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