Set upper and lower interpolation bounds for MGXS data. (#3803)

This commit is contained in:
Kevin Sawatzky 2026-02-15 15:59:08 -06:00 committed by GitHub
parent a35927aad3
commit c6ef84d1d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,6 +14,7 @@
#include "openmc/error.h"
#include "openmc/math_functions.h"
#include "openmc/mgxs_interface.h"
#include "openmc/nuclide.h"
#include "openmc/random_lcg.h"
#include "openmc/settings.h"
#include "openmc/string_utils.h"
@ -85,6 +86,13 @@ void Mgxs::metadata_from_hdf5(hid_t xs_id, const vector<double>& temperature,
delete[] dset_names;
std::sort(temps_available.begin(), temps_available.end());
// Set the global upper and lower interpolation bounds to avoid errors
// involving C-API functions.
data::temperature_min =
std::min(data::temperature_min, temps_available.front());
data::temperature_max =
std::max(data::temperature_max, temps_available.back());
// If only one temperature is available, lets just use nearest temperature
// interpolation
if ((num_temps == 1) &&