From 47c37f506daad78b596536ae37aa0d61e2efab33 Mon Sep 17 00:00:00 2001 From: nplinden <57541749+nplinden@users.noreply.github.com> Date: Wed, 29 Nov 2023 12:44:14 +0100 Subject: [PATCH] Correctly apply volumes to materials when using DAGMC geometries (#2787) Co-authored-by: Nicolas Linden --- openmc/model/model.py | 7 ++++++- openmc/summary.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/openmc/model/model.py b/openmc/model/model.py index a40a79bc91..9da834e139 100644 --- a/openmc/model/model.py +++ b/openmc/model/model.py @@ -787,7 +787,12 @@ class Model: for i, vol_calc in enumerate(self.settings.volume_calculations): vol_calc.load_results(f"volume_{i + 1}.h5") # First add them to the Python side - self.geometry.add_volume_information(vol_calc) + if vol_calc.domain_type == "material" and self.materials: + for material in self.materials: + if material.id in vol_calc.volumes: + material.add_volume_information(vol_calc) + else: + self.geometry.add_volume_information(vol_calc) # And now repeat for the C API if self.is_initialized and vol_calc.domain_type == 'material': diff --git a/openmc/summary.py b/openmc/summary.py index 43224334d0..6423f8ce1d 100644 --- a/openmc/summary.py +++ b/openmc/summary.py @@ -240,4 +240,9 @@ class Summary: Results from a stochastic volume calculation """ - self.geometry.add_volume_information(volume_calc) + if volume_calc.domain_type == "material" and self.materials: + for material in self.materials: + if material.id in volume_calc.volumes: + material.add_volume_information(volume_calc) + else: + self.geometry.add_volume_information(volume_calc)