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

HS Inputs in PropsSI function working in two-phase region? #455

Closed
somniumAeternam opened this issue Feb 9, 2015 · 5 comments
Closed

HS Inputs in PropsSI function working in two-phase region? #455

somniumAeternam opened this issue Feb 9, 2015 · 5 comments
Milestone

Comments

@somniumAeternam
Copy link

I tried to calculate the pressure with enthalpy and entropy as inputs für CO2 in CoolProp 5.0.6:

PropsSI('P','H',310000,'S',1400,'R744')

which gives:

ValueError: saturation_PHSU_pure solver did not converge after 50 iterations for Hmolar=13643 current error is 7.11139 : PropsSI("P","H",310000,"S",1400,"R744")

These values will be in the two-phase region. I read a couple of months ago, that HS inputs only work in the single phase region. Can you confirm this or should it also work in the two-phase region?

@ibell
Copy link
Contributor

ibell commented Feb 10, 2015

Is it only that state point or all state points? In principle two-phase HS inputs should work now. You might be close to critical values, which cause problems.

@somniumAeternam
Copy link
Author

I have just tested a wide range of input values right in the middle of the two-phase region of CO2 (pressure between 30 and 55 bar, entropy between 1200 and 1600 J/kgK). I calculated the minimum and maximum enthalpy for each entropy with PS as inputs. Everything below an entropy of 1600 leads to some errors. The lower the entropy the more errors occur. Everything below an entropy of about 1470 only leads to errors.

The command:

PropsSI('P','H',325125,'S',1470,'R744')

leads to the strange error:

Traceback (most recent call last):
File "", line 1, in
File "CoolProp\CoolProp.pyx", line 204, in CoolProp.CoolProp.PropsSI (CoolProp\CoolProp.cpp:15824)
File "CoolProp\CoolProp.pyx", line 236, in CoolProp.CoolProp.PropsSI (CoolProp\CoolProp.cpp:15619)
File "CoolProp\CoolProp.pyx", line 173, in CoolProp.CoolProp.__Props_err2 (CoolProp\CoolProp.cpp:14440)
ValueError: p is not a valid number : PropsSI("P","H",325125,"S",1470,"R744")

@ibell
Copy link
Contributor

ibell commented Feb 10, 2015

Can you show your code? I think you might be evaluating solid inputs
sometimes?

On Tue, Feb 10, 2015 at 2:38 AM, somniumAeternam notifications@github.com
wrote:

I have just tested a wide range of input values right in the middle of the
two-phase region of CO2 (pressure between 30 and 55 bar, entropy between
1200 and 1600 J/kgK). I calculated the minimum and maximum enthalpy for
each entropy with PS as inputs. Everything below an entropy of 1600 leads
to some errors. The lower the entropy the more errors occur. Everything
below an entropy of about 1470 only leads to errors.

The command:

PropsSI('P','H',325125,'S',1470,'R744')

leads to the strange error:

Traceback (most recent call last):
File "", line 1, in
File "CoolProp\CoolProp.pyx", line 204, in CoolProp.CoolProp.PropsSI
(CoolProp\CoolProp.cpp:15824)
File "CoolProp\CoolProp.pyx", line 236, in CoolProp.CoolProp.PropsSI
(CoolProp\CoolProp.cpp:15619)
File "CoolProp\CoolProp.pyx", line 173, in CoolProp.CoolProp.__Props_err2
(CoolProp\CoolProp.cpp:14440)
ValueError: p is not a valid number :
PropsSI("P","H",325125,"S",1470,"R744")


Reply to this email directly or view it on GitHub
#455 (comment).

@somniumAeternam
Copy link
Author

I added a condition for the right phase. Here is the Python-code:

from CoolProp.CoolProp import PhaseSI
from CoolProp.CoolProp import PropsSI
import numpy as np

s = np.arange(1200,1600,10)
p = np.arange(30*10**5,55*10**5,1*10**5)

counter = 0
error = 0

h = np.zeros(p.size)

for i in np.arange(s.size):
    for j in np.arange(p.size):
        h[j] = PropsSI('H','P',p[j],'S',s[i],'R744')

    if PhaseSI('P',p[j],'S',s[i],'R744') == u'twophase':   
        for k in np.arange(h.size):
            try:            
                print(PropsSI('P','H',h[k],'S',s[i],'R744'))
                counter += 1
            except:
                print('Error')
                error += 1

print('Correct: '+str(counter))
print('Errors: '+str(error))

By the way, is there a page in the documentation with the reference states for enthalpy and entropy?

@ibell
Copy link
Contributor

ibell commented Feb 12, 2015

I'd recommend a few small changes to your script, but yes, it does seem to result in quite a few failures. I'm about to embark on #262, it might be a while before I can take a look :(

from __future__ import print_function

from CoolProp.CoolProp import PhaseSI, PropsSI
import numpy as np

s = np.arange(1200,1600,10)
p = np.arange(30e5,55e5,1e5)

counter = 0
error = 0

h = np.zeros(p.size)

for i in np.arange(s.size):
    for j in np.arange(p.size):
        h[j] = PropsSI('H','P',p[j],'S',s[i],'R744')

    if PhaseSI('P',p[j],'S',s[i],'R744') == u'twophase':   
        for k in np.arange(h.size):
            try:            
                print(PropsSI('P','H',h[k],'S',s[i],'R744'))
                counter += 1
            except BaseException as BE:
                print('Error', BE)
                error += 1

print('Correct: '+str(counter))
print('Errors: '+str(error))

@ibell ibell added this to the v 5.1 milestone Apr 26, 2015
@ibell ibell closed this as completed in 08676c3 Apr 26, 2015
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