Skip to content

Commit

Permalink
Merge pull request #5640 from bska/fix-displacing-oil-go-consistency-…
Browse files Browse the repository at this point in the history
…check

Fix Lower Bound Conditions for Three Point Checks
  • Loading branch information
bska authored Oct 2, 2024
2 parents 836e71c + 120b39a commit 3acf0cb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ testImpl(const EclEpsScalingPointsInfo<Scalar>& endPoints)

const auto sr = Scalar{1} - (this->sogcr_ + this->swl_);

const auto low = ! (this->swl_ < sr);
const auto low = ! (this->sgcr_ < sr);
const auto high = ! (sr < this->sgu_);

if (low || high) {
Expand Down Expand Up @@ -86,7 +86,7 @@ testImpl(const EclEpsScalingPointsInfo<Scalar>& endPoints)

const auto sr = Scalar{1} - (this->sowcr_ + this->sgl_);

const auto low = ! (this->sgl_ < sr);
const auto low = ! (this->swcr_ < sr);
const auto high = ! (sr < this->swu_);

if (low || high) {
Expand Down
31 changes: 31 additions & 0 deletions tests/test_ThreePointHorizontalSatfuncConsistencyChecks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,37 @@ BOOST_AUTO_TEST_CASE(All_Good)
BOOST_CHECK_MESSAGE(! check.isCritical(), "Test must not be violated at critical level");
}

BOOST_AUTO_TEST_CASE(All_Good_2)
{
auto check = Checks::DisplacingOil_GO<float>{};

constexpr auto expectNumExportedCheckValues = std::size_t{5};

{
auto endPoints = Opm::EclEpsScalingPointsInfo<float>{};
endPoints.Swl = 0.4f;
endPoints.Sgcr = 0.15f;
endPoints.Sogcr = 0.2f;
endPoints.Sgu = 0.6;

check.test(endPoints);
}

{
auto values = std::vector<float>(expectNumExportedCheckValues);
check.exportCheckValues(values.data());

BOOST_CHECK_CLOSE(values[0], 0.4f, 1.0e-6f);
BOOST_CHECK_CLOSE(values[1], 0.2f, 1.0e-6f);
BOOST_CHECK_CLOSE(values[2], 0.15f, 1.0e-6f);
BOOST_CHECK_CLOSE(values[3], 0.4f, 1.0e-5f);
BOOST_CHECK_CLOSE(values[4], 0.6f, 1.0e-6f);
}

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(Non_Finite)
{
// NaN
Expand Down

0 comments on commit 3acf0cb

Please sign in to comment.