cad-to-dagmc

Convert CAD geometry (STP files) or Cadquery assemblies to DAGMC h5m files

https://github.com/fusion-energy/cad_to_dagmc

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.4%) to scientific vocabulary

Keywords

cad converter dagmc mesh neutronics openmc

Keywords from Contributors

neutron photon h5m fispact mcnp serpent conversion convert normalization units
Last synced: 6 months ago · JSON representation ·

Repository

Convert CAD geometry (STP files) or Cadquery assemblies to DAGMC h5m files

Basic Info
  • Host: GitHub
  • Owner: fusion-energy
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 4.96 MB
Statistics
  • Stars: 33
  • Watchers: 3
  • Forks: 10
  • Open Issues: 16
  • Releases: 27
Topics
cad converter dagmc mesh neutronics openmc
Created over 3 years ago · Last pushed 10 months ago
Metadata Files
Readme License Citation

README.md

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, unstructured mesh files (vtk) and Gmsh (msh) files ready for use in neutronics simulations.

cad-to-dagmc can create DAGMC compatible: - surface meshes / faceted geometry / triangular meshes - unstructured mesh / tetrahedral meshes / volume meshes

cad-to-dagmc can convert the following in to DAGMC compatible meshes: - STEP files - CadQuery objects (optionally use names as material tags) - Gmsh meshes (optionally use physical groups as material tags)

Cad-to-dagmc offers a wide range of features including. - Compatibly with assembly-mesh-plugin (see examples) - Access to the Gmsh mesh to allow user to define full set of mesh parameters - Option to use Gmsh physical groups as material tags - Geometry scaling with scale_factor argument - Model wide mesh size parameters with min_mesh_size and max_mesh_size arguments - Volume specific mesh sizing parameters with the set_size argument - Unstructured mesh that share the same coordinates as the surface mesh. - Volume mesh allows selecting individual volumes in the geometry. - Parallel meshing to quickly mesh the geometry using multiple CPU cores - Imprint and merging of CAD geometry, or disable with the imprint argument - Add geometry from multiple sources (STEP files, CadQuery objects and Gmsh meshes) - Ability to tag the DAGMC implicit complement material using the implicit_complement_material_tag argument - Selected different Gmesh mesh algorithms (defaults to 1) using the mesh_algorithm argument - Pass CadQuery objects in memory for fast transfer of geometry using the method argument - Easy to install with pip and Conda/Mamba - Well tested both with CI unit tests, integration tests and the CSG Model Benchmark Zoo. - Compatible with Paramak geometry for fusion simulations.

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: - Miniforge (recommended as it includes mamba) - Anaconda - Miniconda

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. bash mamba create --name new_env python=3.10 -y

Activate the environment bash mamba activate new_env

Then you can install the cadtodagmc package bash 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: - Miniforge (recommended as it includes mamba) - Anaconda - Miniconda

Create a new environment, I've chosen Python 3.10 here but newer versions are also supported. bash conda create --name new_env python=3.10 -y

Activate the environment bash conda activate new_env

Then you can install the cadtodagmc package bash 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 install MOAB, currently available from the repo.

pip install git+https://bitbucket.org/fathomteam/moab/

Then you can install the cadtodagmc package with pip

bash 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 bash mamba install -c conda-forge -y "openmc=0.15.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

For examples showing creation of DAGMC h5m files, vtk files and usage within OpenMC transport code see the examples folder

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

Related software

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

Owner

  • Name: Fusion Energy
  • Login: fusion-energy
  • Kind: organization

A collection of software projects related to fusion energy

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Shimwell"
  given-names: "Jonathan"
  orcid: "https://orcid.org/0000-0001-6909-0946"
title: "CAD to DAGMC. Convert CAD geometry (STP files) or Cadquery assemblies to DAGMC h5m files"
version: 0.7.0
date-released: 2024-4-14
url: "https://github.com/fusion-energy/cad_to_dagmc"

GitHub Events

Total
  • Issues event: 5
  • Watch event: 9
  • Issue comment event: 8
  • Push event: 33
  • Pull request review comment event: 1
  • Pull request event: 1
  • Fork event: 6
Last Year
  • Issues event: 5
  • Watch event: 9
  • Issue comment event: 8
  • Push event: 33
  • Pull request review comment event: 1
  • Pull request event: 1
  • Fork event: 6

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 131
  • Total Committers: 3
  • Avg Commits per committer: 43.667
  • Development Distribution Score (DDS): 0.206
Top Committers
Name Email Commits
Jonathan Shimwell m****l@j****m 104
shimwell s****l@u****m 26
Jonathan Shimwell d****l@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 29
  • Total pull requests: 108
  • Average time to close issues: 3 months
  • Average time to close pull requests: 6 days
  • Total issue authors: 12
  • Total pull request authors: 3
  • Average comments per issue: 2.69
  • Average comments per pull request: 0.25
  • Merged pull requests: 96
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 10
  • Pull requests: 39
  • Average time to close issues: 20 days
  • Average time to close pull requests: 1 day
  • Issue authors: 4
  • Pull request authors: 3
  • Average comments per issue: 1.2
  • Average comments per pull request: 0.28
  • Merged pull requests: 33
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • shimwell (12)
  • gglamzn (3)
  • connoramoreno (2)
  • jon-proximafusion (2)
  • ParticleTruthSeeker (2)
  • rherrero-pf (1)
  • emaartensson (1)
  • rlbarker (1)
  • RemDelaporteMathurin (1)
  • ctrossei (1)
  • Adambar24 (1)
  • msavtchouk-pf (1)
Pull Request Authors
  • shimwell (122)
  • jon-proximafusion (4)
  • connoramoreno (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 2,577 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 0
  • Total versions: 29
  • Total maintainers: 2
pypi.org: cad-to-dagmc

Converts CAD files to a DAGMC h5m file

  • Versions: 29
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 2,577 Last month
Rankings
Dependent packages count: 2.9%
Downloads: 11.0%
Average: 20.1%
Stargazers count: 25.5%
Forks count: 30.5%
Dependent repos count: 30.6%
Maintainers (2)
Last synced: 6 months ago

Dependencies

.github/workflows/anaconda-publish.yml actions
  • actions/checkout v2 composite
.github/workflows/black.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • stefanzweifel/git-auto-commit-action v4 composite
.github/workflows/ci_with_install.yml actions
  • actions/checkout v2 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
pyproject.toml pypi
  • networkx *
  • trimesh *
.github/workflows/ci_with_benchmarks.yml actions
  • actions/checkout v3 composite