-
Notifications
You must be signed in to change notification settings - Fork 2
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
making h5m files with h5py #10
Comments
Alternatively, h5py routines could be written into this package to take the vertices and triangles and write them directly to h5m files. Perhaps something like this is a starting point import numpy as np
import h5py
vertices = np.array(
[
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0],
]
)
triangles = [
np.array([[0, 1, 2], [3, 1, 2], [0, 2, 3], [0, 1, 3]]),
]
f = h5py.File("one_volume.h5m", "w")
tstt = f.create_group("tstt")
elements = tstt.create_group("elements")
nodes = tstt.create_group("nodes")
coords = nodes.create_dataset("coordinates", data=vertices)
sets = tstt.create_group("sets")
tags = tstt.create_group("tags") |
To test the resulting h5m file works in openmc I have a few test cases as part of the CI that will check that the material tags are visible to DAGMC and that neutrons can be transported through the geometry. So any solution to this issue can be tested against these test cases |
just to note the triangle sets need tagging with a string that is encoded. here is an example of decoding https://github.com/openmc-dev/openmc/blob/dff3ad48f1e9f7f3bc9cb74675613d1ae3d8bb60/openmc/universe.py#L717-L728 |
The package currently uses pymoab
However it might be possible to use h5py
This would have the advantage of being pip installable and faster.
The data structure needed for a DAGMC compatible h5m file is shown here https://sigma.mcs.anl.gov/moab/h5m-file-format/
meshio is able to make h5m files, but these have never quite worked in the simulation code we make the h5m files for (dagmc/openmc).
It would be great to add to meshio so that the h5m files produced work in neutronics simulations.
The h5m files produced by this package work in neutronics simulations so could be used to provide a simple comparison as we can make a simple set of vertices and triangles into a dagmc/openmc compatible h5m file and compare it to the output from meshio and see what is missing
The text was updated successfully, but these errors were encountered: