Closed thermalogic closed 7 years ago
You are right, and with 0.2 as quality value isn't a small value near saturation line, so this is a gross bug. Nowadays I'm trying to add coverage to iapws code, and i can see the _Bound_hs method is too tricky and bug prone. I'm trying to rewrite it. Thanks and stay tuned for commit
Your job is the most perfect in all open source codes on IAPWS-IF97. Thanks
Please check the following code:
if h <= hmax:
if smin <= s <= s13:
P = _Backward1_P_hs(h, s) # if (h,s) is wet steam region, the line may produce the bug, p is error.
T = _Backward1_T_Ph(P, h)
if T-0.0218 >= 273.15 and Pt <= P <= 100:
hs = _h1_s(s)
if h >= hs:
region = 1
elif hmin <= h < hs:
region = 4
Hi, i think it's solved with last commit
In [1]: from iapws.iapws97 import IAPWS97
In [2]: f_px = IAPWS97(P=0.00353658941, x=0.2)
In [3]: f_hs = IAPWS97(h=f_px.h, s=f_px.s)
In [4]: f_hs.P
Out[4]: 0.003536589410004118
In [5]: f_hs.x
Out[5]: 0.19999999999996446
Try it
Your work is great! I have improved my IF97 code in C with your python code Thanks!
_Bound_hs(h, s) Returns region = None
raise
NotImplementedError("Incoming out of bound")