source: trunk/eml/heat_exchangers/DoublePipeIncr.mso @ 430

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

added model for double pipe heat exchanger with incremental approach

  • Property svn:executable set to *
File size: 30.0 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*--------------------------------------------------------------------
15* Author: Gerson Balbueno Bicca
16* $Id: DoublePipeIncr.mso                                                               $
17*------------------------------------------------------------------*#
18
19using "streams";
20
21Model Properties_Average
22       
23ATTRIBUTES
24        Pallete = false;
25        Brief = "Average incremental physical properties of the streams.";
26        Info =
27        "to be documented.";
28
29PARAMETERS
30
31outer N   as Integer    (Brief="Number of incremental points", Default = 2);
32
33VARIABLES
34        Mw                              as molweight                    (Brief="Average Mol Weight",Default=75, Lower=1, Upper=1e8);
35        T(N)                            as temperature          (Brief="Average  Incremental Temperature",Lower=50);
36        P(N)                            as pressure                     (Brief="Average  Incremental Pressure",Default=1, Lower=1e-10, Upper=2e4, DisplayUnit='kPa');
37        rho(N)                  as dens_mass                    (Brief="Stream Incremental Density" ,Default=1000, Lower=1e-3, Upper=5e5, Symbol = "\rho");
38        Mu(N)                   as viscosity                            (Brief="Stream Incremental Viscosity",Lower=0.0001, Symbol = "\mu");
39        Cp(N)                   as cp_mol                               (Brief="Stream Incremental Molar Heat Capacity", Upper=1e10);
40        K(N)                            as conductivity                 (Brief="Stream Incremental Thermal Conductivity", Default=1.0, Lower=1e-5, Upper=500);
41
42end
43
44Model Properties_In_Out
45       
46ATTRIBUTES
47        Pallete = false;
48        Brief = "Inlet and outlet physical properties of the streams.";
49        Info =
50        "to be documented.";
51       
52VARIABLES
53Fw              as flow_mass            (Brief="Stream Mass Flow");
54rho             as dens_mass            (Brief="Stream Density" ,Default=1000, Lower=1e-3, Upper=5e5, Symbol = "\rho");
55end
56
57Model Properties_Wall
58       
59ATTRIBUTES
60        Pallete = false;
61        Brief = "Incremental Physical properties of the streams at wall temperature.";
62        Info =
63        "to be documented.";
64
65PARAMETERS
66
67outer N   as Integer    (Brief="Number of incremental points", Default = 2);
68
69VARIABLES
70        Mu(N)                   as viscosity                    (Brief="Stream Incremental Viscosity",Default=1, Lower=1e-5, Upper=1e5, Symbol = "\mu");
71        Twall(N)        as temperature  (Brief="Incremental Wall Temperature",Lower=50);
72
73end
74
75Model Physical_Properties
76       
77ATTRIBUTES
78        Pallete = false;
79        Brief = "to be documented";
80        Info =
81        "to be documented";
82       
83VARIABLES
84        Inlet                   as Properties_In_Out    (Brief="Properties at Inlet Stream", Symbol = "^{in}");
85        Average                 as Properties_Average   (Brief="Properties at Average Temperature", Symbol = "^{avg}");
86        Outlet          as Properties_In_Out            (Brief="Properties at Outlet Stream", Symbol = "^{out}");
87        Wall                            as Properties_Wall                      (Brief="Properties at Wall Temperature", Symbol = "^{wall}");
88
89end
90
91Model Details_Main
92       
93ATTRIBUTES
94        Pallete = false;
95        Brief = "to be documented";
96        Info =
97        "to be documented";
98
99PARAMETERS
100
101outer N   as Integer    (Brief="Number of incremental points", Default = 2);
102
103VARIABLES
104        A                               as area                                                 (Brief="Total Exchange Surface Area");
105        Q(N)            as power                                                        (Brief="Incremental Duty", Default=7000, Lower=1e-6, Upper=1e10);
106        Qtotal          as power                                                        (Brief="Total Duty", Default=7000, Lower=1e-6, Upper=1e10);
107        Uc(N)           as heat_trans_coeff             (Brief="Incremental Overall Heat Transfer Coefficient Clean",Default=1,Lower=1e-6,Upper=1e10);
108        Ud(N)           as heat_trans_coeff             (Brief="Incremental Overall Heat Transfer Coefficient Dirty",Default=1,Lower=1e-6,Upper=1e10);
109
110end
111
112Model DoublePipe_HeatTransfer
113       
114ATTRIBUTES
115        Pallete = false;
116        Brief = "to be documented";
117        Info =
118        "to be documented";
119
120PARAMETERS
121
122As                      as area                 (Brief="Cross Sectional Area for Flow",Default=0.05,Lower=1e-8);
123Dh                      as length               (Brief="Hydraulic Diameter of Pipe for Heat Transfer",Lower=1e-8);
124outer N   as Integer    (Brief="Number of incremental points", Default = 2);
125
126VARIABLES
127
128Tlocal(N+1)             as temperature                          (Brief="Incremental Local  Temperature",Lower=50);
129Re(N)                           as positive                                     (Brief="Incremental Reynolds Number",Default=100,Lower=1);
130hcoeff(N)                       as heat_trans_coeff             (Brief="Incremental Film Coefficient",Default=1,Lower=1e-12, Upper=1e6, DisplayUnit = 'W/m^2/K');
131fi(N)                           as fricfactor                                   (Brief="Incremental Friction Factor", Default=0.05, Lower=1e-10, Upper=2000);
132Nu(N)                           as positive                                     (Brief="Incremental Nusselt Number",Default=0.5,Lower=1e-8);
133PR(N)                           as positive                                     (Brief="Incremental Prandtl Number",Default=0.5,Lower=1e-8);
134Phi(N)                          as positive                                     (Brief="Incremental Phi Correction",Default=1,Lower=1e-3);
135Vmean(N)                as velocity                                     (Brief="Incremental Tube Velocity",Lower=1e-8);
136Enth(N+1)               as enth_mol                             (Brief="Incremental Stream Enthalpy");
137
138end
139
140Model DoublePipe_PressureDrop
141       
142ATTRIBUTES
143        Pallete = false;
144        Brief = "to be documented";
145        Info =
146        "to be documented";
147       
148PARAMETERS
149
150Dh                      as length               (Brief="Hydraulic Diameter of Pipe for Pressure Drop",Lower=1e-6);
151outer N   as Integer    (Brief="Number of incremental points", Default = 2);
152
153VARIABLES
154
155Plocal(N+1)     as pressure             (Brief="Incremental Local  Pressure",Default=1, Lower=1e-10, Upper=2e4, DisplayUnit='kPa');
156Pdrop                           as press_delta  (Brief="Total Pressure Drop",Default=0.01, Lower=0,DisplayUnit='kPa', Symbol ="\Delta P");
157Pd_fric(N+1)    as press_delta  (Brief="Incremental Pressure Drop for friction",Default=0.01, Lower=0,DisplayUnit='kPa', Symbol ="\Delta P_{fric}");
158fi(N)                           as fricfactor           (Brief="Incremental Friction Factor", Default=0.05, Lower=1e-10, Upper=2000);
159Re(N)                           as positive                     (Brief="Incremental Reynolds Number",Default=100,Lower=1);
160
161end     
162
163Model Main_DoublePipe
164       
165ATTRIBUTES
166        Pallete = false;
167        Brief = "to be documented";
168        Info =
169        "to be documented";
170       
171VARIABLES
172
173HeatTransfer    as DoublePipe_HeatTransfer      (Brief="Double Pipe Heat Transfer");
174PressureDrop    as DoublePipe_PressureDrop      (Brief="Double Pipe Pressure Drop");
175Properties              as Physical_Properties                          (Brief="Double Pipe Properties");
176
177end
178
179Model DoublePipeIncr
180
181ATTRIBUTES
182        Pallete         = true;
183        Icon = "icon/DoublePipe";
184        Brief           = "Incremental Double Pipe Heat Exchanger. ";
185        Info                    =
186        "Incremental approach for a single double pipe heat exchanger. ";
187
188PARAMETERS
189
190outer PP                as Plugin               (Brief="External Physical Properties", Type="PP");
191outer NComp     as Integer      (Brief="Number of Components");
192        N                                       as Integer      (Brief="Number of incremental points", Default = 2);
193       
194        M(NComp)        as molweight    (Brief="Component Mol Weight");
195       
196        FlowDirection   as Switcher     (Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
197       
198        HotSide                                 as Switcher     (Brief="Flag for Fluid Alocation ",Valid=["outer","inner"],Default="outer");
199        innerFlowRegime         as Switcher     (Brief="Inner Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
200        outerFlowRegime         as Switcher     (Brief="Outer Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
201
202        InnerLaminarCorrelation         as Switcher     (Brief="Heat Transfer Correlation in Laminar Flow for the Inner Side",Valid=["Hausen","Schlunder"],Default="Hausen");
203        InnerTransitionCorrelation  as Switcher         (Brief="Heat Transfer Correlation in Transition Flow for the Inner Side",Valid=["Gnielinski","Hausen"],Default="Gnielinski");
204        InnerTurbulentCorrelation   as Switcher (Brief="Heat Transfer Correlation in Turbulent Flow for the Inner Side",Valid=["Petukhov","SiederTate"],Default="Petukhov");
205
206        OuterLaminarCorrelation         as Switcher             (Brief="Heat Transfer Correlation in Laminar Flow for the Outer Side",Valid=["Hausen","Schlunder"],Default="Hausen");
207        OuterTransitionCorrelation  as Switcher         (Brief="Heat Transfer Correlation in Transition Flow for the OuterSide",Valid=["Gnielinski","Hausen"],Default="Gnielinski");
208        OuterTurbulentCorrelation   as Switcher         (Brief="Heat Transfer Correlation in Turbulent Flow for the Outer Side",Valid=["Petukhov","SiederTate"],Default="Petukhov");
209
210        Pi                              as constant             (Brief="Pi Number",Default=3.14159265, Symbol = "\pi");
211        DoInner         as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
212        DiInner as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
213        DiOuter as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
214        Lpipe           as length                       (Brief="Effective Tube Length of one segment of Pipe",Lower=0.1, Symbol = "L_{pipe}");
215        Kwall           as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0, Symbol = "K_{wall}");
216        Rfi                     as positive                     (Brief="Inside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
217        Rfo                     as positive                     (Brief="Outside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
218
219VARIABLES
220
221in  InletInner          as stream               (Brief="Inlet Inner Stream", PosX=0, PosY=0.5225, Symbol="_{inInner}");
222in  InletOuter          as stream               (Brief="Inlet Outer Stream", PosX=0.2805, PosY=0, Symbol="_{inOuter}");
223
224out OutletInner         as streamPH     (Brief="Outlet Inner Stream", PosX=1, PosY=0.5225, Symbol="_{outInner}");
225out OutletOuter         as streamPH     (Brief="Outlet Outer Stream", PosX=0.7264, PosY=1, Symbol="_{outOuter}");
226
227        Details         as Details_Main                 (Brief="Some Details in the Heat Exchanger", Symbol=" ");
228        Inner                   as Main_DoublePipe      (Brief="Inner Side of the Heat Exchanger", Symbol="_{Inner}");
229        Outer                   as Main_DoublePipe      (Brief="Outer Side of the Heat Exchanger", Symbol="_{Outer}");
230
231        Lincr(N+1)              as length               (Brief = "Incremental Tube Length", Symbol = "L_{incr}");
232
233SET
234
235#"Component Molecular Weight"
236        M  = PP.MolecularWeight();
237
238#"Pi Number"
239        Pi      = 3.14159265;
240
241#"Inner Pipe Cross Sectional Area for Flow"
242        Inner.HeatTransfer.As=0.25*Pi*DiInner*DiInner;
243
244#"Outer Pipe Cross Sectional Area for Flow"
245        Outer.HeatTransfer.As=0.25*Pi*(DiOuter*DiOuter - DoInner*DoInner);
246
247#"Inner Pipe Hydraulic Diameter for Heat Transfer"
248        Inner.HeatTransfer.Dh=DiInner;
249       
250#"Outer Pipe Hydraulic Diameter for Heat Transfer"
251        Outer.HeatTransfer.Dh=(DiOuter*DiOuter-DoInner*DoInner)/DoInner;
252
253#"Inner Pipe Hydraulic Diameter for Pressure Drop"
254        Inner.PressureDrop.Dh=DiInner;
255       
256#"Outer Pipe Hydraulic Diameter for Pressure Drop"
257        Outer.PressureDrop.Dh=DiOuter-DoInner;
258
259EQUATIONS
260
261"Outer  Stream Average Temperature"
262        Outer.Properties.Average.T(1:N) = 0.5*Outer.HeatTransfer.Tlocal(1:N) + 0.5*Outer.HeatTransfer.Tlocal(2:N+1);
263
264"Inner Stream Average Temperature"
265        Inner.Properties.Average.T(1:N)  = 0.5*Inner.HeatTransfer.Tlocal(1:N) + 0.5*Inner.HeatTransfer.Tlocal(2:N+1);
266       
267"Outer Stream Average Pressure"
268        Outer.Properties.Average.P(1:N) = 0.5*Outer.PressureDrop.Plocal(1:N) + 0.5*Outer.PressureDrop.Plocal(2:N+1);
269       
270"Inner Stream Average Pressure"
271        Inner.Properties.Average.P(1:N) = 0.5*Inner.PressureDrop.Plocal(1:N) + 0.5*Inner.PressureDrop.Plocal(2:N+1);
272
273"Inner Stream Wall Temperature"
274        Inner.Properties.Wall.Twall =   0.5*Outer.Properties.Average.T + 0.5*Inner.Properties.Average.T;
275
276"Outer Stream Wall Temperature"
277        Outer.Properties.Wall.Twall =   0.5*Outer.Properties.Average.T + 0.5*Inner.Properties.Average.T;
278
279"Outer Stream Average Molecular Weight"
280        Outer.Properties.Average.Mw = sum(M*InletOuter.z);
281
282"Inner Stream Average Molecular Weight"
283        Inner.Properties.Average.Mw = sum(M*InletInner.z);
284
285
286if InletInner.v equal 0
287
288then
289"Inlet Mass Density Inner Stream"
290        Inner.Properties.Inlet.rho              =       PP.LiquidDensity(InletInner.T,InletInner.P,InletInner.z);
291
292"Outlet Mass Density Inner Stream"
293        Inner.Properties.Outlet.rho     =       PP.LiquidDensity(OutletInner.T,OutletInner.P,OutletInner.z);
294
295else
296"Inlet Mass Density Inner Stream"
297        Inner.Properties.Inlet.rho              =       PP.VapourDensity(InletInner.T,InletInner.P,InletInner.z);
298       
299"Outlet Mass Density Inner Stream"
300        Inner.Properties.Outlet.rho     =       PP.VapourDensity(OutletInner.T,OutletInner.P,OutletInner.z);
301
302end
303
304if InletOuter.v equal 0
305
306then
307"Inlet Mass Density Outer Stream"
308        Outer.Properties.Inlet.rho              =               PP.LiquidDensity(InletOuter.T,InletOuter.P,InletOuter.z);
309
310"Outlet Mass Density Outer Stream"
311        Outer.Properties.Outlet.rho     =               PP.LiquidDensity(OutletOuter.T,OutletOuter.P,OutletOuter.z);
312
313else
314"Inlet Mass Density Outer Stream"
315        Outer.Properties.Inlet.rho              =               PP.VapourDensity(InletOuter.T,InletOuter.P,InletOuter.z);
316       
317"Outlet Mass Density Outer Stream"
318        Outer.Properties.Outlet.rho     =               PP.VapourDensity(OutletOuter.T,OutletOuter.P,OutletOuter.z);
319
320end
321
322for i in [1:N]
323
324if InletInner.v equal 0
325       
326        then   
327
328"Average Heat Capacity Inner Stream"
329        Inner.Properties.Average.Cp(i)  =       PP.LiquidCp(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
330
331"Average Mass Density Inner Stream"
332        Inner.Properties.Average.rho(i)         =       PP.LiquidDensity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
333
334"Average Viscosity Inner Stream"
335        Inner.Properties.Average.Mu(i)  =       PP.LiquidViscosity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
336
337"Average        Conductivity Inner Stream"
338        Inner.Properties.Average.K(i)           =       PP.LiquidThermalConductivity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
339
340"Viscosity Inner Stream at wall temperature"
341        Inner.Properties.Wall.Mu(i)             =       PP.LiquidViscosity(Inner.Properties.Wall.Twall(i),Inner.Properties.Average.P(i),InletInner.z);
342
343        else
344
345"Average Heat Capacity InnerStream"
346        Inner.Properties.Average.Cp(i)  =       PP.VapourCp(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
347
348"Average Mass Density Inner Stream"
349        Inner.Properties.Average.rho(i)         =       PP.VapourDensity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
350
351"Average Viscosity Inner Stream"
352        Inner.Properties.Average.Mu(i)  =       PP.VapourViscosity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
353
354"Average Conductivity Inner Stream"
355        Inner.Properties.Average.K(i)           =       PP.VapourThermalConductivity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
356
357"Viscosity Inner Stream at wall temperature"
358        Inner.Properties.Wall.Mu(i)             =       PP.VapourViscosity(Inner.Properties.Wall.Twall(i),Inner.Properties.Average.P(i),InletInner.z);
359
360end
361
362if InletOuter.v equal 0
363
364        then
365
366"Average Heat Capacity Outer Stream"
367        Outer.Properties.Average.Cp(i)  =               PP.LiquidCp(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
368
369"Average Mass Density Outer Stream"
370        Outer.Properties.Average.rho(i) =               PP.LiquidDensity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
371
372"Average Viscosity Outer Stream"
373        Outer.Properties.Average.Mu(i)  =               PP.LiquidViscosity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);   
374
375"Average Conductivity Outer Stream"
376        Outer.Properties.Average.K(i)   =               PP.LiquidThermalConductivity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
377
378"Viscosity Outer Stream at wall temperature"
379        Outer.Properties.Wall.Mu(i)             =               PP.LiquidViscosity(Outer.Properties.Wall.Twall(i),Outer.Properties.Average.P(i),InletOuter.z); 
380
381
382        else
383
384"Average Heat Capacity Outer Stream"
385        Outer.Properties.Average.Cp(i)  =               PP.VapourCp(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
386
387"Average Mass Density Outer Stream"
388        Outer.Properties.Average.rho(i) =               PP.VapourDensity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
389
390"Average Viscosity Outer Stream"
391        Outer.Properties.Average.Mu(i)  =               PP.VapourViscosity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
392
393"Average Conductivity Outer Stream"
394        Outer.Properties.Average.K(i)   =               PP.VapourThermalConductivity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
395
396"Viscosity Outer Stream at wall temperature"
397        Outer.Properties.Wall.Mu(i)             =               PP.VapourViscosity(Outer.Properties.Wall.Twall(i),Outer.Properties.Average.P(i),InletOuter.z);
398
399end
400
401end
402
403switch HotSide
404
405        case "outer":
406
407switch FlowDirection
408
409        case "cocurrent":
410        "Energy Balance Outer Stream in cocurrent flow"
411                Details.Q(1:N) = InletOuter.F*(Outer.HeatTransfer.Enth(1:N) - Outer.HeatTransfer.Enth(2:N+1));
412               
413        case "counter":
414        "Energy Balance Outer Stream in counter flow"
415                Details.Q(1:N) = InletOuter.F*(Outer.HeatTransfer.Enth(2:N+1) - Outer.HeatTransfer.Enth(1:N));
416               
417end
418
419"Energy Balance Inner Stream"
420        Details.Q(1:N) = -InletInner.F*(Inner.HeatTransfer.Enth(1:N)    -       Inner.HeatTransfer.Enth(2:N+1));
421
422        when InletInner.T > InletOuter.T switchto "inner";
423
424        case "inner":
425
426"Energy Balance Hot Stream"
427        Details.Q(1:N) = InletInner.F*(Inner.HeatTransfer.Enth(1:N)-Inner.HeatTransfer.Enth(2:N+1));
428
429switch FlowDirection
430
431        case "cocurrent":
432        "Energy Balance Cold Stream in cocurrent flow"
433                Details.Q(1:N) = -InletOuter.F*(Outer.HeatTransfer.Enth(1:N) - Outer.HeatTransfer.Enth(2:N+1));
434               
435        case "counter":
436        "Energy Balance Cold Stream in counter flow"
437                Details.Q(1:N) = -InletOuter.F*(Outer.HeatTransfer.Enth(2:N+1) - Outer.HeatTransfer.Enth(1:N));
438               
439end
440
441        when InletInner.T < InletOuter.T switchto "outer";
442
443end
444
445"Flow Mass Inlet Inner Stream"
446        Inner.Properties.Inlet.Fw               =  sum(M*InletInner.z)*InletInner.F;
447
448"Flow Mass Outlet Inner Stream"
449        Inner.Properties.Outlet.Fw              =  sum(M*OutletInner.z)*OutletInner.F;
450
451"Flow Mass Inlet Outer Stream"
452        Outer.Properties.Inlet.Fw               =  sum(M*InletOuter.z)*InletOuter.F;
453
454"Flow Mass Outlet Outer Stream"
455        Outer.Properties.Outlet.Fw      =  sum(M*OutletOuter.z)*OutletOuter.F;
456
457"Molar Balance Outer Stream"
458        OutletOuter.F = InletOuter.F;
459       
460"Molar Balance Inner Stream"
461        OutletInner.F = InletInner.F;
462
463"Outer Stream Molar Fraction Constraint"
464        OutletOuter.z=InletOuter.z;
465       
466"InnerStream Molar Fraction Constraint"
467        OutletInner.z=InletInner.z;
468
469"Total Exchange Surface Area for one segment of pipe"
470        Details.A=Pi*DoInner*Lpipe;
471
472"Pipe Initial Length from Left to Right - OBS: Left: Always Inlet inner side"
473        Lincr(1) = 0*'m';
474
475for i in [1:N]
476
477"Incremental Length"
478        Lincr(i+1) = i*abs(Lpipe)/N;
479
480end
481
482for i in [1:N]
483
484switch innerFlowRegime
485       
486        case "laminar":
487       
488"Inner Side Friction Factor for Pressure Drop - laminar Flow"
489        Inner.PressureDrop.fi(i)*Inner.PressureDrop.Re(i) = 16;
490       
491        when Inner.PressureDrop.Re(i) > 2300 switchto "transition";
492
493        case "transition":
494       
495"using Turbulent Flow - to be implemented"
496        (Inner.PressureDrop.fi(i)-0.0035)*(Inner.PressureDrop.Re(i)^0.42) = 0.264;
497
498        when Inner.PressureDrop.Re(i) < 2300 switchto "laminar";
499        when Inner.PressureDrop.Re(i) > 10000 switchto "turbulent";
500
501        case "turbulent":
502
503"Inner Side Friction Factor - Turbulent Flow"
504        (Inner.PressureDrop.fi(i)-0.0035)*(Inner.PressureDrop.Re(i)^0.42) = 0.264;
505
506        when Inner.PressureDrop.Re(i) < 10000 switchto "transition";
507       
508end     
509
510end
511
512for i in [1:N]
513
514switch outerFlowRegime
515       
516        case "laminar":
517       
518"Outer Side Friction Factor - laminar Flow"
519        Outer.PressureDrop.fi(i)*Outer.PressureDrop.Re(i) = 16;
520       
521        when Outer.PressureDrop.Re(i) > 2300 switchto "transition";
522
523        case "transition":
524       
525"using Turbulent Flow - Transition Flow must be implemented"
526        (Outer.PressureDrop.fi(i)-0.0035)*(Outer.PressureDrop.Re(i)^0.42) = 0.264;
527
528        when Outer.PressureDrop.Re(i) < 2300 switchto "laminar";
529        when Outer.PressureDrop.Re(i) > 10000 switchto "turbulent";
530
531        case "turbulent":
532
533"Outer Side Friction Factor - Turbulent Flow"
534        (Outer.PressureDrop.fi(i)-0.0035)*(Outer.PressureDrop.Re(i)^0.42) = 0.264;
535
536        when Outer.PressureDrop.Re(i) < 10000 switchto "transition";
537       
538end
539
540end
541
542for i in [1:N]
543
544switch innerFlowRegime
545       
546        case "laminar":
547       
548"Inner Side Friction Factor for Heat Transfer - laminar Flow"
549        Inner.HeatTransfer.fi(i)   = 1/(0.79*ln(Inner.HeatTransfer.Re(i))-1.64)^2;
550       
551switch InnerLaminarCorrelation
552       
553        case "Hausen":
554
555"Nusselt Number"
556        Inner.HeatTransfer.Nu(i) = 3.665 + ((0.19*((DiInner/Lpipe)*Inner.HeatTransfer.Re(i)*Inner.HeatTransfer.PR(i))^0.8)/(1+0.117*((DiInner/Lpipe)*Inner.HeatTransfer.Re(i)*Inner.HeatTransfer.PR(i))^0.467));
557       
558        case "Schlunder":
559
560"Nusselt Number"
561        Inner.HeatTransfer.Nu(i) = (49.027896+4.173281*Inner.HeatTransfer.Re(i)*Inner.HeatTransfer.PR(i)*(DiInner/Lpipe))^(1/3);
562
563end
564       
565        when Inner.HeatTransfer.Re(i) > 2300 switchto "transition";
566       
567        case "transition":
568       
569"Inner Side Friction Factor for Heat Transfer - transition Flow"
570        Inner.HeatTransfer.fi(i)   = 1/(0.79*ln(Inner.HeatTransfer.Re(i))-1.64)^2;
571       
572switch InnerTransitionCorrelation
573       
574        case "Gnielinski":
575       
576"Nusselt Number"
577        Inner.HeatTransfer.Nu(i)*(1+(12.7*sqrt(0.125*Inner.HeatTransfer.fi(i))*((Inner.HeatTransfer.PR(i))^(2/3) -1))) = 0.125*Inner.HeatTransfer.fi(i)*(Inner.HeatTransfer.Re(i)-1000)*Inner.HeatTransfer.PR(i);
578
579        case "Hausen":
580
581"Nusselt Number"
582        Inner.HeatTransfer.Nu(i) =0.116*(Inner.HeatTransfer.Re(i)^(0.667)-125)*Inner.HeatTransfer.PR(i)^(0.333)*(1+(DiInner/Lpipe)^0.667);
583       
584end
585
586        when Inner.HeatTransfer.Re(i) < 2300 switchto "laminar";
587        when Inner.HeatTransfer.Re(i) > 10000 switchto "turbulent";
588
589        case "turbulent":
590
591switch InnerTurbulentCorrelation
592       
593        case "Petukhov":
594       
595"Inner Side Friction Factor for Heat Transfer - turbulent Flow"
596        Inner.HeatTransfer.fi(i)   = 1/(1.82*log(Inner.HeatTransfer.Re(i))-1.64)^2;
597
598"Nusselt Number"
599        Inner.HeatTransfer.Nu(i)*(1.07+(12.7*sqrt(0.125*Inner.HeatTransfer.fi(i))*((Inner.HeatTransfer.PR(i))^(2/3) -1))) = 0.125*Inner.HeatTransfer.fi(i)*Inner.HeatTransfer.Re(i)*Inner.HeatTransfer.PR(i);
600       
601        case "SiederTate":
602
603"Nusselt Number"
604        Inner.HeatTransfer.Nu(i) = 0.027*(Inner.HeatTransfer.PR(i))^(1/3)*(Inner.HeatTransfer.Re(i))^(4/5);
605
606"Inner Side Friction Factor for Heat Transfer - turbulent Flow"
607        Inner.HeatTransfer.fi(i)   = 1/(1.82*log(Inner.HeatTransfer.Re(i))-1.64)^2;
608       
609end
610       
611        when Inner.HeatTransfer.Re(i) < 10000 switchto "transition";
612       
613end
614
615end
616
617for i in [1:N]
618
619switch outerFlowRegime
620       
621        case "laminar":
622       
623"Outer Side Friction Factor for Heat Transfer - laminar Flow"
624        Outer.HeatTransfer.fi(i)   = 1/(0.79*ln(Outer.HeatTransfer.Re(i))-1.64)^2;
625       
626switch OuterLaminarCorrelation
627       
628        case "Hausen":
629
630"Nusselt Number"
631        Outer.HeatTransfer.Nu(i) = 3.665 + ((0.19*((Outer.HeatTransfer.Dh/Lpipe)*Outer.HeatTransfer.Re(i)*Outer.HeatTransfer.PR(i))^0.8)/(1+0.117*((Outer.HeatTransfer.Dh/Lpipe)*Outer.HeatTransfer.Re(i)*Outer.HeatTransfer.PR(i))^0.467));
632       
633        case "Schlunder":
634
635"Nusselt Number"
636        Outer.HeatTransfer.Nu(i) = (49.027896+4.173281*Outer.HeatTransfer.Re(i)*Outer.HeatTransfer.PR(i)*(Outer.HeatTransfer.Dh/Lpipe))^(1/3);
637
638end
639       
640        when Outer.HeatTransfer.Re(i) > 2300 switchto "transition";
641       
642        case "transition":
643       
644switch OuterTransitionCorrelation
645       
646        case "Gnielinski":
647
648"Outer Side Friction Factor for Heat Transfer - transition Flow"
649        Outer.HeatTransfer.fi(i)   = 1/(0.79*ln(Outer.HeatTransfer.Re(i))-1.64)^2;
650
651"Nusselt Number"
652        Outer.HeatTransfer.Nu(i)*(1+(12.7*sqrt(0.125*Outer.HeatTransfer.fi(i))*((Outer.HeatTransfer.PR(i))^(2/3) -1))) = 0.125*Outer.HeatTransfer.fi(i)*(Outer.HeatTransfer.Re(i)-1000)*Outer.HeatTransfer.PR(i);
653
654        case "Hausen":
655
656"Nusselt Number"
657        Outer.HeatTransfer.Nu(i) =      0.116*(Outer.HeatTransfer.Re(i)^(0.667)-125)*Outer.HeatTransfer.PR(i)^(0.333)*(1+(Outer.HeatTransfer.Dh/Lpipe)^0.667);
658
659
660"Outer Side Friction Factor for Heat Transfer - transition Flow"
661        Outer.HeatTransfer.fi(i)   = 1/(0.79*ln(Outer.HeatTransfer.Re(i))-1.64)^2;
662       
663end
664       
665        when Outer.HeatTransfer.Re(i) < 2300 switchto "laminar";
666        when Outer.HeatTransfer.Re(i) > 10000 switchto "turbulent";
667       
668        case "turbulent":
669       
670switch OuterTurbulentCorrelation
671       
672        case "Petukhov":
673
674"Outer Side Friction Factor for Heat Transfer - turbulent Flow"
675        Outer.HeatTransfer.fi(i)   = 1/(1.82*log(Outer.HeatTransfer.Re(i))-1.64)^2;
676       
677"Nusselt Number"
678        Outer.HeatTransfer.Nu(i)*(1.07+(12.7*sqrt(0.125*Outer.HeatTransfer.fi(i))*((Outer.HeatTransfer.PR(i))^(2/3) -1))) = 0.125*Outer.HeatTransfer.fi(i)*Outer.HeatTransfer.Re(i)*Outer.HeatTransfer.PR(i);
679       
680        case "SiederTate":
681
682"Nusselt Number"
683        Outer.HeatTransfer.Nu(i) = 0.027*(Outer.HeatTransfer.PR(i))^(1/3)*(Outer.HeatTransfer.Re(i))^(4/5);
684
685"Outer Side Friction Factor for Heat Transfer - turbulent Flow"
686        Outer.HeatTransfer.fi(i)   = 1/(1.82*log(Outer.HeatTransfer.Re(i))-1.64)^2;
687       
688end
689
690        when Outer.HeatTransfer.Re(i) < 10000 switchto "transition";
691
692end
693
694end
695
696"Inner Pipe Film Coefficient"
697        Inner.HeatTransfer.hcoeff = (Inner.HeatTransfer.Nu*Inner.Properties.Average.K/DiInner)*Inner.HeatTransfer.Phi;
698
699"Outer Pipe Film Coefficient"
700        Outer.HeatTransfer.hcoeff= (Outer.HeatTransfer.Nu*Outer.Properties.Average.K/Outer.HeatTransfer.Dh)*Outer.HeatTransfer.Phi;
701
702"Outer Pipe Phi correction"
703        Outer.HeatTransfer.Phi = (Outer.Properties.Average.Mu/Outer.Properties.Wall.Mu)^0.14;
704       
705"Inner Pipe Phi correction"
706        Inner.HeatTransfer.Phi  = (Inner.Properties.Average.Mu/Inner.Properties.Wall.Mu)^0.14;
707
708"Outer Pipe Prandtl Number"
709        Outer.HeatTransfer.PR = ((Outer.Properties.Average.Cp/Outer.Properties.Average.Mw)*Outer.Properties.Average.Mu)/Outer.Properties.Average.K;
710
711"Inner Pipe Prandtl Number"
712        Inner.HeatTransfer.PR = ((Inner.Properties.Average.Cp/Inner.Properties.Average.Mw)*Inner.Properties.Average.Mu)/Inner.Properties.Average.K;
713
714"Outer Pipe Reynolds Number for Heat Transfer"
715        Outer.HeatTransfer.Re = (Outer.Properties.Average.rho*Outer.HeatTransfer.Vmean*Outer.HeatTransfer.Dh)/Outer.Properties.Average.Mu;
716
717"Outer Pipe Reynolds Number for Pressure Drop"
718        Outer.PressureDrop.Re = (Outer.Properties.Average.rho*Outer.HeatTransfer.Vmean*Outer.PressureDrop.Dh)/Outer.Properties.Average.Mu;
719
720"Inner Pipe Reynolds Number for Heat Transfer"
721        Inner.HeatTransfer.Re = (Inner.Properties.Average.rho*Inner.HeatTransfer.Vmean*Inner.HeatTransfer.Dh)/Inner.Properties.Average.Mu;
722
723"Inner Pipe Reynolds Number for Pressure Drop"
724        Inner.PressureDrop.Re = Inner.HeatTransfer.Re;
725
726"Outer Pipe Velocity"
727        Outer.HeatTransfer.Vmean*(Outer.HeatTransfer.As*Outer.Properties.Average.rho)  = Outer.Properties.Inlet.Fw;
728
729"Inner Pipe Velocity"
730        Inner.HeatTransfer.Vmean*(Inner.HeatTransfer.As*Inner.Properties.Average.rho)  = Inner.Properties.Inlet.Fw;
731
732"Overall Heat Transfer Coefficient Clean"
733        Details.Uc*((DoInner/(Inner.HeatTransfer.hcoeff*DiInner) )+(DoInner*ln(DoInner/DiInner)/(2*Kwall))+(1/(Outer.HeatTransfer.hcoeff)))=1;
734
735"Overall Heat Transfer Coefficient Dirty"
736        Details.Ud*(Rfi*(DoInner/DiInner) +  Rfo + (DoInner/(Inner.HeatTransfer.hcoeff*DiInner) )+(DoInner*ln(DoInner/DiInner)/(2*Kwall))+(1/(Outer.HeatTransfer.hcoeff)))=1;
737
738"Total Duty"
739        Details.Qtotal = sum(Details.Q);
740
741switch HotSide
742
743        case "outer":
744
745"Incremental Duty"
746        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Outer.Properties.Average.T - Inner.Properties.Average.T);
747
748        when InletInner.T > InletOuter.T switchto "inner";
749
750        case "inner":
751
752"Incremental Duty"
753        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Inner.Properties.Average.T - Outer.Properties.Average.T);
754
755        when InletInner.T < InletOuter.T switchto "outer";
756
757end
758
759for i in [2:N]
760
761"Incremental Enthalpy Inner Stream"
762        Inner.HeatTransfer.Enth(i) = (1-InletInner.v)*PP.LiquidEnthalpy(Inner.HeatTransfer.Tlocal(i), Inner.PressureDrop.Plocal(i), InletInner.z) - InletInner.v*PP.VapourEnthalpy(Inner.HeatTransfer.Tlocal(i), Inner.PressureDrop.Plocal(i), InletInner.z);
763
764"Incremental Enthalpy Outer Stream"
765        Outer.HeatTransfer.Enth(i) = (1-InletOuter.v)*PP.LiquidEnthalpy(Outer.HeatTransfer.Tlocal(i), Outer.PressureDrop.Plocal(i), InletOuter.z) - InletOuter.v*PP.VapourEnthalpy(Outer.HeatTransfer.Tlocal(i), Outer.PressureDrop.Plocal(i), InletOuter.z);
766
767end
768
769"Enthalpy of Inner Side - Inlet Boundary"
770        Inner.HeatTransfer.Enth(1) = InletInner.h;
771
772"Enthalpy of inner Side - Outlet Boundary"
773        Inner.HeatTransfer.Enth(N+1) = OutletInner.h;
774
775"Temperature of Inner Side - Inlet Boundary"
776        Inner.HeatTransfer.Tlocal(1) = InletInner.T;
777
778"Temperature of Inner Side - Outlet Boundary"
779        Inner.HeatTransfer.Tlocal(N+1) = OutletInner.T;
780
781"Pressure of Inner Side - Inlet Boundary"
782        Inner.PressureDrop.Plocal(1) = InletInner.P;
783
784"Pressure of Inner Side - Outlet Boundary"
785        Inner.PressureDrop.Plocal(N+1) = OutletInner.P;
786
787switch FlowDirection
788
789        case "cocurrent":
790
791"Enthalpy of Outer Side - Inlet Boundary"
792        Outer.HeatTransfer.Enth(1) = InletOuter.h;
793
794"Enthalpy of Outer Side - Outlet Boundary"
795        Outer.HeatTransfer.Enth(N+1) = OutletOuter.h;
796
797"Temperature of Outer Side - Inlet Boundary"
798        Outer.HeatTransfer.Tlocal(1) = InletOuter.T;
799
800"Temperature of Outer Side - Outlet Boundary"
801        Outer.HeatTransfer.Tlocal(N+1) = OutletOuter.T;
802
803"Pressure of Outer Side - Inlet Boundary"
804        Outer.PressureDrop.Plocal(1) = InletOuter.P;
805
806"Pressure of Outer Side - Outlet Boundary"
807        Outer.PressureDrop.Plocal(N+1) = OutletOuter.P;
808
809        case "counter":
810
811"Enthalpy of Outer Side - Inlet Boundary"
812        Outer.HeatTransfer.Enth(N+1) = InletOuter.h;
813
814"Enthalpy of Outer Side - Outlet Boundary"
815        Outer.HeatTransfer.Enth(1) = OutletOuter.h;
816
817"Temperature of Outer Side - Inlet Boundary"
818        Outer.HeatTransfer.Tlocal(N+1) = InletOuter.T;
819
820"Temperature of Outer Side - Outlet Boundary"
821        Outer.HeatTransfer.Tlocal(1) = OutletOuter.T;
822
823"Pressure of Outer Side - Inlet Boundary"
824        Outer.PressureDrop.Plocal(N+1) = InletOuter.P;
825
826"Pressure of Outer Side - Outlet Boundary"
827        Outer.PressureDrop.Plocal(1) = OutletOuter.P;
828
829end
830
831switch FlowDirection
832
833        case "cocurrent":
834
835"Total Pressure Drop Outer Stream"
836        Outer.PressureDrop.Pdrop  = Outer.PressureDrop.Pd_fric(N+1);
837
838"Outer Pipe Pressure Drop for friction"
839        Outer.PressureDrop.Pd_fric(2:N+1) = (2*Outer.PressureDrop.fi*Lincr(2:N+1)*Outer.Properties.Average.rho*Outer.HeatTransfer.Vmean^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi);
840
841"Outer Pipe Pressure Drop for friction"
842        Outer.PressureDrop.Pd_fric(1) = 0*'kPa';
843
844for i in [1:N]
845   
846"Outer Pipe Local Pressure"
847        Outer.PressureDrop.Plocal(i+1) =        Outer.PressureDrop.Plocal(1) - Outer.PressureDrop.Pd_fric(i+1);
848
849end
850
851        case "counter":
852
853"Total Pressure Drop Outer Stream"
854        Outer.PressureDrop.Pdrop  = Outer.PressureDrop.Pd_fric(1);
855
856for i in [1:N]
857
858"Outer Pipe Pressure Drop for friction"                 
859        Outer.PressureDrop.Pd_fric(i) = (2*Outer.PressureDrop.fi(i)*Lincr(1+N-i)*Outer.Properties.Average.rho(i)*Outer.HeatTransfer.Vmean(i)^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi(i));
860
861end
862
863"Outer Pipe Pressure Drop for friction"
864        Outer.PressureDrop.Pd_fric(N+1) = 0*'kPa';
865
866for i in [1:N]
867   
868"Outer Pipe Local Pressure"
869        Outer.PressureDrop.Plocal(i) =  Outer.PressureDrop.Plocal(N+1) - Outer.PressureDrop.Pd_fric(i+1);
870
871end
872
873end
874
875"Total Pressure Drop Inner Stream"
876        Inner.PressureDrop.Pdrop  = Inner.PressureDrop.Pd_fric(N+1);
877       
878"Inner Pipe Pressure Drop for friction"
879        Inner.PressureDrop.Pd_fric(2:N+1) = (2*Inner.PressureDrop.fi*Lincr(2:N+1)*Inner.Properties.Average.rho*Inner.HeatTransfer.Vmean^2)/(DiInner*Inner.HeatTransfer.Phi);
880
881"Inner Pipe Pressure Drop for friction"
882        Inner.PressureDrop.Pd_fric(1) = 0*'kPa';
883
884for i in [1:N]
885
886"Inner Pipe Local Pressure"
887        Inner.PressureDrop.Plocal(i+1) =        Inner.PressureDrop.Plocal(1) - Inner.PressureDrop.Pd_fric(i+1);
888
889end
890
891end
Note: See TracBrowser for help on using the repository browser.