24#ifndef DUMUX_MATERIAL_FLUID_STATE_ADAPTER_HH
25#define DUMUX_MATERIAL_FLUID_STATE_ADAPTER_HH
27#include <dune/common/exceptions.hh>
42template<
class Flu
idState,
class AdapterPolicy>
45 using FluidSystem =
typename AdapterPolicy::FluidSystem;
48 using Scalar =
typename FluidState::Scalar;
51 static constexpr int numPhases = FluidSystem::numPhases;
60 : fluidState_(fluidState)
68 { DUNE_THROW(Dune::InvalidStateException,
"wetting phase index cannot be mapped"); }
74 sumMoleFrac += fluidState_.moleFraction(AdapterPolicy::phaseIdx(phaseIdx), AdapterPolicy::compIdx(cIdx));
76 return fluidState_.moleFraction(AdapterPolicy::phaseIdx(phaseIdx), AdapterPolicy::compIdx(compIdx))/sumMoleFrac;
83 sumMassFrac += fluidState_.massFraction(AdapterPolicy::phaseIdx(phaseIdx), AdapterPolicy::compIdx(cIdx));
85 return fluidState_.massFraction(AdapterPolicy::phaseIdx(phaseIdx), AdapterPolicy::compIdx(compIdx))/sumMassFrac;
94 const auto xi = fluidState_.moleFraction(AdapterPolicy::phaseIdx(phaseIdx), AdapterPolicy::compIdx(cIdx));
96 sumXiMi += xi*FluidSystem::molarMass(cIdx);
103 {
return fluidState_.pressure(AdapterPolicy::phaseIdx(phaseIdx)); }
107 assert(FluidSystem::isGas(phaseIdx));
112 {
return fluidState_.temperature(AdapterPolicy::phaseIdx(phaseIdx)); }
115 {
return fluidState_.temperature(0); }
119 const FluidState& fluidState_;
FluidStateAdapter(const FluidState &fluidState)
Adapter class for fluid states with different indices.
Definition: adapter.hh:59
Adapter class for fluid states with different indices.
Definition: adapter.hh:44
Scalar averageMolarMass(int phaseIdx) const
Definition: adapter.hh:88
static constexpr int numPhases
export number of phases and components of the embedded fluid system
Definition: adapter.hh:51
static constexpr int numComponents
Definition: adapter.hh:52
Scalar temperature(int phaseIdx) const
Definition: adapter.hh:111
Scalar massFraction(int phaseIdx, int compIdx) const
Definition: adapter.hh:79
typename FluidState::Scalar Scalar
export scalar type
Definition: adapter.hh:48
Scalar pressure(int phaseIdx) const
Definition: adapter.hh:102
Scalar moleFraction(int phaseIdx, int compIdx) const
Definition: adapter.hh:70
Scalar temperature() const
Definition: adapter.hh:114
int wettingPhase() const
Definition: adapter.hh:67
Scalar partialPressure(int phaseIdx, int compIdx) const
Definition: adapter.hh:105