diff --git a/ebos/equil/initstateequil.hh b/ebos/equil/initstateequil.hh index d0df7e10d..89df5e075 100644 --- a/ebos/equil/initstateequil.hh +++ b/ebos/equil/initstateequil.hh @@ -544,7 +544,7 @@ private: /// \param[in] pcow O/W capillary pressure value (Po - Pw). /// /// \return Water saturation value. - double applySwatInit(const double pcow); + std::pair applySwatInit(const double pcow); /// Derive water saturation from SWATINIT data. /// @@ -558,7 +558,7 @@ private: /// /// \return Water saturation value. Input value, possibly mollified by /// current set of material laws. - double applySwatInit(const double pc, const double sw); + std::pair applySwatInit(const double pc, const double sw); /// Invoke material law container's capillary pressure calculator on /// current fluid state. diff --git a/ebos/equil/initstateequil_impl.hh b/ebos/equil/initstateequil_impl.hh index b2f3cf6bd..389fd000e 100644 --- a/ebos/equil/initstateequil_impl.hh +++ b/ebos/equil/initstateequil_impl.hh @@ -694,9 +694,17 @@ void PhaseSaturations::deriveWa // cell. const auto pcow = this->press_.oil - this->press_.water; - sw = this->swatInit_.empty() - ? this->invertCapPress(pcow, this->waterPos(), isIncr) - : this->applySwatInit(pcow); + if (this->swatInit_.empty()) { + sw = this->invertCapPress(pcow, this->waterPos(), isIncr); + } + else { + auto [swout, newSwatInit] = this->applySwatInit(pcow); + if (newSwatInit) + sw = this->invertCapPress(pcow, this->waterPos(), isIncr); + else { + sw = swout; + } + } } } @@ -718,7 +726,14 @@ fixUnphysicalTransition() // Re-scale Pc to reflect imposed sw for vanishing oil phase. This // seems consistent with ECLIPSE, but fails to honour SWATINIT in // case of non-trivial gas/oil capillary pressure. - sw = this->applySwatInit(pcgw, sw); + auto [swout, newSwatInit] = this->applySwatInit(pcgw, sw); + if (newSwatInit){ + const auto isIncr = false; // dPcow/dSw <= 0 for all Sw. + sw = this->invertCapPress(pcgw, this->waterPos(), isIncr); + } + else { + sw = swout; + } } sw = satFromSumOfPcs @@ -846,18 +861,19 @@ accountForScaledSaturations() } template -double PhaseSaturations:: +std::pair +PhaseSaturations:: applySwatInit(const double pcow) { return this->applySwatInit(pcow, this->swatInit_[this->evalPt_.position->cell]); } template -double PhaseSaturations:: +std::pair +PhaseSaturations:: applySwatInit(const double pcow, const double sw) { - return this->matLawMgr_ - .applySwatinit(this->evalPt_.position->cell, pcow, sw); + return this->matLawMgr_.applySwatinit(this->evalPt_.position->cell, pcow, sw); } template diff --git a/opm/simulators/utils/UnsupportedFlowKeywords.cpp b/opm/simulators/utils/UnsupportedFlowKeywords.cpp index a13c8e018..75a184292 100644 --- a/opm/simulators/utils/UnsupportedFlowKeywords.cpp +++ b/opm/simulators/utils/UnsupportedFlowKeywords.cpp @@ -490,7 +490,6 @@ const KeywordValidation::UnsupportedKeywords& unsupportedKeywords() {"PLYATEMP", {true, std::nullopt}}, {"PLYCAMAX", {true, std::nullopt}}, {"PLYDHFLF", {true, std::nullopt}}, - {"PPCWMAX", {true, std::nullopt}}, {"PRORDER", {true, std::nullopt}}, {"PRVD", {true, std::nullopt}}, {"PVTGWO", {true, std::nullopt}}, diff --git a/regressionTests.cmake b/regressionTests.cmake index 62f0b6080..f5b1393d0 100644 --- a/regressionTests.cmake +++ b/regressionTests.cmake @@ -509,6 +509,13 @@ add_test_compareECLFiles(CASENAME co2store REL_TOL ${rel_tol} DIR co2store) +add_test_compareECLFiles(CASENAME ppcwmax + FILENAME PPCWMAX-01 + SIMULATOR flow + ABS_TOL ${abs_tol} + REL_TOL ${rel_tol} + DIR ppcwmax) + add_test_compareECLFiles(CASENAME co2store_diffusive FILENAME CO2STORE_DIFFUSIVE SIMULATOR flow