Correctly apply volumes to materials when using DAGMC geometries (#2787)

Co-authored-by: Nicolas Linden <n.linden@naarea.fr>
This commit is contained in:
nplinden 2023-11-29 12:44:14 +01:00 committed by GitHub
parent 87e00f76ed
commit 47c37f506d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -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':

View file

@ -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)