Converts CAD files to a DAGMC h5m file using Cubit
Project description
This is a minimal Python package that provides both command line and API interfaces for converting multiple CAD files (STP and SAT format) into a DAGMC h5m file using the Cubit Python API.
This is useful for creating the DAGMC geometry for use in compatible neutronics codes such as OpenMC, FLUKA and MCNP.
The geometry is imprinting or merging during the process which can speed up particle transport.
Command line usage
Perhaps the most common use of this program is to convert a STP file into DAGMC geometry.
cad-to-h5m -i part1.stp -o dagmc.h5m -t mat:1 -c /opt/Coreform-Cubit-2020.2/bin/python3/
- the
-i
or--input
argument specifies the input CAD filename(s) - the
-o
or--output
argument specifies the output h5m filename - the
-t
or--tags
argument specifies the tags to apply to the CAD volumes. - the
-c
or--cubit
argument specifies the path to the Cubit python3 folder - the
-v
or--verbose
argument enables (true) or disables (false) the printing of additional details
Multiple STP or SAT files can also be combined and converted into a DAGMC geometry. This example combines two STP files into a single geometry with seperate material tags for each STP file and saves the result as a h5m file.
cad-to-h5m -i part1.stp part2.stp -o dagmc.h5m -t mat:1 mat:2 -c /opt/Coreform-Cubit-2020.2/bin/python3/
It is also possible to convert .sat files in the following way.
cad-to-h5m -i part1.sat -o dagmc.h5m -t mat:1 -c /opt/Coreform-Cubit-2020.2/bin/python3/
Python API usage
Creating a h5m file from a single STP file called part1.stp
and applying
a material tag to the volume.
from cad_to_h5m import stp_converter
stp_converter(
input='part1.stp',
output='dagmc.h5m',
tags='mat:1',
cubit_path='/opt/Coreform-Cubit-2020.2/bin/python3/'
)
Creating a h5m file from two STP files called part1.stp
and part2.stp
.
Both parts have distinct material tag applied to them and the result is output
as a h5m file.
from cad_to_h5m import stp_converter
stp_converter(
input=['part1.stp', 'part2.stp'],
output='dagmc.h5m',
tags=['mat:1', 'mat:2'],
cubit_path='/opt/Coreform-Cubit-2020.2/bin/python3/'
)
Creating a h5m file from a single SAT is a similar process.
from cad_to_h5m import sat_converter
sat_converter(
input='part1.sat',
output='dagmc.h5m',
tags='mat:1',
cubit_path='/opt/Coreform-Cubit-2020.2/bin/python3/'
)
Installation
The package is available via the PyPi package manager and the recommended method of installing is via pip.
pip install cad_to_h5m
Some Python dependencies (such as Numpy) are installed during the pip install cad_to_h5m
process, however Cubit needs to be installed seperatly to make full use of this package.
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 cad_to_h5m-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa554297f39c41adf78c19afb03d659d0748975c3d82648c00510d936620de75 |
|
MD5 | 2bc760d6a4f7aada07e88a9f9e73d47f |
|
BLAKE2b-256 | 09b725ca818d846e42cff7a44d154872abfe80de33ea0d525011ff0c2f6f8812 |