Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add placeholder for the 2/3D Euler CESE solver #403

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

yungyuc
Copy link
Member

@yungyuc yungyuc commented Aug 7, 2024

  • Add the the placeholder modmesh::EulerCore C++ class and wrap it to Python as modmesh.EulerCore.
  • Add the test file tests/test_euler.py

This PR is for issue #404.

* Add the the placeholder `modmesh::EulerCore` C++ class and wrap it to Python as `modmesh.EulerCore`.
* Add the test file `tests/test_euler.py`
@yungyuc yungyuc added the multidim Multi-dimensional solver label Aug 7, 2024
@yungyuc yungyuc self-assigned this Aug 7, 2024
Copy link
Member Author

@yungyuc yungyuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checkin is only to add the placeholder code for the multi-dimensional Euler solver.

@j8xixo12 @tigercosmos @Gene0315 Maybe you will be interested.

namespace modmesh
{

class EulerCore
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solver core for the Euler equation. I hope there is a better name than core, but I haven't got one. I will wait a while before adding code comment block.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Core" sounds fine, unless you have other Euler stuff.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is that core.py is already used. That could be clumsy when making shorthands for local variable names. But I do not have a better idea yet. It's not practical to spend a lot of time pondering a "perfect name". Only time can tell.

@@ -0,0 +1,38 @@
#pragma once
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placeholder header for the new multidim module. But it should just use the modmesh namespace without a sub-namespace.


protected:

WrapEulerCore(pybind11::module & mod, const char * pyname, const char * clsdoc)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the placeholding C++ class available in Python.

@@ -48,6 +49,7 @@ void initialize(pybind11::module_ mod)
initialize_buffer(mod);
initialize_universe(mod);
initialize_mesh(mod);
initialize_multidim(mod);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add code in the multidim directory.


def test_construct(self):
mh = mm.StaticMesh(ndim=2, nnode=0)
mm.EulerCore(mesh=mh, time_increment=0.0)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, add the most basic existence test for the placeholder class.

@yungyuc yungyuc marked this pull request as ready for review August 7, 2024 12:07
@@ -0,0 +1,30 @@
# Copyright (c) 2019, Yung-Yu Chen <[email protected]>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to be 2024.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The year remained in the past because the content was almost identical to the original file it copied from.

namespace modmesh
{

class EulerCore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Core" sounds fine, unless you have other Euler stuff.

namespace python
{

using namespace modmesh; // NOLINT(google-build-using-namespace)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't. Thanks for spotting it. It will be fixed in the next upload.

class EulerCoreTC(unittest.TestCase):

def test_construct(self):
mh = mm.StaticMesh(ndim=2, nnode=0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does mh stand for? I would expect a name that is related to "mesh".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means mesh. Shorthands are important for readability. The shorthand has be used for a couple of years.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I thought the first m meant "modmesh".

Copy link
Member Author

@yungyuc yungyuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary line:

using namespace modmesh; // NOLINT(google-build-using-namespace)

@yungyuc yungyuc merged commit 69a768b into solvcon:multidim Aug 8, 2024
13 checks passed
@yungyuc yungyuc deleted the feature/start-multidim-euler branch August 8, 2024 07:40
@yungyuc yungyuc linked an issue Aug 11, 2024 that may be closed by this pull request
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multidim Multi-dimensional solver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port the 2/3D Euler solver from the legacy solvcon code base
2 participants