cad-to-dagmc 0.5.1__tar.gz → 0.6.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.5.1 → cad_to_dagmc-0.6.1}/.github/workflows/ci_with_benchmarks.yml +7 -5
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/.github/workflows/ci_with_install.yml +18 -21
- cad_to_dagmc-0.6.1/.github/workflows/ci_with_pip_install.yml +67 -0
- cad_to_dagmc-0.6.1/PKG-INFO +180 -0
- cad_to_dagmc-0.6.1/README.md +158 -0
- {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.1/examples/surface_mesh}/cadquery_assembly.py +2 -2
- {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.1/examples/surface_mesh}/cadquery_compound.py +2 -2
- cad_to_dagmc-0.6.1/examples/surface_mesh/cadquery_object_and_stp_file.py +16 -0
- {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.1/examples/surface_mesh}/cadquery_text.py +6 -4
- cad_to_dagmc-0.5.1/examples/curved_cadquery_object.py → cad_to_dagmc-0.6.1/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +5 -5
- {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.1/examples/surface_mesh}/multiple_cadquery_objects.py +3 -3
- cad_to_dagmc-0.6.1/examples/surface_mesh/multiple_stp_files.py +12 -0
- {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.1/examples/surface_mesh}/single_cadquery_object.py +2 -2
- cad_to_dagmc-0.6.1/examples/surface_mesh/single_stp_file.py +5 -0
- {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.1/examples/surface_mesh}/single_stp_file_multiple_volumes.py +2 -2
- cad_to_dagmc-0.6.1/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +62 -0
- cad_to_dagmc-0.6.1/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +71 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/pyproject.toml +4 -1
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/src/_version.py +2 -2
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/src/cad_to_dagmc/core.py +142 -118
- cad_to_dagmc-0.6.1/src/cad_to_dagmc.egg-info/PKG-INFO +180 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/src/cad_to_dagmc.egg-info/SOURCES.txt +14 -14
- cad_to_dagmc-0.6.1/src/cad_to_dagmc.egg-info/requires.txt +8 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/test_file_creation.py +82 -15
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/test_h5m_in_transport.py +95 -17
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/test_loading_from_file_vs_shape_object.py +6 -6
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/test_python_api.py +10 -5
- cad_to_dagmc-0.5.1/PKG-INFO +0 -120
- cad_to_dagmc-0.5.1/README.md +0 -101
- cad_to_dagmc-0.5.1/examples/cadquery_object_and_stp_file.py +0 -9
- cad_to_dagmc-0.5.1/examples/multiple_stp_files.py +0 -7
- cad_to_dagmc-0.5.1/examples/single_stp_file.py +0 -5
- cad_to_dagmc-0.5.1/src/cad_to_dagmc.egg-info/PKG-INFO +0 -120
- cad_to_dagmc-0.5.1/src/cad_to_dagmc.egg-info/requires.txt +0 -5
- cad_to_dagmc-0.5.1/tests/test_h5m_in_simulation.py +0 -137
- cad_to_dagmc-0.5.1/tests/test_match.py +0 -39
- cad_to_dagmc-0.5.1/tests/test_package.py +0 -435
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/.github/workflows/anaconda-publish.yml +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/.github/workflows/black.yml +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/.github/workflows/python-publish.yml +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/.gitignore +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/LICENSE +0 -0
- {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.1/examples/surface_mesh}/create_stp_files_for_examples.py +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/setup.cfg +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/src/cad_to_dagmc/__init__.py +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/ball_reactor.brep +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/create_brep_file_for_testing.py +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/curved_extrude.stp +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/extrude_rectangle.step +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/extrude_rectangle.stp +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/multi_volume_cylinders.stp +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/one_cube.brep +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/single_cube.step +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/single_cube.stp +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/single_volume_thin.stp +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/single_volume_thin.vtk +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/test_brep_file.brep +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/test_two_joined_cubes.brep +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/test_two_sep_cubes.brep +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/test_version.py +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/two_connected_cubes.stp +0 -0
- {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.1}/tests/two_disconnected_cubes.stp +0 -0
|
@@ -23,7 +23,7 @@ jobs:
|
|
|
23
23
|
- name: Checkout repository
|
|
24
24
|
uses: actions/checkout@v4
|
|
25
25
|
|
|
26
|
-
- name: install
|
|
26
|
+
- name: install dependencies and run CSG / DAMGC benchmarks
|
|
27
27
|
env:
|
|
28
28
|
OPENMC_CROSS_SECTIONS: /home/runner/work/cad_to_dagmc/cad_to_dagmc/cross_sections.xml
|
|
29
29
|
shell: bash
|
|
@@ -37,12 +37,14 @@ jobs:
|
|
|
37
37
|
sudo apt-get upgrade -y
|
|
38
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
39
|
mamba activate
|
|
40
|
-
mamba install -y -c
|
|
41
|
-
mamba install -y -c conda-forge "openmc=0.13.3=dagmc*nompi*"
|
|
40
|
+
mamba install -y -c conda-forge "openmc=0.14.0=dagmc*nompi*" moab>=5.3.0 gmsh python-gmsh
|
|
42
41
|
python -m pip install --upgrade pip
|
|
43
|
-
python -m pip install
|
|
42
|
+
python -m pip install .
|
|
43
|
+
python -m pip install openmc_data_downloader
|
|
44
44
|
openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9
|
|
45
|
-
git clone https://github.com/fusion-energy/model_benchmark_zoo.git
|
|
45
|
+
git clone --single-branch -b main --depth 1 https://github.com/fusion-energy/model_benchmark_zoo.git
|
|
46
46
|
cd model_benchmark_zoo
|
|
47
47
|
python -m pip install .[tests]
|
|
48
|
+
conda env export > environment.yml
|
|
49
|
+
cat environment.yml
|
|
48
50
|
pytest tests/test_cad_to_dagmc -v
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
# This CI
|
|
3
|
-
# within that image the pytest test suite is run
|
|
4
|
-
# container:
|
|
5
|
-
# image: continuumio/miniconda3:23.3.1-0
|
|
2
|
+
# This CI does includes particle transport tests as openmc is installed
|
|
6
3
|
|
|
7
4
|
name: CI with install
|
|
8
5
|
|
|
@@ -28,8 +25,6 @@ jobs:
|
|
|
28
25
|
- name: Checkout repository
|
|
29
26
|
uses: actions/checkout@v4
|
|
30
27
|
|
|
31
|
-
# - uses: conda-incubator/setup-miniconda@v2
|
|
32
|
-
|
|
33
28
|
- name: install non pypi dependencies
|
|
34
29
|
shell: bash
|
|
35
30
|
run: |
|
|
@@ -42,22 +37,24 @@ jobs:
|
|
|
42
37
|
sudo apt-get upgrade -y
|
|
43
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
|
|
44
39
|
mamba activate
|
|
45
|
-
mamba
|
|
40
|
+
mamba create -y --name cad_to_dagmc python=3.10
|
|
41
|
+
mamba activate cad_to_dagmc
|
|
42
|
+
mamba install -y -c conda-forge "openmc=0.14.0=dagmc*nompi*" gmsh python-gmsh
|
|
46
43
|
python -m pip install --upgrade pip
|
|
47
44
|
python -m pip install .
|
|
48
45
|
python -c "import cad_to_dagmc"
|
|
49
|
-
mamba install -y -c conda-forge "openmc=0.13.3=dagmc*nompi*"
|
|
50
46
|
python -m pip install .[tests]
|
|
51
|
-
pytest
|
|
52
|
-
|
|
53
|
-
python
|
|
54
|
-
python
|
|
55
|
-
python
|
|
56
|
-
python
|
|
57
|
-
python
|
|
58
|
-
python
|
|
59
|
-
python
|
|
60
|
-
python
|
|
61
|
-
python
|
|
62
|
-
python
|
|
63
|
-
python
|
|
47
|
+
pytest -v tests
|
|
48
|
+
python examples/surface_mesh/create_stp_files_for_examples.py
|
|
49
|
+
python examples/surface_mesh/cadquery_assembly.py
|
|
50
|
+
python examples/surface_mesh/cadquery_compound.py
|
|
51
|
+
python examples/surface_mesh/cadquery_object_and_stp_file.py
|
|
52
|
+
python examples/surface_mesh/cadquery_text.py
|
|
53
|
+
python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
|
|
54
|
+
python examples/surface_mesh/multiple_cadquery_objects.py
|
|
55
|
+
python examples/surface_mesh/multiple_stp_files.py
|
|
56
|
+
python examples/surface_mesh/single_stp_file_multiple_volumes.py
|
|
57
|
+
python examples/surface_mesh/single_cadquery_object.py
|
|
58
|
+
python examples/surface_mesh/single_stp_file.py
|
|
59
|
+
python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
|
|
60
|
+
python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
# This CI does not currently include particle transport tests as openmc is not installed
|
|
3
|
+
|
|
4
|
+
name: CI with pip install
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
paths-ignore:
|
|
11
|
+
- 'docs/**'
|
|
12
|
+
- '.gitignore'
|
|
13
|
+
- '*.md'
|
|
14
|
+
- 'CITATION.cff'
|
|
15
|
+
- 'LICENSE.txt'
|
|
16
|
+
- 'readthedocs.yml'
|
|
17
|
+
push:
|
|
18
|
+
branches:
|
|
19
|
+
- main
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
testing:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
container:
|
|
25
|
+
image: openmc/openmc:develop-dagmc
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout repository
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: install non pypi dependencies
|
|
31
|
+
shell: bash
|
|
32
|
+
run: |
|
|
33
|
+
apt-get --allow-releaseinfo-change update
|
|
34
|
+
apt-get update -y
|
|
35
|
+
apt-get upgrade -y
|
|
36
|
+
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
|
|
37
|
+
apt-get install -y make cmake
|
|
38
|
+
apt install python3
|
|
39
|
+
apt install python3-pip
|
|
40
|
+
python -m pip install --upgrade pip
|
|
41
|
+
mkdir MOAB
|
|
42
|
+
cd MOAB
|
|
43
|
+
git clone --single-branch -b 5.5.1 --depth 1 https://bitbucket.org/fathomteam/moab/
|
|
44
|
+
mkdir build
|
|
45
|
+
cd build
|
|
46
|
+
apt-get install -y libeigen3-dev
|
|
47
|
+
cmake ../moab -DENABLE_PYMOAB=ON -DENABLE_HDF5=ON -DENABLE_BLASLAPACK=OFF -DENABLE_FORTRAN=OFF
|
|
48
|
+
make -j2
|
|
49
|
+
make install
|
|
50
|
+
cd ../..
|
|
51
|
+
python -m pip install .
|
|
52
|
+
python -c "import cad_to_dagmc"
|
|
53
|
+
python -m pip install .[tests]
|
|
54
|
+
pytest -v tests
|
|
55
|
+
cd examples
|
|
56
|
+
python create_stp_files_for_examples.py
|
|
57
|
+
python cadquery_assembly.py
|
|
58
|
+
python cadquery_compound.py
|
|
59
|
+
python cadquery_object_and_stp_file.py
|
|
60
|
+
python cadquery_text.py
|
|
61
|
+
python curved_cadquery_object_to_dagmc_surface_mesh.py
|
|
62
|
+
python curved_cadquery_object_to_dagmc_volume_mesh.py
|
|
63
|
+
python multiple_cadquery_objects.py
|
|
64
|
+
python multiple_stp_files.py
|
|
65
|
+
python single_stp_file_multiple_volumes.py
|
|
66
|
+
python single_cadquery_object.py
|
|
67
|
+
python single_stp_file.py
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: cad_to_dagmc
|
|
3
|
+
Version: 0.6.1
|
|
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
|
+
Requires-Dist: cadquery-ocp>=7.7.2
|
|
18
|
+
Requires-Dist: cadquery>=2.4.0
|
|
19
|
+
Provides-Extra: tests
|
|
20
|
+
Requires-Dist: pytest; extra == "tests"
|
|
21
|
+
Requires-Dist: vtk; extra == "tests"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
[](https://www.python.org)
|
|
25
|
+
|
|
26
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml) Testing package and running examples
|
|
27
|
+
|
|
28
|
+
[](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)
|
|
29
|
+
|
|
30
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/python-publish.yml)
|
|
31
|
+
|
|
32
|
+
[](https://pypi.org/project/cad_to_dagmc/)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
A minimal package that converts CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) h5m files
|
|
36
|
+
|
|
37
|
+
cad-to-dagmc can create:
|
|
38
|
+
- surface meshes / faceted geometry / triangular meshes
|
|
39
|
+
- unstructured mesh / tetrahedral meshes / volume meshes
|
|
40
|
+
|
|
41
|
+
cad-to-dagmc can convert:
|
|
42
|
+
- STEP files
|
|
43
|
+
- CadQuery objects (in memory)
|
|
44
|
+
|
|
45
|
+
cad-to-dagmc aims to produce DAGMC compatible h5m files from CAD geometry is intended to convert [STEP](http://www.steptools.com/stds/step/) files or [CadQuery](https://cadquery.readthedocs.io) objects to a [DAGMC](https://github.com/svalinn/DAGMC/) compatible h5m file.
|
|
46
|
+
|
|
47
|
+
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/).
|
|
48
|
+
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
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/)
|
|
52
|
+
|
|
53
|
+
# Installation options
|
|
54
|
+
|
|
55
|
+
- Install using Mamba and pip
|
|
56
|
+
- Install using Conda and pip
|
|
57
|
+
- Install using pip and source compilations
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Install using Mamba and pip
|
|
61
|
+
|
|
62
|
+
In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
|
|
63
|
+
- [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
|
|
64
|
+
- [Anaconda](https://www.anaconda.com/download)
|
|
65
|
+
- [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
|
|
66
|
+
|
|
67
|
+
This example assumes you have installed the Miniforge option or separately have installed Mamba with ```conda install -c conda-forge mamba -y```
|
|
68
|
+
|
|
69
|
+
Create a new conda environment, I've chosen Python 3.10 here but newer versions are
|
|
70
|
+
also supported.
|
|
71
|
+
```bash
|
|
72
|
+
mamba create --name new_env python=3.10 -y
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Activate the environment
|
|
76
|
+
```bash
|
|
77
|
+
mamba activate new_env
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Install the dependencies
|
|
81
|
+
```bash
|
|
82
|
+
mamba install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Then you can install the cad_to_dagmc package with ```pip```
|
|
86
|
+
```bash
|
|
87
|
+
pip install cad_to_dagmc
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## Install using Conda and pip
|
|
92
|
+
|
|
93
|
+
In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
|
|
94
|
+
- [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
|
|
95
|
+
- [Anaconda](https://www.anaconda.com/download)
|
|
96
|
+
- [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
|
|
97
|
+
|
|
98
|
+
This example uses Conda to install some dependencies that are not available via PyPi.
|
|
99
|
+
|
|
100
|
+
Create a new conda environment
|
|
101
|
+
```bash
|
|
102
|
+
conda create --name new_env python=3.10 -y
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Activate the environment
|
|
106
|
+
```bash
|
|
107
|
+
conda activate new_env
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Install the dependencies
|
|
111
|
+
```bash
|
|
112
|
+
conda install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Then you can install the cad_to_dagmc package with ```pip```
|
|
116
|
+
```bash
|
|
117
|
+
pip install cad_to_dagmc
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Install using pip and source compilations
|
|
121
|
+
|
|
122
|
+
It should possible to avoid the use of conda and installing using pip and compiling from source.
|
|
123
|
+
|
|
124
|
+
First compile MOAB (and install Pymoab) from source
|
|
125
|
+
|
|
126
|
+
Then install gmsh from source (installing from pip appears to cause conflicts with the open cascade used in ocp and cadquery)
|
|
127
|
+
|
|
128
|
+
Then you can install the cad_to_dagmc package with ```pip```
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
pip install cad_to_dagmc
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Install with transport code (e.g OpenMC)
|
|
135
|
+
|
|
136
|
+
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/).
|
|
137
|
+
|
|
138
|
+
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
|
|
139
|
+
```bash
|
|
140
|
+
mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
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.
|
|
144
|
+
|
|
145
|
+
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.
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
# Known incompatibilities
|
|
150
|
+
|
|
151
|
+
The package requires newer versions of Linux. For example the package does not work on Ubuntu 18.04 or older.
|
|
152
|
+
|
|
153
|
+
The package requires newer versions of pip. It is recommended to ensure that your version of pip is up to date. This can be done with ```python -m pip install --upgrade pip```
|
|
154
|
+
|
|
155
|
+
Installing one of the package dependancies (gmsh) with pip appears to result in occational errors when passing cad objects between cadquery / ocp and gmsh. The conda install gmsh appears to work fine.
|
|
156
|
+
|
|
157
|
+
# Usage - with OpenMC
|
|
158
|
+
|
|
159
|
+
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/).
|
|
160
|
+
|
|
161
|
+
You can run ```mamba install -c conda-forge openmc``` however this may choose to install OpenMC without DAGMC included.
|
|
162
|
+
|
|
163
|
+
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
|
|
164
|
+
```bash
|
|
165
|
+
mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
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.
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
# Usage - creation of DAGMC h5m files
|
|
173
|
+
|
|
174
|
+
For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
|
|
175
|
+
|
|
176
|
+
# Usage - simulation with transport code
|
|
177
|
+
|
|
178
|
+
For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
|
|
179
|
+
|
|
180
|
+
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,158 @@
|
|
|
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
|
+
cad-to-dagmc aims to produce DAGMC compatible h5m files from CAD geometry is intended to convert [STEP](http://www.steptools.com/stds/step/) files or [CadQuery](https://cadquery.readthedocs.io) objects to a [DAGMC](https://github.com/svalinn/DAGMC/) compatible h5m file.
|
|
24
|
+
|
|
25
|
+
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/).
|
|
26
|
+
|
|
27
|
+
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.
|
|
28
|
+
|
|
29
|
+
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/)
|
|
30
|
+
|
|
31
|
+
# Installation options
|
|
32
|
+
|
|
33
|
+
- Install using Mamba and pip
|
|
34
|
+
- Install using Conda and pip
|
|
35
|
+
- Install using pip and source compilations
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Install using Mamba and pip
|
|
39
|
+
|
|
40
|
+
In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
|
|
41
|
+
- [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
|
|
42
|
+
- [Anaconda](https://www.anaconda.com/download)
|
|
43
|
+
- [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
|
|
44
|
+
|
|
45
|
+
This example assumes you have installed the Miniforge option or separately have installed Mamba with ```conda install -c conda-forge mamba -y```
|
|
46
|
+
|
|
47
|
+
Create a new conda environment, I've chosen Python 3.10 here but newer versions are
|
|
48
|
+
also supported.
|
|
49
|
+
```bash
|
|
50
|
+
mamba create --name new_env python=3.10 -y
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Activate the environment
|
|
54
|
+
```bash
|
|
55
|
+
mamba activate new_env
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Install the dependencies
|
|
59
|
+
```bash
|
|
60
|
+
mamba install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Then you can install the cad_to_dagmc package with ```pip```
|
|
64
|
+
```bash
|
|
65
|
+
pip install cad_to_dagmc
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## Install using Conda and pip
|
|
70
|
+
|
|
71
|
+
In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
|
|
72
|
+
- [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
|
|
73
|
+
- [Anaconda](https://www.anaconda.com/download)
|
|
74
|
+
- [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
|
|
75
|
+
|
|
76
|
+
This example uses Conda to install some dependencies that are not available via PyPi.
|
|
77
|
+
|
|
78
|
+
Create a new conda environment
|
|
79
|
+
```bash
|
|
80
|
+
conda create --name new_env python=3.10 -y
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Activate the environment
|
|
84
|
+
```bash
|
|
85
|
+
conda activate new_env
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Install the dependencies
|
|
89
|
+
```bash
|
|
90
|
+
conda install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Then you can install the cad_to_dagmc package with ```pip```
|
|
94
|
+
```bash
|
|
95
|
+
pip install cad_to_dagmc
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Install using pip and source compilations
|
|
99
|
+
|
|
100
|
+
It should possible to avoid the use of conda and installing using pip and compiling from source.
|
|
101
|
+
|
|
102
|
+
First compile MOAB (and install Pymoab) from source
|
|
103
|
+
|
|
104
|
+
Then install gmsh from source (installing from pip appears to cause conflicts with the open cascade used in ocp and cadquery)
|
|
105
|
+
|
|
106
|
+
Then you can install the cad_to_dagmc package with ```pip```
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pip install cad_to_dagmc
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Install with transport code (e.g OpenMC)
|
|
113
|
+
|
|
114
|
+
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/).
|
|
115
|
+
|
|
116
|
+
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
|
|
117
|
+
```bash
|
|
118
|
+
mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
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.
|
|
122
|
+
|
|
123
|
+
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.
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# Known incompatibilities
|
|
128
|
+
|
|
129
|
+
The package requires newer versions of Linux. For example the package does not work on Ubuntu 18.04 or older.
|
|
130
|
+
|
|
131
|
+
The package requires newer versions of pip. It is recommended to ensure that your version of pip is up to date. This can be done with ```python -m pip install --upgrade pip```
|
|
132
|
+
|
|
133
|
+
Installing one of the package dependancies (gmsh) with pip appears to result in occational errors when passing cad objects between cadquery / ocp and gmsh. The conda install gmsh appears to work fine.
|
|
134
|
+
|
|
135
|
+
# Usage - with OpenMC
|
|
136
|
+
|
|
137
|
+
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/).
|
|
138
|
+
|
|
139
|
+
You can run ```mamba install -c conda-forge openmc``` however this may choose to install OpenMC without DAGMC included.
|
|
140
|
+
|
|
141
|
+
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
|
|
142
|
+
```bash
|
|
143
|
+
mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
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.
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# Usage - creation of DAGMC h5m files
|
|
151
|
+
|
|
152
|
+
For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
|
|
153
|
+
|
|
154
|
+
# Usage - simulation with transport code
|
|
155
|
+
|
|
156
|
+
For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
|
|
157
|
+
|
|
158
|
+
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.1/examples → cad_to_dagmc-0.6.1/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.1/examples → cad_to_dagmc-0.6.1/examples/surface_mesh}/cadquery_compound.py
RENAMED
|
@@ -24,5 +24,5 @@ cq_shape_2 = r2.extrude(1)
|
|
|
24
24
|
compound_of_shapes = cq.Compound.makeCompound([cq_shape_1.val(), cq_shape_2.val()])
|
|
25
25
|
|
|
26
26
|
my_model = CadToDagmc()
|
|
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)
|
|
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,5 +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(filename="cadquery_text.h5m", max_mesh_size=0.2, min_mesh_size=0.1)
|
|
@@ -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.1/examples → cad_to_dagmc-0.6.1/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,5 +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("text_dagmc.stp"
|
|
6
|
-
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"])
|