cad-to-dagmc 0.8.2__tar.gz → 0.9.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.8.2 → cad_to_dagmc-0.9.1}/.github/workflows/ci_with_benchmarks.yml +29 -14
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/.github/workflows/ci_with_conda_install.yml +23 -11
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/.github/workflows/ci_with_pip_install.yml +3 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/PKG-INFO +12 -17
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/README.md +8 -15
- cad_to_dagmc-0.9.1/examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py +107 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/from_gmsh_mesh_file.py +7 -9
- cad_to_dagmc-0.9.1/examples/surface_mesh/from_gmsh_mesh_file_with_tags.py +44 -0
- cad_to_dagmc-0.9.1/examples/surface_mesh/from_gmsh_object_with_tag.py +26 -0
- cad_to_dagmc-0.9.1/examples/surface_mesh/tagged_mesh.msh +3445 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/pyproject.toml +3 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/src/_version.py +9 -4
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/src/cad_to_dagmc/core.py +174 -78
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/src/cad_to_dagmc.egg-info/PKG-INFO +12 -17
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/src/cad_to_dagmc.egg-info/SOURCES.txt +7 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/src/cad_to_dagmc.egg-info/requires.txt +1 -0
- cad_to_dagmc-0.9.1/tests/tagged_mesh.msh +3445 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/test_file_creation.py +8 -5
- cad_to_dagmc-0.9.1/tests/test_get_volumes.py +63 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/test_h5m_in_transport.py +46 -2
- cad_to_dagmc-0.9.1/tests/test_mesh_to_dagmc.py +106 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/test_python_api.py +53 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/.github/workflows/black.yml +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/.github/workflows/python-publish.yml +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/.gitignore +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/CITATION.cff +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/LICENSE +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/cadquery_assembly.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/cadquery_compound.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/cadquery_text.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/different_resolution_meshes.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/multiple_stp_files.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/single_cadquery_object.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/single_stp_file.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/unstrucutred_volume_mesh/different_resolution_meshes.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/setup.cfg +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/src/cad_to_dagmc/__init__.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/ball_reactor.brep +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/curved_extrude.stp +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/extrude_rectangle.stp +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/multi_volume_cylinders.stp +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/one_cube.brep +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/single_cube.stp +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/single_volume_thin.stp +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/single_volume_thin.vtk +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/test_brep_file.brep +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/test_loading_from_file_vs_shape_object.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/test_two_joined_cubes.brep +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/test_two_sep_cubes.brep +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/test_version.py +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/two_connected_cubes.stp +0 -0
- {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.1}/tests/two_disconnected_cubes.stp +0 -0
|
@@ -19,32 +19,47 @@ on:
|
|
|
19
19
|
jobs:
|
|
20
20
|
testing:
|
|
21
21
|
runs-on: ubuntu-latest
|
|
22
|
+
|
|
22
23
|
steps:
|
|
23
24
|
- name: Checkout repository
|
|
24
25
|
uses: actions/checkout@v4
|
|
25
26
|
|
|
26
|
-
- name:
|
|
27
|
-
env:
|
|
28
|
-
OPENMC_CROSS_SECTIONS: /home/runner/work/cad_to_dagmc/cad_to_dagmc/cross_sections.xml
|
|
29
|
-
shell: bash
|
|
27
|
+
- name: Install system packages
|
|
30
28
|
run: |
|
|
31
|
-
wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
|
|
32
|
-
bash Miniforge3.sh -b -p "${HOME}/conda"
|
|
33
|
-
source "${HOME}/conda/etc/profile.d/conda.sh"
|
|
34
|
-
source "${HOME}/conda/etc/profile.d/mamba.sh"
|
|
35
|
-
sudo apt-get --allow-releaseinfo-change update
|
|
36
29
|
sudo apt-get update -y
|
|
37
30
|
sudo apt-get upgrade -y
|
|
38
31
|
sudo apt-get install -y libgl1 libglx-mesa0 libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
|
|
33
|
+
- name: Set up Miniforge
|
|
34
|
+
run: |
|
|
35
|
+
wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-$(uname -m).sh"
|
|
36
|
+
bash Miniforge3.sh -b -p "${HOME}/miniforge"
|
|
37
|
+
source "${HOME}/miniforge/etc/profile.d/conda.sh"
|
|
38
|
+
conda init bash
|
|
39
|
+
conda config --set always_yes yes --set changeps1 no
|
|
40
|
+
conda update -q conda
|
|
41
|
+
|
|
42
|
+
- name: Create and activate Conda environment
|
|
43
|
+
run: |
|
|
44
|
+
source "${HOME}/miniforge/etc/profile.d/conda.sh"
|
|
45
|
+
conda create -n ci-env python=3.11
|
|
46
|
+
conda activate ci-env
|
|
47
|
+
conda install -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh vtk
|
|
48
|
+
python -m pip install .[tests]
|
|
49
|
+
python -m pip install git+https://github.com/svalinn/pydagmc
|
|
50
|
+
|
|
51
|
+
- name: Run tests
|
|
52
|
+
shell: bash -l {0}
|
|
53
|
+
env:
|
|
54
|
+
OPENMC_CROSS_SECTIONS: /home/runner/work/cad_to_dagmc/cad_to_dagmc/cross_sections.xml
|
|
55
|
+
run: |
|
|
56
|
+
source "${HOME}/miniforge/etc/profile.d/conda.sh"
|
|
57
|
+
conda activate ci-env
|
|
41
58
|
python -m ensurepip --upgrade
|
|
42
59
|
python -m pip install . --no-deps
|
|
43
60
|
python -m pip install openmc_data_downloader
|
|
44
|
-
openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9
|
|
61
|
+
openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9 Al27
|
|
45
62
|
git clone --single-branch -b main --depth 1 https://github.com/fusion-energy/model_benchmark_zoo.git
|
|
46
63
|
cd model_benchmark_zoo
|
|
47
64
|
python -m pip install .[tests]
|
|
48
|
-
conda env export > environment.yml
|
|
49
|
-
cat environment.yml
|
|
50
65
|
pytest tests/test_cad_to_dagmc -v
|
|
@@ -31,33 +31,43 @@ jobs:
|
|
|
31
31
|
sudo apt-get update -y
|
|
32
32
|
sudo apt-get upgrade -y
|
|
33
33
|
sudo apt-get install -y libgl1 libglx-mesa0 libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0
|
|
34
|
+
- name: Set up Miniforge
|
|
35
|
+
run: |
|
|
36
|
+
wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-$(uname -m).sh"
|
|
37
|
+
bash Miniforge3.sh -b -p "${HOME}/miniforge"
|
|
38
|
+
source "${HOME}/miniforge/etc/profile.d/conda.sh"
|
|
39
|
+
conda init bash
|
|
40
|
+
conda config --set always_yes yes --set changeps1 no
|
|
41
|
+
conda update -q conda
|
|
34
42
|
|
|
35
|
-
- name:
|
|
36
|
-
uses: conda-incubator/setup-miniconda@v2
|
|
37
|
-
with:
|
|
38
|
-
activate-environment: ci-env
|
|
39
|
-
miniforge-version: latest
|
|
40
|
-
channels: conda-forge
|
|
41
|
-
|
|
42
|
-
- name: install dependencies
|
|
43
|
-
shell: bash -l {0}
|
|
43
|
+
- name: Create and activate Conda environment
|
|
44
44
|
run: |
|
|
45
|
-
|
|
45
|
+
source "${HOME}/miniforge/etc/profile.d/conda.sh"
|
|
46
|
+
conda create -n ci-env python=3.11
|
|
47
|
+
conda activate ci-env
|
|
48
|
+
conda install -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh vtk
|
|
46
49
|
python -m pip install .[tests]
|
|
47
|
-
|
|
50
|
+
python -m pip install git+https://github.com/svalinn/pydagmc
|
|
51
|
+
|
|
48
52
|
- name: Test import
|
|
49
53
|
shell: bash -l {0}
|
|
50
54
|
run: |
|
|
55
|
+
source "${HOME}/miniforge/etc/profile.d/conda.sh"
|
|
56
|
+
conda activate ci-env
|
|
51
57
|
python -c "import cad_to_dagmc"
|
|
52
58
|
|
|
53
59
|
- name: Run tests
|
|
54
60
|
shell: bash -l {0}
|
|
55
61
|
run: |
|
|
62
|
+
source "${HOME}/miniforge/etc/profile.d/conda.sh"
|
|
63
|
+
conda activate ci-env
|
|
56
64
|
pytest -v tests
|
|
57
65
|
|
|
58
66
|
- name: Run examples
|
|
59
67
|
shell: bash -l {0}
|
|
60
68
|
run: |
|
|
69
|
+
source "${HOME}/miniforge/etc/profile.d/conda.sh"
|
|
70
|
+
conda activate ci-env
|
|
61
71
|
python examples/surface_mesh/cadquery_assembly.py
|
|
62
72
|
python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
|
|
63
73
|
python examples/surface_mesh/cadquery_compound.py
|
|
@@ -65,6 +75,8 @@ jobs:
|
|
|
65
75
|
python examples/surface_mesh/cadquery_text.py
|
|
66
76
|
python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
|
|
67
77
|
python examples/surface_mesh/from_gmsh_mesh_file.py
|
|
78
|
+
python examples/surface_mesh/from_gmsh_mesh_file_with_tags.py
|
|
79
|
+
python examples/surface_mesh/from_gmsh_object_with_tag.py
|
|
68
80
|
python examples/surface_mesh/multiple_cadquery_objects.py
|
|
69
81
|
python examples/surface_mesh/multiple_stp_files.py
|
|
70
82
|
python examples/surface_mesh/single_cadquery_object.py
|
|
@@ -43,6 +43,7 @@ jobs:
|
|
|
43
43
|
cd ..
|
|
44
44
|
python -c "import pymoab"
|
|
45
45
|
python -m pip install .[tests]
|
|
46
|
+
python -m pip install git+https://github.com/svalinn/pydagmc
|
|
46
47
|
python -c "import cad_to_dagmc"
|
|
47
48
|
pytest -v tests
|
|
48
49
|
python examples/surface_mesh/cadquery_assembly.py
|
|
@@ -56,6 +57,8 @@ jobs:
|
|
|
56
57
|
python examples/surface_mesh/single_cadquery_object.py
|
|
57
58
|
python examples/surface_mesh/single_stp_file.py
|
|
58
59
|
python examples/surface_mesh/from_gmsh_mesh_file.py
|
|
60
|
+
python examples/surface_mesh/from_gmsh_mesh_file_with_tags.py
|
|
61
|
+
python examples/surface_mesh/from_gmsh_object_with_tag.py
|
|
59
62
|
python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
|
|
60
63
|
python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
|
|
61
64
|
python examples/unstrucutred_volume_mesh/different_resolution_meshes.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: cad_to_dagmc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.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
|
|
@@ -20,6 +20,8 @@ Requires-Dist: gmsh
|
|
|
20
20
|
Provides-Extra: tests
|
|
21
21
|
Requires-Dist: pytest; extra == "tests"
|
|
22
22
|
Requires-Dist: vtk; extra == "tests"
|
|
23
|
+
Requires-Dist: assembly-mesh-plugin; extra == "tests"
|
|
24
|
+
Dynamic: license-file
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
[](https://www.python.org)
|
|
@@ -43,13 +45,17 @@ cad-to-dagmc can create DAGMC compatible:
|
|
|
43
45
|
|
|
44
46
|
cad-to-dagmc can convert the following in to DAGMC compatible meshes:
|
|
45
47
|
- STEP files
|
|
46
|
-
- CadQuery objects (
|
|
47
|
-
- Gmsh meshes
|
|
48
|
+
- CadQuery objects (optionally use names as material tags)
|
|
49
|
+
- Gmsh meshes (optionally use physical groups as material tags)
|
|
48
50
|
|
|
49
51
|
Cad-to-dagmc offers a wide range of features including.
|
|
52
|
+
- Compatibly with [assembly-mesh-plugin](https://github.com/CadQuery/assembly-mesh-plugin) (see examples)
|
|
53
|
+
- Access to the Gmsh mesh to allow user to define full set of mesh parameters
|
|
54
|
+
- Option to use Gmsh physical groups as material tags
|
|
50
55
|
- Geometry scaling with ```scale_factor``` argument
|
|
51
56
|
- Model wide mesh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
|
|
52
57
|
- Volume specific mesh sizing parameters with the ```set_size``` argument
|
|
58
|
+
- Volume mesh selected volumes in the geometry (helps ensure conformal volume and surface mesh).
|
|
53
59
|
- Parallel meshing to quickly mesh the geometry using multiple CPU cores
|
|
54
60
|
- Imprint and merging of CAD geometry, or disable with the ```imprint``` argument
|
|
55
61
|
- Add geometry from multiple sources ([STEP](http://www.steptools.com/stds/step/) files, [CadQuery](https://cadquery.readthedocs.io) objects and [Gmsh](https://gmsh.info/) meshes)
|
|
@@ -125,21 +131,10 @@ First ensure hdf5 is installed as this is needed by MOAB pip install command
|
|
|
125
131
|
sudo apt-get install libhdf5-dev
|
|
126
132
|
```
|
|
127
133
|
|
|
128
|
-
Then
|
|
134
|
+
Then install MOAB, currently available from the repo.
|
|
129
135
|
|
|
130
136
|
```
|
|
131
|
-
|
|
132
|
-
cd moab
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Ensure pip is up to date as a new version is needed
|
|
136
|
-
```
|
|
137
|
-
python -m pip install --upgrade pip
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Run the pip install command with cmake arguments.
|
|
141
|
-
```
|
|
142
|
-
pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
|
|
137
|
+
pip install git+https://bitbucket.org/fathomteam/moab/
|
|
143
138
|
```
|
|
144
139
|
|
|
145
140
|
Then you can install the cad_to_dagmc package with ```pip```
|
|
@@ -20,13 +20,17 @@ cad-to-dagmc can create DAGMC compatible:
|
|
|
20
20
|
|
|
21
21
|
cad-to-dagmc can convert the following in to DAGMC compatible meshes:
|
|
22
22
|
- STEP files
|
|
23
|
-
- CadQuery objects (
|
|
24
|
-
- Gmsh meshes
|
|
23
|
+
- CadQuery objects (optionally use names as material tags)
|
|
24
|
+
- Gmsh meshes (optionally use physical groups as material tags)
|
|
25
25
|
|
|
26
26
|
Cad-to-dagmc offers a wide range of features including.
|
|
27
|
+
- Compatibly with [assembly-mesh-plugin](https://github.com/CadQuery/assembly-mesh-plugin) (see examples)
|
|
28
|
+
- Access to the Gmsh mesh to allow user to define full set of mesh parameters
|
|
29
|
+
- Option to use Gmsh physical groups as material tags
|
|
27
30
|
- Geometry scaling with ```scale_factor``` argument
|
|
28
31
|
- Model wide mesh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
|
|
29
32
|
- Volume specific mesh sizing parameters with the ```set_size``` argument
|
|
33
|
+
- Volume mesh selected volumes in the geometry (helps ensure conformal volume and surface mesh).
|
|
30
34
|
- Parallel meshing to quickly mesh the geometry using multiple CPU cores
|
|
31
35
|
- Imprint and merging of CAD geometry, or disable with the ```imprint``` argument
|
|
32
36
|
- Add geometry from multiple sources ([STEP](http://www.steptools.com/stds/step/) files, [CadQuery](https://cadquery.readthedocs.io) objects and [Gmsh](https://gmsh.info/) meshes)
|
|
@@ -102,21 +106,10 @@ First ensure hdf5 is installed as this is needed by MOAB pip install command
|
|
|
102
106
|
sudo apt-get install libhdf5-dev
|
|
103
107
|
```
|
|
104
108
|
|
|
105
|
-
Then
|
|
109
|
+
Then install MOAB, currently available from the repo.
|
|
106
110
|
|
|
107
111
|
```
|
|
108
|
-
|
|
109
|
-
cd moab
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Ensure pip is up to date as a new version is needed
|
|
113
|
-
```
|
|
114
|
-
python -m pip install --upgrade pip
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Run the pip install command with cmake arguments.
|
|
118
|
-
```
|
|
119
|
-
pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
|
|
112
|
+
pip install git+https://bitbucket.org/fathomteam/moab/
|
|
120
113
|
```
|
|
121
114
|
|
|
122
115
|
Then you can install the cad_to_dagmc package with ```pip```
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# This example makes 3 CAD half spheres
|
|
2
|
+
# Meshes the 3 volumes with different resolutions
|
|
3
|
+
# exports the mesh to a DAGMC unstructured VTK file and a DAGMC h5m file
|
|
4
|
+
# The outer surface of the volume mesh should match the surface of the surface
|
|
5
|
+
# mesh as the same mesh parameters were used in both the surface and volume mesh.
|
|
6
|
+
# Additionally only volume 2 is volume meshed, while all three volumes are surface meshed
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
import cadquery as cq
|
|
10
|
+
from cad_to_dagmc import CadToDagmc
|
|
11
|
+
|
|
12
|
+
box_cutter = cq.Workplane("XY").moveTo(0, 5).box(20, 10, 20)
|
|
13
|
+
inner_sphere = cq.Workplane("XY").sphere(6).cut(box_cutter)
|
|
14
|
+
middle_sphere = cq.Workplane("XY").sphere(6.1).cut(box_cutter).cut(inner_sphere)
|
|
15
|
+
outer_sphere = cq.Workplane("XY").sphere(10).cut(box_cutter).cut(inner_sphere).cut(middle_sphere)
|
|
16
|
+
|
|
17
|
+
assembly = cq.Assembly()
|
|
18
|
+
assembly.add(inner_sphere, name="inner_sphere")
|
|
19
|
+
assembly.add(middle_sphere, name="middle_sphere")
|
|
20
|
+
assembly.add(outer_sphere, name="outer_sphere")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
model = CadToDagmc()
|
|
24
|
+
model.add_cadquery_object(assembly, material_tags=["mat1", "mat2", "mat3"])
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
h5m_file = model.export_dagmc_h5m_file(
|
|
28
|
+
filename="different_resolution_meshes.h5m",
|
|
29
|
+
set_size={1: 0.9, 2: 0.1, 3: 0.9},
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
vtk_file = model.export_unstructured_mesh_file(
|
|
33
|
+
filename="umesh.vtk",
|
|
34
|
+
set_size={1: 0.9, 2: 0.1, 3: 0.9},
|
|
35
|
+
volumes=[2], # only mesh volume 2 out of the three volumes
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
import openmc
|
|
40
|
+
|
|
41
|
+
with open("cross_sections.xml", "w") as file:
|
|
42
|
+
file.write(
|
|
43
|
+
"""
|
|
44
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
|
45
|
+
<cross_sections>
|
|
46
|
+
<library materials="H1" path="tests/ENDFB-7.1-NNDC_H1.h5" type="neutron"/>
|
|
47
|
+
</cross_sections>
|
|
48
|
+
"""
|
|
49
|
+
)
|
|
50
|
+
openmc.config["cross_sections"] = "cross_sections.xml"
|
|
51
|
+
|
|
52
|
+
umesh = openmc.UnstructuredMesh(vtk_file, library="moab")
|
|
53
|
+
mesh_filter = openmc.MeshFilter(umesh)
|
|
54
|
+
tally = openmc.Tally(name="unstructured_mesh_tally")
|
|
55
|
+
tally.filters = [mesh_filter]
|
|
56
|
+
tally.scores = ["flux"]
|
|
57
|
+
my_tallies = openmc.Tallies([tally])
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
mat1 = openmc.Material(name="mat1")
|
|
61
|
+
mat1.add_nuclide("H1", 1, percent_type="ao")
|
|
62
|
+
mat1.set_density("g/cm3", 0.001)
|
|
63
|
+
mat2 = openmc.Material(name="mat2")
|
|
64
|
+
mat2.add_nuclide("H1", 1, percent_type="ao")
|
|
65
|
+
mat2.set_density("g/cm3", 0.002)
|
|
66
|
+
mat3 = openmc.Material(name="mat3")
|
|
67
|
+
mat3.add_nuclide("H1", 1, percent_type="ao")
|
|
68
|
+
mat3.set_density("g/cm3", 0.003)
|
|
69
|
+
my_materials = openmc.Materials([mat1, mat2, mat3])
|
|
70
|
+
|
|
71
|
+
dag_univ = openmc.DAGMCUniverse(filename=h5m_file)
|
|
72
|
+
bound_dag_univ = dag_univ.bounded_universe()
|
|
73
|
+
my_geometry = openmc.Geometry(root=bound_dag_univ)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
my_settings = openmc.Settings()
|
|
77
|
+
my_settings.batches = 10
|
|
78
|
+
my_settings.particles = 5000
|
|
79
|
+
my_settings.run_mode = "fixed source"
|
|
80
|
+
|
|
81
|
+
# Create a DT point source
|
|
82
|
+
my_source = openmc.IndependentSource()
|
|
83
|
+
my_source.space = openmc.stats.Point(my_geometry.bounding_box.center)
|
|
84
|
+
my_source.angle = openmc.stats.Isotropic()
|
|
85
|
+
my_source.energy = openmc.stats.Discrete([14e6], [1])
|
|
86
|
+
my_settings.source = my_source
|
|
87
|
+
|
|
88
|
+
model = openmc.model.Model(my_geometry, my_materials, my_settings, my_tallies)
|
|
89
|
+
sp_filename = model.run()
|
|
90
|
+
|
|
91
|
+
sp = openmc.StatePoint(sp_filename)
|
|
92
|
+
|
|
93
|
+
tally_result = sp.get_tally(name="unstructured_mesh_tally")
|
|
94
|
+
|
|
95
|
+
# normally with regular meshes I would get the mesh from the tally
|
|
96
|
+
# but with unstructured meshes the tally does not contain the mesh
|
|
97
|
+
# however we can get it from the statepoint file
|
|
98
|
+
# umesh = tally_result.find_filter(openmc.MeshFilter)
|
|
99
|
+
umesh_from_sp = sp.meshes[1]
|
|
100
|
+
|
|
101
|
+
# these trigger internal code in the mesh object so that its centroids and volumes become known.
|
|
102
|
+
# centroids and volumes are needed for the get_values and write_data_to_vtk steps
|
|
103
|
+
centroids = umesh_from_sp.centroids
|
|
104
|
+
mesh_vols = umesh_from_sp.volumes
|
|
105
|
+
|
|
106
|
+
flux_mean = tally_result.get_values(scores=["flux"], value="mean").reshape(umesh_from_sp.dimension)
|
|
107
|
+
umesh_from_sp.write_data_to_vtk(filename="tally.vtk", datasets={"mean": flux_mean})
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# this file makes a GMESH mesh file from a Step file
|
|
2
2
|
# then loads up the GMESH file and converts it to a DAGMC file
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
# making the GMESH file
|
|
6
4
|
from cad_to_dagmc import CadToDagmc
|
|
7
5
|
import cadquery as cq
|
|
6
|
+
import cad_to_dagmc
|
|
7
|
+
import openmc
|
|
8
8
|
|
|
9
|
+
# making the gmsh file just so we have one for the example
|
|
9
10
|
result1 = cq.Workplane("XY").box(10.0, 10.0, 5.0)
|
|
10
11
|
result2 = cq.Workplane("XY").moveTo(10, 0).box(10.0, 10.0, 5.0)
|
|
11
12
|
assembly = cq.Assembly()
|
|
@@ -17,18 +18,15 @@ geometry = CadToDagmc()
|
|
|
17
18
|
geometry.add_stp_file("two_connected_cubes.stp")
|
|
18
19
|
geometry.export_gmsh_mesh_file(filename="example_gmsh_mesh.msh")
|
|
19
20
|
|
|
20
|
-
# converting the mesh file to a DAGMC file
|
|
21
|
-
from cad_to_dagmc import MeshToDagmc
|
|
22
21
|
|
|
23
|
-
mesh
|
|
22
|
+
# converting the mesh file to a DAGMC file
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
cad_to_dagmc.export_gmsh_file_to_dagmc_h5m_file(
|
|
25
|
+
gmsh_filename="example_gmsh_mesh.msh",
|
|
26
26
|
material_tags=["mat1", "mat2"],
|
|
27
|
-
|
|
27
|
+
dagmc_filename="dagmc.h5m",
|
|
28
28
|
)
|
|
29
29
|
|
|
30
|
-
# making use of the DAGMC file in OpenMC
|
|
31
|
-
import openmc
|
|
32
30
|
|
|
33
31
|
openmc.config["cross_sections"] = "cross_sections.xml"
|
|
34
32
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# this file makes a GMESH mesh file that contains 3D physical groups.
|
|
2
|
+
# these groups are then used as the material tags in the DAGMC file.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# making the GMESH file
|
|
6
|
+
import cad_to_dagmc
|
|
7
|
+
import openmc
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# converting the mesh file to a DAGMC file
|
|
11
|
+
|
|
12
|
+
cad_to_dagmc.export_gmsh_file_to_dagmc_h5m_file(
|
|
13
|
+
gmsh_filename="examples/surface_mesh/tagged_mesh.msh",
|
|
14
|
+
# no need to specify material tags as the mesh file already has physical
|
|
15
|
+
# groups which are used as material tags
|
|
16
|
+
# material_tags=["shell", "insert"],
|
|
17
|
+
dagmc_filename="dagmc.h5m",
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# making use of the DAGMC file in OpenMC
|
|
21
|
+
|
|
22
|
+
openmc.config["cross_sections"] = "cross_sections.xml"
|
|
23
|
+
|
|
24
|
+
mat1 = openmc.Material(name="shell")
|
|
25
|
+
mat1.add_nuclide("H1", 1, percent_type="ao")
|
|
26
|
+
mat1.set_density("g/cm3", 0.001)
|
|
27
|
+
|
|
28
|
+
mat2 = openmc.Material(name="insert")
|
|
29
|
+
mat2.add_nuclide("H1", 1, percent_type="ao")
|
|
30
|
+
mat2.set_density("g/cm3", 0.002)
|
|
31
|
+
|
|
32
|
+
materials = openmc.Materials([mat1, mat2])
|
|
33
|
+
|
|
34
|
+
universe = openmc.DAGMCUniverse("dagmc.h5m").bounded_universe()
|
|
35
|
+
geometry = openmc.Geometry(universe)
|
|
36
|
+
|
|
37
|
+
my_settings = openmc.Settings()
|
|
38
|
+
my_settings.batches = 10
|
|
39
|
+
my_settings.inactive = 0
|
|
40
|
+
my_settings.particles = 500
|
|
41
|
+
my_settings.run_mode = "fixed source"
|
|
42
|
+
|
|
43
|
+
model = openmc.Model(geometry=geometry, materials=materials, settings=my_settings)
|
|
44
|
+
model.run()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import cadquery as cq
|
|
2
|
+
import cad_to_dagmc
|
|
3
|
+
import gmsh
|
|
4
|
+
import assembly_mesh_plugin
|
|
5
|
+
|
|
6
|
+
box_shape1 = cq.Workplane("XY").box(50, 50, 50)
|
|
7
|
+
box_shape2 = cq.Workplane("XY").moveTo(0, 50).box(50, 50, 100)
|
|
8
|
+
|
|
9
|
+
assembly = cq.Assembly()
|
|
10
|
+
assembly.add(box_shape1, name="first_material")
|
|
11
|
+
assembly.add(box_shape2, name="second_material")
|
|
12
|
+
|
|
13
|
+
# getTaggedGmsh initializes gmsh and creates a mesh object ready for meshing
|
|
14
|
+
assembly.getTaggedGmsh()
|
|
15
|
+
# Here you can set the mesh parameters
|
|
16
|
+
# In this case, we set the minimum and maximum mesh size
|
|
17
|
+
# but you can set any other Gmsh parameters
|
|
18
|
+
# Remember that the gmsh has physical groups if you want to use them when meshing
|
|
19
|
+
gmsh.option.setNumber("Mesh.MeshSizeMax", 4.2)
|
|
20
|
+
gmsh.model.mesh.generate(2) # for DAGMC surface mesh we just need a 2D surface mesh
|
|
21
|
+
|
|
22
|
+
cad_to_dagmc.export_gmsh_object_to_dagmc_h5m_file(filename="dagmc_from_gmsh_object.h5m")
|
|
23
|
+
|
|
24
|
+
# finalize the GMSH API after using export_gmsh_object_to_dagmc_h5m_file
|
|
25
|
+
# and getTaggedGmsh as these both need access to the GMSH object.
|
|
26
|
+
gmsh.finalize()
|