cad-to-dagmc 0.7.4__tar.gz → 0.9.4__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.
Files changed (67) hide show
  1. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/.github/workflows/ci_with_benchmarks.yml +29 -14
  2. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/.github/workflows/ci_with_conda_install.yml +45 -20
  3. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/.github/workflows/ci_with_pip_install.yml +11 -8
  4. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/PKG-INFO +40 -35
  5. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/README.md +34 -31
  6. cad_to_dagmc-0.9.4/examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py +105 -0
  7. cad_to_dagmc-0.9.4/examples/surface_mesh/different_resolution_meshes.py +44 -0
  8. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/from_gmsh_mesh_file.py +7 -9
  9. cad_to_dagmc-0.9.4/examples/surface_mesh/from_gmsh_mesh_file_with_tags.py +44 -0
  10. cad_to_dagmc-0.9.4/examples/surface_mesh/from_gmsh_object_with_tag.py +26 -0
  11. cad_to_dagmc-0.9.4/examples/surface_mesh/tagged_mesh.msh +3445 -0
  12. cad_to_dagmc-0.9.4/examples/unstrucutred_volume_mesh/different_resolution_meshes.py +44 -0
  13. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/pyproject.toml +9 -4
  14. cad_to_dagmc-0.9.4/src/_version.py +34 -0
  15. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/src/cad_to_dagmc/__init__.py +1 -0
  16. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/src/cad_to_dagmc/core.py +471 -135
  17. cad_to_dagmc-0.9.4/src/cad_to_dagmc/direct_mesh_plugin.py +508 -0
  18. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/src/cad_to_dagmc.egg-info/PKG-INFO +40 -35
  19. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/src/cad_to_dagmc.egg-info/SOURCES.txt +11 -0
  20. cad_to_dagmc-0.9.4/src/cad_to_dagmc.egg-info/requires.txt +10 -0
  21. cad_to_dagmc-0.9.4/tests/tagged_mesh.msh +3445 -0
  22. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/test_file_creation.py +25 -14
  23. cad_to_dagmc-0.9.4/tests/test_get_volumes.py +89 -0
  24. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/test_h5m_in_transport.py +64 -16
  25. cad_to_dagmc-0.9.4/tests/test_kwarg_args.py +229 -0
  26. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/test_loading_from_file_vs_shape_object.py +0 -2
  27. cad_to_dagmc-0.9.4/tests/test_mesh_to_dagmc.py +106 -0
  28. cad_to_dagmc-0.9.4/tests/test_python_api.py +434 -0
  29. cad_to_dagmc-0.7.4/src/_version.py +0 -16
  30. cad_to_dagmc-0.7.4/src/cad_to_dagmc.egg-info/requires.txt +0 -9
  31. cad_to_dagmc-0.7.4/tests/test_python_api.py +0 -140
  32. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/.github/workflows/black.yml +0 -0
  33. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/.github/workflows/python-publish.yml +0 -0
  34. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/.gitignore +0 -0
  35. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/CITATION.cff +0 -0
  36. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/LICENSE +0 -0
  37. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/cadquery_assembly.py +0 -0
  38. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +0 -0
  39. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/cadquery_compound.py +0 -0
  40. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
  41. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/cadquery_text.py +0 -0
  42. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
  43. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
  44. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/multiple_stp_files.py +0 -0
  45. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/single_cadquery_object.py +0 -0
  46. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/single_stp_file.py +0 -0
  47. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
  48. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +0 -0
  49. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -0
  50. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/setup.cfg +0 -0
  51. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
  52. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
  53. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
  54. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/ball_reactor.brep +0 -0
  55. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/curved_extrude.stp +0 -0
  56. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/extrude_rectangle.stp +0 -0
  57. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/multi_volume_cylinders.stp +0 -0
  58. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/one_cube.brep +0 -0
  59. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/single_cube.stp +0 -0
  60. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/single_volume_thin.stp +0 -0
  61. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/single_volume_thin.vtk +0 -0
  62. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/test_brep_file.brep +0 -0
  63. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/test_two_joined_cubes.brep +0 -0
  64. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/test_two_sep_cubes.brep +0 -0
  65. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/test_version.py +0 -0
  66. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/two_connected_cubes.stp +0 -0
  67. {cad_to_dagmc-0.7.4 → cad_to_dagmc-0.9.4}/tests/two_disconnected_cubes.stp +0 -0
@@ -19,32 +19,47 @@ 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
+
51
+ - name: Run tests
52
+ shell: bash -l {0}
53
+ env:
54
+ OPENMC_CROSS_SECTIONS: /home/runner/work/cad_to_dagmc/cad_to_dagmc/cross_sections.xml
55
+ run: |
56
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
57
+ conda activate ci-env
41
58
  python -m ensurepip --upgrade
42
59
  python -m pip install . --no-deps
43
60
  python -m pip install openmc_data_downloader
44
- openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9
61
+ openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9 Al27
45
62
  git clone --single-branch -b main --depth 1 https://github.com/fusion-energy/model_benchmark_zoo.git
46
63
  cd model_benchmark_zoo
47
64
  python -m pip install .[tests]
48
- conda env export > environment.yml
49
- cat environment.yml
50
65
  pytest tests/test_cad_to_dagmc -v
@@ -21,45 +21,70 @@ on:
21
21
  jobs:
22
22
  testing:
23
23
  runs-on: ubuntu-latest
24
- strategy:
25
- matrix:
26
- python-version: ["3.10", "3.11", "3.12"]
24
+
27
25
  steps:
28
26
  - name: Checkout repository
29
27
  uses: actions/checkout@v4
30
28
 
31
- - name: install non pypi dependencies
32
- shell: bash
29
+ - name: Install system packages
33
30
  run: |
34
- wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
35
- bash Miniforge3.sh -b -p "${HOME}/conda"
36
- source "${HOME}/conda/etc/profile.d/conda.sh"
37
- source "${HOME}/conda/etc/profile.d/mamba.sh"
38
- sudo apt-get --allow-releaseinfo-change update
39
31
  sudo apt-get update -y
40
32
  sudo apt-get upgrade -y
41
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
42
- mamba activate
43
- mamba create -y --name cad_to_dagmc python=${{ matrix.python-version }}
44
- mamba activate cad_to_dagmc
45
- mamba install -y -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh
46
- python -m ensurepip --upgrade
47
- python -m pip install . --no-deps
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
+
52
+ - name: Test import
53
+ shell: bash -l {0}
54
+ run: |
55
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
56
+ conda activate ci-env
48
57
  python -c "import cad_to_dagmc"
49
- mamba install -y -c conda-forge pytest vtk
50
- python -m pip install .[tests] --no-deps
58
+
59
+ - name: Run tests
60
+ shell: bash -l {0}
61
+ run: |
62
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
63
+ conda activate ci-env
51
64
  pytest -v tests
65
+
66
+ - name: Run examples
67
+ shell: bash -l {0}
68
+ run: |
69
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
70
+ conda activate ci-env
52
71
  python examples/surface_mesh/cadquery_assembly.py
72
+ python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
53
73
  python examples/surface_mesh/cadquery_compound.py
54
74
  python examples/surface_mesh/cadquery_object_and_stp_file.py
55
75
  python examples/surface_mesh/cadquery_text.py
56
76
  python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
77
+ python examples/surface_mesh/from_gmsh_mesh_file.py
78
+ python examples/surface_mesh/from_gmsh_mesh_file_with_tags.py
79
+ python examples/surface_mesh/from_gmsh_object_with_tag.py
57
80
  python examples/surface_mesh/multiple_cadquery_objects.py
58
81
  python examples/surface_mesh/multiple_stp_files.py
59
- python examples/surface_mesh/single_stp_file_multiple_volumes.py
60
82
  python examples/surface_mesh/single_cadquery_object.py
83
+ python examples/surface_mesh/single_stp_file_multiple_volumes.py
61
84
  python examples/surface_mesh/single_stp_file.py
62
- python examples/surface_mesh/from_gmsh_mesh_file.py
63
85
  python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
64
86
  python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
87
+ python examples/unstrucutred_volume_mesh/different_resolution_meshes.py
88
+ python examples/surface_mesh/different_resolution_meshes.py
65
89
  python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
90
+ python examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py
@@ -36,26 +36,29 @@ 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
46
43
  python -c "import cad_to_dagmc"
47
44
  pytest -v tests
48
45
  python examples/surface_mesh/cadquery_assembly.py
46
+ python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
49
47
  python examples/surface_mesh/cadquery_compound.py
50
48
  python examples/surface_mesh/cadquery_object_and_stp_file.py
51
49
  python examples/surface_mesh/cadquery_text.py
52
50
  python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
51
+ python examples/surface_mesh/from_gmsh_mesh_file.py
52
+ python examples/surface_mesh/from_gmsh_mesh_file_with_tags.py
53
+ python examples/surface_mesh/from_gmsh_object_with_tag.py
53
54
  python examples/surface_mesh/multiple_cadquery_objects.py
54
55
  python examples/surface_mesh/multiple_stp_files.py
55
- python examples/surface_mesh/single_stp_file_multiple_volumes.py
56
56
  python examples/surface_mesh/single_cadquery_object.py
57
+ python examples/surface_mesh/single_stp_file_multiple_volumes.py
57
58
  python examples/surface_mesh/single_stp_file.py
58
- python examples/surface_mesh/from_gmsh_mesh_file.py
59
59
  python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
60
60
  python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
61
- python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
61
+ python examples/unstrucutred_volume_mesh/different_resolution_meshes.py
62
+ python examples/surface_mesh/different_resolution_meshes.py
63
+ python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
64
+ 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.4
3
+ Version: 0.9.4
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,37 @@ 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
+ - Geometry scaling with ```scale_factor``` argument
53
+ - Ddirect surface meshing of CadQuery geometry with ```tolerance``` and ```angular_tolerance``` arguments (avoids using Gmsh)
54
+ - Model wide mesh Gmsh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
55
+ - Volume specific mesh sizing parameters with the ```set_size``` argument
56
+ - Unstructured mesh that share the same coordinates as the surface mesh.
57
+ - Volume mesh allows selecting individual volumes in the geometry.
58
+ - Parallel meshing to quickly mesh the geometry using multiple CPU cores
59
+ - Imprint and merging of CAD geometry, or disable with the ```imprint``` argument
60
+ - 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)
61
+ - Ability to tag the DAGMC implicit complement material using the ```implicit_complement_material_tag``` argument
62
+ - Selected different Gmesh mesh algorithms (defaults to 1) using the ```mesh_algorithm``` argument
63
+ - Pass CadQuery objects in memory for fast transfer of geometry using the ```method``` argument
64
+ - Easy to install with [pip](https://pypi.org/project/cad-to-dagmc/) and [Conda/Mamba](https://anaconda.org/conda-forge/cad_to_dagmc)
65
+ - 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).
66
+ - Access to the Gmsh mesh to allow user to define full set of mesh parameters
67
+ - Option to use Gmsh physical groups as material tags
68
+ - Compatibly with [assembly-mesh-plugin](https://github.com/CadQuery/assembly-mesh-plugin) (see examples)
69
+ - Compatible with [Paramak](https://github.com/fusion-energy/paramak) geometry for fusion simulations.
47
70
 
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
71
 
56
72
  # Installation options
57
73
 
@@ -117,21 +133,10 @@ First ensure hdf5 is installed as this is needed by MOAB pip install command
117
133
  sudo apt-get install libhdf5-dev
118
134
  ```
119
135
 
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
- ```
136
+ Then install MOAB, currently available from the repo.
126
137
 
127
- Ensure pip is up to date as a new version is needed
128
138
  ```
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
139
+ pip install git+https://bitbucket.org/fathomteam/moab/
135
140
  ```
136
141
 
137
142
  Then you can install the cad_to_dagmc package with ```pip```
@@ -146,7 +151,7 @@ You may also want to install OpenMC with DAGMC to make use of the h5m geometry f
146
151
 
147
152
  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
153
  ```bash
149
- mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
154
+ mamba install -c conda-forge -y "openmc=0.15.0=dagmc*nompi*"
150
155
  ```
151
156
 
152
157
  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 +165,15 @@ The package requires newer versions of Linux. For example the package does not w
160
165
 
161
166
  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
167
 
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.
168
+ 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
169
 
165
170
 
166
- # Usage - creation of DAGMC h5m files
171
+ # Usage
167
172
 
168
- For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
173
+ 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
174
 
170
- # Usage - simulation with transport code
175
+ 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
176
 
172
- For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
177
+ # Related software
173
178
 
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)
179
+ 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,37 @@
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
+ - Geometry scaling with ```scale_factor``` argument
28
+ - Ddirect surface meshing of CadQuery geometry with ```tolerance``` and ```angular_tolerance``` arguments (avoids using Gmsh)
29
+ - Model wide mesh Gmsh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
30
+ - Volume specific mesh sizing parameters with the ```set_size``` argument
31
+ - Unstructured mesh that share the same coordinates as the surface mesh.
32
+ - Volume mesh allows selecting individual volumes in the geometry.
33
+ - Parallel meshing to quickly mesh the geometry using multiple CPU cores
34
+ - Imprint and merging of CAD geometry, or disable with the ```imprint``` argument
35
+ - 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)
36
+ - Ability to tag the DAGMC implicit complement material using the ```implicit_complement_material_tag``` argument
37
+ - Selected different Gmesh mesh algorithms (defaults to 1) using the ```mesh_algorithm``` argument
38
+ - Pass CadQuery objects in memory for fast transfer of geometry using the ```method``` argument
39
+ - Easy to install with [pip](https://pypi.org/project/cad-to-dagmc/) and [Conda/Mamba](https://anaconda.org/conda-forge/cad_to_dagmc)
40
+ - 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).
41
+ - Access to the Gmsh mesh to allow user to define full set of mesh parameters
42
+ - Option to use Gmsh physical groups as material tags
43
+ - Compatibly with [assembly-mesh-plugin](https://github.com/CadQuery/assembly-mesh-plugin) (see examples)
44
+ - Compatible with [Paramak](https://github.com/fusion-energy/paramak) geometry for fusion simulations.
24
45
 
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
46
 
33
47
  # Installation options
34
48
 
@@ -94,21 +108,10 @@ First ensure hdf5 is installed as this is needed by MOAB pip install command
94
108
  sudo apt-get install libhdf5-dev
95
109
  ```
96
110
 
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
- ```
111
+ Then install MOAB, currently available from the repo.
103
112
 
104
- Ensure pip is up to date as a new version is needed
105
113
  ```
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
114
+ pip install git+https://bitbucket.org/fathomteam/moab/
112
115
  ```
113
116
 
114
117
  Then you can install the cad_to_dagmc package with ```pip```
@@ -123,7 +126,7 @@ You may also want to install OpenMC with DAGMC to make use of the h5m geometry f
123
126
 
124
127
  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
128
  ```bash
126
- mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
129
+ mamba install -c conda-forge -y "openmc=0.15.0=dagmc*nompi*"
127
130
  ```
128
131
 
129
132
  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 +140,15 @@ The package requires newer versions of Linux. For example the package does not w
137
140
 
138
141
  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
142
 
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.
143
+ 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
144
 
142
145
 
143
- # Usage - creation of DAGMC h5m files
146
+ # Usage
144
147
 
145
- For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
148
+ 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
149
 
147
- # Usage - simulation with transport code
150
+ 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
151
 
149
- For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
152
+ # Related software
150
153
 
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)
154
+ 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