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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1273 - (show annotations) (download) (as text)
Sun Feb 4 04:54:20 2007 UTC (15 years, 5 months ago) by johnpye
File MIME type: text/x-ascend
File size: 5993 byte(s)
Identified a problem in moving from qdot_s = 700 to qdot_s = 1000 in QRSlv steady case. Maybe a problem with nominal values?
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
7 the saturated regime, and with constant-valued friction factor.
8 External heat loss is also simplified.
9 *)
10 REQUIRE "steam/satsteamstream.a4c";
11
12 MODEL dsgsat3;
13 n IS_A integer_constant;
14 n :== 2;
15
16 (* temporal derivatives *)
17 drho_dt[2..n] IS_A density_rate;
18 dmdot_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 vel[1..n] IS_A speed;
40 T_w[2..n] IS_A temperature;
41 T[1..n] IS_A temperature;
42
43 (* constants, for the moment: *)
44 f IS_A positive_factor;
45 (* mu_f IS_A viscosity; *)
46 T_amb IS_A temperature;
47
48 (* system dynamics *)
49 qdot_t[2..n], qdot_l[2..n] IS_A power_per_length;
50 qdot_s IS_A power_per_length;
51
52 FOR i IN [1..n] CREATE
53 z_vel[i]: vel[i] = node[i].v*node[i].mdot/A;
54 END FOR;
55
56 (* some aliases just for easier review of the state of the model *)
57 x[1..n] IS_A fraction;
58 mdot[1..n] IS_A mass_rate;
59 p[1..n] IS_A pressure;
60 FOR i IN [1..n] CREATE
61 x[i], node[i].x ARE_THE_SAME;
62 mdot[i], node[i].mdot ARE_THE_SAME;
63 p[i], node[i].p ARE_THE_SAME;
64 T[i], node[i].T ARE_THE_SAME;
65 END FOR;
66
67 (* differential equations *)
68 FOR i IN [2..n] CREATE
69 z_massbal[i]: A * drho_dt[i] * dz = - (node[i].mdot - node[i-1].mdot);
70
71 z_enbal[i]: dz * (qdot_t[i] - node[i].rho * A * du_dt[i]) =
72 + node[i].mdot * (node[i].u - node[i-1].u)
73 + (node[i].p*node[i].v*node[i].mdot - node[i-1].p*node[i-1].v*node[i-1].mdot);
74
75 z_mombal[i]: - dz/A*dmdot_dt[i] =
76 (node[i].p-node[i-1].p)
77 + dz * f/D/2 * node[i].rho * vel[i]^2
78 + (node[i].rho*vel[i]^2 - node[i-1].rho*vel[i-1]^2);
79
80 z_wall[i]: rho_w*A_w*c_w*dTw_dt[i] = qdot_s - qdot_l[i] - qdot_t[i];
81 z_loss[i]: qdot_l[i] = h_ext*(1{PI}*D_2)*(T_w[i] - T_amb);
82 z_trans[i]: qdot_t[i] = h_int*(1{PI}*D) *(T_w[i] - node[i].T);
83
84 END FOR;
85
86 t IS_A time;
87 METHODS
88 METHOD bound_self;
89 vel[1..n].upper_bound := 100 {m/s};
90 qdot_l[2..n].lower_bound := 0 {W/m};
91 FOR i IN [1..n] DO
92 RUN node[i].bound_self;
93 END FOR;
94 END bound_self;
95 METHOD default_self;
96 D := 0.06 {m};
97 D_2 := 0.07 {m};
98 A_w := 0.25{PI}*D_2^2 -0.25{PI}*D^2;
99 A := 1 {m^2};
100 L := 50 {m};
101 T_amb := 298 {K};
102 dz := 3.08 {m};
103 f := 0.01;
104 h_ext := 10 {W/m^2/K};
105 h_int := 100 {W/m^2/K};
106 qdot_s := 700 {W/m};
107 rho_w := 1000 {kg/m^3};
108 t := 0 {s};
109 FOR i IN [1..n] DO
110 T[i] := 298 {K};
111 vel[i] := 1 {m/s};
112 RUN node[i].default_self;
113 END FOR;
114 FOR i IN [2..n] DO
115 T_w[i] := 298 {K};
116 drho_dt[i] := 0 {kg/m^3/s};
117 dmdot_dt[i] := 0 {kg/s/s};
118 du_dt[i] := 0 {kJ/kg/s};
119 dTw_dt[i] := 0 {K/s};
120 qdot_t[i] := 0 {W/m};
121 qdot_l[i] := 0 {W/m};
122 END FOR;
123 END default_self;
124 METHOD values;
125 L := 50 {m};
126 h_int := 100 {W/m^2/K};
127 h_ext := 10 {W/m^2/K};
128 f := 0.1;
129 node[1].mdot := 0.2 {kg/s};
130 node[1].p := 7 {bar};
131 node[1].x := 0.2;
132 qdot_s := 1000 {W/m^2} * D_2 * 10;
133 FOR i IN [2..n] DO
134 dmdot_dt[i] := 0.0 {kg/s/s};
135 du_dt[i] := 0 {W/kg};
136 node[i].v := 0.2 {L/kg};
137 node[i].rho := 6 {kg/L};
138 node[i].dp_dT := +0.5 {kPa/K};
139 node[i].p := 5 {bar};
140 END FOR;
141 END values;
142 METHOD on_load;
143 RUN default_self;
144 RUN configure_steady;
145 RUN ode_init;
146 END on_load;
147 (*--------- a physically sensible steady-state configuration---------*)
148 METHOD configure_steady;
149 RUN reset;
150 RUN bound_steady;
151 RUN values;
152 END configure_steady;
153 METHOD bound_steady;
154 RUN bound_self;
155 T_w[2..n].upper_bound := 1000 {K};
156 END bound_steady;
157 METHOD specify;
158 (* setup for the steady-state problem, with fluid properties FREEd *)
159 FOR i IN [1..n] DO
160 RUN node[i].specify;
161 FIX dTw_dt[i]; FREE T_w[i];
162 END FOR;
163 FIX node[1].p;
164 FREE node[1].T;
165 FIX qdot_s;
166 FIX D, D_2, L;
167 FIX h_int, c_w, rho_w, h_ext;
168 FIX f;
169 (* FIX mu_f; *)
170 FIX T_amb;
171 (* fix derivatives to zero *)
172 FOR i IN [2..n] DO
173 (* FIX dmdot_dt[i]; FREE node[i].mdot; *)
174 FREE node[i].x; FIX node[i].p;
175 FIX drho_dt[i]; FREE node[i].p;
176 FIX du_dt[i]; FREE node[i].T;
177 FREE mdot[i]; FIX dmdot_dt[i];
178 END FOR;
179 END specify;
180 (*-------------------- the dynamic problem -------------------------*)
181 METHOD configure_dynamic;
182 FOR i IN [2..n] DO
183 FREE drho_dt[i]; FIX node[i].rho;
184 FREE dmdot_dt[i]; FIX node[i].mdot;
185 FREE du_dt[i]; FIX node[i].u;
186 FREE dTw_dt[i]; FIX T_w[i];
187 FREE node[i].x;
188 FREE node[i].T;
189 END FOR;
190 t := 0 {s};
191 END configure_dynamic;
192 METHOD free_states;
193 FOR i IN [2..n] DO
194 FREE node[i].rho;
195 FREE node[i].mdot;
196 FREE node[i].u;
197 FREE T_w[i];
198 END FOR;
199 END free_states;
200 METHOD ode_init;
201 (* add necessary meta data to allow solving with Integrator *)
202 t.ode_type := -1;
203
204 FOR i IN [2..n] DO
205 drho_dt[i].ode_id := 4*i; node[i].rho.ode_id := 4*i;
206 drho_dt[i].ode_type := 2; node[i].rho.ode_type := 1;
207
208 dmdot_dt[i].ode_id := 4*i+1; node[i].mdot.ode_id := 4*i+1;
209 dmdot_dt[i].ode_type := 2; node[i].mdot.ode_type := 1;
210
211 du_dt[i].ode_id := 4*i+2; node[i].u.ode_id := 4*i+2;
212 du_dt[i].ode_type := 2; node[i].u.ode_type := 1;
213
214 dTw_dt[i].ode_id := 4*i+3; T_w[i].ode_id := 4*i+3;
215 dTw_dt[i].ode_type := 2; T_w[i].ode_type := 1;
216 END FOR;
217
218 FOR i IN [1..n] DO
219 p[i].obs_id := 1 + 10*i;
220 x[i].obs_id := 2 + 10*i;
221 node[i].mdot.obs_id := 4 + 10*i;
222 END FOR;
223 FOR i IN [2..n] DO
224 qdot_t[i].obs_id := 3 + 10*i;
225 T_w[i].obs_id := 5 + 10*i;
226 T[i].obs_id := 6 + 10*i;
227 END FOR;
228 END ode_init;
229 METHOD fix_outlet_quality;
230 FIX x[n];
231 FREE node[1].mdot;
232 END fix_outlet_quality;
233
234 END dsgsat3;
235 ADD NOTES IN dsgsat2;
236 'QRSlv' iterationlimit {50}
237 END NOTES;

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