Merge pull request #589 from smharper/restart_bug

Restart errors
This commit is contained in:
Paul Romano 2016-02-23 08:18:18 -06:00
commit 12f2467d6e
3 changed files with 1416 additions and 1396 deletions

View file

@ -658,7 +658,10 @@ contains
file_id = file_open(path_state_point, 'r', parallel=.true.)
! Read filetype
call read_dataset(file_id, "filetype", int_array(1))
call read_dataset(file_id, "filetype", word)
if (word /= 'statepoint') then
call fatal_error("OpenMC tried to restart from a non-statepoint file.")
end if
! Read revision number for state point file and make sure it matches with
! current version
@ -744,8 +747,13 @@ contains
&file")
end if
! Read tallies to master
! Read tallies to master. If we are using Parallel HDF5, all processes
! need to be included in the HDF5 calls.
#ifdef PHDF5
if (.true.) then
#else
if (master) then
#endif
! Read number of realizations for global tallies
call read_dataset(file_id, "n_realizations", n_realizations, indep=.true.)
@ -755,7 +763,8 @@ contains
! Check if tally results are present
tallies_group = open_group(file_id, "tallies")
call read_dataset(file_id, "tallies_present", int_array(1), indep=.true.)
call read_dataset(tallies_group, "tallies_present", int_array(1), &
indep=.true.)
! Read in sum and sum squared
if (int_array(1) == 1) then
@ -763,10 +772,12 @@ contains
! Set pointer to tally
tally => tallies(i)
! Read sum and sum_sq for each bin
! Read sum, sum_sq, and N for each bin
tally_group = open_group(tallies_group, "tally " // &
trim(to_str(tally%id)))
call read_dataset(tally_group, "results", tally%results)
trim(to_str(tally % id)))
call read_dataset(tally_group, "results", tally % results)
call read_dataset(tally_group, "n_realizations", &
tally % n_realizations)
call close_group(tally_group)
end do TALLY_RESULTS
end if

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,11 @@ from openmc.executor import Executor
class StatepointRestartTestHarness(TestHarness):
def __init__(self, final_sp, restart_sp, tallies_present=False):
super(StatepointRestartTestHarness, self).__init__(final_sp,
tallies_present)
self._restart_sp = restart_sp
def execute_test(self):
"""Run OpenMC with the appropriate arguments and check the outputs."""
try:
@ -40,7 +45,9 @@ class StatepointRestartTestHarness(TestHarness):
def _run_openmc_restart(self):
# Get the name of the statepoint file.
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))
statepoint = glob.glob(os.path.join(os.getcwd(), self._restart_sp))
assert len(statepoint) == 1
statepoint = statepoint[0]
# Run OpenMC
executor = Executor()
@ -52,11 +59,13 @@ class StatepointRestartTestHarness(TestHarness):
mpi_exec=self._opts.mpi_exec)
else:
returncode = executor.run_simulation(openmc_exec=self._opts.exe)
returncode = executor.run_simulation(openmc_exec=self._opts.exe,
restart_file=statepoint)
assert returncode == 0, 'OpenMC did not exit successfully.'
if __name__ == '__main__':
harness = StatepointRestartTestHarness('statepoint.07.*', True)
harness = StatepointRestartTestHarness('statepoint.10.h5',
'statepoint.07.h5', True)
harness.main()