Add a toggle to turn multipole on/off

This commit is contained in:
Sterling Harper 2016-02-16 18:34:39 -05:00
parent e78933d0d3
commit dc0907a294
10 changed files with 68 additions and 10 deletions

View file

@ -267,12 +267,14 @@ based on the recommended value in LA-UR-14-24530_.
``<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.
The ``<multipole_library>`` element 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.
.. note:: The <use_windowed_multipole> element must also be set to "True"
for windowed multipole functionality.
.. _natural_elements:
@ -775,6 +777,17 @@ problem. It has the following attributes/sub-elements:
*Default*: None
``<use_windowed_multipole>`` Element
------------------------------------
The ``<use_windowed_multipole>`` element toggles the windowed multipole
capability on or off. If this element is set to "True" and the relevant data is
available, OpenMC will use the windowed multipole method to evaluate and Doppler
broaden cross sections in the resolved resonance range.
*Default*: False
``<verbosity>`` Element
-----------------------

View file

@ -125,6 +125,9 @@ class SettingsFile(object):
Coordinates of the lower-left point of the UFS mesh
ufs_upper_right : tuple or list
Coordinates of the upper-right point of the UFS mesh
use_windowed_multipole : bool
Whether or not windowed multipole can be used to evaluate resolved
resonance cross sections.
"""
@ -201,6 +204,7 @@ class SettingsFile(object):
self._settings_file = ET.Element("settings")
self._run_mode_subelement = None
self._source_element = None
self._multipole_active = None
@property
def run_mode(self):
@ -386,6 +390,10 @@ class SettingsFile(object):
def dd_count_interactions(self):
return self._dd_count_interactions
@property
def use_windowed_multipole(self):
return self._multipole_active
@run_mode.setter
def run_mode(self, run_mode):
if 'run_mode' not in ['eigenvalue', 'fixed source']:
@ -750,6 +758,11 @@ class SettingsFile(object):
self._dd_count_interactions = interactions
@use_windowed_multipole.setter
def use_windowed_multipole(self, active):
check_type('use_windowed_multipole', active, bool)
self._multipole_active = active
def _create_run_mode_subelement(self):
if self.run_mode == 'eigenvalue':
@ -1024,6 +1037,12 @@ class SettingsFile(object):
subelement = ET.SubElement(element, "count_interactions")
subelement.text = str(self._dd_count_interactions).lower()
def _create_use_multipole_subelement(self):
if self._multipole_active is not None:
element = ET.SubElement(self._settings_file,
"use_windowed_multipole")
element.text = str(self._multipole_active)
def export_to_xml(self):
"""Create a settings.xml file that can be used for a simulation.
@ -1059,6 +1078,7 @@ class SettingsFile(object):
self._create_track_subelement()
self._create_ufs_subelement()
self._create_dd_subelement()
self._create_use_multipole_subelement()
# Clean the indentation in the file to be user-readable
clean_xml_indentation(self._settings_file)

View file

@ -114,7 +114,7 @@ contains
end if
! Read multipole file into the appropriate entry on the nuclides array
call read_multipole_data(i_nuclide)
if (multipole_active) call read_multipole_data(i_nuclide)
! Add name and alias to dictionary
call already_read % add(name)

View file

@ -112,7 +112,7 @@ module ace_header
type(UrrData), pointer :: urr_data => null()
! Multipole data
logical :: mp_present
logical :: mp_present = .false.
type(MultipoleArray), allocatable :: multipole
! Reactions

View file

@ -91,6 +91,9 @@ module global
! What to assume for expanding natural elements
integer :: default_expand = ENDF_BVII1
! Whether or not windowed multipole cross sections should be used.
logical :: multipole_active = .false.
! ============================================================================
! TALLY-RELATED VARIABLES

View file

@ -1054,6 +1054,20 @@ contains
end select
end if
! Check to see if windowed multipole functionality is requested
if (check_for_node(doc, "use_windowed_multipole")) then
call get_node_value(doc, "use_windowed_multipole", temp_str)
select case (to_lower(temp_str))
case ('true', 't', '1', 'y')
multipole_active = .true.
case ('false', 'f', '0', 'n')
multipole_active = .false.
case default
call fatal_error("Unrecognized value for <use_windowed_multipole> in &
&settings.xml")
end select
end if
! Close settings XML file
call close_xmldoc(doc)

View file

@ -162,5 +162,7 @@ element settings {
(element E_max { xsd:double } |
attribute E_max { xsd:double })?
}*
}?
}? &
element use_windowed_multipole { xsd:boolean }?
}

View file

@ -738,5 +738,10 @@
</zeroOrMore>
</element>
</optional>
<optional>
<element name="use_windowed_multipole">
<data type="boolean"/>
</element>
</optional>
</interleave>
</element>

View file

@ -1 +1 @@
5c1cec635da5c4c869bdf58f62924a4cb1648e4ddecf0ce71b823cf45178767ba7f2e089b76d36e8616b1b21ffa43b32ab1b17d20bb74120f900b9e3e9ab9bcc
7658bebe2b6f93feae06417a05bfd4bbbfca668eebd100d976543326439b82d16ea23752ac0537284e1839d9681714df116828daf30857bc83e86cc67e4550d7

View file

@ -86,6 +86,7 @@ class DistribmatTestHarness(PyAPITestHarness):
sets_file.particles = 1000
sets_file.source = Source(space=Box([-1, -1, -1], [1, 1, 1]))
sets_file.output = {'summary': True}
sets_file.use_windowed_multipole=True
sets_file.export_to_xml()