82 LhsEval Vm = params.molarVolume(phaseIdx);
85 LhsEval bi_b = params.bPure(phaseIdx, compIdx) / params.b(phaseIdx);
88 LhsEval RT = R*fs.temperature(phaseIdx);
89 LhsEval p = fs.pressure(phaseIdx);
93 LhsEval Astar = params.a(phaseIdx)*p/(RT*RT);
94 LhsEval Bstar = params.b(phaseIdx)*p/(RT);
97 for (
unsigned compJIdx = 0; compJIdx < numComponents; ++compJIdx) {
98 A_s += params.aCache(phaseIdx, compIdx, compJIdx) * fs.moleFraction(phaseIdx, compJIdx) * p / (RT * RT);
110 m1 = 0.5*(u + std::sqrt(u*u - 4*w));
111 m2 = 0.5*(u - std::sqrt(u*u - 4*w));
113 alpha = -log(Z - Bstar) + bi_b * (Z - 1);
114 betta = log((Z + m2 * Bstar) / (Z + m1 * Bstar)) * Astar / ((m1 - m2) * Bstar);
115 gamma = (2 / Astar ) * A_s - bi_b;
116 ln_phi = alpha + (betta * gamma);
118 fugCoeff = exp(ln_phi);
126 fugCoeff = min(1e10, fugCoeff);
131 fugCoeff = max(1e-10, fugCoeff);