12#ifndef DUMUX_FLUIDSYTEMS_ONEP_ADAPTER_HH
13#define DUMUX_FLUIDSYTEMS_ONEP_ADAPTER_HH
17#include <dune/common/exceptions.hh>
23namespace FluidSystems {
31template <
class MPFlu
idSystem,
int phase = 0>
33:
public Base<typename MPFluidSystem::Scalar, OnePAdapter<MPFluidSystem, phase>>
37 static_assert(phase < MPFluidSystem::numPhases,
"Phase does not exist in multi-phase fluidsystem!");
41 using FluidSystem = MPFluidSystem;
44 static int phaseIdx(
int mpFluidPhaseIdx)
62 template<
class Flu
idState>
63 static auto adaptFluidState(
const FluidState& fluidState)
67 using Scalar =
typename MPFluidSystem::Scalar;
79 static constexpr int numComponents = MultiPhaseFluidSystem::isMiscible() ? MultiPhaseFluidSystem::numComponents :
numPhases;
84 static constexpr int compIdx(
int multiPhaseFluidSystemCompIdx)
85 {
return AdapterPolicy::compIdx(multiPhaseFluidSystemCompIdx); }
90 template<
class ...Args>
91 static void init(Args&&... args)
92 { MultiPhaseFluidSystem::init(std::forward<Args>(args)...); }
103 {
return MultiPhaseFluidSystem::phaseName(phase); }
111 {
return MultiPhaseFluidSystem::componentName(AdapterPolicy::compIdx(
compIdx)); }
117 {
return MultiPhaseFluidSystem::phaseName(phase); }
128 static constexpr bool isGas(
int phaseIdx = 0)
129 {
return MultiPhaseFluidSystem::isGas(phase); }
146 {
return MultiPhaseFluidSystem::isIdealMixture(phase); }
152 {
return MultiPhaseFluidSystem::isCompressible(phase); }
158 {
return MultiPhaseFluidSystem::viscosityIsConstant(phase); }
164 {
return MultiPhaseFluidSystem::isIdealGas(phase); }
170 {
return MultiPhaseFluidSystem::molarMass(AdapterPolicy::compIdx(
compIdx)); }
174 template <
class Flu
idState>
177 assert(phaseIdx == 0);
183 template <
class Flu
idState>
186 assert(phaseIdx == 0);
192 template <
class Flu
idState>
195 assert(phaseIdx == 0);
196 return MultiPhaseFluidSystem::enthalpy(adaptFluidState(fluidState), phase);
206 template <
class Flu
idState>
211 assert(phaseIdx == 0);
212 return MultiPhaseFluidSystem::componentEnthalpy(adaptFluidState(fluidState), phase,
213 AdapterPolicy::compIdx(
compIdx));
218 template <
class Flu
idState>
221 assert(phaseIdx == 0);
227 template <
class Flu
idState>
232 assert(phaseIdx == 0);
233 return MultiPhaseFluidSystem::fugacityCoefficient(adaptFluidState(fluidState), phase,
234 AdapterPolicy::compIdx(
compIdx));
239 template <
class Flu
idState>
244 assert(phaseIdx == 0);
245 return MultiPhaseFluidSystem::diffusionCoefficient(adaptFluidState(fluidState), phase,
246 AdapterPolicy::compIdx(
compIdx));
251 template <
class Flu
idState>
257 assert(phaseIdx == 0);
258 return MultiPhaseFluidSystem::binaryDiffusionCoefficient(adaptFluidState(fluidState), phase,
259 AdapterPolicy::compIdx(compIIdx),
260 AdapterPolicy::compIdx(compJIdx));
265 template <
class Flu
idState>
269 assert(phaseIdx == 0);
270 return MultiPhaseFluidSystem::thermalConductivity(adaptFluidState(fluidState), phase);
275 template <
class Flu
idState>
279 assert(phaseIdx == 0);
280 return MultiPhaseFluidSystem::heatCapacity(adaptFluidState(fluidState), phase);
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:33
An adapter for multi-phase fluid systems to be used with (compositional) one-phase models.
Definition: 1padapter.hh:34
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int compIdx)
Returns the specific enthalpy of a component in a specific phase.
Definition: 1padapter.hh:207
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx=0)
Thermal conductivity of a fluid phase .
Definition: 1padapter.hh:266
static Scalar viscosity(const FluidState &fluidState, int phaseIdx=0)
Calculate the dynamic viscosity of a fluid phase .
Definition: 1padapter.hh:219
static std::string phaseName(int phaseIdx=0)
Return the human readable name of a fluid phase.
Definition: 1padapter.hh:102
static void init(Args &&... args)
Initialize the fluid system's static parameters generically.
Definition: 1padapter.hh:91
static Scalar density(const FluidState &fluidState, int phaseIdx=0)
Calculate the density of a fluid phase.
Definition: 1padapter.hh:175
static constexpr int multiphaseFluidsystemPhaseIdx
the index of the phase we choose from the multi-phase fluid system
Definition: 1padapter.hh:73
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx=0)
Calculate the molar density of a fluid phase.
Definition: 1padapter.hh:184
static constexpr int numPhases
number of phases in the fluid system
Definition: 1padapter.hh:76
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:81
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:252
typename MPFluidSystem::Scalar Scalar
Definition: 1padapter.hh:67
static constexpr int compIdx(int multiPhaseFluidSystemCompIdx)
convert a component index of the multi-phase component index to the actual component index
Definition: 1padapter.hh:84
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:193
MPFluidSystem MultiPhaseFluidSystem
export the wrapped MultiPhaseFluidSystem type
Definition: 1padapter.hh:71
static Scalar molarMass(int compIdx)
The mass in of one mole of the component.
Definition: 1padapter.hh:169
static std::string componentName(int compIdx)
A human readable name for the component.
Definition: 1padapter.hh:110
static std::string name()
A human readable name for the component.
Definition: 1padapter.hh:116
static constexpr bool viscosityIsConstant(int phaseIdx=0)
Returns true if the fluid viscosity is constant.
Definition: 1padapter.hh:157
static constexpr bool isGas(int phaseIdx=0)
Returns whether the fluid is gaseous.
Definition: 1padapter.hh:128
static constexpr bool isMiscible()
There is only one phase, so no mass transfer between phases can occur.
Definition: 1padapter.hh:122
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:228
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:145
static constexpr bool isIdealGas(int phaseIdx=0)
Returns true if the fluid is assumed to be an ideal gas.
Definition: 1padapter.hh:163
static constexpr int numComponents
Definition: 1padapter.hh:79
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx=0)
Specific isobaric heat capacity of a fluid phase .
Definition: 1padapter.hh:276
static constexpr bool isCompressible(int phaseIdx=0)
Returns true if the fluid is assumed to be compressible.
Definition: 1padapter.hh:151
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:240
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