From e29da0cf5bff358f960a557a7fbf27bc0fd45151 Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Sun, 3 Apr 2016 13:35:08 -0400 Subject: [PATCH] Remove some multipole global variables --- src/ace.F90 | 14 ----- src/cross_section.F90 | 54 +++++--------------- src/math.F90 | 2 + src/multipole.F90 | 4 +- src/multipole_header.F90 | 6 --- tests/test_filter_distribcell/case-1/test.py | 7 --- 6 files changed, 18 insertions(+), 69 deletions(-) delete mode 100644 tests/test_filter_distribcell/case-1/test.py diff --git a/src/ace.F90 b/src/ace.F90 index e3e6161a6..76656b9fd 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -12,7 +12,6 @@ module ace use list_header, only: ListInt use material_header, only: Material use multipole, only: multipole_read - use multipole_header, only: max_L, max_poles, max_poly use nuclide_header use output, only: write_message use product_header, only: ReactionProduct @@ -478,19 +477,6 @@ contains call multipole_read(filename, nuc % multipole, i_table) nuc % mp_present = .true. - ! Update the maximum number of poles, l indices, and polynomial order - if (nuc % multipole % max_w > max_poles) then - max_poles = nuc % multipole % max_w - end if - - if (nuc % multipole % num_l > max_L) then - max_L = nuc % multipole % num_l - end if - - if (nuc % multipole % fit_order + 1 > max_poly) then - max_poly = nuc % multipole % fit_order + 1 - end if - ! Recreate nu-fission tables if (nuc % fissionable) then call generate_nu_fission(nuc) diff --git a/src/cross_section.F90 b/src/cross_section.F90 index 930d1a052..68140beb1 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -9,7 +9,7 @@ module cross_section use math, only: faddeeva, broaden_wmp_polynomials use multipole_header, only: FORM_RM, FORM_MLBW, MP_EA, RM_RT, RM_RA, RM_RF, & MLBW_RT, MLBW_RX, MLBW_RA, MLBW_RF, FIT_T, FIT_A,& - FIT_F, MultipoleArray, max_poly, max_L, max_poles + FIT_F, MultipoleArray use nuclide_header use particle_header, only: Particle use random_lcg, only: prn, future_prn, prn_set_stream @@ -18,14 +18,6 @@ module cross_section implicit none - ! Allocatable arrays for multipole that are allocated once for speed purposes - complex(8), allocatable :: sigT_factor(:) - real(8), allocatable :: twophi(:) - real(8), allocatable :: broadened_polynomials(:) - logical :: mp_already_alloc = .false. - -!$omp threadprivate(sigT_factor, twophi, broadened_polynomials, mp_already_alloc) - contains !=============================================================================== @@ -558,19 +550,6 @@ contains end function find_energy_index -!=============================================================================== -! MULTIPOLE_EVAL_ALLOCATE allocates fixed-length arrays that vary based on -! what nuclides are loaded into the problem -!=============================================================================== - - subroutine multipole_eval_allocate() - allocate(sigT_factor(max_L)) - allocate(twophi(max_L)) - allocate(broadened_polynomials(max_poly)) - - mp_already_alloc = .true. - end subroutine - !=============================================================================== ! MULTIPOLE_EVAL evaluates the windowed multipole equations for cross ! sections in the resolved resonance regions @@ -593,6 +572,8 @@ contains complex(8) :: c_temp ! complex temporary variable complex(8) :: w_val ! The faddeeva function evaluated at Z complex(8) :: Z ! sqrt(atomic weight ratio / kT) * (sqrt(E) - pole) + complex(8) :: sigT_factor(multipole % num_l) + real(8) :: broadened_polynomials(multipole % fit_order + 1) real(8) :: sqrtE ! sqrt(E), eV real(8) :: invE ! 1/E, eV real(8) :: dopp ! sqrt(atomic weight ratio / kT) = 1 / (2 sqrt(xi)) @@ -617,10 +598,6 @@ contains invE = ONE / E dopp = multipole % sqrtAWR / sqrtkT - if (.not. mp_already_alloc) then - call multipole_eval_allocate() - end if - ! Locate us. i_window = floor((sqrtE - sqrt(multipole % start_E)) / multipole % spacing & + ONE) @@ -629,8 +606,7 @@ contains ! Fill in factors. if (startw <= endw) then - call fill_factors(multipole, sqrtE, sigT_factor, twophi, & - multipole % num_l) + call compute_sigT_factor(multipole, sqrtE, sigT_factor) end if ! Initialize the ouptut cross sections. @@ -705,25 +681,23 @@ contains end do end if end if - end subroutine + end subroutine multipole_eval !=============================================================================== -! FILL_FACTORS calculates the value of phi, the hardsphere phase shift factor, -! and sigT_factor, a factor inside of the sigT equation not present in the -! sigA and sigF equations. +! COMPUTE_SIGT_FACTOR calculates the sigT_factor, a factor inside of the sigT +! equation not present in the sigA and sigF equations. !=============================================================================== - subroutine fill_factors(multipole, sqrtE, sigT_factor, twophi, max_L) - type(MultipoleArray), intent(in) :: multipole - real(8), intent(in) :: sqrtE - integer, intent(in) :: max_L - complex(8), intent(out) :: sigT_factor(max_L) - real(8), intent(out) :: twophi(max_L) + subroutine compute_sigT_factor(multipole, sqrtE, sigT_factor) + type(MultipoleArray), intent(in) :: multipole + real(8), intent(in) :: sqrtE + complex(8), intent(out) :: sigT_factor(multipole % num_l) integer :: iL + real(8) :: twophi(multipole % num_l) real(8) :: arg - do iL = 1, max_L + do iL = 1, multipole % num_l twophi(iL) = multipole % pseudo_k0RS(iL) * sqrtE if (iL == 2) then twophi(iL) = twophi(iL) - atan(twophi(iL)) @@ -739,7 +713,7 @@ contains twophi = 2.0_8 * twophi sigT_factor = cmplx(cos(twophi), -sin(twophi), KIND=8) - end subroutine + end subroutine compute_sigT_factor !=============================================================================== ! 0K_ELASTIC_XS determines the microscopic 0K elastic cross section diff --git a/src/math.F90 b/src/math.F90 index fce57e6fc..5c486e38f 100644 --- a/src/math.F90 +++ b/src/math.F90 @@ -741,6 +741,8 @@ contains ! For imag(z) > 0, w_int(z) = w_fun(z) ! For imag(z) < 0, w_int(z) = -conjg(w_fun(conjg(z))) + ! Note that faddeeva_w will interpret zero as machine epsilon + relerr = ZERO if (aimag(z) > ZERO) then wv = faddeeva_w(z, relerr) diff --git a/src/multipole.F90 b/src/multipole.F90 index 612e03d7a..cb83d85d1 100644 --- a/src/multipole.F90 +++ b/src/multipole.F90 @@ -4,8 +4,8 @@ module multipole use global use hdf5 use hdf5_interface - use multipole_header, only: MultipoleArray, FIT_T, FIT_A, FIT_F, max_L, & - max_poles, max_poly, MP_FISS, FORM_MLBW, FORM_RM + use multipole_header, only: MultipoleArray, FIT_T, FIT_A, FIT_F, & + MP_FISS, FORM_MLBW, FORM_RM implicit none diff --git a/src/multipole_header.F90 b/src/multipole_header.F90 index a3642b890..a21677a95 100644 --- a/src/multipole_header.F90 +++ b/src/multipole_header.F90 @@ -32,12 +32,6 @@ module multipole_header ! Value of 'true' when checking if nuclide is fissionable integer, parameter :: MP_FISS = 1 - ! These variables store the maximum value from every nuclide in order - ! to preallocate some arrays to improve performance. - integer :: max_poly ! Maximum number of polynomials we expect - integer :: max_poles ! Maximum number of poles in the problem for allocation - integer :: max_L ! Maximum L value for allocation - !=============================================================================== ! MULTIPOLE contains all the components needed for the windowed multipole ! temperature dependent cross section libraries for the resolved resonance diff --git a/tests/test_filter_distribcell/case-1/test.py b/tests/test_filter_distribcell/case-1/test.py deleted file mode 100644 index a71516d5f..000000000 --- a/tests/test_filter_distribcell/case-1/test.py +++ /dev/null @@ -1,7 +0,0 @@ -import openmc - - -su = openmc.Summary('summary.h5') -sp = openmc.StatePoint('statepoint.1.h5') -sp.link_with_summary(su) -print(sp.tallies[1].get_pandas_dataframe(summary=su))