26 #ifndef OPM_TWO_PHASE_IMMISCIBLE_FLUID_SYSTEM_HPP
27 #define OPM_TWO_PHASE_IMMISCIBLE_FLUID_SYSTEM_HPP
40 namespace FluidSystems {
55 template <
class Scalar,
class WettingPhase,
class NonwettingPhase>
57 :
public BaseFluidSystem<Scalar, TwoPhaseImmiscible<Scalar, WettingPhase, NonwettingPhase> >
84 assert(0 <= phaseIdx && phaseIdx < numPhases);
86 static const char *name[] = {
90 return name[phaseIdx];
98 (phaseIdx == wettingPhaseIdx)
99 ? WettingPhase::isLiquid()
100 : NonwettingPhase::isLiquid();
109 (phaseIdx == wettingPhaseIdx)
110 ? WettingPhase::isCompressible()
111 : NonwettingPhase::isCompressible();
121 (phaseIdx == wettingPhaseIdx)
122 ? WettingPhase::isIdealGas()
123 : NonwettingPhase::isIdealGas();
150 assert(0 <= compIdx && compIdx < numComponents);
152 if (compIdx == wettingCompIdx)
153 return WettingPhase::name();
154 return NonwettingPhase::name();
164 (compIdx == wettingCompIdx)
165 ? WettingPhase::molarMass()
166 : NonwettingPhase::molarMass();
177 (compIdx == wettingCompIdx)
178 ? WettingPhase::criticalTemperature()
179 : NonwettingPhase::criticalTemperature();
190 (compIdx == wettingCompIdx)
191 ? WettingPhase::criticalPressure()
192 : NonwettingPhase::criticalPressure();
203 (compIdx == wettingCompIdx)
204 ? WettingPhase::acentricFactor()
205 : NonwettingPhase::acentricFactor();
217 assert(WettingPhase::isLiquid() || NonwettingPhase::isLiquid());
221 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
222 static LhsEval
density(
const FluidState &fluidState,
223 const ParameterCache &,
228 assert(0 <= phaseIdx && phaseIdx < numPhases);
230 const auto& temperature = FsToolbox::template toLhs<LhsEval>(fluidState.temperature(phaseIdx));
231 const auto& pressure = FsToolbox::template toLhs<LhsEval>(fluidState.pressure(phaseIdx));
232 if (phaseIdx == wettingPhaseIdx)
233 return WettingPhase::density(temperature, pressure);
234 return NonwettingPhase::density(temperature, pressure);
238 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
240 const ParameterCache &,
245 assert(0 <= phaseIdx && phaseIdx < numPhases);
247 const auto& temperature = FsToolbox::template toLhs<LhsEval>(fluidState.temperature(phaseIdx));
248 const auto& pressure = FsToolbox::template toLhs<LhsEval>(fluidState.pressure(phaseIdx));
249 if (phaseIdx == wettingPhaseIdx)
250 return WettingPhase::viscosity(temperature, pressure);
251 return NonwettingPhase::viscosity(temperature, pressure);
255 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
257 const ParameterCache &,
263 assert(0 <= phaseIdx && phaseIdx < numPhases);
264 assert(0 <= compIdx && compIdx < numComponents);
266 if (phaseIdx == compIdx)
271 return LhsToolbox::createConstant(1.0);
272 return LhsToolbox::createConstant(std::numeric_limits<Scalar>::infinity());
276 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
277 static LhsEval
enthalpy(
const FluidState &fluidState,
278 const ParameterCache &,
283 assert(0 <= phaseIdx && phaseIdx < numPhases);
285 const auto& temperature = FsToolbox::template toLhs<LhsEval>(fluidState.temperature(phaseIdx));
286 const auto& pressure = FsToolbox::template toLhs<LhsEval>(fluidState.pressure(phaseIdx));
287 if (phaseIdx == wettingPhaseIdx)
288 return WettingPhase::enthalpy(temperature, pressure);
289 return NonwettingPhase::enthalpy(temperature, pressure);
293 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
295 const ParameterCache &,
300 assert(0 <= phaseIdx && phaseIdx < numPhases);
302 const auto& temperature = FsToolbox::template toLhs<LhsEval>(fluidState.temperature(phaseIdx));
303 const auto& pressure = FsToolbox::template toLhs<LhsEval>(fluidState.pressure(phaseIdx));
304 if (phaseIdx == wettingPhaseIdx)
305 return WettingPhase::thermalConductivity(temperature, pressure);
306 return NonwettingPhase::thermalConductivity(temperature, pressure);
310 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
312 const ParameterCache &,
317 assert(0 <= phaseIdx && phaseIdx < numPhases);
319 const auto& temperature = FsToolbox::template toLhs<LhsEval>(fluidState.temperature(phaseIdx));
320 const auto& pressure = FsToolbox::template toLhs<LhsEval>(fluidState.pressure(phaseIdx));
321 if (phaseIdx == wettingPhaseIdx)
322 return WettingPhase::heatCapacity(temperature, pressure);
323 return NonwettingPhase::heatCapacity(temperature, pressure);
static LhsEval thermalConductivity(const FluidState &fluidState, const ParameterCache &, unsigned phaseIdx)
Thermal conductivity of a fluid phase [W/(m K)].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:294
static const char * componentName(unsigned compIdx)
Return the human readable name of a component.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:148
static const int nonWettingCompIdx
Index of the non-wetting phase's component.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:145
Definition: Air_Mesitylene.hpp:31
A parameter cache which does nothing.
static bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:127
static Scalar criticalPressure(unsigned compIdx)
Critical pressure of a component [Pa].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:185
Represents the liquid phase of a single (pseudo-) component.
The base class for all fluid systems.
Definition: BaseFluidSystem.hpp:43
A parameter cache which does nothing.
Definition: NullParameterCache.hpp:36
NullParameterCache ParameterCache
The type of the fluid system's parameter cache.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:67
static const int numPhases
Number of fluid phases in the fluid system.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:74
static const char * phaseName(unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:82
Represents the gas phase of a single (pseudo-) component.
static LhsEval enthalpy(const FluidState &fluidState, const ParameterCache &, unsigned phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy [J/kg...
Definition: TwoPhaseImmiscibleFluidSystem.hpp:277
static LhsEval density(const FluidState &fluidState, const ParameterCache &, unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:222
static bool isCompressible(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:104
static LhsEval fugacityCoefficient(const FluidState &, const ParameterCache &, unsigned phaseIdx, unsigned compIdx)
Calculate the fugacity coefficient [Pa] of an individual component in a fluid phase.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:256
static LhsEval viscosity(const FluidState &fluidState, const ParameterCache &, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:239
static Scalar acentricFactor(unsigned compIdx)
The acentric factor of a component [].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:198
static const int wettingPhaseIdx
Index of the wetting phase.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:77
static LhsEval heatCapacity(const FluidState &fluidState, const ParameterCache &, unsigned phaseIdx)
Specific isobaric heat capacity of a fluid phase [J/kg].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:311
static Scalar criticalTemperature(unsigned compIdx)
Critical temperature of a component [K].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:172
static bool isIdealGas(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:115
static void init()
Initialize the fluid system's static parameters.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:213
static bool isLiquid(unsigned phaseIdx)
Return whether a phase is liquid.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:94
static const int numComponents
Number of chemical species in the fluid system.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:140
The base class for all fluid systems.
A fluid system for two-phase models assuming immiscibility and thermodynamic equilibrium.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:56
static Scalar molarMass(unsigned compIdx)
Return the molar mass of a component in [kg/mol].
Definition: TwoPhaseImmiscibleFluidSystem.hpp:158
static const int nonWettingPhaseIdx
Index of the non-wetting phase.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:79
Represents all relevant thermodynamic quantities of a multi-phase, multi-component fluid system assum...
static const int wettingCompIdx
Index of the wetting phase's component.
Definition: TwoPhaseImmiscibleFluidSystem.hpp:143