27#ifndef OPM_SPE5_FLUID_SYSTEM_HPP
28#define OPM_SPE5_FLUID_SYSTEM_HPP
56template <
class Scalar>
63 typedef typename ::Opm::PengRobinson<Scalar>
PengRobinson;
69 template <
class Evaluation>
88 typedef ::Opm::H2O<Scalar>
H2O;
91 static std::string_view
phaseName(
unsigned phaseIdx)
93 static const std::string_view name[] = {
100 return name[phaseIdx];
155 static const std::string_view name[] = {
166 return name[compIdx];
289 unsigned i = std::min(comp1Idx, comp2Idx);
290 unsigned j = std::max(comp1Idx, comp2Idx);
323 Scalar minA = 1e30, maxA = -1e30;
324 Scalar minB = 1e30, maxB = -1e30;
327 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx) {
328 minA = std::min(prParams.
pureParams(compIdx).
a(), minA);
329 maxA = std::max(prParams.
pureParams(compIdx).
a(), maxA);
330 minB = std::min(prParams.
pureParams(compIdx).
b(), minB);
331 maxB = std::max(prParams.
pureParams(compIdx).
b(), maxB);
335 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx) {
336 minA = std::min(prParams.
pureParams(compIdx).
a(), minA);
337 maxA = std::max(prParams.
pureParams(compIdx).
a(), maxA);
338 minB = std::min(prParams.
pureParams(compIdx).
b(), minB);
339 maxB = std::max(prParams.
pureParams(compIdx).
b(), maxB);
343 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx) {
344 minA = std::min(prParams.
pureParams(compIdx).
a(), minA);
345 maxA = std::max(prParams.
pureParams(compIdx).
a(), maxA);
346 minB = std::min(prParams.
pureParams(compIdx).
b(), minB);
347 maxB = std::max(prParams.
pureParams(compIdx).
b(), maxB);
351 for (
unsigned compIdx = 0; compIdx <
numComponents; ++compIdx) {
352 minA = std::min(prParams.
pureParams(compIdx).
a(), minA);
353 maxA = std::max(prParams.
pureParams(compIdx).
a(), maxA);
354 minB = std::min(prParams.
pureParams(compIdx).
b(), minB);
355 maxB = std::max(prParams.
pureParams(compIdx).
b(), maxB);
358 PengRobinson::init(minA, maxA, 100,
363 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
364 static LhsEval
density(
const FluidState& fluidState,
370 return fluidState.averageMolarMass(phaseIdx)/paramCache.
molarVolume(phaseIdx);
374 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
384 return 0.0170e-2 * 0.1;
393 return 0.208e-2 * 0.1;
398 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
415 henryCoeffWater_(compIdx, fluidState.temperature(
waterPhaseIdx))
421 template <
class LhsEval>
422 static LhsEval henryCoeffWater_(
unsigned compIdx,
const LhsEval& temperature)
431 case C1Idx:
return 5.57601e+09;
432 case C3Idx:
return 1e10;
433 case C6Idx:
return 1e10;
437 default:
throw std::logic_error(
"Unknown component index "+std::to_string(compIdx));
442template <
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:47
Scalar Scalar
The type used for scalar quantities.
Definition BaseFluidSystem.hpp:52
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:95
static std::string_view name()
A human readable name for the water.
Definition H2O.hpp:77
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition H2O.hpp:141
static const Scalar criticalMolarVolume()
Returns the molar volume of water at the critical point.
Definition H2O.hpp:113
static const Scalar acentricFactor()
The acentric factor of water.
Definition H2O.hpp:89
static const Scalar criticalPressure()
Returns the critical pressure of water.
Definition H2O.hpp:101
static const Scalar molarMass()
The molar mass in of water.
Definition H2O.hpp:83
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:74
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:59
The fluid system for the oil, gas and water phases of the SPE5 problem.
Definition Spe5FluidSystem.hpp:59
static const int oilPhaseIdx
Index of the oil phase.
Definition Spe5FluidSystem.hpp:85
static bool isIdealMixture(unsigned phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition Spe5FluidSystem.hpp:129
static const int H2OIdx
Index of the water component.
Definition Spe5FluidSystem.hpp:144
static const int numComponents
Number of chemical species in the fluid system.
Definition Spe5FluidSystem.hpp:142
static const int C15Idx
Index of the C15 component.
Definition Spe5FluidSystem.hpp:149
static const int numPhases
Number of fluid phases in the fluid system.
Definition Spe5FluidSystem.hpp:78
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:399
static Scalar criticalPressure(unsigned compIdx)
Critical pressure of a component [Pa].
Definition Spe5FluidSystem.hpp:216
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:364
static Scalar criticalTemperature(unsigned compIdx)
Critical temperature of a component [K].
Definition Spe5FluidSystem.hpp:193
static Scalar criticalMolarVolume(unsigned compIdx)
Molar volume of a component at the critical point [m^3/mol].
Definition Spe5FluidSystem.hpp:239
static Scalar acentricFactor(unsigned compIdx)
The acentric factor of a component [].
Definition Spe5FluidSystem.hpp:262
static LhsEval viscosity(const FluidState &, const ParameterCache< ParamCacheEval > &, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition Spe5FluidSystem.hpp:375
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:310
static const int C1Idx
Index of the C1 component.
Definition Spe5FluidSystem.hpp:145
static bool isCompressible(unsigned)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition Spe5FluidSystem.hpp:115
static const int C20Idx
Index of the C20 component.
Definition Spe5FluidSystem.hpp:150
static const int C6Idx
Index of the C6 component.
Definition Spe5FluidSystem.hpp:147
static const int C10Idx
Index of the C10 component.
Definition Spe5FluidSystem.hpp:148
static Scalar interactionCoefficient(unsigned comp1Idx, unsigned comp2Idx)
Returns the interaction coefficient for two components.
Definition Spe5FluidSystem.hpp:287
static const int waterPhaseIdx
Index of the water phase.
Definition Spe5FluidSystem.hpp:83
static Scalar molarMass(unsigned compIdx)
Return the molar mass of a component in [kg/mol].
Definition Spe5FluidSystem.hpp:170
::Opm::H2O< Scalar > H2O
The component for pure water to be used.
Definition Spe5FluidSystem.hpp:88
static const int C3Idx
Index of the C3 component.
Definition Spe5FluidSystem.hpp:146
static bool isLiquid(unsigned phaseIdx)
Return whether a phase is liquid.
Definition Spe5FluidSystem.hpp:104
static const int gasPhaseIdx
Index of the gas phase.
Definition Spe5FluidSystem.hpp:81
static std::string_view componentName(unsigned compIdx)
Return the human readable name of a component.
Definition Spe5FluidSystem.hpp:153
static std::string_view phaseName(unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition Spe5FluidSystem.hpp:91
static bool isIdealGas(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition Spe5FluidSystem.hpp:122
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
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
The type of the fluid system's parameter cache.
Definition Spe5FluidSystem.hpp:71