From 21585e937cbcae426324f497ce8492155807104a Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 12 Jan 2018 15:44:30 -0600 Subject: [PATCH] Remove elastic from sum_xs and caches --- src/cross_section.F90 | 29 ++++++++++++++++------------- src/nuclide_header.F90 | 16 +++++----------- src/physics.F90 | 12 ++++++++++++ src/tallies/tally.F90 | 14 -------------- 4 files changed, 33 insertions(+), 38 deletions(-) diff --git a/src/cross_section.F90 b/src/cross_section.F90 index 0a944f2118..82e3c00e8b 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -42,7 +42,6 @@ contains ! Set all material macroscopic cross sections to zero material_xs % total = ZERO - material_xs % elastic = ZERO material_xs % absorption = ZERO material_xs % fission = ZERO material_xs % nu_fission = ZERO @@ -115,10 +114,6 @@ contains material_xs % total = material_xs % total + & atom_density * micro_xs(i_nuclide) % total - ! Add contributions to material macroscopic scattering cross section - material_xs % elastic = material_xs % elastic + & - atom_density * micro_xs(i_nuclide) % elastic - ! Add contributions to material macroscopic absorption cross section material_xs % absorption = material_xs % absorption + & atom_density * micro_xs(i_nuclide) % absorption @@ -162,6 +157,7 @@ contains real(8) :: sig_t, sig_a, sig_f ! Intermediate multipole variables ! Initialize cached cross sections to zero + micro_xs(i_nuclide) % elastic = ZERO micro_xs(i_nuclide) % thermal = ZERO micro_xs(i_nuclide) % thermal_elastic = ZERO @@ -181,7 +177,6 @@ contains call multipole_eval(nuc % multipole, E, sqrtkT, sig_t, sig_a, sig_f) micro_xs(i_nuclide) % total = sig_t - micro_xs(i_nuclide) % elastic = sig_t - sig_a micro_xs(i_nuclide) % absorption = sig_a micro_xs(i_nuclide) % fission = sig_f @@ -268,9 +263,9 @@ contains micro_xs(i_nuclide) % total = (ONE - f) * xs % value(XS_TOTAL,i_grid) & + f * xs % value(XS_TOTAL,i_grid + 1) - ! Calculate microscopic nuclide elastic cross section - micro_xs(i_nuclide) % elastic = (ONE - f) * xs % value(XS_ELASTIC,i_grid) & - + f * xs % value(XS_ELASTIC,i_grid + 1) + ! Calculate microscopic nuclide absorption cross section + micro_xs(i_nuclide) % absorption = (ONE - f) * xs % value(XS_ABSORPTION, & + i_grid) + f * xs % value(XS_ABSORPTION,i_grid + 1) if (nuc % fissionable) then ! Calculate microscopic nuclide total cross section @@ -284,10 +279,6 @@ contains micro_xs(i_nuclide) % fission = ZERO micro_xs(i_nuclide) % nu_fission = ZERO end if - - ! Calculate microscopic nuclide absorption cross section - micro_xs(i_nuclide) % absorption = (ONE - f) * xs % value(XS_ABSORPTION, & - i_grid) + f * xs % value(XS_ABSORPTION,i_grid + 1) end associate ! Depletion-related reactions @@ -450,6 +441,18 @@ contains micro_xs(i_nuclide) % thermal = sab_frac * (elastic + inelastic) micro_xs(i_nuclide) % thermal_elastic = sab_frac * elastic + ! Calculate free atom elastic cross section + f = micro_xs(i_nuclide) % interp_factor + i_grid = micro_xs(i_nuclide) % index_grid + i_temp = micro_xs(i_nuclide) % index_temp + if (i_temp > 0) then + associate (xs => nuclides(i_nuclide) % reactions(1) % xs(i_temp) % value) + micro_xs(i_nuclide) % elastic = (ONE - f)*xs(i_grid) + f*xs(i_grid + 1) + end associate + else + micro_xs(i_nuclide) % elastic = ZERO + end if + ! Correct total and elastic cross sections micro_xs(i_nuclide) % total = micro_xs(i_nuclide) % total & + micro_xs(i_nuclide) % thermal & diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index 88e9348562..23e6e5825f 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -39,11 +39,9 @@ module nuclide_header ! Positions for first dimension of Nuclide % xs integer, parameter :: & XS_TOTAL = 1, & - XS_ELASTIC = 2, & + XS_ABSORPTION = 2, & XS_FISSION = 3, & - XS_NU_FISSION = 4, & - XS_ABSORPTION = 5, & - XS_HEATING = 6 + XS_NU_FISSION = 4 ! The array within SumXS is of shape (6, n_energy) where the first dimension ! corresponds to the following values: 1) total, 2) elastic scattering, 3) @@ -120,11 +118,12 @@ module nuclide_header type NuclideMicroXS ! Microscopic cross sections in barns real(8) :: total - real(8) :: elastic ! If sab_frac is not 1 or 0, then this value is - ! averaged over bound and non-bound nuclei real(8) :: absorption ! absorption (disappearance) real(8) :: fission ! fission real(8) :: nu_fission ! neutron production from fission + + real(8) :: elastic ! If sab_frac is not 1 or 0, then this value is + ! averaged over bound and non-bound nuclei real(8) :: thermal ! Bound thermal elastic & inelastic scattering real(8) :: thermal_elastic ! Bound thermal elastic scattering @@ -155,7 +154,6 @@ module nuclide_header type MaterialMacroXS real(8) :: total ! macroscopic total xs - real(8) :: elastic ! macroscopic elastic scattering xs real(8) :: absorption ! macroscopic absorption xs real(8) :: fission ! macroscopic fission xs real(8) :: nu_fission ! macroscopic production xs @@ -606,10 +604,6 @@ contains j = rx % xs(t) % threshold n = size(rx % xs(t) % value) - ! Copy elastic - if (rx % MT == ELASTIC) this % xs(t) % value(XS_ELASTIC,:) = & - rx % xs(t) % value - ! Add contribution to total cross section this % xs(t) % value(XS_TOTAL,j:j+n-1) = this % xs(t) % & value(XS_TOTAL,j:j+n-1) + rx % xs(t) % value diff --git a/src/physics.F90 b/src/physics.F90 index d13313e05a..5d31d87d7b 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -338,6 +338,18 @@ contains micro_xs(i_nuclide) % absorption) sampled = .false. + ! Calculate elastic cross section if need be + if (micro_xs(i_nuclide) % elastic == ZERO) then + if (i_temp > 0) then + associate (xs => nuc % reactions(1) % xs(i_temp) % value) + micro_xs(i_nuclide) % elastic = (ONE - f)*xs(i_grid) + f*xs(i_grid + 1) + end associate + else + micro_xs(i_nuclide) % elastic = micro_xs(i_nuclide) % total - & + micro_xs(i_nuclide) % absorption + end if + end if + prob = micro_xs(i_nuclide) % elastic - micro_xs(i_nuclide) % thermal if (prob > cutoff) then ! ======================================================================= diff --git a/src/tallies/tally.F90 b/src/tallies/tally.F90 index 7684a36aa6..d3dbf888d1 100644 --- a/src/tallies/tally.F90 +++ b/src/tallies/tally.F90 @@ -1009,20 +1009,6 @@ contains ! Simply count number of scoring events score = ONE - case (ELASTIC) - if (t % estimator == ESTIMATOR_ANALOG) then - ! Check if event MT matches - if (p % event_MT /= ELASTIC) cycle SCORE_LOOP - score = p % last_wgt * flux - - else - if (i_nuclide > 0) then - score = micro_xs(i_nuclide) % elastic * atom_density * flux - else - score = material_xs % elastic * flux - end if - end if - case (SCORE_FISS_Q_PROMPT) score = ZERO