Skip to main content

N|Python

CI with install

anaconda-publish Upload Python Package

conda-publish PyPI

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. The mesh is then converted into a h5m file using either the vertices-to-h5m (default) or stl-to-h5m package.

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',
    material_tags=[
        'material_for_volume_1',
        'material_for_volume_2',
        'material_for_volume_3',
        'material_for_volume_4',
        'material_for_volume_5',
        'material_for_volume_6',
        'material_for_volume_7',
        '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.

Metadata

Release files for brep-to-h5m 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brep-to-h5m 0.4.2
File Size Uploaded
brep_to_h5m-0.4.2.tar.gz 26.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for brep-to-h5m 0.4.2
File Interpreter ABI Platform
brep_to_h5m-0.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 34.7 kB

Release files / brep_to_h5m-0.4.2.tar.gz

Download URL brep_to_h5m-0.4.2.tar.gz
Size 26.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b8b7f33e5338be86e6c4038afea26c298dae11d5a3c45ab2f30d80a41c198b0c
BLAKE2b-256 checksum
How to use checksums
5e2da37fd91e968d5d57654400d77b301654efa4369c18b426dfa91b692f387d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / brep_to_h5m-0.4.2-py3-none-any.whl

Download URL brep_to_h5m-0.4.2-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
689a36f59a372c7dc395eda9554f09f1398a08f8cd111ac3f5ae00e4bede25e4
BLAKE2b-256 checksum
How to use checksums
a9bf2b8d904972fefa515a345c1c0000d01a7e7a4d3b2d06f7ef7e7713a70bf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page