mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Make n_bmat required only for FissionYieldCutoffHelper
Base class TalliedFissionYieldHelper and AveragedFissionYieldHelper instances do not need to know the number of burnable materials, and thus it is no longer a required input argument. Changes propagated into the from_operator methods and tests/unit_tests/test_deplete_fission_yields.py Removed explicit TalliedFissionYieldHelper.from_operator method as it is identical and now inherited from the base FissionYieldHelper.from_operator method
This commit is contained in:
parent
aa86aa5262
commit
d8b5752b59
3 changed files with 8 additions and 34 deletions
|
|
@ -497,13 +497,9 @@ class TalliedFissionYieldHelper(FissionYieldHelper):
|
|||
chain_nuclides : iterable of openmc.deplete.Nuclide
|
||||
Nuclides tracked in the depletion chain. Not necessary
|
||||
that all have yield data.
|
||||
n_bmats : int
|
||||
Number of burnable materials tracked in the problem.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
n_bmats : int
|
||||
Number of burnable materials tracked in the problem.
|
||||
constant_yields : dict of str to :class:`openmc.deplete.FissionYield`
|
||||
Fission yields for all nuclides that only have one set of
|
||||
fission yield data. Can be accessed as ``{parent: {product: yield}}``
|
||||
|
|
@ -513,9 +509,8 @@ class TalliedFissionYieldHelper(FissionYieldHelper):
|
|||
|
||||
_upper_energy = 20.0e6 # upper energy for tallies
|
||||
|
||||
def __init__(self, chain_nuclides, n_bmats):
|
||||
def __init__(self, chain_nuclides):
|
||||
super().__init__(chain_nuclides)
|
||||
self.n_bmats = n_bmats
|
||||
self._local_indexes = None
|
||||
self._fission_rate_tally = None
|
||||
self._tally_nucs = []
|
||||
|
|
@ -578,24 +573,6 @@ class TalliedFissionYieldHelper(FissionYieldHelper):
|
|||
tally data.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def from_operator(cls, operator, **kwargs):
|
||||
"""Create a new instance by pulling data from the operator
|
||||
|
||||
Require the more concrete :class:`openmc.deplete.Operator`
|
||||
because this needs knowledge of burnable materials
|
||||
|
||||
Parameters
|
||||
----------
|
||||
operator : openmc.deplete.TransportOperator
|
||||
Operator with a depletion chain
|
||||
kwargs: optional
|
||||
Optional keyword arguments to be passed to the underlying
|
||||
``__init__`` method
|
||||
"""
|
||||
return cls(operator.chain.nuclides, len(operator.burnable_mats),
|
||||
**kwargs)
|
||||
|
||||
|
||||
class Integrator(ABC):
|
||||
"""Abstract class for solving the time-integration for depletion
|
||||
|
|
|
|||
|
|
@ -299,7 +299,8 @@ class FissionYieldCutoffHelper(TalliedFissionYieldHelper):
|
|||
check_greater_than("thermal_energy", thermal_energy, 0.0, equality=True)
|
||||
check_greater_than("cutoff", cutoff, thermal_energy, equality=False)
|
||||
check_greater_than("fast_energy", fast_energy, cutoff, equality=False)
|
||||
super().__init__(chain_nuclides, n_bmats)
|
||||
self.n_bmats = n_bmats
|
||||
super().__init__(chain_nuclides)
|
||||
self._cutoff = cutoff
|
||||
self._thermal_yields = {}
|
||||
self._fast_yields = {}
|
||||
|
|
@ -477,13 +478,9 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
|
|||
chain_nuclides : iterable of openmc.deplete.Nuclide
|
||||
Nuclides tracked in the depletion chain. Not necessary
|
||||
that all have yield data.
|
||||
n_bmats : int
|
||||
Number of burnable materials tracked in the problem.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
n_bmats : int
|
||||
Number of burnable materials tracked in the problem.
|
||||
constant_yields : dict of str to :class:`openmc.deplete.FissionYield`
|
||||
Fission yields for all nuclides that only have one set of
|
||||
fission yield data. Can be accessed as ``{parent: {product: yield}}``
|
||||
|
|
@ -494,8 +491,8 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
|
|||
is the number of nuclides with multiple sets of fission yields.
|
||||
"""
|
||||
|
||||
def __init__(self, chain_nuclides, n_bmats):
|
||||
super().__init__(chain_nuclides, n_bmats)
|
||||
def __init__(self, chain_nuclides):
|
||||
super().__init__(chain_nuclides)
|
||||
self._weighted_tally = None
|
||||
|
||||
def generate_tallies(self, materials, mat_indexes):
|
||||
|
|
@ -588,11 +585,11 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
operator : openmc.deplete.Operator
|
||||
operator : openmc.deplete.TransportOperator
|
||||
Operator with a depletion chain
|
||||
|
||||
Returns
|
||||
-------
|
||||
AveragedFissionYieldHelper
|
||||
"""
|
||||
return cls(operator.chain.nuclides, len(operator.burnable_mats))
|
||||
return cls(operator.chain.nuclides)
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class AverageProxy(ProxyMixin, AveragedFissionYieldHelper):
|
|||
|
||||
@pytest.mark.parametrize("avg_energy", (0.01, 100, 15e6))
|
||||
def test_averaged_helper(nuclide_bundle, avg_energy):
|
||||
proxy = AverageProxy(nuclide_bundle, len(MATERIALS))
|
||||
proxy = AverageProxy(nuclide_bundle)
|
||||
proxy.generate_tallies(MATERIALS, [0])
|
||||
tallied_nucs = proxy.update_nuclides_from_operator(
|
||||
[n.name for n in nuclide_bundle])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue