opm-common
Loading...
Searching...
No Matches
SolventPvt.hpp
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
27#ifndef OPM_SOLVENT_PVT_HPP
28#define OPM_SOLVENT_PVT_HPP
29
31
32#include <cstddef>
33#include <vector>
34
35namespace Opm {
36
37#if HAVE_ECL_INPUT
38class EclipseState;
39class Schedule;
40#endif
41
46template <class Scalar>
48{
49 using SamplingPoints = std::vector<std::pair<Scalar, Scalar>>;
50
51public:
52 using TabulatedOneDFunction = Tabulated1DFunction<Scalar>;
53
54#if HAVE_ECL_INPUT
60 void initFromState(const EclipseState& eclState, const Schedule&);
61#endif
62
63 void setNumRegions(std::size_t numRegions);
64
65 void setVapPars(const Scalar, const Scalar)
66 {
67 }
68
72 void setReferenceDensity(unsigned regionIdx, Scalar rhoRefSolvent)
73 { solventReferenceDensity_[regionIdx] = rhoRefSolvent; }
74
80 void setSolventViscosity(unsigned regionIdx, const TabulatedOneDFunction& mug)
81 { solventMu_[regionIdx] = mug; }
82
89 void setSolventFormationVolumeFactor(unsigned regionIdx,
90 const SamplingPoints& samplePoints);
91
95 void initEnd();
96
100 unsigned numRegions() const
101 { return solventReferenceDensity_.size(); }
102
106 template <class Evaluation>
107 Evaluation viscosity(unsigned regionIdx,
108 const Evaluation&,
109 const Evaluation& pressure) const
110 {
111 const Evaluation& invBg = inverseSolventB_[regionIdx].eval(pressure, /*extrapolate=*/true);
112 const Evaluation& invMugBg = inverseSolventBMu_[regionIdx].eval(pressure, /*extrapolate=*/true);
113
114 return invBg / invMugBg;
115 }
116
117 template <class Evaluation>
118 Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
119 const Evaluation& /*pressure*/,
120 unsigned /*compIdx*/) const
121 {
122 throw std::runtime_error("Not implemented: The PVT model does not provide "
123 "a diffusionCoefficient()");
124 }
125
129 Scalar referenceDensity(unsigned regionIdx) const
130 { return solventReferenceDensity_[regionIdx]; }
131
135 template <class Evaluation>
136 Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
137 const Evaluation&,
138 const Evaluation& pressure) const
139 { return inverseSolventB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
140
141 const std::vector<Scalar>& solventReferenceDensity() const
142 { return solventReferenceDensity_; }
143
144 const std::vector<TabulatedOneDFunction>& inverseSolventB() const
145 { return inverseSolventB_; }
146
147 const std::vector<TabulatedOneDFunction>& solventMu() const
148 { return solventMu_; }
149
150 const std::vector<TabulatedOneDFunction>& inverseSolventBMu() const
151 { return inverseSolventBMu_; }
152
153private:
154 std::vector<Scalar> solventReferenceDensity_{};
155 std::vector<TabulatedOneDFunction> inverseSolventB_{};
156 std::vector<TabulatedOneDFunction> solventMu_{};
157 std::vector<TabulatedOneDFunction> inverseSolventBMu_{};
158};
159
160} // namespace Opm
161
162#endif
Implements a linearly interpolated scalar function that depends on one variable.
Definition EclipseState.hpp:62
Definition Schedule.hpp:101
This class represents the Pressure-Volume-Temperature relations of the "second" gas phase in the of E...
Definition SolventPvt.hpp:48
Evaluation viscosity(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition SolventPvt.hpp:107
void setReferenceDensity(unsigned regionIdx, Scalar rhoRefSolvent)
Initialize the reference density of the solvent gas for a given PVT region.
Definition SolventPvt.hpp:72
void setSolventViscosity(unsigned regionIdx, const TabulatedOneDFunction &mug)
Initialize the viscosity of the solvent gas phase.
Definition SolventPvt.hpp:80
Scalar referenceDensity(unsigned regionIdx) const
Return the reference density the solvent phase for a given PVT region.
Definition SolventPvt.hpp:129
void initEnd()
Finish initializing the oil phase PVT properties.
Definition SolventPvt.cpp:105
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition SolventPvt.hpp:100
void setSolventFormationVolumeFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the function for the formation volume factor of solvent gas.
Definition SolventPvt.cpp:91
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the formation volume factor [-] of the fluid phase.
Definition SolventPvt.hpp:136
Implements a linearly interpolated scalar function that depends on one variable.
Definition Tabulated1DFunction.hpp:51
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30