From 37e3e6e9b5bbd141dafed057b1ceefa658aea116 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 6 Apr 2012 09:27:06 -0400 Subject: [PATCH] Fixed bug with analog fission tallies when using UFS. --- src/particle_header.F90 | 1 + src/physics.F90 | 16 ++++++++-------- src/source.F90 | 1 + src/tally.F90 | 7 ++++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/particle_header.F90 b/src/particle_header.F90 index 4330dfb882..7ce921bca1 100644 --- a/src/particle_header.F90 +++ b/src/particle_header.F90 @@ -57,6 +57,7 @@ module particle_header ! Post-collision physical data integer :: n_bank ! number of fission sites banked + real(8) :: wgt_bank ! weight of fission sites banked ! Energy grid data integer :: IE ! index on energy grid diff --git a/src/physics.F90 b/src/physics.F90 index 382cce60b3..c38464dde9 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -213,8 +213,9 @@ contains if (tallies_on .and. n_analog_tallies > 0) & call score_analog_tally() - ! Reset number of particles banked during collision - p % n_bank = 0 + ! Reset banked weight during collision + p % n_bank = 0 + p % wgt_bank = ZERO end subroutine collision @@ -934,11 +935,7 @@ contains fission_bank(i) % xyz = p % coord0 % xyz ! Set weight of fission bank site - if (ufs) then - fission_bank(i) % wgt = ONE/weight - else - fission_bank(i) % wgt = ONE - end if + fission_bank(i) % wgt = ONE/weight ! sample cosine of angle mu = sample_angle(rxn, E) @@ -1039,7 +1036,10 @@ contains ! increment number of bank sites n_bank = min(n_bank + nu, 3*work) - p % n_bank = nu + + ! Store total weight banked for analog fission tallies + p % n_bank = nu + p % wgt_bank = nu/weight end subroutine create_fission_sites diff --git a/src/source.F90 b/src/source.F90 index d5a82fe41f..0c8caeb499 100644 --- a/src/source.F90 +++ b/src/source.F90 @@ -193,6 +193,7 @@ contains p % wgt = ONE p % last_wgt = ONE p % n_bank = 0 + p % wgt_bank = ZERO p % n_collision = 0 ! remove any original coordinates diff --git a/src/tally.F90 b/src/tally.F90 index 2169af5c14..f6d18eaa18 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -440,7 +440,7 @@ contains ! bank. Since this was weighted by 1/keff, we multiply by keff ! to get the proper score. - score = keff * p % n_bank + score = keff * p % wgt_bank end if @@ -495,10 +495,11 @@ contains ! score by keff to get the true nu-fission rate. Otherwise, the sum ! of all nu-fission rates would be ~1.0. - score = keff - ! loop over number of particles banked do k = 1, p % n_bank + ! determine score based on bank site weight and keff + score = keff * fission_bank(n_bank - p % n_bank + k) % wgt + ! determine outgoing energy from fission bank E_out = fission_bank(n_bank - p % n_bank + k) % E