mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Refactor read_input_xml so that all non-trivial functionality is containined in public functions.
This commit is contained in:
parent
ac808730a6
commit
adf7077a01
5 changed files with 32 additions and 28 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue