Skip to content

Commit

Permalink
Merge pull request #26 from openmsr/search_for_keff_refactor
Browse files Browse the repository at this point in the history
refactoring of search_for_keff check condition
  • Loading branch information
church89 authored Jan 15, 2024
2 parents b45f669 + 3603e98 commit 85707a4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions openmc/deplete/batchwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,14 @@ def _search_for_keff(self, val):
print("Search_for_keff returned values below or above "
"target. Trying to iteratively adapt bracket...")

# if the retured keffs range ends up being smaller than the
# max keff std deviation, set closest value and continue
if all(abs(keff-self.target) <= max(keffs).s for keff in keffs):
# if the difference between keffs is smaller than 1 pcm,
# the grad calculation will be overshot, so let's set the root
# to the closest guess value
if abs(np.diff(keffs))*1e5 < 1:
arg_min = abs(self.target - np.array(keffs)).argmin()
print("Search_for_keff returned keffs range smaller than"
"max std dev. Set root to guess with "
print("Difference between keff values is "
"smaller than 1 pcm. "
"Set root to guess value with "
"closest keff to target and continue...")
root = guesses[arg_min]

Expand Down

0 comments on commit 85707a4

Please sign in to comment.