source: branches/newlanguage/eml/heat_exchangers/HeatExchangerDiscretized.mso @ 115

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

modified some equations

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