27#ifndef OPM_H2O_AIR_XYLENE_FLUID_SYSTEM_HPP
28#define OPM_H2O_AIR_XYLENE_FLUID_SYSTEM_HPP
52template <
class Scalar>
60 template <
class Evaluation>
65 typedef ::Opm::H2O<Scalar>
H2O;
69 typedef ::Opm::Air<Scalar>
Air;
138 throw std::logic_error(
"Invalid phase index "+std::to_string(phaseIdx));
149 throw std::logic_error(
"Invalid component index "+std::to_string(compIdx));
169 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
170 static LhsEval
density(
const FluidState& fluidState,
175 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
176 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
192 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
197 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
198 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
200 const LhsEval& pH2O = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
H2OIdx))*p;
201 const LhsEval& pAir = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
airIdx))*p;
202 const LhsEval& pNAPL = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
NAPLIdx))*p;
210 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
215 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
216 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
242 Air::simpleGasViscosity(T, p),
252 const auto& xgAir = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
airIdx));
253 const auto& xgH2O = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
H2OIdx));
256 const LhsEval& xgAW = xgAir + xgH2O;
257 const LhsEval& muAW = (mu[
airIdx]*xgAir + mu[
H2OIdx]*xgH2O)/ xgAW;
266 const LhsEval& phiAWC = phiCAW * muAW*M[
NAPLIdx]/(mu[
NAPLIdx]*MAW);
268 return (xgAW*muAW)/(xgAW+xgNapl*phiAWC) + (xgNapl*mu[
NAPLIdx])/(xgNapl + xgAW*phiCAW);
272 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
279 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
280 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
286 const LhsEval& xga = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
airIdx));
287 const LhsEval& xgw = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
H2OIdx));
290 if (compIdx==
NAPLIdx)
return (1.- xgw)/(xga/diffAW + xgc/diffWC);
291 else if (compIdx==
H2OIdx)
return (1.- xgc)/(xgw/diffWC + xga/diffAC);
292 else if (compIdx==
airIdx)
throw std::logic_error(
"Diffusivity of air in the gas phase "
293 "is constraint by sum of diffusive fluxes = 0 !\n");
305 return (1.- xww)/(xwa/diffAWl + xwc/diffWCl);
307 return (1.- xwc)/(xww/diffWCl + xwa/diffACl);
309 throw std::logic_error(
"Diffusivity of water in the water phase "
310 "is constraint by sum of diffusive fluxes = 0 !\n");
314 throw std::logic_error(
"Diffusion coefficients of "
315 "substances in liquid phase are undefined!\n");
321 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
330 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
331 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
336 else if (compIdx ==
airIdx)
351 else if (compIdx ==
airIdx)
353 else if (compIdx ==
H2OIdx)
364 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
365 static LhsEval
enthalpy(
const FluidState& fluidState,
369 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
370 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
390 throw std::logic_error(
"Invalid phase index "+std::to_string(phaseIdx));
394 template <
class LhsEval>
395 static LhsEval waterPhaseDensity_(
const LhsEval& T,
409 template <
class LhsEval>
410 static LhsEval gasPhaseDensity_(
const LhsEval& T,
417 template <
class LhsEval>
418 static LhsEval NAPLPhaseDensity_(
const LhsEval& T,
const LhsEval& pn)
A simple class implementing the fluid properties of air.
Binary coefficients for water and xylene.
The base class for all fluid systems.
Material properties of pure water .
Binary coefficients for water and nitrogen.
Binary coefficients for water and xylene.
Relations valid for an ideal gas.
A parameter cache which does nothing.
A generic class which tabulates all thermodynamic properties of a given component.
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of at a given pressure and temperature [kg/m^3].
Definition Air.hpp:104
static Scalar molarMass()
The molar mass in of .
Definition Air.hpp:82
static std::string_view name()
A human readable name for the .
Definition Air.hpp:62
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition Air.hpp:74
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water with 273.15 K as basis.
Definition Air.hpp:182
The base class for all fluid systems.
Definition BaseFluidSystem.hpp:47
Scalar Scalar
The type used for scalar quantities.
Definition BaseFluidSystem.hpp:52
static Evaluation gasDiffCoeff(Evaluation temperature, Evaluation pressure)
Binary diffusion coefficent [m^2/s] for air and xylene.
Definition Air_Xylene.hpp:57
static Evaluation henry(const Evaluation &temperature)
Henry coefficent for air in liquid water.
Definition H2O_Air.hpp:55
static Evaluation gasDiffCoeff(const Evaluation &temperature, const Evaluation &pressure)
Binary diffusion coefficent for molecular water and air.
Definition H2O_Air.hpp:70
static Evaluation gasDiffCoeff(Evaluation temperature, Evaluation pressure)
Binary diffusion coefficent [m^2/s] for molecular water and xylene.
Definition H2O_Xylene.hpp:66
static Evaluation henry(const Evaluation &)
Henry coefficent for xylene in liquid water.
Definition H2O_Xylene.hpp:51
A fluid system with water, gas and NAPL as phases and water, air and NAPL (contaminant) as components...
Definition H2OAirXyleneFluidSystem.hpp:55
static LhsEval viscosity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition H2OAirXyleneFluidSystem.hpp:211
static const int numPhases
Number of fluid phases in the fluid system.
Definition H2OAirXyleneFluidSystem.hpp:72
static const int naplPhaseIdx
The index of the NAPL phase.
Definition H2OAirXyleneFluidSystem.hpp:79
static Scalar molarMass(unsigned compIdx)
Return the molar mass of a component in [kg/mol].
Definition H2OAirXyleneFluidSystem.hpp:153
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 H2OAirXyleneFluidSystem.hpp:365
static void init()
Initialize the fluid system's static parameters.
Definition H2OAirXyleneFluidSystem.hpp:91
static LhsEval density(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition H2OAirXyleneFluidSystem.hpp:170
static std::string_view componentName(unsigned compIdx)
Return the human readable name of a component.
Definition H2OAirXyleneFluidSystem.hpp:142
static LhsEval diffusionCoefficient(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx, unsigned compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase [mol^2 * s / (k...
Definition H2OAirXyleneFluidSystem.hpp:273
::Opm::H2O< Scalar > H2O
The type of the water component.
Definition H2OAirXyleneFluidSystem.hpp:65
Xylene< Scalar > NAPL
The type of the xylene/napl component.
Definition H2OAirXyleneFluidSystem.hpp:67
static bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition H2OAirXyleneFluidSystem.hpp:106
static const int waterPhaseIdx
The index of the water phase.
Definition H2OAirXyleneFluidSystem.hpp:77
static const int numComponents
Number of chemical species in the fluid system.
Definition H2OAirXyleneFluidSystem.hpp:74
static const int H2OIdx
The index of the water component.
Definition H2OAirXyleneFluidSystem.hpp:84
static bool isCompressible(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition H2OAirXyleneFluidSystem.hpp:117
static const int NAPLIdx
The index of the NAPL component.
Definition H2OAirXyleneFluidSystem.hpp:86
::Opm::Air< Scalar > Air
The type of the air component.
Definition H2OAirXyleneFluidSystem.hpp:69
static bool isLiquid(unsigned phaseIdx)
Return whether a phase is liquid.
Definition H2OAirXyleneFluidSystem.hpp:95
static const int airIdx
The index of the air pseudo-component.
Definition H2OAirXyleneFluidSystem.hpp:88
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 H2OAirXyleneFluidSystem.hpp:322
static std::string_view phaseName(unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition H2OAirXyleneFluidSystem.hpp:131
static const int gasPhaseIdx
The index of the gas phase.
Definition H2OAirXyleneFluidSystem.hpp:81
static bool isIdealGas(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition H2OAirXyleneFluidSystem.hpp:102
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 Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam in at a given pressure and temperature.
Definition H2O.hpp:562
static std::string_view name()
A human readable name for the water.
Definition H2O.hpp:77
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 bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition H2O.hpp:627
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 gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of water steam .
Definition H2O.hpp:186
A parameter cache which does nothing.
Definition NullParameterCache.hpp:40
Component for Xylene.
Definition Xylene.hpp:48
static Evaluation liquidViscosity(Evaluation temperature, const Evaluation &)
The dynamic liquid viscosity of the pure component.
Definition Xylene.hpp:310
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density in of the component at a given pressure in and temperature in .
Definition Xylene.hpp:221
static Evaluation vaporPressure(const Evaluation &temperature)
The saturation vapor pressure in of pure xylene at a given temperature according to Antoine after Be...
Definition Xylene.hpp:96
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the pure component in gas.
Definition Xylene.hpp:212
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition Xylene.hpp:284
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the pure component in liquid.
Definition Xylene.hpp:150
static Scalar molarMass()
The molar mass in of xylene.
Definition Xylene.hpp:62
static std::string_view name()
A human readable name for the xylene.
Definition Xylene.hpp:56
static Evaluation gasViscosity(Evaluation temperature, const Evaluation &)
The dynamic viscosity of the pure component at a given pressure in and temperature in .
Definition Xylene.hpp:291
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of the liquid component at a given pressure in and temperature in .
Definition Xylene.hpp:266
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition Xylene.hpp:278
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition H2OAirXyleneFluidSystem.hpp:62