source: branches/tests/eml/pressure_changers/pipe.mso @ 343

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

testing a new model : pipe simples with pressure drop profile

File size: 4.2 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: pipe.mso 326 2007-08-17 19:25:59Z bicca $
17*--------------------------------------------------------------------*#
18using "streams";
19
20Model pipe
21
22ATTRIBUTES
23        Pallete         = true;
24        Icon            = "icon/pipe";         
25        Brief           = "Model of a simple pipe";
26        Info            =
27        "testing a model of pressure drop.";
28
29PARAMETERS
30
31        outer   NComp   as Integer(Brief = "Number of chemical components", Lower = 1);
32        outer PP                as Plugin (Brief = "External Physical Properties",Type="PP");
33
34        N                                       as Integer                      (Brief = "Number of Profile Intervals", Default = 1, Lower = 1, Upper = 300);
35        pi                              as Real                                 (Brief="pi number",Default=3.141592);
36        g                                       as acceleration         (Brief="Acceleration of gravity");
37        Lpipe                   as length                       (Brief="Pipe Length");
38        Hrise                           as length                       (Brief="Pipe Rise");
39        Dpipe                   as length                       (Brief="Pipe Inner Diameter");
40        Apipe                   as area                         (Brief="Pipe Area");
41        Roughness               as length                       (Brief="Pipe Roughness");
42
43        FlowRegime      as Switcher     (Brief="Pipe flow regime ",Valid=["laminar","turbulent"],Default="laminar");
44
45SET
46
47        g               = 1*'ga';
48        Apipe = 0.25*pi*Dpipe^2;
49
50SUBMODELS
51       
52        in              Inlet           as stream               (Brief = "Inlet Stream" , Symbol = "^in");
53        out     Outlet  as streamPH     (Brief = "Outlet Stream", Symbol = "^out");
54
55VARIABLES
56
57        Pdrop                   as pressure     (Brief = "Total Pressure Drop", DisplayUnit = 'kPa',Lower = 0, Symbol = "\Delta P_{drop}");
58        dPfric(N+1)     as pressure     (Brief = "Friction Pressure Drop", DisplayUnit = 'kPa',Lower = 0, Symbol = "\Delta P_{fric}");
59        dPelv(N+1)      as pressure     (Brief = "Elevation Pressure Drop", DisplayUnit = 'kPa',Lower = 0 , Symbol = "\Delta P_{elev}");
60        Pincr(N+1)              as pressure             (Brief = "Pressure Profile", DisplayUnit = 'kPa' , Symbol = "P_{incr}");
61        Lincr(N+1)              as length               (Brief = "Length Points", Symbol = "L_{incr}");
62        Vel(N+1)                as velocity             (Brief = "Velocity Profile");
63        vm(N+1)                 as vol_mol              (Brief = "Mixture Molar Volume Profile");
64        f(N+1)                  as fricfactor   (Brief = "Friction Factor");
65       
66        rho(N+1)        as dens_mass    (Brief = "Mass Density Profile" , Symbol = "\rho");
67        mu(N+1)         as viscosity    (Brief = "Viscosity Profile" , Symbol = "\mu");
68        Re(N+1)         as Real                 (Brief = "Reynolds Number Profile");
69
70EQUATIONS
71
72"Inlet Boudary for Pressure Profile"
73        Pincr(1) =  Inlet.P;
74
75"Outlet Boundary for Pressure Profile"
76        Pincr(N+1) = Outlet.P;
77
78"Total Pressure Drop"
79        Pdrop = dPfric(N+1) + dPelv(N+1);
80       
81"Pipe Initial Length"
82        Lincr(1) = 0*'m';
83
84"Outlet Composition"
85        Outlet.z = Inlet.z;
86       
87"Outlet Temperature"
88        Outlet.T = Inlet.T;
89       
90"Molar Balance"
91        Outlet.F = Inlet.F;
92
93for i in [1:N+1]
94
95"Velocity"
96        Vel(i) = Inlet.F/Apipe*vm(i);
97
98"Reynolds Number"
99        Re(i)   = rho(i)*Vel(i)*Dpipe/mu(i);
100
101"Density"
102        rho(i) = PP.LiquidDensity(Inlet.T,Pincr(i),Inlet.z);
103       
104"Viscosiyty"
105        mu(i) = PP.LiquidViscosity(Inlet.T,Pincr(i),Inlet.z);
106       
107"Molar Volume"
108        vm(i) = PP.LiquidVolume(Inlet.T,Pincr(i),Inlet.z);
109
110"Incremental Friction Pressure Drop"
111        dPfric(i)       = (2*f(i)*Lincr(i)*rho(i)*Vel(i)^2/Dpipe);
112
113"Incremental Elevation Pressure Drop"
114        dPelv(i)        = rho(i)*g*Lincr(i)*(Hrise/Lpipe);
115
116end
117
118for i in [1:N]
119       
120"Outlet Pressure"
121        Pincr(i+1) = Pincr(1) - (dPfric(i+1) + dPelv(i+1));
122
123"Incremental Length"
124        Lincr(i+1) = i*Lpipe/N;
125
126end
127
128for i in [1:N+1]
129       
130switch FlowRegime
131       
132        case "laminar":
133       
134"Friction Factor for Pressure Drop - laminar Flow"
135        f(i)*Re(i) = 16;
136       
137        when Re(i) > 2300 switchto "turbulent";
138
139        case "turbulent":
140
141"Friction Factor  for Pressure Drop - Turbulent Flow"
142        1/sqrt(f(i))= -4*log(Roughness/Dpipe/3.7+1.255/Re(i)/sqrt(f(i)));
143
144        when Re(i) <= 2300 switchto "laminar";
145       
146end
147
148end
149
150end
Note: See TracBrowser for help on using the repository browser.