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);
182 template <
class Flu
idState>
185 assert(phaseIdx == 0);
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);
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
the index of the phase we choose from the multi-phase fluid system
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
number of phases in the fluid system
Definition: 1padapter.hh:75
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: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
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
export the wrapped MultiPhaseFluidSystem type
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
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:62
std::string molarDensity(int phaseIdx) noexcept
I/O name of molar density for multiphase systems.
Definition: name.hh:71
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53