Added a check for minimum energy in the source sampling. Set multigroup min and max energies and removed check for these after samping the source.

This commit is contained in:
Brody Bassett 2017-12-15 02:19:50 -05:00
parent 2891fdae46
commit 8e6b617116
3 changed files with 15 additions and 13 deletions

View file

@ -4215,11 +4215,16 @@ contains
rev_energy_bins = energy_bins
energy_bins = energy_bins(num_energy_groups + 1:1:-1)
! Get the midpoint of the energy groups
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))
end do
! Get the minimum and maximum energies
energy_min_neutron = energy_bins(num_energy_groups + 1)
energy_max_neutron = energy_bins(1)
! Get the datasets present in the library
call get_groups(file_id, names)
n_libraries = size(names)

View file

@ -129,15 +129,9 @@ contains
! If running in MG, convert site % E to group
if (.not. run_CE) 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(rev_energy_bins, num_energy_groups + 1, &
site % E), 8)
site % E = num_energy_groups + 1 - site % E
end if
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
! Set the random number generator back to the tracking stream.

View file

@ -9,7 +9,7 @@ module source_header
use error
use geometry, only: find_cell
use material_header, only: materials
use nuclide_header, only: energy_max_neutron
use nuclide_header, only: energy_min_neutron, energy_max_neutron
use particle_header, only: Particle
use string, only: to_lower
use xml_interface
@ -275,9 +275,12 @@ contains
! Check for monoenergetic source above maximum neutron energy
select type (energy => this % energy)
type is (Discrete)
if (any(energy % x >= energy_max_neutron)) then
if (any(energy % x > energy_max_neutron)) then
call fatal_error("Source energy above range of energies of at least &
&one cross section table")
else if (any(energy % x < energy_min_neutron)) then
call fatal_error("Source energy below range of energies of at least &
&one cross section table")
end if
end select
@ -285,8 +288,8 @@ contains
! Sample energy spectrum
site % E = this % energy % sample()
! resample if energy is greater than maximum neutron energy
if (site % E < energy_max_neutron) exit
! Resample if energy falls outside minimum or maximum neutron energy
if (site % E < energy_max_neutron .and. site % E > energy_min_neutron) exit
end do
! Set delayed group