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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1305 - (show annotations) (download) (as text)
Sat Mar 3 04:57:04 2007 UTC (12 years, 11 months ago) by johnpye
File MIME type: text/x-ascend
File size: 6974 byte(s)
Converted grid to constants, added some alias quantities
1 REQUIRE "ivpsystem.a4l";
2 REQUIRE "atoms.a4l";
3 REQUIRE "johnpye/thermo_types.a4c";
4
5 (*
6 An attempt to model direct steam generation in pipe flow, limited to the
7 saturated regime, and with constant-valued friction factor. External heat
8 loss is also simplified.
9 *)
10 REQUIRE "steam/satsteamstream.a4c";
11
12 MODEL dsgsat3;
13 n IS_A integer_constant;
14 n :== 7;
15
16 (* temporal derivatives *)
17 drho_dt[2..n] IS_A density_rate;
18 dG_dt[2..n] IS_A mass_rate_rate;
19 du_dt[2..n] IS_A specific_energy_rate;
20 dTw_dt[2..n] IS_A temperature_rate;
21
22 (* wall properties *)
23 rho_w IS_A mass_density;
24 D, D_2 IS_A distance;
25 c_w IS_A specific_heat_capacity;
26 A, A_w IS_A area;
27 h_int IS_A heat_transfer_coefficient; (* internal *)
28 h_ext IS_A heat_transfer_coefficient; (* external *)
29 z_A: A = 1{PI}*D^2/4;
30 z_Aw: A_w = 1{PI}*(D_2^2 - D^2)/4;
31 dz IS_A distance;
32 L IS_A distance;
33 z_dz: dz = L / (n - 1);
34
35 (* fluid properties *)
36 node[1..n] IS_A satsteamstream;
37
38 (* flow properties *)
39 T_w[2..n] IS_A temperature;
40 T[1..n] IS_A temperature;
41
42 (* constants, for the moment: *)
43 f IS_A positive_factor;
44 (* mu_f IS_A viscosity; *)
45 T_amb IS_A temperature;
46
47 (* system dynamics *)
48 qdot_t[2..n], qdot_l[2..n] IS_A power_per_length;
49 qdot_s IS_A power_per_length;
50
51 (* some aliases just for easier review of the state of the model *)
52 x[1..n] IS_A fraction;
53 G[1..n] IS_A mass_flux;
54 p[1..n] IS_A pressure;
55 FOR i IN [1..n] CREATE
56 x[i], node[i].x ARE_THE_SAME;
57 G[i] = node[i].mdot / A;
58 p[i], node[i].p ARE_THE_SAME;
59 T[i], node[i].T ARE_THE_SAME;
60 END FOR;
61
62 (* differential equations *)
63
64 (* use central difference for several derivatives *)
65 FOR i IN [2..n-1] CREATE
66 z_massbal[i]: drho_dt[i] * dz = - (G[i+1] - G[i-1]) / 2.0;
67
68 z_enbal[i]: dz * (qdot_t[i]/A - node[i].rho * du_dt[i]) =
69 + G[i] * (node[i].u - node[i-1].u)
70 + (node[i+1].p*node[i+1].v*G[i+1] - node[i-1].p*node[i-1].v*G[i-1]) / 2;
71
72 z_mombal[i]: - dz*dG_dt[i] =
73 (node[i+1].p-node[i-1].p) / 2.0
74 + dz * f/D/2 * G[i]^2 / node[i].rho
75 + (G[i+1]^2 / node[i+1].rho - G[i-1]^2 / node[i-1].rho) / 2.0;
76 END FOR;
77
78 (* the equations for the last node use backwards difference *)
79 FOR i IN [n] CREATE
80 z_massbal1[i]: drho_dt[i] * dz = - (G[i] - G[i-1]);
81
82 z_enbal1[i]: dz * (qdot_t[i]/A - node[i].rho * du_dt[i]) =
83 + G[i] * (node[i].u - node[i-1].u)
84 + (node[i].p*node[i].v*G[i] - node[i-1].p*node[i-1].v*G[i-1]);
85
86 z_mombal1[i]: - dz*dG_dt[i] =
87 (node[i].p-node[i-1].p)
88 + dz * f/D/2 * G[i]^2 / node[i].rho
89 + (G[i]^2 / node[i].rho - G[i-1]^2 / node[i-1].rho);
90 END FOR;
91
92 (* these equation have no spatial derivatives *)
93 FOR i IN [2..n] CREATE
94 z_wall[i]: rho_w*A_w*c_w*dTw_dt[i] = qdot_s - qdot_l[i] - qdot_t[i];
95 z_loss[i]: qdot_l[i] = h_ext*(1{PI}*D_2)*(T_w[i] - T_amb);
96 z_trans[i]: qdot_t[i] = h_int*(1{PI}*D) *(T_w[i] - node[i].T);
97 END FOR;
98
99 t IS_A time;
100 METHODS
101 METHOD bound_self;
102 (* vel[1..n].upper_bound := 100 {m/s}; *)
103 qdot_l[2..n].lower_bound := 0 {W/m};
104 FOR i IN [1..n] DO
105 RUN node[i].bound_self;
106 END FOR;
107 END bound_self;
108 METHOD default_self;
109 (* these are DEFAULT values and are overwritten in METHOD values below *)
110 D := 0.06 {m};
111 D_2 := 0.07 {m};
112 A_w := 0.25{PI}*D_2^2 -0.25{PI}*D^2;
113 A := 1{PI}*D^2;
114 L := 50 {m};
115 T_amb := 298 {K};
116 dz := 3.08 {m};
117 f := 0.01;
118 h_ext := 10 {W/m^2/K};
119 h_int := 100 {W/m^2/K};
120 qdot_s := 1000 {W/m};
121 rho_w := 1000 {kg/m^3};
122 t := 0 {s};
123 FOR i IN [1..n] DO
124 T[i] := 298 {K};
125 (* vel[i] := 1 {m/s}; *)
126 RUN node[i].default_self;
127 END FOR;
128 FOR i IN [2..n] DO
129 T_w[i] := 298 {K};
130 drho_dt[i] := 0 {kg/m^3/s};
131 dG_dt[i] := 0 {kg/s/s};
132 du_dt[i] := 0 {kJ/kg/s};
133 dTw_dt[i] := 0 {K/s};
134 qdot_t[i] := 0 {W/m};
135 qdot_l[i] := 0 {W/m};
136 END FOR;
137 END default_self;
138 METHOD specify;
139 (* change to a proper steady-state problem, with fluid properties FREEd *)
140 FOR i IN [1..n] DO
141 RUN node[i].specify;
142 FREE node[i].mdot;
143 FIX dTw_dt[i]; FREE T_w[i];
144 END FOR;
145 FIX node[1].p;
146 FREE node[1].T;
147 FIX qdot_s;
148 FIX D, D_2, L;
149 FIX h_int, c_w, rho_w, h_ext;
150 FIX f;
151 (* FIX mu_f; *)
152 FIX T_amb;
153 (* fix derivatives to zero *)
154 FOR i IN [2..n] DO
155 (* FIX dG_dt[i]; FREE node[i].mdot; *)
156 FREE node[i].x; FIX node[i].p;
157 FIX drho_dt[i]; FREE node[i].p;
158 FIX du_dt[i]; FREE node[i].T;
159 FREE G[i]; FIX dG_dt[i];
160 END FOR;
161 END specify;
162 METHOD values;
163 D := 0.06 {m};
164 D_2 := 0.07 {m};
165 A_w := 0.25{PI}*D_2^2 -0.25{PI}*D^2;
166 A := 1{PI}*D^2;
167 L := 10 {m};
168 h_int := 100 {W/m^2/K};
169 h_ext := 20 {W/m^2/K};
170 f := 0.03;
171 G[1] := 0.26 {kg/s} / A;
172 node[1].p := 10 {bar};
173 node[1].x := 0.23;
174 qdot_s := 1000 {W/m^2} * D_2 * 10;
175 FOR i IN [2..n] DO
176 dG_dt[i] := 0.0 {kg/s/s};
177 du_dt[i] := 0 {kJ/kg/s};
178 node[i].v := 0.2 {L/kg};
179 node[i].rho := 6 {kg/L};
180 node[i].dp_dT := +0.5 {kPa/K};
181 node[i].p := 5 {bar};
182 END FOR;
183 END values;
184 METHOD on_load;
185 RUN configure_steady;
186 RUN ode_init;
187 END on_load;
188 (*---------------- a physically sensible steady-state configuration-----------*)
189 METHOD configure_steady;
190 RUN default_self;
191 RUN ClearAll;
192 RUN specify;
193 RUN bound_steady;
194 RUN values;
195 END configure_steady;
196 METHOD bound_steady;
197 RUN bound_self;
198 T_w[2..n].upper_bound := 1000 {K};
199 END bound_steady;
200 (*------------------------- the dynamic problem ------------------------------*)
201 METHOD configure_dynamic;
202 FOR i IN [2..n] DO
203 FREE drho_dt[i]; FIX node[i].rho;
204 FREE dG_dt[i]; FIX G[i];
205 FREE du_dt[i]; FIX node[i].u;
206 FREE dTw_dt[i]; FIX T_w[i];
207 FREE node[i].x;
208 FREE node[i].T;
209 END FOR;
210 t := 0 {s};
211 END configure_dynamic;
212 METHOD free_states;
213 FOR i IN [2..n] DO
214 FREE node[i].rho;
215 FREE G[i];
216 FREE node[i].u;
217 FREE T_w[i];
218 END FOR;
219 END free_states;
220 METHOD ode_init;
221 (* add the necessary meta data to allow solving with the integrator *)
222 t.ode_type := -1;
223
224 FOR i IN [2..n] DO
225 drho_dt[i].ode_id := 4*i; node[i].rho.ode_id := 4*i;
226 drho_dt[i].ode_type := 2; node[i].rho.ode_type := 1;
227
228 dG_dt[i].ode_id := 4*i+1; G[i].ode_id := 4*i+1;
229 dG_dt[i].ode_type := 2; G[i].ode_type := 1;
230
231 du_dt[i].ode_id := 4*i+2; node[i].u.ode_id := 4*i+2;
232 du_dt[i].ode_type := 2; node[i].u.ode_type := 1;
233
234 dTw_dt[i].ode_id := 4*i+3; T_w[i].ode_id := 4*i+3;
235 dTw_dt[i].ode_type := 2; T_w[i].ode_type := 1;
236 END FOR;
237
238 FOR i IN [1..n] DO
239 (* p[i].obs_id := 1 + 10*i; *)
240 (* x[i].obs_id := 2 + 10*i; *)
241 (* node[i].mdot.obs_id := 4 + 10*i; *)
242 (* node[i].h.obs_id := 3 + 10*i; *)
243 END FOR;
244 FOR i IN [2..n] DO
245 (* qdot_t[i].obs_id := 3 + 10*i; *)
246 (* T_w[i].obs_id := 5 + 10*i; *)
247 (* T[i].obs_id := 6 + 10*i;*)
248 END FOR;
249
250 G[n].obs_id := 1;
251 node[n].x.obs_id := 1;
252 p[n].obs_id := 1;
253 G[n].obs_id := 1;
254
255 END ode_init;
256 METHOD fix_outlet_quality;
257 FIX x[n];
258 FREE G[1];
259 END fix_outlet_quality;
260
261 END dsgsat3;
262 ADD NOTES IN dsgsat2;
263 'QRSlv' iterationlimit {50}
264 END NOTES;

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