24#ifndef DUMUX_3P_IMMISCIBLE_FLUID_SYSTEM_HH
25#define DUMUX_3P_IMMISCIBLE_FLUID_SYSTEM_HH
31#include <dune/common/exceptions.hh>
40namespace FluidSystems {
59template <
class Scalar,
class WettingFlu
id,
class NonwettingFlu
id,
class Gas>
61:
public Base<Scalar, ThreePImmiscible<Scalar, WettingFluid, NonwettingFluid, Gas> >
63 static_assert((WettingFluid::numPhases == 1),
"WettingFluid has more than one phase");
64 static_assert((NonwettingFluid::numPhases == 1),
"NonwettingFluid has more than one phase");
65 static_assert((Gas::numPhases == 1),
"Gas has more than one phase");
66 static_assert((WettingFluid::numComponents == 1),
"WettingFluid has more than one component");
67 static_assert((NonwettingFluid::numComponents == 1),
"NonwettingFluid has more than one component");
68 static_assert((Gas::numComponents == 1),
"Gas has more than one component");
93 assert(0 <= phaseIdx && phaseIdx <
numPhases);
102 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index " << phaseIdx);
115 static constexpr bool isGas(
int phaseIdx)
117 assert(0 <= phaseIdx && phaseIdx <
numPhases);
121 case wPhaseIdx:
return WettingFluid::isGas();
break;
122 case nPhaseIdx:
return NonwettingFluid::isGas();
break;
123 case gPhaseIdx:
return Gas::isGas();
break;
124 default:
return false;
155 assert(0 <= phaseIdx && phaseIdx <
numPhases);
160 case wPhaseIdx:
return WettingFluid::isCompressible();
break;
161 case nPhaseIdx:
return NonwettingFluid::isCompressible();
break;
162 case gPhaseIdx:
return Gas::isCompressible();
break;
163 default:
return false;
175 assert(0 <= phaseIdx && phaseIdx <
numPhases);
180 case wPhaseIdx:
return WettingFluid::isIdealGas();
break;
181 case nPhaseIdx:
return NonwettingFluid::isIdealGas();
break;
182 case gPhaseIdx:
return Gas::isIdealGas();
break;
183 default:
return false;
212 case wCompIdx:
return WettingFluid::name();
break;
213 case nCompIdx:
return NonwettingFluid::name();
break;
214 case gCompIdx:
return Gas::name();
break;
215 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid component index");
229 case wCompIdx:
return WettingFluid::molarMass();
break;
230 case nCompIdx:
return NonwettingFluid::molarMass();
break;
231 case gCompIdx:
return Gas::molarMass();
break;
232 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid component index");
246 case wCompIdx:
return WettingFluid::criticalTemperature();
break;
247 case nCompIdx:
return NonwettingFluid::criticalTemperature();
break;
248 case gCompIdx:
return Gas::criticalTemperature();
break;
249 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid component index");
263 case wCompIdx:
return WettingFluid::criticalPressure();
break;
264 case nCompIdx:
return NonwettingFluid::criticalPressure();
break;
265 case gCompIdx:
return Gas::criticalPressure();
break;
266 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid component index");
280 case wCompIdx:
return WettingFluid::Component::acentricFactor();
break;
281 case nCompIdx:
return NonwettingFluid::Component::acentricFactor();
break;
282 case gCompIdx:
return Gas::Component::acentricFactor();
break;
283 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid component index");
298 static_assert(!WettingFluid::isGas() && !NonwettingFluid::isGas() && Gas::isGas(),
"There can only be one gaseous phase!");
316 static_assert(!WettingFluid::isGas() && !NonwettingFluid::isGas() && Gas::isGas(),
"There can only be one gaseous phase!");
318 if (WettingFluid::Component::isTabulated)
320 std::cout <<
"Initializing tables for the wetting fluid properties ("
324 WettingFluid::Component::init(tempMin, tempMax, nTemp,
325 pressMin, pressMax, nPress);
329 if (NonwettingFluid::Component::isTabulated)
331 std::cout <<
"Initializing tables for the nonwetting fluid properties ("
335 NonwettingFluid::Component::init(tempMin, tempMax, nTemp,
336 pressMin, pressMax, nPress);
340 if (Gas::Component::isTabulated)
342 std::cout <<
"Initializing tables for the gas fluid properties ("
346 Gas::Component::init(tempMin, tempMax, nTemp,
347 pressMin, pressMax, nPress);
357 template <
class Flu
idState>
361 assert(0 <= phaseIdx && phaseIdx <
numPhases);
371 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
385 template <
class Flu
idState>
389 assert(0 <= phaseIdx && phaseIdx <
numPhases);
399 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
409 template <
class Flu
idState>
413 assert(0 <= phaseIdx && phaseIdx <
numPhases);
423 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
444 template <
class Flu
idState>
449 assert(0 <= phaseIdx && phaseIdx <
numPhases);
452 if (phaseIdx == compIdx)
458 return std::numeric_limits<Scalar>::infinity();
484 template <
class Flu
idState>
489 DUNE_THROW(Dune::InvalidStateException,
490 "Diffusion coefficients of components are meaningless if"
491 " immiscibility is assumed");
504 template <
class Flu
idState>
511 DUNE_THROW(Dune::InvalidStateException,
512 "Binary diffusion coefficients of components are meaningless if"
513 " immiscibility is assumed");
522 template <
class Flu
idState>
526 assert(0 <= phaseIdx && phaseIdx <
numPhases);
536 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
546 template <
class Flu
idState>
550 assert(0 <= phaseIdx && phaseIdx <
numPhases);
560 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
576 template <
class Flu
idState>
580 assert(0 <= phaseIdx && phaseIdx <
numPhases);
590 default: DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index");
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 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 three-phase models assuming immiscibility and thermodynamic equilibrium.
Definition: 3pimmiscible.hh:62
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: 3pimmiscible.hh:206
static constexpr int numPhases
Number of phases in the fluid system.
Definition: 3pimmiscible.hh:78
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: 3pimmiscible.hh:153
static constexpr int wPhaseIdx
Index of the wetting phase.
Definition: 3pimmiscible.hh:81
static constexpr void init()
Initialize the fluid system's static parameters.
Definition: 3pimmiscible.hh:294
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: 3pimmiscible.hh:91
static constexpr int gCompIdx
Index of the gas phase's component.
Definition: 3pimmiscible.hh:199
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Return the viscosity of a phase .
Definition: 3pimmiscible.hh:410
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:312
static constexpr int numComponents
Number of components in the fluid system.
Definition: 3pimmiscible.hh:192
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: 3pimmiscible.hh:223
static constexpr int wCompIdx
Index of the wetting phase's component.
Definition: 3pimmiscible.hh:195
static Scalar criticalPressure(int compIdx)
Critical pressure of a component .
Definition: 3pimmiscible.hh:257
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:445
static constexpr int nPhaseIdx
Index of the nonwetting phase.
Definition: 3pimmiscible.hh:83
static Scalar criticalTemperature(int compIdx)
Critical temperature of a component .
Definition: 3pimmiscible.hh:240
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: 3pimmiscible.hh:115
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: 3pimmiscible.hh:358
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:485
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: 3pimmiscible.hh:108
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: 3pimmiscible.hh:577
static constexpr int gPhaseIdx
Index of the gas phase.
Definition: 3pimmiscible.hh:85
static Scalar acentricFactor(int compIdx)
The acentric factor of a component .
Definition: 3pimmiscible.hh:274
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:173
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
The molar density of a fluid phase in .
Definition: 3pimmiscible.hh:386
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: 3pimmiscible.hh:547
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:141
static constexpr int nCompIdx
Index of the nonwetting phase's component.
Definition: 3pimmiscible.hh:197
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Return the specific enthalpy of a fluid phase .
Definition: 3pimmiscible.hh:523
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:505
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,...