To calculate dew pressure of hydrocarbon mixture by PC-SAFT

Click For Summary
SUMMARY

The discussion focuses on the challenges of calculating dew point pressure for hydrocarbon mixtures using the PC-SAFT (Perturbed-Chain Statistical Associating Fluid Theory) method. While bubble point pressure calculations align closely with experimental data, the dew point pressure calculations fail to converge at various temperatures. The issue is attributed to the differences in fugacity calculations for component compositions, indicating that while internal parameters of PC-SAFT are accurate, the dew pressure computation remains problematic.

PREREQUISITES
  • Understanding of PC-SAFT (Perturbed-Chain Statistical Associating Fluid Theory)
  • Familiarity with fugacity calculations in thermodynamics
  • Proficiency in numerical methods, particularly least squares optimization
  • Knowledge of Python programming for implementing the calculation algorithms
NEXT STEPS
  • Research the equations and algorithms used in PC-SAFT for dew point pressure calculations
  • Learn about fugacity coefficients and their role in phase equilibrium calculations
  • Explore numerical optimization techniques, specifically least squares methods, in Python
  • Investigate common convergence issues in thermodynamic calculations and their solutions
USEFUL FOR

This discussion is beneficial for chemical engineers, thermodynamic researchers, and computational scientists involved in phase behavior modeling of hydrocarbon mixtures.

yan3220
Messages
2
Reaction score
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!



Code:
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
 
Last edited by a moderator:
Science news on Phys.org
Rather than attaching the code, please provide the equations you used.
 
  • Like
Likes   Reactions: yan3220
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
 
can I get this report here please