Skip to content

Commit af35184

Browse files
grab first enetry in step time for consistent restart behavior with simulation interrupts
1 parent 832acb5 commit af35184

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

openmc/deplete/abc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ def _get_bos_data_from_restart(self, source_rate, bos_conc):
821821
def _get_start_data(self):
822822
if self.operator.prev_res is None:
823823
return 0.0, 0
824-
return (self.operator.prev_res[-1].time[-1],
824+
return (self.operator.prev_res[-1].time[0],
825825
len(self.operator.prev_res) - 1)
826826

827827
def integrate(

tests/unit_tests/test_deplete_continue.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""
55

66
import pytest
7+
import numpy as np
78
import openmc.deplete
89

910
from tests import dummy_operator
@@ -27,7 +28,7 @@ def test_continue(run_in_tmpdir):
2728
continue_timesteps=True).integrate()
2829

2930
final_res = openmc.deplete.Results(operator.output_dir / "depletion_results.h5")
30-
assert final_res.get_times() == [0.0, 1.0, 2.0, 3.0, 4.0]
31+
assert np.array_equal(final_res.get_times(),[0.0, 1.0, 2.0, 3.0, 4.0])
3132

3233

3334
def test_continue_continue(run_in_tmpdir):
@@ -53,9 +54,9 @@ def test_continue_continue(run_in_tmpdir):
5354
continue_timesteps=True).integrate()
5455

5556
final_res = openmc.deplete.Results(operator.output_dir / "depletion_results.h5")
56-
assert final_res.get_times() == [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
57+
assert np.array_equal(final_res.get_times(),[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
5758

58-
def test_killed_and_continue():
59+
def test_killed_and_continue(run_in_tmpdir):
5960
"""
6061
Attempt to continue from a simulation that was killed mid state.
6162
The previous state is provided in the form of a few local files:

0 commit comments

Comments
 (0)