/[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 1476 - (hide annotations) (download) (as text)
Mon Jun 4 16:44:46 2007 UTC (13 years, 4 months ago) by kchittur
File MIME type: text/x-ascend
File size: 1943 byte(s)


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     T WILL_BE temperature;
8     V WILL_BE molar_volume;
9     Z WILL_BE factor;
10     data WILL_BE td_component_constants;);
11    
12     R IS_A gas_constant;
13     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    
18     PSI, OMEGA, sigma, eps IS_A real_constant;
19    
20     PSI :== 0.42748;
21     OMEGA :== 0.08664;
22     sigma :== 1.0;
23     eps :== 0.0;
24    
25     Pc = data.Pc;
26     Tc = data.Tc;
27     omega = data.omega;
28    
29     eq1: Tr = T/Tc;
30     eq2: Pr = P/Pc;
31     eq3: T_degC = T/1{K} - 273.15;
32    
33     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     METHODS
39     METHOD default_self;
40     RUN ClearAll;
41     RUN specify;
42     RUN values;
43     END default_self;
44     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    
57     END rk;
58    
59     MODEL testrk;
60    
61     c1 IS_A symbol_constant;
62     c1 :== 'ethylene';
63     cd IS_A components_data([c1],c1);
64     Tr, Pr IS_A factor;
65     P IS_A pressure;
66     T IS_A temperature;
67     V IS_A molar_volume;
68     Z IS_A factor;
69     trk IS_A rk(P,T,V,Z,cd.data[c1]);
70    
71     eqTr: Tr = T/cd.data[c1].Tc;
72     eqPr: Pr = P/cd.data[c1].Pc;
73    
74     METHODS
75     METHOD default_self;
76     RUN ClearAll;
77     RUN specify;
78     RUN values;
79     END default_self;
80    
81     METHOD specify;
82     P.fixed := TRUE;
83     V.fixed := FALSE;
84     Z.fixed := FALSE;
85     T.fixed := TRUE;
86     RUN trk.specify;
87     END specify;
88     METHOD values;
89     P := 12.0 {bar};
90     T := 298.15 {K};
91     RUN trk.values;
92     END values;
93    
94     METHOD on_load;
95     RUN default_self;
96     END on_load;
97    
98     METHOD fancyplot;
99     EXTERNAL zplot(SELF);
100     END fancyplot;
101    
102     END testrk;

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