/[ascend]/trunk/models/steam/iapwssatprops.a4c
ViewVC logotype

Contents of /trunk/models/steam/iapwssatprops.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1274 - (show annotations) (download) (as text)
Sun Feb 4 04:59:57 2007 UTC (13 years, 5 months ago) by johnpye
File MIME type: text/x-ascend
File size: 7091 byte(s)
Fixed the 700->1000 problem, but testpeturbida still not working
1 (*
2 ASCEND modelling environment
3 Copyright (C) 2006 John Pye
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, USA.
18 *)
19 REQUIRE "atoms.a4l";
20 REQUIRE "johnpye/thermo_types.a4c";
21
22 (*
23 This model implements the complete set of equations from the IAPWS
24 release, 'Revised Supplementary Release on Saturation Properties of
25 Ordinary Water Substance' from the International Association for the
26 Properties of Water and Steam, St Petersburg, Russia, September 1992.
27 http://www.iapws.org/relguide/supsat.pdf
28
29 These equations are not compatible with the full IAPWS-IF97
30 correlations; they only implement properties inside the saturation
31 region, using relatively simple correlations.
32 *)
33 MODEL iapwssatprops;
34 T IS_A temperature;
35 p IS_A pressure;
36 h_f, h_g IS_A specific_enthalpy;
37 rho_f, rho_g IS_A mass_density;
38 u_f, u_g IS_A specific_energy;
39 s_f, s_g IS_A specific_entropy;
40 dp_dT IS_A pressure_per_temperature;
41 tau IS_A fraction;
42 theta IS_A fraction;
43 alpha IS_A specific_energy;
44 phi IS_A specific_entropy;
45
46 p_c IS_A pressure_constant;
47 p_c :== 22.064 {MPa};
48 T_c IS_A temperature_constant;
49 T_c :== 647.096 {K};
50 alpha_0 IS_A real_constant;
51 alpha_0 :== 1000 {J/kg};
52 rho_c IS_A real_constant;
53 rho_c :== 322 {kg/m^3};
54
55 tau_expr: tau = 1 - theta;
56 theta_expr: theta = T / T_c;
57
58 (* note: I tried to rearrange this without the '/' but it caused divergence in dsgsat2.a4c in configure_dynamic mode *)
59 uf_expr: u_f = h_f - p/rho_f;
60 ug_expr: u_g = h_g - p/rho_g;
61
62 a[1..6] IS_A real_constant;
63 a[1] :== -7.85951783;
64 a[2] :== 1.84408259;
65 a[3] :== -11.7866497;
66 a[4] :== 22.6807411;
67 a[5] :== -15.9618719;
68 a[6] :== 1.80122502;
69
70 n[1..6] IS_A real_constant;
71 n[1] :== 1;
72 n[2] :== 1.5;
73 n[3] :== 3;
74 n[4] :== 3.5;
75 n[5] :== 4;
76 n[6] :== 7.5;
77
78 ln(p / p_c) = T_c/T * SUM[a[i]*tau^n[i] | i IN [1..6]];
79
80 dpdT_expr: dp_dT = - p/T * T_c/T * SUM[a[i]*n[i]*tau^(n[i]-1) + a[i]*(1-n[i])*tau^n[i] | i IN [1..6]];
81
82 b[1..6] IS_A real_constant;
83 b[1] :== 1.99274064;
84 b[2] :== 1.09965342;
85 b[3] :== -0.510839303;
86 b[4] :== -1.75493479;
87 b[5] :== -45.5170352;
88 b[6] :== -6.74694450e5;
89
90 rhof_expr: rho_f / rho_c = 1 + b[1]*tau^(1/3) + b[2]*tau^(2/3) + b[3]*tau^(5/3) + b[4]*tau^(16/3) + b[5] * tau^(43/3) + b[6]*tau^(110/3);
91
92 c[1..6] IS_A real_constant;
93 c[1] :== -2.03150240;
94 c[2] :== -2.68302940;
95 c[3] :== -5.38626492;
96 c[4] :== -17.2991605;
97 c[5] :== -44.7586581;
98 c[6] :== -63.9201063;
99
100 rhog_expr: rho_g / rho_c = exp( c[1]*tau^(2/6) + c[2] * tau^(4/6) +c[3]*tau^(8/6) + c[4] *tau^(18/6) + c[5]*tau^(37/6) + c[6]*tau^(71/6) );
101
102 alpha_expr: alpha / alpha_0 = d_alpha + d[1]*theta^-19 +d[2]*theta + d[3]*theta^4.5 + d[4]*theta^5 + d[5]*theta^54.5;
103
104 d[1..5] IS_A real_constant;
105 d[1] :== -5.65134998e-8;
106 d[2] :== 2690.66631;
107 d[3] :== 127.287297;
108 d[4] :== -135.003439;
109 d[5] :== 0.981825814;
110 d_alpha IS_A real_constant;
111 d_alpha :== -1135.905627715;
112
113 hf_expr: h_f - alpha = T / rho_f * dp_dT;
114 hg_expr: h_g - alpha = T / rho_g * dp_dT;
115
116 d_phi IS_A real_constant;
117 d_phi :== 2319.5246;
118
119 phi_0 IS_A real_constant;
120 phi_0 :== 1000 {J/kg} / 647.096 {K};
121
122 phi_expr: phi / phi_0 = d_phi + 19/20*d[1]*theta^(-20) + d[2]*ln(theta) + 9/7*d[3]*theta^3.5 + 5/4*d[4]*theta^4 + 109/107*d[5]*theta^53.5;
123
124 sf_expr: s_f = phi + 1/rho_f * dp_dT;
125 sg_expr: s_g = phi + 1/rho_g * dp_dT;
126 METHODS
127 METHOD on_load;
128 RUN default_self;
129 RUN reset; RUN values; RUN bound_self;
130 END on_load;
131 METHOD default_self;
132 h_f := 800 {kJ/kg};
133 h_f.nominal := 700 {kJ/kg};
134 h_g := 2900 {kJ/kg};
135 h_g.nominal := 2600 {kJ/kg};
136 u_f := 700 {kJ/kg};
137 u_g := 2700 {kJ/kg};
138 dp_dT.nominal := 10 {kPa/K};
139 rho_f := 1000 {kg/m^3};
140 rho_f.nominal := 1000 {kg/m^3};
141 rho_g := 5 {kg/m^3};
142 rho_g.nominal := 10 {kg/m^3};
143
144 T := 298 {K};
145 p := 7 {bar};
146 dp_dT := 1 {Pa/K};
147
148 s_f := 6 {kJ/kg/K};
149 s_g := 6 {kJ/kg/K};
150 theta := 0.5;
151 tau := 0.5;
152 alpha := 1000 {kJ/kg};
153 phi := 6 {kJ/kg/K};
154 END default_self;
155 METHOD specify;
156 FIX T;
157 END specify;
158 METHOD bound_self;
159 u_f.lower_bound := -1e50 {J/kg};
160 u_g.lower_bound := -1e50 {J/kg};
161 phi.lower_bound := -0.045 {J/kg/K};
162 alpha.lower_bound := -11.54 {J/kg};
163 s_f.lower_bound := -5e-5 {J/kg/K};
164 END bound_self;
165 METHOD values;
166 T := 300 {K};
167 u_g := 3000 {kJ/kg}; (* just a starting guess *)
168 END values;
169 END iapwssatprops;
170
171 (*
172 The following test cases implement the three test points provided in
173 the IAPWS supsat.pdf release.
174 *)
175
176 MODEL testiapwssatprops1 REFINES iapwssatprops;
177 METHODS
178 METHOD values;
179 T := 273.16 {K};
180
181 u_g := 4000 {kJ/kg}; (* starting guess *)
182 END values;
183 METHOD self_test;
184 ASSERT abs(p - 611.657 {Pa}) < 0.001 {Pa};
185 ASSERT abs(dp_dT - 44.436693 {Pa/K}) < 0.0005e3 {Pa/K};
186 ASSERT abs(rho_f - 999.789 {kg/m^3}) < 0.0005 {kg/m^3};
187 ASSERT abs(rho_g - 0.00485426 {kg/m^3}) < 0.0000005 {kg/m^3};
188 ASSERT abs(alpha - -11.529101 {J/kg}) < 0.005e3 {J/kg};
189 ASSERT abs(h_f - 0.611786 {J/kg}) < 0.005e3 {J/kg};
190 ASSERT abs(h_g - 2500.5e3 {J/kg}) < 0.05e3 {J/kg};
191 ASSERT abs(phi - -0.04 {J/kg/K}) < 0.0005e3 {J/kg/K};
192 ASSERT abs(s_f - 0 {J/kg/K}) < 0.0005e3 {J/kg/K};
193 ASSERT abs(s_g - 9.154e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
194 END self_test;
195 END testiapwssatprops1;
196
197 MODEL testiapwssatprops2 REFINES iapwssatprops;
198 METHODS
199 METHOD values;
200 T := 373.1243 {K};
201 u_g := 4000 {kJ/kg};
202 END values;
203 METHOD self_test;
204 ASSERT abs(p - 101.325 {kPa}) < 1 {Pa};
205 ASSERT abs(dp_dT - 3.616e3 {Pa/K}) < 0.0005e3 {Pa/K};
206 ASSERT abs(rho_f - 958.365 {kg/m^3}) < 0.0005 {kg/m^3};
207 ASSERT abs(rho_g - 0.597586 {kg/m^3}) < 0.0000005 {kg/m^3};
208 ASSERT abs(alpha - 417.65e3 {J/kg}) < 0.005e3 {J/kg};
209 ASSERT abs(h_f - 419.05e3 {J/kg}) < 0.005e3 {J/kg};
210 ASSERT abs(h_g - 2675.7e3 {J/kg}) < 0.05e3 {J/kg};
211 ASSERT abs(phi - 1.303e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
212 ASSERT abs(s_f - 1.307e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
213 ASSERT abs(s_g - 7.355e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
214 END self_test;
215 END testiapwssatprops2;
216
217 MODEL testiapwssatprops3 REFINES iapwssatprops;
218 METHODS
219 METHOD values;
220 T := 647.096 {K};
221 rho_f := 322 {kg/m^3};
222 END values;
223 METHOD self_test;
224 ASSERT abs(p - 22.064 {MPa}) < 1 {kPa};
225 ASSERT abs(dp_dT - 268e3 {Pa/K}) < 0.1e3 {Pa/K};
226 ASSERT abs(rho_g - 322 {kg/m^3}) < 0.001 {kg/m^3};
227 ASSERT abs(alpha - 1548e3 {J/kg}) < 0.5e3 {J/kg};
228 ASSERT abs(h_f - 2086.6e3 {J/kg}) < 0.05e3 {J/kg};
229 ASSERT abs(h_g - 2086.6e3 {J/kg}) < 0.05e3 {J/kg};
230 ASSERT abs(phi - 3.578e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
231 ASSERT abs(s_f - 4.410e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
232 ASSERT abs(s_g - 4.410e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
233 END self_test;
234 END testiapwssatprops3;

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