mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Move timer starting to initialize_batch. Fixes infinity calculation rate for restart runs.
This commit is contained in:
parent
dc4a8ff54e
commit
5d983d4be8
2 changed files with 20 additions and 11 deletions
|
|
@ -25,13 +25,6 @@ contains
|
|||
|
||||
if (master) call header("CRITICALITY TRANSPORT SIMULATION", level=1)
|
||||
|
||||
! Start timer
|
||||
if (tallies_on) then
|
||||
call timer_start(time_active)
|
||||
else
|
||||
call timer_start(time_inactive)
|
||||
end if
|
||||
|
||||
! Allocate particle
|
||||
allocate(p)
|
||||
|
||||
|
|
@ -42,14 +35,14 @@ contains
|
|||
! LOOP OVER BATCHES
|
||||
BATCH_LOOP: do current_batch = 1, n_batches
|
||||
|
||||
call initialize_batch()
|
||||
|
||||
! Handle restart runs
|
||||
if (restart_run .and. current_batch <= restart_batch) then
|
||||
call replay_batch_history()
|
||||
cycle BATCH_LOOP
|
||||
end if
|
||||
|
||||
call initialize_batch()
|
||||
|
||||
! =======================================================================
|
||||
! LOOP OVER GENERATIONS
|
||||
GENERATION_LOOP: do current_gen = 1, gen_per_batch
|
||||
|
|
@ -106,6 +99,16 @@ contains
|
|||
! Reset total starting particle weight used for normalizing tallies
|
||||
total_weight = ZERO
|
||||
|
||||
if (current_batch == n_inactive + 1) then
|
||||
! This will start the active timer at the first non-inactive batch
|
||||
! (including batch 1 if there are no inactive batches).
|
||||
call timer_start(time_active)
|
||||
elseif (current_batch == 1) then
|
||||
! If there are inactive batches, start the inactive timer on the first
|
||||
! batch.
|
||||
call timer_start(time_inactive)
|
||||
end if
|
||||
|
||||
end subroutine initialize_batch
|
||||
|
||||
!===============================================================================
|
||||
|
|
|
|||
|
|
@ -1215,8 +1215,14 @@ contains
|
|||
write(ou,100) "Total time for finalization", time_finalize % elapsed
|
||||
write(ou,100) "Total time elapsed", time_total % elapsed
|
||||
|
||||
! display calculate rate and final keff
|
||||
total_particles = n_particles * n_batches * gen_per_batch
|
||||
if (restart_run) then
|
||||
total_particles = n_particles * (n_batches - &
|
||||
restart_batch) * gen_per_batch
|
||||
else
|
||||
total_particles = n_particles * n_batches * gen_per_batch
|
||||
end if
|
||||
|
||||
! display calculate rate
|
||||
speed = real(total_particles) / (time_inactive % elapsed + &
|
||||
time_active % elapsed)
|
||||
string = to_str(speed)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue