To calculate dew pressure of hydrocarbon mixture by PC-SAFT

  • #1
yan3220
2
0
Hello, everyone:
I'm trying to use the PC-SAFT (Perturbed-Chain Statistical Associating Fluid Theory) method to calculate the bubble point and dew point pressures of hydrocarbon mixtures, and subsequently plot the PT phase envelope. My calculations for bubble pressure match the experimental data very well. However, when calculating dew pressure at different temperatures, the program fails to converge. I understand that the difference between calculating bubble pressure and dew pressure lies in how the component compositions are determined through fugacity calculations. Therefore, if the bubble pressure calculations are very accurate, it indicates that the internal parameters of PC-SAFT are correct. So why can't the dew pressure be calculated at all?
I have attached the code for calculating dew pressure below.
I'm really hoping someone can offer me some help and advice. Thank you so much!




def cal_VLE_dew_point(temperature, initial_system_pressure, component_mixture,pc_saft_para_dict,component_name,univeral_model_constant=univeral_model_constant):

composition_liquid = component_mixture.copy()
composition_vapor = component_mixture.copy()
def wrapped_cal_pressure(initial_packing_fraction, temperature, component_mixture, pc_saft_para_dict, target_pressure):
calculated_pressure = cal_pressure(initial_packing_fraction,temperature,univeral_model_constant,component_name, component_mixture, pc_saft_para_dict,boltzmann_constant = 1.3806*10**-23)
return np.array(calculated_pressure, dtype=np.float64) - target_pressure
iteration = 0
error = 100
vapor_packing_fraction = 10**-10
liquid_packing_fraction = 0.5
while (error > 0.00001) and iteration < 300:
result = least_squares(wrapped_cal_pressure, liquid_packing_fraction, args=(temperature, composition_liquid, pc_saft_para_dict, initial_system_pressure), xtol=1e-12,ftol=1e-12,gtol=1e-12,max_nfev=50000)
liquid_packing_fraction = result.x
result = least_squares(wrapped_cal_pressure, vapor_packing_fraction, args=(temperature, composition_vapor, pc_saft_para_dict, initial_system_pressure), xtol=1e-12,ftol=1e-12,gtol=1e-12,max_nfev=50000)
vapor_packing_fraction = result.x



fugacity_coefficient_liquid = cal_fugacity(liquid_packing_fraction, temperature, univeral_model_constant,component_name, composition_liquid, pc_saft_para_dict)
fugacity_coefficient_vapor = cal_fugacity(vapor_packing_fraction, temperature, univeral_model_constant,component_name, composition_vapor, pc_saft_para_dict)

update_liquid_compostion = {}
total_composition_liquid = 0
for i in component_name:
update_liquid_compostion = fugacity_coefficient_vapor*composition_vapor/fugacity_coefficient_liquid
total_composition_liquid += update_liquid_compostion
for k,v in update_liquid_compostion.items():
update_liquid_compostion[k] = update_liquid_compostion[k]/total_composition_liquid
composition_liquid = update_liquid_compostion.copy()
initial_system_pressure = total_composition_liquid * initial_system_pressure
error = np.abs(total_composition_liquid - 1.0)
iteration += 1
dew_point_pressure = cal_pressure(liquid_packing_fraction,temperature, univeral_model_constant,component_name, composition_liquid, pc_saft_para_dict,boltzmann_constant = 1.3806*10**-23)

return composition_liquid, composition_vapor, dew_point_pressure
 
Science news on Phys.org
  • #2
Rather than attaching the code, please provide the equations you used.
 
  • Like
Likes yan3220
  • #3
Thank you very much for your response. The PC-SAFT method has many formulas. Here, I have attached screenshots of my calculation algorithm in hopes that it will more clearly illustrate the problem I am encountering. Thank you.

1720785645594.png
 
  • #4

Similar threads

  • Atomic and Condensed Matter
Replies
7
Views
482
  • Introductory Physics Homework Help
Replies
1
Views
2K
  • Biology and Chemistry Homework Help
Replies
4
Views
7K
Replies
23
Views
5K
Back
Top