during cmfd reweighting, bank is looped through with a bank size computed by bank_first and bank_last

This commit is contained in:
Bryan Herman 2012-11-07 12:56:52 -08:00
parent bc82937219
commit f5a9676869

View file

@ -315,7 +315,8 @@ contains
use constants, only: ZERO, ONE
use error, only: warning, fatal_error
use global, only: n_particles, meshes, source_bank, work, &
n_user_meshes, message, cmfd, master, mpi_err
n_user_meshes, message, cmfd, master, mpi_err, &
bank_first, bank_last
use mesh_header, only: StructuredMesh
use mesh, only: count_bank_sites, get_mesh_indices
use search, only: binary_search
@ -329,6 +330,7 @@ contains
integer :: ijk(3) ! spatial bin location
integer :: e_bin ! energy bin of source particle
integer :: n_groups ! number of energy groups
integer(8) :: size_bank ! size of source bank
logical :: outside ! any source sites outside mesh
logical :: in_mesh ! source site is inside mesh
logical :: new_weights ! calcualte new weights
@ -344,6 +346,9 @@ contains
nz = cmfd%indices(3)
ng = cmfd%indices(4)
! compute size of source bank
size_bank = bank_last - bank_first + 1_8
! allocate arrays in cmfd object (can take out later extend to multigroup)
if (.not.allocated(cmfd%sourcecounts)) then
allocate(cmfd%sourcecounts(ng,nx,ny,nz))
@ -366,7 +371,13 @@ contains
! count bank sites in mesh
call count_bank_sites(m, source_bank, cmfd%sourcecounts, egrid, &
sites_outside=outside)
sites_outside=outside, size_bank = size_bank)
! check for sites outside of the mesh
if (master .and. outside) then
message = "Source sites outside of the CMFD mesh!"
call fatal_error()
end if
! have master compute weight factors
if (master) then
@ -383,7 +394,7 @@ contains
end if
! begin loop over source bank
do i = 1, size(source_bank) ! int(work,4)
do i = 1, int(size_bank, 4)
! determine spatial bin
call get_mesh_indices(m, source_bank(i)%xyz, ijk, in_mesh)
@ -407,7 +418,7 @@ contains
! check for outside of mesh
if (.not. in_mesh) then
message = 'source site found outside of mesh'
message = 'Source site found outside of CMFD mesh!'
call fatal_error()
end if