version 3.10-dev
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_BRINE_HH
13#define DUMUX_BRINE_HH
14
15#include <cmath>
16
17#include <dune/common/math.hh>
18
26
27namespace Dumux::Components {
28
38template <class Scalar,
39 class H2O_Tabulated = Components::TabulatedComponent<Components::H2O<Scalar>>>
40class Brine
41: public Components::Base<Scalar, Brine<Scalar, H2O_Tabulated> >
42, public Components::Liquid<Scalar, Brine<Scalar, H2O_Tabulated> >
43, public Components::Gas<Scalar, Brine<Scalar, H2O_Tabulated> >
44{
46public:
48
50 static constexpr Scalar R = Constants<Scalar>::R;
51
55 static std::string name()
56 { return "Brine"; }
57
61 static Scalar salinity()
62 {
63 static const Scalar salinity = getParam<Scalar>("Brine.Salinity");
64 return salinity;
65 }
66
71 static Scalar molarMass()
72 {
73 const Scalar M1 = H2O::molarMass();
74 const Scalar M2 = Components::NaCl<Scalar>::molarMass(); // molar mass of NaCl [kg/mol]
75 return M1*M2/(M2 + ThisType::salinity()*(M1 - M2));
76 };
77
83 static Scalar criticalTemperature()
84 { return H2O::criticalTemperature(); }
85
91 static Scalar criticalPressure()
92 { return H2O::criticalPressure(); }
93
98 static Scalar tripleTemperature()
99 { return H2O::tripleTemperature(); }
100
105 static Scalar triplePressure()
106 { return H2O::triplePressure(); }
107
117 static Scalar vaporPressure(Scalar temperature)
118 {
119 //calculate mole fraction
120 const Scalar M1 = H2O::molarMass();
121 const Scalar M2 = Components::NaCl<Scalar>::molarMass(); // molar mass of NaCl [kg/mol]
122 const Scalar xNaClLiquid = - M1 * ThisType::salinity() / ((M2-M1) * ThisType::salinity() - M2);
123
124 // Raoult's law, see Thomas Fetzer's Dissertation Eq. 2.11.
125 return H2O::vaporPressure(temperature) * (1 - xNaClLiquid);
126 }
127
134 static const Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
136
149 static const Scalar liquidEnthalpy(Scalar T, Scalar p)
150 {
151 /*Numerical coefficients from PALLISER*/
152 static const Scalar f[] = {
153 2.63500E-1, 7.48368E-6, 1.44611E-6, -3.80860E-10
154 };
155
156 /*Numerical coefficients from MICHAELIDES for the enthalpy of brine*/
157 static const 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 Scalar theta = T - 273.15;
165 const Scalar salSat = f[0] + f[1]*theta + f[2]*theta*theta + f[3]*theta*theta*theta;
166
167 /*Regularization*/
168 using std::min;
169 using std::max;
170 const Scalar salinity = min(max(ThisType::salinity(),0.0), salSat);
171
172 const Scalar hw = H2O::liquidEnthalpy(T, p)/1E3; /* kJ/kg */
173
174 /*DAUBERT and DANNER*/
175 /*U=*/const Scalar h_NaCl = (3.6710E4*T + 0.5*(6.2770E1)*T*T - ((6.6670E-2)/3)*T*T*T
176 +((2.8000E-5)/4)*(T*T*T*T))/(58.44E3)- 2.045698e+02; /* kJ/kg */
177
178 const Scalar m = (1E3/58.44)*(salinity/(1-salinity));
179
180 using Dune::power;
181 Scalar d_h = 0;
182 for (int i = 0; i<=3; i++) {
183 for (int j=0; j<=2; j++) {
184 d_h = d_h + a[i][j] * power(theta, i) * power(m, j);
185 }
186 }
187
188 /* heat of dissolution for halite according to Michaelides 1971 */
189 const Scalar delta_h = (4.184/(1E3 + (58.44 * m)))*d_h;
190
191 /* Enthalpy of brine without any dissolved gas */
192 const Scalar h_ls1 =(1-salinity)*hw + salinity*h_NaCl + salinity*delta_h; /* kJ/kg */
193 return h_ls1*1E3; /*J/kg*/
194 }
195
208 static const Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
209 {
210 const Scalar eps = temperature*1e-8;
212 }
213
226 static const Scalar gasHeatCapacity(Scalar temperature,
227 Scalar pressure)
228 {
230 }
231
238 static const Scalar gasInternalEnergy(Scalar temperature,
239 Scalar pressure)
240 {
242 }
243
250 static const Scalar liquidInternalEnergy(Scalar temperature,
251 Scalar pressure)
252 {
254 }
255
262 static Scalar gasDensity(Scalar temperature, Scalar pressure)
264
273 static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
275
279 static constexpr bool gasIsIdeal()
280 { return H2O::gasIsIdeal(); }
281
285 static constexpr bool gasIsCompressible()
286 { return H2O::gasIsCompressible(); }
287
291 static constexpr bool liquidIsCompressible()
292 { return H2O::liquidIsCompressible(); }
293
306 static Scalar liquidDensity(Scalar temperature, Scalar pressure)
307 {
308 using std::max;
309 const Scalar TempC = temperature - 273.15;
310 const Scalar pMPa = pressure/1.0E6;
311 const Scalar salinity = max(0.0, ThisType::salinity());
312
313 const Scalar rhow = H2O::liquidDensity(temperature, pressure);
314
315 const Scalar density = rhow +
316 1000*salinity*(
317 0.668 +
318 0.44*salinity +
319 1.0E-6*(
320 300*pMPa -
321 2400*pMPa*salinity +
322 TempC*(
323 80.0 +
324 3*TempC -
325 3300*salinity -
326 13*pMPa +
327 47*pMPa*salinity)));
328 assert(density > 0.0);
329 return density;
330 }
331
339 static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
341
348 static Scalar gasPressure(Scalar temperature, Scalar density)
350
358 static Scalar liquidPressure(Scalar temperature, Scalar density)
359 {
360 // We use the Newton method for this. For the initial value we
361 // assume the pressure to be 10% higher than the vapor
362 // pressure
363 Scalar pressure = 1.1*vaporPressure(temperature);
364 const Scalar eps = pressure*1e-7;
365
366 Scalar deltaP = pressure*2;
367
368 using std::abs;
369 for (int i = 0; i < 5 && abs(pressure*1e-9) < abs(deltaP); ++i) {
371
372 Scalar df_dp;
373 df_dp = liquidDensity(temperature, pressure + eps);
374 df_dp -= liquidDensity(temperature, pressure - eps);
375 df_dp /= 2*eps;
376
377 deltaP = - f/df_dp;
378
379 pressure += deltaP;
380 }
381 assert(pressure > 0.0);
382 return pressure;
383 }
384
391 static Scalar gasViscosity(Scalar temperature, Scalar pressure)
393
407 static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
408 {
409 // regularisation
410 using std::max;
411 temperature = max(temperature, 275.0);
412 const Scalar salinity = max(0.0, ThisType::salinity());
413
414 using std::pow;
415 using Dune::power;
416 using std::exp;
417 const Scalar T_C = temperature - 273.15;
418 const Scalar A = (0.42*power((pow(salinity, 0.8)-0.17), 2) + 0.045)*pow(T_C, 0.8);
419 const Scalar mu_brine = 0.1 + 0.333*salinity + (1.65+91.9*salinity*salinity*salinity)*exp(-A); //[cP]
420 assert(mu_brine > 0.0);
421 return mu_brine/1000.0; //[Pa s]
422 }
423
431 static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
432 {
433 Scalar tempC = temperature-273.15;
434 Scalar xNaCl = ThisType::salinity() * H2O::molarMass() / (ThisType::salinity() * H2O::molarMass() + (1-ThisType::salinity() )*Components::NaCl<Scalar>::molarMass()); // mole fraction of NaCl
435 Scalar m = xNaCl/(H2O::molarMass()*(1- xNaCl)); // molality of NaCl
436 Scalar S = 5844.3 * m / (1000 + 58.443 *m);
437 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;
438 return contribNaClFactor * H2O::liquidThermalConductivity(temperature, pressure);
439 }
440};
441
442template <class Scalar, class H2O>
443struct IsAqueous<Brine<Scalar, H2O>> : public std::true_type {};
444
445} // end namespace Dumux::Components
446
447#endif
Base class for all components Components provide the thermodynamic relations for the liquid,...
Definition: components/base.hh:47
A class for the brine fluid properties.
Definition: components/brine.hh:44
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of pure brine.
Definition: components/brine.hh:407
static const Scalar liquidEnthalpy(Scalar T, Scalar p)
Specific enthalpy of liquid brine .
Definition: components/brine.hh:149
static Scalar molarMass()
The molar mass in of brine. This assumes that the salt is pure NaCl.
Definition: components/brine.hh:71
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:273
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:98
static Scalar gasPressure(Scalar temperature, Scalar density)
The pressure of steam in at a given density and temperature.
Definition: components/brine.hh:348
static const Scalar liquidInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of liquid brine .
Definition: components/brine.hh:250
static Scalar salinity()
Return the constant salinity.
Definition: components/brine.hh:61
static const Scalar gasHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of water steam .
Definition: components/brine.hh:226
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:91
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:134
static constexpr Scalar R
The ideal gas constant .
Definition: components/brine.hh:50
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of steam at a given pressure and temperature .
Definition: components/brine.hh:262
static Scalar liquidPressure(Scalar temperature, Scalar density)
The pressure of brine in at a given density and temperature.
Definition: components/brine.hh:358
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
The molar density of brine in at a given pressure and temperature.
Definition: components/brine.hh:339
static Scalar vaporPressure(Scalar temperature)
The vapor pressure in of pure brine at a given temperature.
Definition: components/brine.hh:117
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:105
static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of a brine .
Definition: components/brine.hh:431
static const Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of brine .
Definition: components/brine.hh:208
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of steam.
Definition: components/brine.hh:391
static constexpr bool liquidIsCompressible()
Returns true if the liquid phase is assumed to be compressible.
Definition: components/brine.hh:291
static std::string name()
A human readable name for the brine.
Definition: components/brine.hh:55
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:83
static const Scalar gasInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of steam .
Definition: components/brine.hh:238
static constexpr bool gasIsCompressible()
Returns true if the gas phase is assumed to be compressible.
Definition: components/brine.hh:285
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: components/brine.hh:279
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of pure brine at a given pressure and temperature .
Definition: components/brine.hh:306
Interface for components that have a gas state.
Definition: gas.hh:29
Material properties of pure water .
Definition: h2o.hh:49
Interface for components that have a liquid state.
Definition: liquid.hh:29
A class for the NaCl properties.
Definition: nacl.hh:35
static constexpr Scalar molarMass()
The molar mass of NaCl in .
Definition: nacl.hh:48
Tabulates all thermodynamic properties of a given component.
Definition: tabulatedcomponent.hh:672
static const Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of the gas .
Definition: tabulatedcomponent.hh:817
static Scalar gasPressure(Scalar temperature, Scalar density)
The pressure of gas in at a given density and temperature.
Definition: tabulatedcomponent.hh:911
static Scalar criticalTemperature()
Returns the critical temperature in of the component.
Definition: tabulatedcomponent.hh:763
static const Scalar gasHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the gas .
Definition: tabulatedcomponent.hh:853
static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
The thermal conductivity of liquid water .
Definition: tabulatedcomponent.hh:1081
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of gas at a given pressure and temperature .
Definition: tabulatedcomponent.hh:967
static const Scalar liquidEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of the liquid .
Definition: tabulatedcomponent.hh:835
static Scalar triplePressure()
Returns the pressure in at the component's triple point.
Definition: tabulatedcomponent.hh:781
static Scalar criticalPressure()
Returns the critical pressure in of the component.
Definition: tabulatedcomponent.hh:769
static const Scalar gasInternalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy of the gas .
Definition: tabulatedcomponent.hh:889
static constexpr Scalar molarMass()
The molar mass in of the component.
Definition: tabulatedcomponent.hh:757
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of gas.
Definition: tabulatedcomponent.hh:1027
static Scalar tripleTemperature()
Returns the temperature in at the component's triple point.
Definition: tabulatedcomponent.hh:775
static constexpr bool liquidIsCompressible()
Returns true if the liquid phase is assumed to be compressible.
Definition: tabulatedcomponent.hh:950
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of liquid at a given pressure and temperature .
Definition: tabulatedcomponent.hh:997
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of gas in at a given pressure and temperature.
Definition: tabulatedcomponent.hh:987
static Scalar vaporPressure(Scalar T)
The vapor pressure in of the component at a given temperature.
Definition: tabulatedcomponent.hh:790
static constexpr bool gasIsCompressible()
Returns true if the gas phase is assumed to be compressible.
Definition: tabulatedcomponent.hh:944
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: tabulatedcomponent.hh:956
A central place for various physical constants occurring in some equations.
Definition: constants.hh:27
Base class for all components Components provide the thermodynamic relations for the liquid,...
Interface for components that have a gas state.
Material properties of pure water .
Interface for components that have a liquid state.
Material properties of pure salt .
Definition: air.hh:23
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:39
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:22
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
IsAqueous struct.
Definition: components/base.hh:35
Tabulates all thermodynamic properties of a given untabulated chemical species.