Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call refprop from coolprop in scilab on linux #1303

Closed
saha84 opened this issue Oct 30, 2016 · 10 comments
Closed

call refprop from coolprop in scilab on linux #1303

saha84 opened this issue Oct 30, 2016 · 10 comments
Milestone

Comments

@saha84
Copy link
Contributor

saha84 commented Oct 30, 2016

Hello Ibell,

I have a work to do concerning absorption system working with the ammonia/water mixture. Sadly, I can't do this with Coolprop at present. So I decided to use coolprop to call Refprop using this command:

PropsSI('D','T',300,'P',101325,'REFPROP::ammonia[0.697615]&water[0.302385]')

But the results are always "inf".

I have Refprop installed with wine. Also, I installed the librefprop.so as it was instructed at https://github.com/jowr/librefprop.so.

I even tried to call from python but always no result.

@ibell
Copy link
Contributor

ibell commented Oct 31, 2016

Hi @saha84 - A couple of things to be aware of:

On linux, in scilab, how are you trying to call CoolProp? Runnable code would be nice. Are you calling the DLL through scilab? Or calling python through scilab?

For linux, you should have compiled a shared library of REFPROP and put the shared library in the folder /opt/refprop, along with the fluids and mixtures folders of REFPROP. I recommend my cmake workflow for compiling the shared library of REFPROP: https://github.com/usnistgov/REFPROP-cmake . The wine part is nice, but scilab won't have the ability to use the REFPROP files for windows unless you installed scilab into the wine environment too

Also, linux is case sensitive, so you should be probably calling into REFPROP like

PropsSI('D','T',300,'P',101325,'REFPROP::AMMONIA[0.697615]&WATER[0.302385]')

On my computer (Mac), I get these results:

Python 2.7.11 |Anaconda 2.3.0 (x86_64)| (default, Jun 15 2016, 16:09:16) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import CoolProp
>>> CoolProp.CoolProp.PropsSI('D','T',300,'P',101325,'REFPROP::AMMONIA[0.697615]&WATER[0.302385]')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "CoolProp/CoolProp.pyx", line 328, in CoolProp.CoolProp.PropsSI (CoolProp/CoolProp.cpp:41707)
  File "CoolProp/CoolProp.pyx", line 408, in CoolProp.CoolProp.PropsSI (CoolProp/CoolProp.cpp:41495)
  File "CoolProp/CoolProp.pyx", line 297, in CoolProp.CoolProp.__Props_err2 (CoolProp/CoolProp.cpp:39709)
ValueError: PT: [TPFLSH error 219] outer iteration loop for composition in 2-phase state did not converge:   : PropsSI("D","T",300,"P",101325,"REFPROP::AMMONIA[0.697615]&WATER[0.302385]")

but that's a REFPROP problem, not a CoolProp problem.

@saha84
Copy link
Contributor Author

saha84 commented Oct 31, 2016

hello,

Actually ,I call CoolProp from the shared library libcoolprop.so as discribed here: http://coolprop.sourceforge.net/coolprop/wrappers/Scilab/index.html

As for compiling REFPROP, I tried to use your cmake workflow but I always have those errors:

cmake .. -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 6.2.1
-- The CXX compiler identification is GNU 6.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is GNU 6.2.1
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- DEFSYM_FLAG: --using-defsym
-- linux
Missing from PASS_CMN_tokens: ['DHFL1dll', 'PASSCMN', 'PHI0dll']
Missing from REFPROP_lib.h: ['SETNCdll', 'MAXTdll', 'MAXPdll', 'B12dll', 'VIRBAdll', 'VIRCAdll', 'HEATdll', 'SATTESTdll', 'SATPESTdll', 'PSATKdll', 'DLSATKdll', 'DVSATKdll', 'TSATDdll', 'TPRHOPRdll', 'DQFL2dll', 'CSTARdll', 'LIQSPNDLdll', 'VAPSPNDLdll', 'OMEGAdll', 'ETAK0dll', 'ETAK1dll', 'ETAKRdll', 'ETAKBdll', 'TCXK0dll', 'TCXKBdll', 'TCXKCdll', 'IDCRVdll', 'BLCRVdll', 'JTCRVdll', 'JICRVdll']

-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/REFPROP-cmake/build

and when I try "cmake --build .", I get:

Scanning dependencies of target refprop
[ 3%] Building Fortran object CMakeFiles/refprop.dir/FORTRAN/CORE_ANC.FOR.o
/home/user/REFPROP-cmake/FORTRAN/CORE_ANC.FOR:46: Error: Can't open included file 'commons.for'
make[2]: *** [CMakeFiles/refprop.dir/build.make:63: CMakeFiles/refprop.dir/FORTRAN/CORE_ANC.FOR.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:69: CMakeFiles/refprop.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

@ibell
Copy link
Contributor

ibell commented Oct 31, 2016

What version of REFPROP were you trying to compile? It seems rather old.
This workflow is for REFPROP version >= 9.0, which you should be upgraded
to at least since there are many improvements and fixes since previous
versions.

On Mon, Oct 31, 2016 at 5:14 AM, saha84 notifications@github.com wrote:

hello,

Actually ,I call CoolProp from the shared library libcoolprop.so as
discribed here: http://coolprop.sourceforge.net/coolprop/wrappers/Scilab/
index.html

As for compiling REFPROP, I tried to use your cmake workflow but I always
have those errors:

cmake .. -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 6.2.1
-- The CXX compiler identification is GNU 6.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is GNU 6.2.1
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- DEFSYM_FLAG: --using-defsym
-- linux
Missing from PASS_CMN_tokens: ['DHFL1dll', 'PASSCMN', 'PHI0dll']
Missing from REFPROP_lib.h: ['SETNCdll', 'MAXTdll', 'MAXPdll', 'B12dll',
'VIRBAdll', 'VIRCAdll', 'HEATdll', 'SATTESTdll', 'SATPESTdll', 'PSATKdll',
'DLSATKdll', 'DVSATKdll', 'TSATDdll', 'TPRHOPRdll', 'DQFL2dll', 'CSTARdll',
'LIQSPNDLdll', 'VAPSPNDLdll', 'OMEGAdll', 'ETAK0dll', 'ETAK1dll',
'ETAKRdll', 'ETAKBdll', 'TCXK0dll', 'TCXKBdll', 'TCXKCdll', 'IDCRVdll',
'BLCRVdll', 'JTCRVdll', 'JICRVdll']

-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/REFPROP-cmake/build

and when I try "cmake --build .", I get:

Scanning dependencies of target refprop
[ 3%] Building Fortran object CMakeFiles/refprop.dir/
FORTRAN/CORE_ANC.FOR.o
/home/user/REFPROP-cmake/FORTRAN/CORE_ANC.FOR:46: Error: Can't open
included file 'commons.for'
make[2]: *** [CMakeFiles/refprop.dir/build.make:63:
CMakeFiles/refprop.dir/FORTRAN/CORE_ANC.FOR.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:69: CMakeFiles/refprop.dir/all] Error 2
make: *** [Makefile:84: all] Error 2


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1303 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABxhayqnxRkF90m0dnk0amcHCtgJ4y5Yks5q5c2ogaJpZM4KkVIc
.

@saha84
Copy link
Contributor Author

saha84 commented Oct 31, 2016

It's REFPROP 9.1.
I'm trying to compile it on Archlinux 64 bits

Edit:
I got the same errors with linux mint 64 bits

@ibell
Copy link
Contributor

ibell commented Oct 31, 2016

Well, your sources are certainly not for REFPROP 9.1. Can you please file
an issue here and I will investigate:
https://github.com/usnistgov/REFPROP-cmake/issues . I built on ubuntu with
REFPROP 9.1 without any problem.

On Mon, Oct 31, 2016 at 9:51 AM, saha84 notifications@github.com wrote:

It's REFPROP 9.1.
I'm trying to compile it on Archlinux 64 bits


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1303 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABxha7hP2NEk7UlLj5AxqANFioCX4_w1ks5q5g59gaJpZM4KkVIc
.

@saha84
Copy link
Contributor Author

saha84 commented Nov 1, 2016

Hello,
Returning to the main issue, CoolProp still don't recognize REFPROP even after putting the librefprop.so in /opt/refprop along with fluids and mixture folders.

~ % python
Python 3.5.2 (default, Jun 28 2016, 08:46:01)
[GCC 6.1.1 20160602] on linux
Type "help", "copyright", "credits" or "license" for more information.
->> import CoolProp
->> CoolProp.CoolProp.PropsSI('D','T',300,'P',101325,'water')
996.5569352652021
->> CoolProp.CoolProp.PropsSI('D','T',300,'P',101325,'REFPROP::AMMONIA[0.697615]&WATER[0.302385]')
Good news: It is possible to use REFPROP on your system! However, the library
could not be loaded. Please make sure that REFPROP is available on your system.

Neither found in current location nor found in system PATH.
If you already obtained a copy of REFPROP from http://www.nist.gov/srd/,
add location of REFPROP to the PATH environment variable or your library path.

In case you do not use Windows, have a look at https://github.com/jowr/librefprop.so
to find instructions on how to compile your own version of the REFPROP library.

ALTERNATIVE_REFPROP_PATH:
Traceback (most recent call last):
File "", line 1, in
File "CoolProp/CoolProp.pyx", line 328, in CoolProp.CoolProp.PropsSI (CoolProp/CoolProp.cpp:41356)
File "CoolProp/CoolProp.pyx", line 408, in CoolProp.CoolProp.PropsSI (CoolProp/CoolProp.cpp:41141)
File "CoolProp/CoolProp.pyx", line 297, in CoolProp.CoolProp.__Props_err2 (CoolProp/CoolProp.cpp:39346)
ValueError: Initialize failed for backend: "REFPROP", fluid: "AMMONIA&WATER" fractions "[ 0.6976150000, 0.3023850000 ]"; error: You cannot use the REFPROPMixtureBackend. : PropsSI("D","T",300,"P",101325,"REFPROP::AMMONIA[0.697615]&WATER[0.302385]")

@saha84
Copy link
Contributor Author

saha84 commented Nov 1, 2016

It's working now, I just followed the instruction here: http://stackoverflow.com/questions/13428910/how-to-set-the-environmental-variable-ld-library-path-in-linux

sudo gedit /etc/ld.so.conf.d/randomLibs.conf

then I added the needed path:

/opt/refprop

Save and run sudo ldconfig to update the system with this libs.

now with python I get:
->>> import CoolProp
->>>CoolProp.CoolProp.PropsSI('D','T',300,'P',101325,'REFPROP::AMMONIA[0.697615]&WATER[0.302385]')
Traceback (most recent call last):
File "", line 1, in
File "CoolProp/CoolProp.pyx", line 328, in CoolProp.CoolProp.PropsSI(CoolProp/CoolProp.cpp:41356)
File "CoolProp/CoolProp.pyx", line 408, in CoolProp.CoolProp.PropsSI (CoolProp/CoolProp.cpp:41141)
File "CoolProp/CoolProp.pyx", line 297, in CoolProp.CoolProp.__Props_err2
(CoolProp/CoolProp.cpp:39346)
ValueError: PT: [TPFLSH error 219] outer iteration loop for composition in 2-phase state did not converge: : PropsSI("D","T",300,"P",101325,"REFPROP::AMMONIA[0.697615]&WATER[0.302385]")
->>>CoolProp.CoolProp.PropsSI('D','T',300,'P',101.325,'REFPROP::AMMONIA[0.697615]&WATER[0.302385]')
0.0007039147747616463

the first error is because the pressure is in KPa

@ibell
Copy link
Contributor

ibell commented Nov 2, 2016

Can I please interest you in updating the docs with your experiences: https://github.com/CoolProp/CoolProp/blob/master/Web/coolprop/REFPROP.rst ?

@saha84
Copy link
Contributor Author

saha84 commented Nov 2, 2016

Ok, but I'm not experienced at all :-), I just follow the instructions and it could exit a better way to update the path

@ibell
Copy link
Contributor

ibell commented Nov 3, 2016

In any case, we appreciate people that make use of REFPROP contributing,
and updating docs is an easy way to help. That's a useful link you show.
I didn't know about that before.

On Wed, Nov 2, 2016 at 3:59 PM, saha84 notifications@github.com wrote:

Ok, but I'm not experienced at all :-), I just follow the instruction and
it could exit a better way to update the path


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1303 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABxha5_fBoVGGtkT110TovtbzN6NZcSOks5q6QfWgaJpZM4KkVIc
.

@ibell ibell added this to the MinorRelease milestone Nov 5, 2016
@ibell ibell closed this as completed in 81d1751 Nov 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants