source: branches/new_gui/my_folders/fogler/chap2/series_reactors.mso @ 931

Last change on this file since 931 was 896, checked in by gerson bicca, 14 years ago

added special folder for unconventional applications

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 574 2008-07-25 14:18:50Z rafael $
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] do
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] do
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.X = 0.0;
296        R1.Outlet.X = 0.8;
297       
298        OPTIONS
299        Dynamic = false;
300end
301
302
303#*---------------------------------------------------------------------
304* Example 2-3: Scale-up an isotermic PFR in gaseous phase
305*--------------------------------------------------------------------*#
306
307FlowSheet pfr_sample
308        DEVICES
309        Inlet   as simple_stream;
310        R1              as simple_pfr;
311       
312        CONNECTIONS
313        Inlet   to R1.Inlet;
314       
315        SPECIFY
316        Inlet.F = 0.866541*'mol/s';
317        Inlet.X = 0.0;
318       
319        OPTIONS
320        TimeStep = 0.008;
321        TimeEnd = 0.8;
322end
323
324
325#*---------------------------------------------------------------------
326* Example 2-3: (discreted)
327*--------------------------------------------------------------------*#
328
329FlowSheet pfr_d_sample
330        VARIABLES
331        Vt              as volume       (Brief="Total reactor volume", DisplayUnit='l');
332       
333        DEVICES
334        Inlet   as simple_stream;
335        R1              as simple_pfr_d;
336
337        CONNECTIONS
338        Inlet   to R1.Inlet;
339       
340        EQUATIONS
341        "Total reactor volume"
342        Vt = R1.V(R1.N);
343
344        SET
345        R1.N = 150;
346
347        SPECIFY
348        Inlet.F = 0.866541*'mol/s';
349        Inlet.X = 0.0;
350
351        R1.Outlet.X     = 0.8;
352       
353        OPTIONS
354        Dynamic = false;
355end
356
357
358#*---------------------------------------------------------------------
359* Example 2-4: Comparing volumes between one CSTR and one PFR
360*--------------------------------------------------------------------*#
361
362FlowSheet comparative
363        VARIABLES
364        V_cstr  as volume       (Brief="CSTR volume", DisplayUnit='l');
365        V_pfr   as volume       (Brief="PFR volume", DisplayUnit='l');
366       
367        DEVICES
368        Inlet   as simple_stream;
369        CSTR    as simple_cstr;
370        PFR             as simple_pfr_d;
371
372        CONNECTIONS
373        Inlet   to CSTR.Inlet;
374        Inlet   to PFR.Inlet;
375       
376        EQUATIONS
377        "CSTR volume"
378        V_cstr = CSTR.V;
379       
380        "PFR volume"
381        V_pfr = PFR.V(PFR.N);
382       
383        SET
384        PFR.N = 100;
385
386        SPECIFY
387        Inlet.F = 5.0*'mol/s';
388        Inlet.X = 0.0;
389
390        CSTR.Outlet.X = 0.6;
391        PFR.Outlet.X = 0.6;
392       
393        OPTIONS
394        Dynamic = false;
395end
396
397
398#*---------------------------------------------------------------------
399* Example 2-5: two CSTRs in serie
400*--------------------------------------------------------------------*#
401
402FlowSheet cstr_cstr
403        VARIABLES
404        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
405        V2              as volume       (Brief="2nd reactor volume", DisplayUnit='l');
406        Vt              as volume       (Brief="Total reactor volumes", DisplayUnit='l');
407       
408        DEVICES
409        Inlet   as simple_stream;
410        R1              as simple_cstr;
411        R2              as simple_cstr;
412
413        CONNECTIONS
414        Inlet           to R1.Inlet;
415        R1.Outlet       to R2.Inlet;
416       
417        EQUATIONS
418        "1st volume reactor"
419        V1 = R1.V;
420        "1st volume reactor"
421        V2 = R2.V;
422        "Total volume of reactors"
423        Vt = V1 + V2;
424       
425        SPECIFY
426        Inlet.F = 0.866541*'mol/s';
427        Inlet.X = 0.0;
428       
429        R1.Outlet.X = 0.4;
430        R2.Outlet.X = 0.8;
431       
432        OPTIONS
433        Dynamic = false;
434end
435
436
437#*---------------------------------------------------------------------
438* Example 2-6: two PFRs in series (discreted)
439*--------------------------------------------------------------------*#
440
441FlowSheet pfr_pfr
442        VARIABLES
443        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
444        V2              as volume       (Brief="2nd reactor volume", DisplayUnit='l');
445        Vt              as volume       (Brief="Total reactor volumes", DisplayUnit='l');
446       
447        DEVICES
448        Inlet   as simple_stream;
449        R1              as simple_pfr_d;
450        R2              as simple_pfr_d;
451
452        CONNECTIONS
453        Inlet           to      R1.Inlet;
454        R1.Outlet       to      R2.Inlet;
455       
456        EQUATIONS
457        "1st reactor volume"
458        V1 = R1.V(R1.N);
459        "1st reactor volume"
460        V2 = R2.V(R2.N);
461        "Total reactor volumes"
462        Vt = V1 + V2;
463       
464        SPECIFY
465        Inlet.F = 0.866541*'mol/s';
466        Inlet.X = 0.0;
467       
468        R1.Outlet.X = 0.4;
469        R2.Outlet.X = 0.8;
470       
471        OPTIONS
472        Dynamic = false;
473end
474
475
476#*---------------------------------------------------------------------
477* Example 2-7a: one PFR and one CSTR in series
478*--------------------------------------------------------------------*#
479
480FlowSheet pfr_cstr
481        VARIABLES
482        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
483        V2              as volume       (Brief="2nd reactor volume", DisplayUnit='l');
484        Vt              as volume       (Brief="Total reactor volumes", DisplayUnit='l');
485       
486        DEVICES
487        Inlet   as simple_stream;
488        R1              as simple_pfr_d;
489        R2              as simple_cstr;
490
491        CONNECTIONS
492        Inlet           to      R1.Inlet;
493        R1.Outlet       to      R2.Inlet;
494       
495        EQUATIONS
496        "1st reactor volume"
497        V1 = R1.V(R1.N);
498        "1st reactor volume"
499        V2 = R2.V;
500        "Total reactor volumes"
501        Vt = V1 + V2;
502       
503        SET
504        R1.N = 100;
505       
506        SPECIFY
507        Inlet.F = 0.866541*'mol/s';
508        Inlet.X = 0.0;
509       
510        R1.Outlet.X = 0.5;
511        R2.Outlet.X = 0.8;
512       
513        OPTIONS
514        Dynamic = false;
515end
516
517
518#*---------------------------------------------------------------------
519* Example 2-7b: one CSTR and one PFR in series
520*--------------------------------------------------------------------*#
521
522FlowSheet cstr_pfr
523        VARIABLES
524        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
525        V2              as volume       (Brief="2nd reactor volume", DisplayUnit='l');
526        Vt              as volume       (Brief="Total reactor volumes", DisplayUnit='l');
527       
528        DEVICES
529        Inlet   as simple_stream;
530        R1              as simple_cstr;
531        R2              as simple_pfr_d;
532
533        CONNECTIONS
534        Inlet           to      R1.Inlet;
535        R1.Outlet       to      R2.Inlet;
536       
537        EQUATIONS
538        "1st reactor volume"
539        V1 = R1.V;
540        "1st reactor volume"
541        V2 = R2.V(R2.N);
542        "Total reactor volumes"
543        Vt = V1 + V2;
544       
545        SET
546        R2.N = 100;
547       
548        SPECIFY
549        Inlet.F = 0.866541*'mol/s';
550        Inlet.X = 0.0;
551       
552        R1.Outlet.X = 0.5;
553        R2.Outlet.X = 0.8;
554       
555        OPTIONS
556        Dynamic = false;
557end
Note: See TracBrowser for help on using the repository browser.