24#ifndef SPE5_PARAMETER_CACHE_HH
25#define SPE5_PARAMETER_CACHE_HH
42template <
class Scalar,
class Flu
idSystem>
51 enum { numPhases = FluidSystem::numPhases };
53 enum { wPhaseIdx = FluidSystem::wPhaseIdx };
54 enum { oPhaseIdx = FluidSystem::oPhaseIdx };
55 enum { gPhaseIdx = FluidSystem::gPhaseIdx };
67 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
78 template <
class Flu
idState>
107 template <
class Flu
idState>
112 if (phaseIdx == oPhaseIdx)
114 else if (phaseIdx == gPhaseIdx)
125 Scalar
a(
int phaseIdx)
const
132 DUNE_THROW(Dune::InvalidStateException,
133 "The a() parameter is only defined for "
134 "oil and gas phases");
142 Scalar
b(
int phaseIdx)
const
149 DUNE_THROW(Dune::InvalidStateException,
150 "The b() parameter is only defined for "
151 "oil and gas phases");
162 Scalar
aPure(
int phaseIdx,
int compIdx)
const
169 DUNE_THROW(Dune::InvalidStateException,
170 "The a() parameter is only defined for "
171 "oil and gas phases");
181 Scalar
bPure(
int phaseIdx,
int compIdx)
const
188 DUNE_THROW(Dune::InvalidStateException,
189 "The b() parameter is only defined for "
190 "oil and gas phases");
201 return Vm_[phaseIdx];
223 template <
class Flu
idState>
251 template <
class Flu
idState>
254 Scalar T = fs.temperature(phaseIdx);
255 Scalar p = fs.pressure(phaseIdx);
271 template <
class Flu
idState>
287 template <
class Flu
idState>
326 const Scalar stockTankWaterDensity = 62.4 * 0.45359237 / 0.028316847;
329 Scalar overPressure = fs.pressure(wPhaseIdx) - 1.013e5;
330 Scalar waterDensity =
331 stockTankWaterDensity * (1 + 3.3e-6*overPressure/6894.7573);
334 Vm_[wPhaseIdx] = fs.averageMolarMass(wPhaseIdx)/waterDensity;
338 DUNE_THROW(Dune::InvalidStateException,
"invalid phaseIdx " << phaseIdx);
Material properties of pure water .
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.
The base class of the parameter cache classes for fluid systems.
Implements the Peng-Robinson equation of state for liquids and gases.
Definition: pengrobinson.hh:58
static Scalar computeMolarVolume(const FluidState &fs, Params ¶ms, int phaseIdx, bool isGasPhase)
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:50
Scalar b() const
Returns the repulsive parameter 'b' of the Peng-Robinson fluid.
Definition: pengrobinsonparams.hh:58
void updateMix(const FluidState &fs)
Calculates the "a" and "b" Peng-Robinson parameters for the mixture.
Definition: pengrobinsonparamsmixture.hh:136
const PureParams & pureParams(int compIdx) const
Return the Peng-Robinson parameters of a pure substance,.
Definition: pengrobinsonparamsmixture.hh:192
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:182
void updatePure(const FluidState &fluidState)
Update Peng-Robinson parameters for the pure components.
Definition: pengrobinsonparamsmixture.hh:76
The base class of the parameter cache classes for fluid systems.
Definition: parametercachebase.hh:35
@ Composition
Definition: parametercachebase.hh:41
@ Pressure
Definition: parametercachebase.hh:40
@ Temperature
Definition: parametercachebase.hh:39
@ None
Definition: parametercachebase.hh:38
Specifies the parameters required by the SPE5 problem which are despondent on the thermodynamic state...
Definition: spe5parametercache.hh:45
bool VmUpToDate_[numPhases]
Definition: spe5parametercache.hh:342
Scalar b(int phaseIdx) const
The Peng-Robinson co-volume for a phase.
Definition: spe5parametercache.hh:142
const GasPhaseParams & gasPhaseParams() const
Returns the Peng-Robinson mixture parameters for the gas phase.
Definition: spe5parametercache.hh:216
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:162
void updateMolarVolume_(const FluidState &fs, int phaseIdx)
Definition: spe5parametercache.hh:288
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:79
Scalar Vm_[numPhases]
Definition: spe5parametercache.hh:343
Scalar a(int phaseIdx) const
The Peng-Robinson attractive parameter for a phase.
Definition: spe5parametercache.hh:125
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:224
void updatePure_(const FluidState &fs, int phaseIdx)
Update all parameters of a phase which only depend on temperature and/or pressure.
Definition: spe5parametercache.hh:252
const OilPhaseParams & oilPhaseParams() const
Returns the Peng-Robinson mixture parameters for the oil phase.
Definition: spe5parametercache.hh:209
Spe5ParameterCache()
The constructor.
Definition: spe5parametercache.hh:65
GasPhaseParams gasPhaseParams_
Definition: spe5parametercache.hh:346
OilPhaseParams oilPhaseParams_
Definition: spe5parametercache.hh:345
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:272
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:108
Scalar molarVolume(int phaseIdx) const
Returns the molar volume of a phase .
Definition: spe5parametercache.hh:198
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:181