Loading...
Searching...
No Matches
Brine_H2.hpp
Go to the documentation of this file.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef OPM_BINARY_COEFF_BRINE_H2_HPP
#define OPM_BINARY_COEFF_BRINE_H2_HPP
#include <opm/material/binarycoefficients/FullerMethod.hpp>
namespace Opm {
namespace BinaryCoeff {
template<class Scalar, class H2O, class H2, bool verbose = true>
class Brine_H2 {
static const int liquidPhaseIdx = 0; // index of the liquid phase
static const int gasPhaseIdx = 1; // index of the gas phase
public:
template <class Evaluation>
static Evaluation calculateMoleFractions(const Evaluation& temperature,
const Evaluation& pg,
const Evaluation& salinity,
bool extrapolate = false)
{
// Convert salinity to molality from mass fraction
Evaluation X_NaCl = salinityToMolality_(salinity);
// All intermediate calculations
Evaluation lnYH2 = moleFractionGasH2_(temperature, pg);
Evaluation lnPg = log(pg / 1e6); // Pa --> MPa before ln
Evaluation lnPhiH2 = fugacityCoefficientH2(temperature, pg, extrapolate);
Evaluation lnKh = henrysConstant_(temperature);
Evaluation PF = computePoyntingFactor_(temperature, pg);
Evaluation lnGammaH2 = activityCoefficient_(temperature, X_NaCl);
// Eq. (4) to get mole fraction of H2 in brine
Evaluation xH2 = exp(lnYH2 + lnPg + lnPhiH2 - lnKh - PF - lnGammaH2);
return xH2;
}
template <class Evaluation>
static Evaluation computePoyntingFactor_(const Evaluation& temperature, const Evaluation& pg)
{
// PF is approximated as a polynomial expansion in terms of temperature and pressure with the following
// parameters (Table 4)
static const Scalar a[4] = {6.156755, -2.502396e-2, 4.140593e-5, -1.322988e-3};
// Eq. (16)
Evaluation pg_mpa = pg / 1.0e6; // convert from Pa to MPa
Evaluation PF = a[0]*pg_mpa/temperature + a[1]*pg_mpa + a[2]*temperature*pg_mpa + a[3]*pg_mpa*pg_mpa/temperature;
return PF;
}
template <class Evaluation>
static Evaluation activityCoefficient_(const Evaluation& temperature, const Evaluation& salinity)
{
// Linear approximation in temperature with following parameters (Table 5)
static const Scalar a[2] = {0.64485, 0.00142};
// Eq. (17)
Evaluation lnGamma = (a[0] - a[1]*temperature)*salinity;
return lnGamma;
}
template <class Evaluation>
static Evaluation henrysConstant_(const Evaluation& temperature)
{
// Polynomic approximation in temperature with following parameters (Table 2)
static const Scalar a[5] = {2.68721e-5, -0.05121, 33.55196, -3411.0432, -31258.74683};
// Eq. (13)
Evaluation lnKh = a[0]*temperature*temperature + a[1]*temperature + a[2] + a[3]/temperature
+ a[4]/(temperature*temperature);
return lnKh;
}
template <class Evaluation>
static Evaluation moleFractionGasH2_(const Evaluation& temperature, const Evaluation& pg)
{
// Need saturaturated vapor pressure of pure water
Evaluation pw_sat = H2O::vaporPressure(temperature);
// Eq. (12)
Evaluation lnyH2 = log(1 - (pw_sat / pg));
return lnyH2;
}
template <class Evaluation>
static Evaluation fugacityCoefficientH2(const Evaluation& temperature,
const Evaluation& pg,
bool extrapolate = false)
{
// Convert pressure to reduced density and temperature to reduced temperature
Evaluation rho_red = H2::reducedMolarDensity(temperature, pg, extrapolate);
Evaluation T_red = H2::criticalTemperature() / temperature;
// Residual Helmholtz energy, Eq. (7) in Li et al. (2018)
Evaluation resHelm = H2::residualPartHelmholtz(T_red, rho_red);
// Derivative of residual Helmholtz energy wrt to reduced density, Eq. (73) in Span et al. (2018)
Evaluation dResHelm_dRedRho = H2::derivResHelmholtzWrtRedRho(T_red, rho_red);
// Fugacity coefficient, Eq. (8) in Li et al. (2018)
Evaluation lnPhiH2 = resHelm + rho_red * dResHelm_dRedRho - log(rho_red * dResHelm_dRedRho + 1);
return lnPhiH2;
}
template <class Evaluation>
static Evaluation gasDiffCoeff(const Evaluation& temperature, const Evaluation& pressure)
{
// atomic diffusion volumes
const Scalar SigmaNu[2] = { 13.1 /* H2O */, 7.07 /* H2 */ };
// molar masses [g/mol]
const Scalar M[2] = { H2O::molarMass()*Scalar(1e3), H2::molarMass()*Scalar(1e3) };
return fullerMethod(M, SigmaNu, temperature, pressure);
}
private:
template <class Evaluation>
static Evaluation salinityToMolality_(const Evaluation& salinity) {
// Molar mass NaCl
const Scalar M_NaCl = 58.44e-3;
// Convert
const Evaluation X_NaCl = salinity / ((1 - salinity) * M_NaCl);
return X_NaCl;
}
}; // end class Brine_H2
} // end namespace BinaryCoeff
} // end namespace Opm
#endif
FullerMethod.hpp
Estimate binary diffusion coefficents in gases according to the method by Fuller.
Opm::BinaryCoeff::fullerMethod
Evaluation fullerMethod(const Scalar *M, const Scalar *SigmaNu, const Evaluation &temperature, const Evaluation &pressure)
Estimate binary diffusion coefficents in gases according to the method by Fuller.
Definition FullerMethod.hpp:56
Opm::BinaryCoeff::Brine_H2
Binary coefficients for brine and H2.
Definition Brine_H2.hpp:41
Opm::BinaryCoeff::Brine_H2::calculateMoleFractions
static Evaluation calculateMoleFractions(const Evaluation &temperature, const Evaluation &pg, const Evaluation &salinity, bool extrapolate=false)
Returns the mol (!) fraction of H2 in the liquid phase for a given temperature, pressure,...
Definition Brine_H2.hpp:57
Opm::BinaryCoeff::Brine_H2::activityCoefficient_
static Evaluation activityCoefficient_(const Evaluation &temperature, const Evaluation &salinity)
Returns the activity coefficient of H2 in brine which is needed in calculation of H2 solubility in Li...
Definition Brine_H2.hpp:106
Opm::BinaryCoeff::Brine_H2::gasDiffCoeff
static Evaluation gasDiffCoeff(const Evaluation &temperature, const Evaluation &pressure)
Binary diffusion coefficent [m^2/s] for molecular water and H2 as an approximation for brine-H2 diffu...
Definition Brine_H2.hpp:186
Opm::BinaryCoeff::Brine_H2::henrysConstant_
static Evaluation henrysConstant_(const Evaluation &temperature)
Returns Henry's constant of H2 in brine which is needed in calculation of H2 solubility in Li et al (...
Definition Brine_H2.hpp:122
Opm::BinaryCoeff::Brine_H2::moleFractionGasH2_
static Evaluation moleFractionGasH2_(const Evaluation &temperature, const Evaluation &pg)
Returns mole fraction of H2 in gasous phase which is needed in calculation of H2 solubility in Li et ...
Definition Brine_H2.hpp:141
Opm::BinaryCoeff::Brine_H2::computePoyntingFactor_
static Evaluation computePoyntingFactor_(const Evaluation &temperature, const Evaluation &pg)
Returns the Poynting Factor (PF) which is needed in calculation of H2 solubility in Li et al (2018).
Definition Brine_H2.hpp:85
Opm::BinaryCoeff::Brine_H2::fugacityCoefficientH2
static Evaluation fugacityCoefficientH2(const Evaluation &temperature, const Evaluation &pg, bool extrapolate=false)
Calculate fugacity coefficient for H2 which is needed in calculation of H2 solubility in Li et al (20...
Definition Brine_H2.hpp:160
Opm::H2O::vaporPressure
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition H2O.hpp:143
Opm::H2O::molarMass
static const Scalar molarMass()
The molar mass in of water.
Definition H2O.hpp:85
Opm::H2::residualPartHelmholtz
static Evaluation residualPartHelmholtz(const Evaluation &T_red, const Evaluation &rho_red)
The residual part of Helmholtz energy.
Definition H2.hpp:464
Opm::H2::criticalTemperature
static Scalar criticalTemperature()
Returns the critical temperature of molecular hydrogen.
Definition H2.hpp:83
Opm::H2::reducedMolarDensity
static Evaluation reducedMolarDensity(const Evaluation &temperature, const Evaluation &pg, bool extrapolate=false)
Calculate reduced density (rho/rho_crit) from pressure and temperature.
Definition H2.hpp:380
Opm::H2::derivResHelmholtzWrtRedRho
static Evaluation derivResHelmholtzWrtRedRho(const Evaluation &T_red, const Evaluation &rho_red)
Derivative of the residual part of Helmholtz energy wrt.
Definition H2.hpp:498
Opm::H2::molarMass
static constexpr Scalar molarMass()
The molar mass in of molecular hydrogen.
Definition H2.hpp:77
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30