diff --git a/src/constants.F90 b/src/constants.F90
index 89490eb183..67e7877467 100644
--- a/src/constants.F90
+++ b/src/constants.F90
@@ -312,6 +312,12 @@ module constants
integer, parameter :: ERROR_INT = -huge(0)
real(8), parameter :: ERROR_REAL = -huge(0.0_8) * 0.917826354_8
+ ! Energy grid methods
+ integer, parameter :: &
+ GRID_NUCLIDE = 1, & ! non-unionized energy grid (MCNP)
+ GRID_UNION = 2, & ! union grid with pointers
+ GRID_LETHARGY = 3 ! lethargy mapping (MC21)
+
! Source types
integer, parameter :: &
SRC_BOX = 1, & ! Source in a rectangular prism
diff --git a/src/cross_section.F90 b/src/cross_section.F90
index 966ff1cd94..b43283e037 100644
--- a/src/cross_section.F90
+++ b/src/cross_section.F90
@@ -37,7 +37,7 @@ contains
mat => materials(p % material)
! Find energy index on unionized grid
- call find_energy_index()
+ if (grid_method == GRID_UNION) call find_energy_index()
! Check if there's an S(a,b) table for this material
if (mat % has_sab_table) then
@@ -107,11 +107,28 @@ contains
! Set pointer to nuclide
nuc => nuclides(index_nuclide)
- ! TODO: If not using unionized energy grid, we need to find the index on the
- ! nuclide energy grid using lethargy mapping or whatever other technique
+ ! Determine index on nuclide energy grid
+ select case (grid_method)
+ case (GRID_UNION)
+ ! If we're using the unionized grid with pointers, finding the index on
+ ! the nuclide energy grid is as simple as looking up the pointer
- ! get index on nuclide energy grid
- IE = nuc % grid_index(p % IE)
+ IE = nuc % grid_index(p % IE)
+
+ case (GRID_NUCLIDE)
+ ! If we're not using the unionized grid, we have to do a binary search on
+ ! the nuclide energy grid in order to determine which points to
+ ! interpolate between
+
+ if (p % E < nuc % energy(1)) then
+ IE = 1
+ elseif (p % E > nuc % energy(nuc % n_grid)) then
+ IE = nuc % n_grid - 1
+ else
+ IE = binary_search(nuc % energy, nuc % n_grid, p % E)
+ end if
+
+ end select
! check for rare case where two energy points are the same
if (nuc % energy(IE) == nuc % energy(IE+1)) IE = IE + 1
diff --git a/src/global.F90 b/src/global.F90
index d7edf18215..c64ebedc9d 100644
--- a/src/global.F90
+++ b/src/global.F90
@@ -82,7 +82,8 @@ module global
type(DictionaryCI), pointer :: xs_listing_dict => null()
! Unionized energy grid
- integer :: n_grid ! number of points on unionized grid
+ integer :: grid_method ! how to treat the energy grid
+ integer :: n_grid ! number of points on unionized grid
real(8), allocatable :: e_grid(:) ! energies on unionized grid
! Unreoslved resonance probablity tables
diff --git a/src/initialize.F90 b/src/initialize.F90
index 697273533e..3d3719b48d 100644
--- a/src/initialize.F90
+++ b/src/initialize.F90
@@ -106,9 +106,11 @@ contains
call timer_stop(time_read_xs)
! Construct unionized energy grid from cross-sections
- call timer_start(time_unionize)
- call unionized_grid()
- call timer_stop(time_unionize)
+ if (grid_method == GRID_UNION) then
+ call timer_start(time_unionize)
+ call unionized_grid()
+ call timer_stop(time_unionize)
+ end if
! Create tally map
call create_tally_map()
diff --git a/src/input_xml.F90 b/src/input_xml.F90
index 29c72309a9..c1257855e1 100644
--- a/src/input_xml.F90
+++ b/src/input_xml.F90
@@ -67,6 +67,7 @@ contains
! Initialize XML scalar variables
cross_sections_ = ""
verbosity_ = 0
+ energy_grid_ = "union"
! Parse settings.xml file
call read_xml_file_settings_t(filename)
@@ -111,6 +112,20 @@ contains
call fatal_error()
end if
+ ! Energy grid methods
+ select case (energy_grid_)
+ case ('nuclide')
+ grid_method = GRID_NUCLIDE
+ case ('union')
+ grid_method = GRID_UNION
+ case ('lethargy')
+ message = "Lethargy mapped energy grid not yet supported."
+ call fatal_error()
+ case default
+ message = "Unknown energy grid method: " // energy_grid_
+ call fatal_error()
+ end select
+
! Verbosity
if (verbosity_ > 0) verbosity = verbosity_
diff --git a/src/xml-fortran/templates/settings_t.xml b/src/xml-fortran/templates/settings_t.xml
index 69388420ca..4b450f5724 100644
--- a/src/xml-fortran/templates/settings_t.xml
+++ b/src/xml-fortran/templates/settings_t.xml
@@ -27,13 +27,14 @@
-
+
+
+
+
+
-
-
-
+
-