opm-common
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 
35 namespace Opm {
36 
37 class EclipseState;
38 class Schedule;
39 
44 template <class Scalar>
46 {
47  using SamplingPoints = std::vector<std::pair<Scalar, Scalar>>;
48 
49 public:
51 
57  void initFromState(const EclipseState& eclState, const Schedule&);
58 
59  void setNumRegions(std::size_t numRegions);
60 
61  void setVapPars(const Scalar, const Scalar)
62  {
63  }
64 
68  void setReferenceDensity(unsigned regionIdx, Scalar rhoRefSolvent)
69  { solventReferenceDensity_[regionIdx] = rhoRefSolvent; }
70 
76  void setSolventViscosity(unsigned regionIdx, const TabulatedOneDFunction& mug)
77  { solventMu_[regionIdx] = mug; }
78 
85  void setSolventFormationVolumeFactor(unsigned regionIdx,
86  const SamplingPoints& samplePoints);
87 
91  void initEnd();
92 
96  unsigned numRegions() const
97  { return solventReferenceDensity_.size(); }
98 
102  template <class Evaluation>
103  Evaluation viscosity(unsigned regionIdx,
104  const Evaluation&,
105  const Evaluation& pressure) const
106  {
107  const Evaluation& invBg = inverseSolventB_[regionIdx].eval(pressure, /*extrapolate=*/true);
108  const Evaluation& invMugBg = inverseSolventBMu_[regionIdx].eval(pressure, /*extrapolate=*/true);
109 
110  return invBg / invMugBg;
111  }
112 
113  template <class Evaluation>
114  Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
115  const Evaluation& /*pressure*/,
116  unsigned /*compIdx*/) const
117  {
118  throw std::runtime_error("Not implemented: The PVT model does not provide "
119  "a diffusionCoefficient()");
120  }
121 
125  Scalar referenceDensity(unsigned regionIdx) const
126  { return solventReferenceDensity_[regionIdx]; }
127 
131  template <class Evaluation>
132  Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
133  const Evaluation&,
134  const Evaluation& pressure) const
135  { return inverseSolventB_[regionIdx].eval(pressure, /*extrapolate=*/true); }
136 
137  const std::vector<Scalar>& solventReferenceDensity() const
138  { return solventReferenceDensity_; }
139 
140  const std::vector<TabulatedOneDFunction>& inverseSolventB() const
141  { return inverseSolventB_; }
142 
143  const std::vector<TabulatedOneDFunction>& solventMu() const
144  { return solventMu_; }
145 
146  const std::vector<TabulatedOneDFunction>& inverseSolventBMu() const
147  { return inverseSolventBMu_; }
148 
149 private:
150  std::vector<Scalar> solventReferenceDensity_{};
151  std::vector<TabulatedOneDFunction> inverseSolventB_{};
152  std::vector<TabulatedOneDFunction> solventMu_{};
153  std::vector<TabulatedOneDFunction> inverseSolventBMu_{};
154 };
155 
156 } // namespace Opm
157 
158 #endif
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:103
Scalar referenceDensity(unsigned regionIdx) const
Return the reference density the solvent phase for a given PVT region.
Definition: SolventPvt.hpp:125
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the formation volume factor [-] of the fluid phase.
Definition: SolventPvt.hpp:132
This class represents the Pressure-Volume-Temperature relations of the "second" gas phase in the of E...
Definition: SolventPvt.hpp:45
Definition: Schedule.hpp:100
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: SolventPvt.hpp:96
void setReferenceDensity(unsigned regionIdx, Scalar rhoRefSolvent)
Initialize the reference density of the solvent gas for a given PVT region.
Definition: SolventPvt.hpp:68
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: EclipseState.hpp:66
void initEnd()
Finish initializing the oil phase PVT properties.
Definition: SolventPvt.cpp:101
void setSolventViscosity(unsigned regionIdx, const TabulatedOneDFunction &mug)
Initialize the viscosity of the solvent gas phase.
Definition: SolventPvt.hpp:76
Implements a linearly interpolated scalar function that depends on one variable.
void setSolventFormationVolumeFactor(unsigned regionIdx, const SamplingPoints &samplePoints)
Initialize the function for the formation volume factor of solvent gas.
Definition: SolventPvt.cpp:87
Implements a linearly interpolated scalar function that depends on one variable.
Definition: Tabulated1DFunction.hpp:50
void initFromState(const EclipseState &eclState, const Schedule &)
Initialize the parameters for "solvent gas" using an ECL deck.
Definition: SolventPvt.cpp:39