source: trunk/eml/heat_exchangers/HeatExchangerDetailed.mso @ 251

Last change on this file since 251 was 251, checked in by gerson bicca, 15 years ago

updated shell and tubes heat exchanger model - new implementation in switcher parameter

File size: 43.8 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*--------------------------------------------------------------------
16* Author: Gerson Balbueno Bicca
17* $Id: HeatExchangerDetailed.mso 197 2007-03-08 14:31:57Z bicca $
18*------------------------------------------------------------------*#
19using "heat_exchangers/HEX_Engine";
20
21Model ShellandTubesBasic
22
23ATTRIBUTES
24        Pallete = false;
25        Brief  = "Basic Model for Detailed Shell and Tubes Heat Exchangers";
26        Info  =
27        "write some information";
28
29PARAMETERS
30
31HotSide                 as Switcher     (Brief="Hot Side in the Exchanger",Valid=["shell","tubes"],Default="shell");
32ShellType       as Switcher     (Brief="TEMA Designation",Valid=["Eshell","Fshell"],Default="Eshell");
33
34VARIABLES
35
36in      InletTube               as stream               (Brief="Inlet Tube Stream");
37out     OutletTube              as streamPH     (Brief="Outlet Tube Stream");
38in      InletShell              as stream               (Brief="Inlet Shell Stream");
39out     OutletShell                     as streamPH     (Brief="Outlet Shell Stream");
40       
41        Details                 as Details_Main                 (Brief="Details in Heat Exchanger");
42        Tubes                           as Tube_Side_Main       (Brief="Tube Side");   
43        Shell                           as Shell_Side_Main      (Brief="Shell Side");
44        Baffles                 as Baffles_Main                 (Brief="Baffles");
45
46#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
47#                               Auxiliar Variables - Must be hidden                                             
48#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
49        Nc      as Real         (Brief = "Number of Tube rows Crossed in one Crossflow Section",Lower=1);
50        Ncw     as Real         (Brief = "Number of Effective Crossflow rows in Each Window",Lower=1);
51        a               as Real         (Brief = "Variable for calculating Ji heat transfer correction Factor",Lower=1e-3);
52        b               as Real         (Brief = "Variable for calculating shell side pressure drop friction Factor",Lower=1e-3);
53        Rb      as Real         (Brief = "ByPass Correction Factor for Pressure Drop",Lower=1e-3);
54        Rss     as Real         (Brief = "Correction Factor for Pressure Drop",Lower=1e-3);
55        Rspd    as Real         (Brief = "Pressure Drop Correction Factor for Unequal Baffle Spacing",Lower=1e-3);
56        mw      as Real         (Brief = "Mass Velocity in Window Zone", Unit='kg/m^2/s');
57       
58PARAMETERS
59outer PP                as Plugin               (Brief="External Physical Properties",Type = "PP");
60outer NComp     as Integer      (Brief="Number of Components");
61       
62        Pi                              as constant    (Brief="Pi Number",Default=3.14159265);
63        M(NComp)  as molweight  (Brief="Component Mol Weight");
64
65TubeFlowRegime           as Switcher    (Brief="Tube Side Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
66ShellFlowRegime                  as Switcher    (Brief="Shell Side Flow Regime ",Valid=["deep laminar","laminar","turbulent"],Default="deep laminar");
67ShellRange                       as Switcher    (Brief="Shell Side Flow Regime Range for Correction Factor",Valid=["range1","range2","range3", "range4","range5"],Default="range1");
68Side                                             as Switcher    (Brief="Flag for Fluid Alocation ",Valid=["shell","tubes"],Default="shell");
69LaminarCorrelation       as Switcher    (Brief="Tube Heat Transfer Correlation in Laminar Flow",Valid=["Hausen","Schlunder"],Default="Hausen");
70TransitionCorrelation  as Switcher      (Brief="Tube Heat Transfer Correlation in Transition Flow",Valid=["Gnielinski","ESDU"],Default="Gnielinski");
71TurbulentCorrelation  as Switcher       (Brief="Tube Heat Transfer Correlation in Turbulent Flow",Valid=["Petukhov","SiederTate"],Default="Petukhov");
72
73#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
74#                               Shell Geometrical Parameters                                           
75#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
76Tpass                                   as Integer              (Brief="Number of Tube Passes",Lower=1);
77Nss                                     as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
78Dishell                                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
79Donozzle_Shell          as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
80Dinozzle_Shell          as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
81Aonozzle_Shell          as area                 (Brief="Shell Outlet Nozzle Area",Lower=10e-6);
82Ainozzle_Shell          as area                 (Brief="Shell Inlet Nozzle Area",Lower=10e-6);
83Aeonozzle_Shell         as area                 (Brief="Shell Outlet Escape Area Under Nozzle",Lower=10e-6);
84Aeinozzle_Shell         as area                 (Brief="Shell Inlet Escape Area Under Nozzle",Lower=10e-6);
85Hinozzle_Shell          as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
86Honozzle_Shell          as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
87Lcf                                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
88
89#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
90#                               Tubes Geometrical Parameters                                           
91#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
92Ntt                                     as Integer                      (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
93Pattern                 as Switcher             (Brief="Tube Layout Characteristic Angle",Valid=["30","45","90"],Default="30");
94Ltube                                   as length                       (Brief="Effective Tube Length",Lower=0.1);
95pitch                           as length                       (Brief="Tube Pitch",Lower=1e-8);
96Kwall                                   as conductivity         (Brief="Tube Wall Material Thermal Conductivity");
97Dotube                                  as length                       (Brief="Tube Outside Diameter",Lower=10e-6);
98Ditube                          as length                       (Brief="Tube Inside Diameter",Lower=10e-6);
99Donozzle_Tube   as length                       (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
100Dinozzle_Tube   as length                       (Brief="Tube Inlet Nozzle Diameter",Lower=10e-6);
101Aonozzle_Tube   as area                         (Brief="Tube Outlet Nozzle Area",Lower=10e-6);
102Ainozzle_Tube   as area                         (Brief="Tube Inlet Nozzle Area",Lower=10e-6);
103Kinlet_Tube             as positive                     (Brief="Tube Inlet Nozzle Pressure Loss Coeff",Default=1.1);
104Koutlet_Tube    as positive                     (Brief="Tube Outlet Nozzle Pressure Loss Coeff",Default=0.7);
105
106#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
107#                               Baffles Geometrical Parameters                                         
108#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
109Bc      as Integer      (Brief="Baffle Cut",Default=25,Lower=25);
110Nb      as Real         (Brief="Number of Baffles",Lower=1);
111Lcd     as length       (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
112Ltd             as length       (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
113
114#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
115#                               Fouling                                         
116#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
117Rfi                     as positive     (Brief="Inside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
118Rfo             as positive     (Brief="Outside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
119
120#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
121#                               Auxiliar Parameters - Must be hidden                                           
122#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
123Ods     as Real                 (Brief="Baffle Cut Angle in Degrees");
124Octl    as Real                 (Brief="Baffle Cut Angle relative to the centerline in Degrees");
125Ftw     as Real                 (Brief="Fraction of Number of Tubes in Baffle Window");
126Scd     as area         (Brief="Shell to Baffle Leakage Area");
127Std     as area         (Brief="Tube to Baffle Hole Leakage Area");
128Rs              as Real                 (Brief="Ratio of the shell to baffle leakage area");
129Dw    as length         (Brief="Hydraulic diameter of the baffle window");
130
131SET
132
133        M                                               = PP.MolecularWeight();
134        Pi                                              = 3.14159265;
135
136#"comments"
137        Ods     = (360/Pi)*acos(1-0.02*Bc);
138
139#"comments"
140        Octl    = (360/Pi)*acos((Dishell/(Dishell - Lcf - Dotube))*(1-0.02*Bc));
141
142#"comments"
143        Ftw     = (Octl/360)-sin(Octl*Pi/180)/(2*Pi);
144
145#"comments"
146        Scd     = Pi*Dishell*Lcd*((360-Ods)/720);
147
148#"comments"
149        Std     = Pi*0.25*((Ltd + Dotube)^2-Dotube*Dotube)*Ntt*(1-Ftw);
150
151#"comments"
152        Rs              = Scd/(Scd+Std);
153
154#"comments"
155        Dw      = (4*abs((Pi*Dishell*Dishell*((Ods/360)-sin(Ods*Pi/180)/(2*Pi))/4)-(Ntt*Pi*Dotube*Dotube*Ftw/4)))/(Pi*Dotube*Ntt*Ftw+ Pi*Dishell*Ods/360);
156
157#"Tube Side Inlet Nozzle Area"
158        Ainozzle_Tube = (Pi*Dinozzle_Tube*Dinozzle_Tube)/4;
159
160#"Tube Side Outlet Nozzle Area"
161        Aonozzle_Tube = (Pi*Donozzle_Tube*Donozzle_Tube)/4;
162
163#"Tube Inlet Nozzle Pressure Loss Coeff"
164        Kinlet_Tube   = 1.1;
165
166#"Tube Outlet Nozzle Pressure Loss Coeff"
167        Koutlet_Tube  = 0.7;
168
169#"Shell Outlet Nozzle Area"
170        Aonozzle_Shell  = (Pi*Donozzle_Shell*Donozzle_Shell)/4;
171
172#"Shell Inlet Nozzle Area"
173        Ainozzle_Shell  = (Pi*Dinozzle_Shell*Dinozzle_Shell)/4;
174
175#"Shell Outlet Escape Area Under Nozzle"
176        Aeonozzle_Shell = Pi*Donozzle_Shell*Honozzle_Shell + 0.6*Aonozzle_Shell*(1-(Dotube/pitch));
177
178#"Shell Inlet Escape Area Under Nozzle"
179        Aeinozzle_Shell = Pi*Dinozzle_Shell*Hinozzle_Shell + 0.6*Ainozzle_Shell*(1-(Dotube/pitch));
180
181EQUATIONS
182
183"Shell Stream Average Temperature"
184        Shell.Properties.Average.T = 0.5*InletShell.T + 0.5*OutletShell.T;
185       
186"Tube Stream Average Temperature"
187        Tubes.Properties.Average.T = 0.5*OutletTube.T + 0.5*OutletTube.T;
188       
189"Shell Stream Average Pressure"
190        Shell.Properties.Average.P = 0.5*InletShell.P+0.5*OutletShell.P;
191       
192"Tube Stream Average Pressure"
193        Tubes.Properties.Average.P = 0.5*OutletTube.P+0.5*OutletTube.P;
194       
195"Shell Stream Average Molecular Weight"
196        Shell.Properties.Average.Mw = sum(M*InletShell.z);
197
198"Tube Stream Average Molecular Weight"
199        Tubes.Properties.Average.Mw = sum(M*OutletTube.z);
200       
201if InletTube.v equal 0
202       
203        then   
204       
205"Tube Stream Average Heat Capacity"
206        Tubes.Properties.Average.Cp     =       PP.LiquidCp(Tubes.Properties.Average.T,Tubes.Properties.Average.P,OutletTube.z);
207
208"Tube Stream Inlet Heat Capacity"
209        Tubes.Properties.Inlet.Cp       =       PP.LiquidCp(OutletTube.T,OutletTube.P,OutletTube.z);
210
211"Tube Stream Outlet Heat Capacity"
212        Tubes.Properties.Outlet.Cp      =       PP.LiquidCp(OutletTube.T,OutletTube.P,OutletTube.z);
213
214"Tube Stream Average Mass Density"
215        Tubes.Properties.Average.rho =  PP.LiquidDensity(Tubes.Properties.Average.T,Tubes.Properties.Average.P,OutletTube.z);
216
217"Tube Stream Inlet Mass Density"
218        Tubes.Properties.Inlet.rho      =       PP.LiquidDensity(OutletTube.T,OutletTube.P,OutletTube.z);
219
220"Tube Stream Outlet Mass Density"
221        Tubes.Properties.Outlet.rho     =       PP.LiquidDensity(OutletTube.T,OutletTube.P,OutletTube.z);
222
223"TubeStream Average Viscosity"
224        Tubes.Properties.Average.Mu     =       PP.LiquidViscosity(Tubes.Properties.Average.T,Tubes.Properties.Average.P,OutletTube.z);
225
226"Tube Stream inlet Viscosity"
227        Tubes.Properties.Inlet.Mu       =       PP.LiquidViscosity(OutletTube.T,OutletTube.P,OutletTube.z);
228       
229"Tube Stream Outlet Viscosity"
230        Tubes.Properties.Outlet.Mu      =       PP.LiquidViscosity(OutletTube.T,OutletTube.P,OutletTube.z);
231
232"Tube Stream Average Conductivity"
233        Tubes.Properties.Average.K      =       PP.LiquidThermalConductivity(Tubes.Properties.Average.T,Tubes.Properties.Average.P,OutletTube.z);
234
235"Tube Stream Inlet Conductivity"       
236        Tubes.Properties.Inlet.K        =       PP.LiquidThermalConductivity(OutletTube.T,OutletTube.P,OutletTube.z);
237
238"Tube Stream Outlet Conductivity"
239        Tubes.Properties.Outlet.K       =       PP.LiquidThermalConductivity(OutletTube.T,OutletTube.P,OutletTube.z);
240
241"Tube Stream Viscosity at Wall Temperature"
242        Tubes.Properties.Wall.Mu        =       PP.LiquidViscosity(Tubes.Properties.Wall.Twall,Tubes.Properties.Average.P,OutletTube.z);
243
244        else
245
246"Tube Stream Average Heat Capacity"
247        Tubes.Properties.Average.Cp     =       PP.VapourCp(Tubes.Properties.Average.T,Tubes.Properties.Average.P,OutletTube.z);
248
249"Tube Stream Inlet Heat Capacity"       
250        Tubes.Properties.Inlet.Cp       =       PP.VapourCp(OutletTube.T,OutletTube.P,OutletTube.z);
251
252"Tube Stream Outlet Heat Capacity"     
253        Tubes.Properties.Outlet.Cp      =       PP.VapourCp(OutletTube.T,OutletTube.P,OutletTube.z);
254
255"Tube Stream Average Mass Density"
256        Tubes.Properties.Average.rho =  PP.VapourDensity(Tubes.Properties.Average.T,Tubes.Properties.Average.P,OutletTube.z);
257
258"Tube Stream Inlet Mass Density"
259        Tubes.Properties.Inlet.rho      =       PP.VapourDensity(OutletTube.T,OutletTube.P,OutletTube.z);
260
261"Tube Stream Outlet Mass Density"       
262        Tubes.Properties.Outlet.rho     =       PP.VapourDensity(OutletTube.T,OutletTube.P,OutletTube.z);
263
264"Tube Stream Average Viscosity "
265        Tubes.Properties.Average.Mu     =       PP.VapourViscosity(Tubes.Properties.Average.T,Tubes.Properties.Average.P,OutletTube.z);
266
267"Tube Stream Inlet Viscosity " 
268        Tubes.Properties.Inlet.Mu       =       PP.VapourViscosity(OutletTube.T,OutletTube.P,OutletTube.z);
269
270"Tube Stream Outlet Viscosity "
271        Tubes.Properties.Outlet.Mu      =       PP.VapourViscosity(OutletTube.T,OutletTube.P,OutletTube.z);
272
273"Tube Stream Average Conductivity "
274        Tubes.Properties.Average.K      =       PP.VapourThermalConductivity(Tubes.Properties.Average.T,Tubes.Properties.Average.P,OutletTube.z);
275
276"Tube Stream Inlet Conductivity "
277        Tubes.Properties.Inlet.K        =       PP.VapourThermalConductivity(OutletTube.T,OutletTube.P,OutletTube.z);
278
279"Tube Stream Outlet Conductivity "
280        Tubes.Properties.Outlet.K       =       PP.VapourThermalConductivity(OutletTube.T,OutletTube.P,OutletTube.z);
281       
282"Tube Stream Viscosity at Wall Temperature"
283        Tubes.Properties.Wall.Mu        =       PP.VapourViscosity(Tubes.Properties.Wall.Twall,Tubes.Properties.Average.P,OutletTube.z);
284
285end
286
287if InletShell.v equal 0
288
289        then
290
291"Shell Stream Average Heat Capacity"
292        Shell.Properties.Average.Cp     =               PP.LiquidCp(Shell.Properties.Average.T,Shell.Properties.Average.P,InletShell.z);
293
294"Shell Stream Inlet Heat Capacity"
295        Shell.Properties.Inlet.Cp       =               PP.LiquidCp(InletShell.T,InletShell.P,InletShell.z);
296
297"Shell Stream Outlet Heat Capacity"
298        Shell.Properties.Outlet.Cp      =               PP.LiquidCp(OutletShell.T,OutletShell.P,OutletShell.z);
299
300"Shell Stream Average Mass Density"
301        Shell.Properties.Average.rho    =               PP.LiquidDensity(Shell.Properties.Average.T,Shell.Properties.Average.P,InletShell.z);
302
303"ShellStream Inlet Mass Density"       
304        Shell.Properties.Inlet.rho      =               PP.LiquidDensity(InletShell.T,InletShell.P,InletShell.z);
305
306"Shell Stream Outlet Mass Density"     
307        Shell.Properties.Outlet.rho     =               PP.LiquidDensity(OutletShell.T,OutletShell.P,OutletShell.z);
308
309"Shell Stream Average Viscosity"
310        Shell.Properties.Average.Mu     =               PP.LiquidViscosity(Shell.Properties.Average.T,Shell.Properties.Average.P,InletShell.z);
311
312"Shell Stream Inlet Viscosity"
313        Shell.Properties.Inlet.Mu       =               PP.LiquidViscosity(InletShell.T,InletShell.P,InletShell.z);     
314
315"Shell Stream Outlet Viscosity"
316        Shell.Properties.Outlet.Mu      =               PP.LiquidViscosity(OutletShell.T,OutletShell.P,OutletShell.z); 
317
318"Shell Stream Average Conductivity"
319        Shell.Properties.Average.K      =               PP.LiquidThermalConductivity(Shell.Properties.Average.T,Shell.Properties.Average.P,InletShell.z);       
320
321"Shell Stream Inlet Conductivity"
322        Shell.Properties.Inlet.K                =               PP.LiquidThermalConductivity(InletShell.T,InletShell.P,InletShell.z);   
323
324"Shell Stream Outlet Conductivity"
325        Shell.Properties.Outlet.K       =               PP.LiquidThermalConductivity(OutletShell.T,OutletShell.P,OutletShell.z);       
326
327"ShellStream Viscosity  at Wall Temperature"
328        Shell.Properties.Wall.Mu                =               PP.LiquidViscosity(Shell.Properties.Wall.Twall,Shell.Properties.Average.P,InletShell.z);       
329
330
331        else
332
333"Shell Stream Average Heat Capacity"
334        Shell.Properties.Average.Cp     =               PP.VapourCp(Shell.Properties.Average.T,Shell.Properties.Average.P,InletShell.z);
335
336"Shell Stream Inlet Heat Capacity"
337        Shell.Properties.Inlet.Cp       =               PP.VapourCp(InletShell.T,InletShell.P,InletShell.z);
338
339"Shell Stream Outlet Heat Capacity"
340        Shell.Properties.Outlet.Cp      =               PP.VapourCp(OutletShell.T,OutletShell.P,OutletShell.z);
341
342"Shell Stream Average Mass Density"
343        Shell.Properties.Average.rho    =               PP.VapourDensity(Shell.Properties.Average.T,Shell.Properties.Average.P,InletShell.z);
344
345"Shell Stream Inlet Mass Density"       
346        Shell.Properties.Inlet.rho      =               PP.VapourDensity(InletShell.T,InletShell.P,InletShell.z);
347
348"Shell Stream Outlet Mass Density"
349        Shell.Properties.Outlet.rho     =               PP.VapourDensity(OutletShell.T,OutletShell.P,OutletShell.z);
350
351"Shell Stream Average Viscosity"
352        Shell.Properties.Average.Mu     =               PP.VapourViscosity(Shell.Properties.Average.T,Shell.Properties.Average.P,InletShell.z);
353
354"Shell Stream Inlet Viscosity"
355        Shell.Properties.Inlet.Mu       =               PP.VapourViscosity(InletShell.T,InletShell.P,InletShell.z);
356
357"Shell Stream Outlet Viscosity"
358        Shell.Properties.Outlet.Mu      =               PP.VapourViscosity(OutletShell.T,OutletShell.P,OutletShell.z);
359
360"Shell Stream Average Conductivity"
361        Shell.Properties.Average.K      =               PP.VapourThermalConductivity(Shell.Properties.Average.T,Shell.Properties.Average.P,InletShell.z);       
362
363"Shell Stream Inlet Conductivity"
364        Shell.Properties.Inlet.K                =               PP.VapourThermalConductivity(InletShell.T,InletShell.P,InletShell.z);   
365       
366"Shell Stream Outlet Conductivity"
367        Shell.Properties.Outlet.K       =               PP.VapourThermalConductivity(OutletShell.T,OutletShell.P,OutletShell.z);       
368
369"Shell Stream Viscosity at Wall Temperature"
370        Shell.Properties.Wall.Mu                =               PP.VapourViscosity(Shell.Properties.Wall.Twall,Shell.Properties.Average.P,InletShell.z);
371
372end
373
374switch Side
375       
376        case "shell":
377       
378"Energy Balance Hot Stream"
379        Details.Q = InletShell.F*(InletShell.h-OutletShell.h);
380
381"Energy Balance Cold Stream"
382        Details.Q =-InletTube.F*(InletTube.h-OutletTube.h);
383
384        when InletTube.T > InletShell.T switchto "tubes";
385
386        case "tubes":
387       
388"Energy Balance Hot Stream"
389        Details.Q = InletTube.F*(InletTube.h-OutletTube.h);
390
391"Energy Balance Cold Stream"
392        Details.Q =-InletShell.F*(InletShell.h-OutletShell.h);
393       
394        when InletTube.T < InletShell.T switchto "shell";
395       
396end
397
398"Flow Mass Inlet Tube Stream"
399        Tubes.Properties.Inlet.Fw               =  sum(M*InletTube.z)*InletTube.F;
400
401"Flow Mass Outlet Tube Stream"
402        Tubes.Properties.Outlet.Fw      =  sum(M*OutletTube.z)*OutletTube.F;
403
404"Flow Mass Inlet Shell Stream"
405        Shell.Properties.Inlet.Fw               =  sum(M*InletShell.z)*InletShell.F;
406
407"Flow Mass Outlet Shell Stream"
408        Shell.Properties.Outlet.Fw              =  sum(M*OutletShell.z)*OutletShell.F;
409
410"Molar Balance Shell Stream"
411        OutletShell.F  = InletShell.F;
412       
413"Molar Balance Tube Stream"
414        OutletTube.F = InletTube.F;
415
416"Shell  Stream Molar Fraction Constraint"
417        OutletShell.z=InletShell.z;
418       
419"Tube Stream Molar Fraction Constraint"
420        OutletTube.z=InletTube.z;
421       
422"Jc Factor"
423        Shell.HeatTransfer.Jc = 0.55+0.72*(1-2*Ftw);
424
425"Jl Factor"
426        Shell.HeatTransfer.Jl = 0.44*(1-Rs)+(1-0.44*(1-Rs))*exp(-2.2*(Scd + Std)/Shell.HeatTransfer.Sm);
427
428"Total J Factor"
429        Shell.HeatTransfer.Jtotal = Shell.HeatTransfer.Jc*Shell.HeatTransfer.Jl*Shell.HeatTransfer.Jb*Shell.HeatTransfer.Jr*Shell.HeatTransfer.Js;
430
431"Mass Velocity in Window Zone"
432        mw      = Shell.Properties.Inlet.Fw/sqrt(abs(Shell.HeatTransfer.Sm*abs((Pi*Dishell*Dishell*((Ods/360)-sin(Ods*Pi/180)/(2*Pi))/4)-(Ntt*Pi*Dotube*Dotube*Ftw/4))));
433
434switch TubeFlowRegime
435       
436        case "laminar":
437       
438"Friction Factor for heat Transfer: Not Necessary in Laminar Correlation - Use any one equation that you want"
439        Tubes.HeatTransfer.fi   = 16/Tubes.HeatTransfer.Re;
440       
441"Friction Factor for Pressure Drop in Laminar Flow"
442        Tubes.PressureDrop.fi   = 16/Tubes.HeatTransfer.Re;
443       
444switch LaminarCorrelation
445       
446        case "Hausen":
447
448"Nusselt Number in Laminar Flow - Hausen Equation"
449        Tubes.HeatTransfer.Nu = 3.665 + ((0.19*((Ditube/Ltube)*Tubes.HeatTransfer.Re*Tubes.HeatTransfer.PR)^0.8)/(1+0.117*((Ditube/Ltube)*Tubes.HeatTransfer.Re*Tubes.HeatTransfer.PR)^0.467));
450       
451        case "Schlunder":
452       
453"Nusselt Number in Laminar Flow - Schlunder Equation"
454        Tubes.HeatTransfer.Nu = (49.027896+4.173281*Tubes.HeatTransfer.Re*Tubes.HeatTransfer.PR*(Ditube/Ltube))^(1/3);
455
456end
457       
458        when Tubes.HeatTransfer.Re > 2300 switchto "transition";
459       
460        case "transition":
461       
462"Friction Factor for heat Transfer : for use in Gnielinski Equation"
463        Tubes.HeatTransfer.fi   = 1/(0.79*ln(Tubes.HeatTransfer.Re)-1.64)^2;
464       
465"Friction Factor for Pressure Drop in Transition Flow"
466        Tubes.PressureDrop.fi   = 0.0122;
467       
468switch TransitionCorrelation
469       
470        case "Gnielinski":
471       
472"Nusselt Number in Transition Flow - Gnielinski Equation"
473        Tubes.HeatTransfer.Nu*(1+(12.7*sqrt(0.125*Tubes.HeatTransfer.fi)*((Tubes.HeatTransfer.PR)^(2/3) -1))) = 0.125*Tubes.HeatTransfer.fi*(Tubes.HeatTransfer.Re-1000)*Tubes.HeatTransfer.PR;
474
475        case "ESDU":
476       
477"Nusselt Number in Transition Flow - ESDU Equation"
478        Tubes.HeatTransfer.Nu =1;#to be implemented
479       
480end
481
482        when Tubes.HeatTransfer.Re < 2300 switchto "laminar";
483        when Tubes.HeatTransfer.Re > 10000 switchto "turbulent";
484
485        case "turbulent":
486
487"Friction Factor for heat Transfer : for use in Petukhov Equation"
488        Tubes.HeatTransfer.fi   = 1/(1.82*log(Tubes.HeatTransfer.Re)-1.64)^2;
489
490"Friction Factor for Pressure Drop in Turbulent Flow"
491        Tubes.PressureDrop.fi   = 0.0035 + 0.264*Tubes.HeatTransfer.Re^(-0.42);
492
493switch TurbulentCorrelation
494       
495        case "Petukhov":
496       
497"Nusselt Number in Turbulent Flow - Petukhov Equation"
498        Tubes.HeatTransfer.Nu*(1.07+(12.7*sqrt(0.125*Tubes.HeatTransfer.fi)*((Tubes.HeatTransfer.PR)^(2/3) -1))) = 0.125*Tubes.HeatTransfer.fi*Tubes.HeatTransfer.Re*Tubes.HeatTransfer.PR;
499       
500        case "SiederTate":
501
502"Nusselt Number in Transition Flow - Sieder Tate Equation"
503        Tubes.HeatTransfer.Nu = 0.027*(Tubes.HeatTransfer.PR)^(1/3)*(Tubes.HeatTransfer.Re)^(4/5);
504
505end
506       
507        when Tubes.HeatTransfer.Re < 10000 switchto "transition";
508
509end
510
511switch Pattern
512       
513case "30":
514
515"Shell Side Cross Flow Area"
516        Shell.HeatTransfer.Sm= Baffles.Ls*(Lcf+((Dishell-Lcf-Dotube)/pitch)*(pitch-Dotube));
517
518"Number of Tube rows Crossed in one Crossflow Section"
519        Nc      = Dishell*(1-0.02*Bc)/(0.866*pitch);
520
521"Number of Effective Crossflow rows in Each Window"
522        Ncw = 0.8*(Dishell*0.01*Bc-(Lcf + Dotube)*0.5)/(0.866*pitch);
523
524"Variable for calculating Ji heat transfer correction Factor"
525        a       =       1.45/(1+0.14*Shell.HeatTransfer.Re^0.519);
526       
527"Variable for calculating Shell Side Pressure Drop Friction Factor"
528        b=7/(1+0.14*Shell.HeatTransfer.Re^0.5);
529
530"Correction Factor for Pressure Drop"
531        Rss     = Nss/(Dishell*(1-0.02*Bc)/(0.866*pitch)) ;
532       
533"Ideal Shell Side Pressure Drop"
534        Shell.PressureDrop.Pideal= 2*Shell.PressureDrop.fi*(Dishell*(1-0.02*Bc)/(0.866*pitch))*(Shell.Properties.Inlet.Fw/Shell.HeatTransfer.Sm)^2/(Shell.Properties.Average.rho*Shell.HeatTransfer.Phi);
535
536"Shell Pressure End Zones"
537        Shell.PressureDrop.PdEndZones = Shell.PressureDrop.Pideal*(1+ (Ncw/(Dishell*(1-0.02*Bc)/(0.866*pitch))))*Rb*Rspd;
538
539switch ShellRange
540       
541        case "range1":
542       
543"Ji Factor"
544        Shell.HeatTransfer.Ji =1.40*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^0.667;
545       
546"Shell Side Pressure Drop Friction Factor"
547        Shell.PressureDrop.fi=48*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-1;
548       
549        when Shell.HeatTransfer.Re > 10 switchto "range2";
550       
551        case "range2":
552       
553"Ji Factor"
554        Shell.HeatTransfer.Ji =1.36*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^-0.657;
555       
556"Shell Side Pressure Drop Friction Factor"
557        Shell.PressureDrop.fi=45.10*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-0.973;
558       
559        when Shell.HeatTransfer.Re > 100 switchto "range3";
560       
561        case "range3":
562
563"Ji Factor"
564        Shell.HeatTransfer.Ji =0.593*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^-0.477;
565       
566"Shell Side Pressure Drop Friction Factor"
567        Shell.PressureDrop.fi=4.570*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-0.476;
568       
569        when Shell.HeatTransfer.Re > 1000 switchto "range4";
570       
571        case "range4":
572
573"Ji Factor"
574        Shell.HeatTransfer.Ji =0.321*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^-0.388;
575       
576"Shell Side Pressure Drop Friction Factor"
577        Shell.PressureDrop.fi=0.486*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-0.152;
578
579        when Shell.HeatTransfer.Re > 10000 switchto "range5";
580
581        case "range5":
582
583"Ji Factor"
584        Shell.HeatTransfer.Ji =0.321*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^-0.388;
585
586"Shell Side Pressure Drop Friction Factor"
587        Shell.PressureDrop.fi=0.372*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-0.123;
588       
589        when Shell.HeatTransfer.Re < 10000 switchto "range4";
590       
591end
592
593case "45":
594
595"Shell Side Cross Flow Area"
596        Shell.HeatTransfer.Sm= Baffles.Ls*(Lcf+((Dishell-Lcf-Dotube)/(0.707*pitch))*(pitch-Dotube));
597
598"Number of Tube rows Crossed in one Crossflow Section"
599        Nc      = Dishell*(1-0.02*Bc)/(0.707*pitch);
600
601"Number of Effective Crossflow rows in Each Window"
602        Ncw = 0.8*(Dishell*0.01*Bc-(Lcf + Dotube)*0.5)/(0.707*pitch);
603
604"Variable for calculating Ji heat transfer correction Factor"
605        a       =       1.930/(1+0.14*Shell.HeatTransfer.Re^0.500);
606
607"Variable for calculating Shell Side Pressure Drop Friction Factor"
608        b=6.59/(1+0.14*Shell.HeatTransfer.Re^0.52);
609
610"Correction Factor for Pressure Drop"
611        Rss     = Nss/(Dishell*(1-0.02*Bc)/(0.707*pitch)) ;
612
613"Ideal Shell Side Pressure Drop"
614        Shell.PressureDrop.Pideal= 2*Shell.PressureDrop.fi*(Dishell*(1-0.02*Bc)/(0.707*pitch))*(Shell.Properties.Inlet.Fw/Shell.HeatTransfer.Sm)^2/(Shell.Properties.Average.rho*Shell.HeatTransfer.Phi);
615
616"Shell Pressure End Zones"
617        Shell.PressureDrop.PdEndZones = Shell.PressureDrop.Pideal*(1+ (Ncw/(Dishell*(1-0.02*Bc)/(0.707*pitch))))*Rb*Rspd;
618
619switch ShellRange
620       
621        case "range1":
622
623"Ji Factor"
624        Shell.HeatTransfer.Ji =1.550*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^0.667;
625
626"Shell Side Pressure Drop Friction Factor"
627        Shell.PressureDrop.fi=32*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-1;
628       
629        when Shell.HeatTransfer.Re > 10 switchto "range2";
630       
631        case "range2":
632
633"Ji Factor"
634        Shell.HeatTransfer.Ji =0.498*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^0.656;
635
636"Shell Side Pressure Drop Friction Factor"
637        Shell.PressureDrop.fi=26.20*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-0.913;
638       
639        when Shell.HeatTransfer.Re > 100 switchto "range3";
640       
641        case "range3":
642
643"Ji Factor"
644        Shell.HeatTransfer.Ji =0.730*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^0.500;
645
646"Shell Side Pressure Drop Friction Factor"
647        Shell.PressureDrop.fi=3.50*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-0.476;
648       
649        when Shell.HeatTransfer.Re > 1000 switchto "range4";
650       
651        case "range4":
652       
653"Ji Factor"
654        Shell.HeatTransfer.Ji =0.370*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^-0.396;
655       
656"Shell Side Pressure Drop Friction Factor"
657        Shell.PressureDrop.fi=0.333*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-0.136;
658
659        when Shell.HeatTransfer.Re > 10000 switchto "range5";
660
661        case "range5":
662
663"Ji Factor"
664        Shell.HeatTransfer.Ji =0.370*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^-0.396;
665       
666"Shell Side Pressure Drop Friction Factor"
667        Shell.PressureDrop.fi=0.303*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-0.126;
668       
669        when Shell.HeatTransfer.Re < 10000 switchto "range4";
670       
671end
672
673case "90":
674
675"Shell Side Cross Flow Area"
676        Shell.HeatTransfer.Sm= Baffles.Ls*(Lcf+((Dishell-Lcf-Dotube)/pitch)*(pitch-Dotube));
677
678"Number of Tube rows Crossed in one Crossflow Section"
679        Nc      = Dishell*(1-0.02*Bc)/pitch;
680       
681"Number of Effective Crossflow rows in Each Window"
682        Ncw = 0.8*(Dishell*0.01*Bc-(Lcf + Dotube)*0.5)/pitch;
683
684"Variable for calculating Ji heat transfer correction Factor"
685        a       =       1.187/(1+0.14*Shell.HeatTransfer.Re^0.370);
686
687"Variable for calculating Shell Side Pressure Drop Friction Factor"
688        b=6.30/(1+0.14*Shell.HeatTransfer.Re^0.38);
689
690"Correction Factor for Pressure Drop"
691        Rss     = Nss/(Dishell*(1-0.02*Bc)/pitch) ;
692
693"Ideal Shell Side Pressure Drop"
694        Shell.PressureDrop.Pideal= 2*Shell.PressureDrop.fi*(Dishell*(1-0.02*Bc)/pitch)*(Shell.Properties.Inlet.Fw/Shell.HeatTransfer.Sm)^2/(Shell.Properties.Average.rho*Shell.HeatTransfer.Phi);
695
696"Shell Pressure End Zones"
697        Shell.PressureDrop.PdEndZones = Shell.PressureDrop.Pideal*(1+ (Ncw/(Dishell*(1-0.02*Bc)/pitch)))*Rb*Rspd;
698
699switch ShellRange
700       
701        case "range1":
702
703"Ji Factor"
704        Shell.HeatTransfer.Ji =0.970*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^-0.667;
705       
706"Shell Side Pressure Drop Friction Factor"     
707        Shell.PressureDrop.fi=35*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-1;
708
709        when Shell.HeatTransfer.Re > 10 switchto "range2";
710       
711        case "range2":
712
713"Ji Factor"
714        Shell.HeatTransfer.Ji =0.900*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^-0.631;
715
716"Shell Side Pressure Drop Friction Factor"     
717        Shell.PressureDrop.fi=32.10*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-0.963;
718
719        when Shell.HeatTransfer.Re > 100 switchto "range3";
720       
721        case "range3":
722
723"Ji Factor"
724        Shell.HeatTransfer.Ji =0.408*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^-0.460;
725
726"Shell Side Pressure Drop Friction Factor"     
727        Shell.PressureDrop.fi=6.090*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-0.602;
728
729        when Shell.HeatTransfer.Re > 1000 switchto "range4";
730       
731        case "range4":
732       
733"Ji Factor"
734        Shell.HeatTransfer.Ji =0.107*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^-0.266;
735
736"Shell Side Pressure Drop Friction Factor"     
737        Shell.PressureDrop.fi=0.0815*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^0.022;
738
739        when Shell.HeatTransfer.Re > 10000 switchto "range5";
740
741        case "range5":
742       
743"Ji Factor"
744        Shell.HeatTransfer.Ji =0.370*((1.33*Dotube/pitch)^a)*Shell.HeatTransfer.Re^-0.395;
745
746"Shell Side Pressure Drop Friction Factor"     
747        Shell.PressureDrop.fi=0.391*((1.33*Dotube/pitch)^b)*Shell.HeatTransfer.Re^-0.148;
748
749        when Shell.HeatTransfer.Re < 10000 switchto "range4";
750       
751end
752
753end
754
755switch ShellFlowRegime
756
757        case "deep laminar":
758
759"Jr Factor"     
760        Shell.HeatTransfer.Jr = (10/((Nc +Ncw)*(Nb+1)))^0.18;
761
762"Js Factor"
763        Shell.HeatTransfer.Js = (Nb-1+(Baffles.Lsi/Baffles.Ls)^0.7 + (Baffles.Lso/Baffles.Ls)^0.7)/(Nb-1+(Baffles.Lsi/Baffles.Ls) + (Baffles.Lso/Baffles.Ls));
764
765"Jb Factor"
766        Shell.HeatTransfer.Jb = exp(-1.35*( Lcf+ Dotube)*Baffles.Ls/Shell.HeatTransfer.Sm*(1-(2*(Nss/Nc)^(1/3))));
767
768"ByPass Correction Factor for Pressure Drop"
769        Rb      = exp(-4.7*((Lcf + Dotube)*Baffles.Ls/Shell.HeatTransfer.Sm)*(1-(2*Rss)^(1/3)));
770
771"Pressure Drop Correction Factor for Unequal Baffle Spacing"
772        Rspd = (Baffles.Ls/Baffles.Lso) + (Baffles.Ls/Baffles.Lsi);
773
774"Shell Pressure Drop Baffle Window"
775        Shell.PressureDrop.Pdwindow    = Nb*((26/Shell.Properties.Average.rho)*mw*Shell.Properties.Average.Mu*(Ncw/(pitch-Dotube)+ Baffles.Ls/(Dw*Dw))+ 0.5*mw*mw/Shell.Properties.Average.rho)*exp(-1.33*(1+Rs)*((Scd + Std)/Shell.HeatTransfer.Sm)^(-0.15*(1+Rs) + 0.8));
776
777        when Shell.HeatTransfer.Re > 20 switchto "laminar";
778
779        case "laminar":
780
781"Jr Factor"     
782        Shell.HeatTransfer.Jr = (10/((Nc +Ncw)*(Nb+1)))^0.18 + (0.25-0.0125*Shell.HeatTransfer.Re)*((10/((Nc +Ncw)*(Nb+1)))^0.18 - 1);
783
784"Js Factor"
785        Shell.HeatTransfer.Js = (Nb-1+(Baffles.Lsi/Baffles.Ls)^0.7 + (Baffles.Lso/Baffles.Ls)^0.7)/(Nb-1+(Baffles.Lsi/Baffles.Ls) + (Baffles.Lso/Baffles.Ls));
786
787"Jb Factor"
788        Shell.HeatTransfer.Jb = exp(-1.35*( Lcf+ Dotube)*Baffles.Ls/Shell.HeatTransfer.Sm*(1-(2*(Nss/Nc)^(1/3))));
789
790"ByPass Correction Factor for Pressure Drop"
791        Rb      = exp(-4.7*((Lcf + Dotube)*Baffles.Ls/Shell.HeatTransfer.Sm)*(1-(2*Rss)^(1/3)));
792
793"Pressure Drop Correction Factor for Unequal Baffle Spacing"
794        Rspd = (Baffles.Ls/Baffles.Lso) + (Baffles.Ls/Baffles.Lsi);
795
796"Shell Pressure Drop Baffle Window"
797        Shell.PressureDrop.Pdwindow    = Nb*((26/Shell.Properties.Average.rho)*mw*Shell.Properties.Average.Mu*(Ncw/(pitch-Dotube)+ Baffles.Ls/(Dw*Dw))+ 0.5*mw*mw/Shell.Properties.Average.rho)*exp(-1.33*(1+Rs)*((Scd + Std)/Shell.HeatTransfer.Sm)^(-0.15*(1+Rs) + 0.8));
798
799        when Shell.HeatTransfer.Re < 20 switchto "deep laminar";
800        when Shell.HeatTransfer.Re > 100 switchto "turbulent";
801
802        case "turbulent":
803
804"Jr Factor"     
805        Shell.HeatTransfer.Jr = 1;
806
807"Js Factor"
808        Shell.HeatTransfer.Js = (Nb-1+(Baffles.Lsi/Baffles.Ls)^0.4 + (Baffles.Lso/Baffles.Ls)^0.4)/(Nb-1+(Baffles.Lsi/Baffles.Ls) + (Baffles.Lso/Baffles.Ls));
809
810"Jb Factor"
811        Shell.HeatTransfer.Jb = exp(-1.25*( Lcf+ Dotube)*Baffles.Ls/Shell.HeatTransfer.Sm*(1-(2*(Nss/Nc)^(1/3))));
812
813"ByPass Correction Factor for Pressure Drop"
814        Rb      = exp(-3.7*((Lcf + Dotube)*Baffles.Ls/Shell.HeatTransfer.Sm)*(1-(2*Rss)^(1/3)));
815
816"Pressure Drop Correction Factor for Unequal Baffle Spacing"
817        Rspd = (Baffles.Ls/Baffles.Lso)^1.8 + (Baffles.Ls/Baffles.Lsi)^1.8;
818
819"Shell Pressure Drop Baffle Window"
820        Shell.PressureDrop.Pdwindow    = Nb*((2+0.6*Ncw)*0.5*mw*mw/Shell.Properties.Average.rho)*exp(-1.33*(1+Rs)*((Scd + Std)/Shell.HeatTransfer.Sm)^(-0.15*(1+Rs) + 0.8));
821       
822        when Shell.HeatTransfer.Re < 100 switchto "laminar";
823       
824end
825
826"Shell Pressure Drop Cross Flow"
827        Shell.PressureDrop.PdCross = Shell.PressureDrop.Pideal*Rb*(Nb-1)*exp(-1.33*(1+Rs)*((Scd + Std)/Shell.HeatTransfer.Sm)^(-0.15*(1+Rs) + 0.8));
828
829"Shell Side Phi correction"
830        Shell.HeatTransfer.Phi  = (Shell.Properties.Average.Mu/Shell.Properties.Wall.Mu)^0.14;
831
832"Tube Side Phi correction"
833        Tubes.HeatTransfer.Phi  = (Tubes.Properties.Average.Mu/Tubes.Properties.Wall.Mu)^0.14;
834       
835"Shell Side inlet Nozzle rho-V^2"
836        Shell.PressureDrop.RVsquare_in = Shell.Properties.Inlet.rho*(Shell.PressureDrop.Vnozzle_in)^2;
837
838"Shell Side Outlet Nozzle rho-V^2"
839        Shell.PressureDrop.RVsquare_out = Shell.Properties.Outlet.rho*(Shell.PressureDrop.Vnozzle_out)^2;
840
841"Tube Side Pressure Drop"
842        Tubes.PressureDrop.PdTube       = 2*Tubes.PressureDrop.fi*Ltube*Tubes.Properties.Average.rho*(Tubes.HeatTransfer.Vtube^2)*Tpass/(Ditube*Tubes.HeatTransfer.Phi);
843
844"Pressure Drop Tube Side Inlet Nozzle"
845        Tubes.PressureDrop.Pdnozzle_in  = 0.5*Kinlet_Tube*Tubes.Properties.Inlet.rho*Tubes.PressureDrop.Vnozzle_in^2;
846
847"Velocity Tube Side Inlet Nozzle"
848        Tubes.PressureDrop.Vnozzle_in   = Tubes.Properties.Inlet.Fw/(Tubes.Properties.Inlet.rho*Ainozzle_Tube);
849
850"Pressure Drop Tube Side Outlet Nozzle"
851        Tubes.PressureDrop.Pdnozzle_out = 0.5*Koutlet_Tube*Tubes.Properties.Outlet.rho*Tubes.PressureDrop.Vnozzle_out^2;
852
853"Velocity Tube Side Outlet Nozzle"
854        Tubes.PressureDrop.Vnozzle_out  = Tubes.Properties.Inlet.Fw/(Tubes.Properties.Outlet.rho*Aonozzle_Tube);
855
856"Shell Pressure Drop Inlet Nozzle"
857        Shell.PressureDrop.Pdnozzle_in  = (0.5*Shell.Properties.Inlet.Fw^2/Shell.Properties.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
858
859"Velocity Shell Side Inlet Nozzle"
860        Shell.PressureDrop.Vnozzle_in   = Shell.Properties.Inlet.Fw/(Shell.Properties.Inlet.rho*Ainozzle_Shell);
861
862"Shell Pressure Drop Outlet Nozzle"
863        Shell.PressureDrop.Pdnozzle_out = (0.5*Shell.Properties.Outlet.Fw^2/Shell.Properties.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
864
865"Velocity Shell Side Outlet Nozzle"
866        Shell.PressureDrop.Vnozzle_out  = Shell.Properties.Outlet.Fw/(Shell.Properties.Outlet.rho*Aonozzle_Shell);
867
868"Pressure Drop Shell Stream"
869        OutletShell.P  = InletShell.P - Shell.PressureDrop.Pdtotal;     
870       
871"Pressure Drop Tube Stream"
872        OutletTube.P  = InletTube.P - Tubes.PressureDrop.Pdtotal;
873
874"Shell Wall Temperature"
875        Shell.Properties.Wall.Twall     = (Shell.Properties.Average.T+Tubes.Properties.Average.T)/2;
876
877"Tube Wall Temperature"
878        Tubes.Properties.Wall.Twall  = (Shell.Properties.Average.T+Tubes.Properties.Average.T)/2;
879
880"Tube Side Velocity"
881        Tubes.HeatTransfer.Vtube        = Tubes.Properties.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Tubes.Properties.Average.rho*Ntt);
882
883"Tube Side Reynolds Number"
884        Tubes.HeatTransfer.Re           = (Tubes.Properties.Average.rho*Tubes.HeatTransfer.Vtube*Ditube)/Tubes.Properties.Average.Mu;
885       
886"Tube Side Prandtl Number"
887        Tubes.HeatTransfer.PR           = ((Tubes.Properties.Average.Cp/Tubes.Properties.Average.Mw)*Tubes.Properties.Average.Mu)/Tubes.Properties.Average.K;
888
889"Tube Side Film Coefficient"
890        Tubes.HeatTransfer.htube= (Tubes.HeatTransfer.Nu*Tubes.Properties.Average.K/Ditube)*Tubes.HeatTransfer.Phi;
891
892"Shell Side Prandtl Number"
893        Shell.HeatTransfer.PR           = ((Shell.Properties.Average.Cp/Shell.Properties.Average.Mw)*Shell.Properties.Average.Mu)/Shell.Properties.Average.K;
894
895"Overall Heat Transfer Coefficient Dirty"
896        Details.Ud=1/(Dotube/(Tubes.HeatTransfer.htube*Ditube)+Rfo+Rfi*(Dotube/Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Shell.HeatTransfer.hshell)));
897
898"Overall Heat Transfer Coefficient Clean"
899        Details.Uc=1/(Dotube/(Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Shell.HeatTransfer.hshell)));
900
901"Exchange Surface Area"
902        Details.A=Pi*Dotube*Ntt*Ltube;
903
904"Baffles Spacing"
905        Ltube = Baffles.Lsi+Baffles.Lso+Baffles.Ls*(Nb-1);
906
907"Shell Side Reynolds Number"
908        Shell.HeatTransfer.Re = (Dotube*Shell.Properties.Inlet.Fw/Shell.HeatTransfer.Sm)/Shell.Properties.Average.Mu;
909
910"Shell Heat Transfer Coefficient"
911        Shell.HeatTransfer.hshell                       = Shell.HeatTransfer.Ji*(Shell.Properties.Average.Cp/Shell.Properties.Average.Mw)*(Shell.Properties.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
912
913end
914
915Model ShellandTubes_NTU         as ShellandTubesBasic
916
917ATTRIBUTES
918        Pallete = false;
919        Brief  = "Shell and Tubes Heat Exchangers";
920        Info  =
921        "write some information";
922
923VARIABLES
924
925Method as NTU_Basic;
926
927EQUATIONS
928
929"Number of Units Transference"
930        Method.NTU*Method.Cmin = Details.Ud*Pi*Dotube*Ntt*Ltube;
931
932"Minimum Heat Capacity"
933        Method.Cmin  = min([Method.Ch,Method.Cc]);
934       
935"Maximum Heat Capacity"
936        Method.Cmax  = max([Method.Ch,Method.Cc]);
937
938"Thermal Capacity Ratio"
939        Method.Cr    = Method.Cmin/Method.Cmax;
940       
941switch HotSide
942       
943        case "shell":
944
945"Duty"
946        Details.Q       = Method.Eft*Method.Cmin*(InletShell.T-InletTube.T);
947
948"Hot Stream Heat Capacity"
949        Method.Ch  = InletShell.F*Shell.Properties.Average.Cp;
950       
951"Cold Stream Heat Capacity"
952        Method.Cc = InletTube.F*Tubes.Properties.Average.Cp;
953
954        when InletTube.T > InletShell.T switchto "tubes";
955       
956        case "tubes":
957
958"Duty"
959        Details.Q       = Method.Eft*Method.Cmin*(InletTube.T-InletShell.T);
960
961"Hot Stream Heat Capacity"
962        Method.Cc = InletShell.F*Shell.Properties.Average.Cp;
963       
964"Cold Stream Heat Capacity"
965        Method.Ch = InletTube.F*Tubes.Properties.Average.Cp;
966       
967        when InletTube.T < InletShell.T switchto "shell";
968       
969end
970
971switch ShellType
972       
973        case "Fshell":
974       
975"Effectiveness Correction for 2 pass shell side"
976        Method.Eft1 = 2*(1+Method.Cr+sqrt(1+Method.Cr^2)*((1+exp(-Method.NTU*sqrt(1+Method.Cr^2)))/(1-exp(-Method.NTU*sqrt(1+Method.Cr^2)))) )^-1;
977
978"TEMA F Shell Effectiveness"
979        Method.Eft = ( ((1-Method.Eft1*Method.Cr)/(1-Method.Eft1))^2 -1  )*( ((1-Method.Eft1*Method.Cr)/(1-Method.Eft1))^2 - Method.Cr )^-1;
980
981        case "Eshell":
982       
983"TEMA E Shell Effectiveness"
984        Method.Eft = 2*(1+Method.Cr+sqrt(1+Method.Cr^2)*((1+exp(-Method.NTU*sqrt(1+Method.Cr^2)))/(1-exp(-Method.NTU*sqrt(1+Method.Cr^2)))) )^-1;
985#       Method.Eft = 1;
986
987"Variable not in use when 1 Pass Shell Side"
988        Method.Eft1     = 1;
989       
990end
991
992end
993
994Model ShellandTubes_LMTD        as ShellandTubesBasic
995
996ATTRIBUTES
997        Pallete = false;
998        Brief  = "Shell and Tubes Heat Exchangers";
999        Info  =
1000        "write some information";
1001
1002PARAMETERS
1003
1004LMTDcorrection  as Switcher     (Brief="LMTD Correction Factor Model",Valid=["Bowmann","Fakeri"],Default="Bowmann");
1005       
1006VARIABLES
1007
1008Method  as LMTD_Basic;
1009R                       as positive     (Brief=" Capacity Ratio for LMTD Correction Fator",Lower=1e-6);
1010P                       as positive     (Brief="Non - Dimensional Variable for LMTD Correction Fator ",Lower=1e-6);
1011Pc                      as positive     (Brief="Non - Dimensional Variable for LMTD Correction Fator when 2 Pass Shell Side",Lower=1e-6);
1012Rho             as positive     (Brief="Non - Dimensional Variable for LMTD Correction Fator in Fakeri Equation",Lower=1e-6);
1013Phi     as positive     (Brief="Non - Dimensional Variable for LMTD Correction Fator in Fakeri Equation",Lower=1e-6);
1014lambdaN as positive     (Brief="Non - Dimensional Variable for LMTD Correction Fator in Fakeri Equation when 2 Pass Shell Side",Lower=1e-6);
1015lambda1 as positive  (Brief="Non - Dimensional Variable for LMTD Correction Fator in Fakeri Equationwhen 2 Pass Shell Side",Lower=1e-6);
1016
1017EQUATIONS
1018
1019"Exchange Surface Area"
1020        Details.Q   = Details.Ud*Pi*Dotube*Ntt*Ltube*Method.LMTD*Method.Fc;
1021
1022switch HotSide
1023       
1024        case "shell":
1025
1026"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation "
1027        Phi*(2*((InletShell.T+ OutletShell.T)-(InletTube.T+ OutletTube.T)))  = (sqrt(((InletShell.T- OutletShell.T)*(InletShell.T- OutletShell.T))+((OutletTube.T - InletTube.T)*(OutletTube.T - InletTube.T))));
1028
1029"R: Capacity Ratio for LMTD Correction Fator"
1030        R*(OutletTube.T - InletTube.T ) = (InletShell.T-OutletShell.T);
1031
1032"P: Non - Dimensional Variable for LMTD Correction Fator"
1033        P*(InletShell.T- InletTube.T)= (OutletTube.T-InletTube.T);
1034       
1035"Temperature Difference at Inlet"
1036        Method.DT0 = InletShell.T - OutletTube.T;
1037
1038"Temperature Difference at Outlet"
1039        Method.DTL = OutletShell.T - InletTube.T;
1040
1041        when InletTube.T > InletShell.T switchto "tubes";
1042       
1043        case "tubes":
1044
1045"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation "
1046        Phi*(2*((InletShell.T+ OutletShell.T)-(InletTube.T+ OutletTube.T)))  = (sqrt(((InletShell.T- OutletShell.T)*(InletShell.T- OutletShell.T))+((OutletTube.T - InletTube.T)*(OutletTube.T - InletTube.T))));
1047
1048"R: Capacity Ratio for LMTD Correction Fator"
1049        R*(OutletShell.T - InletShell.T ) = (InletTube.T-OutletTube.T);
1050
1051"P: Non - Dimensional Variable for LMTD Correction Fator"
1052        P*(InletTube.T- InletShell.T)= (OutletShell.T-InletShell.T);
1053       
1054"Temperature Difference at Inlet"
1055        Method.DT0 = InletTube.T - OutletShell.T;
1056
1057"Temperature Difference at Outlet"
1058        Method.DTL = OutletTube.T - InletShell.T;
1059
1060       
1061        when InletTube.T < InletShell.T switchto "shell";
1062       
1063end
1064
1065switch ShellType
1066       
1067        case "Fshell":
1068       
1069switch LMTDcorrection
1070       
1071        case "Bowmann":
1072       
1073" Variable not in use with Bowmann equation"
1074        lambdaN =1;
1075       
1076" Variable not in use with Bowmann equation"
1077        lambda1 =1;
1078
1079#" Variable not in use with Bowmann equation"
1080#       Phi = 1;
1081
1082" Variable not in use with Bowmann equation"
1083        Rho =1;
1084
1085if R equal 1
1086       
1087        then
1088       
1089"Non Dimensional Variable for LMTD Correction Fator when 2 Pass Shell Side"
1090        Pc*(2-P)= P;
1091
1092"LMTD Correction Fator when 2 Pass Shell Side"
1093        Method.Fc= (sqrt(2)*Pc)/((1-Pc)*ln( abs( ( 2-Pc*0.585786)/( 2-Pc*3.414214))));
1094       
1095        else
1096       
1097"Non Dimensional Variable for LMTD Correction Fator when 2 Pass Shell Side"
1098        Pc = (sqrt(abs(( 1-P*R)/(1-P)))-1)/(sqrt(abs(( 1-P*R)/(1-P)))-R);
1099
1100"LMTD Correction Fator when 2 Pass Shell Side"
1101        Method.Fc = sqrt(R*R+1)*ln(abs((1-Pc*R)/(1-Pc)))/((1-R)*ln( abs( ( 2-Pc*(R+1-sqrt(R*R+1)))/ ( 2-Pc*(R + 1 + sqrt(R*R+1))))));
1102       
1103end
1104
1105        case "Fakeri":
1106       
1107" Variable not in use with Fakeri equation"
1108        Pc = P;
1109       
1110"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation"
1111        Rho*(1-P*R) = (1-P);
1112
1113#"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation "
1114#       Phi = (sqrt(((Inlet.Hot.T - Outlet.Hot.T)*(Inlet.Hot.T- Outlet.Hot.T))+((Outlet.Cold.T -  Inlet.Cold.T)*(Outlet.Cold.T -  Inlet.Cold.T))))/(2*((Inlet.Hot.T + Outlet.Hot.T)-( Inlet.Cold.T + Outlet.Cold.T)));
1115
1116if Rho equal 1
1117       
1118        then
1119       
1120" Variable not in use when Rho = 1"
1121        lambdaN =       1;
1122       
1123" Variable not in use when Rho = 1"
1124        lambda1 =       1;
1125       
1126"LMTD Correction Fator when 2 Pass Shell Side"
1127        Method.Fc = (2*Phi )/(ln(abs((1+Phi )/(1-Phi ))));
1128       
1129        else
1130
1131"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation"
1132        lambdaN = (1/ln(sqrt(abs(Rho))))*((2*sqrt(abs(Rho))-2)/(sqrt(abs(Rho))+1));
1133       
1134"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation"
1135        lambda1 = (1/ln(abs(Rho)))*((2*Rho-2)/(Rho+1));
1136
1137"LMTD Correction Fator when 2 Pass Shell Side"
1138        Method.Fc =     ((2*Phi *(lambdaN/lambda1))/(ln(abs((1+Phi *(lambdaN/lambda1))/(1-Phi *(lambdaN/lambda1))))))*(1/lambdaN);
1139
1140end
1141
1142
1143end
1144
1145        case "Eshell":
1146       
1147" Variable not in use when 1 Pass Shell Side"
1148        lambdaN =1;
1149
1150" Variable not in use when 1 Pass Shell Side"
1151        lambda1 =1;
1152       
1153" Variable not in use when 1 Pass Shell Side"
1154        Pc = P;
1155       
1156switch LMTDcorrection
1157       
1158        case "Bowmann":
1159
1160#" Variable not in use with Bowmann equation"
1161#       Phi  = 1;
1162       
1163" Variable not in use with Bowmann equation"
1164        Rho = 1;
1165
1166
1167 if R equal 1
1168       
1169    then
1170       
1171"LMTD Correction Fator when 1 Pass Shell Side"
1172        Method.Fc = (sqrt(2)*P)/((1-P)*ln( abs( ( 2-P*0.585786)/( 2-P*3.414214))));
1173
1174        else
1175       
1176"LMTD Correction Fator when 1 Pass Shell Side"
1177        Method.Fc = sqrt(R*R+1)*ln(abs((1-P*R)/(1-P)))/((1-R)*ln( abs( ( 2-P*(R+1-sqrt(R*R+1)))/ ( 2-P*(R + 1 + sqrt(R*R+1))))));
1178
1179end
1180
1181        case "Fakeri":
1182
1183#"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation "
1184#       Phi  = (sqrt(((Inlet.Hot.T- Outlet.Hot.T)*(Inlet.Hot.T- Outlet.Hot.T))+((Outlet.Cold.T - Inlet.Cold.T)*(Outlet.Cold.T - Inlet.Cold.T))))/(2*((Inlet.Hot.T+ Outlet.Hot.T)-(Inlet.Cold.T+ Outlet.Cold.T)));
1185
1186"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation"
1187        Rho*(1-P*R) = (1-P);
1188
1189if Rho equal 1
1190       
1191        then
1192       
1193"LMTD Correction Fator when 1 Pass Shell Side"
1194        Method.Fc = (4*Phi)/(ln(abs((1+2*Phi)/(1-2*Phi))));
1195
1196        else
1197
1198"LMTD Correction Fator when 1 Pass Shell Side"
1199        Method.Fc = (2*Phi*(Rho+1)*ln(abs(Rho)))/( ln(abs((1+2*Phi)/(1-2*Phi)))*(Rho-1));
1200       
1201end
1202
1203end
1204
1205       
1206end
1207
1208end
1209
Note: See TracBrowser for help on using the repository browser.