27 #ifndef OPM_H2O_AIR_XYLENE_FLUID_SYSTEM_HPP
28 #define OPM_H2O_AIR_XYLENE_FLUID_SYSTEM_HPP
50 template <
class Scalar>
58 template <
class Evaluation>
63 typedef ::Opm::H2O<Scalar>
H2O;
67 typedef ::Opm::Air<Scalar>
Air;
136 throw std::logic_error(
"Invalid phase index "+std::to_string(phaseIdx));
147 throw std::logic_error(
"Invalid component index "+std::to_string(compIdx));
167 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
168 static LhsEval
density(
const FluidState& fluidState,
173 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
174 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
190 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
195 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
196 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
198 const LhsEval& pH2O = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
H2OIdx))*p;
199 const LhsEval& pAir = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
airIdx))*p;
200 const LhsEval& pNAPL = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
NAPLIdx))*p;
208 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
213 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
214 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
240 Air::simpleGasViscosity(T, p),
250 const auto& xgAir = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
airIdx));
251 const auto& xgH2O = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
H2OIdx));
254 const LhsEval& xgAW = xgAir + xgH2O;
255 const LhsEval& muAW = (mu[
airIdx]*xgAir + mu[
H2OIdx]*xgH2O)/ xgAW;
264 const LhsEval& phiAWC = phiCAW * muAW*M[
NAPLIdx]/(mu[
NAPLIdx]*MAW);
266 return (xgAW*muAW)/(xgAW+xgNapl*phiAWC) + (xgNapl*mu[
NAPLIdx])/(xgNapl + xgAW*phiCAW);
270 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
277 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
278 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
284 const LhsEval& xga = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
airIdx));
285 const LhsEval& xgw = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
H2OIdx));
288 if (compIdx==
NAPLIdx)
return (1.- xgw)/(xga/diffAW + xgc/diffWC);
289 else if (compIdx==
H2OIdx)
return (1.- xgc)/(xgw/diffWC + xga/diffAC);
290 else if (compIdx==
airIdx)
throw std::logic_error(
"Diffusivity of air in the gas phase "
291 "is constraint by sum of diffusive fluxes = 0 !\n");
303 return (1.- xww)/(xwa/diffAWl + xwc/diffWCl);
305 return (1.- xwc)/(xww/diffWCl + xwa/diffACl);
307 throw std::logic_error(
"Diffusivity of water in the water phase "
308 "is constraint by sum of diffusive fluxes = 0 !\n");
312 throw std::logic_error(
"Diffusion coefficients of "
313 "substances in liquid phase are undefined!\n");
319 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
328 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
329 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
334 else if (compIdx ==
airIdx)
349 else if (compIdx ==
airIdx)
351 else if (compIdx ==
H2OIdx)
362 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
363 static LhsEval
enthalpy(
const FluidState& fluidState,
367 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
368 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
388 throw std::logic_error(
"Invalid phase index "+std::to_string(phaseIdx));
392 template <
class LhsEval>
393 static LhsEval waterPhaseDensity_(
const LhsEval& T,
407 template <
class LhsEval>
408 static LhsEval gasPhaseDensity_(
const LhsEval& T,
415 template <
class LhsEval>
416 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:102
static Scalar molarMass()
The molar mass in of .
Definition: Air.hpp:80
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: Air.hpp:72
static const char * name()
A human readable name for the .
Definition: Air.hpp:60
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water with 273.15 K as basis.
Definition: Air.hpp:180
The base class for all fluid systems.
Definition: BaseFluidSystem.hpp:44
Scalar Scalar
The type used for scalar quantities.
Definition: BaseFluidSystem.hpp:49
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:53
static LhsEval viscosity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: H2OAirXyleneFluidSystem.hpp:209
static const int numPhases
Number of fluid phases in the fluid system.
Definition: H2OAirXyleneFluidSystem.hpp:70
static const int naplPhaseIdx
The index of the NAPL phase.
Definition: H2OAirXyleneFluidSystem.hpp:77
static Scalar molarMass(unsigned compIdx)
Return the molar mass of a component in [kg/mol].
Definition: H2OAirXyleneFluidSystem.hpp:151
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:363
static void init()
Initialize the fluid system's static parameters.
Definition: H2OAirXyleneFluidSystem.hpp:89
static LhsEval density(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: H2OAirXyleneFluidSystem.hpp:168
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:271
::Opm::H2O< Scalar > H2O
The type of the water component.
Definition: H2OAirXyleneFluidSystem.hpp:63
Xylene< Scalar > NAPL
The type of the xylene/napl component.
Definition: H2OAirXyleneFluidSystem.hpp:65
static bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: H2OAirXyleneFluidSystem.hpp:104
static const int waterPhaseIdx
The index of the water phase.
Definition: H2OAirXyleneFluidSystem.hpp:75
static const int numComponents
Number of chemical species in the fluid system.
Definition: H2OAirXyleneFluidSystem.hpp:72
static const char * componentName(unsigned compIdx)
Return the human readable name of a component.
Definition: H2OAirXyleneFluidSystem.hpp:140
static const int H2OIdx
The index of the water component.
Definition: H2OAirXyleneFluidSystem.hpp:82
static bool isCompressible(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: H2OAirXyleneFluidSystem.hpp:115
static const int NAPLIdx
The index of the NAPL component.
Definition: H2OAirXyleneFluidSystem.hpp:84
::Opm::Air< Scalar > Air
The type of the air component.
Definition: H2OAirXyleneFluidSystem.hpp:67
static bool isLiquid(unsigned phaseIdx)
Return whether a phase is liquid.
Definition: H2OAirXyleneFluidSystem.hpp:93
static const char * phaseName(unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition: H2OAirXyleneFluidSystem.hpp:129
static const int airIdx
The index of the air pseudo-component.
Definition: H2OAirXyleneFluidSystem.hpp:86
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:320
static const int gasPhaseIdx
The index of the gas phase.
Definition: H2OAirXyleneFluidSystem.hpp:79
static bool isIdealGas(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: H2OAirXyleneFluidSystem.hpp:100
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:698
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam in at a given pressure and temperature.
Definition: H2O.hpp:572
static const char * name()
A human readable name for the water.
Definition: H2O.hpp:74
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition: H2O.hpp:138
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of steam.
Definition: H2O.hpp:802
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of liquid water .
Definition: H2O.hpp:236
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: H2O.hpp:638
static const Scalar molarMass()
The molar mass in of water.
Definition: H2O.hpp:80
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: H2O.hpp:556
static Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &pressure, bool extrapolate=false)
The dynamic viscosity of pure water.
Definition: H2O.hpp:828
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of water steam .
Definition: H2O.hpp:183
A parameter cache which does nothing.
Definition: NullParameterCache.hpp:40
Component for Xylene.
Definition: Xylene.hpp:47
static Evaluation liquidViscosity(Evaluation temperature, const Evaluation &)
The dynamic liquid viscosity of the pure component.
Definition: Xylene.hpp:309
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:220
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:95
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the pure component in gas.
Definition: Xylene.hpp:211
static const char * name()
A human readable name for the xylene.
Definition: Xylene.hpp:55
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: Xylene.hpp:283
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the pure component in liquid.
Definition: Xylene.hpp:149
static Scalar molarMass()
The molar mass in of xylene.
Definition: Xylene.hpp:61
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:290
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:265
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: Xylene.hpp:277
Definition: H2OAirXyleneFluidSystem.hpp:60