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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1179 - (hide annotations) (download) (as text)
Fri Jan 19 01:14:32 2007 UTC (15 years, 6 months ago) by johnpye
File MIME type: text/x-ascend
File size: 6119 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 johnpye 1179 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 :== 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 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    
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 * (node[i].rho * A * du_dt[i] - qdot_t[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] = -(node[i].p-node[i-1].p)
76     - f/D/2*node[i].rho*vel[i]^2*(
77     node[i].rho*vel[i]^2 - node[i-1].rho*vel[i-1]^2
78     );
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     (* -- original formulation --
85     z_massbal[i]: A * drho_dt[i] * dz = - (node[i].mdot - node[i-1].mdot);
86     z_mombal[i]: dz/A*dmdot_dt[i] = -(node[i].p-node[i-1].p)
87     - f/D/2*node[i].rho*node[i].v^2*(
88     node[i].rho*vel[i]^2 - node[i-1].rho*vel[i-1]^2
89     );
90     z_enbal[i]: dz * (A * drhou_dt[i] - qdot_t[i]) = - (node[i].Hdot - node[i-1].Hdot);
91     z_wall[i]: rho_w*A_w*c_w*dTw_dt[i] = qdot_s - qdot_l[i] - qdot_t[i];
92     z_loss[i]: qdot_l[i] = h_ext*(1{PI}*D_2)*(T_w[i] - T_amb);
93     z_trans[i]: qdot_t[i] = h_int*(1{PI}*D) *(T_w[i] - node[i].T);
94     *)
95     END FOR;
96    
97     t IS_A time;
98     METHODS
99     METHOD bound_self;
100     vel[1..n].upper_bound := 100 {m/s};
101     qdot_l[2..n].lower_bound := 0 {W/m};
102     FOR i IN [1..n] DO
103     RUN node[i].bound_self;
104     END FOR;
105     END bound_self;
106     METHOD default_self;
107     D := 0.06 {m};
108     D_2 := 0.07 {m};
109     A_w := 0.25{PI}*D_2^2 -0.25{PI}*D^2;
110     FOR i IN [1..n] DO
111     RUN node[i].default_self;
112     END FOR;
113     END default_self;
114     METHOD values;
115     L := 50 {m};
116     h_int := 5 {W/m^2/K};
117     h_ext := 10 {W/m^2/K};
118     node[1].mdot := 0.3 {kg/s};
119     node[1].p := 5 {bar};
120     node[1].x := 0.2;
121     qdot_s := 1000 {W/m^2} * D_2 * 10;
122     FOR i IN [2..n] DO
123     dmdot_dt[i] := 0.0 {kg/s/s};
124     du_dt[i] := 0 {W/m^3};
125     node[i].v := 0.2 {L/kg};
126     node[i].rho := 6 {kg/L};
127     node[i].dp_dT := +0.5 {kPa/K};
128     END FOR;
129     END values;
130     METHOD on_load;
131     RUN configure_steady;
132     RUN ode_init;
133     END on_load;
134     (*---------------- a physically sensible steady-state configuration-----------*)
135     METHOD configure_steady;
136     RUN default_self;
137     RUN ClearAll;
138     RUN specify_steady;
139     RUN bound_steady;
140     RUN values;
141     END configure_steady;
142     METHOD bound_steady;
143     RUN bound_self;
144     T_w[2..n].upper_bound := 1000 {K};
145     END bound_steady;
146     METHOD specify_steady;
147     (* change to a proper steady-state problem, with fluid properties FREEd *)
148     FOR i IN [1..n] DO
149     RUN node[i].specify;
150     FIX dTw_dt[i]; FREE T_w[i];
151     END FOR;
152     FIX node[1].p;
153     FREE node[1].T;
154     FIX qdot_s;
155     FIX D, D_2, L;
156     FIX h_int, c_w, rho_w, h_ext;
157     FIX f;
158     (* FIX mu_f; *)
159     FIX T_amb;
160     (* fix derivatives to zero *)
161     FOR i IN [2..n] DO
162     (* FIX dmdot_dt[i]; FREE node[i].mdot; *)
163     FREE node[i].x; FIX node[i].p;
164     FIX drho_dt[i]; FREE node[i].p;
165     FIX du_dt[i]; FREE node[i].T;
166     FREE mdot[i]; FIX dmdot_dt[i];
167     END FOR;
168     END specify_steady;
169     (*------------------------- the dynamic problem ------------------------------*)
170     METHOD configure_dynamic;
171     FOR i IN [2..n] DO
172     FREE drho_dt[i]; FIX node[i].rho;
173     FREE dmdot_dt[i]; FIX node[i].mdot;
174     FREE du_dt[i]; FIX node[i].u;
175     FREE dTw_dt[i]; FIX T_w[i];
176     FREE node[i].x;
177     FREE node[i].T;
178     END FOR;
179     t := 0 {s};
180     END configure_dynamic;
181     METHOD free_states;
182     FOR i IN [2..n] DO
183     FREE node[i].rho;
184     FREE node[i].mdot;
185     FREE node[i].u;
186     FREE T_w[i];
187     END FOR;
188     END free_states;
189     METHOD ode_init;
190     (* add the necessary meta data to allow solving with the integrator *)
191     t.ode_type := -1;
192     t.obs_id := 1;
193    
194     FOR i IN [2..n] DO
195     drho_dt[i].ode_id := 4*i; node[i].rho.ode_id := 4*i;
196     drho_dt[i].ode_type := 2; node[i].rho.ode_type := 1;
197    
198     dmdot_dt[i].ode_id := 4*i+1; node[i].mdot.ode_id := 4*i+1;
199     dmdot_dt[i].ode_type := 2; node[i].mdot.ode_type := 1;
200    
201     du_dt[i].ode_id := 4*i+2; node[i].u.ode_id := 4*i+2;
202     du_dt[i].ode_type := 2; node[i].u.ode_type := 1;
203    
204     dTw_dt[i].ode_id := 4*i+3; T_w[i].ode_id := 4*i+3;
205     dTw_dt[i].ode_type := 2; T_w[i].ode_type := 1;
206     END FOR;
207    
208     FOR i IN [1..n] DO
209     p[i].obs_id := 1 + 5*i;
210     x[i].obs_id := 2 + 5*i;
211     node[i].mdot.obs_id := 4 + 5*i;
212     END FOR;
213     FOR i IN [2..n] DO
214     qdot_t[i].obs_id := 3 + 5*i;
215     T_w[i].obs_id := 5 + 4*i;
216     END FOR;
217     END ode_init;
218    
219     METHOD fix_outlet_quality;
220     FIX x[n];
221     FREE node[1].mdot;
222     END fix_outlet_quality;
223    
224     END dsgsat3;
225     ADD NOTES IN dsgsat2;
226     'QRSlv' iterationlimit {50}
227     END NOTES;
228    
229    

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