29#ifndef DUMUX_COMPUTE_FROM_REFERENCE_PHASE_HH
30#define DUMUX_COMPUTE_FROM_REFERENCE_PHASE_HH
34#include <dune/common/fvector.hh>
35#include <dune/common/fmatrix.hh>
75template <
class Scalar,
class Flu
idSystem>
78 enum { numPhases = FluidSystem::numPhases };
79 enum { numComponents = FluidSystem::numComponents };
81 using ComponentVector = Dune::FieldVector<Scalar, numComponents>;
111 template <
class Flu
idState,
class ParameterCache>
112 static void solve(FluidState &fluidState,
113 ParameterCache ¶mCache,
116 ComponentVector fugVec;
120 paramCache.updatePhase(fluidState, refPhaseIdx);
121 fluidState.setDensity(refPhaseIdx,
125 fluidState.setMolarDensity(refPhaseIdx,
131 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
133 fluidState.setFugacityCoefficient(refPhaseIdx,
135 FluidSystem::fugacityCoefficient(fluidState,
139 fugVec[compIdx] = fluidState.fugacity(refPhaseIdx, compIdx);
143 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
145 if (phaseIdx == refPhaseIdx)
Some exceptions thrown in DuMux
Some templates to wrap the valgrind macros.
Determines the fluid composition given the component fugacities and an arbitary equation of state.
std::string molarDensity(int phaseIdx) noexcept
I/O name of molar density for multiphase systems.
Definition: name.hh:83
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Calculates the chemical equilibrium from the component fugacities in the phase .
Definition: compositionfromfugacities.hh:55
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:71
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:99
Computes all quantities of a generic fluid state if a reference phase has been specified.
Definition: computefromreferencephase.hh:77
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:112