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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1695 - (show annotations) (download) (as text)
Wed Dec 26 08:23:08 2007 UTC (12 years, 6 months ago) by jpye
File MIME type: text/x-ascend
File size: 9682 byte(s)
Fixed up some debug output and lint, formatting.
tubebank model currently causes crash as noted in bug #350.
1 (*
2 ASCEND model library: tube-bank view factor model
3 Copyright (C) John Pye 2007
4 http://pye.dyndns.org/
5
6 This program is free software; you can redistribute it
7 and/or modify it under the terms of the GNU General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later
10 version.
11
12 This program is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied
14 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the GNU General Public License for more
16 details.
17
18 You should have received a copy of the GNU General Public
19 License along with this program; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place, Suite 330,
21 Boston, MA 02111-1307 USA
22 -------------------------------------------------------------------
23
24 View factor calculation from a bank of tubes
25 to an opposing flat surface. This case is of
26 interest in solar collector design.
27
28 F
29 ___ _._ ___
30 .˙˙ ˙˙. .˙˙ : ˙˙.G .˙˙ ˙˙.
31 : E : : : C:. : D :
32 | ´ | | C ^ E| .| ´ |·········
33 '. .' B'. : .'; '.H .' ^
34 '-----' .'--:--'. . '-----' :
35 . : . ` I˙ . : h
36 . : . ˙ ˙ . :
37 .:. . ˙ . :
38 ------------------+------+----------+----+-+->
39 O A X J x
40 (x1) (x2)
41
42 (ASCII art above uses UTF-8 encoding)
43
44 The view factor from the entire surface of cylinder
45 'C' to the plane slice from A to J is calculated and
46 returned as 'F' by this model.
47
48 The distance OC is given by the variable 'h'.
49 The distance OA is given by the variable 'x1'.
50 The distance OJ is given by the variable 'x2'.
51 The radius of the cylinders is given by 'r'.
52 The spacing of the cylinders (centre-to-centre) is 2*s.
53
54 At the point X there is a region boundary. To the
55 right of X, some beams from the cylinder C are
56 occluded by the cylinder D. For this reason, the model
57 currently requires the conditional solver CMSlv.
58
59 The calculation method uses Hottel's crossed string rule
60 to determine the view factor.
61 *)
62
63 REQUIRE "atoms.a4l";
64
65 (*
66 Calculates the angle (relative to the top of the
67 circle) at which a tangent strikes a circle, given the position
68 of the point (x,-h) and the radius of the circle (r).
69 *)
70 MODEL wrapping_angle(
71 x WILL_BE delta_distance;
72 h WILL_BE distance;
73 r WILL_BE distance;
74 theta WILL_BE angle;
75 );
76 theta = arccos((x*sqrt(h^2 + x^2 - r^2) - h*r) / (x^2 + h^2));
77 END wrapping_angle;
78
79 (*
80 Calculate the length L of a piece of string from the top
81 of a circle, of radius r, stretched around the circle to a
82 point (x,-h) located below the circle and to one side.
83
84 This will be used in the Hottel 'crossed string' method to
85 calculate view factors from a tube bank to a plane wall.
86 *)
87 MODEL wrapping_length(
88 x WILL_BE delta_distance;
89 h WILL_BE distance;
90 r WILL_BE distance;
91 L WILL_BE distance; (* resulting length (output) *)
92 );
93 theta IS_A angle;
94 wrap_ang IS_A wrapping_angle(x,h,r,theta);
95
96 L_tan, L_arc IS_A distance;
97 L_tan = sqrt(h^2 + x^2 - r^2);
98 L_arc = r*theta;
99 L = L_tan + L_arc;
100 END wrapping_length;
101
102 (*
103 Calculate the length L of a piece of string from the
104 top of a circle (at 0,0, with radius r) stretched to a
105 remote point (x,-h) for the case where the string is
106 partly obstructed by another circle adjacent to the first
107 one. The obstructing circle is located at (2s,0) and has
108 the same radius r.
109 *)
110 MODEL wrapping_length_obstructed(
111 x WILL_BE delta_distance;
112 h WILL_BE distance;
113 r WILL_BE distance;
114 s WILL_BE distance;
115 L WILL_BE distance; (* resulting length (output) *)
116 );
117 phi IS_A angle;
118 phi = arcsin(r/s);
119
120 L_arc, L_span, L_tan IS_A distance;
121 L_arc = r*phi;
122 L_span = 2*sqrt(s^2-r^2);
123
124 x1 IS_A delta_distance;
125 -x1 = (x - 2*s);
126 psi IS_A angle;
127 wrap IS_A wrapping_angle(x1,h,r,psi);
128
129 L_hug IS_A delta_distance;
130 L_hug = r*(psi - (1{PI} - phi));
131
132 L_tan = sqrt(h^2 + x1^2 - r^2);
133
134 L = L_arc + L_span + L_hug + L_tan;
135
136 END wrapping_length_obstructed;
137
138 (*
139 Conditional model, to calculate the length of a string
140 as for wrapping_length_obstructed and wrapping_length
141 for remote points (x,-h) where it is not yet known
142 whether or not the string is obstructed by an adjacent
143 circle. The distance x_crit is calculated, then depending
144 on its value, the appropriate wrapping length formula
145 is used. The equations are condensed from the above
146 models into fewer (but more complex) equations, to help
147 with model convergence.
148 *)
149 MODEL wrapping_length_ambi(
150 x WILL_BE delta_distance;
151 h WILL_BE distance;
152 r WILL_BE distance;
153 s WILL_BE distance;
154 L WILL_BE distance; (* resulting length (output) *)
155 );
156 x_crit IS_A distance;
157 x_crit = s + h*sqrt(s^2-r^2)/r;
158
159 (* obstructed case *)
160 phi IS_A angle;
161 phi = arcsin(r/s);
162
163 x1 IS_A delta_distance;
164 -x1 = (x - 2*s);
165
166 psi IS_A angle;
167 wrap IS_A wrapping_angle(x1,h,r,psi);
168
169 L_span IS_A distance;
170 L_span = 2*sqrt(s^2-r^2);
171 L_hug IS_A delta_distance;
172 L_hug = r*(psi - (1{PI} - phi));
173
174 L_expr_obstructed: L = r*phi + L_span + L_hug + sqrt(h^2 + x1^2 - r^2);
175
176 (* unobstructed case *)
177 theta IS_A angle;
178 wrap_clear IS_A wrapping_angle(x,h,r,theta);
179
180 L_expr_clear: L = r*theta + sqrt(h^2 + x^2 - r^2);
181
182 CONDITIONAL
183 obstructed_expr: abs(x) > x_crit;
184 END CONDITIONAL;
185 is_obstructed IS_A boolean_var;
186 is_obstructed == SATISFIED(obstructed_expr, 1e-3{m});
187 WHEN(is_obstructed)
188 CASE TRUE:
189 USE L_expr_obstructed;
190 CASE FALSE:
191 USE L_expr_clear;
192 END WHEN;
193
194 END wrapping_length_ambi;
195
196 MODEL vfac_empty;
197 (* nothing here, just a placeholder for refinement *)
198 END vfac_empty;
199
200 (*
201 View factor from a circle C to a flat strip OA
202 placed below it (see diagram at top of file)
203 *)
204 MODEL vfac_circle_plane(
205 x WILL_BE delta_distance;
206 h WILL_BE distance;
207 r WILL_BE distance;
208 F WILL_BE fraction; (* output *)
209 ) REFINES vfac_empty;
210 xzero IS_A delta_distance;
211 xzero = 0;
212 OBF, OECF, ADBF, ACF IS_A distance;
213 OBF_wrap IS_A wrapping_length(xzero,h,r,OBF);
214 OECF,OBF ARE_THE_SAME;
215 xneg IS_A delta_distance;
216 xneg = -x;
217 ADBF_wrap IS_A wrapping_length(xneg,h,r,ADBF);
218 ACF_wrap IS_A wrapping_length(x,h,r,ACF);
219
220 F = ((ADBF + OECF) - (OBF + ACF)) / (4{PI}*r);
221 END vfac_circle_plane;
222
223 (*
224 View factor from a circle C to a flat strip OA
225 placed below it, for the case where the view is
226 obstructed by adjacent circle D (see diagram at top
227 of file).
228 *)
229 MODEL vfac_circle_plane_obstructed(
230 x WILL_BE delta_distance;
231 h WILL_BE distance;
232 r WILL_BE distance;
233 s WILL_BE distance;
234 F WILL_BE fraction; (* output *)
235 ) REFINES vfac_empty;
236 xzero IS_A delta_distance;
237 xzero = 0;
238 OBF, OEGF, JKBF, JIHGF IS_A distance;
239 OBF_wrap IS_A wrapping_length(xzero,h,r,OBF);
240 OEGF,OBF ARE_THE_SAME;
241 xneg IS_A delta_distance;
242 xneg = -x;
243 JKBF_wrap IS_A wrapping_length(xneg,h,r,JKBF);
244 JIHGF_wrap IS_A wrapping_length_obstructed(x,h,r,s,JIHGF);
245
246 F = ((JKBF + OEGF) - (OBF + JIHGF)) / (4{PI}*r);
247 END vfac_circle_plane_obstructed;
248
249 (*
250 Conditional model that calculates the view factor
251 from a circle C to a flat string OA placed below it,
252 for the case where it may or may not be obstructed by
253 a neighbouring circle D.
254 *)
255 MODEL vfac_circle_plane_ambi(
256 x WILL_BE delta_distance;
257 h WILL_BE distance;
258 r WILL_BE distance;
259 s WILL_BE distance;
260 F WILL_BE fraction; (* output *)
261 ) REFINES vfac_empty;
262 xzero IS_A delta_distance;
263 xzero = 0;
264 OBF, OEGF, JKBF, JIHGF IS_A distance;
265 OBF_wrap IS_A wrapping_length(xzero,h,r,OBF);
266 OEGF,OBF ARE_THE_SAME;
267 xneg IS_A delta_distance;
268 xneg = -x;
269 JKBF_wrap IS_A wrapping_length(xneg,h,r,JKBF);
270 JIHGF_wrap IS_A wrapping_length_ambi(x,h,r,s,JIHGF);
271
272 F = ((JKBF + OEGF) - (OBF + JIHGF)) / (4{PI}*r);
273 END vfac_circle_plane_ambi;
274
275 (*
276 Model of a tube bank (many tubes) facing opposite a
277 flat surface. Model serves only to calculate the view
278 factors, which will then be used elsewhere.
279 *)
280 MODEL tubebank;
281 W IS_A distance;
282 D IS_A distance;
283 theta IS_A angle;
284
285 B, N IS_A distance;
286 N*sin(theta)=D;
287 N*cos(theta)*2 = B - W;
288
289 h IS_A distance;
290 r IS_A distance;
291 L IS_A distance;
292 s IS_A distance;
293
294 h = D - s; (* assume that tubes are spaced down from the top wall slightly *)
295
296 n IS_A integer_constant;
297 n :== 2; (* in the half-cavity *)
298
299 2*s = (W/2) / n;
300
301 nb IS_A integer_constant;
302 nb :== 2; (* in the half-cavity *)
303
304 (*
305 Calculate view factors:
306
307 F_cum is from a tube to a plate from 0 to x[j].
308 F is from x[j-1] to x[j]
309 In both cases, j=[1..nb].
310 *)
311 F_cum[1..n][-nb..nb] IS_A fraction;
312 F[1..n][-nb..-1,1..nb] IS_A fraction;
313
314 x_base[-nb..nb] IS_A delta_distance;
315 FOR j IN [-nb..nb] CREATE
316 x_base[j] = j/nb * (B/2);
317 END FOR;
318
319 x_tube[1..n] IS_A delta_distance;
320 FOR i IN [1..n] CREATE
321 x_tube[i] = (2*i-1)*s;
322 END FOR;
323
324 x[1..n][-nb..nb] IS_A delta_distance;
325
326 vfac[1..n][-nb..nb] IS_A vfac_empty;
327 FOR i IN [1..n] CREATE
328 x[i][0] = x_base[j] - x_tube[i];
329 vfac[i][0] IS_REFINED_TO vfac_circle_plane_ambi(x[i][0],h,r,s,F[i][0]);
330 FOR j IN [1..nb] CREATE
331 x[i][j] = x_base[j] - x_tube[i];
332 x[i][-j] = x_base[j] + x_tube[i];
333 vfac[i][j] IS_REFINED_TO vfac_circle_plane_ambi(x[i][j],h,r,s,F[i][j]);
334 vfac[i][-j] IS_REFINED_TO vfac_circle_plane_ambi(x[i][-j],h,r,s,F[i][-j]);
335 END FOR;
336 END FOR;
337 FOR i IN [1..n] CREATE
338 FOR j IN [1..nb] CREATE
339 F[i][j] = F_cum[i][j] - F_cum[i][j-1];
340 F[i][-j] = F_cum[i][-j] - F_cum[i][-j+1];
341 END FOR;
342 END FOR;
343 METHODS
344 METHOD on_load;
345 FIX D,W,theta;
346 D := 200 {mm};
347 W := 575 {mm};
348 theta := 32 {deg};
349
350 FIX r;
351 r:= 42.164 {mm} / 2.;
352 END on_load;
353 END tubebank;

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