27 #ifndef OPM_H2O_N2_FLUID_SYSTEM_HPP 28 #define OPM_H2O_N2_FLUID_SYSTEM_HPP 42 #include <string_view> 51 template <
class Scalar>
59 typedef ::Opm::IdealGas<Scalar>
IdealGas;
66 template <
class Evaluation>
82 static std::string_view
phaseName(
unsigned phaseIdx)
84 static const std::string_view name[] = {
90 return name[phaseIdx];
155 static const std::string_view name[] = {
161 return name[compIdx];
168 return (compIdx ==
H2OIdx)
182 return (compIdx ==
H2OIdx)
196 return (compIdx ==
H2OIdx)
210 return (compIdx ==
H2OIdx)
251 if (H2O::isTabulated) {
253 pressMin, pressMax, nPress);
260 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::ValueType,
class ParamCacheEval = LhsEval>
261 static LhsEval
density(
const FluidState& fluidState,
267 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
268 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
270 LhsEval sumMoleFrac = 0;
271 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx)
272 sumMoleFrac += decay<LhsEval>(fluidState.moleFraction(phaseIdx, compIdx));
290 const auto& xgH2O = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
H2OIdx));
291 const auto& xgN2 = decay<LhsEval>(fluidState.moleFraction(
gasPhaseIdx,
N2Idx));
294 return (rho_gH2O + rho_gN2)/max(1e-5, sumMoleFrac);
298 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::ValueType,
class ParamCacheEval = LhsEval>
305 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
306 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
322 LhsEval muResult = 0;
329 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx)
330 sumx += decay<LhsEval>(fluidState.moleFraction(phaseIdx, compIdx));
331 sumx = max(1e-10, sumx);
340 decay<LhsEval>(fluidState.moleFraction(phaseIdx, j))
344 decay<LhsEval>(fluidState.moleFraction(phaseIdx, i))
351 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::ValueType,
class ParamCacheEval = LhsEval>
360 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
361 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
378 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::ValueType,
class ParamCacheEval = LhsEval>
385 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
386 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
398 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::ValueType,
class ParamCacheEval = LhsEval>
399 static LhsEval
enthalpy(
const FluidState& fluidState,
403 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
404 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
405 Valgrind::CheckDefined(T);
406 Valgrind::CheckDefined(p);
419 const auto& XgH2O = decay<LhsEval>(fluidState.massFraction(
gasPhaseIdx,
H2OIdx));
420 const auto& XgN2 = decay<LhsEval>(fluidState.massFraction(
gasPhaseIdx,
N2Idx));
428 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::ValueType,
class ParamCacheEval = LhsEval>
435 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
436 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
444 const auto& xH2O = decay<LhsEval>(fluidState.moleFraction(phaseIdx,
H2OIdx));
445 const auto& xN2 = decay<LhsEval>(fluidState.moleFraction(phaseIdx,
N2Idx));
452 return lambdaN2 + lambdaH2O;
456 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::ValueType,
class ParamCacheEval = LhsEval>
461 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
462 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
463 const auto& xAlphaH2O = decay<LhsEval>(fluidState.moleFraction(phaseIdx,
H2OIdx));
464 const auto& xAlphaN2 = decay<LhsEval>(fluidState.moleFraction(phaseIdx,
N2Idx));
465 const auto& XAlphaH2O = decay<LhsEval>(fluidState.massFraction(phaseIdx,
H2OIdx));
466 const auto& XAlphaN2 = decay<LhsEval>(fluidState.massFraction(phaseIdx,
N2Idx));
482 return XAlphaH2O*c_pH2O + XAlphaN2*c_pN2;
Material properties of pure water .
Definition: H2O.hpp:64
static std::string_view name()
A human readable name for the component.
Definition: TabulatedComponent.hpp:328
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:564
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the liquid .
Definition: TabulatedComponent.hpp:414
static Evaluation liquidHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of the liquid .
Definition: TabulatedComponent.hpp:450
static Scalar molarMass()
The molar mass in of the component.
Definition: TabulatedComponent.hpp:334
A simple version of pure water.
Relations valid for an ideal gas.
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:248
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:379
Properties of pure molecular nitrogen .
Definition: N2.hpp:49
static bool isIdealGas(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: H2ON2FluidSystem.hpp:112
static const int gasPhaseIdx
Index of the gas phase.
Definition: H2ON2FluidSystem.hpp:79
static LhsEval heatCapacity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Specific isobaric heat capacity of a fluid phase [J/kg].
Definition: H2ON2FluidSystem.hpp:457
static Evaluation liquidDiffCoeff(const Evaluation &temperature, const Evaluation &)
Diffusion coefficent for molecular nitrogen in liquid water.
Definition: H2O_N2.hpp:102
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition: N2.hpp:304
static Scalar criticalPressure()
Returns the critical pressure of molecular nitrogen.
Definition: N2.hpp:75
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &)
Specific isobaric heat capacity of pure nitrogen gas.
Definition: N2.hpp:237
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of gas at a given pressure and temperature.
Definition: N2.hpp:146
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of pure nitrogen gas.
Definition: N2.hpp:187
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:582
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of gas at a given pressure and temperature .
Definition: TabulatedComponent.hpp:545
static Scalar criticalTemperature(unsigned compIdx)
Critical temperature of a component [K].
Definition: H2ON2FluidSystem.hpp:180
static Scalar criticalPressure(unsigned compIdx)
Critical pressure of a component [Pa].
Definition: H2ON2FluidSystem.hpp:194
Relations valid for an ideal gas.
Definition: IdealGas.hpp:38
static Evaluation liquidThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
The thermal conductivity of liquid water .
Definition: TabulatedComponent.hpp:636
static LhsEval density(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: H2ON2FluidSystem.hpp:261
static Evaluation vaporPressure(const Evaluation &temperature)
The vapor pressure in of the component at a given temperature.
Definition: TabulatedComponent.hpp:380
static Scalar molarMass()
The molar mass in of molecular nitrogen.
Definition: N2.hpp:63
static std::string_view componentName(unsigned compIdx)
Return the human readable name of a component.
Definition: H2ON2FluidSystem.hpp:153
static Scalar criticalPressure()
Returns the critical pressure in of the component.
Definition: TabulatedComponent.hpp:346
static const int numPhases
Number of fluid phases in the fluid system.
Definition: H2ON2FluidSystem.hpp:74
static Scalar acentricFactor(unsigned compIdx)
The acentric factor of a component [].
Definition: H2ON2FluidSystem.hpp:208
static Evaluation gasViscosity(const Evaluation &temperature, const Evaluation &)
The dynamic viscosity of at a given pressure and temperature.
Definition: N2.hpp:268
static Evaluation gasHeatCapacity(const Evaluation &temperature, const Evaluation &pressure)
Specific isobaric heat capacity of the gas .
Definition: TabulatedComponent.hpp:432
static std::string_view phaseName(unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition: H2ON2FluidSystem.hpp:82
static Scalar criticalTemperature()
Returns the critical temperature in of the component.
Definition: TabulatedComponent.hpp:340
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:352
static LhsEval thermalConductivity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Thermal conductivity of a fluid phase [W/(m K)].
Definition: H2ON2FluidSystem.hpp:429
Properties of pure molecular nitrogen .
A generic class which tabulates all thermodynamic properties of a given component.
The base class for all fluid systems.
Definition: BaseFluidSystem.hpp:42
static Scalar acentricFactor()
Returns the acentric factor of the component.
Definition: TabulatedComponent.hpp:352
A generic class which tabulates all thermodynamic properties of a given component.
Definition: TabulatedComponent.hpp:138
TabulatedH2O H2O
The component for pure water.
Definition: H2ON2FluidSystem.hpp:145
static Scalar acentricFactor()
Acentric factor of .
Definition: N2.hpp:86
static LhsEval viscosity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: H2ON2FluidSystem.hpp:299
SimpleN2 N2
The component for pure nitrogen.
Definition: H2ON2FluidSystem.hpp:150
A two-phase fluid system with water and nitrogen as components.
Definition: H2ON2FluidSystem.hpp:52
static Evaluation gasDiffCoeff(const Evaluation &temperature, const Evaluation &pressure)
Binary diffusion coefficent for molecular water and nitrogen.
Definition: H2O_N2.hpp:70
static bool isCompressible(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: H2ON2FluidSystem.hpp:101
A parameter cache which does nothing.
Definition: NullParameterCache.hpp:39
static bool isLiquid(unsigned phaseIdx)
Return whether a phase is liquid.
Definition: H2ON2FluidSystem.hpp:94
static Scalar molarMass(unsigned compIdx)
Return the molar mass of a component in [kg/mol].
Definition: H2ON2FluidSystem.hpp:165
Some templates to wrap the valgrind client request macros.
static void init()
Initialize the fluid system's static parameters.
Definition: H2ON2FluidSystem.hpp:227
Scalar Scalar
The type used for scalar quantities.
Definition: BaseFluidSystem.hpp:48
static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, Scalar pressMin, Scalar pressMax, unsigned nPress)
Initialize the tables.
Definition: TabulatedComponent.hpp:155
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: N2.hpp:161
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &pressure)
Specific enthalpy of the gas .
Definition: TabulatedComponent.hpp:396
static Scalar criticalTemperature()
Returns the critical temperature of molecular nitrogen.
Definition: N2.hpp:69
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: TabulatedComponent.hpp:534
static const int N2Idx
The component index of molecular nitrogen.
Definition: H2ON2FluidSystem.hpp:142
static Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of liquid.
Definition: TabulatedComponent.hpp:600
static const int H2OIdx
The component index of water.
Definition: H2ON2FluidSystem.hpp:140
static const int numComponents
Number of chemical species in the fluid system.
Definition: H2ON2FluidSystem.hpp:137
static Evaluation gasThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
The thermal conductivity of gaseous water .
Definition: TabulatedComponent.hpp:618
static const int liquidPhaseIdx
Index of the liquid phase.
Definition: H2ON2FluidSystem.hpp:77
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:399
The base class for all fluid systems.
static bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: H2ON2FluidSystem.hpp:123
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: TabulatedComponent.hpp:528
Binary coefficients for water and nitrogen.
static std::string_view name()
A human readable name for nitrogen.
Definition: N2.hpp:57