From 9eaba103cc542c338131cf4cf0e41916f2431c00 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 13 Sep 2024 08:51:52 +0200 Subject: [PATCH 1/2] Fix issue with stopped injectors in thermal runs --- opm/simulators/wells/StandardWell_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 77d80af97..ed8b31360 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -2602,7 +2602,7 @@ namespace Opm } // change temperature for injecting fluids - if (this->isInjector() && cq_s[activeCompIdx] > 0.0){ + if (this->isInjector() && !this->wellIsStopped() && cq_s[activeCompIdx] > 0.0){ // only handles single phase injection now assert(this->well_ecl_.injectorType() != InjectorType::MULTI); fs.setTemperature(this->well_ecl_.inj_temperature()); From ee4a6e0e39fb767843d658fdc8d91bcf7cdc3de8 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Tue, 17 Sep 2024 13:58:01 +0200 Subject: [PATCH 2/2] WIP fix issue with stopped wells --- opm/simulators/wells/StandardWell_impl.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index ed8b31360..f6d59a4f9 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -2602,7 +2602,7 @@ namespace Opm } // change temperature for injecting fluids - if (this->isInjector() && !this->wellIsStopped() && cq_s[activeCompIdx] > 0.0){ + if (this->isInjector() && !this->wellIsStopped() && cq_r_thermal > 0.0){ // only handles single phase injection now assert(this->well_ecl_.injectorType() != InjectorType::MULTI); fs.setTemperature(this->well_ecl_.inj_temperature()); @@ -2619,6 +2619,9 @@ namespace Opm fs.setEnthalpy(phaseIdx, h); cq_r_thermal *= this->extendEval(fs.enthalpy(phaseIdx)) * this->extendEval(fs.density(phaseIdx)); result += getValue(cq_r_thermal); + } else if (cq_r_thermal > 0.0) { + cq_r_thermal *= getValue(fs.enthalpy(phaseIdx)) * getValue(fs.density(phaseIdx)); + result += Base::restrictEval(cq_r_thermal); } else { // compute the thermal flux cq_r_thermal *= this->extendEval(fs.enthalpy(phaseIdx)) * this->extendEval(fs.density(phaseIdx));