EclDefaultMaterial: increase the epsilon for division-by-zero-avoidance to 1e-20

also, treat saturations smaller than 0 as 0. this also makes clamping the
kro values to range [0, 1] superfluous.
This commit is contained in:
Andreas Lauser 2015-08-13 17:35:14 +02:00
parent 797012a8ba
commit 0d1c711d8e

View File

@ -304,7 +304,7 @@ public:
const Evaluation& kro_go = GasOilMaterialLaw::twoPhaseSatKrw(params.gasOilParams(), So_go);
Evaluation kro;
if (std::abs(Toolbox::value(Sg) + Toolbox::value(Sw) - Swco) < 1e-50)
if (Toolbox::value(Sg) + Toolbox::value(Sw) - Swco < 1e-20)
kro = kro_ow; // avoid division by zero
else {
const auto& weightOilWater = (Sw - Swco)/(Sg + Sw - Swco);
@ -312,7 +312,7 @@ public:
kro = weightOilWater*kro_ow + weightGasOil*kro_go;
}
return Toolbox::min(1.0, Toolbox::max(0.0, kro));
return kro;
}
/*!