source: trunk/sample/reactors/fogler/chap2/series_reactors.mso @ 446

Last change on this file since 446 was 446, checked in by Rodolfo Rodrigues, 15 years ago
  • Property svn:keywords set to Id
File size: 14.1 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 446 2008-01-14 18:46:07Z rodolfo $
50*--------------------------------------------------------------------*#
51
52using "types";
53
54
55#*---------------------------------------------------------------------
56* Estimation of rate of reaction
57*--------------------------------------------------------------------*#
58
59FlowSheet rate
60        PARAMETERS
61        a1              as Real                 (Brief="Parameter to estimate", Default=0.01);
62        a2              as Real                 (Brief="Parameter to estimate", Default=0.01);
63        a3              as Real                 (Brief="Parameter to estimate", Default=0.01);
64        a4              as Real                 (Brief="Parameter to estimate", Default=0.01);
65
66        VARIABLES
67        r               as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/m^3/s');
68        X               as fraction             (Brief="Molar conversion", Unit='mol/mol');
69       
70        EQUATIONS
71        "Rate of reaction" # Attributed expression
72        (-r) = (a4*X^3 + a3*X^2 + a2*X + a1)*'mol/l/s';
73       
74        SPECIFY
75        X = 0.5;
76
77        OPTIONS
78        Dynamic = false;
79end
80
81Estimation rate_of_reaction as rate
82        ESTIMATE
83        # PAR   START   LOWER  UPPER
84        a1              0.01    -1              1;
85        a2              0.01    -1              1;
86        a3              -0.01   -1              1;
87        a4              0.01    -1              1;
88
89        EXPERIMENTS
90        # FILE                WEIGTH
91        "raw_data.dat"          1; # Table 2-1 (Fogler,1999)
92
93        OPTIONS
94        Dynamic = false;
95        NLPSolver(File = "ipopt_emso",
96                ObjTol = 1e-8
97        );
98end
99
100
101#*---------------------------------------------------------------------
102* Model of a simple stream
103*--------------------------------------------------------------------*#
104
105Model simple_stream
106        VARIABLES
107        F as flow_mol   (Brief="Molar flow", DisplayUnit='mol/s');
108        X as fraction   (Brief="Molar conversion");
109end
110
111Model reactor_source
112        ATTRIBUTES
113        Pallete = true;
114        Brief   = "Simple inlet stream";
115        Icon    = "icon/inlet";
116       
117        VARIABLES
118out Outlet      as simple_stream        (Brief="Outlet stream", PosX=1, PosY=0.5);
119end
120
121Model reactor_sink
122        ATTRIBUTES
123        Pallete = true;
124        Brief   = "Simple outlet stream";
125        Icon    = "icon/outlet";
126       
127        VARIABLES
128in      Inlet   as simple_stream        (Brief="Inlet stream", PosX=0, PosY=0.5);
129end
130
131
132#*---------------------------------------------------------------------
133* Model of a steady-state, isotermic, and isobaric CSTR
134*--------------------------------------------------------------------*#
135
136Model simple_cstr
137        ATTRIBUTES
138        Pallete = true;
139        Brief   = "Simple model of a steady-state CSTR";
140        Icon    = "icon/simple_cstr";
141       
142        PARAMETERS
143        NT              as Integer              (Brief="Number of terms of reaction rate expression", Default=4);
144        a(NT)   as reaction_mol (Brief="Parameter of reaction rate expression", DisplayUnit='mol/l/s');
145       
146        VARIABLES
147in      Inlet   as simple_stream(Brief="Inlet stream", Symbol="_{in}", PosX=0, PosY=0);
148out     Outlet  as simple_stream(Brief="Outlet stream", Symbol="_{out}", PosX=1, PosY=1);
149        r               as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/l/s');
150        V       as volume               (Brief="Volume", DisplayUnit='l', Upper=2e3);
151       
152        SET
153        a = [0.00526629, 0.00133545, -0.0153342, 0.00921664]*'mol/l/s'; # Estimated
154       
155        EQUATIONS
156        "Component molar balance"
157        Inlet.F*(Outlet.X - Inlet.X) = (-r)*V;
158       
159        "Molar flow"
160        Outlet.F = Inlet.F;
161
162        "Rate of reaction"
163        (-r) = sum(a*Outlet.X^[0:(NT-1)]);
164end
165
166
167#*---------------------------------------------------------------------
168* Model of a steady-state, isotermic, and isobaric PFR
169*--------------------------------------------------------------------*#
170
171Model simple_pfr       
172        PARAMETERS
173        NT              as Integer              (Brief="Number of terms of reaction rate expression", Default=4);
174        a(NT)   as reaction_mol (Brief="Parameter of reaction rate expression", DisplayUnit='mol/l/s');
175       
176        VARIABLES
177in      Inlet   as simple_stream(Brief="Inlet stream", Symbol="_{in}");
178out     Outlet  as simple_stream(Brief="Outlet stream", Symbol="_{out}");
179        V       as volume               (Brief="Volume", DisplayUnit='l', Upper=2e3);
180        r               as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/l/s');
181       
182        SET
183        a = [0.00526629, 0.00133545, -0.0153342, 0.00921664]*'mol/l/s'; # Estimated
184       
185        EQUATIONS
186        "Molar balance"
187        diff(V) = Inlet.F/(-r)/'s';
188
189        "Change time in X"
190        Outlet.X = time/'s';
191       
192        "Molar flow"
193        Outlet.F = Inlet.F;
194
195        "Rate of reaction"
196        (-r) = sum(a*Outlet.X^[0:(NT-1)]);
197
198        INITIAL
199        "Reactor volume"
200        V = 0.0*'l';
201end
202
203
204#*---------------------------------------------------------------------
205* Model of a discreted steady-state, isotermic, and isobaric PFR
206*--------------------------------------------------------------------*#
207
208Model simple_pfr_d
209        ATTRIBUTES
210        Pallete = true;
211        Brief   = "Simple model of a steady-state PFR";
212        Icon    = "icon/simple_pfr";
213       
214        PARAMETERS
215        N       as Integer              (Brief="Number of discrete points", Lower=2, Default=150);
216        NT              as Integer              (Brief="Number of terms of reaction rate expression", Default=4);
217        a(NT)   as reaction_mol (Brief="Parameter of reaction rate expression",DisplayUnit='mol/l/s');
218       
219        VARIABLES
220in      Inlet   as simple_stream(Brief="Inlet stream", Symbol="_{in}", PosX=0, PosY=0.5);
221out     Outlet  as simple_stream(Brief="Outlet stream", Symbol="_{out}", PosX=1, PosY=0.5);
222        V(N)    as volume           (Brief="Volume", DisplayUnit='l', Upper=2e3);
223        r(N)    as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/l/s');
224        X(N)    as fraction             (Brief="Molar conversion");
225        dx      as fraction     (Brief="Conversion increment");
226       
227        SET
228        a = [0.00526629, 0.00133545, -0.0153342, 0.00921664]*'mol/l/s'; # Estimated
229       
230        EQUATIONS
231       
232        "Outlet molar conversion"
233        Outlet.X = X(N);
234       
235        "Discrete interval"
236        dx = (Outlet.X - Inlet.X)/(N-1);
237
238        "Initial reactor volume"
239        V(1) = 0.0*'l';
240
241        for i in [2:N]
242        "Molar balance"
243           V(i) - V(i-1) = -0.5*Inlet.F*dx*(1/r(i-1) + 1/r(i)); # second order
244#          V(i) - V(i-1) = Inlet.F*dx/(-r(i));                                  # first order
245        "Discrete molar conversion"
246           X(i-1) = X(i) - dx;
247    end
248       
249        "Molar flow"
250        Outlet.F = Inlet.F;
251       
252        for i in [1:N]
253        "Rate of reaction"
254                (-r(i)) = sum(a*X(i)^[0:(NT-1)]);
255        end
256end
257
258
259#*---------------------------------------------------------------------
260* Example 2-2: Scale-up an isotermic CSTR in gaseous phase
261*--------------------------------------------------------------------*#
262
263FlowSheet cstr_sample
264        PARAMETERS
265        R       as Real                 (Brief="Universal gas constant", Unit='atm*l/mol/K', Default=0.082);
266        T       as temperature  (Brief="Temperatura in the reactor");
267        P       as pressure             (Brief="Pressure in the reactor");
268        zin     as fraction             (Brief="Inlet molar fraction");
269        v0  as flow_vol         (Brief="Volumetric flow");
270       
271        VARIABLES
272        Vt      as volume               (Brief="Total reactor volume", DisplayUnit='l');
273       
274        DEVICES
275        Inlet   as simple_stream;
276        R1              as simple_cstr;
277
278        CONNECTIONS
279        Inlet   to R1.Inlet;
280       
281        EQUATIONS
282        "Inlet molar flow"
283        Inlet.F = (zin*P/(R*T))*v0;
284       
285        "Total reactor volume"
286        Vt = R1.V;
287       
288        SET
289        v0  = 6.0*'l/s';
290        T       = 422.2*'K';
291        P       = 10*'atm';
292        zin     = 0.5;
293       
294        SPECIFY
295        "Inlet conversion"
296        Inlet.X = 0.0;
297        "Required conversion"
298        R1.Outlet.X = 0.8;
299       
300        OPTIONS
301        Dynamic = false;
302end
303
304
305#*---------------------------------------------------------------------
306* Example 2-3: Scale-up an isotermic PFR in gaseous phase
307*--------------------------------------------------------------------*#
308
309FlowSheet pfr_sample
310        DEVICES
311        Inlet   as simple_stream;
312        R1              as simple_pfr;
313       
314        CONNECTIONS
315        Inlet   to R1.Inlet;
316       
317        SPECIFY
318        "Inlet molar flow"
319        Inlet.F = 0.866541*'mol/s';
320        "Inlet conversion"
321        Inlet.X = 0.0;
322       
323        OPTIONS
324        TimeStep = 0.008;
325        TimeEnd = 0.8;
326end
327
328
329#*---------------------------------------------------------------------
330* Example 2-3: (discreted)
331*--------------------------------------------------------------------*#
332
333FlowSheet pfr_d_sample
334        VARIABLES
335        Vt              as volume       (Brief="Total reactor volume", DisplayUnit='l');
336       
337        DEVICES
338        Inlet   as simple_stream;
339        R1              as simple_pfr_d;
340
341        CONNECTIONS
342        Inlet   to R1.Inlet;
343       
344        EQUATIONS
345        "Total reactor volume"
346        Vt = R1.V(R1.N);
347
348        SET
349        R1.N = 150;
350
351        SPECIFY
352        "Inlet molar flow"
353        Inlet.F = 0.866541*'mol/s';
354        "Inlet conversion"
355        Inlet.X = 0.0;
356
357        "Required conversion"
358        R1.Outlet.X     = 0.8;
359       
360        OPTIONS
361        Dynamic = false;
362end
363
364
365#*---------------------------------------------------------------------
366* Example 2-4: Comparing volumes between one CSTR and one PFR
367*--------------------------------------------------------------------*#
368
369FlowSheet comparative
370        VARIABLES
371        V_cstr  as volume       (Brief="CSTR volume", DisplayUnit='l');
372        V_pfr   as volume       (Brief="PFR volume", DisplayUnit='l');
373       
374        DEVICES
375        Inlet   as simple_stream;
376        CSTR    as simple_cstr;
377        PFR             as simple_pfr_d;
378
379        CONNECTIONS
380        Inlet   to CSTR.Inlet;
381        Inlet   to PFR.Inlet;
382       
383        EQUATIONS
384        "CSTR volume"
385        V_cstr = CSTR.V;
386       
387        "PFR volume"
388        V_pfr = PFR.V(PFR.N);
389       
390        SET
391        PFR.N = 100;
392
393        SPECIFY
394        "Inlet molar flow"
395        Inlet.F = 5.0*'mol/s';
396        "Inlet conversion"
397        Inlet.X = 0.0;
398
399        "Required CSTR conversion"
400        CSTR.Outlet.X = 0.6;
401        "Required PFR conversion"
402        PFR.Outlet.X = 0.6;
403       
404        OPTIONS
405        Dynamic = false;
406end
407
408
409#*---------------------------------------------------------------------
410* Example 2-5: two CSTRs in serie
411*--------------------------------------------------------------------*#
412
413FlowSheet cstr_cstr
414        VARIABLES
415        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
416        V2              as volume       (Brief="2nd reactor volume", DisplayUnit='l');
417        Vt              as volume       (Brief="Total reactor volumes", DisplayUnit='l');
418       
419        DEVICES
420        Inlet   as simple_stream;
421        R1              as simple_cstr;
422        R2              as simple_cstr;
423
424        CONNECTIONS
425        Inlet           to R1.Inlet;
426        R1.Outlet       to R2.Inlet;
427       
428        EQUATIONS
429        "1st volume reactor"
430        V1 = R1.V;
431        "1st volume reactor"
432        V2 = R2.V;
433        "Total volume of reactors"
434        Vt = V1 + V2;
435       
436        SPECIFY
437        "Inlet molar flow"
438        Inlet.F = 0.866541*'mol/s';
439        "Inlet conversion"
440        Inlet.X = 0.0;
441       
442        "Required 1st reactor conversion"
443        R1.Outlet.X = 0.4;
444        "Required 2nd reactor conversion"
445        R2.Outlet.X = 0.8;
446       
447        OPTIONS
448        Dynamic = false;
449end
450
451
452#*---------------------------------------------------------------------
453* Example 2-6: two PFRs in series (discreted)
454*--------------------------------------------------------------------*#
455
456FlowSheet pfr_pfr
457        VARIABLES
458        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
459        V2              as volume       (Brief="2nd reactor volume", DisplayUnit='l');
460        Vt              as volume       (Brief="Total reactor volumes", DisplayUnit='l');
461       
462        DEVICES
463        Inlet   as simple_stream;
464        R1              as simple_pfr_d;
465        R2              as simple_pfr_d;
466
467        CONNECTIONS
468        Inlet           to      R1.Inlet;
469        R1.Outlet       to      R2.Inlet;
470       
471        EQUATIONS
472        "1st reactor volume"
473        V1 = R1.V(R1.N);
474        "1st reactor volume"
475        V2 = R2.V(R2.N);
476        "Total reactor volumes"
477        Vt = V1 + V2;
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.4;
487        "Required 2nd reactor conversion"
488        R2.Outlet.X = 0.8;
489       
490        OPTIONS
491        Dynamic = false;
492end
493
494
495#*---------------------------------------------------------------------
496* Example 2-7a: one PFR and one CSTR in series
497*--------------------------------------------------------------------*#
498
499FlowSheet pfr_cstr
500        VARIABLES
501        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
502        V2              as volume       (Brief="2nd reactor volume", DisplayUnit='l');
503        Vt              as volume       (Brief="Total reactor volumes", DisplayUnit='l');
504       
505        DEVICES
506        Inlet   as simple_stream;
507        R1              as simple_pfr_d;
508        R2              as simple_cstr;
509
510        CONNECTIONS
511        Inlet           to      R1.Inlet;
512        R1.Outlet       to      R2.Inlet;
513       
514        EQUATIONS
515        "1st reactor volume"
516        V1 = R1.V(R1.N);
517        "1st reactor volume"
518        V2 = R2.V;
519        "Total reactor volumes"
520        Vt = V1 + V2;
521       
522        SET
523        R1.N = 100;
524       
525        SPECIFY
526        "Inlet molar flow"
527        Inlet.F = 0.866541*'mol/s';
528        "Inlet conversion"
529        Inlet.X = 0.0;
530       
531        "Required 1st reactor conversion"
532        R1.Outlet.X = 0.5;
533        "Required 2nd reactor conversion"
534        R2.Outlet.X = 0.8;
535       
536        OPTIONS
537        Dynamic = false;
538end
539
540
541#*---------------------------------------------------------------------
542* Example 2-7b: one CSTR and one PFR in series
543*--------------------------------------------------------------------*#
544
545FlowSheet cstr_pfr
546        VARIABLES
547        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
548        V2              as volume       (Brief="2nd reactor volume", DisplayUnit='l');
549        Vt              as volume       (Brief="Total reactor volumes", DisplayUnit='l');
550       
551        DEVICES
552        Inlet   as simple_stream;
553        R1              as simple_cstr;
554        R2              as simple_pfr_d;
555
556        CONNECTIONS
557        Inlet           to      R1.Inlet;
558        R1.Outlet       to      R2.Inlet;
559       
560        EQUATIONS
561        "1st reactor volume"
562        V1 = R1.V;
563        "1st reactor volume"
564        V2 = R2.V(R2.N);
565        "Total reactor volumes"
566        Vt = V1 + V2;
567       
568        SET
569        R2.N = 100;
570       
571        SPECIFY
572        "Inlet molar flow"
573        Inlet.F = 0.866541*'mol/s';
574        "Inlet conversion"
575        Inlet.X = 0.0;
576       
577        "Required 1st reactor conversion"
578        R1.Outlet.X = 0.5;
579        "Required 2nd reactor conversion"
580        R2.Outlet.X = 0.8;
581       
582        OPTIONS
583        Dynamic = false;
584end
Note: See TracBrowser for help on using the repository browser.