cad-to-dagmc 0.5.0__tar.gz → 0.6.0__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.
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/.github/workflows/black.yml +2 -2
- cad_to_dagmc-0.6.0/.github/workflows/ci_with_benchmarks.yml +47 -0
- cad_to_dagmc-0.6.0/.github/workflows/ci_with_install.yml +70 -0
- cad_to_dagmc-0.6.0/.github/workflows/ci_with_pip_install.yml +57 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/.gitignore +1 -0
- cad_to_dagmc-0.6.0/PKG-INFO +144 -0
- cad_to_dagmc-0.6.0/README.md +124 -0
- {cad_to_dagmc-0.5.0/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/cadquery_assembly.py +2 -2
- {cad_to_dagmc-0.5.0/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/cadquery_compound.py +3 -8
- cad_to_dagmc-0.6.0/examples/surface_mesh/cadquery_object_and_stp_file.py +16 -0
- {cad_to_dagmc-0.5.0/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/cadquery_text.py +6 -6
- {cad_to_dagmc-0.5.0/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/create_stp_files_for_examples.py +1 -6
- cad_to_dagmc-0.5.0/examples/curved_cadquery_object.py → cad_to_dagmc-0.6.0/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +5 -5
- {cad_to_dagmc-0.5.0/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/multiple_cadquery_objects.py +3 -3
- cad_to_dagmc-0.6.0/examples/surface_mesh/multiple_stp_files.py +12 -0
- {cad_to_dagmc-0.5.0/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/single_cadquery_object.py +2 -2
- cad_to_dagmc-0.6.0/examples/surface_mesh/single_stp_file.py +5 -0
- {cad_to_dagmc-0.5.0/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/single_stp_file_multiple_volumes.py +2 -4
- cad_to_dagmc-0.6.0/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +62 -0
- cad_to_dagmc-0.6.0/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +71 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/pyproject.toml +2 -1
- cad_to_dagmc-0.6.0/src/_version.py +16 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc/__init__.py +1 -6
- cad_to_dagmc-0.6.0/src/cad_to_dagmc/core.py +503 -0
- cad_to_dagmc-0.6.0/src/cad_to_dagmc.egg-info/PKG-INFO +144 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc.egg-info/SOURCES.txt +16 -15
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc.egg-info/requires.txt +1 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/test_file_creation.py +85 -32
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/test_h5m_in_simulation.py +4 -8
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/test_h5m_in_transport.py +30 -26
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/test_loading_from_file_vs_shape_object.py +1 -0
- cad_to_dagmc-0.6.0/tests/test_model_creation_for_transport.py +47 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/test_package.py +2 -5
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/test_python_api.py +10 -5
- cad_to_dagmc-0.5.0/.github/workflows/ci_with_install.yml +0 -112
- cad_to_dagmc-0.5.0/PKG-INFO +0 -119
- cad_to_dagmc-0.5.0/README.md +0 -100
- cad_to_dagmc-0.5.0/examples/cadquery_object_and_stp_file.py +0 -11
- cad_to_dagmc-0.5.0/examples/multiple_stp_files.py +0 -7
- cad_to_dagmc-0.5.0/examples/single_stp_file.py +0 -5
- cad_to_dagmc-0.5.0/src/_version.py +0 -8
- cad_to_dagmc-0.5.0/src/cad_to_dagmc/brep_part_finder.py +0 -36
- cad_to_dagmc-0.5.0/src/cad_to_dagmc/brep_to_h5m.py +0 -121
- cad_to_dagmc-0.5.0/src/cad_to_dagmc/core.py +0 -171
- cad_to_dagmc-0.5.0/src/cad_to_dagmc/vertices_to_h5m.py +0 -262
- cad_to_dagmc-0.5.0/src/cad_to_dagmc.egg-info/PKG-INFO +0 -119
- cad_to_dagmc-0.5.0/tests/test_match.py +0 -41
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/.github/workflows/anaconda-publish.yml +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/.github/workflows/python-publish.yml +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/LICENSE +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/setup.cfg +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/ball_reactor.brep +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/create_brep_file_for_testing.py +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/curved_extrude.stp +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/extrude_rectangle.step +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/extrude_rectangle.stp +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/multi_volume_cylinders.stp +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/one_cube.brep +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/single_cube.step +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/single_cube.stp +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/single_volume_thin.stp +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/single_volume_thin.vtk +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/test_brep_file.brep +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/test_two_joined_cubes.brep +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/test_two_sep_cubes.brep +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/test_version.py +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/two_connected_cubes.stp +0 -0
- {cad_to_dagmc-0.5.0 → cad_to_dagmc-0.6.0}/tests/two_disconnected_cubes.stp +0 -0
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
black:
|
|
14
14
|
runs-on: ubuntu-latest
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v3
|
|
17
17
|
with:
|
|
18
18
|
ref: ${{ github.head_ref }}
|
|
19
19
|
- name: Setup Python
|
|
@@ -26,7 +26,7 @@ jobs:
|
|
|
26
26
|
pip install black
|
|
27
27
|
- name: Run black
|
|
28
28
|
run: |
|
|
29
|
-
black .
|
|
29
|
+
black --line-length 100 .
|
|
30
30
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
|
31
31
|
with:
|
|
32
32
|
commit_message: "[skip ci] Apply formatting changes"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
name: CI with model benchmark zoo
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
paths-ignore:
|
|
9
|
+
- 'docs/**'
|
|
10
|
+
- '.gitignore'
|
|
11
|
+
- '*.md'
|
|
12
|
+
- 'CITATION.cff'
|
|
13
|
+
- 'LICENSE.txt'
|
|
14
|
+
- 'readthedocs.yml'
|
|
15
|
+
push:
|
|
16
|
+
branches:
|
|
17
|
+
- main
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
testing:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout repository
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
|
|
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
|
|
30
|
+
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
|
+
sudo apt-get update -y
|
|
37
|
+
sudo apt-get upgrade -y
|
|
38
|
+
sudo apt-get install -y libgl1-mesa-glx 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 moab gmsh python-gmsh cadquery=2.4.0 "openmc=0.14.0=dagmc*nompi*"
|
|
41
|
+
python -m pip install --upgrade pip
|
|
42
|
+
python -m pip install cad_to_dagmc openmc_data_downloader
|
|
43
|
+
openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9
|
|
44
|
+
git clone https://github.com/fusion-energy/model_benchmark_zoo.git
|
|
45
|
+
cd model_benchmark_zoo
|
|
46
|
+
python -m pip install .[tests]
|
|
47
|
+
pytest tests/test_cad_to_dagmc -v
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
|
|
2
|
+
name: CI with install
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
paths-ignore:
|
|
9
|
+
- 'docs/**'
|
|
10
|
+
- '.gitignore'
|
|
11
|
+
- '*.md'
|
|
12
|
+
- 'CITATION.cff'
|
|
13
|
+
- 'LICENSE.txt'
|
|
14
|
+
- 'readthedocs.yml'
|
|
15
|
+
push:
|
|
16
|
+
branches:
|
|
17
|
+
- main
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
testing:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout repository
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: install non pypi dependencies
|
|
27
|
+
shell: bash
|
|
28
|
+
run: |
|
|
29
|
+
wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
|
|
30
|
+
bash Miniforge3.sh -b -p "${HOME}/conda"
|
|
31
|
+
source "${HOME}/conda/etc/profile.d/conda.sh"
|
|
32
|
+
source "${HOME}/conda/etc/profile.d/mamba.sh"
|
|
33
|
+
sudo apt-get --allow-releaseinfo-change update
|
|
34
|
+
sudo apt-get update -y
|
|
35
|
+
sudo apt-get upgrade -y
|
|
36
|
+
sudo apt-get install -y libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0
|
|
37
|
+
mamba activate
|
|
38
|
+
mamba create -y --name cad_to_dagmc python=3.10
|
|
39
|
+
mamba activate cad_to_dagmc
|
|
40
|
+
mamba install -y -c conda-forge moab>=5.3.0 gmsh python-gmsh ocp=7.7.2.0 cadquery=2.4.0
|
|
41
|
+
python -m pip install --upgrade pip
|
|
42
|
+
python -m pip install .
|
|
43
|
+
python -c "import cad_to_dagmc"
|
|
44
|
+
python -m pip install .[tests]
|
|
45
|
+
pytest -v tests/test_file_creation.py
|
|
46
|
+
pytest -v tests/test_loading_from_file_vs_shape_object.py
|
|
47
|
+
pytest -v tests/test_python_api.py
|
|
48
|
+
pytest -v tests/test_version.py
|
|
49
|
+
python examples/surface_mesh/create_stp_files_for_examples.py
|
|
50
|
+
python examples/surface_mesh/cadquery_assembly.py
|
|
51
|
+
python examples/surface_mesh/cadquery_compound.py
|
|
52
|
+
python examples/surface_mesh/cadquery_object_and_stp_file.py
|
|
53
|
+
python examples/surface_mesh/cadquery_text.py
|
|
54
|
+
python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
|
|
55
|
+
python examples/surface_mesh/multiple_cadquery_objects.py
|
|
56
|
+
python examples/surface_mesh/multiple_stp_files.py
|
|
57
|
+
python examples/surface_mesh/single_stp_file_multiple_volumes.py
|
|
58
|
+
python examples/surface_mesh/single_cadquery_object.py
|
|
59
|
+
python examples/surface_mesh/single_stp_file.py
|
|
60
|
+
python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
|
|
61
|
+
pytest -v tests/test_model_creation_for_transport.py
|
|
62
|
+
mamba activate base
|
|
63
|
+
mamba create -y --name openmc python=3.10
|
|
64
|
+
mamba activate openmc
|
|
65
|
+
mamba install -y -c conda-forge "openmc=0.14.0=dagmc*nompi*"
|
|
66
|
+
python -m pip install pytest
|
|
67
|
+
python -m pip install vtk
|
|
68
|
+
pytest -v tests/test_h5m_in_simulation.py
|
|
69
|
+
pytest -v tests/test_h5m_in_transport.py
|
|
70
|
+
python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
|
|
2
|
+
name: CI with pip install
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
paths-ignore:
|
|
9
|
+
- 'docs/**'
|
|
10
|
+
- '.gitignore'
|
|
11
|
+
- '*.md'
|
|
12
|
+
- 'CITATION.cff'
|
|
13
|
+
- 'LICENSE.txt'
|
|
14
|
+
- 'readthedocs.yml'
|
|
15
|
+
push:
|
|
16
|
+
branches:
|
|
17
|
+
- main
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
testing:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
container:
|
|
23
|
+
image: openmc/openmc:develop-dagmc
|
|
24
|
+
steps:
|
|
25
|
+
- name: Checkout repository
|
|
26
|
+
uses: actions/checkout@v4
|
|
27
|
+
|
|
28
|
+
- name: install non pypi dependencies
|
|
29
|
+
shell: bash
|
|
30
|
+
run: |
|
|
31
|
+
apt-get --allow-releaseinfo-change update
|
|
32
|
+
apt-get update -y
|
|
33
|
+
apt-get upgrade -y
|
|
34
|
+
apt-get install -y libgl1-mesa-glx 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
|
|
35
|
+
apt install python3
|
|
36
|
+
apt install python3-pip
|
|
37
|
+
python -m pip install --upgrade pip
|
|
38
|
+
python -m pip install gmsh
|
|
39
|
+
python -m pip install cadquery-ocp==7.7.2
|
|
40
|
+
python -m pip install cadquery==2.4.0
|
|
41
|
+
python -m pip install .
|
|
42
|
+
python -c "import cad_to_dagmc"
|
|
43
|
+
python -m pip install .[tests]
|
|
44
|
+
pytest tests -v
|
|
45
|
+
cd examples
|
|
46
|
+
python create_stp_files_for_examples.py
|
|
47
|
+
python cadquery_assembly.py
|
|
48
|
+
python cadquery_compound.py
|
|
49
|
+
python cadquery_object_and_stp_file.py
|
|
50
|
+
python cadquery_text.py
|
|
51
|
+
python curved_cadquery_object_to_dagmc_surface_mesh.py
|
|
52
|
+
python curved_cadquery_object_to_dagmc_volume_mesh.py
|
|
53
|
+
python multiple_cadquery_objects.py
|
|
54
|
+
python multiple_stp_files.py
|
|
55
|
+
python single_stp_file_multiple_volumes.py
|
|
56
|
+
python single_cadquery_object.py
|
|
57
|
+
python single_stp_file.py
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: cad_to_dagmc
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: Converts CAD files to a DAGMC h5m file
|
|
5
|
+
Author-email: Jonathan Shimwell <mail@jshimwell.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/fusion-energy/cad_to_dagmc
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/fusion-energy/cad_to_dagmc/issues
|
|
8
|
+
Keywords: dagmc,geometry,plot,slice
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: trimesh
|
|
16
|
+
Requires-Dist: networkx
|
|
17
|
+
Provides-Extra: tests
|
|
18
|
+
Requires-Dist: pytest; extra == "tests"
|
|
19
|
+
Requires-Dist: vtk; extra == "tests"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
[](https://www.python.org)
|
|
23
|
+
|
|
24
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml) Testing package and running examples
|
|
25
|
+
|
|
26
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml) Testing with [Model Benchmark Zoo](https://github.com/fusion-energy/model_benchmark_zoo)
|
|
27
|
+
|
|
28
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/python-publish.yml)
|
|
29
|
+
|
|
30
|
+
[](https://pypi.org/project/cad_to_dagmc/)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
A minimal package that converts CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) h5m files
|
|
34
|
+
|
|
35
|
+
cad-to-dagmc can create:
|
|
36
|
+
- surface meshes / faceted geometry / triangular meshes
|
|
37
|
+
- unstructured mesh / tetrahedral meshes / volume meshes
|
|
38
|
+
|
|
39
|
+
cad-to-dagmc can convert:
|
|
40
|
+
- STEP files
|
|
41
|
+
- CadQuery objects (in memory)
|
|
42
|
+
|
|
43
|
+
cadto-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.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
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/).
|
|
47
|
+
|
|
48
|
+
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.
|
|
49
|
+
|
|
50
|
+
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/)
|
|
51
|
+
|
|
52
|
+
# Installation prerequisite
|
|
53
|
+
|
|
54
|
+
In principle, any Conda/Mamba distribution will work. A few Conda/Mamba options are:
|
|
55
|
+
- [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
|
|
56
|
+
- [Anaconda](https://www.anaconda.com/download)
|
|
57
|
+
- [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# Install using Mamba and pip
|
|
61
|
+
|
|
62
|
+
This example assumes you have installed the Miniforge option or separately have installed Mamba with ```conda install -c conda-forge mamba -y```
|
|
63
|
+
|
|
64
|
+
Create a new conda environment, I've chosen Python 3.10 here but newer versions are
|
|
65
|
+
also supported.
|
|
66
|
+
```bash
|
|
67
|
+
mamba create --name new_env python=3.10 -y
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Activate the environment
|
|
71
|
+
```bash
|
|
72
|
+
mamba activate new_env
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Install the dependencies
|
|
76
|
+
```bash
|
|
77
|
+
mamba install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Then you can install the cad_to_dagmc package with ```pip```
|
|
81
|
+
```bash
|
|
82
|
+
pip install cad_to_dagmc
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others [link to DAGMC documentation](https://svalinn.github.io/DAGMC/).
|
|
86
|
+
|
|
87
|
+
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
|
|
88
|
+
```bash
|
|
89
|
+
mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
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.
|
|
93
|
+
|
|
94
|
+
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.
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# Install using Conda and pip
|
|
98
|
+
|
|
99
|
+
This example uses Conda to install some dependencies that are not available via PyPi.
|
|
100
|
+
|
|
101
|
+
Create a new conda environment
|
|
102
|
+
```bash
|
|
103
|
+
conda create --name new_env python=3.10 -y
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Activate the environment
|
|
107
|
+
```bash
|
|
108
|
+
conda activate new_env
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Install the dependencies
|
|
112
|
+
```bash
|
|
113
|
+
conda install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Then you can install the cad_to_dagmc package with ```pip```
|
|
117
|
+
```bash
|
|
118
|
+
pip install cad_to_dagmc
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
# Usage - with OpenMC
|
|
122
|
+
|
|
123
|
+
You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others supported by [DAGMC](https://svalinn.github.io/DAGMC/).
|
|
124
|
+
|
|
125
|
+
You can run ```mamba install -c conda-forge openmc``` however this may choose to install OpenMC without DAGMC included.
|
|
126
|
+
|
|
127
|
+
You can be more specific with conda/mamba commands to make sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
|
|
128
|
+
```bash
|
|
129
|
+
mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
You could also [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which might be prefered as it can be tricky for the conda enviroment to get resolved.
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# Usage - creation of DAGMC h5m files
|
|
137
|
+
|
|
138
|
+
For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
|
|
139
|
+
|
|
140
|
+
# Usage - simulation with transport code
|
|
141
|
+
|
|
142
|
+
For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
|
|
143
|
+
|
|
144
|
+
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)
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
|
|
2
|
+
[](https://www.python.org)
|
|
3
|
+
|
|
4
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml) Testing package and running examples
|
|
5
|
+
|
|
6
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml) Testing with [Model Benchmark Zoo](https://github.com/fusion-energy/model_benchmark_zoo)
|
|
7
|
+
|
|
8
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/python-publish.yml)
|
|
9
|
+
|
|
10
|
+
[](https://pypi.org/project/cad_to_dagmc/)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
A minimal package that converts CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) h5m files
|
|
14
|
+
|
|
15
|
+
cad-to-dagmc can create:
|
|
16
|
+
- surface meshes / faceted geometry / triangular meshes
|
|
17
|
+
- unstructured mesh / tetrahedral meshes / volume meshes
|
|
18
|
+
|
|
19
|
+
cad-to-dagmc can convert:
|
|
20
|
+
- STEP files
|
|
21
|
+
- CadQuery objects (in memory)
|
|
22
|
+
|
|
23
|
+
cadto-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.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
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/).
|
|
27
|
+
|
|
28
|
+
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.
|
|
29
|
+
|
|
30
|
+
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/)
|
|
31
|
+
|
|
32
|
+
# Installation prerequisite
|
|
33
|
+
|
|
34
|
+
In principle, any Conda/Mamba distribution will work. A few Conda/Mamba options are:
|
|
35
|
+
- [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
|
|
36
|
+
- [Anaconda](https://www.anaconda.com/download)
|
|
37
|
+
- [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Install using Mamba and pip
|
|
41
|
+
|
|
42
|
+
This example assumes you have installed the Miniforge option or separately have installed Mamba with ```conda install -c conda-forge mamba -y```
|
|
43
|
+
|
|
44
|
+
Create a new conda environment, I've chosen Python 3.10 here but newer versions are
|
|
45
|
+
also supported.
|
|
46
|
+
```bash
|
|
47
|
+
mamba create --name new_env python=3.10 -y
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Activate the environment
|
|
51
|
+
```bash
|
|
52
|
+
mamba activate new_env
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Install the dependencies
|
|
56
|
+
```bash
|
|
57
|
+
mamba install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Then you can install the cad_to_dagmc package with ```pip```
|
|
61
|
+
```bash
|
|
62
|
+
pip install cad_to_dagmc
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others [link to DAGMC documentation](https://svalinn.github.io/DAGMC/).
|
|
66
|
+
|
|
67
|
+
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
|
|
68
|
+
```bash
|
|
69
|
+
mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
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.
|
|
73
|
+
|
|
74
|
+
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.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# Install using Conda and pip
|
|
78
|
+
|
|
79
|
+
This example uses Conda to install some dependencies that are not available via PyPi.
|
|
80
|
+
|
|
81
|
+
Create a new conda environment
|
|
82
|
+
```bash
|
|
83
|
+
conda create --name new_env python=3.10 -y
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Activate the environment
|
|
87
|
+
```bash
|
|
88
|
+
conda activate new_env
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Install the dependencies
|
|
92
|
+
```bash
|
|
93
|
+
conda install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Then you can install the cad_to_dagmc package with ```pip```
|
|
97
|
+
```bash
|
|
98
|
+
pip install cad_to_dagmc
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
# Usage - with OpenMC
|
|
102
|
+
|
|
103
|
+
You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others supported by [DAGMC](https://svalinn.github.io/DAGMC/).
|
|
104
|
+
|
|
105
|
+
You can run ```mamba install -c conda-forge openmc``` however this may choose to install OpenMC without DAGMC included.
|
|
106
|
+
|
|
107
|
+
You can be more specific with conda/mamba commands to make sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
|
|
108
|
+
```bash
|
|
109
|
+
mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
You could also [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which might be prefered as it can be tricky for the conda enviroment to get resolved.
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# Usage - creation of DAGMC h5m files
|
|
117
|
+
|
|
118
|
+
For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
|
|
119
|
+
|
|
120
|
+
# Usage - simulation with transport code
|
|
121
|
+
|
|
122
|
+
For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
|
|
123
|
+
|
|
124
|
+
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)
|
{cad_to_dagmc-0.5.0/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/cadquery_assembly.py
RENAMED
|
@@ -10,5 +10,5 @@ assembly.add(result)
|
|
|
10
10
|
assembly.add(result2)
|
|
11
11
|
|
|
12
12
|
my_model = CadToDagmc()
|
|
13
|
-
my_model.add_cadquery_object(assembly
|
|
14
|
-
my_model.export_dagmc_h5m_file(min_mesh_size=0.5, max_mesh_size=1.0)
|
|
13
|
+
my_model.add_cadquery_object(assembly)
|
|
14
|
+
my_model.export_dagmc_h5m_file(min_mesh_size=0.5, max_mesh_size=1.0, material_tags=["mat1", "mat2"])
|
{cad_to_dagmc-0.5.0/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/cadquery_compound.py
RENAMED
|
@@ -17,17 +17,12 @@ r = s.lineTo(3.0, 0).lineTo(3.0, 1.0).spline(spline_points, includeCurrent=True)
|
|
|
17
17
|
cq_shape_1 = r.extrude(-1)
|
|
18
18
|
|
|
19
19
|
s2 = cq.Workplane("XY")
|
|
20
|
-
r2 = (
|
|
21
|
-
s2.lineTo(3.0, 0)
|
|
22
|
-
.lineTo(3.0, 1.0)
|
|
23
|
-
.spline(spline_points, includeCurrent=True)
|
|
24
|
-
.close()
|
|
25
|
-
)
|
|
20
|
+
r2 = s2.lineTo(3.0, 0).lineTo(3.0, 1.0).spline(spline_points, includeCurrent=True).close()
|
|
26
21
|
cq_shape_2 = r2.extrude(1)
|
|
27
22
|
|
|
28
23
|
|
|
29
24
|
compound_of_shapes = cq.Compound.makeCompound([cq_shape_1.val(), cq_shape_2.val()])
|
|
30
25
|
|
|
31
26
|
my_model = CadToDagmc()
|
|
32
|
-
my_model.add_cadquery_object(object=compound_of_shapes
|
|
33
|
-
my_model.export_dagmc_h5m_file(max_mesh_size=0.2, min_mesh_size=0.1)
|
|
27
|
+
my_model.add_cadquery_object(object=compound_of_shapes)
|
|
28
|
+
my_model.export_dagmc_h5m_file(max_mesh_size=0.2, min_mesh_size=0.1, material_tags=["mat1", "mat2"])
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from cad_to_dagmc import CadToDagmc
|
|
2
|
+
import cadquery as cq
|
|
3
|
+
|
|
4
|
+
result = cq.Workplane("XY").moveTo(10, 0).box(3, 3, 0.5).edges("|Z").fillet(0.125)
|
|
5
|
+
|
|
6
|
+
my_model = CadToDagmc()
|
|
7
|
+
|
|
8
|
+
my_model.add_cadquery_object(result)
|
|
9
|
+
|
|
10
|
+
my_model.add_stp_file(filename="single_cube.stp", scale_factor=0.1)
|
|
11
|
+
|
|
12
|
+
my_model.export_dagmc_h5m_file(
|
|
13
|
+
max_mesh_size=0.2,
|
|
14
|
+
min_mesh_size=0.1,
|
|
15
|
+
material_tags=["mat1", "mat2"],
|
|
16
|
+
)
|
|
@@ -5,8 +5,12 @@ text = cq.Workplane().text(txt="DAGMC", fontsize=10, distance=1)
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
my_model = CadToDagmc()
|
|
8
|
-
my_model.add_cadquery_object(
|
|
9
|
-
|
|
8
|
+
my_model.add_cadquery_object(object=text)
|
|
9
|
+
|
|
10
|
+
my_model.export_dagmc_h5m_file(
|
|
11
|
+
filename="cadquery_text.h5m",
|
|
12
|
+
max_mesh_size=0.2,
|
|
13
|
+
min_mesh_size=0.1,
|
|
10
14
|
material_tags=[
|
|
11
15
|
"mat1",
|
|
12
16
|
"mat2",
|
|
@@ -15,7 +19,3 @@ my_model.add_cadquery_object(
|
|
|
15
19
|
"mat5",
|
|
16
20
|
], # 5 volumes one for each letter
|
|
17
21
|
)
|
|
18
|
-
|
|
19
|
-
my_model.export_dagmc_h5m_file(
|
|
20
|
-
filename="cadquery_text.h5m", max_mesh_size=0.2, min_mesh_size=0.1
|
|
21
|
-
)
|
|
@@ -46,12 +46,7 @@ spline_points = [
|
|
|
46
46
|
(0.5, 1.0),
|
|
47
47
|
(0, 1.0),
|
|
48
48
|
]
|
|
49
|
-
r = (
|
|
50
|
-
result.lineTo(3.0, 0)
|
|
51
|
-
.lineTo(3.0, 1.0)
|
|
52
|
-
.spline(spline_points, includeCurrent=True)
|
|
53
|
-
.close()
|
|
54
|
-
)
|
|
49
|
+
r = result.lineTo(3.0, 0).lineTo(3.0, 1.0).spline(spline_points, includeCurrent=True).close()
|
|
55
50
|
result = r.extrude(1.5)
|
|
56
51
|
assembly = Assembly()
|
|
57
52
|
assembly.add(result)
|
|
@@ -39,11 +39,11 @@ result = (
|
|
|
39
39
|
|
|
40
40
|
my_model = CadToDagmc()
|
|
41
41
|
|
|
42
|
-
my_model.add_cadquery_object(
|
|
43
|
-
result,
|
|
44
|
-
material_tags=["mat1"],
|
|
45
|
-
)
|
|
42
|
+
my_model.add_cadquery_object(result)
|
|
46
43
|
|
|
47
44
|
my_model.export_dagmc_h5m_file(
|
|
48
|
-
filename="cadquery_objects_and_stp_files.h5m",
|
|
45
|
+
filename="cadquery_objects_and_stp_files.h5m",
|
|
46
|
+
max_mesh_size=1,
|
|
47
|
+
min_mesh_size=0.1,
|
|
48
|
+
material_tags=["mat1"],
|
|
49
49
|
)
|
|
@@ -7,6 +7,6 @@ box = cq.Workplane("XY").moveTo(2, 0).box(2, 2, 2)
|
|
|
7
7
|
box_with_round_corners = cq.Workplane("XY").box(2, 1, 1)
|
|
8
8
|
|
|
9
9
|
my_model = CadToDagmc()
|
|
10
|
-
my_model.add_cadquery_object(box
|
|
11
|
-
my_model.add_cadquery_object(box_with_round_corners
|
|
12
|
-
my_model.export_dagmc_h5m_file()
|
|
10
|
+
my_model.add_cadquery_object(box)
|
|
11
|
+
my_model.add_cadquery_object(box_with_round_corners)
|
|
12
|
+
my_model.export_dagmc_h5m_file(material_tags=["mat1", "mat2"])
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from cad_to_dagmc import CadToDagmc
|
|
2
|
+
|
|
3
|
+
my_model = CadToDagmc()
|
|
4
|
+
my_model.add_stp_file("two_connected_cubes.stp")
|
|
5
|
+
my_model.add_stp_file("single_sphere.stp")
|
|
6
|
+
|
|
7
|
+
my_model.export_dagmc_h5m_file(
|
|
8
|
+
max_mesh_size=1,
|
|
9
|
+
min_mesh_size=0.5,
|
|
10
|
+
implicit_complement_material_tag="air",
|
|
11
|
+
material_tags=["mat1", "mat2", "mat3"],
|
|
12
|
+
)
|
{cad_to_dagmc-0.5.0/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/single_cadquery_object.py
RENAMED
|
@@ -4,5 +4,5 @@ import cadquery as cq
|
|
|
4
4
|
result = sphere = cq.Workplane().moveTo(100, 0).sphere(5)
|
|
5
5
|
|
|
6
6
|
my_model = CadToDagmc()
|
|
7
|
-
my_model.add_cadquery_object(result
|
|
8
|
-
my_model.export_dagmc_h5m_file()
|
|
7
|
+
my_model.add_cadquery_object(result)
|
|
8
|
+
my_model.export_dagmc_h5m_file(material_tags=["mat1"])
|
|
@@ -2,7 +2,5 @@ from cad_to_dagmc import CadToDagmc
|
|
|
2
2
|
|
|
3
3
|
my_model = CadToDagmc()
|
|
4
4
|
# the d and c from the word dagmc would be tagged with one material and the agm are tagged with another material
|
|
5
|
-
my_model.add_stp_file(
|
|
6
|
-
|
|
7
|
-
)
|
|
8
|
-
my_model.export_dagmc_h5m_file()
|
|
5
|
+
my_model.add_stp_file("text_dagmc.stp")
|
|
6
|
+
my_model.export_dagmc_h5m_file(material_tags=["mat1", "mat2", "mat2", "mat2", "mat1"])
|