12#ifndef DUMUX_2P_1C_FLUID_SYSTEM_HH
13#define DUMUX_2P_1C_FLUID_SYSTEM_HH
19#include <dune/common/exceptions.hh>
31template <
class Scalar,
class ComponentType>
33 :
public Base<Scalar, TwoPOneC<Scalar, ComponentType> >
36 using Component = ComponentType;
59 static std::string name[] = {
64 assert(0 <= phaseIdx && phaseIdx <
numPhases);
65 return name[phaseIdx];
79 static constexpr bool isGas(
int phaseIdx)
81 assert(0 <= phaseIdx && phaseIdx <
numPhases);
101 assert(0 <= phaseIdx && phaseIdx <
numPhases);
119 assert(0 <= phaseIdx && phaseIdx <
numPhases);
124 return Component::liquidIsCompressible();
135 assert(0 <= phaseIdx && phaseIdx <
numPhases);
139 return Component::gasIsIdeal();
155 return Component::name();
166 return Component::molarMass();
177 return Component::criticalTemperature();
188 return Component::criticalPressure();
198 DUNE_THROW(Dune::NotImplemented,
199 "TwoPOneC::criticalMolarVolume()");
211 return Component::acentricFactor();
248 if (Component::isTabulated)
250 Component::init(tempMin, tempMax, nTemp,
251 pressMin, pressMax, nPress);
257 template <
class Flu
idState>
261 assert(0 <= phaseIdx && phaseIdx <
numPhases);
275 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
280 template <
class Flu
idState>
290 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
295 template <
class Flu
idState>
299 assert(0 <= phaseIdx && phaseIdx <
numPhases);
310 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
319 template <
class Flu
idState>
321 const unsigned int phaseIdx)
323 assert(0 <= phaseIdx && phaseIdx <
numPhases);
326 return Component::vaporTemperature(
pressure);
357 template <
class Flu
idState>
362 assert(0 <= phaseIdx && phaseIdx <
numPhases);
378 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
384 template <
class Flu
idState>
390 DUNE_THROW(Dune::NotImplemented,
"Diffusion coefficients");
395 template <
class Flu
idState>
401 { DUNE_THROW(Dune::NotImplemented,
"Binary Diffusion coefficients"); }
405 template <
class Flu
idState>
409 assert(0 <= phaseIdx && phaseIdx <
numPhases);
413 return Component::liquidEnthalpy(fluidState.temperature(phaseIdx),
414 fluidState.pressure(phaseIdx));
417 return Component::gasEnthalpy(fluidState.temperature(phaseIdx),
418 fluidState.pressure(phaseIdx));
421 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
426 template <
class Flu
idState>
430 assert(0 <= phaseIdx && phaseIdx <
numPhases);
433 return Component::liquidThermalConductivity(fluidState.temperature(phaseIdx),
434 fluidState.pressure(phaseIdx));
437 return Component::gasThermalConductivity(fluidState.temperature(phaseIdx),
438 fluidState.pressure(phaseIdx));
441 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
446 template <
class Flu
idState>
450 assert(0 <= phaseIdx && phaseIdx <
numPhases);
453 return Component::liquidHeatCapacity(fluidState.temperature(phaseIdx),
454 fluidState.pressure(phaseIdx));
457 return Component::gasHeatCapacity(fluidState.temperature(phaseIdx),
458 fluidState.pressure(phaseIdx));
461 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
Fluid system base class.
Definition: fluidsystems/base.hh:32
Scalar Scalar
export the scalar type
Definition: fluidsystems/base.hh:35
A two-phase fluid system with only one component.
Definition: 2p1c.hh:34
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: 2p1c.hh:406
static Scalar molarMass(int compIdx)
Return the molar mass of a component in [kg/mol].
Definition: 2p1c.hh:163
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: 2p1c.hh:71
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: 2p1c.hh:152
static constexpr bool isIdealGas(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: 2p1c.hh:133
static Scalar criticalMolarVolume(int compIdx)
Molar volume of a component at the critical point [m^3/mol].
Definition: 2p1c.hh:196
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: 2p1c.hh:245
static constexpr int comp0Idx
index of the only component
Definition: 2p1c.hh:47
static Scalar criticalTemperature(int compIdx)
Critical temperature of a component [K].
Definition: 2p1c.hh:174
static constexpr int numPhases
Number of phases in the fluid system.
Definition: 2p1c.hh:39
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: 2p1c.hh:117
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: 2p1c.hh:57
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient [-] of an individual component in a fluid phase.
Definition: 2p1c.hh:358
static Scalar criticalPressure(int compIdx)
Critical pressure of a component [Pa].
Definition: 2p1c.hh:185
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: 2p1c.hh:447
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: 2p1c.hh:281
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: 2p1c.hh:396
static constexpr int phase1Idx
index of the second phase
Definition: 2p1c.hh:45
static constexpr int liquidPhaseIdx
index of the liquid phase
Definition: 2p1c.hh:42
static constexpr int numComponents
Number of components in the fluid system.
Definition: 2p1c.hh:40
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: 2p1c.hh:385
static constexpr int gasPhaseIdx
index of the gas phase
Definition: 2p1c.hh:43
static Scalar thermalConductivity(const FluidState &fluidState, const int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: 2p1c.hh:427
static Scalar vaporTemperature(const FluidState &fluidState, const unsigned int phaseIdx)
calculate the temperature of vapor at a given pressure on the vapor pressure curve.
Definition: 2p1c.hh:320
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: 2p1c.hh:258
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: 2p1c.hh:79
static constexpr bool isIdealMixture(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: 2p1c.hh:99
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: 2p1c.hh:296
static void init()
Initialize the fluid system's static parameters generically.
Definition: 2p1c.hh:224
static constexpr int phase0Idx
index of the first phase
Definition: 2p1c.hh:44
static Scalar acentricFactor(int compIdx)
The acentric factor of a component [].
Definition: 2p1c.hh:208
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 liquidPhase() noexcept
I/O name of liquid phase.
Definition: name.hh:107
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:22