Skip to content

Commit 47c37f5

Browse files
nplindenNicolas Linden
and
Nicolas Linden
authored
Correctly apply volumes to materials when using DAGMC geometries (openmc-dev#2787)
Co-authored-by: Nicolas Linden <[email protected]>
1 parent 87e00f7 commit 47c37f5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

openmc/model/model.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,12 @@ def calculate_volumes(self, threads=None, output=True, cwd='.',
787787
for i, vol_calc in enumerate(self.settings.volume_calculations):
788788
vol_calc.load_results(f"volume_{i + 1}.h5")
789789
# First add them to the Python side
790-
self.geometry.add_volume_information(vol_calc)
790+
if vol_calc.domain_type == "material" and self.materials:
791+
for material in self.materials:
792+
if material.id in vol_calc.volumes:
793+
material.add_volume_information(vol_calc)
794+
else:
795+
self.geometry.add_volume_information(vol_calc)
791796

792797
# And now repeat for the C API
793798
if self.is_initialized and vol_calc.domain_type == 'material':

openmc/summary.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,9 @@ def add_volume_information(self, volume_calc):
240240
Results from a stochastic volume calculation
241241
242242
"""
243-
self.geometry.add_volume_information(volume_calc)
243+
if volume_calc.domain_type == "material" and self.materials:
244+
for material in self.materials:
245+
if material.id in volume_calc.volumes:
246+
material.add_volume_information(volume_calc)
247+
else:
248+
self.geometry.add_volume_information(volume_calc)

0 commit comments

Comments
 (0)