Merge pull request #1752 from helen-brooks/initialisation_refactor

Refactor read_input_xml
This commit is contained in:
April Novak 2021-02-02 10:58:08 -06:00 committed by GitHub
commit 29ed9292ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 28 deletions

View file

@ -70,6 +70,9 @@ void read_ce_cross_sections(const std::vector<std::vector<double>>& nuc_temps,
//! Read cross_sections.xml and populate data libraries
void read_ce_cross_sections_xml();
//! Load nuclide and thermal scattering data
void finalize_cross_sections();
void library_clear();
} // namespace openmc

View file

@ -46,14 +46,9 @@ void get_temperatures(std::vector<std::vector<double>>& nuc_temps,
//==============================================================================
//! \brief Perform final setup for geometry
//!
//! \param[out] nuc_temps Vector of temperatures for each nuclide
//! \param[out] thermal_temps Vector of tempratures for each thermal scattering
//! table
//==============================================================================
void finalize_geometry(std::vector<std::vector<double>>& nuc_temps,
std::vector<std::vector<double>>& thermal_temps);
void finalize_geometry();
//==============================================================================
//! Figure out which Universe is the root universe.

View file

@ -7,6 +7,7 @@
#include "openmc/dagmc.h"
#endif
#include "openmc/error.h"
#include "openmc/geometry_aux.h"
#include "openmc/file_utils.h"
#include "openmc/hdf5_interface.h"
#include "openmc/material.h"
@ -17,6 +18,7 @@
#include "openmc/settings.h"
#include "openmc/simulation.h"
#include "openmc/string_utils.h"
#include "openmc/timer.h"
#include "openmc/thermal.h"
#include "openmc/xml_interface.h"
#include "openmc/wmp.h"
@ -323,6 +325,27 @@ void read_ce_cross_sections_xml()
}
}
void finalize_cross_sections(){
if (settings::run_mode != RunMode::PLOTTING) {
simulation::time_read_xs.start();
if (settings::run_CE) {
// Determine desired temperatures for each nuclide and S(a,b) table
double_2dvec nuc_temps(data::nuclide_map.size());
double_2dvec thermal_temps(data::thermal_scatt_map.size());
get_temperatures(nuc_temps, thermal_temps);
// Read continuous-energy cross sections from HDF5
read_ce_cross_sections(nuc_temps, thermal_temps);
} else {
// Create material macroscopic data for MGXS
set_mg_interface_nuclides_and_temps();
data::mg.init();
mark_fissionable_mgxs_materials();
}
simulation::time_read_xs.stop();
}
}
void library_clear() {
data::libraries.clear();
data::library_map.clear();

View file

@ -242,8 +242,7 @@ get_temperatures(std::vector<std::vector<double>>& nuc_temps,
//==============================================================================
void finalize_geometry(std::vector<std::vector<double>>& nuc_temps,
std::vector<std::vector<double>>& thermal_temps)
void finalize_geometry()
{
// Perform some final operations to set up the geometry
adjust_indices();
@ -253,9 +252,6 @@ void finalize_geometry(std::vector<std::vector<double>>& nuc_temps,
// Assign temperatures to cells that don't have temperatures already assigned
assign_temperatures();
// Determine desired temperatures for each nuclide and S(a,b) table
get_temperatures(nuc_temps, thermal_temps);
// Determine number of nested coordinate levels in the geometry
model::n_coord_levels = maximum_levels(model::root_universe);
}

View file

@ -257,24 +257,11 @@ void read_input_xml()
read_materials_xml();
read_geometry_xml();
// Convert user IDs -> indices, assign temperatures
double_2dvec nuc_temps(data::nuclide_map.size());
double_2dvec thermal_temps(data::thermal_scatt_map.size());
finalize_geometry(nuc_temps, thermal_temps);
// Final geometry setup and assign temperatures
finalize_geometry();
if (settings::run_mode != RunMode::PLOTTING) {
simulation::time_read_xs.start();
if (settings::run_CE) {
// Read continuous-energy cross sections
read_ce_cross_sections(nuc_temps, thermal_temps);
} else {
// Create material macroscopic data for MGXS
set_mg_interface_nuclides_and_temps();
data::mg.init();
mark_fissionable_mgxs_materials();
}
simulation::time_read_xs.stop();
}
// Finalize cross sections having assigned temperatures
finalize_cross_sections();
read_tallies_xml();