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

Contents of /trunk/models/kchittur/eos-vdw.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1457 - (show annotations) (download) (as text)
Mon May 28 17:50:45 2007 UTC (13 years, 8 months ago) by kchittur
File MIME type: text/x-ascend
File size: 2641 byte(s)
krishnan chittur
1 REQUIRE "thermodynamics.a4l";
2
3 IMPORT "johnpye/extpy/extpy";
4 IMPORT "zplot";
5
6 ATOM vdwa REFINES solver_var
7 DIMENSION M*L^5/Q^2/T^2
8 DEFAULT 0.1 {kg*m^5/mole^2/sec^2};
9 lower_bound := 0.0 {kg*m^5/mole^2/sec^2};
10 upper_bound := 10.0 {kg*m^5/mole^2/sec^2};
11 nominal := 0.1 {kg*m^5/mole^5/sec^2};
12 END vdwa;
13
14 ATOM virialC REFINES solver_var
15 DIMENSION L^6/Q^2
16 DEFAULT 7000.0 {cm^6/mol^2};
17 lower_bound := 0.0 {cm^6/mol^2};
18 upper_bound := 1.0 {m^6/mol^2};
19 nominal := 7000.0 {cm^6/mol^2};
20 END virialC;
21
22 ATOM virialB REFINES solver_var
23 DIMENSION L^3/Q
24 DEFAULT 1.0 {m^3/mol};
25 lower_bound := -1000.00 {m^3/mol};
26 upper_bound := 1000.0 {m^3/mol};
27 nominal := 1.0 {m^3/mol};
28 END virialB;
29
30 MODEL vdw(P WILL_BE pressure;
31 T WILL_BE temperature;
32 V WILL_BE molar_volume;
33 Z WILL_BE factor;
34 data WILL_BE td_component_constants;);
35
36 R IS_A gas_constant;
37 Pc IS_A pressure;
38 Tc IS_A temperature;
39 T_degC IS_A factor;
40 beta, q,Tr, Pr, omega IS_A factor;
41
42 alpha, PSI, OMEGA, sigma, eps IS_A real_constant;
43
44 PSI :== 27.0/64.0;
45 OMEGA :== 1.0/8.0;
46 sigma :== 0.0;
47 eps :== 0.0;
48 alpha :== 1.0;
49
50 Pc = data.Pc;
51 Tc = data.Tc;
52 omega = data.omega;
53
54 eq1: Tr = T/Tc;
55 eq2: Pr = P/Pc;
56 eq3: T_degC = T/1{K} - 273.15;
57
58 eq5: q = PSI*alpha/(OMEGA*Tr);
59 eq6: beta = OMEGA*Pr/Tr;
60 eq7: Z = 1.0 + beta - q*beta*(Z - beta)/((Z + eps*beta)*(Z + sigma*beta));
61 eq8: P*V = Z*R*T;
62
63 METHODS
64 METHOD default_self;
65 RUN ClearAll;
66 RUN specify;
67 RUN values;
68 END default_self;
69
70 METHOD specify;
71 P.fixed := TRUE;
72 T.fixed := TRUE;
73 T_degC.fixed := FALSE;
74 END specify;
75 METHOD values;
76 P := 12.0 {bar};
77 T := 298.15 {K};
78 Z.lower_bound := 0.0;
79 Z.upper_bound := 10.0;
80 Z.nominal := 0.1;
81 END values;
82
83 END vdw;
84
85
86 MODEL testvdw;
87
88 c1 IS_A symbol_constant;
89 c1 :== 'ethylene';
90 cd IS_A components_data([c1],c1);
91 Tr, Pr IS_A factor;
92 P IS_A pressure;
93 T IS_A temperature;
94 V IS_A molar_volume;
95 Z IS_A factor;
96 tvdw IS_A vdw(P,T,V,Z,cd.data[c1]);
97
98 eqTr: Tr = T/cd.data[c1].Tc;
99 eqPr: Pr = P/cd.data[c1].Pc;
100
101 METHODS
102 METHOD default_self;
103 RUN ClearAll;
104 RUN specify;
105 RUN values;
106 END default_self;
107
108 METHOD specify;
109 P.fixed := TRUE;
110 V.fixed := FALSE;
111 Z.fixed := FALSE;
112 T.fixed := TRUE;
113 RUN tvdw.specify;
114 END specify;
115 METHOD values;
116 P := 12.0 {bar};
117 T := 298.15 {K};
118 RUN tvdw.values;
119 END values;
120
121 METHOD on_load;
122 RUN default_self;
123 END on_load;
124
125 METHOD fancyplot;
126 EXTERNAL zplot(SELF);
127 END fancyplot;
128
129 END testvdw;

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