diff --git a/openmc/deplete/coupled_operator.py b/openmc/deplete/coupled_operator.py index a2747802ca1..d591e956f5f 100644 --- a/openmc/deplete/coupled_operator.py +++ b/openmc/deplete/coupled_operator.py @@ -265,6 +265,9 @@ def __init__(self, model, chain_file=None, prev_results=None, 'fission_yield_opts': fission_yield_opts } + # Records how many times the operator has been called + self._n_calls = 0 + super().__init__( materials=model.materials, cross_sections=cross_sections, @@ -428,7 +431,16 @@ def __call__(self, vec, source_rate): """ # Reset results in OpenMC openmc.lib.reset() - openmc.lib.reset_timers() + + # The timers are reset only if the operator has been called before. + # This is because we call this method after loading cross sections, and + # no transport has taken place yet. As a result, we only reset the + # timers after the first step so as to correctly report the time spent + # reading cross sections in the first depletion step, and from there + # correctly report all particle tracking rates in multistep depletion + # solvers. + if self._n_calls > 0: + openmc.lib.reset_timers() self._update_materials_and_nuclides(vec) @@ -450,6 +462,8 @@ def __call__(self, vec, source_rate): op_result = OperatorResult(keff, rates) + self._n_calls += 1 + return copy.deepcopy(op_result) def _update_materials(self):