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

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

updated model double pipe incremental

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