17#ifndef DUMUX_COMPUTE_FROM_REFERENCE_PHASE_HH
18#define DUMUX_COMPUTE_FROM_REFERENCE_PHASE_HH
22#include <dune/common/fvector.hh>
23#include <dune/common/fmatrix.hh>
62template <
class Scalar,
class Flu
idSystem>
65 enum { numPhases = FluidSystem::numPhases };
66 enum { numComponents = FluidSystem::numComponents };
68 using ComponentVector = Dune::FieldVector<Scalar, numComponents>;
98 template <
class Flu
idState,
class ParameterCache>
99 static void solve(FluidState &fluidState,
100 ParameterCache ¶mCache,
103 ComponentVector fugVec;
107 paramCache.updatePhase(fluidState, refPhaseIdx);
108 fluidState.setDensity(refPhaseIdx,
112 fluidState.setMolarDensity(refPhaseIdx,
118 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
120 fluidState.setFugacityCoefficient(refPhaseIdx,
122 FluidSystem::fugacityCoefficient(fluidState,
126 fugVec[compIdx] = fluidState.fugacity(refPhaseIdx, compIdx);
130 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
132 if (phaseIdx == refPhaseIdx)
Calculates the chemical equilibrium from the component fugacities in the phase .
Definition: compositionfromfugacities.hh:41
static void guessInitial(FluidState &fluidState, ParameterCache ¶mCache, int phaseIdx, const ComponentVector &fugVec)
Guess an initial value for the composition of the phase.
Definition: compositionfromfugacities.hh:56
static void solve(FluidState &fluidState, ParameterCache ¶mCache, int phaseIdx, const ComponentVector &targetFug)
Calculates the chemical equilibrium from the component fugacities in a phase.
Definition: compositionfromfugacities.hh:84
Computes all quantities of a generic fluid state if a reference phase has been specified.
Definition: computefromreferencephase.hh:64
static void solve(FluidState &fluidState, ParameterCache ¶mCache, int refPhaseIdx)
Computes all quantities of a generic fluid state if a reference phase has been specified.
Definition: computefromreferencephase.hh:99
Determines the fluid composition given the component fugacities and an arbitrary equation of state.
Some exceptions thrown in DuMux
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