In [1]:
import CoolProp
import CoolProp.CoolProp as CP
from math import sqrt
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize
%matplotlib inline

In [2]:
# Calculate the saturation curves for all fluids
acc = [CP.Props(fluid,'accentric') for fluid in CoolProp.__fluids__]
mm = [CP.Props(fluid,'molemass') for fluid in CoolProp.__fluids__]
pc = [CP.Props(fluid,'pcrit') for fluid in CoolProp.__fluids__]
Tc = [CP.Props(fluid,'Tcrit') for fluid in CoolProp.__fluids__]

ms = []
for fluid in CoolProp.__fluids__:
    Tc = CP.Props(fluid,'Tcrit')
    rhoc = CP.Props(fluid,'rhocrit')
    pc = CP.Props(fluid,'pcrit')
    T = np.linspace(CP.Props(fluid,'Tmin'),Tc-0.5,200)
    pV = CP.Props('P','T',T,'Q',1,fluid)
    plt.plot(Tc/T-1,np.log(pV/pc))
    
    # m is the mean slope in plot coordinates
    ms.append(np.mean(np.log(pV/pc)/(Tc/T-1)))
    
    
plt.xlabel('$T_c/T-1$')
plt.ylabel('$\ln(p/p_c)$')


Out[2]:
<matplotlib.text.Text at 0x5b0ac90>

In [3]:
plt.plot(acc,ms,'o')
m,b = np.polyfit(acc,ms,1)
plt.plot(acc,m*np.array(acc)+b)
print m,b
plt.show()


-6.08930221451 -5.42477887222

Final solution is

$$m = -6.08930221451 \omega -5.42477887222$$

and

$$\ln\left(\frac{p}{p_c}\right)=m\left(\frac{T_c}{T}-1\right)$$

In [18]:
acc = np.array([CP.Props(fluid,'accentric') for fluid in CoolProp.__fluids__])
mm = np.array([CP.Props(fluid,'molemass') for fluid in CoolProp.__fluids__])
pc = np.array([CP.Props(fluid,'pcrit') for fluid in CoolProp.__fluids__])
Tc = np.array([CP.Props(fluid,'Tcrit') for fluid in CoolProp.__fluids__])
rhoc = np.array([CP.Props(fluid,'rhocrit') for fluid in CoolProp.__fluids__])

plt.plot(Tc, acc, 'o')

a = np.polyfit(Tc,acc,3)
x = np.linspace(np.min(Tc),np.max(Tc))
y = np.polyval(a,x)
plt.plot(x,y)
plt.xlabel('$T_c$')
plt.ylabel('$\omega$')
print a


[  6.67228479e-09  -7.20464352e-06   3.16947758e-03  -2.88760012e-01]

In [5]:
acc = np.array([CP.Props(fluid,'accentric') for fluid in CoolProp.__fluids__])
mm = np.array([CP.Props(fluid,'molemass') for fluid in CoolProp.__fluids__])
pc = np.array([CP.Props(fluid,'pcrit') for fluid in CoolProp.__fluids__])
Tc = np.array([CP.Props(fluid,'Tcrit') for fluid in CoolProp.__fluids__])
rhoc = np.array([CP.Props(fluid,'rhocrit') for fluid in CoolProp.__fluids__])

plt.plot(mm, Tc, 'o')


Out[5]:
[<matplotlib.lines.Line2D at 0x6a80a50>]

In [53]:
a,b,c,d = [],[],[],[]
for fluid in CoolProp.__fluids__:
    Tc = CP.Props(fluid,'Tcrit')
    Tt = CP.Props(fluid,'Ttriple')
    rhoc = CP.Props(fluid,'rhocrit')
    pc = CP.Props(fluid,'pcrit')
    T = np.linspace(CP.Props(fluid,'Tmin'),Tc-0.5,200)
    rhoV = CP.Props('D','T',T,'Q',1,fluid)
    x = (Tc/T-1)/(Tc/Tt-1)
    y = np.log(rhoV/rhoc)*(T/Tc)**1.5
    plt.plot(x,y)
    pf = np.polyfit(x,y,3)
    a.append(pf[0])
    b.append(pf[1])
    c.append(pf[2])
    d.append(pf[3])



In [31]:
acc = np.array([CP.Props(fluid,'accentric') for fluid in CoolProp.__fluids__])
mm = np.array([CP.Props(fluid,'molemass') for fluid in CoolProp.__fluids__])
pc = np.array([CP.Props(fluid,'pcrit') for fluid in CoolProp.__fluids__])
Tc = np.array([CP.Props(fluid,'Tcrit') for fluid in CoolProp.__fluids__])
rhoc = np.array([CP.Props(fluid,'rhocrit') for fluid in CoolProp.__fluids__])

plt.plot(pc,d,'o')


Out[31]:
[<matplotlib.lines.Line2D at 0x7b3f5b0>]

In [ ]: