Converts Brep CAD geometry files to h5m geometry files compatible with DAGMC simulations
Project description
brep_to_h5m
A Python package that converts Brep CAD geometry files to h5m geometry files compatible with DAGMC simulations.
The method uses gmsh to create a conformal mesh of the geometry and then exports separate volumes to STL files. The stl-to-h5m package then converts the non overlapping STL files into a h5m geometry.
Installation (Conda)
Create a new enviroment and activate the enviroment.
conda create --name my_env
conda activate my_env
Then install this package
conda install -c fusion-energy -c conda-forge brep_to_h5m
The above command should also install moab
and gmsh
Installation (Conda + pip)
Create a new enviroment and activate the enviroment.
conda create --name my_env
conda activate my_env
Install dependancies that are not installed with pip (MOAB and GMSH)
conda install -c conda-forge moab
conda install -c conda-forge gmsh
conda install -c conda-forge python-gmsh
Then install this package
pip install brep_to_h5m
Usage
See the examples folder for a complete workflow from geometry creation to conversion to h5m and then use in and OpenMC simulation.
To make a Brep file with merged surfaces consider using the Paramak as it has a export_brep
method that merges the shared surfaces for Brep files.
Starting with a Brep file that has shared surfaces the following command should produce a DAGMC compatible h5m file.
from brep_to_h5m import brep_to_h5m
brep_to_h5m(
brep_filename='my_brep_file_with_merged_surfaces.brep',
volumes_with_tags={
1: 'material_for_volume_1',
2: 'material_for_volume_2',
3: 'material_for_volume_3',
4: 'material_for_volume_4',
5: 'material_for_volume_5',
6: 'material_for_volume_6',
7: 'material_for_volume_7',
8: 'material_for_volume_8',
},
h5m_filename='dagmc.h5m',
min_mesh_size= 30,
max_mesh_size = 50,
mesh_algorithm = 1,
)
The resulting dagmc.h5m
file can now be used in neutronics simulation with DAGMC enabled transport codes.
Acknowledgement
Many thanks to @makeclean for suggesting gmsh for meshing and Brep for the CAD file format. Also for showing the way forwards by starting gmsh2dagmc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for brep_to_h5m-0.2.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28161572e6876e39930418a40237e10cb874cd9fd71f2a55b5c1c5e95505280c |
|
MD5 | d3f78317d658639e571e7d7d6fbab270 |
|
BLAKE2b-256 | 964a07a9380107823a354bbf19ed7d1f404ad56cda876d67a3101f0a9455c2b0 |