3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
brine_co2.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_BINARY_COEFF_BRINE_CO2_HH
25#define DUMUX_BINARY_COEFF_BRINE_CO2_HH
26
32
33namespace Dumux {
34namespace BinaryCoeff {
39template<class Scalar, class CO2Tables, bool verbose = true>
40class Brine_CO2 {
44 static const int lPhaseIdx = 0; // index of the liquid phase
45 static const int gPhaseIdx = 1; // index of the gas phase
46
47public:
55 static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
56 {
57 if(!hasParam("BinaryCoefficients.GasDiffCoeff")) //in case one might set that user-specific as e.g. in dumux-lecture/mm/convectivemixing
58 {
59 //Diffusion coefficient of water in the CO2 phase
60 Scalar const PI=3.141593;
61 Scalar const k = 1.3806504e-23; // Boltzmann constant
62 Scalar const c = 4; // slip parameter, can vary between 4 (slip condition) and 6 (stick condition)
63 Scalar const R_h = 1.72e-10; // hydrodynamic radius of the solute
64 Scalar mu = CO2::gasViscosity(temperature, pressure); // CO2 viscosity
65 Scalar D = k / (c * PI * R_h) * (temperature / mu);
66 return D;
67 } else return getParam<Scalar>("BinaryCoefficients.GasDiffCoeff");
68 }
69
76 static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
77 {
78 //Diffusion coefficient of CO2 in the brine phase
79 if(!hasParam("BinaryCoefficients.LiquidDiffCoeff")) //in case one might set that user-specific as e.g. in dumux-lecture/mm/convectivemixing
80 {
81 return 2e-9;
82 } else return getParam<Scalar>("BinaryCoefficients.LiquidDiffCoeff");
83 }
84
102 static void calculateMoleFractions(const Scalar temperature,
103 const Scalar pg,
104 const Scalar salinity,
105 const int knownPhaseIdx,
106 Scalar &xlCO2,
107 Scalar &ygH2O) {
108
109 Scalar A = computeA_(temperature, pg);
110
111 /* salinity: conversion from mass fraction to mol fraction */
112 const Scalar x_NaCl = salinityToMoleFrac_(salinity);
113
114 // if both phases are present the mole fractions in each phase can be calculate
115 // with the mutual solubility function
116 if (knownPhaseIdx < 0)
117 {
118 Scalar molalityNaCl = molFracToMolality_(x_NaCl); // molality of NaCl //CHANGED
119 Scalar m0_CO2 = molalityCO2inPureWater_(temperature, pg); // molality of CO2 in pure water
120 Scalar gammaStar = activityCoefficient_(temperature, pg, molalityNaCl);// activity coefficient of CO2 in brine
121 Scalar m_CO2 = m0_CO2 / gammaStar; // molality of CO2 in brine
122 xlCO2 = m_CO2 / (molalityNaCl + 55.508 + m_CO2); // mole fraction of CO2 in brine
123 ygH2O = A * (1 - xlCO2 - x_NaCl); // mole fraction of water in the gas phase
124 }
125
126 // if only liquid phase is present the mole fraction of CO2 in brine is given and
127 // and the virtual equilibrium mole fraction of water in the non-existing gas phase can be estimated
128 // with the mutual solubility function
129 if (knownPhaseIdx == lPhaseIdx)
130 ygH2O = A * (1 - xlCO2 - x_NaCl);
131
132 // if only gas phase is present the mole fraction of water in the gas phase is given and
133 // and the virtual equilibrium mole fraction of CO2 in the non-existing liquid phase can be estimated
134 // with the mutual solubility function
135 if (knownPhaseIdx == gPhaseIdx)
136 xlCO2 = 1 - x_NaCl - ygH2O / A;
137 }
138
146 static Scalar fugacityCoefficientCO2(Scalar T, Scalar pg)
147 {
148 Scalar V = 1 / (CO2::gasDensity(T, pg) / CO2::molarMass()) * 1.e6; // molar volume in cm^3/mol
149 Scalar pg_bar = pg / 1.e5; // gas phase pressure in bar
150 Scalar a_CO2 = (7.54e7 - 4.13e4 * T); // mixture parameter of Redlich-Kwong equation
151 static const Scalar b_CO2 = 27.8; // mixture parameter of Redlich-Kwong equation
152 static const Scalar R = IdealGas::R * 10.; // ideal gas constant with unit bar cm^3 /(K mol)
153 Scalar lnPhiCO2, phiCO2;
154
155 using std::log;
156 using std::exp;
157 using std::pow;
158 lnPhiCO2 = log(V / (V - b_CO2)) + b_CO2 / (V - b_CO2) - 2 * a_CO2 / (R
159 * pow(T, 1.5) * b_CO2) * log((V + b_CO2) / V) + a_CO2 * b_CO2
160 / (R * pow(T, 1.5) * b_CO2 * b_CO2) * (log((V + b_CO2) / V)
161 - b_CO2 / (V + b_CO2)) - log(pg_bar * V / (R * T));
162
163 phiCO2 = exp(lnPhiCO2); // fugacity coefficient of CO2
164 return phiCO2;
165 }
166
174 static Scalar fugacityCoefficientH2O(Scalar T, Scalar pg)
175 {
176 Scalar V = 1 / (CO2::gasDensity(T, pg) / CO2::molarMass()) * 1.e6; // molar volume in cm^3/mol
177 Scalar pg_bar = pg / 1.e5; // gas phase pressure in bar
178 Scalar a_CO2 = (7.54e7 - 4.13e4 * T);// mixture parameter of Redlich-Kwong equation
179 static const Scalar a_CO2_H2O = 7.89e7;// mixture parameter of Redlich-Kwong equation
180 static const Scalar b_CO2 = 27.8;// mixture parameter of Redlich-Kwong equation
181 static const Scalar b_H2O = 18.18;// mixture parameter of Redlich-Kwong equation
182 static const Scalar R = IdealGas::R * 10.; // ideal gas constant with unit bar cm^3 /(K mol)
183 Scalar lnPhiH2O, phiH2O;
184
185 using std::log;
186 using std::pow;
187 using std::exp;
188 lnPhiH2O = log(V / (V - b_CO2)) + b_H2O / (V - b_CO2) - 2 * a_CO2_H2O
189 / (R * pow(T, 1.5) * b_CO2) * log((V + b_CO2) / V) + a_CO2
190 * b_H2O / (R * pow(T, 1.5) * b_CO2 * b_CO2) * (log((V + b_CO2)
191 / V) - b_CO2 / (V + b_CO2)) - log(pg_bar * V / (R * T));
192
193 phiH2O = exp(lnPhiH2O); // fugacity coefficient of H2O
194 return phiH2O;
195 }
196
197private:
202 static Scalar salinityToMoleFrac_(Scalar salinity)
203 {
204 const Scalar Mw = H2O::molarMass(); // molecular weight of water [kg/mol]
205 const Scalar Ms = 58.8e-3; // molecular weight of NaCl [kg/mol]
206
207 const Scalar X_NaCl = salinity;
208 // salinity: conversion from mass fraction to mol fraction
209 const Scalar x_NaCl = -Mw * X_NaCl / ((Ms - Mw) * X_NaCl - Ms);
210 return x_NaCl;
211 }
212
219 static Scalar molFracToMolality_(Scalar x_NaCl)
220 {
221 // conversion from mol fraction to molality (dissolved CO2 neglected)
222 const Scalar mol_NaCl = 55.508 * x_NaCl / (1 - x_NaCl);
223 return mol_NaCl;
224 }
225
233 static Scalar molalityCO2inPureWater_(Scalar temperature, Scalar pg)
234 {
235 Scalar A = computeA_(temperature, pg); // according to Spycher, Pruess and Ennis-King (2003)
236 Scalar B = computeB_(temperature, pg); // according to Spycher, Pruess and Ennis-King (2003)
237 Scalar yH2OinGas = (1 - B) / (1. / A - B); // equilibrium mol fraction of H2O in the gas phase
238 Scalar xCO2inWater = B * (1 - yH2OinGas); // equilibrium mol fraction of CO2 in the water phase
239 Scalar molalityCO2 = (xCO2inWater * 55.508) / (1 - xCO2inWater); // CO2 molality
240 return molalityCO2;
241 }
242
252 static Scalar activityCoefficient_(Scalar temperature, Scalar pg, Scalar molalityNaCl)
253 {
254 Scalar lambda = computeLambda_(temperature, pg); // lambda_{CO2-Na+}
255 Scalar xi = computeXi_(temperature, pg); // Xi_{CO2-Na+-Cl-}
256 Scalar lnGammaStar = 2 * lambda * molalityNaCl + xi * molalityNaCl
257 * molalityNaCl;
258 using std::exp;
259 Scalar gammaStar = exp(lnGammaStar);
260 return gammaStar; // molal activity coefficient of CO2 in brine
261 }
262
271 static Scalar computeA_(Scalar T, Scalar pg)
272 {
273 Scalar deltaP = pg / 1e5 - 1; // pressure range [bar] from p0 = 1bar to pg[bar]
274 const Scalar v_av_H2O = 18.1; // average partial molar volume of H2O [cm^3/mol]
275 const Scalar R = IdealGas::R * 10;
276 Scalar k0_H2O = equilibriumConstantH2O_(T); // equilibrium constant for H2O at 1 bar
277 Scalar phi_H2O = fugacityCoefficientH2O(T, pg); // fugacity coefficient of H2O for the water-CO2 system
278 Scalar pg_bar = pg / 1.e5;
279 using std::exp;
280 Scalar A = k0_H2O / (phi_H2O * pg_bar) * exp(deltaP * v_av_H2O / (R * T));
281 return A;
282 }
283
292 static Scalar computeB_(Scalar T, Scalar pg)
293 {
294 Scalar deltaP = pg / 1e5 - 1; // pressure range [bar] from p0 = 1bar to pg[bar]
295 const Scalar v_av_CO2 = 32.6; // average partial molar volume of CO2 [cm^3/mol]
296 const Scalar R = IdealGas::R * 10;
297 Scalar k0_CO2 = equilibriumConstantCO2_(T); // equilibrium constant for CO2 at 1 bar
298 Scalar phi_CO2 = fugacityCoefficientCO2(T, pg); // fugacity coefficient of CO2 for the water-CO2 system
299 Scalar pg_bar = pg / 1.e5;
300 using std::exp;
301 Scalar B = phi_CO2 * pg_bar / (55.508 * k0_CO2) * exp(-(deltaP
302 * v_av_CO2) / (R * T));
303 return B;
304 }
305
313 static Scalar computeLambda_(Scalar T, Scalar pg)
314 {
315 Scalar lambda;
316 static const Scalar c[6] = { -0.411370585, 6.07632013E-4, 97.5347708,
317 -0.0237622469, 0.0170656236, 1.41335834E-5 };
318
319 using std::log;
320 Scalar pg_bar = pg / 1.0E5; /* conversion from Pa to bar */
321 lambda = c[0] + c[1] * T + c[2] / T + c[3] * pg_bar / T + c[4] * pg_bar
322 / (630.0 - T) + c[5] * T * log(pg_bar);
323
324 return lambda;
325 }
326
334 static Scalar computeXi_(Scalar T, Scalar pg)
335 {
336 Scalar xi;
337 static const Scalar c[4] = { 3.36389723E-4, -1.98298980E-5,
338 2.12220830E-3, -5.24873303E-3 };
339
340 Scalar pg_bar = pg / 1.0E5; /* conversion from Pa to bar */
341 xi = c[0] + c[1] * T + c[2] * pg_bar / T + c[3] * pg_bar / (630.0 - T);
342
343 return xi;
344 }
345
352 static Scalar equilibriumConstantCO2_(Scalar T)
353 {
354 Scalar TinC = T - 273.15; //temperature in °C
355 static const Scalar c[3] = { 1.189, 1.304e-2, -5.446e-5 };
356 Scalar logk0_CO2 = c[0] + c[1] * TinC + c[2] * TinC * TinC;
357 using std::pow;
358 Scalar k0_CO2 = pow(10, logk0_CO2);
359 return k0_CO2;
360 }
361
368 static Scalar equilibriumConstantH2O_(Scalar T)
369 {
370 Scalar TinC = T - 273.15; //temperature in °C
371 static const Scalar c[4] = { -2.209, 3.097e-2, -1.098e-4, 2.048e-7 };
372 Scalar logk0_H2O = c[0] + c[1] * TinC + c[2] * TinC * TinC + c[3]
373 * TinC * TinC * TinC;
374 using std::pow;
375 Scalar k0_H2O = pow(10, logk0_H2O);
376 return k0_H2O;
377 }
378};
379
386template<class Scalar, class CO2Tables, bool verbose = true>
388{
393
394public:
403 static Scalar moleFracCO2InBrine(Scalar temperature, Scalar pg, Scalar rhoCO2)
404 {
405 // regularisations:
406 if (pg > 2.5e8) {
407 pg = 2.5e8;
408 }
409 if (pg < 2.e5) {
410 pg = 2.e5;
411 }
412 if (temperature < 275.) {
413 temperature = 275;
414 }
415 if (temperature > 600.) {
416 temperature = 600;
417 }
418
419 const Scalar Mw = H2O::molarMass(); /* molecular weight of water [kg/mol] */
420 const Scalar Ms = 58.8e-3; /* molecular weight of NaCl [kg/mol] */
421
422 const Scalar X_NaCl = Brine::salinity();
423 /* salinity: conversion from mass fraction to mole fraction */
424 const Scalar x_NaCl = -Mw * X_NaCl / ((Ms - Mw) * X_NaCl - Ms);
425
426 // salinity: conversion from mole fraction to molality
427 const Scalar mol_NaCl = -55.56 * x_NaCl / (x_NaCl - 1);
428
429 const Scalar A = computeA_(temperature, pg); /* mu_{CO2}^{l(0)}/RT */
430 const Scalar B = computeB_(temperature, pg); /* lambda_{CO2-Na+} */
431 const Scalar C = computeC_(temperature, pg); /* Xi_{CO2-Na+-Cl-} */
432 const Scalar pgCO2 = partialPressureCO2_(temperature, pg);
433 const Scalar phiCO2 = fugacityCoeffCO2_(temperature, pgCO2, rhoCO2);
434
435 using std::log;
436 using std::pow;
437 const Scalar exponent = A - log(phiCO2) + 2*B*mol_NaCl + C*pow(mol_NaCl,2);
438
439 using std::exp;
440 const Scalar mol_CO2w = pgCO2 / (1e5 * exp(exponent)); /* paper: equation (6) */
441
442 const Scalar x_CO2w = mol_CO2w / (mol_CO2w + 55.56); /* conversion: molality to mole fraction */
443 //Scalar X_CO2w = x_CO2w*MCO2/(x_CO2w*MCO2 + (1-x_CO2w)*Mw); /* conversion: mole fraction to mass fraction */
444
445 return x_CO2w;
446 }
447
448private:
454 static Scalar computeA_(Scalar T, Scalar pg)
455 {
456 static const Scalar c[10] = {
457 28.9447706,
458 -0.0354581768,
459 -4770.67077,
460 1.02782768E-5,
461 33.8126098,
462 9.04037140E-3,
463 -1.14934031E-3,
464 -0.307405726,
465 -0.0907301486,
466 9.32713393E-4,
467 };
468
469 const Scalar pg_bar = pg / 1.0E5; /* conversion from Pa to bar */
470 const Scalar Tr = 630.0 - T;
471
472 using std::log;
473 return
474 c[0] +
475 c[1]*T +
476 c[2]/T +
477 c[3]*T*T +
478 c[4]/Tr +
479 c[5]*pg_bar +
480 c[6]*pg_bar*log(T) +
481 c[7]*pg_bar/T +
482 c[8]*pg_bar/Tr +
483 c[9]*pg_bar*pg_bar/(Tr*Tr);
484 }
485
492 static Scalar computeB_(Scalar T, Scalar pg)
493 {
494 const Scalar c1 = -0.411370585;
495 const Scalar c2 = 6.07632013E-4;
496 const Scalar c3 = 97.5347708;
497 const Scalar c8 = -0.0237622469;
498 const Scalar c9 = 0.0170656236;
499 const Scalar c11 = 1.41335834E-5;
500
501 const Scalar pg_bar = pg / 1.0E5; /* conversion from Pa to bar */
502
503 using std::log;
504 return
505 c1 +
506 c2*T +
507 c3/T +
508 c8*pg_bar/T +
509 c9*pg_bar/(630.0-T) +
510 c11*T*log(pg_bar);
511 }
512
519 static Scalar computeC_(Scalar T, Scalar pg)
520 {
521 const Scalar c1 = 3.36389723E-4;
522 const Scalar c2 = -1.98298980E-5;
523 const Scalar c8 = 2.12220830E-3;
524 const Scalar c9 = -5.24873303E-3;
525
526 const Scalar pg_bar = pg / 1.0E5; /* conversion from Pa to bar */
527
528 return
529 c1 +
530 c2*T +
531 c8*pg_bar/T +
532 c9*pg_bar/(630.0-T);
533 }
534
545 static Scalar partialPressureCO2_(Scalar temperature, Scalar pg)
546 {
548 }
549
557 static Scalar fugacityCoeffCO2_(Scalar temperature,
558 Scalar pg,
559 Scalar rhoCO2)
560 {
561 static const Scalar a[15] = {
562 8.99288497E-2,
563 -4.94783127E-1,
564 4.77922245E-2,
565 1.03808883E-2,
566 -2.82516861E-2,
567 9.49887563E-2,
568 5.20600880E-4,
569 -2.93540971E-4,
570 -1.77265112E-3,
571 -2.51101973E-5,
572 8.93353441E-5,
573 7.88998563E-5,
574 -1.66727022E-2,
575 1.3980,
576 2.96000000E-2
577 };
578
579 // reduced temperature
580 const Scalar Tr = temperature / CO2::criticalTemperature();
581 // reduced pressure
582 const Scalar pr = pg / CO2::criticalPressure();
583
584 // reduced molar volume. ATTENTION: Vc is _NOT_ the critical
585 // molar volume of CO2. See the reference!
587 const Scalar Vr =
588 // molar volume of CO2 at (temperature, pg)
589 CO2::molarMass() / rhoCO2
590 *
591 // "pseudo-critical" molar volume
592 1.0 / Vc;
593
594 // the Z coefficient
595 const Scalar Z = pr * Vr / Tr;
596
597 const Scalar A = a[0] + a[1] / (Tr * Tr) + a[2] / (Tr * Tr * Tr);
598 const Scalar B = a[3] + a[4] / (Tr * Tr) + a[5] / (Tr * Tr * Tr);
599 const Scalar C = a[6] + a[7] / (Tr * Tr) + a[8] / (Tr * Tr * Tr);
600 const Scalar D = a[9] + a[10] / (Tr * Tr) + a[11] / (Tr * Tr * Tr);
601
602 using std::log;
603 using std::exp;
604 const Scalar lnphiCO2 =
605 Z - 1 -
606 log(Z) +
607 A/Vr +
608 B/(2*Vr*Vr) +
609 C/(4*Vr*Vr*Vr*Vr) +
610 D/(5*Vr*Vr*Vr*Vr*Vr)
611 +
612 a[12]/(2*Tr*Tr*Tr*a[14])*
613 (
614 a[13] + 1 -
615 ( a[13] + 1 +
616 a[14]/(Vr*Vr)
617 )*exp(-a[14]/(Vr*Vr)));
618
619 return exp(lnphiCO2);
620 }
621
622};
623} // end namespace BinaryCoeff
624} // end namespace Dumux
625
626#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
A class for the CO2 fluid properties.
Material properties of pure water .
Relations valid for an ideal gas.
bool hasParam(const std::string &param)
Check whether a key exists in the parameter tree.
Definition: parameters.hh:383
Definition: adapt.hh:29
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
Binary coefficients for brine and CO2.
Definition: brine_co2.hh:40
static Scalar fugacityCoefficientCO2(Scalar T, Scalar pg)
Returns the fugacity coefficient of the CO2 component in a water-CO2 mixture (given in Spycher,...
Definition: brine_co2.hh:146
static Scalar fugacityCoefficientH2O(Scalar T, Scalar pg)
Returns the fugacity coefficient of the H2O component in a water-CO2 mixture (given in Spycher,...
Definition: brine_co2.hh:174
static void calculateMoleFractions(const Scalar temperature, const Scalar pg, const Scalar salinity, const int knownPhaseIdx, Scalar &xlCO2, Scalar &ygH2O)
Returns the mol (!) fraction of CO2 in the liquid phase and the mol (!) fraction of H2O in the gas ph...
Definition: brine_co2.hh:102
static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient of CO2 in the brine phase.
Definition: brine_co2.hh:76
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient of water in the CO2 phase.
Definition: brine_co2.hh:55
Old version of binary coefficients for CO2 and brine. Calculates molfraction of CO2 in brine accordin...
Definition: brine_co2.hh:388
static Scalar moleFracCO2InBrine(Scalar temperature, Scalar pg, Scalar rhoCO2)
Returns the mole (!) fraction of CO2 in the liquid phase at a given temperature, pressure and density...
Definition: brine_co2.hh:403
A class for the brine fluid properties.
Definition: components/brine.hh:57
static Scalar salinity()
Return the constant salinity.
Definition: components/brine.hh:74
static Scalar vaporPressure(Scalar temperature)
The vapor pressure in of pure brine at a given temperature. Here, it is assumed to be equal to that ...
Definition: components/brine.hh:121
A class for the CO2 fluid properties.
Definition: co2.hh:56
static constexpr Scalar molarMass()
The mass in of one mole of CO2.
Definition: co2.hh:71
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of CO2 at a given pressure and temperature .
Definition: co2.hh:225
static Scalar criticalTemperature()
Returns the critical temperature of CO2.
Definition: co2.hh:77
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of CO2. Equations given in: - Vesovic et al., 1990.
Definition: co2.hh:326
static Scalar criticalPressure()
Returns the critical pressure of CO2.
Definition: co2.hh:83
Material properties of pure water .
Definition: h2o.hh:61
static constexpr Scalar molarMass()
The molar mass in of water.
Definition: h2o.hh:81
Relations valid for an ideal gas.
Definition: idealgas.hh:37
static constexpr Scalar R
The ideal gas constant .
Definition: idealgas.hh:40
A class for the brine fluid properties,.