12#ifndef DUMUX_2P_1C_FLUID_SYSTEM_HH
13#define DUMUX_2P_1C_FLUID_SYSTEM_HH
19#include <dune/common/exceptions.hh>
26namespace FluidSystems {
32template <
class Scalar,
class ComponentType>
34 :
public Base<Scalar, TwoPOneC<Scalar, ComponentType> >
37 using Component = ComponentType;
60 static std::string name[] = {
65 assert(0 <= phaseIdx && phaseIdx <
numPhases);
66 return name[phaseIdx];
80 static constexpr bool isGas(
int phaseIdx)
82 assert(0 <= phaseIdx && phaseIdx <
numPhases);
102 assert(0 <= phaseIdx && phaseIdx <
numPhases);
120 assert(0 <= phaseIdx && phaseIdx <
numPhases);
125 return Component::liquidIsCompressible();
136 assert(0 <= phaseIdx && phaseIdx <
numPhases);
140 return Component::gasIsIdeal();
156 return Component::name();
167 return Component::molarMass();
178 return Component::criticalTemperature();
189 return Component::criticalPressure();
199 DUNE_THROW(Dune::NotImplemented,
200 "TwoPOneC::criticalMolarVolume()");
212 return Component::acentricFactor();
249 if (Component::isTabulated)
251 Component::init(tempMin, tempMax, nTemp,
252 pressMin, pressMax, nPress);
258 template <
class Flu
idState>
262 assert(0 <= phaseIdx && phaseIdx <
numPhases);
276 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
281 template <
class Flu
idState>
291 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
296 template <
class Flu
idState>
300 assert(0 <= phaseIdx && phaseIdx <
numPhases);
311 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
320 template <
class Flu
idState>
322 const unsigned int phaseIdx)
324 assert(0 <= phaseIdx && phaseIdx <
numPhases);
327 return Component::vaporTemperature(
pressure);
358 template <
class Flu
idState>
363 assert(0 <= phaseIdx && phaseIdx <
numPhases);
379 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
385 template <
class Flu
idState>
391 DUNE_THROW(Dune::NotImplemented,
"Diffusion coefficients");
396 template <
class Flu
idState>
402 { DUNE_THROW(Dune::NotImplemented,
"Binary Diffusion coefficients"); }
406 template <
class Flu
idState>
410 assert(0 <= phaseIdx && phaseIdx <
numPhases);
414 return Component::liquidEnthalpy(fluidState.temperature(phaseIdx),
415 fluidState.pressure(phaseIdx));
418 return Component::gasEnthalpy(fluidState.temperature(phaseIdx),
419 fluidState.pressure(phaseIdx));
422 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
427 template <
class Flu
idState>
431 assert(0 <= phaseIdx && phaseIdx <
numPhases);
434 return Component::liquidThermalConductivity(fluidState.temperature(phaseIdx),
435 fluidState.pressure(phaseIdx));
438 return Component::gasThermalConductivity(fluidState.temperature(phaseIdx),
439 fluidState.pressure(phaseIdx));
442 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
447 template <
class Flu
idState>
451 assert(0 <= phaseIdx && phaseIdx <
numPhases);
454 return Component::liquidHeatCapacity(fluidState.temperature(phaseIdx),
455 fluidState.pressure(phaseIdx));
458 return Component::gasHeatCapacity(fluidState.temperature(phaseIdx),
459 fluidState.pressure(phaseIdx));
462 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index.");
Fluid system base class.
Definition: fluidsystems/base.hh:33
Scalar Scalar
export the scalar type
Definition: fluidsystems/base.hh:36
A two-phase fluid system with only one component.
Definition: 2p1c.hh:35
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: 2p1c.hh:407
static Scalar molarMass(int compIdx)
Return the molar mass of a component in [kg/mol].
Definition: 2p1c.hh:164
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: 2p1c.hh:72
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: 2p1c.hh:153
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:134
static Scalar criticalMolarVolume(int compIdx)
Molar volume of a component at the critical point [m^3/mol].
Definition: 2p1c.hh:197
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:246
static constexpr int comp0Idx
index of the only component
Definition: 2p1c.hh:48
static Scalar criticalTemperature(int compIdx)
Critical temperature of a component [K].
Definition: 2p1c.hh:175
static constexpr int numPhases
Number of phases in the fluid system.
Definition: 2p1c.hh:40
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: 2p1c.hh:118
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: 2p1c.hh:58
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:359
static Scalar criticalPressure(int compIdx)
Critical pressure of a component [Pa].
Definition: 2p1c.hh:186
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: 2p1c.hh:448
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: 2p1c.hh:282
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:397
static constexpr int phase1Idx
index of the second phase
Definition: 2p1c.hh:46
static constexpr int liquidPhaseIdx
index of the liquid phase
Definition: 2p1c.hh:43
static constexpr int numComponents
Number of components in the fluid system.
Definition: 2p1c.hh:41
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:386
static constexpr int gasPhaseIdx
index of the gas phase
Definition: 2p1c.hh:44
static Scalar thermalConductivity(const FluidState &fluidState, const int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: 2p1c.hh:428
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:321
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: 2p1c.hh:259
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: 2p1c.hh:80
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:100
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: 2p1c.hh:297
static void init()
Initialize the fluid system's static parameters generically.
Definition: 2p1c.hh:225
static constexpr int phase0Idx
index of the first phase
Definition: 2p1c.hh:45
static Scalar acentricFactor(int compIdx)
The acentric factor of a component [].
Definition: 2p1c.hh:209
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