diff --git a/src/opm/material/fluidmatrixinteractions/EclMaterialLawManager.cpp b/src/opm/material/fluidmatrixinteractions/EclMaterialLawManager.cpp index 2113ae007..f0ef0c156 100644 --- a/src/opm/material/fluidmatrixinteractions/EclMaterialLawManager.cpp +++ b/src/opm/material/fluidmatrixinteractions/EclMaterialLawManager.cpp @@ -178,8 +178,8 @@ applySwatinit(unsigned elemIdx, Scalar pcowAtSw = pc[oilPhaseIdx] - pc[waterPhaseIdx]; constexpr const Scalar pcowAtSwThreshold = 1.0; //Pascal - // avoid divison by very small number - if (std::abs(pcowAtSw) > pcowAtSwThreshold) { + // avoid divison by very small number and avoid negative PCW at connate Sw + if (pcowAtSw > pcowAtSwThreshold) { // Scale max. capillary pressure to honor SWATINIT value Scalar newMaxPcow = elemScaledEpsInfo.maxPcow * (pcow/pcowAtSw); @@ -206,6 +206,8 @@ applySwatinit(unsigned elemIdx, *oilWaterEclEpsConfig_, EclTwoPhaseSystemType::OilWater); } + // Find Sw from unscaled curve if PCW at connate Sw would be negative (i.e., do no respect SWATINIT in this case) + if (pcowAtSw < 0.0) newSwatInit = true; } return {Sw, newSwatInit};