zmeri / PC-SAFT

Functions implementing the PC-SAFT equation of state, including association, electrolyte and dipole terms
GNU General Public License v3.0
46 stars 18 forks source link

Example on VLE calculation #109

Closed RayleighSun closed 9 months ago

RayleighSun commented 1 year ago

Hi, I have tried to use this program to calculate the vapor-liquid equilibrium at a constant temperature, such as the following mixture, but I am not very good at using this program. image

Does this program have any specific examples of calculating VLE Or where are these examples that I don't see?

zmeri commented 1 year ago

I have a few examples in a small textbook in a separate repo. Here, for example, are two examples of finding a single VLE point: https://github.com/zmeri/thermo-course/blob/master/examples/n2ide_faasitasakaal.py. You could use a for-loop to iterate through a series of points and calculate curves like the one in the figure you've shown. The textbook is in Estonian, but I think the code should be helpful even if you aren't able to read the comments.

RayleighSun commented 1 year ago

Thank you for your reply. In addition, can the code you provide calculate the critical temperature and critical pressure of a binary mixture under certain composition? For example, ethane+propane, the molar fraction is 0.5 and 0.5? Is there a similar example?

RayleighSun commented 12 months ago

Dear Dr. Baird, I noticed that you provided a program to find the three parameters (m, sigma, epsilon_k) related to PC-SAFT, and experimental data are as input, but you seem to have not uploaded it? I modified the calculation program for propane according to the example you provided, but I can't calculate it, and it seems to be stuck in an endless loop. Can you help me find out what caused it? Or show me the andmed_1-hekseen.csv so I can learn further? Thank you so much!

data_propane.txt pcsaft_parameters_find.txt

zmeri commented 12 months ago

The code cannot currently find critical properties.

And unfortunately, it seems I no longer have those data files. They were on an old computer that I no longer have and I don't think I moved them elsewhere. Those files just have property data for the different compounds. You could create a similar file with data for a specific chemical or mixture from the literature.

I looked over your code, but I don't see any problem with it. I don't have the time to more thoroughly debug your code, so you'll need to do that yourself. You might try putting a print statement in the cost function so you can see how the optimization is progressing and if it is getting stuck somewhere or if the cost is weird in some way.