Merge pull request #1218 from GiudGiud/PR_tc_tallies

Speeding up import of transport corrected cross sections
This commit is contained in:
Paul Romano 2019-04-10 08:39:07 -05:00 committed by GitHub
commit e792fe72e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -3926,7 +3926,7 @@ class ScatterMatrixXS(MatrixMGXS):
# to match scattering matrix shape for tally arithmetic
energy_filter = copy.deepcopy(energy_filter)
scatter_p1 = \
scatter_p1.diagonalize_filter(energy_filter)
scatter_p1.diagonalize_filter(energy_filter, 1)
self._rxn_rate_tally = scatter_p0 - scatter_p1
@ -4022,7 +4022,7 @@ class ScatterMatrixXS(MatrixMGXS):
# to match scattering matrix shape for tally arithmetic
energy_filter = flux.find_filter(openmc.EnergyFilter)
energy_filter = copy.deepcopy(energy_filter)
scatter_p1 = scatter_p1.diagonalize_filter(energy_filter)
scatter_p1 = scatter_p1.diagonalize_filter(energy_filter, 1)
# Compute the trasnport correction term
correction = scatter_p1 / flux

View file

@ -2964,7 +2964,7 @@ class Tally(IDManagerMixin):
tally_avg.sparse = self.sparse
return tally_avg
def diagonalize_filter(self, new_filter):
def diagonalize_filter(self, new_filter, filter_position=-1):
"""Diagonalize the tally data array along a new axis of filter bins.
This is a helper method for the tally arithmetic methods. This method
@ -2979,6 +2979,9 @@ class Tally(IDManagerMixin):
----------
new_filter : Filter
The filter along which to diagonalize the data in the new
filter_position : int
Where to place the new filter in the Tally.filters list. Defaults
to last position.
Returns
-------
@ -2988,6 +2991,7 @@ class Tally(IDManagerMixin):
"""
cv.check_type('new_filter', new_filter, _FILTER_CLASSES)
cv.check_type('filter_position', filter_position, Integral)
if new_filter in self.filters:
msg = 'Unable to diagonalize Tally ID="{0}" which already ' \
@ -2996,7 +3000,7 @@ class Tally(IDManagerMixin):
# Add the new filter to a copy of this Tally
new_tally = copy.deepcopy(self)
new_tally.filters.append(new_filter)
new_tally.filters.insert(filter_position, new_filter)
# Determine "base" indices along the new "diagonal", and the factor
# by which the "base" indices should be repeated to account for all