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.
This commit is contained in:
Andrew Johnson 2019-09-20 10:49:32 -05:00
parent 4b688e5efa
commit 72212f60a2
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB
3 changed files with 10 additions and 0 deletions

View file

@ -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)]

View file

@ -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

View file

@ -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)