/[ascend]/trunk/models/johnpye/fprops/python/sat.py
ViewVC logotype

Contents of /trunk/models/johnpye/fprops/python/sat.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2225 - (show annotations) (download) (as text)
Mon Jul 26 03:40:18 2010 UTC (9 years, 11 months ago) by jpye
File MIME type: text/x-python
File size: 1102 byte(s)
Added python bindings for new function. 
We can see that it's not converging for about 10% of cases.
1 from fprops import *
2
3 D = helmholtz_data_carbondioxide;
4
5 from pylab import *
6 hold(1)
7
8 T_min = 206.
9 TT = linspace(T_min, D.T_c, 1000)
10
11 rhog = array([fprops_rhog_T_chouaieb(T,D) for T in TT])
12 rhof = array([fprops_rhof_T_rackett(T,D) for T in TT])
13 psat = array([fprops_psat_T_xiang(T,D) for T in TT])
14
15 rhof1 = []
16 rhog1 = []
17 psat1 = []
18
19 TT2 = linspace(T_min, D.T_c, 300)
20 TT1 = []
21 for T in TT2:
22 res, p1, rf1, rg1 = fprops_sat_T(T,D)
23 if res:
24 print "error in saturation function T =",T
25 continue
26 rhof1.append(rf1)
27 rhog1.append(rg1)
28 psat1.append(p1)
29 #print "T=%f, psat=%f bar, rhof=%f, rhog=%f" % (T,p1/1e5,rf1,rg1)
30 TT1.append(T)
31
32 TT = array(TT)
33 TT1 = array(TT1)
34 psat1 = array(psat1)
35 psat = array(psat)
36
37 plot(rhog,TT,label="vapour (Chouaieb)")
38 plot(rhof,TT,label="liquid (Rackett)")
39
40 plot(rhog1,TT1,'rx',label="vapour (Maxwell)")
41 plot(rhof1,TT1,'bx',label="liquid (Maxwell)")
42
43
44 legend(loc=8)
45 xlabel('Density')
46 ylabel('Temperature')
47 #legend(L)
48 #axis([10,1200,1.,1e6 * D.p_c])
49 #axis([0,1000,0,100e6])
50
51 figure()
52 hold(1)
53
54 plot(TT,psat/1e5,label="Xiang")
55 plot(TT1,psat1/1e5,'rx',label="Maxwell")
56
57 show()
58

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22