Skip to main content

Converts CAD files to a DAGMC h5m file

Project description

N|Python

CI with Conda install Testing package and running examples with dependencies installed via Conda

CI with pip install Testing package and running examples with dependencies installed vua PIP

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)

cad-to-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 options

  • Install using Mamba
  • Install using Conda
  • Install using pip and source compilations

Install using Mamba

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

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 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

Then you can install the cad_to_dagmc package

mamba install -y -c conda-forge cad_to_dagmc

Install using Conda

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

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

conda create --name new_env python=3.10 -y

Activate the environment

conda activate new_env

Then you can install the cad_to_dagmc package

conda install -y -c conda-forge cad_to_dagmc

Install using pip and source compilations

It is also possible to avoid the use of conda/mamba and installing using pip.

First ensure hdf5 is installed as this is needed by MOAB pip install command

sudo apt-get install libhdf5-dev

Then clone the latest version of MOAB and cd into the moab directory.

git clone  master https://bitbucket.org/fathomteam/moab/
cd moab

Ensure pip is up to date as a new version is needed

python -m pip install --upgrade pip

Run the pip install command with cmake arguments.

pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON

Then you can install the cad_to_dagmc package with pip

pip install cad_to_dagmc

Install with OpenMC or other particle transport codes

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.

Known incompatibilities

The package requires newer versions of Linux. For example the package does not work on Ubuntu 18.04 or older.

The package requires newer versions of pip. It is recommended to ensure that your version of pip is up to date. This can be done with python -m pip install --upgrade pip

Installing one of the package dependancies (gmsh) with pip appears to result in errors when passing cad objects in memory between cadquery / ocp and gmsh. The default method of passing cad objects is via file so this should not impact most users. The conda install gmsh appears to work fine with in memory passing of cad objects as the version of OCP matches between Gmsh and CadQuery.

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

Uploaded Source

Built Distribution

cad_to_dagmc-0.7.4-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file cad_to_dagmc-0.7.4.tar.gz.

File metadata

  • Download URL: cad_to_dagmc-0.7.4.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for cad_to_dagmc-0.7.4.tar.gz
Algorithm Hash digest
SHA256 4a48635ba5b81d20b6ea306d8bf464c38e138fda8ef09e32fcf6d21bdb4a2c2c
MD5 aa36ea29922244effff13f2a10efb31b
BLAKE2b-256 49c8e9fdf5a9703e802a10ba9a4727f39af659cd5350fc4b43c2f9d87552259f

See more details on using hashes here.

File details

Details for the file cad_to_dagmc-0.7.4-py3-none-any.whl.

File metadata

  • Download URL: cad_to_dagmc-0.7.4-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for cad_to_dagmc-0.7.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1d2e7f7243241de065922351384fbe17c5e6980c5196cc6e719277c11563598c
MD5 0d417e6687bac3a1237fa6376c1ee00b
BLAKE2b-256 a72a280cfd2972d3ee65f9226985a2e116c2408732be7b6f2ef2845b2d48b2a3

See more details on using hashes here.

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