Changed TallyScore to TallyResult, t % scores to t % results, etc.

This commit is contained in:
Paul Romano 2012-12-04 10:25:29 -05:00
parent 3f61c736b4
commit a5057a424d
14 changed files with 263 additions and 263 deletions

View file

@ -61,7 +61,7 @@ contains
meshes
use mesh, only: mesh_indices_to_bin
use mesh_header, only: StructuredMesh
use tally_header, only: TallyObject, TallyScore
use tally_header, only: TallyObject
integer :: nx ! number of mesh cells in x direction
integer :: ny ! number of mesh cells in y direction
@ -155,7 +155,7 @@ contains
score_index = sum((t % matching_bins - 1) * t%stride) + 1
! get flux
flux = t % scores(1,score_index) % sum
flux = t % results(1,score_index) % sum
cmfd % flux(h,i,j,k) = flux
! detect zero flux
@ -166,13 +166,13 @@ contains
end if
! get total rr and convert to total xs
cmfd % totalxs(h,i,j,k) = t % scores(2,score_index) % sum / flux
cmfd % totalxs(h,i,j,k) = t % results(2,score_index) % sum / flux
! get p1 scatter rr and convert to p1 scatter xs
cmfd % p1scattxs(h,i,j,k) = t % scores(3,score_index) % sum / flux
cmfd % p1scattxs(h,i,j,k) = t % results(3,score_index) % sum / flux
! extract diffusion coefficient tally
cmfd % diffusion(h,i,j,k) = t % scores(4,score_index) % sum / flux
cmfd % diffusion(h,i,j,k) = t % results(4,score_index) % sum / flux
! calculate diffusion coefficient
! cmfd % diffcof(h,i,j,k) = ONE/(3.0_8*cmfd%totalxs(h,i,j,k))
@ -206,16 +206,16 @@ contains
score_index = sum((t % matching_bins - 1) * t%stride) + 1
! get scattering
cmfd % scattxs(h,g,i,j,k) = t % scores(1,score_index) % sum /&
cmfd % scattxs(h,g,i,j,k) = t % results(1,score_index) % sum /&
cmfd % flux(h,i,j,k)
! get nu-fission
cmfd % nfissxs(h,g,i,j,k) = t % scores(2,score_index) % sum /&
cmfd % nfissxs(h,g,i,j,k) = t % results(2,score_index) % sum /&
cmfd % flux(h,i,j,k)
! bank source
cmfd % openmc_src(g,i,j,k) = cmfd % openmc_src(g,i,j,k) + &
t % scores(2,score_index) % sum
t % results(2,score_index) % sum
end do INGROUP
@ -232,60 +232,60 @@ contains
(/ i-1, j, k /) + 1, .true.)
t % matching_bins(i_filter_surf) = IN_RIGHT
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! outgoing
cmfd % current(1,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(1,h,i,j,k) = t % results(1,score_index) % sum
t % matching_bins(i_filter_surf) = OUT_RIGHT
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! incoming
cmfd % current(2,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(2,h,i,j,k) = t % results(1,score_index) % sum
! right surface
t % matching_bins(i_filter_mesh) = mesh_indices_to_bin(m, &
(/ i, j, k /) + 1, .true.)
t % matching_bins(i_filter_surf) = IN_RIGHT
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! incoming
cmfd % current(3,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(3,h,i,j,k) = t % results(1,score_index) % sum
t % matching_bins(i_filter_surf) = OUT_RIGHT
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! outgoing
cmfd % current(4,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(4,h,i,j,k) = t % results(1,score_index) % sum
! back surface
t % matching_bins(i_filter_mesh) = mesh_indices_to_bin(m, &
(/ i, j-1, k /) + 1, .true.)
t % matching_bins(i_filter_surf) = IN_FRONT
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! outgoing
cmfd % current(5,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(5,h,i,j,k) = t % results(1,score_index) % sum
t % matching_bins(i_filter_surf) = OUT_FRONT
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! incoming
cmfd % current(6,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(6,h,i,j,k) = t % results(1,score_index) % sum
! front surface
t % matching_bins(i_filter_mesh) = mesh_indices_to_bin(m, &
(/ i, j, k /) + 1, .true.)
t % matching_bins(i_filter_surf) = IN_FRONT
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! incoming
cmfd % current(7,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(7,h,i,j,k) = t % results(1,score_index) % sum
t % matching_bins(i_filter_surf) = OUT_FRONT
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! outgoing
cmfd % current(8,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(8,h,i,j,k) = t % results(1,score_index) % sum
! bottom surface
t % matching_bins(i_filter_mesh) = mesh_indices_to_bin(m, &
(/ i, j, k-1 /) + 1, .true.)
t % matching_bins(i_filter_surf) = IN_TOP
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! outgoing
cmfd % current(9,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(9,h,i,j,k) = t % results(1,score_index) % sum
t % matching_bins(i_filter_surf) = OUT_TOP
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! incoming
cmfd % current(10,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(10,h,i,j,k) = t % results(1,score_index) % sum
! top surface
t % matching_bins(i_filter_mesh) = mesh_indices_to_bin(m, &
(/ i, j, k /) + 1, .true.)
t % matching_bins(i_filter_surf) = IN_TOP
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! incoming
cmfd % current(11,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(11,h,i,j,k) = t % results(1,score_index) % sum
t % matching_bins(i_filter_surf) = OUT_TOP
score_index = sum((t % matching_bins - 1) * t % stride) + 1 ! outgoing
cmfd % current(12,h,i,j,k) = t % scores(1,score_index) % sum
cmfd % current(12,h,i,j,k) = t % results(1,score_index) % sum
end if TALLY

View file

@ -478,7 +478,7 @@ contains
use global, only: n_user_tallies, n_tallies, tallies, message
use output, only: write_message
use tally, only: reset_score
use tally, only: reset_result
integer :: i ! loop counter
@ -491,7 +491,7 @@ contains
! reset that tally
tallies(i) % n_realizations = 0
call reset_score(tallies(i) % scores)
call reset_result(tallies(i) % results)
end do

View file

@ -173,7 +173,7 @@ contains
use mesh_header, only: StructuredMesh
use string
use tally, only: setup_active_cmfdtallies
use tally_header, only: TallyObject, TallyScore, TallyFilter
use tally_header, only: TallyObject, TallyFilter
use xml_data_cmfd_t
integer :: i ! loop counter

View file

@ -13,7 +13,7 @@ module global
use particle_header, only: Particle
use plot_header, only: Plot
use source_header, only: ExtSource
use tally_header, only: TallyObject, TallyMap, TallyScore
use tally_header, only: TallyObject, TallyMap, TallyResult
use timing, only: Timer
#ifdef MPI
@ -111,7 +111,7 @@ module global
! 3) track-length estimate of k-eff
! 4) leakage fraction
type(TallyScore), target :: global_tallies(N_GLOBAL_TALLIES)
type(TallyResult), target :: global_tallies(N_GLOBAL_TALLIES)
! Tally map structure
type(TallyMap), allocatable :: tally_maps(:)
@ -208,7 +208,7 @@ module global
logical :: mpi_enabled = .false. ! is MPI in use and initialized?
integer :: mpi_err ! MPI error code
integer :: MPI_BANK ! MPI datatype for fission bank
integer :: MPI_TALLYSCORE ! MPI datatype for TallyScore
integer :: MPI_TALLYRESULT ! MPI datatype for TallyResult
! No reduction at end of batch
logical :: reduce_tallies = .true.
@ -240,11 +240,11 @@ module global
! HDF5 VARIABLES
#ifdef HDF5
integer(HID_T) :: hdf5_output_file ! identifier for output file
integer(HID_T) :: hdf5_tallyscore_t ! Compound type for TallyScore
integer(HID_T) :: hdf5_bank_t ! Compound type for Bank
integer(HID_T) :: hdf5_integer8_t ! type for integer(8)
integer :: hdf5_err ! error flag
integer(HID_T) :: hdf5_output_file ! identifier for output file
integer(HID_T) :: hdf5_tallyresult_t ! Compound type for TallyResult
integer(HID_T) :: hdf5_bank_t ! Compound type for Bank
integer(HID_T) :: hdf5_integer8_t ! type for integer(8)
integer :: hdf5_err ! error flag
#endif
! ============================================================================

View file

@ -30,20 +30,20 @@ contains
subroutine hdf5_initialize()
type(TallyScore), target :: tmp(2) ! temporary TallyScore
type(Bank), target :: tmpb(2) ! temporary Bank
integer(HID_T) :: coordinates_t ! HDF5 type for 3 reals
integer(HSIZE_T) :: dims(1) = (/3/) ! size of coordinates
type(TallyResult), target :: tmp(2) ! temporary TallyResult
type(Bank), target :: tmpb(2) ! temporary Bank
integer(HID_T) :: coordinates_t ! HDF5 type for 3 reals
integer(HSIZE_T) :: dims(1) = (/3/) ! size of coordinates
! Initialize FORTRAN interface.
call h5open_f(hdf5_err)
! Create the compound datatype for TallyScore
! Create the compound datatype for TallyResult
call h5tcreate_f(H5T_COMPOUND_F, h5offsetof(c_loc(tmp(1)), &
c_loc(tmp(2))), hdf5_tallyscore_t, hdf5_err)
call h5tinsert_f(hdf5_tallyscore_t, "sum", h5offsetof(c_loc(tmp(1)), &
c_loc(tmp(2))), hdf5_tallyresult_t, hdf5_err)
call h5tinsert_f(hdf5_tallyresult_t, "sum", h5offsetof(c_loc(tmp(1)), &
c_loc(tmp(1)%sum)), H5T_NATIVE_DOUBLE, hdf5_err)
call h5tinsert_f(hdf5_tallyscore_t, "sum_sq", h5offsetof(c_loc(tmp(1)), &
call h5tinsert_f(hdf5_tallyresult_t, "sum_sq", h5offsetof(c_loc(tmp(1)), &
c_loc(tmp(1)%sum_sq)), H5T_NATIVE_DOUBLE, hdf5_err)
! Create compound type for xyz and uvw
@ -73,7 +73,7 @@ contains
subroutine hdf5_finalize()
! Release compound datatypes
call h5tclose_f(hdf5_tallyscore_t, hdf5_err)
call h5tclose_f(hdf5_tallyresult_t, hdf5_err)
! Close FORTRAN interface.
call h5close_f(hdf5_err)
@ -1031,10 +1031,10 @@ contains
! Write global tallies
dims(1) = N_GLOBAL_TALLIES
call h5screate_simple_f(1, dims, dspace, hdf5_err)
call h5dcreate_f(hdf5_state_point, "global_tallies", hdf5_tallyscore_t, &
call h5dcreate_f(hdf5_state_point, "global_tallies", hdf5_tallyresult_t, &
dspace, dset, hdf5_err)
f_ptr = c_loc(global_tallies(1))
CALL h5dwrite_f(dset, hdf5_tallyscore_t, f_ptr, hdf5_err)
CALL h5dwrite_f(dset, hdf5_tallyresult_t, f_ptr, hdf5_err)
call h5dclose_f(dset, hdf5_err)
call h5sclose_f(dspace, hdf5_err)
@ -1043,7 +1043,7 @@ contains
call hdf5_write_integer(tallies_group, "tallies_present", 1)
! Write tally sum and sum_sq
TALLY_SCORES: do i = 1, n_tallies
TALLY_RESULTS: do i = 1, n_tallies
! Get pointer to tally
t => tallies(i)
@ -1052,18 +1052,18 @@ contains
temp_group, hdf5_err)
! Write sum and sum_sq for each bin
dims2 = shape(t % scores)
dims2 = shape(t % results)
call h5screate_simple_f(2, dims2, dspace, hdf5_err)
call h5dcreate_f(temp_group, "values", hdf5_tallyscore_t, &
call h5dcreate_f(temp_group, "results", hdf5_tallyresult_t, &
dspace, dset, hdf5_err)
f_ptr = c_loc(t % scores(1, 1))
CALL h5dwrite_f(dset, hdf5_tallyscore_t, f_ptr, hdf5_err)
f_ptr = c_loc(t % results(1, 1))
CALL h5dwrite_f(dset, hdf5_tallyresult_t, f_ptr, hdf5_err)
call h5dclose_f(dset, hdf5_err)
call h5sclose_f(dspace, hdf5_err)
! Close group for the i-th tally
call h5gclose_f(temp_group, hdf5_err)
end do TALLY_SCORES
end do TALLY_RESULTS
else
! Indicate that tallies are off
call hdf5_write_integer(tallies_group, "tallies_present", 0)
@ -1153,7 +1153,7 @@ contains
! Read global tallies
f_ptr = c_loc(global_tallies(1))
call h5dread_f(dset, hdf5_tallyscore_t, f_ptr, hdf5_err)
call h5dread_f(dset, hdf5_tallyresult_t, f_ptr, hdf5_err)
! Close global tallies dataset
call h5dclose_f(dset, hdf5_err)
@ -1167,14 +1167,14 @@ contains
call hdf5_read_integer(tally_group, "n_realizations", &
tallies(i) % n_realizations)
! Open dataset for tally values
call h5dopen_f(tally_group, "values", dset, hdf5_err)
! Open dataset for tally results
call h5dopen_f(tally_group, "results", dset, hdf5_err)
! Read sum and sum_sq for each tally bin
f_ptr = c_loc(tallies(i) % scores(1,1))
call h5dread_f(dset, hdf5_tallyscore_t, f_ptr, hdf5_err)
f_ptr = c_loc(tallies(i) % results(1,1))
call h5dread_f(dset, hdf5_tallyresult_t, f_ptr, hdf5_err)
! Close dataset for tally values
! Close dataset for tally results
call h5dclose_f(dset, hdf5_err)
! Close tally group
@ -1191,7 +1191,7 @@ contains
f_ptr = c_loc(source_bank(1))
call h5dread_f(dset, hdf5_bank_t, f_ptr, hdf5_err)
! Close dataset for tally values
! Close dataset for source bank
call h5dclose_f(dset, hdf5_err)
! Close HDF5 state point file

View file

@ -169,14 +169,14 @@ contains
integer :: bank_types(4) ! Datatypes
integer(MPI_ADDRESS_KIND) :: bank_disp(4) ! Displacements
integer :: temp_type ! temporary derived type
integer :: score_blocks(1) ! Count for each datatype
integer :: score_types(1) ! Datatypes
integer(MPI_ADDRESS_KIND) :: score_disp(1) ! Displacements
integer(MPI_ADDRESS_KIND) :: score_base_disp ! Base displacement
integer(MPI_ADDRESS_KIND) :: lower_bound ! Lower bound for TallyScore
integer(MPI_ADDRESS_KIND) :: extent ! Extent for TallyScore
integer :: result_blocks(1) ! Count for each datatype
integer :: result_types(1) ! Datatypes
integer(MPI_ADDRESS_KIND) :: result_disp(1) ! Displacements
integer(MPI_ADDRESS_KIND) :: result_base_disp ! Base displacement
integer(MPI_ADDRESS_KIND) :: lower_bound ! Lower bound for TallyResult
integer(MPI_ADDRESS_KIND) :: extent ! Extent for TallyResult
type(Bank) :: b
type(TallyScore) :: ts
type(TallyResult) :: tr
! Indicate that MPI is turned on
mpi_enabled = .true.
@ -215,29 +215,29 @@ contains
call MPI_TYPE_COMMIT(MPI_BANK, mpi_err)
! ==========================================================================
! CREATE MPI_TALLYSCORE TYPE
! CREATE MPI_TALLYRESULT TYPE
! Determine displacements for MPI_BANK type
call MPI_GET_ADDRESS(ts % value, score_base_disp, mpi_err)
call MPI_GET_ADDRESS(ts % sum, score_disp(1), mpi_err)
call MPI_GET_ADDRESS(tr % value, result_base_disp, mpi_err)
call MPI_GET_ADDRESS(tr % sum, result_disp(1), mpi_err)
! Adjust displacements
score_disp = score_disp - score_base_disp
result_disp = result_disp - result_base_disp
! Define temporary type for tallyscore
score_blocks = (/ 2 /)
score_types = (/ MPI_REAL8 /)
call MPI_TYPE_CREATE_STRUCT(1, score_blocks, score_disp, score_types, &
! Define temporary type for TallyResult
result_blocks = (/ 2 /)
result_types = (/ MPI_REAL8 /)
call MPI_TYPE_CREATE_STRUCT(1, result_blocks, result_disp, result_types, &
temp_type, mpi_err)
! Adjust lower-bound and extent of type for tally score
lower_bound = 0
extent = score_disp(1) + 16
extent = result_disp(1) + 16
call MPI_TYPE_CREATE_RESIZED(temp_type, lower_bound, extent, &
MPI_TALLYSCORE, mpi_err)
MPI_TALLYRESULT, mpi_err)
! Commit derived type for tally scores
call MPI_TYPE_COMMIT(MPI_TALLYSCORE, mpi_err)
call MPI_TYPE_COMMIT(MPI_TALLYRESULT, mpi_err)
end subroutine initialize_mpi
#endif

View file

@ -93,7 +93,7 @@ contains
!===============================================================================
! MESH_INDICES_TO_BIN maps (i,j) or (i,j,k) indices to a single bin number for
! use in a TallyObject scores array
! use in a TallyObject results array
!===============================================================================
function mesh_indices_to_bin(m, ijk, surface_current) result(bin)
@ -126,7 +126,7 @@ contains
end function mesh_indices_to_bin
!===============================================================================
! BIN_TO_MESH_INDICES maps a single mesh bin from a TallyObject scores array to
! BIN_TO_MESH_INDICES maps a single mesh bin from a TallyObject results array to
! (i,j) or (i,j,k) indices
!===============================================================================

View file

@ -1387,7 +1387,7 @@ contains
integer :: n ! loop index for nuclides
integer :: type ! type of tally filter
integer :: indent ! number of spaces to preceed output
integer :: filter_index ! index in scores array for filters
integer :: filter_index ! index in results array for filters
integer :: score_index ! scoring bin index
integer :: i_nuclide ! index in nuclides array
integer :: i_listing ! index in xs_listings array
@ -1453,14 +1453,14 @@ contains
! Multiply uncertainty by t-value
if (confidence_intervals) then
do k = 1, size(t % scores, 2)
do j = 1, size(t % scores, 1)
do k = 1, size(t % results, 2)
do j = 1, size(t % results, 1)
! Calculate t-value for confidence intervals
if (confidence_intervals) then
alpha = ONE - CONFIDENCE_LEVEL
t_value = t_percentile(ONE - alpha/TWO, t % n_realizations - 1)
end if
t % scores(j,k) % sum_sq = t_value * t % scores(j,k) % sum_sq
t % results(j,k) % sum_sq = t_value * t % results(j,k) % sum_sq
end do
end do
end if
@ -1480,7 +1480,7 @@ contains
cycle
end if
! WARNING: Admittedly, the logic for moving for printing scores is
! WARNING: Admittedly, the logic for moving for printing results is
! extremely confusing and took quite a bit of time to get correct. The
! logic is structured this way since it is not practical to have a do
! loop for each filter variable (given that only a few filters are likely
@ -1511,7 +1511,7 @@ contains
indent = indent - 2
! =================================================================
! VALID BIN -- WRITE FILTER INFORMATION OR EXIT TO WRITE SCORES
! VALID BIN -- WRITE FILTER INFORMATION OR EXIT TO WRITE RESULTS
else
! Check if this is last filter
@ -1544,7 +1544,7 @@ contains
filter_index = 1
end if
! Write scores for this filter bin combination
! Write results for this filter bin combination
score_index = 0
if (t % n_filters > 0) indent = indent + 2
do n = 1, t % n_nuclide_bins
@ -1564,8 +1564,8 @@ contains
score_index = score_index + 1
write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A,"+/- ",A)') &
repeat(" ", indent), score_name(abs(t % score_bins(k))), &
to_str(t % scores(score_index,filter_index) % sum), &
trim(to_str(t % scores(score_index,filter_index) % sum_sq))
to_str(t % results(score_index,filter_index) % sum), &
trim(to_str(t % results(score_index,filter_index) % sum_sq))
end do
indent = indent - 2
@ -1601,7 +1601,7 @@ contains
integer :: n ! number of incoming energy bins
integer :: len1 ! length of string
integer :: len2 ! length of string
integer :: filter_index ! index in scores array for filters
integer :: filter_index ! index in results array for filters
logical :: print_ebin ! should incoming energy bin be displayed?
character(MAX_LINE_LEN) :: string
type(StructuredMesh), pointer :: m => null()
@ -1652,15 +1652,15 @@ contains
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Left", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
t % matching_bins(i_filter_surf) = OUT_RIGHT
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Left", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
! Right Surface
t % matching_bins(i_filter_mesh) = &
@ -1669,15 +1669,15 @@ contains
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Right", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
t % matching_bins(i_filter_surf) = OUT_RIGHT
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Right", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
! Back Surface
t % matching_bins(i_filter_mesh) = &
@ -1686,15 +1686,15 @@ contains
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Back", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
t % matching_bins(i_filter_surf) = OUT_FRONT
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Back", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
! Front Surface
t % matching_bins(i_filter_mesh) = &
@ -1703,15 +1703,15 @@ contains
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Front", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
t % matching_bins(i_filter_surf) = OUT_FRONT
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Front", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
! Bottom Surface
t % matching_bins(i_filter_mesh) = &
@ -1720,15 +1720,15 @@ contains
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Bottom", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
t % matching_bins(i_filter_surf) = OUT_TOP
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Bottom", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
! Top Surface
t % matching_bins(i_filter_mesh) = &
@ -1737,15 +1737,15 @@ contains
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Incoming Current from Top", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
t % matching_bins(i_filter_surf) = OUT_TOP
filter_index = sum((t % matching_bins - 1) * t % stride) + 1
write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') &
"Outgoing Current to Top", &
to_str(t % scores(1,filter_index) % sum), &
trim(to_str(t % scores(1,filter_index) % sum_sq))
to_str(t % results(1,filter_index) % sum), &
trim(to_str(t % results(1,filter_index) % sum_sq))
end do
end do

View file

@ -82,7 +82,7 @@ contains
! If using the no-tally-reduction method, we need to collect tally
! results before writing them to the state point file.
call write_tally_scores_nr(fh)
call write_tally_results_nr(fh)
elseif (master) then
! Write number of realizations
@ -93,7 +93,7 @@ contains
call MPI_FILE_WRITE(fh, N_GLOBAL_TALLIES, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpi_err)
call MPI_FILE_WRITE(fh, global_tallies, N_GLOBAL_TALLIES, &
MPI_TALLYSCORE, MPI_STATUS_IGNORE, mpi_err)
MPI_TALLYRESULT, MPI_STATUS_IGNORE, mpi_err)
if (tallies_on) then
! Indicate that tallies are on
@ -101,14 +101,14 @@ contains
call MPI_FILE_WRITE(fh, temp, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpi_err)
! Write all tally scores
TALLY_SCORES: do i = 1, n_tallies
! Write all tally results
TALLY_RESULTS: do i = 1, n_tallies
t => tallies(i)
n = size(t % scores, 1) * size(t % scores, 2)
call MPI_FILE_WRITE(fh, t % scores, n, MPI_TALLYSCORE, &
n = size(t % results, 1) * size(t % results, 2)
call MPI_FILE_WRITE(fh, t % results, n, MPI_TALLYRESULT, &
MPI_STATUS_IGNORE, mpi_err)
end do TALLY_SCORES
end do TALLY_RESULTS
else
! Indicate that tallies are off
temp = 0
@ -209,7 +209,7 @@ contains
! Number of realizations
write(UNIT_STATE) t % n_realizations
! Write size of each dimension of tally scores array
! Write size of each dimension of tally results array
write(UNIT_STATE) t % total_score_bins
write(UNIT_STATE) t % total_filter_bins
@ -263,18 +263,18 @@ contains
! Indicate that tallies are on
write(UNIT_STATE) 1
TALLY_SCORES: do i = 1, n_tallies
TALLY_RESULTS: do i = 1, n_tallies
! Get pointer to tally
t => tallies(i)
! Write tally sum and sum_sq for each bin
do k = 1, size(t % scores, 2)
do j = 1, size(t % scores, 1)
write(UNIT_STATE) t % scores(j,k) % sum
write(UNIT_STATE) t % scores(j,k) % sum_sq
do k = 1, size(t % results, 2)
do j = 1, size(t % results, 1)
write(UNIT_STATE) t % results(j,k) % sum
write(UNIT_STATE) t % results(j,k) % sum_sq
end do
end do
end do TALLY_SCORES
end do TALLY_RESULTS
else
! Indicate that tallies are off
write(UNIT_STATE) 0
@ -454,10 +454,10 @@ contains
#ifdef MPI
!===============================================================================
! WRITE_TALLY_SCORES_NR
! WRITE_TALLY_RESULTS_NR
!===============================================================================
subroutine write_tally_scores_nr(fh)
subroutine write_tally_results_nr(fh)
integer, intent(in) :: fh ! file handle
@ -466,7 +466,7 @@ contains
integer :: m ! number of score bins
integer :: temp ! temporary variable
integer :: n_bins ! total number of bins
real(8), allocatable :: tally_temp(:,:,:) ! contiguous array of scores
real(8), allocatable :: tally_temp(:,:,:) ! contiguous array of results
real(8) :: global_temp(2,N_GLOBAL_TALLIES)
real(8) :: dummy ! temporary receive buffer for non-root reduces
type(TallyObject), pointer :: t => null()
@ -518,20 +518,20 @@ contains
MPI_STATUS_IGNORE, mpi_err)
end if
! Write all tally scores
TALLY_SCORES: do i = 1, n_tallies
! Write all tally results
TALLY_RESULTS: do i = 1, n_tallies
t => tallies(i)
! Determine size of tally scores array
m = size(t % scores, 1)
n = size(t % scores, 2)
! Determine size of tally results array
m = size(t % results, 1)
n = size(t % results, 2)
n_bins = m*n*2
! Allocate array for storing sums and sums of squares, but
! contiguously in memory for each
allocate(tally_temp(2,m,n))
tally_temp(1,:,:) = t % scores(:,:) % sum
tally_temp(2,:,:) = t % scores(:,:) % sum_sq
tally_temp(1,:,:) = t % results(:,:) % sum
tally_temp(2,:,:) = t % results(:,:) % sum_sq
if (master) then
! The MPI_IN_PLACE specifier allows the master to copy values into
@ -544,10 +544,10 @@ contains
MPI_STATUS_IGNORE, mpi_err)
! At the end of the simulation, store the results back in the
! regular TallyScores array
! regular TallyResults array
if (current_batch == n_batches) then
t % scores(:,:) % sum = tally_temp(1,:,:)
t % scores(:,:) % sum_sq = tally_temp(2,:,:)
t % results(:,:) % sum = tally_temp(1,:,:)
t % results(:,:) % sum_sq = tally_temp(2,:,:)
end if
else
! Receive buffer not significant at other processors
@ -557,7 +557,7 @@ contains
! Deallocate temporary copy of tally results
deallocate(tally_temp)
end do TALLY_SCORES
end do TALLY_RESULTS
else
if (master) then
! Indicate that tallies are off
@ -567,7 +567,7 @@ contains
end if
end if
end subroutine write_tally_scores_nr
end subroutine write_tally_results_nr
#endif
!===============================================================================
@ -687,12 +687,12 @@ contains
call MPI_FILE_READ(fh, tallies(i) % n_realizations, 1, &
MPI_INTEGER, MPI_STATUS_IGNORE, mpi_err)
! Read dimensions of tally filters and scores and make sure they
! Read dimensions of tally filters and results and make sure they
! match
call MPI_FILE_READ(fh, temp, 2, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpi_err)
if (temp(1) /= size(tallies(i) % scores, 1) .or. &
temp(2) /= size(tallies(i) % scores, 2)) then
if (temp(1) /= size(tallies(i) % results, 1) .or. &
temp(2) /= size(tallies(i) % results, 2)) then
message = "Tally dimensions do not match in state point."
call fatal_error()
end if
@ -736,7 +736,7 @@ contains
MPI_STATUS_IGNORE, mpi_err)
deallocate(int_array)
! Read number of scores
! Read number of results
call MPI_FILE_READ(fh, temp, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpi_err)
@ -760,7 +760,7 @@ contains
! Read global tally data
call MPI_FILE_READ(fh, global_tallies, N_GLOBAL_TALLIES, &
MPI_TALLYSCORE, MPI_STATUS_IGNORE, mpi_err)
MPI_TALLYRESULT, MPI_STATUS_IGNORE, mpi_err)
! Check if tally results are present
call MPI_FILE_READ(fh, temp, 1, MPI_INTEGER, MPI_STATUS_IGNORE, mpi_err)
@ -770,11 +770,11 @@ contains
! Read sum and sum squared
if (temp(1) == 1) then
TALLY_SCORES: do i = 1, n_tallies
n = size(tallies(i) % scores, 1) * size(tallies(i) % scores, 2)
call MPI_FILE_READ(fh, tallies(i) % scores, n, MPI_TALLYSCORE, &
TALLY_RESULTS: do i = 1, n_tallies
n = size(tallies(i) % results, 1) * size(tallies(i) % results, 2)
call MPI_FILE_READ(fh, tallies(i) % results, n, MPI_TALLYRESULT, &
MPI_STATUS_IGNORE, mpi_err)
end do TALLY_SCORES
end do TALLY_RESULTS
end if
end if
@ -886,11 +886,11 @@ contains
! Read number of realizations
read(UNIT_STATE) tallies(i) % n_realizations
! Read dimensions of tally filters and scores and make sure they
! Read dimensions of tally filters and results and make sure they
! match
read(UNIT_STATE) temp(1:2)
if (temp(1) /= size(tallies(i) % scores, 1) .or. &
temp(2) /= size(tallies(i) % scores, 2)) then
if (temp(1) /= size(tallies(i) % results, 1) .or. &
temp(2) /= size(tallies(i) % results, 2)) then
message = "Tally dimensions do not match in state point."
call fatal_error()
end if
@ -927,7 +927,7 @@ contains
read(UNIT_STATE) int_array
deallocate(int_array)
! Read number of scores
! Read number of results
read(UNIT_STATE) temp(1)
! Read nuclide bins
@ -955,14 +955,14 @@ contains
! Read sum and sum squared
read(UNIT_STATE) temp(1)
if (temp(1) == 1) then
TALLY_SCORES: do i = 1, n_tallies
do k = 1, size(tallies(i) % scores, 2)
do j = 1, size(tallies(i) % scores, 1)
read(UNIT_STATE) tallies(i) % scores(j,k) % sum
read(UNIT_STATE) tallies(i) % scores(j,k) % sum_sq
TALLY_RESULTS: do i = 1, n_tallies
do k = 1, size(tallies(i) % results, 2)
do j = 1, size(tallies(i) % results, 1)
read(UNIT_STATE) tallies(i) % results(j,k) % sum
read(UNIT_STATE) tallies(i) % results(j,k) % sum_sq
end do
end do
end do TALLY_SCORES
end do TALLY_RESULTS
end if
end if

View file

@ -11,7 +11,7 @@ module tally
use output, only: header
use search, only: binary_search
use string, only: to_str
use tally_header, only: TallyScore, TallyMapItem, TallyMapElement
use tally_header, only: TallyResult, TallyMapItem, TallyMapElement
#ifdef MPI
use mpi
@ -73,10 +73,10 @@ contains
end if
! =======================================================================
! CALCULATE SCORES AND ACCUMULATE TALLY
! CALCULATE RESULTS AND ACCUMULATE TALLY
! If we have made it here, we have a scoring combination of bins for this
! tally -- now we need to determine where in the scores array we should
! tally -- now we need to determine where in the results array we should
! be accumulating the tally values
! Determine scoring index for this filter combination
@ -303,7 +303,7 @@ contains
! bin. However, in the case of fission, since multiple
! fission neutrons were emitted with different energies,
! multiple outgoing energy bins may have been scored to. The
! following logic treats this special case and scores to
! following logic treats this special case and results to
! multiple bins
call score_fission_eout(t, score_index)
@ -330,8 +330,8 @@ contains
end select
! Add score to tally
t % scores(score_index, filter_index) % value = &
t % scores(score_index, filter_index) % value + score
t % results(score_index, filter_index) % value = &
t % results(score_index, filter_index) % value + score
end do SCORE_LOOP
@ -400,8 +400,8 @@ contains
i_filter = sum((t % matching_bins - 1) * t % stride) + 1
! Add score to tally
t % scores(i_score, i_filter) % value = &
t % scores(i_score, i_filter) % value + score
t % results(i_score, i_filter) % value = &
t % results(i_score, i_filter) % value + score
end do
! reset outgoing energy bin and score index
@ -465,10 +465,10 @@ contains
end if
! =======================================================================
! CALCULATE SCORES AND ACCUMULATE TALLY
! CALCULATE RESULTS AND ACCUMULATE TALLY
! If we have made it here, we have a scoring combination of bins for this
! tally -- now we need to determine where in the scores array we should
! tally -- now we need to determine where in the results array we should
! be accumulating the tally values
! Determine scoring index for this filter combination
@ -561,8 +561,8 @@ contains
score_index = (k - 1)*t % n_score_bins + j
! Add score to tally
t % scores(score_index, filter_index) % value = &
t % scores(score_index, filter_index) % value + score
t % results(score_index, filter_index) % value = &
t % results(score_index, filter_index) % value + score
end do SCORE_LOOP
@ -656,8 +656,8 @@ contains
score_index = (i_nuclide - 1)*t % n_score_bins + j
! Add score to tally
t % scores(score_index, filter_index) % value = &
t % scores(score_index, filter_index) % value + score
t % results(score_index, filter_index) % value = &
t % results(score_index, filter_index) % value + score
end do SCORE_LOOP
@ -697,8 +697,8 @@ contains
score_index = n_nuclides_total*t % n_score_bins + j
! Add score to tally
t % scores(score_index, filter_index) % value = &
t % scores(score_index, filter_index) % value + score
t % results(score_index, filter_index) % value = &
t % results(score_index, filter_index) % value + score
end do MATERIAL_SCORE_LOOP
@ -986,8 +986,8 @@ contains
score_index = (b - 1)*t % n_score_bins + j
! Add score to tally
t % scores(score_index, filter_index) % value = &
t % scores(score_index, filter_index) % value + score
t % results(score_index, filter_index) % value = &
t % results(score_index, filter_index) % value + score
end do SCORE_LOOP
@ -1208,8 +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
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
t % results(1, filter_index) % value = &
t % results(1, filter_index) % value + p % wgt
end if
end do
else
@ -1220,8 +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
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
t % results(1, filter_index) % value = &
t % results(1, filter_index) % value + p % wgt
end if
end do
end if
@ -1237,8 +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
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
t % results(1, filter_index) % value = &
t % results(1, filter_index) % value + p % wgt
end if
end do
else
@ -1249,8 +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
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
t % results(1, filter_index) % value = &
t % results(1, filter_index) % value + p % wgt
end if
end do
end if
@ -1266,8 +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
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
t % results(1, filter_index) % value = &
t % results(1, filter_index) % value + p % wgt
end if
end do
else
@ -1278,8 +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
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
t % results(1, filter_index) % value = &
t % results(1, filter_index) % value + p % wgt
end if
end do
end if
@ -1403,8 +1403,8 @@ contains
end if
! Add to surface current tally
t % scores(1, filter_index) % value = &
t % scores(1, filter_index) % value + p % wgt
t % results(1, filter_index) % value = &
t % results(1, filter_index) % value + p % wgt
end if
! Calculate new coordinates
@ -1499,7 +1499,7 @@ contains
! Accumulate on master only unless run is not reduced then do it on all
if (master .or. (.not. reduce_tallies)) then
! Accumulate scores for each tally
! Accumulate results for each tally
curr_ptr => active_tallies
do while(associated(curr_ptr))
call accumulate_tally(tallies(curr_ptr % data))
@ -1507,13 +1507,13 @@ contains
end do
if (run_mode == MODE_EIGENVALUE) then
! Before accumulating scores for global_tallies, we need to get the
! Before accumulating results for global_tallies, we need to get the
! current batch estimate of k_analog for displaying to output
if (active_batches) k_batch(current_batch) = global_tallies(K_ANALOG) % value
end if
! Accumulate scores for global tallies
if (active_batches) call accumulate_score(global_tallies)
! Accumulate results for global tallies
if (active_batches) call accumulate_result(global_tallies)
end if
if (associated(curr_ptr)) nullify(curr_ptr)
@ -1530,7 +1530,7 @@ contains
integer :: n ! number of filter bins
integer :: m ! number of score bins
integer :: n_bins ! total number of bins
real(8), allocatable :: tally_temp(:,:) ! contiguous array of scores
real(8), allocatable :: tally_temp(:,:) ! contiguous array of results
real(8) :: global_temp(N_GLOBAL_TALLIES)
real(8) :: dummy ! temporary receive buffer for non-root reduces
type(TallyObject), pointer :: t => null()
@ -1546,7 +1546,7 @@ contains
allocate(tally_temp(m,n))
tally_temp = t % scores(:,:) % value
tally_temp = t % results(:,:) % value
if (master) then
! The MPI_IN_PLACE specifier allows the master to copy values into
@ -1555,14 +1555,14 @@ contains
MPI_SUM, 0, MPI_COMM_WORLD, mpi_err)
! Transfer values to value on master
t % scores(:,:) % value = tally_temp
t % results(:,:) % value = tally_temp
else
! Receive buffer not significant at other processors
call MPI_REDUCE(tally_temp, dummy, n_bins, MPI_REAL8, &
MPI_SUM, 0, MPI_COMM_WORLD, mpi_err)
! Reset value on other processors
t % scores(:,:) % value = 0
t % results(:,:) % value = 0
end if
deallocate(tally_temp)
@ -1620,14 +1620,14 @@ contains
t % n_realizations = t % n_realizations + n_procs
end if
! Accumulate each TallyScore
call accumulate_score(t % scores)
! Accumulate each TallyResult
call accumulate_result(t % results)
end subroutine accumulate_tally
!===============================================================================
! TALLY_STATISTICS computes the mean and standard deviation of the mean of each
! tally and stores them in the val and val_sq attributes of the TallyScores
! tally and stores them in the val and val_sq attributes of the TallyResults
! respectively
!===============================================================================
@ -1640,72 +1640,72 @@ contains
do i = 1, n_tallies
t => tallies(i)
call statistics_score(t % scores, t % n_realizations)
call statistics_result(t % results, t % n_realizations)
end do
! Calculate statistics for global tallies
call statistics_score(global_tallies, n_realizations)
call statistics_result(global_tallies, n_realizations)
end subroutine tally_statistics
!===============================================================================
! ACCUMULATE_SCORE accumulates scores from many histories (or many generations)
! ACCUMULATE_RESULT accumulates results from many histories (or many generations)
! into a single realization of a random variable.
!===============================================================================
elemental subroutine accumulate_score(score)
elemental subroutine accumulate_result(this)
type(TallyScore), intent(inout) :: score
type(TallyResult), intent(inout) :: this
real(8) :: val
! Add the sum and square of the sum of contributions from a tally score to
! Add the sum and square of the sum of contributions from a tally result to
! the variables sum and sum_sq. This will later allow us to calculate a
! variance on the tallies.
val = score % value/total_weight
score % sum = score % sum + val
score % sum_sq = score % sum_sq + val*val
val = this % value/total_weight
this % sum = this % sum + val
this % sum_sq = this % sum_sq + val*val
! Reset the single batch estimate
score % value = ZERO
this % value = ZERO
end subroutine accumulate_score
end subroutine accumulate_result
!===============================================================================
! STATISTICS_SCORE determines the sample mean and the standard deviation of the
! mean for a TallyScore.
! STATISTICS_RESULT determines the sample mean and the standard deviation of the
! mean for a TallyResult.
!===============================================================================
elemental subroutine statistics_score(score, n)
elemental subroutine statistics_result(this, n)
type(TallyScore), intent(inout) :: score
integer, intent(in) :: n
type(TallyResult), intent(inout) :: this
integer, intent(in) :: n
! Calculate sample mean and standard deviation of the mean -- note that we
! have used Bessel's correction so that the estimator of the variance of the
! sample mean is unbiased.
score % sum = score % sum/n
score % sum_sq = sqrt((score % sum_sq/n - score % sum * &
score % sum) / (n - 1))
this % sum = this % sum/n
this % sum_sq = sqrt((this % sum_sq/n - this % sum * &
this % sum) / (n - 1))
end subroutine statistics_score
end subroutine statistics_result
!===============================================================================
! RESET_SCORE zeroes out the value and accumulated sum and sum-squared for a
! single TallyScore.
! RESET_RESULT zeroes out the value and accumulated sum and sum-squared for a
! single TallyResult.
!===============================================================================
elemental subroutine reset_score(score)
elemental subroutine reset_result(this)
type(TallyScore), intent(inout) :: score
type(TallyResult), intent(inout) :: this
score % value = ZERO
score % sum = ZERO
score % sum_sq = ZERO
this % value = ZERO
this % sum = ZERO
this % sum_sq = ZERO
end subroutine reset_score
end subroutine reset_result
!===============================================================================
! SETUP_ACTIVE_USERTALLIES

View file

@ -35,14 +35,14 @@ module tally_header
end type TallyMap
!===============================================================================
! TALLYSCORE provides accumulation of scores in a particular tally bin
! TALLYRESULT provides accumulation of results in a particular tally bin
!===============================================================================
type TallyScore
type TallyResult
real(8) :: value = 0.
real(8) :: sum = 0.
real(8) :: sum_sq = 0.
end type TallyScore
end type TallyResult
!===============================================================================
! TALLYFILTER describes a filter that limits what events score to a tally. For
@ -59,8 +59,8 @@ module tally_header
!===============================================================================
! TALLYOBJECT describes a user-specified tally. The region of phase space to
! tally in is given by the TallyBins and the scores are stored in a TallyScore
! array.
! tally in is given by the TallyFilters and the results are stored in a
! TallyResult array.
!===============================================================================
type TallyObject
@ -77,10 +77,10 @@ module tally_header
integer :: n_filters ! Number of filters
type(TallyFilter), allocatable :: filters(:) ! Filter data (type/bins)
! The stride attribute is used for determining the index in the scores
! The stride attribute is used for determining the index in the results
! array for a matching_bin combination. Since multiple dimensions are
! mapped onto one dimension in the scores array, the stride attribute gives
! the stride for a given filter type within the scores array
! mapped onto one dimension in the results array, the stride attribute gives
! the stride for a given filter type within the results array
integer, allocatable :: matching_bins(:)
integer, allocatable :: stride(:)
@ -100,14 +100,14 @@ module tally_header
integer :: n_score_bins = 0
integer, allocatable :: score_bins(:)
! Scores for each bin -- the first dimenion of the array is for scores
! Results for each bin -- the first dimension of the array is for scores
! (e.g. flux, total reaction rate, fission reaction rate, etc.) and the
! second dimension of the array is for the combination of filters
! (e.g. specific cell, specific energy group, etc.)
integer :: total_filter_bins
integer :: total_score_bins
type(TallyScore), allocatable :: scores(:,:)
type(TallyResult), allocatable :: results(:,:)
! reset property - allows a tally to be reset after every batch
logical :: reset = .false.

View file

@ -25,7 +25,7 @@ contains
!===============================================================================
! SETUP_TALLY_ARRAYS allocates and populates several member arrays of the
! TallyObject derived type, including stride, matching_bins, and scores.
! TallyObject derived type, including stride, matching_bins, and results.
!===============================================================================
subroutine setup_tally_arrays()
@ -57,8 +57,8 @@ contains
t % total_filter_bins = n
t % total_score_bins = t % n_score_bins * t % n_nuclide_bins
! Allocate scores array
allocate(t % scores(t % total_score_bins, t % total_filter_bins))
! Allocate results array
allocate(t % results(t % total_score_bins, t % total_filter_bins))
end do TALLY_LOOP
@ -68,7 +68,7 @@ contains
! SETUP_TALLY_MAPS creates a map that allows a quick determination of which
! tallies and bins need to be scored to when a particle makes a collision. This
! subroutine also sets the stride attribute for each tally as well as allocating
! storage for the scores array.
! storage for the results array.
!===============================================================================
subroutine setup_tally_maps()

View file

@ -81,7 +81,7 @@ class StatePoint(BinaryFile):
# Set flags for what data was read
self._metadata = False
self._values = False
self._results = False
self._source = False
# Initialize arrays for meshes and tallies
@ -194,7 +194,7 @@ class StatePoint(BinaryFile):
# Set flag indicating metadata has already been read
self._metadata = True
def read_values(self):
def read_results(self):
# Check whether metadata has been read
if not self._metadata:
self._read_metadata()
@ -215,16 +215,16 @@ class StatePoint(BinaryFile):
for t in self.tallies:
n = t.total_score_bins * t.total_filter_bins
t.values = np.array(self._get_double(2*n))
t.values.shape = (t.total_filter_bins, t.total_score_bins, 2)
t.results = np.array(self._get_double(2*n))
t.results.shape = (t.total_filter_bins, t.total_score_bins, 2)
# Indicate that tally values have been read
self._values = True
# Indicate that tally results have been read
self._results = True
def read_source(self):
# Check whether tally values have been read
if not self._values:
self.read_values()
# Check whether tally results have been read
if not self._results:
self.read_results()
for i in range(self.n_particles):
s = SourceSite()
@ -274,18 +274,18 @@ class StatePoint(BinaryFile):
# Regular tallies
for t in self.tallies:
for i in range(t.values.shape[0]):
for j in range(t.values.shape[1]):
for i in range(t.results.shape[0]):
for j in range(t.results.shape[1]):
# Get sum and sum of squares
s, s2 = t.values[i,j]
s, s2 = t.results[i,j]
# Calculate sample mean and replace value
s /= n
t.values[i,j,0] = s
t.results[i,j,0] = s
# Calculate standard deviation
if s != 0.0:
t.values[i,j,1] = t_value*sqrt((s2/n - s*s)/(n-1))
t.results[i,j,1] = t_value*sqrt((s2/n - s*s)/(n-1))
def get_value(self, tally_index, spec_list, score_index):
"""Returns a tally score given a list of filters to satisfy.
@ -305,14 +305,14 @@ class StatePoint(BinaryFile):
score_index : int
Index corresponding to score for tally, i.e. the second index in
Tally.values[:,:,:].
Tally.results[:,:,:].
"""
# Get Tally object given the index
t = self.tallies[tally_index]
# Initialize index for filter in Tally.values[:,:,:]
# Initialize index for filter in Tally.results[:,:,:]
filter_index = 0
# Loop over specified filters in spec_list
@ -335,7 +335,7 @@ class StatePoint(BinaryFile):
else:
filter_index += f_index*t.filters[f_type].stride
# Return the desired result from Tally.values. This could be the sum and
# Return the desired result from Tally.results. This could be the sum and
# sum of squares, or it could be mean and stdev if self.generate_stdev()
# has been called already.
return t.values[filter_index, score_index]
return t.results[filter_index, score_index]

View file

@ -17,8 +17,8 @@ sp1 = StatePoint(path1)
sp2 = StatePoint(path2)
# Read tally results
sp1.read_values()
sp2.read_values()
sp1.read_results()
sp2.read_results()
# Compare header information
assert sp1.revision == sp2.revision
@ -71,7 +71,7 @@ for t1, t2 in zip(sp1.tallies, sp2.tallies):
assert t1.scores == t2.scores
# Compare tally results
assert_allclose(t1.values, t2.values)
assert_allclose(t1.results, t2.results)
# If criticality, compare source sites
if sp1.run_mode == 2: