/[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 2067 - (show annotations) (download) (as text)
Thu Aug 13 10:39:43 2009 UTC (10 years, 11 months ago) by jpye
File MIME type: text/x-ascend
File size: 2189 byte(s)
Add thermal_resistance type.
Formatting of thermodynamics.a4l.
Changing to 'molar_gas_constant' in eos-vanderwaals.
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
23 R IS_A molar_gas_constant;
24 b IS_A molar_volume;
25 a IS_A vdwa;
26 Pc IS_A pressure;
27 Tc IS_A temperature;
28
29 eq: (P*V^2 + a)*(V - b) = R*T*V^2;
30 eqb: b*8.0*data.Pc = R*data.Tc;
31 eqa: a*64.0*data.Pc = 27.0*R^2*(data.Tc)^2;
32 eqc: Z*R*T = P*V;
33
34 METHODS
35 METHOD default_self;
36 RUN ClearAll;
37 RUN specify;
38 RUN values;
39 END default_self;
40 METHOD specify;
41 P.fixed := TRUE;
42 T.fixed := TRUE;
43 V.fixed := FALSE;
44 Z.fixed := FALSE;
45 END specify;
46 METHOD values;
47 P := 12.0 {atm};
48 T := 298.15 {K};
49 V := 0.075 {m^3/mole};
50 V.nominal := 0.05 {m^3/mole};
51 V.upper_bound := 100 {m^3/mole};
52 END values;
53
54 END vanderwaals;
55
56 MODEL testvanderwaals;
57
58 c1 IS_A symbol_constant;
59 c1 :== 'helium_4';
60 cd IS_A components_data([c1],c1);
61 Tr, Pr IS_A factor;
62 P IS_A pressure;
63 T IS_A temperature;
64 V IS_A molar_volume;
65 Z IS_A factor;
66 tvanderwaals IS_A vanderwaals(P,T,V,Z,cd.data[c1]);
67
68 eqTr: Tr = T/cd.data[c1].Tc;
69 eqPr: Pr = P/cd.data[c1].Pc;
70
71 METHODS
72 METHOD default_self;
73 RUN ClearAll;
74 RUN specify;
75 RUN values;
76 END default_self;
77
78 METHOD specify;
79 P.fixed := TRUE;
80 V.fixed := FALSE;
81 Z.fixed := FALSE;
82 T.fixed := TRUE;
83 RUN tvanderwaals.specify;
84 END specify;
85 METHOD values;
86 P := 12.0 {bar};
87 T := 298.15 {K};
88 RUN tvanderwaals.values;
89 END values;
90
91 METHOD on_load;
92 RUN default_self;
93 END on_load;
94
95 METHOD fancyplot;
96 EXTERNAL zplot(SELF);
97 END fancyplot;
98
99 METHOD pvtplot;
100 EXTERNAL pvplot(SELF);
101 END pvtplot;
102
103 END testvanderwaals;

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