{"action":"created","comment":{"url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/comments/142401659","pull_request_review_id":66756393,"id":142401659,"diff_hunk":"@@ -0,0 +1,744 @@\n+/*\n+  Copyright 2017 Statoil ASA.\n+\n+  This file is part of the Open Porous Media Project (OPM).\n+\n+  OPM is free software: you can redistribute it and/or modify\n+  it under the terms of the GNU General Public License as published by\n+  the Free Software Foundation, either version 3 of the License, or\n+  (at your option) any later version.\n+\n+  OPM is distributed in the hope that it will be useful,\n+  but WITHOUT ANY WARRANTY; without even the implied warranty of\n+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+  GNU General Public License for more details.\n+\n+  You should have received a copy of the GNU General Public License\n+  along with OPM.  If not, see <http://www.gnu.org/licenses/>.\n+*/\n+\n+#ifndef OPM_ECLPVTCOMMON_HEADER_INCLUDED\n+#define OPM_ECLPVTCOMMON_HEADER_INCLUDED\n+\n+#include <opm/utility/ECLPhaseIndex.hpp>\n+#include <opm/utility/ECLPiecewiseLinearInterpolant.hpp>\n+#include <opm/utility/ECLPropTable.hpp>\n+#include <opm/utility/ECLTableInterpolation1D.hpp>\n+#include <opm/utility/ECLUnitHandling.hpp>\n+\n+#include <algorithm>\n+#include <array>\n+#include <functional>\n+#include <initializer_list>\n+#include <iterator>\n+#include <memory>\n+#include <utility>\n+#include <type_traits>\n+\n+/// \\file\n+///\n+/// Facility for evaluating pressure-dependent fluid properties (formation\n+/// volume factor, viscosities &c) for oil or gas based on tabulated\n+/// descriptions as represented in an ECL result set (INIT file 'TAB'\n+/// vector).\n+\n+namespace Opm {\n+    class ECLInitFileData;\n+} // Opm\n+\n+namespace Opm { namespace ECLPVT {\n+\n+    /// Protocol for converting raw table input data to strict SI unit\n+    /// conventions.\n+    struct ConvertUnits\n+    {\n+        /// Convenience type alias for a value transformation.\n+        using Converter = std::function<double(const double)>;\n+\n+        /// How to convert the independent variate (1st column)\n+        Converter indep;\n+\n+        /// How to convert the dependent variates (2nd... columns).\n+        std::vector<Converter> column;\n+    };\n+\n+    /// Collection of unit converters for PVT quantities tabulated in a\n+    /// result set's INIT file.\n+    struct CreateUnitConverter {\n+        /// Convert quantities from native representations to strict SI\n+        /// units of measure.\n+        struct ToSI {\n+            /// Convert quantities of type mass density (\\rho) to\n+            /// strict SI units of measure (i.e., to kg/m^3).\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            density(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert quantities of type pressure to strict SI units of\n+            /// measure (i.e., to Pascal units).\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            pressure(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert quantities of type compressibility to strict SI\n+            /// units of measure (i.e., to Pascal^-1 units).\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            compressibility(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert quantities of type dissolved gas-oil ratio (Rs) to\n+            /// strict SI units of measure (i.e., to Sm^3/Sm^3).\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            disGas(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert quantities of type vaporised oil-gas ratio (Rv) to\n+            /// strict SI units of measure (i.e., to Sm^3/Sm^3).\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            vapOil(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert quantities of type reciprocal formation volume\n+            /// factor (1/B) to strict SI units of measure (i.e., to\n+            /// Sm^3/Rm^3).\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvf(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert derivatives of quantities of type reciprocal\n+            /// formation volume factor (1/B) with respect to fluid pressure\n+            /// to strict SI units of measure (i.e., to Sm^3/(Rm^3 * Pa)).\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvfDerivPress(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert derivatives of quantities of type reciprocal\n+            /// formation volume factor (1/B) with respect to vaporised\n+            /// oil-gas ratio to strict SI units of measure (i.e., to\n+            /// Sm^3/(Rm^3 * (Sm^3 / Sm^3))).\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvfDerivVapOil(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert quantities of type reciprocal product of formation\n+            /// volume factor and phase viscosity (1/(B * mu)) to strict SI\n+            /// units of measure (i.e., to Sm^3/(Rm^3 * Pa*s)).\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvfVisc(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert derivatives of quantities of type reciprocal product\n+            /// of formation volume factor and phase viscosity (1/(B * mu))\n+            /// with respect to fluid pressure to strict SI units of measure\n+            /// (i.e., to Sm^3/(Rm^3 * Pa*s * Pa)).\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvfViscDerivPress(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert derivatives of quantities of type reciprocal product\n+            /// of formation volume factor and phase viscosity (1/(B * mu))\n+            /// with respect to vaporised oil-gas ratio to strict SI units\n+            /// of measure (i.e., to Sm^3/(Rm^3 * Pa*s * (Sm^3/Sm^3))).\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvfViscDerivVapOil(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert quantities of type reciprocal formation volume\n+            /// factor (1/B) to strict SI units of measure (i.e., to\n+            /// Sm^3/Rm^3).\n+            ///\n+            /// Specialisation for Gas.\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvfGas(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert derivatives of quantities of type reciprocal\n+            /// formation volume factor (1/B) with respect to fluid pressure\n+            /// to strict SI units of measure (i.e., to Sm^3/(Rm^3 * Pa)).\n+            ///\n+            /// Specialisation for Gas.\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvfGasDerivPress(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert derivatives of quantities of type reciprocal\n+            /// formation volume factor (1/B) with respect to vaporised\n+            /// oil-gas ratio to strict SI units of measure (i.e., to\n+            /// Sm^3/(Rm^3 * (Sm^3 / Sm^3))).\n+            ///\n+            /// Specialisation for Gas.\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvfGasDerivVapOil(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert quantities of type reciprocal product of formation\n+            /// volume factor and phase viscosity (1/(B * mu)) to strict SI\n+            /// units of measure (i.e., to Sm^3/(Rm^3 * Pa*s)).\n+            ///\n+            /// Specialisation for Gas.\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvfGasVisc(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert derivatives of quantities of type reciprocal product\n+            /// of formation volume factor and phase viscosity (1/(B * mu))\n+            /// with respect to fluid pressure to strict SI units of measure\n+            /// (i.e., to Sm^3/(Rm^3 * Pa*s * Pa)).\n+            ///\n+            /// Specialisation for Gas.\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvfGasViscDerivPress(const ::Opm::ECLUnits::UnitSystem& usys);\n+\n+            /// Convert derivatives of quantities of type reciprocal product\n+            /// of formation volume factor and phase viscosity (1/(B * mu))\n+            /// with respect to vaporised oil-gas ratio to strict SI units\n+            /// of measure (i.e., to Sm^3/(Rm^3 * Pa*s * (Sm^3/Sm^3))).\n+            ///\n+            /// Specialisation for Gas.\n+            ///\n+            /// \\param[in] usys Native unit system for particular result\n+            ///    set.\n+            ///\n+            /// \\return Value transformation function affecting requisite\n+            ///    unit conversion.\n+            static ConvertUnits::Converter\n+            recipFvfGasViscDerivVapOil(const ::Opm::ECLUnits::UnitSystem& usys);\n+        };\n+    };\n+\n+    template <std::size_t N>\n+    class DenseVector {\n+    public:\n+        explicit DenseVector(const std::array<double, N>& other)\n+            : x_(other)\n+        {}\n+\n+        DenseVector& operator+=(const DenseVector& rhs)\n+        {\n+            std::transform(std::begin(this->x_),\n+                           std::end  (this->x_),\n+                           std::begin(rhs  .x_),\n+                           std::begin(this->x_),\n+                           std::plus<double>());\n+\n+            return *this;\n+        }\n+\n+        DenseVector& operator-=(const DenseVector& rhs)\n+        {\n+            std::transform(std::begin(this->x_),\n+                           std::end  (this->x_),\n+                           std::begin(rhs  .x_),\n+                           std::begin(this->x_),\n+                           std::minus<double>());\n+\n+            return *this;\n+        }\n+\n+        DenseVector& operator*=(const double rhs)\n+        {\n+            std::transform(std::begin(this->x_),\n+                           std::end  (this->x_),\n+                           std::begin(this->x_),\n+               [rhs](const double xi)\n+            {\n+                return rhs * xi;\n+            });\n+\n+            return *this;\n+        }\n+\n+        DenseVector& operator/=(const double rhs)\n+        {\n+            std::transform(std::begin(this->x_),\n+                           std::end  (this->x_),\n+                           std::begin(this->x_),\n+               [rhs](const double xi)\n+            {\n+                return xi / rhs;\n+            });\n+\n+            return *this;\n+        }\n+\n+        const std::array<double, N>& array() const\n+        {\n+            return this->x_;\n+        }\n+\n+    private:\n+        std::array<double, N> x_;\n+    };\n+\n+    template <std::size_t N>\n+    DenseVector<N> operator/(DenseVector<N> v, const double a)\n+    {\n+        return v *= 1.0 / a;\n+    }\n+\n+    template <std::size_t N>\n+    DenseVector<N> operator*(const double a, DenseVector<N> v)\n+    {\n+        return v *= a;\n+    }\n+\n+    template <std::size_t N>\n+    DenseVector<N> operator*(DenseVector<N> v, const double a)\n+    {\n+        return v *= a;\n+    }\n+\n+    template <std::size_t N>\n+    DenseVector<N> operator+(DenseVector<N> u, const DenseVector<N>& v)\n+    {\n+        return u += v;\n+    }\n+\n+    template <std::size_t N>\n+    DenseVector<N> operator-(DenseVector<N> u, const DenseVector<N>& v)\n+    {\n+        return u -= v;\n+    }\n+\n+    /// Evaluate pressure-dependent properties (formation volume factor,\n+    /// viscosity &c) for dead oil (PVDO) or dry gas (PVDG) from tabulated\n+    /// functions as represented in an ECL result set (ECLInitData).\n+    class PVDx\n+    {\n+    public:\n+        /// Convenience type alias.\n+        using ElemIt = ECLPropTableRawData::ElementIterator;\n+\n+        /// Constructor.\n+        ///\n+        /// \\param[in] xBegin Starting position of range of independent\n+        ///    variable (phase pressure).\n+        ///\n+        /// \\param[in] xEnd One past the end of range of independent\n+        ///    variable.  Must be reachable from \\p xBegin.\n+        ///\n+        /// \\param[in,out] colIt Column iterators that reference the\n+        ///    dependent variables (reciprocal FVF &c).  Should be size 4 to\n+        ///    represent the FVF, the viscosity and the derivatives with\n+        ///    respect to phase pressure.  On input, positioned at the\n+        ///    beginning of a single table's dependent variables columns.\n+        ///    On output, advanced across \\code std::distance(xBegin, xEnd)\n+        ///    \\endcode rows/entries.\n+        PVDx(ElemIt               xBegin,\n+             ElemIt               xEnd,\n+             const ConvertUnits&  convert,\n+             std::vector<ElemIt>& colIt);\n+\n+        /// Evaluate the phase FVF in selection of pressure points.\n+        ///\n+        /// \\param[in] p Set of phase pressure points.\n+        ///\n+        /// \\return Phase Formation volume factors for each pressure point.\n+        std::vector<double>\n+        formationVolumeFactor(const std::vector<double>& p) const;\n+\n+        /// Evaluate the phase viscosity in selection of pressure points.\n+        ///\n+        /// \\param[in] p Set of phase pressure points.\n+        ///\n+        /// \\return Phase viscosity for each pressure point.\n+        std::vector<double>\n+        viscosity(const std::vector<double>& p) const;\n+\n+    private:\n+        /// Extrapolation policy for property evaluator/interpolant.\n+        using Extrap = ::Opm::Interp1D::PiecewisePolynomial::\n+            ExtrapolationPolicy::Linearly;\n+\n+        /// Type of fundamental table interpolant.\n+        using Backend = ::Opm::Interp1D::PiecewisePolynomial::Linear<Extrap>;\n+\n+        /// Convenience type alias representing the interpolant's evaluation\n+        /// point conventions.\n+        using EvalPt = std::decay<\n+            decltype(std::declval<Backend>().classifyPoint(0.0))\n+        >::type;\n+\n+        /// Interpolant for table of\n+        ///\n+        ///    [1/B, 1/(B*mu), d(1/B)/dp, d(1/(B*mu))/dp]\n+        ///\n+        /// versus \"pressure\" p--typically phase pressure for oil (Po) or\n+        /// gas (Pg).\n+        Backend interp_;\n+\n+        /// Translate pressure value to evaluation point and identify\n+        /// relevant extrapolation case if needed.\n+        EvalPt getInterpPoint(const double p) const\n+        {\n+            return this->interp_.classifyPoint(p);\n+        }\n+\n+        /// Interpolate reciprocal FVF at evaluation point.\n+        double fvf_recip(const EvalPt& pt) const\n+        {\n+            const auto col = std::size_t{0};\n+\n+            return this->interp_.evaluate(col, pt);\n+        }\n+\n+        /// Interpolate reciprocal product of FVF and viscosity at\n+        /// evaluation point.\n+        double fvf_mu_recip(const EvalPt& pt) const\n+        {\n+            const auto col = std::size_t{1};\n+\n+            return this->interp_.evaluate(col, pt);\n+        }\n+\n+        /// Compute a dynamic quantity such as the FVF or viscosity for a\n+        /// selection of pressure values.\n+        template <class EvalDynamicQuant>\n+        std::vector<double>\n+        computeQuantity(const std::vector<double>& p,\n+                        EvalDynamicQuant&&         eval) const\n+        {\n+            auto result = std::vector<double>{};\n+            result.reserve(p.size());\n+\n+            for (const auto& pi : p) {\n+                result.push_back(eval(this->getInterpPoint(pi)));\n+            }\n+\n+            return result;\n+        }\n+    };\n+\n+    /// Evaluate pressure-dependent properties (formation volume factor,\n+    /// viscosity &c) for live oil (PVTO) or wet gas (PVTG) from tabulated\n+    /// functions as represented in an ECL result set (ECLInitData).\n+    template <class SubtableInterpolant>\n+    class PVTx\n+    {\n+    public:\n+        PVTx(std::vector<double>              key,\n+             std::vector<SubtableInterpolant> propInterp)\n+            : key_       (std::move(key))\n+            , propInterp_(std::move(propInterp))\n+        {\n+            if (this->key_.size() != this->propInterp_.size()) {\n+                throw std::invalid_argument {\n+                    \"Size of Key Table Does Not Match \"\n+                    \"Number of Sub-Table Interpolants\"\n+                };\n+            }\n+\n+            if (this->key_.size() < 2) {\n+                throw std::invalid_argument {\n+                    \"Mixing-Dependent Property Evaluator \"\n+                    \"Must Have At Least Two Inner Tables\"\n+                };\n+            }\n+        }\n+\n+        struct PrimaryKey\n+        {\n+            const std::vector<double>& data;\n+        };\n+\n+        struct InnerVariate\n+        {\n+            const std::vector<double>& data;\n+        };\n+\n+        std::vector<double>\n+        formationVolumeFactor(const PrimaryKey&   key,\n+                              const InnerVariate& x) const\n+        {\n+            const auto col = std::size_t{0};\n+\n+            return this->computeQuantity(key, x,\n+                [this, col](const std::size_t     curve,\n+                            const InnerEvalPoint& pt) -> double\n+            {   // IFunc: Interpolate 1 / B.\n+                return this->propInterp_[curve].evaluate(col, pt);\n+            },\n+                [](const double recipFvF) -> double\n+            {\n+                // OFunc: Convert reciprocal FvF to ordinary FvF.\n+                return 1.0 / recipFvF;\n+            });\n+        }\n+\n+        std::vector<double>\n+        viscosity(const PrimaryKey& key,\n+                  const InnerVariate& x) const\n+        {\n+            return this->computeQuantity(key, x,\n+                [this](const std::size_t     curve,\n+                       const InnerEvalPoint& pt) -> DenseVector<2>\n+            {\n+                // IFunc: Interpolate 1/B and 1/(B*mu)\n+                const auto& I = this->propInterp_[curve];\n+\n+                const auto fvf_recip    = I.evaluate(0, pt);\n+                const auto fvf_mu_recip = I.evaluate(1, pt);\n+\n+                // { (1 / B) , (1 / (B*mu)) }\n+                return DenseVector<2>{\n+                    std::array<double,2>{\n+                        { fvf_recip, fvf_mu_recip }\n+                    }\n+                };\n+            },\n+                [](const DenseVector<2>& recipFvFVisc) -> double\n+            {\n+                // OFunc: Compute viscosity as\n+                //   (1 / B) / (1 / B*mu)\n+\n+                const auto& x = recipFvFVisc.array();","path":"opm/utility/ECLPvtCommon.hpp","position":575,"original_position":575,"commit_id":"20b600335685a4c6f32bf8cf0b09d38d704b885f","original_commit_id":"20b600335685a4c6f32bf8cf0b09d38d704b885f","user":{"login":"atgeirr","id":1876621,"avatar_url":"https://avatars0.githubusercontent.com/u/1876621?v=4","gravatar_id":"","url":"https://api.github.com/users/atgeirr","html_url":"https://github.com/atgeirr","followers_url":"https://api.github.com/users/atgeirr/followers","following_url":"https://api.github.com/users/atgeirr/following{/other_user}","gists_url":"https://api.github.com/users/atgeirr/gists{/gist_id}","starred_url":"https://api.github.com/users/atgeirr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atgeirr/subscriptions","organizations_url":"https://api.github.com/users/atgeirr/orgs","repos_url":"https://api.github.com/users/atgeirr/repos","events_url":"https://api.github.com/users/atgeirr/events{/privacy}","received_events_url":"https://api.github.com/users/atgeirr/received_events","type":"User","site_admin":false},"body":"Shadowing variable.","created_at":"2017-10-03T13:31:22Z","updated_at":"2017-10-03T13:31:22Z","html_url":"https://github.com/OPM/opm-flowdiagnostics-applications/pull/57#discussion_r142401659","pull_request_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/57","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/comments/142401659"},"html":{"href":"https://github.com/OPM/opm-flowdiagnostics-applications/pull/57#discussion_r142401659"},"pull_request":{"href":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/57"}}},"pull_request":{"url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/57","id":144276913,"html_url":"https://github.com/OPM/opm-flowdiagnostics-applications/pull/57","diff_url":"https://github.com/OPM/opm-flowdiagnostics-applications/pull/57.diff","patch_url":"https://github.com/OPM/opm-flowdiagnostics-applications/pull/57.patch","issue_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/issues/57","number":57,"state":"open","locked":false,"title":"Flux Calculator: Add Support for Variable Density and Viscosity","user":{"login":"bska","id":1871438,"avatar_url":"https://avatars0.githubusercontent.com/u/1871438?v=4","gravatar_id":"","url":"https://api.github.com/users/bska","html_url":"https://github.com/bska","followers_url":"https://api.github.com/users/bska/followers","following_url":"https://api.github.com/users/bska/following{/other_user}","gists_url":"https://api.github.com/users/bska/gists{/gist_id}","starred_url":"https://api.github.com/users/bska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bska/subscriptions","organizations_url":"https://api.github.com/users/bska/orgs","repos_url":"https://api.github.com/users/bska/repos","events_url":"https://api.github.com/users/bska/events{/privacy}","received_events_url":"https://api.github.com/users/bska/received_events","type":"User","site_admin":false},"body":"Known limitations: Does not distinguish saturated from unsaturated conditions when evaluating density or viscosity of live oil/wet gas.  Does not support capillary pressure.  Does not support keyword `PVCDO` (single record pr. PVT region in the INIT-file's `TAB` vector).\r\n\r\nMost of the implementation is contained in the new classes `ECLPvtGas`, `ECLPvtOil`, and `ECLPvtWater` that use the `TAB` vector to initialise one-D and two-D piecewise linear interpolants.  We extract the basic support interpolants out to a new helper class, `PiecewisePolynomial::Linear` that has configurable behaviour for extrapolation outside the range of the independent variable.  At present we support constant extrapolation (useful for saturation functions), linear extrapolation based on estimated derivatives at the end-points of the range, and linear extrapolation based on tabulated derivatives.  We also add the requisite unit conversion support to guarantee that we perform all calculations in strict SI unit conventions.\r\n\r\nFinally, we correct two mistakes in the computation of the three-phase relative permeability for oil and the definition of a `vector<bool>` extracted from a LOGIHEAD-like result-set vector.","created_at":"2017-10-02T20:33:40Z","updated_at":"2017-10-03T13:31:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4125d236c55a8ba4a0a32b7a4e26f6a9e5fa5993","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/57/commits","review_comments_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/57/comments","review_comment_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/issues/57/comments","statuses_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/statuses/20b600335685a4c6f32bf8cf0b09d38d704b885f","head":{"label":"bska:pvtsupport","ref":"pvtsupport","sha":"20b600335685a4c6f32bf8cf0b09d38d704b885f","user":{"login":"bska","id":1871438,"avatar_url":"https://avatars0.githubusercontent.com/u/1871438?v=4","gravatar_id":"","url":"https://api.github.com/users/bska","html_url":"https://github.com/bska","followers_url":"https://api.github.com/users/bska/followers","following_url":"https://api.github.com/users/bska/following{/other_user}","gists_url":"https://api.github.com/users/bska/gists{/gist_id}","starred_url":"https://api.github.com/users/bska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bska/subscriptions","organizations_url":"https://api.github.com/users/bska/orgs","repos_url":"https://api.github.com/users/bska/repos","events_url":"https://api.github.com/users/bska/events{/privacy}","received_events_url":"https://api.github.com/users/bska/received_events","type":"User","site_admin":false},"repo":{"id":60683609,"name":"opm-flowdiagnostics-applications","full_name":"bska/opm-flowdiagnostics-applications","owner":{"login":"bska","id":1871438,"avatar_url":"https://avatars0.githubusercontent.com/u/1871438?v=4","gravatar_id":"","url":"https://api.github.com/users/bska","html_url":"https://github.com/bska","followers_url":"https://api.github.com/users/bska/followers","following_url":"https://api.github.com/users/bska/following{/other_user}","gists_url":"https://api.github.com/users/bska/gists{/gist_id}","starred_url":"https://api.github.com/users/bska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bska/subscriptions","organizations_url":"https://api.github.com/users/bska/orgs","repos_url":"https://api.github.com/users/bska/repos","events_url":"https://api.github.com/users/bska/events{/privacy}","received_events_url":"https://api.github.com/users/bska/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bska/opm-flowdiagnostics-applications","description":"Stand-Alone Utilities for Developing and Testing Flow Diagnostics Compuational Kernels","fork":true,"url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications","forks_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/forks","keys_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/teams","hooks_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/hooks","issue_events_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/issues/events{/number}","events_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/events","assignees_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/assignees{/user}","branches_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/branches{/branch}","tags_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/tags","blobs_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/git/refs{/sha}","trees_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/statuses/{sha}","languages_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/languages","stargazers_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/stargazers","contributors_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/contributors","subscribers_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/subscribers","subscription_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/subscription","commits_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/commits{/sha}","git_commits_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/git/commits{/sha}","comments_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/comments{/number}","issue_comment_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/issues/comments{/number}","contents_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/contents/{+path}","compare_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/merges","archive_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/downloads","issues_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/issues{/number}","pulls_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/pulls{/number}","milestones_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/milestones{/number}","notifications_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/labels{/name}","releases_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/releases{/id}","deployments_url":"https://api.github.com/repos/bska/opm-flowdiagnostics-applications/deployments","created_at":"2016-06-08T08:55:52Z","updated_at":"2016-08-17T14:20:30Z","pushed_at":"2017-10-03T13:19:14Z","git_url":"git://github.com/bska/opm-flowdiagnostics-applications.git","ssh_url":"git@github.com:bska/opm-flowdiagnostics-applications.git","clone_url":"https://github.com/bska/opm-flowdiagnostics-applications.git","svn_url":"https://github.com/bska/opm-flowdiagnostics-applications","homepage":null,"size":343,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OPM:master","ref":"master","sha":"1b5be711fc319245524377ee156f1e12f2c9470a","user":{"login":"OPM","id":1827197,"avatar_url":"https://avatars0.githubusercontent.com/u/1827197?v=4","gravatar_id":"","url":"https://api.github.com/users/OPM","html_url":"https://github.com/OPM","followers_url":"https://api.github.com/users/OPM/followers","following_url":"https://api.github.com/users/OPM/following{/other_user}","gists_url":"https://api.github.com/users/OPM/gists{/gist_id}","starred_url":"https://api.github.com/users/OPM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OPM/subscriptions","organizations_url":"https://api.github.com/users/OPM/orgs","repos_url":"https://api.github.com/users/OPM/repos","events_url":"https://api.github.com/users/OPM/events{/privacy}","received_events_url":"https://api.github.com/users/OPM/received_events","type":"Organization","site_admin":false},"repo":{"id":60683509,"name":"opm-flowdiagnostics-applications","full_name":"OPM/opm-flowdiagnostics-applications","owner":{"login":"OPM","id":1827197,"avatar_url":"https://avatars0.githubusercontent.com/u/1827197?v=4","gravatar_id":"","url":"https://api.github.com/users/OPM","html_url":"https://github.com/OPM","followers_url":"https://api.github.com/users/OPM/followers","following_url":"https://api.github.com/users/OPM/following{/other_user}","gists_url":"https://api.github.com/users/OPM/gists{/gist_id}","starred_url":"https://api.github.com/users/OPM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OPM/subscriptions","organizations_url":"https://api.github.com/users/OPM/orgs","repos_url":"https://api.github.com/users/OPM/repos","events_url":"https://api.github.com/users/OPM/events{/privacy}","received_events_url":"https://api.github.com/users/OPM/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OPM/opm-flowdiagnostics-applications","description":"Stand-Alone Utilities for Developing and Testing Flow Diagnostics Compuational Kernels","fork":false,"url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications","forks_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/forks","keys_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/teams","hooks_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/hooks","issue_events_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/issues/events{/number}","events_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/events","assignees_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/assignees{/user}","branches_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/branches{/branch}","tags_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/tags","blobs_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/git/refs{/sha}","trees_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/statuses/{sha}","languages_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/languages","stargazers_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/stargazers","contributors_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/contributors","subscribers_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/subscribers","subscription_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/subscription","commits_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/commits{/sha}","git_commits_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/git/commits{/sha}","comments_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/comments{/number}","issue_comment_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/issues/comments{/number}","contents_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/contents/{+path}","compare_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/merges","archive_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/downloads","issues_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/issues{/number}","pulls_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls{/number}","milestones_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/milestones{/number}","notifications_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/labels{/name}","releases_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/releases{/id}","deployments_url":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/deployments","created_at":"2016-06-08T08:54:32Z","updated_at":"2017-06-28T13:49:26Z","pushed_at":"2017-10-03T13:19:15Z","git_url":"git://github.com/OPM/opm-flowdiagnostics-applications.git","ssh_url":"git@github.com:OPM/opm-flowdiagnostics-applications.git","clone_url":"https://github.com/OPM/opm-flowdiagnostics-applications.git","svn_url":"https://github.com/OPM/opm-flowdiagnostics-applications","homepage":null,"size":271,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":4,"forks":7,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/57"},"html":{"href":"https://github.com/OPM/opm-flowdiagnostics-applications/pull/57"},"issue":{"href":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/issues/57"},"comments":{"href":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/issues/57/comments"},"review_comments":{"href":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/57/comments"},"review_comment":{"href":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/pulls/57/commits"},"statuses":{"href":"https://api.github.com/repos/OPM/opm-flowdiagnostics-applications/statuses/20b600335685a4c6f32bf8cf0b09d38d704b885f"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"atgeirr"}}