12#ifndef DUMUX_BINARY_COEFF_BRINE_CO2_HH
13#define DUMUX_BINARY_COEFF_BRINE_CO2_HH
15#include <dune/common/math.hh>
18#include <dune/common/debugstream.hh>
31template<
class Scalar,
class CO2,
bool verbose = true>
35 static constexpr int lPhaseIdx = 0;
36 static constexpr int gPhaseIdx = 1;
48 static const bool hasGasDiffCoeff =
hasParam(
"BinaryCoefficients.GasDiffCoeff");
52 constexpr Scalar PI = 3.141593;
53 constexpr Scalar k = 1.3806504e-23;
54 constexpr Scalar c = 4;
55 constexpr Scalar R_h = 1.72e-10;
61 static const Scalar D = getParam<Scalar>(
"BinaryCoefficients.GasDiffCoeff");
75 static const bool hasLiquidDiffCoeff =
hasParam(
"BinaryCoefficients.LiquidDiffCoeff");
76 if (!hasLiquidDiffCoeff)
80 const Scalar D = getParam<Scalar>(
"BinaryCoefficients.LiquidDiffCoeff");
104 const Scalar salinity,
105 const int knownPhaseIdx,
113 const Scalar x_NaCl = salinityToMoleFrac_(salinity);
117 if (knownPhaseIdx < 0)
119 const Scalar molalityNaCl = molFracToMolality_(x_NaCl);
120 const Scalar m0_CO2 = molalityCO2inPureWater_(
temperature, pg);
121 const Scalar gammaStar = activityCoefficient_(
temperature, pg, molalityNaCl);
122 const Scalar m_CO2 = m0_CO2 / gammaStar;
123 xlCO2 = m_CO2 / (molalityNaCl + 55.508 + m_CO2);
124 ygH2O = A * (1 - xlCO2 - x_NaCl);
130 if (knownPhaseIdx == lPhaseIdx)
131 ygH2O = A * (1 - xlCO2 - x_NaCl);
136 if (knownPhaseIdx == gPhaseIdx)
137 xlCO2 = 1 - x_NaCl - ygH2O / A;
149 const Scalar V = 1 / (CO2::gasDensity(T, pg) / CO2::molarMass()) * 1.e6;
150 const Scalar pg_bar = pg / 1.e5;
151 const Scalar a_CO2 = (7.54e7 - 4.13e4 * T);
152 constexpr Scalar b_CO2 = 27.8;
158 const Scalar 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));
163 return exp(lnPhiCO2);
175 const Scalar V = 1 / (CO2::gasDensity(T, pg) / CO2::molarMass()) * 1.e6;
176 const Scalar pg_bar = pg / 1.e5;
177 const Scalar a_CO2 = (7.54e7 - 4.13e4 * T);
178 constexpr Scalar a_CO2_H2O = 7.89e7;
179 constexpr Scalar b_CO2 = 27.8;
180 constexpr Scalar b_H2O = 18.18;
186 const Scalar lnPhiH2O = log(V / (V - b_CO2)) + b_H2O / (V - b_CO2) - 2 * a_CO2_H2O
187 / (R * pow(T, 1.5) * b_CO2) * log((V + b_CO2) / V) + a_CO2
188 * b_H2O / (R * pow(T, 1.5) * b_CO2 * b_CO2) * (log((V + b_CO2)
189 / V) - b_CO2 / (V + b_CO2)) - log(pg_bar * V / (R * T));
191 return exp(lnPhiH2O);
199 static Scalar salinityToMoleFrac_(Scalar salinity)
202 constexpr Scalar Ms = 58.8e-3;
204 const Scalar X_NaCl = salinity;
206 const Scalar x_NaCl = -Mw * X_NaCl / ((Ms - Mw) * X_NaCl - Ms);
216 static Scalar molFracToMolality_(Scalar x_NaCl)
219 return 55.508 * x_NaCl / (1 - x_NaCl);
229 static Scalar molalityCO2inPureWater_(Scalar
temperature, Scalar pg)
233 const Scalar yH2OinGas = (1 - B) / (1. / A - B);
234 const Scalar xCO2inWater = B * (1 - yH2OinGas);
235 return (xCO2inWater * 55.508) / (1 - xCO2inWater);
247 static Scalar activityCoefficient_(Scalar
temperature, Scalar pg, Scalar molalityNaCl)
249 const Scalar lambda = computeLambda_(
temperature, pg);
251 const Scalar lnGammaStar = 2 * lambda * molalityNaCl + xi * molalityNaCl
254 return exp(lnGammaStar);
265 static Scalar computeA_(Scalar T, Scalar pg)
267 const Scalar deltaP = pg / 1e5 - 1;
268 const Scalar v_av_H2O = 18.1;
270 const Scalar k0_H2O = equilibriumConstantH2O_(T);
272 const Scalar pg_bar = pg / 1.e5;
274 return k0_H2O / (phi_H2O * pg_bar) * exp(deltaP * v_av_H2O / (R * T));
285 static Scalar computeB_(Scalar T, Scalar pg)
287 const Scalar deltaP = pg / 1e5 - 1;
288 constexpr Scalar v_av_CO2 = 32.6;
290 const Scalar k0_CO2 = equilibriumConstantCO2_(T);
292 const Scalar pg_bar = pg / 1.e5;
294 return phi_CO2 * pg_bar / (55.508 * k0_CO2) * exp(-(deltaP
295 * v_av_CO2) / (R * T));
305 static Scalar computeLambda_(Scalar T, Scalar pg)
307 constexpr Scalar c[6] = { -0.411370585, 6.07632013E-4, 97.5347708,
308 -0.0237622469, 0.0170656236, 1.41335834E-5 };
311 const Scalar pg_bar = pg / 1.0E5;
312 return c[0] + c[1] * T + c[2] / T + c[3] * pg_bar / T + c[4] * pg_bar
313 / (630.0 - T) + c[5] * T * log(pg_bar);
323 static Scalar computeXi_(Scalar T, Scalar pg)
325 constexpr Scalar c[4] = { 3.36389723E-4, -1.98298980E-5,
326 2.12220830E-3, -5.24873303E-3 };
328 Scalar pg_bar = pg / 1.0E5;
329 return c[0] + c[1] * T + c[2] * pg_bar / T + c[3] * pg_bar / (630.0 - T);
338 static Scalar equilibriumConstantCO2_(Scalar T)
340 const Scalar TinC = T - 273.15;
341 constexpr Scalar c[3] = { 1.189, 1.304e-2, -5.446e-5 };
342 const Scalar logk0_CO2 = c[0] + c[1] * TinC + c[2] * TinC * TinC;
344 return pow(10, logk0_CO2);
353 static Scalar equilibriumConstantH2O_(Scalar T)
355 const Scalar TinC = T - 273.15;
356 constexpr Scalar c[4] = { -2.209, 3.097e-2, -1.098e-4, 2.048e-7 };
357 const Scalar logk0_H2O = c[0] + c[1] * TinC + c[2] * TinC * TinC + c[3]
358 * TinC * TinC * TinC;
360 return pow(10, logk0_H2O);
370template<
class Scalar,
class CO2Impl,
bool verbose = true>
404 const Scalar Ms = 58.8e-3;
408 const Scalar x_NaCl = -Mw * X_NaCl / ((Ms - Mw) * X_NaCl - Ms);
411 const Scalar mol_NaCl = -55.56 * x_NaCl / (x_NaCl - 1);
416 const Scalar pgCO2 = partialPressureCO2_(
temperature, pg);
417 const Scalar phiCO2 = fugacityCoeffCO2_(
temperature, pgCO2, rhoCO2);
421 const Scalar exponent = A - log(phiCO2) + 2*B*mol_NaCl + C*power(mol_NaCl,2);
424 const Scalar mol_CO2w = pgCO2 / (1e5 * exp(exponent));
426 const Scalar x_CO2w = mol_CO2w / (mol_CO2w + 55.56);
438 static Scalar computeA_(Scalar T, Scalar pg)
440 static const Scalar c[10] = {
453 const Scalar pg_bar = pg / 1.0E5;
454 const Scalar Tr = 630.0 - T;
467 c[9]*pg_bar*pg_bar/(Tr*Tr);
476 static Scalar computeB_(Scalar T, Scalar pg)
478 const Scalar c1 = -0.411370585;
479 const Scalar c2 = 6.07632013E-4;
480 const Scalar c3 = 97.5347708;
481 const Scalar c8 = -0.0237622469;
482 const Scalar c9 = 0.0170656236;
483 const Scalar c11 = 1.41335834E-5;
485 const Scalar pg_bar = pg / 1.0E5;
493 c9*pg_bar/(630.0-T) +
503 static Scalar computeC_(Scalar T, Scalar pg)
505 const Scalar c1 = 3.36389723E-4;
506 const Scalar c2 = -1.98298980E-5;
507 const Scalar c8 = 2.12220830E-3;
508 const Scalar c9 = -5.24873303E-3;
510 const Scalar pg_bar = pg / 1.0E5;
529 static Scalar partialPressureCO2_(Scalar
temperature, Scalar pg)
541 static Scalar fugacityCoeffCO2_(Scalar
temperature,
545 static const Scalar a[15] = {
564 const Scalar Tr =
temperature / CO2::criticalTemperature();
566 const Scalar pr = pg / CO2::criticalPressure();
570 const Scalar Vc =
IdealGas::R*CO2::criticalTemperature()/CO2::criticalPressure();
573 CO2::molarMass() / rhoCO2
579 const Scalar Z = pr * Vr / Tr;
581 const Scalar A = a[0] + a[1] / (Tr * Tr) + a[2] / (Tr * Tr * Tr);
582 const Scalar B = a[3] + a[4] / (Tr * Tr) + a[5] / (Tr * Tr * Tr);
583 const Scalar C = a[6] + a[7] / (Tr * Tr) + a[8] / (Tr * Tr * Tr);
584 const Scalar D = a[9] + a[10] / (Tr * Tr) + a[11] / (Tr * Tr * Tr);
588 const Scalar lnphiCO2 =
596 a[12]/(2*Tr*Tr*Tr*a[14])*
601 )*exp(-a[14]/(Vr*Vr)));
603 return exp(lnphiCO2);
Old version of binary coefficients for CO2 and brine. Calculates molfraction of CO2 in brine accordin...
Definition: brine_co2.hh:372
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:387
Binary coefficients for brine and CO2.
Definition: brine_co2.hh:32
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:72
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:173
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient of water in the CO2 phase.
Definition: brine_co2.hh:46
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:147
A class for the brine fluid properties.
Definition: components/brine.hh:44
static Scalar salinity()
Return the constant salinity.
Definition: components/brine.hh:61
static Scalar vaporPressure(Scalar temperature)
The vapor pressure in of pure brine at a given temperature.
Definition: components/brine.hh:117
Material properties of pure water .
Definition: h2o.hh:49
static constexpr Scalar molarMass()
The molar mass in of water.
Definition: h2o.hh:69
Relations valid for an ideal gas.
Definition: idealgas.hh:25
static constexpr Scalar R
The ideal gas constant .
Definition: idealgas.hh:28
A class for the CO2 fluid properties.
A class for the brine fluid properties,.
bool hasParam(const std::string ¶m)
Check whether a key exists in the parameter tree.
Definition: parameters.hh:157
Material properties of pure water .
Relations valid for an ideal gas.
Definition: air_mesitylene.hh:19
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
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.