diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index 9b2d78607..847dc66ff 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,19 +725,29 @@ 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`). *Default*: "nearest" +.. _temperature_multipole: + +```` Element +----------------------------------- + +The ```` 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. This override other +methods like "nearest" and "interpolation" in the resolved resonance range. + + *Default*: False + .. _temperature_tolerance: ```` Element @@ -850,17 +860,6 @@ problem. It has the following attributes/sub-elements: *Default*: None - -```` Element ------------------------------------- - -The ```` 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 - ```` Element ----------------------- diff --git a/openmc/settings.py b/openmc/settings.py index f255a8bb1..335de839a 100644 --- a/openmc/settings.py +++ b/openmc/settings.py @@ -103,11 +103,13 @@ class Settings(object): temperature : dict Defines a default temperature and method for treating intermediate 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 - 'nearest', 'tolerance' indicates a range of temperature within which - cross sections may be used. + 'default', 'method', 'tolerance', and 'multipole'. The value for + 'default' should be a float representing the default temperature in + Kelvin. The value for 'method' should be 'nearest' or 'interpolation'. + If the method is 'nearest', 'tolerance' indicates a range of temperature + within which cross sections may be used. 'multipole' is a boolean + indicating whether or not the windowed multipole method should be used + to evaluate resolved resonance cross sections. trigger_active : bool Indicate whether tally triggers are used trigger_max_batches : int @@ -671,14 +673,16 @@ class Settings(object): cv.check_type('temperature settings', temperature, Mapping) for key, value in temperature.items(): cv.check_value('temperature key', key, - ['default', 'method', 'tolerance']) + ['default', 'method', 'tolerance', 'multipole']) if key == 'default': 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) + elif key == 'multipole': + cv.check_type('temperature multipole', value, bool) self._temperature = temperature @threads.setter @@ -1049,7 +1053,7 @@ class Settings(object): def _create_temperature_subelements(self): if self.temperature: - for key, value in self.temperature.items(): + for key, value in sorted(self.temperature.items()): element = ET.SubElement(self._settings_file, "temperature_{}".format(key)) element.text = str(value) diff --git a/src/constants.F90 b/src/constants.F90 index cc0d663ea..8c321156c 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 4bb323c51..69363e40a 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 d971581ba..f00a1d368 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -101,6 +101,7 @@ module global ! Default temperature and method for choosing temperatures integer :: temperature_method = TEMPERATURE_NEAREST + logical :: temperature_multipole = .false. real(8) :: temperature_tolerance = 10.0_8 real(8) :: temperature_default = 293.6_8 diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 16892397a..8691a9d5c 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -1082,8 +1082,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 @@ -1091,6 +1089,18 @@ contains if (check_for_node(doc, "temperature_tolerance")) then call get_node_value(doc, "temperature_tolerance", temperature_tolerance) end if + if (check_for_node(doc, "temperature_multipole")) then + call get_node_value(doc, "temperature_multipole", temp_str) + select case (to_lower(temp_str)) + case ('true', '1') + temperature_multipole = .true. + case ('false', '0') + temperature_multipole = .false. + case default + call fatal_error("Unrecognized value for in & + &settings.xml") + end select + end if ! Close settings XML file call close_xmldoc(doc) @@ -5786,8 +5796,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 (temperature_multipole) call read_multipole_data(i_nuclide) end if ! Check if material is fissionable @@ -5841,7 +5850,7 @@ contains end do ! If the user wants multipole, make sure we found a multipole library. - if (temperature_method == TEMPERATURE_MULTIPOLE) then + if (temperature_multipole) 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 4235f4234..d07ccbe5a 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 23fb6f1df..6a6a9787d 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/relaxng/settings.rnc b/src/relaxng/settings.rnc index 70550a40f..b05ab7d6b 100644 --- a/src/relaxng/settings.rnc +++ b/src/relaxng/settings.rnc @@ -132,6 +132,8 @@ element settings { element temperature_method { xsd:string }? & + element temperature_multipole { xsd:boolean }? & + element temperature_tolerance { xsd:double }? & element threads { xsd:positiveInteger }? & @@ -182,6 +184,4 @@ element settings { attribute E_max { xsd:double })? }* }? & - - element use_windowed_multipole { xsd:boolean }? } diff --git a/src/relaxng/settings.rng b/src/relaxng/settings.rng index 246c78e68..cbeac25a5 100644 --- a/src/relaxng/settings.rng +++ b/src/relaxng/settings.rng @@ -575,6 +575,11 @@ + + + + + @@ -816,10 +821,5 @@ - - - - - diff --git a/src/sab_header.F90 b/src/sab_header.F90 index 21a2ab032..dcf5df979 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/src/tally.F90 b/src/tally.F90 index 3c008e30e..f7d8ab5a2 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -149,7 +149,7 @@ contains if (survival_biasing) then ! We need to account for the fact that some weight was already ! absorbed - score = p % last_wgt + p % absorb_wgt * flux + score = (p % last_wgt + p % absorb_wgt) * flux else score = p % last_wgt * flux end if @@ -417,6 +417,13 @@ contains case (SCORE_PROMPT_NU_FISSION) + ! make sure the correct energy is used + if (t % estimator == ESTIMATOR_TRACKLENGTH) then + E = p % E + else + E = p % last_E + end if + if (t % estimator == ESTIMATOR_ANALOG) then if (survival_biasing .or. p % fission) then if (t % find_filter(FILTER_ENERGYOUT) > 0) then @@ -453,13 +460,6 @@ contains end if else - ! make sure the correct energy is used - if (t % estimator == ESTIMATOR_TRACKLENGTH) then - E = p % E - else - E = p % last_E - end if - if (i_nuclide > 0) then score = micro_xs(i_nuclide) % fission * nuclides(i_nuclide) % & nu(E, EMISSION_PROMPT) * atom_density * flux @@ -675,6 +675,12 @@ contains case (SCORE_DECAY_RATE) + ! make sure the correct energy is used + if (t % estimator == ESTIMATOR_TRACKLENGTH) then + E = p % E + else + E = p % last_E + end if ! Set the delayedgroup filter index dg_filter = t % find_filter(FILTER_DELAYEDGROUP) diff --git a/tests/test_multipole/inputs_true.dat b/tests/test_multipole/inputs_true.dat index 930be9536..3b2b43ec7 100644 --- a/tests/test_multipole/inputs_true.dat +++ b/tests/test_multipole/inputs_true.dat @@ -1 +1 @@ -8462e17d102259b3a48a7e908bc75038a28a19d4a5e8bd38f26579e5baf3998bc2d05d1d3055ac1ed478d0c01bd64868d654919c2e6ca3fea86d79f03eda25ef \ No newline at end of file +2be927608035759f52a2ac88b2c84e28c06e0f7905187bfd4695fecd80f417e727d8879c52fe03253938f7aa0301061f72dce9b5ae46b8675049b5bc4d9525a0 \ No newline at end of file diff --git a/tests/test_multipole/results_true.dat b/tests/test_multipole/results_true.dat index 4d379b3f4..b17f6b0aa 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 a44489aa5..32b38dd76 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,7 @@ 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.temperature = {'tolerance': 1000, 'multipole': True} sets_file.export_to_xml() ####################