27 #ifndef OPM_SPE5_FLUID_SYSTEM_HPP
28 #define OPM_SPE5_FLUID_SYSTEM_HPP
54 template <
class Scalar>
61 typedef typename ::Opm::PengRobinson<Scalar>
PengRobinson;
67 template <
class Evaluation>
86 typedef ::Opm::H2O<Scalar>
H2O;
91 static const char* name[] = {
98 return name[phaseIdx];
153 static const char* name[] = {
164 return name[compIdx];
287 unsigned i = std::min(comp1Idx, comp2Idx);
288 unsigned j = std::max(comp1Idx, comp2Idx);
321 Scalar minA = 1e30, maxA = -1e30;
322 Scalar minB = 1e30, maxB = -1e30;
325 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx) {
326 minA = std::min(prParams.
pureParams(compIdx).
a(), minA);
327 maxA = std::max(prParams.
pureParams(compIdx).
a(), maxA);
328 minB = std::min(prParams.
pureParams(compIdx).
b(), minB);
329 maxB = std::max(prParams.
pureParams(compIdx).
b(), maxB);
333 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx) {
334 minA = std::min(prParams.
pureParams(compIdx).
a(), minA);
335 maxA = std::max(prParams.
pureParams(compIdx).
a(), maxA);
336 minB = std::min(prParams.
pureParams(compIdx).
b(), minB);
337 maxB = std::max(prParams.
pureParams(compIdx).
b(), maxB);
341 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx) {
342 minA = std::min(prParams.
pureParams(compIdx).
a(), minA);
343 maxA = std::max(prParams.
pureParams(compIdx).
a(), maxA);
344 minB = std::min(prParams.
pureParams(compIdx).
b(), minB);
345 maxB = std::max(prParams.
pureParams(compIdx).
b(), maxB);
349 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx) {
350 minA = std::min(prParams.
pureParams(compIdx).
a(), minA);
351 maxA = std::max(prParams.
pureParams(compIdx).
a(), maxA);
352 minB = std::min(prParams.
pureParams(compIdx).
b(), minB);
353 maxB = std::max(prParams.
pureParams(compIdx).
b(), maxB);
356 PengRobinson::init(minA, maxA, 100,
361 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
362 static LhsEval
density(
const FluidState& fluidState,
368 return fluidState.averageMolarMass(phaseIdx)/paramCache.
molarVolume(phaseIdx);
372 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
382 return 0.0170e-2 * 0.1;
391 return 0.208e-2 * 0.1;
396 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
413 henryCoeffWater_(compIdx, fluidState.temperature(
waterPhaseIdx))
419 template <
class LhsEval>
420 static LhsEval henryCoeffWater_(
unsigned compIdx,
const LhsEval& temperature)
429 case C1Idx:
return 5.57601e+09;
430 case C3Idx:
return 1e10;
431 case C6Idx:
return 1e10;
435 default:
throw std::logic_error(
"Unknown component index "+std::to_string(compIdx));
440 template <
class Scalar>
The base class for all fluid systems.
A central place for various physical constants occuring in some equations.
Implements the Peng-Robinson equation of state for a mixture.
Specifies the parameter cache used by the SPE-5 fluid system.
Class implementing cubic splines.
The base class for all fluid systems.
Definition: BaseFluidSystem.hpp:44
Scalar Scalar
The type used for scalar quantities.
Definition: BaseFluidSystem.hpp:49
static const Scalar R
The ideal gas constant [J/(mol K)].
Definition: Constants.hpp:45
static const Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: H2O.hpp:92
static const char * name()
A human readable name for the water.
Definition: H2O.hpp:74
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition: H2O.hpp:138
static const Scalar criticalMolarVolume()
Returns the molar volume of water at the critical point.
Definition: H2O.hpp:110
static const Scalar acentricFactor()
The acentric factor of water.
Definition: H2O.hpp:86
static const Scalar criticalPressure()
Returns the critical pressure of water.
Definition: H2O.hpp:98
static const Scalar molarMass()
The molar mass in of water.
Definition: H2O.hpp:80
Implements the Peng-Robinson equation of state for a mixture.
Definition: PengRobinsonMixture.hpp:41
static LhsEval computeFugacityCoefficient(const FluidState &fs, const Params ¶ms, unsigned phaseIdx, unsigned compIdx)
Returns the fugacity coefficient of an individual component in the phase.
Definition: PengRobinsonMixture.hpp:89
The mixing rule for the oil and the gas phases of the SPE5 problem.
Definition: PengRobinsonParamsMixture.hpp:60
void updatePure(const FluidState &fluidState)
Update Peng-Robinson parameters for the pure components.
Definition: PengRobinsonParamsMixture.hpp:82
const PureParams & pureParams(unsigned compIdx) const
Return the Peng-Robinson parameters of a pure substance,.
Definition: PengRobinsonParamsMixture.hpp:205
Scalar a() const
Returns the attractive parameter 'a' of the Peng-Robinson fluid.
Definition: PengRobinsonParams.hpp:50
Scalar b() const
Returns the repulsive parameter 'b' of the Peng-Robinson fluid.
Definition: PengRobinsonParams.hpp:57
Implements the Peng-Robinson equation of state for liquids and gases.
Definition: PengRobinson.hpp:56
The fluid system for the oil, gas and water phases of the SPE5 problem.
Definition: Spe5FluidSystem.hpp:57
static const int oilPhaseIdx
Index of the oil phase.
Definition: Spe5FluidSystem.hpp:83
static bool isIdealMixture(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: Spe5FluidSystem.hpp:127
static const char * componentName(unsigned compIdx)
Return the human readable name of a component.
Definition: Spe5FluidSystem.hpp:151
static const int H2OIdx
Index of the water component.
Definition: Spe5FluidSystem.hpp:142
static const int numComponents
Number of chemical species in the fluid system.
Definition: Spe5FluidSystem.hpp:140
static const int C15Idx
Index of the C15 component.
Definition: Spe5FluidSystem.hpp:147
static const int numPhases
Number of fluid phases in the fluid system.
Definition: Spe5FluidSystem.hpp:76
static LhsEval fugacityCoefficient(const FluidState &fluidState, const ParameterCache< ParamCacheEval > ¶mCache, unsigned phaseIdx, unsigned compIdx)
Calculate the fugacity coefficient [Pa] of an individual component in a fluid phase.
Definition: Spe5FluidSystem.hpp:397
static Scalar criticalPressure(unsigned compIdx)
Critical pressure of a component [Pa].
Definition: Spe5FluidSystem.hpp:214
static LhsEval density(const FluidState &fluidState, const ParameterCache< ParamCacheEval > ¶mCache, unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: Spe5FluidSystem.hpp:362
static Scalar criticalTemperature(unsigned compIdx)
Critical temperature of a component [K].
Definition: Spe5FluidSystem.hpp:191
static Scalar criticalMolarVolume(unsigned compIdx)
Molar volume of a component at the critical point [m^3/mol].
Definition: Spe5FluidSystem.hpp:237
static const char * phaseName(unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition: Spe5FluidSystem.hpp:89
static Scalar acentricFactor(unsigned compIdx)
The acentric factor of a component [].
Definition: Spe5FluidSystem.hpp:260
static LhsEval viscosity(const FluidState &, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: Spe5FluidSystem.hpp:373
static void init(Scalar minT=273.15, Scalar maxT=373.15, Scalar minP=1e4, Scalar maxP=100e6)
Initialize the fluid system's static parameters.
Definition: Spe5FluidSystem.hpp:308
static const int C1Idx
Index of the C1 component.
Definition: Spe5FluidSystem.hpp:143
static bool isCompressible(unsigned)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: Spe5FluidSystem.hpp:113
static const int C20Idx
Index of the C20 component.
Definition: Spe5FluidSystem.hpp:148
static const int C6Idx
Index of the C6 component.
Definition: Spe5FluidSystem.hpp:145
static const int C10Idx
Index of the C10 component.
Definition: Spe5FluidSystem.hpp:146
static Scalar interactionCoefficient(unsigned comp1Idx, unsigned comp2Idx)
Returns the interaction coefficient for two components.
Definition: Spe5FluidSystem.hpp:285
static const int waterPhaseIdx
Index of the water phase.
Definition: Spe5FluidSystem.hpp:81
static Scalar molarMass(unsigned compIdx)
Return the molar mass of a component in [kg/mol].
Definition: Spe5FluidSystem.hpp:168
::Opm::H2O< Scalar > H2O
The component for pure water to be used.
Definition: Spe5FluidSystem.hpp:86
static const int C3Idx
Index of the C3 component.
Definition: Spe5FluidSystem.hpp:144
static bool isLiquid(unsigned phaseIdx)
Return whether a phase is liquid.
Definition: Spe5FluidSystem.hpp:102
static const int gasPhaseIdx
Index of the gas phase.
Definition: Spe5FluidSystem.hpp:79
static bool isIdealGas(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: Spe5FluidSystem.hpp:120
Specifies the parameter cache used by the SPE-5 fluid system.
Definition: Spe5ParameterCache.hpp:47
Scalar molarVolume(unsigned phaseIdx) const
Returns the molar volume of a phase [m^3/mol].
Definition: Spe5ParameterCache.hpp:202
The type of the fluid system's parameter cache.
Definition: Spe5FluidSystem.hpp:69