/[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 1394 by jpye, Fri Apr 6 10:50:41 2007 UTC revision 1395 by jpye, Sat Apr 21 15:11:45 2007 UTC
# Line 14  IMPORT "johnpye/roots"; Line 14  IMPORT "johnpye/roots";
14    
15  MODEL dsgsat3;  MODEL dsgsat3;
16      n IS_A integer_constant;      n IS_A integer_constant;
17      n :== 30;(* with L = 10m: 5,6,7,8,9,10,11 *)      n :== 7;(* with L = 10m: 5,6,7,8,9,10,11 *)
18               (* 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 *)
19    
20      dz IS_A real_constant;      dz IS_A real_constant;
21      L IS_A real_constant;      L IS_A real_constant;
22      L :== 11 {m};      L :== 16 {m};
23      dz :== L / (n-1);      dz :== L / (n-1);
24    
25      nodes,butfirst1,upwind4,central IS_A set OF integer_constant;      nodes,butfirst1,upwind4,central IS_A set OF integer_constant;
# Line 67  MODEL dsgsat3; Line 67  MODEL dsgsat3;
67      p[nodes] IS_A pressure;      p[nodes] IS_A pressure;
68      rho[nodes] IS_A mass_density;      rho[nodes] IS_A mass_density;
69      u[nodes] IS_A specific_energy;      u[nodes] IS_A specific_energy;
     v[nodes] IS_A specific_volume;  
70    
71  (*  Qdot_t IS_A energy_rate;  (*  Qdot_t IS_A energy_rate;
72      Qdot_t = SUM[qdot_t[i] | i IN butfirst1]; *)      Qdot_t = SUM[qdot_t[i] | i IN butfirst1]; *)
73    
74      FOR i IN nodes CREATE      FOR i IN nodes CREATE
75          z_vel[i]: vel[i] = v[i]*mdot[i]/A;          z_vel[i]: vel[i]*rho[i]*A = mdot[i];
76      END FOR;      END FOR;
77    
78      FOR i IN nodes CREATE      FOR i IN nodes CREATE
# Line 83  MODEL dsgsat3; Line 82  MODEL dsgsat3;
82          T[i],    node[i].T ARE_THE_SAME;          T[i],    node[i].T ARE_THE_SAME;
83          rho[i],  node[i].rho ARE_THE_SAME;          rho[i],  node[i].rho ARE_THE_SAME;
84          u[i],    node[i].u ARE_THE_SAME;          u[i],    node[i].u ARE_THE_SAME;
85          v[i],    node[i].v ARE_THE_SAME;          h[i] ALIASES node[i].h;
86      END FOR;      END FOR;
87    
88      en_upwind4,en_central,mom_upwind4,mom_central,mass_upwind4,mass_central IS_A set OF integer_constant;      en_upwind4,en_central,mom_upwind4,mom_central,mass_upwind4,mass_central IS_A set OF integer_constant;
89    
90      (* mass conservation *)      (* mass conservation *)
91      mass_upwind4 :== upwind4;      mass_upwind4 :== [];
92      mass_central :== central - mass_upwind4;      mass_central :== central - mass_upwind4;
93      FOR i IN mass_upwind4 CREATE (* 4-pt upwind biased *)      FOR i IN mass_upwind4 CREATE (* 4-pt upwind biased *)
94          z_massbal1[i]: A * drho_dt[i] * dz =          z_massbal1[i]: A * drho_dt[i] * dz = - (rho[i+1]*A*vel[i+1] + 6 * rho[i]*A*vel[i] - 3. * rho[i-1]*A*vel[i-1] - 2. * rho[i-2]*A*vel[i-2]) / 6;
                 - (mdot[i+1] + 6.*mdot[i] - 3.*mdot[i-1] - 2.*mdot[i-2]) / 6.;  
95      END FOR;      END FOR;
96      FOR i IN mass_central CREATE      FOR i IN mass_central CREATE
97          z_massbal2[i]: A * drho_dt[i] * dz =          z_massbal2[i]: A * drho_dt[i] * dz = - (rho[i+1]*A*vel[i+1] - rho[i-1]*A*vel[i-1]) / 2.;
                 - (mdot[i+1] - mdot[i-1]) / 2.;  
98      END FOR;      END FOR;
99      FOR i IN butfirst1 - mass_upwind4 - mass_central CREATE      FOR i IN butfirst1 - mass_upwind4 - mass_central CREATE
100          z_massbal[i]: A * drho_dt[i] * dz = - (mdot[i] - mdot[i-1]);          z_massbal[i]: A * drho_dt[i] * dz = - (rho[i]*A*vel[i] - rho[i-1]*A*vel[i-1]);
101      END FOR;      END FOR;
102    
103      (* energy conservation *)      (* energy conservation *)
104      en_upwind4 :== [];      en_upwind4 :== [];
105      en_central :== central - en_upwind4;      en_central :== [](*central - en_upwind4*);
106      FOR i IN en_upwind4 CREATE      FOR i IN en_upwind4 CREATE
107          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]) =
108               + 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.
109               + (p[i+1]*node[i+1].v*mdot[i+1] - p[i-1]*v[i-1]*mdot[i-1]) / 2.;               + (p[i+1]/rho[i+1]*mdot[i+1] - p[i-1]/rho[i-1]*mdot[i-1]) / 2.;
110      END FOR;      END FOR;
111      FOR i IN en_central CREATE      FOR i IN en_central CREATE
112          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]) =
113               + mdot[i] * (u[i] - u[i-1]) (* NOTE: not central *)               + mdot[i] * (u[i] - u[i-1]) (* NOTE: not central *)
114               + (p[i+1]*v[i+1]*mdot[i+1] - p[i-1]*v[i-1]*mdot[i-1]) / 2.;               + (p[i+1]/rho[i+1]*mdot[i+1] - p[i-1]/rho[i-1]*mdot[i-1]) / 2.;
115      END FOR;      END FOR;
116      FOR i IN butfirst1 - en_upwind4 - en_central CREATE      FOR i IN butfirst1 - en_upwind4 - en_central CREATE
117          z_enbal[i]: dz * (qdot_t[i] - rho[i] * A * du_dt[i]) =          z_enbal3[i]: dz * (qdot_t[i] - A * rho[i]*du_dt[i]) =
118               + mdot[i] * (u[i] - u[i-1])              + mdot[i] * (h[i] - h[i-1])
119               + (p[i]*v[i]*mdot[i] - p[i-1]*v[i-1]*mdot[i-1]);              + p[i]/rho[i]*(mdot[i] - mdot[i-1]);
120      END FOR;      END FOR;
121    
122      (* stationary momentum *)      (* stationary momentum *)
123      FOR i IN butfirst1 CREATE      FOR i IN butfirst1 CREATE
124          z_mombal[i]: p[i] = p[i-1] - dz  * f/D/2 * rho[i] * vel[i]^2;          z_mombal[i]: p[i] = p[i-1] - dz * f/D/2 * rho[i] * vel[i]^2;
125      END FOR;      END FOR;
126      mom_upwind4 :== [];      mom_upwind4 :== [];
127      mom_central :== [];      mom_central :== [];
 (*  
     * momentum conservation *  
     FOR i IN mom_upwind4 CREATE  
         z_mombal2[i]:  - dz/A * dmdot_dt[i]  
              =  (p[i]-p[i-1])  * backdiff for pressure *  
                 + dz * f/D/2 * rho[i] * vel[i]^2  
                 + (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.;  
     END FOR;  
     FOR i IN mom_central CREATE  
         z_mombal1[i]:  - dz/A * dmdot_dt[i]  
              =  (p[i+1]-p[i-1]) / 2.  
                 + dz * f/D/2 * rho[i] * vel[i]^2  
                 + (rho[i+1]*vel[i+1]^2 - rho[i-1]*vel[i-1]^2) / 2.;  
     END FOR;  
     FOR i IN butfirst1 - mom_upwind4 - mom_central CREATE  
         z_mombal[i]:  - dz/A * dmdot_dt[i]  
              =  (p[i]-p[i-1])  
                 + dz * f/D/2 * rho[i] * vel[i]^2  
                 + (rho[i]*vel[i]^2 - rho[i-1]*vel[i-1]^2);  
     END FOR;  
 *)  
128    
129      (* internal/external convection, and thermal mass of wall -- no spatial derivs here *)      (* internal/external convection, and thermal mass of wall -- no spatial derivs here *)
130      FOR i IN butfirst1 CREATE      FOR i IN butfirst1 CREATE
# Line 224  METHODS Line 200  METHODS
200              T_w[i] := 298 {K};              T_w[i] := 298 {K};
201  (*          dmdot_dt[i] := 0.0 {kg/s/s};*)  (*          dmdot_dt[i] := 0.0 {kg/s/s};*)
202              du_dt[i] := 0 {kJ/kg/s};              du_dt[i] := 0 {kJ/kg/s};
             v[i] := 0.2 {L/kg};  
203              rho[i] := 6 {kg/L};              rho[i] := 6 {kg/L};
204              node[i].dp_dT := +0.5 {kPa/K};              node[i].dp_dT := +0.5 {kPa/K};
205              p[i] := 5 {bar};              p[i] := 5 {bar};
# Line 300  METHODS Line 275  METHODS
275          mdot[n].obs_id := 1;          mdot[n].obs_id := 1;
276          x[n].obs_id := 1;          x[n].obs_id := 1;
277          p[n].obs_id := 1;          p[n].obs_id := 1;
278          vel[n].obs_id := 1;          h[n].obs_id := 15;
279          T_w[n].obs_id := 2;          vel[n].obs_id := 10;
280            T[n].obs_id := 20;
281            T_w[n].obs_id := 30;
282    
283      END ode_init;      END ode_init;
284      METHOD fix_outlet_quality;      METHOD fix_outlet_quality;

Legend:
Removed from v.1394  
changed lines
  Added in v.1395

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