-
Notifications
You must be signed in to change notification settings - Fork 358
Description
For plotting purposes, I'm trying to calculate properties of water at critical pressure. This works fine at the critical point, but not when I move away from it:
from CoolProp import AbstractState
import CoolProp.CoolProp as CP
backend="?"
fluid="water"
state = AbstractState(backend, fluid)
pcrit = CP.PropsSI(fluid, "pcrit")
print("critical point")
state.update(CP.PQ_INPUTS, pcrit, 0)
smass = 4000
print("pcrit, smass={}".format(smass))
state.update(CP.PSmass_INPUTS, pcrit, smass)
the last line throws an error message:
>>> state.update(CP.PSmass_INPUTS, pcrit, 5000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "CoolProp/AbstractState.pyx", line 90, in CoolProp.CoolProp.AbstractState.update (CoolProp/CoolProp.cpp:17930)
File "CoolProp/AbstractState.pyx", line 92, in CoolProp.CoolProp.AbstractState.update (CoolProp/CoolProp.cpp:17822)
ValueError: Residual function in secant returned invalid number
I also tried using PT_INPUTS, starting at minimum temperature for water (273.16 K). AFAIK Water should be liquid at critical pressure and triple point temperature, but CP outputs an empty string for the phase and throws the same error as above. Only when I use a higher temperature (starting between 300 and 350 K), things start to work without errors.
Increasing pressure by just 1 Pa also gets rid of the errors, as in
state2.update(CP.PT_INPUTS, pcrit+1, tmin)`
Is there a reliable way of evaulating at pcrit over the whole defined range of some other variable (for example entropy or temperature, as above)?