1 | |
---|
2 | using "streams"; |
---|
3 | |
---|
4 | Model props |
---|
5 | |
---|
6 | ATTRIBUTES |
---|
7 | Pallete = false; |
---|
8 | Brief = "System properties for the pipe model"; |
---|
9 | Info = |
---|
10 | "== Contents == |
---|
11 | * Mass Density |
---|
12 | * Dynamic Viscosity |
---|
13 | * Molar Volume |
---|
14 | * Reynolds Number |
---|
15 | * Velocity |
---|
16 | "; |
---|
17 | |
---|
18 | PARAMETERS |
---|
19 | |
---|
20 | outer N as Integer (Brief = "Number of Profile Intervals", Default = 1, Lower = 1, Upper = 100); |
---|
21 | |
---|
22 | VARIABLES |
---|
23 | |
---|
24 | rho(N+1) as dens_mass (Brief = "Mass Density Profile" , Symbol = "\rho"); |
---|
25 | mu(N+1) as viscosity (Brief = "Viscosity Profile" , Symbol = "\mu"); |
---|
26 | Re(N+1) as Real (Brief = "Reynolds Number Profile"); |
---|
27 | Vel(N+1) as velocity (Brief = "Velocity Profile"); |
---|
28 | vm(N+1) as vol_mol (Brief = "Mixture Molar Volume Profile"); |
---|
29 | |
---|
30 | end |
---|
31 | |
---|
32 | Model pipe |
---|
33 | |
---|
34 | ATTRIBUTES |
---|
35 | Pallete = true; |
---|
36 | Icon = "icon/pipe"; |
---|
37 | Brief = "pipe"; |
---|
38 | Info = |
---|
39 | "This distributed model describes the pressure drop of a liquid stream flowing in a pipe. |
---|
40 | |
---|
41 | ==Assumptions== |
---|
42 | *The flow along the pipe is adiabatic; |
---|
43 | *The pipe is always full of liquid; |
---|
44 | *Cross sectional area is constant; |
---|
45 | *Newtonian fluid; |
---|
46 | *Steady-state; |
---|
47 | "; |
---|
48 | |
---|
49 | PARAMETERS |
---|
50 | |
---|
51 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
52 | outer PP as Plugin (Brief = "External Physical Properties",Type="PP"); |
---|
53 | |
---|
54 | N as Integer (Brief = "Number of Profile Intervals", Default = 1, Lower = 1, Upper = 100); |
---|
55 | pi as Real (Brief="pi number",Default=3.141592, Symbol = "\pi"); |
---|
56 | g as acceleration (Brief="Acceleration of gravity"); |
---|
57 | Lpipe as length (Brief="Pipe Length", Symbol = "L_{pipe}"); |
---|
58 | Hrise as length (Brief="Pipe Rise", Symbol = "H_{rise}"); |
---|
59 | Dpipe as length (Brief="Pipe Inner Diameter", Symbol = "D_{pipe}"); |
---|
60 | Apipe as area (Brief="Pipe Area", Symbol = "A_{pipe}"); |
---|
61 | Roughness as length (Brief="Pipe Roughness", Symbol = "\varepsilon"); |
---|
62 | |
---|
63 | FlowRegime as Switcher (Brief="Pipe flow regime ",Valid=["laminar","turbulent"],Default="laminar"); |
---|
64 | |
---|
65 | SET |
---|
66 | |
---|
67 | g = 1*'ga'; |
---|
68 | Apipe = 0.25*pi*Dpipe^2; |
---|
69 | |
---|
70 | VARIABLES |
---|
71 | |
---|
72 | in Inlet as stream (Brief = "Inlet Stream" ,PosX=0, PosY=0.5225, Symbol = "^{in}"); |
---|
73 | out Outlet as streamPH (Brief = "Outlet Stream",PosX=1, PosY=0.5225, Symbol = "^{out}"); |
---|
74 | Properties as props (Brief = "Pipe Properties", Symbol = " "); |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | Pdrop as pressure (Brief = "Total Pressure Drop", DisplayUnit = 'kPa',Lower = 0, Symbol = "\Delta P_{drop}"); |
---|
79 | dPfric(N+1) as pressure (Brief = "Friction Pressure Drop", DisplayUnit = 'kPa',Lower = 0, Symbol = "\Delta P_{fric}"); |
---|
80 | dPelv(N+1) as pressure (Brief = "Elevation Pressure Drop", DisplayUnit = 'kPa',Lower = 0 , Symbol = "\Delta P_{elev}"); |
---|
81 | Pincr(N+1) as pressure (Brief = "Pressure Profile", DisplayUnit = 'kPa' , Symbol = "P_{incr}"); |
---|
82 | Lincr(N+1) as length (Brief = "Length Points", Symbol = "L_{incr}"); |
---|
83 | f(N+1) as fricfactor (Brief = "Friction Factor"); |
---|
84 | |
---|
85 | EQUATIONS |
---|
86 | |
---|
87 | "Inlet Boudary for Pressure Profile" |
---|
88 | Pincr(1) = Inlet.P; |
---|
89 | |
---|
90 | "Outlet Boundary for Pressure Profile" |
---|
91 | Pincr(N+1) = Outlet.P; |
---|
92 | |
---|
93 | "Total Pressure Drop" |
---|
94 | Pdrop = dPfric(N+1) + dPelv(N+1); |
---|
95 | |
---|
96 | "Pipe Initial Length" |
---|
97 | Lincr(1) = 0*'m'; |
---|
98 | |
---|
99 | "Outlet Composition" |
---|
100 | Outlet.z = Inlet.z; |
---|
101 | |
---|
102 | "Outlet Temperature" |
---|
103 | Outlet.T = Inlet.T; |
---|
104 | |
---|
105 | "Molar Balance" |
---|
106 | Outlet.F = Inlet.F; |
---|
107 | |
---|
108 | "Velocity" |
---|
109 | Properties.Vel(1:N+1) = Inlet.F/Apipe*Properties.vm(1:N+1); |
---|
110 | |
---|
111 | "Reynolds Number" |
---|
112 | Properties.Re(1:N+1) = Properties.rho(1:N+1)*Properties.Vel(1:N+1)*Dpipe/Properties.mu(1:N+1); |
---|
113 | |
---|
114 | "Incremental Friction Pressure Drop" |
---|
115 | dPfric(1:N+1) = (2*f(1:N+1)*Lincr(1:N+1)*Properties.rho(1:N+1)*Properties.Vel(1:N+1)^2/Dpipe); |
---|
116 | |
---|
117 | if Hrise > Lpipe |
---|
118 | |
---|
119 | then |
---|
120 | "Incremental Elevation Pressure Drop Constraint" |
---|
121 | dPelv(1:N+1) = Properties.rho(1:N+1)*g*Lincr(1:N+1)*1; |
---|
122 | |
---|
123 | else |
---|
124 | "Incremental Elevation Pressure Drop" |
---|
125 | dPelv(1:N+1) = Properties.rho(1:N+1)*g*Lincr(1:N+1)*(Hrise/abs(Lpipe)); |
---|
126 | |
---|
127 | end |
---|
128 | |
---|
129 | for i in [1:N+1] |
---|
130 | |
---|
131 | "Density" |
---|
132 | Properties.rho(i) = PP.LiquidDensity(Inlet.T,Pincr(i),Inlet.z); |
---|
133 | |
---|
134 | "Viscosiyty" |
---|
135 | Properties.mu(i) = PP.LiquidViscosity(Inlet.T,Pincr(i),Inlet.z); |
---|
136 | |
---|
137 | "Molar Volume" |
---|
138 | Properties.vm(i) = PP.LiquidVolume(Inlet.T,Pincr(i),Inlet.z); |
---|
139 | |
---|
140 | end |
---|
141 | |
---|
142 | for i in [1:N] |
---|
143 | |
---|
144 | "Outlet Pressure" |
---|
145 | Pincr(i+1) = Pincr(1) - (dPfric(i+1) + dPelv(i+1)); |
---|
146 | |
---|
147 | "Incremental Length" |
---|
148 | Lincr(i+1) = i*abs(Lpipe)/N; |
---|
149 | |
---|
150 | end |
---|
151 | |
---|
152 | for i in [1:N+1] |
---|
153 | |
---|
154 | switch FlowRegime |
---|
155 | |
---|
156 | case "laminar": |
---|
157 | |
---|
158 | "Friction Factor for Pressure Drop - laminar Flow" |
---|
159 | f(i)*Properties.Re(i) = 16; |
---|
160 | |
---|
161 | when Properties.Re(i) > 2300 switchto "turbulent"; |
---|
162 | |
---|
163 | case "turbulent": |
---|
164 | |
---|
165 | "Friction Factor for Pressure Drop - Turbulent Flow" |
---|
166 | 1/sqrt(f(i))= -4*log(Roughness/Dpipe/3.7+1.255/Properties.Re(i)/sqrt(f(i))); |
---|
167 | |
---|
168 | when Properties.Re(i) <= 2300 switchto "laminar"; |
---|
169 | |
---|
170 | end |
---|
171 | |
---|
172 | end |
---|
173 | |
---|
174 | end |
---|
175 | |
---|
176 | |
---|
177 | |
---|
178 | FlowSheet Pipe_simples |
---|
179 | |
---|
180 | PARAMETERS |
---|
181 | PP as Plugin(Brief="Physical Properties", |
---|
182 | Type="PP", |
---|
183 | Components = [ "water"], |
---|
184 | LiquidModel = "PR", |
---|
185 | VapourModel = "PR" |
---|
186 | ); |
---|
187 | NComp as Integer; |
---|
188 | |
---|
189 | DEVICES |
---|
190 | Tube as pipe; |
---|
191 | Feed as simple_source; |
---|
192 | |
---|
193 | SET |
---|
194 | NComp = PP.NumberOfComponents; |
---|
195 | Tube.N = 10; |
---|
196 | |
---|
197 | CONNECTIONS |
---|
198 | Feed.Outlet to Tube.Inlet; |
---|
199 | |
---|
200 | SPECIFY |
---|
201 | Feed.F = 10 * 'mol/s'; |
---|
202 | Feed.P = 150 * 'kPa'; |
---|
203 | Feed.T = 281.75 * 'K'; |
---|
204 | Feed.MolarComposition = [1]; |
---|
205 | |
---|
206 | SET |
---|
207 | |
---|
208 | Tube.Lpipe = 30*'m'; |
---|
209 | Tube.Hrise = 5*'m'; |
---|
210 | |
---|
211 | Tube.Dpipe = 3*'in'; |
---|
212 | Tube.Roughness =4.572e-05*'m'; |
---|
213 | |
---|
214 | OPTIONS |
---|
215 | Dynamic = false; |
---|
216 | NLASolver( |
---|
217 | RelativeAccuracy = 1e-6 |
---|
218 | ); |
---|
219 | end |
---|
220 | |
---|