My Project
Loading...
Searching...
No Matches
ConstantCompressibilityBrinePvt.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_BRINE_PVT_HPP
28#define OPM_CONSTANT_COMPRESSIBILITY_BRINE_PVT_HPP
29
31
32#include <vector>
33
34namespace Opm {
35
36template <class Scalar, bool enableThermal, bool enableBrine>
37class WaterPvtMultiplexer;
38
39#if HAVE_ECL_INPUT
40class EclipseState;
41class Schedule;
42#endif
43
48template <class Scalar>
50{
51public:
53
54#if HAVE_ECL_INPUT
59 void initFromState(const EclipseState& eclState, const Schedule&);
60#endif
61
62 void setNumRegions(size_t numRegions)
63 {
64 waterReferenceDensity_.resize(numRegions);
65
66 for (unsigned regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
67 setReferenceDensities(regionIdx, 650.0, 1.0, 1000.0);
68 }
69 }
70
71 void setVapPars(const Scalar, const Scalar)
72 {
73 }
74
78 void setReferenceDensities(unsigned regionIdx,
79 Scalar /*rhoRefOil*/,
80 Scalar /*rhoRefGas*/,
81 Scalar rhoRefWater)
82 { waterReferenceDensity_[regionIdx] = rhoRefWater; }
83
87 void initEnd()
88 { }
89
90
94 unsigned numRegions() const
95 { return waterReferenceDensity_.size(); }
96
100 template <class Evaluation>
101 Evaluation internalEnergy(unsigned,
102 const Evaluation&,
103 const Evaluation&,
104 const Evaluation&,
105 const Evaluation&) const
106 {
107 throw std::runtime_error("Requested the enthalpy of water but the thermal option is not enabled");
108 }
109
113 template <class Evaluation>
114 Evaluation viscosity(unsigned regionIdx,
115 const Evaluation& temperature,
116 const Evaluation& pressure,
117 const Evaluation& Rsw,
118 const Evaluation& saltconcentration) const
119 {
120 // cf. ECLiPSE 2013.2 technical description, p. 114
121 Scalar pRef = referencePressure_[regionIdx];
122 const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
123 const Evaluation Cv = viscosibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
124 const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
125 const Evaluation Y = (C-Cv)* (pressure - pRef);
126 Evaluation MuwRef = viscosityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
127
128 const Evaluation& bw = inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rsw, saltconcentration);
129
130 return MuwRef*BwRef*bw/(1 + Y*(1 + Y/2));
131 }
132
133
137 template <class Evaluation>
138 Evaluation saturatedViscosity(unsigned regionIdx,
139 const Evaluation& temperature,
140 const Evaluation& pressure,
141 const Evaluation& saltconcentration) const
142 {
143 Scalar pRef = referencePressure_[regionIdx];
144 const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
145 const Evaluation Cv = viscosibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
146 const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
147 const Evaluation Y = (C-Cv)* (pressure - pRef);
148 Evaluation MuwRef = viscosityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
149
150 const Evaluation& bw = saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure, saltconcentration);
151
152 return MuwRef*BwRef*bw/(1 + Y*(1 + Y/2));
153 }
154
158 template <class Evaluation>
159 Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
160 const Evaluation& temperature,
161 const Evaluation& pressure,
162 const Evaluation& saltconcentration) const
163 {
164 Evaluation Rsw = 0.0;
165 return inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rsw, saltconcentration);
166 }
170 template <class Evaluation>
171 Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
172 const Evaluation& /*temperature*/,
173 const Evaluation& pressure,
174 const Evaluation& /*Rsw*/,
175 const Evaluation& saltconcentration) const
176 {
177 Scalar pRef = referencePressure_[regionIdx];
178
179 const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
180 const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
181 const Evaluation X = C * (pressure - pRef);
182
183 return (1.0 + X*(1.0 + X/2.0))/BwRef;
184
185 }
186
193 template <class Evaluation>
194 Evaluation saturationPressure(unsigned /*regionIdx*/,
195 const Evaluation& /*temperature*/,
196 const Evaluation& /*Rs*/,
197 const Evaluation& /*saltconcentration*/) const
198 { return 0.0; /* this is dead water, so there isn't any meaningful saturation pressure! */ }
199
203 template <class Evaluation>
204 Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
205 const Evaluation& /*temperature*/,
206 const Evaluation& /*pressure*/,
207 const Evaluation& /*saltconcentration*/) const
208 { return 0.0; /* this is dead water! */ }
209
210 template <class Evaluation>
211 Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
212 const Evaluation& /*pressure*/,
213 unsigned /*compIdx*/) const
214 {
215 throw std::runtime_error("Not implemented: The PVT model does not provide a diffusionCoefficient()");
216 }
217
218 const Scalar waterReferenceDensity(unsigned regionIdx) const
219 { return waterReferenceDensity_[regionIdx]; }
220
221 const std::vector<Scalar>& referencePressure() const
222 { return referencePressure_; }
223
224 const std::vector<TabulatedFunction>& formationVolumeTables() const
225 { return formationVolumeTables_; }
226
227 const std::vector<TabulatedFunction>& compressibilityTables() const
228 { return compressibilityTables_; }
229
230 const std::vector<TabulatedFunction>& viscosityTables() const
231 { return viscosityTables_; }
232
233 const std::vector<TabulatedFunction>& viscosibilityTables() const
234 { return viscosibilityTables_; }
235
236private:
237 std::vector<Scalar> waterReferenceDensity_;
238 std::vector<Scalar> referencePressure_;
239 std::vector<TabulatedFunction> formationVolumeTables_;
240 std::vector<TabulatedFunction> compressibilityTables_;
241 std::vector<TabulatedFunction> viscosityTables_;
242 std::vector<TabulatedFunction> viscosibilityTables_;
243};
244
245} // namespace Opm
246
247#endif
Implements a linearly interpolated scalar function that depends on one variable.
This class represents the Pressure-Volume-Temperature relations of the gas phase without vaporized oi...
Definition ConstantCompressibilityBrinePvt.hpp:50
Evaluation saturatedViscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &saltconcentration) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition ConstantCompressibilityBrinePvt.hpp:138
Evaluation viscosity(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &Rsw, const Evaluation &saltconcentration) const
Returns the dynamic viscosity [Pa s] of the fluid phase given a set of parameters.
Definition ConstantCompressibilityBrinePvt.hpp:114
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition ConstantCompressibilityBrinePvt.hpp:94
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure, const Evaluation &, const Evaluation &saltconcentration) const
Returns the formation volume factor [-] of the fluid phase.
Definition ConstantCompressibilityBrinePvt.hpp:171
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar, Scalar rhoRefWater)
Set the water reference density [kg / m^3].
Definition ConstantCompressibilityBrinePvt.hpp:78
Evaluation saturationPressure(unsigned, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the saturation pressure of the water phase [Pa] depending on its mass fraction of the gas com...
Definition ConstantCompressibilityBrinePvt.hpp:194
Evaluation saturatedGasDissolutionFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the gas dissolution factor [m^3/m^3] of the water phase.
Definition ConstantCompressibilityBrinePvt.hpp:204
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &saltconcentration) const
Returns the formation volume factor [-] of the fluid phase.
Definition ConstantCompressibilityBrinePvt.hpp:159
void initEnd()
Finish initializing the water phase PVT properties.
Definition ConstantCompressibilityBrinePvt.hpp:87
Evaluation internalEnergy(unsigned, const Evaluation &, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the specific enthalpy [J/kg] of water given a set of parameters.
Definition ConstantCompressibilityBrinePvt.hpp:101
Definition EclipseState.hpp:63
Definition Schedule.hpp:88
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