14#ifndef DUMUX_NONEQUILIBRIUM_FLUID_STATE_HH
15#define DUMUX_NONEQUILIBRIUM_FLUID_STATE_HH
19#include <dune/common/exceptions.hh>
29template <
class ScalarType,
class Flu
idSystem>
33 static constexpr int numPhases = FluidSystem::numPhases;
93 * FluidSystem::molarMass(compIdx)
203 assert(FluidSystem::isGas(phaseIdx));
280 for (
int compJIdx = 0; compJIdx <
numComponents; ++compJIdx) {
295 DUNE_THROW(Dune::NotImplemented,
"This currently only works for 2 components.");
299 Scalar M1 = FluidSystem::molarMass(compIdx);
300 Scalar M2 = FluidSystem::molarMass(1-compIdx);
302 Scalar avgMolarMass = M1*M2/(M2 + X2*(M1 - M2));
304 moleFraction_[phaseIdx][compIdx] = value * avgMolarMass / M1;
310 for (
int compJIdx = 0; compJIdx <
numComponents; ++compJIdx) {
358 template <
class Flu
idState>
361 for (
int phaseIdx = 0; phaseIdx <
numPhases; ++phaseIdx)
367 moleFraction_[phaseIdx][compIdx] = fs.moleFraction(phaseIdx, compIdx);
372 pressure_[phaseIdx] = fs.pressure(phaseIdx);
374 density_[phaseIdx] = fs.density(phaseIdx);
376 enthalpy_[phaseIdx] = fs.enthalpy(phaseIdx);
377 viscosity_[phaseIdx] = fs.viscosity(phaseIdx);
Represents all relevant thermodynamic quantities of a multi-phase, multi-component fluid system witho...
Definition: nonequilibrium.hh:31
Scalar temperatureEquil_
Definition: nonequilibrium.hh:394
ScalarType Scalar
export the scalar type
Definition: nonequilibrium.hh:37
void setPressure(int phaseIdx, Scalar value)
Set the fluid pressure of a phase .
Definition: nonequilibrium.hh:249
Scalar viscosity(int phaseIdx) const
The dynamic viscosity of fluid phase in .
Definition: nonequilibrium.hh:226
Scalar molarDensity_[numPhases]
Definition: nonequilibrium.hh:390
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:292
Scalar density(int phaseIdx) const
The mass density of the fluid phase in .
Definition: nonequilibrium.hh:165
Scalar fugacity(int compIdx) const
Definition: nonequilibrium.hh:150
void setDensity(int phaseIdx, Scalar value)
Set the density of a phase .
Definition: nonequilibrium.hh:326
static constexpr int numPhases
Definition: nonequilibrium.hh:33
void setEnthalpy(int phaseIdx, Scalar value)
Set the specific enthalpy of a phase .
Definition: nonequilibrium.hh:338
static constexpr int numComponents
Definition: nonequilibrium.hh:34
int wettingPhase() const
Returns the index of the wetting phase in the fluid-solid configuration (for porous medium systems).
Definition: nonequilibrium.hh:47
void setMolarDensity(int phaseIdx, Scalar value)
Set the molar density of a phase .
Definition: nonequilibrium.hh:332
Scalar pressure(int phaseIdx) const
The pressure of a fluid phase in .
Definition: nonequilibrium.hh:194
Scalar fugacityCoefficient(int phaseIdx, int compIdx) const
The fugacity coefficient of component in fluid phase in .
Definition: nonequilibrium.hh:123
void setTemperature(int phaseIdx, Scalar value)
Set the temperature of a fluid phase.
Definition: nonequilibrium.hh:237
Scalar averageMolarMass(int phaseIdx) const
The average molar mass of phase in .
Definition: nonequilibrium.hh:105
Scalar moleFraction_[numPhases][numComponents]
Definition: nonequilibrium.hh:383
void assign(const FluidState &fs)
Retrieve all parameters from an arbitrary fluid state.
Definition: nonequilibrium.hh:359
void setFugacityCoefficient(int phaseIdx, int compIdx, Scalar value)
Set the fugacity of a component in a phase .
Definition: nonequilibrium.hh:320
void setMoleFraction(int phaseIdx, int compIdx, Scalar value)
Set the mole fraction of a component in a phase .
Definition: nonequilibrium.hh:261
Scalar internalEnergy(int phaseIdx) const
The specific internal energy of a fluid phase in .
Definition: nonequilibrium.hh:220
Scalar temperature(const int phaseIdx) const
The absolute temperature of a fluid phase in .
Definition: nonequilibrium.hh:182
Scalar partialPressure(int phaseIdx, int compIdx) const
The partial pressure of a component in a phase .
Definition: nonequilibrium.hh:201
Scalar pressure_[numPhases]
Definition: nonequilibrium.hh:387
Scalar molarDensity(int phaseIdx) const
The molar density of a fluid phase in .
Definition: nonequilibrium.hh:176
Scalar saturation_[numPhases]
Definition: nonequilibrium.hh:388
Scalar temperature_[numPhases]
Definition: nonequilibrium.hh:393
Scalar molarVolume(int phaseIdx) const
The molar volume of a fluid phase in .
Definition: nonequilibrium.hh:158
Scalar sumMoleFractions_[numPhases]
Definition: nonequilibrium.hh:386
Scalar enthalpy_[numPhases]
Definition: nonequilibrium.hh:391
Scalar density_[numPhases]
Definition: nonequilibrium.hh:389
Scalar fugacity(int phaseIdx, int compIdx) const
The fugacity of component in fluid phase in .
Definition: nonequilibrium.hh:143
void setSaturation(int phaseIdx, Scalar value)
Set the saturation of a phase .
Definition: nonequilibrium.hh:255
void setTemperature(Scalar value)
Set the temperature of all fluid phases.
Definition: nonequilibrium.hh:243
Scalar temperature() const
Get the equilibrium temperature of the fluid phases.
Definition: nonequilibrium.hh:188
Scalar saturation(int phaseIdx) const
Returns the saturation of a fluid phase in .
Definition: nonequilibrium.hh:56
Scalar enthalpy(int phaseIdx) const
The specific enthalpy of a fluid phase in .
Definition: nonequilibrium.hh:210
void setWettingPhase(int phaseIdx)
Set the index of the wetting phase.
Definition: nonequilibrium.hh:350
Scalar averageMolarMass_[numPhases]
Definition: nonequilibrium.hh:385
Scalar molarity(int phaseIdx, int compIdx) const
The molar concentration of component in fluid phase in .
Definition: nonequilibrium.hh:117
int wPhaseIdx_
Definition: nonequilibrium.hh:398
void setViscosity(int phaseIdx, Scalar value)
Set the dynamic viscosity of a phase .
Definition: nonequilibrium.hh:344
Scalar moleFraction(int phaseIdx, int compIdx) const
Returns the molar fraction of the component in fluid phase in .
Definition: nonequilibrium.hh:68
Scalar viscosity_[numPhases]
Definition: nonequilibrium.hh:392
Scalar massFraction(int phaseIdx, int compIdx) const
Returns the mass fraction of component in fluid phase in .
Definition: nonequilibrium.hh:87
Scalar fugacityCoefficient_[numPhases][numComponents]
Definition: nonequilibrium.hh:384