27 #ifndef OPM_H2O_N2_FLUID_SYSTEM_HPP 28 #define OPM_H2O_N2_FLUID_SYSTEM_HPP 39 #include <opm/common/Valgrind.hpp> 41 #include <opm/common/Exceptions.hpp> 42 #include <opm/common/ErrorMacros.hpp> 48 namespace FluidSystems {
55 template <
class Scalar,
bool useComplexRelations = true>
70 template <
class Evaluation>
88 static const char* name[] = {
93 assert(0 <= phaseIdx && phaseIdx <
numPhases);
94 return name[phaseIdx];
159 static const char* name[] = {
165 return name[compIdx];
172 return (compIdx ==
H2OIdx)
186 return (compIdx ==
H2OIdx)
200 return (compIdx ==
H2OIdx)
214 return (compIdx ==
H2OIdx)
217 ? N2::acentricFactor()
255 if (H2O::isTabulated) {
257 pressMin, pressMax, nPress);
268 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
269 static LhsEval
density(
const FluidState& fluidState,
273 assert(0 <= phaseIdx && phaseIdx <
numPhases);
275 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
276 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
278 LhsEval sumMoleFrac = 0;
279 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx)
280 sumMoleFrac += Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx, compIdx));
284 if (!useComplexRelations)
305 if (!useComplexRelations)
309 * Opm::decay<LhsEval>(fluidState.averageMolarMass(
gasPhaseIdx))
310 / Opm::max(1e-5, sumMoleFrac);
314 const auto& xgH2O = Opm::decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
H2OIdx));
315 const auto& xgN2 = Opm::decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
N2Idx));
318 return (rho_gH2O + rho_gN2)/Opm::max(1e-5, sumMoleFrac);
322 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
327 assert(0 <= phaseIdx && phaseIdx <
numPhases);
329 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
330 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
340 if (!useComplexRelations)
350 LhsEval muResult = 0;
357 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx)
358 sumx += Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx, compIdx));
359 sumx = Opm::max(1e-10, sumx);
364 LhsEval phiIJ = 1 + Opm::sqrt(mu[i]/mu[j]) * std::pow(
molarMass(j)/
molarMass(i), 1/4.0);
368 Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx, j))
372 Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx, i))
380 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
386 assert(0 <= phaseIdx && phaseIdx <
numPhases);
389 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
390 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
407 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
414 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
415 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);
450 const auto& XgH2O = Opm::decay<LhsEval>(fluidState.massFraction(
gasPhaseIdx,
H2OIdx));
451 const auto& XgN2 = Opm::decay<LhsEval>(fluidState.massFraction(
gasPhaseIdx,
N2Idx));
459 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
464 assert(0 <= phaseIdx && phaseIdx <
numPhases);
466 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
467 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
474 if (useComplexRelations){
476 const auto& xH2O = Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx,
H2OIdx));
477 const auto& xN2 = Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx,
N2Idx));
484 return lambdaN2 + lambdaH2O;
492 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
497 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
498 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
499 const auto& xAlphaH2O = Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx,
H2OIdx));
500 const auto& xAlphaN2 = Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx,
N2Idx));
501 const auto& XAlphaH2O = Opm::decay<LhsEval>(fluidState.massFraction(phaseIdx,
H2OIdx));
502 const auto& XAlphaN2 = Opm::decay<LhsEval>(fluidState.massFraction(phaseIdx,
N2Idx));
515 if (useComplexRelations) {
535 return XAlphaH2O*c_pH2O + XAlphaN2*c_pN2;
Material properties of pure water .
Definition: H2O.hpp:61
static const char * name()
A human readable name for nitrogen.
Definition: N2.hpp:56
static Evaluation henry(const Evaluation &temperature)
Henry coefficent for molecular nitrogen in liquid water.
Definition: H2O_N2.hpp:52
static Evaluation liquidDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of liquid at a given pressure and temperature .
Definition: TabulatedComponent.hpp:435
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the liquid .
Definition: TabulatedComponent.hpp:290
static bool isIdealGas(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: H2ON2FluidSystem.hpp:116
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: H2ON2FluidSystem.hpp:428
static Evaluation liquidHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of the liquid .
Definition: TabulatedComponent.hpp:324
static Scalar molarMass()
The molar mass in of the component.
Definition: TabulatedComponent.hpp:224
static const char * phaseName(unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition: H2ON2FluidSystem.hpp:86
static const int N2Idx
The component index of molecular nitrogen.
Definition: H2ON2FluidSystem.hpp:146
A simple version of pure water.
static LhsEval diffusionCoefficient(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: H2ON2FluidSystem.hpp:408
Relations valid for an ideal gas.
SimpleN2 N2
The component for pure nitrogen.
Definition: H2ON2FluidSystem.hpp:154
Properties of pure molecular nitrogen .
Definition: N2.hpp:48
static LhsEval heatCapacity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Specific isobaric heat capacity of a fluid phase [J/kg].
Definition: H2ON2FluidSystem.hpp:493
static const char * componentName(unsigned compIdx)
Return the human readable name of a component.
Definition: H2ON2FluidSystem.hpp:157
static LhsEval viscosity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: H2ON2FluidSystem.hpp:323
static const int gasPhaseIdx
Index of the gas phase.
Definition: H2ON2FluidSystem.hpp:83
static Scalar molarMass(unsigned compIdx)
Return the molar mass of a component in [kg/mol].
Definition: H2ON2FluidSystem.hpp:169
static const Scalar acentricFactor()
The acentric factor of water.
Definition: H2O.hpp:86
static const int H2OIdx
The component index of water.
Definition: H2ON2FluidSystem.hpp:144
static bool isLiquid(unsigned phaseIdx)
Return whether a phase is liquid.
Definition: H2ON2FluidSystem.hpp:98
static const int liquidPhaseIdx
Index of the liquid phase.
Definition: H2ON2FluidSystem.hpp:81
static Evaluation liquidDiffCoeff(const Evaluation &temperature, const Evaluation &)
Diffusion coefficent for molecular nitrogen in liquid water.
Definition: H2O_N2.hpp:102
static void init()
Initialize the fluid system's static parameters.
Definition: H2ON2FluidSystem.hpp:231
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition: N2.hpp:302
static Scalar criticalPressure()
Returns the critical pressure of molecular nitrogen.
Definition: N2.hpp:74
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &)
Specific isobaric heat capacity of pure nitrogen gas.
Definition: N2.hpp:234
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of gas at a given pressure and temperature.
Definition: N2.hpp:135
Definition: Air_Mesitylene.hpp:33
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of pure nitrogen gas.
Definition: N2.hpp:176
static LhsEval density(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: H2ON2FluidSystem.hpp:269
A parameter cache which does nothing.
Material properties of pure water .
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of gas.
Definition: TabulatedComponent.hpp:452
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of gas at a given pressure and temperature .
Definition: TabulatedComponent.hpp:417
A central place for various physical constants occuring in some equations.
Definition: Constants.hpp:40
A two-phase fluid system with water and nitrogen as components.
Definition: H2ON2FluidSystem.hpp:56
static Scalar criticalPressure(unsigned compIdx)
Critical pressure of a component [Pa].
Definition: H2ON2FluidSystem.hpp:198
Relations valid for an ideal gas.
Definition: IdealGas.hpp:37
static Evaluation liquidThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
The thermal conductivity of liquid water .
Definition: TabulatedComponent.hpp:503
static Scalar acentricFactor(unsigned compIdx)
The acentric factor of a component [].
Definition: H2ON2FluidSystem.hpp:212
static const char * name()
A human readable name for the component.
Definition: TabulatedComponent.hpp:218
static Evaluation vaporPressure(const Evaluation &temperature)
The vapor pressure in of the component at a given temperature.
Definition: TabulatedComponent.hpp:258
static Scalar molarMass()
The molar mass in of molecular nitrogen.
Definition: N2.hpp:62
static const int numComponents
Number of chemical species in the fluid system.
Definition: H2ON2FluidSystem.hpp:141
static Scalar criticalPressure()
Returns the critical pressure in of the component.
Definition: TabulatedComponent.hpp:236
static Scalar criticalTemperature(unsigned compIdx)
Critical temperature of a component [K].
Definition: H2ON2FluidSystem.hpp:184
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &)
The dynamic viscosity of at a given pressure and temperature.
Definition: N2.hpp:266
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of the gas .
Definition: TabulatedComponent.hpp:307
static Scalar criticalTemperature()
Returns the critical temperature in of the component.
Definition: TabulatedComponent.hpp:230
static LhsEval thermalConductivity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Thermal conductivity of a fluid phase [W/(m K)].
Definition: H2ON2FluidSystem.hpp:460
Properties of pure molecular nitrogen .
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: H2ON2FluidSystem.hpp:381
A generic class which tabulates all thermodynamic properties of a given component.
The base class for all fluid systems.
Definition: BaseFluidSystem.hpp:43
A generic class which tabulates all thermodynamic properties of a given component.
Definition: TabulatedComponent.hpp:58
static bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: H2ON2FluidSystem.hpp:127
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 bool isCompressible(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: H2ON2FluidSystem.hpp:105
static Evaluation gasDiffCoeff(const Evaluation &temperature, const Evaluation &pressure)
Binary diffusion coefficent for molecular water and nitrogen.
Definition: H2O_N2.hpp:70
A parameter cache which does nothing.
Definition: NullParameterCache.hpp:39
TabulatedH2O H2O
The component for pure water.
Definition: H2ON2FluidSystem.hpp:149
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: H2ON2FluidSystem.hpp:252
Scalar Scalar
The type used for scalar quantities.
Definition: BaseFluidSystem.hpp:49
static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, Scalar pressMin, Scalar pressMax, unsigned nPress)
Initialize the tables.
Definition: TabulatedComponent.hpp:75
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: N2.hpp:150
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the gas .
Definition: TabulatedComponent.hpp:273
static Scalar criticalTemperature()
Returns the critical temperature of molecular nitrogen.
Definition: N2.hpp:68
static const int numPhases
Number of fluid phases in the fluid system.
Definition: H2ON2FluidSystem.hpp:78
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: TabulatedComponent.hpp:405
static Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of liquid.
Definition: TabulatedComponent.hpp:469
static Evaluation gasThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
The thermal conductivity of gaseous water .
Definition: TabulatedComponent.hpp:486
The base class for all fluid systems.
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: TabulatedComponent.hpp:399
Binary coefficients for water and nitrogen.