Make sure Tally % n_realizations is available on all ranks

This commit is contained in:
Paul Romano 2018-11-09 07:56:14 -06:00
parent 5d4c39cc7d
commit 0bf2d0c4a9
2 changed files with 24 additions and 22 deletions

View file

@ -3792,11 +3792,6 @@ contains
! Accumulate on master only unless run is not reduced then do it on all
if (master .or. (.not. reduce_tallies)) then
! Accumulate results for each tally
do i = 1, active_tallies % size()
call tallies(active_tallies % data(i)) % obj % accumulate()
end do
if (run_mode == MODE_EIGENVALUE) then
if (current_batch > n_inactive) then
! Accumulate products of different estimators of k
@ -3820,6 +3815,11 @@ contains
end do
end if
! Accumulate results for each tally
do i = 1, active_tallies % size()
call tallies(active_tallies % data(i)) % obj % accumulate()
end do
end subroutine accumulate_tallies
!===============================================================================

View file

@ -6,7 +6,7 @@ module tally_header
use error
use dict_header, only: DictIntInt
use hdf5_interface, only: HID_T, HSIZE_T
use message_passing, only: n_procs
use message_passing, only: n_procs, master
use nuclide_header, only: nuclide_dict
use settings, only: reduce_tallies, run_mode
use stl_vector, only: VectorInt
@ -182,25 +182,27 @@ contains
this % n_realizations = this % n_realizations + n_procs
end if
! Calculate total source strength for normalization
if (run_mode == MODE_FIXEDSOURCE) then
total_source = total_source_strength()
else
total_source = ONE
end if
if (master .or. (.not. reduce_tallies)) then
! Calculate total source strength for normalization
if (run_mode == MODE_FIXEDSOURCE) then
total_source = total_source_strength()
else
total_source = ONE
end if
! Accumulate each result
do j = 1, size(this % results, 3)
do i = 1, size(this % results, 2)
val = this % results(RESULT_VALUE, i, j)/total_weight * total_source
this % results(RESULT_VALUE, i, j) = ZERO
! Accumulate each result
do j = 1, size(this % results, 3)
do i = 1, size(this % results, 2)
val = this % results(RESULT_VALUE, i, j)/total_weight * total_source
this % results(RESULT_VALUE, i, j) = ZERO
this % results(RESULT_SUM, i, j) = &
this % results(RESULT_SUM, i, j) + val
this % results(RESULT_SUM_SQ, i, j) = &
this % results(RESULT_SUM_SQ, i, j) + val*val
this % results(RESULT_SUM, i, j) = &
this % results(RESULT_SUM, i, j) + val
this % results(RESULT_SUM_SQ, i, j) = &
this % results(RESULT_SUM_SQ, i, j) + val*val
end do
end do
end do
end if
end subroutine tally_accumulate
subroutine tally_write_results_hdf5(this, group_id)