mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Merge pull request #1218 from GiudGiud/PR_tc_tallies
Speeding up import of transport corrected cross sections
This commit is contained in:
commit
e792fe72e5
2 changed files with 8 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue