12#ifndef DUMUX_MATERIAL_FLUID_STATE_ADAPTER_HH
13#define DUMUX_MATERIAL_FLUID_STATE_ADAPTER_HH
15#include <dune/common/exceptions.hh>
30template<
class Flu
idState,
class AdapterPolicy>
33 using FluidSystem =
typename AdapterPolicy::FluidSystem;
36 using Scalar =
typename FluidState::Scalar;
39 static constexpr int numPhases = FluidSystem::numPhases;
48 : fluidState_(fluidState)
56 { DUNE_THROW(Dune::InvalidStateException,
"wetting phase index cannot be mapped"); }
62 sumMoleFrac += fluidState_.moleFraction(AdapterPolicy::phaseIdx(phaseIdx), AdapterPolicy::compIdx(cIdx));
64 return fluidState_.moleFraction(AdapterPolicy::phaseIdx(phaseIdx), AdapterPolicy::compIdx(compIdx))/sumMoleFrac;
71 sumMassFrac += fluidState_.massFraction(AdapterPolicy::phaseIdx(phaseIdx), AdapterPolicy::compIdx(cIdx));
73 return fluidState_.massFraction(AdapterPolicy::phaseIdx(phaseIdx), AdapterPolicy::compIdx(compIdx))/sumMassFrac;
82 const auto xi = fluidState_.moleFraction(AdapterPolicy::phaseIdx(phaseIdx), AdapterPolicy::compIdx(cIdx));
84 sumXiMi += xi*FluidSystem::molarMass(cIdx);
91 {
return fluidState_.pressure(AdapterPolicy::phaseIdx(phaseIdx)); }
95 assert(FluidSystem::isGas(phaseIdx));
100 {
return fluidState_.temperature(AdapterPolicy::phaseIdx(phaseIdx)); }
103 {
return fluidState_.temperature(0); }
107 const FluidState& fluidState_;
Adapter class for fluid states with different indices.
Definition: adapter.hh:32
Scalar averageMolarMass(int phaseIdx) const
Definition: adapter.hh:76
static constexpr int numPhases
export number of phases and components of the embedded fluid system
Definition: adapter.hh:39
static constexpr int numComponents
Definition: adapter.hh:40
Scalar temperature(int phaseIdx) const
Definition: adapter.hh:99
Scalar massFraction(int phaseIdx, int compIdx) const
Definition: adapter.hh:67
typename FluidState::Scalar Scalar
export scalar type
Definition: adapter.hh:36
Scalar pressure(int phaseIdx) const
Definition: adapter.hh:90
Scalar moleFraction(int phaseIdx, int compIdx) const
Definition: adapter.hh:58
Scalar temperature() const
Definition: adapter.hh:102
int wettingPhase() const
Definition: adapter.hh:55
Scalar partialPressure(int phaseIdx, int compIdx) const
Definition: adapter.hh:93
FluidStateAdapter(const FluidState &fluidState)
Adapter class for fluid states with different indices.
Definition: adapter.hh:47