From d359909aa820cde96cdb4b3afd72980dd00dd2bb Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Mon, 10 Apr 2017 17:27:28 -0400 Subject: [PATCH] Revised order of operations for consistent scattering matrix calculation to work with multiple nuclides --- openmc/mgxs/mgxs.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 3131e0e6e..ffe5bb6dd 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3956,10 +3956,6 @@ class ScatterMatrixXS(MatrixMGXS): self._xs_tally = MGXS.xs_tally.fget(self) else: - # Compute groupwise scattering cross section - self._xs_tally = self.tallies['scatter'] / \ - self.tallies['flux (tracklength)'] - # Compute scattering probability matrix energyout_bins = [self.energy_groups.get_group_bounds(i) for i in range(self.num_groups, 0, -1)] @@ -3969,7 +3965,6 @@ class ScatterMatrixXS(MatrixMGXS): norm = self.tallies[tally_key].get_slice(scores=['scatter-0']) norm = norm.summation( filter_type=openmc.EnergyoutFilter, filter_bins=energyout_bins) - # Remove the AggregateFilter summed across energyout bins norm._filters = norm._filters[:2] @@ -3990,8 +3985,10 @@ class ScatterMatrixXS(MatrixMGXS): # Remove the AggregateFilter summed across mu bins norm._filters = norm._filters[:2] - # Multiply by the group-to-group probability matrix - self._xs_tally *= (self.tallies[tally_key] / norm) + # Compute groupwise scattering cross section + self._xs_tally = \ + self.tallies['scatter'] * self.tallies[tally_key] / norm + self._xs_tally /= self.tallies['flux (tracklength)'] # Multiply by the multiplicity matrix if self.nu: