Extend xs_cdf to 0 to prevent potential out-of-bounds error

This commit is contained in:
Paul Romano 2017-03-29 11:02:42 -05:00
parent 05440f5f2a
commit a77c8eee41
3 changed files with 8 additions and 13 deletions

View file

@ -5287,7 +5287,8 @@ contains
! Build CDF for 0K elastic scattering
xs_cdf_sum = ZERO
allocate(nuc % xs_cdf(size(nuc % energy_0K)))
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

View file

@ -938,17 +938,11 @@ contains
elseif (sampling_method == RES_SCAT_ARES) then
! interpolate xs CDF since we're not exactly at the energy indices
! cdf value at lower bound attainable energy
if (i_E_low > 1) then
m = (nuc % xs_cdf(i_E_low) - nuc % xs_cdf(i_E_low - 1)) &
/ (nuc % energy_0K(i_E_low + 1) - nuc % energy_0K(i_E_low))
cdf_low = nuc % xs_cdf(i_E_low - 1) &
+ m * (E_low - nuc % energy_0K(i_E_low))
else
m = nuc % xs_cdf(i_E_low) &
/ (nuc % energy_0K(i_E_low + 1) - nuc % energy_0K(i_E_low))
cdf_low = m * (E_low - nuc % energy_0K(i_E_low))
if (E_low <= nuc % energy_0K(1)) cdf_low = ZERO
end if
m = (nuc % xs_cdf(i_E_low) - nuc % xs_cdf(i_E_low - 1)) &
/ (nuc % energy_0K(i_E_low + 1) - nuc % energy_0K(i_E_low))
cdf_low = nuc % xs_cdf(i_E_low - 1) &
+ m * (E_low - nuc % energy_0K(i_E_low))
if (E_low <= nuc % energy_0K(1)) cdf_low = ZERO
! cdf value at upper bound attainable energy
m = (nuc % xs_cdf(i_E_up) - nuc % xs_cdf(i_E_up - 1)) &

View file

@ -1,2 +1,2 @@
k-combined:
1.441041E+00 8.832991E-03
1.436406E+00 1.833812E-02