My Project
Loading...
Searching...
No Matches
ConstantCompressibilityOilPvt.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_CONSTANT_COMPRESSIBILITY_OIL_PVT_HPP
28#define OPM_CONSTANT_COMPRESSIBILITY_OIL_PVT_HPP
29
30#include <cstddef>
31#include <stdexcept>
32#include <vector>
33
34namespace Opm {
35
36#if HAVE_ECL_INPUT
37class EclipseState;
38class Schedule;
39#endif
40
45template <class Scalar>
47{
48public:
49#if HAVE_ECL_INPUT
57 void initFromState(const EclipseState& eclState, const Schedule&);
58#endif
59
60 void setNumRegions(std::size_t numRegions);
61
62 void setVapPars(const Scalar, const Scalar)
63 {
64 }
65
69 void setReferenceDensities(unsigned regionIdx,
70 Scalar rhoRefOil,
71 Scalar /*rhoRefGas*/,
72 Scalar /*rhoRefWater*/)
73 { oilReferenceDensity_[regionIdx] = rhoRefOil; }
74
78 void setViscosity(unsigned regionIdx, Scalar muo, Scalar oilViscosibility = 0.0)
79 {
80 oilViscosity_[regionIdx] = muo;
81 oilViscosibility_[regionIdx] = oilViscosibility;
82 }
83
87 void setCompressibility(unsigned regionIdx, Scalar oilCompressibility)
88 { oilCompressibility_[regionIdx] = oilCompressibility; }
89
93 void setReferencePressure(unsigned regionIdx, Scalar p)
94 { oilReferencePressure_[regionIdx] = p; }
95
99 void setReferenceFormationVolumeFactor(unsigned regionIdx, Scalar BoRef)
100 { oilReferenceFormationVolumeFactor_[regionIdx] = BoRef; }
101
105 void setViscosibility(unsigned regionIdx, Scalar muComp)
106 { oilViscosibility_[regionIdx] = muComp; }
107
111 void initEnd()
112 { }
113
117 unsigned numRegions() const
118 { return oilViscosity_.size(); }
119
123 template <class Evaluation>
124 Evaluation internalEnergy(unsigned,
125 const Evaluation&,
126 const Evaluation&,
127 const Evaluation&) const
128 {
129 throw std::runtime_error("Requested the enthalpy of oil but the thermal "
130 "option is not enabled");
131 }
132 Scalar hVap(unsigned) const
133 {
134 throw std::runtime_error("Requested the hvap of oil but the thermal "
135 "option is not enabled");
136 }
141 template <class Evaluation>
142 Evaluation viscosity(unsigned regionIdx,
143 const Evaluation& temperature,
144 const Evaluation& pressure,
145 const Evaluation& /*Rs*/) const
146 { return saturatedViscosity(regionIdx, temperature, pressure); }
147
151 template <class Evaluation>
152 Evaluation saturatedViscosity(unsigned regionIdx,
153 const Evaluation& temperature,
154 const Evaluation& pressure) const
155 {
156 Scalar BoMuoRef = oilViscosity_[regionIdx]*oilReferenceFormationVolumeFactor_[regionIdx];
157 const Evaluation& bo = saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure);
158
159 Scalar pRef = oilReferencePressure_[regionIdx];
160 const Evaluation& Y =
161 (oilCompressibility_[regionIdx] - oilViscosibility_[regionIdx])
162 * (pressure - pRef);
163 return BoMuoRef * bo / (1.0 + Y * (1.0 + Y / 2.0));
164 }
165
169 template <class Evaluation>
170 Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
171 const Evaluation& temperature,
172 const Evaluation& pressure,
173 const Evaluation& /*Rs*/) const
174 { return saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure); }
175
182 template <class Evaluation>
183 Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
184 const Evaluation& /*temperature*/,
185 const Evaluation& pressure) const
186 {
187 // cf. ECLiPSE 2011 technical description, p. 116
188 Scalar pRef = oilReferencePressure_[regionIdx];
189 const Evaluation& X = oilCompressibility_[regionIdx]*(pressure - pRef);
190
191 Scalar BoRef = oilReferenceFormationVolumeFactor_[regionIdx];
192 return (1 + X*(1 + X/2))/BoRef;
193 }
194
198 template <class Evaluation>
199 Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
200 const Evaluation& /*temperature*/,
201 const Evaluation& /*pressure*/) const
202 { return 0.0; /* this is dead oil! */ }
203
207 template <class Evaluation>
208 Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
209 const Evaluation& /*temperature*/,
210 const Evaluation& /*pressure*/,
211 const Evaluation& /*oilSaturation*/,
212 const Evaluation& /*maxOilSaturation*/) const
213 { return 0.0; /* this is dead oil! */ }
214
222 template <class Evaluation>
223 Evaluation saturationPressure(unsigned /*regionIdx*/,
224 const Evaluation& /*temperature*/,
225 const Evaluation& /*Rs*/) const
226 { return 0.0; /* this is dead oil, so there isn't any meaningful saturation pressure! */ }
227
228 template <class Evaluation>
229 Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
230 const Evaluation& /*pressure*/,
231 unsigned /*compIdx*/) const
232 {
233 throw std::runtime_error("Not implemented: The PVT model does not "
234 "provide a diffusionCoefficient()");
235 }
236
237 Scalar oilReferenceDensity(unsigned regionIdx) const
238 { return oilReferenceDensity_[regionIdx]; }
239
240 const std::vector<Scalar>& oilReferenceFormationVolumeFactor() const
241 { return oilReferenceFormationVolumeFactor_; }
242
243 const std::vector<Scalar>& oilCompressibility() const
244 { return oilCompressibility_; }
245
246 const std::vector<Scalar>& oilViscosity() const
247 { return oilViscosity_; }
248
249 const std::vector<Scalar>& oilViscosibility() const
250 { return oilViscosibility_; }
251
252private:
253 std::vector<Scalar> oilReferenceDensity_{};
254 std::vector<Scalar> oilReferencePressure_{};
255 std::vector<Scalar> oilReferenceFormationVolumeFactor_{};
256 std::vector<Scalar> oilCompressibility_{};
257 std::vector<Scalar> oilViscosity_{};
258 std::vector<Scalar> oilViscosibility_{};
259};
260
261} // namespace Opm
262
263#endif
This class represents the Pressure-Volume-Temperature relations of the oil phase without dissolved ga...
Definition ConstantCompressibilityOilPvt.hpp:47
Evaluation internalEnergy(unsigned, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the specific enthalpy [J/kg] of oil given a set of parameters.
Definition ConstantCompressibilityOilPvt.hpp:124
Evaluation saturationPressure(unsigned, const Evaluation &, const Evaluation &) const
Returns the saturation pressure of the oil phase [Pa] depending on its mass fraction of the gas compo...
Definition ConstantCompressibilityOilPvt.hpp:223
void setViscosity(unsigned regionIdx, Scalar muo, Scalar oilViscosibility=0.0)
Set the viscosity and "viscosibility" of the oil phase.
Definition ConstantCompressibilityOilPvt.hpp:78
void initEnd()
Finish initializing the oil phase PVT properties.
Definition ConstantCompressibilityOilPvt.hpp:111
Evaluation saturatedGasDissolutionFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the gas dissolution factor [m^3/m^3] of the oil phase.
Definition ConstantCompressibilityOilPvt.hpp:208
void setReferencePressure(unsigned regionIdx, Scalar p)
Set the oil reference pressure [Pa].
Definition ConstantCompressibilityOilPvt.hpp:93
void setCompressibility(unsigned regionIdx, Scalar oilCompressibility)
Set the compressibility of the oil phase.
Definition ConstantCompressibilityOilPvt.hpp:87
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &) const
Returns the dynamic viscosity [Pa s] of gas saturated oil given a pressure and a phase composition.
Definition ConstantCompressibilityOilPvt.hpp:142
void setReferenceDensities(unsigned regionIdx, Scalar rhoRefOil, Scalar, Scalar)
Initialize the reference densities of all fluids for a given PVT region.
Definition ConstantCompressibilityOilPvt.hpp:69
void setViscosibility(unsigned regionIdx, Scalar muComp)
Set the oil "viscosibility" [1/ (Pa s)].
Definition ConstantCompressibilityOilPvt.hpp:105
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &) const
Returns the formation volume factor [-] of the fluid phase.
Definition ConstantCompressibilityOilPvt.hpp:170
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure) const
Returns the formation volume factor [-] of gas saturated oil.
Definition ConstantCompressibilityOilPvt.hpp:183
void setReferenceFormationVolumeFactor(unsigned regionIdx, Scalar BoRef)
Set the oil reference formation volume factor [-].
Definition ConstantCompressibilityOilPvt.hpp:99
Evaluation saturatedGasDissolutionFactor(unsigned, const Evaluation &, const Evaluation &) const
Returns the gas dissolution factor [m^3/m^3] of the oil phase.
Definition ConstantCompressibilityOilPvt.hpp:199
Evaluation saturatedViscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure) const
Returns the dynamic viscosity [Pa s] of gas saturated oil given a pressure.
Definition ConstantCompressibilityOilPvt.hpp:152
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition ConstantCompressibilityOilPvt.hpp:117
Definition EclipseState.hpp:63
Definition Schedule.hpp:89
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30