diff --git a/src/dagmc.cpp b/src/dagmc.cpp index 1acef12629..22f9d392a3 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -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_; diff --git a/tests/regression_tests/dagmc/dagmc.h5m b/tests/regression_tests/dagmc/dagmc.h5m index 49c28c4f5e..a55e061dca 100644 Binary files a/tests/regression_tests/dagmc/dagmc.h5m and b/tests/regression_tests/dagmc/dagmc.h5m differ diff --git a/tests/regression_tests/uwuw/dagmc.h5m b/tests/regression_tests/uwuw/dagmc.h5m index 8fca1fff14..4fbba3bb62 100644 Binary files a/tests/regression_tests/uwuw/dagmc.h5m and b/tests/regression_tests/uwuw/dagmc.h5m differ