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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2260 - (show annotations) (download) (as text)
Thu Aug 5 06:28:01 2010 UTC (13 years, 10 months ago) by jpye
File MIME type: text/x-python
File size: 1066 byte(s)
Error messages to detect temperatures below critical point.
1 from fprops import *
2 from pylab import *
3
4 D = helmholtz_data_water;
5
6 TT = linspace(273.16, 1000, 40);
7 rr = logspace(log10(0.01), log10(900), 40);
8
9 goodT = []
10 goodv = []
11 badT = []
12 badv = []
13
14 for T in TT:
15 for rho in rr:
16 print "+++ T = %f, rho = %f" % (T,rho)
17 p = helmholtz_p(T,rho,D)
18 h = helmholtz_h(T,rho,D)
19 print " p = %f bar, h = %f kJ/kg" % (p/1e5,h/1e3)
20 if(h > 8000e3):
21 continue
22
23 res, T1, rho1 = fprops_solve_ph(p,h,0,D);
24 if res:
25 print " +++ BAD RESULT"
26 if not isnan(T) and not isnan(rho):
27 badT.append(T); badv.append(1./rho)
28 else:
29 if not isnan(T) and not isnan(rho):
30 goodT.append(T); goodv.append(1./rho)
31 print " +++ GOOD RESULT T1 = %f, rho1 = %f" % (T1, rho1)
32
33 figure()
34 print badT
35 semilogx(badv, badT, 'rx')
36 hold(1)
37 semilogx(goodv, goodT, 'g.')
38
39 # plot saturation curves
40 TT = linspace(D.T_t, D.T_c, 100)
41 TT1 = []
42 vf1 = []
43 vg1 = []
44 for T in TT:
45 res, p, rhof, rhog = fprops_sat_T(T,D)
46 if not res:
47 TT1.append(T)
48 vf1.append(1./rhof)
49 vg1.append(1./rhog)
50
51 semilogx(vf1,TT1,"b-")
52 semilogx(vg1,TT1,"b-")
53
54 show()
55

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