12#ifndef SPE5_PARAMETER_CACHE_HH
13#define SPE5_PARAMETER_CACHE_HH
30template <
class Scalar,
class Flu
idSystem>
39 enum { numPhases = FluidSystem::numPhases };
41 enum { wPhaseIdx = FluidSystem::wPhaseIdx };
42 enum { oPhaseIdx = FluidSystem::oPhaseIdx };
43 enum { gPhaseIdx = FluidSystem::gPhaseIdx };
55 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
66 template <
class Flu
idState>
95 template <
class Flu
idState>
100 if (phaseIdx == oPhaseIdx)
102 else if (phaseIdx == gPhaseIdx)
113 Scalar
a(
int phaseIdx)
const
120 DUNE_THROW(Dune::InvalidStateException,
121 "The a() parameter is only defined for "
122 "oil and gas phases");
130 Scalar
b(
int phaseIdx)
const
137 DUNE_THROW(Dune::InvalidStateException,
138 "The b() parameter is only defined for "
139 "oil and gas phases");
150 Scalar
aPure(
int phaseIdx,
int compIdx)
const
157 DUNE_THROW(Dune::InvalidStateException,
158 "The a() parameter is only defined for "
159 "oil and gas phases");
169 Scalar
bPure(
int phaseIdx,
int compIdx)
const
176 DUNE_THROW(Dune::InvalidStateException,
177 "The b() parameter is only defined for "
178 "oil and gas phases");
189 return Vm_[phaseIdx];
211 template <
class Flu
idState>
239 template <
class Flu
idState>
242 Scalar T = fs.temperature(phaseIdx);
243 Scalar p = fs.pressure(phaseIdx);
259 template <
class Flu
idState>
275 template <
class Flu
idState>
314 const Scalar stockTankWaterDensity = 62.4 * 0.45359237 / 0.028316847;
317 Scalar overPressure = fs.pressure(wPhaseIdx) - 1.013e5;
318 Scalar waterDensity =
319 stockTankWaterDensity * (1 + 3.3e-6*overPressure/6894.7573);
322 Vm_[wPhaseIdx] = fs.averageMolarMass(wPhaseIdx)/waterDensity;
326 DUNE_THROW(Dune::InvalidStateException,
"invalid phaseIdx " << phaseIdx);
The base class of the parameter cache classes for fluid systems.
Definition: parametercachebase.hh:23
@ Composition
Definition: parametercachebase.hh:29
@ Pressure
Definition: parametercachebase.hh:28
@ Temperature
Definition: parametercachebase.hh:27
@ None
Definition: parametercachebase.hh:26
Implements the Peng-Robinson equation of state for liquids and gases.
Definition: pengrobinson.hh:48
static Scalar computeMolarVolume(const FluidState &fs, Params ¶ms, int phaseIdx, bool isGasPhase, bool handleUnphysicalPhase=true)
Computes molar volumes where the Peng-Robinson EOS is true.
Definition: pengrobinson.hh:144
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
void updateMix(const FluidState &fs)
Calculates the "a" and "b" Peng-Robinson parameters for the mixture.
Definition: pengrobinsonparamsmixture.hh:124
const PureParams & pureParams(int compIdx) const
Return the Peng-Robinson parameters of a pure substance,.
Definition: pengrobinsonparamsmixture.hh:180
void updateSingleMoleFraction(const FluidState &fs, int compIdx)
Calculates the "a" and "b" Peng-Robinson parameters for the mixture provided that only a single mole ...
Definition: pengrobinsonparamsmixture.hh:170
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
bool VmUpToDate_[numPhases]
Definition: spe5parametercache.hh:330
Scalar b(int phaseIdx) const
The Peng-Robinson co-volume for a phase.
Definition: spe5parametercache.hh:130
const GasPhaseParams & gasPhaseParams() const
Returns the Peng-Robinson mixture parameters for the gas phase.
Definition: spe5parametercache.hh:204
Scalar aPure(int phaseIdx, int compIdx) const
The Peng-Robinson attractive parameter for a pure component given the same temperature and pressure o...
Definition: spe5parametercache.hh:150
void updateMolarVolume_(const FluidState &fs, int phaseIdx)
Definition: spe5parametercache.hh:276
void updatePhase(const FluidState &fs, int phaseIdx, int except=ParentType::None)
Update all parameters required by the fluid system to calculate some quantities for the phase.
Definition: spe5parametercache.hh:67
Scalar Vm_[numPhases]
Definition: spe5parametercache.hh:331
Scalar a(int phaseIdx) const
The Peng-Robinson attractive parameter for a phase.
Definition: spe5parametercache.hh:113
void updateEosParams(const FluidState &fs, int phaseIdx, int exceptQuantities=ParentType::None)
Update all parameters required by the equation of state to calculate some quantities for the phase.
Definition: spe5parametercache.hh:212
void updatePure_(const FluidState &fs, int phaseIdx)
Update all parameters of a phase which only depend on temperature and/or pressure.
Definition: spe5parametercache.hh:240
const OilPhaseParams & oilPhaseParams() const
Returns the Peng-Robinson mixture parameters for the oil phase.
Definition: spe5parametercache.hh:197
Spe5ParameterCache()
The constructor.
Definition: spe5parametercache.hh:53
GasPhaseParams gasPhaseParams_
Definition: spe5parametercache.hh:334
OilPhaseParams oilPhaseParams_
Definition: spe5parametercache.hh:333
void updateMix_(const FluidState &fs, int phaseIdx)
Update all parameters of a phase which depend on the fluid composition. It is assumed that updatePure...
Definition: spe5parametercache.hh:260
void updateSingleMoleFraction(const FluidState &fs, int phaseIdx, int compIdx)
Update all cached parameters of a specific fluid phase which depend on the mole fraction of a single ...
Definition: spe5parametercache.hh:96
Scalar molarVolume(int phaseIdx) const
Returns the molar volume of a phase .
Definition: spe5parametercache.hh:186
Scalar bPure(int phaseIdx, int compIdx) const
The Peng-Robinson co-volume for a pure component given the same temperature and pressure of the phase...
Definition: spe5parametercache.hh:169
Material properties of pure water .
The base class of the parameter cache classes for fluid systems.
Implements the Peng-Robinson equation of state for liquids and gases.
The mixing rule for the oil and the gas phases of the SPE5 problem.