File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 13
13
from .surface import _BOUNDARY_TYPES
14
14
from .bounding_box import BoundingBox
15
15
from .utility_funcs import input_path
16
+ from .plots import add_plot_params
16
17
17
18
18
19
class DAGMCUniverse (openmc .UniverseBase ):
@@ -566,6 +567,21 @@ def sync_dagmc_cells(self, mats: Iterable[openmc.Material]):
566
567
fill = mats_per_id [dag_cell .fill .id ] if dag_cell .fill else None
567
568
self .add_cell (openmc .DAGMCCell (cell_id = dag_cell_id , fill = fill ))
568
569
570
+ @add_plot_params
571
+ def plot (self , * args , ** kwargs ):
572
+ """Display a slice plot of the DAGMCUniverse.
573
+ """
574
+ model = openmc .Model ()
575
+ model .geometry = openmc .Geometry (self )
576
+
577
+ for mat_name in self .material_names :
578
+ material = openmc .Material (name = mat_name )
579
+ # Placeholder nuclide to ensure material is not empty
580
+ material .add_nuclide ('H1' , 1.0 )
581
+ model .materials .append (material )
582
+
583
+ return model .plot (* args , ** kwargs )
584
+
569
585
570
586
class DAGMCCell (openmc .Cell ):
571
587
"""A cell class for DAGMC-based geometries.
Original file line number Diff line number Diff line change 7
7
not openmc .lib ._dagmc_enabled (), reason = "DAGMC CAD geometry is not enabled."
8
8
)
9
9
10
- def test_plotting_dagmc_geometry (request ):
11
- """Test plotting a DAGMC geometry with OpenMC. This is different to CSG
12
- geometry plotting as the path to the DAGMC file needs handling."""
10
+ def test_plotting_dagmc_model (request ):
11
+ """Test plotting a DAGMC model with OpenMC. This is different to CSG
12
+ model plotting as the path to the DAGMC file needs handling."""
13
13
14
14
dag_universe = openmc .DAGMCUniverse (request .path .parent / 'dagmc.h5m' )
15
15
csg_with_dag_inside = dag_universe .bounded_universe ()
@@ -30,3 +30,11 @@ def test_plotting_dagmc_geometry(request):
30
30
model .settings .particles = 50
31
31
32
32
model .plot ()
33
+
34
+
35
+ def test_plotting_dagmc_universe (request ):
36
+ """Test plotting a DAGMCUniverse with OpenMC. This is different to plotting
37
+ UniverseBase as the materials are not defined withing the DAGMCUniverse."""
38
+
39
+ dag_universe = openmc .DAGMCUniverse (request .path .parent / 'dagmc.h5m' )
40
+ dag_universe .plot ()
You can’t perform that action at this time.
0 commit comments