From 5d983d4be8e2c9b4e38290dc38bf419356dbe310 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Sat, 18 Aug 2012 16:26:11 -0400 Subject: [PATCH] Move timer starting to initialize_batch. Fixes infinity calculation rate for restart runs. --- src/criticality.F90 | 21 ++++++++++++--------- src/output.F90 | 10 ++++++++-- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/criticality.F90 b/src/criticality.F90 index ce14b1210a..928e1b87c4 100644 --- a/src/criticality.F90 +++ b/src/criticality.F90 @@ -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 !=============================================================================== diff --git a/src/output.F90 b/src/output.F90 index 7ff8b526b8..063787bf12 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -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)