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  const 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 tripleTemperature()
104  { return H2O::tripleTemperature(); /* [K] */ }
105 
109  static Scalar triplePressure()
110  { return H2O::triplePressure(); /* [N/m^2] */ }
111 
115  template <class Evaluation>
116  static Evaluation vaporPressure(const Evaluation& T)
117  { return H2O::vaporPressure(T); /* [N/m^2] */ }
118 
122  template <class Evaluation>
123  static Evaluation gasEnthalpy(const Evaluation& temperature,
124  const Evaluation& pressure)
125  { return H2O::gasEnthalpy(temperature, pressure); /* [J/kg] */ }
126 
135  template <class Evaluation>
136  static Evaluation liquidEnthalpy(const Evaluation& temperature,
137  const Evaluation& pressure)
138  {
139  // Numerical coefficents from Palliser and McKibbin
140  static const Scalar f[] = {
141  2.63500e-1, 7.48368e-6, 1.44611e-6, -3.80860e-10
142  };
143 
144  // Numerical coefficents from Michaelides for the enthalpy of brine
145  static const Scalar a[4][3] = {
146  { -9633.6, -4080.0, +286.49 },
147  { +166.58, +68.577, -4.6856 },
148  { -0.90963, -0.36524, +0.249667e-1 },
149  { +0.17965e-2, +0.71924e-3, -0.4900e-4 }
150  };
151 
152  const Evaluation& theta = temperature - 273.15;
153 
154  Evaluation S = salinity;
155  const Evaluation& S_lSAT =
156  f[0]
157  + f[1]*theta
158  + f[2]*pow(theta, 2)
159  + f[3]*pow(theta, 3);
160 
161  // Regularization
162  if (S > S_lSAT)
163  S = S_lSAT;
164 
165  const Evaluation& hw = H2O::liquidEnthalpy(temperature, pressure)/1e3; // [kJ/kg]
166 
167  // From Daubert and Danner
168  const Evaluation& h_NaCl =
169  (3.6710e4*temperature
170  + (6.2770e1/2)*temperature*temperature
171  - (6.6670e-2/3)*temperature*temperature*temperature
172  + (2.8000e-5/4)*pow(temperature, 4.0))/58.44e3
173  - 2.045698e+02; // [kJ/kg]
174 
175  const Evaluation& m = S/(1-S)/58.44e-3;
176 
177  Evaluation d_h = 0;
178  for (int i = 0; i<=3; ++i) {
179  for (int j = 0; j <= 2; ++j) {
180  d_h += a[i][j] * pow(theta, i) * pow(m, j);
181  }
182  }
183 
184  const Evaluation& delta_h = 4.184/(1e3 + (58.44 * m))*d_h;
185 
186  // Enthalpy of brine
187  const Evaluation& h_ls = (1-S)*hw + S*h_NaCl + S*delta_h; // [kJ/kg]
188  return h_ls*1e3; // convert to [J/kg]
189  }
190 
191 
195  template <class Evaluation>
196  static Evaluation liquidHeatCapacity(const Evaluation& temperature,
197  const Evaluation& pressure)
198  {
199  Scalar eps = scalarValue(temperature)*1e-8;
200  return (liquidEnthalpy(temperature + eps, pressure) - liquidEnthalpy(temperature, pressure))/eps;
201  }
202 
206  template <class Evaluation>
207  static Evaluation gasHeatCapacity(const Evaluation& temperature,
208  const Evaluation& pressure)
209  { return H2O::gasHeatCapacity(temperature, pressure); }
210 
214  template <class Evaluation>
215  static Evaluation gasInternalEnergy(const Evaluation& temperature,
216  const Evaluation& pressure)
217  {
218  return
219  gasEnthalpy(temperature, pressure) -
220  pressure/gasDensity(temperature, pressure);
221  }
222 
226  template <class Evaluation>
227  static Evaluation liquidInternalEnergy(const Evaluation& temperature,
228  const Evaluation& pressure)
229  {
230  return
231  liquidEnthalpy(temperature, pressure) -
232  pressure/liquidDensity(temperature, pressure);
233  }
234 
238  template <class Evaluation>
239  static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
240  { return H2O::gasDensity(temperature, pressure); }
241 
249  template <class Evaluation>
250  static Evaluation liquidDensity(const Evaluation& temperature, const Evaluation& pressure, bool extrapolate = false)
251  {
252  Evaluation tempC = temperature - 273.15;
253  Evaluation pMPa = pressure/1.0E6;
254 
255  const Evaluation rhow = H2O::liquidDensity(temperature, pressure, extrapolate);
256  return
257  rhow +
258  1000*salinity*(
259  0.668 +
260  0.44*salinity +
261  1.0E-6*(
262  300*pMPa -
263  2400*pMPa*salinity +
264  tempC*(
265  80.0 -
266  3*tempC -
267  3300*salinity -
268  13*pMPa +
269  47*pMPa*salinity)));
270  }
271 
275  template <class Evaluation>
276  static Evaluation gasPressure(const Evaluation& temperature, const Evaluation& density)
277  { return H2O::gasPressure(temperature, density); }
278 
282  template <class Evaluation>
283  static Evaluation liquidPressure(const Evaluation& temperature, const Evaluation& density)
284  {
285  // We use the newton method for this. For the initial value we
286  // assume the pressure to be 10% higher than the vapor
287  // pressure
288  Evaluation pressure = 1.1*vaporPressure(temperature);
289  Scalar eps = scalarValue(pressure)*1e-7;
290 
291  Evaluation deltaP = pressure*2;
292  for (int i = 0;
293  i < 5
294  && std::abs(scalarValue(pressure)*1e-9) < std::abs(scalarValue(deltaP));
295  ++i)
296  {
297  const Evaluation& f = liquidDensity(temperature, pressure) - density;
298 
299  Evaluation df_dp = liquidDensity(temperature, pressure + eps);
300  df_dp -= liquidDensity(temperature, pressure - eps);
301  df_dp /= 2*eps;
302 
303  deltaP = - f/df_dp;
304 
305  pressure += deltaP;
306  }
307 
308  return pressure;
309  }
310 
314  template <class Evaluation>
315  static Evaluation gasViscosity(const Evaluation& temperature, const Evaluation& pressure)
316  { return H2O::gasViscosity(temperature, pressure); }
317 
326  template <class Evaluation>
327  static Evaluation liquidViscosity(const Evaluation& temperature, const Evaluation& /*pressure*/)
328  {
329  Evaluation T_C = temperature - 273.15;
330  if(temperature <= 275.) // regularization
331  T_C = 275.0;
332 
333  Evaluation A = (0.42*std::pow((std::pow(salinity, 0.8)-0.17), 2) + 0.045)*pow(T_C, 0.8);
334  Evaluation mu_brine = 0.1 + 0.333*salinity + (1.65+91.9*salinity*salinity*salinity)*exp(-A);
335 
336  return mu_brine/1000.0; // convert to [Pa s] (todo: check if correct cP->Pa s is times 10...)
337  }
338 };
339 
343 template <class Scalar, class H2O>
344 Scalar Brine<Scalar, H2O>::salinity = 0.1; // also needs to be adapted in CO2 solubility table!
345 
346 } // namespace Opm
347 
348 #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:276
static Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition: Brine.hpp:103
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:215
static Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition: Brine.hpp:116
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:136
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:250
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of steam.
Definition: Brine.hpp:315
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam in at a given pressure and temperature.
Definition: Brine.hpp:239
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:109
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of water steam .
Definition: Brine.hpp:207
static Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &)
The dynamic viscosity of pure water.
Definition: Brine.hpp:327
static Evaluation liquidInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of liquid water .
Definition: Brine.hpp:227
static Evaluation liquidPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of liquid water in at a given density and temperature.
Definition: Brine.hpp:283
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:123
static Scalar salinity
The mass fraction of salt assumed to be in the brine.
Definition: Brine.hpp:49
static Evaluation liquidHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of liquid water .
Definition: Brine.hpp:196
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:692
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:566
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: H2O.hpp:544
static Evaluation gasPressure(const Evaluation &temperature, Scalar density)
The pressure of steam in at a given density and temperature.
Definition: H2O.hpp:648
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition: H2O.hpp:132
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of steam.
Definition: H2O.hpp:796
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of water steam .
Definition: H2O.hpp:274
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of liquid water .
Definition: H2O.hpp:230
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: H2O.hpp:632
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:550
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of water steam .
Definition: H2O.hpp:177
static const Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition: H2O.hpp:110
static const Scalar triplePressure()
Returns the pressure at water's triple point.
Definition: H2O.hpp:116