From 71522fd31024fe6b5d45189740b8560c2af3ca63 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Tue, 16 Jul 2019 11:16:16 -0500 Subject: [PATCH] Check for material temp and use if cell temp is not set on the .h5m file. --- src/dagmc.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/dagmc.cpp b/src/dagmc.cpp index 78d8bc4fb6..29e89b4bc1 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -215,17 +215,6 @@ void load_dagmc_geometry() model::universes[it->second]->cells_.push_back(i); } - // check for temperature assignment - std::string temp_value; - 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 * settings::temperature_default)); - } - // MATERIALS if (model::DAG->is_implicit_complement(vol_handle)) { @@ -295,6 +284,24 @@ void load_dagmc_geometry() legacy_assign_material(mat_value, c); } } + + // check for temperature assignment + std::string temp_value; + + if (c->material_[0] == MATERIAL_VOID) { continue; } + + auto& mat = model::materials[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 if (mat->temperature_ > 0.0) { + c->sqrtkT_.push_back(std::sqrt(K_BOLTZMANN * mat->temperature_)); + } else { + c->sqrtkT_.push_back(std::sqrt(K_BOLTZMANN * settings::temperature_default)); + } + } // allocate the cell overlap count if necessary