mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Fix capi restart unit test
This commit is contained in:
parent
b5dca6baff
commit
4b62006d23
1 changed files with 10 additions and 6 deletions
|
|
@ -313,10 +313,14 @@ def test_mesh(capi_init):
|
|||
assert msf.mesh == mesh
|
||||
|
||||
|
||||
def test_restart(pincell_model):
|
||||
# Run for 7 batches then write a statepoint.
|
||||
def test_restart(capi_init):
|
||||
# Finalize and re-init to make internal state consistent with XML.
|
||||
openmc.capi.hard_reset()
|
||||
openmc.capi.finalize()
|
||||
openmc.capi.init()
|
||||
openmc.capi.simulation_init()
|
||||
|
||||
# Run for 7 batches then write a statepoint.
|
||||
for i in range(7):
|
||||
openmc.capi.next_batch()
|
||||
openmc.capi.statepoint_write('restart_test.h5', True)
|
||||
|
|
@ -325,17 +329,17 @@ def test_restart(pincell_model):
|
|||
for i in range(3):
|
||||
openmc.capi.next_batch()
|
||||
keff0 = openmc.capi.keff()
|
||||
openmc.capi.simulation_finalize()
|
||||
openmc.capi.finalize()
|
||||
|
||||
# Restart the simulation and run all 10 batches.
|
||||
# Restart the simulation from the statepoint and run all 10 batches.
|
||||
openmc.capi.simulation_finalize()
|
||||
openmc.capi.hard_reset()
|
||||
openmc.capi.finalize()
|
||||
openmc.capi.init(args=('-r', 'restart_test.h5'))
|
||||
openmc.capi.simulation_init()
|
||||
for i in range(10):
|
||||
openmc.capi.next_batch()
|
||||
keff1 = openmc.capi.keff()
|
||||
openmc.capi.simulation_finalize()
|
||||
openmc.capi.finalize()
|
||||
|
||||
# Compare the keff values.
|
||||
assert keff0 == pytest.approx(keff1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue