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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1179 - (show annotations) (download) (as text)
Fri Jan 19 01:14:32 2007 UTC (15 years, 5 months ago) by johnpye
File MIME type: text/x-ascend
File size: 5546 byte(s)
Fixed problem with 'v' (spec vol) verusus 'vel' in one equation!
Added new formulation where (rho*u) equation is rewritten as (u).
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 dsgsat2;
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 drhou_dt[2..n] IS_A power_per_volume;
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 rhou[1..n] IS_A energy_per_volume;
52
53 FOR i IN [1..n] CREATE
54 z_vel[i]: vel[i] = node[i].v*node[i].mdot/A;
55 z_rhou[i]: rhou[i] = node[i].rho * node[i].u;
56 END FOR;
57
58 (* some aliases just for easier review of the state of the model *)
59 x[1..n] IS_A fraction;
60 mdot[1..n] IS_A mass_rate;
61 p[1..n] IS_A pressure;
62 FOR i IN [1..n] CREATE
63 x[i], node[i].x ARE_THE_SAME;
64 mdot[i], node[i].mdot ARE_THE_SAME;
65 p[i], node[i].p ARE_THE_SAME;
66 T[i], node[i].T ARE_THE_SAME;
67 END FOR;
68
69 (* differential equations *)
70 FOR i IN [2..n] CREATE
71 z_massbal[i]: A * drho_dt[i] * dz = - (node[i].mdot - node[i-1].mdot);
72 z_mombal[i]: dz/A*dmdot_dt[i] = -(node[i].p-node[i-1].p)
73 - f/D/2*node[i].rho*vel[i]^2*(
74 node[i].rho*vel[i]^2 - node[i-1].rho*vel[i-1]^2
75 );
76 z_enbal[i]: dz * (A * drhou_dt[i] - qdot_t[i]) = - (node[i].Hdot - node[i-1].Hdot);
77 z_wall[i]: rho_w*A_w*c_w*dTw_dt[i] = qdot_s - qdot_l[i] - qdot_t[i];
78 z_loss[i]: qdot_l[i] = h_ext*(1{PI}*D_2)*(T_w[i] - T_amb);
79 z_trans[i]: qdot_t[i] = h_int*(1{PI}*D) *(T_w[i] - node[i].T);
80 END FOR;
81
82 t IS_A time;
83 METHODS
84 METHOD bound_self;
85 vel[1..n].upper_bound := 100 {m/s};
86 qdot_l[2..n].lower_bound := 0 {W/m};
87 FOR i IN [1..n] DO
88 RUN node[i].bound_self;
89 END FOR;
90 END bound_self;
91 METHOD default_self;
92 D := 0.06 {m};
93 D_2 := 0.07 {m};
94 A_w := 0.25{PI}*D_2^2 -0.25{PI}*D^2;
95 FOR i IN [1..n] DO
96 RUN node[i].default_self;
97 END FOR;
98 END default_self;
99 METHOD values;
100 L := 50 {m};
101 h_int := 5 {W/m^2/K};
102 h_ext := 10 {W/m^2/K};
103 node[1].mdot := 0.3 {kg/s};
104 node[1].p := 5 {bar};
105 node[1].x := 0.2;
106 qdot_s := 1000 {W/m^2} * D_2 * 10;
107 FOR i IN [2..n] DO
108 dmdot_dt[i] := 0.0 {kg/s/s};
109 drhou_dt[i] := 0 {kJ/m^3/s};
110 node[i].v := 0.2 {L/kg};
111 node[i].rho := 6 {kg/L};
112 node[i].dp_dT := +0.5 {kPa/K};
113 END FOR;
114 END values;
115 METHOD on_load;
116 RUN configure_steady;
117 RUN ode_init;
118 END on_load;
119 (*---------------- a physically sensible steady-state configuration-----------*)
120 METHOD configure_steady;
121 RUN default_self;
122 RUN ClearAll;
123 RUN specify_steady;
124 RUN bound_steady;
125 RUN values;
126 END configure_steady;
127 METHOD bound_steady;
128 RUN bound_self;
129 T_w[2..n].upper_bound := 1000 {K};
130 END bound_steady;
131 METHOD specify_steady;
132 (* change to a proper steady-state problem, with fluid properties FREEd *)
133 FOR i IN [1..n] DO
134 RUN node[i].specify;
135 FIX dTw_dt[i]; FREE T_w[i];
136 FREE rhou[i];
137 END FOR;
138 FIX node[1].p;
139 FREE node[1].T;
140 FIX qdot_s;
141 FIX D, D_2, L;
142 FIX h_int, c_w, rho_w, h_ext;
143 FIX f;
144 (* FIX mu_f; *)
145 FIX T_amb;
146 (* fix derivatives to zero *)
147 FOR i IN [2..n] DO
148 (* FIX dmdot_dt[i]; FREE node[i].mdot; *)
149 FREE node[i].x; FIX node[i].p;
150 FIX drho_dt[i]; FREE node[i].p;
151 FIX drhou_dt[i]; FREE node[i].T;
152 FREE mdot[i]; FIX dmdot_dt[i];
153 END FOR;
154 END specify_steady;
155 (*------------------------- the dynamic problem ------------------------------*)
156 METHOD configure_dynamic;
157 FOR i IN [2..n] DO
158 FREE drho_dt[i]; FIX node[i].rho;
159 FREE dmdot_dt[i]; FIX node[i].mdot;
160 FREE drhou_dt[i]; FIX rhou[i];
161 FREE dTw_dt[i]; FIX T_w[i];
162 FREE node[i].x;
163 FREE node[i].T;
164 END FOR;
165 t := 0 {s};
166 END configure_dynamic;
167 METHOD free_states;
168 FOR i IN [2..n] DO
169 FREE node[i].rho;
170 FREE node[i].mdot;
171 FREE rhou[i];
172 FREE T_w[i];
173 END FOR;
174 END free_states;
175 METHOD ode_init;
176 (* add the necessary meta data to allow solving with the integrator *)
177 t.ode_type := -1;
178 t.obs_id := 1;
179
180 FOR i IN [2..n] DO
181 drho_dt[i].ode_id := 4*i; node[i].rho.ode_id := 4*i;
182 drho_dt[i].ode_type := 2; node[i].rho.ode_type := 1;
183
184 dmdot_dt[i].ode_id := 4*i+1; node[i].mdot.ode_id := 4*i+1;
185 dmdot_dt[i].ode_type := 2; node[i].mdot.ode_type := 1;
186
187 drhou_dt[i].ode_id := 4*i+2; rhou[i].ode_id := 4*i+2;
188 drhou_dt[i].ode_type := 2; rhou[i].ode_type := 1;
189
190 dTw_dt[i].ode_id := 4*i+3; T_w[i].ode_id := 4*i+3;
191 dTw_dt[i].ode_type := 2; T_w[i].ode_type := 1;
192 END FOR;
193
194 FOR i IN [1..n] DO
195 p[i].obs_id := 1 + 5*i;
196 x[i].obs_id := 2 + 5*i;
197 node[i].mdot.obs_id := 4 + 5*i;
198 END FOR;
199 FOR i IN [2..n] DO
200 qdot_t[i].obs_id := 3 + 5*i;
201 T_w[i].obs_id := 5 + 4*i;
202 END FOR;
203 END ode_init;
204
205 METHOD fix_outlet_quality;
206 FIX x[n];
207 FREE node[1].mdot;
208 END fix_outlet_quality;
209
210 END dsgsat2;
211 ADD NOTES IN dsgsat2;
212 'QRSlv' iterationlimit {50}
213 END NOTES;

Properties

Name Value
svn:executable *

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