jjgomera / iapws

python libray for IAPWS standard calculation of water and steam properties
GNU General Public License v3.0
170 stars 64 forks source link

Heating at a constant specific volume #60

Closed JWDobken closed 2 years ago

JWDobken commented 2 years ago

Let's say I heat a closed volume from 1 bar to 1.5 bar:

>> state0 = IAPWS97(P=0.1, x=0.5)
>> state1 = IAPWS97(P=0.15, v=state0.v)
>> state1.T
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/var/folders/gn/kp0n81rx5nxbcxdcpf8lhsq40000gn/T/ipykernel_13339/4110925265.py in <module>
      1 state0 = IAPWS97(P=0.1, x=0.5)
      2 state1 = IAPWS97(P=0.15, v=state0.v)
----> 3 state1.T

AttributeError: 'IAPWS97' object has no attribute 'T'

How can I determine state 1 from the specific volume?

jjgomera commented 2 years ago

Hi, IAPWS97 don't support input pair P-v, use IAPWS95 instead:

>>> from iapws import IAPWS95
>>> st0 = IAPWS95(P=0.1, x=0.5)
>>> st1 = IAPWS95(P=0.15, v=st0.v)
/home/jjgomera/Programacion/iapws/iapws/iapws95.py:734: RuntimeWarning: invalid value encountered in log
  Ps = self.R*T*rhol*rhog/(rhol-rhog)*(K+log(rhol/rhog))
/home/jjgomera/Programacion/iapws/iapws/iapws95.py:736: RuntimeWarning: invalid value encountered in log
  Jl*(1/rhog-1/rhol)-log(rhol/rhog)-K,
>>> st1.T
384.4993788995694