1 | |
---|
2 | using "streams"; |
---|
3 | # Not Finished yet !!!! |
---|
4 | # Do Not Use it |
---|
5 | |
---|
6 | Model props |
---|
7 | |
---|
8 | ATTRIBUTES |
---|
9 | Pallete = false; |
---|
10 | Brief = "System properties for the pipe model"; |
---|
11 | |
---|
12 | PARAMETERS |
---|
13 | |
---|
14 | outer N as Integer (Brief = "Number of Profile Intervals", Default = 1, Lower = 1, Upper = 100); |
---|
15 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
16 | |
---|
17 | VARIABLES |
---|
18 | |
---|
19 | Fw(N+1) as flow_mass (Brief = "Mass Flow Profile" , Symbol = "F_w"); |
---|
20 | rho(N+1) as dens_mass (Brief = "Mass Density Profile" , Symbol = "\rho"); |
---|
21 | mu(N+1) as viscosity (Brief = "Viscosity Profile" , Symbol = "\mu"); |
---|
22 | |
---|
23 | Vel(N+1) as velocity (Brief = "Velocity Profile"); |
---|
24 | vm(N+1) as vol_mol (Brief = "Molar Volume Profile"); |
---|
25 | frac(N+1) as fraction (Brief = "Molar Fraction Profile"); |
---|
26 | Vsfrac(N+1) as fraction (Brief = "No Slip Volume Fraction Profile",Lower=0); |
---|
27 | Holdup(N+1) as fraction (Brief = "Holdup Profile",Lower=0); |
---|
28 | Mfrac(N+1,NComp) as fraction (Brief = "Phase Molar Fraction Profile"); |
---|
29 | h(N+1) as enth_mol (Brief = "Molar Enthalpy profile"); |
---|
30 | |
---|
31 | end |
---|
32 | |
---|
33 | Model pipe |
---|
34 | |
---|
35 | ATTRIBUTES |
---|
36 | Pallete = true; |
---|
37 | Icon = "icon/pipe"; |
---|
38 | Brief = "pipe"; |
---|
39 | Info = |
---|
40 | "This distributed model describes the pressure drop of a material stream flowing in a pipe. |
---|
41 | |
---|
42 | ==Assumptions== |
---|
43 | *Cross sectional area is constant; |
---|
44 | *Newtonian fluid; |
---|
45 | *Steady-state; |
---|
46 | "; |
---|
47 | |
---|
48 | PARAMETERS |
---|
49 | |
---|
50 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
51 | outer PP as Plugin (Brief = "External Physical Properties",Type="PP"); |
---|
52 | |
---|
53 | N as Integer (Brief = "Number of Profile Intervals", Default = 1, Lower = 1, Upper = 100); |
---|
54 | pi as Real (Brief="pi number",Default=3.141592, Symbol = "\pi"); |
---|
55 | eps as Real (Brief="Small Number",Default=1E-8); |
---|
56 | g as acceleration (Brief="Acceleration of gravity"); |
---|
57 | Lpipe as length (Brief="Pipe Length", Symbol = "L_{pipe}"); |
---|
58 | Hrise as angle (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 | M(NComp) as molweight (Brief="Component Mol Weight"); |
---|
63 | FlowRegime as Switcher (Brief="Pipe flow regime",Valid=["laminar","turbulent"],Default="laminar"); |
---|
64 | Correlation as Switcher (Brief="Holdup Correlation for Two Phase Flow", Valid=["Beggs-Brill","Lockhart-Martinelli"], Default="Beggs-Brill"); |
---|
65 | Thermal as Switcher (Brief="Pipe Thermal Specification ",Valid=["Constant Temperature","Linear Temperature profile"],Default="Constant Temperature"); |
---|
66 | Toutlet as temperature (Brief= "Outlet Temperature", Symbol = "T_{out}"); |
---|
67 | |
---|
68 | SET |
---|
69 | |
---|
70 | g = 1*'ga'; |
---|
71 | Apipe = 0.25*pi*Dpipe^2; |
---|
72 | M = PP.MolecularWeight(); |
---|
73 | |
---|
74 | VARIABLES |
---|
75 | |
---|
76 | in Inlet as stream (Brief = "Inlet Stream" ,PosX=0, PosY=0.5225, Symbol = "^{in}"); |
---|
77 | out Outlet as streamPH (Brief = "Outlet Stream",PosX=1, PosY=0.5225, Symbol = "^{out}"); |
---|
78 | |
---|
79 | Liquid as props (Brief = "Liquid Properties", Symbol = " "); |
---|
80 | Vapour as props (Brief = "Vapour Properties", Symbol = " "); |
---|
81 | |
---|
82 | Tincr(N+1) as temperature (Brief = "Temperature Profile", Symbol = "T_{incr}"); |
---|
83 | |
---|
84 | Pdrop as pressure (Brief = "Total Pressure Drop", DisplayUnit = 'kPa',Lower = 0, Symbol = "\Delta P_{drop}"); |
---|
85 | dPfricTotal as pressure (Brief = "Total Friction Pressure Drop", DisplayUnit = 'kPa',Lower = 0, Symbol = "\Delta Ptotal_{fric}"); |
---|
86 | dPelvTotal as pressure (Brief = "Total Elevation Pressure Drop", DisplayUnit = 'kPa',Lower = 0 , Symbol = "\Delta Ptotal_{elev}"); |
---|
87 | dPaccTotal as pressure (Brief = "Total Acceleration Pressure Drop", DisplayUnit = 'kPa',Lower = 0 , Symbol = "\Delta Ptotal_{acc}"); |
---|
88 | dPfric(N+1) as pressure (Brief = "Friction Pressure Drop", DisplayUnit = 'kPa',Lower = 0, Symbol = "\Delta P_{fric}"); |
---|
89 | dPelv(N+1) as pressure (Brief = "Elevation Pressure Drop", DisplayUnit = 'kPa',Lower = 0 , Symbol = "\Delta P_{elev}"); |
---|
90 | dPacc(N+1) as pressure (Brief = "Acceleration Pressure Drop", DisplayUnit = 'kPa',Lower = 0 , Symbol = "\Delta P_{acc}"); |
---|
91 | Pincr(N+1) as pressure (Brief = "Pressure Profile", DisplayUnit = 'kPa' , Symbol = "P_{incr}"); |
---|
92 | |
---|
93 | Lincr(N+1) as length (Brief = "Length Points", Symbol = "L_{incr}"); |
---|
94 | fns(N+1) as fricfactor (Brief = "No Slip Friction Factor"); |
---|
95 | ftp(N+1) as fricfactor (Brief = "Two phase Friction Factor"); |
---|
96 | Mw as molweight (Brief = "Average Mol Weight"); |
---|
97 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
98 | Re(N+1) as Real (Brief = "Reynolds Number Profile"); |
---|
99 | Fw as flow_mass (Brief = "Total Mass Flow Profile" , Lower = 0,DisplayUnit = 'kg/h', Symbol = "F_w"); |
---|
100 | |
---|
101 | rho(N+1) as dens_mass (Brief = "Mass Density Profile" , Symbol = "\rho"); |
---|
102 | mu(N+1) as viscosity (Brief = "Viscosity Profile" , Symbol = "\mu"); |
---|
103 | Vel(N+1) as velocity (Brief = "Velocity Profile"); |
---|
104 | vm(N+1) as vol_mol (Brief = "Mixture Molar Volume Profile"); |
---|
105 | h(N+1) as enth_mol (Brief = "Molar Enthalpy profile"); |
---|
106 | |
---|
107 | dPdLfric(N+1) as positive (Brief = "Friction Gradient",Lower = 0, Unit = 'Pa/m', DisplayUnit = 'kPa/m'); |
---|
108 | dPelvdL(N+1) as positive (Brief = "Elevation Gradient", Lower = 0 , Unit = 'Pa/m', DisplayUnit = 'kPa/m'); |
---|
109 | #dPaccdL(N+1) as positive (Brief = "Acceleration Gradient",Lower = 0 , Unit = 'Pa/m', DisplayUnit = 'kPa/m'); |
---|
110 | |
---|
111 | #Beggs&Brill Method |
---|
112 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
113 | NFR(N+1) as positive (Brief="Froude Number", Lower=1E-10,Symbol = "N_{FR}"); |
---|
114 | BBLine1(N+1) as positive (Brief="Beggs and Brill Correlation Parameter 1"); |
---|
115 | BBLine2(N+1) as positive (Brief="Beggs and Brill Correlation Parameter 2"); |
---|
116 | BBLine3(N+1) as positive (Brief="Beggs and Brill Correlation Parameter 3"); |
---|
117 | BBLine4(N+1) as positive (Brief="Beggs and Brill Correlation Parameter 4"); |
---|
118 | Map(N+1) as positive (Brief="Beggs and Brill Flag ");#apenas verificação do algoritmo |
---|
119 | Atrans(N+1) as positive (Brief="Beggs and Brill Correction When Flow is in Transition Pattern"); |
---|
120 | Y(N+1) as positive (Brief="Beggs and Brill Correction for Friction Factor in Two Phase Flow"); |
---|
121 | S(N+1) as Real (Brief="Beggs and Brill Correction for Friction Factor in Two Phase Flow"); |
---|
122 | |
---|
123 | #Lockhart&Martinelli Method |
---|
124 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
125 | |
---|
126 | XLM(N+1) as Real (Brief="Lockhart and Martinelli Parameter - Square", Lower=1E-6); |
---|
127 | PhiLM(N+1) as Real (Brief="Lockhart and Martinelli Two phase Multiplier - Square", Lower=1E-3); |
---|
128 | |
---|
129 | EQUATIONS |
---|
130 | |
---|
131 | "Total Average Molecular Weight" |
---|
132 | Mw = sum(M*Inlet.z); |
---|
133 | |
---|
134 | "Froude Number" |
---|
135 | NFR =Vel*Vel/(g*Dpipe); |
---|
136 | |
---|
137 | "No Slip Liquid Volume Fraction" |
---|
138 | Liquid.Vsfrac = Liquid.Vel/Vel; |
---|
139 | |
---|
140 | "No Slip Vapour Volume Fraction" |
---|
141 | Vapour.Vsfrac = Vapour.Vel/Vel; |
---|
142 | |
---|
143 | "Vapour Holdup" |
---|
144 | Vapour.Holdup=1-Liquid.Holdup; |
---|
145 | |
---|
146 | for i in [1:N+1] |
---|
147 | |
---|
148 | if Vapour.frac(i) equal 0 then # Only Liquid phase |
---|
149 | |
---|
150 | "Reynolds Number" |
---|
151 | Re(i)*mu(i) = rho(i)*Vel(i)*Dpipe; |
---|
152 | |
---|
153 | "Liquid Superficial Velocity" |
---|
154 | Liquid.Vel(i) = Liquid.Fw(i)/Apipe/Liquid.rho(i); |
---|
155 | |
---|
156 | "Vapour Superficial Velocity" |
---|
157 | Vapour.Vel(i) = 0*'m/s'; |
---|
158 | |
---|
159 | "Liquid Mass Flow" |
---|
160 | Liquid.Fw(i) = Fw; |
---|
161 | |
---|
162 | "Vapour Mass Flow" |
---|
163 | Vapour.Fw(i) = 0*Fw; |
---|
164 | |
---|
165 | "Liquid Holdup" |
---|
166 | Liquid.Holdup(i) = 1; |
---|
167 | |
---|
168 | "Lockhart-martinelli Two Phase Multiplier" |
---|
169 | XLM(i) = 1; |
---|
170 | |
---|
171 | PhiLM(i) = 1; |
---|
172 | |
---|
173 | "Beggs and Brill Line 1" |
---|
174 | BBLine1(i) = 1; |
---|
175 | |
---|
176 | "Beggs and Brill Line 2" |
---|
177 | BBLine2(i) = 1; |
---|
178 | |
---|
179 | "Beggs and Brill Line 3" |
---|
180 | BBLine3(i) = 1; |
---|
181 | |
---|
182 | "Beggs and Brill Line 4" |
---|
183 | BBLine4(i) = 1; |
---|
184 | |
---|
185 | Map(i)=10; |
---|
186 | Atrans(i) = 1; |
---|
187 | Y(i) = 1; |
---|
188 | |
---|
189 | ftp(i)= 1; |
---|
190 | |
---|
191 | S(i)= 1; |
---|
192 | |
---|
193 | else if Liquid.frac(i) equal 0 then # Only Vapour phase |
---|
194 | |
---|
195 | "Reynolds Number" |
---|
196 | Re(i)*mu(i) = rho(i)*Vel(i)*Dpipe; |
---|
197 | |
---|
198 | "Vapour Superficial Velocity" |
---|
199 | Vapour.Vel(i) = Vapour.Fw(i)/Apipe/Vapour.rho(i); |
---|
200 | |
---|
201 | "Liquid Superficial Velocity" |
---|
202 | Liquid.Vel(i) = 0*'m/s'; |
---|
203 | |
---|
204 | "Liquid Mass Flow" |
---|
205 | Liquid.Fw(i) = 0*Fw; |
---|
206 | |
---|
207 | "Vapour Mass Flow" |
---|
208 | Vapour.Fw(i) = Fw; |
---|
209 | |
---|
210 | "Liquid Holdup" |
---|
211 | Liquid.Holdup(i) = 0; |
---|
212 | |
---|
213 | "Lockhart-martinelli Two Phase Multiplier" |
---|
214 | XLM(i) = 1; |
---|
215 | |
---|
216 | PhiLM(i) = 1; |
---|
217 | |
---|
218 | "Beggs and Brill Line 1" |
---|
219 | BBLine1(i) = 1; |
---|
220 | |
---|
221 | "Beggs and Brill Line 2" |
---|
222 | BBLine2(i) = 1; |
---|
223 | |
---|
224 | "Beggs and Brill Line 3" |
---|
225 | BBLine3(i) = 1; |
---|
226 | |
---|
227 | "Beggs and Brill Line 4" |
---|
228 | BBLine4(i) = 1; |
---|
229 | |
---|
230 | Map(i)=11; |
---|
231 | Atrans(i) = 1; |
---|
232 | Y(i) = 1; |
---|
233 | |
---|
234 | ftp(i)= 1; |
---|
235 | |
---|
236 | S(i)= 1; |
---|
237 | |
---|
238 | else # Two phase |
---|
239 | |
---|
240 | "Reynolds Number" |
---|
241 | Re(i)*(Liquid.mu(i)*Liquid.Vsfrac(i)+Vapour.mu(i)*Vapour.Vsfrac(i))= (Liquid.rho(i)*Liquid.Vsfrac(i)+Vapour.rho(i)*Vapour.Vsfrac(i))*Vel(i)*Dpipe; #no sip Reynolds Number |
---|
242 | |
---|
243 | "Vapour Superficial Velocity" |
---|
244 | Vapour.Vel(i) = Vapour.Fw(i)/Apipe/Vapour.rho(i); |
---|
245 | |
---|
246 | "Liquid Superficial Velocity" |
---|
247 | Liquid.Vel(i) = Liquid.Fw(i)/Apipe/Liquid.rho(i); |
---|
248 | |
---|
249 | "Liquid Mass Flow" |
---|
250 | Liquid.Fw(i)= Inlet.F*Liquid.frac(i)*sumt(M(1:NComp)*Liquid.Mfrac(i,1:NComp)); |
---|
251 | |
---|
252 | "Vapour Mass Flow" |
---|
253 | Vapour.Fw(i) = Inlet.F*Vapour.frac(i)*sumt(M(1:NComp)*Vapour.Mfrac(i,1:NComp)); |
---|
254 | |
---|
255 | switch Correlation |
---|
256 | |
---|
257 | case "Beggs-Brill": |
---|
258 | |
---|
259 | "Lockhart-martinelli Two Phase Multiplier" |
---|
260 | XLM(i) = 1; |
---|
261 | |
---|
262 | PhiLM(i) = 1; |
---|
263 | |
---|
264 | "Beggs and Brill Line 1" |
---|
265 | BBLine1(i) = 2.499687083 + 0.302*log(Liquid.Vsfrac(i));#aplicado o log somente no lado direito da equação |
---|
266 | |
---|
267 | "Beggs and Brill Line 2" |
---|
268 | BBLine2(i) = -3.033764376 - 2.4684*log(Liquid.Vsfrac(i));#aplicado o log somente no lado direito da equação |
---|
269 | |
---|
270 | "Beggs and Brill Line 3" |
---|
271 | BBLine3(i) = -1 - 1.4516*log(Liquid.Vsfrac(i));#aplicado o log somente no lado direito da equação |
---|
272 | |
---|
273 | "Beggs and Brill Line 4" |
---|
274 | BBLine4(i) = -0.301029996 - 6.738*log(Liquid.Vsfrac(i));#aplicado o log somente no lado direito da equação |
---|
275 | |
---|
276 | Y(i)*Liquid.Holdup(i)*Liquid.Holdup(i) = Liquid.Vsfrac(i); |
---|
277 | |
---|
278 | ftp(i)= fns(i)*exp(S(i)); |
---|
279 | |
---|
280 | S(i)= ln(abs(2.2*Y(i)-1.2)); |
---|
281 | |
---|
282 | # Find the Flow Pattern for Beggs-Brill Method |
---|
283 | #++++++++++++++++++++++++++++++++++++++++++ |
---|
284 | if NFR(i) < 10^BBLine1(i) and Liquid.Vsfrac(i) < 0.01 |
---|
285 | then |
---|
286 | "Liquid Holdup in Segregated Flow" |
---|
287 | Liquid.Holdup(i)*NFR(i)^0.0868 = 0.98*Liquid.Vsfrac(i)^(0.4846); |
---|
288 | Atrans(i) = 1; |
---|
289 | Map(i)=1; |
---|
290 | |
---|
291 | else |
---|
292 | if NFR(i) < 10^BBLine2(i) and Liquid.Vsfrac(i) >= 0.01 |
---|
293 | then |
---|
294 | "Liquid Holdup in Segregated Flow" |
---|
295 | Liquid.Holdup(i)*NFR(i)^0.0868 = 0.98*Liquid.Vsfrac(i)^(0.4846); |
---|
296 | Atrans(i) = 1; |
---|
297 | Map(i)=1; |
---|
298 | |
---|
299 | else |
---|
300 | if NFR(i) > 10^BBLine2(i) and NFR(i) <= 10^BBLine3(i) and Liquid.Vsfrac(i) >= 0.01 |
---|
301 | then |
---|
302 | "Liquid Holdup in Transition Flow"#usando segregated, deve ser por interpolação!!! |
---|
303 | Liquid.Holdup(i)*NFR(i)^0.0868 = 0.98*Liquid.Vsfrac(i)^(0.4846); |
---|
304 | |
---|
305 | Atrans(i) = abs(10^BBLine3(i) - NFR(i))/(abs(10^BBLine3(i) - 10^BBLine2(i))+eps); |
---|
306 | Map(i)=2; |
---|
307 | |
---|
308 | else |
---|
309 | if NFR(i) > 10^BBLine3(i) and NFR(i) <= 10^BBLine1(i) and Liquid.Vsfrac(i) >= 0.01 and Liquid.Vsfrac(i) < 0.4 |
---|
310 | then |
---|
311 | "Liquid Holdup in Intermittent Flow" |
---|
312 | Liquid.Holdup(i)*NFR(i)^0.0173 = 0.845*Liquid.Vsfrac(i)^(0.5351); |
---|
313 | Atrans(i) = 1; |
---|
314 | Map(i)=3; |
---|
315 | |
---|
316 | else |
---|
317 | if NFR(i) > 10^BBLine3(i) and NFR(i) <= 10^BBLine4(i) and Liquid.Vsfrac(i) >= 0.4 |
---|
318 | then |
---|
319 | "Liquid Holdup in Intermittent Flow" |
---|
320 | Liquid.Holdup(i)*NFR(i)^0.0173 = 0.845*Liquid.Vsfrac(i)^(0.5351); |
---|
321 | Atrans(i) = 1; |
---|
322 | Map(i)=3; |
---|
323 | |
---|
324 | else |
---|
325 | if NFR(i) >= 10^BBLine1(i) and Liquid.Vsfrac(i) <= 0.4 |
---|
326 | then |
---|
327 | "Liquid Holdup in Distributed Flow" |
---|
328 | Liquid.Holdup(i)*NFR(i)^0.0609 = 1.065*Liquid.Vsfrac(i)^(0.5824); |
---|
329 | Atrans(i) = 1; |
---|
330 | Map(i)=4; |
---|
331 | |
---|
332 | else |
---|
333 | if NFR(i) > 10^BBLine4(i) and Liquid.Vsfrac(i) >= 0.4 |
---|
334 | then |
---|
335 | "Liquid Holdup in Distributed Flow" |
---|
336 | Liquid.Holdup(i)*NFR(i)^0.0609 = 1.065*Liquid.Vsfrac(i)^(0.5824); |
---|
337 | Atrans(i) = 1; |
---|
338 | Map(i)=4; |
---|
339 | |
---|
340 | else |
---|
341 | "Outside the Range of Beggs-Brill Method" |
---|
342 | Liquid.Holdup(i) = Liquid.Vsfrac(i); |
---|
343 | Atrans(i) = 1; |
---|
344 | Map(i)=5; |
---|
345 | |
---|
346 | end |
---|
347 | |
---|
348 | end |
---|
349 | |
---|
350 | end |
---|
351 | |
---|
352 | end |
---|
353 | |
---|
354 | end |
---|
355 | |
---|
356 | end |
---|
357 | |
---|
358 | end |
---|
359 | #++++++++++++++++++++++++++++++++++++++++++ |
---|
360 | case "Lockhart-Martinelli": |
---|
361 | |
---|
362 | "Do Not Use Variables related to Beggs and Brill Method" |
---|
363 | BBLine1(i) = 1; |
---|
364 | |
---|
365 | "Do Not Use Variables related to Beggs and Brill Method" |
---|
366 | BBLine2 (i)= 1; |
---|
367 | |
---|
368 | "Do Not Use Variables related to Beggs and Brill Method" |
---|
369 | BBLine3(i) = 1; |
---|
370 | |
---|
371 | "Do Not Use Variables related to Beggs and Brill Method" |
---|
372 | BBLine4 (i)= 1; |
---|
373 | |
---|
374 | "Lockhart-martinelli Two Phase Multiplier" |
---|
375 | XLM(i)*Vapour.rho(i)*Vapour.Vel(i)^2 = Liquid.rho(i)*Liquid.Vel(i)^2; |
---|
376 | |
---|
377 | PhiLM(i) = 1+20/sqrt(XLM(i))+1/XLM(i); |
---|
378 | |
---|
379 | "Liquid Holdup" |
---|
380 | Liquid.Holdup(i) = (1/abs(PhiLM(i)))^(1/3); |
---|
381 | |
---|
382 | Atrans(i) = 1; |
---|
383 | |
---|
384 | Map(i)=20; |
---|
385 | |
---|
386 | Y(i)=1; |
---|
387 | |
---|
388 | ftp(i)= 1; |
---|
389 | |
---|
390 | S(i)= 1; |
---|
391 | |
---|
392 | end |
---|
393 | |
---|
394 | |
---|
395 | end |
---|
396 | |
---|
397 | end |
---|
398 | |
---|
399 | end |
---|
400 | |
---|
401 | "Mass Fraction" |
---|
402 | zmass = M*Outlet.z / Mw; |
---|
403 | |
---|
404 | "Total Mass Flow" |
---|
405 | Fw = sum(M*Inlet.z)*Inlet.F; |
---|
406 | |
---|
407 | "Inlet Boudary for Temperature Profile" |
---|
408 | Tincr(1) = Inlet.T; |
---|
409 | |
---|
410 | "Outlet Boundary for Temperature Profile" |
---|
411 | Tincr(N+1) = Outlet.T; |
---|
412 | |
---|
413 | "Inlet Boudary for Pressure Profile" |
---|
414 | Pincr(1) = Inlet.P; |
---|
415 | |
---|
416 | "Outlet Boundary for Pressure Profile" |
---|
417 | Pincr(N+1) = Outlet.P; |
---|
418 | |
---|
419 | "Total Pressure Drop" |
---|
420 | Pdrop = dPfricTotal+ dPelvTotal + dPaccTotal; |
---|
421 | |
---|
422 | "Total Pressure Drop for Friction" |
---|
423 | dPfricTotal = dPfric(N+1); |
---|
424 | |
---|
425 | "Total Pressure Drop for Elevation" |
---|
426 | dPelvTotal = dPelv(N+1); |
---|
427 | |
---|
428 | "Total Pressure Drop for Acceleration " |
---|
429 | dPaccTotal= sum(dPacc); |
---|
430 | |
---|
431 | "Pipe Initial Length" |
---|
432 | Lincr(1) = 0*'m'; |
---|
433 | |
---|
434 | "Outlet Composition" |
---|
435 | Outlet.z = Inlet.z; |
---|
436 | |
---|
437 | "Molar Balance" |
---|
438 | Outlet.F = Inlet.F; |
---|
439 | |
---|
440 | "Mixture Velocity" |
---|
441 | Vel= Vapour.Vel+Liquid.Vel; |
---|
442 | |
---|
443 | "Incremental Acceleration Pressure Drop at Pipe Entry" |
---|
444 | dPacc(1) = 0*'Pa'; |
---|
445 | |
---|
446 | "Incremental Elevation Pressure Drop" |
---|
447 | dPelv= rho*g*Lincr*sin(Hrise); |
---|
448 | |
---|
449 | dPelvdL= rho*g*sin(Hrise); |
---|
450 | |
---|
451 | "Incremental Friction Pressure Drop" |
---|
452 | #dPfric = (0.5*fns*Lincr*(Liquid.rho*Liquid.Vsfrac+Vapour.rho*Vapour.Vsfrac)*Vel*Vel/Dpipe); |
---|
453 | dPfric = PhiLM*(0.5*fns*Lincr*(Liquid.rho*Liquid.Vsfrac+Vapour.rho*Vapour.Vsfrac)*Vel*Vel/Dpipe); |
---|
454 | |
---|
455 | dPdLfric = (0.5*fns*(Liquid.rho*Liquid.Vsfrac+Vapour.rho*Vapour.Vsfrac)*Vel*Vel/Dpipe); |
---|
456 | |
---|
457 | for i in [1:N+1] |
---|
458 | |
---|
459 | "Flash Calculation" |
---|
460 | [Vapour.frac(i), Liquid.Mfrac(i,:), Vapour.Mfrac(i,:)] = PP.FlashPH(Pincr(i), h(i), Inlet.z); |
---|
461 | |
---|
462 | "Liquid Fraction" |
---|
463 | Liquid.frac(i) = 1-Vapour.frac(i); |
---|
464 | |
---|
465 | "Enthalpy" |
---|
466 | h(i) = Liquid.frac(i)*Liquid.h(i) + Vapour.frac(i)*Vapour.h(i); |
---|
467 | |
---|
468 | Liquid.h(i) = PP.LiquidEnthalpy(Tincr(i),Pincr(i),Liquid.Mfrac(i,:)); |
---|
469 | |
---|
470 | Vapour.h(i) = PP.VapourEnthalpy(Tincr(i),Pincr(i),Vapour.Mfrac(i,:)); |
---|
471 | |
---|
472 | "Density" |
---|
473 | rho(i) = Liquid.frac(i)*Liquid.rho(i)+Vapour.frac(i)*Vapour.rho(i); |
---|
474 | |
---|
475 | Liquid.rho(i) = PP.LiquidDensity(Tincr(i),Pincr(i),Liquid.Mfrac(i,:)); |
---|
476 | |
---|
477 | Vapour.rho(i) = PP.VapourDensity(Tincr(i),Pincr(i),Vapour.Mfrac(i,:)); |
---|
478 | |
---|
479 | "Viscosiyty" |
---|
480 | |
---|
481 | mu(i) = Liquid.frac(i)*Liquid.mu(i)+Vapour.frac(i)*Vapour.mu(i); |
---|
482 | |
---|
483 | Liquid.mu(i) = PP.LiquidViscosity(Tincr(i),Pincr(i),Liquid.Mfrac(i,:)); |
---|
484 | |
---|
485 | Vapour.mu(i) = PP.VapourViscosity(Tincr(i),Pincr(i),Vapour.Mfrac(i,:)); |
---|
486 | |
---|
487 | "Molar Volume" |
---|
488 | vm(i) = Liquid.frac(i)*Liquid.vm(i)+Vapour.frac(i)*Vapour.vm(i); |
---|
489 | |
---|
490 | Liquid.vm(i) = PP.LiquidVolume(Tincr(i),Pincr(i),Liquid.Mfrac(i,:)); |
---|
491 | |
---|
492 | Vapour.vm(i) = PP.VapourVolume(Tincr(i),Pincr(i),Vapour.Mfrac(i,:)); |
---|
493 | |
---|
494 | end |
---|
495 | |
---|
496 | for i in [1:N] |
---|
497 | |
---|
498 | "Outlet Pressure" |
---|
499 | Pincr(i+1) = Pincr(1) - (dPfric(i+1) + dPelv(i+1) + dPacc(i+1)); |
---|
500 | |
---|
501 | "Incremental Acceleration Pressure Drop" |
---|
502 | dPacc(i+1) = (Fw/Apipe)^2*(1/rho(i+1)-1/rho(i)); |
---|
503 | |
---|
504 | "Incremental Length" |
---|
505 | Lincr(i+1) = i*abs(Lpipe)/N; |
---|
506 | |
---|
507 | end |
---|
508 | |
---|
509 | for i in [1:N] |
---|
510 | |
---|
511 | switch Thermal |
---|
512 | |
---|
513 | case "Constant Temperature": |
---|
514 | "Outlet Temperature" |
---|
515 | Tincr(i+1) = Inlet.T; |
---|
516 | |
---|
517 | case "Linear Temperature profile": |
---|
518 | "Outlet Temperature" |
---|
519 | Toutlet - Tincr(1) = Lpipe*((Tincr(i+1)-Tincr(i))/(Lincr(i+1)-Lincr(i))); |
---|
520 | |
---|
521 | end |
---|
522 | |
---|
523 | end |
---|
524 | |
---|
525 | for i in [1:N+1] |
---|
526 | |
---|
527 | switch FlowRegime |
---|
528 | |
---|
529 | case "laminar": |
---|
530 | |
---|
531 | "Friction Factor for Pressure Drop - laminar Flow" |
---|
532 | fns(i)*Re(i) = 16; |
---|
533 | |
---|
534 | when Re(i) > 2300 switchto "turbulent"; |
---|
535 | |
---|
536 | case "turbulent": |
---|
537 | |
---|
538 | "Friction Factor for Pressure Drop - Turbulent Flow" |
---|
539 | 1/sqrt(fns(i))= -2*log(Roughness/Dpipe/3.7+2.51/Re(i)/sqrt(fns(i))); |
---|
540 | |
---|
541 | when Re(i) <= 2300 switchto "laminar"; |
---|
542 | |
---|
543 | end |
---|
544 | |
---|
545 | end |
---|
546 | |
---|
547 | end |
---|
548 | |
---|
549 | |
---|
550 | FlowSheet Pipe_simples |
---|
551 | |
---|
552 | PARAMETERS |
---|
553 | PP as Plugin(Brief="Physical Properties", |
---|
554 | Type="PP", |
---|
555 | Components = [ "isobutane", "benzene","n-hexane"], |
---|
556 | LiquidModel = "PR", |
---|
557 | VapourModel = "PR" |
---|
558 | ); |
---|
559 | |
---|
560 | NComp as Integer; |
---|
561 | |
---|
562 | DEVICES |
---|
563 | Tube as pipe; |
---|
564 | Feed as simple_source; |
---|
565 | Storage as simple_sink; |
---|
566 | |
---|
567 | SET |
---|
568 | NComp = PP.NumberOfComponents; |
---|
569 | Tube.N = 5; |
---|
570 | |
---|
571 | #Tube.Thermal ="Constant Temperature"; |
---|
572 | Tube.Thermal ="Linear Temperature profile"; |
---|
573 | Tube.Toutlet = (80+273.15) * 'K'; |
---|
574 | |
---|
575 | |
---|
576 | CONNECTIONS |
---|
577 | Feed.Outlet to Tube.Inlet; |
---|
578 | Tube.Outlet to Storage.Inlet; |
---|
579 | |
---|
580 | SPECIFY |
---|
581 | Feed.Outlet.F = 10 * 'kmol/h'; |
---|
582 | Feed.Outlet.P = 3* 'atm'; |
---|
583 | Feed.Outlet.T = (60+273.15) * 'K'; |
---|
584 | Feed.Outlet.z = [0.5,0.2,0.3]; |
---|
585 | |
---|
586 | SET |
---|
587 | Tube.Lpipe = 5*'m'; |
---|
588 | Tube.Hrise = 0*'deg'; # working only in the horizontal , must be updated |
---|
589 | Tube.Correlation = "Beggs-Brill"; |
---|
590 | #Tube.Correlation = "Lockhart-Martinelli"; |
---|
591 | |
---|
592 | |
---|
593 | Tube.Dpipe = 3*'in'; |
---|
594 | Tube.Roughness = 4.572E-5*'m'; |
---|
595 | |
---|
596 | OPTIONS |
---|
597 | Dynamic = false; |
---|
598 | #GuessFile="Pipe_simples"; |
---|
599 | |
---|
600 | end |
---|