From 790682df2f3da246ed715ec44c237010fac42e8d Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 8 May 2017 17:15:46 -0500 Subject: [PATCH 1/2] Fix assignment of S(a,b) tables --- src/input_xml.F90 | 7 +++++-- tests/test_salphabeta/results_true.dat | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index a5c894d10c..fdf8494540 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -5038,6 +5038,7 @@ contains integer :: m ! position for sorting integer :: temp_nuclide ! temporary value for sorting integer :: temp_table ! temporary value for sorting + logical :: found type(VectorInt) :: i_sab_tables type(VectorInt) :: i_sab_nuclides @@ -5051,17 +5052,19 @@ contains ! In order to know which nuclide the S(a,b) table applies to, we need ! to search through the list of nuclides for one which has a matching ! name + found = .false. associate (sab => sab_tables(mat % i_sab_tables(k))) FIND_NUCLIDE: do j = 1, size(mat % nuclide) if (any(sab % nuclides == nuclides(mat % nuclide(j)) % name)) then - call i_sab_tables % push_back(k) + call i_sab_tables % push_back(mat % i_sab_tables(k)) call i_sab_nuclides % push_back(j) + found = .true. end if end do FIND_NUCLIDE end associate ! Check to make sure S(a,b) table matched a nuclide - if (find(i_sab_tables, k) == -1) then + if (.not. found) then call fatal_error("S(a,b) table " // trim(mat % & sab_names(k)) // " did not match any nuclide on material " & // trim(to_str(mat % id))) diff --git a/tests/test_salphabeta/results_true.dat b/tests/test_salphabeta/results_true.dat index 378888998e..bdfb98990f 100644 --- a/tests/test_salphabeta/results_true.dat +++ b/tests/test_salphabeta/results_true.dat @@ -1,2 +1,2 @@ k-combined: -8.465448E-01 5.743842E-03 +8.544160E-01 1.274133E-02 From 71abc38d852c7ea07c8c6280d8db4c3c6326d530 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 10 May 2017 11:23:37 -0500 Subject: [PATCH 2/2] Apply resonance scattering treatment to all nuclides if none are specified --- src/input_xml.F90 | 70 ++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index fdf8494540..6c1a40ee3a 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -5301,43 +5301,51 @@ contains subroutine assign_0K_elastic_scattering(nuc) type(Nuclide), intent(inout) :: nuc - integer :: i, j + integer :: i real(8) :: xs_cdf_sum - do i = 1, size(res_scat_nuclides) - if (nuc % name == res_scat_nuclides(i)) then - ! Make sure nuclide has 0K data - if (.not. allocated(nuc % energy_0K)) then - call fatal_error("Cannot treat " // trim(nuc % name) // " as a & - &resonant scatterer because 0 K elastic scattering data is not & - &present.") + nuc % resonant = .false. + if (allocated(res_scat_nuclides)) then + ! If resonant nuclides were specified, check the list explicitly + do i = 1, size(res_scat_nuclides) + if (nuc % name == res_scat_nuclides(i)) then + nuc % resonant = .true. + + ! Make sure nuclide has 0K data + if (.not. allocated(nuc % energy_0K)) then + call fatal_error("Cannot treat " // trim(nuc % name) // " as a & + &resonant scatterer because 0 K elastic scattering data is & + ¬ present.") + end if + + exit end if + end do + else + ! Otherwise, assume that any that have 0 K elastic scattering data are + ! resonant + nuc % resonant = allocated(nuc % energy_0K) + end if - ! Set nuclide to be resonant - nuc % resonant = .true. + if (nuc % resonant) then + ! Build CDF for 0K elastic scattering + xs_cdf_sum = ZERO + allocate(nuc % xs_cdf(0:size(nuc % energy_0K))) + nuc % xs_cdf(0) = ZERO - ! Build CDF for 0K elastic scattering - xs_cdf_sum = ZERO - allocate(nuc % xs_cdf(0:size(nuc % energy_0K))) - nuc % xs_cdf(0) = ZERO - - associate (E => nuc % energy_0K, xs => nuc % elastic_0K) - do j = 1, size(E) - 1 - ! Negative cross sections result in a CDF that is not monotonically - ! increasing. Set all negative xs values to zero. - if (xs(j) < ZERO) xs(j) = ZERO - - ! build xs cdf - xs_cdf_sum = xs_cdf_sum + (sqrt(E(j))*xs(j) + sqrt(E(j+1))*xs(j+1))& - / TWO * (E(j+1) - E(j)) - nuc % xs_cdf(j) = xs_cdf_sum - end do - end associate - - exit - end if - end do + associate (E => nuc % energy_0K, xs => nuc % elastic_0K) + do i = 1, size(E) - 1 + ! Negative cross sections result in a CDF that is not monotonically + ! increasing. Set all negative xs values to zero. + if (xs(i) < ZERO) xs(i) = ZERO + ! build xs cdf + xs_cdf_sum = xs_cdf_sum + (sqrt(E(i))*xs(i) + sqrt(E(i+1))*xs(i+1))& + / TWO * (E(i+1) - E(i)) + nuc % xs_cdf(i) = xs_cdf_sum + end do + end associate + end if end subroutine assign_0K_elastic_scattering !===============================================================================