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

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

updated ATTRIBUTES section in heat exchangers

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