Random Ray Source Region Mesh Subdivision (Cell-Under-Voxel Geometry) (#3333)

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
John Tramm 2025-03-06 20:48:31 -06:00 committed by GitHub
parent e8c9134ff6
commit 9b5678b5f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 16638 additions and 460 deletions

View file

@ -1,4 +1,5 @@
#include "openmc/settings.h"
#include "openmc/random_ray/flat_source_domain.h"
#include <cmath> // for ceil, pow
#include <limits> // for numeric_limits
@ -319,6 +320,31 @@ void get_run_parameters(pugi::xml_node node_base)
fatal_error("Unrecognized sample method: " + temp_str);
}
}
if (check_for_node(random_ray_node, "source_region_meshes")) {
pugi::xml_node node_source_region_meshes =
random_ray_node.child("source_region_meshes");
for (pugi::xml_node node_mesh :
node_source_region_meshes.children("mesh")) {
int mesh_id = std::stoi(node_mesh.attribute("id").value());
for (pugi::xml_node node_domain : node_mesh.children("domain")) {
int domain_id = std::stoi(node_domain.attribute("id").value());
std::string domain_type = node_domain.attribute("type").value();
Source::DomainType type;
if (domain_type == "material") {
type = Source::DomainType::MATERIAL;
} else if (domain_type == "cell") {
type = Source::DomainType::CELL;
} else if (domain_type == "universe") {
type = Source::DomainType::UNIVERSE;
} else {
throw std::runtime_error("Unknown domain type: " + domain_type);
}
FlatSourceDomain::mesh_domain_map_[mesh_id].emplace_back(
type, domain_id);
RandomRay::mesh_subdivision_enabled_ = true;
}
}
}
}
}