/[ascend]/trunk/models/johnpye/dsg.a4c
ViewVC logotype

Diff of /trunk/models/johnpye/dsg.a4c

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

revision 887 by johnpye, Mon Oct 9 15:06:06 2006 UTC revision 888 by johnpye, Wed Oct 11 14:53:27 2006 UTC
# Line 1  Line 1 
1    REQUIRE "ivpsystem.a4l";
2  REQUIRE "atoms.a4l";  REQUIRE "atoms.a4l";
3  REQUIRE "johnpye/thermo_types.a4c";  REQUIRE "johnpye/thermo_types.a4c";
4  IMPORT "freesteam";  IMPORT "freesteam";
# Line 21  IMPORT "dsg"; Line 22  IMPORT "dsg";
22      cd $HOME/src/dsg-transient      cd $HOME/src/dsg-transient
23      scons -j2 ascend      scons -j2 ascend
24      export ASCENDLIBRARY=$HOME/src/dsg-transient/ascend:$ASCENDLIBRARY      export ASCENDLIBRARY=$HOME/src/dsg-transient/ascend:$ASCENDLIBRARY
25      $HOME/src/ascend/pygtk/ascdev johnpye/dsg.a4c        export PATH=$PATH:$HOME/src/ascend/pygtk
26        ascdev johnpye/dsg.a4c  
27  *)  *)
28    
29  MODEL dsg;  MODEL dsg;
30      (* temporal derivatives *)      (* temporal derivatives *)
31      drho_dt IS_A density_rate;      drho_dt IS_A density_rate;
32      dmdot_dt IS_A mass_rate_rate;      dmdot_dt IS_A mass_rate_rate;
33      drhou_dt IS_A solver_var;      drhou_dt IS_A power_per_volume;
34      dTw_dt IS_A temperature_rate;      dTw_dt IS_A temperature_rate;
35    
36      (* spatial derivatives *)      (* spatial derivatives *)
# Line 56  MODEL dsg; Line 58  MODEL dsg;
58      rho IS_A mass_density;      rho IS_A mass_density;
59      mdot IS_A mass_rate;      mdot IS_A mass_rate;
60      p IS_A pressure;      p IS_A pressure;
61      f IS_A factor; (* pipe friction factor *)      f IS_A positive_factor; (* pipe friction factor *)
62      u IS_A specific_energy;      u IS_A specific_energy;
63      h IS_A specific_enthalpy;      h IS_A specific_enthalpy;
64      vel IS_A speed;      vel IS_A speed;
# Line 66  MODEL dsg; Line 68  MODEL dsg;
68      T, T1, Tw, T2, Tamb IS_A temperature;      T, T1, Tw, T2, Tamb IS_A temperature;
69      ekdot IS_A specific_power;      ekdot IS_A specific_power;
70    
71        rhou IS_A energy_per_volume;
72        rhou = rho * u;
73    
74      rho * v = 1;      rho * v = 1;
75      ekdot = 0.5 * rho * vel^2;      ekdot = 0.5 * rho * vel^2;
76    
# Line 76  MODEL dsg; Line 81  MODEL dsg;
81    
82      vel = rho*mdot/A;      vel = rho*mdot/A;
83    
84      Re IS_A factor;      Re IS_A positive_factor;
85      Re_rel: Re = rho*vel*D/mu;      Re_rel: Re = rho*vel*D/mu;
86      eps_on_D IS_A factor;      eps_on_D IS_A factor;
87      eps_on_D_rel: eps_on_D = eps/D;      eps_on_D_rel: eps_on_D = eps/D;
# Line 91  MODEL dsg; Line 96  MODEL dsg;
96          f : OUTPUT          f : OUTPUT
97      );      );
98    
99      phi2 IS_A factor;      phi2 IS_A positive_factor;
100      x IS_A factor;      x IS_A fraction;
101      twophmult: dsg_phi2_martinelli_nelson(      twophmult: dsg_phi2_martinelli_nelson(
102          p,x : INPUT;          p,x : INPUT;
103          phi2 : OUTPUT          phi2 : OUTPUT
# Line 125  MODEL dsg; Line 130  MODEL dsg;
130          h1 : OUTPUT          h1 : OUTPUT
131      );      );
132    
133        t IS_A time;
134    
135  METHODS  METHODS
136    
137  METHOD specify;  METHOD specify;
138      RUN fix_design;      RUN fix_design;
139      RUN fix_states;      RUN fix_states;
140      RUN fix_spatials;      RUN fix_spatials;
141        RUN ode_init;
142  END specify;  END specify;
143    
144  METHOD fix_states;  METHOD fix_states;
# Line 176  METHOD values; Line 184  METHOD values;
184      mdot := 0.001 {kg/s};      mdot := 0.001 {kg/s};
185    
186      (* spatial derivs *)      (* spatial derivs *)
187      dp_dz := -500 {Pa/m};      dp_dz := -200 {Pa/m};
188      dmdot_dz := 0 {kg/s/m};      dmdot_dz := 0 {kg/s/m};
189      drhovel2_dz := (0 {kg/m^3}) * (0 {m/s})^2 / (1 {m});      drhovel2_dz := (0 {kg/m^3}) * (0 {m/s})^2 / (1 {m});
190      dekdot_dz := 0 {W/m};      dekdot_dz := 0 {W/m};
# Line 188  METHOD values; Line 196  METHOD values;
196      drhou_dt := 0 {kg/m^3*kJ/kg/s};      drhou_dt := 0 {kg/m^3*kJ/kg/s};
197      dTw_dt := 0 {K/s};      dTw_dt := 0 {K/s};
198    
199        drhou_dt.nominal := rhou.nominal / 60 {s};
200    
201        v := 0.2 {m^3/kg};
202    
203      (* bounds *)      (* bounds *)
204      f.lower_bound := 0.008;      f.lower_bound := 0.008;
205      v.lower_bound := 0.00999 {m^3/kg};      v.lower_bound := 0.00999 {m^3/kg};
# Line 199  METHOD values; Line 211  METHOD values;
211      Re := 10000;      Re := 10000;
212  END values;  END values;
213    
214    METHOD ode_init;
215        t.ode_type := -1;
216        t := 0 {s};
217    
218        rho.ode_id := 1;   drho_dt.ode_id := 1;
219        rho.ode_type := 1; drho_dt.ode_type := 2;
220    
221        mdot.ode_id := 2;   dmdot_dt.ode_id := 2;
222        mdot.ode_type := 1; dmdot_dt.ode_type := 2;
223        
224        rhou.ode_id := 3;   drhou_dt.ode_id := 3;
225        rhou.ode_type := 1; drhou_dt.ode_type := 2;
226    
227        Tw.ode_id := 4;   dTw_dt.ode_id := 4;
228        Tw.ode_type := 1; dTw_dt.ode_type := 2;
229    
230        rho.obs_id := 1;
231        mdot.obs_id := 2;
232        rhou.obs_id := 3;
233        Tw.obs_id := 4;
234    
235    END ode_init;
236    
237  METHOD on_load;  METHOD on_load;
238      RUN reset;      RUN reset;
239      RUN values;      RUN values;

Legend:
Removed from v.887  
changed lines
  Added in v.888

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