From 4b66b0874ea3c4f7ea12ce01d2bb5e196b7734a7 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Tue, 8 Dec 2015 16:07:23 +0100 Subject: [PATCH] Add methods for critial gas and gas in oil saturations Methods that returns the scaled critical gas (SGCR) saturation and the scaled critical gas in oil saturation (SOGCR) is added to BlackoilPropsAdFromDeck and BlackoilPropsAdInterface A test is added in test_boprops_ad and fluid.data is modified to make the test non trivial. --- opm/autodiff/BlackoilPropsAdFromDeck.cpp | 39 +++++++++++++++++++++++ opm/autodiff/BlackoilPropsAdFromDeck.hpp | 10 ++++++ opm/autodiff/BlackoilPropsAdInterface.hpp | 13 ++++++++ tests/fluid.data | 17 +++++++--- tests/test_boprops_ad.cpp | 13 ++++++++ 5 files changed, 88 insertions(+), 4 deletions(-) diff --git a/opm/autodiff/BlackoilPropsAdFromDeck.cpp b/opm/autodiff/BlackoilPropsAdFromDeck.cpp index 2d11085de..979df47d1 100644 --- a/opm/autodiff/BlackoilPropsAdFromDeck.cpp +++ b/opm/autodiff/BlackoilPropsAdFromDeck.cpp @@ -928,5 +928,44 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck& } + /// Obtain the scaled critical oil in gas saturation values. + /// \param[in] cells Array of cell indices. + /// \return Array of critical oil in gas saturaion values. + V BlackoilPropsAdFromDeck::scaledCriticalOilinGasSaturations(const Cells& cells) const { + + + assert(phaseUsage_.phase_used[BlackoilPhases::Gas]); + assert(phaseUsage_.phase_used[BlackoilPhases::Oil]); + + const int n = cells.size(); + V sogcr = V::Zero(n); + const MaterialLawManager& materialLawManager = satprops_->materialLawManager(); + for (int i = 0; i < n; ++i) { + const auto& scaledDrainageInfo = + materialLawManager.oilWaterScaledEpsInfoDrainage(cells[i]); + sogcr[i] = scaledDrainageInfo.Sogcr; + } + return sogcr; + } + + /// Obtain the scaled critical gas saturation values. + /// \param[in] cells Array of cell indices. + /// \return Array of scaled critical gas saturaion values. + V BlackoilPropsAdFromDeck::scaledCriticalGasSaturations(const Cells& cells) const { + + assert(phaseUsage_.phase_used[BlackoilPhases::Gas]); + + const int n = cells.size(); + V sgcr = V::Zero(n); + const MaterialLawManager& materialLawManager = satprops_->materialLawManager(); + for (int i = 0; i < n; ++i) { + const auto& scaledDrainageInfo = + materialLawManager.oilWaterScaledEpsInfoDrainage(cells[i]); + sgcr[i] = scaledDrainageInfo.Sgcr; + } + return sgcr; + } + + } // namespace Opm diff --git a/opm/autodiff/BlackoilPropsAdFromDeck.hpp b/opm/autodiff/BlackoilPropsAdFromDeck.hpp index 1aebfab84..9c6116c6c 100644 --- a/opm/autodiff/BlackoilPropsAdFromDeck.hpp +++ b/opm/autodiff/BlackoilPropsAdFromDeck.hpp @@ -360,6 +360,16 @@ namespace Opm void setSwatInitScaling(const std::vector& saturation, const std::vector& pc); + /// Obtain the scaled critical oil in gas saturation values. + /// \param[in] cells Array of cell indices. + /// \return Array of critical oil in gas saturaion values. + V scaledCriticalOilinGasSaturations(const Cells& cells) const; + + /// Obtain the scaled critical gas saturation values. + /// \param[in] cells Array of cell indices. + /// \return Array of scaled critical gas saturaion values. + V scaledCriticalGasSaturations(const Cells& cells) const; + private: /// Initializes the properties. diff --git a/opm/autodiff/BlackoilPropsAdInterface.hpp b/opm/autodiff/BlackoilPropsAdInterface.hpp index 23595ac18..c6e923638 100644 --- a/opm/autodiff/BlackoilPropsAdInterface.hpp +++ b/opm/autodiff/BlackoilPropsAdInterface.hpp @@ -253,6 +253,19 @@ namespace Opm /// Update for max oil saturation. virtual void updateSatOilMax(const std::vector& saturation) = 0; + + /// Obtain the scaled critical oil in gas saturation values. + /// \param[in] cells Array of cell indices. + /// \return Array of critical oil in gas saturaion values. + virtual + V scaledCriticalOilinGasSaturations(const Cells& cells) const = 0; + + /// Obtain the scaled critical gas saturation values. + /// \param[in] cells Array of cell indices. + /// \return Array of scaled critical gas saturaion values. + virtual + V scaledCriticalGasSaturations(const Cells& cells) const = 0; + }; } // namespace Opm diff --git a/tests/fluid.data b/tests/fluid.data index b018133b2..dbbd26426 100644 --- a/tests/fluid.data +++ b/tests/fluid.data @@ -55,13 +55,22 @@ PVDG / SWOF -0 0 1 0 -1 1 0 0 +0.12 0 1 0 +0.15 0 1 0 +0.17 0.01 1 0 +0.2 0.5 0.5 0 +0.96 0.9 0.1 0 +0.98 0.95 0 0 +1 1 0 0 / SGOF -0 0 1 0 -1 1 0 0 +0 0 1.0 0 +0.02 0 1.0 0 +0.05 0.1 0.9 0 +0.86 0.9 0.1 0 +0.87 0.95 0 0 +0.88 1.0 0 0 / DENSITY diff --git a/tests/test_boprops_ad.cpp b/tests/test_boprops_ad.cpp index 95f65c73b..d4a036a7a 100644 --- a/tests/test_boprops_ad.cpp +++ b/tests/test_boprops_ad.cpp @@ -200,3 +200,16 @@ BOOST_FIXTURE_TEST_CASE(ViscosityAD, TestFixture) BOOST_CHECK_EQUAL(AmuWat.value()[0], VmuWat[i]); } } + +BOOST_FIXTURE_TEST_CASE(criticalSaturations, TestFixture) +{ + const Opm::BlackoilPropsAdFromDeck::Cells cells(10, 0); + + typedef Opm::BlackoilPropsAdFromDeck::V V; + + V sgcr = boprops_ad.scaledCriticalGasSaturations(cells); + V sogcr = boprops_ad.scaledCriticalOilinGasSaturations(cells); + BOOST_CHECK_EQUAL(sgcr[0], 0.02); + BOOST_CHECK_EQUAL(sogcr[0], 0.13); + +}