Open shimwell opened 2 years ago
I have added a switch that allows the method to be changed from "pymoab" to "h5py"
This means the h5m output can now be generated using both methods and the neutron transport flux result can be compared.
vertices = [
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0],
]
triangle_groups = [
[[0, 1, 2], [3, 1, 2], [0, 2, 3], [0, 1, 3]]
]
vertices_to_h5m(
vertices=vertices,
triangle_groups=triangle_groups,
material_tags=["mat1"],
h5m_filename=test_h5m_filename,
method = 'pymoab' # or 'h5py'
)
I have also added some tests to this PR so that the the particle flux across the surface meshed geometry is measured and then I can check that both methods give the same result
This should get the enviroment and tests up and runing
git clone https://github.com/fusion-energy/vertices_to_h5m.git
git checkout writing_files_h5py
conda create --name software_help2 python=3.8
conda activate software_help2
conda install -c conda-forge moab
conda install -c conda-forge openmc
pip install h5py
pip install -e .[tests]
This is the file that is being worked on on examples/example_two_volume_h5py.py once this works then I shall refactor the package core.py to allow a 'h5py' method
To develop I've been running two example files to generate two hdf5 files
python examples/example_two_volume_pymoab.py
python examples/example_two_volume_h5py.py
Then I've been comparing the contents of h5m files produced
h5dump pymoab_two_volumes.h5m
h5dump h5py_two_volumes.h5m
I've just added a simple test file that lives in the repo root and allows these two h5m files to be tested. This looks for tags and also uses the geometry in particle simulations. It is not part of the CI as it makes use of these two h5m files generated above.
pytest test_h5m_files.py
@nschloe this should be the minimal setup and testing needed to prototype. Feel free to update the python examples/example_two_volume_h5py.py
script to get us closer to the end goal
A detailed description of h5m groups and their contents can be found here https://sigma.mcs.anl.gov/moab/h5m-file-format/
note to self, tests failing with error message RuntimeError: MOAB ErrorCode: MB_TAG_NOT_FOUND
Thanks to Patrick for mentioning a couple of sources that describe the dagmc file metadata
https://svalinn.github.io/DAGMC/contribute/devtheory.html#dagmc-setup
https://svalinn.github.io/DAGMC/contribute/devtheory.html#dagmc-metadata
https://sigma.mcs.anl.gov/moab/h5m-file-format/
And Paul
@cfe316 this is one of the developments that might help make a smoother DAGMC workflow
This PR is work in progress, but the end goal is to offer another method of writing DAGMC compatible h5m files using h5py.