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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1124 - (show annotations) (download) (as text)
Fri Jan 12 23:51:09 2007 UTC (17 years, 5 months ago) by johnpye
File MIME type: text/x-ascend
File size: 5366 byte(s)
Fixed the 'A_w' problem by adding some default 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 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 :== 10;
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;
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*node[i].v^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 END default_self;
96 METHOD on_load;
97 RUN configure_steady;
98 END on_load;
99 (*---------------- a physically sensible steady-state configuration-----------*)
100 METHOD configure_steady;
101 RUN default_self;
102 RUN ClearAll;
103 RUN specify_steady;
104 RUN bound_steady;
105 RUN values_steady;
106 END configure_steady;
107 METHOD bound_steady;
108 RUN bound_self;
109 T_w[2..n].upper_bound := 1000 {K};
110 END bound_steady;
111 METHOD specify_steady;
112 (* change to a proper steady-state problem, with fluid properties FREEd *)
113 FOR i IN [1..n] DO
114 RUN node[i].specify;
115 FIX dTw_dt[i]; FREE T_w[i];
116 FREE rhou[i];
117 END FOR;
118 FIX node[1].p;
119 FREE node[1].T;
120 FIX qdot_s;
121 FIX D, D_2, L;
122 FIX h_int, c_w, rho_w, h_ext;
123 FIX f;
124 (* FIX mu_f; *)
125 FIX T_amb;
126 (* fix derivatives to zero *)
127 FOR i IN [2..n] DO
128 (* FIX dmdot_dt[i]; FREE node[i].mdot; *)
129 FREE node[i].x; FIX node[i].p;
130 FIX drho_dt[i]; FREE node[i].p;
131 FIX drhou_dt[i]; FREE node[i].T;
132 FREE mdot[i]; FIX dmdot_dt[i];
133 END FOR;
134 END specify_steady;
135 METHOD values_steady;
136 L := 50 {m};
137 h_int := 5 {W/m^2/K};
138 h_ext := 10 {W/m^2/K};
139 node[1].mdot := 0.3 {kg/s};
140 node[1].p := 5 {bar};
141 node[1].x := 0.2;
142 qdot_s := 1000 {W/m^2} * D_2 * 10;
143 FOR i IN [2..n] DO
144 dmdot_dt[i] := 0.0 {kg/s/s};
145 drhou_dt[i] := 0 {kJ/m^3/s};
146 node[i].v := 0.2 {L/kg};
147 node[i].rho := 6 {kg/L};
148 node[i].dp_dT := +0.5 {kPa/K};
149 END FOR;
150 (* nothing atm *)
151 END values_steady;
152 (*------------------------- the dynamic problem ------------------------------*)
153 METHOD configure_dynamic;
154 RUN ode_init;
155 FOR i IN [2..n] DO
156 FREE drho_dt[i]; FIX node[i].rho;
157 FREE dmdot_dt[i]; FIX node[i].mdot;
158 FREE drhou_dt[i]; FIX rhou[i];
159 FREE dTw_dt[i]; FIX T_w[i];
160 FREE node[i].x;
161 FREE node[i].T;
162 END FOR;
163 t := 0 {s};
164 END configure_dynamic;
165
166 METHOD ode_init;
167 (* add the necessary meta data to allow solving with the integrator *)
168 t.ode_type := -1;
169 t.obs_id := 1;
170
171 FOR i IN [2..n] DO
172 drho_dt[i].ode_id := 4*i; node[i].rho.ode_id := 4*i;
173 drho_dt[i].ode_type := 2; node[i].rho.ode_type := 1;
174
175 dmdot_dt[i].ode_id := 4*i+1; node[i].mdot.ode_id := 4*i+1;
176 dmdot_dt[i].ode_type := 2; node[i].mdot.ode_type := 1;
177
178 drhou_dt[i].ode_id := 4*i+2; rhou[i].ode_id := 4*i+2;
179 drhou_dt[i].ode_type := 2; rhou[i].ode_type := 1;
180
181 dTw_dt[i].ode_id := 4*i+3; T_w[i].ode_id := 4*i+3;
182 dTw_dt[i].ode_type := 2; T_w[i].ode_type := 1;
183 END FOR;
184
185 FOR i IN [1..n] DO
186 p[i].obs_id := 1 + 4*i;
187 x[i].obs_id := 2 + 4*i+1;
188 END FOR;
189 FOR i IN [] DO
190 (* qdot_t[i].obs_id := 3 + 4*i; *)
191 node[i].mdot.obs_id := 3 + 4*i;
192 T_w[i].obs_id := 4 + 4*i;
193 END FOR;
194 END ode_init;
195
196 METHOD fix_outlet_quality;
197 FIX x[n];
198 FREE node[1].mdot;
199 END fix_outlet_quality;
200
201 END dsgsat2;
202 ADD NOTES IN dsgsat2;
203 'QRSlv' iterationlimit {50}
204 END NOTES;

Properties

Name Value
svn:executable *

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