From ae9557069362b8b8ea054d55ed085b07a3ef1bde Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Mon, 21 Sep 2020 13:58:09 +0200 Subject: [PATCH] output temperature when TEMP is set --- ebos/ecloutputblackoilmodule.hh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ebos/ecloutputblackoilmodule.hh b/ebos/ecloutputblackoilmodule.hh index 399b62a2f..09fcb0999 100644 --- a/ebos/ecloutputblackoilmodule.hh +++ b/ebos/ecloutputblackoilmodule.hh @@ -348,9 +348,6 @@ public: } } - // always allocate memory for temperature - temperature_.resize(bufferSize, 0.0); - // field data should be allocated // 1) when we want to restart // 2) when it is ask for by the user via restartConfig @@ -370,6 +367,12 @@ public: rstKeywords["PRES"] = 0; rstKeywords["PRESSURE"] = 0; + // allocate memory for temperature + if (enableEnergy || rstKeywords["TEMP"]) { + temperature_.resize(bufferSize, 0.0); + rstKeywords["TEMP"] = 0; + } + if (FluidSystem::phaseIsActive(oilPhaseIdx)) rstKeywords["SOIL"] = 0; if (FluidSystem::phaseIsActive(gasPhaseIdx)) @@ -560,7 +563,7 @@ public: Opm::Valgrind::CheckDefined(oilPressure_[globalDofIdx]); } - if (enableEnergy) { + if (temperature_.size() > 0) { temperature_[globalDofIdx] = Opm::getValue(fs.temperature(oilPhaseIdx)); Opm::Valgrind::CheckDefined(temperature_[globalDofIdx]); } @@ -958,7 +961,7 @@ public: sol.insert("PRESSURE", Opm::UnitSystem::measure::pressure, std::move(oilPressure_), Opm::data::TargetType::RESTART_SOLUTION); } - if (enableEnergy) { + if (temperature_.size() > 0) { sol.insert("TEMP", Opm::UnitSystem::measure::temperature, std::move(temperature_), Opm::data::TargetType::RESTART_SOLUTION); } @@ -1702,7 +1705,7 @@ public: if (oilPressure_.size() > 0 && sol.has("PRESSURE")) oilPressure_[elemIdx] = sol.data("PRESSURE")[globalDofIndex]; - if (enableEnergy && sol.has("TEMP")) + if (temperature_.size() > 0 && sol.has("TEMP")) temperature_[elemIdx] = sol.data("TEMP")[globalDofIndex]; if (rs_.size() > 0 && sol.has("RS")) rs_[elemIdx] = sol.data("RS")[globalDofIndex]; @@ -1756,7 +1759,7 @@ public: } } - if (enableEnergy) + if (temperature_.size() > 0) fs.setTemperature(temperature_[elemIdx]); if (rs_.size() > 0) fs.setRs(rs_[elemIdx]);