/[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 1276 by johnpye, Sun Feb 4 06:28:53 2007 UTC revision 1277 by johnpye, Sun Feb 4 07:39:31 2007 UTC
# Line 65  MODEL dsgsat3; Line 65  MODEL dsgsat3;
65      END FOR;      END FOR;
66    
67      (* differential equations *)      (* 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);      (* use central difference for several derivatives *)
70        FOR i IN [2..n-1] CREATE
71            z_massbal[i]: A * drho_dt[i] * dz = - (node[i+1].mdot - node[i-1].mdot) / 2.0;
72    
73          z_enbal[i]: dz * (qdot_t[i] - node[i].rho * A * du_dt[i]) =          z_enbal[i]: dz * (qdot_t[i] - node[i].rho * A * du_dt[i]) =
74               + node[i].mdot * (node[i].u - node[i-1].u)               + node[i].mdot * (node[i].u - node[i-1].u)
75               + (node[i].p*node[i].v*node[i].mdot - node[i-1].p*node[i-1].v*node[i-1].mdot);               + (node[i+1].p*node[i+1].v*node[i+1].mdot - node[i-1].p*node[i-1].v*node[i-1].mdot) / 2;
76    
77          z_mombal[i]:  - dz/A*dmdot_dt[i] =          z_mombal[i]:  - dz/A*dmdot_dt[i] =
78                          (node[i].p-node[i-1].p)                          (node[i+1].p-node[i-1].p) / 2.0
79                          + dz * f/D/2 * node[i].rho * vel[i]^2                          + dz * f/D/2 * node[i].rho * vel[i]^2
80                          + (node[i].rho*vel[i]^2 - node[i-1].rho*vel[i-1]^2);                          + (node[i].rho*vel[i]^2 - node[i-1].rho*vel[i-1]^2);
81    
# Line 81  MODEL dsgsat3; Line 83  MODEL dsgsat3;
83          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);
84          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);
85    
86  (* -- original formulation --      END FOR;
87          z_massbal[i]: A * drho_dt[i] * dz = - (node[i].mdot - node[i-1].mdot);  
88          z_mombal[i]:  dz/A*dmdot_dt[i] = -(node[i].p-node[i-1].p)      (* the last equations use backwards difference *)
89                          - f/D/2*node[i].rho*node[i].v^2*(      FOR i IN [n] CREATE
90                              node[i].rho*vel[i]^2 - node[i-1].rho*vel[i-1]^2          z_massbal1[i]: A * drho_dt[i] * dz = - (node[i].mdot - node[i-1].mdot);
91                          );  
92          z_enbal[i]: dz * (A * drhou_dt[i] - qdot_t[i]) = - (node[i].Hdot - node[i-1].Hdot);          z_enbal1[i]: dz * (qdot_t[i] - node[i].rho * A * du_dt[i]) =
93          z_wall[i]:  rho_w*A_w*c_w*dTw_dt[i] = qdot_s - qdot_l[i] - qdot_t[i];               + node[i].mdot * (node[i].u - node[i-1].u)
94          z_loss[i]:  qdot_l[i] = h_ext*(1{PI}*D_2)*(T_w[i] - T_amb);               + (node[i].p*node[i].v*node[i].mdot - node[i-1].p*node[i-1].v*node[i-1].mdot);
95          z_trans[i]: qdot_t[i] = h_int*(1{PI}*D)  *(T_w[i] - node[i].T);  
96  *)          z_mombal1[i]:  - dz/A*dmdot_dt[i] =
97                            (node[i].p-node[i-1].p)
98                            + dz * f/D/2 * node[i].rho * vel[i]^2
99                            + (node[i].rho*vel[i]^2 - node[i-1].rho*vel[i-1]^2);
100    
101            z_wall1[i]:  rho_w*A_w*c_w*dTw_dt[i] = qdot_s - qdot_l[i] - qdot_t[i];
102            z_loss1[i]:  qdot_l[i] = h_ext*(1{PI}*D_2)*(T_w[i] - T_amb);
103            z_trans1[i]: qdot_t[i] = h_int*(1{PI}*D)  *(T_w[i] - node[i].T);
104    
105      END FOR;      END FOR;
106    
107      t IS_A time;      t IS_A time;
# Line 120  METHOD default_self; Line 130  METHOD default_self;
130      FOR i IN [1..n] DO      FOR i IN [1..n] DO
131          T[i] := 298 {K};          T[i] := 298 {K};
132          vel[i] := 1 {m/s};          vel[i] := 1 {m/s};
133            node[i].v := 0.2 {L/kg};
134            node[i].rho := 6 {kg/L};
135            node[i].dp_dT := +0.5 {kPa/K};
136            node[i].p := 5 {bar};
137          RUN node[i].default_self;          RUN node[i].default_self;
138      END FOR;      END FOR;
139      FOR i IN [2..n] DO      FOR i IN [2..n] DO
# Line 131  METHOD default_self; Line 145  METHOD default_self;
145          qdot_t[i] := 0 {W/m};          qdot_t[i] := 0 {W/m};
146          qdot_l[i] := 0 {W/m};          qdot_l[i] := 0 {W/m};
147      END FOR;      END FOR;
148  END default_self;  END default_self;
149    METHOD specify;
150        (* change to a proper steady-state problem, with fluid properties FREEd *)
151        FOR i IN [1..n] DO
152            RUN node[i].specify;
153            FIX dTw_dt[i];   FREE T_w[i];
154        END FOR;
155        FIX node[1].p;
156        FREE node[1].T;
157        FIX qdot_s;
158        FIX D, D_2, L;
159        FIX h_int, c_w, rho_w, h_ext;
160        FIX f;
161        (* FIX mu_f; *)
162        FIX T_amb;
163        (* fix derivatives to zero *)
164        FOR i IN [2..n] DO
165            (* FIX dmdot_dt[i]; FREE node[i].mdot; *)
166            FREE node[i].x; FIX node[i].p;
167            FIX drho_dt[i];  FREE node[i].p;
168            FIX du_dt[i]; FREE node[i].T;
169            FREE mdot[i]; FIX dmdot_dt[i];
170        END FOR;
171    END specify;
172  METHOD values;  METHOD values;
173      L := 3 {m};      L := 9 {m};
174      h_int := 100 {W/m^2/K};      h_int := 100 {W/m^2/K};
175      h_ext := 10 {W/m^2/K};      h_ext := 20 {W/m^2/K};
176      f := 0.01;      f := 0.01;
177      node[1].mdot := 0.2 {kg/s};      node[1].mdot := 0.5 {kg/s};
178      node[1].p := 7 {bar};      node[1].p := 8 {bar};
179      node[1].x := 0.2;      node[1].x := 0.3;
180      qdot_s := 1000 {W/m^2} * D_2 * 10;      qdot_s := 1000 {W/m^2} * D_2 * 10;
181      FOR i IN [2..n] DO      FOR i IN [2..n] DO
182          dmdot_dt[i] := 0.0 {kg/s/s};          dmdot_dt[i] := 0.0 {kg/s/s};
183          du_dt[i] := 0 {kJ/kg/s};          du_dt[i] := 0 {kJ/kg/s};
         node[i].v := 0.2 {L/kg};  
         node[i].rho := 6 {kg/L};  
         node[i].dp_dT := +0.5 {kPa/K};  
         node[i].p := 5 {bar};  
184      END FOR;      END FOR;
185  END values;  END values;
186  METHOD on_load;  METHOD on_load;
# Line 157  END on_load; Line 190  END on_load;
190  (*---------------- a physically sensible steady-state configuration-----------*)  (*---------------- a physically sensible steady-state configuration-----------*)
191  METHOD configure_steady;  METHOD configure_steady;
192      RUN default_self;      RUN default_self;
193      RUN ClearAll;      RUN reset;
     RUN specify_steady;  
194      RUN bound_steady;      RUN bound_steady;
195      RUN values;      RUN values;
196  END configure_steady;  END configure_steady;
# Line 166  METHOD bound_steady; Line 198  METHOD bound_steady;
198      RUN bound_self;      RUN bound_self;
199      T_w[2..n].upper_bound := 1000 {K};      T_w[2..n].upper_bound := 1000 {K};
200  END bound_steady;  END bound_steady;
 METHOD specify_steady;  
     (* change to a proper steady-state problem, with fluid properties FREEd *)  
     FOR i IN [1..n] DO  
         RUN node[i].specify;  
         FIX dTw_dt[i];   FREE T_w[i];  
     END FOR;  
     FIX node[1].p;  
     FREE node[1].T;  
     FIX qdot_s;  
     FIX D, D_2, L;  
     FIX h_int, c_w, rho_w, h_ext;  
     FIX f;  
     (* FIX mu_f; *)  
     FIX T_amb;  
     (* fix derivatives to zero *)  
     FOR i IN [2..n] DO  
         (* FIX dmdot_dt[i]; FREE node[i].mdot; *)  
         FREE node[i].x; FIX node[i].p;  
         FIX drho_dt[i];  FREE node[i].p;  
         FIX du_dt[i]; FREE node[i].T;  
         FREE mdot[i]; FIX dmdot_dt[i];  
     END FOR;  
 END specify_steady;  
201  (*------------------------- the dynamic problem ------------------------------*)  (*------------------------- the dynamic problem ------------------------------*)
202  METHOD configure_dynamic;  METHOD configure_dynamic;
203      FOR i IN [2..n] DO      FOR i IN [2..n] DO

Legend:
Removed from v.1276  
changed lines
  Added in v.1277

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