From 72212f60a2ea64cbd37059ed7c45b5ca2c7f3cee Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Sep 2019 10:49:32 -0500 Subject: [PATCH] Use internal tallies to compute quantities for depletion Tallies created by internal depletion helpers are marked as internal using the openmc.lib.Tally.writeable property. This is done to resolve issue #1327 where statepoint files could grow to be quite large after tallying reaction rates across many burnable materials for all nuclides of interest. A check is added in the depletion regression test to ensure that no additional tallies are loaded to the StatePoint. --- openmc/deplete/abc.py | 1 + openmc/deplete/helpers.py | 3 +++ tests/regression_tests/deplete/test.py | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/openmc/deplete/abc.py b/openmc/deplete/abc.py index e0ed64645..3a7eee34d 100644 --- a/openmc/deplete/abc.py +++ b/openmc/deplete/abc.py @@ -539,6 +539,7 @@ class TalliedFissionYieldHelper(FissionYieldHelper): # Tally group-wise fission reaction rates self._fission_rate_tally = Tally() + self._fission_rate_tally.writeable = False self._fission_rate_tally.scores = ['fission'] self._fission_rate_tally.filters = [MaterialFilter(materials)] diff --git a/openmc/deplete/helpers.py b/openmc/deplete/helpers.py index 9e3e379d5..b1e7e17ef 100644 --- a/openmc/deplete/helpers.py +++ b/openmc/deplete/helpers.py @@ -59,6 +59,7 @@ class DirectReactionRateHelper(ReactionRateHelper): ``"(n, gamma)"``, needed for the reaction rate tally. """ self._rate_tally = Tally() + self._rate_tally.writeable = False self._rate_tally.scores = scores self._rate_tally.filters = [MaterialFilter(materials)] @@ -194,6 +195,7 @@ class EnergyScoreHelper(EnergyHelper): """ self._tally = Tally() + self._tally.writeable = False self._tally.scores = [self.score] def reset(self): @@ -570,6 +572,7 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper): func_filter = EnergyFunctionFilter() func_filter.set_data((0, self._upper_energy), (0, self._upper_energy)) weighted_tally = Tally() + weighted_tally.writeable = False weighted_tally.scores = ['fission'] weighted_tally.filters = filters + [func_filter] self._weighted_tally = weighted_tally diff --git a/tests/regression_tests/deplete/test.py b/tests/regression_tests/deplete/test.py index c7a9c162e..01ce21c01 100644 --- a/tests/regression_tests/deplete/test.py +++ b/tests/regression_tests/deplete/test.py @@ -108,11 +108,17 @@ def test_full(run_in_tmpdir): t_ref, k_ref = res_ref.get_eigenvalue() k_state = np.empty_like(k_ref) + n_tallies = np.empty(N + 1, dtype=int) + # Get statepoint files for all BOS points and EOL for n in range(N + 1): statepoint = openmc.StatePoint("openmc_simulation_n{}.h5".format(n)) k_n = statepoint.k_combined k_state[n] = [k_n.nominal_value, k_n.std_dev] + n_tallies[n] = len(statepoint.tallies) # Look for exact match pulling from statepoint and depletion_results assert np.all(k_state == k_test) assert np.allclose(k_test, k_ref) + + # Check that no additional tallies are loaded from the files + assert np.all(n_tallies == 0)