mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Merge pull request #491 from wbinventor/nuscatter-mat-hotfix
Hotfix for nu-scatter matrix in openmc.mgxs
This commit is contained in:
commit
7b862ee021
7 changed files with 225 additions and 231 deletions
File diff suppressed because one or more lines are too long
|
|
@ -62,8 +62,9 @@ class Library(object):
|
|||
compute the cross section
|
||||
all_mgxs : OrderedDict
|
||||
MGXS objects keyed by domain ID and cross section type
|
||||
statepoint : openmc.StatePoint
|
||||
The statepoint with tally data used to the compute cross sections
|
||||
sp_filename : str
|
||||
The filename of the statepoint with tally data used to the
|
||||
compute cross sections
|
||||
name : str, optional
|
||||
Name of the multi-group cross section library. Used as a label to
|
||||
identify tallies in OpenMC 'tallies.xml' file.
|
||||
|
|
@ -189,7 +190,7 @@ class Library(object):
|
|||
return self._all_mgxs
|
||||
|
||||
@property
|
||||
def statepoint(self):
|
||||
def sp_filename(self):
|
||||
return self._sp_filename
|
||||
|
||||
@openmc_geometry.setter
|
||||
|
|
@ -341,7 +342,9 @@ class Library(object):
|
|||
----------
|
||||
domain : Material or Cell or Universe or Integral
|
||||
The material, cell, or universe object of interest (or its ID)
|
||||
mgxs_type : {'total', 'transport', 'absorption', 'capture', 'fission', 'nu-fission', 'scatter', 'nu-scatter', 'scatter matrix', 'nu-scatter matrix', 'chi'}
|
||||
mgxs_type : {'total', 'transport', 'absorption', 'capture', 'fission',
|
||||
'nu-fission', 'scatter', 'nu-scatter', 'scatter matrix',
|
||||
'nu-scatter matrix', 'chi'}
|
||||
The type of multi-group cross section object to return
|
||||
|
||||
Returns
|
||||
|
|
@ -414,7 +417,7 @@ class Library(object):
|
|||
|
||||
"""
|
||||
|
||||
if self.statepoint is None:
|
||||
if self.sp_filename is None:
|
||||
msg = 'Unable to get a condensed coarse group cross section ' \
|
||||
'library since the statepoint has not yet been loaded'
|
||||
raise ValueError(msg)
|
||||
|
|
@ -466,7 +469,7 @@ class Library(object):
|
|||
|
||||
"""
|
||||
|
||||
if self.statepoint is None:
|
||||
if self.sp_filename is None:
|
||||
msg = 'Unable to get a subdomain-averaged cross section ' \
|
||||
'library since the statepoint has not yet been loaded'
|
||||
raise ValueError(msg)
|
||||
|
|
@ -531,9 +534,9 @@ class Library(object):
|
|||
|
||||
"""
|
||||
|
||||
if self.statepoint is None:
|
||||
msg = 'Unable to get a condensed coarse group cross section ' \
|
||||
'library since a statepoint has not yet been loaded'
|
||||
if self.sp_filename is None:
|
||||
msg = 'Unable to export multi-group cross section library ' \
|
||||
'since a statepoint has not yet been loaded'
|
||||
raise ValueError(msg)
|
||||
|
||||
cv.check_type('filename', filename, basestring)
|
||||
|
|
|
|||
|
|
@ -420,12 +420,12 @@ class MGXS(object):
|
|||
|
||||
return densities
|
||||
|
||||
def create_tallies(self, scores, all_filters, keys, estimator):
|
||||
def _create_tallies(self, scores, all_filters, keys, estimator):
|
||||
"""Instantiates tallies needed to compute the multi-group cross section.
|
||||
|
||||
This is a helper method for MGXS subclasses to create tallies
|
||||
for input file generation. The tallies are stored in the tallies dict.
|
||||
This method is called by each subclass' create_tallies(...) method
|
||||
This method is called by each subclass' tallies property getter
|
||||
which define the parameters given to this parent class method.
|
||||
|
||||
Parameters
|
||||
|
|
@ -1286,7 +1286,7 @@ class TotalXS(MGXS):
|
|||
"""
|
||||
|
||||
# Instantiate tallies if they do not exist
|
||||
if super(TotalXS, self).tallies is None:
|
||||
if self._tallies is None:
|
||||
|
||||
# Create a list of scores for each Tally to be created
|
||||
scores = ['flux', 'total']
|
||||
|
|
@ -1299,10 +1299,9 @@ class TotalXS(MGXS):
|
|||
filters = [[energy_filter], [energy_filter]]
|
||||
|
||||
# Initialize the Tallies
|
||||
super(TotalXS, self).create_tallies(scores, filters,
|
||||
keys, estimator)
|
||||
self._create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
return super(TotalXS, self).tallies
|
||||
return self._tallies
|
||||
|
||||
def compute_xs(self):
|
||||
"""Computes the multi-group total cross sections using OpenMC
|
||||
|
|
@ -1333,7 +1332,7 @@ class TransportXS(MGXS):
|
|||
"""
|
||||
|
||||
# Instantiate tallies if they do not exist
|
||||
if super(TransportXS, self).tallies is None:
|
||||
if self._tallies is None:
|
||||
|
||||
# Create a list of scores for each Tally to be created
|
||||
scores = ['flux', 'total', 'scatter-P1']
|
||||
|
|
@ -1347,10 +1346,9 @@ class TransportXS(MGXS):
|
|||
filters = [[energy_filter], [energy_filter], [energyout_filter]]
|
||||
|
||||
# Initialize the Tallies
|
||||
super(TransportXS, self).create_tallies(scores, filters,
|
||||
keys, estimator)
|
||||
self._create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
return super(TransportXS, self).tallies
|
||||
return self._tallies
|
||||
|
||||
def compute_xs(self):
|
||||
"""Computes the multi-group transport cross sections using OpenMC
|
||||
|
|
@ -1386,7 +1384,7 @@ class AbsorptionXS(MGXS):
|
|||
"""
|
||||
|
||||
# Instantiate tallies if they do not exist
|
||||
if super(AbsorptionXS, self).tallies is None:
|
||||
if self._tallies is None:
|
||||
|
||||
# Create a list of scores for each Tally to be created
|
||||
scores = ['flux', 'absorption']
|
||||
|
|
@ -1399,10 +1397,9 @@ class AbsorptionXS(MGXS):
|
|||
filters = [[energy_filter], [energy_filter]]
|
||||
|
||||
# Initialize the Tallies
|
||||
super(AbsorptionXS, self).create_tallies(scores, filters,
|
||||
keys, estimator)
|
||||
self._create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
return super(AbsorptionXS, self).tallies
|
||||
return self._tallies
|
||||
|
||||
def compute_xs(self):
|
||||
"""Computes the multi-group absorption cross sections using OpenMC
|
||||
|
|
@ -1439,7 +1436,7 @@ class CaptureXS(MGXS):
|
|||
"""
|
||||
|
||||
# Instantiate tallies if they do not exist
|
||||
if super(CaptureXS, self).tallies is None:
|
||||
if self._tallies is None:
|
||||
|
||||
# Create a list of scores for each Tally to be created
|
||||
scores = ['flux', 'absorption', 'fission']
|
||||
|
|
@ -1452,10 +1449,9 @@ class CaptureXS(MGXS):
|
|||
filters = [[energy_filter], [energy_filter], [energy_filter]]
|
||||
|
||||
# Initialize the Tallies
|
||||
super(CaptureXS, self).create_tallies(scores, filters,
|
||||
keys, estimator)
|
||||
self._create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
return super(CaptureXS, self).tallies
|
||||
return self._tallies
|
||||
|
||||
def compute_xs(self):
|
||||
"""Computes the multi-group capture cross sections using OpenMC
|
||||
|
|
@ -1486,7 +1482,7 @@ class FissionXS(MGXS):
|
|||
"""
|
||||
|
||||
# Instantiate tallies if they do not exist
|
||||
if super(FissionXS, self).tallies is None:
|
||||
if self._tallies is None:
|
||||
|
||||
# Create a list of scores for each Tally to be created
|
||||
scores = ['flux', 'fission']
|
||||
|
|
@ -1499,10 +1495,9 @@ class FissionXS(MGXS):
|
|||
filters = [[energy_filter], [energy_filter]]
|
||||
|
||||
# Initialize the Tallies
|
||||
super(FissionXS, self).create_tallies(scores, filters,
|
||||
keys, estimator)
|
||||
self._create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
return super(FissionXS, self).tallies
|
||||
return self._tallies
|
||||
|
||||
def compute_xs(self):
|
||||
"""Computes the multi-group fission cross sections using OpenMC
|
||||
|
|
@ -1532,7 +1527,7 @@ class NuFissionXS(MGXS):
|
|||
"""
|
||||
|
||||
# Instantiate tallies if they do not exist
|
||||
if super(NuFissionXS, self).tallies is None:
|
||||
if self._tallies is None:
|
||||
|
||||
# Create a list of scores for each Tally to be created
|
||||
scores = ['flux', 'nu-fission']
|
||||
|
|
@ -1545,10 +1540,9 @@ class NuFissionXS(MGXS):
|
|||
filters = [[energy_filter], [energy_filter]]
|
||||
|
||||
# Initialize the Tallies
|
||||
super(NuFissionXS, self).create_tallies(scores, filters,
|
||||
keys, estimator)
|
||||
self._create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
return super(NuFissionXS, self).tallies
|
||||
return self._tallies
|
||||
|
||||
def compute_xs(self):
|
||||
"""Computes the multi-group nu-fission cross sections using OpenMC
|
||||
|
|
@ -1578,7 +1572,7 @@ class ScatterXS(MGXS):
|
|||
"""
|
||||
|
||||
# Instantiate tallies if they do not exist
|
||||
if super(ScatterXS, self).tallies is None:
|
||||
if self._tallies is None:
|
||||
|
||||
# Create a list of scores for each Tally to be created
|
||||
scores = ['flux', 'scatter']
|
||||
|
|
@ -1591,10 +1585,9 @@ class ScatterXS(MGXS):
|
|||
filters = [[energy_filter], [energy_filter]]
|
||||
|
||||
# Intialize the Tallies
|
||||
super(ScatterXS, self).create_tallies(scores, filters,
|
||||
keys, estimator)
|
||||
self._create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
return super(ScatterXS, self).tallies
|
||||
return self._tallies
|
||||
|
||||
def compute_xs(self):
|
||||
"""Computes the scattering multi-group cross sections using
|
||||
|
|
@ -1624,7 +1617,7 @@ class NuScatterXS(MGXS):
|
|||
"""
|
||||
|
||||
# Instantiate tallies if they do not exist
|
||||
if super(NuScatterXS, self).tallies is None:
|
||||
if self._tallies is None:
|
||||
|
||||
# Create a list of scores for each Tally to be created
|
||||
scores = ['flux', 'nu-scatter']
|
||||
|
|
@ -1637,10 +1630,9 @@ class NuScatterXS(MGXS):
|
|||
filters = [[energy_filter], [energy_filter]]
|
||||
|
||||
# Initialize the Tallies
|
||||
super(NuScatterXS, self).create_tallies(scores, filters,
|
||||
keys, estimator)
|
||||
self._create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
return super(NuScatterXS, self).tallies
|
||||
return self._tallies
|
||||
|
||||
def compute_xs(self):
|
||||
"""Computes the nu-scattering multi-group cross section using OpenMC
|
||||
|
|
@ -1687,7 +1679,7 @@ class ScatterMatrixXS(MGXS):
|
|||
"""
|
||||
|
||||
# Instantiate tallies if they do not exist
|
||||
if super(ScatterMatrixXS, self).tallies is None:
|
||||
if self._tallies is None:
|
||||
|
||||
group_edges = self.energy_groups.group_edges
|
||||
energy = openmc.Filter('energy', group_edges)
|
||||
|
|
@ -1705,10 +1697,9 @@ class ScatterMatrixXS(MGXS):
|
|||
keys = scores
|
||||
|
||||
# Initialize the Tallies
|
||||
super(ScatterMatrixXS, self).create_tallies(scores, filters,
|
||||
keys, estimator)
|
||||
self._create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
return super(ScatterMatrixXS, self).tallies
|
||||
return self._tallies
|
||||
|
||||
@correction.setter
|
||||
def correction(self, correction):
|
||||
|
|
@ -1998,7 +1989,7 @@ class NuScatterMatrixXS(ScatterMatrixXS):
|
|||
"""
|
||||
|
||||
# Instantiate tallies if they do not exist
|
||||
if super(NuScatterMatrixXS, self).tallies is None:
|
||||
if self._tallies is None:
|
||||
|
||||
# Create the non-domain specific Filters for the Tallies
|
||||
group_edges = self.energy_groups.group_edges
|
||||
|
|
@ -2018,10 +2009,9 @@ class NuScatterMatrixXS(ScatterMatrixXS):
|
|||
filters = [[energy], [energy, energyout]]
|
||||
|
||||
# Intialize the Tallies
|
||||
super(ScatterMatrixXS, self).create_tallies(scores, filters,
|
||||
keys, estimator)
|
||||
self._create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
return super(ScatterMatrixXS, self).tallies
|
||||
return self._tallies
|
||||
|
||||
class Chi(MGXS):
|
||||
"""The fission spectrum."""
|
||||
|
|
@ -2042,7 +2032,7 @@ class Chi(MGXS):
|
|||
"""
|
||||
|
||||
# Instantiate tallies if they do not exist
|
||||
if super(Chi, self).tallies is None:
|
||||
if self._tallies is None:
|
||||
|
||||
# Create a list of scores for each Tally to be created
|
||||
scores = ['nu-fission', 'nu-fission']
|
||||
|
|
@ -2056,9 +2046,9 @@ class Chi(MGXS):
|
|||
filters = [[energyin], [energyout]]
|
||||
|
||||
# Intialize the Tallies
|
||||
super(Chi, self).create_tallies(scores, filters, keys, estimator)
|
||||
self._create_tallies(scores, filters, keys, estimator)
|
||||
|
||||
return super(Chi, self).tallies
|
||||
return self._tallies
|
||||
|
||||
def compute_xs(self):
|
||||
"""Computes chi fission spectrum using OpenMC tally arithmetic."""
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
7e5c0de6e50c494abeea443d74606db809d74ce8bb2571eb4e1c98b3c9a33885b0aef2a4a82b6f95a1725b078d4a5ff01f68e1cc72addbd2d6bd0fb8251ad2e7
|
||||
35f99f1973b3bf3efcec6c2dddf56d6679a15dab8582ab5336e86e4fdf90967ce91036e5c30c345decb994ab9133a906b82dc8fad0cdd3398a612d9aa05c1c77
|
||||
|
|
@ -1 +1 @@
|
|||
7e5c0de6e50c494abeea443d74606db809d74ce8bb2571eb4e1c98b3c9a33885b0aef2a4a82b6f95a1725b078d4a5ff01f68e1cc72addbd2d6bd0fb8251ad2e7
|
||||
35f99f1973b3bf3efcec6c2dddf56d6679a15dab8582ab5336e86e4fdf90967ce91036e5c30c345decb994ab9133a906b82dc8fad0cdd3398a612d9aa05c1c77
|
||||
|
|
@ -1 +1 @@
|
|||
7e5c0de6e50c494abeea443d74606db809d74ce8bb2571eb4e1c98b3c9a33885b0aef2a4a82b6f95a1725b078d4a5ff01f68e1cc72addbd2d6bd0fb8251ad2e7
|
||||
35f99f1973b3bf3efcec6c2dddf56d6679a15dab8582ab5336e86e4fdf90967ce91036e5c30c345decb994ab9133a906b82dc8fad0cdd3398a612d9aa05c1c77
|
||||
|
|
@ -1 +1 @@
|
|||
04dcfca7d68981d7ec19d428c541acd6345ec2d608c581d56ce21d23548f52977fe713b5cdd7434bebf62067444d6562ef322175736a6a63e3985e5e48718081
|
||||
7c1deb8a54fbe1a1ce6ef27cea4a11995210ad3e5ecf32bd83d7c80041edf0793378a7325ffe7ebf9c537e9c278fd4545642fec6c1e46b9c5418118f035d5e95
|
||||
Loading…
Add table
Add a link
Reference in a new issue