My Project
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 namespace Opm {
35 
44 template <class Scalar, class H2O>
45 class Brine : public Component<Scalar, Brine<Scalar, H2O> >
46 {
47 public:
49  static Scalar salinity;
50 
54  static const char* name()
55  { return "Brine"; }
56 
60  static bool gasIsIdeal()
61  { return H2O::gasIsIdeal(); }
62 
66  static bool gasIsCompressible()
67  { return H2O::gasIsCompressible(); }
68 
72  static bool liquidIsCompressible()
73  { return H2O::liquidIsCompressible(); }
74 
80  static Scalar molarMass()
81  {
82  const Scalar M1 = H2O::molarMass();
83  constexpr Scalar M2 = 58e-3; // molar mass of NaCl [kg/mol]
84  const Scalar X2 = salinity; // mass fraction of salt in brine
85  return M1*M2/(M2 + X2*(M1 - M2));
86  }
87 
91  static Scalar criticalTemperature()
92  { return H2O::criticalTemperature(); /* [K] */ }
93 
97  static Scalar criticalPressure()
98  { return H2O::criticalPressure(); /* [N/m^2] */ }
99 
103  static Scalar criticalVolume()
104  { return H2O::criticalVolume(); /* [m3/kmol] */ }
105 
109  static Scalar acentricFactor()
110  { return H2O::acentricFactor(); }
111 
115  static Scalar tripleTemperature()
116  { return H2O::tripleTemperature(); /* [K] */ }
117 
121  static Scalar triplePressure()
122  { return H2O::triplePressure(); /* [N/m^2] */ }
123 
127  template <class Evaluation>
128  static Evaluation vaporPressure(const Evaluation& T)
129  { return H2O::vaporPressure(T); /* [N/m^2] */ }
130 
134  template <class Evaluation>
135  static Evaluation gasEnthalpy(const Evaluation& temperature,
136  const Evaluation& pressure)
137  { return H2O::gasEnthalpy(temperature, pressure); /* [J/kg] */ }
138 
147  template <class Evaluation>
148  static Evaluation liquidEnthalpy(const Evaluation& temperature,
149  const Evaluation& pressure)
150  {
151  // Numerical coefficents from Palliser and McKibbin
152  static constexpr Scalar f[] = {
153  2.63500e-1, 7.48368e-6, 1.44611e-6, -3.80860e-10
154  };
155 
156  // Numerical coefficents from Michaelides for the enthalpy of brine
157  static constexpr Scalar a[4][3] = {
158  { -9633.6, -4080.0, +286.49 },
159  { +166.58, +68.577, -4.6856 },
160  { -0.90963, -0.36524, +0.249667e-1 },
161  { +0.17965e-2, +0.71924e-3, -0.4900e-4 }
162  };
163 
164  const Evaluation theta = temperature - 273.15;
165 
166  Evaluation S = salinity;
167  const Evaluation S_lSAT =
168  f[0]
169  + f[1]*theta
170  + f[2]*pow(theta, 2)
171  + f[3]*pow(theta, 3);
172 
173  // Regularization
174  if (S > S_lSAT)
175  S = S_lSAT;
176 
177  const Evaluation hw = H2O::liquidEnthalpy(temperature, pressure)/1e3; // [kJ/kg]
178 
179  // From Daubert and Danner
180  const Evaluation h_NaCl =
181  (3.6710e4*temperature
182  + (6.2770e1/2)*temperature*temperature
183  - (6.6670e-2/3)*temperature*temperature*temperature
184  + (2.8000e-5/4)*pow(temperature, 4.0))/58.44e3
185  - 2.045698e+02; // [kJ/kg]
186 
187  const Evaluation m = S/(1-S)/58.44e-3;
188 
189  Evaluation d_h = 0;
190  for (int i = 0; i<=3; ++i) {
191  for (int j = 0; j <= 2; ++j) {
192  d_h += a[i][j] * pow(theta, i) * pow(m, j);
193  }
194  }
195 
196  const Evaluation delta_h = 4.184/(1e3 + (58.44 * m))*d_h;
197 
198  // Enthalpy of brine
199  const Evaluation h_ls = (1-S)*hw + S*h_NaCl + S*delta_h; // [kJ/kg]
200  return h_ls*1e3; // convert to [J/kg]
201  }
202 
203 
207  template <class Evaluation>
208  static Evaluation liquidHeatCapacity(const Evaluation& temperature,
209  const Evaluation& pressure)
210  {
211  Scalar eps = scalarValue(temperature)*1e-8;
212  return (liquidEnthalpy(temperature + eps, pressure) - liquidEnthalpy(temperature, pressure))/eps;
213  }
214 
218  template <class Evaluation>
219  static Evaluation gasHeatCapacity(const Evaluation& temperature,
220  const Evaluation& pressure)
221  { return H2O::gasHeatCapacity(temperature, pressure); }
222 
226  template <class Evaluation>
227  static Evaluation gasInternalEnergy(const Evaluation& temperature,
228  const Evaluation& pressure)
229  {
230  return
231  gasEnthalpy(temperature, pressure) -
232  pressure/gasDensity(temperature, pressure);
233  }
234 
238  template <class Evaluation>
239  static Evaluation liquidInternalEnergy(const Evaluation& temperature,
240  const Evaluation& pressure)
241  {
242  return
243  liquidEnthalpy(temperature, pressure) -
244  pressure/liquidDensity(temperature, pressure);
245  }
246 
250  template <class Evaluation>
251  static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
252  { return H2O::gasDensity(temperature, pressure); }
253 
261  template <class Evaluation>
262  static Evaluation liquidDensity(const Evaluation& temperature, const Evaluation& pressure, bool extrapolate = false)
263  {
264  Evaluation tempC = temperature - 273.15;
265  Evaluation pMPa = pressure/1.0E6;
266 
267  const Evaluation rhow = H2O::liquidDensity(temperature, pressure, extrapolate);
268  return
269  rhow +
270  1000*salinity*(
271  0.668 +
272  0.44*salinity +
273  1.0E-6*(
274  300*pMPa -
275  2400*pMPa*salinity +
276  tempC*(
277  80.0 -
278  3*tempC -
279  3300*salinity -
280  13*pMPa +
281  47*pMPa*salinity)));
282  }
283 
287  template <class Evaluation>
288  static Evaluation gasPressure(const Evaluation& temperature, const Evaluation& density)
289  { return H2O::gasPressure(temperature, density); }
290 
294  template <class Evaluation>
295  static Evaluation liquidPressure(const Evaluation& temperature, const Evaluation& density)
296  {
297  // We use the newton method for this. For the initial value we
298  // assume the pressure to be 10% higher than the vapor
299  // pressure
300  Evaluation pressure = 1.1*vaporPressure(temperature);
301  Scalar eps = scalarValue(pressure)*1e-7;
302 
303  Evaluation deltaP = pressure*2;
304  for (int i = 0;
305  i < 5
306  && std::abs(scalarValue(pressure)*1e-9) < std::abs(scalarValue(deltaP));
307  ++i)
308  {
309  const Evaluation f = liquidDensity(temperature, pressure) - density;
310 
311  Evaluation df_dp = liquidDensity(temperature, pressure + eps);
312  df_dp -= liquidDensity(temperature, pressure - eps);
313  df_dp /= 2*eps;
314 
315  deltaP = - f/df_dp;
316 
317  pressure += deltaP;
318  }
319 
320  return pressure;
321  }
322 
326  template <class Evaluation>
327  static Evaluation gasViscosity(const Evaluation& temperature, const Evaluation& pressure)
328  { return H2O::gasViscosity(temperature, pressure); }
329 
338  template <class Evaluation>
339  static Evaluation liquidViscosity(const Evaluation& temperature, const Evaluation& /*pressure*/)
340  {
341  Evaluation T_C = temperature - 273.15;
342  if(temperature <= 275.) // regularization
343  T_C = 275.0;
344 
345  Evaluation A = (0.42*std::pow((std::pow(salinity, 0.8)-0.17), 2) + 0.045)*pow(T_C, 0.8);
346  Evaluation mu_brine = 0.1 + 0.333*salinity + (1.65+91.9*salinity*salinity*salinity)*exp(-A);
347 
348  return mu_brine/1000.0; // convert to [Pa s] (todo: check if correct cP->Pa s is times 10...)
349  }
350 };
351 
355 template <class Scalar, class H2O>
356 Scalar Brine<Scalar, H2O>::salinity = 0.1; // also needs to be adapted in CO2 solubility table!
357 
358 } // namespace Opm
359 
360 #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:46
static Scalar molarMass()
The molar mass in of the component.
Definition: Brine.hpp:80
static Evaluation gasPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of steam in at a given density and temperature.
Definition: Brine.hpp:288
static Scalar criticalVolume()
Returns the critical volume of water.
Definition: Brine.hpp:103
static Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition: Brine.hpp:115
static Scalar criticalPressure()
Returns the critical pressure of water.
Definition: Brine.hpp:97
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam and water vapor .
Definition: Brine.hpp:227
static Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition: Brine.hpp:128
static const char * name()
A human readable name for the component.
Definition: Brine.hpp:54
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the pure component in liquid.
Definition: Brine.hpp:148
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: Brine.hpp:66
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:262
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of steam.
Definition: Brine.hpp:327
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam in at a given pressure and temperature.
Definition: Brine.hpp:251
static Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: Brine.hpp:91
static Scalar triplePressure()
Returns the pressure at water's triple point.
Definition: Brine.hpp:121
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of water steam .
Definition: Brine.hpp:219
static Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &)
The dynamic viscosity of pure water.
Definition: Brine.hpp:339
static Evaluation liquidInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of liquid water .
Definition: Brine.hpp:239
static Evaluation liquidPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of liquid water in at a given density and temperature.
Definition: Brine.hpp:295
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: Brine.hpp:72
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: Brine.hpp:60
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the pure component in gas.
Definition: Brine.hpp:135
static Scalar salinity
The mass fraction of salt assumed to be in the brine.
Definition: Brine.hpp:49
static Scalar acentricFactor()
Definition: Brine.hpp:109
static Evaluation liquidHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of liquid water .
Definition: Brine.hpp:208
Abstract base class of a pure chemical species.
Definition: Component.hpp:42
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:698
static const Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: H2O.hpp:92
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam in at a given pressure and temperature.
Definition: H2O.hpp:572
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: H2O.hpp:550
static Evaluation gasPressure(const Evaluation &temperature, Scalar density)
The pressure of steam in at a given density and temperature.
Definition: H2O.hpp:654
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition: H2O.hpp:138
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of steam.
Definition: H2O.hpp:802
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of water steam .
Definition: H2O.hpp:280
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of liquid water .
Definition: H2O.hpp:236
static const Scalar acentricFactor()
The acentric factor of water.
Definition: H2O.hpp:86
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: H2O.hpp:638
static const Scalar criticalPressure()
Returns the critical pressure of water.
Definition: H2O.hpp:98
static const Scalar molarMass()
The molar mass in of water.
Definition: H2O.hpp:80
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: H2O.hpp:556
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of water steam .
Definition: H2O.hpp:183
static const Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition: H2O.hpp:116
static const Scalar triplePressure()
Returns the pressure at water's triple point.
Definition: H2O.hpp:122
static const Scalar criticalVolume()
Returns the critical volume of water.
Definition: H2O.hpp:104