Fix a few mistakes, update salphabeta test result

Turns out there was a bug in material_assign_sab_tables where a wrong sab_frac
got applied when multiple tables were present.
This commit is contained in:
Paul Romano 2019-01-28 08:23:21 -06:00
parent 2ffbb6ea26
commit 19a83ca1d4
5 changed files with 18 additions and 20 deletions

View file

@ -229,7 +229,7 @@ read_ce_cross_sections(const std::vector<std::vector<double>>& nuc_temps,
// Check if elemental data has been read, if needed
int pos = name.find_first_of("0123456789");
std::string element = name.substr(pos);
std::string element = name.substr(0, pos);
if (settings::photon_transport) {
if (already_read.find(element) == already_read.end()) {
// Read photon interaction data from HDF5 photon library
@ -275,9 +275,6 @@ read_ce_cross_sections(const std::vector<std::vector<double>>& nuc_temps,
}
for (auto& mat : model::materials) {
// Skip materials with no S(a,b) tables
if (mat->thermal_tables_.empty()) continue;
for (const auto& table : mat->thermal_tables_) {
// Get name of S(a,b) table
int i_table = table.index_table;
@ -305,12 +302,11 @@ read_ce_cross_sections(const std::vector<std::vector<double>>& nuc_temps,
already_read.insert(name);
}
} // thermal_tables_
// Finish setting up materials (normalizing densities, etc.)
mat->finalize();
} // materials
// Finish setting up materials (normalizing densities, etc.)
for (auto& mat : model::materials) {
mat->finalize();
}
// Set up logarithmic grid for nuclides
for (auto& nuc : data::nuclides) {

View file

@ -139,15 +139,13 @@ get_temperatures(std::vector<std::vector<double>>& nuc_temps,
}
}
if (mat->thermal_tables_.size() > 0) {
for (const auto& table : mat->thermal_tables_) {
// Get index in data::thermal_scatt array
int i_sab = table.index_table;
for (const auto& table : mat->thermal_tables_) {
// Get index in data::thermal_scatt array
int i_sab = table.index_table;
// Add temperature if it hasn't already been added
if (!contains(thermal_temps[i_sab], temperature)) {
thermal_temps[i_sab].push_back(temperature);
}
// Add temperature if it hasn't already been added
if (!contains(thermal_temps[i_sab], temperature)) {
thermal_temps[i_sab].push_back(temperature);
}
}
}

View file

@ -226,7 +226,7 @@ Material::Material(pugi::xml_node node)
// transport will be used, we need to add its symbol to the element_dict
if (settings::photon_transport) {
int pos = name.find_first_of("0123456789");
std::string element = name.substr(pos);
std::string element = name.substr(0, pos);
// Make sure photon cross section data is available
LibraryKey key {Library::Type::photon, element};
@ -689,7 +689,7 @@ void Material::calculate_neutron_xs(const Particle& p) const
// S(a,b) table, then don't use the S(a,b) table
if (p.E > data::thermal_scatt[i_sab]->threshold()) i_sab = C_NONE;
// Increment position in i_sab_nuclides
// Increment position in thermal_tables_
++j;
// Don't check for S(a,b) tables if there are no more left

View file

@ -603,7 +603,11 @@ sab_from_hdf5(hid_t group, const double* temperature, int n)
return data::thermal_scatt.back().get();
}
extern "C" void sab_clear() { data::thermal_scatt.clear(); }
extern "C" void sab_clear()
{
data::thermal_scatt.clear();
data::thermal_scatt_map.clear();
}
extern "C" bool sab_has_nuclide(int i_sab, const char* name)
{

View file

@ -1,2 +1,2 @@
k-combined:
8.447580E-01 1.806149E-02
8.403447E-01 2.461538E-02