source: mso/eml/heat_exchangers/HeatExchangerDiscretized.mso @ 45

Last change on this file since 45 was 45, checked in by gerson bicca, 16 years ago

updated heat exchanger model

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 54.7 KB
RevLine 
[1]1
[26]2#--------------------------------------------------------------------
3# Author: Gerson Balbueno Bicca
4# $Id: HeatExchangerDiscretized.mso 45 2006-11-07 16:11:10Z bicca $
5#--------------------------------------------------------------------
6
[1]7using "HEX_Engine";
8
[26]9#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]10#       Basic Model for Discretized Heat Exchangers
[26]11#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]12
13Model HeatExchangerDiscretized_Basic
14
15PARAMETERS
16
17ext PP      as CalcObject(Brief="External Physical Properties");
[45]18        HE          as CalcObject(Brief="STHE Calculations",File="heatex");
[1]19ext NComp   as Integer   (Brief="Number of Components");
20  M(NComp)  as molweight (Brief="Component Mol Weight");
21       
22VARIABLES
23
24in  Inlet           as Inlet_Main_Stream;       # Hot and Cold Inlets
25out Outlet      as Outlet_Main_Stream;  # Hot and Cold Outlets
26        Properties  as Main_Properties;         # Hot and Cold Properties
27        Details     as Details_Main;
[26]28        Tubes           as Tube_Side_Main;     
29        Shell           as Shell_Side_Main;
[1]30        Resistances as Main_Resistances;
31        Baffles     as Baffles_Main;
32       
33SET
34
35M   = PP.MolecularWeight();
36
37EQUATIONS
38
39"Hot Stream Average Temperature"
40        Properties.Hot.Average.T = 0.5*Inlet.Hot.T + 0.5*Outlet.Hot.T;
41       
42"Cold Stream Average Temperature"
43        Properties.Cold.Average.T = 0.5*Inlet.Cold.T + 0.5*Outlet.Cold.T;
44       
45"Hot Stream Average Pressure"
46        Properties.Hot.Average.P = 0.5*Inlet.Hot.P+0.5*Outlet.Hot.P;
47       
48"Cold Stream Average Pressure"
49        Properties.Cold.Average.P = 0.5*Inlet.Cold.P+0.5*Outlet.Cold.P;
50       
51"Hot Stream Average Molecular Weight"
52        Properties.Hot.Average.Mw = sum(M*Inlet.Hot.z);
53
54"Cold Stream Average Molecular Weight"
55        Properties.Cold.Average.Mw = sum(M*Inlet.Cold.z);
56       
57
58if Inlet.Cold.v equal 0
59       
60        then   
61       
62"Heat Capacity Cold Stream"
63        Properties.Cold.Average.Cp      =       PP.LiquidCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
64        Properties.Cold.Inlet.Cp        =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
65        Properties.Cold.Outlet.Cp       =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
66
67"Mass Density Cold Stream"
68        Properties.Cold.Average.rho =   PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
69        Properties.Cold.Inlet.rho       =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
70        Properties.Cold.Outlet.rho      =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
71
72"Viscosity Cold Stream"
73        Properties.Cold.Average.Mu =    PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
74        Properties.Cold.Inlet.Mu =              PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
75        Properties.Cold.Outlet.Mu =     PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
76
77"Conductivity Cold Stream"
78        Properties.Cold.Average.K =     PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
79        Properties.Cold.Inlet.K =               PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
80        Properties.Cold.Outlet.K =              PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
81
82"Heat Capacity Cold Stream"
83        Properties.Cold.Wall.Cp         =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
84       
85"Viscosity Cold Stream"
86        Properties.Cold.Wall.Mu =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
87
88"Conductivity Cold Stream"
89        Properties.Cold.Wall.K =        PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
90
91
92        else
93
94"Heat Capacity Cold Stream"
95        Properties.Cold.Average.Cp      =       PP.VapourCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
96        Properties.Cold.Inlet.Cp        =       PP.VapourCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
97        Properties.Cold.Outlet.Cp       =       PP.VapourCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
98
99"Mass Density Cold Stream"
100        Properties.Cold.Average.rho     =       PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
101        Properties.Cold.Inlet.rho       =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
102        Properties.Cold.Outlet.rho      =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
103
104"Viscosity Cold Stream"
105        Properties.Cold.Average.Mu =    PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
106        Properties.Cold.Inlet.Mu =              PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
107        Properties.Cold.Outlet.Mu =             PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
108
109"Conductivity Cold Stream"
110        Properties.Cold.Average.K =     PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
111        Properties.Cold.Inlet.K =               PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
112        Properties.Cold.Outlet.K =              PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
113       
114"Heat Capacity Cold Stream"
115        Properties.Cold.Wall.Cp         =       PP.VapourCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
116
117
118"Viscosity Cold Stream"
119        Properties.Cold.Wall.Mu =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
120
121"Conductivity Cold Stream"
122        Properties.Cold.Wall.K =        PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
123       
124       
125       
126end
127
128if Inlet.Hot.v equal 0
129
130        then
131
132"Heat Capacity Hot Stream"
133        Properties.Hot.Average.Cp       =               PP.LiquidCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
134        Properties.Hot.Inlet.Cp         =               PP.LiquidCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
135        Properties.Hot.Outlet.Cp        =               PP.LiquidCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
136
137"Mass Density Hot Stream"
138        Properties.Hot.Average.rho      =               PP.LiquidDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
139        Properties.Hot.Inlet.rho        =               PP.LiquidDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
140        Properties.Hot.Outlet.rho       =               PP.LiquidDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
141
142"Viscosity Hot Stream"
143        Properties.Hot.Average.Mu       =               PP.LiquidViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);     
144        Properties.Hot.Inlet.Mu         =               PP.LiquidViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);       
145        Properties.Hot.Outlet.Mu        =               PP.LiquidViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);     
146
147"Conductivity Hot Stream"
148        Properties.Hot.Average.K        =               PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
149        Properties.Hot.Inlet.K  =               PP.LiquidThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
150        Properties.Hot.Outlet.K         =               PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
151
152"Heat Capacity Hot Stream"
153        Properties.Hot.Wall.Cp  =               PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
154
155"Viscosity Hot Stream"
156        Properties.Hot.Wall.Mu  =               PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
157
158"Conductivity Hot Stream"
159        Properties.Hot.Wall.K   =               PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
160       
161
162        else
163
164"Heat Capacity Hot Stream"
165        Properties.Hot.Average.Cp       =               PP.VapourCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
166        Properties.Hot.Inlet.Cp         =               PP.VapourCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
167        Properties.Hot.Outlet.Cp        =               PP.VapourCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
168
169"Mass Density Hot Stream"
170        Properties.Hot.Average.rho      =               PP.VapourDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
171        Properties.Hot.Inlet.rho        =               PP.VapourDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
172        Properties.Hot.Outlet.rho       =               PP.VapourDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
173
174"Viscosity Hot Stream"
175        Properties.Hot.Average.Mu       =               PP.VapourViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
176        Properties.Hot.Inlet.Mu         =               PP.VapourViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
177        Properties.Hot.Outlet.Mu        =               PP.VapourViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
178
179"Conductivity Hot Stream"
180        Properties.Hot.Average.K        =               PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
181        Properties.Hot.Inlet.K  =               PP.VapourThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
182        Properties.Hot.Outlet.K         =               PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
183
184"Heat Capacity Hot Stream"
185        Properties.Hot.Wall.Cp  =               PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
186
187"Viscosity Hot Stream"
188        Properties.Hot.Wall.Mu  =               PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
189
190"Conductivity Hot Stream"
191        Properties.Hot.Wall.K   =               PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
192
193
194end
195
[26]196#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]197#       Thermal Details
[26]198#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]199"Hot Stream Heat Capacity"
200        Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
201       
202"Cold Stream Heat Capacity"
203        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
204       
[26]205"Minimum Heat Capacity"
206        Details.Cmin  = min([Details.Ch,Details.Cc]);
207
208"Maximum Heat Capacity"
209        Details.Cmax  = max([Details.Ch,Details.Cc]);
210
[1]211"Heat Capacity Ratio"
[26]212        Details.Cr    = Details.Cmin/Details.Cmax;
213       
214#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]215#       Energy Balance
[26]216#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]217"Energy Balance Hot Stream"
218        Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
219
220"Energy Balance Cold Stream"
221        Details.Q =-Inlet.Cold.F*(Inlet.Cold.h-Outlet.Cold.h);
222
[26]223#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]224#       Material Balance
[26]225#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]226"Flow Mass Inlet Cold Stream"
227        Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
228
229"Flow Mass Outlet Cold Stream"
230        Properties.Cold.Outlet.Fw       =  sum(M*Outlet.Cold.z)*Outlet.Cold.F;
231
232"Flow Mass Inlet Hot Stream"
233        Properties.Hot.Inlet.Fw         =  sum(M*Inlet.Hot.z)*Inlet.Hot.F;
234
235"Flow Mass Outlet Hot Stream"   
236        Properties.Hot.Outlet.Fw        =  sum(M*Outlet.Hot.z)*Outlet.Hot.F;
237
238"Molar Balance Hot Stream"
239        Inlet.Hot.F  = Outlet.Hot.F;
240       
241"Molar Balance Cold Stream"
242        Inlet.Cold.F = Outlet.Cold.F;
243
[26]244#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]245#       Constraints
[26]246#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]247"Hot Stream Molar Fraction Constraint"
248        Outlet.Hot.z=Inlet.Hot.z;
249       
250"Cold Stream Molar Fraction Constraint"
251        Outlet.Cold.z=Inlet.Cold.z;
252       
253"No Phase Change In Cold Stream"
254        Inlet.Cold.v=Outlet.Cold.v;
255
256"No Phase Change In Hot Stream"
257        Inlet.Hot.v=Outlet.Hot.v;
258
259       
260end
261
[26]262Model Heatex_Discretized_NTU            as HeatExchangerDiscretized_Basic
263       
264VARIABLES
265
266Eft             as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
267       
268EQUATIONS
269
270"Exchange Surface Area"
271        Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
272
273"TEMA E Shell Effectiveness"
274        Eft = HE.EshellEffectiveness(Details.Cr,Details.NTU);
275       
276end
277
[1]278Model Heatex_Discretized_LMTD           as HeatExchangerDiscretized_Basic
279       
280VARIABLES
[45]281DT0     as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
282DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
283LMTD    as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
284Fc              as positive             (Brief="LMTD Correction Factor",Lower=0.5);
285MTD             as temp_delta   (Brief="Mean Temperature Difference",Lower=1);
[1]286
287EQUATIONS
288"Exchange Surface Area"
289        Details.Q   = Details.U*Details.A*MTD;
290       
291"Mean Temperature Difference"   
292        MTD   = Fc*LMTD;
293       
[45]294#"LMTD Correction Factor"
295#       Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
[1]296
[45]297"Temperature Difference at Inlet"
298        DT0 = Inlet.Hot.T - Outlet.Cold.T;
[1]299
[45]300"Temperature Difference at Outlet"
301        DTL = Outlet.Hot.T - Inlet.Cold.T;
302#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
303#                       Log Mean Temperature Difference
304#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
305if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
306       
307        then
308"Log Mean Temperature Difference"
309        LMTD= (DT0-DTL)/ln(DT0/DTL);
310
311        else
312       
313if DT0*DTL equal 0
314       
315        then
316"Log Mean Temperature Difference"
317        LMTD = 0.5*(DT0+DTL);
318       
319        else
320"Log Mean Temperature Difference"
321        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
322       
[1]323end
[45]324       
325end
[1]326
[45]327       
328end
329
[1]330Model Profiles
331
332PARAMETERS
333
[26]334Zones   as Integer(Brief="Number of Zones");
[1]335
336VARIABLES
337
[26]338Lz(Zones)               as length                       (Brief="Zone Tube Length");
339Area                            as area                         (Brief="Area Total");
340Q                               as power                        (Brief="Total Duty");
341PdropTubesNozzle        as pressure                     (Brief="Total Tube Nozzles Pressure Drop");
342PdropTubes                      as pressure                     (Brief="Total Tube Pressure Drop");
343PdropWin                        as pressure                     (Brief="Total Shell Side Window Pressure Drop");
344PdropCross                      as pressure                     (Brief="Total Shell Side Cross Flow Pressure Drop");
345PdropEnds                       as pressure                     (Brief="Total Shell Side Ends Pressure Drop");
346PdropShellNozzle        as pressure                     (Brief="Total Shell Side Nozzles Pressure Drop");
347PdropShell                      as pressure                     (Brief="Total Shell Side Pressure Drop");
348Uaverage                        as heat_trans_coeff (Brief="Average Overall Heat Transfer Coefficient",Default=1,Lower=1e-6,Upper=1e10);
349hshellaverage           as heat_trans_coeff     (Brief="Average Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
350htubeaverage            as heat_trans_coeff     (Brief="Average Tube Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
351Thot(Zones)             as temperature          (Brief="Hot Temperature",Lower = 300, Upper = 500);
352Tcold(Zones)            as temperature          (Brief="Cold Temperature",Lower = 300, Upper = 500);
353Phot(Zones)             as pressure                     (Brief="Hot Pressure",Lower = 0.8, Upper = 30);
354Pcold(Zones)            as pressure                     (Brief="Cold Pressure",Lower = 0.8, Upper = 30);
[1]355
356end
357
[26]358Model E_Shell_NTU_Disc           
359#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
360#       Shell and Tubes Heat Exchanger with 1 shell pass - NTU Method
361#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]362PARAMETERS
363
[45]364        HE      as CalcObject   (Brief="STHE Calculations",File="heatex");
[26]365ext PP  as CalcObject   (Brief="External Physical Properties");
366side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
367Pi              as constant     (Brief="Pi Number",Default=3.14159265);
[1]368
[26]369#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]370#       Shell Geometrical Parameters
[26]371#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]372Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
373Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
374Dishell                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
375Donozzle_Shell  as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
376Dinozzle_Shell  as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
377Hinozzle_Shell  as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
378Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
379Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
[26]380#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]381#       Tubes Geometrical Parameters
[26]382#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]383Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
384Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
385Ltube                   as length               (Brief="Effective Tube Length",Lower=0.1);
386pitch                   as length               (Brief="Tube Pitch",Lower=1e-8);
387Kwall                   as conductivity (Brief="Tube Wall Material Thermal Conductivity");
388Dotube                  as length               (Brief="Tube Outside Diameter",Lower=10e-6);
389Ditube                  as length               (Brief="Tube Inside Diameter",Lower=10e-6);
390Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
391Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
[26]392#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]393#       Baffles Geometrical Parameters
[26]394#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]395Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
396Nb              as Integer              (Brief="Number of Baffles",Default=4);
397Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
398Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
[26]399#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]400VARIABLES
401
[26]402Unity(Nb+1)     as Heatex_Discretized_NTU;
[1]403Sumary          as Profiles;
404
405CONNECTIONS
406
407Unity([1:Nb]).Outlet.Hot  to Unity([2:Nb+1]).Inlet.Hot;
408Unity([2:Nb+1]).Outlet.Cold to Unity([1:Nb]).Inlet.Cold;
409
410EQUATIONS
411
[26]412"Hot Temperatures"
413        Sumary.Thot     = Unity.Outlet.Hot.T;
[1]414       
[26]415"Cold Temperatures"
416        Sumary.Tcold    = Unity.Outlet.Cold.T ;
[1]417
[26]418"Hot Pressures"
419        Sumary.Phot     = Unity.Outlet.Hot.P ;
420       
421"Cold Pressures"
422        Sumary.Pcold    = Unity.Outlet.Cold.P ;
[1]423
[26]424"Average Shell Side Film Coefficient"
425        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
[1]426
[26]427"Average Tube Side Film Coefficient"
428        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
[1]429
[26]430"Average Overall Heat Transfer Coefficient"
431        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
432
433"Area Total"
434        Sumary.Area                             = sum(Unity.Details.A);
435
436"Duty Total"
437        Sumary.Q                                = sum(Unity.Details.Q);
438
439"Length Inlet zone"
440        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
441
442"Length Outlet zone"
443        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
444
445"Total Shell Side Pressure Drop"
446        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
447
448"Total Tube Side Pressure Drop"
449        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
450
451"Total Tube Side Nozzles Pressure Drop"
452        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
453
454"Total Shell Side Nozzles Pressure Drop"
455        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
456
457"Total Shell Side Window Pressure Drop"
458        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
459
460"Total Shell Side Cross Flow Pressure Drop"
461        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
462
463"Total Shell Side Ends Pressure Drop"
464        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
465
[1]466"Shell Side Cross Flow Area"
467        Unity(1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(1).Baffles.Lsi);
468       
469"Shell Side Cross Flow Area"
470        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
471
[26]472
[1]473if side equal 1
474       
475        then
[26]476       
477"Shell Side inlet Nozzle rho-V^2"
478        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
[1]479
[26]480"Shell Side Outlet Nozzle rho-V^2"
481        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
[1]482
[26]483"Shell Pressure End Zones"
484        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
485        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
[1]486
[26]487"Shell Pressure End Zones"
488        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
489        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Hot.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Hot.Average.rho);
490
[1]491"Pressure Drop Tube Side Inlet Nozzle"
[26]492        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
[1]493
494"Velocity Tube Side Inlet Nozzle"
[26]495        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
[1]496
497"Pressure Drop Tube Side Outlet Nozzle"
[26]498        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
[1]499
500"Velocity Tube Side Outlet Nozzle"
[26]501        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
[1]502
503"Shell Pressure Drop Inlet Nozzle"
[26]504        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
[1]505
506"Velocity Shell Side Inlet Nozzle"
[26]507        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
[1]508
509"Shell Pressure Drop Outlet Nozzle"
[26]510        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
[1]511
512"Velocity Shell Side Outlet Nozzle"
[26]513        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
514       
[1]515
516        else
517       
[26]518"Shell Side inlet Nozzle rho-V^2"
519        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
[1]520
[26]521"Shell Side Outlet Nozzle rho-V^2"
522        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
523
524"Shell Pressure End Zones"
525        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
526        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
527
528"Shell Pressure End Zones"
529        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
530        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Cold.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Cold.Average.rho);
531
532
[1]533"Pressure Drop Tube Side Inlet Nozzle"
[26]534        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
[1]535
536"Velocity Tube Side Inlet Nozzle"
[26]537        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
[1]538
539"Pressure Drop Tube Side Outlet Nozzle"
[26]540        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
[1]541
542"Velocity Tube Side Outlet Nozzle"
[26]543        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
[1]544
545"Shell Pressure Drop Inlet Nozzle"
[26]546        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
[1]547
548"Velocity Shell Side Inlet Nozzle"
[26]549        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
[1]550
551"Shell Pressure Drop Outlet Nozzle"
[26]552        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
[1]553
554"Velocity Shell Side Outlet Nozzle"
[26]555        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
[1]556
[26]557
[1]558end
559
560
561for i in [2:Nb]
562
[26]563"Pressure Drop Tube Side Inlet Nozzle"
564        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
565
566"Velocity Tube Side Inlet Nozzle"
567        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
568
569"Pressure Drop Tube Side Outlet Nozzle"
570        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
571
572"Velocity Tube Side Outlet Nozzle"
573        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
574
575"Shell Pressure Drop Inlet Nozzle"
576        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
577
578"Velocity Shell Side Inlet Nozzle"
579        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
580
581"Shell Pressure Drop Outlet Nozzle"
582        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
583
584"Velocity Shell Side Outlet Nozzle"
585        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
586
587"Shell Pressure End Zones"
588        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
589       
590"Shell Side Outlet Nozzle rho-V^2"
591        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
592       
593"Shell Side inlet Nozzle rho-V^2"
594        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
595
[1]596if side equal 1
597       
598        then
599       
[26]600"Shell Pressure Drop Cross Flow"
601        Unity(i).Shell.PressureDrop.PdCross             =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
[1]602
603
604        else
605
[26]606"Shell Pressure Drop Cross Flow"
607        Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
[1]608
609
610end
611
[26]612"Zone Length"
[1]613        Sumary.Lz(i) = Unity(1).Baffles.Ls;
614
615"Shell Side Cross Flow Area"
616        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
[26]617       
[1]618end
619
620
621for i in [1:Nb+1]
622       
[26]623if side equal 1
[1]624       
[26]625        then
626"Pressure Drop Hot Stream"
627        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
[1]628
[26]629"Pressure Drop Cold Stream"
630        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
[1]631       
632"Shell Side Reynolds Number"
[45]633        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
[1]634
635"Shell Heat Transfer Coefficient"
[45]636        Unity(i).Shell.HeatTransfer.hshell =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
[1]637
638
639"Shell Pressure Baffle Window"
[26]640        Unity(i).Shell.PressureDrop.Pdwindow            =       HE.DeltaPwindowIncremental(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
[1]641
[26]642"Hot Wall Temperature"
643        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
[1]644
[26]645"Cold Wall Temperature"
646        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
[1]647
648"Tube Side Velocity"
[45]649        Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
[1]650
651"Tube Side Reynolds Number"
[45]652        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
[1]653       
654"Tube Side Prandtl Number"
[45]655        Unity(i).Tubes.HeatTransfer.PR          = ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
[1]656
657"Tube Side Prandtl Number at Wall"
[45]658        Unity(i).Tubes.HeatTransfer.PRw         =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
[1]659
660"Tube Side Film Coefficient"
[45]661        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
[1]662       
663"Shell Side Prandtl Number"
[45]664        Unity(i).Shell.HeatTransfer.PR          =       ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
[1]665
666"Shell Side Prandtl Number at Wall"
[45]667        Unity(i).Shell.HeatTransfer.PRw         =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K; 
[1]668
669"Tube Side Pressure Drop"
[26]670        Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
[1]671        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
672       
673"Shell Side Phi correction for viscosity"
[26]674        Unity(i).Shell.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
[1]675       
676"Tube Side Phi correction for viscosity"
[26]677        Unity(i).Tubes.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
[1]678       
679        else
[26]680
681"Pressure Drop Hot Stream"
682        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
[1]683       
[26]684"Pressure Drop Cold Stream"
685        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
686       
[1]687"Shell Side Reynolds Number"
[45]688        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
[1]689
690"Shell Heat Transfer Coefficient"
[45]691        Unity(i).Shell.HeatTransfer.hshell      =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*
692        (Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
[1]693
694
695"Shell Pressure Baffle Window"
[26]696        Unity(i).Shell.PressureDrop.Pdwindow    =       HE.DeltaPwindowIncremental(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
[1]697
[26]698"Hot Wall Temperature"
699        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
[1]700
[26]701"Cold Wall Temperature"
702        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
[1]703
704"Tube Side Velocity"
[45]705        Unity(i).Tubes.HeatTransfer.Vtube               = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
[1]706
707"Tube Side Reynolds Number"
[45]708        Unity(i).Tubes.HeatTransfer.Re                  =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
[1]709       
710"Tube Side Prandtl Number"
[45]711        Unity(i).Tubes.HeatTransfer.PR                  =       ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
[26]712       
[1]713"Tube Side Prandtl Number at Wall"
[45]714        Unity(i).Tubes.HeatTransfer.PRw                 =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
[26]715       
[1]716"Tube Side Film Coefficient"
[45]717        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
[1]718       
719"Shell Side Prandtl Number"
[45]720        Unity(i).Shell.HeatTransfer.PR                  =       ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
[1]721
722"Shell Side Prandtl Number at Wall"
[45]723        Unity(i).Shell.HeatTransfer.PRw                 =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
[1]724
725"Tube Side Pressure Drop"
[26]726        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
[1]727        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
728
729"Shell Side Phi correction for viscosity"
730        Unity(i).Shell.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
731       
732"Tube Side Phi correction for viscosity"
733        Unity(i).Tubes.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
734
735end
736
737"Tube Resistance"       
738        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
739       
740"Wall Resistance"
741        Unity(i).Resistances.Rwall      =       Dotube*ln(Dotube/Ditube)/(2*Kwall);
742       
743"Shell Resistance"
744        Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)        =       1;
745       
746"Overall Heat Transfer Coefficient"
747        Unity(i).Details.U      =       1/(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)));
748
749"Exchange Surface Area"
750        Unity(i).Details.A      =       Pi*Dotube*Ntt*Sumary.Lz(i);
751
752"Baffles Spacing"
753        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
754       
755
[26]756"Js Factor"     
757        Unity(i).Shell.HeatTransfer.Js                  =       1;
758       
759"Ji Factor"
760        Unity(i).Shell.HeatTransfer.Ji                  =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
761
762"Jc Factor"
763        Unity(i).Shell.HeatTransfer.Jc                  =       HE.JcFactor();
764       
765"Jl Factor"
766        Unity(i).Shell.HeatTransfer.Jl                  =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
767
768"Jb Factor"
769        Unity(i).Shell.HeatTransfer.Jb                  =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
770
771"Jr Factor"     
772        Unity(i).Shell.HeatTransfer.Jr                  =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
773       
774"Total J Factor"
775        Unity(i).Shell.HeatTransfer.Jtotal              =       Unity(i).Shell.HeatTransfer.Jc*Unity(i).Shell.HeatTransfer.Jl*Unity(i).Shell.HeatTransfer.Jb*Unity(i).Shell.HeatTransfer.Jr*Unity(i).Shell.HeatTransfer.Js;
[1]776end
777
[26]778
779"Velocity Tube Side Inlet Nozzle"
780        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
781
782"Velocity Tube Side Outlet Nozzle"
783        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
784       
785"Tube Pressure Drop Inlet Nozzle"
786        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
787
788"Tube Pressure Drop Outlet Nozzle"
789        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
790
791"Velocity Shell Side Inlet Nozzle"
792        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
793
794"Velocity Shell Side Outlet Nozzle"
795        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
796       
797"Shell Pressure Drop Inlet Nozzle"
798        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
799       
800"Shell Pressure Drop Outlet Nozzle"
801        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
802
803"Shell Cross Flow Pressure Drop"
804        Unity(1).Shell.PressureDrop.PdCross             = 0;
805       
806"Shell Cross Flow Pressure Drop"
807        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
808       
809"Shell Side Outlet Nozzle rho-V^2"
810        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
811       
812"Shell Side inlet Nozzle rho-V^2"
813        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
814
[1]815SET
[26]816#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
817#  Set Parameters for heatex Calculation
818#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]819        Sumary.Zones        = Nb+1;
820        Pi                              = 3.14159265;
821        HE.Tpass                        = Tpass;
822        HE.Nss                          = Nss;
823        HE.Ntt                          = Ntt;
824        HE.Pattern                      = Pattern;
825        HE.Bc                           = Bc;
826        HE.Donozzle_Shell       = Donozzle_Shell;
827        HE.Dinozzle_Shell       = Dinozzle_Shell;
828        HE.Honozzle_Shell       = Honozzle_Shell;
829        HE.Hinozzle_Shell       = Hinozzle_Shell;
830        HE.Donozzle_Tube        = Donozzle_Tube;
831        HE.Dinozzle_Tube        = Dinozzle_Tube;
832        HE.Nb                       = Nb;
833        HE.Dishell                      = Dishell;             
834        HE.Lcf                          = Lcf; 
835        HE.pitch                        = pitch;               
836        HE.Dotube                       = Dotube;       
837        HE.Ditube                       = Ditube;       
838        HE.Lcd                          = Lcd;
839        HE.Ltd                          = Ltd;
840        side                            = HE.FluidAlocation();
841end
842
[26]843Model E_Shell_LMTD_Disc         
844#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
845#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
846#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]847PARAMETERS
848
[45]849        HE      as CalcObject   (Brief="STHE Calculations",File="heatex");
[26]850ext PP  as CalcObject   (Brief="External Physical Properties");
[1]851side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
[26]852Pi              as constant     (Brief="Pi Number",Default=3.14159265);
[1]853
[26]854#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]855#       Shell Geometrical Parameters
[26]856#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]857Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
858Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
859Dishell                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
860Donozzle_Shell  as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
861Dinozzle_Shell  as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
862Hinozzle_Shell  as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
863Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
864Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
[26]865#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]866#       Tubes Geometrical Parameters
[26]867#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]868Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
869Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
870Ltube                   as length               (Brief="Effective Tube Length",Lower=0.1);
871pitch                   as length               (Brief="Tube Pitch",Lower=1e-8);
872Kwall                   as conductivity (Brief="Tube Wall Material Thermal Conductivity");
873Dotube                  as length               (Brief="Tube Outside Diameter",Lower=10e-6);
874Ditube                  as length               (Brief="Tube Inside Diameter",Lower=10e-6);
875Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
876Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
[26]877#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]878#       Baffles Geometrical Parameters
[26]879#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]880Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
881Nb              as Integer              (Brief="Number of Baffles",Default=4);
882Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
883Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
[26]884#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]885VARIABLES
886
[26]887Unity(Nb+1)     as Heatex_Discretized_LMTD;
[1]888Sumary          as Profiles;
889
890CONNECTIONS
891
[26]892Unity([1:Nb]).Outlet.Hot        to Unity([2:Nb+1]).Inlet.Hot;
[1]893Unity([2:Nb+1]).Outlet.Cold to Unity([1:Nb]).Inlet.Cold;
894
895EQUATIONS
896
[26]897"Hot Temperatures"
898        Sumary.Thot     = Unity.Outlet.Hot.T;
899       
900"Cold Temperatures"
901        Sumary.Tcold    = Unity.Outlet.Cold.T ;
[1]902
[26]903"Hot Pressures"
904        Sumary.Phot     = Unity.Outlet.Hot.P ;
905       
906"Cold Pressures"
907        Sumary.Pcold    = Unity.Outlet.Cold.P ;
[1]908
[26]909"Average Shell Side Film Coefficient"
910        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
911
912"Average Tube Side Film Coefficient"
913        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
914
915"Average Overall Heat Transfer Coefficient"
916        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
917
918"Area Total"
919        Sumary.Area                             = sum(Unity.Details.A);
920
921"Duty Total"
922        Sumary.Q                                = sum(Unity.Details.Q);
923
924"Length Inlet zone"
925        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
926
927"Length Outlet zone"
928        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
929
930"Total Shell Side Pressure Drop"
931        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
932
933"Total Tube Side Pressure Drop"
934        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
935
936"Total Tube Side Nozzles Pressure Drop"
937        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
938
939"Total Shell Side Nozzles Pressure Drop"
940        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
941
942"Total Shell Side Window Pressure Drop"
943        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
944
945"Total Shell Side Cross Flow Pressure Drop"
946        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
947
948"Total Shell Side Ends Pressure Drop"
949        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
950
[1]951"Shell Side Cross Flow Area"
952        Unity(1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(1).Baffles.Lsi);
953       
954"Shell Side Cross Flow Area"
955        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
956
[45]957"LMTD Correction Factor"
958        Unity.Fc = HE.EshellCorrectionFactor(Unity(1).Inlet.Hot.T,Unity(Nb+1).Outlet.Hot.T,Unity(Nb+1).Inlet.Cold.T,Unity(1).Outlet.Cold.T);
[1]959
960if side equal 1
961       
962        then
[26]963
964"Shell Side inlet Nozzle rho-V^2"
965        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
966
967"Shell Side Outlet Nozzle rho-V^2"
968        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
969
970"Shell Pressure End Zones"
971        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
972        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
973
974"Shell Pressure End Zones"
975        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
976        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Hot.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Hot.Average.rho);
977
[1]978"Pressure Drop Tube Side Inlet Nozzle"
[26]979        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
[1]980
981"Velocity Tube Side Inlet Nozzle"
[26]982        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
[1]983
984"Pressure Drop Tube Side Outlet Nozzle"
[26]985        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
[1]986
987"Velocity Tube Side Outlet Nozzle"
[26]988        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
[1]989
990"Shell Pressure Drop Inlet Nozzle"
[26]991        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
[1]992
993"Velocity Shell Side Inlet Nozzle"
[26]994        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
[1]995
996"Shell Pressure Drop Outlet Nozzle"
[26]997        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
[1]998
999"Velocity Shell Side Outlet Nozzle"
[26]1000        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
[1]1001       
1002
[26]1003        else
[1]1004
[26]1005"Shell Side inlet Nozzle rho-V^2"
1006        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
[1]1007
[26]1008"Shell Side Outlet Nozzle rho-V^2"
1009        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
[1]1010
[26]1011"Shell Pressure End Zones"
1012        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
1013        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
1014
1015"Shell Pressure End Zones"
1016        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
1017        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Cold.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Cold.Average.rho);
1018
1019
[1]1020"Pressure Drop Tube Side Inlet Nozzle"
[26]1021        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
[1]1022
1023"Velocity Tube Side Inlet Nozzle"
[26]1024        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
[1]1025
1026"Pressure Drop Tube Side Outlet Nozzle"
[26]1027        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
[1]1028
1029"Velocity Tube Side Outlet Nozzle"
[26]1030        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
[1]1031
1032"Shell Pressure Drop Inlet Nozzle"
[26]1033        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
[1]1034
1035"Velocity Shell Side Inlet Nozzle"
[26]1036        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
[1]1037
1038"Shell Pressure Drop Outlet Nozzle"
[26]1039        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
[1]1040
1041"Velocity Shell Side Outlet Nozzle"
[26]1042        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
[1]1043
1044
1045end
1046
1047
1048for i in [2:Nb]
1049
[26]1050"Pressure Drop Tube Side Inlet Nozzle"
1051        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
[1]1052
[26]1053"Velocity Tube Side Inlet Nozzle"
1054        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
1055
1056"Pressure Drop Tube Side Outlet Nozzle"
1057        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
1058
1059"Velocity Tube Side Outlet Nozzle"
1060        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
1061
1062"Shell Pressure Drop Inlet Nozzle"
1063        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
1064
1065"Velocity Shell Side Inlet Nozzle"
1066        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
1067
1068"Shell Pressure Drop Outlet Nozzle"
1069        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
1070
1071"Velocity Shell Side Outlet Nozzle"
1072        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
1073
1074"Shell Pressure End Zones"
1075        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
1076
1077"Shell Side Outlet Nozzle rho-V^2"
1078        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
1079       
1080"Shell Side inlet Nozzle rho-V^2"
1081        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
1082       
[1]1083if side equal 1
1084       
1085        then
1086       
[26]1087"Shell Pressure Drop Cross Flow"
1088        Unity(i).Shell.PressureDrop.PdCross             =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
[1]1089
1090
1091        else
1092
[26]1093"Shell Pressure Drop Cross Flow"
1094        Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
[1]1095
1096
1097end
1098
[26]1099"Zone Length"
1100        Sumary.Lz(i) = Unity(1).Baffles.Ls;
[1]1101
1102"Shell Side Cross Flow Area"
1103        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
1104       
1105end
1106
1107
1108for i in [1:Nb+1]
[45]1109
1110
[1]1111if side equal 1
1112       
1113        then
[26]1114"Pressure Drop Hot Stream"
1115        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
[1]1116
[26]1117"Pressure Drop Cold Stream"
1118        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
1119       
[1]1120"Shell Side Reynolds Number"
[45]1121        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
[1]1122
1123"Shell Heat Transfer Coefficient"
[45]1124        Unity(i).Shell.HeatTransfer.hshell =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
[1]1125
1126"Shell Pressure Baffle Window"
1127        Unity(i).Shell.PressureDrop.Pdwindow            =       HE.DeltaPwindowIncremental(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
1128
[26]1129"Hot Wall Temperature"
[1]1130        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1131       
[26]1132"Cold Wall Temperature"
[1]1133        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1134
1135"Tube Side Velocity"
[45]1136        Unity(i).Tubes.HeatTransfer.Vtube       =       Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
[1]1137
1138"Tube Side Reynolds Number"
[45]1139        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
[1]1140       
1141"Tube Side Prandtl Number"
[45]1142        Unity(i).Tubes.HeatTransfer.PR          =       ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
[1]1143
1144"Tube Side Prandtl Number at Wall"
[45]1145        Unity(i).Tubes.HeatTransfer.PRw         =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
[1]1146
1147"Tube Side Film Coefficient"
[45]1148        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
[1]1149       
1150"Shell Side Prandtl Number"
[45]1151        Unity(i).Shell.HeatTransfer.PR          =       ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
[1]1152
1153"Shell Side Prandtl Number at Wall"
[45]1154        Unity(i).Shell.HeatTransfer.PRw         =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K; 
[1]1155
1156"Tube Side Pressure Drop"
1157        Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
1158        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
1159       
1160"Shell Side Phi correction for viscosity"
1161        Unity(i).Shell.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
1162       
1163"Tube Side Phi correction for viscosity"
1164        Unity(i).Tubes.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1165       
1166        else
1167
[26]1168"Pressure Drop Hot Stream"
1169        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
1170       
1171"Pressure Drop Cold Stream"
1172        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
1173       
[1]1174"Shell Side Reynolds Number"
[45]1175        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
[1]1176
1177"Shell Heat Transfer Coefficient"
[45]1178        Unity(i).Shell.HeatTransfer.hshell      =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*
1179        (Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
[1]1180
1181
1182"Shell Pressure Baffle Window"
1183        Unity(i).Shell.PressureDrop.Pdwindow    =       HE.DeltaPwindowIncremental(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
1184
1185
[26]1186"Hot Wall Temperature"
[1]1187        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1188       
[26]1189"Cold Wall Temperature"
[1]1190        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1191
1192"Tube Side Velocity"
[45]1193        Unity(i).Tubes.HeatTransfer.Vtube               = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
[1]1194
1195"Tube Side Reynolds Number"
[45]1196        Unity(i).Tubes.HeatTransfer.Re                  =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
[1]1197       
1198"Tube Side Prandtl Number"
[45]1199        Unity(i).Tubes.HeatTransfer.PR                  =((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
[1]1200       
1201"Tube Side Prandtl Number at Wall"
[45]1202        Unity(i).Tubes.HeatTransfer.PRw                 =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
[1]1203       
1204       
1205"Tube Side Film Coefficient"
[45]1206        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
[1]1207       
1208"Shell Side Prandtl Number"
[45]1209        Unity(i).Shell.HeatTransfer.PR                  =       ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
[1]1210
1211"Shell Side Prandtl Number at Wall"
[45]1212        Unity(i).Shell.HeatTransfer.PRw                 =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
[1]1213
1214"Tube Side Pressure Drop"
1215        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
1216        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
1217
1218"Shell Side Phi correction for viscosity"
1219        Unity(i).Shell.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1220       
1221"Tube Side Phi correction for viscosity"
1222        Unity(i).Tubes.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
1223
1224end
1225
1226"Tube Resistance"       
1227        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
1228       
1229"Wall Resistance"
1230        Unity(i).Resistances.Rwall      =       Dotube*ln(Dotube/Ditube)/(2*Kwall);
1231       
1232"Shell Resistance"
1233        Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)        =       1;
1234       
1235"Overall Heat Transfer Coefficient"
1236        Unity(i).Details.U      =       1/(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)));
1237
1238"Exchange Surface Area"
1239        Unity(i).Details.A      =       Pi*Dotube*Ntt*Sumary.Lz(i);
1240
1241"Baffles Spacing"
1242        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
1243
1244"Js Factor"     
[26]1245        Unity(i).Shell.HeatTransfer.Js                  =       1;
[1]1246
1247"Ji Factor"
1248        Unity(i).Shell.HeatTransfer.Ji                  =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
1249
1250"Jc Factor"
1251        Unity(i).Shell.HeatTransfer.Jc                  =       HE.JcFactor();
1252       
1253"Jl Factor"
1254        Unity(i).Shell.HeatTransfer.Jl                  =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
1255
1256"Jb Factor"
1257        Unity(i).Shell.HeatTransfer.Jb                  =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
1258
1259"Jr Factor"     
1260        Unity(i).Shell.HeatTransfer.Jr                  =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
1261       
1262"Total J Factor"
1263        Unity(i).Shell.HeatTransfer.Jtotal              =       Unity(i).Shell.HeatTransfer.Jc*Unity(i).Shell.HeatTransfer.Jl*Unity(i).Shell.HeatTransfer.Jb*Unity(i).Shell.HeatTransfer.Jr*Unity(i).Shell.HeatTransfer.Js;
1264end
1265
[26]1266"Velocity Tube Side Inlet Nozzle"
1267        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
[1]1268
[26]1269"Velocity Tube Side Outlet Nozzle"
1270        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
1271       
1272"Tube Pressure Drop Inlet Nozzle"
1273        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
1274
1275"Tube Pressure Drop Outlet Nozzle"
1276        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
1277
1278"Velocity Shell Side Inlet Nozzle"
1279        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
1280
1281"Velocity Shell Side Outlet Nozzle"
1282        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
1283       
1284"Shell Pressure Drop Inlet Nozzle"
1285        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
1286       
1287"Shell Pressure Drop Outlet Nozzle"
1288        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
1289
1290"Shell Cross Flow Pressure Drop"
1291        Unity(1).Shell.PressureDrop.PdCross             = 0;
1292       
1293"Shell Cross Flow Pressure Drop"
1294        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
1295       
1296"Shell Side Outlet Nozzle rho-V^2"
1297        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
1298       
1299"Shell Side inlet Nozzle rho-V^2"
1300        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
1301
[1]1302SET
[26]1303#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]1304#  Set Parameters for heatex Calculation
[26]1305#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
[1]1306        Sumary.Zones        = Nb+1;
1307        Pi                              = 3.14159265;
1308        HE.Tpass                        = Tpass;
1309        HE.Nss                          = Nss;
1310        HE.Ntt                          = Ntt;
1311        HE.Pattern                      = Pattern;
1312        HE.Bc                           = Bc;
1313        HE.Donozzle_Shell       = Donozzle_Shell;
1314        HE.Dinozzle_Shell       = Dinozzle_Shell;
1315        HE.Honozzle_Shell       = Honozzle_Shell;
1316        HE.Hinozzle_Shell       = Hinozzle_Shell;
1317        HE.Donozzle_Tube        = Donozzle_Tube;
1318        HE.Dinozzle_Tube        = Dinozzle_Tube;
1319        HE.Nb                       = Nb;
1320        HE.Dishell                      = Dishell;             
1321        HE.Lcf                          = Lcf; 
1322        HE.pitch                        = pitch;               
1323        HE.Dotube                       = Dotube;       
1324        HE.Ditube                       = Ditube;       
1325        HE.Lcd                          = Lcd;
1326        HE.Ltd                          = Ltd;
1327        side                            = HE.FluidAlocation();
1328end
Note: See TracBrowser for help on using the repository browser.