My Project
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
74 void setReferenceDensities(unsigned regionIdx,
75 Scalar /*rhoRefOil*/,
76 Scalar /*rhoRefGas*/,
77 Scalar rhoRefWater)
78 { waterReferenceDensity_[regionIdx] = rhoRefWater; }
79
83 void initEnd()
84 { }
85
86
90 unsigned numRegions() const
91 { return waterReferenceDensity_.size(); }
92
96 template <class Evaluation>
97 Evaluation internalEnergy(unsigned,
98 const Evaluation&,
99 const Evaluation&,
100 const Evaluation&,
101 const Evaluation&) const
102 {
103 throw std::runtime_error("Requested the enthalpy of water but the thermal option is not enabled");
104 }
105
109 template <class Evaluation>
110 Evaluation viscosity(unsigned regionIdx,
111 const Evaluation& temperature,
112 const Evaluation& pressure,
113 const Evaluation& Rsw,
114 const Evaluation& saltconcentration) const
115 {
116 // cf. ECLiPSE 2013.2 technical description, p. 114
117 Scalar pRef = referencePressure_[regionIdx];
118 const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
119 const Evaluation Cv = viscosibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
120 const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
121 const Evaluation Y = (C-Cv)* (pressure - pRef);
122 Evaluation MuwRef = viscosityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
123
124 const Evaluation& bw = inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rsw, saltconcentration);
125
126 return MuwRef*BwRef*bw/(1 + Y*(1 + Y/2));
127 }
128
129
133 template <class Evaluation>
134 Evaluation saturatedViscosity(unsigned regionIdx,
135 const Evaluation& temperature,
136 const Evaluation& pressure,
137 const Evaluation& saltconcentration) const
138 {
139 Scalar pRef = referencePressure_[regionIdx];
140 const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
141 const Evaluation Cv = viscosibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
142 const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
143 const Evaluation Y = (C-Cv)* (pressure - pRef);
144 Evaluation MuwRef = viscosityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
145
146 const Evaluation& bw = saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure, saltconcentration);
147
148 return MuwRef*BwRef*bw/(1 + Y*(1 + Y/2));
149 }
150
154 template <class Evaluation>
155 Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
156 const Evaluation& temperature,
157 const Evaluation& pressure,
158 const Evaluation& saltconcentration) const
159 {
160 Evaluation Rsw = 0.0;
161 return inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rsw, saltconcentration);
162 }
166 template <class Evaluation>
167 Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
168 const Evaluation& /*temperature*/,
169 const Evaluation& pressure,
170 const Evaluation& /*Rsw*/,
171 const Evaluation& saltconcentration) const
172 {
173 Scalar pRef = referencePressure_[regionIdx];
174
175 const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
176 const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
177 const Evaluation X = C * (pressure - pRef);
178
179 return (1.0 + X*(1.0 + X/2.0))/BwRef;
180
181 }
182
189 template <class Evaluation>
190 Evaluation saturationPressure(unsigned /*regionIdx*/,
191 const Evaluation& /*temperature*/,
192 const Evaluation& /*Rs*/,
193 const Evaluation& /*saltconcentration*/) const
194 { return 0.0; /* this is dead water, so there isn't any meaningful saturation pressure! */ }
195
199 template <class Evaluation>
200 Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
201 const Evaluation& /*temperature*/,
202 const Evaluation& /*pressure*/,
203 const Evaluation& /*saltconcentration*/) const
204 { return 0.0; /* this is dead water! */ }
205
206 template <class Evaluation>
207 Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
208 const Evaluation& /*pressure*/,
209 unsigned /*compIdx*/) const
210 {
211 throw std::runtime_error("Not implemented: The PVT model does not provide a diffusionCoefficient()");
212 }
213
214 const Scalar waterReferenceDensity(unsigned regionIdx) const
215 { return waterReferenceDensity_[regionIdx]; }
216
217 const std::vector<Scalar>& referencePressure() const
218 { return referencePressure_; }
219
220 const std::vector<TabulatedFunction>& formationVolumeTables() const
221 { return formationVolumeTables_; }
222
223 const std::vector<TabulatedFunction>& compressibilityTables() const
224 { return compressibilityTables_; }
225
226 const std::vector<TabulatedFunction>& viscosityTables() const
227 { return viscosityTables_; }
228
229 const std::vector<TabulatedFunction>& viscosibilityTables() const
230 { return viscosibilityTables_; }
231
232private:
233 std::vector<Scalar> waterReferenceDensity_;
234 std::vector<Scalar> referencePressure_;
235 std::vector<TabulatedFunction> formationVolumeTables_;
236 std::vector<TabulatedFunction> compressibilityTables_;
237 std::vector<TabulatedFunction> viscosityTables_;
238 std::vector<TabulatedFunction> viscosibilityTables_;
239};
240
241} // namespace Opm
242
243#endif
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:134
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:110
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition: ConstantCompressibilityBrinePvt.hpp:90
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:167
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar, Scalar rhoRefWater)
Set the water reference density [kg / m^3].
Definition: ConstantCompressibilityBrinePvt.hpp:74
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:190
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:200
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:155
void initEnd()
Finish initializing the water phase PVT properties.
Definition: ConstantCompressibilityBrinePvt.hpp:83
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:97
Definition: EclipseState.hpp:55
Definition: Schedule.hpp:130
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