diff --git a/include/openmc/constants.h b/include/openmc/constants.h index 28700bb9b..486ba5f18 100644 --- a/include/openmc/constants.h +++ b/include/openmc/constants.h @@ -114,7 +114,7 @@ constexpr int NUCLIDE_NONE {-1}; // CROSS SECTION RELATED CONSTANTS // Temperature treatment method -enum class TemperatureInterpolationType { +enum class TemperatureMethod { NEAREST, INTERPOLATION }; @@ -250,7 +250,7 @@ enum ReactionType { constexpr std::array DEPLETION_RX {N_GAMMA, N_P, N_A, N_2N, N_3N, N_4N}; -enum class UnresolvProbTableParam { +enum class URRTableParam { CUM_PROB, TOTAL, ELASTIC, @@ -376,7 +376,7 @@ enum class Interpolation { enum class RunMode { UNSET, // default value, OpenMC throws error if left to this - FIXEDSOURCE, + FIXED_SOURCE, EIGENVALUE, PLOTTING, PARTICLE, diff --git a/include/openmc/settings.h b/include/openmc/settings.h index cfb803697..1d99840ac 100644 --- a/include/openmc/settings.h +++ b/include/openmc/settings.h @@ -80,7 +80,7 @@ extern std::vector res_scat_nuclides; //!< Nuclides using res. ups extern RunMode run_mode; //!< Run mode (eigenvalue, fixed src, etc.) extern std::unordered_set sourcepoint_batch; //!< Batches when source should be written extern std::unordered_set statepoint_batch; //!< Batches when state should be written -extern TemperatureInterpolationType temperature_method; //!< method for choosing temperatures +extern TemperatureMethod temperature_method; //!< method for choosing temperatures extern double temperature_tolerance; //!< Tolerance in [K] on choosing temperatures extern double temperature_default; //!< Default T in [K] extern std::array temperature_range; //!< Min/max T in [K] over which to load xs diff --git a/include/openmc/surface.h b/include/openmc/surface.h index f0c76e873..c72fa8ef3 100644 --- a/include/openmc/surface.h +++ b/include/openmc/surface.h @@ -84,7 +84,7 @@ class Surface public: // Types of available boundary conditions on a surface - enum class Bc { + enum class BoundaryType { TRANSMIT, VACUUM, REFLECT, diff --git a/include/openmc/tallies/derivative.h b/include/openmc/tallies/derivative.h index e208fc432..be998e80b 100644 --- a/include/openmc/tallies/derivative.h +++ b/include/openmc/tallies/derivative.h @@ -15,7 +15,7 @@ namespace openmc { // Different independent variables -enum class WithRespectTo { +enum class DerivativeVariable { DENSITY, NUCLIDE_DENSITY, TEMPERATURE @@ -23,7 +23,7 @@ enum class WithRespectTo { struct TallyDerivative { - WithRespectTo variable; //!< Independent variable (like temperature) + DerivativeVariable variable; //!< Independent variable (like temperature) int id; //!< User-defined identifier int diff_material; //!< Material this derivative is applied to int diff_nuclide; //!< Nuclide this material is applied to diff --git a/src/cell.cpp b/src/cell.cpp index fbcdab42c..b0b074282 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -247,7 +247,7 @@ Cell::temperature(int32_t instance) const void Cell::set_temperature(double T, int32_t instance) { - if (settings::temperature_method == TemperatureInterpolationType::INTERPOLATION) { + if (settings::temperature_method == TemperatureMethod::INTERPOLATION) { if (T < data::temperature_min) { throw std::runtime_error{"Temperature is below minimum temperature at " "which data is available."}; diff --git a/src/dagmc.cpp b/src/dagmc.cpp index 571209bdd..33b2e8af8 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -347,11 +347,11 @@ void load_dagmc_geometry() to_lower(bc_value); if (bc_value == "transmit" || bc_value == "transmission") { - s->bc_ = Surface::Bc::TRANSMIT; + s->bc_ = Surface::BoundaryType::TRANSMIT; } else if (bc_value == "vacuum") { - s->bc_ = Surface::Bc::VACUUM; + s->bc_ = Surface::BoundaryType::VACUUM; } else if (bc_value == "reflective" || bc_value == "reflect" || bc_value == "reflecting") { - s->bc_ = Surface::Bc::REFLECT; + s->bc_ = Surface::BoundaryType::REFLECT; } else if (bc_value == "periodic") { fatal_error("Periodic boundary condition not supported in DAGMC."); } else { @@ -362,7 +362,7 @@ void load_dagmc_geometry() } } else { // if no condition is found, set to transmit - s->bc_ = Surface::Bc::TRANSMIT; + s->bc_ = Surface::BoundaryType::TRANSMIT; } // graveyard check @@ -373,7 +373,7 @@ void load_dagmc_geometry() // if this surface belongs to the graveyard if (graveyard && parent_vols.find(graveyard) != parent_vols.end()) { // set BC to vacuum - s->bc_ = Surface::Bc::VACUUM; + s->bc_ = Surface::BoundaryType::VACUUM; } // add to global array and map diff --git a/src/finalize.cpp b/src/finalize.cpp index 84fd4a7c0..a71a4d9b2 100644 --- a/src/finalize.cpp +++ b/src/finalize.cpp @@ -96,7 +96,7 @@ int openmc_finalize() settings::source_write = true; settings::survival_biasing = false; settings::temperature_default = 293.6; - settings::temperature_method = TemperatureInterpolationType::NEAREST; + settings::temperature_method = TemperatureMethod::NEAREST; settings::temperature_multipole = false; settings::temperature_range = {0.0, 0.0}; settings::temperature_tolerance = 10.0; diff --git a/src/main.cpp b/src/main.cpp index 36f7211a8..dea347ce4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char* argv[]) { // start problem based on mode switch (settings::run_mode) { - case RunMode::FIXEDSOURCE: + case RunMode::FIXED_SOURCE: case RunMode::EIGENVALUE: err = openmc_run(); break; diff --git a/src/mgxs.cpp b/src/mgxs.cpp index 9dd3cb394..55be267bc 100644 --- a/src/mgxs.cpp +++ b/src/mgxs.cpp @@ -102,15 +102,15 @@ Mgxs::metadata_from_hdf5(hid_t xs_id, const std::vector& temperature, // If only one temperature is available, lets just use nearest temperature // interpolation - if ((num_temps == 1) && (settings::temperature_method == TemperatureInterpolationType::INTERPOLATION)) { + if ((num_temps == 1) && (settings::temperature_method == TemperatureMethod::INTERPOLATION)) { warning("Cross sections for " + strtrim(name) + " are only available " + "at one temperature. Reverting to the nearest temperature " + "method."); - settings::temperature_method = TemperatureInterpolationType::NEAREST; + settings::temperature_method = TemperatureMethod::NEAREST; } switch(settings::temperature_method) { - case TemperatureInterpolationType::NEAREST: + case TemperatureMethod::NEAREST: // Determine actual temperatures to read for (const auto& T : temperature) { auto i_closest = xt::argmin(xt::abs(available_temps - T))[0]; @@ -129,7 +129,7 @@ Mgxs::metadata_from_hdf5(hid_t xs_id, const std::vector& temperature, } break; - case TemperatureInterpolationType::INTERPOLATION: + case TemperatureMethod::INTERPOLATION: for (int i = 0; i < temperature.size(); i++) { for (int j = 0; j < num_temps - 1; j++) { if ((available_temps[j] <= temperature[i]) && @@ -344,7 +344,7 @@ Mgxs::Mgxs(const std::string& in_name, const std::vector& mat_kTs, std::vector micro_t_interp(micros.size(), 0.); for (int m = 0; m < micros.size(); m++) { switch(settings::temperature_method) { - case TemperatureInterpolationType::NEAREST: + case TemperatureMethod::NEAREST: { micro_t[m] = xt::argmin(xt::abs(micros[m]->kTs - temp_desired))[0]; auto temp_actual = micros[m]->kTs[micro_t[m]]; @@ -357,7 +357,7 @@ Mgxs::Mgxs(const std::string& in_name, const std::vector& mat_kTs, } } break; - case TemperatureInterpolationType::INTERPOLATION: + case TemperatureMethod::INTERPOLATION: // Get a list of bounding temperatures for each actual temperature // present in the model for (int k = 0; k < micros[m]->kTs.shape()[0] - 1; k++) { @@ -381,7 +381,7 @@ Mgxs::Mgxs(const std::string& in_name, const std::vector& mat_kTs, // If we are doing nearest temperature interpolation, then we don't need // to do the 2nd temperature int num_interp_points = 2; - if (settings::temperature_method == TemperatureInterpolationType::NEAREST) num_interp_points = 1; + if (settings::temperature_method == TemperatureMethod::NEAREST) num_interp_points = 1; for (int interp_point = 0; interp_point < num_interp_points; interp_point++) { std::vector interp(micros.size()); std::vector temp_indices(micros.size()); diff --git a/src/nuclide.cpp b/src/nuclide.cpp index d21edb09a..3b0143073 100644 --- a/src/nuclide.cpp +++ b/src/nuclide.cpp @@ -69,12 +69,12 @@ Nuclide::Nuclide(hid_t group, const std::vector& temperature, int i_nucl std::sort(temps_available.begin(), temps_available.end()); // If only one temperature is available, revert to nearest temperature - if (temps_available.size() == 1 && settings::temperature_method == TemperatureInterpolationType::INTERPOLATION) { + if (temps_available.size() == 1 && settings::temperature_method == TemperatureMethod::INTERPOLATION) { if (mpi::master) { warning("Cross sections for " + name_ + " are only available at one " "temperature. Reverting to nearest temperature method."); } - settings::temperature_method = TemperatureInterpolationType::NEAREST; + settings::temperature_method = TemperatureMethod::NEAREST; } // Determine actual temperatures to read -- start by checking whether a @@ -93,7 +93,7 @@ Nuclide::Nuclide(hid_t group, const std::vector& temperature, int i_nucl } switch (settings::temperature_method) { - case TemperatureInterpolationType::NEAREST: + case TemperatureMethod::NEAREST: // Find nearest temperatures for (double T_desired : temperature) { @@ -126,7 +126,7 @@ Nuclide::Nuclide(hid_t group, const std::vector& temperature, int i_nucl } break; - case TemperatureInterpolationType::INTERPOLATION: + case TemperatureMethod::INTERPOLATION: // If temperature interpolation or multipole is selected, get a list of // bounding temperatures for each actual temperature present in the model for (double T_desired : temperature) { @@ -581,7 +581,7 @@ void Nuclide::calculate_xs(int i_sab, int i_log_union, double sab_frac, Particle double f; int i_temp = -1; switch (settings::temperature_method) { - case TemperatureInterpolationType::NEAREST: + case TemperatureMethod::NEAREST: { double max_diff = INFTY; for (int t = 0; t < kTs_.size(); ++t) { @@ -594,7 +594,7 @@ void Nuclide::calculate_xs(int i_sab, int i_log_union, double sab_frac, Particle } break; - case TemperatureInterpolationType::INTERPOLATION: + case TemperatureMethod::INTERPOLATION: // Find temperatures that bound the actual temperature for (i_temp = 0; i_temp < kTs_.size() - 1; ++i_temp) { if (kTs_[i_temp] <= kT && kT < kTs_[i_temp + 1]) break; @@ -784,10 +784,10 @@ void Nuclide::calculate_urr_xs(int i_temp, Particle& p) const p.stream_ = STREAM_TRACKING; int i_low = 0; - while (urr.prob_(i_energy, UnresolvProbTableParam::CUM_PROB, i_low) <= r) {++i_low;}; + while (urr.prob_(i_energy, URRTableParam::CUM_PROB, i_low) <= r) {++i_low;}; int i_up = 0; - while (urr.prob_(i_energy + 1, UnresolvProbTableParam::CUM_PROB, i_up) <= r) {++i_up;}; + while (urr.prob_(i_energy + 1, URRTableParam::CUM_PROB, i_up) <= r) {++i_up;}; // Determine elastic, fission, and capture cross sections from the // probability table @@ -800,46 +800,46 @@ void Nuclide::calculate_urr_xs(int i_temp, Particle& p) const f = (p.E_ - urr.energy_(i_energy)) / (urr.energy_(i_energy + 1) - urr.energy_(i_energy)); - elastic = (1. - f) * urr.prob_(i_energy, UnresolvProbTableParam::ELASTIC, i_low) + - f * urr.prob_(i_energy + 1, UnresolvProbTableParam::ELASTIC, i_up); - fission = (1. - f) * urr.prob_(i_energy, UnresolvProbTableParam::FISSION, i_low) + - f * urr.prob_(i_energy + 1, UnresolvProbTableParam::FISSION, i_up); - capture = (1. - f) * urr.prob_(i_energy, UnresolvProbTableParam::N_GAMMA, i_low) + - f * urr.prob_(i_energy + 1, UnresolvProbTableParam::N_GAMMA, i_up); + elastic = (1. - f) * urr.prob_(i_energy, URRTableParam::ELASTIC, i_low) + + f * urr.prob_(i_energy + 1, URRTableParam::ELASTIC, i_up); + fission = (1. - f) * urr.prob_(i_energy, URRTableParam::FISSION, i_low) + + f * urr.prob_(i_energy + 1, URRTableParam::FISSION, i_up); + capture = (1. - f) * urr.prob_(i_energy, URRTableParam::N_GAMMA, i_low) + + f * urr.prob_(i_energy + 1, URRTableParam::N_GAMMA, i_up); } else if (urr.interp_ == Interpolation::log_log) { // Determine interpolation factor on the table f = std::log(p.E_ / urr.energy_(i_energy)) / std::log(urr.energy_(i_energy + 1) / urr.energy_(i_energy)); // Calculate the elastic cross section/factor - if ((urr.prob_(i_energy, UnresolvProbTableParam::ELASTIC, i_low) > 0.) && - (urr.prob_(i_energy + 1, UnresolvProbTableParam::ELASTIC, i_up) > 0.)) { + if ((urr.prob_(i_energy, URRTableParam::ELASTIC, i_low) > 0.) && + (urr.prob_(i_energy + 1, URRTableParam::ELASTIC, i_up) > 0.)) { elastic = std::exp((1. - f) * - std::log(urr.prob_(i_energy, UnresolvProbTableParam::ELASTIC, i_low)) + - f * std::log(urr.prob_(i_energy + 1, UnresolvProbTableParam::ELASTIC, i_up))); + std::log(urr.prob_(i_energy, URRTableParam::ELASTIC, i_low)) + + f * std::log(urr.prob_(i_energy + 1, URRTableParam::ELASTIC, i_up))); } else { elastic = 0.; } // Calculate the fission cross section/factor - if ((urr.prob_(i_energy, UnresolvProbTableParam::FISSION, i_low) > 0.) && - (urr.prob_(i_energy + 1, UnresolvProbTableParam::FISSION, i_up) > 0.)) { + if ((urr.prob_(i_energy, URRTableParam::FISSION, i_low) > 0.) && + (urr.prob_(i_energy + 1, URRTableParam::FISSION, i_up) > 0.)) { fission = std::exp((1. - f) * - std::log(urr.prob_(i_energy, UnresolvProbTableParam::FISSION, i_low)) + - f * std::log(urr.prob_(i_energy + 1, UnresolvProbTableParam::FISSION, i_up))); + std::log(urr.prob_(i_energy, URRTableParam::FISSION, i_low)) + + f * std::log(urr.prob_(i_energy + 1, URRTableParam::FISSION, i_up))); } else { fission = 0.; } // Calculate the capture cross section/factor - if ((urr.prob_(i_energy, UnresolvProbTableParam::N_GAMMA, i_low) > 0.) && - (urr.prob_(i_energy + 1, UnresolvProbTableParam::N_GAMMA, i_up) > 0.)) { + if ((urr.prob_(i_energy, URRTableParam::N_GAMMA, i_low) > 0.) && + (urr.prob_(i_energy + 1, URRTableParam::N_GAMMA, i_up) > 0.)) { capture = std::exp((1. - f) * - std::log(urr.prob_(i_energy, UnresolvProbTableParam::N_GAMMA, i_low)) + - f * std::log(urr.prob_(i_energy + 1, UnresolvProbTableParam::N_GAMMA, i_up))); + std::log(urr.prob_(i_energy, URRTableParam::N_GAMMA, i_low)) + + f * std::log(urr.prob_(i_energy + 1, URRTableParam::N_GAMMA, i_up))); } else { capture = 0.; } diff --git a/src/output.cpp b/src/output.cpp index 9ec8b4c9b..faa9a7acd 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -659,16 +659,16 @@ write_tallies() if (tally.deriv_ != C_NONE) { const auto& deriv {model::tally_derivs[tally.deriv_]}; switch (deriv.variable) { - case WithRespectTo::DENSITY: + case DerivativeVariable::DENSITY: tallies_out << " Density derivative Material " << std::to_string(deriv.diff_material) << "\n"; break; - case WithRespectTo::NUCLIDE_DENSITY: + case DerivativeVariable::NUCLIDE_DENSITY: tallies_out << " Nuclide density derivative Material " << std::to_string(deriv.diff_material) << " Nuclide " << data::nuclides[deriv.diff_nuclide]->name_ << "\n"; break; - case WithRespectTo::TEMPERATURE: + case DerivativeVariable::TEMPERATURE: tallies_out << " Temperature derivative Material " << std::to_string(deriv.diff_material) << "\n"; break; diff --git a/src/particle.cpp b/src/particle.cpp index 724821824..8bcde89d2 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -400,7 +400,7 @@ Particle::cross_surface() write_message(" Crossing surface " + std::to_string(surf->id_)); } - if (surf->bc_ == Surface::Bc::VACUUM && (settings::run_mode != RunMode::PLOTTING)) { + if (surf->bc_ == Surface::BoundaryType::VACUUM && (settings::run_mode != RunMode::PLOTTING)) { // ======================================================================= // PARTICLE LEAKS OUT OF PROBLEM @@ -428,7 +428,7 @@ Particle::cross_surface() } return; - } else if ((surf->bc_ == Surface::Bc::REFLECT || surf->bc_ == Surface::Bc::WHITE) + } else if ((surf->bc_ == Surface::BoundaryType::REFLECT || surf->bc_ == Surface::Bc::WHITE) && (settings::run_mode != RunMode::PLOTTING)) { // ======================================================================= // PARTICLE REFLECTS FROM SURFACE @@ -459,7 +459,7 @@ Particle::cross_surface() this->r() = r; } - Direction u = (surf->bc_ == Surface::Bc::REFLECT) ? + Direction u = (surf->bc_ == Surface::BoundaryType::REFLECT) ? surf->reflect(this->r(), this->u()) : surf->diffuse_reflect(this->r(), this->u(), this->current_seed()); @@ -492,7 +492,7 @@ Particle::cross_surface() } return; - } else if (surf->bc_ == Surface::Bc::PERIODIC && settings::run_mode != RunMode::PLOTTING) { + } else if (surf->bc_ == Surface::BoundaryType::PERIODIC && settings::run_mode != RunMode::PLOTTING) { // ======================================================================= // PERIODIC BOUNDARY @@ -654,7 +654,7 @@ Particle::write_restart() const write_dataset(file_id, "current_generation", simulation::current_gen); write_dataset(file_id, "n_particles", settings::n_particles); switch (settings::run_mode) { - case RunMode::FIXEDSOURCE: + case RunMode::FIXED_SOURCE: write_dataset(file_id, "run_mode", "fixed source"); break; case RunMode::EIGENVALUE: diff --git a/src/particle_restart.cpp b/src/particle_restart.cpp index 6b206c42c..1f5ff9eb8 100644 --- a/src/particle_restart.cpp +++ b/src/particle_restart.cpp @@ -38,7 +38,7 @@ void read_particle_restart(Particle& p, RunMode& previous_run_mode) if (mode == "eigenvalue") { previous_run_mode = RunMode::EIGENVALUE; } else if (mode == "fixed source") { - previous_run_mode = RunMode::FIXEDSOURCE; + previous_run_mode = RunMode::FIXED_SOURCE; } read_dataset(file_id, "id", p.id_); int type; @@ -91,7 +91,7 @@ void run_particle_restart() case RunMode::EIGENVALUE: particle_seed = (simulation::total_gen + overall_generation() - 1)*settings::n_particles + p.id_; break; - case RunMode::FIXEDSOURCE: + case RunMode::FIXED_SOURCE: particle_seed = p.id_; break; default: diff --git a/src/physics.cpp b/src/physics.cpp index fa31214c5..483424493 100644 --- a/src/physics.cpp +++ b/src/physics.cpp @@ -96,7 +96,7 @@ void sample_neutron_reaction(Particle* p) Reaction* rx = sample_fission(i_nuclide, p); if (settings::run_mode == RunMode::EIGENVALUE) { create_fission_sites(p, i_nuclide, rx, simulation::fission_bank); - } else if (settings::run_mode == RunMode::FIXEDSOURCE && + } else if (settings::run_mode == RunMode::FIXED_SOURCE && settings::create_fission_neutrons) { create_fission_sites(p, i_nuclide, rx, simulation::secondary_bank); diff --git a/src/physics_mg.cpp b/src/physics_mg.cpp index 91a02b87c..efc500bee 100644 --- a/src/physics_mg.cpp +++ b/src/physics_mg.cpp @@ -49,7 +49,7 @@ sample_reaction(Particle* p) if (model::materials[p->material_]->fissionable_) { if (settings::run_mode == RunMode::EIGENVALUE) { create_fission_sites(p, simulation::fission_bank); - } else if ((settings::run_mode == RunMode::FIXEDSOURCE) && + } else if ((settings::run_mode == RunMode::FIXED_SOURCE) && (settings::create_fission_neutrons)) { create_fission_sites(p, simulation::secondary_bank); } diff --git a/src/settings.cpp b/src/settings.cpp index 0f60869e6..916d07b46 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -94,7 +94,7 @@ std::vector res_scat_nuclides; RunMode run_mode {RunMode::UNSET}; std::unordered_set sourcepoint_batch; std::unordered_set statepoint_batch; -TemperatureInterpolationType temperature_method {TemperatureInterpolationType::NEAREST}; +TemperatureMethod temperature_method {TemperatureInterpolationType::NEAREST}; double temperature_tolerance {10.0}; double temperature_default {293.6}; std::array temperature_range {0.0, 0.0}; @@ -299,7 +299,7 @@ void read_settings_xml() if (temp_str == "eigenvalue") { run_mode = RunMode::EIGENVALUE; } else if (temp_str == "fixed source") { - run_mode = RunMode::FIXEDSOURCE; + run_mode = RunMode::FIXED_SOURCE; } else if (temp_str == "plot") { run_mode = RunMode::PLOTTING; } else if (temp_str == "particle restart") { @@ -322,7 +322,7 @@ void read_settings_xml() } else { node_mode = root.child("fixed_source"); if (node_mode) { - run_mode = RunMode::FIXEDSOURCE; + run_mode = RunMode::FIXED_SOURCE; } else { fatal_error(" or not specified."); } @@ -330,7 +330,7 @@ void read_settings_xml() } } - if (run_mode == RunMode::EIGENVALUE || run_mode == RunMode::FIXEDSOURCE) { + if (run_mode == RunMode::EIGENVALUE || run_mode == RunMode::FIXED_SOURCE) { // Read run parameters get_run_parameters(node_mode); @@ -732,9 +732,9 @@ void read_settings_xml() if (check_for_node(root, "temperature_method")) { auto temp = get_node_value(root, "temperature_method", true, true); if (temp == "nearest") { - temperature_method = TemperatureInterpolationType::NEAREST; + temperature_method = TemperatureMethod::NEAREST; } else if (temp == "interpolation") { - temperature_method = TemperatureInterpolationType::INTERPOLATION; + temperature_method = TemperatureMethod::INTERPOLATION; } else { fatal_error("Unknown temperature method: " + temp); } @@ -773,7 +773,7 @@ void read_settings_xml() } // Check whether create fission sites - if (run_mode == RunMode::FIXEDSOURCE) { + if (run_mode == RunMode::FIXED_SOURCE) { if (check_for_node(root, "create_fission_neutrons")) { create_fission_neutrons = get_node_value_bool(root, "create_fission_neutrons"); } diff --git a/src/simulation.cpp b/src/simulation.cpp index c7c096b58..e2e730dc6 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -100,7 +100,7 @@ int openmc_simulation_init() // Display header if (mpi::master) { - if (settings::run_mode == RunMode::FIXEDSOURCE) { + if (settings::run_mode == RunMode::FIXED_SOURCE) { header("FIXED SOURCE TRANSPORT SIMULATION", 3); } else if (settings::run_mode == RunMode::EIGENVALUE) { header("K EIGENVALUE SIMULATION", 3); @@ -306,7 +306,7 @@ void initialize_batch() // Increment current batch ++simulation::current_batch; - if (settings::run_mode == RunMode::FIXEDSOURCE) { + if (settings::run_mode == RunMode::FIXED_SOURCE) { int b = simulation::current_batch; write_message("Simulating batch " + std::to_string(b), 6); } @@ -460,7 +460,7 @@ void finalize_generation() } } - } else if (settings::run_mode == RunMode::FIXEDSOURCE) { + } else if (settings::run_mode == RunMode::FIXED_SOURCE) { // For fixed-source mode, we need to sample the external source fill_source_bank_fixedsource(); } diff --git a/src/state_point.cpp b/src/state_point.cpp index 5c99c227c..cf733dd77 100644 --- a/src/state_point.cpp +++ b/src/state_point.cpp @@ -83,7 +83,7 @@ openmc_statepoint_write(const char* filename, bool* write_source) write_dataset(file_id, "energy_mode", settings::run_CE ? "continuous-energy" : "multi-group"); switch (settings::run_mode) { - case RunMode::FIXEDSOURCE: + case RunMode::FIXED_SOURCE: write_dataset(file_id, "run_mode", "fixed source"); break; case RunMode::EIGENVALUE: @@ -116,13 +116,13 @@ openmc_statepoint_write(const char* filename, bool* write_source) hid_t deriv_group = create_group(derivs_group, "derivative " + std::to_string(deriv.id)); write_dataset(deriv_group, "material", deriv.diff_material); - if (deriv.variable == WithRespectTo::DENSITY) { + if (deriv.variable == DerivativeVariable::DENSITY) { write_dataset(deriv_group, "independent variable", "density"); - } else if (deriv.variable == WithRespectTo::NUCLIDE_DENSITY) { + } else if (deriv.variable == DerivativeVariable::NUCLIDE_DENSITY) { write_dataset(deriv_group, "independent variable", "nuclide_density"); write_dataset(deriv_group, "nuclide", data::nuclides[deriv.diff_nuclide]->name_); - } else if (deriv.variable == WithRespectTo::TEMPERATURE) { + } else if (deriv.variable == DerivativeVariable::TEMPERATURE) { write_dataset(deriv_group, "independent variable", "temperature"); } else { fatal_error("Independent variable for derivative " @@ -363,7 +363,7 @@ void load_state_point() // Read and overwrite run information except number of batches read_dataset(file_id, "run_mode", word); if (word == "fixed source") { - settings::run_mode = RunMode::FIXEDSOURCE; + settings::run_mode = RunMode::FIXED_SOURCE; } else if (word == "eigenvalue") { settings::run_mode = RunMode::EIGENVALUE; } diff --git a/src/surface.cpp b/src/surface.cpp index 0e25e4ff9..c1f4885be 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -132,18 +132,18 @@ Surface::Surface(pugi::xml_node surf_node) std::string surf_bc = get_node_value(surf_node, "boundary", true, true); if (surf_bc == "transmission" || surf_bc == "transmit" ||surf_bc.empty()) { - bc_ = Bc::TRANSMIT; + bc_ = BoundaryType::TRANSMIT; } else if (surf_bc == "vacuum") { - bc_ = Bc::VACUUM; + bc_ = BoundaryType::VACUUM; } else if (surf_bc == "reflective" || surf_bc == "reflect" || surf_bc == "reflecting") { - bc_ = Bc::REFLECT; + bc_ = BoundaryType::REFLECT; } else if (surf_bc == "white") { - bc_ = Bc::WHITE; + bc_ = BoundaryType::WHITE; } else if (surf_bc == "periodic") { - bc_ = Bc::PERIODIC; + bc_ = BoundaryType::PERIODIC; } else { std::stringstream err_msg; err_msg << "Unknown boundary condition \"" << surf_bc @@ -152,7 +152,7 @@ Surface::Surface(pugi::xml_node surf_node) } } else { - bc_ = Bc::TRANSMIT; + bc_ = BoundaryType::TRANSMIT; } } @@ -220,19 +220,19 @@ CSGSurface::to_hdf5(hid_t group_id) const hid_t surf_group = create_group(group_id, group_name); switch(bc_) { - case Bc::TRANSMIT : + case BoundaryType::TRANSMIT : write_string(surf_group, "boundary_type", "transmission", false); break; - case Bc::VACUUM : + case BoundaryType::VACUUM : write_string(surf_group, "boundary_type", "vacuum", false); break; - case Bc::REFLECT : + case BoundaryType::REFLECT : write_string(surf_group, "boundary_type", "reflective", false); break; - case Bc::WHITE : + case BoundaryType::WHITE : write_string(surf_group, "boundary_type", "white", false); break; - case Bc::PERIODIC : + case BoundaryType::PERIODIC : write_string(surf_group, "boundary_type", "periodic", false); break; } @@ -1195,7 +1195,7 @@ void read_surfaces(pugi::xml_node node) zmin {INFTY}, zmax {-INFTY}; int i_xmin, i_xmax, i_ymin, i_ymax, i_zmin, i_zmax; for (int i_surf = 0; i_surf < model::surfaces.size(); i_surf++) { - if (model::surfaces[i_surf]->bc_ == Surface::Bc::PERIODIC) { + if (model::surfaces[i_surf]->bc_ == Surface::BoundaryType::PERIODIC) { // Downcast to the PeriodicSurface type. Surface* surf_base = model::surfaces[i_surf].get(); auto surf = dynamic_cast(surf_base); @@ -1240,7 +1240,7 @@ void read_surfaces(pugi::xml_node node) // Set i_periodic for periodic BC surfaces. for (int i_surf = 0; i_surf < model::surfaces.size(); i_surf++) { - if (model::surfaces[i_surf]->bc_ == Surface::Bc::PERIODIC) { + if (model::surfaces[i_surf]->bc_ == Surface::BoundaryType::PERIODIC) { // Downcast to the PeriodicSurface type. Surface* surf_base = model::surfaces[i_surf].get(); auto surf = dynamic_cast(surf_base); @@ -1289,7 +1289,7 @@ void read_surfaces(pugi::xml_node node) } // Make sure the opposite surface is also periodic. - if (model::surfaces[surf->i_periodic_]->bc_ != Surface::Bc::PERIODIC) { + if (model::surfaces[surf->i_periodic_]->bc_ != Surface::BoundaryType::PERIODIC) { std::stringstream err_msg; err_msg << "Could not find matching surface for periodic boundary " "condition on surface " << surf->id_; @@ -1302,7 +1302,7 @@ void read_surfaces(pugi::xml_node node) // surface bool boundary_exists = false; for (const auto& surf : model::surfaces) { - if (surf->bc_ != Surface::Bc::TRANSMIT) { + if (surf->bc_ != Surface::BoundaryType::TRANSMIT) { boundary_exists = true; break; } diff --git a/src/tallies/derivative.cpp b/src/tallies/derivative.cpp index c538a3921..74bf122d6 100644 --- a/src/tallies/derivative.cpp +++ b/src/tallies/derivative.cpp @@ -41,10 +41,10 @@ TallyDerivative::TallyDerivative(pugi::xml_node node) std::string variable_str = get_node_value(node, "variable"); if (variable_str == "density") { - variable = WithRespectTo::DENSITY; + variable = DerivativeVariable::DENSITY; } else if (variable_str == "nuclide_density") { - variable = WithRespectTo::NUCLIDE_DENSITY; + variable = DerivativeVariable::NUCLIDE_DENSITY; std::string nuclide_name = get_node_value(node, "nuclide"); bool found = false; @@ -62,7 +62,7 @@ TallyDerivative::TallyDerivative(pugi::xml_node node) } } else if (variable_str == "temperature") { - variable = WithRespectTo::TEMPERATURE; + variable = DerivativeVariable::TEMPERATURE; } else { std::stringstream out; @@ -146,7 +146,7 @@ apply_derivative_to_score(const Particle* p, int i_tally, int i_nuclide, // d_c / d_rho = sigma_MT * const // (1 / c) * (d_c / d_rho) = 1 / rho - case WithRespectTo::DENSITY: + case DerivativeVariable::DENSITY: switch (tally.estimator_) { case TallyEstimator::ANALOG: @@ -186,7 +186,7 @@ apply_derivative_to_score(const Particle* p, int i_tally, int i_nuclide, // (1 / c) * (d_c / d_N) = sigma_MT_i / Sigma_MT // where i is the perturbed nuclide. - case WithRespectTo::NUCLIDE_DENSITY: + case DerivativeVariable::NUCLIDE_DENSITY: switch (tally.estimator_) { case TallyEstimator::ANALOG: @@ -312,7 +312,7 @@ apply_derivative_to_score(const Particle* p, int i_tally, int i_nuclide, // computed by multipole_deriv_eval. It only works for the resolved // resonance range and requires multipole data. - case WithRespectTo::TEMPERATURE: + case DerivativeVariable::TEMPERATURE: switch (tally.estimator_) { case TallyEstimator::ANALOG: @@ -578,7 +578,7 @@ score_track_derivative(const Particle* p, double distance) switch (deriv.variable) { - case WithRespectTo::DENSITY: + case DerivativeVariable::DENSITY: // phi is proportional to e^(-Sigma_tot * dist) // (1 / phi) * (d_phi / d_rho) = - (d_Sigma_tot / d_rho) * dist // (1 / phi) * (d_phi / d_rho) = - Sigma_tot / rho * dist @@ -586,7 +586,7 @@ score_track_derivative(const Particle* p, double distance) / material.density_gpcc_; break; - case WithRespectTo::NUCLIDE_DENSITY: + case DerivativeVariable::NUCLIDE_DENSITY: // phi is proportional to e^(-Sigma_tot * dist) // (1 / phi) * (d_phi / d_N) = - (d_Sigma_tot / d_N) * dist // (1 / phi) * (d_phi / d_N) = - sigma_tot * dist @@ -594,7 +594,7 @@ score_track_derivative(const Particle* p, double distance) * p->neutron_xs_[deriv.diff_nuclide].total; break; - case WithRespectTo::TEMPERATURE: + case DerivativeVariable::TEMPERATURE: for (auto i = 0; i < material.nuclide_.size(); ++i) { const auto& nuc {*data::nuclides[material.nuclide_[i]]}; if (multipole_in_range(&nuc, p->E_last_)) { @@ -625,14 +625,14 @@ void score_collision_derivative(const Particle* p) switch (deriv.variable) { - case WithRespectTo::DENSITY: + case DerivativeVariable::DENSITY: // phi is proportional to Sigma_s // (1 / phi) * (d_phi / d_rho) = (d_Sigma_s / d_rho) / Sigma_s // (1 / phi) * (d_phi / d_rho) = 1 / rho deriv.flux_deriv += 1. / material.density_gpcc_; break; - case WithRespectTo::NUCLIDE_DENSITY: + case DerivativeVariable::NUCLIDE_DENSITY: if (p->event_nuclide_ != deriv.diff_nuclide) continue; // Find the index in this material for the diff_nuclide. int i; @@ -653,7 +653,7 @@ void score_collision_derivative(const Particle* p) deriv.flux_deriv += 1. / material.atom_density_(i); break; - case WithRespectTo::TEMPERATURE: + case DerivativeVariable::TEMPERATURE: // Loop over the material's nuclides until we find the event nuclide. for (auto i_nuc : material.nuclide_) { const auto& nuc {*data::nuclides[i_nuc]}; diff --git a/src/tallies/tally.cpp b/src/tallies/tally.cpp index 247e3e441..20fffb737 100644 --- a/src/tallies/tally.cpp +++ b/src/tallies/tally.cpp @@ -407,8 +407,8 @@ Tally::Tally(pugi::xml_node node) } const auto& deriv = model::tally_derivs[deriv_]; - if (deriv.variable == WithRespectTo::NUCLIDE_DENSITY - || deriv.variable == WithRespectTo::TEMPERATURE) { + if (deriv.variable == DerivativeVariable::NUCLIDE_DENSITY + || deriv.variable == DerivativeVariable::TEMPERATURE) { for (int i_nuc : nuclides_) { if (has_energyout && i_nuc == -1) { fatal_error("Error on tally " + std::to_string(id_) @@ -823,7 +823,7 @@ void Tally::accumulate() if (mpi::master || !settings::reduce_tallies) { // Calculate total source strength for normalization double total_source = 0.0; - if (settings::run_mode == RunMode::FIXEDSOURCE) { + if (settings::run_mode == RunMode::FIXED_SOURCE) { for (const auto& s : model::external_sources) { total_source += s.strength(); } diff --git a/src/thermal.cpp b/src/thermal.cpp index ab0dd1542..ee06ed8aa 100644 --- a/src/thermal.cpp +++ b/src/thermal.cpp @@ -76,7 +76,7 @@ ThermalScattering::ThermalScattering(hid_t group, const std::vector& tem } switch (settings::temperature_method) { - case TemperatureInterpolationType::NEAREST: + case TemperatureMethod::NEAREST: // Determine actual temperatures to read for (const auto& T : temperature) { @@ -96,7 +96,7 @@ ThermalScattering::ThermalScattering(hid_t group, const std::vector& tem } break; - case TemperatureInterpolationType::INTERPOLATION: + case TemperatureMethod::INTERPOLATION: // If temperature interpolation or multipole is selected, get a list of // bounding temperatures for each actual temperature present in the model for (const auto& T : temperature) { @@ -156,7 +156,7 @@ ThermalScattering::calculate_xs(double E, double sqrtkT, int* i_temp, // Determine temperature for S(a,b) table double kT = sqrtkT*sqrtkT; int i; - if (settings::temperature_method == TemperatureInterpolationType::NEAREST) { + if (settings::temperature_method == TemperatureMethod::NEAREST) { // If using nearest temperature, do linear search on temperature for (i = 0; i < kTs_.size(); ++i) { if (std::abs(kTs_[i] - kT) < K_BOLTZMANN*settings::temperature_tolerance) {