Fixed issue in source.F90 with fixing energy bins.

This commit is contained in:
Brody Bassett 2017-12-11 04:10:32 -05:00
parent a9ec1af39e
commit fae2888b26
4 changed files with 17 additions and 8 deletions

View file

@ -4201,6 +4201,7 @@ contains
num_delayed_groups = 0
end if
allocate(rev_energy_bins(num_energy_groups + 1))
allocate(energy_bins(num_energy_groups + 1))
if (attribute_exists(file_id, "group structure")) then
@ -4210,6 +4211,10 @@ contains
call fatal_error("'group structure' attribute must exist!")
end if
! First reverse the order of energy_groups
rev_energy_bins = energy_bins
energy_bins = energy_bins(num_energy_groups + 1:1:-1)
allocate(energy_bin_avg(num_energy_groups))
do i = 1, num_energy_groups
energy_bin_avg(i) = HALF * (energy_bins(i) + energy_bins(i + 1))

View file

@ -221,12 +221,15 @@ module mgxs_header
! Number of delayed groups
integer :: num_delayed_groups
! Energy group structure
! Energy group structure with decreasing energy
real(8), allocatable :: energy_bins(:)
! Midpoint of the energy group structure
real(8), allocatable :: energy_bin_avg(:)
! Energy group structure with increasing energy
real(8), allocatable :: rev_energy_bins(:)
contains
!===============================================================================

View file

@ -15,7 +15,7 @@ module source
use hdf5_interface, only: file_create, file_open, file_close, read_dataset
use math
use message_passing, only: rank
use mgxs_header, only: energy_bins, num_energy_groups
use mgxs_header, only: rev_energy_bins, num_energy_groups
use output, only: write_message
use particle_header, only: Particle
use random_lcg, only: prn, set_particle_seed, prn_set_stream
@ -129,13 +129,14 @@ contains
! If running in MG, convert site % E to group
if (.not. run_CE) then
if (site % E <= energy_bins(1)) then
site % E = real(1, 8)
else if (site % E > energy_bins(num_energy_groups + 1)) then
if (site % E <= rev_energy_bins(1)) then
site % E = real(num_energy_groups, 8)
else if (site % E > rev_energy_bins(num_energy_groups + 1)) then
site % E = real(1, 8)
else
site % E = real(binary_search(energy_bins, num_energy_groups + 1, &
site % E = real(binary_search(rev_energy_bins, num_energy_groups + 1, &
site % E), 8)
site % E = num_energy_groups + 1 - site % E
end if
end if

View file

@ -8,7 +8,7 @@ module tally_filter_energy
use constants
use error
use hdf5_interface
use mgxs_header, only: num_energy_groups, energy_bins
use mgxs_header, only: num_energy_groups, rev_energy_bins
use particle_header, only: Particle
use settings, only: run_CE
use string, only: to_str
@ -75,7 +75,7 @@ contains
! ordering of the library and tallying systems).
if (.not. run_CE) then
if (n == num_energy_groups + 1) then
if (all(this % bins == energy_bins)) &
if (all(this % bins == rev_energy_bins)) &
then
this % matches_transport_groups = .true.
end if