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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2680 - (show annotations) (download) (as text)
Mon Jan 28 06:30:25 2013 UTC (9 years, 6 months ago) by jpye
File MIME type: text/x-python
File size: 1076 byte(s)
Working on problem with solve_ph. Could be that one of the deriv routines is wrong in the saturation region?
1 from fprops import *
2
3 F = fluid("isohexane","pengrob","Chem. Eng. Data")
4
5 Tt = F.T_t
6 pt,rhoft,rhogt = F.triple_point()
7
8 hft = F.set_Tx(Tt,0).h
9 hgt = F.set_Tx(Tt,1.).h
10
11 print "rhoft = %f, rhogt = %e" % (rhoft, rhogt)
12 print "hft = %f, hgt = %f" % (hft, hgt)
13
14 h = 0.4 * hft + 0.6 * hgt
15 S = F.set_ph(pt, h)
16
17 print "S.rho =",S.rho
18
19 print "---"
20
21 h = F.set_Trho(Tt,1).h
22
23 S = F.set_ph(pt, h)
24
25 print "S.rho =",S.rho
26 print "S.h =",S.h
27
28 print "\n---"
29
30 T = 128.4465
31 rho = 1
32
33 print "Testing h(T,rho) for T = %f, rho = %f" % (T,rho)
34
35 hf = F.set_Tx(T,0).h
36 hg = F.set_Tx(T,1.).h
37
38 rhof = F.set_Tx(T,0).rho
39 rhog = F.set_Tx(T,1.).rho
40
41 print "rhof = %f, rhog = %e" % (rhof, rhog)
42 print "hf = %f, hg = %f" % (hf, hg)
43
44 S = F.set_Trho(T, rho)
45
46 print "S.T =",S.T
47 print "S.rho =",S.rho
48
49 print "S.h =",S.h
50 print "S.x =",S.x
51 print "S.p =",S.p
52
53 print "by h, should be...",(S.h - hf)/(hg - hf)
54 print "by rho, should be...",(1/rho - 1/rhof)/(1/rhog - 1/rhof)
55
56 print "\n---"
57 print "Solving (p,h) for T = %f, rho = %f" % (T,rho)
58
59 p = S.p
60 h = S.h
61 S = F.set_ph(p,h)
62
63 print "S.T =",S.T
64 print "S.rho =",S.rho
65
66
67

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