Skip to content
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

progress on h5py method #12

Open
wants to merge 52 commits into
base: main
Choose a base branch
from
Open

progress on h5py method #12

wants to merge 52 commits into from

Conversation

shimwell
Copy link
Member

@shimwell shimwell commented Oct 21, 2022

This PR is work in progress, but the end goal is to offer another method of writing DAGMC compatible h5m files using h5py.

@shimwell
Copy link
Member Author

shimwell commented Oct 21, 2022

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

@shimwell
Copy link
Member Author

shimwell commented Oct 25, 2022

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]

@shimwell
Copy link
Member Author

shimwell commented Oct 25, 2022

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

@shimwell
Copy link
Member Author

shimwell commented Oct 25, 2022

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

@shimwell shimwell linked an issue Oct 25, 2022 that may be closed by this pull request
vertices_to_h5m/core.py Outdated Show resolved Hide resolved
vertices_to_h5m/core.py Outdated Show resolved Hide resolved
vertices_to_h5m/core.py Outdated Show resolved Hide resolved
vertices_to_h5m/core.py Outdated Show resolved Hide resolved
vertices_to_h5m/core.py Outdated Show resolved Hide resolved
vertices_to_h5m/core.py Outdated Show resolved Hide resolved
@shimwell
Copy link
Member Author

shimwell commented Mar 2, 2023

@cfe316 this is one of the developments that might help make a smoother DAGMC workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

making h5m files with h5py
2 participants