Clean up internals for AveragedFissionYieldHelper

Respond to some other reviewer comments for #1313
This commit is contained in:
Andrew Johnson 2019-08-30 09:36:28 -05:00
parent 6c5dfd69c2
commit 399b77e38f
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB
4 changed files with 9 additions and 10 deletions

View file

@ -731,6 +731,7 @@ class Chain(object):
yields = [yields]
check_type("fission_yields", yields, Iterable, Mapping)
self._fission_yields = yields
def validate(self, strict=True, quiet=False, tolerance=1e-4):
"""Search for possible inconsistencies

View file

@ -425,11 +425,9 @@ class FissionYieldCutoffHelper(TalliedFissionYieldHelper):
return yields
rates = self.results[local_mat_index]
# iterate over thermal then fast yields, prefer __mul__ to __rmul__
for therm_frac, nuc in zip(rates[0], self._tally_nucs):
yields[nuc.name] = self._thermal_yields[nuc.name] * therm_frac
for fast_frac, nuc in zip(rates[1], self._tally_nucs):
yields[nuc.name] += self._fast_yields[nuc.name] * fast_frac
for therm_frac, fast_frac, nuc in zip(rates[0], rates[1], self._tally_nucs):
yields[nuc.name] = (self._thermal_yields[nuc.name] * therm_frac
+ self._fast_yields[nuc.name] * fast_frac)
return yields
@property
@ -444,9 +442,7 @@ class FissionYieldCutoffHelper(TalliedFissionYieldHelper):
class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
r"""Class that computes fission yields based on average fission energy
Computes average energy at which fission events occured
reactions for all nuclides with multiple sets of fission yields
by
Computes average energy at which fission events occured with
.. math::
@ -481,6 +477,8 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
have shape ``(n_mats, n_tnucs)``, where ``n_mats`` is the number
of materials where fission reactions were tallied and ``n_tnucs``
is the number of nuclides with multiple sets of fission yields.
Data in the array are the average energy of fission events for
tallied nuclides across burnable materials.
"""
def __init__(self, chain_nuclides):

View file

@ -86,7 +86,7 @@ class Operator(TransportOperator):
in initial condition to ensure they exist in the decay chain.
Only done for nuclides with reaction rates.
Defaults to 1.0e3.
fission_yield_mode : ("constant", "cutoff", "average")
fission_yield_mode : {"constant", "cutoff", "average"}
Key indicating what fission product yield scheme to use. The
key determines what fission energy helper is used:

View file

@ -205,7 +205,7 @@ def test_cutoff_helper(materials, nuclide_bundle, therm_frac):
non_zero_nucs = [n.name for n in nuclide_bundle]
tally_nucs = helper.update_tally_nuclides(non_zero_nucs)
assert tally_nucs == ["Pu239", "U235",]
assert tally_nucs == ["Pu239", "U235"]
# Check tallies
fission_tally = helper._fission_rate_tally