To create a Vapor-Liquid Equilibrium (VLE) curve for an ethanol-water mixture, the Antoine equation can be used to estimate vapor pressures, and then Raoult's law can be applied for the mixture's boiling point compositions. The activity coefficients can be assumed to be unity for an ideal solution, which simplifies the calculations.
Below is an example Python script using Matplotlib to plot the VLE curve. This example assumes ideal behavior and does not account for non-idealities that can arise in such mixtures.
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import fsolve
# Antoine equation constants for ethanol, from NIST (valid for the temperature range of 293 to 366 K)
A_eth = 8.11220
B_eth = 1592.864
C_eth = 226.184
# Antoine equation constants for water, from NIST (valid for the temperature range of 273 to 333 K)
A_wat = 8.07131
B_wat = 1730.63
C_wat = 233.426
# Antoine equation to estimate the vapor pressure as a function of temperature (in K)
def antoine_equation(A, B, C, T):
return 10**(A - B / (C + T))
# Raoult's law to estimate the total pressure of the mixture
def raoults_law(PA, PB, xA):
return xA * PA + (1 - xA) * PB
# Calculate the equilibrium compositions
def get_vapor_composition(y, xA, T):
PA = antoine_equation(A_eth, B_eth, C_eth, T) # Vapor pressure of ethanol at T
PB = antoine_equation(A_wat, B_wat, C_wat, T) # Vapor pressure of water at T
# Use Raoult's law to calculate the vapor composition
def equations(p):
yA = p
return yA - xA * PA / (xA * PA + (1 - xA) * PB)
# Solve for vapor composition
yA = fsolve(equations, 0.5)
return yA
# Temperature (assume isothermal conditions)
T = 353.15 # K
# Set up the plot arrays
x_ethanol = np.linspace(0.001, 1, 100)
y_ethanol = np.array([get_vapor_composition(y, x, T) for x in x_ethanol])
# Plot the VLE curve
plt.plot(x_ethanol, y_ethanol, label=f'VLE at T={T} K')
plt.title('Ethanol-Water Mixture VLE (Mass Basis)')
plt.xlabel('Mass Fraction of Ethanol in Liquid (x)')
plt.ylabel('Mass Fraction of Ethanol in Vapor (y)')
plt.legend()
plt.grid(True)
plt.show()
Please keep in mind that the Antoine constants used are valid within specific temperature ranges, and beyond that, the model might not produce accurate results. For a non-ideal mixture, a more complex activity coefficient model such as UNIFAC, Wilson, or NRTL would be implied, and experimental data is required to fit the model constants.
Make sure you have numpy, matplotlib, and scipy libraries installed in your Python environment before running this script, as they are prerequisites for performing numerical calculations and plotting.
To install the libraries if you haven't already, you can use pip:
pip install numpy matplotlib scipy