mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
addressed some of the PR comments
This commit is contained in:
parent
1a7630083b
commit
63fd6e2e1a
5 changed files with 65 additions and 48 deletions
|
|
@ -659,23 +659,17 @@ class Material(object):
|
|||
density_in_atom = density > 0.
|
||||
sum_percent = 0.
|
||||
|
||||
awrs = []
|
||||
for nuclide in nuclides.items():
|
||||
awr = openmc.data.atomic_mass(nuclide[0])
|
||||
if awr is not None:
|
||||
awrs.append(awr)
|
||||
else:
|
||||
raise ValueError(nuclide[0] + " is invalid")
|
||||
|
||||
# Convert the weight amounts to atomic amounts
|
||||
if not percent_in_atom:
|
||||
for n, nuc in enumerate(nucs):
|
||||
nuc_densities[n] *= self.average_molar_mass / awrs[n]
|
||||
nuc_densities[n] *= self.average_molar_mass / \
|
||||
openmc.data.atomic_mass(nuc)
|
||||
|
||||
# Now that we have the awr, lets finish calculating densities
|
||||
# Now that we have the atomic amounts, lets finish calculating densities
|
||||
sum_percent = np.sum(nuc_densities)
|
||||
nuc_densities = nuc_densities / sum_percent
|
||||
|
||||
# Convert the mass density to an atom density
|
||||
if not density_in_atom:
|
||||
density = -density / self.average_molar_mass * 1.E-24 \
|
||||
* openmc.data.AVOGADRO
|
||||
|
|
|
|||
|
|
@ -529,9 +529,8 @@ class Library(object):
|
|||
if self.num_delayed_groups == 0:
|
||||
mgxs.delayed_groups = None
|
||||
else:
|
||||
delayed_groups \
|
||||
= list(range(1,self.num_delayed_groups+1))
|
||||
mgxs.delayed_groups = delayed_groups
|
||||
mgxs.delayed_groups \
|
||||
= list(range(1, self.num_delayed_groups+1))
|
||||
|
||||
for tally in mgxs.tallies.values():
|
||||
tallies_file.append(tally, merge=merge)
|
||||
|
|
|
|||
|
|
@ -923,7 +923,7 @@ class ChiDelayed(MDGXS):
|
|||
tally_keys : list of str
|
||||
The keys into the tallies dictionary for each tally used to compute
|
||||
the multi-group cross section
|
||||
estimator : {'tracklength', 'analog'}
|
||||
estimator : 'analog'
|
||||
The tally estimator used to compute the multi-group cross section
|
||||
tallies : collections.OrderedDict
|
||||
OpenMC tallies needed to compute the multi-group cross section. The keys
|
||||
|
|
@ -1016,7 +1016,12 @@ class ChiDelayed(MDGXS):
|
|||
return self._xs_tally
|
||||
|
||||
def get_homogenized_mgxs(self, other_mgxs):
|
||||
"""Construct a homogenized mgxs with other mgxs objects.
|
||||
"""Construct a homogenized MGXS with other mgxs objects.
|
||||
|
||||
This method constructs a new MGXS object that is the flux-weighted
|
||||
combination of two MGXS objects. It is equivalent to what one would
|
||||
obtain if the tally spatial domain were designed to encompass the
|
||||
individual domains for both MGXS objects.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -1031,7 +1036,7 @@ class ChiDelayed(MDGXS):
|
|||
Raises
|
||||
------
|
||||
ValueError
|
||||
If the other_mgxs are of a different type.
|
||||
If the other_mgxs is of a different type.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1607,7 +1612,12 @@ class Beta(MDGXS):
|
|||
return self._xs_tally
|
||||
|
||||
def get_homogenized_mgxs(self, other_mgxs):
|
||||
"""Construct a homogenized mgxs with other mgxs objects.
|
||||
"""Construct a homogenized MGXS with other mgxs objects.
|
||||
|
||||
This method constructs a new MGXS object that is the flux-weighted
|
||||
combination of two MGXS objects. It is equivalent to what one would
|
||||
obtain if the tally spatial domain were designed to encompass the
|
||||
individual domains for both MGXS objects.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -1622,7 +1632,7 @@ class Beta(MDGXS):
|
|||
Raises
|
||||
------
|
||||
ValueError
|
||||
If the other_mgxs are of a different type.
|
||||
If the other_mgxs is of a different type.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1780,7 +1790,12 @@ class DecayRate(MDGXS):
|
|||
return self._xs_tally
|
||||
|
||||
def get_homogenized_mgxs(self, other_mgxs):
|
||||
"""Construct a homogenized mgxs with other mgxs objects.
|
||||
"""Construct a homogenized MGXS with other mgxs objects.
|
||||
|
||||
This method constructs a new MGXS object that is the flux-weighted
|
||||
combination of two MGXS objects. It is equivalent to what one would
|
||||
obtain if the tally spatial domain were designed to encompass the
|
||||
individual domains for both MGXS objects.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -1795,7 +1810,7 @@ class DecayRate(MDGXS):
|
|||
Raises
|
||||
------
|
||||
ValueError
|
||||
If the other_mgxs are of a different type.
|
||||
If the other_mgxs is of a different type.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -2358,7 +2373,7 @@ class DelayedNuFissionMatrixXS(MatrixMDGXS):
|
|||
tally_keys : list of str
|
||||
The keys into the tallies dictionary for each tally used to compute
|
||||
the multi-group cross section
|
||||
estimator : {'tracklength', 'analog'}
|
||||
estimator : 'analog'
|
||||
The tally estimator used to compute the multi-group cross section
|
||||
tallies : collections.OrderedDict
|
||||
OpenMC tallies needed to compute the multi-group cross section. The keys
|
||||
|
|
|
|||
|
|
@ -997,7 +997,15 @@ class MGXS(object):
|
|||
return avg_xs
|
||||
|
||||
def _get_homogenized_mgxs(self, other_mgxs, denom_score='flux'):
|
||||
"""Construct a homogenized mgxs with other mgxs objects.
|
||||
"""Construct a homogenized MGXS with other mgxs objects.
|
||||
|
||||
This method constructs a new MGXS object that is the flux-weighted
|
||||
combination of two MGXS objects. It is equivalent to what one would
|
||||
obtain if the tally spatial domain were designed to encompass the
|
||||
individual domains for both MGXS objects. This is accomplished by
|
||||
summing the rxn rate (numerator) tally and the denominator tally
|
||||
(often a tally of the flux over the spatial domain) that are used to
|
||||
compute a multi-group cross-section.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -1014,14 +1022,15 @@ class MGXS(object):
|
|||
Raises
|
||||
------
|
||||
ValueError
|
||||
If the other_mgxs are of a different type.
|
||||
If the other_mgxs is of a different type.
|
||||
|
||||
"""
|
||||
|
||||
# Check type of denom score
|
||||
cv.check_type('denom_score', denom_score, str)
|
||||
|
||||
# Construct a collection of the subdomain filter bins to average across
|
||||
# Construct a collection of the subdomain filter bins to homogenize
|
||||
# across
|
||||
if isinstance(other_mgxs, openmc.mgxs.MGXS):
|
||||
other_mgxs = [other_mgxs]
|
||||
|
||||
|
|
@ -1034,7 +1043,7 @@ class MGXS(object):
|
|||
# Clone this MGXS to initialize the homogenized version
|
||||
homogenized_mgxs = copy.deepcopy(self)
|
||||
homogenized_mgxs._derived = True
|
||||
name = '{} + '.format(self.domain.name)
|
||||
name = 'hom({}, '.format(self.domain.name)
|
||||
|
||||
# Get the domain filter
|
||||
filter_type = _DOMAIN_TO_FILTER[self.domain_type]
|
||||
|
|
@ -1061,12 +1070,12 @@ class MGXS(object):
|
|||
denom_tally += other_denom_tally
|
||||
|
||||
# Update the name for the homogenzied MGXS
|
||||
name += '{} + '.format(mgxs.domain.name)
|
||||
name += '{}, '.format(mgxs.domain.name)
|
||||
|
||||
# Set the properties of the homogenized MGXS
|
||||
homogenized_mgxs._rxn_rate_tally = rxn_rate_tally
|
||||
homogenized_mgxs.tallies[denom_score] = denom_tally
|
||||
homogenized_mgxs._domain.name = name[:-3]
|
||||
homogenized_mgxs._domain.name = name[:-2] + ')'
|
||||
|
||||
return homogenized_mgxs
|
||||
|
||||
|
|
@ -1086,7 +1095,7 @@ class MGXS(object):
|
|||
Raises
|
||||
------
|
||||
ValueError
|
||||
If the other_mgxs are of a different type.
|
||||
If the other_mgxs is of a different type.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -3278,7 +3287,7 @@ class NuScatterXS(MGXS):
|
|||
tally_keys : list of str
|
||||
The keys into the tallies dictionary for each tally used to compute
|
||||
the multi-group cross section
|
||||
estimator : {'tracklength', 'collision', 'analog'}
|
||||
estimator : 'analog'
|
||||
The tally estimator used to compute the multi-group cross section
|
||||
tallies : collections.OrderedDict
|
||||
OpenMC tallies needed to compute the multi-group cross section. The keys
|
||||
|
|
@ -4673,7 +4682,7 @@ class Chi(MGXS):
|
|||
Raises
|
||||
------
|
||||
ValueError
|
||||
If the other_mgxs are of a different type.
|
||||
If the other_mgxs is of a different type.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -5456,7 +5465,7 @@ class PromptNuFissionMatrixXS(MatrixMGXS):
|
|||
tally_keys : list of str
|
||||
The keys into the tallies dictionary for each tally used to compute
|
||||
the multi-group cross section
|
||||
estimator : {'tracklength', 'collision', 'analog'}
|
||||
estimator : 'analog'
|
||||
The tally estimator used to compute the multi-group cross section
|
||||
tallies : collections.OrderedDict
|
||||
OpenMC tallies needed to compute the multi-group cross section. The keys
|
||||
|
|
|
|||
|
|
@ -925,7 +925,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -970,7 +970,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1017,7 +1017,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1064,7 +1064,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1119,7 +1119,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1174,7 +1174,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1231,7 +1231,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1277,7 +1277,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1320,7 +1320,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1366,7 +1366,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1414,7 +1414,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1459,7 +1459,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1509,7 +1509,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1598,7 +1598,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -1648,12 +1648,12 @@ class XSdata(object):
|
|||
nuclide='total', xs_type='macro',
|
||||
subdomain=None):
|
||||
"""This method allows for an openmc.mgxs.InverseVelocity
|
||||
to be used to set the absorption cross section for this XSdata object.
|
||||
to be used to set the inverse velocity for this XSdata object.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
inverse_velocity : openmc.mgxs.InverseVelocity
|
||||
MGXS Object containing the inverse velocity for the domain of
|
||||
MGXS object containing the inverse velocity for the domain of
|
||||
interest.
|
||||
temperature : float
|
||||
Temperature (in Kelvin) of the data. Defaults to room temperature
|
||||
|
|
@ -1671,7 +1671,7 @@ class XSdata(object):
|
|||
See also
|
||||
--------
|
||||
openmc.mgxs.Library.create_mg_library()
|
||||
openmc.mgxs.Library.get_xsdata
|
||||
openmc.mgxs.Library.get_xsdata()
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue