source: mso/eml/heat_exchangers/HeatExchangerDiscretized.mso @ 78

Last change on this file since 78 was 78, checked in by Paula Bettio Staudt, 15 years ago

Updated heat_exchangers files header

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 56.7 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 78 2006-12-08 19:29:10Z paula $
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.U*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");
426Uaverage                        as heat_trans_coeff (Brief="Average Overall Heat Transfer Coefficient",Default=1,Lower=1e-6,Upper=1e10);
427hshellaverage           as heat_trans_coeff     (Brief="Average Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
428htubeaverage            as heat_trans_coeff     (Brief="Average Tube Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
429Thot(Zones)             as temperature          (Brief="Hot Temperature",Lower = 300, Upper = 500);
430Tcold(Zones)            as temperature          (Brief="Cold Temperature",Lower = 300, Upper = 500);
431Phot(Zones)             as pressure                     (Brief="Hot Pressure",Lower = 0.8, Upper = 30);
432Pcold(Zones)            as pressure                     (Brief="Cold Pressure",Lower = 0.8, Upper = 30);
433
434end
435
436Model E_Shell_NTU_Disc           
437#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
438#       Shell and Tubes Heat Exchanger with 1 shell pass - NTU Method
439#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
440PARAMETERS
441
442        HE      as CalcObject   (Brief="STHE Calculations",File="heatex");
443ext PP  as CalcObject   (Brief="External Physical Properties");
444side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
445Pi              as constant     (Brief="Pi Number",Default=3.14159265);
446
447#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
448#       Shell Geometrical Parameters
449#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
450Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
451Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
452Dishell                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
453Donozzle_Shell  as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
454Dinozzle_Shell  as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
455Hinozzle_Shell  as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
456Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
457Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
458#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
459#       Tubes Geometrical Parameters
460#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
461Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
462Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
463Ltube                   as length               (Brief="Effective Tube Length",Lower=0.1);
464pitch                   as length               (Brief="Tube Pitch",Lower=1e-8);
465Kwall                   as conductivity (Brief="Tube Wall Material Thermal Conductivity");
466Dotube                  as length               (Brief="Tube Outside Diameter",Lower=10e-6);
467Ditube                  as length               (Brief="Tube Inside Diameter",Lower=10e-6);
468Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
469Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
470#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
471#       Baffles Geometrical Parameters
472#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
473Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
474Nb              as Integer              (Brief="Number of Baffles",Default=4);
475Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
476Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
477#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
478VARIABLES
479
480Unity(Nb+1)     as Heatex_Discretized_NTU;
481Sumary          as Profiles;
482
483CONNECTIONS
484
485Unity([1:Nb]).Outlet.Hot  to Unity([2:Nb+1]).Inlet.Hot;
486Unity([2:Nb+1]).Outlet.Cold to Unity([1:Nb]).Inlet.Cold;
487
488EQUATIONS
489
490"Hot Temperatures"
491        Sumary.Thot     = Unity.Outlet.Hot.T;
492       
493"Cold Temperatures"
494        Sumary.Tcold    = Unity.Outlet.Cold.T ;
495
496"Hot Pressures"
497        Sumary.Phot     = Unity.Outlet.Hot.P ;
498       
499"Cold Pressures"
500        Sumary.Pcold    = Unity.Outlet.Cold.P ;
501
502"Average Shell Side Film Coefficient"
503        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
504
505"Average Tube Side Film Coefficient"
506        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
507
508"Average Overall Heat Transfer Coefficient"
509        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
510
511"Area Total"
512        Sumary.Area                             = sum(Unity.Details.A);
513
514"Duty Total"
515        Sumary.Q                                = sum(Unity.Details.Q);
516
517"Length Inlet zone"
518        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
519
520"Length Outlet zone"
521        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
522
523"Total Shell Side Pressure Drop"
524        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
525
526"Total Tube Side Pressure Drop"
527        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
528
529"Total Tube Side Nozzles Pressure Drop"
530        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
531
532"Total Shell Side Nozzles Pressure Drop"
533        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
534
535"Total Shell Side Window Pressure Drop"
536        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
537
538"Total Shell Side Cross Flow Pressure Drop"
539        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
540
541"Total Shell Side Ends Pressure Drop"
542        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
543
544"Shell Side Cross Flow Area"
545        Unity(1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(1).Baffles.Lsi);
546       
547"Shell Side Cross Flow Area"
548        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
549
550
551if side equal 1
552       
553        then
554       
555"Shell Side inlet Nozzle rho-V^2"
556        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
557
558"Shell Side Outlet Nozzle rho-V^2"
559        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
560
561"Shell Pressure End Zones"
562        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
563        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
564
565"Shell Pressure End Zones"
566        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
567        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);
568
569"Pressure Drop Tube Side Inlet Nozzle"
570        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
571
572"Velocity Tube Side Inlet Nozzle"
573        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
574
575"Pressure Drop Tube Side Outlet Nozzle"
576        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
577
578"Velocity Tube Side Outlet Nozzle"
579        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
580
581"Shell Pressure Drop Inlet Nozzle"
582        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
583
584"Velocity Shell Side Inlet Nozzle"
585        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
586
587"Shell Pressure Drop Outlet Nozzle"
588        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
589
590"Velocity Shell Side Outlet Nozzle"
591        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
592       
593
594        else
595       
596"Shell Side inlet Nozzle rho-V^2"
597        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
598
599"Shell Side Outlet Nozzle rho-V^2"
600        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
601
602"Shell Pressure End Zones"
603        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
604        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
605
606"Shell Pressure End Zones"
607        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
608        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);
609
610
611"Pressure Drop Tube Side Inlet Nozzle"
612        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
613
614"Velocity Tube Side Inlet Nozzle"
615        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
616
617"Pressure Drop Tube Side Outlet Nozzle"
618        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
619
620"Velocity Tube Side Outlet Nozzle"
621        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
622
623"Shell Pressure Drop Inlet Nozzle"
624        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
625
626"Velocity Shell Side Inlet Nozzle"
627        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
628
629"Shell Pressure Drop Outlet Nozzle"
630        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
631
632"Velocity Shell Side Outlet Nozzle"
633        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
634
635
636end
637
638
639for i in [2:Nb]
640
641"Pressure Drop Tube Side Inlet Nozzle"
642        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
643
644"Velocity Tube Side Inlet Nozzle"
645        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
646
647"Pressure Drop Tube Side Outlet Nozzle"
648        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
649
650"Velocity Tube Side Outlet Nozzle"
651        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
652
653"Shell Pressure Drop Inlet Nozzle"
654        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
655
656"Velocity Shell Side Inlet Nozzle"
657        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
658
659"Shell Pressure Drop Outlet Nozzle"
660        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
661
662"Velocity Shell Side Outlet Nozzle"
663        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
664
665"Shell Pressure End Zones"
666        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
667       
668"Shell Side Outlet Nozzle rho-V^2"
669        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
670       
671"Shell Side inlet Nozzle rho-V^2"
672        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
673
674if side equal 1
675       
676        then
677       
678"Shell Pressure Drop Cross Flow"
679        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);
680
681
682        else
683
684"Shell Pressure Drop Cross Flow"
685        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);
686
687
688end
689
690"Zone Length"
691        Sumary.Lz(i) = Unity(1).Baffles.Ls;
692
693"Shell Side Cross Flow Area"
694        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
695       
696end
697
698
699for i in [1:Nb+1]
700       
701if side equal 1
702       
703        then
704"Pressure Drop Hot Stream"
705        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
706
707"Pressure Drop Cold Stream"
708        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
709       
710"Shell Side Reynolds Number"
711        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
712
713"Shell Heat Transfer Coefficient"
714        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;
715
716
717"Shell Pressure Baffle Window"
718        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);
719
720"Hot Wall Temperature"
721        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
722
723"Cold Wall Temperature"
724        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
725
726"Tube Side Velocity"
727        Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
728
729"Tube Side Reynolds Number"
730        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
731       
732"Tube Side Prandtl Number"
733        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;
734
735"Tube Side Prandtl Number at Wall"
736        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;
737
738"Tube Side Film Coefficient"
739        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;
740       
741"Shell Side Prandtl Number"
742        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;
743
744"Shell Side Prandtl Number at Wall"
745        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; 
746
747"Tube Side Pressure Drop"
748        Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
749        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
750       
751"Shell Side Phi correction for viscosity"
752        Unity(i).Shell.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
753       
754"Tube Side Phi correction for viscosity"
755        Unity(i).Tubes.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
756       
757        else
758
759"Pressure Drop Hot Stream"
760        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
761       
762"Pressure Drop Cold Stream"
763        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
764       
765"Shell Side Reynolds Number"
766        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
767
768"Shell Heat Transfer Coefficient"
769        Unity(i).Shell.HeatTransfer.hshell      =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*
770        (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;
771
772
773"Shell Pressure Baffle Window"
774        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);
775
776"Hot Wall Temperature"
777        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
778
779"Cold Wall Temperature"
780        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
781
782"Tube Side Velocity"
783        Unity(i).Tubes.HeatTransfer.Vtube               = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
784
785"Tube Side Reynolds Number"
786        Unity(i).Tubes.HeatTransfer.Re                  =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
787       
788"Tube Side Prandtl Number"
789        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;
790       
791"Tube Side Prandtl Number at Wall"
792        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;
793       
794"Tube Side Film Coefficient"
795        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;
796       
797"Shell Side Prandtl Number"
798        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;
799
800"Shell Side Prandtl Number at Wall"
801        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;
802
803"Tube Side Pressure Drop"
804        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
805        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
806
807"Shell Side Phi correction for viscosity"
808        Unity(i).Shell.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
809       
810"Tube Side Phi correction for viscosity"
811        Unity(i).Tubes.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
812
813end
814
815"Tube Resistance"       
816        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
817       
818"Wall Resistance"
819        Unity(i).Resistances.Rwall      =       Dotube*ln(Dotube/Ditube)/(2*Kwall);
820       
821"Shell Resistance"
822        Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)        =       1;
823       
824"Overall Heat Transfer Coefficient"
825        Unity(i).Details.U*(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)))=1;
826
827"Exchange Surface Area"
828        Unity(i).Details.A      =       Pi*Dotube*Ntt*Sumary.Lz(i);
829
830"Baffles Spacing"
831        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
832       
833
834"Js Factor"     
835        Unity(i).Shell.HeatTransfer.Js                  =       1;
836       
837"Ji Factor"
838        Unity(i).Shell.HeatTransfer.Ji                  =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
839
840"Jc Factor"
841        Unity(i).Shell.HeatTransfer.Jc                  =       HE.JcFactor();
842       
843"Jl Factor"
844        Unity(i).Shell.HeatTransfer.Jl                  =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
845
846"Jb Factor"
847        Unity(i).Shell.HeatTransfer.Jb                  =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
848
849"Jr Factor"     
850        Unity(i).Shell.HeatTransfer.Jr                  =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
851       
852"Total J Factor"
853        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;
854end
855
856
857"Velocity Tube Side Inlet Nozzle"
858        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
859
860"Velocity Tube Side Outlet Nozzle"
861        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
862       
863"Tube Pressure Drop Inlet Nozzle"
864        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
865
866"Tube Pressure Drop Outlet Nozzle"
867        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
868
869"Velocity Shell Side Inlet Nozzle"
870        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
871
872"Velocity Shell Side Outlet Nozzle"
873        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
874       
875"Shell Pressure Drop Inlet Nozzle"
876        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
877       
878"Shell Pressure Drop Outlet Nozzle"
879        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
880
881"Shell Cross Flow Pressure Drop"
882        Unity(1).Shell.PressureDrop.PdCross             = 0;
883       
884"Shell Cross Flow Pressure Drop"
885        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
886       
887"Shell Side Outlet Nozzle rho-V^2"
888        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
889       
890"Shell Side inlet Nozzle rho-V^2"
891        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
892
893SET
894#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
895#  Set Parameters for heatex Calculation
896#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
897        Sumary.Zones        = Nb+1;
898        Pi                              = 3.14159265;
899        HE.Tpass                        = Tpass;
900        HE.Nss                          = Nss;
901        HE.Ntt                          = Ntt;
902        HE.Pattern                      = Pattern;
903        HE.Bc                           = Bc;
904        HE.Donozzle_Shell       = Donozzle_Shell;
905        HE.Dinozzle_Shell       = Dinozzle_Shell;
906        HE.Honozzle_Shell       = Honozzle_Shell;
907        HE.Hinozzle_Shell       = Hinozzle_Shell;
908        HE.Donozzle_Tube        = Donozzle_Tube;
909        HE.Dinozzle_Tube        = Dinozzle_Tube;
910        HE.Nb                       = Nb;
911        HE.Dishell                      = Dishell;             
912        HE.Lcf                          = Lcf; 
913        HE.pitch                        = pitch;               
914        HE.Dotube                       = Dotube;       
915        HE.Ditube                       = Ditube;       
916        HE.Lcd                          = Lcd;
917        HE.Ltd                          = Ltd;
918        side                            = HE.FluidAlocation();
919end
920
921Model E_Shell_LMTD_Disc         
922#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
923#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
924#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
925PARAMETERS
926
927        HE      as CalcObject   (Brief="STHE Calculations",File="heatex");
928ext PP  as CalcObject   (Brief="External Physical Properties");
929side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
930Pi              as constant     (Brief="Pi Number",Default=3.14159265);
931
932#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
933#       Shell Geometrical Parameters
934#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
935Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
936Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
937Dishell                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
938Donozzle_Shell  as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
939Dinozzle_Shell  as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
940Hinozzle_Shell  as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
941Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
942Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
943#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
944#       Tubes Geometrical Parameters
945#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
946Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
947Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
948Ltube                   as length               (Brief="Effective Tube Length",Lower=0.1);
949pitch                   as length               (Brief="Tube Pitch",Lower=1e-8);
950Kwall                   as conductivity (Brief="Tube Wall Material Thermal Conductivity");
951Dotube                  as length               (Brief="Tube Outside Diameter",Lower=10e-6);
952Ditube                  as length               (Brief="Tube Inside Diameter",Lower=10e-6);
953Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
954Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
955#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
956#       Baffles Geometrical Parameters
957#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
958Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
959Nb              as Integer              (Brief="Number of Baffles",Default=4);
960Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
961Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
962#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
963VARIABLES
964
965Unity(Nb+1)     as Heatex_Discretized_LMTD;
966Sumary          as Profiles;
967
968CONNECTIONS
969
970Unity([1:Nb]).Outlet.Hot        to Unity([2:Nb+1]).Inlet.Hot;
971Unity([2:Nb+1]).Outlet.Cold to Unity([1:Nb]).Inlet.Cold;
972
973EQUATIONS
974
975"Hot Temperatures"
976        Sumary.Thot     = Unity.Outlet.Hot.T;
977       
978"Cold Temperatures"
979        Sumary.Tcold    = Unity.Outlet.Cold.T ;
980
981"Hot Pressures"
982        Sumary.Phot     = Unity.Outlet.Hot.P ;
983       
984"Cold Pressures"
985        Sumary.Pcold    = Unity.Outlet.Cold.P ;
986
987"Average Shell Side Film Coefficient"
988        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
989
990"Average Tube Side Film Coefficient"
991        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
992
993"Average Overall Heat Transfer Coefficient"
994        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
995
996"Area Total"
997        Sumary.Area                             = sum(Unity.Details.A);
998
999"Duty Total"
1000        Sumary.Q                                = sum(Unity.Details.Q);
1001
1002"Length Inlet zone"
1003        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
1004
1005"Length Outlet zone"
1006        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
1007
1008"Total Shell Side Pressure Drop"
1009        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
1010
1011"Total Tube Side Pressure Drop"
1012        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
1013
1014"Total Tube Side Nozzles Pressure Drop"
1015        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
1016
1017"Total Shell Side Nozzles Pressure Drop"
1018        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
1019
1020"Total Shell Side Window Pressure Drop"
1021        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
1022
1023"Total Shell Side Cross Flow Pressure Drop"
1024        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
1025
1026"Total Shell Side Ends Pressure Drop"
1027        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
1028
1029"Shell Side Cross Flow Area"
1030        Unity(1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(1).Baffles.Lsi);
1031       
1032"Shell Side Cross Flow Area"
1033        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
1034
1035#"LMTD Correction Factor"
1036#       Unity.Fc = HE.EshellCorrectionFactor(Unity(1).Inlet.Hot.T,Unity(Nb+1).Outlet.Hot.T,Unity(Nb+1).Inlet.Cold.T,Unity(1).Outlet.Cold.T);
1037
1038if side equal 1
1039       
1040        then
1041
1042"Shell Side inlet Nozzle rho-V^2"
1043        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
1044
1045"Shell Side Outlet Nozzle rho-V^2"
1046        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
1047
1048"Shell Pressure End Zones"
1049        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
1050        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
1051
1052"Shell Pressure End Zones"
1053        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
1054        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);
1055
1056"Pressure Drop Tube Side Inlet Nozzle"
1057        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
1058
1059"Velocity Tube Side Inlet Nozzle"
1060        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
1061
1062"Pressure Drop Tube Side Outlet Nozzle"
1063        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
1064
1065"Velocity Tube Side Outlet Nozzle"
1066        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
1067
1068"Shell Pressure Drop Inlet Nozzle"
1069        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
1070
1071"Velocity Shell Side Inlet Nozzle"
1072        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
1073
1074"Shell Pressure Drop Outlet Nozzle"
1075        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
1076
1077"Velocity Shell Side Outlet Nozzle"
1078        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
1079       
1080
1081        else
1082
1083"Shell Side inlet Nozzle rho-V^2"
1084        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
1085
1086"Shell Side Outlet Nozzle rho-V^2"
1087        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
1088
1089"Shell Pressure End Zones"
1090        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
1091        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
1092
1093"Shell Pressure End Zones"
1094        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
1095        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);
1096
1097
1098"Pressure Drop Tube Side Inlet Nozzle"
1099        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
1100
1101"Velocity Tube Side Inlet Nozzle"
1102        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
1103
1104"Pressure Drop Tube Side Outlet Nozzle"
1105        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
1106
1107"Velocity Tube Side Outlet Nozzle"
1108        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
1109
1110"Shell Pressure Drop Inlet Nozzle"
1111        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
1112
1113"Velocity Shell Side Inlet Nozzle"
1114        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
1115
1116"Shell Pressure Drop Outlet Nozzle"
1117        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
1118
1119"Velocity Shell Side Outlet Nozzle"
1120        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
1121
1122
1123end
1124
1125
1126for i in [2:Nb]
1127
1128"Pressure Drop Tube Side Inlet Nozzle"
1129        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
1130
1131"Velocity Tube Side Inlet Nozzle"
1132        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
1133
1134"Pressure Drop Tube Side Outlet Nozzle"
1135        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
1136
1137"Velocity Tube Side Outlet Nozzle"
1138        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
1139
1140"Shell Pressure Drop Inlet Nozzle"
1141        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
1142
1143"Velocity Shell Side Inlet Nozzle"
1144        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
1145
1146"Shell Pressure Drop Outlet Nozzle"
1147        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
1148
1149"Velocity Shell Side Outlet Nozzle"
1150        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
1151
1152"Shell Pressure End Zones"
1153        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
1154
1155"Shell Side Outlet Nozzle rho-V^2"
1156        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
1157       
1158"Shell Side inlet Nozzle rho-V^2"
1159        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
1160       
1161if side equal 1
1162       
1163        then
1164       
1165"Shell Pressure Drop Cross Flow"
1166        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);
1167
1168
1169        else
1170
1171"Shell Pressure Drop Cross Flow"
1172        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);
1173
1174
1175end
1176
1177"Zone Length"
1178        Sumary.Lz(i) = Unity(1).Baffles.Ls;
1179
1180"Shell Side Cross Flow Area"
1181        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
1182       
1183end
1184
1185
1186for i in [1:Nb+1]
1187
1188
1189if side equal 1
1190       
1191        then
1192"Pressure Drop Hot Stream"
1193        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
1194
1195"Pressure Drop Cold Stream"
1196        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
1197       
1198"Shell Side Reynolds Number"
1199        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
1200
1201"Shell Heat Transfer Coefficient"
1202        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;
1203
1204"Shell Pressure Baffle Window"
1205        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);
1206
1207"Hot Wall Temperature"
1208        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1209       
1210"Cold Wall Temperature"
1211        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1212
1213"Tube Side Velocity"
1214        Unity(i).Tubes.HeatTransfer.Vtube       =       Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
1215
1216"Tube Side Reynolds Number"
1217        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
1218       
1219"Tube Side Prandtl Number"
1220        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;
1221
1222"Tube Side Prandtl Number at Wall"
1223        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;
1224
1225"Tube Side Film Coefficient"
1226        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;
1227       
1228"Shell Side Prandtl Number"
1229        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;
1230
1231"Shell Side Prandtl Number at Wall"
1232        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; 
1233
1234"Tube Side Pressure Drop"
1235        Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
1236        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
1237       
1238"Shell Side Phi correction for viscosity"
1239        Unity(i).Shell.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
1240       
1241"Tube Side Phi correction for viscosity"
1242        Unity(i).Tubes.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1243       
1244        else
1245
1246"Pressure Drop Hot Stream"
1247        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
1248       
1249"Pressure Drop Cold Stream"
1250        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
1251       
1252"Shell Side Reynolds Number"
1253        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
1254
1255"Shell Heat Transfer Coefficient"
1256        Unity(i).Shell.HeatTransfer.hshell      =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*
1257        (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;
1258
1259
1260"Shell Pressure Baffle Window"
1261        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);
1262
1263
1264"Hot Wall Temperature"
1265        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1266       
1267"Cold Wall Temperature"
1268        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1269
1270"Tube Side Velocity"
1271        Unity(i).Tubes.HeatTransfer.Vtube               = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
1272
1273"Tube Side Reynolds Number"
1274        Unity(i).Tubes.HeatTransfer.Re                  =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
1275       
1276"Tube Side Prandtl Number"
1277        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;
1278       
1279"Tube Side Prandtl Number at Wall"
1280        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;
1281       
1282       
1283"Tube Side Film Coefficient"
1284        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;
1285       
1286"Shell Side Prandtl Number"
1287        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;
1288
1289"Shell Side Prandtl Number at Wall"
1290        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;
1291
1292"Tube Side Pressure Drop"
1293        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
1294        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
1295
1296"Shell Side Phi correction for viscosity"
1297        Unity(i).Shell.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1298       
1299"Tube Side Phi correction for viscosity"
1300        Unity(i).Tubes.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
1301
1302end
1303
1304"Tube Resistance"       
1305        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
1306       
1307"Wall Resistance"
1308        Unity(i).Resistances.Rwall      =       Dotube*ln(Dotube/Ditube)/(2*Kwall);
1309       
1310"Shell Resistance"
1311        Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)        =       1;
1312       
1313"Overall Heat Transfer Coefficient"
1314        Unity(i).Details.U*(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)))=1;
1315
1316"Exchange Surface Area"
1317        Unity(i).Details.A      =       Pi*Dotube*Ntt*Sumary.Lz(i);
1318
1319"Baffles Spacing"
1320        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
1321
1322"Js Factor"     
1323        Unity(i).Shell.HeatTransfer.Js                  =       1;
1324
1325"Ji Factor"
1326        Unity(i).Shell.HeatTransfer.Ji                  =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
1327
1328"Jc Factor"
1329        Unity(i).Shell.HeatTransfer.Jc                  =       HE.JcFactor();
1330       
1331"Jl Factor"
1332        Unity(i).Shell.HeatTransfer.Jl                  =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
1333
1334"Jb Factor"
1335        Unity(i).Shell.HeatTransfer.Jb                  =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
1336
1337"Jr Factor"     
1338        Unity(i).Shell.HeatTransfer.Jr                  =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
1339       
1340"Total J Factor"
1341        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;
1342end
1343
1344"Velocity Tube Side Inlet Nozzle"
1345        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
1346
1347"Velocity Tube Side Outlet Nozzle"
1348        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
1349       
1350"Tube Pressure Drop Inlet Nozzle"
1351        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
1352
1353"Tube Pressure Drop Outlet Nozzle"
1354        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
1355
1356"Velocity Shell Side Inlet Nozzle"
1357        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
1358
1359"Velocity Shell Side Outlet Nozzle"
1360        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
1361       
1362"Shell Pressure Drop Inlet Nozzle"
1363        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
1364       
1365"Shell Pressure Drop Outlet Nozzle"
1366        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
1367
1368"Shell Cross Flow Pressure Drop"
1369        Unity(1).Shell.PressureDrop.PdCross             = 0;
1370       
1371"Shell Cross Flow Pressure Drop"
1372        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
1373       
1374"Shell Side Outlet Nozzle rho-V^2"
1375        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
1376       
1377"Shell Side inlet Nozzle rho-V^2"
1378        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
1379
1380SET
1381#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1382#  Set Parameters for heatex Calculation
1383#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1384        Sumary.Zones        = Nb+1;
1385        Pi                              = 3.14159265;
1386        HE.Tpass                        = Tpass;
1387        HE.Nss                          = Nss;
1388        HE.Ntt                          = Ntt;
1389        HE.Pattern                      = Pattern;
1390        HE.Bc                           = Bc;
1391        HE.Donozzle_Shell       = Donozzle_Shell;
1392        HE.Dinozzle_Shell       = Dinozzle_Shell;
1393        HE.Honozzle_Shell       = Honozzle_Shell;
1394        HE.Hinozzle_Shell       = Hinozzle_Shell;
1395        HE.Donozzle_Tube        = Donozzle_Tube;
1396        HE.Dinozzle_Tube        = Dinozzle_Tube;
1397        HE.Nb                       = Nb;
1398        HE.Dishell                      = Dishell;             
1399        HE.Lcf                          = Lcf; 
1400        HE.pitch                        = pitch;               
1401        HE.Dotube                       = Dotube;       
1402        HE.Ditube                       = Ditube;       
1403        HE.Lcd                          = Lcd;
1404        HE.Ltd                          = Ltd;
1405        side                            = HE.FluidAlocation();
1406end
Note: See TracBrowser for help on using the repository browser.