My Project
Loading...
Searching...
No Matches
Brine.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*/
28#ifndef OPM_BRINE_HPP
29#define OPM_BRINE_HPP
30
33
34#include <string_view>
35
36namespace Opm {
37
46template <class Scalar, class H2O>
47class Brine : public Component<Scalar, Brine<Scalar, H2O> >
48{
49public:
51 static Scalar salinity;
52
56 static std::string_view name()
57 { return "Brine"; }
58
62 static bool gasIsIdeal()
63 { return H2O::gasIsIdeal(); }
64
68 static bool gasIsCompressible()
69 { return H2O::gasIsCompressible(); }
70
75 { return H2O::liquidIsCompressible(); }
76
82 static Scalar molarMass()
83 {
84 const Scalar M1 = H2O::molarMass();
85 constexpr Scalar M2 = 58e-3; // molar mass of NaCl [kg/mol]
86 const Scalar X2 = salinity; // mass fraction of salt in brine
87 return M1*M2/(M2 + X2*(M1 - M2));
88 }
89
93 static Scalar criticalTemperature()
94 { return H2O::criticalTemperature(); /* [K] */ }
95
99 static Scalar criticalPressure()
100 { return H2O::criticalPressure(); /* [N/m^2] */ }
101
105 static Scalar criticalVolume()
106 { return H2O::criticalVolume(); /* [m3/kmol] */ }
107
111 static Scalar acentricFactor()
112 { return H2O::acentricFactor(); }
113
117 static Scalar tripleTemperature()
118 { return H2O::tripleTemperature(); /* [K] */ }
119
123 static Scalar triplePressure()
124 { return H2O::triplePressure(); /* [N/m^2] */ }
125
129 template <class Evaluation>
130 static Evaluation vaporPressure(const Evaluation& T)
131 { return H2O::vaporPressure(T); /* [N/m^2] */ }
132
136 template <class Evaluation>
137 static Evaluation gasEnthalpy(const Evaluation& temperature,
138 const Evaluation& pressure)
139 { return H2O::gasEnthalpy(temperature, pressure); /* [J/kg] */ }
140
149 template <class Evaluation>
150 static Evaluation liquidEnthalpy(const Evaluation& temperature,
151 const Evaluation& pressure)
152 {
153 // Numerical coefficents from Palliser and McKibbin
154 static constexpr Scalar f[] = {
155 2.63500e-1, 7.48368e-6, 1.44611e-6, -3.80860e-10
156 };
157
158 // Numerical coefficents from Michaelides for the enthalpy of brine
159 static constexpr Scalar a[4][3] = {
160 { -9633.6, -4080.0, +286.49 },
161 { +166.58, +68.577, -4.6856 },
162 { -0.90963, -0.36524, +0.249667e-1 },
163 { +0.17965e-2, +0.71924e-3, -0.4900e-4 }
164 };
165
166 const Evaluation theta = temperature - 273.15;
167
168 Evaluation S = salinity;
169 const Evaluation S_lSAT =
170 f[0]
171 + f[1]*theta
172 + f[2]*pow(theta, 2)
173 + f[3]*pow(theta, 3);
174
175 // Regularization
176 if (S > S_lSAT)
177 S = S_lSAT;
178
179 const Evaluation hw = H2O::liquidEnthalpy(temperature, pressure)/1e3; // [kJ/kg]
180
181 // From Daubert and Danner
182 const Evaluation h_NaCl =
183 (3.6710e4*temperature
184 + (6.2770e1/2)*temperature*temperature
185 - (6.6670e-2/3)*temperature*temperature*temperature
186 + (2.8000e-5/4)*pow(temperature, 4.0))/58.44e3
187 - 2.045698e+02; // [kJ/kg]
188
189 const Evaluation m = S/(1-S)/58.44e-3;
190
191 Evaluation d_h = 0;
192 for (int i = 0; i<=3; ++i) {
193 for (int j = 0; j <= 2; ++j) {
194 d_h += a[i][j] * pow(theta, i) * pow(m, j);
195 }
196 }
197
198 const Evaluation delta_h = 4.184/(1e3 + (58.44 * m))*d_h;
199
200 // Enthalpy of brine
201 const Evaluation h_ls = (1-S)*hw + S*h_NaCl + S*delta_h; // [kJ/kg]
202 return h_ls*1e3; // convert to [J/kg]
203 }
204
205
209 template <class Evaluation>
210 static Evaluation liquidHeatCapacity(const Evaluation& temperature,
211 const Evaluation& pressure)
212 {
213 Scalar eps = scalarValue(temperature)*1e-8;
214 return (liquidEnthalpy(temperature + eps, pressure) - liquidEnthalpy(temperature, pressure))/eps;
215 }
216
220 template <class Evaluation>
221 static Evaluation gasHeatCapacity(const Evaluation& temperature,
222 const Evaluation& pressure)
223 { return H2O::gasHeatCapacity(temperature, pressure); }
224
228 template <class Evaluation>
229 static Evaluation gasInternalEnergy(const Evaluation& temperature,
230 const Evaluation& pressure)
231 {
232 return
233 gasEnthalpy(temperature, pressure) -
234 pressure/gasDensity(temperature, pressure);
235 }
236
240 template <class Evaluation>
241 static Evaluation liquidInternalEnergy(const Evaluation& temperature,
242 const Evaluation& pressure)
243 {
244 return
245 liquidEnthalpy(temperature, pressure) -
246 pressure/liquidDensity(temperature, pressure);
247 }
248
252 template <class Evaluation>
253 static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
254 { return H2O::gasDensity(temperature, pressure); }
255
263 template <class Evaluation>
264 static Evaluation liquidDensity(const Evaluation& temperature, const Evaluation& pressure, bool extrapolate = false)
265 {
266 Evaluation tempC = temperature - 273.15;
267 Evaluation pMPa = pressure/1.0E6;
268
269 const Evaluation rhow = H2O::liquidDensity(temperature, pressure, extrapolate);
270 return
271 rhow +
272 1000*salinity*(
273 0.668 +
274 0.44*salinity +
275 1.0E-6*(
276 300*pMPa -
277 2400*pMPa*salinity +
278 tempC*(
279 80.0 +
280 3*tempC -
281 3300*salinity -
282 13*pMPa +
283 47*pMPa*salinity)));
284 }
285
289 template <class Evaluation>
290 static Evaluation gasPressure(const Evaluation& temperature, const Evaluation& density)
291 { return H2O::gasPressure(temperature, density); }
292
296 template <class Evaluation>
297 static Evaluation liquidPressure(const Evaluation& temperature, const Evaluation& density)
298 {
299 // We use the newton method for this. For the initial value we
300 // assume the pressure to be 10% higher than the vapor
301 // pressure
302 Evaluation pressure = 1.1*vaporPressure(temperature);
303 Scalar eps = scalarValue(pressure)*1e-7;
304
305 Evaluation deltaP = pressure*2;
306 for (int i = 0;
307 i < 5
308 && std::abs(scalarValue(pressure)*1e-9) < std::abs(scalarValue(deltaP));
309 ++i)
310 {
311 const Evaluation f = liquidDensity(temperature, pressure) - density;
312
313 Evaluation df_dp = liquidDensity(temperature, pressure + eps);
314 df_dp -= liquidDensity(temperature, pressure - eps);
315 df_dp /= 2*eps;
316
317 deltaP = - f/df_dp;
318
319 pressure += deltaP;
320 }
321
322 return pressure;
323 }
324
328 template <class Evaluation>
329 static Evaluation gasViscosity(const Evaluation& temperature, const Evaluation& pressure)
330 { return H2O::gasViscosity(temperature, pressure); }
331
340 template <class Evaluation>
341 static Evaluation liquidViscosity(const Evaluation& temperature, const Evaluation& /*pressure*/)
342 {
343 Evaluation T_C = temperature - 273.15;
344 if(temperature <= 275.) // regularization
345 T_C = 275.0;
346
347 Evaluation A = (0.42*std::pow((std::pow(salinity, 0.8)-0.17), 2) + 0.045)*pow(T_C, 0.8);
348 Evaluation mu_brine = 0.1 + 0.333*salinity + (1.65+91.9*salinity*salinity*salinity)*exp(-A);
349
350 return mu_brine/1000.0; // convert to [Pa s] (todo: check if correct cP->Pa s is times 10...)
351 }
352};
353
357template <class Scalar, class H2O>
358Scalar Brine<Scalar, H2O>::salinity = 0.1; // also needs to be adapted in CO2 solubility table!
359
360} // namespace Opm
361
362#endif
Abstract base class of a pure chemical species.
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
A class for the brine fluid properties.
Definition Brine.hpp:48
static Scalar molarMass()
The molar mass in of the component.
Definition Brine.hpp:82
static Evaluation gasPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of steam in at a given density and temperature.
Definition Brine.hpp:290
static Scalar criticalVolume()
Returns the critical volume of water.
Definition Brine.hpp:105
static Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition Brine.hpp:117
static Scalar criticalPressure()
Returns the critical pressure of water.
Definition Brine.hpp:99
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam and water vapor .
Definition Brine.hpp:229
static Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition Brine.hpp:130
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the pure component in liquid.
Definition Brine.hpp:150
static std::string_view name()
A human readable name for the component.
Definition Brine.hpp:56
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition Brine.hpp:68
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The density of the liquid component at a given pressure in and temperature in .
Definition Brine.hpp:264
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of steam.
Definition Brine.hpp:329
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam in at a given pressure and temperature.
Definition Brine.hpp:253
static Scalar criticalTemperature()
Returns the critical temperature of water.
Definition Brine.hpp:93
static Scalar triplePressure()
Returns the pressure at water's triple point.
Definition Brine.hpp:123
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of water steam .
Definition Brine.hpp:221
static Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &)
The dynamic viscosity of pure water.
Definition Brine.hpp:341
static Evaluation liquidInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of liquid water .
Definition Brine.hpp:241
static Evaluation liquidPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of liquid water in at a given density and temperature.
Definition Brine.hpp:297
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition Brine.hpp:74
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition Brine.hpp:62
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the pure component in gas.
Definition Brine.hpp:137
static Scalar salinity
The mass fraction of salt assumed to be in the brine.
Definition Brine.hpp:51
static Scalar acentricFactor()
Definition Brine.hpp:111
static Evaluation liquidHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of liquid water .
Definition Brine.hpp:210
Abstract base class of a pure chemical species.
Definition Component.hpp:44
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The density of pure water in at a given pressure and temperature.
Definition H2O.hpp:687
static const Scalar criticalTemperature()
Returns the critical temperature of water.
Definition H2O.hpp:95
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam in at a given pressure and temperature.
Definition H2O.hpp:562
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition H2O.hpp:540
static Evaluation gasPressure(const Evaluation &temperature, Scalar density)
The pressure of steam in at a given density and temperature.
Definition H2O.hpp:643
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition H2O.hpp:141
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of steam.
Definition H2O.hpp:790
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of water steam .
Definition H2O.hpp:279
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of liquid water .
Definition H2O.hpp:237
static const Scalar acentricFactor()
The acentric factor of water.
Definition H2O.hpp:89
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition H2O.hpp:627
static const Scalar criticalPressure()
Returns the critical pressure of water.
Definition H2O.hpp:101
static const Scalar molarMass()
The molar mass in of water.
Definition H2O.hpp:83
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition H2O.hpp:546
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of water steam .
Definition H2O.hpp:186
static const Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition H2O.hpp:119
static const Scalar triplePressure()
Returns the pressure at water's triple point.
Definition H2O.hpp:125
static const Scalar criticalVolume()
Returns the critical volume of water.
Definition H2O.hpp:107
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30