mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Fixed issue in Filter.is_subset(...) routine for energy filter types
This commit is contained in:
parent
e05ab41527
commit
4bf7fe5104
3 changed files with 16 additions and 12 deletions
|
|
@ -322,6 +322,8 @@ class Filter(object):
|
|||
return False
|
||||
elif self.type != other.type:
|
||||
return False
|
||||
elif self.type in ['energy', 'energyout']:
|
||||
return np.all(self.bins == other.bins)
|
||||
|
||||
for bin in other.bins:
|
||||
if bin not in self.bins:
|
||||
|
|
|
|||
|
|
@ -840,6 +840,7 @@ class TransportXS(MultiGroupXS):
|
|||
super(TransportXS, self).load_from_statepoint(statepoint)
|
||||
scatter_p1 = self.tallies['scatter-P1']
|
||||
self.tallies['scatter-P1'] = scatter_p1.get_slice(scores=['scatter-P1'])
|
||||
self.tallies['scatter-P1'].filters[-1].type = 'energy'
|
||||
|
||||
def compute_xs(self):
|
||||
"""Computes the multi-group transport cross-sections using OpenMC
|
||||
|
|
@ -1061,7 +1062,7 @@ class ScatterMatrixXS(MultiGroupXS):
|
|||
# Initialize the Tallies
|
||||
super(ScatterMatrixXS, self).create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
def compute_xs(self, correction='None'):
|
||||
def compute_xs(self, correction='P0'):
|
||||
"""Computes the multi-group scattering matrix using OpenMC
|
||||
tally arithmetic.
|
||||
|
||||
|
|
@ -1075,7 +1076,7 @@ class ScatterMatrixXS(MultiGroupXS):
|
|||
|
||||
# If using P0 correction subtract scatter-P1 from the diagonal
|
||||
if correction == 'P0':
|
||||
scatter_p1 = self.tallies['scatter-1']
|
||||
scatter_p1 = self.tallies['scatter-P1']
|
||||
scatter_p1 = scatter_p1.get_slice(scores=['scatter-P1'])
|
||||
energy_filter = openmc.Filter(type='energy')
|
||||
energy_filter.bins = self.energy_groups.group_edges
|
||||
|
|
@ -1245,7 +1246,7 @@ class NuScatterMatrixXS(ScatterMatrixXS):
|
|||
# Intialize the Tallies
|
||||
super(ScatterMatrixXS, self).create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
def compute_xs(self, correction='None'):
|
||||
def compute_xs(self, correction='P0'):
|
||||
"""Computes the multi-group nu-scattering matrix using OpenMC
|
||||
tally arithmetic.
|
||||
|
||||
|
|
@ -1259,7 +1260,7 @@ class NuScatterMatrixXS(ScatterMatrixXS):
|
|||
|
||||
# If using P0 correction subtract scatter-P1 from the diagonal
|
||||
if correction == 'P0':
|
||||
scatter_p1 = self.tallies['scatter-1']
|
||||
scatter_p1 = self.tallies['scatter-P1']
|
||||
scatter_p1 = scatter_p1.get_slice(scores=['scatter-P1'])
|
||||
energy_filter = openmc.Filter(type='energy')
|
||||
energy_filter.bins = self.energy_groups.group_edges
|
||||
|
|
@ -1288,8 +1289,9 @@ class Chi(MultiGroupXS):
|
|||
|
||||
# Create the non-domain specific Filters for the Tallies
|
||||
group_edges = self.energy_groups.group_edges
|
||||
energyout_filter = openmc.Filter('energyout', group_edges)
|
||||
filters = [[], [energyout_filter]]
|
||||
energyout_filter1 = openmc.Filter('energyout', group_edges)
|
||||
energyout_filter2 = openmc.Filter('energyout', [group_edges[0], group_edges[-1]])
|
||||
filters = [[energyout_filter2], [energyout_filter1]]
|
||||
|
||||
# Intialize the Tallies
|
||||
super(Chi, self).create_tallies(scores, filters, keys, estimator)
|
||||
|
|
@ -1299,6 +1301,7 @@ class Chi(MultiGroupXS):
|
|||
|
||||
nu_fission_in = self.tallies['nu-fission-in']
|
||||
nu_fission_out = self.tallies['nu-fission-out']
|
||||
nu_fission_in.remove_filter(nu_fission_in.filters[-1])
|
||||
self._xs_tally = nu_fission_out / nu_fission_in
|
||||
self._xs_tally._mean = np.nan_to_num(self.xs_tally.mean)
|
||||
self._xs_tally._std_dev = np.nan_to_num(self.xs_tally.std_dev)
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ class StatePoint(object):
|
|||
"""Finds and returns a Tally object with certain properties.
|
||||
|
||||
This routine searches the list of Tallies and returns the first Tally
|
||||
found it finds which satisfies all of the input parameters.
|
||||
found which satisfies all of the input parameters.
|
||||
NOTE: The input parameters do not need to match the complete Tally
|
||||
specification and may only represent a subset of the Tally's properties.
|
||||
|
||||
|
|
@ -534,15 +534,14 @@ class StatePoint(object):
|
|||
|
||||
# Iterate over the Filters requested by the user
|
||||
for filter in filters:
|
||||
contains_filter = False
|
||||
contains_filters = False
|
||||
|
||||
for test_filter in test_tally.filters:
|
||||
if test_filter.is_subset(filter):
|
||||
contains_filter = True
|
||||
if filter.is_subset(test_filter):
|
||||
contains_filters = True
|
||||
break
|
||||
|
||||
if not contains_filter:
|
||||
contains_filters = False
|
||||
if not contains_filters:
|
||||
break
|
||||
|
||||
if not contains_filters:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue