From b0732cb6b3754a2718b7c6c028f151e317a5174f Mon Sep 17 00:00:00 2001 From: Lorenzo Chierici Date: Tue, 18 Jun 2024 13:31:07 +0200 Subject: [PATCH] add dagmc fill materials to homogenized materials method (#3026) Co-authored-by: Paul Romano --- openmc/mesh.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openmc/mesh.py b/openmc/mesh.py index 215c91923..5456abd1a 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -211,6 +211,18 @@ class MeshBase(IDManagerMixin, ABC): # Create homogenized material for each element materials = model.geometry.get_all_materials() + + # Account for materials in DAGMC universes + # TODO: This should really get incorporated in lower-level calls to + # get_all_materials, but right now it requires information from the + # Model object + for cell in model.geometry.get_all_cells().values(): + if isinstance(cell.fill, openmc.DAGMCUniverse): + names = cell.fill.material_names + materials.update({ + mat.id: mat for mat in model.materials if mat.name in names + }) + homogenized_materials = [] for mat_volume_list in mat_volume_by_element: material_ids, volumes = [list(x) for x in zip(*mat_volume_list)]