Use sqrt of numerical_limit epsilon instead of zero to check for non zero saturations

The reason is to make it more robust in terms of numerical noise.
This commit is contained in:
Tor Harald Sandve 2023-06-23 13:28:54 +02:00
parent a363ad6028
commit bf5413d853

View File

@ -70,7 +70,7 @@ operator()(const double depth,
const double temp,
const double satGas) const
{
if (satGas > 0.0) {
if (satGas > std::sqrt(std::numeric_limits<double>::epsilon())) {
return satRs(press, temp);
}
else {
@ -180,7 +180,7 @@ operator()(const double depth,
"Must not pass negative oil saturation"
};
}
if (satOil > 1e-16) {
if (satOil > std::sqrt(std::numeric_limits<double>::epsilon())) {
return satRv(press, temp);
}
else {
@ -222,7 +222,7 @@ operator()(const double depth,
};
}
if (satWat > 1e-16) {
if (satWat > std::sqrt(std::numeric_limits<double>::epsilon())) {
return satRvw(press, temp); //saturated Rvw
}
else {
@ -257,7 +257,7 @@ operator()(const double /* depth */,
const double temp,
const double satGas) const
{
if (satGas > 0.0) {
if (satGas > std::sqrt(std::numeric_limits<double>::epsilon())) {
return satRs(press, temp);
}
else {
@ -287,7 +287,7 @@ operator()(const double /*depth*/,
const double temp,
const double satOil) const
{
if (satOil > 0.0) {
if (satOil > std::sqrt(std::numeric_limits<double>::epsilon())) {
return satRv(press, temp);
}
else {
@ -317,7 +317,7 @@ operator()(const double /*depth*/,
const double temp,
const double satWat) const
{
if (satWat > 0.0) {
if (satWat > std::sqrt(std::numeric_limits<double>::epsilon())) {
return satRvw(press, temp);
}
else {