Skip to content

Commit

Permalink
Correctly apply volumes to materials when using DAGMC geometries (#2787)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Linden <n.linden@naarea.fr>
  • Loading branch information
nplinden and Nicolas Linden committed Nov 29, 2023
1 parent 87e00f7 commit 47c37f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion openmc/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,12 @@ def calculate_volumes(self, threads=None, output=True, cwd='.',
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':
Expand Down
7 changes: 6 additions & 1 deletion openmc/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,9 @@ def add_volume_information(self, volume_calc):
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)

0 comments on commit 47c37f5

Please sign in to comment.