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

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

updated heat exchangers samples and models

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