Allow user to specify multipole library location

This commit is contained in:
Sterling Harper 2016-02-16 14:57:01 -05:00
parent 81ec5700b6
commit e78933d0d3
8 changed files with 67 additions and 13 deletions

View file

@ -264,6 +264,16 @@ based on the recommended value in LA-UR-14-24530_.
*Default*: 8000
``<multipole_library>`` Element
-------------------------------
The ``<multipole_library>`` element has no attributes and indicates the
directory containing a windowed multipole library. If a windowed multipole
library is available, OpenMC can use it for on-the-fly Doppler-broadening of
resolved resonance range cross sections. If this element is absent from the
settings.xml file, the :envvar:`MULTIPOLE_LIBRARY` environment variable will be
used.
.. _natural_elements:
``<natural_elements>`` Element

View file

@ -72,6 +72,10 @@ class SettingsFile(object):
cross_sections.xml). If it is not set, the :envvar:`CROSS_SECTIONS`
environment variable will be used to find the path to the XML cross
section listing.
multipole_library : str
Indicates the path to a directory containing a windowed multipole
cross section library. If it is not set, the :envvar:`MULTIPOLE_LIBRARY'
environment variable will be used. A multipole library is optional.
energy_grid : str
Set the method used to search energy grids. Acceptable values are
'nuclide', 'logarithm', and 'material-union'.
@ -139,6 +143,7 @@ class SettingsFile(object):
self._confidence_intervals = None
self._cross_sections = None
self._multipole_library = None
self._energy_grid = None
self._ptables = None
self._run_cmfd = None
@ -233,6 +238,10 @@ class SettingsFile(object):
def cross_sections(self):
return self._cross_sections
@property
def multipole_library(self):
return self._multipole_library
@property
def energy_grid(self):
return self._energy_grid
@ -528,6 +537,11 @@ class SettingsFile(object):
check_type('cross sections', cross_sections, basestring)
self._cross_sections = cross_sections
@multipole_library.setter
def multipole_library(self, multipole_library):
check_type('cross sections', multipole_library, basestring)
self._multipole_library = multipole_library
@energy_grid.setter
def energy_grid(self, energy_grid):
check_value('energy grid', energy_grid,
@ -861,6 +875,11 @@ class SettingsFile(object):
element = ET.SubElement(self._settings_file, "cross_sections")
element.text = str(self._cross_sections)
def _create_multipole_library_subelement(self):
if self._multipole_library is not None:
element = ET.SubElement(self._settings_file, "multipole_library")
element.text = str(self._multipole_library)
def _create_energy_grid_subelement(self):
if self._energy_grid is not None:
element = ET.SubElement(self._settings_file, "energy_grid")
@ -1024,6 +1043,7 @@ class SettingsFile(object):
self._create_sourcepoint_subelement()
self._create_confidence_intervals()
self._create_cross_sections_subelement()
self._create_multipole_library_subelement()
self._create_energy_grid_subelement()
self._create_ptables_subelement()
self._create_run_cmfd_subelement()

View file

@ -431,15 +431,14 @@ contains
logical :: file_exists ! does multipole library exist?
character(7) :: readable ! is multipole library readable?
character(6) :: zaid_string ! String of the ZAID
character(9) :: filename ! path to multipole cross section library
type(Nuclide), pointer :: nuc => null()
character(MAX_FILE_LEN+9) :: filename ! path to multipole xs library
! For the time being, and I know this is a bit hacky, we just assume
! that the file will be zaid.h5.
associate (nuc => nuclides(i_table))
write(zaid_string,'(I6.6)') nuc % zaid
filename = zaid_string // ".h5"
write(zaid_string, '(I6.6)') nuc % zaid
filename = trim(path_multipole) // zaid_string // ".h5"
! Check if Multipole library exists and is readable
inquire(FILE=filename, EXIST=file_exists, READ=readable)
@ -447,11 +446,11 @@ contains
nuc % mp_present = .false.
return
elseif (readable(1:3) == 'NO') then
call fatal_error("Multipole library '" // trim(filename) // "' is not readable! &
&Change file permissions with chmod command.")
call fatal_error("Multipole library '" // trim(filename) // "' is not &
&readable! Change file permissions with chmod command.")
end if
! display message
! Display message
call write_message("Loading Multipole XS table: " // filename, 6)
allocate(nuc % multipole)

View file

@ -282,6 +282,7 @@ module global
character(MAX_FILE_LEN) :: path_input ! Path to input file
character(MAX_FILE_LEN) :: path_cross_sections ! Path to cross_sections.xml
character(MAX_FILE_LEN) :: path_multipole ! Path to wmp library
character(MAX_FILE_LEN) :: path_source = '' ! Path to binary source
character(MAX_FILE_LEN) :: path_state_point ! Path to binary state point
character(MAX_FILE_LEN) :: path_source_point ! Path to binary source point

View file

@ -127,6 +127,21 @@ contains
end if
end if
! Find the windowed multipole library
if (run_mode /= MODE_PLOTTING) then
if (.not. check_for_node(doc, "multipole_library") .and. &
run_mode /= MODE_PLOTTING) then
! No library location specified in settings.xml, check
! environment variable
call get_environment_variable("MULTIPOLE_LIBRARY", env_variable)
path_multipole = trim(env_variable)
else
call get_node_value(doc, "multipole_library", path_multipole)
end if
if (.not. ends_with(path_multipole, "/")) &
path_multipole = trim(path_multipole) // "/"
end if
! Set output directory if a path has been specified on the <output_path>
! element
if (check_for_node(doc, "output_path")) then
@ -1901,7 +1916,6 @@ contains
type(Node), pointer :: doc => null()
type(Node), pointer :: node_mat => null()
type(Node), pointer :: node_dens => null()
type(Node), pointer :: node_temp => null()
type(Node), pointer :: node_nuc => null()
type(Node), pointer :: node_ele => null()
type(Node), pointer :: node_sab => null()

View file

@ -17,18 +17,19 @@ contains
!===============================================================================
subroutine multipole_read(filename, multipole, i_table)
character(len=*), intent(in) :: filename ! Filename of the multipole library to load
character(len=*), intent(in) :: filename ! Filename of the
! multipole library
! to load
type(MultipoleArray), intent(out), target :: multipole ! The object to fill
integer, intent(in) :: i_table ! index in nuclides/sab_tables
type(Nuclide), pointer :: nuc => null()
integer, intent(in) :: i_table ! index in nuclides/
! sab_tables
integer(HID_T) :: file_id
integer(HID_T) :: group_id
! Intermediate loading components
integer :: NMT
integer :: i, j, k
integer :: i, j
integer, allocatable :: MT(:)
logical :: accumulated_fission
character(len=3) :: MT_string

View file

@ -27,6 +27,8 @@ element settings {
element cross_sections { xsd:string { maxLength = "255" } }? &
element multipole_library { xsd:string { maxLength = "255" } }? &
element cutoff {
(element weight { xsd:double } | attribute weight { xsd:double })? &
(element weight_avg { xsd:double } | attribute weight_avg { xsd:double })?

View file

@ -95,6 +95,13 @@
</data>
</element>
</optional>
<optional>
<element name="multipole_library">
<data type="string">
<param name="maxLength">255</param>
</data>
</element>
</optional>
<optional>
<element name="cutoff">
<interleave>