From 472d808e9732631cda9fc799601517d99ace72ed Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 10 Aug 2017 10:49:17 -0500 Subject: [PATCH] Move MGXS-related module variables to mgxs_header --- src/global.F90 | 20 +---------- src/input_xml.F90 | 1 + src/mgxs_header.F90 | 20 ++++++++++- src/particle_header.F90 | 3 +- src/tallies/tally_filter.F90 | 66 ++++++++++++++++++------------------ 5 files changed, 56 insertions(+), 54 deletions(-) diff --git a/src/global.F90 b/src/global.F90 index 628d69c314..27c28b0404 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -12,7 +12,7 @@ module global use dict_header, only: DictCharInt, DictIntInt use geometry_header, only: Cell, Universe, Lattice, LatticeContainer use material_header, only: Material - use mgxs_header, only: Mgxs, MgxsContainer + use mgxs_header use plot_header, only: ObjectPlot use set_header, only: SetInt use stl_vector, only: VectorInt @@ -97,24 +97,6 @@ module global ! ============================================================================ ! MULTI-GROUP CROSS SECTION RELATED VARIABLES - ! Cross section arrays - type(MgxsContainer), allocatable, target :: nuclides_MG(:) - - ! Cross section caches - type(MgxsContainer), target, allocatable :: macro_xs(:) - - ! Number of energy groups - integer :: num_energy_groups - - ! Number of delayed groups - integer :: num_delayed_groups - - ! Energy group structure - real(8), allocatable :: energy_bins(:) - - ! Midpoint of the energy group structure - real(8), allocatable :: energy_bin_avg(:) - ! Maximum Data Order integer :: max_order diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 93a75d61c3..6923b39349 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -16,6 +16,7 @@ module input_xml use mesh_header, only: RegularMesh use message_passing use mgxs_data, only: create_macro_xs, read_mgxs + use mgxs_header use multipole, only: multipole_read use output, only: write_message, title, header use plot_header diff --git a/src/mgxs_header.F90 b/src/mgxs_header.F90 index faf0fbaff9..a00a3756dc 100644 --- a/src/mgxs_header.F90 +++ b/src/mgxs_header.F90 @@ -209,7 +209,25 @@ module mgxs_header procedure :: calculate_xs => mgxsang_calculate_xs end type MgxsAngle - contains + ! Cross section arrays + type(MgxsContainer), allocatable, target :: nuclides_MG(:) + + ! Cross section caches + type(MgxsContainer), target, allocatable :: macro_xs(:) + + ! Number of energy groups + integer :: num_energy_groups + + ! Number of delayed groups + integer :: num_delayed_groups + + ! Energy group structure + real(8), allocatable :: energy_bins(:) + + ! Midpoint of the energy group structure + real(8), allocatable :: energy_bin_avg(:) + +contains !=============================================================================== ! MGXS*_FROM_HDF5 reads in the data from the HDF5 Library. At the point of entry diff --git a/src/particle_header.F90 b/src/particle_header.F90 index 3f4680c2ff..bda7f03b43 100644 --- a/src/particle_header.F90 +++ b/src/particle_header.F90 @@ -147,7 +147,7 @@ contains this % fission = .false. this % delayed_group = 0 this % n_delayed_bank(:) = 0 - this % g = 1 + this % g = NONE ! Set up base level coordinates this % coord(1) % universe = root_universe @@ -214,6 +214,7 @@ contains this % last_uvw = src % uvw if (run_CE) then this % E = src % E + this % g = NONE else this % g = int(src % E) this % last_g = int(src % E) diff --git a/src/tallies/tally_filter.F90 b/src/tallies/tally_filter.F90 index cf8e49b819..a718202b78 100644 --- a/src/tallies/tally_filter.F90 +++ b/src/tallies/tally_filter.F90 @@ -666,28 +666,28 @@ contains integer :: bin real(8) :: E - n = this % n_bins - - if ((.not. run_CE) .and. this % matches_transport_groups) then - if (estimator == ESTIMATOR_TRACKLENGTH) then - call match % bins % push_back(num_energy_groups - p % g + 1) - call match % weights % push_back(ONE) - else - call match % bins % push_back(num_energy_groups - p % last_g + 1) - call match % weights % push_back(ONE) - end if + n = this % n_bins + if (p % g /= NONE .and. this % matches_transport_groups) then + if (estimator == ESTIMATOR_TRACKLENGTH) then + call match % bins % push_back(num_energy_groups - p % g + 1) + call match % weights % push_back(ONE) else - ! Pre-collision energy of particle - E = p % last_E - - ! Search to find incoming energy bin. - bin = binary_search(this % bins, n + 1, E) - if (bin /= NO_BIN_FOUND) then - call match % bins % push_back(bin) - call match % weights % push_back(ONE) - end if + call match % bins % push_back(num_energy_groups - p % last_g + 1) + call match % weights % push_back(ONE) end if + + else + ! Pre-collision energy of particle + E = p % last_E + + ! Search to find incoming energy bin. + bin = binary_search(this % bins, n + 1, E) + if (bin /= NO_BIN_FOUND) then + call match % bins % push_back(bin) + call match % weights % push_back(ONE) + end if + end if end subroutine get_all_bins_energy subroutine to_statepoint_energy(this, filter_group) @@ -724,23 +724,23 @@ contains integer :: n integer :: bin - n = this % n_bins + n = this % n_bins - if ((.not. run_CE) .and. this % matches_transport_groups) then - ! Tallies are ordered in increasing groups, group indices - ! however are the opposite, so switch - call match % bins % push_back(num_energy_groups - p % g + 1) + if (p % g /= NONE .and. this % matches_transport_groups) then + ! Tallies are ordered in increasing groups, group indices + ! however are the opposite, so switch + call match % bins % push_back(num_energy_groups - p % g + 1) + call match % weights % push_back(ONE) + + else + + ! Search to find incoming energy bin. + bin = binary_search(this % bins, n + 1, p % E) + if (bin /= NO_BIN_FOUND) then + call match % bins % push_back(bin) call match % weights % push_back(ONE) - - else - - ! Search to find incoming energy bin. - bin = binary_search(this % bins, n + 1, p % E) - if (bin /= NO_BIN_FOUND) then - call match % bins % push_back(bin) - call match % weights % push_back(ONE) - end if end if + end if end subroutine get_all_bins_energyout subroutine to_statepoint_energyout(this, filter_group)