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

Last change on this file since 68 was 68, checked in by gerson bicca, 16 years ago

added double pipe heat exchanger model and updated eml/heat_exchangers

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