12#ifndef DUMUX_LIQUID_TWOC_PHASE_HH 
   13#define DUMUX_LIQUID_TWOC_PHASE_HH 
   18#include <dune/common/exceptions.hh> 
   30template <
class Scalar, 
class MainComponent, 
class SecondComponent>
 
   32: 
public Base<Scalar, LiquidPhaseTwoC<Scalar, MainComponent, SecondComponent> >
 
   80    { 
return compIdx ? SecondComponent::name() : MainComponent::name(); }
 
 
   86    { 
return "LiquidPhaseTwoC"; }
 
 
   91    static constexpr bool isGas(
int phaseIdx = 0)
 
 
  115    { 
return MainComponent::liquidIsCompressible(); }
 
 
  127    {  
return compIdx ? SecondComponent::molarMass() : MainComponent::molarMass(); }
 
 
  133    {  
return MainComponent::criticalTemperature(); }
 
 
  139    {  
return MainComponent::criticalPressure(); }
 
 
  145    {  
return MainComponent::tripleTemperature(); }
 
 
  151    { 
return MainComponent::triplePressure(); }
 
 
  158    {  
return MainComponent::vaporPressure(T); }
 
 
  166    {  
return MainComponent::liquidDensity(temperature, 
pressure); }
 
 
  170    template <
class Flu
idState>
 
  172                          const int phaseIdx = 0)
 
  174        const Scalar T = fluidState.temperature(phaseIdx);
 
  175        const Scalar p = fluidState.pressure(phaseIdx);
 
  180        const Scalar pureComponentMolarDensity = MainComponent::liquidMolarDensity(T, p);
 
  182        return pureComponentMolarDensity
 
 
  189    template <
class Flu
idState>
 
  192        const Scalar T = fluidState.temperature(phaseIdx);
 
  193        const Scalar p = fluidState.pressure(phaseIdx);
 
  197        return MainComponent::liquidMolarDensity(T, p);
 
 
  206    {  
return MainComponent::liquidPressure(temperature, 
density); }
 
 
  214    {  
return MainComponent::liquidEnthalpy(temperature, 
pressure); }
 
 
  218    template <
class Flu
idState>
 
  222        return enthalpy(fluidState.temperature(phaseIdx),
 
  223                        fluidState.pressure(phaseIdx));
 
 
  232    template <
class Flu
idState>
 
  237        const Scalar T = fluidState.temperature(phaseIdx);
 
  238        const Scalar p = fluidState.pressure(phaseIdx);
 
  241            return MainComponent::liquidEnthalpy(T, p);
 
  243            return SecondComponent::liquidEnthalpy(T, p);
 
  245            DUNE_THROW(Dune::InvalidStateException, 
"Invalid component index " << componentIdx);
 
 
  254    { 
return MainComponent::liquidInternalEnergy(temperature, 
pressure); }
 
 
  262    {  
return MainComponent::liquidViscosity(temperature, 
pressure); }
 
 
  266    template <
class Flu
idState>
 
  270        return viscosity(fluidState.temperature(phaseIdx),
 
  271                         fluidState.pressure(phaseIdx));
 
 
  276    template <
class Flu
idState>
 
  281        assert(0 <= phaseIdx  && phaseIdx < 
numPhases);
 
  284        if (phaseIdx == compIdx)
 
  290        return std::numeric_limits<Scalar>::infinity();
 
 
  295    template <
class Flu
idState>
 
  300        DUNE_THROW(Dune::InvalidStateException, 
"Not applicable: Diffusion coefficients");
 
 
  305    template <
class Flu
idState>
 
  309        return BinaryCoefficients::liquidDiffCoeff(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
 
 
  318    { 
return MainComponent::liquidThermalConductivity(temperature, 
pressure); }
 
 
  322    template <
class Flu
idState>
 
  327                                   fluidState.pressure(phaseIdx));
 
 
  336    { 
return MainComponent::liquidHeatCapacity(temperature, 
pressure); }
 
 
  340    template <
class Flu
idState>
 
  345                            fluidState.pressure(phaseIdx));
 
 
 
Binary coefficients for water and another component.
Definition h2o_constant.hh:30
Fluid system base class.
Definition fluidsystems/base.hh:32
Scalar Scalar
Definition fluidsystems/base.hh:35
A liquid phase consisting of a two components, a main component and a conservative tracer component.
Definition liquidphase2c.hh:33
static constexpr int liquidPhaseIdx
Definition liquidphase2c.hh:43
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition liquidphase2c.hh:71
static constexpr bool isCompressible(int phaseIdx=0)
Returns true if the fluid is assumed to be compressible.
Definition liquidphase2c.hh:114
static constexpr int numComponents
Definition liquidphase2c.hh:41
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int componentIdx)
Returns the specific enthalpy  of a component in the specified phase.
Definition liquidphase2c.hh:233
static Scalar thermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of the fluid .
Definition liquidphase2c.hh:317
static constexpr int mainCompIdx
Definition liquidphase2c.hh:48
static const Scalar internalEnergy(Scalar temperature, Scalar pressure)
Specific internal energy  the pure component as a liquid.
Definition liquidphase2c.hh:253
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density  of a fluid phase.
Definition liquidphase2c.hh:190
static std::string phaseName(int phaseIdx=0)
Return the human readable name of a fluid phase.
Definition liquidphase2c.hh:64
static Scalar pressure(Scalar temperature, Scalar density)
Definition liquidphase2c.hh:205
static Scalar density(Scalar temperature, Scalar pressure)
The density  of the phase at a given pressure and temperature.
Definition liquidphase2c.hh:165
static Scalar criticalTemperature()
Returns the critical temperature  of the main component.
Definition liquidphase2c.hh:132
static Scalar tripleTemperature()
Returns the temperature  at the main component's triple point.
Definition liquidphase2c.hh:144
static constexpr int comp0Idx
Definition liquidphase2c.hh:46
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:108
static Scalar viscosity(const FluidState &fluidState, const int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition liquidphase2c.hh:267
static Scalar triplePressure()
Returns the pressure  at the main component's triple point.
Definition liquidphase2c.hh:150
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:306
static Scalar viscosity(Scalar temperature, Scalar pressure)
The dynamic liquid viscosity  of the pure component.
Definition liquidphase2c.hh:261
static std::string name()
A human readable name for the fluid system.
Definition liquidphase2c.hh:85
static std::string componentName(int compIdx)
A human readable name for the component.
Definition liquidphase2c.hh:79
static Scalar heatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the fluid .
Definition liquidphase2c.hh:335
static bool isIdealGas(int phaseIdx=0)
Returns true if the fluid is assumed to be an ideal gas.
Definition liquidphase2c.hh:120
static Scalar density(const FluidState &fluidState, const int phaseIdx=0)
Calculate the density  of a fluid phase.
Definition liquidphase2c.hh:171
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:219
static void init()
Initialize the fluid system's static parameters generically.
Definition liquidphase2c.hh:54
static constexpr int phase0Idx
Definition liquidphase2c.hh:44
static const Scalar enthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy  the pure component as a liquid.
Definition liquidphase2c.hh:213
static constexpr int secondCompIdx
Definition liquidphase2c.hh:49
NullParameterCache ParameterCache
Definition liquidphase2c.hh:38
static Scalar vaporPressure(Scalar T)
The vapor pressure in  of the main component at a given temperature.
Definition liquidphase2c.hh:157
static Scalar molarMass(int compIdx)
The mass in  of one mole of the component.
Definition liquidphase2c.hh:126
static Scalar heatCapacity(const FluidState &fluidState, const int phaseIdx)
Specific isobaric heat capacity  of a fluid phase .
Definition liquidphase2c.hh:341
static Scalar criticalPressure()
Returns the critical pressure  of the main component.
Definition liquidphase2c.hh:138
static Scalar thermalConductivity(const FluidState &fluidState, const int phaseIdx)
Thermal conductivity  of a fluid phase .
Definition liquidphase2c.hh:323
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:277
static constexpr bool isGas(int phaseIdx=0)
Returns whether the fluid is gaseous.
Definition liquidphase2c.hh:91
static constexpr int comp1Idx
Definition liquidphase2c.hh:47
static constexpr int numPhases
Definition liquidphase2c.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 liquidphase2c.hh:296
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 liquidPhase() noexcept
I/O name of liquid phase.
Definition name.hh:107