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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:executable *

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