usnistgov / REFPROP-wrappers

Wrappers around NIST REFPROP for languages such as Python, MATLAB, etc.
190 stars 126 forks source link

Error trying to load mixtures with coolprop + refprop #140

Closed raphaeltimbo closed 5 years ago

raphaeltimbo commented 6 years ago

I am getting the following error when trying to create an abstractstate with coolprop + refprop on python:

>>> import CoolProp.CoolProp as CP
>>> CP.AbstractState('REFPROP', 'METHANE&ETHANE')

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-b5c528d52e26> in <module>()
----> 1 CP.AbstractState('REFPROP', 'METHANE&ETHANE')

CoolProp/AbstractState.pyx in CoolProp.CoolProp.AbstractState.__cinit__()

ValueError: Could not load these fluids: METHANE|ETHANE

The following does work:

>>> CP.AbstractState('REFPROP', 'METHANE')

System information: Ubuntu 16.04 Python - '3.6.4 | packaged by conda-forge | (default, Dec 23 2017, 16:31:06) \n[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]' CoolProp - 6.1.1dev REFPROP - 9.4.4.39 (002)

The error started to happen after building the .so with the above refprop version. I've built it using the REFPROP-Cmake.

Tested with refprop 9.4.4.27 and it works.

Let me know if additional information is needed.

ianhbell commented 6 years ago

Where did you install REFPROP? You probably need to set the ALTERNATIVE_REFPROP_PATH configuration variable: http://www.coolprop.org/coolprop/Configuration.html

raphaeltimbo commented 6 years ago

I am using that as:

path = '/home/raphael/REFPROP/REFPROP-cmake/build/'
CP.set_config_string(CP.ALTERNATIVE_REFPROP_PATH, path)

I have carried out some tests with the python wrapper using the file test_PQFLSHdll.py.

The original file has the following line:

ierr, herr = r.SETUPdll(3, 'NITROGEN.FLD|OXYGEN.FLD|WATER.FLD', 'HMX.BNC', 'DEF')

Running this file I get the following results (I added a line to print the refprop version to verify the version - let me know if I need to check other things regarding the installation):

REFPROP version:  SETUPdlloutput(ierr=94439, herr='9.4.4.39 (002)')
wm 28.83449383336775 kg/kmol
h 328.25887968907887 kJ/kg
s 258.97167075370066 J/(mol*K)
s 8.981314957365903 kJ/(kg*K)

If I modify the line with: ierr, herr = r.SETUPdll(3, 'METHANE.FLD|BUTANE.FLD|WATER.FLD', 'HMX.BNC', 'DEF')

The output is:

REFPROP version:  SETUPdlloutput(ierr=94439, herr='9.4.4.39 (002)')
wm 24.86939899465006 kg/kmol
h 826.6649938358481 kJ/kg
s 182.433694733015 J/(mol*K)
s 7.3356696224247475 kJ/(kg*K)

But when I try with: ierr, herr = r.SETUPdll(3, 'METHANE.FLD|ETHANE.FLD|WATER.FLD', 'HMX.BNC', 'DEF')

The output is: 691 [RPNEQN error 691] Error in setup of reverse Polish notation equations: Missing or incorrect entry in coefficients: 0.64034200732045 1. 1. 2. 1. -90. -100. 1. 1. 0. 0. 0.

ianhbell commented 6 years ago

Did you also update the fluid files? They have changed subtly during the course of development of the beta and that might be reason for this

raphaeltimbo commented 6 years ago

Yes! I tried now with refprop 9.4.4.38 (021) and it is working. Will keep with that version for now. I will try to build everything again for .39 and see if there is something wrong with my setup. I will let you know if anything changes!

ianhbell commented 6 years ago

Great! Can you please close this issue then?

raphaeltimbo commented 6 years ago

Yes! Thanks!