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 common simulation functions #43

Merged
merged 10 commits into from
Sep 7, 2023

Conversation

johannesring
Copy link
Collaborator

@johannesring johannesring commented Sep 5, 2023

In this pull request I have added a set of functions in a new file called simulation_common.py. These functions provides various functionalities for mesh and data handling, as well as some flow analysis. Here's a short summary of each function:

  • load_mesh_and_data: Loads mesh, boundary data, and domain data from an HDF5 file.

  • print_mesh_summary: Prints geometric information about a volumetric mesh.

  • load_mesh_info: Loads and processes mesh information from a JSON file, returning various parameters like inlet IDs, outlet IDs, wall ID, mean flow rate, area ratios, and inlet areas. The information in the JSON file is currently not always correct, so this function is not so useful yet.

  • load_probe_points: Loads probe points from a file based on the mesh file's path.

  • print_probe_points: Prints velocity and pressure at specified probe points.

  • peval: Allows parallel synchronized evaluation of a function. This is used for probes.

  • calculate_and_print_flow_properties: Calculates and prints flow properties such as flow rate, velocity, CLF numbers and Reynolds numbers.

Copy link
Collaborator

@keiyamamo keiyamamo left a comment

Choose a reason for hiding this comment

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

Looks very nice! I’ve been meaning to bring up the usage of project for computing CFL number but didn’t have a chance to do it. Yet, I noticed it was extremely slow when I used it for post-processing, so I would really like to avoid using it especially with turtle. Please let me know if you want me to work on this.

src/fsipy/simulations/simulation_common.py Show resolved Hide resolved
src/fsipy/simulations/simulation_common.py Show resolved Hide resolved
src/fsipy/simulations/simulation_common.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@jorgensd jorgensd left a comment

Choose a reason for hiding this comment

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

Some minor comments. In general a very nice and well written PR.

In general I wonder if we should switch print statements with a logger, as it would make it easier to turn on and off such statements.

src/fsipy/simulations/simulation_common.py Outdated Show resolved Hide resolved
src/fsipy/simulations/simulation_common.py Outdated Show resolved Hide resolved
src/fsipy/simulations/simulation_common.py Show resolved Hide resolved
src/fsipy/simulations/simulation_common.py Show resolved Hide resolved
@johannesring
Copy link
Collaborator Author

Thank you both for your comments! I have addressed some of them now and will look at the other comments later.

@johannesring
Copy link
Collaborator Author

I think we have addressed all the comments. Is this ready to be merged? @jorgensd

…flow_properties' functions as recommended by Jørgen
@johannesring johannesring merged commit c05c663 into master Sep 7, 2023
5 checks passed
@johannesring johannesring deleted the johannr/simulation-common-functions branch September 23, 2023 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants