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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1269 by johnpye, Sat Feb 3 06:18:11 2007 UTC revision 1270 by johnpye, Sun Feb 4 01:01:18 2007 UTC
# Line 3  REQUIRE "atoms.a4l"; Line 3  REQUIRE "atoms.a4l";
3  REQUIRE "johnpye/thermo_types.a4c";  REQUIRE "johnpye/thermo_types.a4c";
4    
5  (*  (*
6      An attempt to model direct steam generation in pipe flow, limited to the      An attempt to model direct steam generation in pipe flow, limited to
7      saturated regime, and with constant-valued friction factor. External heat      the saturated regime, and with constant-valued friction factor.
8      loss is also simplified.      External heat loss is also simplified.
9  *)  *)
10  REQUIRE "steam/satsteamstream.a4c";  REQUIRE "steam/satsteamstream.a4c";
11    
12  MODEL dsgsat3;  MODEL dsgsat3;
13      n IS_A integer_constant;      n IS_A integer_constant;
14      n :== 4;      n :== 2;
15    
16      (* temporal derivatives *)      (* temporal derivatives *)
17      drho_dt[2..n] IS_A density_rate;      drho_dt[2..n] IS_A density_rate;
18      dmdot_dt[2..n] IS_A mass_rate_rate;      dmdot_dt[2..n] IS_A mass_rate_rate;
19      du_dt[2..n] IS_A power_per_volume;      du_dt[2..n] IS_A specific_energy_rate;
20      dTw_dt[2..n] IS_A temperature_rate;      dTw_dt[2..n] IS_A temperature_rate;
21    
22      (* wall properties *)      (* wall properties *)
# Line 81  MODEL dsgsat3; Line 81  MODEL dsgsat3;
81          z_loss[i]:  qdot_l[i] = h_ext*(1{PI}*D_2)*(T_w[i] - T_amb);          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);          z_trans[i]: qdot_t[i] = h_int*(1{PI}*D)  *(T_w[i] - node[i].T);
83    
 (* -- original formulation --  
         z_massbal[i]: A * drho_dt[i] * dz = - (node[i].mdot - node[i-1].mdot);  
         z_mombal[i]:  dz/A*dmdot_dt[i] = -(node[i].p-node[i-1].p)  
                         - f/D/2*node[i].rho*node[i].v^2*(  
                             node[i].rho*vel[i]^2 - node[i-1].rho*vel[i-1]^2  
                         );  
         z_enbal[i]: dz * (A * drhou_dt[i] - qdot_t[i]) = - (node[i].Hdot - node[i-1].Hdot);  
         z_wall[i]:  rho_w*A_w*c_w*dTw_dt[i] = qdot_s - qdot_l[i] - qdot_t[i];  
         z_loss[i]:  qdot_l[i] = h_ext*(1{PI}*D_2)*(T_w[i] - T_amb);  
         z_trans[i]: qdot_t[i] = h_int*(1{PI}*D)  *(T_w[i] - node[i].T);  
 *)  
84      END FOR;      END FOR;
85    
86      t IS_A time;      t IS_A time;
# Line 107  METHOD default_self; Line 96  METHOD default_self;
96      D := 0.06 {m};      D := 0.06 {m};
97      D_2 := 0.07 {m};      D_2 := 0.07 {m};
98      A_w := 0.25{PI}*D_2^2 -0.25{PI}*D^2;      A_w := 0.25{PI}*D_2^2 -0.25{PI}*D^2;
99        A := 1 {m^2};
100        L := 5 {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      FOR i IN [1..n] DO
110            T[i] := 298 {K};
111            vel[i] := 1 {m/s};
112          RUN node[i].default_self;          RUN node[i].default_self;
113      END FOR;      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;  END default_self;
124  METHOD values;  METHOD values;
125      L := 1 {m};      L := 200 {m};
126      h_int := 100 {W/m^2/K};      h_int := 100 {W/m^2/K};
127      h_ext := 10 {W/m^2/K};      h_ext := 10 {W/m^2/K};
128      f := 0.01;      f := 0.01;
# Line 122  METHOD values; Line 132  METHOD values;
132      qdot_s := 1000 {W/m^2} * D_2 * 10;      qdot_s := 1000 {W/m^2} * D_2 * 10;
133      FOR i IN [2..n] DO      FOR i IN [2..n] DO
134          dmdot_dt[i] := 0.0 {kg/s/s};          dmdot_dt[i] := 0.0 {kg/s/s};
135          du_dt[i] := 0 {W/m^3};          du_dt[i] := 0 {W/kg};
136          node[i].v := 0.2 {L/kg};          node[i].v := 0.2 {L/kg};
137          node[i].rho := 6 {kg/L};          node[i].rho := 6 {kg/L};
138          node[i].dp_dT := +0.5 {kPa/K};          node[i].dp_dT := +0.5 {kPa/K};
# Line 130  METHOD values; Line 140  METHOD values;
140      END FOR;      END FOR;
141  END values;  END values;
142  METHOD on_load;  METHOD on_load;
143        RUN default_self;
144      RUN configure_steady;      RUN configure_steady;
145      RUN ode_init;      RUN ode_init;
146  END on_load;  END on_load;
147  (*---------------- a physically sensible steady-state configuration-----------*)  (*--------- a physically sensible steady-state configuration---------*)
148  METHOD configure_steady;  METHOD configure_steady;
149      RUN default_self;      RUN reset;
     RUN ClearAll;  
     RUN specify_steady;  
150      RUN bound_steady;      RUN bound_steady;
151      RUN values;      RUN values;
152  END configure_steady;  END configure_steady;
153  METHOD bound_steady;  METHOD bound_steady;
154      RUN bound_self;      RUN bound_self;
155      T_w[2..n].upper_bound := 1000 {K};      T_w[2..n].upper_bound := 1000 {K};
156  END bound_steady;  END bound_steady;
157  METHOD specify_steady;  METHOD specify;
158      (* change to a proper steady-state problem, with fluid properties FREEd *)      (* setup for the steady-state problem, with fluid properties FREEd *)
159      FOR i IN [1..n] DO      FOR i IN [1..n] DO
160          RUN node[i].specify;          RUN node[i].specify;
161          FIX dTw_dt[i];   FREE T_w[i];          FIX dTw_dt[i];   FREE T_w[i];
# Line 167  METHOD specify_steady; Line 176  METHOD specify_steady;
176          FIX du_dt[i]; FREE node[i].T;          FIX du_dt[i]; FREE node[i].T;
177          FREE mdot[i]; FIX dmdot_dt[i];          FREE mdot[i]; FIX dmdot_dt[i];
178      END FOR;      END FOR;
179  END specify_steady;  END specify;
180  (*------------------------- the dynamic problem ------------------------------*)  (*-------------------- the dynamic problem -------------------------*)
181  METHOD configure_dynamic;  METHOD configure_dynamic;
182      FOR i IN [2..n] DO      FOR i IN [2..n] DO
183          FREE drho_dt[i];  FIX node[i].rho;          FREE drho_dt[i];  FIX node[i].rho;
# Line 189  METHOD free_states; Line 198  METHOD free_states;
198      END FOR;      END FOR;
199  END free_states;      END free_states;    
200  METHOD ode_init;  METHOD ode_init;
201      (* add the necessary meta data to allow solving with the integrator *)      (* add necessary meta data to allow solving with Integrator *)
202      t.ode_type := -1;      t.ode_type := -1;
203    
204      FOR i IN [2..n] DO      FOR i IN [2..n] DO

Legend:
Removed from v.1269  
changed lines
  Added in v.1270

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