cad-to-dagmc 0.7.3__tar.gz → 0.9.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cad-to-dagmc might be problematic. Click here for more details.

Files changed (68) hide show
  1. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/.github/workflows/ci_with_benchmarks.yml +30 -14
  2. cad_to_dagmc-0.9.3/.github/workflows/ci_with_conda_install.yml +91 -0
  3. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/.github/workflows/ci_with_pip_install.yml +12 -8
  4. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/PKG-INFO +39 -35
  5. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/README.md +33 -31
  6. cad_to_dagmc-0.9.3/examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py +105 -0
  7. cad_to_dagmc-0.9.3/examples/surface_mesh/different_resolution_meshes.py +44 -0
  8. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/from_gmsh_mesh_file.py +7 -9
  9. cad_to_dagmc-0.9.3/examples/surface_mesh/from_gmsh_mesh_file_with_tags.py +44 -0
  10. cad_to_dagmc-0.9.3/examples/surface_mesh/from_gmsh_object_with_tag.py +26 -0
  11. cad_to_dagmc-0.9.3/examples/surface_mesh/tagged_mesh.msh +3445 -0
  12. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +1 -1
  13. cad_to_dagmc-0.9.3/examples/unstrucutred_volume_mesh/different_resolution_meshes.py +44 -0
  14. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +2 -2
  15. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/pyproject.toml +11 -4
  16. cad_to_dagmc-0.9.3/src/_version.py +34 -0
  17. cad_to_dagmc-0.9.3/src/cad_to_dagmc/core.py +1036 -0
  18. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/src/cad_to_dagmc.egg-info/PKG-INFO +39 -35
  19. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/src/cad_to_dagmc.egg-info/SOURCES.txt +10 -0
  20. cad_to_dagmc-0.9.3/src/cad_to_dagmc.egg-info/requires.txt +10 -0
  21. cad_to_dagmc-0.9.3/tests/tagged_mesh.msh +3445 -0
  22. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/test_file_creation.py +25 -14
  23. cad_to_dagmc-0.9.3/tests/test_get_volumes.py +89 -0
  24. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/test_h5m_in_transport.py +64 -16
  25. cad_to_dagmc-0.9.3/tests/test_kwarg_args.py +229 -0
  26. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/test_loading_from_file_vs_shape_object.py +0 -2
  27. cad_to_dagmc-0.9.3/tests/test_mesh_to_dagmc.py +106 -0
  28. cad_to_dagmc-0.9.3/tests/test_python_api.py +434 -0
  29. cad_to_dagmc-0.7.3/.github/workflows/ci_with_conda_install.yml +0 -65
  30. cad_to_dagmc-0.7.3/src/_version.py +0 -16
  31. cad_to_dagmc-0.7.3/src/cad_to_dagmc/core.py +0 -668
  32. cad_to_dagmc-0.7.3/src/cad_to_dagmc.egg-info/requires.txt +0 -9
  33. cad_to_dagmc-0.7.3/tests/test_python_api.py +0 -140
  34. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/.github/workflows/black.yml +0 -0
  35. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/.github/workflows/python-publish.yml +0 -0
  36. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/.gitignore +0 -0
  37. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/CITATION.cff +0 -0
  38. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/LICENSE +0 -0
  39. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/cadquery_assembly.py +0 -0
  40. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +0 -0
  41. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/cadquery_compound.py +0 -0
  42. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
  43. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/cadquery_text.py +0 -0
  44. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
  45. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
  46. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/multiple_stp_files.py +0 -0
  47. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/single_cadquery_object.py +0 -0
  48. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/single_stp_file.py +0 -0
  49. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
  50. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/setup.cfg +0 -0
  51. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/src/cad_to_dagmc/__init__.py +0 -0
  52. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
  53. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
  54. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
  55. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/ball_reactor.brep +0 -0
  56. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/curved_extrude.stp +0 -0
  57. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/extrude_rectangle.stp +0 -0
  58. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/multi_volume_cylinders.stp +0 -0
  59. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/one_cube.brep +0 -0
  60. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/single_cube.stp +0 -0
  61. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/single_volume_thin.stp +0 -0
  62. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/single_volume_thin.vtk +0 -0
  63. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/test_brep_file.brep +0 -0
  64. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/test_two_joined_cubes.brep +0 -0
  65. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/test_two_sep_cubes.brep +0 -0
  66. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/test_version.py +0 -0
  67. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/two_connected_cubes.stp +0 -0
  68. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.9.3}/tests/two_disconnected_cubes.stp +0 -0
@@ -19,32 +19,48 @@ on:
19
19
  jobs:
20
20
  testing:
21
21
  runs-on: ubuntu-latest
22
+
22
23
  steps:
23
24
  - name: Checkout repository
24
25
  uses: actions/checkout@v4
25
26
 
26
- - name: install dependencies and run CSG / DAMGC benchmarks
27
- env:
28
- OPENMC_CROSS_SECTIONS: /home/runner/work/cad_to_dagmc/cad_to_dagmc/cross_sections.xml
29
- shell: bash
27
+ - name: Install system packages
30
28
  run: |
31
- wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
32
- bash Miniforge3.sh -b -p "${HOME}/conda"
33
- source "${HOME}/conda/etc/profile.d/conda.sh"
34
- source "${HOME}/conda/etc/profile.d/mamba.sh"
35
- sudo apt-get --allow-releaseinfo-change update
36
29
  sudo apt-get update -y
37
30
  sudo apt-get upgrade -y
38
31
  sudo apt-get install -y libgl1 libglx-mesa0 libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0
39
- mamba activate
40
- mamba install -y -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh
32
+
33
+ - name: Set up Miniforge
34
+ run: |
35
+ wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-$(uname -m).sh"
36
+ bash Miniforge3.sh -b -p "${HOME}/miniforge"
37
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
38
+ conda init bash
39
+ conda config --set always_yes yes --set changeps1 no
40
+ conda update -q conda
41
+
42
+ - name: Create and activate Conda environment
43
+ run: |
44
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
45
+ conda create -n ci-env python=3.11
46
+ conda activate ci-env
47
+ conda install -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh vtk
48
+ python -m pip install .[tests]
49
+ python -m pip install git+https://github.com/svalinn/pydagmc
50
+ python -m pip install git+https://github.com/jmwright/cadquery-direct-mesh-plugin
51
+
52
+ - name: Run tests
53
+ shell: bash -l {0}
54
+ env:
55
+ OPENMC_CROSS_SECTIONS: /home/runner/work/cad_to_dagmc/cad_to_dagmc/cross_sections.xml
56
+ run: |
57
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
58
+ conda activate ci-env
41
59
  python -m ensurepip --upgrade
42
60
  python -m pip install . --no-deps
43
61
  python -m pip install openmc_data_downloader
44
- openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9
62
+ openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9 Al27
45
63
  git clone --single-branch -b main --depth 1 https://github.com/fusion-energy/model_benchmark_zoo.git
46
64
  cd model_benchmark_zoo
47
65
  python -m pip install .[tests]
48
- conda env export > environment.yml
49
- cat environment.yml
50
66
  pytest tests/test_cad_to_dagmc -v
@@ -0,0 +1,91 @@
1
+
2
+ # This CI does includes particle transport tests as openmc is installed
3
+
4
+ name: CI with Conda install
5
+
6
+ on:
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ paths-ignore:
11
+ - 'docs/**'
12
+ - '.gitignore'
13
+ - '*.md'
14
+ - 'CITATION.cff'
15
+ - 'LICENSE.txt'
16
+ - 'readthedocs.yml'
17
+ push:
18
+ branches:
19
+ - main
20
+
21
+ jobs:
22
+ testing:
23
+ runs-on: ubuntu-latest
24
+
25
+ steps:
26
+ - name: Checkout repository
27
+ uses: actions/checkout@v4
28
+
29
+ - name: Install system packages
30
+ run: |
31
+ sudo apt-get update -y
32
+ sudo apt-get upgrade -y
33
+ sudo apt-get install -y libgl1 libglx-mesa0 libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0
34
+ - name: Set up Miniforge
35
+ run: |
36
+ wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-$(uname -m).sh"
37
+ bash Miniforge3.sh -b -p "${HOME}/miniforge"
38
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
39
+ conda init bash
40
+ conda config --set always_yes yes --set changeps1 no
41
+ conda update -q conda
42
+
43
+ - name: Create and activate Conda environment
44
+ run: |
45
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
46
+ conda create -n ci-env python=3.11
47
+ conda activate ci-env
48
+ conda install -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh vtk
49
+ python -m pip install .[tests]
50
+ python -m pip install git+https://github.com/svalinn/pydagmc
51
+ python -m pip install git+https://github.com/jmwright/cadquery-direct-mesh-plugin
52
+
53
+ - name: Test import
54
+ shell: bash -l {0}
55
+ run: |
56
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
57
+ conda activate ci-env
58
+ python -c "import cad_to_dagmc"
59
+
60
+ - name: Run tests
61
+ shell: bash -l {0}
62
+ run: |
63
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
64
+ conda activate ci-env
65
+ pytest -v tests
66
+
67
+ - name: Run examples
68
+ shell: bash -l {0}
69
+ run: |
70
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
71
+ conda activate ci-env
72
+ python examples/surface_mesh/cadquery_assembly.py
73
+ python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
74
+ python examples/surface_mesh/cadquery_compound.py
75
+ python examples/surface_mesh/cadquery_object_and_stp_file.py
76
+ python examples/surface_mesh/cadquery_text.py
77
+ python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
78
+ python examples/surface_mesh/from_gmsh_mesh_file.py
79
+ python examples/surface_mesh/from_gmsh_mesh_file_with_tags.py
80
+ python examples/surface_mesh/from_gmsh_object_with_tag.py
81
+ python examples/surface_mesh/multiple_cadquery_objects.py
82
+ python examples/surface_mesh/multiple_stp_files.py
83
+ python examples/surface_mesh/single_cadquery_object.py
84
+ python examples/surface_mesh/single_stp_file_multiple_volumes.py
85
+ python examples/surface_mesh/single_stp_file.py
86
+ python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
87
+ python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
88
+ python examples/unstrucutred_volume_mesh/different_resolution_meshes.py
89
+ python examples/surface_mesh/different_resolution_meshes.py
90
+ python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
91
+ python examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py
@@ -36,26 +36,30 @@ jobs:
36
36
  apt-get install -y libblas-dev liblapack-dev libgl1 libglx-mesa0 libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0 libxcursor-dev libxft2 libxinerama-dev make cmake libeigen3-dev
37
37
  apt install python3
38
38
  apt install python3-pip
39
- python -m pip install --upgrade pip
40
- git clone --single-branch -b master --depth 1 https://bitbucket.org/fathomteam/moab/
41
- cd moab
42
- python -m pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
43
- cd ..
39
+ python -m pip install --extra-index-url https://shimwell.github.io/wheels moab
44
40
  python -c "import pymoab"
45
41
  python -m pip install .[tests]
42
+ python -m pip install git+https://github.com/svalinn/pydagmc
43
+ python -m pip install git+https://github.com/jmwright/cadquery-direct-mesh-plugin
46
44
  python -c "import cad_to_dagmc"
47
45
  pytest -v tests
48
46
  python examples/surface_mesh/cadquery_assembly.py
47
+ python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
49
48
  python examples/surface_mesh/cadquery_compound.py
50
49
  python examples/surface_mesh/cadquery_object_and_stp_file.py
51
50
  python examples/surface_mesh/cadquery_text.py
52
51
  python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
52
+ python examples/surface_mesh/from_gmsh_mesh_file.py
53
+ python examples/surface_mesh/from_gmsh_mesh_file_with_tags.py
54
+ python examples/surface_mesh/from_gmsh_object_with_tag.py
53
55
  python examples/surface_mesh/multiple_cadquery_objects.py
54
56
  python examples/surface_mesh/multiple_stp_files.py
55
- python examples/surface_mesh/single_stp_file_multiple_volumes.py
56
57
  python examples/surface_mesh/single_cadquery_object.py
58
+ python examples/surface_mesh/single_stp_file_multiple_volumes.py
57
59
  python examples/surface_mesh/single_stp_file.py
58
- python examples/surface_mesh/from_gmsh_mesh_file.py
59
60
  python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
60
61
  python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
61
- python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
62
+ python examples/unstrucutred_volume_mesh/different_resolution_meshes.py
63
+ python examples/surface_mesh/different_resolution_meshes.py
64
+ python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
65
+ python examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: cad_to_dagmc
3
- Version: 0.7.3
3
+ Version: 0.9.3
4
4
  Summary: Converts CAD files to a DAGMC h5m file
5
5
  Author-email: Jonathan Shimwell <mail@jshimwell.com>
6
6
  Project-URL: Homepage, https://github.com/fusion-energy/cad_to_dagmc
@@ -14,12 +14,14 @@ Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
  Requires-Dist: trimesh
16
16
  Requires-Dist: networkx
17
- Requires-Dist: cadquery>=2.4.0
18
- Requires-Dist: numpy<=1.26.4
17
+ Requires-Dist: cadquery>=2.5.2
18
+ Requires-Dist: numpy
19
19
  Requires-Dist: gmsh
20
20
  Provides-Extra: tests
21
21
  Requires-Dist: pytest; extra == "tests"
22
22
  Requires-Dist: vtk; extra == "tests"
23
+ Requires-Dist: assembly-mesh-plugin; extra == "tests"
24
+ Dynamic: license-file
23
25
 
24
26
 
25
27
  [![N|Python](https://www.python.org/static/community_logos/python-powered-w-100x40.png)](https://www.python.org)
@@ -35,23 +37,36 @@ Requires-Dist: vtk; extra == "tests"
35
37
  [![PyPI](https://img.shields.io/pypi/v/cad_to_dagmc?color=brightgreen&label=pypi&logo=grebrightgreenen&logoColor=green)](https://pypi.org/project/cad_to_dagmc/)
36
38
 
37
39
 
38
- A minimal package that converts CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) h5m files
40
+ A minimal package that converts CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) (h5m) files, [unstructured mesh](https://docs.openmc.org/en/latest/pythonapi/generated/openmc.UnstructuredMesh.html) files (vtk) and Gmsh (msh) files ready for use in neutronics simulations.
39
41
 
40
- cad-to-dagmc can create:
42
+ cad-to-dagmc can create DAGMC compatible:
41
43
  - surface meshes / faceted geometry / triangular meshes
42
44
  - unstructured mesh / tetrahedral meshes / volume meshes
43
45
 
44
- cad-to-dagmc can convert:
46
+ cad-to-dagmc can convert the following in to DAGMC compatible meshes:
45
47
  - STEP files
46
- - CadQuery objects (in memory)
48
+ - CadQuery objects (optionally use names as material tags)
49
+ - Gmsh meshes (optionally use physical groups as material tags)
50
+
51
+ Cad-to-dagmc offers a wide range of features including.
52
+ - Compatibly with [assembly-mesh-plugin](https://github.com/CadQuery/assembly-mesh-plugin) (see examples)
53
+ - Access to the Gmsh mesh to allow user to define full set of mesh parameters
54
+ - Option to use Gmsh physical groups as material tags
55
+ - Geometry scaling with ```scale_factor``` argument
56
+ - Model wide mesh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
57
+ - Volume specific mesh sizing parameters with the ```set_size``` argument
58
+ - Unstructured mesh that share the same coordinates as the surface mesh.
59
+ - Volume mesh allows selecting individual volumes in the geometry.
60
+ - Parallel meshing to quickly mesh the geometry using multiple CPU cores
61
+ - Imprint and merging of CAD geometry, or disable with the ```imprint``` argument
62
+ - Add geometry from multiple sources ([STEP](http://www.steptools.com/stds/step/) files, [CadQuery](https://cadquery.readthedocs.io) objects and [Gmsh](https://gmsh.info/) meshes)
63
+ - Ability to tag the DAGMC implicit complement material using the ```implicit_complement_material_tag``` argument
64
+ - Selected different Gmesh mesh algorithms (defaults to 1) using the ```mesh_algorithm``` argument
65
+ - Pass CadQuery objects in memory for fast transfer of geometry using the ```method``` argument
66
+ - Easy to install with [pip](https://pypi.org/project/cad-to-dagmc/) and [Conda/Mamba](https://anaconda.org/conda-forge/cad_to_dagmc)
67
+ - Well tested both with [CI unit tests](https://github.com/fusion-energy/cad_to_dagmc/tree/main/tests), integration tests and the CSG [Model Benchmark Zoo](https://github.com/fusion-energy/model_benchmark_zoo).
68
+ - Compatible with [Paramak](https://github.com/fusion-energy/paramak) geometry for fusion simulations.
47
69
 
48
- cad-to-dagmc aims to produce DAGMC compatible h5m files from CAD geometry is intended to convert [STEP](http://www.steptools.com/stds/step/) files or [CadQuery](https://cadquery.readthedocs.io) objects to a [DAGMC](https://github.com/svalinn/DAGMC/) compatible h5m file.
49
-
50
- The resulting DAGMC geometry can then be used for simulations in [OpenMC](https://github.com/openmc-dev/openmc/) or [other supported codes](https://svalinn.github.io/DAGMC/).
51
-
52
- This package is tested with [pytest tests](https://github.com/fusion-energy/cad_to_dagmc/tree/main/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](https://github.com/fusion-energy/model_benchmark_zoo) for more details.
53
-
54
- Also checkout these other software projects that also create DAGMC geometry [CAD-to-OpenMC](https://github.com/openmsr/CAD_to_OpenMC), [Stellarmesh](https://github.com/Thea-Energy/stellarmesh) and [Coreform Cubit](https://coreform.com/products/coreform-cubit/)
55
70
 
56
71
  # Installation options
57
72
 
@@ -117,21 +132,10 @@ First ensure hdf5 is installed as this is needed by MOAB pip install command
117
132
  sudo apt-get install libhdf5-dev
118
133
  ```
119
134
 
120
- Then clone the latest version of MOAB and cd into the moab directory.
121
-
122
- ```
123
- git clone master https://bitbucket.org/fathomteam/moab/
124
- cd moab
125
- ```
135
+ Then install MOAB, currently available from the repo.
126
136
 
127
- Ensure pip is up to date as a new version is needed
128
137
  ```
129
- python -m pip install --upgrade pip
130
- ```
131
-
132
- Run the pip install command with cmake arguments.
133
- ```
134
- pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
138
+ pip install git+https://bitbucket.org/fathomteam/moab/
135
139
  ```
136
140
 
137
141
  Then you can install the cad_to_dagmc package with ```pip```
@@ -146,7 +150,7 @@ You may also want to install OpenMC with DAGMC to make use of the h5m geometry f
146
150
 
147
151
  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
148
152
  ```bash
149
- mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
153
+ mamba install -c conda-forge -y "openmc=0.15.0=dagmc*nompi*"
150
154
  ```
151
155
 
152
156
  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.
@@ -160,15 +164,15 @@ The package requires newer versions of Linux. For example the package does not w
160
164
 
161
165
  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```
162
166
 
163
- 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.
167
+ 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.
164
168
 
165
169
 
166
- # Usage - creation of DAGMC h5m files
170
+ # Usage
167
171
 
168
- For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
172
+ For examples showing creation of DAGMC h5m files, vtk files and usage within OpenMC transport code see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
169
173
 
170
- # Usage - simulation with transport code
174
+ For more examples see the CAD tasks in the [neutronics-workshop](https://github.com/fusion-energy/neutronics-workshop) and [model benchmark zoo](https://github.com/fusion-energy/model_benchmark_zoo)
171
175
 
172
- For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
176
+ # Related software
173
177
 
174
- For more examples see the CAD tasks in the [neutronics-workshop](https://github.com/fusion-energy/neutronics-workshop) and [model benchmark zoo](https://github.com/fusion-energy/model_benchmark_zoo)
178
+ Also checkout these other software projects that also create DAGMC geometry [CAD-to-OpenMC](https://github.com/openmsr/CAD_to_OpenMC), [Stellarmesh](https://github.com/Thea-Energy/stellarmesh) and [Coreform Cubit](https://coreform.com/products/coreform-cubit/).
@@ -12,23 +12,36 @@
12
12
  [![PyPI](https://img.shields.io/pypi/v/cad_to_dagmc?color=brightgreen&label=pypi&logo=grebrightgreenen&logoColor=green)](https://pypi.org/project/cad_to_dagmc/)
13
13
 
14
14
 
15
- A minimal package that converts CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) h5m files
15
+ A minimal package that converts CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) (h5m) files, [unstructured mesh](https://docs.openmc.org/en/latest/pythonapi/generated/openmc.UnstructuredMesh.html) files (vtk) and Gmsh (msh) files ready for use in neutronics simulations.
16
16
 
17
- cad-to-dagmc can create:
17
+ cad-to-dagmc can create DAGMC compatible:
18
18
  - surface meshes / faceted geometry / triangular meshes
19
19
  - unstructured mesh / tetrahedral meshes / volume meshes
20
20
 
21
- cad-to-dagmc can convert:
21
+ cad-to-dagmc can convert the following in to DAGMC compatible meshes:
22
22
  - STEP files
23
- - CadQuery objects (in memory)
23
+ - CadQuery objects (optionally use names as material tags)
24
+ - Gmsh meshes (optionally use physical groups as material tags)
25
+
26
+ Cad-to-dagmc offers a wide range of features including.
27
+ - Compatibly with [assembly-mesh-plugin](https://github.com/CadQuery/assembly-mesh-plugin) (see examples)
28
+ - Access to the Gmsh mesh to allow user to define full set of mesh parameters
29
+ - Option to use Gmsh physical groups as material tags
30
+ - Geometry scaling with ```scale_factor``` argument
31
+ - Model wide mesh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
32
+ - Volume specific mesh sizing parameters with the ```set_size``` argument
33
+ - Unstructured mesh that share the same coordinates as the surface mesh.
34
+ - Volume mesh allows selecting individual volumes in the geometry.
35
+ - Parallel meshing to quickly mesh the geometry using multiple CPU cores
36
+ - Imprint and merging of CAD geometry, or disable with the ```imprint``` argument
37
+ - Add geometry from multiple sources ([STEP](http://www.steptools.com/stds/step/) files, [CadQuery](https://cadquery.readthedocs.io) objects and [Gmsh](https://gmsh.info/) meshes)
38
+ - Ability to tag the DAGMC implicit complement material using the ```implicit_complement_material_tag``` argument
39
+ - Selected different Gmesh mesh algorithms (defaults to 1) using the ```mesh_algorithm``` argument
40
+ - Pass CadQuery objects in memory for fast transfer of geometry using the ```method``` argument
41
+ - Easy to install with [pip](https://pypi.org/project/cad-to-dagmc/) and [Conda/Mamba](https://anaconda.org/conda-forge/cad_to_dagmc)
42
+ - Well tested both with [CI unit tests](https://github.com/fusion-energy/cad_to_dagmc/tree/main/tests), integration tests and the CSG [Model Benchmark Zoo](https://github.com/fusion-energy/model_benchmark_zoo).
43
+ - Compatible with [Paramak](https://github.com/fusion-energy/paramak) geometry for fusion simulations.
24
44
 
25
- cad-to-dagmc aims to produce DAGMC compatible h5m files from CAD geometry is intended to convert [STEP](http://www.steptools.com/stds/step/) files or [CadQuery](https://cadquery.readthedocs.io) objects to a [DAGMC](https://github.com/svalinn/DAGMC/) compatible h5m file.
26
-
27
- The resulting DAGMC geometry can then be used for simulations in [OpenMC](https://github.com/openmc-dev/openmc/) or [other supported codes](https://svalinn.github.io/DAGMC/).
28
-
29
- This package is tested with [pytest tests](https://github.com/fusion-energy/cad_to_dagmc/tree/main/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](https://github.com/fusion-energy/model_benchmark_zoo) for more details.
30
-
31
- Also checkout these other software projects that also create DAGMC geometry [CAD-to-OpenMC](https://github.com/openmsr/CAD_to_OpenMC), [Stellarmesh](https://github.com/Thea-Energy/stellarmesh) and [Coreform Cubit](https://coreform.com/products/coreform-cubit/)
32
45
 
33
46
  # Installation options
34
47
 
@@ -94,21 +107,10 @@ First ensure hdf5 is installed as this is needed by MOAB pip install command
94
107
  sudo apt-get install libhdf5-dev
95
108
  ```
96
109
 
97
- Then clone the latest version of MOAB and cd into the moab directory.
98
-
99
- ```
100
- git clone master https://bitbucket.org/fathomteam/moab/
101
- cd moab
102
- ```
110
+ Then install MOAB, currently available from the repo.
103
111
 
104
- Ensure pip is up to date as a new version is needed
105
112
  ```
106
- python -m pip install --upgrade pip
107
- ```
108
-
109
- Run the pip install command with cmake arguments.
110
- ```
111
- pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
113
+ pip install git+https://bitbucket.org/fathomteam/moab/
112
114
  ```
113
115
 
114
116
  Then you can install the cad_to_dagmc package with ```pip```
@@ -123,7 +125,7 @@ You may also want to install OpenMC with DAGMC to make use of the h5m geometry f
123
125
 
124
126
  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
125
127
  ```bash
126
- mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
128
+ mamba install -c conda-forge -y "openmc=0.15.0=dagmc*nompi*"
127
129
  ```
128
130
 
129
131
  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.
@@ -137,15 +139,15 @@ The package requires newer versions of Linux. For example the package does not w
137
139
 
138
140
  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```
139
141
 
140
- 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.
142
+ 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.
141
143
 
142
144
 
143
- # Usage - creation of DAGMC h5m files
145
+ # Usage
144
146
 
145
- For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
147
+ For examples showing creation of DAGMC h5m files, vtk files and usage within OpenMC transport code see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
146
148
 
147
- # Usage - simulation with transport code
149
+ For more examples see the CAD tasks in the [neutronics-workshop](https://github.com/fusion-energy/neutronics-workshop) and [model benchmark zoo](https://github.com/fusion-energy/model_benchmark_zoo)
148
150
 
149
- For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
151
+ # Related software
150
152
 
151
- For more examples see the CAD tasks in the [neutronics-workshop](https://github.com/fusion-energy/neutronics-workshop) and [model benchmark zoo](https://github.com/fusion-energy/model_benchmark_zoo)
153
+ Also checkout these other software projects that also create DAGMC geometry [CAD-to-OpenMC](https://github.com/openmsr/CAD_to_OpenMC), [Stellarmesh](https://github.com/Thea-Energy/stellarmesh) and [Coreform Cubit](https://coreform.com/products/coreform-cubit/).
@@ -0,0 +1,105 @@
1
+ # This example makes 3 CAD half spheres
2
+ # Meshes the 3 volumes with different resolutions
3
+ # exports the mesh to a DAGMC unstructured VTK file and a DAGMC h5m file
4
+ # The outer surface of the volume mesh should match the surface of the surface
5
+ # mesh as the same mesh parameters were used in both the surface and volume mesh.
6
+ # Additionally only volume 2 is volume meshed, while all three volumes are surface meshed
7
+
8
+ import cadquery as cq
9
+ from cad_to_dagmc import CadToDagmc
10
+ import openmc
11
+
12
+
13
+ box_cutter = cq.Workplane("XY").moveTo(0, 5).box(20, 10, 20)
14
+ inner_sphere = cq.Workplane("XY").sphere(6).cut(box_cutter)
15
+ middle_sphere = cq.Workplane("XY").sphere(6.1).cut(box_cutter).cut(inner_sphere)
16
+ outer_sphere = cq.Workplane("XY").sphere(10).cut(box_cutter).cut(inner_sphere).cut(middle_sphere)
17
+
18
+ assembly = cq.Assembly()
19
+ assembly.add(inner_sphere, name="inner_sphere")
20
+ assembly.add(middle_sphere, name="middle_sphere")
21
+ assembly.add(outer_sphere, name="outer_sphere")
22
+
23
+
24
+ model = CadToDagmc()
25
+ model.add_cadquery_object(assembly, material_tags=["mat1", "mat2", "mat3"])
26
+
27
+ dagmc_filename, umesh_filename = model.export_dagmc_h5m_file(
28
+ filename="surface_mesh_conformal.h5m",
29
+ set_size={
30
+ 1: 0.9,
31
+ 2: 0.1,
32
+ 3: 0.9,
33
+ },
34
+ unstructured_volumes=[2],
35
+ umesh_filename="volume_mesh_conformal.vtk",
36
+ meshing_backend="gmsh",
37
+ )
38
+
39
+
40
+ with open("cross_sections.xml", "w") as file:
41
+ file.write(
42
+ """
43
+ <?xml version='1.0' encoding='UTF-8'?>
44
+ <cross_sections>
45
+ <library materials="H1" path="tests/ENDFB-7.1-NNDC_H1.h5" type="neutron"/>
46
+ </cross_sections>
47
+ """
48
+ )
49
+ openmc.config["cross_sections"] = "cross_sections.xml"
50
+
51
+ umesh = openmc.UnstructuredMesh(umesh_filename, library="moab")
52
+ mesh_filter = openmc.MeshFilter(umesh)
53
+ tally = openmc.Tally(name="unstructured_mesh_tally")
54
+ tally.filters = [mesh_filter]
55
+ tally.scores = ["flux"]
56
+ my_tallies = openmc.Tallies([tally])
57
+
58
+
59
+ mat1 = openmc.Material(name="mat1")
60
+ mat1.add_nuclide("H1", 1, percent_type="ao")
61
+ mat1.set_density("g/cm3", 0.001)
62
+ mat2 = openmc.Material(name="mat2")
63
+ mat2.add_nuclide("H1", 1, percent_type="ao")
64
+ mat2.set_density("g/cm3", 0.002)
65
+ mat3 = openmc.Material(name="mat3")
66
+ mat3.add_nuclide("H1", 1, percent_type="ao")
67
+ mat3.set_density("g/cm3", 0.003)
68
+ my_materials = openmc.Materials([mat1, mat2, mat3])
69
+
70
+ dag_univ = openmc.DAGMCUniverse(filename=dagmc_filename)
71
+ bound_dag_univ = dag_univ.bounded_universe()
72
+ my_geometry = openmc.Geometry(root=bound_dag_univ)
73
+
74
+ my_settings = openmc.Settings()
75
+ my_settings.batches = 10
76
+ my_settings.particles = 5000
77
+ my_settings.run_mode = "fixed source"
78
+
79
+ # Create a DT point source
80
+ my_source = openmc.IndependentSource()
81
+ my_source.space = openmc.stats.Point(my_geometry.bounding_box.center)
82
+ my_source.angle = openmc.stats.Isotropic()
83
+ my_source.energy = openmc.stats.Discrete([14e6], [1])
84
+ my_settings.source = my_source
85
+
86
+ model = openmc.model.Model(my_geometry, my_materials, my_settings, my_tallies)
87
+ sp_filename = model.run()
88
+
89
+ sp = openmc.StatePoint(sp_filename)
90
+
91
+ tally_result = sp.get_tally(name="unstructured_mesh_tally")
92
+
93
+ # normally with regular meshes I would get the mesh from the tally
94
+ # but with unstructured meshes the tally does not contain the mesh
95
+ # however we can get it from the statepoint file
96
+ # umesh = tally_result.find_filter(openmc.MeshFilter)
97
+ umesh_from_sp = sp.meshes[1]
98
+
99
+ # these trigger internal code in the mesh object so that its centroids and volumes become known.
100
+ # centroids and volumes are needed for the get_values and write_data_to_vtk steps
101
+ centroids = umesh_from_sp.centroids
102
+ mesh_vols = umesh_from_sp.volumes
103
+
104
+ flux_mean = tally_result.get_values(scores=["flux"], value="mean").reshape(umesh_from_sp.dimension)
105
+ umesh_from_sp.write_data_to_vtk(filename="tally.vtk", datasets={"mean": flux_mean})
@@ -0,0 +1,44 @@
1
+ # This example makes 3 CAD boxes
2
+ # Meshes the 3 volumes with different resolutions
3
+ # exports the mesh to a DAGMC h5m file and GMsh msh file
4
+ import cadquery as cq
5
+ from cad_to_dagmc import CadToDagmc
6
+
7
+ box_set_size_course_mesh = cq.Workplane().box(1, 1, 2)
8
+ box_set_size_fine_mesh = cq.Workplane().moveTo(1, 0.5).box(1, 1, 1.5)
9
+ box_set_global_mesh = cq.Workplane().moveTo(2, 1).box(1, 1, 1)
10
+
11
+ assembly = cq.Assembly()
12
+ assembly.add(box_set_size_course_mesh, color=cq.Color(0, 0, 1))
13
+ assembly.add(box_set_size_fine_mesh, color=cq.Color(0, 1, 0))
14
+ assembly.add(box_set_global_mesh, color=cq.Color(1, 0, 0))
15
+
16
+ assembly.export("different_resolution_meshes.step")
17
+
18
+ # uncomment to see the assembly in a pop up vtk viewer
19
+ # from cadquery import vis
20
+ # vis.show(assembly)
21
+
22
+ model = CadToDagmc()
23
+ model.add_cadquery_object(assembly, material_tags=["mat1", "mat2", "mat3"])
24
+
25
+ model.export_dagmc_h5m_file(
26
+ filename="different_resolution_meshes.h5m",
27
+ min_mesh_size=0.01,
28
+ max_mesh_size=10,
29
+ set_size={
30
+ 1: 0.9,
31
+ 2: 0.1,
32
+ }, # not volume 3 is not specified in the set_size so it uses only the min max mesh sizes
33
+ )
34
+
35
+ model.export_gmsh_mesh_file(
36
+ filename="different_resolution_meshes.msh",
37
+ dimensions=2,
38
+ min_mesh_size=0.01,
39
+ max_mesh_size=10,
40
+ set_size={
41
+ 1: 0.9,
42
+ 2: 0.1,
43
+ }, # not volume 3 is not specified in the set_size so it uses only the min max mesh sizes
44
+ )
@@ -1,11 +1,12 @@
1
1
  # this file makes a GMESH mesh file from a Step file
2
2
  # then loads up the GMESH file and converts it to a DAGMC file
3
3
 
4
-
5
- # making the GMESH file
6
4
  from cad_to_dagmc import CadToDagmc
7
5
  import cadquery as cq
6
+ import cad_to_dagmc
7
+ import openmc
8
8
 
9
+ # making the gmsh file just so we have one for the example
9
10
  result1 = cq.Workplane("XY").box(10.0, 10.0, 5.0)
10
11
  result2 = cq.Workplane("XY").moveTo(10, 0).box(10.0, 10.0, 5.0)
11
12
  assembly = cq.Assembly()
@@ -17,18 +18,15 @@ geometry = CadToDagmc()
17
18
  geometry.add_stp_file("two_connected_cubes.stp")
18
19
  geometry.export_gmsh_mesh_file(filename="example_gmsh_mesh.msh")
19
20
 
20
- # converting the mesh file to a DAGMC file
21
- from cad_to_dagmc import MeshToDagmc
22
21
 
23
- mesh = MeshToDagmc(filename="example_gmsh_mesh.msh")
22
+ # converting the mesh file to a DAGMC file
24
23
 
25
- mesh.export_dagmc_h5m_file(
24
+ cad_to_dagmc.export_gmsh_file_to_dagmc_h5m_file(
25
+ gmsh_filename="example_gmsh_mesh.msh",
26
26
  material_tags=["mat1", "mat2"],
27
- filename="dagmc.h5m",
27
+ dagmc_filename="dagmc.h5m",
28
28
  )
29
29
 
30
- # making use of the DAGMC file in OpenMC
31
- import openmc
32
30
 
33
31
  openmc.config["cross_sections"] = "cross_sections.xml"
34
32