Import and export meshes

Hello Everyone!
I’m going to do the coupling of openmc and thermal calculation code and I want to use unstructured mesh to complete the data transfer. So I want to know the mesh types supported by openmc for import and export and if I can update the temperature and density distribution of the model by importing the mesh.
Thank you!

I just noticed this is your first post, welcome to the community Jacob :tada:

Unstructured mesh file Formats supported are exodus and h5

One could produce a tetrahedral mesh using Cubit, save as a h5 file, make sure dagmc is included in the openmc binary (either via conda or compilation), use the h5 file as shown by the unstructured example notebooks.
openmc.UnstructuredMesh(“filename.h5”, library=‘moab’)

Alternatively one could produce a mesh in Exodus and save it in .exo format. Make sure libmesh is included in the openmc binary (not currently available with conda, possible via the compile route). Use the exo file as shown in the unstructured example notebooks.
openmc.UnstructuredMesh(“filename.exo”, library=‘libmesh’)

I think temperature and density distributions on an unstructured mesh are not currently possible but something that is being worked on. C++ source code changes would be needed to get this feature working. I know of at least on molten salt reactor design that is keen on seeing this feature as well and I think there are some plans to add it in the future. Tagging @pshriwise who might be able to share more information on this development.

Thanks for your answering!

If I want to get some solution data under the mesh, can I export the data with the node coordinates in a text file?

If it helps then centroids can be accessed as the UnstructuredMesh class has a centroid method

https://docs.openmc.org/en/latest/pythonapi/generated/openmc.UnstructuredMesh.html?highlight=UnstructuredMesh#openmc.UnstructuredMesh.centroid

Thank you @Shimwell
Yeah, the coordinate output of the centroid is really helpful, then can I export the solution data as well? For instance, the flux. I’m thinking that maybe I could make it with the aid of some post-processing software.

Hi @Jacob!

Thanks for using some of the unstructured mesh capabilities in OpenMC.

For exporting mesh coordinates (and element data) I’d recommend having a look at the UnstructuredMesh.write_data_to_vtk method in the Python API. Element-wise mesh data can be extracted from statepoint files using the standard classes/method and applied to a VTK mesh for visualization using that method.

Regarding temperature and density distributions that are defined on the mesh and used during transport: As @Shimwell mentioned, this is something we’re interested in for work related to MSR modeling and we’re hoping to start in on it soon. I can keep you updated on it if you like. We’ll also be discussing it at the OpenMC monthly drop-in meetings I’m sure. OpenMC monthly drop in session dates 2022 - #12 by pshriwise

(Note that we’re canceling the one in Dec. and will start again in January.)

I hope this was helpful!

– Patrick

Thank you @pshriwise!

I think the temperature and density distributions that are defined on the mesh and used during transport can play a great role in multiphysics coupling, which will make Openmc more powerful.Thanks again for considering this function.

And for the current research, although the refined unstructured mesh can be used to export data, the cell mode can only be used to import data(temperature or density), so I may eventually adopt the “cell to cell” coupling mode.

Hi @Jacob - I’ll add a bit more information about current C++ efforts.

We are developing a C++ - based coupling of OpenMC to thermal calculation codes. Temperature and density can be applied to an OpenMC model using an unstructured mesh using Cardinal, an open-source code that couples OpenMC to MOOSE finite element calculations. Using Cardinal, OpenMC has been coupled to heat conduction and Computational Fluid Dynamics (CFD) physics. Depending on your use case, Cardinal may provide what you are looking for (or at least a place to learn more about mesh-based multiphysics).

Hi @April

Thanks for your answer. Yeah, I’ll take some research about Cardinal and I’m sure it can help me a lot.