-
Notifications
You must be signed in to change notification settings - Fork 37
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
[WIP]: Cell Count Example #734
Open
Yurlungur
wants to merge
12
commits into
develop
Choose a base branch
from
jmm/count-cells
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Yurlungur
requested review from
brryan,
forrestglines,
jdolence,
lroberts36 and
pgrete
October 3, 2022 03:50
Yurlungur
commented
Oct 3, 2022
Comment on lines
+25
to
+26
author="The Parthenon Team", | ||
author_email="", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Josh Brown has moved on so his email should probably not be here. That said, should we have an official Parthenon email?
@pgrete just a ping on this. I think there's a higher-level discussion to be had about this capability. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
I recently wanted to scope out a simulation cost, and thought "why not let Parthenon do the work for me?" That led me to developing this cute little example, which I figured I'd push upstream. The idea here is to have Parthenon generate a mesh tree/hierarchy based on some estimated needed resolution (say 100m resolution for a neutron star) in some region (say a sphere of some radius) without actually allocating any variables. Then have Parthenon report how big the mesh is.
The way I implement this is I create a package with no variables, but a custom mesh refinement check that checks to see if the desired resolution has been reached in the desired region. (Just for simplicity, this is hardcoded to a sphere. I'm not trying to create a full-featured capability here. If you want to spec something out other than a single isolated star, I think you could use this example as a jumping off point pretty easily.)
The example has no driver. I just init packages and mesh, run a loop through the mesh to count total number of cells heuristically, and print the results. Results can also be saved to a text file.
To visualize the mesh structure, I also wrote a little script that can read a
phdf
file and plot the meshblocks as rectangles, similar to themovie2d
script. I initialize outputs in my little example (no driver so it must be done manually) and spit out an hdf5 file if requested. I found that by far the slowest part the calculation was outputting the mesh---in particular, the coordinates grids. So I added a new hdf5 output type, which I callgridh5
. This is the standardphdf
format, but instead of outputting full cell and face coordinates, it just outputs the minimum and maximum face coordinate values for each meshblocks. To do so I had to make a few one-line changes (and some indentation) to theparthenon_hdf5
output.Outputs visualized with my little script, which I called
plot_mesh.py
look like this:Those boxes are meshblocks, not cells. This particular grid had 32^3 meshblocks. This is an X3=0 slice. Grids with cell counts of 100s of millions of cells can be generated and visualized in less than a minute.
I hooked this machinery into regression tests, but because I didn't want to deal with a new gold file release, I didn't hook the
gridh5
into the regression tests, just a cell count.PR Checklist