Problem description
The calculation of saturation temperature/pressure has bugs/raises errors at the critical point.
Steps to reproduce
In [1]: import cantera as ct
...: w = ct.Water()
In [2]: w.T_sat
Out[2]: 373.1772329354826
In [3]: w.P_sat
Out[3]: 3528.213802290444
In [4]: w.TP = w.critical_temperature, w.critical_pressure
In [5]: w.TP
Out[5]: (647.286, 22088999.992234096)
In [6]: w.P_sat # <--- produces incorrect result (equal to last calculation)
Out[6]: 3528.213802290444
In [7]: w.T_sat # <--- raises error (instead of returning critical temperature)
---------------------------------------------------------------------------
CanteraError Traceback (most recent call last)
<ipython-input-7-1b90fdda2181> in <module>()
----> 1 w.T_sat
/src/interfaces/cython/cantera/thermo.pyx in cantera._cantera.ThermoPhase.T_sat.__get__()
1223 """Saturation temperature [K] at the current pressure."""
1224 def __get__(self):
-> 1225 return self.thermo.satTemperature(self.P)
1226
1227 ######## Methods to get/set the complete thermodynamic state ########
CanteraError:
***********************************************************************
CanteraError thrown by Substance::Ps:
illegal temperature value 647.2860009464163
***********************************************************************
In [8]: w.P_sat # <--- different from previous call (!), and very close
Out[8]: 22088999.992961578
System information
- Cantera version: 2.5.0b1
- OS: Ubuntu 18.04
- Python version: 3.6.9
Additional context
Bug surfaced while finalizing #907; it appears to be related to the behavior that @speth encountered when investigating the initial version of the PR.
Problem description
The calculation of saturation temperature/pressure has bugs/raises errors at the critical point.
Steps to reproduce
System information
Additional context
Bug surfaced while finalizing #907; it appears to be related to the behavior that @speth encountered when investigating the initial version of the PR.