24#ifndef DUMUX_BINARY_COEFF_BRINE_CO2_HH
25#define DUMUX_BINARY_COEFF_BRINE_CO2_HH
27#include <dune/common/math.hh>
41template<
class Scalar,
class CO2Tables,
bool verbose = true>
46 static constexpr int lPhaseIdx = 0;
47 static constexpr int gPhaseIdx = 1;
59 static const bool hasGasDiffCoeff =
hasParam(
"BinaryCoefficients.GasDiffCoeff");
63 constexpr Scalar PI = 3.141593;
64 constexpr Scalar k = 1.3806504e-23;
65 constexpr Scalar c = 4;
66 constexpr Scalar R_h = 1.72e-10;
72 static const Scalar D = getParam<Scalar>(
"BinaryCoefficients.GasDiffCoeff");
86 static const bool hasLiquidDiffCoeff =
hasParam(
"BinaryCoefficients.LiquidDiffCoeff");
87 if (!hasLiquidDiffCoeff)
91 const Scalar D = getParam<Scalar>(
"BinaryCoefficients.LiquidDiffCoeff");
115 const Scalar salinity,
116 const int knownPhaseIdx,
124 const Scalar x_NaCl = salinityToMoleFrac_(salinity);
128 if (knownPhaseIdx < 0)
130 const Scalar molalityNaCl = molFracToMolality_(x_NaCl);
131 const Scalar m0_CO2 = molalityCO2inPureWater_(
temperature, pg);
132 const Scalar gammaStar = activityCoefficient_(
temperature, pg, molalityNaCl);
133 const Scalar m_CO2 = m0_CO2 / gammaStar;
134 xlCO2 = m_CO2 / (molalityNaCl + 55.508 + m_CO2);
135 ygH2O = A * (1 - xlCO2 - x_NaCl);
141 if (knownPhaseIdx == lPhaseIdx)
142 ygH2O = A * (1 - xlCO2 - x_NaCl);
147 if (knownPhaseIdx == gPhaseIdx)
148 xlCO2 = 1 - x_NaCl - ygH2O / A;
161 const Scalar pg_bar = pg / 1.e5;
162 const Scalar a_CO2 = (7.54e7 - 4.13e4 * T);
163 constexpr Scalar b_CO2 = 27.8;
169 const Scalar lnPhiCO2 = log(V / (V - b_CO2)) + b_CO2 / (V - b_CO2) - 2 * a_CO2 / (R
170 * pow(T, 1.5) * b_CO2) * log((V + b_CO2) / V) + a_CO2 * b_CO2
171 / (R * pow(T, 1.5) * b_CO2 * b_CO2) * (log((V + b_CO2) / V)
172 - b_CO2 / (V + b_CO2)) - log(pg_bar * V / (R * T));
174 return exp(lnPhiCO2);
187 const Scalar pg_bar = pg / 1.e5;
188 const Scalar a_CO2 = (7.54e7 - 4.13e4 * T);
189 constexpr Scalar a_CO2_H2O = 7.89e7;
190 constexpr Scalar b_CO2 = 27.8;
191 constexpr Scalar b_H2O = 18.18;
197 const Scalar lnPhiH2O = log(V / (V - b_CO2)) + b_H2O / (V - b_CO2) - 2 * a_CO2_H2O
198 / (R * pow(T, 1.5) * b_CO2) * log((V + b_CO2) / V) + a_CO2
199 * b_H2O / (R * pow(T, 1.5) * b_CO2 * b_CO2) * (log((V + b_CO2)
200 / V) - b_CO2 / (V + b_CO2)) - log(pg_bar * V / (R * T));
202 return exp(lnPhiH2O);
210 static Scalar salinityToMoleFrac_(Scalar salinity)
213 constexpr Scalar Ms = 58.8e-3;
215 const Scalar X_NaCl = salinity;
217 const Scalar x_NaCl = -Mw * X_NaCl / ((Ms - Mw) * X_NaCl - Ms);
227 static Scalar molFracToMolality_(Scalar x_NaCl)
230 return 55.508 * x_NaCl / (1 - x_NaCl);
240 static Scalar molalityCO2inPureWater_(Scalar
temperature, Scalar pg)
244 const Scalar yH2OinGas = (1 - B) / (1. / A - B);
245 const Scalar xCO2inWater = B * (1 - yH2OinGas);
246 return (xCO2inWater * 55.508) / (1 - xCO2inWater);
258 static Scalar activityCoefficient_(Scalar
temperature, Scalar pg, Scalar molalityNaCl)
260 const Scalar lambda = computeLambda_(
temperature, pg);
262 const Scalar lnGammaStar = 2 * lambda * molalityNaCl + xi * molalityNaCl
265 return exp(lnGammaStar);
276 static Scalar computeA_(Scalar T, Scalar pg)
278 const Scalar deltaP = pg / 1e5 - 1;
279 const Scalar v_av_H2O = 18.1;
281 const Scalar k0_H2O = equilibriumConstantH2O_(T);
283 const Scalar pg_bar = pg / 1.e5;
285 return k0_H2O / (phi_H2O * pg_bar) * exp(deltaP * v_av_H2O / (R * T));
296 static Scalar computeB_(Scalar T, Scalar pg)
298 const Scalar deltaP = pg / 1e5 - 1;
299 constexpr Scalar v_av_CO2 = 32.6;
301 const Scalar k0_CO2 = equilibriumConstantCO2_(T);
303 const Scalar pg_bar = pg / 1.e5;
305 return phi_CO2 * pg_bar / (55.508 * k0_CO2) * exp(-(deltaP
306 * v_av_CO2) / (R * T));
316 static Scalar computeLambda_(Scalar T, Scalar pg)
318 constexpr Scalar c[6] = { -0.411370585, 6.07632013E-4, 97.5347708,
319 -0.0237622469, 0.0170656236, 1.41335834E-5 };
322 const Scalar pg_bar = pg / 1.0E5;
323 return c[0] + c[1] * T + c[2] / T + c[3] * pg_bar / T + c[4] * pg_bar
324 / (630.0 - T) + c[5] * T * log(pg_bar);
334 static Scalar computeXi_(Scalar T, Scalar pg)
336 constexpr Scalar c[4] = { 3.36389723E-4, -1.98298980E-5,
337 2.12220830E-3, -5.24873303E-3 };
339 Scalar pg_bar = pg / 1.0E5;
340 return c[0] + c[1] * T + c[2] * pg_bar / T + c[3] * pg_bar / (630.0 - T);
349 static Scalar equilibriumConstantCO2_(Scalar T)
351 const Scalar TinC = T - 273.15;
352 constexpr Scalar c[3] = { 1.189, 1.304e-2, -5.446e-5 };
353 const Scalar logk0_CO2 = c[0] + c[1] * TinC + c[2] * TinC * TinC;
355 return pow(10, logk0_CO2);
364 static Scalar equilibriumConstantH2O_(Scalar T)
366 const Scalar TinC = T - 273.15;
367 constexpr Scalar c[4] = { -2.209, 3.097e-2, -1.098e-4, 2.048e-7 };
368 const Scalar logk0_H2O = c[0] + c[1] * TinC + c[2] * TinC * TinC + c[3]
369 * TinC * TinC * TinC;
371 return pow(10, logk0_H2O);
381template<
class Scalar,
class CO2Tables,
bool verbose = true>
415 const Scalar Ms = 58.8e-3;
419 const Scalar x_NaCl = -Mw * X_NaCl / ((Ms - Mw) * X_NaCl - Ms);
422 const Scalar mol_NaCl = -55.56 * x_NaCl / (x_NaCl - 1);
427 const Scalar pgCO2 = partialPressureCO2_(
temperature, pg);
428 const Scalar phiCO2 = fugacityCoeffCO2_(
temperature, pgCO2, rhoCO2);
432 const Scalar exponent = A - log(phiCO2) + 2*B*mol_NaCl + C*power(mol_NaCl,2);
435 const Scalar mol_CO2w = pgCO2 / (1e5 * exp(exponent));
437 const Scalar x_CO2w = mol_CO2w / (mol_CO2w + 55.56);
449 static Scalar computeA_(Scalar T, Scalar pg)
451 static const Scalar c[10] = {
464 const Scalar pg_bar = pg / 1.0E5;
465 const Scalar Tr = 630.0 - T;
478 c[9]*pg_bar*pg_bar/(Tr*Tr);
487 static Scalar computeB_(Scalar T, Scalar pg)
489 const Scalar c1 = -0.411370585;
490 const Scalar c2 = 6.07632013E-4;
491 const Scalar c3 = 97.5347708;
492 const Scalar c8 = -0.0237622469;
493 const Scalar c9 = 0.0170656236;
494 const Scalar c11 = 1.41335834E-5;
496 const Scalar pg_bar = pg / 1.0E5;
504 c9*pg_bar/(630.0-T) +
514 static Scalar computeC_(Scalar T, Scalar pg)
516 const Scalar c1 = 3.36389723E-4;
517 const Scalar c2 = -1.98298980E-5;
518 const Scalar c8 = 2.12220830E-3;
519 const Scalar c9 = -5.24873303E-3;
521 const Scalar pg_bar = pg / 1.0E5;
540 static Scalar partialPressureCO2_(Scalar
temperature, Scalar pg)
552 static Scalar fugacityCoeffCO2_(Scalar
temperature,
556 static const Scalar a[15] = {
590 const Scalar Z = pr * Vr / Tr;
592 const Scalar A = a[0] + a[1] / (Tr * Tr) + a[2] / (Tr * Tr * Tr);
593 const Scalar B = a[3] + a[4] / (Tr * Tr) + a[5] / (Tr * Tr * Tr);
594 const Scalar C = a[6] + a[7] / (Tr * Tr) + a[8] / (Tr * Tr * Tr);
595 const Scalar D = a[9] + a[10] / (Tr * Tr) + a[11] / (Tr * Tr * Tr);
599 const Scalar lnphiCO2 =
607 a[12]/(2*Tr*Tr*Tr*a[14])*
612 )*exp(-a[14]/(Vr*Vr)));
614 return exp(lnphiCO2);
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 ¶m)
Check whether a key exists in the parameter tree.
Definition: parameters.hh:366
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
Definition: air_mesitylene.hh:31
Binary coefficients for brine and CO2.
Definition: brine_co2.hh:42
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:158
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:184
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:113
static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient of CO2 in the brine phase.
Definition: brine_co2.hh:83
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient of water in the CO2 phase.
Definition: brine_co2.hh:57
Old version of binary coefficients for CO2 and brine. Calculates molfraction of CO2 in brine accordin...
Definition: brine_co2.hh:383
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:398
A class for the brine fluid properties.
Definition: components/brine.hh:56
static Scalar salinity()
Return the constant salinity.
Definition: components/brine.hh:73
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:120
A class for the CO2 fluid properties.
Definition: co2.hh:57
static constexpr Scalar molarMass()
The mass in of one mole of CO2.
Definition: co2.hh:72
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of CO2 at a given pressure and temperature .
Definition: co2.hh:226
static Scalar criticalTemperature()
Returns the critical temperature of CO2.
Definition: co2.hh:78
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of CO2. Equations given in: - Vesovic et al., 1990.
Definition: co2.hh:327
static Scalar criticalPressure()
Returns the critical pressure of CO2.
Definition: co2.hh:84
Material properties of pure water .
Definition: h2o.hh:60
static constexpr Scalar molarMass()
The molar mass in of water.
Definition: h2o.hh:80
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,.