12#ifndef DUMUX_LIQUID_TWOC_PHASE_HH
13#define DUMUX_LIQUID_TWOC_PHASE_HH
18#include <dune/common/exceptions.hh>
24namespace FluidSystems {
31template <
class Scalar,
class MainComponent,
class SecondComponent>
33:
public Base<Scalar, LiquidPhaseTwoC<Scalar, MainComponent, SecondComponent> >
81 {
return compIdx ? SecondComponent::name() : MainComponent::name(); }
87 {
return "LiquidPhaseTwoC"; }
92 static constexpr bool isGas(
int phaseIdx = 0)
116 {
return MainComponent::liquidIsCompressible(); }
128 {
return compIdx ? SecondComponent::molarMass() : MainComponent::molarMass(); }
134 {
return MainComponent::criticalTemperature(); }
140 {
return MainComponent::criticalPressure(); }
146 {
return MainComponent::tripleTemperature(); }
152 {
return MainComponent::triplePressure(); }
159 {
return MainComponent::vaporPressure(T); }
171 template <
class Flu
idState>
173 const int phaseIdx = 0)
175 const Scalar T = fluidState.temperature(phaseIdx);
176 const Scalar p = fluidState.pressure(phaseIdx);
181 const Scalar pureComponentMolarDensity = MainComponent::liquidMolarDensity(T, p);
183 return pureComponentMolarDensity
190 template <
class Flu
idState>
193 const Scalar T = fluidState.temperature(phaseIdx);
194 const Scalar p = fluidState.pressure(phaseIdx);
198 return MainComponent::liquidMolarDensity(T, p);
219 template <
class Flu
idState>
223 return enthalpy(fluidState.temperature(phaseIdx),
224 fluidState.pressure(phaseIdx));
233 template <
class Flu
idState>
238 const Scalar T = fluidState.temperature(phaseIdx);
239 const Scalar p = fluidState.pressure(phaseIdx);
242 return MainComponent::liquidEnthalpy(T, p);
244 return SecondComponent::liquidEnthalpy(T, p);
246 DUNE_THROW(Dune::InvalidStateException,
"Invalid component index " << componentIdx);
267 template <
class Flu
idState>
271 return viscosity(fluidState.temperature(phaseIdx),
272 fluidState.pressure(phaseIdx));
277 template <
class Flu
idState>
282 assert(0 <= phaseIdx && phaseIdx <
numPhases);
285 if (phaseIdx == compIdx)
291 return std::numeric_limits<Scalar>::infinity();
296 template <
class Flu
idState>
301 DUNE_THROW(Dune::InvalidStateException,
"Not applicable: Diffusion coefficients");
306 template <
class Flu
idState>
310 return BinaryCoefficients::liquidDiffCoeff(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
323 template <
class Flu
idState>
328 fluidState.pressure(phaseIdx));
341 template <
class Flu
idState>
346 fluidState.pressure(phaseIdx));
Binary coefficients for water and another component.
Definition: h2o_constant.hh:31
Fluid system base class.
Definition: fluidsystems/base.hh:33
Scalar Scalar
export the scalar type
Definition: fluidsystems/base.hh:36
A liquid phase consisting of a two components, a main component and a conservative tracer component.
Definition: liquidphase2c.hh:34
static constexpr int liquidPhaseIdx
index of the liquid phase
Definition: liquidphase2c.hh:44
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: liquidphase2c.hh:72
static constexpr bool isCompressible(int phaseIdx=0)
Returns true if the fluid is assumed to be compressible.
Definition: liquidphase2c.hh:115
static constexpr int numComponents
Number of components in the fluid system.
Definition: liquidphase2c.hh:42
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int componentIdx)
Returns the specific enthalpy of a component in the specified phase.
Definition: liquidphase2c.hh:234
static Scalar thermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of the fluid .
Definition: liquidphase2c.hh:318
static constexpr int mainCompIdx
index of the main component
Definition: liquidphase2c.hh:49
static const Scalar internalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy the pure component as a liquid.
Definition: liquidphase2c.hh:254
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: liquidphase2c.hh:191
static std::string phaseName(int phaseIdx=0)
Return the human readable name of a fluid phase.
Definition: liquidphase2c.hh:65
static Scalar pressure(Scalar temperature, Scalar density)
The pressure of the component at a given density and temperature.
Definition: liquidphase2c.hh:206
static Scalar density(Scalar temperature, Scalar pressure)
The density of the phase at a given pressure and temperature.
Definition: liquidphase2c.hh:166
static Scalar criticalTemperature()
Returns the critical temperature of the main component.
Definition: liquidphase2c.hh:133
static Scalar tripleTemperature()
Returns the temperature at the main component's triple point.
Definition: liquidphase2c.hh:145
static constexpr int comp0Idx
index of the first component
Definition: liquidphase2c.hh:47
static bool isIdealMixture(int phaseIdx=0)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: liquidphase2c.hh:109
static Scalar viscosity(const FluidState &fluidState, const int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: liquidphase2c.hh:268
static Scalar triplePressure()
Returns the pressure at the main component's triple point.
Definition: liquidphase2c.hh:151
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: liquidphase2c.hh:307
static Scalar viscosity(Scalar temperature, Scalar pressure)
The dynamic liquid viscosity of the pure component.
Definition: liquidphase2c.hh:262
static std::string name()
A human readable name for the fluid system.
Definition: liquidphase2c.hh:86
static std::string componentName(int compIdx)
A human readable name for the component.
Definition: liquidphase2c.hh:80
static Scalar heatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the fluid .
Definition: liquidphase2c.hh:336
static bool isIdealGas(int phaseIdx=0)
Returns true if the fluid is assumed to be an ideal gas.
Definition: liquidphase2c.hh:121
static Scalar density(const FluidState &fluidState, const int phaseIdx=0)
Calculate the density of a fluid phase.
Definition: liquidphase2c.hh:172
static Scalar enthalpy(const FluidState &fluidState, const int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: liquidphase2c.hh:220
static void init()
Initialize the fluid system's static parameters generically.
Definition: liquidphase2c.hh:55
static constexpr int phase0Idx
index of the only phase
Definition: liquidphase2c.hh:45
static const Scalar enthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy the pure component as a liquid.
Definition: liquidphase2c.hh:214
static constexpr int secondCompIdx
index of the secondary component
Definition: liquidphase2c.hh:50
static Scalar vaporPressure(Scalar T)
The vapor pressure in of the main component at a given temperature.
Definition: liquidphase2c.hh:158
static Scalar molarMass(int compIdx)
The mass in of one mole of the component.
Definition: liquidphase2c.hh:127
static Scalar heatCapacity(const FluidState &fluidState, const int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: liquidphase2c.hh:342
static Scalar criticalPressure()
Returns the critical pressure of the main component.
Definition: liquidphase2c.hh:139
static Scalar thermalConductivity(const FluidState &fluidState, const int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: liquidphase2c.hh:324
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: liquidphase2c.hh:278
static constexpr bool isGas(int phaseIdx=0)
Returns whether the fluid is gaseous.
Definition: liquidphase2c.hh:92
static constexpr int comp1Idx
index of the second component
Definition: liquidphase2c.hh:48
static constexpr int numPhases
Number of phases in the fluid system.
Definition: liquidphase2c.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: liquidphase2c.hh:297
The a parameter cache which does nothing.
Definition: nullparametercache.hh:22
Binary coefficients for water and a "constant" component.
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 liquidPhase() noexcept
I/O name of liquid phase.
Definition: name.hh:107