From 4819e02f227394b7f687aa0e456d934245bbb2e4 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sat, 13 Mar 2021 22:24:27 -0600 Subject: [PATCH] Removing some unused DAGMC functions. --- include/openmc/dagmc.h | 10 -- src/dagmc.cpp | 211 ----------------------------------------- 2 files changed, 221 deletions(-) diff --git a/include/openmc/dagmc.h b/include/openmc/dagmc.h index a908f9f6c6..650829fa47 100644 --- a/include/openmc/dagmc.h +++ b/include/openmc/dagmc.h @@ -18,11 +18,6 @@ class UWUW; namespace openmc { -namespace model { - extern std::shared_ptr DAG; -} - - class DAGUniverse : public Universe { public: @@ -43,12 +38,7 @@ public: bool adjust_material_ids_; }; -void load_dagmc_geometry(); -int32_t create_dagmc_universe(const std::string& filename); -void read_geometry_dagmc(); void read_dagmc_universes(pugi::xml_node node); -bool read_uwuw_materials(pugi::xml_document& doc); -bool get_uwuw_materials_xml(std::string& s); } // namespace openmc diff --git a/src/dagmc.cpp b/src/dagmc.cpp index 9f29912684..d04ec4fc00 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -39,13 +39,6 @@ namespace openmc { const std::string DAGMC_FILENAME = "dagmc.h5m"; -namespace model { - -std::shared_ptr DAG; - -} // namespace model - - std::string dagmc_file() { std::string filename = settings::path_input + DAGMC_FILENAME; if (!file_exists(filename)) { @@ -129,9 +122,6 @@ bool read_uwuw_materials(pugi::xml_document& doc) { return found_uwuw_mats; } -void read_single_file_dagmc_materials(std::string dagmc_filename) { -} - bool write_uwuw_materials_xml() { std::string s; bool found_uwuw_mats = get_uwuw_materials_xml(s); @@ -193,21 +183,12 @@ void legacy_assign_material(std::string mat_string, DAGCell* c) } } -void load_dagmc_geometry() -{ - model::universes.push_back(std::make_unique(dagmc_file())); - model::universe_map[model::universes.back()->id_] = model::universes.size() - 1; -} - -#ifdef DAGMC void read_dagmc_universes(pugi::xml_node node) { for (pugi::xml_node dag_node : node.children("dagmc")) { model::universes.push_back(std::make_unique(dag_node)); model::universe_map[model::universes.back()->id_] = model::universes.size() - 1; } } -#endif - DAGUniverse::DAGUniverse(pugi::xml_node node) { if (check_for_node(node, "id")) { @@ -490,197 +471,5 @@ DAGUniverse::read_uwuw_materials() { return uwuw; } -int32_t create_dagmc_universe(const std::string& filename) { - if (!model::DAG) { - model::DAG = std::make_shared(); - } - - // --- Materials --- - - // create uwuw instance - UWUW uwuw(filename.c_str()); - - // check for uwuw material definitions - bool using_uwuw = !uwuw.material_library.empty(); - - // notify user if UWUW materials are going to be used - if (using_uwuw) { - write_message("Found UWUW Materials in the DAGMC geometry file.", 6); - } - - int32_t dagmc_univ_id = 0; // universe is always 0 for DAGMC runs - - // load the DAGMC geometry - moab::ErrorCode rval = model::DAG->load_file(filename.c_str()); - MB_CHK_ERR_CONT(rval); - - // initialize acceleration data structures - rval = model::DAG->init_OBBTree(); - MB_CHK_ERR_CONT(rval); - - // parse model metadata - dagmcMetaData DMD(model::DAG.get(), false, false); - DMD.load_property_data(); - - vector keywords {"temp"}; - std::map dum; - std::string delimiters = ":/"; - rval = model::DAG->parse_properties(keywords, dum, delimiters.c_str()); - MB_CHK_ERR_CONT(rval); - - // --- Cells (Volumes) --- - - // initialize cell objects - int n_cells = model::DAG->num_entities(3); - moab::EntityHandle graveyard = 0; - for (int i = 0; i < n_cells; i++) { - moab::EntityHandle vol_handle = model::DAG->entity_by_index(3, i+1); - // set cell ids using global IDs - DAGCell* c = new DAGCell(); - c->dag_index_ = i+1; - c->id_ = model::DAG->id_by_index(3, c->dag_index_); - c->dagmc_ptr_ = model::DAG; - c->universe_ = dagmc_univ_id; // set to zero for now - c->fill_ = C_NONE; // no fill, single universe - - model::cells.emplace_back(c); - model::cell_map[c->id_] = i; - - // Populate the Universe vector and dict - auto it = model::universe_map.find(dagmc_univ_id); - if (it == model::universe_map.end()) { - model::universes.push_back(make_unique()); - model::universes.back()->id_ = dagmc_univ_id; - model::universes.back()->cells_.push_back(i); - model::universe_map[dagmc_univ_id] = model::universes.size() - 1; - } else { - model::universes[it->second]->cells_.push_back(i); - } - - // MATERIALS - - // determine volume material assignment - std::string mat_str = DMD.get_volume_property("material", vol_handle); - - if (mat_str.empty()) { - fatal_error(fmt::format("Volume {} has no material assignment.", c->id_)); - } - - to_lower(mat_str); - - if (mat_str == "graveyard") { - graveyard = vol_handle; - } - - // material void checks - if (mat_str == "void" || mat_str == "vacuum" || mat_str == "graveyard") { - c->material_.push_back(MATERIAL_VOID); - } else { - if (using_uwuw) { - // lookup material in uwuw if present - std::string uwuw_mat = DMD.volume_material_property_data_eh[vol_handle]; - if (uwuw.material_library.count(uwuw_mat) != 0) { - // Note: material numbers are set by UWUW - int mat_number = uwuw.material_library.get_material(uwuw_mat).metadata["mat_number"].asInt(); - c->material_.push_back(mat_number); - } else { - fatal_error(fmt::format("Material with value {} not found in the " - "UWUW material library", mat_str)); - } - } else { - legacy_assign_material(mat_str, c); - } - } - - // check for temperature assignment - std::string temp_value; - - // no temperature if void - if (c->material_[0] == MATERIAL_VOID) continue; - - // assign cell temperature - const auto& mat = model::materials[model::material_map.at(c->material_[0])]; - if (model::DAG->has_prop(vol_handle, "temp")) { - rval = model::DAG->prop_value(vol_handle, "temp", temp_value); - MB_CHK_ERR_CONT(rval); - double temp = std::stod(temp_value); - c->sqrtkT_.push_back(std::sqrt(K_BOLTZMANN * temp)); - } else { - c->sqrtkT_.push_back(std::sqrt(K_BOLTZMANN * mat->temperature())); - } - - } - - // allocate the cell overlap count if necessary - if (settings::check_overlaps) { - 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 - int n_surfaces = model::DAG->num_entities(2); - - for (int i = 0; i < n_surfaces; i++) { - moab::EntityHandle surf_handle = model::DAG->entity_by_index(2, i+1); - - // set cell ids using global IDs - DAGSurface* s = new DAGSurface(); - s->dag_index_ = i+1; - s->id_ = model::DAG->id_by_index(2, s->dag_index_); - s->dagmc_ptr_ = model::DAG; - - if (contains(settings::source_write_surf_id, s->id_)) { - s->surf_source_ = true; - } - - // set BCs - std::string bc_value = DMD.get_surface_property("boundary", surf_handle); - to_lower(bc_value); - if (bc_value.empty() || bc_value == "transmit" || bc_value == "transmission") { - // Leave the bc_ a nullptr - } else if (bc_value == "vacuum") { - s->bc_ = std::make_shared(); - } else if (bc_value == "reflective" || bc_value == "reflect" || bc_value == "reflecting") { - s->bc_ = std::make_shared(); - } else if (bc_value == "white") { - fatal_error("White boundary condition not supported in DAGMC."); - } else if (bc_value == "periodic") { - fatal_error("Periodic boundary condition not supported in DAGMC."); - } else { - fatal_error(fmt::format("Unknown boundary condition \"{}\" specified " - "on surface {}", bc_value, s->id_)); - } - - // 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 graveyard surface BC's to vacuum - s->bc_ = std::make_shared(); - } - - // add to global array and map - model::surfaces.emplace_back(s); - model::surface_map[s->id_] = i; - } - - return model::universes.size() - 1; -} - -void read_geometry_dagmc() -{ - write_message("Reading DAGMC geometry...", 5); - model::root_universe = find_root_universe(); -} - } #endif