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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 90 - (show annotations) (download) (as text)
Wed Dec 7 16:03:44 2005 UTC (14 years, 8 months ago) by johnpye
File MIME type: text/x-ascend
File size: 17880 byte(s)
Adding some more (under development) models...
1 REQUIRE "system.a4l";
2 REQUIRE "atoms.a4l";
3 REQUIRE "johnpye/thermo_types.a4c";
4
5 (*************************************************************************
6
7 The thermodynamic properties of water calculated with the
8 IAPWS95 equations. Variables and (example/possible) units:
9
10 T Temperature, K
11 rho Density, kg/m^3
12 p Pressure, MPa
13 u Specific internal energy, kJ/kg
14 h Specific enthalpy, kJ/kg
15 s Specific entropy, kJ/(kg*K)
16 cv Isochoric specific heat, kJ/(kg*K)
17 cp Isobaric specific heat, kJ/(kg*K)
18 w Speed of sound, m/s
19
20 References:
21
22 [1] The International Association for the Properties of
23 Water and Steam, "Release on the IAPWS Formulation 1995
24 for the Thermodynamic Properties of Ordinary Water
25 Substance for General and Scientific Use", dated
26 September 1996, Fredericia, Denmark. See the "Releases"
27 section of the website http://www.iapws.org/.
28
29 [2] NIST Chemistry Webbook:
30 http://webbook.nist.gov/chemistry/fluid/
31
32 ----------------------------------------------------------------------
33
34 freesteam-ascend - IAPWS-95 steam library for ASCEND
35 Copyright (C) John Pye 2005
36 derived from work by Don Peterson for freesteam, (C) 2004.
37
38 This program is free software; you can redistribute it
39 and/or modify it under the terms of the GNU General Public
40 License as published by the Free Software Foundation; either
41 version 2 of the License, or (at your option) any later
42 version.
43
44 This program is distributed in the hope that it will be
45 useful, but WITHOUT ANY WARRANTY; without even the implied
46 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
47 PURPOSE. See the GNU General Public License for more
48 details.
49
50 You should have received a copy of the GNU General Public
51 License along with this program; if not, write to the Free
52 Software Foundation, Inc., 59 Temple Place, Suite 330,
53 Boston, MA 02111-1307 USA
54
55 *)
56
57 MODEL steam_state;
58
59 delta IS_A factor;
60 tau IS_A factor;
61
62 rho IS_A mass_density;
63 T IS_A temperature;
64
65 (*-------------- CONSTANTS ---------------*)
66 rhoc IS_A mass_density_constant;
67 Tc IS_A temperature_constant;
68
69 rhoc "density of water at the critical point"
70 :== 322 {kg/m^3};
71
72 Tc "temperature of water at the critical point"
73 :== 647.096 {K};
74
75 R IS_A specific_gas_constant;
76 R "specific gas constant for water"
77 :== 0.46151805 {kJ/kg/K};
78
79 tau = Tc / T;
80 delta = rho / rhoc;
81
82
83 range_0 IS_A set OF integer_constant;
84 range_0 :== [1..8];
85
86 range_01 IS_A set OF integer_constant;
87 range_01 :== [4..8];
88
89 range_r1 IS_A set OF integer_constant;
90 range_r1 :== [1..7];
91
92 range_r2 IS_A set OF integer_constant;
93 range_r2 :== [8..51];
94
95 range_r3 IS_A set OF integer_constant;
96 range_r3 :== [52..54];
97
98 range_r4 IS_A set OF integer_constant;
99 range_r4 :== [55..56];
100
101 n0[range_0] IS_A real_constant;
102 n0[1] :== -8.32044648201;
103
104 n0[2] :== 6.6832105268;
105 n0[3] :== 3.00632;
106 n0[4] :== 0.012436;
107
108 n0[5] :== 0.97315;
109 n0[6] :== 1.27950;
110 n0[7] :== 0.96956;
111 n0[8] :== 0.24873;
112
113 gamma0[range_01] IS_A real_constant;
114 gamma0[4] :== 1.28728967;
115 gamma0[5] :== 3.53734222;
116 gamma0[6] :== 7.74073708;
117 gamma0[7] :== 9.24437796;
118 gamma0[8] :== 27.5075105;
119
120 n[1..56] IS_A real_constant;
121 n[1] :== 0.12533547935523e-1; n[2] :== 0.78957634722828e+1; n[3] :== -0.87803203303561e+1; n[4] :== 0.31802509345418e+0;
122 n[5] :== -0.26145533859358e+0; n[6] :== -0.78199751687981e-2; n[7] :== 0.88089493102134e-2;
123 n[8] :== -0.66856572307965e+0; n[9] :== 0.20433810950965e+0; n[10] :== -0.66212605039687e-4;
124 n[11] :== -0.19232721156002e+0; n[12] :== -0.25709043003438e+0; n[13] :== 0.16074868486251e+0; n[14] :== -0.40092828925807e-1;
125 n[15] :== 0.39343422603254e-6; n[16] :== -0.75941377088144e-5; n[17] :== 0.56250979351888e-3;
126 n[18] :== -0.15608652257135e-4; n[19] :== 0.11537996422951e-8; n[20] :== 0.36582165144204e-6;
127 n[21] :== -0.13251180074668e-11; n[22] :== -0.62639586912454e-9; n[23] :== -0.10793600908932e+0; n[24] :== 0.17611491008752e-1;
128 n[25] :== 0.22132295167546e+0; n[26] :== -0.40247669763528e+0; n[27] :== 0.58083399985759e+0;
129 n[28] :== 0.49969146990806e-2; n[29] :== -0.31358700712549e-1; n[30] :== -0.74315929710341e+0;
130 n[31] :== 0.47807329915480e+0; n[32] :== 0.20527940895948e-1; n[33] :== -0.13636435110343e+0; n[34] :== 0.14180634400617e-1;
131 n[35] :== 0.83326504880713e-2; n[36] :== -0.29052336009585e-1; n[37] :== 0.38615085574206e-1;
132 n[38] :== -0.20393486513704e-1; n[39] :== -0.16554050063734e-2; n[40] :== 0.19955571979541e-2;
133 n[41] :== 0.15870308324157e-3; n[42] :== -0.16388568342530e-4; n[43] :== 0.43613615723811e-1; n[44] :== 0.34994005463765e-1;
134 n[45] :== -0.76788197844621e-1; n[46] :== 0.22446277332006e-1; n[47] :== -0.62689710414685e-4;
135 n[48] :== -0.55711118565645e-9; n[49] :== -0.19905718354408e+0; n[50] :== 0.31777497330738e+0;
136 n[51] :== -0.11841182425981e+0; n[52] :== -0.31306260323435e+2; n[53] :== 0.31546140237781e+2; n[54] :== -0.25213154341695e+4;
137 n[55] :== -0.14874640856724e+0; n[56] :== 0.31806110878444e+0;
138
139 c[1..51] IS_A integer_constant;
140 c[1] :== 0; c[2] :== 0; c[3] :== 0; c[4] :== 0; c[5] :== 0;
141 c[6] :== 0; c[7] :== 0; c[8] :== 1; c[9] :== 1; c[10] :== 1;
142 c[11] :== 1; c[12] :== 1; c[13] :== 1; c[14] :== 1; c[15] :== 1;
143 c[16] :== 1; c[17] :== 1; c[18] :== 1; c[19] :== 1; c[20] :== 1;
144 c[21] :== 1; c[22] :== 1; c[23] :== 2; c[24] :== 2; c[25] :== 2;
145 c[26] :== 2; c[27] :== 2; c[28] :== 2; c[29] :== 2; c[30] :== 2;
146 c[31] :== 2; c[32] :== 2; c[33] :== 2; c[34] :== 2; c[35] :== 2;
147 c[36] :== 2; c[37] :== 2; c[38] :== 2; c[39] :== 2; c[40] :== 2;
148 c[41] :== 2; c[42] :== 2; c[43] :== 3; c[44] :== 3; c[45] :== 3;
149 c[46] :== 3; c[47] :== 4; c[48] :== 6; c[49] :== 6; c[50] :== 6;
150 c[51] :== 6;
151
152 d[1..54] IS_A integer_constant;
153 d[1] :== 1; d[2] :== 1; d[3] :== 1; d[4] :== 2; d[5] :== 2;
154 d[6] :== 3; d[7] :== 4; d[8] :== 1; d[9] :== 1; d[10] :== 1;
155 d[11] :== 2; d[12] :== 2; d[13] :== 3; d[14] :== 4; d[15] :== 4;
156 d[16] :== 5; d[17] :== 7; d[18] :== 9; d[19] :== 10; d[20] :== 11;
157 d[21] :== 13; d[22] :== 15; d[23] :== 1; d[24] :== 2; d[25] :== 2;
158 d[26] :== 2; d[27] :== 3; d[28] :== 4; d[29] :== 4; d[30] :== 4;
159 d[31] :== 5; d[32] :== 6; d[33] :== 6; d[34] :== 7; d[35] :== 9;
160 d[36] :== 9; d[37] :== 9; d[38] :== 9; d[39] :== 9; d[40] :== 10;
161 d[41] :== 10; d[42] :== 12; d[43] :== 3; d[44] :== 4; d[45] :== 4;
162 d[46] :== 5; d[47] :== 14; d[48] :== 3; d[49] :== 6; d[50] :== 6;
163 d[51] :== 6; d[52] :== 3; d[53] :== 3; d[54] :== 3;
164
165 t[1..54] IS_A real_constant;
166 t[1] :== -0.5; t[2] :== 0.875; t[3] :== 1; t[4] :== 0.5; t[5] :== 0.75;
167 t[6] :== 0.375; t[7] :== 1; t[8] :== 4; t[9] :== 6; t[10] :== 12;
168 t[11] :== 1; t[12] :== 5; t[13] :== 4; t[14] :== 2; t[15] :== 13;
169 t[16] :== 9; t[17] :== 3; t[18] :== 4; t[19] :== 11; t[20] :== 4;
170 t[21] :== 13; t[22] :== 1; t[23] :== 7; t[24] :== 1; t[25] :== 9;
171 t[26] :== 10; t[27] :== 10; t[28] :== 3; t[29] :== 7; t[30] :== 10;
172 t[31] :== 10; t[32] :== 6; t[33] :== 10; t[34] :== 10; t[35] :== 1;
173 t[36] :== 2; t[37] :== 3; t[38] :== 4; t[39] :== 8; t[40] :== 6;
174 t[41] :== 9; t[42] :== 8; t[43] :== 16; t[44] :== 22; t[45] :== 23;
175 t[46] :== 23; t[47] :== 10; t[48] :== 50; t[49] :== 44; t[50] :== 46;
176 t[51] :== 50; t[52] :== 0; t[53] :== 1; t[54] :== 4;
177
178 (* Correlation parameters *)
179
180 (* TODO convert from C to ASCEND arrays? Note trickiness with 0- and 1-based array indices. *)
181
182 a[range_r4] IS_A real_constant;
183 a[55]:==3.5;
184 a[56]:==3.5;
185
186 b[range_r4] IS_A real_constant;
187 b[55]:== 0.85;
188 b[56]:== 0.95;
189
190 A[range_r4] IS_A real_constant;
191 A[55]:==0.32;
192 A[56]:==0.32;
193
194 B[range_r4] IS_A real_constant;
195 B[55]:==0.2;
196 B[56]:==0.2;
197
198 C[range_r4] IS_A real_constant;
199 C[55]:==28;
200 C[56]:==32;
201
202 D[range_r4] IS_A real_constant;
203 D[55]:==700;
204 D[56]:==800;
205
206 beta_r4[range_r4] IS_A real_constant;
207 beta_r4[55]:==0.3;
208 beta_r4[56]:==0.3;
209
210 alpha[range_r3] IS_A integer_constant;
211 alpha[52]:==20;
212 alpha[53]:==20;
213 alpha[54]:==20;
214
215 beta[range_r3] IS_A real_constant;
216 beta[52]:==150;
217 beta[53]:==150;
218 beta[54]:==250;
219
220 gamma[range_r3] IS_A real_constant;
221 gamma[52]:==1.21;
222 gamma[53]:==1.21;
223 gamma[54]:==1.25;
224
225 (*--------------- DIMENSIONLESS PARTIAL DERIVATIVES ---------------- *)
226
227 (*------------ IDEAL PARTS ------------*)
228
229 phi0 IS_A factor;
230 phi0_expr: phi0 =
231 SUM[ n0[i]*log(1-exp(-tau*gamma0[i])) | i IN [range_01] ]
232 + log(delta) + n0[1] + n0[2]*tau + n0[3]*log(tau);
233
234 phi0delta IS_A factor;
235 phi0delta_expr: phi0delta = 1.0/delta;
236
237 phi0deltadelta IS_A factor;
238 phi0deltadelta_expr: phi0deltadelta =
239 -1.0/(delta*delta);
240
241
242 phi0tau IS_A factor;
243 phi0tau_expr: phi0tau =
244 n0[2] + n0[3]/tau
245 + SUM[ n0[i]*gamma0[i]*(1/(1-exp(-tau*gamma0[i])) - 1) | i IN [range_01] ];
246
247 phi0deltatau IS_A real_constant;
248 phi0deltatau :== 0.0;
249
250 phi0tautau IS_A factor;
251 phi0tautau_expr: phi0tautau
252 = -n0[3]/(tau*tau)
253 - SUM [ n0[i] * gamma0[i]^2 * exp(-tau*gamma0[i]) / ( 1 - exp(-tau*gamma0[i]) )^2 | i IN range_01 ];
254
255 (*----------- 'REAL' PARTS -- CLOSE YOUR EYES -----------*)
256
257 d1 IS_A factor;
258 d1_expr: d1 = delta - 1;
259
260 t1 IS_A factor;
261 t1_expr: t1 = tau -1;
262
263 r3_b1[range_r3] IS_A factor;
264 FOR i IN range_r3 CREATE
265 r3_b1[i] = -alpha[i]*d1^2 - beta[i]* (tau - gamma[i])^2;
266 END FOR;
267
268 PSI[range_r4] IS_A factor;
269 theta[range_r4] IS_A factor;
270 DELTA[range_r4] IS_A factor;
271 dDELTA_ddelta[range_r4] IS_A factor;
272 dPSI_ddelta[range_r4] IS_A factor;
273 dDELTAbi_ddelta[range_r4] IS_A factor;
274 dDELTAbi_dtau[range_r4] IS_A factor;
275 dPSI_dtau[range_r4] IS_A factor;
276 d2DELTA_ddelta2[range_r4] IS_A factor;
277 d2DELTAbi_ddelta2[range_r4] IS_A factor;
278 d2PSI_ddelta2[range_r4] IS_A factor;
279 d2DELTAbi_dtau2[range_r4] IS_A factor;
280 d2PSI_dtau2[range_r4] IS_A factor;
281 d2PSI_ddeltadtau[range_r4] IS_A factor;
282 d2DELTAbi_ddeltadtau[range_r4] IS_A factor;
283
284 FOR i IN range_r4 CREATE
285 PSI[i] = exp(-C[i]*d1^2 - D[i]*t1^2);
286 (*theta_expr:*) theta[i] = 1 - tau + A[i] * (d1^2)^( 1/(2 * beta_r4[i]) );
287 (*DELTA_expr:*) DELTA[i] = theta[i]^2 + B[i] * (d1^2)^a[i];
288
289 (*dDELTA_ddelta_expr:*) dDELTA_ddelta[i] = d1*(A[i]*theta[i]*2/beta_r4[i]*
290 (d1^2)^(1/(2*beta_r4[i]) - 1) + 2*B[i]*a[i]*
291 (d1^2)^(a[i] - 1) );
292
293 (*dPSI_ddelta_expr:*) dPSI_ddelta[i] = -2*C[i]*d1*PSI[i];
294
295 (*dDELTAbi_ddelta_expr:*) dDELTAbi_ddelta[i] = b[i] * DELTA[i]^(b[i]-1) * dDELTA_ddelta[i];
296
297 (*dDELTAbi_dtau_expr:*) dDELTAbi_dtau[i] = -2 * theta[i] * b[i] * DELTA[i]^(b[i]-1);
298 (*dPSI_dtau_expr:*) dPSI_dtau[i] = -2 * D[i] * t1 * PSI[i];
299
300 (*d2PSI_ddelta2_expr:*) d2PSI_ddelta2[i] = (2 * C[i] * d1^2 - 1) * 2 * C[i] * PSI[i];
301
302 (*d2DELTA_ddelta2_expr:*) d2DELTA_ddelta2[i] = 1/d1*dDELTA_ddelta[i] + d1^2*(4*B[i]*a[i]*
303 (a[i]-1)*(d1^2)^(a[i]-2) + 2*A[i]^2*
304 (1/(beta_r4[i]^2))*((d1^2) ^ (1/(2*beta_r4[i])-1))^2) +
305 A[i]*theta[i]*4/beta_r4[i]*(1/(2*beta_r4[i]) - 1)*
306 (d1^2)^(1/(2*beta_r4[i]) - 2);
307
308 (*d2DELTAbi_ddelta2_expr:*) d2DELTAbi_ddelta2[i] =b[i]*(DELTA[i]^(b[i]-1) *
309 d2DELTA_ddelta2[i] + (b[i]-1)*DELTA[i]^(b[i]-2)*
310 dDELTA_ddelta[i]^2);
311
312 (*d2DELTAbi_dtau2_expr:*) d2DELTAbi_dtau2[i] = 2*b[i] * DELTA[i]^(b[i]-1) +
313 4*theta[i]^2 * b[i]*(b[i]-1) * DELTA[i]^(b[i]-2);
314
315 (*d2PSI_dtau2_expr:*) d2PSI_dtau2[i] = (2 * D[i] * t1^2 - 1) * 2 * D[i] * PSI[i];
316
317 (*d2PSI_ddeltadtau_expr:*) d2PSI_ddeltadtau[i] = 4 * C[i] * D[i] * d1 * t1 * PSI[i];
318
319 (*d2DELTAbi_ddeltadtau_expr:*) d2DELTAbi_ddeltadtau[i] = -A[i] * b[i]*2/beta_r4[i] *
320 DELTA[i]^(b[i]-1) * d1 * (d1^2)^(1/(2*beta_r4[i])-1) -
321 2 * theta[i] * b[i] *(b[i]-1) * DELTA[i]^(b[i]-2) *
322 dDELTA_ddelta[i];
323
324 END FOR;
325
326 phir_r2[range_r2] IS_A factor;
327 FOR i IN range_r2 CREATE
328 phir_r2[i] = n[i] * delta^d[i] * tau^t[i] *
329 exp(-delta^c[i]);
330 END FOR;
331
332 phir IS_A factor;
333 phir_expr: phir
334 =
335 SUM[ n[i] * delta^d[i] * tau^t[i] | i IN [range_r1] ]
336 + SUM[ phir_r2[i] | i IN [range_r2] ]
337 + SUM[ n[i] * delta^d[i] * tau^t[i] * exp(
338 -alpha[i]*d1^2 - beta[i]*
339 (tau - gamma[i])*(tau - gamma[i])
340 ) | i IN [range_r3] ]
341 + SUM[ n[i] * DELTA[i]^b[i] * delta * PSI[i] | i IN [range_r4] ];
342
343
344 phirdelta_r2[range_r2] IS_A factor;
345 FOR i IN range_r2 CREATE
346 phirdelta_r2[i] = n[i] * exp(-delta^c[i]) * (delta^(d[i]-1) *
347 tau^t[i] * (d[i] - c[i] * delta^c[i]) );
348 END FOR;
349
350 phirdelta IS_A factor;
351 phirdelta_expr: phirdelta =
352 SUM[ n[i] * d[i] * delta^(d[i] - 1) * tau^t[i] | i IN range_r1 ]
353 + SUM[ phirdelta_r2[i] | i IN range_r2 ]
354 + SUM[ n[i]*delta^d[i] * tau^t[i] * exp( r3_b1[i] ) *
355 (d[i]/delta - 2*alpha[i]*d1) | i IN range_r3 ]
356 + SUM[ n[i] * (
357 DELTA[i]^b[i] * (PSI[i] + delta * dPSI_ddelta[i] )
358 + dDELTAbi_ddelta[i] * delta * PSI[i] ) | i IN range_r4 ];
359
360 phirtau_r2[range_r2] IS_A factor;
361 FOR i IN range_r2 CREATE
362 phirtau_r2[i] = n[i]*t[i]*delta^d[i]*tau^(t[i]-1) * exp(-delta^c[i]);
363 END FOR;
364
365 phirtau IS_A factor;
366 phirtau_expr: phirtau =
367 SUM[ n[i] * t[i] * delta^d[i] * tau^(t[i]-1) | i IN range_r1 ]
368 + SUM[ phirtau_r2[i] | i IN range_r2 ]
369 + SUM[ n[i] * delta^d[i] * tau^t[i] * exp( r3_b1[i] )*
370 (t[i]/tau - 2*beta[i]*(tau - gamma[i])) | i IN range_r3 ]
371 + SUM[ n[i]*delta*(dDELTAbi_dtau[i] * PSI[i] +
372 DELTA[i]^b[i]*dPSI_dtau[i]) | i IN range_r4 ];
373
374
375 phirdeltadelta_r1[range_r1] IS_A factor;
376 FOR i IN range_r1 CREATE
377 phirdeltadelta_r1[i] =
378 n[i] * d[i] * (d[i] - 1) * delta^(d[i]-2) * tau^t[i];
379 END FOR;
380
381 phirdeltadelta_r2[range_r2] IS_A factor;
382 FOR i IN range_r2 CREATE
383 phirdeltadelta_r2[i] =
384 n[i] * exp(-delta^c[i]) * (
385 delta^(d[i]-2) *
386 tau^t[i] * (
387 ( d[i] - c[i]*delta^c[i] )*(d[i]- 1 - c[i] * delta^c[i] )
388 - c[i]^2 * delta^c[i]
389 )
390 );
391 END FOR;
392
393 phirdeltadelta_r3[range_r3] IS_A factor;
394 FOR i IN range_r3 CREATE
395 phirdeltadelta_r3[i] =
396 n[i]*(tau^t[i])*exp( r3_b1[i] )*
397 (-2*alpha[i]*(delta^d[i]) +
398 4*alpha[i]*alpha[i]*(delta^d[i])*d1^2 -
399 4*d[i]*alpha[i]*(delta^(d[i]-1))*d1 +
400 d[i]*(d[i]-1)*(delta^(d[i]-1)));
401 END FOR;
402
403 phirdeltadelta_r4[range_r4] IS_A factor;
404 FOR i IN range_r4 CREATE
405 phirdeltadelta_r4[i] =
406 n[i]*(
407 DELTA[i]^b[i] * (2*dPSI_ddelta[i] + delta*d2PSI_ddelta2[i] )
408 + 2*dDELTAbi_ddelta[i] * (PSI[i] + delta*dPSI_ddelta[i])
409 + d2DELTAbi_ddelta2[i] * delta * PSI[i] );
410 END FOR;
411
412 phirdeltadelta IS_A factor;
413 phirdeltadelta_expr: phirdeltadelta =
414 SUM[ phirdeltadelta_r1[i] | i IN range_r1 ]
415 + SUM [phirdeltadelta_r2[i] | i IN range_r2 ]
416 + SUM [phirdeltadelta_r3[i] | i IN range_r3 ]
417 + SUM [phirdeltadelta_r4[i] | i IN range_r4 ];
418
419 phirtautau_r2[range_r2] IS_A factor;
420 FOR i IN range_r2 CREATE
421 phirtautau_r2[i] = n[i]*t[i]*(t[i]-1)* delta^d[i] *
422 tau^(t[i]-2) * exp(- delta^c[i] );
423 END FOR;
424
425 phirtautau IS_A factor;
426 phirtautau_expr: phirtautau =
427 SUM[ n[i] * t[i] * (t[i]-1) * delta^d[i] *
428 tau^(t[i]-2) | i IN range_r1 ]
429 + SUM[ phirtautau_r2[i] | i IN range_r2 ]
430 + SUM[ n[i] * delta^d[i] * tau^t[i] * exp( r3_b1[i] ) *
431 ( (t[i]/tau - 2*beta[i]* (tau - gamma[i]) )^2 -
432 t[i]/tau^2 - 2*beta[i] ) | i IN range_r3 ]
433 + SUM[ n[i] * delta * (d2DELTAbi_dtau2[i] * PSI[i] +
434 2 * dDELTAbi_dtau[i] * dPSI_dtau[i]
435 + DELTA[i]^b[i] * d2PSI_dtau2[i] ) | i IN range_r4 ];
436
437
438 phirdeltatau_r2[range_r2] IS_A factor;
439 FOR i IN range_r2 CREATE
440 phirdeltatau_r2[i] =
441 n[i]*t[i] * delta^(d[i]-1) * tau^(t[i]-1)
442 * (d[i] - c[i] * delta^c[i] * exp(-delta^c[i]) );
443 END FOR;
444
445 phirdeltatau IS_A factor;
446 phirdeltatau_expr: phirdeltatau =
447 SUM[ n[i]*d[i]*t[i] * delta^(d[i]-1) * tau^(t[i]-1) | i IN range_r1 ]
448
449 + SUM[ phirdeltatau_r2[i] | i IN range_r2 ]
450 + SUM[ n[i] * delta^d[i] * tau^t[i] * exp( r3_b1[i] ) *
451 (d[i]/delta - 2*alpha[i]*d1)
452 * (t[i]/tau - 2*beta[i]* (tau - gamma[i]) ) | i IN range_r3 ]
453 + SUM[ n[i]*( DELTA[i]^b[i] * (dPSI_dtau[i] + delta *
454 d2PSI_ddeltadtau[i] ) + delta * dDELTAbi_ddelta[i] * dPSI_dtau[i] +
455 dDELTAbi_dtau[i] * (PSI[i] + delta * dPSI_ddelta[i] ) +
456 d2DELTAbi_ddeltadtau[i] * delta * PSI[i] ) | i IN range_r4 ];
457
458 (*--------- THERMO PROPERTY RELATIONS ----------- *)
459
460 p IS_A pressure;
461 u IS_A specific_energy;
462 h IS_A specific_enthalpy;
463 s IS_A specific_entropy;
464 cp IS_A specific_heat_capacity;
465 cv IS_A specific_heat_capacity;
466 w IS_A speed;
467
468 pressure: p
469 = rho * R * T * (1 + delta*phirdelta);
470
471 internal_energy: u
472 = R * T * tau * (phi0tau + phirtau);
473
474 enthalpy: h
475 = R * T * (1 + tau*(phi0tau + phirtau) + delta*phirdelta);
476
477 entropy: s
478 = R * (tau*(phi0tau + phirtau) - phi0 - phir);
479
480 c_isochoric: cv
481 = - R * tau^2 * (phi0tautau + phirtautau);
482
483 c_isobaric: cp
484 = - R * tau^2 * (phi0tautau + phirtautau) +
485 ( 1 + delta*phirdelta - delta*tau*phirdeltatau )^2
486 / ( 1 + 2*delta*phirdelta + delta*delta*phirdeltadelta );
487
488 spd_sound: w
489 = sqrt(R * T * ( 1 + 2*delta*phirdelta + delta^2 * phirdeltadelta -
490 ( 1 + delta*phirdelta - delta*tau*phirdeltatau )^2
491 / ( tau^2 * (phi0tautau + phirtautau) )
492 ));
493
494
495 METHODS
496 METHOD default_self;
497 RUN ClearAll;
498 RUN specify;
499 RUN values;
500 END default_self;
501
502 METHOD specify;
503 T.fixed := TRUE;
504 rho.fixed := TRUE;
505 END specify;
506
507 METHOD values;
508 T := 290 {K};
509 rho := 999 {kg/m^3};
510 END values;
511
512 END steam_state;

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