cad-to-dagmc 0.4.0__tar.gz → 0.5.1__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.4.0 → cad_to_dagmc-0.5.1}/.github/workflows/black.yml +2 -2
- cad_to_dagmc-0.5.1/.github/workflows/ci_with_benchmarks.yml +48 -0
- cad_to_dagmc-0.5.1/.github/workflows/ci_with_install.yml +63 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/.gitignore +1 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/PKG-INFO +38 -29
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/README.md +33 -27
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/examples/cadquery_compound.py +1 -6
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/examples/cadquery_object_and_stp_file.py +1 -3
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/examples/cadquery_text.py +1 -3
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/examples/create_stp_files_for_examples.py +1 -6
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/examples/single_stp_file_multiple_volumes.py +1 -3
- cad_to_dagmc-0.5.1/src/_version.py +16 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/src/cad_to_dagmc/__init__.py +1 -4
- cad_to_dagmc-0.5.1/src/cad_to_dagmc/core.py +479 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/src/cad_to_dagmc.egg-info/PKG-INFO +38 -29
- cad_to_dagmc-0.5.1/src/cad_to_dagmc.egg-info/SOURCES.txt +53 -0
- cad_to_dagmc-0.5.1/tests/extrude_rectangle.step +0 -0
- cad_to_dagmc-0.5.1/tests/single_cube.step +0 -0
- cad_to_dagmc-0.4.0/tests/test_cad_to_dagmc/test_h5m_creation.py → cad_to_dagmc-0.5.1/tests/test_file_creation.py +16 -34
- {cad_to_dagmc-0.4.0/tests/test_cad_to_dagmc → cad_to_dagmc-0.5.1/tests}/test_h5m_in_simulation.py +8 -12
- {cad_to_dagmc-0.4.0/tests/test_brep_to_h5m → cad_to_dagmc-0.5.1/tests}/test_h5m_in_transport.py +0 -2
- {cad_to_dagmc-0.4.0/tests/test_brep_part_finder → cad_to_dagmc-0.5.1/tests}/test_loading_from_file_vs_shape_object.py +6 -5
- cad_to_dagmc-0.5.1/tests/test_match.py +39 -0
- cad_to_dagmc-0.5.1/tests/test_package.py +435 -0
- cad_to_dagmc-0.4.0/.github/workflows/ci_with_install.yml +0 -113
- cad_to_dagmc-0.4.0/src/_version.py +0 -4
- cad_to_dagmc-0.4.0/src/cad_to_dagmc/brep_part_finder.py +0 -37
- cad_to_dagmc-0.4.0/src/cad_to_dagmc/brep_to_h5m.py +0 -118
- cad_to_dagmc-0.4.0/src/cad_to_dagmc/core.py +0 -171
- cad_to_dagmc-0.4.0/src/cad_to_dagmc/vertices_to_h5m.py +0 -211
- cad_to_dagmc-0.4.0/src/cad_to_dagmc.egg-info/SOURCES.txt +0 -58
- cad_to_dagmc-0.4.0/tests/test_cad_to_dagmc/extrude_rectangle.stp +0 -547
- cad_to_dagmc-0.4.0/tests/test_cad_to_dagmc/multi_volume_cylinders.stp +0 -2088
- cad_to_dagmc-0.4.0/tests/test_cad_to_dagmc/single_cube.stp +0 -427
- cad_to_dagmc-0.4.0/tests/test_cad_to_dagmc/single_volume_thin.stp +0 -3698
- cad_to_dagmc-0.4.0/tests/test_vertices_to_h5m/test_package.py +0 -424
- cad_to_dagmc-0.4.0/tests/two_connected_cubes.stp +0 -876
- cad_to_dagmc-0.4.0/tests/two_disconnected_cubes.stp +0 -876
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/.github/workflows/anaconda-publish.yml +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/.github/workflows/python-publish.yml +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/LICENSE +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/examples/cadquery_assembly.py +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/examples/curved_cadquery_object.py +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/examples/multiple_cadquery_objects.py +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/examples/multiple_stp_files.py +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/examples/single_cadquery_object.py +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/examples/single_stp_file.py +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/pyproject.toml +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/setup.cfg +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/src/cad_to_dagmc.egg-info/requires.txt +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
- {cad_to_dagmc-0.4.0/tests/test_brep_part_finder → cad_to_dagmc-0.5.1/tests}/ball_reactor.brep +0 -0
- {cad_to_dagmc-0.4.0/tests/test_brep_to_h5m → cad_to_dagmc-0.5.1/tests}/create_brep_file_for_testing.py +0 -0
- {cad_to_dagmc-0.4.0/tests/test_cad_to_dagmc → cad_to_dagmc-0.5.1/tests}/curved_extrude.stp +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/tests/extrude_rectangle.stp +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/tests/multi_volume_cylinders.stp +0 -0
- {cad_to_dagmc-0.4.0/tests/test_brep_to_h5m → cad_to_dagmc-0.5.1/tests}/one_cube.brep +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/tests/single_cube.stp +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/tests/single_volume_thin.stp +0 -0
- {cad_to_dagmc-0.4.0 → cad_to_dagmc-0.5.1}/tests/single_volume_thin.vtk +0 -0
- {cad_to_dagmc-0.4.0/tests/test_brep_to_h5m → cad_to_dagmc-0.5.1/tests}/test_brep_file.brep +0 -0
- {cad_to_dagmc-0.4.0/tests/test_brep_to_h5m → cad_to_dagmc-0.5.1/tests}/test_python_api.py +0 -0
- {cad_to_dagmc-0.4.0/tests/test_brep_to_h5m → cad_to_dagmc-0.5.1/tests}/test_two_joined_cubes.brep +0 -0
- {cad_to_dagmc-0.4.0/tests/test_brep_to_h5m → cad_to_dagmc-0.5.1/tests}/test_two_sep_cubes.brep +0 -0
- {cad_to_dagmc-0.4.0/tests/test_cad_to_dagmc → cad_to_dagmc-0.5.1/tests}/test_version.py +0 -0
- {cad_to_dagmc-0.4.0/tests/test_cad_to_dagmc → cad_to_dagmc-0.5.1/tests}/two_connected_cubes.stp +0 -0
- {cad_to_dagmc-0.4.0/tests/test_cad_to_dagmc → cad_to_dagmc-0.5.1/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,48 @@
|
|
|
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 non pypi dependencies for cad creation
|
|
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 cadquery -c conda-forge moab gmsh python-gmsh cadquery=master "openmc=0.13.3=dagmc*nompi*"
|
|
41
|
+
mamba install -y -c conda-forge "openmc=0.13.3=dagmc*nompi*"
|
|
42
|
+
python -m pip install --upgrade pip
|
|
43
|
+
python -m pip install cad_to_dagmc openmc_data_downloader
|
|
44
|
+
openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9
|
|
45
|
+
git clone https://github.com/fusion-energy/model_benchmark_zoo.git
|
|
46
|
+
cd model_benchmark_zoo
|
|
47
|
+
python -m pip install .[tests]
|
|
48
|
+
pytest tests/test_cad_to_dagmc -v
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
# This CI will launch a Docker image that contains all the dependencies required
|
|
3
|
+
# within that image the pytest test suite is run
|
|
4
|
+
# container:
|
|
5
|
+
# image: continuumio/miniconda3:23.3.1-0
|
|
6
|
+
|
|
7
|
+
name: CI with install
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
pull_request:
|
|
11
|
+
branches:
|
|
12
|
+
- main
|
|
13
|
+
paths-ignore:
|
|
14
|
+
- 'docs/**'
|
|
15
|
+
- '.gitignore'
|
|
16
|
+
- '*.md'
|
|
17
|
+
- 'CITATION.cff'
|
|
18
|
+
- 'LICENSE.txt'
|
|
19
|
+
- 'readthedocs.yml'
|
|
20
|
+
push:
|
|
21
|
+
branches:
|
|
22
|
+
- main
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
testing:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout repository
|
|
29
|
+
uses: actions/checkout@v4
|
|
30
|
+
|
|
31
|
+
# - uses: conda-incubator/setup-miniconda@v2
|
|
32
|
+
|
|
33
|
+
- name: install non pypi dependencies
|
|
34
|
+
shell: bash
|
|
35
|
+
run: |
|
|
36
|
+
wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
|
|
37
|
+
bash Miniforge3.sh -b -p "${HOME}/conda"
|
|
38
|
+
source "${HOME}/conda/etc/profile.d/conda.sh"
|
|
39
|
+
source "${HOME}/conda/etc/profile.d/mamba.sh"
|
|
40
|
+
sudo apt-get --allow-releaseinfo-change update
|
|
41
|
+
sudo apt-get update -y
|
|
42
|
+
sudo apt-get upgrade -y
|
|
43
|
+
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
|
|
44
|
+
mamba activate
|
|
45
|
+
mamba install -y -c cadquery -c conda-forge moab gmsh python-gmsh cadquery=master
|
|
46
|
+
python -m pip install --upgrade pip
|
|
47
|
+
python -m pip install .
|
|
48
|
+
python -c "import cad_to_dagmc"
|
|
49
|
+
mamba install -y -c conda-forge "openmc=0.13.3=dagmc*nompi*"
|
|
50
|
+
python -m pip install .[tests]
|
|
51
|
+
pytest tests -v
|
|
52
|
+
cd examples
|
|
53
|
+
python create_stp_files_for_examples.py
|
|
54
|
+
python cadquery_assembly.py
|
|
55
|
+
python cadquery_compound.py
|
|
56
|
+
python cadquery_object_and_stp_file.py
|
|
57
|
+
python cadquery_text.py
|
|
58
|
+
python curved_cadquery_object.py
|
|
59
|
+
python multiple_cadquery_objects.py
|
|
60
|
+
python multiple_stp_files.py
|
|
61
|
+
python single_stp_file_multiple_volumes.py
|
|
62
|
+
python single_cadquery_object.py
|
|
63
|
+
python single_stp_file.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cad_to_dagmc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
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
|
|
@@ -11,52 +11,62 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
12
|
Requires-Python: >=3.8
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
|
-
Provides-Extra: tests
|
|
15
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: trimesh
|
|
16
|
+
Requires-Dist: networkx
|
|
17
|
+
Provides-Extra: tests
|
|
18
|
+
Requires-Dist: pytest; extra == "tests"
|
|
16
19
|
|
|
17
20
|
|
|
18
21
|
[](https://www.python.org)
|
|
19
22
|
|
|
20
|
-
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml) Testing package and running examples
|
|
21
24
|
|
|
22
|
-
[](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)
|
|
23
26
|
|
|
27
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/python-publish.yml)
|
|
24
28
|
|
|
25
29
|
[](https://pypi.org/project/cad_to_dagmc/)
|
|
26
30
|
|
|
27
|
-
___
|
|
28
31
|
|
|
29
|
-
A minimal package that uses CadQuery functionality to convert
|
|
32
|
+
A minimal package that uses CadQuery functionality to convert CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) h5m files
|
|
30
33
|
|
|
31
|
-
This particular method of producing DAGMC compatible h5m files from CAD geometry
|
|
32
|
-
is intended to convert STP files or [CadQuery](https://cadquery.readthedocs.io) objects to h5m file.
|
|
34
|
+
This particular method of producing DAGMC compatible h5m files from CAD geometry is intended to convert STP files or [CadQuery](https://cadquery.readthedocs.io) objects to a DAGMC compatible h5m file.
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
This allows for the addition of parametric geometry to static geometry.
|
|
36
|
+
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/).
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
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.
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
Also checkout these other packages that also create DAGMC geometry [CAD-to-OpenMC](https://github.com/openmsr/CAD_to_OpenMC), [Stellarmesh](https://github.com/Thea-Energy/stellarmesh)
|
|
40
41
|
|
|
42
|
+
# Installation prerequisite
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
In principle, any Conda/Mamba distribution will work. A few Conda/Mamba options are:
|
|
45
|
+
- [Mambaforge](https://github.com/conda-forge/miniforge#mambaforge)
|
|
46
|
+
- [Miniforge](https://github.com/conda-forge/miniforge#miniforge-pypy3)
|
|
47
|
+
- [Anaconda](https://www.anaconda.com/download)
|
|
48
|
+
- [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
|
|
43
49
|
|
|
44
|
-
This example uses Conda to install some dependencies that are not available via PyPi.
|
|
45
50
|
|
|
46
|
-
|
|
51
|
+
# Install using Mamba and pip
|
|
52
|
+
|
|
53
|
+
This example assumes you have installed the MambaForge option or separately
|
|
54
|
+
installed Mamba with ```conda install -c conda-forge mamba -y```
|
|
55
|
+
|
|
56
|
+
Create a new conda environment, I've chosen Python 3.9 here but new versions are
|
|
57
|
+
also supported.
|
|
47
58
|
```bash
|
|
48
|
-
|
|
59
|
+
mamba create --name new_env python=3.9 -y
|
|
49
60
|
```
|
|
50
61
|
|
|
51
62
|
Activate the environment
|
|
52
63
|
```bash
|
|
53
|
-
|
|
64
|
+
mamba activate new_env
|
|
54
65
|
```
|
|
55
66
|
|
|
56
67
|
Install the dependencies
|
|
57
68
|
```bash
|
|
58
|
-
|
|
59
|
-
conda install -c cadquery -c conda-forge cadquery=master --no-deps -y
|
|
69
|
+
mamba install -c cadquery -c conda-forge moab gmsh python-gmsh cadquery=master -y
|
|
60
70
|
```
|
|
61
71
|
|
|
62
72
|
Then you can install the cad_to_dagmc package with ```pip```
|
|
@@ -66,30 +76,27 @@ pip install cad_to_dagmc
|
|
|
66
76
|
|
|
67
77
|
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/).You can run ```conda 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
78
|
```bash
|
|
69
|
-
|
|
79
|
+
mamba install -c conda-forge -y "openmc=0.13.3=dagmc*nompi*"
|
|
70
80
|
```
|
|
71
81
|
|
|
72
82
|
|
|
73
|
-
# Install using
|
|
83
|
+
# Install using Conda and pip
|
|
74
84
|
|
|
75
|
-
This example uses
|
|
85
|
+
This example uses Conda to install some dependencies that are not available via PyPi.
|
|
76
86
|
|
|
77
|
-
Create a new conda environment
|
|
78
|
-
also supported.
|
|
87
|
+
Create a new conda environment
|
|
79
88
|
```bash
|
|
80
89
|
conda create --name new_env python=3.9 -y
|
|
81
90
|
```
|
|
82
91
|
|
|
83
92
|
Activate the environment
|
|
84
93
|
```bash
|
|
85
|
-
|
|
94
|
+
conda activate new_env
|
|
86
95
|
```
|
|
87
96
|
|
|
88
97
|
Install the dependencies
|
|
89
98
|
```bash
|
|
90
|
-
conda install -c conda-forge
|
|
91
|
-
mamba install -c conda-forge moab multimethod typish ezdxf nptyping nlopt casadi gmsh python-gmsh ocp>=7.7.1 -y
|
|
92
|
-
mamba install -c cadquery -c conda-forge cadquery=master --no-deps -y
|
|
99
|
+
conda install -c cadquery -c conda-forge moab gmsh python-gmsh cadquery=master -y
|
|
93
100
|
```
|
|
94
101
|
|
|
95
102
|
Then you can install the cad_to_dagmc package with ```pip```
|
|
@@ -99,9 +106,11 @@ pip install cad_to_dagmc
|
|
|
99
106
|
|
|
100
107
|
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/).You can run ```conda 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
|
|
101
108
|
```bash
|
|
102
|
-
|
|
109
|
+
conda install -c conda-forge -y "openmc=0.13.3=dagmc*nompi*"
|
|
103
110
|
```
|
|
104
111
|
|
|
112
|
+
|
|
113
|
+
|
|
105
114
|
# Usage - creation of DAGMC h5m files
|
|
106
115
|
|
|
107
116
|
For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
|
|
@@ -1,46 +1,53 @@
|
|
|
1
1
|
|
|
2
2
|
[](https://www.python.org)
|
|
3
3
|
|
|
4
|
-
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml) Testing package and running examples
|
|
5
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
7
|
|
|
8
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/python-publish.yml)
|
|
8
9
|
|
|
9
10
|
[](https://pypi.org/project/cad_to_dagmc/)
|
|
10
11
|
|
|
11
|
-
___
|
|
12
12
|
|
|
13
|
-
A minimal package that uses CadQuery functionality to convert
|
|
13
|
+
A minimal package that uses CadQuery functionality to convert CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) h5m files
|
|
14
14
|
|
|
15
|
-
This particular method of producing DAGMC compatible h5m files from CAD geometry
|
|
16
|
-
is intended to convert STP files or [CadQuery](https://cadquery.readthedocs.io) objects to h5m file.
|
|
15
|
+
This particular method of producing DAGMC compatible h5m files from CAD geometry is intended to convert STP files or [CadQuery](https://cadquery.readthedocs.io) objects to a DAGMC compatible h5m file.
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
This allows for the addition of parametric geometry to static geometry.
|
|
17
|
+
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/).
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
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.
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
Also checkout these other packages that also create DAGMC geometry [CAD-to-OpenMC](https://github.com/openmsr/CAD_to_OpenMC), [Stellarmesh](https://github.com/Thea-Energy/stellarmesh)
|
|
24
22
|
|
|
23
|
+
# Installation prerequisite
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
In principle, any Conda/Mamba distribution will work. A few Conda/Mamba options are:
|
|
26
|
+
- [Mambaforge](https://github.com/conda-forge/miniforge#mambaforge)
|
|
27
|
+
- [Miniforge](https://github.com/conda-forge/miniforge#miniforge-pypy3)
|
|
28
|
+
- [Anaconda](https://www.anaconda.com/download)
|
|
29
|
+
- [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
|
|
27
30
|
|
|
28
|
-
This example uses Conda to install some dependencies that are not available via PyPi.
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
# Install using Mamba and pip
|
|
33
|
+
|
|
34
|
+
This example assumes you have installed the MambaForge option or separately
|
|
35
|
+
installed Mamba with ```conda install -c conda-forge mamba -y```
|
|
36
|
+
|
|
37
|
+
Create a new conda environment, I've chosen Python 3.9 here but new versions are
|
|
38
|
+
also supported.
|
|
31
39
|
```bash
|
|
32
|
-
|
|
40
|
+
mamba create --name new_env python=3.9 -y
|
|
33
41
|
```
|
|
34
42
|
|
|
35
43
|
Activate the environment
|
|
36
44
|
```bash
|
|
37
|
-
|
|
45
|
+
mamba activate new_env
|
|
38
46
|
```
|
|
39
47
|
|
|
40
48
|
Install the dependencies
|
|
41
49
|
```bash
|
|
42
|
-
|
|
43
|
-
conda install -c cadquery -c conda-forge cadquery=master --no-deps -y
|
|
50
|
+
mamba install -c cadquery -c conda-forge moab gmsh python-gmsh cadquery=master -y
|
|
44
51
|
```
|
|
45
52
|
|
|
46
53
|
Then you can install the cad_to_dagmc package with ```pip```
|
|
@@ -50,30 +57,27 @@ pip install cad_to_dagmc
|
|
|
50
57
|
|
|
51
58
|
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/).You can run ```conda 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
|
|
52
59
|
```bash
|
|
53
|
-
|
|
60
|
+
mamba install -c conda-forge -y "openmc=0.13.3=dagmc*nompi*"
|
|
54
61
|
```
|
|
55
62
|
|
|
56
63
|
|
|
57
|
-
# Install using
|
|
64
|
+
# Install using Conda and pip
|
|
58
65
|
|
|
59
|
-
This example uses
|
|
66
|
+
This example uses Conda to install some dependencies that are not available via PyPi.
|
|
60
67
|
|
|
61
|
-
Create a new conda environment
|
|
62
|
-
also supported.
|
|
68
|
+
Create a new conda environment
|
|
63
69
|
```bash
|
|
64
70
|
conda create --name new_env python=3.9 -y
|
|
65
71
|
```
|
|
66
72
|
|
|
67
73
|
Activate the environment
|
|
68
74
|
```bash
|
|
69
|
-
|
|
75
|
+
conda activate new_env
|
|
70
76
|
```
|
|
71
77
|
|
|
72
78
|
Install the dependencies
|
|
73
79
|
```bash
|
|
74
|
-
conda install -c conda-forge
|
|
75
|
-
mamba install -c conda-forge moab multimethod typish ezdxf nptyping nlopt casadi gmsh python-gmsh ocp>=7.7.1 -y
|
|
76
|
-
mamba install -c cadquery -c conda-forge cadquery=master --no-deps -y
|
|
80
|
+
conda install -c cadquery -c conda-forge moab gmsh python-gmsh cadquery=master -y
|
|
77
81
|
```
|
|
78
82
|
|
|
79
83
|
Then you can install the cad_to_dagmc package with ```pip```
|
|
@@ -83,9 +87,11 @@ pip install cad_to_dagmc
|
|
|
83
87
|
|
|
84
88
|
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/).You can run ```conda 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
|
|
85
89
|
```bash
|
|
86
|
-
|
|
90
|
+
conda install -c conda-forge -y "openmc=0.13.3=dagmc*nompi*"
|
|
87
91
|
```
|
|
88
92
|
|
|
93
|
+
|
|
94
|
+
|
|
89
95
|
# Usage - creation of DAGMC h5m files
|
|
90
96
|
|
|
91
97
|
For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
|
|
@@ -17,12 +17,7 @@ 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
|
|
|
@@ -5,7 +5,5 @@ result = cq.Workplane("XY").moveTo(10, 0).box(3, 3, 0.5).edges("|Z").fillet(0.12
|
|
|
5
5
|
|
|
6
6
|
my_model = CadToDagmc()
|
|
7
7
|
my_model.add_cadquery_object(object=result, material_tags=["mat1"])
|
|
8
|
-
my_model.add_stp_file(
|
|
9
|
-
filename="single_cube.stp", material_tags=["mat2"], scale_factor=0.1
|
|
10
|
-
)
|
|
8
|
+
my_model.add_stp_file(filename="single_cube.stp", material_tags=["mat2"], scale_factor=0.1)
|
|
11
9
|
my_model.export_dagmc_h5m_file(max_mesh_size=0.2, min_mesh_size=0.1)
|
|
@@ -16,6 +16,4 @@ my_model.add_cadquery_object(
|
|
|
16
16
|
], # 5 volumes one for each letter
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
-
my_model.export_dagmc_h5m_file(
|
|
20
|
-
filename="cadquery_text.h5m", max_mesh_size=0.2, min_mesh_size=0.1
|
|
21
|
-
)
|
|
19
|
+
my_model.export_dagmc_h5m_file(filename="cadquery_text.h5m", max_mesh_size=0.2, min_mesh_size=0.1)
|
|
@@ -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)
|
|
@@ -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
|
-
"text_dagmc.stp", material_tags=["mat1", "mat2", "mat2", "mat2", "mat1"]
|
|
7
|
-
)
|
|
5
|
+
my_model.add_stp_file("text_dagmc.stp", material_tags=["mat1", "mat2", "mat2", "mat2", "mat1"])
|
|
8
6
|
my_model.export_dagmc_h5m_file()
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# file generated by setuptools_scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
TYPE_CHECKING = False
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from typing import Tuple, Union
|
|
6
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
|
+
else:
|
|
8
|
+
VERSION_TUPLE = object
|
|
9
|
+
|
|
10
|
+
version: str
|
|
11
|
+
__version__: str
|
|
12
|
+
__version_tuple__: VERSION_TUPLE
|
|
13
|
+
version_tuple: VERSION_TUPLE
|
|
14
|
+
|
|
15
|
+
__version__ = version = '0.5.1'
|
|
16
|
+
__version_tuple__ = version_tuple = (0, 5, 1)
|