Skip to main content

Converts CAD files to a DAGMC h5m file

Project description

N|Python

CI with install Testing package and running examples

CI with model benchmark zoo Testing with Model Benchmark Zoo

Upload Python Package

PyPI

A minimal package that converts CAD geometry to DAGMC h5m files

cad-to-dagmc can create:

  • surface meshes / faceted geometry / triangular meshes
  • unstructured mesh / tetrahedral meshes / volume meshes

cad-to-dagmc can convert:

  • STEP files
  • CadQuery objects (in memory)

cadto-dagmc aims to produce DAGMC compatible h5m files from CAD geometry is intended to convert STEP files or CadQuery objects to a DAGMC compatible h5m file.

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

This package is tested with pytest tests and also the DAGMC geometry made with this package is compared to simulation carried out with native constructive solid geometry, see Model Benchmark Zoo for more details.

Also checkout these other software projects that also create DAGMC geometry CAD-to-OpenMC, Stellarmesh and Coreform Cubit

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 Miniforge option or separately have installed Mamba with conda install -c conda-forge mamba -y

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

mamba create --name new_env python=3.10 -y

Activate the environment

mamba activate new_env

Install the dependencies

mamba install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0

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.

To install OpenMC You can run mamba 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.14.0=dagmc*nompi*"

It might not be possible to install OpenMC and cad-to-dagmc in the same conda/mamba python environment so you may have to create a new conda/mamba environment and install OpenMC there.

Another option would be to install OpenMC from source which would also need compiling with MOAB and DAGMC options.

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.10 -y

Activate the environment

conda activate new_env

Install the dependencies

conda install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0

Then you can install the cad_to_dagmc package with pip

pip install cad_to_dagmc

Usage - with OpenMC

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 supported by DAGMC.

You can run mamba install -c conda-forge openmc however this may choose to install OpenMC without DAGMC included.

You can be more specific with conda/mamba commands to make sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba

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

You could also install OpenMC from source which might be prefered as it can be tricky for the conda enviroment to get resolved.

Usage - creation of DAGMC h5m files

For examples see the examples folder

Usage - simulation with transport code

For examples see the examples folder

For more examples see the CAD tasks in the neutronics-workshop and model benchmark zoo

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

Uploaded Source

Built Distribution

cad_to_dagmc-0.6.0-py3-none-any.whl (9.2 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