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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1728 - (show annotations) (download) (as text)
Wed Jan 16 01:01:07 2008 UTC (12 years, 6 months ago) by kchittur
File MIME type: text/x-ascend
File size: 2194 byte(s)
Minor changes to eos-vanderwaals.a4c and zplot.py
1 REQUIRE "thermodynamics.a4l";
2 IMPORT "johnpye/extpy/extpy";
3 IMPORT "kchittur/zplot";
4
5 (* vanderwaals EOS as usually written *)
6 (* methods written to create a PV plot at different T's *)
7
8 ATOM vdwa REFINES solver_var
9 DIMENSION M*L^5/Q^2/T^2
10 DEFAULT 0.1 {kg*m^5/mole^2/sec^2};
11 lower_bound := 0.0 {kg*m^5/mole^2/sec^2};
12 upper_bound := 10.0 {kg*m^5/mole^2/sec^2};
13 nominal := 0.1 {kg*m^5/mole^5/sec^2};
14 END vdwa;
15
16 MODEL vanderwaals(P WILL_BE pressure;
17 T WILL_BE temperature;
18 V WILL_BE molar_volume;
19 Z WILL_BE factor;
20 data WILL_BE td_component_constants;);
21
22 R IS_A gas_constant;
23 b IS_A molar_volume;
24 a IS_A vdwa;
25 Pc IS_A pressure;
26 Tc IS_A temperature;
27
28 eq: (P*V^2 + a)*(V - b) = R*T*V^2;
29 eqb: b*8.0*data.Pc = R*data.Tc;
30 eqa: a*64.0*data.Pc = 27.0*R^2*(data.Tc)^2;
31 eqc: Z*R*T = P*V;
32
33 METHODS
34 METHOD default_self;
35 RUN ClearAll;
36 RUN specify;
37 RUN values;
38 END default_self;
39 METHOD specify;
40 P.fixed := TRUE;
41 T.fixed := TRUE;
42 V.fixed := FALSE;
43 Z.fixed := FALSE;
44 END specify;
45 METHOD values;
46 P := 12.0 {atm};
47 T := 298.15 {K};
48 V := 0.075 {m^3/mole};
49 V.nominal := 0.05 {m^3/mole};
50 V.upper_bound := 100 {m^3/mole};
51 END values;
52
53 END vanderwaals;
54
55 MODEL testvanderwaals;
56
57 c1 IS_A symbol_constant;
58 c1 :== 'helium_4';
59 cd IS_A components_data([c1],c1);
60 Tr, Pr IS_A factor;
61 P IS_A pressure;
62 T IS_A temperature;
63 V IS_A molar_volume;
64 Z IS_A factor;
65 tvanderwaals IS_A vanderwaals(P,T,V,Z,cd.data[c1]);
66
67 eqTr: Tr = T/cd.data[c1].Tc;
68 eqPr: Pr = P/cd.data[c1].Pc;
69
70 METHODS
71 METHOD default_self;
72 RUN ClearAll;
73 RUN specify;
74 RUN values;
75 END default_self;
76
77 METHOD specify;
78 P.fixed := TRUE;
79 V.fixed := FALSE;
80 Z.fixed := FALSE;
81 T.fixed := TRUE;
82 RUN tvanderwaals.specify;
83 END specify;
84 METHOD values;
85 P := 12.0 {bar};
86 T := 298.15 {K};
87 RUN tvanderwaals.values;
88 END values;
89
90 METHOD on_load;
91 RUN default_self;
92 END on_load;
93
94 METHOD fancyplot;
95 EXTERNAL zplot(SELF);
96 END fancyplot;
97
98 METHOD pvtplot;
99 EXTERNAL pvplot(SELF);
100 END pvtplot;
101
102 END testvanderwaals;

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