/[ascend]/trunk/models/johnpye/ideal_steam.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/ideal_steam.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 576 - (show annotations) (download) (as text)
Tue May 9 03:42:08 2006 UTC (18 years, 8 months ago) by johnpye
File MIME type: text/x-ascend
File size: 2770 byte(s)
Changed all cases of *.fixed := {TRUE,FALSE} to 'FIX' and 'FREE' statements.
1 REQUIRE "johnpye/thermo_types.a4c";
2
3 MODEL ideal_steam REFINES thermo_state;
4
5 delta IS_A positive_variable;
6 tau IS_A positive_variable;
7
8 (*-------------- CONSTANTS ---------------*)
9 rhoc IS_A mass_density_constant;
10 Tc IS_A temperature_constant;
11
12 rhoc "density of water at the critical point"
13 :== 322 {kg/m^3};
14
15 Tc "temperature of water at the critical point"
16 :== 647.096 {K};
17
18 R IS_A specific_gas_constant;
19 R "specific gas constant for water"
20 :== 0.46151805 {kJ/kg/K};
21
22 z_01: tau = Tc / T;
23 z_02: delta = rho / rhoc;
24
25
26 range_0 IS_A set OF integer_constant;
27 range_0 :== [1..8];
28
29 range_01 IS_A set OF integer_constant;
30 range_01 :== [4..8];
31
32 range_r1 IS_A set OF integer_constant;
33 range_r1 :== [1..7];
34
35 range_r2 IS_A set OF integer_constant;
36 range_r2 :== [8..51];
37
38 range_r3 IS_A set OF integer_constant;
39 range_r3 :== [52..54];
40
41 range_r4 IS_A set OF integer_constant;
42 range_r4 :== [55..56];
43
44 n0[range_0] IS_A real_constant;
45 n0[1] :== -8.32044648201;
46
47 n0[2] :== 6.6832105268;
48 n0[3] :== 3.00632;
49 n0[4] :== 0.012436;
50
51 n0[5] :== 0.97315;
52 n0[6] :== 1.27950;
53 n0[7] :== 0.96956;
54 n0[8] :== 0.24873;
55
56 gamma0[range_01] IS_A real_constant;
57 gamma0[4] :== 1.28728967;
58 gamma0[5] :== 3.53734222;
59 gamma0[6] :== 7.74073708;
60 gamma0[7] :== 9.24437796;
61 gamma0[8] :== 27.5075105;
62
63 (*------------ IDEAL PARTS ------------*)
64
65 phi0 IS_A factor;
66 z_phi0_expr: phi0 =
67 SUM[ n0[i]*ln(1-exp(-tau*gamma0[i])) | i IN [range_01] ]
68 + ln(delta) + n0[1] + n0[2]*tau + n0[3]*ln(tau);
69
70 phi0delta IS_A factor;
71 z_phi0delta_expr: phi0delta = 1.0/delta;
72
73 phi0deltadelta IS_A factor;
74 z_phi0deltadelta_expr: phi0deltadelta =
75 -1.0/(delta*delta);
76
77
78 phi0tau IS_A factor;
79 z_phi0tau_expr: phi0tau =
80 n0[2] + n0[3]/tau
81 + SUM[ n0[i]*gamma0[i]*(1/(1-exp(-tau*gamma0[i])) - 1) | i IN [range_01] ];
82
83 phi0deltatau IS_A real_constant;
84 phi0deltatau :== 0.0;
85
86 phi0tautau IS_A factor;
87 z_phi0tautau_expr: phi0tautau
88 = -n0[3] / tau^2
89 - SUM [ n0[i] * gamma0[i]^2 * exp(-gamma0[i] * tau) / ( 1 - exp(-gamma0[i] * tau) )^2 | i IN range_01 ];
90
91
92 (*--------- THERMO PROPERTY RELATIONS ----------- *)
93
94 z_pressure: p = rho * R * T;
95
96 z_internal_energy: u = R * T * tau * (phi0tau);
97
98 z_enthalpy: h = R * T * (1 + tau*(phi0tau));
99
100 z_entropy: s = R * (tau*(phi0tau) - phi0);
101
102 z_c_isochoric: cv = - R * tau^2 * (phi0tautau);
103
104 z_c_isobaric: cp = - R * tau^2 * (phi0tautau);
105
106 (* z_spd_sound: w^2
107 = R * T * (1 - 1/(tau^2 * phi0tautau)); *)
108
109 METHODS
110 METHOD default_self;
111 RUN ClearAll;
112 RUN specify;
113 RUN values;
114 END default_self;
115
116 METHOD specify;
117 FIX T;
118 FIX rho;
119 END specify;
120
121 METHOD values;
122 (* these are the test values from page 14 of the IAPWS-95 release *)
123 T := 500 {K};
124 rho := 838.025 {kg/m^3};
125 END values;
126
127 END ideal_steam;

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