27 #ifndef OPM_TWO_PHASE_IMMISCIBLE_FLUID_SYSTEM_HPP
28 #define OPM_TWO_PHASE_IMMISCIBLE_FLUID_SYSTEM_HPP
55 template <
class Scalar,
class WettingPhase,
class NonwettingPhase>
57 :
public BaseFluidSystem<Scalar, TwoPhaseImmiscibleFluidSystem<Scalar, WettingPhase, NonwettingPhase> >
67 template <
class Evaluation>
88 static const char* name[] = {
92 return name[phaseIdx];
101 ? WettingPhase::isLiquid()
102 : NonwettingPhase::isLiquid();
112 ? WettingPhase::isCompressible()
113 : NonwettingPhase::isCompressible();
124 ? WettingPhase::isIdealGas()
125 : NonwettingPhase::isIdealGas();
155 return WettingPhase::name();
156 return NonwettingPhase::name();
167 ? WettingPhase::molarMass()
168 : NonwettingPhase::molarMass();
180 ? WettingPhase::criticalTemperature()
181 : NonwettingPhase::criticalTemperature();
193 ? WettingPhase::criticalPressure()
194 : NonwettingPhase::criticalPressure();
206 ? WettingPhase::acentricFactor()
207 : NonwettingPhase::acentricFactor();
219 assert(WettingPhase::isLiquid() || NonwettingPhase::isLiquid());
223 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
224 static LhsEval
density(
const FluidState& fluidState,
230 const auto& temperature = decay<LhsEval>(fluidState.temperature(phaseIdx));
231 const auto& pressure = decay<LhsEval>(fluidState.pressure(phaseIdx));
233 return WettingPhase::density(temperature, pressure);
234 return NonwettingPhase::density(temperature, pressure);
238 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
245 const auto& temperature = decay<LhsEval>(fluidState.temperature(phaseIdx));
246 const auto& pressure = decay<LhsEval>(fluidState.pressure(phaseIdx));
248 return WettingPhase::viscosity(temperature, pressure);
249 return NonwettingPhase::viscosity(temperature, pressure);
253 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
262 if (phaseIdx == compIdx)
268 return std::numeric_limits<Scalar>::infinity();
272 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
273 static LhsEval
enthalpy(
const FluidState& fluidState,
279 const auto& temperature = decay<LhsEval>(fluidState.temperature(phaseIdx));
280 const auto& pressure = decay<LhsEval>(fluidState.pressure(phaseIdx));
282 return WettingPhase::enthalpy(temperature, pressure);
283 return NonwettingPhase::enthalpy(temperature, pressure);
287 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
294 const auto& temperature = decay<LhsEval>(fluidState.temperature(phaseIdx));
295 const auto& pressure = decay<LhsEval>(fluidState.pressure(phaseIdx));
297 return WettingPhase::thermalConductivity(temperature, pressure);
298 return NonwettingPhase::thermalConductivity(temperature, pressure);
302 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
309 const auto& temperature = decay<LhsEval>(fluidState.temperature(phaseIdx));
310 const auto& pressure = decay<LhsEval>(fluidState.pressure(phaseIdx));
312 return WettingPhase::heatCapacity(temperature, pressure);
313 return NonwettingPhase::heatCapacity(temperature, pressure);
The base class for all fluid systems.
Represents the gas phase of a single (pseudo-) component.
Represents all relevant thermodynamic quantities of a multi-phase, multi-component fluid system assum...
Represents the liquid phase of a single (pseudo-) component.
A parameter cache which does nothing.
The base class for all fluid systems.
Definition: BaseFluidSystem.hpp:44
Scalar Scalar
The type used for scalar quantities.
Definition: BaseFluidSystem.hpp:49
A parameter cache which does nothing.
Definition: NullParameterCache.hpp:40
A fluid system for two-phase models assuming immiscibility and thermodynamic equilibrium.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:58
static bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:129
static Scalar acentricFactor(unsigned compIdx)
The acentric factor of a component [].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:200
static LhsEval thermalConductivity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Thermal conductivity of a fluid phase [W/(m K)].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:288
static void init()
Initialize the fluid system's static parameters.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:215
static bool isLiquid(unsigned phaseIdx)
Return whether a phase is liquid.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:96
static const char * componentName(unsigned compIdx)
Return the human readable name of a component.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:150
static const char * phaseName(unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:84
static LhsEval fugacityCoefficient(const FluidState &, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx, unsigned compIdx)
Calculate the fugacity coefficient [Pa] of an individual component in a fluid phase.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:254
static Scalar molarMass(unsigned compIdx)
Return the molar mass of a component in [kg/mol].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:160
static bool isIdealGas(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:117
static const int numPhases
Number of fluid phases in the fluid system.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:76
static const int wettingCompIdx
Index of the wetting phase's component.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:145
static const int nonWettingCompIdx
Index of the non-wetting phase's component.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:147
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: TwoPhaseImmiscibleFluidSystem.hpp:273
static LhsEval viscosity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:239
static Scalar criticalTemperature(unsigned compIdx)
Critical temperature of a component [K].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:174
static LhsEval heatCapacity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Specific isobaric heat capacity of a fluid phase [J/kg].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:303
static const int nonWettingPhaseIdx
Index of the non-wetting phase.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:81
static const int numComponents
Number of chemical species in the fluid system.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:142
static LhsEval density(const FluidState &fluidState, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:224
static const int wettingPhaseIdx
Index of the wetting phase.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:79
static Scalar criticalPressure(unsigned compIdx)
Critical pressure of a component [Pa].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:187
static bool isCompressible(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:106
Definition: TwoPhaseImmiscibleFluidSystem.hpp:69