12#ifndef DUMUX_SPE5_FLUID_SYSTEM_HH
13#define DUMUX_SPE5_FLUID_SYSTEM_HH
42template <
class Scalar>
76 assert(0 <= phaseIdx && phaseIdx <
numPhases);
83 DUNE_THROW(Dune::InvalidStateException,
"Invalid phase index " << phaseIdx);
96 static constexpr bool isGas(
int phaseIdx)
98 assert(0 <= phaseIdx && phaseIdx <
numPhases);
110 assert(0 <= phaseIdx && phaseIdx <
numPhases);
143 assert(0 <= phaseIdx && phaseIdx <
numPhases);
168 static std::string name[] = {
179 return name[compIdx];
188 static const Scalar M[] = {
208 static const Scalar Tcrit[] = {
219 return Tcrit[compIdx];
228 static const Scalar pcrit[] = {
239 return pcrit[compIdx];
248 static const Scalar R = 8.314472;
249 static const Scalar vcrit[] = {
260 return vcrit[compIdx];
269 static const Scalar accFac[] = {
280 return accFac[compIdx];
294 int i = min(comp1Idx, comp2Idx);
295 int j = max(comp1Idx, comp2Idx);
319 Scalar minT = 273.15, maxT = 373.15;
320 Scalar minP = 1e4, maxP = 100e6;
322 Scalar minA = 1e100, maxA = -1e100;
323 Scalar minB = 1e100, maxB = -1e100;
329 minA = min(prParams.
pureParams(compIdx).
a(), minA);
330 maxA = max(prParams.
pureParams(compIdx).
a(), maxA);
331 minB = min(prParams.
pureParams(compIdx).
b(), minB);
332 maxB = max(prParams.
pureParams(compIdx).
b(), maxB);
337 minA = min(prParams.
pureParams(compIdx).
a(), minA);
338 maxA = max(prParams.
pureParams(compIdx).
a(), maxA);
339 minB = min(prParams.
pureParams(compIdx).
b(), minB);
340 maxB = max(prParams.
pureParams(compIdx).
b(), maxB);
345 minA = min(prParams.
pureParams(compIdx).
a(), minA);
346 maxA = max(prParams.
pureParams(compIdx).
a(), maxA);
347 minB = min(prParams.
pureParams(compIdx).
b(), minB);
348 maxB = max(prParams.
pureParams(compIdx).
b(), maxB);
353 minA = min(prParams.
pureParams(compIdx).
a(), minA);
354 maxA = max(prParams.
pureParams(compIdx).
a(), maxA);
355 minB = min(prParams.
pureParams(compIdx).
b(), minB);
356 maxB = max(prParams.
pureParams(compIdx).
b(), maxB);
371 template <
class Flu
idState>
372 static Scalar
density(
const FluidState &fluidState,
376 assert(0 <= phaseIdx && phaseIdx <
numPhases);
378 return fluidState.averageMolarMass(phaseIdx)/paramCache.
molarVolume(phaseIdx);
390 template <
class Flu
idState>
402 template <
class Flu
idState>
407 assert(0 <= phaseIdx && phaseIdx <=
numPhases);
412 return 0.0170e-2 * 0.1;
421 return 0.208e-2 * 0.1;
440 template <
class Flu
idState>
446 assert(0 <= phaseIdx && phaseIdx <=
numPhases);
456 return henryCoeffWater_(compIdx, fs.temperature(
wPhaseIdx))
485 template <
class Flu
idState>
490 { DUNE_THROW(Dune::NotImplemented,
"Diffusion coefficients"); }
503 template <
class Flu
idState>
509 { DUNE_THROW(Dune::NotImplemented,
"Binary diffusion coefficients"); }
518 template <
class Flu
idState>
522 { DUNE_THROW(Dune::NotImplemented,
"Enthalpies"); }
531 template <
class Flu
idState>
535 { DUNE_THROW(Dune::NotImplemented,
"Thermal conductivities"); }
544 template <
class Flu
idState>
548 { DUNE_THROW(Dune::NotImplemented,
"Heat capacities"); }
552 static Scalar henryCoeffWater_(
int compIdx, Scalar
temperature)
561 case C1Idx:
return 5.57601e+09;
562 case C3Idx:
return 1e10;
563 case C6Idx:
return 1e10;
567 default: DUNE_THROW(Dune::InvalidStateException,
"Unknown component index " << compIdx);
Material properties of pure water .
Definition: h2o.hh:48
static Scalar vaporPressure(Scalar T)
The vapor pressure in of pure water at a given temperature.
Definition: h2o.hh:118
static constexpr Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: h2o.hh:80
static std::string name()
A human readable name for the water.
Definition: h2o.hh:62
static constexpr Scalar molarMass()
The molar mass in of water.
Definition: h2o.hh:68
static constexpr Scalar criticalPressure()
Returns the critical pressure of water.
Definition: h2o.hh:86
static constexpr Scalar criticalMolarVolume()
Returns the molar volume of water at the critical point.
Definition: h2o.hh:92
The fluid system for the SPE-5 benchmark problem.
Definition: spe5.hh:44
static Scalar molarDensity(const FluidState &fluidState, const ParameterCache ¶mCache, int phaseIdx)
The molar density of a fluid phase in .
Definition: spe5.hh:391
static bool isIdealMixture(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: spe5.hh:127
static Scalar criticalTemperature(int compIdx)
Critical temperature of a component .
Definition: spe5.hh:206
static const int C15Idx
Definition: spe5.hh:159
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, const ParameterCache ¶mCache, int phaseIdx, int compIIdx, int compJIdx)
Given a phase's composition, temperature and pressure, return the binary diffusion coefficient for c...
Definition: spe5.hh:504
static Scalar heatCapacity(const FluidState &fluidState, const ParameterCache ¶mCache, int phaseIdx)
Given a phase's composition, temperature and pressure, calculate its heat capacity .
Definition: spe5.hh:545
static const int C3Idx
Definition: spe5.hh:156
static Scalar fugacityCoefficient(const FluidState &fs, const ParameterCache ¶mCache, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: spe5.hh:441
static Scalar thermalConductivity(const FluidState &fluidState, const ParameterCache ¶mCache, int phaseIdx)
Given a phase's composition, temperature and pressure, calculate its thermal conductivity .
Definition: spe5.hh:532
static const int H2OIdx
Definition: spe5.hh:154
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: spe5.hh:166
static Scalar diffusionCoefficient(const FluidState &fs, const ParameterCache ¶mCache, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: spe5.hh:486
static const int C6Idx
Definition: spe5.hh:157
static const int C20Idx
Definition: spe5.hh:160
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: spe5.hh:186
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: spe5.hh:89
static bool isIdealGas(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: spe5.hh:141
static const int C1Idx
Definition: spe5.hh:155
static const int numComponents
Number of components in the fluid system.
Definition: spe5.hh:152
static const int oPhaseIdx
Index of the oil phase.
Definition: spe5.hh:65
static Scalar density(const FluidState &fluidState, const ParameterCache ¶mCache, int phaseIdx)
Calculate the density of a fluid phase.
Definition: spe5.hh:372
static const int C10Idx
Definition: spe5.hh:158
static Scalar acentricFactor(int compIdx)
The acentric factor of a component .
Definition: spe5.hh:267
static const int gPhaseIdx
Index of the gas phase.
Definition: spe5.hh:61
static Scalar viscosity(const FluidState &fs, const ParameterCache ¶mCache, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: spe5.hh:403
static void init()
Initialize the fluid system's static parameters.
Definition: spe5.hh:310
static Scalar interactionCoefficient(int comp1Idx, int comp2Idx)
Returns the interaction coefficient for two components.
Definition: spe5.hh:290
static const int numPhases
Number of phases in the fluid system.
Definition: spe5.hh:58
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: spe5.hh:74
static const int wPhaseIdx
Index of the water phase.
Definition: spe5.hh:63
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: spe5.hh:96
static Scalar criticalPressure(int compIdx)
Critical pressure of a component .
Definition: spe5.hh:226
static Scalar criticalMolarVolume(int compIdx)
Molar volume of a component at the critical point .
Definition: spe5.hh:246
static Scalar enthalpy(const FluidState &fs, const ParameterCache ¶mCache, int phaseIdx)
Given a phase's composition, temperature and pressure, calculate its specific enthalpy .
Definition: spe5.hh:519
static constexpr bool isCompressible(int phaseIdx)
Return whether a phase is compressible.
Definition: spe5.hh:108
Implements the Peng-Robinson equation of state for liquids and gases.
Definition: pengrobinson.hh:48
static void init(Scalar aMin, Scalar aMax, int na, Scalar bMin, Scalar bMax, int nb)
Definition: pengrobinson.hh:53
Implements the Peng-Robinson equation of state for a mixture.
Definition: pengrobinsonmixture.hh:29
static Scalar computeFugacityCoefficient(const FluidState &fs, const Params ¶ms, int phaseIdx, int compIdx)
Returns the fugacity coefficient of an individual component in the phase.
Definition: pengrobinsonmixture.hh:61
Scalar a() const
Returns the attractive parameter 'a' of the Peng-Robinson fluid.
Definition: pengrobinsonparams.hh:38
Scalar b() const
Returns the repulsive parameter 'b' of the Peng-Robinson fluid.
Definition: pengrobinsonparams.hh:46
The mixing rule for the oil and the gas phases of the SPE5 problem.
Definition: pengrobinsonparamsmixture.hh:51
const PureParams & pureParams(int compIdx) const
Return the Peng-Robinson parameters of a pure substance,.
Definition: pengrobinsonparamsmixture.hh:180
void updatePure(const FluidState &fluidState)
Update Peng-Robinson parameters for the pure components.
Definition: pengrobinsonparamsmixture.hh:64
Specifies the parameters required by the SPE5 problem which are despondent on the thermodynamic state...
Definition: spe5parametercache.hh:33
Scalar molarVolume(int phaseIdx) const
Returns the molar volume of a phase .
Definition: spe5parametercache.hh:186
A collection of input/output field names for common physical quantities.
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:39
std::string gaseousPhase() noexcept
I/O name of gaseous phase.
Definition: name.hh:111
std::string naplPhase() noexcept
I/O name of napl phase.
Definition: name.hh:119
std::string aqueousPhase() noexcept
I/O name of aqueous phase.
Definition: name.hh:115
Implements the Peng-Robinson equation of state for a mixture.
Specifies the parameters required by the SPE5 problem which are despondent on the thermodynamic state...
Provides 3rd order polynomial splines.