From 4dcc655f4df92289aa5c2f345e274e056f2beec4 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Wed, 31 May 2023 15:44:09 +0200 Subject: [PATCH] Fix rvw and rv initialization --- ebos/equil/equilibrationhelpers_impl.hh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ebos/equil/equilibrationhelpers_impl.hh b/ebos/equil/equilibrationhelpers_impl.hh index a242b9b87..7e4ab0f18 100644 --- a/ebos/equil/equilibrationhelpers_impl.hh +++ b/ebos/equil/equilibrationhelpers_impl.hh @@ -175,7 +175,12 @@ operator()(const double depth, const double temp, const double satOil) const { - if (std::abs(satOil) > 1e-16) { + if (satOil < - std::sqrt(std::numeric_limits::epsilon())) { + throw std::logic_error { + "Must not pass negative oil saturation" + }; + } + if (satOil > 1e-16) { return satRv(press, temp); } else { @@ -211,7 +216,13 @@ operator()(const double depth, const double temp, const double satWat) const { - if (std::abs(satWat) > 1e-16) { + if (satWat < - std::sqrt(std::numeric_limits::epsilon())) { + throw std::logic_error { + "Must not pass negative water saturation" + }; + } + + if (satWat > 1e-16) { return satRvw(press, temp); //saturated Rvw } else {