12#ifndef DUMUX_FLUIDSYTEMS_ONEP_ADAPTER_HH 
   13#define DUMUX_FLUIDSYTEMS_ONEP_ADAPTER_HH 
   17#include <dune/common/exceptions.hh> 
   30template <
class MPFlu
idSystem, 
int phase = 0>
 
   32: 
public Base<typename MPFluidSystem::Scalar, OnePAdapter<MPFluidSystem, phase>>
 
   36    static_assert(phase < MPFluidSystem::numPhases, 
"Phase does not exist in multi-phase fluidsystem!");
 
   40        using FluidSystem = MPFluidSystem;
 
   43        static int phaseIdx(
int mpFluidPhaseIdx)
 
   61    template<
class Flu
idState>
 
   62    static auto adaptFluidState(
const FluidState& fluidState)
 
   66    using Scalar = 
typename MPFluidSystem::Scalar;
 
   78    static constexpr int numComponents = MultiPhaseFluidSystem::isMiscible() ? MultiPhaseFluidSystem::numComponents : 
numPhases;
 
   83    static constexpr int compIdx(
int multiPhaseFluidSystemCompIdx)
 
   84    { 
return AdapterPolicy::compIdx(multiPhaseFluidSystemCompIdx); }
 
 
   89    template<
class ...Args>
 
   90    static void init(Args&&... args)
 
   91    { MultiPhaseFluidSystem::init(std::forward<Args>(args)...); }
 
 
  102    { 
return MultiPhaseFluidSystem::phaseName(phase); }
 
 
  110    { 
return MultiPhaseFluidSystem::componentName(AdapterPolicy::compIdx(
compIdx)); }
 
 
  116    { 
return MultiPhaseFluidSystem::phaseName(phase); }
 
 
  127    static constexpr bool isGas(
int phaseIdx = 0)
 
  128    { 
return MultiPhaseFluidSystem::isGas(phase); }
 
 
  145    { 
return MultiPhaseFluidSystem::isIdealMixture(phase); }
 
 
  151    { 
return MultiPhaseFluidSystem::isCompressible(phase); }
 
 
  157    { 
return MultiPhaseFluidSystem::viscosityIsConstant(phase); }
 
 
  163    { 
return MultiPhaseFluidSystem::isIdealGas(phase); }
 
 
  169    {  
return MultiPhaseFluidSystem::molarMass(AdapterPolicy::compIdx(
compIdx)); }
 
 
  173    template <
class Flu
idState>
 
  176        assert(phaseIdx == 0);
 
  177        return MultiPhaseFluidSystem::density(adaptFluidState(fluidState), phase);
 
 
  182    template <
class Flu
idState>
 
  185        assert(phaseIdx == 0);
 
  186        return MultiPhaseFluidSystem::molarDensity(adaptFluidState(fluidState), phase);
 
 
  191    template <
class Flu
idState>
 
  194        assert(phaseIdx == 0);
 
  195        return MultiPhaseFluidSystem::enthalpy(adaptFluidState(fluidState), phase);
 
 
  205    template <
class Flu
idState>
 
  210        assert(phaseIdx == 0);
 
  211        return MultiPhaseFluidSystem::componentEnthalpy(adaptFluidState(fluidState), phase,
 
  212                                                        AdapterPolicy::compIdx(
compIdx));
 
 
  217    template <
class Flu
idState>
 
  220        assert(phaseIdx == 0);
 
  221        return MultiPhaseFluidSystem::viscosity(adaptFluidState(fluidState), phase);
 
 
  226    template <
class Flu
idState>
 
  231        assert(phaseIdx == 0);
 
  232        return MultiPhaseFluidSystem::fugacityCoefficient(adaptFluidState(fluidState), phase,
 
  233                                                          AdapterPolicy::compIdx(
compIdx));
 
 
  238    template <
class Flu
idState>
 
  243        assert(phaseIdx == 0);
 
  244        return MultiPhaseFluidSystem::diffusionCoefficient(adaptFluidState(fluidState), phase,
 
  245                                                           AdapterPolicy::compIdx(
compIdx));
 
 
  250    template <
class Flu
idState>
 
  256        assert(phaseIdx == 0);
 
  257        return MultiPhaseFluidSystem::binaryDiffusionCoefficient(adaptFluidState(fluidState), phase,
 
  258                                                                 AdapterPolicy::compIdx(compIIdx),
 
  259                                                                 AdapterPolicy::compIdx(compJIdx));
 
 
  264    template <
class Flu
idState>
 
  268        assert(phaseIdx == 0);
 
  269        return MultiPhaseFluidSystem::thermalConductivity(adaptFluidState(fluidState), phase);
 
 
  274    template <
class Flu
idState>
 
  278        assert(phaseIdx == 0);
 
  279        return MultiPhaseFluidSystem::heatCapacity(adaptFluidState(fluidState), phase);
 
 
  288    template <
class Flu
idState>
 
  292        return MultiPhaseFluidSystem::vaporPressure(adaptFluidState(fluidState),
 
  293                                                    AdapterPolicy::compIdx(
compIdx));
 
 
 
Adapter class for fluid states with different indices.
Adapter class for fluid states with different indices.
Definition adapter.hh:32
Fluid system base class.
Definition fluidsystems/base.hh:32
An adapter for multi-phase fluid systems to be used with (compositional) one-phase models.
Definition 1padapter.hh:33
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int compIdx)
Returns the specific enthalpy  of a component in a specific phase.
Definition 1padapter.hh:206
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx=0)
Thermal conductivity  of a fluid phase .
Definition 1padapter.hh:265
static Scalar viscosity(const FluidState &fluidState, int phaseIdx=0)
Calculate the dynamic viscosity of a fluid phase .
Definition 1padapter.hh:218
static std::string phaseName(int phaseIdx=0)
Return the human readable name of a fluid phase.
Definition 1padapter.hh:101
static void init(Args &&... args)
Initialize the fluid system's static parameters generically.
Definition 1padapter.hh:90
static Scalar density(const FluidState &fluidState, int phaseIdx=0)
Calculate the density  of a fluid phase.
Definition 1padapter.hh:174
static constexpr int multiphaseFluidsystemPhaseIdx
Definition 1padapter.hh:72
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx=0)
Calculate the molar density  of a fluid phase.
Definition 1padapter.hh:183
static Scalar vaporPressure(const FluidState &fluidState, int compIdx)
Vapor pressure of a component .
Definition 1padapter.hh:289
static constexpr int numPhases
Definition 1padapter.hh:75
static constexpr int phase0Idx
Definition 1padapter.hh:80
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 1padapter.hh:251
NullParameterCache ParameterCache
Definition 1padapter.hh:67
typename MPFluidSystem::Scalar Scalar
Definition 1padapter.hh:66
static constexpr int compIdx(int multiPhaseFluidSystemCompIdx)
convert a component index of the multi-phase component index to the actual component index
Definition 1padapter.hh:83
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx=0)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition 1padapter.hh:192
MPFluidSystem MultiPhaseFluidSystem
Definition 1padapter.hh:70
static Scalar molarMass(int compIdx)
The mass in  of one mole of the component.
Definition 1padapter.hh:168
static std::string componentName(int compIdx)
A human readable name for the component.
Definition 1padapter.hh:109
static std::string name()
A human readable name for the component.
Definition 1padapter.hh:115
static constexpr bool viscosityIsConstant(int phaseIdx=0)
Returns true if the fluid viscosity is constant.
Definition 1padapter.hh:156
static constexpr bool isGas(int phaseIdx=0)
Returns whether the fluid is gaseous.
Definition 1padapter.hh:127
static constexpr bool isMiscible()
There is only one phase, so no mass transfer between phases can occur.
Definition 1padapter.hh:121
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient  of an individual component in a fluid phase.
Definition 1padapter.hh:227
static constexpr bool isIdealMixture(int phaseIdx=0)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition 1padapter.hh:144
static constexpr bool isIdealGas(int phaseIdx=0)
Returns true if the fluid is assumed to be an ideal gas.
Definition 1padapter.hh:162
static constexpr int numComponents
Definition 1padapter.hh:78
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx=0)
Specific isobaric heat capacity  of a fluid phase .
Definition 1padapter.hh:275
static constexpr bool isCompressible(int phaseIdx=0)
Returns true if the fluid is assumed to be compressible.
Definition 1padapter.hh:150
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition 1padapter.hh:239
The a parameter cache which does nothing.
Definition nullparametercache.hh:22