24#ifndef DUMUX_FLUIDSYTEMS_ONEP_ADAPTER_HH
25#define DUMUX_FLUIDSYTEMS_ONEP_ADAPTER_HH
29#include <dune/common/exceptions.hh>
35namespace FluidSystems {
43template <
class MPFlu
idSystem,
int phase = 0>
45:
public Base<typename MPFluidSystem::Scalar, OnePAdapter<MPFluidSystem, phase>>
50 static_assert(phase < MPFluidSystem::numPhases,
"Phase does not exist in multi-phase fluidsystem!");
54 using FluidSystem = MPFluidSystem;
57 static int phaseIdx(
int mpFluidPhaseIdx)
75 template<
class Flu
idState>
76 static auto adaptFluidState(
const FluidState& fluidState)
92 static constexpr int numComponents = MultiPhaseFluidSystem::isMiscible() ? MultiPhaseFluidSystem::numComponents :
numPhases;
97 static constexpr int compIdx(
int multiPhaseFluidSystemCompIdx)
98 {
return AdapterPolicy::compIdx(multiPhaseFluidSystemCompIdx); }
103 template<
class ...Args>
104 static void init(Args&&... args)
105 { MultiPhaseFluidSystem::init(std::forward<Args>(args)...); }
116 {
return MultiPhaseFluidSystem::phaseName(phase); }
124 {
return MultiPhaseFluidSystem::componentName(AdapterPolicy::compIdx(
compIdx)); }
130 {
return MultiPhaseFluidSystem::phaseName(phase); }
141 static constexpr bool isGas(
int phaseIdx = 0)
142 {
return MultiPhaseFluidSystem::isGas(phase); }
159 {
return MultiPhaseFluidSystem::isIdealMixture(phase); }
165 {
return MultiPhaseFluidSystem::isCompressible(phase); }
171 {
return MultiPhaseFluidSystem::viscosityIsConstant(phase); }
177 {
return MultiPhaseFluidSystem::isIdealGas(phase); }
183 {
return MultiPhaseFluidSystem::molarMass(AdapterPolicy::compIdx(
compIdx)); }
189 template <
class Flu
idState>
192 assert(phaseIdx == 0);
206 template <
class Flu
idState>
209 assert(phaseIdx == 0);
217 template <
class Flu
idState>
220 assert(phaseIdx == 0);
221 return MultiPhaseFluidSystem::enthalpy(adaptFluidState(fluidState), phase);
231 template <
class Flu
idState>
236 assert(phaseIdx == 0);
237 return MultiPhaseFluidSystem::componentEnthalpy(adaptFluidState(fluidState), phase,
238 AdapterPolicy::compIdx(
compIdx));
245 template <
class Flu
idState>
248 assert(phaseIdx == 0);
260 template <
class Flu
idState>
265 assert(phaseIdx == 0);
266 return MultiPhaseFluidSystem::fugacityCoefficient(adaptFluidState(fluidState), phase,
267 AdapterPolicy::compIdx(
compIdx));
278 template <
class Flu
idState>
283 assert(phaseIdx == 0);
284 return MultiPhaseFluidSystem::diffusionCoefficient(adaptFluidState(fluidState), phase,
285 AdapterPolicy::compIdx(
compIdx));
297 template <
class Flu
idState>
303 assert(phaseIdx == 0);
304 return MultiPhaseFluidSystem::binaryDiffusionCoefficient(adaptFluidState(fluidState), phase,
305 AdapterPolicy::compIdx(compIIdx),
306 AdapterPolicy::compIdx(compJIdx));
313 template <
class Flu
idState>
317 assert(phaseIdx == 0);
318 return MultiPhaseFluidSystem::thermalConductivity(adaptFluidState(fluidState), phase);
325 template <
class Flu
idState>
329 assert(phaseIdx == 0);
330 return MultiPhaseFluidSystem::heatCapacity(adaptFluidState(fluidState), phase);
Adapter class for fluid states with different indices.
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
std::string molarDensity(int phaseIdx) noexcept
I/O name of molar density for multiphase systems.
Definition: name.hh:83
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Adapter class for fluid states with different indices.
Definition: adapter.hh:44
An adapter for multi-phase fluid systems to be used with (compositional) one-phase models.
Definition: 1padapter.hh:46
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int compIdx)
Returns the specific enthalpy of a component in a specific phase.
Definition: 1padapter.hh:232
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx=0)
Thermal conductivity of the fluid .
Definition: 1padapter.hh:314
static Scalar viscosity(const FluidState &fluidState, int phaseIdx=0)
The dynamic liquid viscosity of the pure component.
Definition: 1padapter.hh:246
static std::string phaseName(int phaseIdx=0)
Return the human readable name of a fluid phase.
Definition: 1padapter.hh:115
static void init(Args &&... args)
Initialize the fluid system's static parameters generically.
Definition: 1padapter.hh:104
static Scalar density(const FluidState &fluidState, int phaseIdx=0)
The density of the component at a given pressure and temperature.
Definition: 1padapter.hh:190
static constexpr int multiphaseFluidsystemPhaseIdx
the index of the phase we choose from the multi-phase fluid system
Definition: 1padapter.hh:86
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx=0)
The molar density of a fluid phase in .
Definition: 1padapter.hh:207
typename Base::Scalar Scalar
Definition: 1padapter.hh:80
static constexpr int numPhases
number of phases in the fluid system
Definition: 1padapter.hh:89
static constexpr int phase0Idx
number of components has to be the same as in the multi-phase fluid system as the composition needs t...
Definition: 1padapter.hh:94
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:298
static constexpr int compIdx(int multiPhaseFluidSystemCompIdx)
convert a component index of the multi-phase component index to the actual component index
Definition: 1padapter.hh:97
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx=0)
Specific enthalpy the pure component as a liquid.
Definition: 1padapter.hh:218
MPFluidSystem MultiPhaseFluidSystem
export the wrapped MultiPhaseFluidSystem type
Definition: 1padapter.hh:84
static Scalar molarMass(int compIdx)
The mass in of one mole of the component.
Definition: 1padapter.hh:182
static std::string componentName(int compIdx)
A human readable name for the component.
Definition: 1padapter.hh:123
static std::string name()
A human readable name for the component.
Definition: 1padapter.hh:129
static constexpr bool viscosityIsConstant(int phaseIdx=0)
Returns true if the fluid viscosity is constant.
Definition: 1padapter.hh:170
static constexpr bool isGas(int phaseIdx=0)
Returns whether the fluid is gaseous.
Definition: 1padapter.hh:141
static constexpr bool isMiscible()
There is only one phase, so not mass transfer between phases can occur.
Definition: 1padapter.hh:135
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:261
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:158
static constexpr bool isIdealGas(int phaseIdx=0)
Returns true if the fluid is assumed to be an ideal gas.
Definition: 1padapter.hh:176
static constexpr int numComponents
Definition: 1padapter.hh:92
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx=0)
Specific isobaric heat capacity of the fluid .
Definition: 1padapter.hh:326
static constexpr bool isCompressible(int phaseIdx=0)
Returns true if the fluid is assumed to be compressible.
Definition: 1padapter.hh:164
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:279
Fluid system base class.
Definition: fluidsystems/base.hh:45
ScalarType Scalar
export the scalar type
Definition: fluidsystems/base.hh:48
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: fluidsystems/base.hh:134
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/base.hh:390
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: fluidsystems/base.hh:197
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: fluidsystems/base.hh:278
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: fluidsystems/base.hh:326
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: fluidsystems/base.hh:363
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: fluidsystems/base.hh:160
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: fluidsystems/base.hh:236
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: fluidsystems/base.hh:424
The a parameter cache which does nothing.
Definition: nullparametercache.hh:34