From 0c9cd6b901e3009590ff8ddd84e81c867cb054be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Thu, 23 May 2013 18:26:25 +0200 Subject: [PATCH] Expose PhaseUsage to clients This is likely to be a hack, but it does facilitate creating the fully implicit solver for arbitrary two- and three-phase fluid systems. --- opm/autodiff/BlackoilPropsAd.cpp | 11 +++++++++++ opm/autodiff/BlackoilPropsAd.hpp | 5 +++++ opm/autodiff/BlackoilPropsAdInterface.hpp | 6 +++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/opm/autodiff/BlackoilPropsAd.cpp b/opm/autodiff/BlackoilPropsAd.cpp index 48b0515da..436964dee 100644 --- a/opm/autodiff/BlackoilPropsAd.cpp +++ b/opm/autodiff/BlackoilPropsAd.cpp @@ -75,6 +75,17 @@ namespace Opm // Fluid interface // //////////////////////////// + /// \return Number of active phases (also the number of components). + int BlackoilPropsAd::numPhases() const + { + return props_.numPhases(); + } + + /// \return Object describing the active phases. + PhaseUsage BlackoilPropsAd::phaseUsage() const + { + return props_.phaseUsage(); + } // ------ Density ------ diff --git a/opm/autodiff/BlackoilPropsAd.hpp b/opm/autodiff/BlackoilPropsAd.hpp index 726ecb9dd..912cdbbb9 100644 --- a/opm/autodiff/BlackoilPropsAd.hpp +++ b/opm/autodiff/BlackoilPropsAd.hpp @@ -71,6 +71,11 @@ namespace Opm typedef ADB::V V; typedef std::vector Cells; + /// \return Number of active phases (also the number of components). + virtual int numPhases() const; + + /// \return Object describing the active phases. + virtual PhaseUsage phaseUsage() const; // ------ Canonical named indices for each phase ------ diff --git a/opm/autodiff/BlackoilPropsAdInterface.hpp b/opm/autodiff/BlackoilPropsAdInterface.hpp index 5bb4b358f..01b47bcaa 100644 --- a/opm/autodiff/BlackoilPropsAdInterface.hpp +++ b/opm/autodiff/BlackoilPropsAdInterface.hpp @@ -69,13 +69,17 @@ namespace Opm typedef ADB::M M; typedef std::vector Cells; + /// \return Number of active phases (also the number of components). + virtual int numPhases() const = 0; + + /// \return Object describing the active phases. + virtual PhaseUsage phaseUsage() const = 0; // ------ Canonical named indices for each phase ------ /// Canonical named indices for each phase. enum PhaseIndex { Water = 0, Oil = 1, Gas = 2 }; - // ------ Density ------ /// Densities of stock components at surface conditions.