27#ifndef OPM_H2O_AIR_SYSTEM_HPP
28#define OPM_H2O_AIR_SYSTEM_HPP
54template <
class Scalar,
56 class H2Otype = TabulatedComponent<Scalar, H2O<Scalar> >>
62 typedef ::Opm::IdealGas<Scalar>
IdealGas;
65 template <
class Evaluation>
72 typedef ::Opm::Air<Scalar>
Air;
89 throw std::logic_error(
"Invalid phase index "+std::to_string(phaseIdx));
150 throw std::logic_error(
"Invalid component index "+std::to_string(compIdx));
222 if (H2O::isTabulated)
245 if (H2O::isTabulated) {
247 pressMin, pressMax, nPress);
252 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
253 static LhsEval
density(
const FluidState& fluidState,
259 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
262 p = decay<LhsEval>(fluidState.pressure(phaseIdx));
267 Valgrind::SetUndefined(p);
271 LhsEval sumMoleFrac = 0;
272 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx)
273 sumMoleFrac += decay<LhsEval>(fluidState.moleFraction(phaseIdx, compIdx));
288 LhsEval partialPressureH2O =
292 LhsEval partialPressureAir =
298 throw std::logic_error(
"Invalid phase index "+std::to_string(phaseIdx));
302 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
309 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
310 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
327 LhsEval muResult = 0;
343 divisor += decay<LhsEval>(fluidState.moleFraction(phaseIdx, j))*phiIJ;
345 const auto& xAlphaI = decay<LhsEval>(fluidState.moleFraction(phaseIdx, i));
346 muResult += xAlphaI*mu[i]/divisor;
350 throw std::logic_error(
"Invalid phase index "+std::to_string(phaseIdx));
354 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
363 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
364 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
378 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
384 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
385 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
395 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
396 static LhsEval
enthalpy(
const FluidState& fluidState,
400 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
401 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
402 Valgrind::CheckDefined(T);
403 Valgrind::CheckDefined(p);
413 LhsEval result = 0.0;
423 throw std::logic_error(
"Invalid phase index "+std::to_string(phaseIdx));
427 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
434 const LhsEval& temperature =
435 decay<LhsEval>(fluidState.temperature(phaseIdx));
436 const LhsEval& pressure =
437 decay<LhsEval>(fluidState.pressure(phaseIdx));
444 const LhsEval& xAir =
445 decay<LhsEval>(fluidState.moleFraction(phaseIdx,
AirIdx));
446 const LhsEval& xH2O =
447 decay<LhsEval>(fluidState.moleFraction(phaseIdx,
H2OIdx));
448 LhsEval lambdaAir = xAir*lambdaDryAir;
452 LhsEval partialPressure = pressure*xH2O;
456 return lambdaAir + lambdaH2O;
A generic class which tabulates all thermodynamic properties of a given component.
Some templates to wrap the valgrind client request macros.
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition: Air.hpp:217
static Scalar criticalPressure()
Returns the critical pressure of .
Definition: Air.hpp:92
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of at a given pressure and temperature [kg/m^3].
Definition: Air.hpp:102
static Scalar molarMass()
The molar mass in of .
Definition: Air.hpp:80
static const char * name()
A human readable name for the .
Definition: Air.hpp:60
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: Air.hpp:72
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water with 273.15 K as basis.
Definition: Air.hpp:180
static Scalar criticalTemperature()
Returns the critical temperature of .
Definition: Air.hpp:86
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &)
The dynamic viscosity of at a given pressure and temperature.
Definition: Air.hpp:137
The base class for all fluid systems.
Definition: BaseFluidSystem.hpp:46
Scalar Scalar
The type used for scalar quantities.
Definition: BaseFluidSystem.hpp:51
static Evaluation henry(const Evaluation &temperature)
Henry coefficent for air in liquid water.
Definition: H2O_Air.hpp:55
static Evaluation liquidDiffCoeff(const Evaluation &temperature, const Evaluation &)
Lacking better data on water-air diffusion in liquids, we use at the moment the diffusion coefficient...
Definition: H2O_Air.hpp:101
static Evaluation gasDiffCoeff(const Evaluation &temperature, const Evaluation &pressure)
Binary diffusion coefficent for molecular water and air.
Definition: H2O_Air.hpp:70
static Scalar acentricFactor()
Returns the acentric factor of the component.
Definition: Component.hpp:110
static void init(Scalar, Scalar, unsigned, Scalar, Scalar, unsigned)
A default routine for initialization, not needed for components and must not be called.
Definition: Component.hpp:60
A fluid system with a liquid and a gaseous phase and water and air as components.
Definition: H2OAirFluidSystem.hpp:59
H2Otype H2O
The type of the water component used for this fluid system.
Definition: H2OAirFluidSystem.hpp:70
static LhsEval density(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: H2OAirFluidSystem.hpp:253
static const int AirIdx
The index of the air component.
Definition: H2OAirFluidSystem.hpp:140
static const int numComponents
Number of chemical species in the fluid system.
Definition: H2OAirFluidSystem.hpp:135
static Scalar molarMass(unsigned compIdx)
Return the molar mass of a component in [kg/mol].
Definition: H2OAirFluidSystem.hpp:154
static const int gasPhaseIdx
The index of the gas phase.
Definition: H2OAirFluidSystem.hpp:80
static bool isIdealGas(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: H2OAirFluidSystem.hpp:112
static const char * componentName(unsigned compIdx)
Return the human readable name of a component.
Definition: H2OAirFluidSystem.hpp:143
static const int liquidPhaseIdx
The index of the liquid phase.
Definition: H2OAirFluidSystem.hpp:78
static LhsEval binaryDiffusionCoefficient(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx, unsigned)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase [mol^2 * s / (k...
Definition: H2OAirFluidSystem.hpp:379
static const int H2OIdx
The index of the water component.
Definition: H2OAirFluidSystem.hpp:138
static bool isCompressible(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: H2OAirFluidSystem.hpp:100
static const int numPhases
Number of fluid phases in the fluid system.
Definition: H2OAirFluidSystem.hpp:75
static const char * phaseName(unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition: H2OAirFluidSystem.hpp:83
static LhsEval viscosity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: H2OAirFluidSystem.hpp:303
static bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: H2OAirFluidSystem.hpp:121
static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, Scalar pressMin, Scalar pressMax, unsigned nPress)
Initialize the fluid system's static parameters using problem specific temperature and pressure range...
Definition: H2OAirFluidSystem.hpp:242
::Opm::Air< Scalar > Air
The type of the air component used for this fluid system.
Definition: H2OAirFluidSystem.hpp:72
static Scalar criticalTemperature(unsigned compIdx)
Critical temperature of a component [K].
Definition: H2OAirFluidSystem.hpp:170
static bool isLiquid(unsigned phaseIdx)
Return whether a phase is liquid.
Definition: H2OAirFluidSystem.hpp:93
static LhsEval enthalpy(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy [J/kg...
Definition: H2OAirFluidSystem.hpp:396
static Scalar acentricFactor(unsigned compIdx)
The acentric factor of a component [].
Definition: H2OAirFluidSystem.hpp:200
static void init()
Initialize the fluid system's static parameters.
Definition: H2OAirFluidSystem.hpp:220
static Scalar criticalPressure(unsigned compIdx)
Critical pressure of a component [Pa].
Definition: H2OAirFluidSystem.hpp:185
static LhsEval thermalConductivity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Thermal conductivity of a fluid phase [W/(m K)].
Definition: H2OAirFluidSystem.hpp:428
static LhsEval fugacityCoefficient(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx, unsigned compIdx)
Calculate the fugacity coefficient [Pa] of an individual component in a fluid phase.
Definition: H2OAirFluidSystem.hpp:355
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The density of pure water in at a given pressure and temperature.
Definition: H2O.hpp:687
static const Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: H2O.hpp:95
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam in at a given pressure and temperature.
Definition: H2O.hpp:562
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition: H2O.hpp:141
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of steam.
Definition: H2O.hpp:790
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of liquid water .
Definition: H2O.hpp:237
static Evaluation liquidThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
Thermal conductivity of water (IAPWS) .
Definition: H2O.hpp:844
static const Scalar acentricFactor()
The acentric factor of water.
Definition: H2O.hpp:89
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: H2O.hpp:627
static const Scalar criticalPressure()
Returns the critical pressure of water.
Definition: H2O.hpp:101
static const Scalar molarMass()
The molar mass in of water.
Definition: H2O.hpp:83
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: H2O.hpp:546
static Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity of pure water.
Definition: H2O.hpp:815
static Evaluation gasThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
Thermal conductivity of water (IAPWS) .
Definition: H2O.hpp:864
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of water steam .
Definition: H2O.hpp:186
static const char * name()
A human readable name for the water.
Definition: H2O.hpp:77
Relations valid for an ideal gas.
Definition: IdealGas.hpp:38
A parameter cache which does nothing.
Definition: NullParameterCache.hpp:40
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: H2OAirFluidSystem.hpp:67