/[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 1311 by johnpye, Sun Mar 4 13:26:32 2007 UTC revision 1312 by johnpye, Sun Mar 4 14:04:39 2007 UTC
# Line 11  REQUIRE "steam/satsteamstream.a4c"; Line 11  REQUIRE "steam/satsteamstream.a4c";
11    
12  MODEL dsgsat3;  MODEL dsgsat3;
13      n IS_A integer_constant;      n IS_A integer_constant;
14      n :== 5;(* with L = 10m: 5,6,7,8,9,10,11 *)      n :== 7;(* with L = 10m: 5,6,7,8,9,10,11 *)
15               (* with L =  5m: 2,3,4,5,7,9,11,12,13,1415,16 *)               (* with L =  5m: 2,3,4,5,7,9,11,12,13,1415,16 *)
16    
17      dz IS_A real_constant;      dz IS_A real_constant;
# Line 79  MODEL dsgsat3; Line 79  MODEL dsgsat3;
79          v[i],    node[i].v ARE_THE_SAME;          v[i],    node[i].v ARE_THE_SAME;
80      END FOR;      END FOR;
81    
82        en_upwind4,en_central,mom_upwind4,mom_central,mass_upwind4,mass_central IS_A set OF integer_constant;
83    
84      (* mass conservation *)      (* mass conservation *)
85      FOR i IN upwind4 CREATE (* 4-pt upwind biased *)      mass_upwind4 :== upwind4;
86        mass_central :== [];
87        FOR i IN mass_upwind4 CREATE (* 4-pt upwind biased *)
88          z_massbal1[i]: A * drho_dt[i] * dz =          z_massbal1[i]: A * drho_dt[i] * dz =
89                  - (mdot[i+1] + 6.*mdot[i] - 3.*mdot[i-1] - 2.*mdot[i-2]) / 6.;                  - (mdot[i+1] + 6.*mdot[i] - 3.*mdot[i-1] - 2.*mdot[i-2]) / 6.;
90      END FOR;      END FOR;
91      FOR i IN [] CREATE      FOR i IN mass_central CREATE
92          z_massbal2[i]: A * drho_dt[i] * dz =          z_massbal2[i]: A * drho_dt[i] * dz =
93                  - (mdot[i+1] - mdot[i-1]) / 2.;                  - (mdot[i+1] - mdot[i-1]) / 2.;
94      END FOR;      END FOR;
95      FOR i IN [2,n] CREATE      FOR i IN butfirst1 - mass_upwind4 - mass_central CREATE
96          z_massbal[i]: A * drho_dt[i] * dz = - (mdot[i] - mdot[i-1]);          z_massbal[i]: A * drho_dt[i] * dz = - (mdot[i] - mdot[i-1]);
97      END FOR;      END FOR;
98    
99      (* energy conservation *)      (* energy conservation *)
100      FOR i IN [] CREATE      en_upwind4 :== [];
101        en_central :== central;
102        FOR i IN en_upwind4 CREATE
103          z_enbal2[i]: dz * (qdot_t[i] - rho[i] * A * du_dt[i]) =          z_enbal2[i]: dz * (qdot_t[i] - rho[i] * A * du_dt[i]) =
104               + mdot[i] * (node[i+1].u + 6.*u[i] - 3.*u[i-1] - 2.*u[i-1]) / 6.               + mdot[i] * (node[i+1].u + 6.*u[i] - 3.*u[i-1] - 2.*u[i-1]) / 6.
105               + (p[i+1]*node[i+1].v*mdot[i+1] - p[i-1]*v[i-1]*mdot[i-1]) / 2.;               + (p[i+1]*node[i+1].v*mdot[i+1] - p[i-1]*v[i-1]*mdot[i-1]) / 2.;
106      END FOR;      END FOR;
107      FOR i IN central CREATE      FOR i IN en_central CREATE
108          z_enbal1[i]: dz * (qdot_t[i] - rho[i] * A * du_dt[i]) =          z_enbal1[i]: dz * (qdot_t[i] - rho[i] * A * du_dt[i]) =
109               + mdot[i] * (u[i] - u[i-1]) (* NOTE: not central *)               + mdot[i] * (u[i] - u[i-1]) (* NOTE: not central *)
110               + (p[i+1]*v[i+1]*mdot[i+1] - p[i-1]*v[i-1]*mdot[i-1]) / 2.;               + (p[i+1]*v[i+1]*mdot[i+1] - p[i-1]*v[i-1]*mdot[i-1]) / 2.;
111      END FOR;      END FOR;
112      FOR i IN [n] CREATE      FOR i IN butfirst1 - en_upwind4 - en_central CREATE
113          z_enbal[i]: dz * (qdot_t[i] - rho[i] * A * du_dt[i]) =          z_enbal[i]: dz * (qdot_t[i] - rho[i] * A * du_dt[i]) =
114               + mdot[i] * (u[i] - u[i-1])               + mdot[i] * (u[i] - u[i-1])
115               + (p[i]*v[i]*mdot[i] - p[i-1]*v[i-1]*mdot[i-1]);               + (p[i]*v[i]*mdot[i] - p[i-1]*v[i-1]*mdot[i-1]);
116      END FOR;      END FOR;
117    
118      (* momentum conservation *)      (* momentum conservation *)
119      FOR i IN [] CREATE      mom_upwind4 :== [];
120        mom_central :== central;
121        FOR i IN mom_upwind4 CREATE
122          z_mombal2[i]:  - dz/A * dmdot_dt[i]          z_mombal2[i]:  - dz/A * dmdot_dt[i]
123               =  (p[i]-p[i-1])  (* backdiff for pressure *)               =  (p[i]-p[i-1])  (* backdiff for pressure *)
124                  + dz * f/D/2 * rho[i] * vel[i]^2                  + dz * f/D/2 * rho[i] * vel[i]^2
125                  + (rho[i+1]*vel[i+1]^2 + 6.*rho[i]*vel[i]^2 - 3.*rho[i-1]*vel[i-1]^2 - 2.*rho[i-2]*vel[i-2]^2) / 6.;                  + (rho[i+1]*vel[i+1]^2 + 6.*rho[i]*vel[i]^2 - 3.*rho[i-1]*vel[i-1]^2 - 2.*rho[i-2]*vel[i-2]^2) / 6.;
126      END FOR;      END FOR;
127      FOR i IN central CREATE      FOR i IN mom_central CREATE
128          z_mombal1[i]:  - dz/A * dmdot_dt[i]          z_mombal1[i]:  - dz/A * dmdot_dt[i]
129               =  (p[i+1]-p[i-1]) / 2.               =  (p[i+1]-p[i-1]) / 2.
130                  + dz * f/D/2 * rho[i] * vel[i]^2                  + dz * f/D/2 * rho[i] * vel[i]^2
131                  + (rho[i+1]*vel[i+1]^2 - rho[i-1]*vel[i-1]^2) / 2.;                  + (rho[i+1]*vel[i+1]^2 - rho[i-1]*vel[i-1]^2) / 2.;
132      END FOR;      END FOR;
133      FOR i IN [n] CREATE      FOR i IN butfirst1 - mom_upwind4 - mom_central CREATE
134          z_mombal[i]:  - dz/A * dmdot_dt[i]          z_mombal[i]:  - dz/A * dmdot_dt[i]
135               =  (p[i]-p[i-1])               =  (p[i]-p[i-1])
136                  + dz * f/D/2 * rho[i] * vel[i]^2                  + dz * f/D/2 * rho[i] * vel[i]^2
# Line 147  METHODS Line 155  METHODS
155      END bound_self;      END bound_self;
156      METHOD default;      METHOD default;
157          (* these are initial guesses only; fixed parameters are overwritten by 'values' below *)          (* these are initial guesses only; fixed parameters are overwritten by 'values' below *)
158            D := 0.06 {m};
159            D_2 := 0.07 {m};
160            A_w := 0.25{PI}*D_2^2 -0.25{PI}*D^2;
161            A := 1 {m^2};
162            T_amb := 298 {K};
163            f := 0.0;
164            h_ext := 10 {W/m^2/K};
165            h_int := 100 {W/m^2/K};
166            qdot_s := 1000 {W/m};
167            rho_w := 1000 {kg/m^3};
168          t := 0 {s};          t := 0 {s};
169          FOR i IN nodes DO          FOR i IN nodes DO
170                T[i] := 298 {K};
171                vel[i] := 1 {m/s};
172              RUN node[i].default_self;              RUN node[i].default_self;
173          END FOR;          END FOR;
174          FOR i IN butfirst1 DO          FOR i IN butfirst1 DO
175                T_w[i] := 298 {K};
176              drho_dt[i] := 0 {kg/m^3/s};              drho_dt[i] := 0 {kg/m^3/s};
177              dmdot_dt[i] := 0 {kg/s/s};              dmdot_dt[i] := 0 {kg/s/s};
178              du_dt[i] := 0 {kJ/kg/s};              du_dt[i] := 0 {kJ/kg/s};
179              dTw_dt[i] := 0 {K/s};              dTw_dt[i] := 0 {K/s};
180              qdot_t[i] := 0 {W/m};              qdot_t[i] := 0 {W/m};
181              qdot_l[i] := 0 {W/m};              qdot_l[i] := 0 {W/m};
182                x[i] := x[1];
183          END FOR;          END FOR;
184      END default;      END default;
185      METHOD specify;      METHOD specify;
# Line 183  METHODS Line 205  METHODS
205          END FOR;          END FOR;
206      END specify;      END specify;
207      METHOD values;      METHOD values;
         T_amb := 298 {K};  
         D := 0.06 {m};  
         D_2 := 0.07 {m};  
208          h_int := 100 {W/m^2/K};          h_int := 100 {W/m^2/K};
209          h_ext := 20 {W/m^2/K};          h_ext := 20 {W/m^2/K};
         rho_w := 1000 {kg/m^3};  
210          f := 0.03;          f := 0.03;
211          mdot[1] := 0.26 {kg/s};          mdot[1] := 0.26 {kg/s};
212          p[1]    := 10 {bar};          p[1]    := 10 {bar};
213          x[1]    := 0.23;          x[1]    := 0.23;
214          qdot_s := 1000 {W/m^2} * D_2 * 10;          qdot_s := 1000 {W/m^2} * D_2 * 10;
215          FOR i IN butfirst1 DO          FOR i IN butfirst1 DO
             T_w[i] := 298 {K};  
216              dmdot_dt[i] := 0.0 {kg/s/s};              dmdot_dt[i] := 0.0 {kg/s/s};
217              du_dt[i] := 0 {kJ/kg/s};              du_dt[i] := 0 {kJ/kg/s};
218              v[i] := 0.2 {L/kg};              v[i] := 0.2 {L/kg};
# Line 285  END dsgsat3; Line 302  END dsgsat3;
302  ADD NOTES IN dsgsat2;  ADD NOTES IN dsgsat2;
303      'QRSlv' iterationlimit {50}      'QRSlv' iterationlimit {50}
304  END NOTES;  END NOTES;
   
   

Legend:
Removed from v.1311  
changed lines
  Added in v.1312

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