12#ifndef DUMUX_3P_IMMISCIBLE_FLUID_SYSTEM_HH
13#define DUMUX_3P_IMMISCIBLE_FLUID_SYSTEM_HH
19#include <dune/common/exceptions.hh>
28namespace FluidSystems {
47template <
class Scalar,
class WettingFlu
id,
class NonwettingFlu
id,
class Gas>
49:
public Base<Scalar, ThreePImmiscible<Scalar, WettingFluid, NonwettingFluid, Gas> >
51 static_assert((WettingFluid::numPhases == 1),
"WettingFluid has more than one phase");
52 static_assert((NonwettingFluid::numPhases == 1),
"NonwettingFluid has more than one phase");
53 static_assert((Gas::numPhases == 1),
"Gas has more than one phase");
54 static_assert((WettingFluid::numComponents == 1),
"WettingFluid has more than one component");
55 static_assert((NonwettingFluid::numComponents == 1),
"NonwettingFluid has more than one component");
56 static_assert((Gas::numComponents == 1),
"Gas has more than one component");
81 assert(0 <= phaseIdx && phaseIdx <
numPhases);
90 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index " << phaseIdx);
103 static constexpr bool isGas(
int phaseIdx)
105 assert(0 <= phaseIdx && phaseIdx <
numPhases);
109 case wPhaseIdx:
return WettingFluid::isGas();
break;
110 case nPhaseIdx:
return NonwettingFluid::isGas();
break;
111 case gPhaseIdx:
return Gas::isGas();
break;
112 default:
return false;
143 assert(0 <= phaseIdx && phaseIdx <
numPhases);
148 case wPhaseIdx:
return WettingFluid::isCompressible();
break;
149 case nPhaseIdx:
return NonwettingFluid::isCompressible();
break;
150 case gPhaseIdx:
return Gas::isCompressible();
break;
151 default:
return false;
163 assert(0 <= phaseIdx && phaseIdx <
numPhases);
168 case wPhaseIdx:
return WettingFluid::isIdealGas();
break;
169 case nPhaseIdx:
return NonwettingFluid::isIdealGas();
break;
170 case gPhaseIdx:
return Gas::isIdealGas();
break;
171 default:
return false;
200 case wCompIdx:
return WettingFluid::name();
break;
201 case nCompIdx:
return NonwettingFluid::name();
break;
202 case gCompIdx:
return Gas::name();
break;
203 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid component index");
217 case wCompIdx:
return WettingFluid::molarMass();
break;
218 case nCompIdx:
return NonwettingFluid::molarMass();
break;
219 case gCompIdx:
return Gas::molarMass();
break;
220 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid component index");
234 case wCompIdx:
return WettingFluid::criticalTemperature();
break;
235 case nCompIdx:
return NonwettingFluid::criticalTemperature();
break;
236 case gCompIdx:
return Gas::criticalTemperature();
break;
237 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid component index");
251 case wCompIdx:
return WettingFluid::criticalPressure();
break;
252 case nCompIdx:
return NonwettingFluid::criticalPressure();
break;
253 case gCompIdx:
return Gas::criticalPressure();
break;
254 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid component index");
268 case wCompIdx:
return WettingFluid::Component::acentricFactor();
break;
269 case nCompIdx:
return NonwettingFluid::Component::acentricFactor();
break;
270 case gCompIdx:
return Gas::Component::acentricFactor();
break;
271 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid component index");
286 static_assert(!WettingFluid::isGas() && !NonwettingFluid::isGas() && Gas::isGas(),
"There can only be one gaseous phase!");
304 static_assert(!WettingFluid::isGas() && !NonwettingFluid::isGas() && Gas::isGas(),
"There can only be one gaseous phase!");
306 if (WettingFluid::Component::isTabulated)
308 std::cout <<
"Initializing tables for the wetting fluid properties ("
312 WettingFluid::Component::init(tempMin, tempMax, nTemp,
313 pressMin, pressMax, nPress);
317 if (NonwettingFluid::Component::isTabulated)
319 std::cout <<
"Initializing tables for the nonwetting fluid properties ("
323 NonwettingFluid::Component::init(tempMin, tempMax, nTemp,
324 pressMin, pressMax, nPress);
328 if (Gas::Component::isTabulated)
330 std::cout <<
"Initializing tables for the gas fluid properties ("
334 Gas::Component::init(tempMin, tempMax, nTemp,
335 pressMin, pressMax, nPress);
342 template <
class Flu
idState>
346 assert(0 <= phaseIdx && phaseIdx <
numPhases);
356 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
370 template <
class Flu
idState>
374 assert(0 <= phaseIdx && phaseIdx <
numPhases);
384 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
394 template <
class Flu
idState>
398 assert(0 <= phaseIdx && phaseIdx <
numPhases);
408 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
429 template <
class Flu
idState>
434 assert(0 <= phaseIdx && phaseIdx <
numPhases);
437 if (phaseIdx == compIdx)
443 return std::numeric_limits<Scalar>::infinity();
469 template <
class Flu
idState>
474 DUNE_THROW(Dune::InvalidStateException,
475 "Diffusion coefficients of components are meaningless if"
476 " immiscibility is assumed");
489 template <
class Flu
idState>
496 DUNE_THROW(Dune::InvalidStateException,
497 "Binary diffusion coefficients of components are meaningless if"
498 " immiscibility is assumed");
507 template <
class Flu
idState>
511 assert(0 <= phaseIdx && phaseIdx <
numPhases);
521 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
531 template <
class Flu
idState>
535 assert(0 <= phaseIdx && phaseIdx <
numPhases);
545 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
561 template <
class Flu
idState>
565 assert(0 <= phaseIdx && phaseIdx <
numPhases);
575 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
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 three-phase models assuming immiscibility and thermodynamic equilibrium.
Definition: 3pimmiscible.hh:50
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: 3pimmiscible.hh:194
static constexpr int numPhases
Number of phases in the fluid system.
Definition: 3pimmiscible.hh:66
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: 3pimmiscible.hh:141
static constexpr int wPhaseIdx
Index of the wetting phase.
Definition: 3pimmiscible.hh:69
static constexpr void init()
Initialize the fluid system's static parameters.
Definition: 3pimmiscible.hh:282
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: 3pimmiscible.hh:79
static constexpr int gCompIdx
Index of the gas phase's component.
Definition: 3pimmiscible.hh:187
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Return the viscosity of a phase .
Definition: 3pimmiscible.hh:395
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: 3pimmiscible.hh:300
static constexpr int numComponents
Number of components in the fluid system.
Definition: 3pimmiscible.hh:180
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: 3pimmiscible.hh:211
static constexpr int wCompIdx
Index of the wetting phase's component.
Definition: 3pimmiscible.hh:183
static Scalar criticalPressure(int compIdx)
Critical pressure of a component .
Definition: 3pimmiscible.hh:245
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: 3pimmiscible.hh:430
static constexpr int nPhaseIdx
Index of the nonwetting phase.
Definition: 3pimmiscible.hh:71
static Scalar criticalTemperature(int compIdx)
Critical temperature of a component .
Definition: 3pimmiscible.hh:228
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: 3pimmiscible.hh:103
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: 3pimmiscible.hh:343
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: 3pimmiscible.hh:470
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: 3pimmiscible.hh:96
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: 3pimmiscible.hh:562
static constexpr int gPhaseIdx
Index of the gas phase.
Definition: 3pimmiscible.hh:73
static Scalar acentricFactor(int compIdx)
The acentric factor of a component .
Definition: 3pimmiscible.hh:262
static constexpr bool isIdealGas(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: 3pimmiscible.hh:161
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
The molar density of a fluid phase in .
Definition: 3pimmiscible.hh:371
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: 3pimmiscible.hh:532
static constexpr bool isIdealMixture(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: 3pimmiscible.hh:129
static constexpr int nCompIdx
Index of the nonwetting phase's component.
Definition: 3pimmiscible.hh:185
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Return the specific enthalpy of a fluid phase .
Definition: 3pimmiscible.hh:508
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: 3pimmiscible.hh:490
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 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