Removed add_to_score subroutine and replaced calls with += instruction.

This commit is contained in:
Paul Romano 2012-12-02 15:52:43 -05:00
parent df157fa234
commit 7a7d83e4e2
3 changed files with 40 additions and 45 deletions

View file

@ -8,7 +8,7 @@ module geometry
use output, only: write_message
use particle_header, only: LocalCoord, deallocate_coord
use string, only: to_str
use tally, only: score_surface_current, add_to_score
use tally, only: score_surface_current
implicit none
@ -272,10 +272,9 @@ contains
call score_surface_current()
end if
if (tallies_on) then
! Score to global leakage tally
call add_to_score(global_tallies(LEAKAGE), p % wgt)
end if
! Score to global leakage tally
if (tallies_on) global_tallies(LEAKAGE) % value = &
global_tallies(LEAKAGE) % value + p % wgt
! Display message
if (verbosity >= 10 .or. trace) then

View file

@ -19,7 +19,7 @@ module physics
use search, only: binary_search
use string, only: to_str
use tally, only: score_analog_tally, score_tracklength_tally, &
score_surface_current, add_to_score
score_surface_current
implicit none
@ -103,12 +103,10 @@ contains
if (associated(active_tracklength_tallies)) &
call score_tracklength_tally(distance)
! Score global tracklength tallies
if (tallies_on) then
! Score track-length estimate of k-eff
call add_to_score(global_tallies(K_TRACKLENGTH), &
p % wgt * distance * material_xs % nu_fission)
end if
! Score track-length estimate of k-eff
if (tallies_on) global_tallies(K_TRACKLENGTH) % value = &
global_tallies(K_TRACKLENGTH) % value + p % wgt * distance * &
material_xs % nu_fission
if (d_collision > d_boundary) then
! ====================================================================
@ -132,10 +130,9 @@ contains
! PARTICLE HAS COLLISION
! Score collision estimate of keff
if (tallies_on) then
call add_to_score(global_tallies(K_COLLISION), &
p % wgt * material_xs % nu_fission / material_xs % total)
end if
if (tallies_on) global_tallies(K_COLLISION) % value = &
global_tallies(K_COLLISION) % value + p % wgt * &
material_xs % nu_fission / material_xs % total
p % surface = NONE
call collision()
@ -908,7 +905,8 @@ contains
end if
! Add to analog estimate of keff
call add_to_score(global_tallies(K_ANALOG), nu/weight * keff)
global_tallies(K_ANALOG) % value = &
global_tallies(K_ANALOG) % value + nu/weight * keff
! Bank source neutrons
if (nu == 0 .or. n_bank == 3*work) return

View file

@ -330,7 +330,8 @@ contains
end select
! Add score to tally
call add_to_score(t % scores(score_index, filter_index), score)
t % scores(score_index, filter_index) % value = &
t % scores(score_index, filter_index) % value + score
end do SCORE_LOOP
@ -399,7 +400,8 @@ contains
i_filter = sum((t % matching_bins - 1) * t % stride) + 1
! Add score to tally
call add_to_score(t % scores(i_score, i_filter), score)
t % scores(i_score, i_filter) % value = &
t % scores(i_score, i_filter) % value + score
end do
! reset outgoing energy bin and score index
@ -559,7 +561,8 @@ contains
score_index = (k - 1)*t % n_score_bins + j
! Add score to tally
call add_to_score(t % scores(score_index, filter_index), score)
t % scores(score_index, filter_index) % value = &
t % scores(score_index, filter_index) % value + score
end do SCORE_LOOP
@ -653,7 +656,8 @@ contains
score_index = (i_nuclide - 1)*t % n_score_bins + j
! Add score to tally
call add_to_score(t % scores(score_index, filter_index), score)
t % scores(score_index, filter_index) % value = &
t % scores(score_index, filter_index) % value + score
end do SCORE_LOOP
@ -693,7 +697,8 @@ contains
score_index = n_nuclides_total*t % n_score_bins + j
! Add score to tally
call add_to_score(t % scores(score_index, filter_index), score)
t % scores(score_index, filter_index) % value = &
t % scores(score_index, filter_index) % value + score
end do MATERIAL_SCORE_LOOP
@ -981,7 +986,8 @@ contains
score_index = (b - 1)*t % n_score_bins + j
! Add score to tally
call add_to_score(t % scores(score_index, filter_index), score)
t % scores(score_index, filter_index) % value = &
t % scores(score_index, filter_index) % value + score
end do SCORE_LOOP
@ -1202,7 +1208,8 @@ contains
t % matching_bins(i_filter_mesh) = &
mesh_indices_to_bin(m, ijk0 + 1, .true.)
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
call add_to_score(t % scores(1, filter_index), p % wgt)
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
end if
end do
else
@ -1213,7 +1220,8 @@ contains
t % matching_bins(i_filter_mesh) = &
mesh_indices_to_bin(m, ijk0 + 1, .true.)
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
call add_to_score(t % scores(1, filter_index), p % wgt)
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
end if
end do
end if
@ -1229,7 +1237,8 @@ contains
t % matching_bins(i_filter_mesh) = &
mesh_indices_to_bin(m, ijk0 + 1, .true.)
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
call add_to_score(t % scores(1, filter_index), p % wgt)
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
end if
end do
else
@ -1240,7 +1249,8 @@ contains
t % matching_bins(i_filter_mesh) = &
mesh_indices_to_bin(m, ijk0 + 1, .true.)
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
call add_to_score(t % scores(1, filter_index), p % wgt)
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
end if
end do
end if
@ -1256,7 +1266,8 @@ contains
t % matching_bins(i_filter_mesh) = &
mesh_indices_to_bin(m, ijk0 + 1, .true.)
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
call add_to_score(t % scores(1, filter_index), p % wgt)
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
end if
end do
else
@ -1267,7 +1278,8 @@ contains
t % matching_bins(i_filter_mesh) = &
mesh_indices_to_bin(m, ijk0 + 1, .true.)
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
call add_to_score(t % scores(1, filter_index), p % wgt)
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
end if
end do
end if
@ -1391,7 +1403,8 @@ contains
end if
! Add to surface current tally
call add_to_score(t % scores(1, filter_index), p % wgt)
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
end if
! Calculate new coordinates
@ -1635,21 +1648,6 @@ contains
end subroutine tally_statistics
!===============================================================================
! ADD_TO_SCORE accumulates a scoring contribution to a specific tally bin and
! specific response function. Note that we don't need to add the square of the
! contribution since that is done at the batch level, not the history level
!===============================================================================
subroutine add_to_score(score, val)
type(TallyScore), intent(inout) :: score
real(8), intent(in) :: val
score % value = score % value + val
end subroutine add_to_score
!===============================================================================
! ACCUMULATE_SCORE accumulates scores from many histories (or many generations)
! into a single realization of a random variable.