mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Merge pull request #1157 from pshriwise/graveyard_bcs
Adopting graveyard convention for DAGMC models.
This commit is contained in:
commit
7ff5647a53
3 changed files with 38 additions and 5 deletions
|
|
@ -134,7 +134,7 @@ void load_dagmc_geometry()
|
|||
|
||||
// initialize cell objects
|
||||
model::n_cells = model::DAG->num_entities(3);
|
||||
|
||||
moab::EntityHandle graveyard = 0;
|
||||
for (int i = 0; i < model::n_cells; i++) {
|
||||
moab::EntityHandle vol_handle = model::DAG->entity_by_index(3, i+1);
|
||||
|
||||
|
|
@ -175,10 +175,22 @@ void load_dagmc_geometry()
|
|||
if (model::DAG->is_implicit_complement(vol_handle)) {
|
||||
if (model::DAG->has_prop(vol_handle, "mat")) {
|
||||
// if the implicit complement has been assigned a material, use it
|
||||
std::string comp_mat = DMD.volume_material_property_data_eh[vol_handle];
|
||||
// Note: material numbers are set by UWUW
|
||||
int mat_number = uwuw.material_library[comp_mat].metadata["mat_number"].asInt();
|
||||
c->material_.push_back(mat_number);
|
||||
if (using_uwuw) {
|
||||
std::string comp_mat = DMD.volume_material_property_data_eh[vol_handle];
|
||||
// Note: material numbers are set by UWUW
|
||||
int mat_number = uwuw.material_library[comp_mat].metadata["mat_number"].asInt();
|
||||
c->material_.push_back(mat_number);
|
||||
} else {
|
||||
std::string mat_value;
|
||||
rval= model::DAG->prop_value(vol_handle, "mat", mat_value);
|
||||
MB_CHK_ERR_CONT(rval);
|
||||
// remove _comp
|
||||
std::string _comp = "_comp";
|
||||
size_t _comp_pos = mat_value.find(_comp);
|
||||
if (_comp_pos != std::string::npos) { mat_value.erase(_comp_pos, _comp.length()); }
|
||||
// assign IC material by id
|
||||
c->material_.push_back(std::stoi(mat_value));
|
||||
}
|
||||
} else {
|
||||
// if no material is found, the implicit complement is void
|
||||
c->material_.push_back(MATERIAL_VOID);
|
||||
|
|
@ -199,6 +211,11 @@ void load_dagmc_geometry()
|
|||
|
||||
std::string cmp_str = mat_value;
|
||||
to_lower(cmp_str);
|
||||
|
||||
if (cmp_str.find("graveyard") != std::string::npos) {
|
||||
graveyard = vol_handle;
|
||||
}
|
||||
|
||||
// material void checks
|
||||
if (cmp_str.find("void") != std::string::npos ||
|
||||
cmp_str.find("vacuum") != std::string::npos ||
|
||||
|
|
@ -231,6 +248,11 @@ void load_dagmc_geometry()
|
|||
model::overlap_check_count.resize(model::cells.size(), 0);
|
||||
}
|
||||
|
||||
if (!graveyard) {
|
||||
warning("No graveyard volume found in the DagMC model."
|
||||
"This may result in lost particles and rapid simulation failure.");
|
||||
}
|
||||
|
||||
/// Surfaces \\\
|
||||
|
||||
// initialize surface objects
|
||||
|
|
@ -271,6 +293,17 @@ void load_dagmc_geometry()
|
|||
s->bc_ = BC_TRANSMIT;
|
||||
}
|
||||
|
||||
// graveyard check
|
||||
moab::Range parent_vols;
|
||||
rval = model::DAG->moab_instance()->get_parent_meshsets(surf_handle, parent_vols);
|
||||
MB_CHK_ERR_CONT(rval);
|
||||
|
||||
// if this surface belongs to the graveyard
|
||||
if (graveyard && parent_vols.find(graveyard) != parent_vols.end()) {
|
||||
// set BC to vacuum
|
||||
s->bc_ = BC_VACUUM;
|
||||
}
|
||||
|
||||
// add to global array and map
|
||||
model::surfaces[i] = s;
|
||||
model::surface_map[s->id_] = s->id_;
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue