12#ifndef DUMUX_2P_IMMISCIBLE_FLUID_SYSTEM_HH
13#define DUMUX_2P_IMMISCIBLE_FLUID_SYSTEM_HH
18#include <dune/common/exceptions.hh>
29namespace FluidSystems {
44template <
class Scalar,
class Flu
id0,
class Flu
id1>
46:
public Base<Scalar, TwoPImmiscible<Scalar, Fluid0, Fluid1> >
48 static_assert((Fluid0::numPhases == 1),
"Fluid0 has more than one phase");
49 static_assert((Fluid1::numPhases == 1),
"Fluid1 has more than one phase");
50 static_assert((Fluid0::numComponents == 1),
"Fluid0 has more than one component");
51 static_assert((Fluid1::numComponents == 1),
"Fluid1 has more than one component");
53 static_assert(!Fluid0::isGas() || !Fluid1::isGas(),
"One phase has to be a liquid!");
75 assert(0 <= phaseIdx && phaseIdx <
numPhases);
77 if (!Fluid0::isGas() && !Fluid1::isGas())
83 return (phaseIdx ==
phase0Idx) ? name0 : name1;
85 return (phaseIdx ==
phase0Idx) ? name0 +
"_0" : name1 +
"_1";
106 static constexpr bool isGas(
int phaseIdx)
108 assert(0 <= phaseIdx && phaseIdx <
numPhases);
111 return Fluid0::isGas();
112 return Fluid1::isGas();
130 assert(0 <= phaseIdx && phaseIdx <
numPhases);
144 assert(0 <= phaseIdx && phaseIdx <
numPhases);
148 return Fluid0::isIdealGas();
149 return Fluid1::isIdealGas();
163 assert(0 <= phaseIdx && phaseIdx <
numPhases);
167 return Fluid0::isCompressible();
168 return Fluid1::isCompressible();
178 assert(0 <= phaseIdx && phaseIdx <
numPhases);
182 return Fluid0::viscosityIsConstant();
183 return Fluid1::viscosityIsConstant();
194 assert(0 <= phaseIdx && phaseIdx <
numPhases);
198 return Fluid0::isIdealFluid1();
199 return Fluid1::isIdealFluid1();
215 return Fluid0::name();
216 return Fluid1::name();
228 return Fluid0::molarMass();
229 return Fluid1::molarMass();
241 return Fluid0::criticalTemperature();
242 return Fluid1::criticalTemperature();
254 return Fluid0::criticalPressure();
255 return Fluid1::criticalPressure();
267 return Fluid0::acentricFactor();
268 return Fluid1::acentricFactor();
281 init(273.15, 623.15, 100,
299 if (Fluid0::Component::isTabulated)
300 Fluid0::Component::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress);
302 if (Fluid1::Component::isTabulated)
303 Fluid1::Component::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress);
308 template <
class Flu
idState>
312 assert(0 <= phaseIdx && phaseIdx <
numPhases);
323 template <
class Flu
idState>
335 template <
class Flu
idState>
339 assert(0 <= phaseIdx && phaseIdx <
numPhases);
350 template <
class Flu
idState>
355 assert(0 <= phaseIdx && phaseIdx <
numPhases);
358 if (phaseIdx == compIdx)
364 return std::numeric_limits<Scalar>::infinity();
369 template <
class Flu
idState>
374 DUNE_THROW(Dune::InvalidStateException,
375 "Diffusion coefficients of components are meaningless if"
376 " immiscibility is assumed");
381 template <
class Flu
idState>
388 DUNE_THROW(Dune::InvalidStateException,
389 "Binary diffusion coefficients of components are meaningless if"
390 " immiscibility is assumed");
395 template <
class Flu
idState>
399 assert(0 <= phaseIdx && phaseIdx <
numPhases);
410 template <
class Flu
idState>
414 assert(0 <= phaseIdx && phaseIdx <
numPhases);
425 template <
class Flu
idState>
429 assert(0 <= phaseIdx && phaseIdx <
numPhases);
A gaseous phase consisting of a single component.
A liquid phase consisting of a single component.
Fluid system base class.
Definition: fluidsystems/base.hh:33
Scalar Scalar
export the scalar type
Definition: fluidsystems/base.hh:36
A fluid system for two-phase models assuming immiscibility and thermodynamic equilibrium.
Definition: 2pimmiscible.hh:47
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIIdx, int compJIdx)
Given a phase's composition, temperature and pressure, return the binary diffusion coefficient for c...
Definition: 2pimmiscible.hh:382
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: 2pimmiscible.hh:73
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: 2pimmiscible.hh:210
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: 2pimmiscible.hh:161
static Scalar acentricFactor(int compIdx)
The acentric factor of a component .
Definition: 2pimmiscible.hh:262
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: 2pimmiscible.hh:396
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: 2pimmiscible.hh:99
static bool isIdealFluid1(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: 2pimmiscible.hh:192
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: 2pimmiscible.hh:411
static bool isIdealMixture(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: 2pimmiscible.hh:128
static void init(Scalar tempMin, Scalar tempMax, std::size_t nTemp, Scalar pressMin, Scalar pressMax, std::size_t nPress)
Initialize the fluid system's static parameters using problem specific temperature and pressure range...
Definition: 2pimmiscible.hh:296
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: 2pimmiscible.hh:336
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: 2pimmiscible.hh:351
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: 2pimmiscible.hh:370
static constexpr bool isIdealGas(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: 2pimmiscible.hh:142
static constexpr int comp0Idx
index of the first component
Definition: 2pimmiscible.hh:63
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: 2pimmiscible.hh:426
static constexpr int phase0Idx
index of the first phase
Definition: 2pimmiscible.hh:61
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: 2pimmiscible.hh:309
static constexpr bool viscosityIsConstant(int phaseIdx)
Returns true if the liquid phase viscostiy is constant.
Definition: 2pimmiscible.hh:176
static constexpr int numPhases
Number of phases in the fluid system.
Definition: 2pimmiscible.hh:58
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: 2pimmiscible.hh:324
static void init()
Initialize the fluid system's static parameters.
Definition: 2pimmiscible.hh:278
static Scalar criticalPressure(int compIdx)
Critical pressure of a component .
Definition: 2pimmiscible.hh:249
static Scalar criticalTemperature(int compIdx)
Critical temperature of a component .
Definition: 2pimmiscible.hh:236
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: 2pimmiscible.hh:106
static constexpr int comp1Idx
index of the second component
Definition: 2pimmiscible.hh:64
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: 2pimmiscible.hh:223
static constexpr int numComponents
Number of components in the fluid system.
Definition: 2pimmiscible.hh:59
static constexpr int phase1Idx
index of the second phase
Definition: 2pimmiscible.hh:62
Base class for all components Components provide the thermodynamic relations for the liquid,...
Represents all relevant thermodynamic quantities of a multi-phase fluid system assuming immiscibility...
A collection of input/output field names for common physical quantities.
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:39
std::string gaseousPhase() noexcept
I/O name of gaseous phase.
Definition: name.hh:111
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:62
std::string molarDensity(int phaseIdx) noexcept
I/O name of molar density for multiphase systems.
Definition: name.hh:71
std::string naplPhase() noexcept
I/O name of napl phase.
Definition: name.hh:119
std::string liquidPhase() noexcept
I/O name of liquid phase.
Definition: name.hh:107
std::string aqueousPhase() noexcept
I/O name of aqueous phase.
Definition: name.hh:115
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:22
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
IsAqueous struct.
Definition: components/base.hh:35