Don't calculate depletion reaction cross sections unless tallies need them

This commit is contained in:
Paul Romano 2017-12-23 16:02:48 +07:00
parent ae2d872143
commit a793b9a087
6 changed files with 22 additions and 13 deletions

View file

@ -39,9 +39,6 @@ contains
real(8) :: atom_density ! atom density of a nuclide
real(8) :: sab_frac ! fraction of atoms affected by S(a,b)
logical :: check_sab ! should we check for S(a,b) table?
logical :: in_active ! are we in active batches?
in_active = (active_tallies % size() > 0)
! Set all material macroscopic cross sections to zero
material_xs % total = ZERO
@ -105,7 +102,7 @@ contains
.or. i_sab /= micro_xs(i_nuclide) % index_sab &
.or. sab_frac /= micro_xs(i_nuclide) % sab_frac) then
call calculate_nuclide_xs(i_nuclide, i_sab, p % E, i_grid, &
p % sqrtkT, sab_frac, in_active)
p % sqrtkT, sab_frac)
end if
! ======================================================================
@ -144,7 +141,7 @@ contains
!===============================================================================
subroutine calculate_nuclide_xs(i_nuclide, i_sab, E, i_log_union, sqrtkT, &
sab_frac, in_active)
sab_frac)
integer, intent(in) :: i_nuclide ! index into nuclides array
integer, intent(in) :: i_sab ! index into sab_tables array
real(8), intent(in) :: E ! energy
@ -152,7 +149,6 @@ contains
! material union energy grid
real(8), intent(in) :: sqrtkT ! square root of kT, material dependent
real(8), intent(in) :: sab_frac ! fraction of atoms affected by S(a,b)
logical, intent(in) :: in_active
logical :: use_mp ! true if XS can be calculated with windowed multipole
integer :: i_temp ! index for temperature
@ -197,7 +193,7 @@ contains
micro_xs(i_nuclide) % nu_fission = ZERO
end if
if (in_active) then
if (need_depletion_rx) then
! Initialize all reaction cross sections to zero
micro_xs(i_nuclide) % reaction(:) = ZERO
@ -297,7 +293,7 @@ contains
end associate
! Depletion-related reactions
if (in_active) then
if (need_depletion_rx) then
do j = 1, 6
! Initialize reaction xs to zero
micro_xs(i_nuclide) % reaction(j) = ZERO

View file

@ -3048,12 +3048,15 @@ contains
&please remove")
case ('n2n', '(n,2n)')
t % score_bins(j) = N_2N
t % depletion_rx = .true.
case ('n3n', '(n,3n)')
t % score_bins(j) = N_3N
t % depletion_rx = .true.
case ('n4n', '(n,4n)')
t % score_bins(j) = N_4N
t % depletion_rx = .true.
case ('absorption')
t % score_bins(j) = SCORE_ABSORPTION
@ -3239,8 +3242,10 @@ contains
t % score_bins(j) = N_NC
case ('(n,gamma)')
t % score_bins(j) = N_GAMMA
t % depletion_rx = .true.
case ('(n,p)')
t % score_bins(j) = N_P
t % depletion_rx = .true.
case ('(n,d)')
t % score_bins(j) = N_D
case ('(n,t)')
@ -3249,6 +3254,7 @@ contains
t % score_bins(j) = N_3HE
case ('(n,a)')
t % score_bins(j) = N_A
t % depletion_rx = .true.
case ('(n,2a)')
t % score_bins(j) = N_2A
case ('(n,3a)')

View file

@ -451,8 +451,9 @@ contains
end if
end if
! Reset current batch
! Reset global variables
current_batch = 0
need_depletion_rx = .false.
! Set flag indicating initialization is done
simulation_initialized = .true.
@ -535,7 +536,8 @@ contains
if (check_overlaps) call print_overlap_check()
end if
! Reset initialization flag
! Reset flags
need_depletion_rx = .false.
simulation_initialized = .false.
end subroutine openmc_simulation_finalize

View file

@ -20,10 +20,11 @@ module simulation_header
! ============================================================================
! SIMULATION VARIABLES
integer :: current_batch ! current batch
integer :: current_gen ! current generation within a batch
integer :: total_gen = 0 ! total number of generations simulated
integer :: current_batch ! current batch
integer :: current_gen ! current generation within a batch
integer :: total_gen = 0 ! total number of generations simulated
logical(C_BOOL), bind(C) :: simulation_initialized = .false.
logical :: need_depletion_rx ! need to calculate depletion reaction rx?
! ============================================================================
! TALLY PRECISION TRIGGER VARIABLES

View file

@ -4381,6 +4381,9 @@ contains
elseif (t % type == TALLY_SURFACE) then
call active_surface_tallies % push_back(i)
end if
! Check if tally contains depletion reactions and if so, set flag
if (t % depletion_rx) need_depletion_rx = .true.
end if
end associate
end do

View file

@ -48,6 +48,7 @@ module tally_header
integer :: estimator = ESTIMATOR_TRACKLENGTH ! collision, track-length
real(8) :: volume ! volume of region
logical :: active = .false.
logical :: depletion_rx = .false. ! has depletion reactions, e.g. (n,2n)
integer, allocatable :: filter(:) ! index in filters array
! The stride attribute is used for determining the index in the results