cad-to-dagmc 0.9.0__tar.gz → 0.9.2__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.

Files changed (62) hide show
  1. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/.github/workflows/ci_with_benchmarks.yml +28 -14
  2. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/.github/workflows/ci_with_conda_install.yml +21 -11
  3. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/.github/workflows/ci_with_pip_install.yml +2 -1
  4. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/PKG-INFO +5 -14
  5. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/README.md +4 -13
  6. cad_to_dagmc-0.9.2/examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py +104 -0
  7. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/from_gmsh_object_with_tag.py +1 -1
  8. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/src/_version.py +2 -2
  9. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/src/cad_to_dagmc/core.py +97 -37
  10. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/src/cad_to_dagmc.egg-info/PKG-INFO +5 -14
  11. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/src/cad_to_dagmc.egg-info/SOURCES.txt +1 -0
  12. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/test_h5m_in_transport.py +46 -2
  13. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/test_mesh_to_dagmc.py +3 -3
  14. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/test_python_api.py +86 -0
  15. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/.github/workflows/black.yml +0 -0
  16. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/.github/workflows/python-publish.yml +0 -0
  17. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/.gitignore +0 -0
  18. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/CITATION.cff +0 -0
  19. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/LICENSE +0 -0
  20. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/cadquery_assembly.py +0 -0
  21. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +0 -0
  22. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/cadquery_compound.py +0 -0
  23. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
  24. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/cadquery_text.py +0 -0
  25. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
  26. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/different_resolution_meshes.py +0 -0
  27. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/from_gmsh_mesh_file.py +0 -0
  28. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/from_gmsh_mesh_file_with_tags.py +0 -0
  29. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
  30. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/multiple_stp_files.py +0 -0
  31. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/single_cadquery_object.py +0 -0
  32. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/single_stp_file.py +0 -0
  33. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
  34. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/surface_mesh/tagged_mesh.msh +0 -0
  35. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +0 -0
  36. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/unstrucutred_volume_mesh/different_resolution_meshes.py +0 -0
  37. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -0
  38. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/pyproject.toml +0 -0
  39. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/setup.cfg +0 -0
  40. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/src/cad_to_dagmc/__init__.py +0 -0
  41. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
  42. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/src/cad_to_dagmc.egg-info/requires.txt +0 -0
  43. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
  44. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
  45. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/ball_reactor.brep +0 -0
  46. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/curved_extrude.stp +0 -0
  47. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/extrude_rectangle.stp +0 -0
  48. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/multi_volume_cylinders.stp +0 -0
  49. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/one_cube.brep +0 -0
  50. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/single_cube.stp +0 -0
  51. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/single_volume_thin.stp +0 -0
  52. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/single_volume_thin.vtk +0 -0
  53. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/tagged_mesh.msh +0 -0
  54. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/test_brep_file.brep +0 -0
  55. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/test_file_creation.py +0 -0
  56. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/test_get_volumes.py +0 -0
  57. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/test_loading_from_file_vs_shape_object.py +0 -0
  58. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/test_two_joined_cubes.brep +0 -0
  59. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/test_two_sep_cubes.brep +0 -0
  60. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/test_version.py +0 -0
  61. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/two_connected_cubes.stp +0 -0
  62. {cad_to_dagmc-0.9.0 → cad_to_dagmc-0.9.2}/tests/two_disconnected_cubes.stp +0 -0
@@ -19,25 +19,42 @@ on:
19
19
  jobs:
20
20
  testing:
21
21
  runs-on: ubuntu-latest
22
+
22
23
  steps:
23
24
  - name: Checkout repository
24
25
  uses: actions/checkout@v4
25
26
 
26
- - name: install dependencies and run CSG / DAMGC benchmarks
27
- env:
28
- OPENMC_CROSS_SECTIONS: /home/runner/work/cad_to_dagmc/cad_to_dagmc/cross_sections.xml
29
- shell: bash
27
+ - name: Install system packages
30
28
  run: |
31
- wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
32
- bash Miniforge3.sh -b -p "${HOME}/conda"
33
- source "${HOME}/conda/etc/profile.d/conda.sh"
34
- source "${HOME}/conda/etc/profile.d/mamba.sh"
35
- sudo apt-get --allow-releaseinfo-change update
36
29
  sudo apt-get update -y
37
30
  sudo apt-get upgrade -y
38
31
  sudo apt-get install -y libgl1 libglx-mesa0 libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0
39
- mamba activate
40
- mamba install -y -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh
32
+
33
+ - name: Set up Miniforge
34
+ run: |
35
+ wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-$(uname -m).sh"
36
+ bash Miniforge3.sh -b -p "${HOME}/miniforge"
37
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
38
+ conda init bash
39
+ conda config --set always_yes yes --set changeps1 no
40
+ conda update -q conda
41
+
42
+ - name: Create and activate Conda environment
43
+ run: |
44
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
45
+ conda create -n ci-env python=3.11
46
+ conda activate ci-env
47
+ conda install -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh vtk
48
+ python -m pip install .[tests]
49
+ python -m pip install git+https://github.com/svalinn/pydagmc
50
+
51
+ - name: Run tests
52
+ shell: bash -l {0}
53
+ env:
54
+ OPENMC_CROSS_SECTIONS: /home/runner/work/cad_to_dagmc/cad_to_dagmc/cross_sections.xml
55
+ run: |
56
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
57
+ conda activate ci-env
41
58
  python -m ensurepip --upgrade
42
59
  python -m pip install . --no-deps
43
60
  python -m pip install openmc_data_downloader
@@ -45,7 +62,4 @@ jobs:
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
- pip install git+https://github.com/svalinn/pydagmc
49
- conda env export > environment.yml
50
- cat environment.yml
51
65
  pytest tests/test_cad_to_dagmc -v
@@ -31,34 +31,43 @@ jobs:
31
31
  sudo apt-get update -y
32
32
  sudo apt-get upgrade -y
33
33
  sudo apt-get install -y libgl1 libglx-mesa0 libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0
34
+ - name: Set up Miniforge
35
+ run: |
36
+ wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-$(uname -m).sh"
37
+ bash Miniforge3.sh -b -p "${HOME}/miniforge"
38
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
39
+ conda init bash
40
+ conda config --set always_yes yes --set changeps1 no
41
+ conda update -q conda
34
42
 
35
- - name: Set up Conda
36
- uses: conda-incubator/setup-miniconda@v2
37
- with:
38
- activate-environment: ci-env
39
- miniforge-version: latest
40
- channels: conda-forge
41
-
42
- - name: install dependencies
43
- shell: bash -l {0}
43
+ - name: Create and activate Conda environment
44
44
  run: |
45
- conda install -y -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh vtk
45
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
46
+ conda create -n ci-env python=3.11
47
+ conda activate ci-env
48
+ conda install -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh vtk
46
49
  python -m pip install .[tests]
47
50
  python -m pip install git+https://github.com/svalinn/pydagmc
48
-
51
+
49
52
  - name: Test import
50
53
  shell: bash -l {0}
51
54
  run: |
55
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
56
+ conda activate ci-env
52
57
  python -c "import cad_to_dagmc"
53
58
 
54
59
  - name: Run tests
55
60
  shell: bash -l {0}
56
61
  run: |
62
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
63
+ conda activate ci-env
57
64
  pytest -v tests
58
65
 
59
66
  - name: Run examples
60
67
  shell: bash -l {0}
61
68
  run: |
69
+ source "${HOME}/miniforge/etc/profile.d/conda.sh"
70
+ conda activate ci-env
62
71
  python examples/surface_mesh/cadquery_assembly.py
63
72
  python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
64
73
  python examples/surface_mesh/cadquery_compound.py
@@ -78,3 +87,4 @@ jobs:
78
87
  python examples/unstrucutred_volume_mesh/different_resolution_meshes.py
79
88
  python examples/surface_mesh/different_resolution_meshes.py
80
89
  python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
90
+ python examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py
@@ -63,4 +63,5 @@ jobs:
63
63
  python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
64
64
  python examples/unstrucutred_volume_mesh/different_resolution_meshes.py
65
65
  python examples/surface_mesh/different_resolution_meshes.py
66
- python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
66
+ python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
67
+ python examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cad_to_dagmc
3
- Version: 0.9.0
3
+ Version: 0.9.2
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
@@ -55,6 +55,8 @@ Cad-to-dagmc offers a wide range of features including.
55
55
  - Geometry scaling with ```scale_factor``` argument
56
56
  - Model wide mesh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
57
57
  - Volume specific mesh sizing parameters with the ```set_size``` argument
58
+ - Unstructured mesh that share the same coordinates as the surface mesh.
59
+ - Volume mesh allows selecting individual volumes in the geometry.
58
60
  - Parallel meshing to quickly mesh the geometry using multiple CPU cores
59
61
  - Imprint and merging of CAD geometry, or disable with the ```imprint``` argument
60
62
  - 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)
@@ -130,21 +132,10 @@ First ensure hdf5 is installed as this is needed by MOAB pip install command
130
132
  sudo apt-get install libhdf5-dev
131
133
  ```
132
134
 
133
- Then clone the latest version of MOAB and cd into the moab directory.
135
+ Then install MOAB, currently available from the repo.
134
136
 
135
137
  ```
136
- git clone master https://bitbucket.org/fathomteam/moab/
137
- cd moab
138
- ```
139
-
140
- Ensure pip is up to date as a new version is needed
141
- ```
142
- python -m pip install --upgrade pip
143
- ```
144
-
145
- Run the pip install command with cmake arguments.
146
- ```
147
- pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
138
+ pip install git+https://bitbucket.org/fathomteam/moab/
148
139
  ```
149
140
 
150
141
  Then you can install the cad_to_dagmc package with ```pip```
@@ -30,6 +30,8 @@ Cad-to-dagmc offers a wide range of features including.
30
30
  - Geometry scaling with ```scale_factor``` argument
31
31
  - Model wide mesh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
32
32
  - Volume specific mesh sizing parameters with the ```set_size``` argument
33
+ - Unstructured mesh that share the same coordinates as the surface mesh.
34
+ - Volume mesh allows selecting individual volumes in the geometry.
33
35
  - Parallel meshing to quickly mesh the geometry using multiple CPU cores
34
36
  - Imprint and merging of CAD geometry, or disable with the ```imprint``` argument
35
37
  - 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)
@@ -105,21 +107,10 @@ First ensure hdf5 is installed as this is needed by MOAB pip install command
105
107
  sudo apt-get install libhdf5-dev
106
108
  ```
107
109
 
108
- Then clone the latest version of MOAB and cd into the moab directory.
110
+ Then install MOAB, currently available from the repo.
109
111
 
110
112
  ```
111
- git clone master https://bitbucket.org/fathomteam/moab/
112
- cd moab
113
- ```
114
-
115
- Ensure pip is up to date as a new version is needed
116
- ```
117
- python -m pip install --upgrade pip
118
- ```
119
-
120
- Run the pip install command with cmake arguments.
121
- ```
122
- pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
113
+ pip install git+https://bitbucket.org/fathomteam/moab/
123
114
  ```
124
115
 
125
116
  Then you can install the cad_to_dagmc package with ```pip```
@@ -0,0 +1,104 @@
1
+ # This example makes 3 CAD half spheres
2
+ # Meshes the 3 volumes with different resolutions
3
+ # exports the mesh to a DAGMC unstructured VTK file and a DAGMC h5m file
4
+ # The outer surface of the volume mesh should match the surface of the surface
5
+ # mesh as the same mesh parameters were used in both the surface and volume mesh.
6
+ # Additionally only volume 2 is volume meshed, while all three volumes are surface meshed
7
+
8
+ import cadquery as cq
9
+ from cad_to_dagmc import CadToDagmc
10
+ import openmc
11
+
12
+
13
+ box_cutter = cq.Workplane("XY").moveTo(0, 5).box(20, 10, 20)
14
+ inner_sphere = cq.Workplane("XY").sphere(6).cut(box_cutter)
15
+ middle_sphere = cq.Workplane("XY").sphere(6.1).cut(box_cutter).cut(inner_sphere)
16
+ outer_sphere = cq.Workplane("XY").sphere(10).cut(box_cutter).cut(inner_sphere).cut(middle_sphere)
17
+
18
+ assembly = cq.Assembly()
19
+ assembly.add(inner_sphere, name="inner_sphere")
20
+ assembly.add(middle_sphere, name="middle_sphere")
21
+ assembly.add(outer_sphere, name="outer_sphere")
22
+
23
+
24
+ model = CadToDagmc()
25
+ model.add_cadquery_object(assembly, material_tags=["mat1", "mat2", "mat3"])
26
+
27
+ dagmc_filename, umesh_filename = model.export_dagmc_h5m_file(
28
+ filename="surface_mesh_conformal.h5m",
29
+ set_size={
30
+ 1: 0.9,
31
+ 2: 0.1,
32
+ 3: 0.9,
33
+ },
34
+ unstructured_volumes=[2],
35
+ umesh_filename="volume_mesh_conformal.vtk", #
36
+ )
37
+
38
+
39
+ with open("cross_sections.xml", "w") as file:
40
+ file.write(
41
+ """
42
+ <?xml version='1.0' encoding='UTF-8'?>
43
+ <cross_sections>
44
+ <library materials="H1" path="tests/ENDFB-7.1-NNDC_H1.h5" type="neutron"/>
45
+ </cross_sections>
46
+ """
47
+ )
48
+ openmc.config["cross_sections"] = "cross_sections.xml"
49
+
50
+ umesh = openmc.UnstructuredMesh(umesh_filename, library="moab")
51
+ mesh_filter = openmc.MeshFilter(umesh)
52
+ tally = openmc.Tally(name="unstructured_mesh_tally")
53
+ tally.filters = [mesh_filter]
54
+ tally.scores = ["flux"]
55
+ my_tallies = openmc.Tallies([tally])
56
+
57
+
58
+ mat1 = openmc.Material(name="mat1")
59
+ mat1.add_nuclide("H1", 1, percent_type="ao")
60
+ mat1.set_density("g/cm3", 0.001)
61
+ mat2 = openmc.Material(name="mat2")
62
+ mat2.add_nuclide("H1", 1, percent_type="ao")
63
+ mat2.set_density("g/cm3", 0.002)
64
+ mat3 = openmc.Material(name="mat3")
65
+ mat3.add_nuclide("H1", 1, percent_type="ao")
66
+ mat3.set_density("g/cm3", 0.003)
67
+ my_materials = openmc.Materials([mat1, mat2, mat3])
68
+
69
+ dag_univ = openmc.DAGMCUniverse(filename=dagmc_filename)
70
+ bound_dag_univ = dag_univ.bounded_universe()
71
+ my_geometry = openmc.Geometry(root=bound_dag_univ)
72
+
73
+ my_settings = openmc.Settings()
74
+ my_settings.batches = 10
75
+ my_settings.particles = 5000
76
+ my_settings.run_mode = "fixed source"
77
+
78
+ # Create a DT point source
79
+ my_source = openmc.IndependentSource()
80
+ my_source.space = openmc.stats.Point(my_geometry.bounding_box.center)
81
+ my_source.angle = openmc.stats.Isotropic()
82
+ my_source.energy = openmc.stats.Discrete([14e6], [1])
83
+ my_settings.source = my_source
84
+
85
+ model = openmc.model.Model(my_geometry, my_materials, my_settings, my_tallies)
86
+ sp_filename = model.run()
87
+
88
+ sp = openmc.StatePoint(sp_filename)
89
+
90
+ tally_result = sp.get_tally(name="unstructured_mesh_tally")
91
+
92
+ # normally with regular meshes I would get the mesh from the tally
93
+ # but with unstructured meshes the tally does not contain the mesh
94
+ # however we can get it from the statepoint file
95
+ # umesh = tally_result.find_filter(openmc.MeshFilter)
96
+ umesh_from_sp = sp.meshes[1]
97
+
98
+ # these trigger internal code in the mesh object so that its centroids and volumes become known.
99
+ # centroids and volumes are needed for the get_values and write_data_to_vtk steps
100
+ centroids = umesh_from_sp.centroids
101
+ mesh_vols = umesh_from_sp.volumes
102
+
103
+ flux_mean = tally_result.get_values(scores=["flux"], value="mean").reshape(umesh_from_sp.dimension)
104
+ umesh_from_sp.write_data_to_vtk(filename="tally.vtk", datasets={"mean": flux_mean})
@@ -1,7 +1,7 @@
1
1
  import cadquery as cq
2
2
  import cad_to_dagmc
3
3
  import gmsh
4
- import assembly_mesh_plugin.plugin
4
+ import assembly_mesh_plugin
5
5
 
6
6
  box_shape1 = cq.Workplane("XY").box(50, 50, 50)
7
7
  box_shape2 = cq.Workplane("XY").moveTo(0, 50).box(50, 50, 100)
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.9.0'
21
- __version_tuple__ = version_tuple = (0, 9, 0)
20
+ __version__ = version = '0.9.2'
21
+ __version_tuple__ = version_tuple = (0, 9, 2)
@@ -1,4 +1,5 @@
1
1
  from pathlib import Path
2
+ from typing import Iterable
2
3
  import cadquery as cq
3
4
  import gmsh
4
5
  import numpy as np
@@ -6,6 +7,7 @@ from cadquery import importers
6
7
  from pymoab import core, types
7
8
  import tempfile
8
9
  import warnings
10
+ from typing import Iterable
9
11
  from cad_to_dagmc import __version__
10
12
 
11
13
 
@@ -234,15 +236,14 @@ def init_gmsh():
234
236
  return gmsh
235
237
 
236
238
 
237
- def mesh_brep(
239
+ def set_sizes_for_mesh(
238
240
  gmsh,
239
241
  min_mesh_size: float | None = None,
240
242
  max_mesh_size: float | None = None,
241
243
  mesh_algorithm: int = 1,
242
- dimensions: int = 2,
243
244
  set_size: dict[int, float] | None = None,
244
245
  ):
245
- """Creates a conformal surface meshes of the volumes in a Brep file using Gmsh.
246
+ """Sets up the mesh sizes for each volume in the mesh.
246
247
 
247
248
  Args:
248
249
  occ_shape: the occ_shape of the Brep file to convert
@@ -252,8 +253,6 @@ def mesh_brep(
252
253
  into gmsh.option.setNumber("Mesh.MeshSizeMax", max_mesh_size)
253
254
  mesh_algorithm: The Gmsh mesh algorithm number to use. Passed into
254
255
  gmsh.option.setNumber("Mesh.Algorithm", mesh_algorithm)
255
- dimensions: The number of dimensions, 2 for a surface mesh 3 for a
256
- volume mesh. Passed to gmsh.model.mesh.generate()
257
256
  set_size: a dictionary of volume ids (int) and target mesh sizes
258
257
  (floats) to set for each volume, passed to gmsh.model.mesh.setSize.
259
258
 
@@ -279,25 +278,42 @@ def mesh_brep(
279
278
  volumes = gmsh.model.getEntities(3)
280
279
  available_volumes = [volume[1] for volume in volumes]
281
280
  print("volumes", volumes)
282
- for volume_id, size in set_size.items():
283
- if volume_id in available_volumes:
284
- size = set_size[volume_id]
285
- if isinstance(size, dict):
286
- # TODO face specific mesh sizes
287
- pass
288
- else:
289
- boundaries = gmsh.model.getBoundary(
290
- [(3, volume_id)], recursive=True
291
- ) # dim must be set to 3
292
- print("boundaries", boundaries)
293
- gmsh.model.mesh.setSize(boundaries, size)
294
- print(f"Set size of {size} for volume {volume_id}")
295
- else:
281
+
282
+ # Ensure all volume IDs in set_size exist in the available volumes
283
+ for volume_id in set_size.keys():
284
+ if volume_id not in available_volumes:
296
285
  raise ValueError(
297
286
  f"volume ID of {volume_id} set in set_sizes but not found in available volumes {volumes}"
298
287
  )
299
288
 
300
- gmsh.model.mesh.generate(dimensions)
289
+ # Step 1: Preprocess boundaries to find shared surfaces and decide mesh sizes
290
+ boundary_sizes = {} # Dictionary to store the mesh size and count for each boundary
291
+ for volume_id, size in set_size.items():
292
+ boundaries = gmsh.model.getBoundary(
293
+ [(3, volume_id)], recursive=True
294
+ ) # dim must be set to 3
295
+ print(f"Boundaries for volume {volume_id}: {boundaries}")
296
+
297
+ for boundary in boundaries:
298
+ boundary_key = (boundary[0], boundary[1]) # (dimension, tag)
299
+ if boundary_key in boundary_sizes:
300
+ # If the boundary is already processed, add the size to the list
301
+ boundary_sizes[boundary_key]["total_size"] += size
302
+ boundary_sizes[boundary_key]["count"] += 1
303
+ else:
304
+ # Otherwise, initialize the boundary with the current size
305
+ boundary_sizes[boundary_key] = {"total_size": size, "count": 1}
306
+
307
+ # Step 2: Calculate the average size for each boundary
308
+ averaged_boundary_sizes = {
309
+ boundary: data["total_size"] / data["count"]
310
+ for boundary, data in boundary_sizes.items()
311
+ }
312
+
313
+ # Step 3: Apply mesh sizes to all boundaries
314
+ for boundary, size in averaged_boundary_sizes.items():
315
+ gmsh.model.mesh.setSize([boundary], size)
316
+ print(f"Set mesh size {size} for boundary {boundary}")
301
317
 
302
318
  return gmsh
303
319
 
@@ -615,11 +631,13 @@ class CadToDagmc:
615
631
  scale_factor: float = 1.0,
616
632
  imprint: bool = True,
617
633
  set_size: dict[int, float] | None = None,
634
+ volumes: Iterable[int] | None = None,
618
635
  ):
619
636
  """
620
- Exports an unstructured mesh file in VTK format for use with openmc.UnstructuredMesh.
621
- Compatible with the MOAB unstructured mesh library. Example useage
622
- openmc.UnstructuredMesh(filename="umesh.vtk", library="moab")
637
+ Exports an unstructured mesh file in VTK format for use with
638
+ openmc.UnstructuredMesh. Compatible with the MOAB unstructured mesh
639
+ library. Example useage openmc.UnstructuredMesh(filename="umesh.vtk",
640
+ library="moab").
623
641
 
624
642
  Parameters:
625
643
  -----------
@@ -648,6 +666,8 @@ class CadToDagmc:
648
666
  and this can save time.
649
667
  set_size: a dictionary of volume ids (int) and target mesh sizes
650
668
  (floats) to set for each volume, passed to gmsh.model.mesh.setSize.
669
+ volumes: a list of volume ids (int) to include in the mesh. If left
670
+ as default (None) then all volumes will be included.
651
671
 
652
672
 
653
673
  Returns:
@@ -672,17 +692,30 @@ class CadToDagmc:
672
692
 
673
693
  gmsh = init_gmsh()
674
694
 
675
- gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method, scale_factor=scale_factor)
695
+ gmsh, volumes_in_model = get_volumes(
696
+ gmsh, imprinted_assembly, method=method, scale_factor=scale_factor
697
+ )
676
698
 
677
- gmsh = mesh_brep(
699
+ gmsh = set_sizes_for_mesh(
678
700
  gmsh=gmsh,
679
701
  min_mesh_size=min_mesh_size,
680
702
  max_mesh_size=max_mesh_size,
681
703
  mesh_algorithm=mesh_algorithm,
682
- dimensions=3,
683
704
  set_size=set_size,
684
705
  )
685
706
 
707
+ if volumes:
708
+ for volume_id in volumes_in_model:
709
+ if volume_id[1] not in volumes:
710
+ gmsh.model.occ.remove([volume_id], recursive=True)
711
+ gmsh.option.setNumber("Mesh.SaveAll", 1)
712
+ gmsh.model.occ.synchronize()
713
+ # Clear the mesh
714
+ gmsh.model.mesh.clear()
715
+ gmsh.option.setNumber("Mesh.SaveElementTagType", 3) # Save only volume elements
716
+
717
+ gmsh.model.mesh.generate(3)
718
+
686
719
  # makes the folder if it does not exist
687
720
  if Path(filename).parent:
688
721
  Path(filename).parent.mkdir(parents=True, exist_ok=True)
@@ -695,7 +728,7 @@ class CadToDagmc:
695
728
 
696
729
  gmsh.finalize()
697
730
 
698
- return gmsh
731
+ return filename
699
732
 
700
733
  def export_gmsh_mesh_file(
701
734
  self,
@@ -751,15 +784,16 @@ class CadToDagmc:
751
784
 
752
785
  gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method, scale_factor=scale_factor)
753
786
 
754
- gmsh = mesh_brep(
787
+ gmsh = set_sizes_for_mesh(
755
788
  gmsh=gmsh,
756
789
  min_mesh_size=min_mesh_size,
757
790
  max_mesh_size=max_mesh_size,
758
791
  mesh_algorithm=mesh_algorithm,
759
- dimensions=dimensions,
760
792
  set_size=set_size,
761
793
  )
762
794
 
795
+ gmsh.model.mesh.generate(dimensions)
796
+
763
797
  # makes the folder if it does not exist
764
798
  if Path(filename).parent:
765
799
  Path(filename).parent.mkdir(parents=True, exist_ok=True)
@@ -785,6 +819,8 @@ class CadToDagmc:
785
819
  scale_factor: float = 1.0,
786
820
  imprint: bool = True,
787
821
  set_size: dict[int, float] | None = None,
822
+ unstructured_volumes: Iterable[int] | None = None,
823
+ umesh_filename: str = "umesh.vtk",
788
824
  ) -> str:
789
825
  """Saves a DAGMC h5m file of the geometry
790
826
 
@@ -813,9 +849,13 @@ class CadToDagmc:
813
849
  and this can save time.
814
850
  set_size: a dictionary of volume ids (int) and target mesh sizes
815
851
  (floats) to set for each volume, passed to gmsh.model.mesh.setSize.
852
+ unstructured_volumes: a list of volume ids to be saved in as an
853
+ unstructured mesh file.
854
+ umesh_filename: the filename to use for the optional unstructured
855
+ mesh file. Only used if unstructured_volumes is not empty.
816
856
 
817
857
  Returns:
818
- str: the DAGMC filename saved
858
+ str: the filenames(s) for the files created.
819
859
  """
820
860
 
821
861
  assembly = cq.Assembly()
@@ -852,7 +892,7 @@ class CadToDagmc:
852
892
  gmsh, imprinted_assembly, method=method, scale_factor=scale_factor
853
893
  )
854
894
 
855
- gmsh = mesh_brep(
895
+ gmsh = set_sizes_for_mesh(
856
896
  gmsh=gmsh,
857
897
  min_mesh_size=min_mesh_size,
858
898
  max_mesh_size=max_mesh_size,
@@ -860,19 +900,39 @@ class CadToDagmc:
860
900
  set_size=set_size,
861
901
  )
862
902
 
863
- dims_and_vol_ids = volumes
903
+ gmsh.model.mesh.generate(2)
864
904
 
865
905
  vertices, triangles_by_solid_by_face = mesh_to_vertices_and_triangles(
866
- dims_and_vol_ids=dims_and_vol_ids
906
+ dims_and_vol_ids=volumes
867
907
  )
868
908
 
869
- gmsh.finalize()
870
-
871
- # checks and fixes triangle fix_normals within vertices_to_h5m
872
- return vertices_to_h5m(
909
+ dagmc_filename = vertices_to_h5m(
873
910
  vertices=vertices,
874
911
  triangles_by_solid_by_face=triangles_by_solid_by_face,
875
912
  material_tags=material_tags_in_brep_order,
876
913
  h5m_filename=filename,
877
914
  implicit_complement_material_tag=implicit_complement_material_tag,
878
915
  )
916
+
917
+ if unstructured_volumes:
918
+ # remove all the unused occ volumes, this prevents them being meshed
919
+ for volume_dim, volume_id in volumes:
920
+ if volume_id not in unstructured_volumes:
921
+ gmsh.model.occ.remove([(volume_dim, volume_id)], recursive=True)
922
+ gmsh.option.setNumber("Mesh.SaveAll", 1)
923
+ gmsh.model.occ.synchronize()
924
+
925
+ # removes all the 2D groups so that 2D faces are not included in the vtk file
926
+ all_2d_groups = gmsh.model.getPhysicalGroups(2)
927
+ for entry in all_2d_groups:
928
+ gmsh.model.removePhysicalGroups([entry])
929
+
930
+ gmsh.model.mesh.generate(3)
931
+ gmsh.option.setNumber("Mesh.SaveElementTagType", 3) # Save only volume elements
932
+ gmsh.write(umesh_filename)
933
+
934
+ gmsh.finalize()
935
+
936
+ return dagmc_filename, umesh_filename
937
+ else:
938
+ return dagmc_filename
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cad_to_dagmc
3
- Version: 0.9.0
3
+ Version: 0.9.2
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
@@ -55,6 +55,8 @@ Cad-to-dagmc offers a wide range of features including.
55
55
  - Geometry scaling with ```scale_factor``` argument
56
56
  - Model wide mesh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
57
57
  - Volume specific mesh sizing parameters with the ```set_size``` argument
58
+ - Unstructured mesh that share the same coordinates as the surface mesh.
59
+ - Volume mesh allows selecting individual volumes in the geometry.
58
60
  - Parallel meshing to quickly mesh the geometry using multiple CPU cores
59
61
  - Imprint and merging of CAD geometry, or disable with the ```imprint``` argument
60
62
  - 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)
@@ -130,21 +132,10 @@ First ensure hdf5 is installed as this is needed by MOAB pip install command
130
132
  sudo apt-get install libhdf5-dev
131
133
  ```
132
134
 
133
- Then clone the latest version of MOAB and cd into the moab directory.
135
+ Then install MOAB, currently available from the repo.
134
136
 
135
137
  ```
136
- git clone master https://bitbucket.org/fathomteam/moab/
137
- cd moab
138
- ```
139
-
140
- Ensure pip is up to date as a new version is needed
141
- ```
142
- python -m pip install --upgrade pip
143
- ```
144
-
145
- Run the pip install command with cmake arguments.
146
- ```
147
- pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
138
+ pip install git+https://bitbucket.org/fathomteam/moab/
148
139
  ```
149
140
 
150
141
  Then you can install the cad_to_dagmc package with ```pip```
@@ -8,6 +8,7 @@ pyproject.toml
8
8
  .github/workflows/ci_with_conda_install.yml
9
9
  .github/workflows/ci_with_pip_install.yml
10
10
  .github/workflows/python-publish.yml
11
+ examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py
11
12
  examples/surface_mesh/cadquery_assembly.py
12
13
  examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
13
14
  examples/surface_mesh/cadquery_compound.py
@@ -22,6 +22,7 @@ def transport_particles_on_h5m_geometry(
22
22
  material_tags: list,
23
23
  nuclides: list = None,
24
24
  cross_sections_xml: str = None,
25
+ vtk_filename: str = None,
25
26
  ):
26
27
  """A function for testing the geometry file with particle transport in
27
28
  DAGMC OpenMC. Requires openmc and either the cross_sections_xml to be
@@ -102,10 +103,16 @@ def transport_particles_on_h5m_geometry(
102
103
  # adds a tally to record the heat deposited in entire geometry
103
104
  cell_tally = openmc.Tally(name="flux")
104
105
  cell_tally.scores = ["flux"]
105
-
106
- # groups the two tallies
107
106
  tallies = openmc.Tallies([cell_tally])
108
107
 
108
+ if vtk_filename:
109
+ umesh_tally = openmc.Tally(name="unstructured_mesh_tally")
110
+ umesh = openmc.UnstructuredMesh(vtk_filename, library="moab")
111
+ mesh_filter = openmc.MeshFilter(umesh)
112
+ umesh_tally.filters = [mesh_filter]
113
+ umesh_tally.scores = ["flux"]
114
+ tallies.append(umesh_tally)
115
+
109
116
  # builds the openmc model
110
117
  my_model = openmc.Model(
111
118
  materials=materials, geometry=geometry, settings=settings, tallies=tallies
@@ -255,3 +262,40 @@ def test_h5m_with_multi_volume_touching():
255
262
  material_tags=mat_tags,
256
263
  nuclides=["H1"] * len(mat_tags),
257
264
  )
265
+
266
+
267
+ @pytest.mark.skipif(openmc is None, reason="openmc tests only required for CI")
268
+ def test_umesh_with_volumes():
269
+ box_cutter = cq.Workplane("XY").moveTo(0, 5).box(20, 10, 20)
270
+ inner_sphere = cq.Workplane("XY").sphere(6).cut(box_cutter)
271
+ middle_sphere = cq.Workplane("XY").sphere(6.1).cut(box_cutter).cut(inner_sphere)
272
+ outer_sphere = (
273
+ cq.Workplane("XY").sphere(10).cut(box_cutter).cut(inner_sphere).cut(middle_sphere)
274
+ )
275
+
276
+ assembly = cq.Assembly()
277
+ assembly.add(inner_sphere, name="inner_sphere")
278
+ assembly.add(middle_sphere, name="middle_sphere")
279
+ assembly.add(outer_sphere, name="outer_sphere")
280
+
281
+ model = CadToDagmc()
282
+ mat_tags = ["mat1", "mat2", "mat3"]
283
+ model.add_cadquery_object(assembly, material_tags=mat_tags)
284
+
285
+ h5m_file = model.export_dagmc_h5m_file(
286
+ filename="dagmc.h5m",
287
+ set_size={1: 0.9, 2: 0.1, 3: 0.9},
288
+ )
289
+
290
+ vtk_file = model.export_unstructured_mesh_file(
291
+ filename="umesh_vol_1.vtk",
292
+ set_size={1: 0.9, 2: 0.1, 3: 0.9},
293
+ volumes=[1], # only mesh volume 2 out of the three volumes
294
+ )
295
+
296
+ transport_particles_on_h5m_geometry(
297
+ h5m_filename=h5m_file,
298
+ material_tags=mat_tags,
299
+ nuclides=["H1"] * len(mat_tags),
300
+ vtk_filename=vtk_file,
301
+ )
@@ -2,7 +2,7 @@ import gmsh
2
2
  from test_python_api import get_volumes_and_materials_from_h5m
3
3
  from test_h5m_in_transport import transport_particles_on_h5m_geometry
4
4
  import cadquery as cq
5
- import assembly_mesh_plugin.plugin
5
+ import assembly_mesh_plugin
6
6
  import gmsh
7
7
  import pydagmc
8
8
  import math
@@ -47,7 +47,7 @@ def test_mesh_to_dagmc_with_mesh_object():
47
47
  2: "mat:insert",
48
48
  }
49
49
 
50
- model = pydagmc.DAGModel(test_h5m_filename)
50
+ model = pydagmc.Model(test_h5m_filename)
51
51
  v1 = model.volumes_by_id[1] # get volume by id number 1
52
52
  v2 = model.volumes_by_id[2] # get volume by id number 2
53
53
  assert len(model.volumes_by_id) == 2
@@ -89,7 +89,7 @@ def test_mesh_to_dagmc_with_cadquery_object():
89
89
  1: "mat:firstmat",
90
90
  2: "mat:aluminum",
91
91
  }
92
- model = pydagmc.DAGModel(test_h5m_filename)
92
+ model = pydagmc.Model(test_h5m_filename)
93
93
  v1 = model.volumes_by_id[1] # get volume by id number 1
94
94
  v2 = model.volumes_by_id[2] # get volume by id number 2
95
95
  assert len(model.volumes_by_id) == 2
@@ -333,3 +333,89 @@ def test_two_box_scaling_factor_when_adding_cq_object(
333
333
  assert width_x == expected_x_width
334
334
  assert width_y == expected_y_width
335
335
  assert width_z == expected_z_width
336
+
337
+
338
+ def test_unstructured_mesh_export_with_surface_mesh():
339
+
340
+ box_set_size_course_mesh = cq.Workplane().box(1, 1, 2)
341
+ box_set_size_fine_mesh = cq.Workplane().moveTo(1, 0.5).box(1, 1, 1.5)
342
+ box_set_global_mesh = cq.Workplane().moveTo(2, 1).box(1, 1, 1)
343
+
344
+ assembly = cq.Assembly()
345
+ assembly.add(box_set_size_course_mesh, color=cq.Color(0, 0, 1))
346
+ assembly.add(box_set_size_fine_mesh, color=cq.Color(0, 1, 0))
347
+ assembly.add(box_set_global_mesh, color=cq.Color(1, 0, 0))
348
+
349
+ model = CadToDagmc()
350
+ model.add_cadquery_object(assembly, material_tags=["mat1", "mat2", "mat3"])
351
+
352
+ dag_filename, umesh_filename = model.export_dagmc_h5m_file(
353
+ filename="conformal-surface-mesh2.h5m",
354
+ min_mesh_size=0.01,
355
+ max_mesh_size=10,
356
+ set_size={
357
+ 1: 0.5,
358
+ 2: 0.4,
359
+ 3: 0.4,
360
+ },
361
+ unstructured_volumes=[2],
362
+ umesh_filename="conformal-volume-mesh2.vtk",
363
+ )
364
+ assert Path("conformal-surface-mesh2.h5m").is_file()
365
+ assert Path("conformal-volume-mesh2.vtk").is_file()
366
+ assert Path(dag_filename).is_file()
367
+ assert Path(umesh_filename).is_file()
368
+ # TODO check the volume mesh outer surface is the same as the surface mesh volume 2 surface
369
+
370
+
371
+ def test_unstructured_mesh_with_volumes():
372
+
373
+ box_cutter = cq.Workplane("XY").moveTo(0, 5).box(20, 10, 20)
374
+ inner_sphere = cq.Workplane("XY").sphere(6).cut(box_cutter)
375
+ middle_sphere = cq.Workplane("XY").sphere(6.1).cut(box_cutter).cut(inner_sphere)
376
+ outer_sphere = (
377
+ cq.Workplane("XY").sphere(10).cut(box_cutter).cut(inner_sphere).cut(middle_sphere)
378
+ )
379
+
380
+ assembly = cq.Assembly()
381
+ assembly.add(inner_sphere, name="inner_sphere")
382
+ assembly.add(middle_sphere, name="middle_sphere")
383
+ assembly.add(outer_sphere, name="outer_sphere")
384
+
385
+ model = CadToDagmc()
386
+ model.add_cadquery_object(assembly, material_tags=["mat1", "mat2", "mat3"])
387
+
388
+ filename = model.export_dagmc_h5m_file(
389
+ filename="dagmc.h5m",
390
+ set_size={1: 0.9, 2: 0.1, 3: 0.9},
391
+ )
392
+ assert Path(filename).is_file()
393
+
394
+ filename = model.export_unstructured_mesh_file(
395
+ filename="umesh_vol_1.vtk",
396
+ set_size={1: 0.9, 2: 0.1, 3: 0.9},
397
+ volumes=[1], # only mesh volume 2 out of the three volumes
398
+ )
399
+ assert Path(filename).is_file()
400
+
401
+ filename = model.export_unstructured_mesh_file(
402
+ filename="umesh_vol_2.vtk",
403
+ set_size={1: 0.9, 2: 0.1, 3: 0.9},
404
+ volumes=[2], # only mesh volume 2 out of the three volumes
405
+ )
406
+ assert Path(filename).is_file()
407
+
408
+ filename = model.export_unstructured_mesh_file(
409
+ filename="umesh_vol_3.vtk",
410
+ set_size={1: 0.9, 2: 0.1, 3: 0.9},
411
+ volumes=[3], # only mesh volume 2 out of the three volumes
412
+ )
413
+ assert Path(filename).is_file()
414
+
415
+ filename = model.export_unstructured_mesh_file(
416
+ filename="umesh_vol_1_2.vtk",
417
+ set_size={1: 0.9, 2: 0.1, 3: 0.9},
418
+ volumes=[1, 2], # only mesh volume 2 out of the three volumes
419
+ )
420
+
421
+ assert Path(filename).is_file()
File without changes
File without changes
File without changes
File without changes