diff --git a/src/tally.F90 b/src/tally.F90 index 4e5f1fcc01..bfaf360e8c 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -95,7 +95,7 @@ contains ! scores array for tally score_bins = t % n_score_bins t % n_total_bins = filter_bins - allocate(t % scores(filter_bins, score_bins)) + allocate(t % scores(score_bins, filter_bins)) ! All the remaining logic is for non-surface-current tallies so we can ! safely skip it @@ -189,7 +189,7 @@ contains ! Allocate scores for tally t % n_total_bins = filter_bins - allocate(t % scores(filter_bins, score_bins)) + allocate(t % scores(score_bins, filter_bins)) end do @@ -450,7 +450,7 @@ contains end select ! Add score to tally - call add_to_score(t % scores(score_index, j), score) + call add_to_score(t % scores(j, score_index), score) end do @@ -511,7 +511,7 @@ contains score_index = sum((bins - 1) * t % stride) + 1 ! Add score to tally - call add_to_score(t % scores(score_index, j), score) + call add_to_score(t % scores(j, score_index), score) end do ! reset outgoing energy bin and score index @@ -598,7 +598,7 @@ contains end select ! Add score to tally - call add_to_score(t % scores(score_index, j), score) + call add_to_score(t % scores(j, score_index), score) end do @@ -838,7 +838,7 @@ contains end select ! Add score to tally - call add_to_score(t % scores(score_index, i), score) + call add_to_score(t % scores(i, score_index), score) end do SCORE_LOOP end if @@ -1057,7 +1057,7 @@ contains bins(SURF_FILTER_SURFACE) = OUT_TOP bins(1:3) = ijk0 + 1 score_index = sum((bins - 1) * t % stride) + 1 - call add_to_score(t % scores(score_index, 1), p % wgt) + call add_to_score(t % scores(1, score_index), p % wgt) end if end do else @@ -1067,7 +1067,7 @@ contains bins(SURF_FILTER_SURFACE) = IN_TOP bins(1:3) = ijk0 + 1 score_index = sum((bins - 1) * t % stride) + 1 - call add_to_score(t % scores(score_index, 1), p % wgt) + call add_to_score(t % scores(1, score_index), p % wgt) end if end do end if @@ -1081,7 +1081,7 @@ contains bins(SURF_FILTER_SURFACE) = OUT_FRONT bins(1:3) = ijk0 + 1 score_index = sum((bins - 1) * t % stride) + 1 - call add_to_score(t % scores(score_index, 1), p % wgt) + call add_to_score(t % scores(1, score_index), p % wgt) end if end do else @@ -1091,7 +1091,7 @@ contains bins(SURF_FILTER_SURFACE) = IN_FRONT bins(1:3) = ijk0 + 1 score_index = sum((bins - 1) * t % stride) + 1 - call add_to_score(t % scores(score_index, 1), p % wgt) + call add_to_score(t % scores(1, score_index), p % wgt) end if end do end if @@ -1105,7 +1105,7 @@ contains bins(SURF_FILTER_SURFACE) = OUT_RIGHT bins(1:3) = ijk0 + 1 score_index = sum((bins - 1) * t % stride) + 1 - call add_to_score(t % scores(score_index, 1), p % wgt) + call add_to_score(t % scores(1, score_index), p % wgt) end if end do else @@ -1115,7 +1115,7 @@ contains bins(SURF_FILTER_SURFACE) = IN_RIGHT bins(1:3) = ijk0 + 1 score_index = sum((bins - 1) * t % stride) + 1 - call add_to_score(t % scores(score_index, 1), p % wgt) + call add_to_score(t % scores(1, score_index), p % wgt) end if end do end if @@ -1231,7 +1231,7 @@ contains end if ! Add to surface current tally - call add_to_score(t % scores(score_index, 1), p % wgt) + call add_to_score(t % scores(1, score_index), p % wgt) end if ! Calculate new coordinates @@ -1353,11 +1353,11 @@ contains do i = 1, n_tallies t => tallies(i) - n = t % n_total_bins m = t % n_score_bins - n_bins = n*m + n = t % n_total_bins + n_bins = m*n - allocate(tally_temp(n,m)) + allocate(tally_temp(m,n)) tally_temp = t % scores(:,:) % value @@ -1437,11 +1437,11 @@ contains do i = 1, n_tallies t => tallies(i) - n = t % n_total_bins m = t % n_score_bins - n_bins = n*m*2 + n = t % n_total_bins + n_bins = m*n*2 - allocate(tally_temp(2,n,m)) + allocate(tally_temp(2,m,n)) tally_temp(1,:,:) = t % scores(:,:) % sum tally_temp(2,:,:) = t % scores(:,:) % sum_sq @@ -1639,8 +1639,8 @@ contains do k = 1, t % n_score_bins write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A,"+/- ",A)') & repeat(" ", indent), score_name(abs(t % score_bins(k) % scalar)), & - to_str(t % scores(score_index,k) % sum), & - trim(to_str(t % scores(score_index,k) % sum_sq)) + to_str(t % scores(k,score_index) % sum), & + trim(to_str(t % scores(k,score_index) % sum_sq)) end do indent = indent - 2 @@ -1716,15 +1716,15 @@ contains score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Outgoing Current to Left", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) bins(SURF_FILTER_SURFACE) = OUT_RIGHT score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Incoming Current from Left", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) ! Right Surface bins(1:3) = (/ i, j, k /) + 1 @@ -1732,15 +1732,15 @@ contains score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Incoming Current from Right", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) bins(SURF_FILTER_SURFACE) = OUT_RIGHT score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Outgoing Current to Right", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) ! Back Surface bins(1:3) = (/ i, j-1, k /) + 1 @@ -1748,15 +1748,15 @@ contains score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Outgoing Current to Back", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) bins(SURF_FILTER_SURFACE) = OUT_FRONT score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Incoming Current from Back", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) ! Front Surface bins(1:3) = (/ i, j, k /) + 1 @@ -1764,15 +1764,15 @@ contains score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Incoming Current from Front", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) bins(SURF_FILTER_SURFACE) = OUT_FRONT score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Outgoing Current to Front", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) ! Bottom Surface bins(1:3) = (/ i, j, k-1 /) + 1 @@ -1780,15 +1780,15 @@ contains score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Outgoing Current to Bottom", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) bins(SURF_FILTER_SURFACE) = OUT_TOP score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Incoming Current from Bottom", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) ! Top Surface bins(1:3) = (/ i, j, k /) + 1 @@ -1796,15 +1796,15 @@ contains score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Incoming Current from Top", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) bins(SURF_FILTER_SURFACE) = OUT_TOP score_index = sum((bins - 1) * t % stride) + 1 write(UNIT=UNIT_TALLY, FMT='(5X,A,T35,A,"+/- ",A)') & "Outgoing Current to Top", & - to_str(t % scores(score_index,1) % sum), & - trim(to_str(t % scores(score_index,1) % sum_sq)) + to_str(t % scores(1,score_index) % sum), & + trim(to_str(t % scores(1,score_index) % sum_sq)) end do end do diff --git a/src/tally_header.F90 b/src/tally_header.F90 index fce21943e7..fdf487aac4 100644 --- a/src/tally_header.F90 +++ b/src/tally_header.F90 @@ -99,11 +99,10 @@ module tally_header type(TallyFilter), pointer :: score_bins(:) => null() integer :: n_score_bins = 0 - ! Scores for each bin -- the most natural way to have scores would be to - ! have a dimension for each different type of bin, but older Fortran - ! standards are limited to 7 dimensions or less, so instead we map a - ! combination of the filter bins into one integer and have that as the - ! index into a one-dimensional array + ! Scores for each bin -- the first dimenion 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.) type(TallyScore), allocatable :: scores(:,:)