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) {
80 template <
class Flu
idState>
109 template <
class Flu
idState>
114 if (phaseIdx == oPhaseIdx)
116 else if (phaseIdx == gPhaseIdx)
127 Scalar
a(
int phaseIdx)
const
134 DUNE_THROW(Dune::InvalidStateException,
135 "The a() parameter is only defined for "
136 "oil and gas phases");
144 Scalar
b(
int phaseIdx)
const
151 DUNE_THROW(Dune::InvalidStateException,
152 "The b() parameter is only defined for "
153 "oil and gas phases");
164 Scalar
aPure(
int phaseIdx,
int compIdx)
const
171 DUNE_THROW(Dune::InvalidStateException,
172 "The a() parameter is only defined for "
173 "oil and gas phases");
183 Scalar
bPure(
int phaseIdx,
int compIdx)
const
190 DUNE_THROW(Dune::InvalidStateException,
191 "The b() parameter is only defined for "
192 "oil and gas phases");
203 return Vm_[phaseIdx];
225 template <
class Flu
idState>
253 template <
class Flu
idState>
256 Scalar T = fs.temperature(phaseIdx);
257 Scalar p = fs.pressure(phaseIdx);
273 template <
class Flu
idState>
290 template <
class Flu
idState>
329 const Scalar stockTankWaterDensity = 62.4 * 0.45359237 / 0.028316847;
332 Scalar overPressure = fs.pressure(wPhaseIdx) - 1.013e5;
333 Scalar waterDensity =
334 stockTankWaterDensity * (1 + 3.3e-6*overPressure/6894.7573);
337 Vm_[wPhaseIdx] = fs.averageMolarMass(wPhaseIdx)/waterDensity;
341 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.
bool CheckDefined(const T &value)
Make valgrind complain if the object occupied by an object is undefined.
Definition valgrind.hh:72
void SetUndefined(const T &value)
Make the memory on which an object resides undefined.
Definition valgrind.hh:102
Implements the Peng-Robinson equation of state for liquids and gases.
Definition pengrobinson.hh:57
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:143
The mixing rule for the oil and the gas phases of the SPE5 problem.
Definition pengrobinsonparamsmixture.hh:63
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
bool VmUpToDate_[numPhases]
Definition spe5parametercache.hh:345
Scalar b(int phaseIdx) const
The Peng-Robinson co-volume for a phase.
Definition spe5parametercache.hh:144
const GasPhaseParams & gasPhaseParams() const
Returns the Peng-Robinson mixture parameters for the gas phase.
Definition spe5parametercache.hh:218
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:164
void updateMolarVolume_(const FluidState &fs, int phaseIdx)
Definition spe5parametercache.hh:291
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:81
Scalar Vm_[numPhases]
Definition spe5parametercache.hh:346
Scalar a(int phaseIdx) const
The Peng-Robinson attractive parameter for a phase.
Definition spe5parametercache.hh:127
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:226
void updatePure_(const FluidState &fs, int phaseIdx)
Update all parameters of a phase which only depend on temperature and/or pressure.
Definition spe5parametercache.hh:254
const OilPhaseParams & oilPhaseParams() const
Returns the Peng-Robinson mixture parameters for the oil phase.
Definition spe5parametercache.hh:211
Spe5ParameterCache()
The constructor.
Definition spe5parametercache.hh:65
GasPhaseParams gasPhaseParams_
Definition spe5parametercache.hh:349
PengRobinsonParamsMixture< Scalar, ThisType, gPhaseIdx, true > GasPhaseParams
Definition spe5parametercache.hh:60
PengRobinsonParamsMixture< Scalar, ThisType, oPhaseIdx, true > OilPhaseParams
Definition spe5parametercache.hh:59
OilPhaseParams oilPhaseParams_
Definition spe5parametercache.hh:348
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:274
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:110
Scalar molarVolume(int phaseIdx) const
Returns the molar volume of a phase .
Definition spe5parametercache.hh:200
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:183