Skip to content

Commit

Permalink
Use temperature bounds in multigroup mode temperature refs #2402
Browse files Browse the repository at this point in the history
  • Loading branch information
GiudGiud committed Jun 24, 2024
1 parent 8ce81d1 commit 23302a1
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/mgxs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,32 @@ void Mgxs::metadata_from_hdf5(hid_t xs_id, const vector<double>& temperature,
settings::temperature_method = TemperatureMethod::NEAREST;
}

// Determine actual temperatures to read -- start by checking whether a
// temperature range was given (indicated by T_max > 0), in which case all
// temperatures in the range are loaded irrespective of what temperatures
// actually appear in the model
int n = temperature.size();
double T_min = n > 0 ? settings::temperature_range[0] : 0.0;
double T_max = n > 0 ? settings::temperature_range[1] : INFTY;
if (T_max > 0.0) {
// Determine first available temperature below or equal to T_min
auto T_min_it =
std::upper_bound(available_temps.begin(), available_temps.end(), T_min);
if (T_min_it != available_temps.begin())
--T_min_it;

// Determine first available temperature above or equal to T_max
auto T_max_it =
std::lower_bound(available_temps.begin(), available_temps.end(), T_max);
if (T_max_it != available_temps.end())
++T_max_it;

// Add corresponding temperatures to vector
for (auto it = T_min_it; it != T_max_it; ++it) {
temps_to_read.push_back(std::round(*it));
}
}

switch (settings::temperature_method) {
case TemperatureMethod::NEAREST:
// Determine actual temperatures to read
Expand Down Expand Up @@ -356,7 +382,7 @@ Mgxs::Mgxs(const std::string& in_name, const vector<double>& mat_kTs,
}
}
} // end switch
} // end microscopic temperature loop
} // end microscopic temperature loop

// Now combine the microscopic data at each relevant temperature
// We will do this by treating the multiple temperatures of a nuclide as
Expand Down

0 comments on commit 23302a1

Please sign in to comment.