/[ascend]/trunk/models/kchittur/eos-rk.a4c
ViewVC logotype

Annotation of /trunk/models/kchittur/eos-rk.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2071 - (hide annotations) (download) (as text)
Fri Aug 28 02:42:47 2009 UTC (11 years, 1 month ago) by jose
File MIME type: text/x-ascend
File size: 1887 byte(s)
MERGE Jose's branch [2274]:[2584] into trunk
1 kchittur 1457 REQUIRE "thermodynamics.a4l";
2    
3     IMPORT "johnpye/extpy/extpy";
4 kchittur 1476 IMPORT "kchittur/zplot";
5    
6 kchittur 1457 MODEL rk(P WILL_BE pressure;
7 jpye 1805 T WILL_BE temperature;
8     V WILL_BE molar_volume;
9     Z WILL_BE factor;
10     data WILL_BE td_component_constants;);
11 kchittur 1457
12 jose 2071 R IS_A molar_gas_constant;
13 jpye 1805 Pc IS_A pressure;
14     Tc IS_A temperature;
15     T_degC IS_A factor;
16     alpha, beta, q,Tr, Pr, omega IS_A factor;
17 kchittur 1457
18 jpye 1805 PSI, OMEGA, sigma, eps IS_A real_constant;
19 kchittur 1457
20 jpye 1805 PSI :== 0.42748;
21     OMEGA :== 0.08664;
22     sigma :== 1.0;
23     eps :== 0.0;
24 kchittur 1457
25 jpye 1805 Pc = data.Pc;
26     Tc = data.Tc;
27     omega = data.omega;
28 kchittur 1457
29 jpye 1805 eq1: Tr = T/Tc;
30     eq2: Pr = P/Pc;
31     eq3: T_degC = T/1{K} - 273.15;
32 kchittur 1457
33 jpye 1805 eq4: alpha = Tr^(0.5);
34     eq5: q = PSI*alpha/(OMEGA*Tr);
35     eq6: beta = OMEGA*Pr/Tr;
36     eq7: Z = 1.0 + beta - q*beta*(Z - beta)/((Z + eps*beta)*(Z + sigma*beta));
37     eq8: P*V = Z*R*T;
38 kchittur 1457 METHODS
39     METHOD default_self;
40 jpye 1805 RUN ClearAll;
41     RUN specify;
42     RUN values;
43 kchittur 1457 END default_self;
44 jpye 1805 METHOD specify;
45     P.fixed := TRUE;
46     T_degC.fixed := FALSE;
47     T.fixed := TRUE;
48     END specify;
49     METHOD values;
50     P := 12.0 {bar};
51     T := 298.15 {K};
52     Z.lower_bound := 0.0;
53     Z.upper_bound := 10.0;
54     Z.nominal := 1.0;
55     END values;
56 kchittur 1457 END rk;
57    
58     MODEL testrk;
59 jpye 1805 c1 IS_A symbol_constant;
60     c1 :== 'ethylene';
61     cd IS_A components_data([c1],c1);
62     Tr, Pr IS_A factor;
63     P IS_A pressure;
64     T IS_A temperature;
65     V IS_A molar_volume;
66     Z IS_A factor;
67     trk IS_A rk(P,T,V,Z,cd.data[c1]);
68 kchittur 1457
69 jpye 1805 eqTr: Tr = T/cd.data[c1].Tc;
70     eqPr: Pr = P/cd.data[c1].Pc;
71 kchittur 1457
72     METHODS
73     METHOD default_self;
74 jpye 1805 RUN ClearAll;
75     RUN specify;
76     RUN values;
77 kchittur 1457 END default_self;
78    
79     METHOD specify;
80 jpye 1805 P.fixed := TRUE;
81     V.fixed := FALSE;
82     Z.fixed := FALSE;
83     T.fixed := TRUE;
84     RUN trk.specify;
85 kchittur 1457 END specify;
86     METHOD values;
87 jpye 1805 P := 12.0 {bar};
88     T := 298.15 {K};
89     RUN trk.values;
90 kchittur 1457 END values;
91    
92     METHOD on_load;
93 jpye 1805 RUN default_self;
94 kchittur 1457 END on_load;
95    
96     METHOD fancyplot;
97 jpye 1805 EXTERNAL zplot(SELF);
98 kchittur 1457 END fancyplot;
99    
100     END testrk;

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