Skip to main content

Converts CAD files to a DAGMC h5m file using Cubit

Project description

N|Python

CircleCI docker based CI

PyPI

codecov

docker-publish-release

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 tagged wih material names, optional imprinted and merging during the process which can speed up particle transport.

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 cad_to_h5m

cad_to_h5m(
    files_with_tags={'filename':'part1.stp', 'material_tags':'m1'},
    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 cad_to_h5m

cad_to_h5m(
    files_with_tags={
        'filename':'part1.stp', 'material_tags':'m1'
        'filename':'part2.stp', 'material_tags':'m2'
    },
    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. Note the .sat file extension.

from cad_to_h5m import cad_to_h5m

cad_to_h5m(
    files_with_tags={'filename':'part1.sat', 'material_tags':'m1'},,
    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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cad_to_h5m-0.1.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

cad_to_h5m-0.1-py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page