27 #ifndef OPM_SPE5_PARAMETER_CACHE_HPP 28 #define OPM_SPE5_PARAMETER_CACHE_HPP 44 template <
class Scalar,
class Flu
idSystem>
53 enum { numPhases = FluidSystem::numPhases };
55 enum { waterPhaseIdx = FluidSystem::waterPhaseIdx };
56 enum { oilPhaseIdx = FluidSystem::oilPhaseIdx };
57 enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
67 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
68 VmUpToDate_[phaseIdx] =
false;
69 Valgrind::SetUndefined(Vm_[phaseIdx]);
74 template <
class Flu
idState>
83 if (VmUpToDate_[phaseIdx])
87 updateMolarVolume_(fluidState, phaseIdx);
91 template <
class Flu
idState>
96 if (phaseIdx == oilPhaseIdx)
98 else if (phaseIdx == gasPhaseIdx)
102 updateMolarVolume_(fluidState, phaseIdx);
110 Scalar
a(
unsigned phaseIdx)
const 114 case oilPhaseIdx:
return oilPhaseParams_.
a();
115 case gasPhaseIdx:
return gasPhaseParams_.
a();
117 OPM_THROW(std::logic_error,
118 "The a() parameter is only defined for " 119 "oil and gas phases");
128 Scalar
b(
unsigned phaseIdx)
const 132 case oilPhaseIdx:
return oilPhaseParams_.
b();
133 case gasPhaseIdx:
return gasPhaseParams_.
b();
135 OPM_THROW(std::logic_error,
136 "The b() parameter is only defined for " 137 "oil and gas phases");
149 Scalar
aPure(
unsigned phaseIdx,
unsigned compIdx)
const 153 case oilPhaseIdx:
return oilPhaseParams_.
pureParams(compIdx).
a();
154 case gasPhaseIdx:
return gasPhaseParams_.
pureParams(compIdx).
a();
156 OPM_THROW(std::logic_error,
157 "The a() parameter is only defined for " 158 "oil and gas phases");
169 Scalar
bPure(
unsigned phaseIdx,
unsigned compIdx)
const 173 case oilPhaseIdx:
return oilPhaseParams_.
pureParams(compIdx).
b();
174 case gasPhaseIdx:
return gasPhaseParams_.
pureParams(compIdx).
b();
176 OPM_THROW(std::logic_error,
177 "The b() parameter is only defined for " 178 "oil and gas phases");
188 { assert(VmUpToDate_[phaseIdx]);
return Vm_[phaseIdx]; }
196 {
return oilPhaseParams_; }
203 {
return gasPhaseParams_; }
213 template <
class Flu
idState>
222 VmUpToDate_[phaseIdx] =
false;
227 VmUpToDate_[phaseIdx] =
false;
230 VmUpToDate_[phaseIdx] =
false;
241 template <
class Flu
idState>
244 Scalar T = fluidState.temperature(phaseIdx);
245 Scalar p = fluidState.pressure(phaseIdx);
249 case oilPhaseIdx: oilPhaseParams_.
updatePure(T, p);
break;
250 case gasPhaseIdx: gasPhaseParams_.
updatePure(T, p);
break;
262 template <
class Flu
idState>
263 void updateMix_(
const FluidState& fluidState,
unsigned phaseIdx)
265 Valgrind::CheckDefined(fluidState.averageMolarMass(phaseIdx));
279 template <
class Flu
idState>
280 void updateMolarVolume_(
const FluidState& fluidState,
283 VmUpToDate_[phaseIdx] =
true;
315 case waterPhaseIdx: {
319 const Scalar stockTankWaterDensity = 62.4 * 0.45359237 / 0.028316847;
322 Scalar overPressure = fluidState.pressure(waterPhaseIdx) - 1.013e5;
323 Scalar waterDensity =
324 stockTankWaterDensity * (1 + 3.3e-6*overPressure/6894.7573);
327 Vm_[waterPhaseIdx] = fluidState.averageMolarMass(waterPhaseIdx)/waterDensity;
333 bool VmUpToDate_[numPhases];
334 Scalar Vm_[numPhases];
The mixing rule for the oil and the gas phases of the SPE5 problem.
Definition: PengRobinsonParamsMixture.hpp:58
Scalar a(unsigned phaseIdx) const
The Peng-Robinson attractive parameter for a phase.
Definition: Spe5ParameterCache.hpp:110
Implements the Peng-Robinson equation of state for liquids and gases.
Definition: PengRobinson.hpp:56
Opm::PengRobinsonParamsMixture< Scalar, FluidSystem, oilPhaseIdx, true > OilPhaseParams
The cached parameters for the oil phase.
Definition: Spe5ParameterCache.hpp:61
void updateMix(const FluidState &fs)
Calculates the "a" and "b" Peng-Robinson parameters for the mixture.
Definition: PengRobinsonParamsMixture.hpp:139
Scalar bPure(unsigned phaseIdx, unsigned compIdx) const
The Peng-Robinson covolume for a pure component given the same temperature and pressure of the phase...
Definition: Spe5ParameterCache.hpp:169
Specifies the parameter cache used by the SPE-5 fluid system.
Definition: Spe5ParameterCache.hpp:45
Scalar b(unsigned phaseIdx) const
The Peng-Robinson covolume for a phase.
Definition: Spe5ParameterCache.hpp:128
Opm::PengRobinsonParamsMixture< Scalar, FluidSystem, gasPhaseIdx, true > GasPhaseParams
The cached parameters for the gas phase.
Definition: Spe5ParameterCache.hpp:63
Definition: Air_Mesitylene.hpp:33
Material properties of pure water .
The temperature has not been modified.
Definition: ParameterCacheBase.hpp:48
const OilPhaseParams & oilPhaseParams() const
Returns the Peng-Robinson mixture parameters for the oil phase.
Definition: Spe5ParameterCache.hpp:195
Implements the Peng-Robinson equation of state for liquids and gases.
The compositions have not been modified.
Definition: ParameterCacheBase.hpp:54
void updatePure(const FluidState &fluidState)
Update Peng-Robinson parameters for the pure components.
Definition: PengRobinsonParamsMixture.hpp:76
Scalar aPure(unsigned phaseIdx, unsigned compIdx) const
The Peng-Robinson attractive parameter for a pure component given the same temperature and pressure o...
Definition: Spe5ParameterCache.hpp:149
All quantities have been (potentially) modified.
Definition: ParameterCacheBase.hpp:45
The pressures have not been modified.
Definition: ParameterCacheBase.hpp:51
The base class of the parameter caches of fluid systems.
Definition: ParameterCacheBase.hpp:37
void updatePure_(const FluidState &fluidState, unsigned phaseIdx)
Update all parameters of a phase which only depend on temperature and/or pressure.
Definition: Spe5ParameterCache.hpp:242
void updateEosParams(const FluidState &fluidState, unsigned phaseIdx, int exceptQuantities=ParentType::None)
Update all parameters required by the equation of state to calculate some quantities for the phase...
Definition: Spe5ParameterCache.hpp:214
void updateSingleMoleFraction(const FluidState &fs, unsigned)
Calculates the "a" and "b" Peng-Robinson parameters for the mixture provided that only a single mole ...
Definition: PengRobinsonParamsMixture.hpp:191
const GasPhaseParams & gasPhaseParams() const
Returns the Peng-Robinson mixture parameters for the gas phase.
Definition: Spe5ParameterCache.hpp:202
The mixing rule for the oil and the gas phases of the SPE5 problem.
Scalar a() const
Returns the attractive parameter 'a' of the Peng-Robinson fluid.
Definition: PengRobinsonParams.hpp:50
void updatePhase(const FluidState &fluidState, unsigned phaseIdx, int exceptQuantities=ParentType::None)
Update all cached parameters of a specific fluid phase.
Definition: Spe5ParameterCache.hpp:75
The base class of the parameter caches of fluid systems.
Scalar b() const
Returns the repulsive parameter 'b' of the Peng-Robinson fluid.
Definition: PengRobinsonParams.hpp:57
static FluidState::Scalar computeMolarVolume(const FluidState &fs, Params ¶ms, unsigned phaseIdx, bool isGasPhase)
Computes molar volumes where the Peng-Robinson EOS is true.
Definition: PengRobinson.hpp:146
void updateMix_(const FluidState &fluidState, unsigned phaseIdx)
Update all parameters of a phase which depend on the fluid composition.
Definition: Spe5ParameterCache.hpp:263
void updateSingleMoleFraction(const FluidState &fluidState, unsigned phaseIdx, unsigned compIdx)
Update all cached parameters of a specific fluid phase which depend on the mole fraction of a single ...
Definition: Spe5ParameterCache.hpp:92
Scalar molarVolume(unsigned phaseIdx) const
Returns the molar volume of a phase [m^3/mol].
Definition: Spe5ParameterCache.hpp:187
const PureParams & pureParams(unsigned compIdx) const
Return the Peng-Robinson parameters of a pure substance,.
Definition: PengRobinsonParamsMixture.hpp:200