diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index 83d3178ff7..701f7d8eb7 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -999,6 +999,11 @@ class Library(object): xsdata.set_total_mgxs(mymgxs, xs_type=xs_type, nuclide=[nuclide], subdomain=subdomain) + elif 'transport' in self.mgxs_types and self.correction == 'P0': + mymgxs = self.get_mgxs(domain, 'transport') + xsdata.set_total_mgxs(mymgxs, xs_type=xs_type, nuclide=[nuclide], + subdomain=subdomain) + elif 'total' in self.mgxs_types: mymgxs = self.get_mgxs(domain, 'total') xsdata.set_total_mgxs(mymgxs, xs_type=xs_type, nuclide=[nuclide], @@ -1167,6 +1172,16 @@ class Library(object): np.subtract(xsdata._total[i], np.sum(np.sum( xsdata._scatter_matrix[i][:, :, :, :, :], axis=4), axis=3)) + # if only scatter matrices have been tallied, multiplicity cannot + # be accounted for + else: + msg = 'Scatter multiplicity (such as (n,xn) reactions) '\ + 'are ignored since multiplicity or nu-scatter matrices '\ + 'were not tallied for ' + xsdata_name + warn(msg, RuntimeWarning) + xsdata.set_scatter_matrix_mgxs(scatt_mgxs, xs_type=xs_type, + nuclide=[nuclide], + subdomain=subdomain) return xsdata @@ -1410,6 +1425,9 @@ class Library(object): fixed source problem could be the target. - Fission and kappa-fission are not required as they are only needed to support tallies the user may wish to request. + - Scattering multiplicity should have been tallied for increased model + accuracy, either using a multiplicity or scatter and nu-scatter matrix + tally. See also -------- @@ -1460,6 +1478,15 @@ class Library(object): '"scatter matrix", or "consistent scatter matrix" MGXS ' 'type is required.') + # Make sure there is some kind of a scattering multiplicity matrix data + if 'multiplicity matrix' not in self.mgxs_types and \ + ('scatter matrix' not in self.mgxs_types or + 'nu-scatter matrix' not in self.mgxs_types) and\ + ('consistent scatter matrix' not in self.mgxs_types or + 'consistent nu-scatter matrix' not in self.mgxs_types): + warn('A "multiplicity matrix" or both a "scatter" and "nu-scatter" ' + 'matrix MGXS type(s) should be provided.') + # Ensure absorption is present if 'absorption' not in self.mgxs_types: error_flag = True diff --git a/openmc/mgxs_library.py b/openmc/mgxs_library.py index b98902030a..34c36ec170 100644 --- a/openmc/mgxs_library.py +++ b/openmc/mgxs_library.py @@ -1638,9 +1638,9 @@ class XSdata(object): xs_type=xs_type, moment=0, subdomains=subdomain) if scatter.scatter_format == 'histogram': - scatt = np.sum(scatt, axis=0) + scatt = np.sum(scatt, axis=2) if nuscatter.scatter_format == 'histogram': - nuscatt = np.sum(nuscatt, axis=0) + nuscatt = np.sum(nuscatt, axis=2) self._multiplicity_matrix[i] = np.divide(nuscatt, scatt) self._multiplicity_matrix[i] = \