diff --git a/openmc/deplete/abc.py b/openmc/deplete/abc.py index fd5278d89..56914367e 100644 --- a/openmc/deplete/abc.py +++ b/openmc/deplete/abc.py @@ -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 diff --git a/openmc/deplete/helpers.py b/openmc/deplete/helpers.py index 8dc9035b3..3303dd4e4 100644 --- a/openmc/deplete/helpers.py +++ b/openmc/deplete/helpers.py @@ -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) diff --git a/tests/unit_tests/test_deplete_fission_yields.py b/tests/unit_tests/test_deplete_fission_yields.py index 0a87c4fb6..6285fe5b9 100644 --- a/tests/unit_tests/test_deplete_fission_yields.py +++ b/tests/unit_tests/test_deplete_fission_yields.py @@ -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])