27 #ifndef OPM_H2O_N2_LIQUIDPHASE_FLUID_SYSTEM_HPP
28 #define OPM_H2O_N2_LIQUIDPHASE_FLUID_SYSTEM_HPP
39 #include <opm/common/Valgrind.hpp>
41 #include <opm/common/Exceptions.hpp>
42 #include <opm/common/ErrorMacros.hpp>
48 namespace FluidSystems {
56 template <
class Scalar,
bool useComplexRelations = true>
58 :
public BaseFluidSystem<Scalar, H2ON2LiquidPhase<Scalar, useComplexRelations> >
70 template <
class Evaluation>
85 static const char*
phaseName(
unsigned phaseIdx OPM_OPTIM_UNUSED)
147 static const char* name[] = {
153 return name[compIdx];
160 return (compIdx ==
H2OIdx)
175 return (compIdx ==
H2OIdx)
190 return (compIdx ==
H2OIdx)
205 return (compIdx ==
H2OIdx)
208 ? N2::acentricFactor()
246 if (H2O::isTabulated) {
248 pressMin, pressMax, nPress);
253 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
254 static LhsEval
density(
const FluidState& fluidState,
258 assert(0 <= phaseIdx && phaseIdx <
numPhases);
260 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
261 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
263 LhsEval sumMoleFrac = 0;
264 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx)
265 sumMoleFrac += Opm::decay<LhsEval>(fluidState.moleFraction(phaseIdx, compIdx));
269 if (!useComplexRelations)
288 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
295 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
296 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
303 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
312 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
313 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
321 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
330 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
331 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
337 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
338 static LhsEval
enthalpy(
const FluidState& fluidState,
344 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
345 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
346 Valgrind::CheckDefined(T);
347 Valgrind::CheckDefined(p);
354 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
357 const unsigned phaseIdx)
361 if(useComplexRelations){
362 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
363 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
371 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
378 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
379 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
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 LhsEval heatCapacity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Specific isobaric heat capacity of a fluid phase [J/kg].
Definition: H2ON2LiquidPhaseFluidSystem.hpp:372
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
A simple version of pure water.
Relations valid for an ideal gas.
TabulatedH2O H2O
The type of the component for pure water.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:137
static void init()
Initialize the fluid system's static parameters.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:222
Properties of pure molecular nitrogen .
Definition: N2.hpp:48
static LhsEval density(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:254
static const char * componentName(unsigned compIdx)
Return the human readable name of a component.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:145
static const Scalar acentricFactor()
The acentric factor of water.
Definition: H2O.hpp:86
static Scalar criticalTemperature(unsigned compIdx)
Critical temperature of a component [K].
Definition: H2ON2LiquidPhaseFluidSystem.hpp:172
static Evaluation liquidDiffCoeff(const Evaluation &temperature, const Evaluation &)
Diffusion coefficent for molecular nitrogen in liquid water.
Definition: H2O_N2.hpp:102
static Scalar acentricFactor(unsigned compIdx)
The acentric factor of a component [].
Definition: H2ON2LiquidPhaseFluidSystem.hpp:202
static bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:115
static Scalar criticalPressure()
Returns the critical pressure of molecular nitrogen.
Definition: N2.hpp:74
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: H2ON2LiquidPhaseFluidSystem.hpp:304
static const int N2Idx
The index of the component for molecular nitrogen.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:134
static const int liquidPhaseIdx
Index of the liquid phase.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:82
A parameter cache which does nothing.
Material properties 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: H2ON2LiquidPhaseFluidSystem.hpp:322
The type of the fluid system's parameter cache.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:71
static Evaluation liquidThermalConductivity(const Evaluation &temperature, const Evaluation &pressure)
The thermal conductivity of liquid water .
Definition: TabulatedComponent.hpp:503
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 bool isLiquid(unsigned)
Return whether a phase is liquid.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:93
static Scalar criticalPressure()
Returns the critical pressure in of the component.
Definition: TabulatedComponent.hpp:236
static const char * phaseName(unsigned phaseIdx OPM_OPTIM_UNUSED)
Return the human readable name of a fluid phase.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:85
static Scalar criticalTemperature()
Returns the critical temperature in of the component.
Definition: TabulatedComponent.hpp:230
A liquid-phase-only fluid system with water and nitrogen as components.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:57
static LhsEval thermalConductivity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, const unsigned phaseIdx)
Thermal conductivity of a fluid phase [W/(m K)].
Definition: H2ON2LiquidPhaseFluidSystem.hpp:355
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: H2ON2LiquidPhaseFluidSystem.hpp:243
static const int numComponents
Number of chemical species in the fluid system.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:129
Properties of pure molecular nitrogen .
A generic class which tabulates all thermodynamic properties of a given component.
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: H2ON2LiquidPhaseFluidSystem.hpp:338
The base class for all fluid systems.
Definition: BaseFluidSystem.hpp:43
static LhsEval viscosity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: H2ON2LiquidPhaseFluidSystem.hpp:289
SimpleN2 N2
The type of the component for pure molecular nitrogen.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:142
static bool isCompressible(unsigned)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:100
A generic class which tabulates all thermodynamic properties of a given component.
Definition: TabulatedComponent.hpp:58
static bool isIdealGas(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:108
A parameter cache which does nothing.
Definition: NullParameterCache.hpp:39
static const int H2OIdx
The index of the water component.
Definition: H2ON2LiquidPhaseFluidSystem.hpp:132
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 Scalar criticalPressure(unsigned compIdx)
Critical pressure of a component [Pa].
Definition: H2ON2LiquidPhaseFluidSystem.hpp:187
static Scalar molarMass(unsigned compIdx)
Return the molar mass of a component in [kg/mol].
Definition: H2ON2LiquidPhaseFluidSystem.hpp:157
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: H2ON2LiquidPhaseFluidSystem.hpp:79
static Evaluation liquidViscosity(const Evaluation &temperature, const Evaluation &pressure)
The dynamic viscosity of liquid.
Definition: TabulatedComponent.hpp:469
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.