Figure 7.22:

Concentration profiles of reactants; fluid concentration of O_2 (x), CO (+), C_3H_6 (*).

Code for Figure 7.22

Text of the GNU GPL.

main.m


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
% Copyright (C) 2001, James B. Rawlings and John G. Ekerdt
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
% published by the Free Software Foundation; either version 2, or (at
% your option) any later version.
%
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; see the file COPYING.  If not, write to
% the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
% MA 02111-1307, USA.

global  npts A Aint Bint Rint  caf cbf ccf ...
        k10 E1 k20 E2 Ka0 Ea Kc0 Ec Da Db Dc T ...
        Ra Rb Rc Da Db Dc kma kmb kmc dcadr dcbdr dccdr
%
% Compute the pellet concentration profiles.
%
% Method can address:
%
%           multi-component, multi-reaction, arbitrary kinetics
%           reaction-diffusion problem in pellet, accurate profiles
%           flux and/or value boundary conditions at pellet exterior
%           energy balance in pellet and fluid
%           pressure drop and equation of state for fluid
%           sphere, semi-infinite cylinder or slab geometries for pellet
%           axial dispersion in the bed
%           transient problem
%
% Method does not address:
%
%           radial profiles in bed
%           non-uniform pellet exterior
%
% 5/07/02
%
% added log transformation; z=log(c)
% 12/ 13/03
%
% jbr
%
%
% units: mol, cm, sec, K
%
% Simulate pellet with parameters from Co, Cavendish, Hegedus.
%
% C0     + 1/2 O_2 -->   CO_2
%
% C_3H_6 + 9/2 O_2 --> 3 CO_2 + 3 H_2O
%
% A=CO  B=O_2  C=C_3H_6  D=CO_2  E=H_2O
%
% r_1 = k_1 c_A c_B / (1+K_A c_A + K_C c_C)^2
% r_2 = k_2 c_C c_B / (1+K_A c_A + K_C c_C)^2

Rg  = 8.314;  % J/K mol
P   = 1.013e5;  % N/m^2
T   = 550; % K
cf  = P/(Rg*T)*1e-6; % mol/cm^3
Rp  = 0.175; % cm radius of catalyst particle

caf = cf*0.02;
cbf = cf*0.03;
ccf = cf*5e-4;

k10  = 6.802e16*2.6e6*80/100*0.05/100;  %mol/cm^3 s
k20  = 1.416e18*2.6e6*80/100*0.05/100;  %mol/cm^3 s
E1   = 13108; %K
E2   = 15109; %K
Ka0  = 8.099e6; % cm^3/mol
Kc0  = 2.579e8; % cm^3/mol
Ea   = -409; %K
Ec   = 191; %K
Da   = 0.0487; % cm^2/s
Db   = 0.0469; % cm^2/s
Dc   = 0.0487; % cm^2/s
kma  = 0.4*9.76;   % cm/s
kmb  = 0.4*10.18;  % cm/s
kmc  = 0.4*9.76;   % cm/s
%
% global collocation
%
npts = 80;
[R A B Q] = colloc(npts-2, 'left', 'right');
R = R*Rp;
A = A/Rp;
B = B/(Rp*Rp);
Q = Q*Rp;
Aint = A(2:npts-1,:);
Bint = B(2:npts-1,:);
Rint = R(2:npts-1);
%
%
%
% find the pellet profile at the fluid conditions
%
zain = log(1e-9*caf); zaout = log(0.75*caf);
za0 = zain + R/Rp*(zaout-zain);
zbin = log(0.75*cbf); zbout = log(cbf);
zb0 = zbin + R/Rp*(zbout-zbin);
zcin = log(1e-6*ccf); zcout = log(ccf);
zc0 = zcin + R/Rp*(zcout-zcin);

z0 = [za0;zb0;zc0];
opts = optimset ('MaxFunEvals', 2000*numel (z0), ...
                 'MaxIter', 500*numel (z0), ...
		 'TolX', 1e-10, 'TolFun', 1e-15);
[z,fval,info] = fsolve('pellet',z0,opts);

za = z(1:npts);
zb = z(npts+1:2*npts);
zc = z(2*npts+1:3*npts);

ca = exp(za);
cb = exp(zb);
cc = exp(zc);
%
% compute other products concentrations
%
kmd = kma;
kme = kmb;
Dd  = Da;
De  = Db;
cdf = 0;
cef = 0;
dcddr = (-Da*dcadr(npts)-3*Dc*dccdr(npts)) /Dd ;
dcedr = (-3*Dc*dccdr(npts)) /De ;
cdR   = cdf - Dd*dcddr/kmd;
ceR   = cef - De*dcedr/kme;
concd = ( Da*(ca(npts)-ca) + 3*Dc*(cc(npts)-cc) )/Dd + cdR;
ce    = ( 3*Dc*(cc(npts)-cc) )/De + ceR;

table = [R ca cb cc concd ce dcadr dcbdr dccdr];

table_2 = [Rp caf cbf ccf cdf cef];

save multi_log.dat table table_2;

if (~ strcmp (getenv ('OMIT_PLOTS'), 'true')) % PLOTTING
subplot (3, 1, 1);
plot (table(:,1), table(:,2:4), table_2(:,1), table_2(:,2:4));
% TITLE

subplot (3, 1, 2);
semilogy (table(:,1), table(:,2:4), table_2(:,1), table_2(:,2:4));
% TITLE

subplot (3, 1, 3);
plot (table(:,1), table(:,5:6), table_2(:,1), table_2(:,5:6));
% TITLE
end % PLOTTING

pellet.m


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function retval = pellet(x)
  global  npts A Aint Bint Rint  caf cbf ccf ...
          k10 E1 k20 E2 Ka0 Ea Kc0 Ec Da Db Dc T ...
          Ra Rb Rc Da Db Dc kma kmb kmc dcadr dcbdr dccdr
  %
  % component A
  %
  za = x(1:npts);
  zb = x(npts+1:2*npts);
  zc = x(2*npts+1:3*npts);
  ca = exp(za);
  cb = exp(zb);
  cc = exp(zc);

  k1      = k10*exp(-E1/T);
  k2      = k20*exp(-E2/T);
  Ka      = Ka0*exp(-Ea/T);
  Kc      = Kc0*exp(-Ec/T);
  den     = (1+Ka*ca+Kc*cc).^2;
  r1      = k1.*ca.*cb./den;
  r2      = k2*cc.*cb./den;
  Ra      = - r1;
  Rb      = - 1/2*r1  - 9/2*r2;
  Rc      = - r2;
  ip = 1;
  retval(ip)    = A(1,:)*za;
  caint = ca(2:npts-1);
  retval(ip+1:ip+npts-2) = Bint*za + Aint*za.*(Aint*za + 2./Rint) + ...
      Ra(2:npts-1)./(Da*caint);
  dzadr = A(npts,:)*za;
  retval(ip+npts-1) = Da*dzadr - kma*(caf/ca(npts) - 1);
  %
  % component B
  %
  ip = npts+1;
  cbint = cb(2:npts-1);
  retval(ip)    = A(1,:)*zb;
  retval(ip+1:ip+npts-2) = Bint*zb + Aint*zb.*(Aint*zb + 2./Rint) + ...
      Rb(2:npts-1)./(Db*cbint);
  dzbdr = A(npts,:)*zb;
  retval(ip+npts-1) =  Db*dzbdr - kmb*(cbf/cb(npts) - 1);
  %
  % component C
  %
  ip = 2*npts+1;
  ccint = cc(2:npts-1);
  retval(ip)    = A(1,:)*zc;
  retval(ip+1:ip+npts-2) = Bint*zc + Aint*zc.*(Aint*zc + 2./Rint) + ...
      Rc(2:npts-1)./(Dc*ccint);
  dzcdr = A(npts,:)*zc;
  retval(ip+npts-1) = Dc*dzcdr - kmc*(ccf/cc(npts) - 1);
  dcadr = dzadr.*ca;
  dcbdr = dzbdr.*cb;
  dccdr = dzcdr.*cc;