35#ifndef DUMUX_PENG_ROBINSON_PARAMS_MIXTURE_HH
36#define DUMUX_PENG_ROBINSON_PARAMS_MIXTURE_HH
60template <
class Scalar,
class Flu
idSystem,
int phaseIdx,
bool useSpe5Relations=false>
64 enum { numComponents = FluidSystem::numComponents };
75 template <
class Flu
idState>
79 fluidState.pressure(phaseIdx));
95 for (
int i = 0; i < numComponents; ++i) {
96 Scalar pc = FluidSystem::criticalPressure(i);
97 Scalar omega = FluidSystem::acentricFactor(i);
98 Scalar Tr =
temperature/FluidSystem::criticalTemperature(i);
103 if (useSpe5Relations) {
104 if (omega < 0.49) f_omega = 0.37464 + omega*(1.54226 + omega*(-0.26992));
105 else f_omega = 0.379642 + omega*(1.48503 + omega*(-0.164423 + omega*0.016666));
108 f_omega = 0.37464 + omega*(1.54226 - omega*0.26992);
111 Scalar tmp = 1 + f_omega*(1 - sqrt(Tr));
114 Scalar
a = 0.4572355*RTc*RTc/pc * tmp;
115 Scalar
b = 0.0777961 * RTc / pc;
135 template <
class Flu
idState>
139 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
140 sumx += fs.moleFraction(phaseIdx, compIdx);
142 sumx = max(1e-10, sumx);
150 for (
int compIIdx = 0; compIIdx < numComponents; ++compIIdx) {
151 Scalar xi = fs.moleFraction(phaseIdx, compIIdx) / sumx;
152 using::std::isfinite;
153 for (
int compJIdx = 0; compJIdx < numComponents; ++compJIdx) {
154 Scalar xj = fs.moleFraction(phaseIdx, compJIdx) / sumx;
157 a += xi * xj * aCache_[compIIdx][compJIdx];
181 template <
class Flu
idState>
201 assert(0 <= compIdx && compIdx < numComponents);
205 [[deprecated(
"Will be removed after Dumux 3.3")]]
214 for (
int compIIdx = 0; compIIdx < numComponents; ++ compIIdx) {
215 for (
int compJIdx = 0; compJIdx < numComponents; ++ compJIdx) {
217 Scalar Psi = FluidSystem::interactionCoefficient(compIIdx, compJIdx);
219 aCache_[compIIdx][compJIdx] =
220 sqrt(this->pureParams_[compIIdx].
a()
221 * this->pureParams_[compJIdx].
a())
227 Scalar aCache_[numComponents][numComponents];
Base class for Peng-Robinson parameters of a single-component fluid or a mixture.
A central place for various physical constants occuring in some equations.
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:34
A central place for various physical constants occuring in some equations.
Definition: constants.hh:39
Stores and provides access to the Peng-Robinson parameters.
Definition: pengrobinsonparams.hh:44
void setA(Scalar value)
Set the attractive parameter 'a' of the Peng-Robinson fluid.
Definition: pengrobinsonparams.hh:70
Scalar a() const
Returns the attractive parameter 'a' of the Peng-Robinson fluid.
Definition: pengrobinsonparams.hh:50
void setB(Scalar value)
Set the repulsive parameter 'b' of the Peng-Robinson fluid.
Definition: pengrobinsonparams.hh:78
Scalar b() const
Returns the repulsive parameter 'b' of the Peng-Robinson fluid.
Definition: pengrobinsonparams.hh:58
The mixing rule for the oil and the gas phases of the SPE5 problem.
Definition: pengrobinsonparamsmixture.hh:63
const PureParams & operator[](int compIdx) const
Returns the Peng-Robinson parameters for a pure component.
Definition: pengrobinsonparamsmixture.hh:199
void updateMix(const FluidState &fs)
Calculates the "a" and "b" Peng-Robinson parameters for the mixture.
Definition: pengrobinsonparamsmixture.hh:136
PureParams pureParams_[numComponents]
Definition: pengrobinsonparamsmixture.hh:209
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(Scalar temperature, Scalar pressure)
Peng-Robinson parameters for the pure components.
Definition: pengrobinsonparamsmixture.hh:88
void checkDefined() const
Definition: pengrobinsonparamsmixture.hh:206
void updatePure(const FluidState &fluidState)
Update Peng-Robinson parameters for the pure components.
Definition: pengrobinsonparamsmixture.hh:76