Skip to content

Commit

Permalink
Rename cache variable
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmay1 committed Sep 10, 2022
1 parent b8ffbe0 commit 9ec20b5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions openmc/deplete/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ class DirectReactionRateHelper(ReactionRateHelper):
def __init__(self, n_nuc, n_react):
super().__init__(n_nuc, n_react)
self._rate_tally = None
self._rate_tally_means = None

# Automatically pre-calculate reaction rates for depletion
openmc.lib.settings.need_depletion_rx = True
Expand Down Expand Up @@ -176,18 +175,20 @@ def generate_tallies(self, materials, scores):
self._rate_tally.writable = False
self._rate_tally.scores = scores
self._rate_tally.filters = [MaterialFilter(materials)]
self._rate_tally_means_cache = None

@property
def rate_tally_means(self):
# If the mean cache is empty, fill it once with this transport cycle's results
if self._rate_tally_means is None:
self._rate_tally_means = self._rate_tally.mean
return self._rate_tally_means
if self._rate_tally_means_cache is None:
self._rate_tally_means_cache = self._rate_tally.mean
return self._rate_tally_means_cache

def reset_tally_means(self):
"""Reset the cached mean rate tallies. This step must be performed after each transport cycle
"""Reset the cached mean rate tallies.
This step must be performed after each transport cycle
"""
self._rate_tally_means = None
self._rate_tally_means_cache = None

def get_material_rates(self, mat_id, nuc_index, react_index):
"""Return an array of reaction rates for a material
Expand Down Expand Up @@ -318,7 +319,8 @@ def flux_tally_means(self):
return self._flux_tally_means_cache

def reset_tally_means(self):
"""Reset the cached mean rate and flux tallies. This step must be performed after each transport cycle
"""Reset the cached mean rate and flux tallies.
This step must be performed after each transport cycle
"""
self._flux_tally_means_cache = None
if self._reactions_direct:
Expand Down

0 comments on commit 9ec20b5

Please sign in to comment.