sgtpy
sgtpy copied to clipboard
SAFT gamma mie : computing density of benzene
Hello Gustavo. I just ran the creating components and mixtures example for saft gamma mie provide in the documentation. It ran fine when I calculating the density of water. However there was a ValueError for benzene. Here is my calculation code:
creating component
benzene = component(GC={'aCH':6}) benzene.saftgammamie() eos = saftgammamie(benzene)
density for liquid phase
T = 373. # K P = 1e5 # Pa rhol = eos.density(T, P, 'L') print(rhol)
According to the example, I need to create a dictionary using the group's names as keys and the numbers of times this group is present as values. But according to my code above, the program cannot proceed. I can't find a solution. Can you give me an example of computing density of benzene.
Thank you very much. Best whises!
Hi Govnavid,
Thanks for using sgtpy! Can you provide more information on what error are you getting? I just run the same script that you wrote and sgtpy is finding the volume root (see the attached figure)

Regards, Gustavo
Hello Gustavo. My code is exactly the same as yours, but there is a problem in the figure below. The sgtpy version I installed is the latest version 0.015. I still don't have a solution. Could you please give me some advice?
Best Regards,
Govnavid.
Hello Gustavo.
Here is my complete code.
Best whises,
Govnavid.
Ohh now I see what happened. This was a bug for molecules that had association sites but that wasn't self-associating. I fixed the bug on the GitHub repo but apparently, I forgot to upload the updated to PyPI. I'm going to upload the updated version to PyPI now, however at this moment I only have access to a mac computer, so I won't be able to upload precompiled windows versions. If you are using windows, you will need a C compiler.
If you are using windows and don't have a C compiler, a workaround would be to modify the config_asso.py
file (located at C:\Users\SunShow\AppData\Roaming\Python\Python39\site-packages\sgtpy\config_asso.py
). You need to modify lines 246 to 250 to the following:
indexABij1 = np.hstack([indexABij1])
indexABij2 = np.hstack([indexABij2])
indexAB_id1 = np.hstack([indexAB_id1])
indexAB_id2 = np.hstack([indexAB_id2])
Hope that helps, Gustavo!
Thank you very much for you answer. I'll solve the problem in your way. If possible, I hope you can upload the update version to PyPl later. Thanks again for your kind help. Best whises!