/[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 1274 by johnpye, Sun Feb 4 04:54:20 2007 UTC revision 1275 by johnpye, Sun Feb 4 06:03:13 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      An attempt to model direct steam generation in pipe flow, limited to the
7      the saturated regime, and with constant-valued friction factor.      saturated regime, and with constant-valued friction factor. External heat
8      External heat loss is also simplified.      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 :== 2;      n :== 4;
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 specific_energy_rate;      du_dt[2..n] IS_A power_per_volume;
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    
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;      END FOR;
96    
97      t IS_A time;      t IS_A time;
# Line 96  METHOD default_self; Line 107  METHOD default_self;
107      D := 0.06 {m};      D := 0.06 {m};
108      D_2 := 0.07 {m};      D_2 := 0.07 {m};
109      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;
     A := 1 {m^2};  
     L := 50 {m};  
     T_amb := 298 {K};  
     dz := 3.08 {m};  
     f := 0.01;  
     h_ext := 10 {W/m^2/K};  
     h_int := 100 {W/m^2/K};  
     qdot_s := 700 {W/m};  
     rho_w := 1000 {kg/m^3};  
     t := 0 {s};  
110      FOR i IN [1..n] DO      FOR i IN [1..n] DO
         T[i] := 298 {K};  
         vel[i] := 1 {m/s};  
111          RUN node[i].default_self;          RUN node[i].default_self;
112      END FOR;      END FOR;
     FOR i IN [2..n] DO  
         T_w[i] := 298 {K};  
         drho_dt[i] := 0 {kg/m^3/s};  
         dmdot_dt[i] := 0 {kg/s/s};  
         du_dt[i] := 0 {kJ/kg/s};  
         dTw_dt[i] := 0 {K/s};  
         qdot_t[i] := 0 {W/m};  
         qdot_l[i] := 0 {W/m};  
     END FOR;  
113  END default_self;  END default_self;
114  METHOD values;  METHOD values;
115      L := 50 {m};      L := 1 {m};
116      h_int := 100 {W/m^2/K};      h_int := 100 {W/m^2/K};
117      h_ext := 10 {W/m^2/K};      h_ext := 10 {W/m^2/K};
118      f := 0.1;      f := 0.01;
119      node[1].mdot := 0.2 {kg/s};      node[1].mdot := 0.2 {kg/s};
120      node[1].p := 7 {bar};      node[1].p := 7 {bar};
121      node[1].x := 0.2;      node[1].x := 0.2;
122      qdot_s := 1000 {W/m^2} * D_2 * 10;      qdot_s := 1000 {W/m^2} * D_2 * 10;
123      FOR i IN [2..n] DO      FOR i IN [2..n] DO
124          dmdot_dt[i] := 0.0 {kg/s/s};          dmdot_dt[i] := 0.0 {kg/s/s};
125          du_dt[i] := 0 {W/kg};          du_dt[i] := 0 {W/m^3};
126          node[i].v := 0.2 {L/kg};          node[i].v := 0.2 {L/kg};
127          node[i].rho := 6 {kg/L};          node[i].rho := 6 {kg/L};
128          node[i].dp_dT := +0.5 {kPa/K};          node[i].dp_dT := +0.5 {kPa/K};
# Line 140  METHOD values; Line 130  METHOD values;
130      END FOR;      END FOR;
131  END values;  END values;
132  METHOD on_load;  METHOD on_load;
     RUN default_self;  
133      RUN configure_steady;      RUN configure_steady;
134      RUN ode_init;      RUN ode_init;
135  END on_load;  END on_load;
136  (*--------- a physically sensible steady-state configuration---------*)  (*---------------- a physically sensible steady-state configuration-----------*)
137  METHOD configure_steady;  METHOD configure_steady;
138      RUN reset;      RUN default_self;
139        RUN ClearAll;
140        RUN specify_steady;
141      RUN bound_steady;      RUN bound_steady;
142      RUN values;      RUN values;
143  END configure_steady;  END configure_steady;
144  METHOD bound_steady;  METHOD bound_steady;
145      RUN bound_self;      RUN bound_self;
146      T_w[2..n].upper_bound := 1000 {K};      T_w[2..n].upper_bound := 1000 {K};
147  END bound_steady;  END bound_steady;
148  METHOD specify;  METHOD specify_steady;
149      (* setup for the steady-state problem, with fluid properties FREEd *)      (* change to a proper steady-state problem, with fluid properties FREEd *)
150      FOR i IN [1..n] DO      FOR i IN [1..n] DO
151          RUN node[i].specify;          RUN node[i].specify;
152          FIX dTw_dt[i];   FREE T_w[i];          FIX dTw_dt[i];   FREE T_w[i];
# Line 176  METHOD specify; Line 167  METHOD specify;
167          FIX du_dt[i]; FREE node[i].T;          FIX du_dt[i]; FREE node[i].T;
168          FREE mdot[i]; FIX dmdot_dt[i];          FREE mdot[i]; FIX dmdot_dt[i];
169      END FOR;      END FOR;
170  END specify;  END specify_steady;
171  (*-------------------- the dynamic problem -------------------------*)  (*------------------------- the dynamic problem ------------------------------*)
172  METHOD configure_dynamic;  METHOD configure_dynamic;
173      FOR i IN [2..n] DO      FOR i IN [2..n] DO
174          FREE drho_dt[i];  FIX node[i].rho;          FREE drho_dt[i];  FIX node[i].rho;
# Line 198  METHOD free_states; Line 189  METHOD free_states;
189      END FOR;      END FOR;
190  END free_states;      END free_states;    
191  METHOD ode_init;  METHOD ode_init;
192      (* add necessary meta data to allow solving with Integrator *)      (* add the necessary meta data to allow solving with the integrator *)
193      t.ode_type := -1;      t.ode_type := -1;
194    
195      FOR i IN [2..n] DO      FOR i IN [2..n] DO

Legend:
Removed from v.1274  
changed lines
  Added in v.1275

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