24#ifndef DUMUX_2P_IMMISCIBLE_FLUID_SYSTEM_HH
25#define DUMUX_2P_IMMISCIBLE_FLUID_SYSTEM_HH
30#include <dune/common/exceptions.hh>
41namespace FluidSystems {
56template <
class Scalar,
class Flu
id0,
class Flu
id1>
58:
public Base<Scalar, TwoPImmiscible<Scalar, Fluid0, Fluid1> >
60 static_assert((Fluid0::numPhases == 1),
"Fluid0 has more than one phase");
61 static_assert((Fluid1::numPhases == 1),
"Fluid1 has more than one phase");
62 static_assert((Fluid0::numComponents == 1),
"Fluid0 has more than one component");
63 static_assert((Fluid1::numComponents == 1),
"Fluid1 has more than one component");
65 static_assert(!Fluid0::isGas() || !Fluid1::isGas(),
"One phase has to be a liquid!");
88 assert(0 <= phaseIdx && phaseIdx <
numPhases);
90 if (!Fluid0::isGas() && !Fluid1::isGas())
96 return (phaseIdx ==
phase0Idx) ? name0 : name1;
98 return (phaseIdx ==
phase0Idx) ? name0 +
"_0" : name1 +
"_1";
119 static constexpr bool isGas(
int phaseIdx)
121 assert(0 <= phaseIdx && phaseIdx <
numPhases);
124 return Fluid0::isGas();
125 return Fluid1::isGas();
143 assert(0 <= phaseIdx && phaseIdx <
numPhases);
157 assert(0 <= phaseIdx && phaseIdx <
numPhases);
161 return Fluid0::isIdealGas();
162 return Fluid1::isIdealGas();
176 assert(0 <= phaseIdx && phaseIdx <
numPhases);
180 return Fluid0::isCompressible();
181 return Fluid1::isCompressible();
191 assert(0 <= phaseIdx && phaseIdx <
numPhases);
195 return Fluid0::viscosityIsConstant();
196 return Fluid1::viscosityIsConstant();
207 assert(0 <= phaseIdx && phaseIdx <
numPhases);
211 return Fluid0::isIdealFluid1();
212 return Fluid1::isIdealFluid1();
228 return Fluid0::name();
229 return Fluid1::name();
241 return Fluid0::molarMass();
242 return Fluid1::molarMass();
254 return Fluid0::criticalTemperature();
255 return Fluid1::criticalTemperature();
267 return Fluid0::criticalPressure();
268 return Fluid1::criticalPressure();
280 return Fluid0::acentricFactor();
281 return Fluid1::acentricFactor();
294 init(273.15, 623.15, 100,
312 if (Fluid0::Component::isTabulated)
313 Fluid0::Component::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress);
315 if (Fluid1::Component::isTabulated)
316 Fluid1::Component::init(tempMin, tempMax, nTemp, pressMin, pressMax, nPress);
324 template <
class Flu
idState>
328 assert(0 <= phaseIdx && phaseIdx <
numPhases);
347 template <
class Flu
idState>
363 template <
class Flu
idState>
367 assert(0 <= phaseIdx && phaseIdx <
numPhases);
393 template <
class Flu
idState>
398 assert(0 <= phaseIdx && phaseIdx <
numPhases);
401 if (phaseIdx == compIdx)
407 return std::numeric_limits<Scalar>::infinity();
433 template <
class Flu
idState>
438 DUNE_THROW(Dune::InvalidStateException,
439 "Diffusion coefficients of components are meaningless if"
440 " immiscibility is assumed");
453 template <
class Flu
idState>
460 DUNE_THROW(Dune::InvalidStateException,
461 "Binary diffusion coefficients of components are meaningless if"
462 " immiscibility is assumed");
471 template <
class Flu
idState>
475 assert(0 <= phaseIdx && phaseIdx <
numPhases);
490 template <
class Flu
idState>
494 assert(0 <= phaseIdx && phaseIdx <
numPhases);
515 template <
class Flu
idState>
519 assert(0 <= phaseIdx && phaseIdx <
numPhases);
A collection of input/output field names for common physical quantities.
Represents all relevant thermodynamic quantities of a multi-phase fluid system assuming immiscibility...
A liquid phase consisting of a single component.
A gaseous phase consisting of a single component.
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string gaseousPhase() noexcept
I/O name of gaseous phase.
Definition: name.hh:123
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
std::string molarDensity(int phaseIdx) noexcept
I/O name of molar density for multiphase systems.
Definition: name.hh:83
std::string naplPhase() noexcept
I/O name of napl phase.
Definition: name.hh:131
std::string liquidPhase() noexcept
I/O name of liquid phase.
Definition: name.hh:119
std::string aqueousPhase() noexcept
I/O name of aqueous phase.
Definition: name.hh:127
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:34
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
IsAqueous struct.
Definition: components/base.hh:47
A fluid system for two-phase models assuming immiscibility and thermodynamic equilibrium.
Definition: 2pimmiscible.hh:59
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:454
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: 2pimmiscible.hh:86
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: 2pimmiscible.hh:223
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: 2pimmiscible.hh:174
static Scalar acentricFactor(int compIdx)
The acentric factor of a component .
Definition: 2pimmiscible.hh:275
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Return the specific enthalpy of a fluid phase .
Definition: 2pimmiscible.hh:472
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: 2pimmiscible.hh:112
static bool isIdealFluid1(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: 2pimmiscible.hh:205
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: 2pimmiscible.hh:491
static bool isIdealMixture(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: 2pimmiscible.hh:141
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:309
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Return the viscosity of a phase .
Definition: 2pimmiscible.hh:364
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:394
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:434
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:155
static constexpr int comp0Idx
index of the frist component
Definition: 2pimmiscible.hh:76
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: 2pimmiscible.hh:516
static constexpr int phase0Idx
index of the first phase
Definition: 2pimmiscible.hh:74
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: 2pimmiscible.hh:325
static constexpr bool viscosityIsConstant(int phaseIdx)
Returns true if the liquid phase viscostiy is constant.
Definition: 2pimmiscible.hh:189
static constexpr int numPhases
Number of phases in the fluid system.
Definition: 2pimmiscible.hh:71
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
The molar density of a fluid phase in .
Definition: 2pimmiscible.hh:348
static void init()
Initialize the fluid system's static parameters.
Definition: 2pimmiscible.hh:291
static Scalar criticalPressure(int compIdx)
Critical pressure of a component .
Definition: 2pimmiscible.hh:262
static Scalar criticalTemperature(int compIdx)
Critical temperature of a component .
Definition: 2pimmiscible.hh:249
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: 2pimmiscible.hh:119
static constexpr int comp1Idx
index of the second component
Definition: 2pimmiscible.hh:77
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: 2pimmiscible.hh:236
static constexpr int numComponents
Number of components in the fluid system.
Definition: 2pimmiscible.hh:72
static constexpr int phase1Idx
index of the second phase
Definition: 2pimmiscible.hh:75
Fluid system base class.
Definition: fluidsystems/base.hh:45
Scalar Scalar
export the scalar type
Definition: fluidsystems/base.hh:48
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: fluidsystems/base.hh:134
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/base.hh:390
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: fluidsystems/base.hh:197
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: fluidsystems/base.hh:278
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: fluidsystems/base.hh:326
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: fluidsystems/base.hh:363
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: fluidsystems/base.hh:160
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: fluidsystems/base.hh:236
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: fluidsystems/base.hh:424
Base class for all components Components provide the thermodynamic relations for the liquid,...