Closed ghost closed 9 years ago
Hello,
You may want to test out my branch : https://github.com/AndySchroder/python-refprop
My branch and BenThelen's are diverged a bit I believe. I'm not sure how much. Everything is working for what I have been doing, so there isn't much of a need for me to see what improvements BenThelen has made.
I am using ubuntu 13.04 and 14.04.1, and I do not have any issues running the command
python -c "import rptest;rptest.settest('refprop')"
I don't think I have made any modifications to python-refprop from what is in my repository listed above.
I am using the python2x version. I have no idea if the python3x version works because I've never needed to try it.
Curious to know if my branch works for you or not.
I realized that I should run rp2so to setup the BenThelen/python-refprop module rather than compile it myself. But I get the following test error, I am not sure if this is a bug? Should I report it in a new issue?:
In [6]: rptest.settest('refprop')
---------------------------------------------------------------------------
RefpropnormalizeError Traceback (most recent call last)
<ipython-input-6-f1d28732ebde> in <module>()
----> 1 rptest.settest('refprop')
/home/vagrant/refprop/python-refprop/python2.7/rptest.pyc in settest(test)
20 if test == u'refprop':
21 import refprop as rp
---> 22 _maintest(rp)
23 elif test == u'multiRP':
24 import multiRP as rp
/home/vagrant/refprop/python-refprop/python2.7/rptest.pyc in _maintest(rp)
30 rp.SetErrorDebug.off() #turn on =>> for testing purpose
31
---> 32 if rp.test(): #if True; rptest =>>for testing purpose
33 print u'refprop installed correctely'
34
/home/vagrant/refprop/python-refprop/python2.7/refprop.pyc in test(criteria)
1101 prop = flsh(u'td', 150, 200 / wmix, x)
1102 Dliq = prop[u'Dliq']
-> 1103 wmix = wmol(prop[u'xliq'])[u'wmix']
1104 testresult += u'check Liquid Density of Methane / Ethane / Propane / Butane'
1105 truefalse = printresults(481.276038325628, Dliq * wmix, truefalse)
/home/vagrant/refprop/python-refprop/python2.7/refprop.pyc in wmol(x)
4600 output (as function value):
4601 wmix--molar mass [g/mol], a.k.a. "molecular weight'''
-> 4602 _inputerrorcheck(locals())
4603 for each in xrange(len(x)): _x[each] = x[each]
4604
/home/vagrant/refprop/python-refprop/python2.7/refprop.pyc in _inputerrorcheck(deflocals)
547 if sum(value) != 1:
548 raise RefpropnormalizeError(u'sum input value '
--> 549 + key + u'is unequal to 1')
550 elif key in checklist:
551 if not type(value) == list:
RefpropnormalizeError: u'sum input value xis unequal to 1'
> /home/vagrant/refprop/python-refprop/python2.7/refprop.py(549)_inputerrorcheck()
548 raise RefpropnormalizeError(u'sum input value '
--> 549 + key + u'is unequal to 1')
550 elif key in checklist:
ipdb> sum(value)
0.9999999999999999
ipdb>
I am still using
Ubuntu 14.04 TLS 64bit
refprop 9.0
And during the installation of, the following warning was produced:
......
processing /usr/local/lib/refprop/mixtures/R504.MIX
processing /usr/local/lib/refprop/mixtures/R508A.MIX
processing /usr/local/lib/refprop/mixtures/R508B.MIX
processing /usr/local/lib/refprop/mixtures/R509A.MIX
processing /usr/local/lib/refprop/mixtures/R510A.MIX
--- Applying common file fix ---
Can't rename /usr/local/lib/refprop/FOR/COMMONS.f /usr/local/lib/refprop/FOR/COMMONS.include: No such file or directory
Can't rename /usr/local/lib/refprop/FOR/COMTRN.f /usr/local/lib/refprop/FOR/COMTRN.include: No such file or directory
--- Creating shared object file ---
/usr/local/lib/refprop/FOR/UTILITY.f:1213.72:
if (ABS(iprnterr).ge.3) pause
1
Warning: Deleted feature: PAUSE statement at (1)
--- Installing object file ---
Note: If you want to display ported commands, type:
nm /usr/local/lib/librefprop.so
@AndySchroder Thanks a lot! I just tested your module, it works for refprop, but multiRP failed
vagrant@vagrant-ubuntu-trusty-64:~/refprop/new/python-refprop/python2x$ python -c "import rptest;rptest.settest('refprop');rptest.settest('multiRP')">a.txt
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "rptest.py", line 22, in settest
_maintest(rp)
File "rptest.py", line 192, in _maintest
print rp.sate(45000, x), u'\n'
File "multiRP.py", line 681, in sate
return _rpfunc_handler(prop, mRP, _rpfunc)
File "multiRP.py", line 287, in _rpfunc_handler
return _rpfunc()
File "multiRP.py", line 680, in _rpfunc
return refprop.sate(e, x, kph)
File "refprop.py", line 3550, in sate
herr = _herr.value, defname = defname)
File "refprop.py", line 619, in _prop
_outputierrcheck(prop[u'ierr'], prop[u'herr'], prop[u'defname'], prop)
File "refprop.py", line 733, in _outputierrcheck
raise RefpropdllError(herr.decode(u'utf-8'))
refprop.RefpropdllError: u'[SATE error 162] iteration for saturation state did not converge for both roots; e = 45000. J/mol'
Actually, I don't normally use multiRP, but I just ran the command you have listed above and I am getting the same error. That looks like a refprop bug/error and not a configuration error on your end. I have cases where refprop can not get a solution, but I'm not sure why the test program has a case selected that refprop doesn't work with. In cases where refprop has problems like this converging, it seems to me like it is usually sensitive to the independent variables that you choose. A workaround I usually use is to pre-populate some tables using other independent variable combinations (making the problem independent variable now a dependent variable while pre-populating) and then interpolate instead.
@AndySchroder Thanks for your reply. I just copied your version of python_refprop to my windows 8.1 and run it under ipython with python 2.7.6, run the command below and compare the output with linux version
ipython -c "import rptest;rptest.settest('refprop');rptest.settest('multiRP')">b.txt
b.txt is generated successfully. I copied b.txt to linux
dos2unix b.txt
diff a.txt b.txt > c.txt
vim -O a.txt b.txt
Use those command to find differences
:diffthis
Ctrl+w l
:diffthis
a lot of differences!!!
I think maybe there are some compiler differences between Intel's Compiler and GCC.
Hello,
I'm not exactly sure why, but the e-mail I received includes your differences, but then the text above on this web page seems to be slightly different and not include the DIFF. Did you edit it? Anyway, I have no idea what the "preos" means. Maybe there is a compiler difference, I'm not sure.
Honestly, I don't know much about how the python refprop works, nor refprop in general. It seemed like luck that I got this working for what I needed. Although the efforts of BenThelen and others who have gotten this together and working for linux have been spectacular, I'm honestly considering changing over to "cool prop" (http://coolprop.sourceforge.net/). Have you looked into it? When I originally got started with everything, cool prop lacked a few features that I needed that refprop had. Refprop is still "working" for me, so I haven't had the push to switch, but I'm preparing for it. Coolprop is free, open source, and has a very active developement team. They seem focused on making these kinds of interfaces standard and integrated into their tool, for many programing languages. With refprop, the people at NIST charge for it, they are working on an archaeic fortran codebase, and they have no concern to make these kinds of useful interfaces available on a variety of platforms and languages. It's up to great memebers of the volunteer community like BenThelen to make it happen, but here is a limit to what they can do efficiently since everyone is at the mercy of NIST. Because refprop is not free, there is a limit to how many people can even test out interfaces like this one and help to make it better.
Coolprop does actually also have an optional interface to use and compile refprop from within it. I haven't personally tried it, but I imagine it works because they have a lot of benchmark comparisons with it. They also use the refprop interface in coolprop to do some things (like mixtures) that cool prop does not yet support (last time I checked, but they could have made all the same functionality work by now). I'm curious to hear your experience with cool prop and if it is any better than refprop. I've briefly tried it, but have not done any in depth analysis or performance or accuracy benchmarks.
@AndySchroder ,thanks a lot
I am just familiar with refprop rather than coolprop, I'll look into coolprop in the future. I do not use it to do cycle analysis, I am studying hydrocarbon fuel's thermodynamic behavior in supercritical conditions. There is few data in this field. I thought refprop is made by NIST and maybe it is better. Though the programming is so bad in its source code. I used NIST 4, the supertrapp, a legacy code. The programming style is the same as refprop. And the cross-programming is more difficult.
p.s. I just found out the best way to do DIFF is vim -d a.txt b.txt
No problem. Sorry I couldn't have been more help, but my above comment pretty much explains my perspective.
Also, I think the title of this original issue may be a complete mistake? I don't think BenThelen's work has anything to do with jowr's work, does it?
I am curious what you are doing with supercritical fuel studies, if you are interested in sharing. If so, but you don't want to continue discussion about your work on this website, you can contact me directly using my contact infromation that can be found at: http://andyschroder.com/contact/ .
Also, I'm not sure if this issue should be closed or not. You may want to get BenThelen's oppinion, but I'm guessing it is dependent upon fixing the REFPROP source code, which is not really included in this project.
@AndySchroder Yes, I think you are right, the title is a complete mistake. And it should be closed. This issue is caused by my misunderstanding of the readme of python_refprop module. I thought I need to compile librefprop.so myself. So I used Jowr's work, but I used BenThelen's test. And it failed.
When I looked into the rp2so file, I found that it is used to compile librefprop.so. I do not need to use Jowr's work anymore...
Then the problem became a version issue. I should use ver 0.2 with refprop 9.0. But I got a RefpropnormalizeError. This problem may be caused by machine error or compiler incompatibility.
Then I used your version of python_refprop. It works fine with refprop 9.0, but multiRP went wrong in linux.
I think this issue should be closed.
platform:
compiled with a lot of warnings but test successfully with the pyrp.py in librefprop.so v0.2. And the librefprop.so and fluids/mixtures folder were located in /opt/refprop/ by defaut.
So I have to modify the refprop.py at line 97:
and run the test by:
and the output is
I used ipython load refprop.py and found that there is no rpsetmix in the dict of refprop. I do not know what happened. I used ipython debugger to see what was defined in the process:
There is a _setmix but no global rpsetmix
I am a windows user, not familiar with debugging in command line using ipdb. I think this might be helpful to find out what happened: