Increase n_realizations every time accumulate_score is called.

This commit is contained in:
Paul Romano 2012-07-31 10:25:29 -04:00
parent 0b19909dec
commit af25e7932e
4 changed files with 17 additions and 24 deletions

View file

@ -121,8 +121,8 @@ module global
integer :: n_current_tallies = 0 ! # of surface current tallies
! Normalization for statistics
integer :: n_realizations ! # of independent realizations
real(8) :: total_weight ! total starting particle weight in realization
integer :: n_realizations = 0 ! # of independent realizations
real(8) :: total_weight ! total starting particle weight in realization
! Flag for turning tallies on
logical :: tallies_on

View file

@ -461,14 +461,6 @@ contains
! batch
if (trim(no_reduce_) == 'on') reduce_tallies = .false.
! Determine number of realizations
if (reduce_tallies) then
n_realizations = n_active
else
n_realizations = n_active * n_procs
end if
end subroutine read_settings_xml
!===============================================================================

View file

@ -360,7 +360,6 @@ contains
subroutine calculate_keff()
integer :: n ! active batch number
real(8) :: temp(2) ! used to reduce sum and sum_sq
message = "Calculate batch keff..."
@ -395,25 +394,19 @@ contains
! need to perform any more reductions and just take the values from
! global_tallies directly
! Define number of realizations
n = current_batch - n_inactive
! Sample mean of keff
keff = global_tallies(K_ANALOG) % sum / n
keff = global_tallies(K_ANALOG) % sum / n_realizations
if (n > 1) then
if (n_realizations > 1) then
! Standard deviation of the sample mean of k
keff_std = sqrt((global_tallies(K_ANALOG) % sum_sq/n - &
keff*keff)/(n - 1))
keff_std = sqrt((global_tallies(K_ANALOG) % sum_sq / &
n_realizations - keff * keff) / (n_realizations - 1))
end if
else
! In this case, no reduce was ever done on global_tallies. Thus, we
! need to reduce the values in sum and sum^2 to get the sample mean
! and its standard deviation
! Define number of realizations
n = (current_batch - n_inactive) * n_procs
#ifdef MPI
if (current_batch /= n_batches) then
call MPI_REDUCE(global_tallies(K_ANALOG) % sum, temp, 2, &
@ -428,11 +421,12 @@ contains
#endif
! Sample mean of k
keff = temp(1) / n
keff = temp(1) / n_realizations
if (n > 1) then
if (n_realizations > 1) then
! Standard deviation of the sample mean of k
keff_std = sqrt((temp(2)/n - keff*keff)/(n - 1))
keff_std = sqrt((temp(2)/n_realizations - keff*keff) / &
(n_realizations - 1))
end if
end if

View file

@ -1622,6 +1622,13 @@ contains
#endif
if (master .or. (.not. reduce_tallies)) then
! Increase number of realizations
if (reduce_tallies) then
n_realizations = n_realizations + 1
else
n_realizations = n_realizations + n_procs
end if
! Accumulate scores for each tally
do i = 1, n_tallies
call accumulate_score(tallies(i) % scores)