Removed two unnecessary MPI calls relating to count_bank_sites.

This commit is contained in:
Paul Romano 2012-03-31 17:31:06 -04:00
parent 7819bef5bc
commit cdb2bbbfd1
2 changed files with 10 additions and 21 deletions

View file

@ -285,8 +285,7 @@ contains
integer :: i, j, k ! index for bank sites
integer :: n ! # of boxes in each dimension
real(8) :: total ! total weight of fission bank sites
logical :: sites_outside ! were there sites outside entropy box?
logical :: sites_outside ! were there sites outside entropy box?
type(StructuredMesh), pointer :: m => null()
! Get pointer to entropy mesh
@ -320,7 +319,7 @@ contains
end if
! count number of fission sites over mesh
call count_bank_sites(m, fission_bank, entropy_p, total, &
call count_bank_sites(m, fission_bank, entropy_p, &
size_bank=n_bank, sites_outside=sites_outside)
! display warning message if there were sites outside entropy box
@ -332,7 +331,7 @@ contains
! sum values to obtain shannon entropy
if (master) then
! Normalize to total weight of bank sites
entropy_p = entropy_p / total
entropy_p = entropy_p / sum(entropy_p)
entropy = 0
do i = 1, m % dimension(1)
@ -470,7 +469,7 @@ contains
else
! count number of source sites in each ufs mesh cell
call count_bank_sites(ufs_mesh, source_bank, source_frac, total, &
call count_bank_sites(ufs_mesh, source_bank, source_frac, &
sites_outside=sites_outside)
! Check for sites outside of the mesh
@ -479,16 +478,16 @@ contains
call fatal_error()
end if
! Normalize to total weight to get fraction of source in each cell
if (master) source_frac = source_frac / total
#ifdef MPI
! Send source fraction to all processors
n = product(ufs_mesh % dimension)
call MPI_BCAST(source_frac, n, MPI_REAL8, 0, MPI_COMM_WORLD, mpi_err)
call MPI_BCAST(total, 1, MPI_REAL8, 0, MPI_COMM_WORLD, mpi_err)
#endif
! Normalize to total weight to get fraction of source in each cell
total = sum(source_frac)
source_frac = source_frac / total
! Since the total starting weight is not equal to n_particles, we need to
! renormalize the weight of the source sites

View file

@ -151,14 +151,13 @@ contains
! weighting)
!===============================================================================
subroutine count_bank_sites(m, bank_array, cnt, total, &
energies, size_bank, sites_outside)
subroutine count_bank_sites(m, bank_array, cnt, energies, size_bank, &
sites_outside)
type(StructuredMesh), pointer :: m ! mesh to count sites
type(Bank), intent(in) :: bank_array(:) ! fission or source bank
real(8), intent(out) :: cnt(:,:,:,:) ! weight of sites in each
! cell and energy group
real(8), intent(out) :: total ! total weight of sites
real(8), optional :: energies(:) ! energy grid to search
integer(8), optional :: size_bank ! # of bank sites (on each proc)
logical, optional :: sites_outside ! were there sites outside mesh?
@ -168,7 +167,6 @@ contains
integer :: ijk(3) ! indices on mesh
integer :: n_groups ! number of groups in energies
integer :: e_bin ! energy_bin
real(8) :: weight ! accumulated weight of sites
logical :: in_mesh ! was single site outside mesh?
logical :: outside ! was any site outside mesh?
#ifdef MPI
@ -177,7 +175,6 @@ contains
! initialize variables
cnt = ZERO
weight = ZERO
outside = .false.
! Set size of bank
@ -205,9 +202,6 @@ contains
cycle
end if
! add weight
weight = weight + bank_array(i) % wgt
! determine energy bin
if (present(energies)) then
if (bank_array(i) % E < energies(1)) then
@ -245,11 +239,7 @@ contains
MPI_COMM_WORLD, mpi_err)
end if
! determine total weight of bank sites
call MPI_REDUCE(weight, total, 1, MPI_REAL8, MPI_SUM, 0, &
MPI_COMM_WORLD, mpi_err)
#else
total = weight
sites_outside = outside
#endif