Skip to content

Commit

Permalink
Update keff variable and std. dev. variable on reset. Update tests to…
Browse files Browse the repository at this point in the history
… confirm this
  • Loading branch information
pshriwise committed Apr 30, 2024
1 parent 5d2b352 commit 47f0b9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/finalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ int openmc_reset()
simulation::k_col_abs = 0.0;
simulation::k_col_tra = 0.0;
simulation::k_abs_tra = 0.0;
simulation::keff = 1.0;
simulation::keff_std = std::numeric_limits<double>::infinity();
simulation::k_sum = {0.0, 0.0};
simulation::satisfy_triggers = false;

Expand Down
4 changes: 4 additions & 0 deletions tests/unit_tests/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def pincell_model():
filter4 = openmc.CellFilter(list(cells.values()))
zernike_tally.filters = [filter3, filter4]
zernike_tally.scores = ['fission']
zernike_tally.estimator = 'collision'
pincell.tallies.append(zernike_tally)

# Add an energy function tally
Expand Down Expand Up @@ -501,6 +502,9 @@ def test_reset(lib_run):

# Reset and run 3 more batches. Check the number of realizations.
openmc.lib.reset()
assert all(openmc.lib.tallies[2].std_dev == np.inf)
assert openmc.lib.keff() == (1.0, np.inf)

for i in range(3):
openmc.lib.next_batch()
assert openmc.lib.num_realizations() == 3
Expand Down

0 comments on commit 47f0b9e

Please sign in to comment.