cad-to-dagmc 0.8.2__tar.gz → 0.9.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 (61) hide show
  1. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/.github/workflows/ci_with_benchmarks.yml +2 -1
  2. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/.github/workflows/ci_with_conda_install.yml +3 -0
  3. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/.github/workflows/ci_with_pip_install.yml +3 -0
  4. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/PKG-INFO +9 -4
  5. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/README.md +5 -2
  6. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/from_gmsh_mesh_file.py +7 -9
  7. cad_to_dagmc-0.9.0/examples/surface_mesh/from_gmsh_mesh_file_with_tags.py +44 -0
  8. cad_to_dagmc-0.9.0/examples/surface_mesh/from_gmsh_object_with_tag.py +26 -0
  9. cad_to_dagmc-0.9.0/examples/surface_mesh/tagged_mesh.msh +3445 -0
  10. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/pyproject.toml +3 -0
  11. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/src/_version.py +9 -4
  12. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/src/cad_to_dagmc/core.py +109 -48
  13. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/src/cad_to_dagmc.egg-info/PKG-INFO +9 -4
  14. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/src/cad_to_dagmc.egg-info/SOURCES.txt +6 -0
  15. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/src/cad_to_dagmc.egg-info/requires.txt +1 -0
  16. cad_to_dagmc-0.9.0/tests/tagged_mesh.msh +3445 -0
  17. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/test_file_creation.py +8 -5
  18. cad_to_dagmc-0.9.0/tests/test_get_volumes.py +63 -0
  19. cad_to_dagmc-0.9.0/tests/test_mesh_to_dagmc.py +106 -0
  20. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/.github/workflows/black.yml +0 -0
  21. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/.github/workflows/python-publish.yml +0 -0
  22. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/.gitignore +0 -0
  23. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/CITATION.cff +0 -0
  24. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/LICENSE +0 -0
  25. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/cadquery_assembly.py +0 -0
  26. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +0 -0
  27. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/cadquery_compound.py +0 -0
  28. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
  29. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/cadquery_text.py +0 -0
  30. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
  31. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/different_resolution_meshes.py +0 -0
  32. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
  33. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/multiple_stp_files.py +0 -0
  34. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/single_cadquery_object.py +0 -0
  35. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/single_stp_file.py +0 -0
  36. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
  37. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +0 -0
  38. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/unstrucutred_volume_mesh/different_resolution_meshes.py +0 -0
  39. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -0
  40. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/setup.cfg +0 -0
  41. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/src/cad_to_dagmc/__init__.py +0 -0
  42. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
  43. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
  44. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
  45. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/ball_reactor.brep +0 -0
  46. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/curved_extrude.stp +0 -0
  47. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/extrude_rectangle.stp +0 -0
  48. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/multi_volume_cylinders.stp +0 -0
  49. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/one_cube.brep +0 -0
  50. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/single_cube.stp +0 -0
  51. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/single_volume_thin.stp +0 -0
  52. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/single_volume_thin.vtk +0 -0
  53. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/test_brep_file.brep +0 -0
  54. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/test_h5m_in_transport.py +0 -0
  55. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/test_loading_from_file_vs_shape_object.py +0 -0
  56. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/test_python_api.py +0 -0
  57. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/test_two_joined_cubes.brep +0 -0
  58. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/test_two_sep_cubes.brep +0 -0
  59. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/test_version.py +0 -0
  60. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/two_connected_cubes.stp +0 -0
  61. {cad_to_dagmc-0.8.2 → cad_to_dagmc-0.9.0}/tests/two_disconnected_cubes.stp +0 -0
@@ -41,10 +41,11 @@ jobs:
41
41
  python -m ensurepip --upgrade
42
42
  python -m pip install . --no-deps
43
43
  python -m pip install openmc_data_downloader
44
- openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9
44
+ openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9 Al27
45
45
  git clone --single-branch -b main --depth 1 https://github.com/fusion-energy/model_benchmark_zoo.git
46
46
  cd model_benchmark_zoo
47
47
  python -m pip install .[tests]
48
+ pip install git+https://github.com/svalinn/pydagmc
48
49
  conda env export > environment.yml
49
50
  cat environment.yml
50
51
  pytest tests/test_cad_to_dagmc -v
@@ -44,6 +44,7 @@ jobs:
44
44
  run: |
45
45
  conda install -y -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh vtk
46
46
  python -m pip install .[tests]
47
+ python -m pip install git+https://github.com/svalinn/pydagmc
47
48
 
48
49
  - name: Test import
49
50
  shell: bash -l {0}
@@ -65,6 +66,8 @@ jobs:
65
66
  python examples/surface_mesh/cadquery_text.py
66
67
  python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
67
68
  python examples/surface_mesh/from_gmsh_mesh_file.py
69
+ python examples/surface_mesh/from_gmsh_mesh_file_with_tags.py
70
+ python examples/surface_mesh/from_gmsh_object_with_tag.py
68
71
  python examples/surface_mesh/multiple_cadquery_objects.py
69
72
  python examples/surface_mesh/multiple_stp_files.py
70
73
  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.2
1
+ Metadata-Version: 2.4
2
2
  Name: cad_to_dagmc
3
- Version: 0.8.2
3
+ Version: 0.9.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
@@ -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
  [![N|Python](https://www.python.org/static/community_logos/python-powered-w-100x40.png)](https://www.python.org)
@@ -43,10 +45,13 @@ 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 (in memory)
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
@@ -20,10 +20,13 @@ 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 (in memory)
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
@@ -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 = MeshToDagmc(filename="example_gmsh_mesh.msh")
22
+ # converting the mesh file to a DAGMC file
24
23
 
25
- mesh.export_dagmc_h5m_file(
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
- filename="dagmc.h5m",
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.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()