mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Random Ray Transport (#2823)
Co-authored-by: Gavin Ridley <gavin.keith.ridley@gmail.com> Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
d53155d234
commit
5111aa2621
46 changed files with 4512 additions and 69 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include "openmc/output.h"
|
||||
#include "openmc/plot.h"
|
||||
#include "openmc/random_lcg.h"
|
||||
#include "openmc/random_ray/random_ray.h"
|
||||
#include "openmc/simulation.h"
|
||||
#include "openmc/source.h"
|
||||
#include "openmc/string_utils.h"
|
||||
|
|
@ -113,6 +114,7 @@ double res_scat_energy_min {0.01};
|
|||
double res_scat_energy_max {1000.0};
|
||||
vector<std::string> res_scat_nuclides;
|
||||
RunMode run_mode {RunMode::UNSET};
|
||||
SolverType solver_type {SolverType::MONTE_CARLO};
|
||||
std::unordered_set<int> sourcepoint_batch;
|
||||
std::unordered_set<int> statepoint_batch;
|
||||
std::unordered_set<int> source_write_surf_id;
|
||||
|
|
@ -233,6 +235,38 @@ void get_run_parameters(pugi::xml_node node_base)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Random ray variables
|
||||
if (solver_type == SolverType::RANDOM_RAY) {
|
||||
xml_node random_ray_node = node_base.child("random_ray");
|
||||
if (check_for_node(random_ray_node, "distance_active")) {
|
||||
RandomRay::distance_active_ =
|
||||
std::stod(get_node_value(random_ray_node, "distance_active"));
|
||||
if (RandomRay::distance_active_ <= 0.0) {
|
||||
fatal_error("Random ray active distance must be greater than 0");
|
||||
}
|
||||
} else {
|
||||
fatal_error("Specify random ray active distance in settings XML");
|
||||
}
|
||||
if (check_for_node(random_ray_node, "distance_inactive")) {
|
||||
RandomRay::distance_inactive_ =
|
||||
std::stod(get_node_value(random_ray_node, "distance_inactive"));
|
||||
if (RandomRay::distance_inactive_ < 0) {
|
||||
fatal_error(
|
||||
"Random ray inactive distance must be greater than or equal to 0");
|
||||
}
|
||||
} else {
|
||||
fatal_error("Specify random ray inactive distance in settings XML");
|
||||
}
|
||||
if (check_for_node(random_ray_node, "source")) {
|
||||
xml_node source_node = random_ray_node.child("source");
|
||||
// Get point to list of <source> elements and make sure there is at least
|
||||
// one
|
||||
RandomRay::ray_source_ = Source::create(source_node);
|
||||
} else {
|
||||
fatal_error("Specify random ray source in settings XML");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void read_settings_xml()
|
||||
|
|
@ -389,6 +423,14 @@ void read_settings_xml(pugi::xml_node root)
|
|||
}
|
||||
}
|
||||
|
||||
// Check solver type
|
||||
if (check_for_node(root, "random_ray")) {
|
||||
solver_type = SolverType::RANDOM_RAY;
|
||||
if (run_CE)
|
||||
fatal_error("multi-group energy mode must be specified in settings XML "
|
||||
"when using the random ray solver.");
|
||||
}
|
||||
|
||||
if (run_mode == RunMode::EIGENVALUE || run_mode == RunMode::FIXED_SOURCE) {
|
||||
// Read run parameters
|
||||
get_run_parameters(node_mode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue