From e8423ceca4d7670e36c39dffd364240758e2354f Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Sun, 21 Jan 2018 19:46:55 +0000 Subject: [PATCH 01/16] single-threaded original exec with tally-opts --- CMakeLists.txt | 8 ++++---- src/simulation.F90 | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5150745b6..f0395d69f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ endif() # Command line options #=============================================================================== -option(openmp "Enable shared-memory parallelism with OpenMP" ON) +option(openmp "Enable shared-memory parallelism with OpenMP" OFF) option(profile "Compile with profiling flags" OFF) option(debug "Compile with debug flags" OFF) option(optimize "Turn on all compiler optimization flags" OFF) @@ -116,12 +116,12 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) endif() # GCC compiler options - list(APPEND f90flags -cpp -std=f2008ts -fbacktrace -O2) + list(APPEND f90flags -cpp -std=f2008ts -fbacktrace -O2 -fstack-arrays -g) if(debug) list(REMOVE_ITEM f90flags -O2) - list(APPEND f90flags -g -Wall -Wno-unused-dummy-argument -pedantic + list(APPEND f90flags -g -enable-checking -fbacktrace -Wall -Wno-unused-dummy-argument -pedantic -fbounds-check -ffpe-trap=invalid,overflow,underflow) - list(APPEND ldflags -g) + list(APPEND ldflags -g -v -da -Q) endif() if(profile) list(APPEND f90flags -pg) diff --git a/src/simulation.F90 b/src/simulation.F90 index ef29e7832b..e86ea960f3 100644 --- a/src/simulation.F90 +++ b/src/simulation.F90 @@ -498,9 +498,9 @@ contains ! Broadcast tally results so that each process has access to results if (allocated(tallies)) then do i = 1, size(tallies) - n = size(tallies(i) % obj % results) - call MPI_BCAST(tallies(i) % obj % results, n, MPI_DOUBLE, 0, & - mpi_intracomm, mpi_err) + !n = size(tallies(i) % obj % results) + !call MPI_BCAST(tallies(i) % obj % results, n, MPI_DOUBLE, 0, & + ! mpi_intracomm, mpi_err) end do end if From 281d6a6aa4be11a0c87959983a0fcfc41be57507 Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Sat, 27 Jan 2018 17:33:53 +0000 Subject: [PATCH 02/16] adding shared-memory --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0395d69f8..787fb1b07d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,10 +30,10 @@ endif() # Command line options #=============================================================================== -option(openmp "Enable shared-memory parallelism with OpenMP" OFF) +option(openmp "Enable shared-memory parallelism with OpenMP" ON) option(profile "Compile with profiling flags" OFF) option(debug "Compile with debug flags" OFF) -option(optimize "Turn on all compiler optimization flags" OFF) +option(optimize "Turn on all compiler optimization flags" ON) option(coverage "Compile with coverage analysis flags" OFF) option(mpif08 "Use Fortran 2008 MPI interface" OFF) From 22efc11d8f98355665f1e038cf039a2e4c6b8183 Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Sun, 28 Jan 2018 02:40:20 +0000 Subject: [PATCH 03/16] updated CMakelist --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 787fb1b07d..409a1b52dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ endif() option(openmp "Enable shared-memory parallelism with OpenMP" ON) option(profile "Compile with profiling flags" OFF) option(debug "Compile with debug flags" OFF) -option(optimize "Turn on all compiler optimization flags" ON) +option(optimize "Turn on all compiler optimization flags" OFF) option(coverage "Compile with coverage analysis flags" OFF) option(mpif08 "Use Fortran 2008 MPI interface" OFF) From 764478a446eedd9082913ae3ee7c371744ae6230 Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Thu, 29 Mar 2018 01:55:34 +0000 Subject: [PATCH 04/16] deleted "<<<<<<" --- CMakeLists.txt | 7 ------- src/simulation.F90 | 6 ------ 2 files changed, 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea2ddc52ff..04a42817bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,17 +114,10 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) endif() # GCC compiler options -<<<<<<< HEAD - list(APPEND f90flags -cpp -std=f2008ts -fbacktrace -O2 -g) - if(debug) - list(REMOVE_ITEM f90flags -O2) - list(APPEND f90flags -g -enable-checking -fbacktrace -Wall -Wno-unused-dummy-argument -pedantic -======= list(APPEND f90flags -cpp -std=f2008ts -fbacktrace -O2 -fstack-arrays) if(debug) list(REMOVE_ITEM f90flags -O2 -fstack-arrays) list(APPEND f90flags -g -Wall -Wno-unused-dummy-argument -pedantic ->>>>>>> 47fbf8282ea94c138f75219bd10fdb31501d3fb7 -fbounds-check -ffpe-trap=invalid,overflow,underflow) list(APPEND ldflags -g -v -da -Q) endif() diff --git a/src/simulation.F90 b/src/simulation.F90 index e1a1dcc750..8fe4f025c3 100644 --- a/src/simulation.F90 +++ b/src/simulation.F90 @@ -507,11 +507,6 @@ contains ! Broadcast tally results so that each process has access to results if (allocated(tallies)) then do i = 1, size(tallies) -<<<<<<< HEAD - n = size(tallies(i) % obj % results) - call MPI_BCAST(tallies(i) % obj % results, n, MPI_DOUBLE, 0, & - mpi_intracomm, mpi_err) -======= associate (results => tallies(i) % obj % results) ! Create a new datatype that consists of all values for a given filter ! bin and then use that to broadcast. This is done to minimize the @@ -524,7 +519,6 @@ contains call MPI_BCAST(results, n, result_block, 0, mpi_intracomm, mpi_err) call MPI_TYPE_FREE(result_block, mpi_err) end associate ->>>>>>> 47fbf8282ea94c138f75219bd10fdb31501d3fb7 end do end if From f704a8a2405978a16c202fbda3c2a21db62b5619 Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Thu, 12 Apr 2018 17:51:53 +0000 Subject: [PATCH 05/16] commented out lines broadcasting tally results. MPICH bug that causes simulations on ecp-benchmarks to crash. --- src/simulation.F90 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/simulation.F90 b/src/simulation.F90 index 8fe4f025c3..83b7ae3ced 100644 --- a/src/simulation.F90 +++ b/src/simulation.F90 @@ -511,13 +511,13 @@ contains ! Create a new datatype that consists of all values for a given filter ! bin and then use that to broadcast. This is done to minimize the ! chance of the 'count' argument of MPI_BCAST exceeding 2**31 - n = size(results, 3) - count_per_filter = size(results, 1) * size(results, 2) - call MPI_TYPE_CONTIGUOUS(count_per_filter, MPI_DOUBLE, & - result_block, mpi_err) - call MPI_TYPE_COMMIT(result_block, mpi_err) - call MPI_BCAST(results, n, result_block, 0, mpi_intracomm, mpi_err) - call MPI_TYPE_FREE(result_block, mpi_err) + !n = size(results, 3) + !count_per_filter = size(results, 1) * size(results, 2) + !call MPI_TYPE_CONTIGUOUS(count_per_filter, MPI_DOUBLE, & + ! result_block, mpi_err) + !call MPI_TYPE_COMMIT(result_block, mpi_err) + !call MPI_BCAST(results, n, result_block, 0, mpi_intracomm, mpi_err) + !call MPI_TYPE_FREE(result_block, mpi_err) end associate end do end if From 6db7cc2977a7821428e0898eb00af7dd8bc6062e Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Thu, 12 Apr 2018 19:06:50 +0000 Subject: [PATCH 06/16] making sure broadcast is commented out. --- src/simulation.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simulation.F90 b/src/simulation.F90 index 83b7ae3ced..c35da3cb35 100644 --- a/src/simulation.F90 +++ b/src/simulation.F90 @@ -514,7 +514,7 @@ contains !n = size(results, 3) !count_per_filter = size(results, 1) * size(results, 2) !call MPI_TYPE_CONTIGUOUS(count_per_filter, MPI_DOUBLE, & - ! result_block, mpi_err) + ! result_block, mpi_err) !call MPI_TYPE_COMMIT(result_block, mpi_err) !call MPI_BCAST(results, n, result_block, 0, mpi_intracomm, mpi_err) !call MPI_TYPE_FREE(result_block, mpi_err) From 00a68d8079e41a5d910287de9f2d349fd935dc10 Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Mon, 30 Apr 2018 19:55:30 +0000 Subject: [PATCH 07/16] adding -g option to CMakeList.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca42bb5ba1..0e3c47c0b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,7 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) endif() # GCC compiler options - list(APPEND f90flags -cpp -std=f2008ts -fbacktrace -O2 -fstack-arrays) + list(APPEND f90flags -cpp -std=f2008ts -fbacktrace -O2 -fstack-arrays -g) if(debug) list(REMOVE_ITEM f90flags -O2 -fstack-arrays) list(APPEND f90flags -g -Wall -Wno-unused-dummy-argument -pedantic From 0af6b4bee0766f63407fea22791f0c9780e445a2 Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Thu, 24 May 2018 20:27:15 +0000 Subject: [PATCH 08/16] 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 d1893bf9e1..e6dcfe7554 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 ebabe5cdbc..487c71545a 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 From 6a53e61c966714d007c3b052eac5b979da0020eb Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Mon, 28 May 2018 13:24:30 +0000 Subject: [PATCH 09/16] Updating tallies.xml --- src/tallies/tally.F90 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tallies/tally.F90 b/src/tallies/tally.F90 index ef8b5915c1..fb3a15d544 100644 --- a/src/tallies/tally.F90 +++ b/src/tallies/tally.F90 @@ -1075,17 +1075,17 @@ contains ! Determine index in NuclideMicroXS % reaction array select case (score_bin) case (N_2N) - m = 1 - case (N_3N) - m = 2 - case (N_4N) - m = 3 - case (N_GAMMA) m = 4 - case (N_P) + case (N_3N) m = 5 - case (N_A) + case (N_4N) m = 6 + case (N_GAMMA) + m = 1 + case (N_P) + m = 2 + case (N_A) + m = 3 end select if (i_nuclide > 0) then From 9857f4623155b9b700da179cb39e5d9afc650b9d Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Mon, 28 May 2018 18:13:59 +0000 Subject: [PATCH 10/16] making sure CMakelist.f90 and simulation.f90 match their corresponding files in the develop branch. --- CMakeLists.txt | 4 ++-- src/simulation.F90 | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9834d49a6e..dc5558de18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,12 +110,12 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) endif() # GCC compiler options - list(APPEND f90flags -cpp -std=f2008ts -fbacktrace -O2 -fstack-arrays -g) + list(APPEND f90flags -cpp -std=f2008ts -fbacktrace -O2 -fstack-arrays) if(debug) list(REMOVE_ITEM f90flags -O2 -fstack-arrays) list(APPEND f90flags -g -Wall -Wno-unused-dummy-argument -pedantic -fbounds-check -ffpe-trap=invalid,overflow,underflow) - list(APPEND ldflags -g -v -da -Q) + list(APPEND ldflags -g) endif() if(profile) list(APPEND f90flags -pg) diff --git a/src/simulation.F90 b/src/simulation.F90 index 203e2056a2..cdb69efb40 100644 --- a/src/simulation.F90 +++ b/src/simulation.F90 @@ -513,13 +513,13 @@ contains ! Create a new datatype that consists of all values for a given filter ! bin and then use that to broadcast. This is done to minimize the ! chance of the 'count' argument of MPI_BCAST exceeding 2**31 - !n = size(results, 3) - !count_per_filter = size(results, 1) * size(results, 2) - !call MPI_TYPE_CONTIGUOUS(count_per_filter, MPI_DOUBLE, & - ! result_block, mpi_err) - !call MPI_TYPE_COMMIT(result_block, mpi_err) - !call MPI_BCAST(results, n, result_block, 0, mpi_intracomm, mpi_err) - !call MPI_TYPE_FREE(result_block, mpi_err) + n = size(results, 3) + count_per_filter = size(results, 1) * size(results, 2) + call MPI_TYPE_CONTIGUOUS(count_per_filter, MPI_DOUBLE, & + result_block, mpi_err) + call MPI_TYPE_COMMIT(result_block, mpi_err) + call MPI_BCAST(results, n, result_block, 0, mpi_intracomm, mpi_err) + call MPI_TYPE_FREE(result_block, mpi_err) end associate end do end if From 2602bef154cfef5115466c01a7cdaf7c85def6b8 Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Tue, 5 Jun 2018 19:11:45 +0000 Subject: [PATCH 11/16] fixing indentations and level-spacing. Changed index in 'nuclide_header.f90' line 891 from 4 to 1 (n,gamma) to account for the re-ordering of DEPLETION_RX. --- src/nuclide_header.F90 | 31 +++++++++++++++---------------- src/simulation.F90 | 2 +- src/tallies/tally.F90 | 12 ++++++------ 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index 487c71545a..8b71e6bf87 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -888,7 +888,7 @@ contains micro_xs % reaction(:) = ZERO ! Only non-zero reaction is (n,gamma) - micro_xs % reaction(4) = sig_a - sig_f + micro_xs % reaction(1) = sig_a - sig_f end if ! Ensure these values are set @@ -983,6 +983,18 @@ contains ! Initialize entire array to zero in case we skip ! any threshold reaction. micro_xs % reaction(:) = ZERO + + !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 !looping from element 2 to element 6. !treating (n,gamma) differently because it is not a threshold reaction. do j = 2, 6 @@ -998,25 +1010,12 @@ contains 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 + elseif (j >= 4) then + exit 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 diff --git a/src/simulation.F90 b/src/simulation.F90 index cdb69efb40..4f6163429e 100644 --- a/src/simulation.F90 +++ b/src/simulation.F90 @@ -516,7 +516,7 @@ contains n = size(results, 3) count_per_filter = size(results, 1) * size(results, 2) call MPI_TYPE_CONTIGUOUS(count_per_filter, MPI_DOUBLE, & - result_block, mpi_err) + result_block, mpi_err) call MPI_TYPE_COMMIT(result_block, mpi_err) call MPI_BCAST(results, n, result_block, 0, mpi_intracomm, mpi_err) call MPI_TYPE_FREE(result_block, mpi_err) diff --git a/src/tallies/tally.F90 b/src/tallies/tally.F90 index fb3a15d544..b245bf5249 100644 --- a/src/tallies/tally.F90 +++ b/src/tallies/tally.F90 @@ -1074,18 +1074,18 @@ contains else ! Determine index in NuclideMicroXS % reaction array select case (score_bin) - case (N_2N) - m = 4 - case (N_3N) - m = 5 - case (N_4N) - m = 6 case (N_GAMMA) m = 1 case (N_P) m = 2 case (N_A) m = 3 + case (N_2N) + m = 4 + case (N_3N) + m = 5 + case (N_4N) + m = 6 end select if (i_nuclide > 0) then From 52173756f61fb23db15fe04f33a50d17c03cd8c2 Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Fri, 15 Jun 2018 01:18:38 +0000 Subject: [PATCH 12/16] More cleaning-up, fixing style and comments. --- src/nuclide_header.F90 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index 8b71e6bf87..4a9a363517 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -985,8 +985,6 @@ contains micro_xs % reaction(:) = ZERO !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)) @@ -996,7 +994,7 @@ contains end associate end if !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 From 10bba7d5f979063567730049d392386222528124 Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Fri, 15 Jun 2018 02:44:40 +0000 Subject: [PATCH 13/16] removing trailing white-space and making sure continuation lines have 5 spaces. --- src/nuclide_header.F90 | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index 4a9a363517..967c953a04 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -978,27 +978,24 @@ contains end if end associate - ! Depletion-related reactions + !Depletion-related reactions if (need_depletion_rx) then - ! Initialize entire array to zero in case we skip - ! any threshold reaction. - micro_xs % reaction(:) = ZERO - + !Initialize entire array to zero in case we skip + !any threshold reaction. + micro_xs % reaction(:) = ZERO !there shouldn't be a threshold check for (n,gamma). 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) + xs % value(i_grid - xs % threshold + 1) + & + f * xs % value(i_grid - xs % threshold + 2) end associate end if !looping from element 2 to element 6. - do j = 2, 6 - - ! If reaction is present and energy is greater than threshold, set - ! the reaction xs appropriately + !If reaction is present and energy is greater than threshold, set + !the reaction xs appropriately i_rxn = this % reaction_index(DEPLETION_RX(j)) if (i_rxn > 0) then associate (xs => this % reactions(i_rxn) % xs(i_temp)) @@ -1006,8 +1003,8 @@ 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. + !Check if we are below the (n,2n) and/or (n,3n) reaction thresholds to + !skip remaining depletion-xs construction. elseif (j >= 4) then exit end if From 3e7aa0705f53723d3e9eeff174ec94e641ee2569 Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Fri, 15 Jun 2018 03:55:35 +0000 Subject: [PATCH 14/16] FTW, removing trail white-spaces in line 985 and 995 from nuclide-header.f90 --- src/nuclide_header.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index 967c953a04..33ad2abb62 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -982,7 +982,7 @@ contains if (need_depletion_rx) then !Initialize entire array to zero in case we skip !any threshold reaction. - micro_xs % reaction(:) = ZERO + micro_xs % reaction(:) = ZERO !there shouldn't be a threshold check for (n,gamma). i_rxn = this % reaction_index(DEPLETION_RX(1)) if (i_rxn > 0) then @@ -992,7 +992,7 @@ contains f * xs % value(i_grid - xs % threshold + 2) end associate end if - !looping from element 2 to element 6. + !looping from element 2 to element 6. do j = 2, 6 !If reaction is present and energy is greater than threshold, set !the reaction xs appropriately From aade6893b1ae0b5d2585753cff9aa5d5d8473031 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 15 Jun 2018 14:22:53 -0500 Subject: [PATCH 15/16] Update some comments, move setting zeros to (n,xn) elseif --- src/constants.F90 | 2 +- src/nuclide_header.F90 | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/constants.F90 b/src/constants.F90 index e6dcfe7554..eff1196395 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_GAMMA, N_P, N_A,N_2N, N_3N,N_4N] + 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 33ad2abb62..9406f8b06e 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -978,12 +978,10 @@ contains end if end associate - !Depletion-related reactions + ! Depletion-related reactions if (need_depletion_rx) then - !Initialize entire array to zero in case we skip - !any threshold reaction. - micro_xs % reaction(:) = ZERO - !there shouldn't be a threshold check for (n,gamma). + ! Physics says that (n,gamma) is not a threshold reaction, so we don't + ! need to specifically check its threshold index i_rxn = this % reaction_index(DEPLETION_RX(1)) if (i_rxn > 0) then associate (xs => this % reactions(i_rxn) % xs(i_temp)) @@ -992,10 +990,11 @@ contains f * xs % value(i_grid - xs % threshold + 2) end associate end if - !looping from element 2 to element 6. + + ! Loop over remaining depletion reactions do j = 2, 6 - !If reaction is present and energy is greater than threshold, set - !the reaction xs appropriately + ! If reaction is present and energy is greater than threshold, set the + ! reaction xs appropriately i_rxn = this % reaction_index(DEPLETION_RX(j)) if (i_rxn > 0) then associate (xs => this % reactions(i_rxn) % xs(i_temp)) @@ -1003,9 +1002,12 @@ 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. elseif (j >= 4) then + ! One can show that the the threshold for (n,(x+1)n) is always + ! higher than the threshold for (n,xn). Thus, if we are below + ! the threshold for, e.g., (n,2n), there is no reason to check + ! the threshold for (n,3n) and (n,4n). + micro_xs % reaction(j:6) = ZERO exit end if end associate From edb4eefbc30444820aec18a3857d8b474a8d76f1 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 15 Jun 2018 16:02:25 -0500 Subject: [PATCH 16/16] Fix initialization of depletion reaction xs --- src/nuclide_header.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index 9406f8b06e..5d046dbcc0 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -980,6 +980,9 @@ contains ! Depletion-related reactions if (need_depletion_rx) then + ! Initialize all reaction cross sections to zero + micro_xs % reaction(:) = ZERO + ! Physics says that (n,gamma) is not a threshold reaction, so we don't ! need to specifically check its threshold index i_rxn = this % reaction_index(DEPLETION_RX(1)) @@ -1007,7 +1010,6 @@ contains ! higher than the threshold for (n,xn). Thus, if we are below ! the threshold for, e.g., (n,2n), there is no reason to check ! the threshold for (n,3n) and (n,4n). - micro_xs % reaction(j:6) = ZERO exit end if end associate