source: branches/newlanguage/sample/reactors/fogler/chap2/series_reactors.mso @ 178

Last change on this file since 178 was 178, checked in by gerson bicca, 16 years ago

fixed problem with bounds

  • Property svn:keywords set to Id
File size: 12.9 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*---------------------------------------------------------------------
16* Series of CSTR and PFR
17*----------------------------------------------------------------------
18* Solved problem from Fogler (1999)
19* Problem number: 2-2 at 2-7
20* Page: 38-49 (Brazilian edition, 2002)
21*----------------------------------------------------------------------
22*
23*   Description:
24*      Sample to comparative between volumes to specific outlet molar
25*       conversion of CSTR and PFR by means of several different
26*       configurations
27*
28*   Assumptions:
29*       * steady-state
30*       * isotermic and isobaric system
31*       * gaseous phase
32*
33*       Specify:
34*               * the inlet stream (F,X)
35*               * the expression of rate of reaction
36*       * the initial volume
37*               * the outlet conversion
38*
39*   Configurations:
40*       * only one CSTR
41*       * only one PFR
42*       * 2 CSTRs in series
43*       * 2 PFRs in series
44*       * one PFR followed for one CSTR
45*       * one CSTR followed for one PFR
46*
47*----------------------------------------------------------------------
48* Author: Rodolfo Rodrigues and Argimiro R. Secchi
49* $Id: series_reactors.mso 178 2007-03-05 13:41:51Z bicca $
50*--------------------------------------------------------------------*#
51
52using "types";
53
54
55#*---------------------------------------------------------------------
56* Model of a stream
57*--------------------------------------------------------------------*#
58
59Model stream
60
61PARAMETERS
62        NComp   as Integer      (Brief="Number of components", Default=1);
63
64VARIABLES
65        F(NComp)        as flow_mol     (Brief="Molar flow", Unit='mol/s');
66        X(NComp)        as fraction     (Brief="Molar conversion");
67
68end
69
70#*---------------------------------------------------------------------
71* Model of a steady-state, isotermic, and isobaric CSTR
72*--------------------------------------------------------------------*#
73
74Model cstr     
75
76VARIABLES
77
78in              Inlet           as stream       (Brief="Inlet stream");
79out     Outlet  as stream       (Brief="Outlet stream");
80       
81        r        as reaction_mol        (Brief="Rate of reaction", Unit='mol/l/s');
82        V   as volume                   (Brief="Volume", Unit='l', Upper=2e3);
83
84EQUATIONS
85
86"Component molar balance"
87        Inlet.F - Outlet.F = (-r)*V;
88       
89"Outlet molar flow"
90        Outlet.F = Inlet.F*(1 - Outlet.X);
91
92end
93
94
95#*---------------------------------------------------------------------
96* Model of a steady-state, isotermic, and isobaric PFR
97*--------------------------------------------------------------------*#
98
99Model pfr
100
101VARIABLES
102in              Inlet           as stream       (Brief="Inlet stream");
103out     Outlet  as stream       (Brief="Outlet stream");
104       
105        V  as volume                    (Brief="Volume", Unit='l', Upper=2e3);
106        r       as reaction_mol (Brief="Rate of reaction", Unit='mol/l/s');
107       
108EQUATIONS
109
110"Molar balance"
111        diff(V) = Inlet.F/(-r)*'1/s';
112
113"Change time in X"
114        Outlet.X = time*'1/s';
115       
116        "Molar flow"
117        Outlet.F = Inlet.F*(1 - Outlet.X);
118end
119
120
121#*---------------------------------------------------------------------
122* Model of a discreted steady-state, isotermic, and isobaric PFR
123*--------------------------------------------------------------------*#
124
125Model pfr_d
126        PARAMETERS
127        N       as Integer              (Brief="Number of discrete points", Default=200);
128       
129        VARIABLES
130in      Inlet   as stream; # Inlet stream
131out     Outlet  as stream; # Outlet stream
132        V(N)    as volume           (Brief="Volume", Unit='l', Upper=2e3);
133        X(N)    as fraction             (Brief="Molar conversion");
134        dx      as fraction     (Brief="Conversion increment");
135        r(N)    as reaction_mol (Brief="Rate of reaction", Unit='mol/l/s');
136        F(N)    as flow_mol             (Brief="Molar flow", Unit='mol/s');
137       
138        EQUATIONS
139        "Discrete interval"
140        dx = X(N)/N;
141       
142        for i in [2:N]
143        "Molar balance"
144           V(i) - V(i-1) = Inlet.F*dx/(-r(i));
145        "Discrete molar conversion"
146           X(i-1) = X(i) - dx;
147    end
148       
149        "Molar flow"
150        F = Inlet.F*(1 - X);
151       
152        "Outlet molar flow"
153        Outlet.F = F(N);
154       
155        "Outlet molar conversion"
156        Outlet.X = X(N);
157end
158
159
160#*---------------------------------------------------------------------
161* Example 2-2: Scale-up an isotermic CSTR in gaseous phase
162*--------------------------------------------------------------------*#
163
164FlowSheet cstr_sample
165        PARAMETERS
166        R       as Real                 (Brief="Universal gas constant", Unit='atm*l/mol/K', Default=0.082);
167        T       as temperature  (Brief="Temperatura in the reactor", Unit='K');
168        P       as pressure             (Brief="Pressure in the reactor", Unit='atm');
169        zin     as fraction             (Brief="Inlet molar fraction");
170        v0  as flow_vol         (Brief="Volumetric flow");
171       
172        VARIABLES
173        Vt      as volume               (Brief="Total reactor volume", Unit='l');
174       
175        DEVICES
176        Inlet   as stream; # Inlet stream
177        R1              as cstr;
178
179        CONNECTIONS
180        Inlet   to R1.Inlet;
181       
182        EQUATIONS
183        "Inlet molar flow"
184        Inlet.F = (zin*P/(R*T))*v0;
185       
186        "Rate of reaction"
187        (-R1.r) = (0.0092*R1.Outlet.X^3 - 0.0153*R1.Outlet.X^2 + 0.0013*R1.Outlet.X + 0.0053)*'mol/l/s';
188       
189        "Total reactor volume"
190        Vt = R1.V;
191       
192        SPECIFY
193        "Inlet conversion"
194        Inlet.X = 0.0;
195        "Required conversion"
196        R1.Outlet.X = 0.8;
197       
198        SET
199        v0  = 6.0*'l/s';
200        T       = 422.2*'K';
201        P       = 10*'atm';
202        zin     = 0.5;
203       
204        OPTIONS
205        Dynamic = false;
206end
207
208
209#*---------------------------------------------------------------------
210* Example 2-3: Scale-up an isotermic PFR in gaseous phase
211*--------------------------------------------------------------------*#
212
213FlowSheet pfr_sample
214
215DEVICES
216        Inlet   as stream;
217        R1              as pfr;
218       
219CONNECTIONS
220        Inlet   to R1.Inlet;
221       
222EQUATIONS
223
224"Rate of reaction"
225        (-R1.r) = (0.0092*R1.Outlet.X^3 - 0.0153*R1.Outlet.X^2 + 0.0013*R1.Outlet.X + 0.0053)*'mol/l/s';
226       
227SPECIFY
228
229"Inlet molar flow"
230        Inlet.F = 0.866541*'mol/s';
231
232"Inlet conversion"
233        Inlet.X = 0.0;
234       
235INITIAL
236
237"Reactor volume"
238        R1.V    = 0.0*'l';
239       
240OPTIONS
241       
242        Dynamic         = true;
243        TimeStep        = 0.004;
244        TimeEnd         = 0.8;
245        TimeUnit        = 's';
246       
247end
248
249
250#*---------------------------------------------------------------------
251* Example 2-3: (discreted)
252*--------------------------------------------------------------------*#
253
254FlowSheet pfr_d_sample
255        VARIABLES
256        Vt              as volume       (Brief="Total reactor volume", Unit='l');
257       
258        DEVICES
259        Inlet   as stream; # Inlet stream
260        R1              as pfr_d;
261
262        CONNECTIONS
263        Inlet   to R1.Inlet;
264       
265        EQUATIONS
266        "Rate of reaction"
267        (-R1.r) = (0.0092*R1.X^3 - 0.0153*R1.X^2 + 0.0013*R1.X + 0.0053)*'mol/l/s';
268       
269        "Total reactor volume"
270        Vt = R1.V(R1.N);
271
272#       SET
273#       R1.N    = 100;
274       
275        SPECIFY
276        "Inlet molar flow"
277        Inlet.F = 0.866541*'mol/s';
278        "Inlet conversion"
279        Inlet.X = 0.0;
280
281        "Required conversion"
282        R1.Outlet.X     = 0.8;
283        "Initial volume"
284        R1.V(1) = 0.0*'l';
285       
286        OPTIONS
287        Dynamic = false;
288end
289
290
291#*---------------------------------------------------------------------
292* Example 2-4: Comparing volumes between one CSTR and one PFR
293*--------------------------------------------------------------------*#
294
295FlowSheet comparative
296        VARIABLES
297        V_cstr  as volume       (Brief="CSTR volume");
298        V_pfr   as volume       (Brief="PFR volume", Unit='l');
299       
300        DEVICES
301        Inlet   as stream; # Inlet stream
302        CSTR    as cstr;
303        PFR             as pfr_d;
304
305        CONNECTIONS
306        Inlet   to CSTR.Inlet;
307        Inlet   to PFR.Inlet;
308       
309        EQUATIONS
310        "Rate of reaction in CSTR"
311        (-CSTR.r) = (0.0092*CSTR.Outlet.X^3 - 0.0153*CSTR.Outlet.X^2 + 0.0013*CSTR.Outlet.X + 0.0053)*'mol/l/s';
312        "Rate of reaction in PFR"
313        (-PFR.r) = (0.0092*PFR.X^3 - 0.0153*PFR.X^2 + 0.0013*PFR.X + 0.0053)*'mol/l/s';
314       
315        "CSTR volume"
316        V_cstr = CSTR.V;
317        "PFR volume"
318        V_pfr = PFR.V(PFR.N);
319       
320#       SET
321#       PFR.N   = 100;
322       
323        SPECIFY
324        "Inlet molar flow"
325        Inlet.F = 5.0*'mol/s';
326        "Inlet conversion"
327        Inlet.X = 0.0;
328       
329        "Required CSTR conversion"
330        CSTR.Outlet.X = 0.6;
331        "Required PFR conversion"
332        PFR.Outlet.X = 0.6;
333       
334        "Initial volume in PFR"
335        PFR.V(1) = 0.0*'l';
336       
337        OPTIONS
338        Dynamic = false;
339end
340
341
342#*---------------------------------------------------------------------
343* Example 2-5: two CSTRs in serie
344*--------------------------------------------------------------------*#
345
346FlowSheet cstr_cstr
347        VARIABLES
348        V1              as volume       (Brief="1st reactor volume", Unit='l');
349        V2              as volume       (Brief="2nd reactor volume", Unit='l');
350        Vt              as volume       (Brief="Total reactor volumes", Unit='l');
351       
352        DEVICES
353        Inlet   as stream;
354        R1              as cstr;
355        R2              as cstr;
356
357        CONNECTIONS
358        Inlet           to R1.Inlet;
359        R1.Outlet       to R2.Inlet;
360       
361        EQUATIONS
362        "Rate of reaction in 1st reactor"
363        (-R1.r) = (0.0092*R1.Outlet.X^3 - 0.0153*R1.Outlet.X^2 + 0.0013*R1.Outlet.X + 0.0053)*'mol/l/s';
364        "Rate of reaction in 2nd reactor"
365        (-R2.r) = (0.0092*R2.Outlet.X^3 - 0.0153*R2.Outlet.X^2 + 0.0013*R2.Outlet.X + 0.0053)*'mol/l/s';
366       
367        "1st volume reactor"
368        V1 = R1.V;
369        "1st volume reactor"
370        V2 = R2.V;
371        "Total volume of reactors"
372        Vt = V1 + V2;
373       
374        SPECIFY
375        "Inlet molar flow"
376        Inlet.F = 0.866541*'mol/s';
377        "Inlet conversion"
378        Inlet.X = 0.0;
379       
380        "Required 1st reactor conversion"
381        R1.Outlet.X = 0.4;
382        "Required 2nd reactor conversion"
383        R2.Outlet.X = 0.8;
384       
385        OPTIONS
386        Dynamic=false;
387       
388end
389
390
391#*---------------------------------------------------------------------
392* Example 2-6: two PFRs in series (discreted)
393*--------------------------------------------------------------------*#
394
395FlowSheet pfr_pfr
396        VARIABLES
397        V1              as volume       (Brief="1st reactor volume", Unit='l');
398        V2              as volume       (Brief="2nd reactor volume", Unit='l');
399        Vt              as volume       (Brief="Total reactor volumes", Unit='l');
400       
401        DEVICES
402        Inlet   as stream;
403        R1              as pfr_d;
404        R2              as pfr_d;
405
406        CONNECTIONS
407        Inlet           to      R1.Inlet;
408        R1.Outlet       to      R2.Inlet;
409       
410        EQUATIONS
411        "Rate of reaction in 1st reactor"
412        (-R1.r) = (0.0092*R1.X^3 - 0.0153*R1.X^2 + 0.0013*R1.X + 0.0053)*'mol/l/s';
413        "Rate of reaction in 2nd reactor"
414        (-R2.r) = (0.0092*R2.X^3 - 0.0153*R2.X^2 + 0.0013*R2.X + 0.0053)*'mol/l/s';
415       
416        "1st reactor volume"
417        V1 = R1.V(R1.N);
418        "1st reactor volume"
419        V2 = R2.V(R2.N);
420        "Total reactor volumes"
421        Vt = V1 + V2;
422       
423        SPECIFY
424        "Inlet molar flow"
425        Inlet.F = 0.866541*'mol/s';
426        "Inlet conversion"
427        Inlet.X = 0.0;
428       
429        "Required 1st reactor conversion"
430        R1.Outlet.X = 0.4;
431        "Required 2nd reactor conversion"
432        R2.Outlet.X = 0.8;
433       
434        "Initial 1st reactor volume"
435        R1.V(1) = 0.0*'l';
436        "Initial 2nd reactor volume"
437        R2.V(1) = 0.0*'l';
438       
439        OPTIONS
440        Dynamic = false;
441end
442
443
444#*---------------------------------------------------------------------
445* Example 2-7a: one PFR and one CSTR in series
446*--------------------------------------------------------------------*#
447
448FlowSheet pfr_cstr
449        VARIABLES
450        V1              as volume       (Brief="1st reactor volume", Unit='l');
451        V2              as volume       (Brief="2nd reactor volume", Unit='l');
452        Vt              as volume       (Brief="Total reactor volumes", Unit='l');
453       
454        DEVICES
455        Inlet   as stream;
456        R1              as pfr_d;
457        R2              as cstr;
458
459        CONNECTIONS
460        Inlet           to      R1.Inlet;
461        R1.Outlet       to      R2.Inlet;
462       
463        EQUATIONS
464        "Rate of reaction in 1st reactor"
465        (-R1.r) = (0.0092*R1.X^3 - 0.0153*R1.X^2 + 0.0013*R1.X + 0.0053)*'mol/l/s';
466        "Rate of reaction in 2nd reactor"
467        (-R2.r) = (0.0092*R2.Outlet.X^3 - 0.0153*R2.Outlet.X^2 + 0.0013*R2.Outlet.X + 0.0053)*'mol/l/s';
468       
469        "1st reactor volume"
470        V1 = R1.V(R1.N);
471        "1st reactor volume"
472        V2 = R2.V;
473        "Total reactor volumes"
474        Vt = V1 + V2;
475       
476#       SET
477#       R1.N    = 100;
478       
479        SPECIFY
480        "Inlet molar flow"
481        Inlet.F = 0.866541*'mol/s';
482        "Inlet conversion"
483        Inlet.X = 0.0;
484       
485        "Required 1st reactor conversion"
486        R1.Outlet.X = 0.5;
487        "Required 2nd reactor conversion"
488        R2.Outlet.X = 0.8;
489       
490        "Initial 1st reactor volume"
491        R1.V(1) = 0.0*'l';
492       
493        OPTIONS
494        Dynamic= false;
495end
496
497
498#*---------------------------------------------------------------------
499* Example 2-7b: one CSTR and one PFR in series
500*--------------------------------------------------------------------*#
501
502FlowSheet cstr_pfr
503        VARIABLES
504        V1              as volume       (Brief="1st reactor volume", Unit='l');
505        V2              as volume       (Brief="2nd reactor volume", Unit='l');
506        Vt              as volume       (Brief="Total reactor volumes", Unit='l');
507       
508        DEVICES
509        Inlet   as stream; # Inlet stream
510        R1              as cstr;
511        R2              as pfr_d;
512
513        CONNECTIONS
514        Inlet           to      R1.Inlet;
515        R1.Outlet       to      R2.Inlet;
516       
517        EQUATIONS
518        "Rate of reaction in 1st reactor"
519        (-R1.r) = (9.2*R1.Outlet.X^3 - 15.3*R1.Outlet.X^2 + 1.3*R1.Outlet.X + 5.3)*1e-3*'mol/l/s';
520        "Rate of reaction in 2nd reactor"
521        (-R2.r) = (9.2*R2.X^3 - 15.3*R2.X^2 + 1.3*R2.X + 5.3)*1e-3*'mol/l/s';
522       
523        "1st reactor volume"
524        V1 = R1.V;
525        "1st reactor volume"
526        V2 = R2.V(R2.N);
527        "Total reactor volumes"
528        Vt = V1 + V2;
529       
530#       SET
531#       R2.N    = 100;
532       
533        SPECIFY
534        "Inlet molar flow"
535        Inlet.F = 0.866541*'mol/s';
536        "Inlet conversion"
537        Inlet.X = 0.0;
538       
539        "Required 1st reactor conversion"
540        R1.Outlet.X = 0.5;
541        "Required 2nd reactor conversion"
542        R2.Outlet.X = 0.8;
543       
544        "Initial 2nd reactor volume"
545        R2.V(1) = 0.0*'l';
546       
547        OPTIONS
548        Dynamic = false;
549end
Note: See TracBrowser for help on using the repository browser.