26#ifndef DUMUX_NONEQUILIBRIUM_FLUID_STATE_HH
27#define DUMUX_NONEQUILIBRIUM_FLUID_STATE_HH
31#include <dune/common/exceptions.hh>
41template <
class ScalarType,
class Flu
idSystem>
45 static constexpr int numPhases = FluidSystem::numPhases;
105 * FluidSystem::molarMass(compIdx)
215 assert(FluidSystem::isGas(phaseIdx));
292 for (
int compJIdx = 0; compJIdx <
numComponents; ++compJIdx) {
307 DUNE_THROW(Dune::NotImplemented,
"This currently only works for 2 components.");
311 Scalar M1 = FluidSystem::molarMass(compIdx);
312 Scalar M2 = FluidSystem::molarMass(1-compIdx);
314 Scalar avgMolarMass = M1*M2/(M2 + X2*(M1 - M2));
316 moleFraction_[phaseIdx][compIdx] = value * avgMolarMass / M1;
322 for (
int compJIdx = 0; compJIdx <
numComponents; ++compJIdx) {
370 template <
class Flu
idState>
373 for (
int phaseIdx = 0; phaseIdx <
numPhases; ++phaseIdx)
379 moleFraction_[phaseIdx][compIdx] = fs.moleFraction(phaseIdx, compIdx);
384 pressure_[phaseIdx] = fs.pressure(phaseIdx);
386 density_[phaseIdx] = fs.density(phaseIdx);
388 enthalpy_[phaseIdx] = fs.enthalpy(phaseIdx);
389 viscosity_[phaseIdx] = fs.viscosity(phaseIdx);
Represents all relevant thermodynamic quantities of a multi-phase, multi-component fluid system witho...
Definition: nonequilibrium.hh:43
Scalar temperatureEquil_
Definition: nonequilibrium.hh:406
ScalarType Scalar
export the scalar type
Definition: nonequilibrium.hh:49
void setPressure(int phaseIdx, Scalar value)
Set the fluid pressure of a phase .
Definition: nonequilibrium.hh:261
Scalar viscosity(int phaseIdx) const
The dynamic viscosity of fluid phase in .
Definition: nonequilibrium.hh:238
Scalar molarDensity_[numPhases]
Definition: nonequilibrium.hh:402
void setMassFraction(int phaseIdx, int compIdx, Scalar value)
Set the mass fraction of a component in a phase and update the average molar mass according to the ...
Definition: nonequilibrium.hh:304
Scalar density(int phaseIdx) const
The mass density of the fluid phase in .
Definition: nonequilibrium.hh:177
Scalar fugacity(int compIdx) const
Definition: nonequilibrium.hh:162
void setDensity(int phaseIdx, Scalar value)
Set the density of a phase .
Definition: nonequilibrium.hh:338
static constexpr int numPhases
Definition: nonequilibrium.hh:45
void setEnthalpy(int phaseIdx, Scalar value)
Set the specific enthalpy of a phase .
Definition: nonequilibrium.hh:350
static constexpr int numComponents
Definition: nonequilibrium.hh:46
int wettingPhase() const
Returns the index of the wetting phase in the fluid-solid configuration (for porous medium systems).
Definition: nonequilibrium.hh:59
void setMolarDensity(int phaseIdx, Scalar value)
Set the molar density of a phase .
Definition: nonequilibrium.hh:344
Scalar pressure(int phaseIdx) const
The pressure of a fluid phase in .
Definition: nonequilibrium.hh:206
Scalar fugacityCoefficient(int phaseIdx, int compIdx) const
The fugacity coefficient of component in fluid phase in .
Definition: nonequilibrium.hh:135
void setTemperature(int phaseIdx, Scalar value)
Set the temperature of a fluid phase.
Definition: nonequilibrium.hh:249
Scalar averageMolarMass(int phaseIdx) const
The average molar mass of phase in .
Definition: nonequilibrium.hh:117
Scalar moleFraction_[numPhases][numComponents]
Definition: nonequilibrium.hh:395
void assign(const FluidState &fs)
Retrieve all parameters from an arbitrary fluid state.
Definition: nonequilibrium.hh:371
void setFugacityCoefficient(int phaseIdx, int compIdx, Scalar value)
Set the fugacity of a component in a phase .
Definition: nonequilibrium.hh:332
void setMoleFraction(int phaseIdx, int compIdx, Scalar value)
Set the mole fraction of a component in a phase .
Definition: nonequilibrium.hh:273
Scalar internalEnergy(int phaseIdx) const
The specific internal energy of a fluid phase in .
Definition: nonequilibrium.hh:232
Scalar temperature(const int phaseIdx) const
The absolute temperature of a fluid phase in .
Definition: nonequilibrium.hh:194
Scalar partialPressure(int phaseIdx, int compIdx) const
The partial pressure of a component in a phase .
Definition: nonequilibrium.hh:213
Scalar pressure_[numPhases]
Definition: nonequilibrium.hh:399
Scalar molarDensity(int phaseIdx) const
The molar density of a fluid phase in .
Definition: nonequilibrium.hh:188
Scalar saturation_[numPhases]
Definition: nonequilibrium.hh:400
Scalar temperature_[numPhases]
Definition: nonequilibrium.hh:405
Scalar molarVolume(int phaseIdx) const
The molar volume of a fluid phase in .
Definition: nonequilibrium.hh:170
Scalar sumMoleFractions_[numPhases]
Definition: nonequilibrium.hh:398
Scalar enthalpy_[numPhases]
Definition: nonequilibrium.hh:403
Scalar density_[numPhases]
Definition: nonequilibrium.hh:401
Scalar fugacity(int phaseIdx, int compIdx) const
The fugacity of component in fluid phase in .
Definition: nonequilibrium.hh:155
void setSaturation(int phaseIdx, Scalar value)
Set the saturation of a phase .
Definition: nonequilibrium.hh:267
void setTemperature(Scalar value)
Set the temperature of all fluid phases.
Definition: nonequilibrium.hh:255
Scalar temperature() const
Get the equilibrium temperature of the fluid phases.
Definition: nonequilibrium.hh:200
Scalar saturation(int phaseIdx) const
Returns the saturation of a fluid phase in .
Definition: nonequilibrium.hh:68
Scalar enthalpy(int phaseIdx) const
The specific enthalpy of a fluid phase in .
Definition: nonequilibrium.hh:222
void setWettingPhase(int phaseIdx)
Set the index of the wetting phase.
Definition: nonequilibrium.hh:362
Scalar averageMolarMass_[numPhases]
Definition: nonequilibrium.hh:397
Scalar molarity(int phaseIdx, int compIdx) const
The molar concentration of component in fluid phase in .
Definition: nonequilibrium.hh:129
int wPhaseIdx_
Definition: nonequilibrium.hh:410
void setViscosity(int phaseIdx, Scalar value)
Set the dynamic viscosity of a phase .
Definition: nonequilibrium.hh:356
Scalar moleFraction(int phaseIdx, int compIdx) const
Returns the molar fraction of the component in fluid phase in .
Definition: nonequilibrium.hh:80
Scalar viscosity_[numPhases]
Definition: nonequilibrium.hh:404
Scalar massFraction(int phaseIdx, int compIdx) const
Returns the mass fraction of component in fluid phase in .
Definition: nonequilibrium.hh:99
Scalar fugacityCoefficient_[numPhases][numComponents]
Definition: nonequilibrium.hh:396