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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 748 - (show annotations) (download) (as text)
Tue Jul 11 05:54:26 2006 UTC (14 years, 1 month ago) by johnpye
File MIME type: text/x-ascend
File size: 3978 byte(s)
Lot of svn ignore tagging.
Little more work on DSG model.
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 T1,Tw,T2,Tamb IS_A temperature;
57 rho * v = 1;
58
59 thermo_props: iapws97_uvmux_ph(
60 p,h : INPUT;
61 u,v,mu,x : OUTPUT
62 );
63
64 vel = rho*mdot/A;
65
66 Re IS_A factor;
67 Re_rel: Re = rho*vel*D/mu;
68 eps_on_D IS_A factor;
69 eps_on_D_rel: eps_on_D = eps/D;
70
71 D IS_A distance;
72 eps IS_A distance;
73 A IS_A area;
74 A = 1{PI}* D^2 / 4;
75
76 friction: dsg_fric_factor_two_phase(
77 Re, eps_on_D : INPUT;
78 f : OUTPUT
79 );
80
81 phi2 IS_A factor;
82 x IS_A factor;
83 twophmult: dsg_phi2_martinelli_nelson(
84 p,x : INPUT;
85 phi2 : OUTPUT
86 );
87 (* TODO: compute LIQUID ONLY reynolds number when in the two-phase region...
88 that's a bit tricky and needs conditional modelling, so maybe try putting
89 it in the external code. *)
90
91 cavity_losses: dsg_ext_heat_loss(
92 T2,Tamb,D2,hw : INPUT;
93 qdotl : OUTPUT
94 );
95
96 Tw = (T1 + T2)/2;
97
98 mdoth IS_A solver_var;
99 mdoth = mdot * h;
100
101 rhovel2 IS_A solver_var;
102 rhovel2 = rho * vel^2;
103
104 METHODS
105
106 METHOD specify;
107 (* states *)
108 FIX T1, T2, p, h, mdot;
109 RUN fix_design;
110 RUN fix_temporals;
111 END specify;
112
113 METHOD fix_design;
114 (* design parameters, geometry, materials of construction *)
115 FIX rhow,D2,cw,hw;
116 FIX D, eps;
117 FIX qdots;
118 FIX Tamb;
119 END specify;
120
121 METHOD fix_spatials;
122 (* for use when tinkering about with a single node only *)
123 FIX dmdot_dz, dmdoth_dz, dekdot_dz, dp_dz, drhovel2_dz;
124 END fix_spatials;
125
126 METHOD fix_temporals;
127 (* for steady-state solution *)
128 FIX drho_dt;
129 FIX dmdot_dt;
130 FIX drhou_dt;
131 FIX dTw_dt;
132 END fix_temporals;
133
134 METHOD values;
135 (* design parameters *)
136 D := 60 {mm};
137 D2 := 70 {mm};
138 eps := 0.05 {mm};
139 rhow := 7.8 {g/cm^3};
140 cw := 0.47 {J/g/K};
141 hw := 10 {W/m^2/K};
142 Tamb := 300 {K};
143
144 (* states *)
145 T1 := 600 {K};
146 T2 := 500 {K};
147 p := 10 {bar};
148 h := 2000 {kJ/kg};
149 mdot := 0.001 {kg/s};
150
151 (* spatial derivs *)
152 dp_dz := -500 {Pa/m};
153 dmdot_dz := 0 {kg/s/m};
154 drhovel2_dz := (0 {kg/m^3}) * (0 {m/s})^2 / (1 {m});
155 dekdot_dz := 0 {W/m};
156 dmdoth_dz := dmdot_dz * 0 {kJ/kg};
157
158 (* derivative variables *)
159 drho_dt := 0 {kg/m^3/s};
160 dmdot_dt := 0 {kg/s/s};
161 drhou_dt := 0 {kg/m^3*kJ/kg/s};
162 dTw_dt := 0 {K/s};
163
164 (* bounds *)
165 f.lower_bound := 0.008;
166 v.lower_bound := 0.00999 {m^3/kg};
167 v.upper_bound := 1/(0.0202 {kg/m^3});
168 u.lower_bound := 0 {kJ/kg};
169 u.upper_bound := 3663 {kJ/kg};
170
171 (* starting guesses *)
172 Re := 10000;
173 END values;
174
175 METHOD on_load;
176 RUN reset;
177 RUN values;
178 END on_load;
179
180 END dsg;

Properties

Name Value
svn:executable *

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