Skip to main content

Converts CAD files to a DAGMC h5m file

Project description

N|Python

CI with install

Upload Python Package

PyPI


A minimal package that uses CadQuery functionality to convert CAD geometry to DAGMC h5m files

This particular method of producing DAGMC compatible h5m files from CAD geometry is intended to convert STP files or CadQuery objects to h5m file.

One unique feature of this package is the ability to combine STP files with CadQuery objects. This allows for the addition of parametric geometry to static geometry.

The resulting DAGMC geometry can then be used for simulations in OpenMC or other supported codes.

Installation prerequisite

In principle, any Conda/Mamba distribution will work. A few Conda/Mamba options are:

Install using Mamba and pip

This example assumes you have installed the MambaForge option or separately installed Mamba with conda install -c conda-forge mamba -y

Create a new conda environment, I've chosen Python 3.9 here but new versions are also supported.

mamba create --name new_env python=3.9 -y

Activate the environment

mamba activate new_env

Install the dependencies

mamba install -c cadquery -c conda-forge moab gmsh python-gmsh cadquery=master -y

Then you can install the cad_to_dagmc package with pip

pip install cad_to_dagmc

You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others link to DAGMC documentation.You can run conda install -c conda-forge openmc however this more specific command makes sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba

mamba install -c conda-forge -y "openmc=0.13.3=dagmc*nompi*"

Install using Conda and pip

This example uses Conda to install some dependencies that are not available via PyPi.

Create a new conda environment

conda create --name new_env python=3.9 -y

Activate the environment

conda activate new_env

Install the dependencies

conda install -c cadquery -c conda-forge moab gmsh python-gmsh cadquery=master -y

Then you can install the cad_to_dagmc package with pip

pip install cad_to_dagmc

You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others link to DAGMC documentation.You can run conda install -c conda-forge openmc however this more specific command makes sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba

conda install -c conda-forge -y "openmc=0.13.3=dagmc*nompi*"

Usage - creation of DAGMC h5m files

For examples see the examples folder

Usage - simulation with transport code

For examples see the CAD tasks in the neutronics-workshop

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_dagmc-0.5.0.tar.gz (1.0 MB view hashes)

Uploaded Source

Built Distribution

cad_to_dagmc-0.5.0-py3-none-any.whl (10.4 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