mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Implementation of Shannon Entropy for Random Ray (#3030)
Co-authored-by: Ethan Krammer <ethan@DESKTOP-MGFGK9N> Co-authored-by: John Tramm <john.tramm@gmail.com>
This commit is contained in:
parent
8ce81d132a
commit
a8171cbd4e
14 changed files with 283 additions and 30 deletions
|
|
@ -627,30 +627,37 @@ void read_settings_xml(pugi::xml_node root)
|
|||
}
|
||||
}
|
||||
|
||||
// Shannon Entropy mesh
|
||||
if (check_for_node(root, "entropy_mesh")) {
|
||||
int temp = std::stoi(get_node_value(root, "entropy_mesh"));
|
||||
if (model::mesh_map.find(temp) == model::mesh_map.end()) {
|
||||
fatal_error(fmt::format(
|
||||
"Mesh {} specified for Shannon entropy does not exist.", temp));
|
||||
// Shannon entropy
|
||||
if (solver_type == SolverType::RANDOM_RAY) {
|
||||
if (check_for_node(root, "entropy_mesh")) {
|
||||
fatal_error("Random ray uses FSRs to compute the Shannon entropy. "
|
||||
"No user-defined entropy mesh is supported.");
|
||||
}
|
||||
|
||||
auto* m =
|
||||
dynamic_cast<RegularMesh*>(model::meshes[model::mesh_map.at(temp)].get());
|
||||
if (!m)
|
||||
fatal_error("Only regular meshes can be used as an entropy mesh");
|
||||
simulation::entropy_mesh = m;
|
||||
|
||||
// Turn on Shannon entropy calculation
|
||||
entropy_on = true;
|
||||
} else if (solver_type == SolverType::MONTE_CARLO) {
|
||||
if (check_for_node(root, "entropy_mesh")) {
|
||||
int temp = std::stoi(get_node_value(root, "entropy_mesh"));
|
||||
if (model::mesh_map.find(temp) == model::mesh_map.end()) {
|
||||
fatal_error(fmt::format(
|
||||
"Mesh {} specified for Shannon entropy does not exist.", temp));
|
||||
}
|
||||
|
||||
} else if (check_for_node(root, "entropy")) {
|
||||
fatal_error(
|
||||
"Specifying a Shannon entropy mesh via the <entropy> element "
|
||||
"is deprecated. Please create a mesh using <mesh> and then reference "
|
||||
"it by specifying its ID in an <entropy_mesh> element.");
|
||||
auto* m = dynamic_cast<RegularMesh*>(
|
||||
model::meshes[model::mesh_map.at(temp)].get());
|
||||
if (!m)
|
||||
fatal_error("Only regular meshes can be used as an entropy mesh");
|
||||
simulation::entropy_mesh = m;
|
||||
|
||||
// Turn on Shannon entropy calculation
|
||||
entropy_on = true;
|
||||
|
||||
} else if (check_for_node(root, "entropy")) {
|
||||
fatal_error(
|
||||
"Specifying a Shannon entropy mesh via the <entropy> element "
|
||||
"is deprecated. Please create a mesh using <mesh> and then reference "
|
||||
"it by specifying its ID in an <entropy_mesh> element.");
|
||||
}
|
||||
}
|
||||
|
||||
// Uniform fission source weighting mesh
|
||||
if (check_for_node(root, "ufs_mesh")) {
|
||||
auto temp = std::stoi(get_node_value(root, "ufs_mesh"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue