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 <cstddef>
33#include <vector>
34
35namespace Opm {
36
37template <class Scalar, bool enableThermal, bool enableBrine>
38class WaterPvtMultiplexer;
39
40#if HAVE_ECL_INPUT
41class EclipseState;
42class Schedule;
43#endif
44
49template <class Scalar>
51{
52public:
54
55#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 setReferenceDensities(unsigned regionIdx,
73 Scalar /*rhoRefOil*/,
74 Scalar /*rhoRefGas*/,
75 Scalar rhoRefWater)
76 { waterReferenceDensity_[regionIdx] = rhoRefWater; }
77
81 void initEnd()
82 { }
83
87 unsigned numRegions() const
88 { return waterReferenceDensity_.size(); }
89
93 template <class Evaluation>
94 Evaluation internalEnergy(unsigned,
95 const Evaluation&,
96 const Evaluation&,
97 const Evaluation&,
98 const Evaluation&) const
99 {
100 throw std::runtime_error("Requested the enthalpy of water but the thermal option is not enabled");
101 }
102
103 Scalar hVap(unsigned) const
104 {
105 throw std::runtime_error("Requested the hvap of oil but the thermal option is not enabled");
106 }
107
111 template <class Evaluation>
112 Evaluation viscosity(unsigned regionIdx,
113 const Evaluation& temperature,
114 const Evaluation& pressure,
115 const Evaluation& Rsw,
116 const Evaluation& saltconcentration) const
117 {
118 // cf. ECLiPSE 2013.2 technical description, p. 114
119 Scalar pRef = referencePressure_[regionIdx];
120 const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
121 const Evaluation Cv = viscosibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
122 const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
123 const Evaluation Y = (C-Cv)* (pressure - pRef);
124 Evaluation MuwRef = viscosityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
125
126 const Evaluation& bw = inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rsw, saltconcentration);
127
128 return MuwRef * BwRef * bw / (1 + Y * (1 + Y/2));
129 }
130
131
135 template <class Evaluation>
136 Evaluation saturatedViscosity(unsigned regionIdx,
137 const Evaluation& temperature,
138 const Evaluation& pressure,
139 const Evaluation& saltconcentration) const
140 {
141 Scalar pRef = referencePressure_[regionIdx];
142 const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
143 const Evaluation Cv = viscosibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
144 const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
145 const Evaluation Y = (C-Cv)* (pressure - pRef);
146 Evaluation MuwRef = viscosityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
147
148 const Evaluation& bw = saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure, saltconcentration);
149
150 return MuwRef * BwRef * bw / (1 + Y * (1 + Y/2));
151 }
152
156 template <class Evaluation>
157 Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
158 const Evaluation& temperature,
159 const Evaluation& pressure,
160 const Evaluation& saltconcentration) const
161 {
162 Evaluation Rsw = 0.0;
163 return inverseFormationVolumeFactor(regionIdx, temperature, pressure,
164 Rsw, saltconcentration);
165 }
169 template <class Evaluation>
170 Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
171 const Evaluation& /*temperature*/,
172 const Evaluation& pressure,
173 const Evaluation& /*Rsw*/,
174 const Evaluation& saltconcentration) const
175 {
176 Scalar pRef = referencePressure_[regionIdx];
177
178 const Evaluation BwRef = formationVolumeTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
179 const Evaluation C = compressibilityTables_[regionIdx].eval(saltconcentration, /*extrapolate=*/true);
180 const Evaluation X = C * (pressure - pRef);
181
182 return (1.0 + X * (1.0 + X / 2.0)) / BwRef;
183
184 }
185
192 template <class Evaluation>
193 Evaluation saturationPressure(unsigned /*regionIdx*/,
194 const Evaluation& /*temperature*/,
195 const Evaluation& /*Rs*/,
196 const Evaluation& /*saltconcentration*/) const
197 { return 0.0; /* this is dead water, so there isn't any meaningful saturation pressure! */ }
198
202 template <class Evaluation>
203 Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
204 const Evaluation& /*temperature*/,
205 const Evaluation& /*pressure*/,
206 const Evaluation& /*saltconcentration*/) const
207 { return 0.0; /* this is dead water! */ }
208
209 template <class Evaluation>
210 Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
211 const Evaluation& /*pressure*/,
212 unsigned /*compIdx*/) const
213 {
214 throw std::runtime_error("Not implemented: The PVT model does not provide "
215 "a diffusionCoefficient()");
216 }
217
218 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:51
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:136
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:112
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition ConstantCompressibilityBrinePvt.hpp:87
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:170
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar, Scalar rhoRefWater)
Set the water reference density [kg / m^3].
Definition ConstantCompressibilityBrinePvt.hpp:72
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:193
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:203
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:157
void initEnd()
Finish initializing the water phase PVT properties.
Definition ConstantCompressibilityBrinePvt.hpp:81
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:94
Definition EclipseState.hpp:62
Definition Schedule.hpp:101
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