A To calculate dew pressure of hydrocarbon mixture by PC-SAFT

AI Thread Summary
The discussion focuses on using the PC-SAFT method to calculate dew point pressures of hydrocarbon mixtures, where the bubble pressure calculations align well with experimental data, but the dew pressure calculations fail to converge. The user highlights the difference in fugacity calculations between bubble and dew pressures as a potential issue. Despite accurate bubble pressure results indicating correct internal parameters, the inability to compute dew pressure remains unresolved. The user seeks assistance and has shared code and screenshots to clarify their calculation algorithm. The thread emphasizes the complexities involved in applying the PC-SAFT method for phase envelope plotting.
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.
 
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
 
I need to calculate the amount of water condensed from a DX cooling coil per hour given the size of the expansion coil (the total condensing surface area), the incoming air temperature, the amount of air flow from the fan, the BTU capacity of the compressor and the incoming air humidity. There are lots of condenser calculators around but they all need the air flow and incoming and outgoing humidity and then give a total volume of condensed water but I need more than that. The size of the...
Thread 'Why work is PdV and not (P+dP)dV in an isothermal process?'
Let's say we have a cylinder of volume V1 with a frictionless movable piston and some gas trapped inside with pressure P1 and temperature T1. On top of the piston lay some small pebbles that add weight and essentially create the pressure P1. Also the system is inside a reservoir of water that keeps its temperature constant at T1. The system is in equilibrium at V1, P1, T1. Now let's say i put another very small pebble on top of the piston (0,00001kg) and after some seconds the system...
Back
Top