3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
components/brine.hh
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program 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 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_BRINE_HH
25#define DUMUX_BRINE_HH
26
27#include <cmath>
28
29#include <dune/common/math.hh>
30
38
39namespace Dumux::Components {
40
50template <class Scalar,
51 class H2O_Tabulated = Components::TabulatedComponent<Components::H2O<Scalar>>>
52class Brine
53: public Components::Base<Scalar, Brine<Scalar, H2O_Tabulated> >
54, public Components::Liquid<Scalar, Brine<Scalar, H2O_Tabulated> >
55, public Components::Gas<Scalar, Brine<Scalar, H2O_Tabulated> >
56{
58public:
60
62 static constexpr Scalar R = Constants<Scalar>::R;
63
67 static std::string name()
68 { return "Brine"; }
69
73 static Scalar salinity()
74 {
75 static const Scalar salinity = getParam<Scalar>("Brine.Salinity");
76 return salinity;
77 }
78
83 static Scalar molarMass()
84 {
85 const Scalar M1 = H2O::molarMass();
86 const Scalar M2 = Components::NaCl<Scalar>::molarMass(); // molar mass of NaCl [kg/mol]
87 return M1*M2/(M2 + ThisType::salinity()*(M1 - M2));
88 };
89
95 static Scalar criticalTemperature()
96 { return H2O::criticalTemperature(); }
97
103 static Scalar criticalPressure()
104 { return H2O::criticalPressure(); }
105
110 static Scalar tripleTemperature()
111 { return H2O::tripleTemperature(); }
112
117 static Scalar triplePressure()
118 { return H2O::triplePressure(); }
119
129 static Scalar vaporPressure(Scalar temperature)
130 {
131 //calculate mole fraction
132 const Scalar M1 = H2O::molarMass();
133 const Scalar M2 = Components::NaCl<Scalar>::molarMass(); // molar mass of NaCl [kg/mol]
134 const Scalar xNaClLiquid = - M1 * ThisType::salinity() / ((M2-M1) * ThisType::salinity() - M2);
135
136 // Raoult's law, see Thomas Fetzer's Dissertation Eq. 2.11.
137 return H2O::vaporPressure(temperature) * (1 - xNaClLiquid);
138 }
139
146 static const Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
148
161 static const Scalar liquidEnthalpy(Scalar T, Scalar p)
162 {
163 /*Numerical coefficients from PALLISER*/
164 static const Scalar f[] = {
165 2.63500E-1, 7.48368E-6, 1.44611E-6, -3.80860E-10
166 };
167
168 /*Numerical coefficients from MICHAELIDES for the enthalpy of brine*/
169 static const Scalar a[4][3] = {
170 { +9633.6, -4080.0, +286.49 },
171 { +166.58, +68.577, -4.6856 },
172 { -0.90963, -0.36524, +0.249667E-1 },
173 { +0.17965E-2, +0.71924E-3, -0.4900E-4 }
174 };
175
176 const Scalar theta = T - 273.15;
177 const Scalar salSat = f[0] + f[1]*theta + f[2]*theta*theta + f[3]*theta*theta*theta;
178
179 /*Regularization*/
180 using std::min;
181 using std::max;
182 const Scalar salinity = min(max(ThisType::salinity(),0.0), salSat);
183
184 const Scalar hw = H2O::liquidEnthalpy(T, p)/1E3; /* kJ/kg */
185
186 /*DAUBERT and DANNER*/
187 /*U=*/const Scalar h_NaCl = (3.6710E4*T + 0.5*(6.2770E1)*T*T - ((6.6670E-2)/3)*T*T*T
188 +((2.8000E-5)/4)*(T*T*T*T))/(58.44E3)- 2.045698e+02; /* kJ/kg */
189
190 const Scalar m = (1E3/58.44)*(salinity/(1-salinity));
191
192 using Dune::power;
193 Scalar d_h = 0;
194 for (int i = 0; i<=3; i++) {
195 for (int j=0; j<=2; j++) {
196 d_h = d_h + a[i][j] * power(theta, i) * power(m, j);
197 }
198 }
199
200 /* heat of dissolution for halite according to Michaelides 1971 */
201 const Scalar delta_h = (4.184/(1E3 + (58.44 * m)))*d_h;
202
203 /* Enthalpy of brine without any dissolved gas */
204 const Scalar h_ls1 =(1-salinity)*hw + salinity*h_NaCl + salinity*delta_h; /* kJ/kg */
205 return h_ls1*1E3; /*J/kg*/
206 }
207
220 static const Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
221 {
222 const Scalar eps = temperature*1e-8;
224 }
225
238 static const Scalar gasHeatCapacity(Scalar temperature,
239 Scalar pressure)
240 {
242 }
243
250 static const Scalar gasInternalEnergy(Scalar temperature,
251 Scalar pressure)
252 {
254 }
255
262 static const Scalar liquidInternalEnergy(Scalar temperature,
263 Scalar pressure)
264 {
266 }
267
274 static Scalar gasDensity(Scalar temperature, Scalar pressure)
276
285 static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
287
291 static constexpr bool gasIsIdeal()
292 { return H2O::gasIsIdeal(); }
293
297 static constexpr bool gasIsCompressible()
298 { return H2O::gasIsCompressible(); }
299
303 static constexpr bool liquidIsCompressible()
304 { return H2O::liquidIsCompressible(); }
305
318 static Scalar liquidDensity(Scalar temperature, Scalar pressure)
319 {
320 using std::max;
321 const Scalar TempC = temperature - 273.15;
322 const Scalar pMPa = pressure/1.0E6;
323 const Scalar salinity = max(0.0, ThisType::salinity());
324
325 const Scalar rhow = H2O::liquidDensity(temperature, pressure);
326
327 const Scalar density = rhow +
328 1000*salinity*(
329 0.668 +
330 0.44*salinity +
331 1.0E-6*(
332 300*pMPa -
333 2400*pMPa*salinity +
334 TempC*(
335 80.0 +
336 3*TempC -
337 3300*salinity -
338 13*pMPa +
339 47*pMPa*salinity)));
340 assert(density > 0.0);
341 return density;
342 }
343
351 static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
353
360 static Scalar gasPressure(Scalar temperature, Scalar density)
362
370 static Scalar liquidPressure(Scalar temperature, Scalar density)
371 {
372 // We use the Newton method for this. For the initial value we
373 // assume the pressure to be 10% higher than the vapor
374 // pressure
375 Scalar pressure = 1.1*vaporPressure(temperature);
376 const Scalar eps = pressure*1e-7;
377
378 Scalar deltaP = pressure*2;
379
380 using std::abs;
381 for (int i = 0; i < 5 && abs(pressure*1e-9) < abs(deltaP); ++i) {
383
384 Scalar df_dp;
385 df_dp = liquidDensity(temperature, pressure + eps);
386 df_dp -= liquidDensity(temperature, pressure - eps);
387 df_dp /= 2*eps;
388
389 deltaP = - f/df_dp;
390
391 pressure += deltaP;
392 }
393 assert(pressure > 0.0);
394 return pressure;
395 }
396
403 static Scalar gasViscosity(Scalar temperature, Scalar pressure)
405
419 static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
420 {
421 // regularisation
422 using std::max;
423 temperature = max(temperature, 275.0);
424 const Scalar salinity = max(0.0, ThisType::salinity());
425
426 using std::pow;
427 using Dune::power;
428 using std::exp;
429 const Scalar T_C = temperature - 273.15;
430 const Scalar A = (0.42*power((pow(salinity, 0.8)-0.17), 2) + 0.045)*pow(T_C, 0.8);
431 const Scalar mu_brine = 0.1 + 0.333*salinity + (1.65+91.9*salinity*salinity*salinity)*exp(-A); //[cP]
432 assert(mu_brine > 0.0);
433 return mu_brine/1000.0; //[Pa s]
434 }
435
443 static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
444 {
445 Scalar tempC = temperature-273.15;
446 Scalar xNaCl = ThisType::salinity() * H2O::molarMass() / (ThisType::salinity() * H2O::molarMass() + (1-ThisType::salinity() )*Components::NaCl<Scalar>::molarMass()); // mole fraction of NaCl
447 Scalar m = xNaCl/(H2O::molarMass()*(1- xNaCl)); // molality of NaCl
448 Scalar S = 5844.3 * m / (1000 + 58.443 *m);
449 Scalar contribNaClFactor = 1.0 - (2.3434e-3 - 7.924e-6*tempC + 3.924e-8*tempC*tempC)*S + (1.06e-5 - 2.0e-8*tempC + 1.2e-10*tempC*tempC)*S*S;
450 return contribNaClFactor * H2O::liquidThermalConductivity(temperature, pressure);
451 }
452};
453
454template <class Scalar, class H2O>
455struct IsAqueous<Brine<Scalar, H2O>> : public std::true_type {};
456
457} // end namespace Dumux::Components
458
459#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Interface for components that have a gas state.
Interface for components that have a liquid state.
Material properties of pure water .
Material properties of pure salt .
Tabulates all thermodynamic properties of a given untabulated chemical species.
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:34
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Definition: air.hh:35
IsAqueous struct.
Definition: components/base.hh:47
Base class for all components Components provide the thermodynamic relations for the liquid,...
Definition: components/base.hh:59
A class for the brine fluid properties.
Definition: components/brine.hh:56
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of pure brine.
Definition: components/brine.hh:419
static const Scalar liquidEnthalpy(Scalar T, Scalar p)
Specific enthalpy of liquid brine .
Definition: components/brine.hh:161
static Scalar molarMass()
The molar mass in of brine. This assumes that the salt is pure NaCl.
Definition: components/brine.hh:83
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of steam in at a given pressure and temperature. We take the value of the H2O gas ...
Definition: components/brine.hh:285
static Scalar tripleTemperature()
Returns the temperature at brine's triple point. Here, it is assumed to be equal to that of pure wat...
Definition: components/brine.hh:110
static Scalar gasPressure(Scalar temperature, Scalar density)
The pressure of steam in at a given density and temperature.
Definition: components/brine.hh:360
static const Scalar liquidInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of liquid brine .
Definition: components/brine.hh:262
static Scalar salinity()
Return the constant salinity.
Definition: components/brine.hh:73
static const Scalar gasHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of water steam .
Definition: components/brine.hh:238
static Scalar criticalPressure()
Returns the critical pressure of brine. Here, it is assumed to be equal to that of pure water....
Definition: components/brine.hh:103
static const Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of gaseous brine . Only water volatile and salt is suppose to stay in the liquid ph...
Definition: components/brine.hh:146
static constexpr Scalar R
The ideal gas constant .
Definition: components/brine.hh:62
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of steam at a given pressure and temperature .
Definition: components/brine.hh:274
static Scalar liquidPressure(Scalar temperature, Scalar density)
The pressure of brine in at a given density and temperature.
Definition: components/brine.hh:370
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
The molar density of brine in at a given pressure and temperature.
Definition: components/brine.hh:351
static Scalar vaporPressure(Scalar temperature)
The vapor pressure in of pure brine at a given temperature.
Definition: components/brine.hh:129
static Scalar triplePressure()
Returns the pressure at brine's triple point. Here, it is assumed to be equal to that of pure water....
Definition: components/brine.hh:117
static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of a brine .
Definition: components/brine.hh:443
static const Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of brine .
Definition: components/brine.hh:220
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of steam.
Definition: components/brine.hh:403
static constexpr bool liquidIsCompressible()
Returns true if the liquid phase is assumed to be compressible.
Definition: components/brine.hh:303
static std::string name()
A human readable name for the brine.
Definition: components/brine.hh:67
static Scalar criticalTemperature()
Returns the critical temperature of brine. Here, it is assumed to be equal to that of pure water....
Definition: components/brine.hh:95
static const Scalar gasInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of steam .
Definition: components/brine.hh:250
static constexpr bool gasIsCompressible()
Returns true if the gas phase is assumed to be compressible.
Definition: components/brine.hh:297
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: components/brine.hh:291
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of pure brine at a given pressure and temperature .
Definition: components/brine.hh:318
Interface for components that have a gas state.
Definition: gas.hh:41
Material properties of pure water .
Definition: h2o.hh:60
Interface for components that have a liquid state.
Definition: liquid.hh:41
A class for the NaCl properties.
Definition: nacl.hh:47
static constexpr Scalar molarMass()
The molar mass of NaCl in .
Definition: nacl.hh:60
Tabulates all thermodynamic properties of a given untabulated chemical species.
Definition: tabulatedcomponent.hh:82
static const Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of the gas .
Definition: tabulatedcomponent.hh:238
static Scalar gasPressure(Scalar temperature, Scalar density)
The pressure of gas in at a given density and temperature.
Definition: tabulatedcomponent.hh:368
static Scalar criticalTemperature()
Returns the critical temperature in of the component.
Definition: tabulatedcomponent.hh:184
static const Scalar gasHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the gas .
Definition: tabulatedcomponent.hh:292
static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
The thermal conductivity of liquid water .
Definition: tabulatedcomponent.hh:619
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of gas at a given pressure and temperature .
Definition: tabulatedcomponent.hh:456
static const Scalar liquidEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of the liquid .
Definition: tabulatedcomponent.hh:265
static Scalar triplePressure()
Returns the pressure in at the component's triple point.
Definition: tabulatedcomponent.hh:202
static Scalar criticalPressure()
Returns the critical pressure in of the component.
Definition: tabulatedcomponent.hh:190
static const Scalar gasInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of the gas .
Definition: tabulatedcomponent.hh:346
static constexpr Scalar molarMass()
The molar mass in of the component.
Definition: tabulatedcomponent.hh:178
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of gas.
Definition: tabulatedcomponent.hh:538
static Scalar tripleTemperature()
Returns the temperature in at the component's triple point.
Definition: tabulatedcomponent.hh:196
static constexpr bool liquidIsCompressible()
Returns true if the liquid phase is assumed to be compressible.
Definition: tabulatedcomponent.hh:439
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of liquid at a given pressure and temperature .
Definition: tabulatedcomponent.hh:495
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of gas in at a given pressure and temperature.
Definition: tabulatedcomponent.hh:485
static Scalar vaporPressure(Scalar T)
The vapor pressure in of the component at a given temperature.
Definition: tabulatedcomponent.hh:211
static constexpr bool gasIsCompressible()
Returns true if the gas phase is assumed to be compressible.
Definition: tabulatedcomponent.hh:433
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: tabulatedcomponent.hh:445
A central place for various physical constants occuring in some equations.
Definition: constants.hh:39
Base class for all components Components provide the thermodynamic relations for the liquid,...