12.2(b1) NON-IDEAL VAPOR-LIQUID AND LIQUID-LIQUID EQUILIBRIUM |POLVER05_1 |2
# Example 12.2 - Two-phase Flash
f(x1) = x1 - z1 / (1 + alpha * (k1 - 1)) # Mole fraction of comp. 1 in the liquid phase
f(x2) = x2 - z2 / (1 + alpha * (k2 - 1)) # Mole fraction of comp. 2 in the liquid phase
f(alpha) = x1 + x2 - (y1 + y2) # Fraction evaporated
# The explicit equations
T = 88.538 # Temperature deg. C
z1 = 0.2 # Mole fraction of comp. 1 in the feed
z2 = 0.8 # Mole fraction of comp. 2 in the feed
p1 = 10 ^ (7.62231 - 1417.9 / (191.15 + T)) # Vapor pressure of 1st component (mmHg)
p2 = 10 ^ (8.10765 - 1750.29 / (235 + T)) # Vapor pressure of 2nd component (mmHg)
A = 1.7 # Van Laar equations constant A
B = 0.7 # Van Laar equations constant B
gamma1 = 10 ^ (A * x2 * x2 / ((A * x1 / B + x2) ^ 2)) # Activity coefficient of comp. 1 in the liquid phase
gamma2 = 10 ^ (B * x1 * x1 / ((x1 + B * x2 / A) ^ 2)) # Activity coefficient of comp. 2 in the liquid phase
k1 = gamma1 * p1 / 760 # Vapor liquid equlibrium ratio of comp. 1
k2 = gamma2 * p2 / 760 # Vapor liquid equlibrium ratio of comp. 2
y1 = k1 * x1 # Mole fraction of comp. 1 in the vapor phase
y2 = k2 * x2 # Mole fraction of comp. 2 in the vapor phase
# Initial Guess for nonlinear equations variables
x1(0) = 0
x2(0) = 1
alpha(0) = 0.5