From 0af6b4bee0766f63407fea22791f0c9780e445a2 Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Thu, 24 May 2018 20:27:15 +0000 Subject: [PATCH] Changed logic in depletion-xs construction to skip (n,3n) and (n,4n) if energy index is below the threshold for (n,2n). If we are above (n,2n) but below (n,3n) then we skip (n,4n) automatically. I also took (n,gamma) outside of that loop since it is not really a threshold reaction. --- src/constants.F90 | 2 +- src/nuclide_header.F90 | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/constants.F90 b/src/constants.F90 index d1893bf9e..e6dcfe755 100644 --- a/src/constants.F90 +++ b/src/constants.F90 @@ -219,7 +219,7 @@ module constants N_3HEC = 799, N_A0 = 800, N_AC = 849, N_2N0 = 875, N_2NC = 891 ! Depletion reactions - integer, parameter :: DEPLETION_RX(6) = [N_2N, N_3N, N_4N, N_GAMMA, N_P, N_A] + integer, parameter :: DEPLETION_RX(6) = [N_GAMMA, N_P, N_A,N_2N, N_3N,N_4N] ! ACE table types integer, parameter :: & diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index ebabe5cdb..487c71545 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -980,9 +980,12 @@ contains ! Depletion-related reactions if (need_depletion_rx) then - do j = 1, 6 - ! Initialize reaction xs to zero - micro_xs % reaction(j) = ZERO + ! Initialize entire array to zero in case we skip + ! any threshold reaction. + micro_xs % reaction(:) = ZERO + !looping from element 2 to element 6. + !treating (n,gamma) differently because it is not a threshold reaction. + do j = 2, 6 ! If reaction is present and energy is greater than threshold, set ! the reaction xs appropriately @@ -993,12 +996,28 @@ contains micro_xs % reaction(j) = (ONE - f) * & xs % value(i_grid - xs % threshold + 1) + & f * xs % value(i_grid - xs % threshold + 2) + ! Check if we are below the (n,2n) and/or (n,3n) reaction thresholds to + ! skip remaining depletion-xs construction. + else + if (j >= 4) then + exit + end if end if end associate end if end do + !there shouldn't be a threshold check for (n,gamma). + !I know this is not very clean but I don't want to overload the loop + !with too many conditional statements for now. + i_rxn = this % reaction_index(DEPLETION_RX(1)) + if (i_rxn > 0) then + associate (xs => this % reactions(i_rxn) % xs(i_temp)) + micro_xs % reaction(1) = (ONE - f) * & + xs % value(i_grid - xs % threshold + 1) + & + f * xs % value(i_grid - xs % threshold + 2) + end associate + end if end if - end if ! Initialize sab treatment to false