-
Notifications
You must be signed in to change notification settings - Fork 509
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
get UnstructuredMesh centroids and volumes without loading from statepoint #2929
Comments
A good thought. I'm sure you can imagine why this is difficult from the Python API as the libraries we rely on for unstructured mesh (MOAB and libMesh) interact with OpennMC through a C++ interface. The mesh volumes are already exposed through the CAPI in the A valid OpenMC problem would still need to be defined and loaded before determining your mesh source strengths, but maybe it's still useful? |
latest attempt
|
At the end, perhaps try: |
Thanks Patrick It is a bit tricky with the need to include the mesh in the model so that openmc.lib can find it. Originally I tried to include it in the model via a MeshSource but that didn't work and raised the error
So I shall include the mesh via a tally and then I should be able to get the fully populated unstrucutred mesh object and then I should be able to make a meshSource from it. Adding centroids would be great. I think longer term we might want to add some extra code to meshSource or settings.source to simplify the process of having a meshsource with and unstrucutred mesh |
update. I tried reading the unstructured mesh in from the statepoint and did get populated centroids and volumes. However it appears that an unstrucutred mesh can't be used as a mesh for an openmc.MeshSource. When trying to use a umesh read in from the statepoint we get the AttributeError
I tried to add that attribute with but this just raised a type error when trying to write the xml
I have a not so minimal example over here if it helps |
Glad to hear that reading the volumes and centroids went alright @shimwell! It seems we are in fact missing the indices property for the The reason that the population of the indices attribute you have above isn't working is because that property is expected to be a tuple of indices. See https://docs.openmc.org/en/latest/pythonapi/generated/openmc.RegularMesh.html?highlight=meshbase#openmc-regularmesh Hopefully that helps you move forward in the meantime. |
Thanks Patrick and Paul (on slack), I appreciate your help going through some of these less trodden workflows. I changed
to
in my example and it now writes the model.xml file, so it does get past that indices check. The code still fails on the run command as now later in the code it recieves a tuple with three values when unstructured meshes have 1D indexing.
So I guess the |
Would it be possible to keep this issue open till that |
Yep yep. Hopefully I'll be able to close that out soon! |
Description
It would be useful if we can get mesh information such as volumes and centroids of the unstructured mesh. Currently this is possible if one loads in an unstructured mesh from a statepoint file but not if an UnstructuredMesh is instantiated in python like this
This would be useful as knowing the centroids or volumes could help with defining a openmc.MeshSource. It would also bring the UnstructuredMesh behaviour more inline with the other meshes such as RegularMesh
Alternatives
We write the UnstructuredMesh to a statepoint file, then read in the statepoint file and get the UnstructuredMesh from hdf5 then it contains centroids and volume information
Compatibility
this would maintain the same api usage
The text was updated successfully, but these errors were encountered: