27 #ifndef OPM_H2O_AIR_SYSTEM_HPP 28 #define OPM_H2O_AIR_SYSTEM_HPP 38 #include <opm/common/Valgrind.hpp> 40 #include <opm/common/Exceptions.hpp> 41 #include <opm/common/ErrorMacros.hpp> 47 namespace FluidSystems {
58 template <
class Scalar,
61 bool useComplexRelations =
true>
63 :
public BaseFluidSystem<Scalar, H2OAir<Scalar, H2Otype, useComplexRelations> >
70 template <
class Evaluation>
94 OPM_THROW(std::logic_error,
"Invalid phase index " << phaseIdx);
155 OPM_THROW(std::logic_error,
"Invalid component index " << compIdx);
211 ? Air::acentricFactor()
227 if (H2O::isTabulated)
250 if (H2O::isTabulated) {
252 pressMin, pressMax, nPress);
257 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
258 static LhsEval
density(
const FluidState& fluidState,
262 assert(0 <= phaseIdx && phaseIdx <
numPhases);
264 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
267 p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
272 Valgrind::SetUndefined(p);
276 LhsEval sumMoleFrac = 0;
277 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx)
278 sumMoleFrac += Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx, compIdx));
282 if (!useComplexRelations)
299 if (!useComplexRelations)
303 * Opm::decay<LhsEval>(fluidState.averageMolarMass(
gasPhaseIdx))
304 / Opm::max(1e-5, sumMoleFrac);
306 LhsEval partialPressureH2O =
308 *Opm::decay<LhsEval>(fluidState.pressure(
gasPhaseIdx));
310 LhsEval partialPressureAir =
312 *Opm::decay<LhsEval>(fluidState.pressure(
gasPhaseIdx));
316 OPM_THROW(std::logic_error,
"Invalid phase index " << phaseIdx);
320 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
325 assert(0 <= phaseIdx && phaseIdx <
numPhases);
327 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
328 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
339 if(!useComplexRelations){
352 LhsEval muResult = 0;
369 Opm::sqrt(mu[i]/mu[j]) *
370 std::pow(M[j]/M[i], 1./4.0);
373 phiIJ /= std::sqrt(8*(1 + M[i]/M[j]));
374 divisor += Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx, j))*phiIJ;
376 const auto& xAlphaI = Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx, i));
377 muResult += xAlphaI*mu[i]/divisor;
382 OPM_THROW(std::logic_error,
"Invalid phase index " << phaseIdx);
386 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
392 assert(0 <= phaseIdx && phaseIdx <
numPhases);
395 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
396 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
410 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
416 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
417 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
427 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
428 static LhsEval
enthalpy(
const FluidState& fluidState,
432 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
433 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
434 Valgrind::CheckDefined(T);
435 Valgrind::CheckDefined(p);
445 LhsEval result = 0.0;
455 OPM_THROW(std::logic_error,
"Invalid phase index " << phaseIdx);
459 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
464 assert(0 <= phaseIdx && phaseIdx <
numPhases);
466 const LhsEval& temperature =
467 Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
468 const LhsEval& pressure =
469 Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
476 if (useComplexRelations){
477 const LhsEval& xAir =
478 Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx,
AirIdx));
479 const LhsEval& xH2O =
480 Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx,
H2OIdx));
481 LhsEval lambdaAir = xAir*lambdaDryAir;
485 LhsEval partialPressure = pressure*xH2O;
489 return lambdaAir + lambdaH2O;
static bool isIdealGas(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: H2OAirFluidSystem.hpp:117
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of pure water in at a given pressure and temperature.
Definition: H2O.hpp:678
static Scalar criticalPressure(unsigned compIdx)
Critical pressure of a component [Pa].
Definition: H2OAirFluidSystem.hpp:190
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: H2O.hpp:618
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:247
Relations valid for an ideal gas.
static const int numPhases
Number of fluid phases in the fluid system.
Definition: H2OAirFluidSystem.hpp:80
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: H2O.hpp:537
static bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: H2OAirFluidSystem.hpp:126
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of steam.
Definition: H2O.hpp:779
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 const int numComponents
Number of chemical species in the fluid system.
Definition: H2OAirFluidSystem.hpp:140
static Scalar criticalPressure()
Returns the critical pressure of .
Definition: Air.hpp:93
static bool isLiquid(unsigned phaseIdx)
Return whether a phase is liquid.
Definition: H2OAirFluidSystem.hpp:98
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:62
static const Scalar acentricFactor()
The acentric factor of water.
Definition: H2O.hpp:86
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: Air.hpp:73
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:411
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam in at a given pressure and temperature.
Definition: H2O.hpp:553
static Evaluation liquidThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
Thermal conductivity of water (IAPWS) .
Definition: H2O.hpp:831
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &)
The dynamic viscosity of at a given pressure and temperature.
Definition: Air.hpp:138
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of liquid water .
Definition: H2O.hpp:228
Definition: H2OAirFluidSystem.hpp:71
A fluid system with a liquid and a gaseous phase and water and air as components. ...
Definition: H2OAirFluidSystem.hpp:62
static Scalar criticalTemperature()
Returns the critical temperature of .
Definition: Air.hpp:87
Definition: Air_Mesitylene.hpp:33
static Scalar molarMass()
The molar mass in of .
Definition: Air.hpp:81
A parameter cache which does nothing.
A simple class implementing the fluid properties of air.
Definition: Air.hpp:47
static Evaluation henry(const Evaluation &temperature)
Henry coefficent for air in liquid water.
Definition: H2O_Air.hpp:55
Material properties of pure water .
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of at a given pressure and temperature [kg/m^3].
Definition: Air.hpp:103
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:428
static const int liquidPhaseIdx
The index of the liquid phase.
Definition: H2OAirFluidSystem.hpp:83
static Scalar criticalTemperature(unsigned compIdx)
Critical temperature of a component [K].
Definition: H2OAirFluidSystem.hpp:175
static const char * name()
A human readable name for the water.
Definition: H2O.hpp:74
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition: Air.hpp:219
static Scalar acentricFactor(unsigned compIdx)
The acentric factor of a component [].
Definition: H2OAirFluidSystem.hpp:205
static const int gasPhaseIdx
The index of the gas phase.
Definition: H2OAirFluidSystem.hpp:85
static const int H2OIdx
The index of the water component.
Definition: H2OAirFluidSystem.hpp:143
Opm::Air< Scalar > Air
The type of the air component used for this fluid system.
Definition: H2OAirFluidSystem.hpp:77
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water with 273.15 K as basis.
Definition: Air.hpp:182
static Evaluation gasDiffCoeff(const Evaluation &temperature, const Evaluation &pressure)
Binary diffusion coefficent for molecular water and air.
Definition: H2O_Air.hpp:70
Relations valid for an ideal gas.
Definition: IdealGas.hpp:37
static Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of pure water.
Definition: H2O.hpp:804
static const Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: H2O.hpp:92
A simple class implementing the fluid properties of air.
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition: H2O.hpp:132
static const int AirIdx
The index of the air component.
Definition: H2OAirFluidSystem.hpp:145
static bool isCompressible(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: H2OAirFluidSystem.hpp:105
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of water steam .
Definition: H2O.hpp:177
A generic class which tabulates all thermodynamic properties of a given component.
The base class for all fluid systems.
Definition: BaseFluidSystem.hpp:43
static Evaluation gasThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
Thermal conductivity of water (IAPWS) .
Definition: H2O.hpp:851
A generic class which tabulates all thermodynamic properties of a given component.
Definition: TabulatedComponent.hpp:58
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:387
static const char * name()
A human readable name for the .
Definition: Air.hpp:61
static LhsEval thermalConductivity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Thermal conductivity of a fluid phase [W/(m K)].
Definition: H2OAirFluidSystem.hpp:460
static Evaluation molarDensity(const Evaluation &temperature, const Evaluation &pressure)
The molar density of the gas , depending on pressure and temperature.
Definition: IdealGas.hpp:67
static const char * phaseName(unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition: H2OAirFluidSystem.hpp:88
static LhsEval viscosity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: H2OAirFluidSystem.hpp:321
A parameter cache which does nothing.
Definition: NullParameterCache.hpp:39
static const Scalar molarMass()
The molar mass in of water.
Definition: H2O.hpp:80
Scalar Scalar
The type used for scalar quantities.
Definition: BaseFluidSystem.hpp:49
static Scalar molarMass(unsigned compIdx)
Return the molar mass of a component in [kg/mol].
Definition: H2OAirFluidSystem.hpp:159
static LhsEval density(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: H2OAirFluidSystem.hpp:258
static const Scalar criticalPressure()
Returns the critical pressure of water.
Definition: H2O.hpp:98
static const char * componentName(unsigned compIdx)
Return the human readable name of a component.
Definition: H2OAirFluidSystem.hpp:148
Binary coefficients for water and nitrogen.
H2Otype H2O
The type of the water component used for this fluid system.
Definition: H2OAirFluidSystem.hpp:75
The base class for all fluid systems.
static void init()
Initialize the fluid system's static parameters.
Definition: H2OAirFluidSystem.hpp:225