cad-to-dagmc 0.8.2__tar.gz → 0.9.7__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 (65) hide show
  1. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/.github/workflows/ci_with_benchmarks.yml +29 -14
  2. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/.github/workflows/ci_with_conda_install.yml +24 -11
  3. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/.github/workflows/ci_with_pip_install.yml +20 -16
  4. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/PKG-INFO +18 -21
  5. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/README.md +14 -19
  6. cad_to_dagmc-0.9.7/examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py +105 -0
  7. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/from_gmsh_mesh_file.py +7 -9
  8. cad_to_dagmc-0.9.7/examples/surface_mesh/from_gmsh_mesh_file_with_tags.py +44 -0
  9. cad_to_dagmc-0.9.7/examples/surface_mesh/from_gmsh_object_with_tag.py +26 -0
  10. cad_to_dagmc-0.9.7/examples/surface_mesh/tagged_mesh.msh +3445 -0
  11. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/pyproject.toml +7 -2
  12. cad_to_dagmc-0.9.7/src/_version.py +34 -0
  13. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/src/cad_to_dagmc/__init__.py +1 -0
  14. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/src/cad_to_dagmc/core.py +409 -136
  15. cad_to_dagmc-0.9.7/src/cad_to_dagmc/direct_mesh_plugin.py +510 -0
  16. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/src/cad_to_dagmc.egg-info/PKG-INFO +18 -21
  17. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/src/cad_to_dagmc.egg-info/SOURCES.txt +9 -0
  18. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/src/cad_to_dagmc.egg-info/requires.txt +1 -0
  19. cad_to_dagmc-0.9.7/tests/tagged_mesh.msh +3445 -0
  20. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/test_file_creation.py +27 -14
  21. cad_to_dagmc-0.9.7/tests/test_get_volumes.py +105 -0
  22. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/test_h5m_in_transport.py +66 -16
  23. cad_to_dagmc-0.9.7/tests/test_kwarg_args.py +346 -0
  24. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/test_loading_from_file_vs_shape_object.py +0 -2
  25. cad_to_dagmc-0.9.7/tests/test_mesh_to_dagmc.py +106 -0
  26. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/test_python_api.py +111 -10
  27. cad_to_dagmc-0.8.2/src/_version.py +0 -16
  28. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/.github/workflows/black.yml +0 -0
  29. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/.github/workflows/python-publish.yml +0 -0
  30. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/.gitignore +0 -0
  31. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/CITATION.cff +0 -0
  32. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/LICENSE +0 -0
  33. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/cadquery_assembly.py +0 -0
  34. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +0 -0
  35. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/cadquery_compound.py +0 -0
  36. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
  37. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/cadquery_text.py +0 -0
  38. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
  39. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/different_resolution_meshes.py +0 -0
  40. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
  41. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/multiple_stp_files.py +0 -0
  42. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/single_cadquery_object.py +0 -0
  43. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/single_stp_file.py +0 -0
  44. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
  45. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +0 -0
  46. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/unstrucutred_volume_mesh/different_resolution_meshes.py +0 -0
  47. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -0
  48. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/setup.cfg +0 -0
  49. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
  50. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
  51. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
  52. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/ball_reactor.brep +0 -0
  53. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/curved_extrude.stp +0 -0
  54. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/extrude_rectangle.stp +0 -0
  55. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/multi_volume_cylinders.stp +0 -0
  56. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/one_cube.brep +0 -0
  57. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/single_cube.stp +0 -0
  58. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/single_volume_thin.stp +0 -0
  59. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/single_volume_thin.vtk +0 -0
  60. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/test_brep_file.brep +0 -0
  61. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/test_two_joined_cubes.brep +0 -0
  62. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/test_two_sep_cubes.brep +0 -0
  63. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/test_version.py +0 -0
  64. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/tests/two_connected_cubes.stp +0 -0
  65. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.7}/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
@@ -31,33 +31,43 @@ jobs:
31
31
  sudo apt-get update -y
32
32
  sudo apt-get upgrade -y
33
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
34
42
 
35
- - name: Set up Conda
36
- uses: conda-incubator/setup-miniconda@v2
37
- with:
38
- activate-environment: ci-env
39
- miniforge-version: latest
40
- channels: conda-forge
41
-
42
- - name: install dependencies
43
- shell: bash -l {0}
43
+ - name: Create and activate Conda environment
44
44
  run: |
45
- conda install -y -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh vtk
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
46
49
  python -m pip install .[tests]
47
-
50
+ python -m pip install git+https://github.com/svalinn/pydagmc
51
+
48
52
  - name: Test import
49
53
  shell: bash -l {0}
50
54
  run: |
55
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
56
+ conda activate ci-env
51
57
  python -c "import cad_to_dagmc"
52
58
 
53
59
  - name: Run tests
54
60
  shell: bash -l {0}
55
61
  run: |
62
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
63
+ conda activate ci-env
56
64
  pytest -v tests
57
65
 
58
66
  - name: Run examples
59
67
  shell: bash -l {0}
60
68
  run: |
69
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
70
+ conda activate ci-env
61
71
  python examples/surface_mesh/cadquery_assembly.py
62
72
  python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
63
73
  python examples/surface_mesh/cadquery_compound.py
@@ -65,6 +75,8 @@ jobs:
65
75
  python examples/surface_mesh/cadquery_text.py
66
76
  python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
67
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
68
80
  python examples/surface_mesh/multiple_cadquery_objects.py
69
81
  python examples/surface_mesh/multiple_stp_files.py
70
82
  python examples/surface_mesh/single_cadquery_object.py
@@ -75,3 +87,4 @@ jobs:
75
87
  python examples/unstrucutred_volume_mesh/different_resolution_meshes.py
76
88
  python examples/surface_mesh/different_resolution_meshes.py
77
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
@@ -21,43 +21,47 @@ on:
21
21
  jobs:
22
22
  testing:
23
23
  runs-on: ubuntu-latest
24
- container:
25
- image: openmc/openmc:develop-dagmc
24
+ strategy:
25
+ matrix:
26
+ python-version: [3.12]
26
27
  steps:
28
+ - name: Set up Python ${{ matrix.python-version }}
29
+ uses: actions/setup-python@v5
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
27
32
  - name: Checkout repository
28
33
  uses: actions/checkout@v4
29
34
 
30
35
  - name: install non pypi dependencies
31
36
  shell: bash
32
37
  run: |
33
- apt-get --allow-releaseinfo-change update
34
- apt-get update -y
35
- apt-get upgrade -y
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
- apt install python3
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 ..
38
+ sudo apt-get update -y
39
+ sudo apt-get upgrade -y
40
+ sudo 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
41
+ # Python3 and pip are pre-installed on GitHub Actions runners
42
+ python -m pip install --extra-index-url https://shimwell.github.io/wheels moab openmc
44
43
  python -c "import pymoab"
45
44
  python -m pip install .[tests]
45
+ python -m pip install git+https://github.com/svalinn/pydagmc
46
46
  python -c "import cad_to_dagmc"
47
47
  pytest -v tests
48
48
  python examples/surface_mesh/cadquery_assembly.py
49
+ python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
49
50
  python examples/surface_mesh/cadquery_compound.py
50
51
  python examples/surface_mesh/cadquery_object_and_stp_file.py
51
52
  python examples/surface_mesh/cadquery_text.py
52
53
  python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
54
+ python examples/surface_mesh/from_gmsh_mesh_file.py
55
+ python examples/surface_mesh/from_gmsh_mesh_file_with_tags.py
56
+ python examples/surface_mesh/from_gmsh_object_with_tag.py
53
57
  python examples/surface_mesh/multiple_cadquery_objects.py
54
58
  python examples/surface_mesh/multiple_stp_files.py
55
- python examples/surface_mesh/single_stp_file_multiple_volumes.py
56
59
  python examples/surface_mesh/single_cadquery_object.py
60
+ python examples/surface_mesh/single_stp_file_multiple_volumes.py
57
61
  python examples/surface_mesh/single_stp_file.py
58
- python examples/surface_mesh/from_gmsh_mesh_file.py
59
62
  python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
60
63
  python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
61
64
  python examples/unstrucutred_volume_mesh/different_resolution_meshes.py
62
65
  python examples/surface_mesh/different_resolution_meshes.py
63
- python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
66
+ python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
67
+ python examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: cad_to_dagmc
3
- Version: 0.8.2
3
+ Version: 0.9.7
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
@@ -20,6 +20,8 @@ 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)
@@ -43,13 +45,16 @@ cad-to-dagmc can create DAGMC compatible:
43
45
 
44
46
  cad-to-dagmc can convert the following in to DAGMC compatible meshes:
45
47
  - STEP files
46
- - CadQuery objects (in memory)
47
- - Gmsh meshes
48
+ - CadQuery objects (optionally use names as material tags)
49
+ - Gmsh meshes (optionally use physical groups as material tags)
48
50
 
49
51
  Cad-to-dagmc offers a wide range of features including.
50
52
  - Geometry scaling with ```scale_factor``` argument
51
- - Model wide mesh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
53
+ - Direct 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
52
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.
53
58
  - Parallel meshing to quickly mesh the geometry using multiple CPU cores
54
59
  - Imprint and merging of CAD geometry, or disable with the ```imprint``` argument
55
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)
@@ -58,6 +63,9 @@ Cad-to-dagmc offers a wide range of features including.
58
63
  - Pass CadQuery objects in memory for fast transfer of geometry using the ```method``` argument
59
64
  - Easy to install with [pip](https://pypi.org/project/cad-to-dagmc/) and [Conda/Mamba](https://anaconda.org/conda-forge/cad_to_dagmc)
60
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)
61
69
  - Compatible with [Paramak](https://github.com/fusion-energy/paramak) geometry for fusion simulations.
62
70
 
63
71
 
@@ -65,7 +73,7 @@ Cad-to-dagmc offers a wide range of features including.
65
73
 
66
74
  - Install using Mamba
67
75
  - Install using Conda
68
- - Install using pip and source compilations
76
+ - Install using pip
69
77
 
70
78
  ## Install using Mamba
71
79
 
@@ -125,21 +133,10 @@ First ensure hdf5 is installed as this is needed by MOAB pip install command
125
133
  sudo apt-get install libhdf5-dev
126
134
  ```
127
135
 
128
- Then clone the latest version of MOAB and cd into the moab directory.
136
+ Then install MOAB, currently available from the repo.
129
137
 
130
138
  ```
131
- git clone master https://bitbucket.org/fathomteam/moab/
132
- cd moab
133
- ```
134
-
135
- Ensure pip is up to date as a new version is needed
136
- ```
137
- python -m pip install --upgrade pip
138
- ```
139
-
140
- Run the pip install command with cmake arguments.
141
- ```
142
- pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
139
+ pip install git+https://bitbucket.org/fathomteam/moab/
143
140
  ```
144
141
 
145
142
  Then you can install the cad_to_dagmc package with ```pip```
@@ -154,10 +151,10 @@ You may also want to install OpenMC with DAGMC to make use of the h5m geometry f
154
151
 
155
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
156
153
  ```bash
157
- mamba install -c conda-forge -y "openmc=0.15.0=dagmc*nompi*"
154
+ mamba install -c conda-forge -y "openmc=0.15.2=dagmc*nompi*"
158
155
  ```
159
156
 
160
- 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.
157
+ You could also install using this [wheel repo](https://github.com/shimwell/wheels)
161
158
 
162
159
  Another option would be to [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which would also need compiling with MOAB and DAGMC options.
163
160
 
@@ -20,13 +20,16 @@ cad-to-dagmc can create DAGMC compatible:
20
20
 
21
21
  cad-to-dagmc can convert the following in to DAGMC compatible meshes:
22
22
  - STEP files
23
- - CadQuery objects (in memory)
24
- - Gmsh meshes
23
+ - CadQuery objects (optionally use names as material tags)
24
+ - Gmsh meshes (optionally use physical groups as material tags)
25
25
 
26
26
  Cad-to-dagmc offers a wide range of features including.
27
27
  - Geometry scaling with ```scale_factor``` argument
28
- - Model wide mesh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
28
+ - Direct 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
29
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.
30
33
  - Parallel meshing to quickly mesh the geometry using multiple CPU cores
31
34
  - Imprint and merging of CAD geometry, or disable with the ```imprint``` argument
32
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)
@@ -35,6 +38,9 @@ Cad-to-dagmc offers a wide range of features including.
35
38
  - Pass CadQuery objects in memory for fast transfer of geometry using the ```method``` argument
36
39
  - Easy to install with [pip](https://pypi.org/project/cad-to-dagmc/) and [Conda/Mamba](https://anaconda.org/conda-forge/cad_to_dagmc)
37
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)
38
44
  - Compatible with [Paramak](https://github.com/fusion-energy/paramak) geometry for fusion simulations.
39
45
 
40
46
 
@@ -42,7 +48,7 @@ Cad-to-dagmc offers a wide range of features including.
42
48
 
43
49
  - Install using Mamba
44
50
  - Install using Conda
45
- - Install using pip and source compilations
51
+ - Install using pip
46
52
 
47
53
  ## Install using Mamba
48
54
 
@@ -102,21 +108,10 @@ First ensure hdf5 is installed as this is needed by MOAB pip install command
102
108
  sudo apt-get install libhdf5-dev
103
109
  ```
104
110
 
105
- Then clone the latest version of MOAB and cd into the moab directory.
111
+ Then install MOAB, currently available from the repo.
106
112
 
107
113
  ```
108
- git clone master https://bitbucket.org/fathomteam/moab/
109
- cd moab
110
- ```
111
-
112
- Ensure pip is up to date as a new version is needed
113
- ```
114
- python -m pip install --upgrade pip
115
- ```
116
-
117
- Run the pip install command with cmake arguments.
118
- ```
119
- pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
114
+ pip install git+https://bitbucket.org/fathomteam/moab/
120
115
  ```
121
116
 
122
117
  Then you can install the cad_to_dagmc package with ```pip```
@@ -131,10 +126,10 @@ You may also want to install OpenMC with DAGMC to make use of the h5m geometry f
131
126
 
132
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
133
128
  ```bash
134
- mamba install -c conda-forge -y "openmc=0.15.0=dagmc*nompi*"
129
+ mamba install -c conda-forge -y "openmc=0.15.2=dagmc*nompi*"
135
130
  ```
136
131
 
137
- 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.
132
+ You could also install using this [wheel repo](https://github.com/shimwell/wheels)
138
133
 
139
134
  Another option would be to [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which would also need compiling with MOAB and DAGMC options.
140
135
 
@@ -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})
@@ -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
 
@@ -0,0 +1,44 @@
1
+ # this file makes a GMESH mesh file that contains 3D physical groups.
2
+ # these groups are then used as the material tags in the DAGMC file.
3
+
4
+
5
+ # making the GMESH file
6
+ import cad_to_dagmc
7
+ import openmc
8
+
9
+
10
+ # converting the mesh file to a DAGMC file
11
+
12
+ cad_to_dagmc.export_gmsh_file_to_dagmc_h5m_file(
13
+ gmsh_filename="examples/surface_mesh/tagged_mesh.msh",
14
+ # no need to specify material tags as the mesh file already has physical
15
+ # groups which are used as material tags
16
+ # material_tags=["shell", "insert"],
17
+ dagmc_filename="dagmc.h5m",
18
+ )
19
+
20
+ # making use of the DAGMC file in OpenMC
21
+
22
+ openmc.config["cross_sections"] = "cross_sections.xml"
23
+
24
+ mat1 = openmc.Material(name="shell")
25
+ mat1.add_nuclide("H1", 1, percent_type="ao")
26
+ mat1.set_density("g/cm3", 0.001)
27
+
28
+ mat2 = openmc.Material(name="insert")
29
+ mat2.add_nuclide("H1", 1, percent_type="ao")
30
+ mat2.set_density("g/cm3", 0.002)
31
+
32
+ materials = openmc.Materials([mat1, mat2])
33
+
34
+ universe = openmc.DAGMCUniverse("dagmc.h5m").bounded_universe()
35
+ geometry = openmc.Geometry(universe)
36
+
37
+ my_settings = openmc.Settings()
38
+ my_settings.batches = 10
39
+ my_settings.inactive = 0
40
+ my_settings.particles = 500
41
+ my_settings.run_mode = "fixed source"
42
+
43
+ model = openmc.Model(geometry=geometry, materials=materials, settings=my_settings)
44
+ model.run()
@@ -0,0 +1,26 @@
1
+ import cadquery as cq
2
+ import cad_to_dagmc
3
+ import gmsh
4
+ import assembly_mesh_plugin
5
+
6
+ box_shape1 = cq.Workplane("XY").box(50, 50, 50)
7
+ box_shape2 = cq.Workplane("XY").moveTo(0, 50).box(50, 50, 100)
8
+
9
+ assembly = cq.Assembly()
10
+ assembly.add(box_shape1, name="first_material")
11
+ assembly.add(box_shape2, name="second_material")
12
+
13
+ # getTaggedGmsh initializes gmsh and creates a mesh object ready for meshing
14
+ assembly.getTaggedGmsh()
15
+ # Here you can set the mesh parameters
16
+ # In this case, we set the minimum and maximum mesh size
17
+ # but you can set any other Gmsh parameters
18
+ # Remember that the gmsh has physical groups if you want to use them when meshing
19
+ gmsh.option.setNumber("Mesh.MeshSizeMax", 4.2)
20
+ gmsh.model.mesh.generate(2) # for DAGMC surface mesh we just need a 2D surface mesh
21
+
22
+ cad_to_dagmc.export_gmsh_object_to_dagmc_h5m_file(filename="dagmc_from_gmsh_object.h5m")
23
+
24
+ # finalize the GMSH API after using export_gmsh_object_to_dagmc_h5m_file
25
+ # and getTaggedGmsh as these both need access to the GMSH object.
26
+ gmsh.finalize()