sgtpy icon indicating copy to clipboard operation
sgtpy copied to clipboard

SAFT gamma mie : computing density of benzene

Open Govnavid opened this issue 2 years ago • 5 comments

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!

Govnavid avatar Nov 02 '22 12:11 Govnavid

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)

Screenshot 2022-11-02 at 11 19 58

Regards, Gustavo

gustavochm avatar Nov 02 '22 14:11 gustavochm

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?

屏幕截图 2022-11-03 092218 Best Regards, Govnavid.

Govnavid avatar Nov 03 '22 01:11 Govnavid

Hello Gustavo. Here is my complete code. image Best whises, Govnavid.

Govnavid avatar Nov 03 '22 01:11 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!

gustavochm avatar Nov 03 '22 12:11 gustavochm

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!

Govnavid avatar Nov 04 '22 02:11 Govnavid