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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 771 - (show annotations) (download) (as text)
Fri Jul 14 04:31:54 2006 UTC (18 years ago) by johnpye
File MIME type: text/x-ascend
File size: 4276 byte(s)
Removed some debug noise.
Minor changes to dsg models.
1 REQUIRE "atoms.a4l";
2 REQUIRE "johnpye/thermo_types.a4c";
3 IMPORT "freesteam";
4 IMPORT "dsg";
5
6 (*
7 This model requires the 'freesteam' library be installed on your system.
8 You must compile it with the 'ASCEND_CONFIG=`which ascend-config`' flag
9 to ensure that the required external library is installed where ASCEND
10 can find it. Alternatively, you can specify the location by adding to the
11 ASCENDLIBRARY path variable. See http://freesteam.sf.net/
12
13 This model also requires the 'dsg' library for Direct Steam Generation
14 calculations, available on request from http://pye.dyndns.org/
15 *)
16
17 MODEL dsg;
18 (* temporal derivatives *)
19 drho_dt IS_A density_rate;
20 dmdot_dt IS_A mass_rate_rate;
21 drhou_dt IS_A solver_var;
22 dTw_dt IS_A temperature_rate;
23
24 (* spatial derivatives *)
25 dmdot_dz IS_A mass_rate_per_length;
26 dmdoth_dz IS_A solver_var;
27 dekdot_dz IS_A solver_var;
28 dp_dz IS_A pressure_per_length;
29 drhovel2_dz IS_A pressure_per_length;
30
31 (* wall properties *)
32 rhow IS_A mass_density;
33 D2 IS_A distance;
34 cw IS_A specific_heat_capacity;
35 Aw IS_A area;
36 hw IS_A heat_transfer_coefficient;
37
38 Aw = 1{PI}*(D2^2 - D^2)/4;
39
40 (* conservation equations *)
41 massbal: drho_dt = -1/A * dmdot_dz;
42 mombal: 1/A * dmdot_dt = -dp_dz - f/D/2*rho*vel^2 - drhovel2_dz;
43 enerbal: drhou_dt = 1/A * ( qdott - dmdoth_dz + mdot * dekdot_dz );
44 pipebal: dTw_dt = 1/rhow/Aw/cw * (qdots - qdotl - qdott);
45
46 rho IS_A mass_density;
47 mdot IS_A mass_rate;
48 p IS_A pressure;
49 f IS_A factor; (* pipe friction factor *)
50 u IS_A specific_energy;
51 h IS_A specific_enthalpy;
52 vel IS_A speed;
53 qdott, qdotl,qdots IS_A power_per_length;
54 mu IS_A viscosity;
55 v IS_A specific_volume;
56 T, T1, Tw, T2, Tamb IS_A temperature;
57 ekdot IS_A specific_power;
58
59 rho * v = 1;
60 ekdot = 0.5 * rho * vel^2;
61
62 thermo_props: iapws97_uvTxmu_ph(
63 p,h : INPUT;
64 u,v,T,x,mu : OUTPUT
65 );
66
67 vel = rho*mdot/A;
68
69 Re IS_A factor;
70 Re_rel: Re = rho*vel*D/mu;
71 eps_on_D IS_A factor;
72 eps_on_D_rel: eps_on_D = eps/D;
73
74 D IS_A distance;
75 eps IS_A distance;
76 A IS_A area;
77 A = 1{PI}* D^2 / 4;
78
79 friction: dsg_fric_factor_two_phase(
80 Re, eps_on_D : INPUT;
81 f : OUTPUT
82 );
83
84 phi2 IS_A factor;
85 x IS_A factor;
86 twophmult: dsg_phi2_martinelli_nelson(
87 p,x : INPUT;
88 phi2 : OUTPUT
89 );
90 (* TODO: compute LIQUID ONLY reynolds number when in the two-phase region...
91 that's a bit tricky and needs conditional modelling, so maybe try putting
92 it in the external code. *)
93
94 cavity_losses: dsg_ext_heat_loss(
95 T2,Tamb,D2,hw : INPUT;
96 qdotl : OUTPUT
97 );
98
99 Tw = (T1 + T2)/2;
100
101 mdoth IS_A energy_rate;
102 mdoth = mdot * h;
103
104 rhovel2 IS_A solver_var;
105 rhovel2 = rho * vel^2;
106
107 (* internal heat transfer *)
108
109 h1 IS_A heat_transfer_coefficient;
110
111 qdott = h1 * 1{PI} * D * (T1 - T);
112
113 twophconv: dsg_conv_coeff_two_phase(
114 p, h, mdot, D, f : INPUT;
115 h1 : OUTPUT
116 );
117
118 METHODS
119
120 METHOD specify;
121 RUN fix_design;
122 RUN fix_states;
123 RUN fix_spatials;
124 END specify;
125
126 METHOD fix_states;
127 FIX T1, T2, p, h, mdot;
128 END fix_states;
129
130 METHOD fix_design;
131 (* design parameters, geometry, materials of construction *)
132 FIX rhow,D2,cw,hw;
133 FIX D, eps;
134 FIX qdots;
135 FIX Tamb;
136 END fix_design;
137
138 METHOD fix_spatials;
139 (* for use when tinkering about with a single node only *)
140 FIX dmdot_dz, dmdoth_dz, dekdot_dz, dp_dz, drhovel2_dz;
141 END fix_spatials;
142
143 METHOD fix_temporals;
144 (* for steady-state solution *)
145 FIX drho_dt;
146 FIX dmdot_dt;
147 FIX drhou_dt;
148 FIX dTw_dt;
149 END fix_temporals;
150
151 METHOD values;
152 (* design parameters *)
153 D := 60 {mm};
154 D2 := 70 {mm};
155 eps := 0.05 {mm};
156 rhow := 7.8 {g/cm^3};
157 cw := 0.47 {J/g/K};
158 hw := 10 {W/m^2/K};
159 Tamb := 300 {K};
160
161 (* states *)
162 T1 := 600 {K};
163 T2 := 500 {K};
164 p := 10 {bar};
165 h := 4000 {kJ/kg};
166 mdot := 0.001 {kg/s};
167
168 (* spatial derivs *)
169 dp_dz := -500 {Pa/m};
170 dmdot_dz := 0 {kg/s/m};
171 drhovel2_dz := (0 {kg/m^3}) * (0 {m/s})^2 / (1 {m});
172 dekdot_dz := 0 {W/m};
173 dmdoth_dz := dmdot_dz * 0 {kJ/kg};
174
175 (* derivative variables *)
176 drho_dt := 0 {kg/m^3/s};
177 dmdot_dt := 0 {kg/s/s};
178 drhou_dt := 0 {kg/m^3*kJ/kg/s};
179 dTw_dt := 0 {K/s};
180
181 (* bounds *)
182 f.lower_bound := 0.008;
183 v.lower_bound := 0.00999 {m^3/kg};
184 v.upper_bound := 1/(0.0202 {kg/m^3});
185 u.lower_bound := 0 {kJ/kg};
186 u.upper_bound := 3663 {kJ/kg};
187
188 (* starting guesses *)
189 Re := 10000;
190 END values;
191
192 METHOD on_load;
193 RUN reset;
194 RUN values;
195 END on_load;
196
197 END dsg;

Properties

Name Value
svn:executable *

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