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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1123 - (show annotations) (download) (as text)
Fri Jan 12 12:17:37 2007 UTC (13 years, 7 months ago) by johnpye
File MIME type: text/x-ascend
File size: 6780 byte(s)
Removed some unattached vars from dsgsat2.a4c
Rearranged hf_expr in iapwssatprops.
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, MA 02110-1301, 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 release:
24 'Revised Supplementary Release on Saturation Properties of Ordinary Water Substance'
25 from the International Association for the Properties of Water and Steam,
26 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 correlations;
30 the only implement properties inside the saturation region, using relatively
31 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 mu_f, mu_g IS_A viscosity;
38 rho_f, rho_g IS_A mass_density;
39 u_f, u_g IS_A specific_energy;
40
41 alpha IS_A specific_energy;
42
43 p_c IS_A pressure_constant;
44 p_c :== 22.064 {MPa};
45 T_c IS_A temperature_constant;
46 T_c :== 647.096 {K};
47 alpha_0 IS_A real_constant;
48 alpha_0 :== 1000 {J/kg};
49 rho_c IS_A real_constant;
50 rho_c :== 322 {kg/m^3};
51
52 tau IS_A fraction;
53 tau_expr: tau = 1 - theta;
54 theta IS_A fraction;
55 theta_expr: theta = T / T_c;
56
57 uf_expr: u_f = h_f - p/rho_f;
58 ug_expr: u_g = h_g - p/rho_g;
59
60 a[1..6] IS_A real_constant;
61 a[1] :== -7.85951783;
62 a[2] :== 1.84408259;
63 a[3] :== -11.7866497;
64 a[4] :== 22.6807411;
65 a[5] :== -15.9618719;
66 a[6] :== 1.80122502;
67
68 n[1..6] IS_A real_constant;
69 n[1] :== 1;
70 n[2] :== 1.5;
71 n[3] :== 3;
72 n[4] :== 3.5;
73 n[5] :== 4;
74 n[6] :== 7.5;
75
76 ln(p / p_c) = T_c/T * SUM[a[i]*tau^n[i] | i IN [1..6]];
77
78 dp_dT IS_A pressure_per_temperature;
79 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]];
80
81 b[1..6] IS_A real_constant;
82 b[1] :== 1.99274064;
83 b[2] :== 1.09965342;
84 b[3] :== -0.510839303;
85 b[4] :== -1.75493479;
86 b[5] :== -45.5170352;
87 b[6] :== -6.74694450e5;
88
89 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);
90
91 c[1..6] IS_A real_constant;
92 c[1] :== -2.03150240;
93 c[2] :== -2.68302940;
94 c[3] :== -5.38626492;
95 c[4] :== -17.2991605;
96 c[5] :== -44.7586581;
97 c[6] :== -63.9201063;
98
99 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) );
100
101 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;
102
103 d[1..5] IS_A real_constant;
104 d[1] :== -5.65134998e-8;
105 d[2] :== 2690.66631;
106 d[3] :== 127.287297;
107 d[4] :== -135.003439;
108 d[5] :== 0.981825814;
109 d_alpha IS_A real_constant;
110 d_alpha :== -1135.905627715;
111
112 hf_expr: h_f - alpha = T / rho_f * dp_dT;
113 hg_expr: h_g - alpha = T / rho_g * dp_dT;
114
115 d_phi IS_A real_constant;
116 d_phi :== 2319.5246;
117
118 phi_0 IS_A real_constant;
119 phi_0 :== 1000 {J/kg} / 647.096 {K};
120
121 phi IS_A specific_entropy;
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 s_f, s_g IS_A specific_entropy;
125 sf_expr: s_f = phi + 1/rho_f * dp_dT;
126 sg_expr: s_g = phi + 1/rho_g * dp_dT;
127 METHODS
128 METHOD on_load;
129 RUN default_self;
130 RUN reset; RUN values; RUN bound_self;
131 END on_load;
132 METHOD default_self;
133 h_f := 1500 {kJ/kg};
134 h_g := 3100 {kJ/kg};
135 u_f := 2000 {kJ/kg};
136 u_g := 4000 {kJ/kg};
137 s_f := 5 {kJ/kg/K};
138 s_g := 7 {kJ/kg/K};
139 mu_f := 2e-5 {Pa*s};
140 mu_g := 1e-7 {Pa*s};
141 rho_f := 900 {kg/m^3};
142 rho_g := 1 {kg/m^3};
143 END default_self;
144 METHOD specify;
145 FIX T;
146 END specify;
147 METHOD bound_self;
148 u_f.lower_bound := -1e50 {J/kg};
149 u_g.lower_bound := -1e50 {J/kg};
150 phi.lower_bound := -0.045 {J/kg/K};
151 alpha.lower_bound := -11.54 {J/kg};
152 s_f.lower_bound := -5e-5 {J/kg/K};
153 END bound_self;
154 METHOD values;
155 T := 300 {K};
156 u_g := 3000 {kJ/kg}; (* just a starting guess *)
157 END values;
158 END iapwssatprops;
159
160 (*
161 The following test cases implement the three test points provided in
162 the IAPWS supsat.pdf release.
163 *)
164
165 MODEL testiapwssatprops1 REFINES iapwssatprops;
166 METHODS
167 METHOD values;
168 T := 273.16 {K};
169
170 u_g := 4000 {kJ/kg}; (* starting guess *)
171 END values;
172 METHOD self_test;
173 ASSERT abs(p - 611.657 {Pa}) < 0.001 {Pa};
174 ASSERT abs(dp_dT - 44.436693 {Pa/K}) < 0.0005e3 {Pa/K};
175 ASSERT abs(rho_f - 999.789 {kg/m^3}) < 0.0005 {kg/m^3};
176 ASSERT abs(rho_g - 0.00485426 {kg/m^3}) < 0.0000005 {kg/m^3};
177 ASSERT abs(alpha - -11.529101 {J/kg}) < 0.005e3 {J/kg};
178 ASSERT abs(h_f - 0.611786 {J/kg}) < 0.005e3 {J/kg};
179 ASSERT abs(h_g - 2500.5e3 {J/kg}) < 0.05e3 {J/kg};
180 ASSERT abs(phi - -0.04 {J/kg/K}) < 0.0005e3 {J/kg/K};
181 ASSERT abs(s_f - 0 {J/kg/K}) < 0.0005e3 {J/kg/K};
182 ASSERT abs(s_g - 9.154e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
183 END self_test;
184 END testiapwssatprops1;
185
186 MODEL testiapwssatprops2 REFINES iapwssatprops;
187 METHODS
188 METHOD values;
189 T := 373.1243 {K};
190 u_g := 4000 {kJ/kg};
191 END values;
192 METHOD self_test;
193 ASSERT abs(p - 101.325 {kPa}) < 1 {Pa};
194 ASSERT abs(dp_dT - 3.616e3 {Pa/K}) < 0.0005e3 {Pa/K};
195 ASSERT abs(rho_f - 958.365 {kg/m^3}) < 0.0005 {kg/m^3};
196 ASSERT abs(rho_g - 0.597586 {kg/m^3}) < 0.0000005 {kg/m^3};
197 ASSERT abs(alpha - 417.65e3 {J/kg}) < 0.005e3 {J/kg};
198 ASSERT abs(h_f - 419.05e3 {J/kg}) < 0.005e3 {J/kg};
199 ASSERT abs(h_g - 2675.7e3 {J/kg}) < 0.05e3 {J/kg};
200 ASSERT abs(phi - 1.303e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
201 ASSERT abs(s_f - 1.307e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
202 ASSERT abs(s_g - 7.355e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
203 END self_test;
204 END testiapwssatprops2;
205
206 MODEL testiapwssatprops3 REFINES iapwssatprops;
207 METHODS
208 METHOD values;
209 T := 647.096 {K};
210 rho_f := 322 {kg/m^3};
211 END values;
212 METHOD self_test;
213 ASSERT abs(p - 22.064 {MPa}) < 1 {kPa};
214 ASSERT abs(dp_dT - 268e3 {Pa/K}) < 0.1e3 {Pa/K};
215 ASSERT abs(rho_g - 322 {kg/m^3}) < 0.001 {kg/m^3};
216 ASSERT abs(alpha - 1548e3 {J/kg}) < 0.5e3 {J/kg};
217 ASSERT abs(h_f - 2086.6e3 {J/kg}) < 0.05e3 {J/kg};
218 ASSERT abs(h_g - 2086.6e3 {J/kg}) < 0.05e3 {J/kg};
219 ASSERT abs(phi - 3.578e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
220 ASSERT abs(s_f - 4.410e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
221 ASSERT abs(s_g - 4.410e3 {J/kg/K}) < 0.0005e3 {J/kg/K};
222 END self_test;
223 END testiapwssatprops3;

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