From ba1419b31f1482f5698a84c3e86ff62f2dd38da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 10 Sep 2024 15:32:24 +0200 Subject: [PATCH] Fix Consistency Check for Maximum Gas Saturation The earlier condition 0 <= SGU < 1 was not appropriate and would, for instance, fail the NORNE_ATW2013 test case in which SGU = 1 in the unscaled table for saturation region 1. Revise the condition to be more in line with that of SWU, i.e., as 0 < SGU <= 1 Pointy Hat: [at]bska --- .../utils/satfunc/GasPhaseConsistencyChecks.cpp | 6 ++++-- .../utils/satfunc/GasPhaseConsistencyChecks.hpp | 4 ++-- tests/test_GasSatfuncConsistencyChecks.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/opm/simulators/utils/satfunc/GasPhaseConsistencyChecks.cpp b/opm/simulators/utils/satfunc/GasPhaseConsistencyChecks.cpp index d2961bda9..8d80a1750 100644 --- a/opm/simulators/utils/satfunc/GasPhaseConsistencyChecks.cpp +++ b/opm/simulators/utils/satfunc/GasPhaseConsistencyChecks.cpp @@ -55,6 +55,8 @@ template void Opm::Satfunc::PhaseChecks::Gas::SGmax:: testImpl(const EclEpsScalingPointsInfo& endPoints) { + // 0 < SGU <= 1 + this->sgu_ = endPoints.Sgu; if (! std::isfinite(this->sgu_)) { @@ -64,8 +66,8 @@ testImpl(const EclEpsScalingPointsInfo& endPoints) return; } - const auto low = this->sgu_ < Scalar{0}; - const auto high = ! (this->sgu_ < Scalar{1}); + const auto low = ! (this->sgu_ > Scalar{0}); + const auto high = this->sgu_ > Scalar{1}; if (low || high) { this->setViolated(); diff --git a/opm/simulators/utils/satfunc/GasPhaseConsistencyChecks.hpp b/opm/simulators/utils/satfunc/GasPhaseConsistencyChecks.hpp index d34f1f444..7f015ff4d 100644 --- a/opm/simulators/utils/satfunc/GasPhaseConsistencyChecks.hpp +++ b/opm/simulators/utils/satfunc/GasPhaseConsistencyChecks.hpp @@ -104,13 +104,13 @@ namespace Opm::Satfunc::PhaseChecks::Gas { /// Descriptive textual summary of this check. std::string description() const override { - return { "Non-negative maximum gas saturation strictly less than one" }; + return { "Positive maximum gas saturation must not exceed one" }; } /// Textual representation of the consistency condition. std::string condition() const override { - return { "0 <= SGU < 1" }; + return { "0 < SGU <= 1" }; } /// Retrieve names of the exported check values. diff --git a/tests/test_GasSatfuncConsistencyChecks.cpp b/tests/test_GasSatfuncConsistencyChecks.cpp index 0eb039956..255cd1b4d 100644 --- a/tests/test_GasSatfuncConsistencyChecks.cpp +++ b/tests/test_GasSatfuncConsistencyChecks.cpp @@ -192,7 +192,7 @@ BOOST_AUTO_TEST_CASE(All_Good) { auto endPoints = Opm::EclEpsScalingPointsInfo{}; - endPoints.Sgu = 0.125f; // >= 0 && < 1 + endPoints.Sgu = 0.125f; // > 0 && <= 1 check.test(endPoints); } @@ -266,7 +266,7 @@ BOOST_AUTO_TEST_CASE(Is_One) { auto check = Checks::SGmax{}; auto endPoints = Opm::EclEpsScalingPointsInfo{}; - endPoints.Sgu = 1.0; // >= 1 + endPoints.Sgu = 1.0; // <= 1 check.test(endPoints); @@ -277,8 +277,8 @@ BOOST_AUTO_TEST_CASE(Is_One) BOOST_CHECK_CLOSE(value, 1.0, 1.0e-8); } - BOOST_CHECK_MESSAGE(check.isViolated(), "Test must be violated"); - BOOST_CHECK_MESSAGE(check.isCritical(), "Test must be violated at critical level"); + BOOST_CHECK_MESSAGE(! check.isViolated(), "Test must not be violated"); + BOOST_CHECK_MESSAGE(! check.isCritical(), "Test must not be violated at critical level"); } BOOST_AUTO_TEST_CASE(Exceeds_One)