My Project
Loading...
Searching...
No Matches
ConstantCompressibilityWaterPvt.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_WATER_PVT_HPP
28#define OPM_CONSTANT_COMPRESSIBILITY_WATER_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
54 void initFromState(const EclipseState& eclState, const Schedule&);
55#endif
56
57 void setNumRegions(std::size_t numRegions);
58
59 void setVapPars(const Scalar, const Scalar)
60 {
61 }
62
66 void setReferenceDensities(unsigned regionIdx,
67 Scalar /*rhoRefOil*/,
68 Scalar /*rhoRefGas*/,
69 Scalar rhoRefWater)
70 { waterReferenceDensity_[regionIdx] = rhoRefWater; }
71
75 void setReferencePressure(unsigned regionIdx, Scalar p)
76 { waterReferencePressure_[regionIdx] = p; }
77
81 void setViscosity(unsigned regionIdx, Scalar muw, Scalar waterViscosibility = 0.0)
82 {
83 waterViscosity_[regionIdx] = muw;
84 waterViscosibility_[regionIdx] = waterViscosibility;
85 }
86
90 void setCompressibility(unsigned regionIdx, Scalar waterCompressibility)
91 { waterCompressibility_[regionIdx] = waterCompressibility; }
92
96 void setReferenceFormationVolumeFactor(unsigned regionIdx, Scalar BwRef)
97 { waterReferenceFormationVolumeFactor_[regionIdx] = BwRef; }
98
102 void setViscosibility(unsigned regionIdx, Scalar muComp)
103 { waterViscosibility_[regionIdx] = muComp; }
104
108 void initEnd()
109 { }
110
114 unsigned numRegions() const
115 { return waterReferenceDensity_.size(); }
116
120 template <class Evaluation>
121 Evaluation internalEnergy(unsigned,
122 const Evaluation&,
123 const Evaluation&,
124 const Evaluation&,
125 const Evaluation&) const
126 {
127 throw std::runtime_error("Requested the enthalpy of water but the thermal "
128 "option is not enabled");
129 }
130
131 Scalar hVap(unsigned) const
132 {
133 throw std::runtime_error("Requested the hvap of oil but the thermal "
134 "option is not enabled");
135 }
136
140 template <class Evaluation>
141 Evaluation saturatedViscosity(unsigned regionIdx,
142 const Evaluation& temperature,
143 const Evaluation& pressure,
144 const Evaluation& saltconcentration) const
145 {
146 Scalar BwMuwRef = waterViscosity_[regionIdx]*waterReferenceFormationVolumeFactor_[regionIdx];
147 const Evaluation& bw = saturatedInverseFormationVolumeFactor(regionIdx, temperature, pressure, saltconcentration);
148
149 Scalar pRef = waterReferencePressure_[regionIdx];
150 const Evaluation& Y =
151 (waterCompressibility_[regionIdx] - waterViscosibility_[regionIdx])
152 * (pressure - pRef);
153 return BwMuwRef * bw / (1 + Y * (1 + Y / 2));
154 }
155
159 template <class Evaluation>
160 Evaluation viscosity(unsigned regionIdx,
161 const Evaluation& temperature,
162 const Evaluation& pressure,
163 const Evaluation& Rsw,
164 const Evaluation& saltconcentration) const
165 {
166 Scalar BwMuwRef = waterViscosity_[regionIdx]*waterReferenceFormationVolumeFactor_[regionIdx];
167 const Evaluation& bw = inverseFormationVolumeFactor(regionIdx, temperature, pressure, Rsw, saltconcentration);
168
169 Scalar pRef = waterReferencePressure_[regionIdx];
170 const Evaluation& Y =
171 (waterCompressibility_[regionIdx] - waterViscosibility_[regionIdx])
172 * (pressure - pRef);
173 return BwMuwRef * bw / (1 + Y * (1 + Y / 2));
174 }
175
179 template <class Evaluation>
180 Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx,
181 const Evaluation& temperature,
182 const Evaluation& pressure,
183 const Evaluation& saltconcentration) const
184 {
185 Evaluation Rsw = 0.0;
186 return inverseFormationVolumeFactor(regionIdx, temperature, pressure,
187 Rsw, saltconcentration);
188 }
189
193 template <class Evaluation>
194 Evaluation inverseFormationVolumeFactor(unsigned regionIdx,
195 const Evaluation& /*temperature*/,
196 const Evaluation& pressure,
197 const Evaluation& /*Rsw*/,
198 const Evaluation& /*saltconcentration*/) const
199 {
200 Scalar pRef = waterReferencePressure_[regionIdx];
201 const Evaluation& X = waterCompressibility_[regionIdx]*(pressure - pRef);
202
203 Scalar BwRef = waterReferenceFormationVolumeFactor_[regionIdx];
204
205 // TODO (?): consider the salt concentration of the brine
206 return (1.0 + X * (1.0 + X / 2.0)) / BwRef;
207 }
208
209 template <class Evaluation>
210 void inverseBAndMu(Evaluation& bw, Evaluation& muW, unsigned regionIdx,
211 const Evaluation& /*temperature*/,
212 const Evaluation& pressure,
213 const Evaluation& /*Rsw*/,
214 const Evaluation& /*saltconcentration*/) const
215 {
216 inverseBAndMu(bw, muW, regionIdx,pressure);
217 }
218
219 template <class Evaluation>
220 void inverseBAndMu(Evaluation& bw, Evaluation& muW, unsigned regionIdx,
221 const Evaluation& pressure) const
222 {
223 Scalar pRef = waterReferencePressure_[regionIdx];
224 const Evaluation& X = waterCompressibility_[regionIdx]*(pressure - pRef);
225
226 Scalar BwRef = waterReferenceFormationVolumeFactor_[regionIdx];
227
228 // TODO (?): consider the salt concentration of the brine
229 bw = (1.0 + X * (1.0 + X / 2.0)) / BwRef;
230
231 Scalar BwMuwRef = waterViscosity_[regionIdx]*BwRef;
232
233 const Evaluation& Y =
234 (waterCompressibility_[regionIdx] - waterViscosibility_[regionIdx])
235 * (pressure - pRef);
236 muW = BwMuwRef * bw / (1 + Y * (1 + Y / 2));
237 }
238
246 template <class Evaluation>
247 Evaluation saturationPressure(unsigned /*regionIdx*/,
248 const Evaluation& /*temperature*/,
249 const Evaluation& /*Rs*/,
250 const Evaluation& /*saltconcentration*/) const
251 { return 0.0; /* this is dead water, so there isn't any meaningful saturation pressure! */ }
252
253 template <class Evaluation>
254 Evaluation diffusionCoefficient(const Evaluation& /*temperature*/,
255 const Evaluation& /*pressure*/,
256 unsigned /*compIdx*/) const
257 {
258 throw std::runtime_error("Not implemented: The PVT model does not provide "
259 "a diffusionCoefficient()");
260 }
261
265 template <class Evaluation>
266 Evaluation saturatedGasDissolutionFactor(unsigned /*regionIdx*/,
267 const Evaluation& /*temperature*/,
268 const Evaluation& /*pressure*/,
269 const Evaluation& /*saltconcentration*/) const
270 { return 0.0; /* this is dead water! */ }
271
272 Scalar waterReferenceDensity(unsigned regionIdx) const
273 { return waterReferenceDensity_[regionIdx]; }
274
275 const std::vector<Scalar>& waterReferencePressure() const
276 { return waterReferencePressure_; }
277
278 const std::vector<Scalar>& waterReferenceFormationVolumeFactor() const
279 { return waterReferenceFormationVolumeFactor_; }
280
281 const std::vector<Scalar>& waterCompressibility() const
282 { return waterCompressibility_; }
283
284 const std::vector<Scalar>& waterViscosity() const
285 { return waterViscosity_; }
286
287 const std::vector<Scalar>& waterViscosibility() const
288 { return waterViscosibility_; }
289
290private:
291 std::vector<Scalar> waterReferenceDensity_{};
292 std::vector<Scalar> waterReferencePressure_{};
293 std::vector<Scalar> waterReferenceFormationVolumeFactor_{};
294 std::vector<Scalar> waterCompressibility_{};
295 std::vector<Scalar> waterViscosity_{};
296 std::vector<Scalar> waterViscosibility_{};
297};
298
299} // namespace Opm
300
301#endif
This class represents the Pressure-Volume-Temperature relations of the gas phase without vaporized oi...
Definition ConstantCompressibilityWaterPvt.hpp:47
void setReferenceFormationVolumeFactor(unsigned regionIdx, Scalar BwRef)
Set the water reference formation volume factor [-].
Definition ConstantCompressibilityWaterPvt.hpp:96
void setViscosibility(unsigned regionIdx, Scalar muComp)
Set the water "viscosibility" [1/ (Pa s)].
Definition ConstantCompressibilityWaterPvt.hpp:102
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 ConstantCompressibilityWaterPvt.hpp:247
Evaluation inverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &, const Evaluation &pressure, const Evaluation &, const Evaluation &) const
Returns the formation volume factor [-] of the fluid phase.
Definition ConstantCompressibilityWaterPvt.hpp:194
void setCompressibility(unsigned regionIdx, Scalar waterCompressibility)
Set the compressibility of the water phase.
Definition ConstantCompressibilityWaterPvt.hpp:90
void setReferenceDensities(unsigned regionIdx, Scalar, Scalar, Scalar rhoRefWater)
Set the water reference density [kg / m^3].
Definition ConstantCompressibilityWaterPvt.hpp:66
unsigned numRegions() const
Return the number of PVT regions which are considered by this PVT-object.
Definition ConstantCompressibilityWaterPvt.hpp:114
void setReferencePressure(unsigned regionIdx, Scalar p)
Set the water reference pressure [Pa].
Definition ConstantCompressibilityWaterPvt.hpp:75
void initEnd()
Finish initializing the water phase PVT properties.
Definition ConstantCompressibilityWaterPvt.hpp:108
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 ConstantCompressibilityWaterPvt.hpp:160
void setViscosity(unsigned regionIdx, Scalar muw, Scalar waterViscosibility=0.0)
Set the viscosity and "viscosibility" of the water phase.
Definition ConstantCompressibilityWaterPvt.hpp:81
Evaluation saturatedInverseFormationVolumeFactor(unsigned regionIdx, const Evaluation &temperature, const Evaluation &pressure, const Evaluation &saltconcentration) const
Returns the formation volume factor [-] of the fluid phase.
Definition ConstantCompressibilityWaterPvt.hpp:180
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 ConstantCompressibilityWaterPvt.hpp:141
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 ConstantCompressibilityWaterPvt.hpp:121
Evaluation saturatedGasDissolutionFactor(unsigned, const Evaluation &, const Evaluation &, const Evaluation &) const
Returns the gas dissolution factor [m^3/m^3] of the water phase.
Definition ConstantCompressibilityWaterPvt.hpp:266
Definition EclipseState.hpp:62
Definition Schedule.hpp:101
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30