28 #ifndef OPM_BINARY_COEFF_BRINE_CO2_HPP
29 #define OPM_BINARY_COEFF_BRINE_CO2_HPP
35 namespace BinaryCoeff {
41 template<
class Scalar,
class H2O,
class CO2,
bool verbose = true>
43 typedef ::Opm::IdealGas<Scalar>
IdealGas;
44 static const int liquidPhaseIdx = 0;
45 static const int gasPhaseIdx = 1;
55 template <
class Evaluation>
56 static Evaluation
gasDiffCoeff(
const Evaluation& temperature,
const Evaluation& pressure,
bool extrapolate =
false)
59 Scalar k = 1.3806504e-23;
61 Scalar R_h = 1.72e-10;
63 return k / (c * M_PI * R_h) * (temperature / mu);
72 template <
class Evaluation>
96 template <
class Evaluation>
100 const int knownPhaseIdx,
103 bool extrapolate =
false)
105 Evaluation A = computeA_(temperature, pg, extrapolate);
108 Scalar x_NaCl = salinityToMolFrac_(salinity);
112 if (knownPhaseIdx < 0) {
113 Scalar molalityNaCl = moleFracToMolality_(x_NaCl);
114 Evaluation m0_CO2 = molalityCO2inPureWater_(temperature, pg, extrapolate);
115 Evaluation gammaStar = activityCoefficient_(temperature, pg, molalityNaCl);
116 Evaluation m_CO2 = m0_CO2 / gammaStar;
117 xlCO2 = m_CO2 / (molalityNaCl + 55.508 + m_CO2);
118 ygH2O = A * (1 - xlCO2 - x_NaCl);
124 if (knownPhaseIdx == liquidPhaseIdx)
125 ygH2O = A * (1 - xlCO2 - x_NaCl);
130 if (knownPhaseIdx == gasPhaseIdx)
132 xlCO2 = 1 - x_NaCl - ygH2O / A;
138 template <
class Evaluation>
139 static Evaluation
henry(
const Evaluation& temperature,
bool extrapolate =
false)
150 template <
class Evaluation>
153 Valgrind::CheckDefined(temperature);
154 Valgrind::CheckDefined(pg);
157 Evaluation pg_bar = pg / 1.e5;
158 Evaluation a_CO2 = (7.54e7 - 4.13e4 * temperature);
163 lnPhiCO2 = log(V / (V - b_CO2));
164 lnPhiCO2 += b_CO2 / (V - b_CO2);
165 lnPhiCO2 -= 2 * a_CO2 / (R * pow(temperature, 1.5) * b_CO2) * log((V + b_CO2) / V);
169 * pow(temperature, 1.5)
172 * (log((V + b_CO2) / V)
173 - b_CO2 / (V + b_CO2));
174 lnPhiCO2 -= log(pg_bar * V / (R * temperature));
176 return exp(lnPhiCO2);
187 template <
class Evaluation>
191 const Evaluation& pg_bar = pg / 1.e5;
192 const Evaluation& a_CO2 = (7.54e7 - 4.13e4 * temperature);
193 Scalar a_CO2_H2O = 7.89e7;
195 Scalar b_H2O = 18.18;
201 + b_H2O/(V - b_CO2) - 2*a_CO2_H2O
202 / (R*pow(temperature, 1.5)*b_CO2)*log((V + b_CO2)/V)
203 + a_CO2*b_H2O/(R*pow(temperature, 1.5)*b_CO2*b_CO2)
204 *(log((V + b_CO2)/V) - b_CO2/(V + b_CO2))
205 - log(pg_bar*V/(R*temperature));
206 return exp(lnPhiH2O);
215 static Scalar salinityToMolFrac_(Scalar salinity) {
218 const Scalar Ms = 58.8e-3;
220 const Scalar X_NaCl = salinity;
222 const Scalar x_NaCl = -Mw * X_NaCl / ((Ms - Mw) * X_NaCl - Ms);
231 static Scalar moleFracToMolality_(Scalar x_NaCl)
234 return 55.508 * x_NaCl / (1 - x_NaCl);
244 template <
class Evaluation>
245 static Evaluation molalityCO2inPureWater_(
const Evaluation& temperature,
const Evaluation& pg,
bool extrapolate =
false)
247 const Evaluation& A = computeA_(temperature, pg, extrapolate);
248 const Evaluation& B = computeB_(temperature, pg, extrapolate);
249 const Evaluation& yH2OinGas = (1 - B) / (1. / A - B);
250 const Evaluation& xCO2inWater = B * (1 - yH2OinGas);
251 return (xCO2inWater * 55.508) / (1 - xCO2inWater);
263 template <
class Evaluation>
264 static Evaluation activityCoefficient_(
const Evaluation& temperature,
265 const Evaluation& pg,
268 const Evaluation& lambda = computeLambda_(temperature, pg);
269 const Evaluation& xi = computeXi_(temperature, pg);
270 const Evaluation& lnGammaStar =
271 2*molalityNaCl*lambda + xi*molalityNaCl*molalityNaCl;
272 return exp(lnGammaStar);
283 template <
class Evaluation>
284 static Evaluation computeA_(
const Evaluation& temperature,
const Evaluation& pg,
bool extrapolate =
false)
286 const Evaluation& deltaP = pg / 1e5 - 1;
287 Scalar v_av_H2O = 18.1;
289 const Evaluation& k0_H2O = equilibriumConstantH2O_(temperature);
291 const Evaluation& pg_bar = pg / 1.e5;
292 return k0_H2O/(phi_H2O*pg_bar)*exp(deltaP*v_av_H2O/(R*temperature));
303 template <
class Evaluation>
304 static Evaluation computeB_(
const Evaluation& temperature,
const Evaluation& pg,
bool extrapolate =
false)
306 const Evaluation& deltaP = pg / 1e5 - 1;
307 const Scalar v_av_CO2 = 32.6;
309 const Evaluation& k0_CO2 = equilibriumConstantCO2_(temperature);
311 const Evaluation& pg_bar = pg / 1.e5;
312 return phi_CO2*pg_bar/(55.508*k0_CO2)*exp(-(deltaP*v_av_CO2)/(R*temperature));
322 template <
class Evaluation>
323 static Evaluation computeLambda_(
const Evaluation& temperature,
const Evaluation& pg)
325 static const Scalar c[6] =
326 { -0.411370585, 6.07632013E-4, 97.5347708, -0.0237622469, 0.0170656236, 1.41335834E-5 };
328 Evaluation pg_bar = pg / 1.0E5;
333 + c[3]*pg_bar/temperature
334 + c[4]*pg_bar/(630.0 - temperature)
335 + c[5]*temperature*log(pg_bar);
345 template <
class Evaluation>
346 static Evaluation computeXi_(
const Evaluation& temperature,
const Evaluation& pg)
348 static const Scalar c[4] =
349 { 3.36389723E-4, -1.98298980E-5, 2.12220830E-3, -5.24873303E-3 };
351 Evaluation pg_bar = pg / 1.0E5;
352 return c[0] + c[1]*temperature + c[2]*pg_bar/temperature + c[3]*pg_bar/(630.0 - temperature);
361 template <
class Evaluation>
362 static Evaluation equilibriumConstantCO2_(
const Evaluation& temperature)
364 Evaluation temperatureCelcius = temperature - 273.15;
365 static const Scalar c[3] = { 1.189, 1.304e-2, -5.446e-5 };
366 Evaluation logk0_CO2 = c[0] + temperatureCelcius*(c[1] + temperatureCelcius*c[2]);
367 Evaluation k0_CO2 = pow(10.0, logk0_CO2);
377 template <
class Evaluation>
378 static Evaluation equilibriumConstantH2O_(
const Evaluation& temperature)
380 Evaluation temperatureCelcius = temperature - 273.15;
381 static const Scalar c[4] = { -2.209, 3.097e-2, -1.098e-4, 2.048e-7 };
382 Evaluation logk0_H2O =
383 c[0] + temperatureCelcius*(c[1] + temperatureCelcius*(c[2] + temperatureCelcius*c[3]));
384 return pow(10.0, logk0_H2O);
Relations valid for an ideal gas.
Some templates to wrap the valgrind client request macros.
Binary coefficients for brine and CO2.
Definition: Brine_CO2.hpp:42
static Evaluation fugacityCoefficientH2O(const Evaluation &temperature, const Evaluation &pg, bool extrapolate=false)
Returns the fugacity coefficient of the H2O component in a water-CO2 mixture.
Definition: Brine_CO2.hpp:188
static void calculateMoleFractions(const Evaluation &temperature, const Evaluation &pg, Scalar salinity, const int knownPhaseIdx, Evaluation &xlCO2, Evaluation &ygH2O, bool extrapolate=false)
Returns the mol (!) fraction of CO2 in the liquid phase and the mol_ (!) fraction of H2O in the gas p...
Definition: Brine_CO2.hpp:97
static Evaluation gasDiffCoeff(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
Binary diffusion coefficent [m^2/s] of water in the CO2 phase.
Definition: Brine_CO2.hpp:56
static Evaluation fugacityCoefficientCO2(const Evaluation &temperature, const Evaluation &pg, bool extrapolate=false)
Returns the fugacity coefficient of the CO2 component in a water-CO2 mixture.
Definition: Brine_CO2.hpp:151
static Evaluation liquidDiffCoeff(const Evaluation &, const Evaluation &)
Binary diffusion coefficent [m^2/s] of CO2 in the brine phase.
Definition: Brine_CO2.hpp:73
static Evaluation henry(const Evaluation &temperature, bool extrapolate=false)
Henry coefficent for CO2 in brine.
Definition: Brine_CO2.hpp:139
static Scalar molarMass()
The mass in [kg] of one mole of CO2.
Definition: CO2.hpp:66
static Evaluation gasViscosity(Evaluation temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity [Pa s] of CO2.
Definition: CO2.hpp:203
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The density of CO2 at a given pressure and temperature [kg/m^3].
Definition: CO2.hpp:189
static const Scalar molarMass()
The molar mass in of water.
Definition: H2O.hpp:80
Relations valid for an ideal gas.
Definition: IdealGas.hpp:38
static const Scalar R
The ideal gas constant .
Definition: IdealGas.hpp:41