diff --git a/openmc/model/model.py b/openmc/model/model.py index d989c0b22d4..71d9a948d81 100644 --- a/openmc/model/model.py +++ b/openmc/model/model.py @@ -963,29 +963,14 @@ def execute_run(self, **kwargs): new_mats = matlist[tidx] rundir = self.ptransport_path / f'timestep_{tidx}' - # Collect all source energy distributions from model - dist_map = {} - for mat in new_mats: - pdist = mat.decay_photon_energy - if pdist is not None: - dist_map[mat.id] = pdist - - # Collect all spatial distributions of the sources from the model - box_map = {} + # Create Source for every depleted region + src_list = [] for cell in self.geometry.get_all_cells().values(): if cell.fill is None: continue - lower_left, upper_right = cell.region.bounding_box - box = openmc.stats.Box(lower_left, upper_right) - box_map[cell.fill.id] = box - - # Create Source for every depleted region - src_list = [] - for idx in dist_map.keys(): - src = openmc.Source(energy=dist_map[idx], space=box_map[idx]) - src.strength = dist_map[idx].integral() - src.particle = 'photon' - src_list.append(src) + src = openmc.Source.from_cell_with_material(cell) + if src is not None: # materials may have no photon emission + src_list.append(src) self.settings.source = src_list self.export_to_xml(rundir)