Allow wmp to work with s(a, b) and URR interp

This commit is contained in:
Sterling Harper 2016-10-02 15:59:57 -04:00
parent 9cfef277f4
commit 49fb1ade00
12 changed files with 56 additions and 31 deletions

View file

@ -292,8 +292,8 @@ 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:`OPENMC_MULTIPOLE_LIBRARY` environment variable will be used.
.. note:: The :ref:`temperature_method` must also be set to "multipole" for
windowed multipole functionality.
.. note:: The <use_windowed_multipole> element must also be set to "true"
for windowed multipole functionality.
``<max_order>`` Element
---------------------------
@ -725,16 +725,16 @@ a material default temperature.
``<temperature_method>`` Element
--------------------------------
The ``<temperature_method>`` element has an accepted value of "nearest",
"interpolation", or "multipole". A value of "nearest" indicates that for each
The ``<temperature_method>`` element has an accepted value of "nearest" or
"interpolation". A value of "nearest" indicates that for each
cell, the nearest temperature at which cross sections are given is to be
applied, within a given tolerance (see :ref:`temperature_tolerance`). A value of
"interpolation" indicates that cross sections are to be linear-linear
interpolated between temperatures at which nuclear data are present (see
:ref:`temperature_treatment`). A value of "multipole" indicates that the
windowed multipole method should be used to evaluate temperature-dependent cross
sections in the resolved resonance range (a :ref:`windowed multipole library
<multipole_library>` must also be available).
:ref:`temperature_treatment`). Note that if ``<use_windowed_multipole>`` is set
true, then for which multipole data is available will use the windowed multipole
method for cross sections in the resolved resonance range. (a
:ref:`windowed multipole library <multipole_library>` must also be available).
*Default*: "nearest"

View file

@ -105,7 +105,7 @@ class Settings(object):
temperatures at which nuclear data doesn't exist. Accepted keys are
'default', 'method', and 'tolerance'. The value for 'default' should be
a float representing the default temperature in Kelvin. The value for
'method' should be 'nearest' or 'multipole'. If the method is
'method' should be 'nearest' or 'interpolation'. If the method is
'nearest', 'tolerance' indicates a range of temperature within which
cross sections may be used.
trigger_active : bool
@ -135,6 +135,9 @@ class Settings(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.
resonance_scattering : ResonanceScattering or iterable of ResonanceScattering
The elastic scattering model to use for resonant isotopes
volume_calculations : VolumeCalculation or iterable of VolumeCalculation
@ -219,6 +222,7 @@ class Settings(object):
self._settings_file = ET.Element("settings")
self._run_mode_subelement = None
self._multipole_active = None
self._resonance_scattering = cv.CheckedList(
ResonanceScattering, 'resonance scattering models')
@ -417,6 +421,10 @@ class Settings(object):
def dd_count_interactions(self):
return self._dd_count_interactions
@property
def use_windowed_multipole(self):
return self._multipole_active
@property
def resonance_scattering(self):
return self._resonance_scattering
@ -676,7 +684,7 @@ class Settings(object):
cv.check_type('default temperature', value, Real)
elif key == 'method':
cv.check_value('temperature method', value,
['nearest', 'interpolation', 'multipole'])
['nearest', 'interpolation'])
elif key == 'tolerance':
cv.check_type('temperature tolerance', value, Real)
self._temperature = temperature
@ -808,6 +816,11 @@ class Settings(object):
self._dd_count_interactions = interactions
@use_windowed_multipole.setter
def use_windowed_multipole(self, active):
cv.check_type('use_windowed_multipole', active, bool)
self._multipole_active = active
@resonance_scattering.setter
def resonance_scattering(self, res):
if not isinstance(res, MutableSequence):
@ -1111,6 +1124,12 @@ class Settings(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 _create_resonance_scattering_subelement(self):
if len(self.resonance_scattering) > 0:
elem = ET.SubElement(self._settings_file, 'resonance_scattering')
@ -1158,6 +1177,7 @@ class Settings(object):
self._create_track_subelement()
self._create_ufs_subelement()
self._create_dd_subelement()
self._create_use_multipole_subelement()
self._create_resonance_scattering_subelement()
self._create_volume_calcs_subelement()

View file

@ -271,8 +271,7 @@ module constants
! Temperature treatment method
integer, parameter :: &
TEMPERATURE_NEAREST = 1, &
TEMPERATURE_INTERPOLATION = 2, &
TEMPERATURE_MULTIPOLE = 3
TEMPERATURE_INTERPOLATION = 2
! ============================================================================
! TALLY-RELATED CONSTANTS

View file

@ -185,8 +185,6 @@ contains
f = (kT - nuc % kTs(i_temp)) / &
(nuc % kTs(i_temp + 1) - nuc % kTs(i_temp))
if (f > prn()) i_temp = i_temp + 1
case (TEMPERATURE_MULTIPOLE)
i_temp = minloc(abs(nuclides(i_nuclide) % kTs - kT), dim=1)
end select
end if

View file

@ -99,6 +99,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.
! Default temperature and method for choosing temperatures
integer :: temperature_method = TEMPERATURE_NEAREST
real(8) :: temperature_tolerance = 10.0_8

View file

@ -1063,6 +1063,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', '1')
multipole_active = .true.
case ('false', '0')
multipole_active = .false.
case default
call fatal_error("Unrecognized value for <use_windowed_multipole> in &
&settings.xml")
end select
end if
call get_node_list(doc, "volume_calc", node_vol_list)
n = get_list_size(node_vol_list)
allocate(volume_calcs(n))
@ -1082,8 +1096,6 @@ contains
temperature_method = TEMPERATURE_NEAREST
case ('interpolation')
temperature_method = TEMPERATURE_INTERPOLATION
case ('multipole')
temperature_method = TEMPERATURE_MULTIPOLE
case default
call fatal_error("Unknown temperature method: " // trim(temp_str))
end select
@ -5786,8 +5798,7 @@ contains
call already_read % add(name)
! Read multipole file into the appropriate entry on the nuclides array
if (temperature_method == TEMPERATURE_MULTIPOLE) &
call read_multipole_data(i_nuclide)
if (multipole_active) call read_multipole_data(i_nuclide)
end if
! Check if material is fissionable
@ -5841,7 +5852,7 @@ contains
end do
! If the user wants multipole, make sure we found a multipole library.
if (temperature_method == TEMPERATURE_MULTIPOLE) then
if (multipole_active) then
mp_found = .false.
do i = 1, size(nuclides)
if (nuclides(i) % mp_present) then

View file

@ -302,10 +302,6 @@ module nuclide_header
trim(to_str(nint(temp_desired))) // " K.")
end do TEMP_LOOP
case (TEMPERATURE_MULTIPOLE)
! Add first available temperature
call temps_to_read % push_back(nint(temps_available(1)))
end select
! Sort temperatures to read

View file

@ -334,7 +334,7 @@ contains
else
! Determine temperature
if (temperature_method == TEMPERATURE_MULTIPOLE) then
if (nuc % mp_present) then
kT = p % sqrtkT**2
else
kT = nuc % kTs(micro_xs(i_nuclide) % index_temp)

View file

@ -187,10 +187,6 @@ contains
trim(to_str(nint(temp_desired))) // " K.")
end do TEMP_LOOP
case (TEMPERATURE_MULTIPOLE)
! Add first available temperature
call temps_to_read % push_back(nint(temps_available(1)))
end select
! Sort temperatures to read

View file

@ -1 +1 @@
8462e17d102259b3a48a7e908bc75038a28a19d4a5e8bd38f26579e5baf3998bc2d05d1d3055ac1ed478d0c01bd64868d654919c2e6ca3fea86d79f03eda25ef
cab3356c163ceace74251d20cafc1b46f9fc3af428685cf5cea9964f5356d59a967468a14b3a2cd2ad3eea04b1d164b5daee8259f38be8ec5fb04fa7b4982830

View file

@ -1,5 +1,5 @@
k-combined:
1.425673E+00 1.779969E-02
1.363786E+00 1.103929E-02
Cell
ID = 11
Name =

View file

@ -17,6 +17,7 @@ class MultipoleTestHarness(PyAPITestHarness):
moderator.set_density('g/cc', 1.0)
moderator.add_nuclide('H1', 2.0)
moderator.add_nuclide('O16', 1.0)
moderator.add_s_alpha_beta('c_H_in_H2O')
dense_fuel = openmc.Material(material_id=2)
dense_fuel.set_density('g/cc', 4.5)
@ -67,7 +68,8 @@ class MultipoleTestHarness(PyAPITestHarness):
sets_file.particles = 1000
sets_file.source = Source(space=Box([-1, -1, -1], [1, 1, 1]))
sets_file.output = {'summary': True}
sets_file.temperature = {'method': 'multipole'}
sets_file.use_windowed_multipole = True
sets_file.temperature = {'tolerance': 1000}
sets_file.export_to_xml()
####################