Closed lindasunyao closed 6 years ago
sat_pressue = IAPWS97(h=4197.3, s=7.82) p = sat_pressue.P print(p)
I want calculate the P use h、s , but when h is invariable, s in range(7.82,7.88),will appear math domain error.
G:\python>cd g:\python && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && python c:\Users\Administrator.vscode\extensions\ms-python.python-2018.5.0\pythonFiles\PythonTools\visualstudio_py_launcher.py g:\python 61692 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput g:\python\cal.py " Traceback (most recent call last): File "g:\python\cal.py", line 44, in sat_pressue = IAPWS97(h=4197.3, s=7.82) File "D:\python\lib\site-packages\iapws\iapws97.py", line 4306, in init self.call(kwargs) File "D:\python\lib\site-packages\iapws\iapws97.py", line 4313, in call self.calculo() File "D:\python\lib\site-packages\iapws\iapws97.py", line 4518, in calculo T, P = fsolve(funcion, [1400, 1]) File "D:\python\lib\site-packages\scipy\optimize\minpack.py", line 146, in fsolve res = _root_hybr(func, x0, args, jac=fprime, options) File "D:\python\lib\site-packages\scipy\optimize\minpack.py", line 224, in _root_hybr ml, mu, epsfcn, factor, diag) File "D:\python\lib\site-packages\iapws\iapws97.py", line 4516, in funcion return (_Region5(par[0], par[1])["h"]-h, File "D:\python\lib\site-packages\iapws\iapws97.py", line 3717, in _Region5 go, gop, gopp, got, gott, gopt = Region5_cp0(Tr, Pr) File "D:\python\lib\site-packages\iapws\iapws97.py", line 3781, in Region5_cp0 go = log(Pr) ValueError: math domain error
Check now
Thanks for report!
sat_pressue = IAPWS97(h=4197.3, s=7.82) p = sat_pressue.P print(p)
I want calculate the P use h、s , but when h is invariable, s in range(7.82,7.88),will appear math domain error.
G:\python>cd g:\python && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && python c:\Users\Administrator.vscode\extensions\ms-python.python-2018.5.0\pythonFiles\PythonTools\visualstudio_py_launcher.py g:\python 61692 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput g:\python\cal.py " Traceback (most recent call last): File "g:\python\cal.py", line 44, in
sat_pressue = IAPWS97(h=4197.3, s=7.82)
File "D:\python\lib\site-packages\iapws\iapws97.py", line 4306, in init
self.call(kwargs)
File "D:\python\lib\site-packages\iapws\iapws97.py", line 4313, in call
self.calculo()
File "D:\python\lib\site-packages\iapws\iapws97.py", line 4518, in calculo
T, P = fsolve(funcion, [1400, 1])
File "D:\python\lib\site-packages\scipy\optimize\minpack.py", line 146, in fsolve
res = _root_hybr(func, x0, args, jac=fprime, options)
File "D:\python\lib\site-packages\scipy\optimize\minpack.py", line 224, in _root_hybr
ml, mu, epsfcn, factor, diag)
File "D:\python\lib\site-packages\iapws\iapws97.py", line 4516, in funcion
return (_Region5(par[0], par[1])["h"]-h,
File "D:\python\lib\site-packages\iapws\iapws97.py", line 3717, in _Region5
go, gop, gopp, got, gott, gopt = Region5_cp0(Tr, Pr)
File "D:\python\lib\site-packages\iapws\iapws97.py", line 3781, in Region5_cp0
go = log(Pr)
ValueError: math domain error