Added weight to Bank derived type.

This commit is contained in:
Paul Romano 2012-03-31 10:43:12 -04:00
parent c663e27b1e
commit a47c7ab91c
4 changed files with 20 additions and 10 deletions

View file

@ -15,6 +15,7 @@ module bank_header
sequence
integer(8) :: id ! Unique ID
real(8) :: wgt ! weight of bank site
real(8) :: xyz(3) ! location of bank particle
real(8) :: uvw(3) ! diretional cosines
real(8) :: E ! energy

View file

@ -149,9 +149,9 @@ contains
subroutine setup_mpi()
#ifdef MPI
integer :: bank_blocks(4) ! Count for each datatype
integer :: bank_types(4) ! Datatypes
integer(MPI_ADDRESS_KIND) :: bank_disp(4) ! Displacements
integer :: bank_blocks(5) ! Count for each datatype
integer :: bank_types(5) ! Datatypes
integer(MPI_ADDRESS_KIND) :: bank_disp(5) ! Displacements
type(Bank) :: b
mpi_enabled = .true.
@ -186,17 +186,18 @@ contains
! Determine displacements for MPI_BANK type
call MPI_GET_ADDRESS(b % id, bank_disp(1), mpi_err)
call MPI_GET_ADDRESS(b % xyz, bank_disp(2), mpi_err)
call MPI_GET_ADDRESS(b % uvw, bank_disp(3), mpi_err)
call MPI_GET_ADDRESS(b % E, bank_disp(4), mpi_err)
call MPI_GET_ADDRESS(b % wgt, bank_disp(2), mpi_err)
call MPI_GET_ADDRESS(b % xyz, bank_disp(3), mpi_err)
call MPI_GET_ADDRESS(b % uvw, bank_disp(4), mpi_err)
call MPI_GET_ADDRESS(b % E, bank_disp(5), mpi_err)
! Adjust displacements
bank_disp = bank_disp - bank_disp(1)
! Define MPI_BANK for fission sites
bank_blocks = (/ 1, 3, 3, 1 /)
bank_types = (/ MPI_INTEGER8, MPI_REAL8, MPI_REAL8, MPI_REAL8 /)
call MPI_TYPE_CREATE_STRUCT(4, bank_blocks, bank_disp, &
bank_blocks = (/ 1, 1, 3, 3, 1 /)
bank_types = (/ MPI_INTEGER8, MPI_REAL8, MPI_REAL8, MPI_REAL8, MPI_REAL8 /)
call MPI_TYPE_CREATE_STRUCT(5, bank_blocks, bank_disp, &
bank_types, MPI_BANK, mpi_err)
call MPI_TYPE_COMMIT(MPI_BANK, mpi_err)

View file

@ -906,6 +906,9 @@ contains
fission_bank(i) % id = p % id
fission_bank(i) % xyz = p % coord0 % xyz
! Set weight of fission bank site
fission_bank(i) % wgt = ONE
! sample cosine of angle
mu = sample_angle(rxn, E)

View file

@ -94,6 +94,9 @@ contains
id = bank_first + j - 1
source_bank(j) % id = id
! Set weight to one
source_bank(j) % wgt = ONE
! initialize random number seed
call set_particle_seed(id)
@ -148,6 +151,8 @@ contains
src => source_bank(index_source)
! copy attributes from source bank site
p % wgt = src % wgt
p % last_wgt = src % wgt
p % coord % xyz = src % xyz
p % coord % uvw = src % uvw
p % last_xyz = src % xyz
@ -315,7 +320,7 @@ contains
call fatal_error()
end if
! Read position, angle, and energy
! Read source sites
read(UNIT=UNIT_SOURCE) source_bank(1:work)
! Close binary source file