From 6072cb20a2985806395fbf6c5e81b96f9039918f Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Wed, 24 Mar 2021 22:53:06 +0100 Subject: [PATCH] only when both oil and gas exist, we handle drsdt and drvdt --- ebos/eclproblem.hh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index 39d524e58..c31b0fac6 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -2324,7 +2324,8 @@ private: const auto& simulator = this->simulator(); int episodeIdx = std::max(simulator.episodeIndex(), 0); const auto& oilVaporizationControl = simulator.vanguard().schedule()[episodeIdx].oilvap(); - return (oilVaporizationControl.drsdtActive()); + const bool bothOilGasActive = FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx); + return (oilVaporizationControl.drsdtActive() && bothOilGasActive); } bool drvdtActive_() const @@ -2332,7 +2333,8 @@ private: const auto& simulator = this->simulator(); int episodeIdx = std::max(simulator.episodeIndex(), 0); const auto& oilVaporizationControl = simulator.vanguard().schedule()[episodeIdx].oilvap(); - return (oilVaporizationControl.drvdtActive()); + const bool bothOilGasActive = FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx); + return (oilVaporizationControl.drvdtActive() && bothOilGasActive); } @@ -2341,7 +2343,8 @@ private: const auto& simulator = this->simulator(); int episodeIdx = std::max(simulator.episodeIndex(), 0); const auto& oilVaporizationControl = simulator.vanguard().schedule()[episodeIdx].oilvap(); - return (oilVaporizationControl.drsdtConvective()); + const bool bothOilGasActive = FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx); + return (oilVaporizationControl.drsdtConvective() && bothOilGasActive); } @@ -2351,8 +2354,6 @@ private: // update the "last Rs" values for all elements, including the ones in the ghost // and overlap regions const auto& simulator = this->simulator(); - int episodeIdx = std::max(simulator.episodeIndex(), 0); - const auto& oilVaporizationControl = simulator.vanguard().schedule()[episodeIdx].oilvap(); if (drsdtConvective_()) { // This implements the convective DRSDT as described in @@ -2391,7 +2392,7 @@ private: } } - if (oilVaporizationControl.drsdtActive()) { + if (this->drsdtActive_()) { ElementContext elemCtx(simulator); const auto& vanguard = simulator.vanguard(); auto elemIt = vanguard.gridView().template begin(); @@ -2409,6 +2410,8 @@ private: typedef typename std::decay::type FluidState; int pvtRegionIdx = pvtRegionIndex(compressedDofIdx); + int episodeIdx = std::max(simulator.episodeIndex(), 0); + const auto& oilVaporizationControl = simulator.vanguard().schedule()[episodeIdx].oilvap(); if (oilVaporizationControl.getOption(pvtRegionIdx) || fs.saturation(gasPhaseIdx) > freeGasMinSaturation_) lastRs_[compressedDofIdx] = Opm::BlackOil::template getRs_