From 49fb1ade00eb0c6c5c0b842f66c7622f37b715bc Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Sun, 2 Oct 2016 15:59:57 -0400 Subject: [PATCH] Allow wmp to work with s(a, b) and URR interp --- docs/source/usersguide/input.rst | 16 ++++++++-------- openmc/settings.py | 24 ++++++++++++++++++++++-- src/constants.F90 | 3 +-- src/cross_section.F90 | 2 -- src/global.F90 | 3 +++ src/input_xml.F90 | 21 ++++++++++++++++----- src/nuclide_header.F90 | 4 ---- src/physics.F90 | 2 +- src/sab_header.F90 | 4 ---- tests/test_multipole/inputs_true.dat | 2 +- tests/test_multipole/results_true.dat | 2 +- tests/test_multipole/test_multipole.py | 4 +++- 12 files changed, 56 insertions(+), 31 deletions(-) diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index 9b2d786077..2e4d3f087b 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -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 element must also be set to "true" + for windowed multipole functionality. ```` Element --------------------------- @@ -725,16 +725,16 @@ a material default temperature. ```` Element -------------------------------- -The ```` element has an accepted value of "nearest", -"interpolation", or "multipole". A value of "nearest" indicates that for each +The ```` 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 -` must also be available). +:ref:`temperature_treatment`). Note that if ```` 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 ` must also be available). *Default*: "nearest" diff --git a/openmc/settings.py b/openmc/settings.py index f255a8bb10..0d3eb61dbb 100644 --- a/openmc/settings.py +++ b/openmc/settings.py @@ -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() diff --git a/src/constants.F90 b/src/constants.F90 index cc0d663ea3..8c321156cf 100644 --- a/src/constants.F90 +++ b/src/constants.F90 @@ -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 diff --git a/src/cross_section.F90 b/src/cross_section.F90 index 4bb323c517..69363e40a3 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -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 diff --git a/src/global.F90 b/src/global.F90 index bea5f61a83..d424e1cecd 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -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 diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 16892397aa..74b5f47ae9 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -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 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 diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index 4235f4234d..d07ccbe5a2 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -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 diff --git a/src/physics.F90 b/src/physics.F90 index 23fb6f1df2..6a6a9787d5 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -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) diff --git a/src/sab_header.F90 b/src/sab_header.F90 index 21a2ab0322..dcf5df979a 100644 --- a/src/sab_header.F90 +++ b/src/sab_header.F90 @@ -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 diff --git a/tests/test_multipole/inputs_true.dat b/tests/test_multipole/inputs_true.dat index 930be95361..9ff8c6e39f 100644 --- a/tests/test_multipole/inputs_true.dat +++ b/tests/test_multipole/inputs_true.dat @@ -1 +1 @@ -8462e17d102259b3a48a7e908bc75038a28a19d4a5e8bd38f26579e5baf3998bc2d05d1d3055ac1ed478d0c01bd64868d654919c2e6ca3fea86d79f03eda25ef \ No newline at end of file +cab3356c163ceace74251d20cafc1b46f9fc3af428685cf5cea9964f5356d59a967468a14b3a2cd2ad3eea04b1d164b5daee8259f38be8ec5fb04fa7b4982830 \ No newline at end of file diff --git a/tests/test_multipole/results_true.dat b/tests/test_multipole/results_true.dat index 4d379b3f40..b17f6b0aab 100644 --- a/tests/test_multipole/results_true.dat +++ b/tests/test_multipole/results_true.dat @@ -1,5 +1,5 @@ k-combined: -1.425673E+00 1.779969E-02 +1.363786E+00 1.103929E-02 Cell ID = 11 Name = diff --git a/tests/test_multipole/test_multipole.py b/tests/test_multipole/test_multipole.py index a44489aa5a..e908eba2d9 100644 --- a/tests/test_multipole/test_multipole.py +++ b/tests/test_multipole/test_multipole.py @@ -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() ####################