cad-to-dagmc 0.5.1__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cad-to-dagmc might be problematic. Click here for more details.

Files changed (64) hide show
  1. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/.github/workflows/ci_with_benchmarks.yml +2 -3
  2. cad_to_dagmc-0.6.0/.github/workflows/ci_with_install.yml +70 -0
  3. cad_to_dagmc-0.6.0/.github/workflows/ci_with_pip_install.yml +57 -0
  4. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/PKG-INFO +43 -19
  5. cad_to_dagmc-0.6.0/README.md +124 -0
  6. {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/cadquery_assembly.py +2 -2
  7. {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/cadquery_compound.py +2 -2
  8. cad_to_dagmc-0.6.0/examples/surface_mesh/cadquery_object_and_stp_file.py +16 -0
  9. {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/cadquery_text.py +6 -4
  10. cad_to_dagmc-0.5.1/examples/curved_cadquery_object.py → cad_to_dagmc-0.6.0/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +5 -5
  11. {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/multiple_cadquery_objects.py +3 -3
  12. cad_to_dagmc-0.6.0/examples/surface_mesh/multiple_stp_files.py +12 -0
  13. {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/single_cadquery_object.py +2 -2
  14. cad_to_dagmc-0.6.0/examples/surface_mesh/single_stp_file.py +5 -0
  15. {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/single_stp_file_multiple_volumes.py +2 -2
  16. cad_to_dagmc-0.6.0/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +62 -0
  17. cad_to_dagmc-0.6.0/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +71 -0
  18. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/pyproject.toml +2 -1
  19. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/src/_version.py +2 -2
  20. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc/core.py +142 -118
  21. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc.egg-info/PKG-INFO +44 -20
  22. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc.egg-info/SOURCES.txt +15 -12
  23. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc.egg-info/requires.txt +1 -0
  24. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/test_file_creation.py +82 -15
  25. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/test_h5m_in_simulation.py +2 -2
  26. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/test_h5m_in_transport.py +30 -24
  27. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/test_loading_from_file_vs_shape_object.py +6 -6
  28. cad_to_dagmc-0.6.0/tests/test_model_creation_for_transport.py +47 -0
  29. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/test_package.py +1 -2
  30. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/test_python_api.py +10 -5
  31. cad_to_dagmc-0.5.1/.github/workflows/ci_with_install.yml +0 -63
  32. cad_to_dagmc-0.5.1/README.md +0 -101
  33. cad_to_dagmc-0.5.1/examples/cadquery_object_and_stp_file.py +0 -9
  34. cad_to_dagmc-0.5.1/examples/multiple_stp_files.py +0 -7
  35. cad_to_dagmc-0.5.1/examples/single_stp_file.py +0 -5
  36. cad_to_dagmc-0.5.1/tests/test_match.py +0 -39
  37. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/.github/workflows/anaconda-publish.yml +0 -0
  38. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/.github/workflows/black.yml +0 -0
  39. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/.github/workflows/python-publish.yml +0 -0
  40. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/.gitignore +0 -0
  41. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/LICENSE +0 -0
  42. {cad_to_dagmc-0.5.1/examples → cad_to_dagmc-0.6.0/examples/surface_mesh}/create_stp_files_for_examples.py +0 -0
  43. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/setup.cfg +0 -0
  44. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc/__init__.py +0 -0
  45. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
  46. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
  47. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
  48. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/ball_reactor.brep +0 -0
  49. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/create_brep_file_for_testing.py +0 -0
  50. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/curved_extrude.stp +0 -0
  51. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/extrude_rectangle.step +0 -0
  52. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/extrude_rectangle.stp +0 -0
  53. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/multi_volume_cylinders.stp +0 -0
  54. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/one_cube.brep +0 -0
  55. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/single_cube.step +0 -0
  56. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/single_cube.stp +0 -0
  57. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/single_volume_thin.stp +0 -0
  58. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/single_volume_thin.vtk +0 -0
  59. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/test_brep_file.brep +0 -0
  60. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/test_two_joined_cubes.brep +0 -0
  61. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/test_two_sep_cubes.brep +0 -0
  62. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/test_version.py +0 -0
  63. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/tests/two_connected_cubes.stp +0 -0
  64. {cad_to_dagmc-0.5.1 → cad_to_dagmc-0.6.0}/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 non pypi dependencies for cad creation
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,8 +37,7 @@ 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 cadquery -c conda-forge moab gmsh python-gmsh cadquery=master "openmc=0.13.3=dagmc*nompi*"
41
- mamba install -y -c conda-forge "openmc=0.13.3=dagmc*nompi*"
40
+ mamba install -y -c conda-forge moab gmsh python-gmsh cadquery=2.4.0 "openmc=0.14.0=dagmc*nompi*"
42
41
  python -m pip install --upgrade pip
43
42
  python -m pip install cad_to_dagmc openmc_data_downloader
44
43
  openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9
@@ -0,0 +1,70 @@
1
+
2
+ name: CI with install
3
+
4
+ on:
5
+ pull_request:
6
+ branches:
7
+ - main
8
+ paths-ignore:
9
+ - 'docs/**'
10
+ - '.gitignore'
11
+ - '*.md'
12
+ - 'CITATION.cff'
13
+ - 'LICENSE.txt'
14
+ - 'readthedocs.yml'
15
+ push:
16
+ branches:
17
+ - main
18
+
19
+ jobs:
20
+ testing:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - name: Checkout repository
24
+ uses: actions/checkout@v4
25
+
26
+ - name: install non pypi dependencies
27
+ shell: bash
28
+ run: |
29
+ wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
30
+ bash Miniforge3.sh -b -p "${HOME}/conda"
31
+ source "${HOME}/conda/etc/profile.d/conda.sh"
32
+ source "${HOME}/conda/etc/profile.d/mamba.sh"
33
+ sudo apt-get --allow-releaseinfo-change update
34
+ sudo apt-get update -y
35
+ sudo apt-get upgrade -y
36
+ sudo apt-get install -y libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0
37
+ mamba activate
38
+ mamba create -y --name cad_to_dagmc python=3.10
39
+ mamba activate cad_to_dagmc
40
+ mamba install -y -c conda-forge moab>=5.3.0 gmsh python-gmsh ocp=7.7.2.0 cadquery=2.4.0
41
+ python -m pip install --upgrade pip
42
+ python -m pip install .
43
+ python -c "import cad_to_dagmc"
44
+ python -m pip install .[tests]
45
+ pytest -v tests/test_file_creation.py
46
+ pytest -v tests/test_loading_from_file_vs_shape_object.py
47
+ pytest -v tests/test_python_api.py
48
+ pytest -v tests/test_version.py
49
+ python examples/surface_mesh/create_stp_files_for_examples.py
50
+ python examples/surface_mesh/cadquery_assembly.py
51
+ python examples/surface_mesh/cadquery_compound.py
52
+ python examples/surface_mesh/cadquery_object_and_stp_file.py
53
+ python examples/surface_mesh/cadquery_text.py
54
+ python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
55
+ python examples/surface_mesh/multiple_cadquery_objects.py
56
+ python examples/surface_mesh/multiple_stp_files.py
57
+ python examples/surface_mesh/single_stp_file_multiple_volumes.py
58
+ python examples/surface_mesh/single_cadquery_object.py
59
+ python examples/surface_mesh/single_stp_file.py
60
+ python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
61
+ pytest -v tests/test_model_creation_for_transport.py
62
+ mamba activate base
63
+ mamba create -y --name openmc python=3.10
64
+ mamba activate openmc
65
+ mamba install -y -c conda-forge "openmc=0.14.0=dagmc*nompi*"
66
+ python -m pip install pytest
67
+ python -m pip install vtk
68
+ pytest -v tests/test_h5m_in_simulation.py
69
+ pytest -v tests/test_h5m_in_transport.py
70
+ python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
@@ -0,0 +1,57 @@
1
+
2
+ name: CI with pip install
3
+
4
+ on:
5
+ pull_request:
6
+ branches:
7
+ - main
8
+ paths-ignore:
9
+ - 'docs/**'
10
+ - '.gitignore'
11
+ - '*.md'
12
+ - 'CITATION.cff'
13
+ - 'LICENSE.txt'
14
+ - 'readthedocs.yml'
15
+ push:
16
+ branches:
17
+ - main
18
+
19
+ jobs:
20
+ testing:
21
+ runs-on: ubuntu-latest
22
+ container:
23
+ image: openmc/openmc:develop-dagmc
24
+ steps:
25
+ - name: Checkout repository
26
+ uses: actions/checkout@v4
27
+
28
+ - name: install non pypi dependencies
29
+ shell: bash
30
+ run: |
31
+ apt-get --allow-releaseinfo-change update
32
+ apt-get update -y
33
+ apt-get upgrade -y
34
+ apt-get install -y libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0 libxcursor-dev libxft2 libxinerama-dev
35
+ apt install python3
36
+ apt install python3-pip
37
+ python -m pip install --upgrade pip
38
+ python -m pip install gmsh
39
+ python -m pip install cadquery-ocp==7.7.2
40
+ python -m pip install cadquery==2.4.0
41
+ python -m pip install .
42
+ python -c "import cad_to_dagmc"
43
+ python -m pip install .[tests]
44
+ pytest tests -v
45
+ cd examples
46
+ python create_stp_files_for_examples.py
47
+ python cadquery_assembly.py
48
+ python cadquery_compound.py
49
+ python cadquery_object_and_stp_file.py
50
+ python cadquery_text.py
51
+ python curved_cadquery_object_to_dagmc_surface_mesh.py
52
+ python curved_cadquery_object_to_dagmc_volume_mesh.py
53
+ python multiple_cadquery_objects.py
54
+ python multiple_stp_files.py
55
+ python single_stp_file_multiple_volumes.py
56
+ python single_cadquery_object.py
57
+ python single_stp_file.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cad_to_dagmc
3
- Version: 0.5.1
3
+ Version: 0.6.0
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
@@ -16,11 +16,12 @@ Requires-Dist: trimesh
16
16
  Requires-Dist: networkx
17
17
  Provides-Extra: tests
18
18
  Requires-Dist: pytest; extra == "tests"
19
+ Requires-Dist: vtk; extra == "tests"
19
20
 
20
21
 
21
22
  [![N|Python](https://www.python.org/static/community_logos/python-powered-w-100x40.png)](https://www.python.org)
22
23
 
23
- [![CI with model benchmark zoo](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml/badge.svg)](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml) Testing package and running examples
24
+ [![CI with install](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml/badge.svg?branch=main)](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml) Testing package and running examples
24
25
 
25
26
  [![CI with model benchmark zoo](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml/badge.svg?branch=main)](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)
26
27
 
@@ -29,34 +30,41 @@ Requires-Dist: pytest; extra == "tests"
29
30
  [![PyPI](https://img.shields.io/pypi/v/cad_to_dagmc?color=brightgreen&label=pypi&logo=grebrightgreenen&logoColor=green)](https://pypi.org/project/cad_to_dagmc/)
30
31
 
31
32
 
32
- A minimal package that uses CadQuery functionality to convert CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) h5m files
33
+ A minimal package that converts CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) h5m files
34
+
35
+ cad-to-dagmc can create:
36
+ - surface meshes / faceted geometry / triangular meshes
37
+ - unstructured mesh / tetrahedral meshes / volume meshes
38
+
39
+ cad-to-dagmc can convert:
40
+ - STEP files
41
+ - CadQuery objects (in memory)
42
+
43
+ cadto-dagmc aims to produce DAGMC compatible h5m files from CAD geometry is intended to convert [STEP](http://www.steptools.com/stds/step/) files or [CadQuery](https://cadquery.readthedocs.io) objects to a [DAGMC](https://github.com/svalinn/DAGMC/) compatible h5m file.
33
44
 
34
- This particular method of producing DAGMC compatible h5m files from CAD geometry is intended to convert STP files or [CadQuery](https://cadquery.readthedocs.io) objects to a DAGMC compatible h5m file.
35
45
 
36
46
  The resulting DAGMC geometry can then be used for simulations in [OpenMC](https://github.com/openmc-dev/openmc/) or [other supported codes](https://svalinn.github.io/DAGMC/).
37
47
 
38
48
  This package is tested with [pytest tests](https://github.com/fusion-energy/cad_to_dagmc/tree/main/tests) and also the DAGMC geometry made with this package is compared to simulation carried out with native constructive solid geometry, see [Model Benchmark Zoo](https://github.com/fusion-energy/model_benchmark_zoo) for more details.
39
49
 
40
- Also checkout these other packages that also create DAGMC geometry [CAD-to-OpenMC](https://github.com/openmsr/CAD_to_OpenMC), [Stellarmesh](https://github.com/Thea-Energy/stellarmesh)
50
+ Also checkout these other software projects that also create DAGMC geometry [CAD-to-OpenMC](https://github.com/openmsr/CAD_to_OpenMC), [Stellarmesh](https://github.com/Thea-Energy/stellarmesh) and [Coreform Cubit](https://coreform.com/products/coreform-cubit/)
41
51
 
42
52
  # Installation prerequisite
43
53
 
44
54
  In principle, any Conda/Mamba distribution will work. A few Conda/Mamba options are:
45
- - [Mambaforge](https://github.com/conda-forge/miniforge#mambaforge)
46
- - [Miniforge](https://github.com/conda-forge/miniforge#miniforge-pypy3)
55
+ - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
47
56
  - [Anaconda](https://www.anaconda.com/download)
48
57
  - [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
49
58
 
50
59
 
51
60
  # Install using Mamba and pip
52
61
 
53
- This example assumes you have installed the MambaForge option or separately
54
- installed Mamba with ```conda install -c conda-forge mamba -y```
62
+ This example assumes you have installed the Miniforge option or separately have installed Mamba with ```conda install -c conda-forge mamba -y```
55
63
 
56
- Create a new conda environment, I've chosen Python 3.9 here but new versions are
64
+ Create a new conda environment, I've chosen Python 3.10 here but newer versions are
57
65
  also supported.
58
66
  ```bash
59
- mamba create --name new_env python=3.9 -y
67
+ mamba create --name new_env python=3.10 -y
60
68
  ```
61
69
 
62
70
  Activate the environment
@@ -66,7 +74,7 @@ mamba activate new_env
66
74
 
67
75
  Install the dependencies
68
76
  ```bash
69
- mamba install -c cadquery -c conda-forge moab gmsh python-gmsh cadquery=master -y
77
+ mamba install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0
70
78
  ```
71
79
 
72
80
  Then you can install the cad_to_dagmc package with ```pip```
@@ -74,11 +82,17 @@ Then you can install the cad_to_dagmc package with ```pip```
74
82
  pip install cad_to_dagmc
75
83
  ```
76
84
 
77
- You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others [link to DAGMC documentation](https://svalinn.github.io/DAGMC/).You can run ```conda install -c conda-forge openmc``` however this more specific command makes sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
85
+ You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others [link to DAGMC documentation](https://svalinn.github.io/DAGMC/).
86
+
87
+ To install OpenMC You can run ```mamba install -c conda-forge openmc``` however this more specific command makes sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
78
88
  ```bash
79
- mamba install -c conda-forge -y "openmc=0.13.3=dagmc*nompi*"
89
+ mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
80
90
  ```
81
91
 
92
+ It might not be possible to install OpenMC and cad-to-dagmc in the same conda/mamba python environment so you may have to create a new conda/mamba environment and install OpenMC there.
93
+
94
+ Another option would be to [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which would also need compiling with MOAB and DAGMC options.
95
+
82
96
 
83
97
  # Install using Conda and pip
84
98
 
@@ -86,7 +100,7 @@ This example uses Conda to install some dependencies that are not available via
86
100
 
87
101
  Create a new conda environment
88
102
  ```bash
89
- conda create --name new_env python=3.9 -y
103
+ conda create --name new_env python=3.10 -y
90
104
  ```
91
105
 
92
106
  Activate the environment
@@ -96,7 +110,7 @@ conda activate new_env
96
110
 
97
111
  Install the dependencies
98
112
  ```bash
99
- conda install -c cadquery -c conda-forge moab gmsh python-gmsh cadquery=master -y
113
+ conda install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0
100
114
  ```
101
115
 
102
116
  Then you can install the cad_to_dagmc package with ```pip```
@@ -104,11 +118,19 @@ Then you can install the cad_to_dagmc package with ```pip```
104
118
  pip install cad_to_dagmc
105
119
  ```
106
120
 
107
- You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others [link to DAGMC documentation](https://svalinn.github.io/DAGMC/).You can run ```conda install -c conda-forge openmc``` however this more specific command makes sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
121
+ # Usage - with OpenMC
122
+
123
+ You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others supported by [DAGMC](https://svalinn.github.io/DAGMC/).
124
+
125
+ You can run ```mamba install -c conda-forge openmc``` however this may choose to install OpenMC without DAGMC included.
126
+
127
+ You can be more specific with conda/mamba commands to make sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
108
128
  ```bash
109
- conda install -c conda-forge -y "openmc=0.13.3=dagmc*nompi*"
129
+ mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
110
130
  ```
111
131
 
132
+ You could also [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which might be prefered as it can be tricky for the conda enviroment to get resolved.
133
+
112
134
 
113
135
 
114
136
  # Usage - creation of DAGMC h5m files
@@ -117,4 +139,6 @@ For examples see the [examples folder](https://github.com/fusion-energy/cad_to_d
117
139
 
118
140
  # Usage - simulation with transport code
119
141
 
120
- For examples see the CAD tasks in the [neutronics-workshop](https://github.com/fusion-energy/neutronics-workshop)
142
+ For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
143
+
144
+ For more examples see the CAD tasks in the [neutronics-workshop](https://github.com/fusion-energy/neutronics-workshop) and [model benchmark zoo](https://github.com/fusion-energy/model_benchmark_zoo)
@@ -0,0 +1,124 @@
1
+
2
+ [![N|Python](https://www.python.org/static/community_logos/python-powered-w-100x40.png)](https://www.python.org)
3
+
4
+ [![CI with install](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml/badge.svg?branch=main)](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml) Testing package and running examples
5
+
6
+ [![CI with model benchmark zoo](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml/badge.svg?branch=main)](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
+ [![Upload Python Package](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/python-publish.yml/badge.svg)](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/python-publish.yml)
9
+
10
+ [![PyPI](https://img.shields.io/pypi/v/cad_to_dagmc?color=brightgreen&label=pypi&logo=grebrightgreenen&logoColor=green)](https://pypi.org/project/cad_to_dagmc/)
11
+
12
+
13
+ A minimal package that converts CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) h5m files
14
+
15
+ cad-to-dagmc can create:
16
+ - surface meshes / faceted geometry / triangular meshes
17
+ - unstructured mesh / tetrahedral meshes / volume meshes
18
+
19
+ cad-to-dagmc can convert:
20
+ - STEP files
21
+ - CadQuery objects (in memory)
22
+
23
+ cadto-dagmc aims to produce DAGMC compatible h5m files from CAD geometry is intended to convert [STEP](http://www.steptools.com/stds/step/) files or [CadQuery](https://cadquery.readthedocs.io) objects to a [DAGMC](https://github.com/svalinn/DAGMC/) compatible h5m file.
24
+
25
+
26
+ The resulting DAGMC geometry can then be used for simulations in [OpenMC](https://github.com/openmc-dev/openmc/) or [other supported codes](https://svalinn.github.io/DAGMC/).
27
+
28
+ This package is tested with [pytest tests](https://github.com/fusion-energy/cad_to_dagmc/tree/main/tests) and also the DAGMC geometry made with this package is compared to simulation carried out with native constructive solid geometry, see [Model Benchmark Zoo](https://github.com/fusion-energy/model_benchmark_zoo) for more details.
29
+
30
+ Also checkout these other software projects that also create DAGMC geometry [CAD-to-OpenMC](https://github.com/openmsr/CAD_to_OpenMC), [Stellarmesh](https://github.com/Thea-Energy/stellarmesh) and [Coreform Cubit](https://coreform.com/products/coreform-cubit/)
31
+
32
+ # Installation prerequisite
33
+
34
+ In principle, any Conda/Mamba distribution will work. A few Conda/Mamba options are:
35
+ - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
36
+ - [Anaconda](https://www.anaconda.com/download)
37
+ - [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
38
+
39
+
40
+ # Install using Mamba and pip
41
+
42
+ This example assumes you have installed the Miniforge option or separately have installed Mamba with ```conda install -c conda-forge mamba -y```
43
+
44
+ Create a new conda environment, I've chosen Python 3.10 here but newer versions are
45
+ also supported.
46
+ ```bash
47
+ mamba create --name new_env python=3.10 -y
48
+ ```
49
+
50
+ Activate the environment
51
+ ```bash
52
+ mamba activate new_env
53
+ ```
54
+
55
+ Install the dependencies
56
+ ```bash
57
+ mamba install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0
58
+ ```
59
+
60
+ Then you can install the cad_to_dagmc package with ```pip```
61
+ ```bash
62
+ pip install cad_to_dagmc
63
+ ```
64
+
65
+ You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others [link to DAGMC documentation](https://svalinn.github.io/DAGMC/).
66
+
67
+ To install OpenMC You can run ```mamba install -c conda-forge openmc``` however this more specific command makes sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
68
+ ```bash
69
+ mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
70
+ ```
71
+
72
+ It might not be possible to install OpenMC and cad-to-dagmc in the same conda/mamba python environment so you may have to create a new conda/mamba environment and install OpenMC there.
73
+
74
+ Another option would be to [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which would also need compiling with MOAB and DAGMC options.
75
+
76
+
77
+ # Install using Conda and pip
78
+
79
+ This example uses Conda to install some dependencies that are not available via PyPi.
80
+
81
+ Create a new conda environment
82
+ ```bash
83
+ conda create --name new_env python=3.10 -y
84
+ ```
85
+
86
+ Activate the environment
87
+ ```bash
88
+ conda activate new_env
89
+ ```
90
+
91
+ Install the dependencies
92
+ ```bash
93
+ conda install -y -c conda-forge gmsh python-gmsh moab>=5.3.0 ocp>=7.7.2.0 cadquery>=2.4.0
94
+ ```
95
+
96
+ Then you can install the cad_to_dagmc package with ```pip```
97
+ ```bash
98
+ pip install cad_to_dagmc
99
+ ```
100
+
101
+ # Usage - with OpenMC
102
+
103
+ You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others supported by [DAGMC](https://svalinn.github.io/DAGMC/).
104
+
105
+ You can run ```mamba install -c conda-forge openmc``` however this may choose to install OpenMC without DAGMC included.
106
+
107
+ You can be more specific with conda/mamba commands to make sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
108
+ ```bash
109
+ mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
110
+ ```
111
+
112
+ You could also [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which might be prefered as it can be tricky for the conda enviroment to get resolved.
113
+
114
+
115
+
116
+ # Usage - creation of DAGMC h5m files
117
+
118
+ For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
119
+
120
+ # Usage - simulation with transport code
121
+
122
+ For examples see the [examples folder](https://github.com/fusion-energy/cad_to_dagmc/tree/main/examples)
123
+
124
+ For more examples see the CAD tasks in the [neutronics-workshop](https://github.com/fusion-energy/neutronics-workshop) and [model benchmark zoo](https://github.com/fusion-energy/model_benchmark_zoo)
@@ -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, material_tags=["mat1", "mat2"])
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"])
@@ -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, material_tags=["mat1", "mat2"])
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
- object=text,
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", max_mesh_size=1, min_mesh_size=0.1
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, material_tags=["mat1"])
11
- my_model.add_cadquery_object(box_with_round_corners, material_tags=["mat2"])
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
+ )
@@ -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, material_tags=["mat1"])
8
- my_model.export_dagmc_h5m_file()
7
+ my_model.add_cadquery_object(result)
8
+ my_model.export_dagmc_h5m_file(material_tags=["mat1"])
@@ -0,0 +1,5 @@
1
+ from cad_to_dagmc import CadToDagmc
2
+
3
+ my_model = CadToDagmc()
4
+ my_model.add_stp_file("spline_extrude.stp")
5
+ 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", material_tags=["mat1", "mat2", "mat2", "mat2", "mat1"])
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"])
@@ -0,0 +1,62 @@
1
+ from cad_to_dagmc import CadToDagmc
2
+ import cadquery as cq
3
+ from math import sin, cos, pi, floor
4
+
5
+
6
+ # define the generating function
7
+ def hypocycloid(t, r1, r2):
8
+ return (
9
+ (r1 - r2) * cos(t) + r2 * cos(r1 / r2 * t - t),
10
+ (r1 - r2) * sin(t) + r2 * sin(-(r1 / r2 * t - t)),
11
+ )
12
+
13
+
14
+ def epicycloid(t, r1, r2):
15
+ return (
16
+ (r1 + r2) * cos(t) - r2 * cos(r1 / r2 * t + t),
17
+ (r1 + r2) * sin(t) - r2 * sin(r1 / r2 * t + t),
18
+ )
19
+
20
+
21
+ def gear(t, r1=4, r2=1):
22
+ if (-1) ** (1 + floor(t / 2 / pi * (r1 / r2))) < 0:
23
+ return epicycloid(t, r1, r2)
24
+ else:
25
+ return hypocycloid(t, r1, r2)
26
+
27
+
28
+ # create the gear profile and extrude it
29
+ result = (
30
+ cq.Workplane("XY")
31
+ .parametricCurve(lambda t: gear(t * 2 * pi, 6, 1))
32
+ .twistExtrude(15, 90)
33
+ .faces(">Z")
34
+ .workplane()
35
+ .circle(2)
36
+ .cutThruAll()
37
+ )
38
+ assembly = cq.Assembly()
39
+ assembly.add(result)
40
+ assembly.save("twist.step")
41
+
42
+ s = cq.Workplane("XY")
43
+ sPnts = [
44
+ (2.75, 1.5),
45
+ (2.5, 1.75),
46
+ (2.0, 1.5),
47
+ (1.5, 1.0),
48
+ (1.0, 1.25),
49
+ (0.5, 1.0),
50
+ (0, 1.0),
51
+ ]
52
+ r = s.lineTo(3.0, 0).lineTo(3.0, 1.0).spline(sPnts, includeCurrent=True).close()
53
+ result2 = r.extrude(-20)
54
+ assembly.add(result2)
55
+ assembly.save("twist_and_extrude.step")
56
+
57
+ my_model = CadToDagmc()
58
+
59
+ my_model.add_cadquery_object(result)
60
+ my_model.add_cadquery_object(result2)
61
+
62
+ my_model.export_unstructured_mesh_file(filename="umesh.h5m", max_mesh_size=1, min_mesh_size=0.1)