Figure 4.27 (page 162):

Overall and per-pass conversion of A as a function of fractional recycle, \alpha .

Code for Figure 4.27

Text of the GNU GPL.

main.m

%% 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 ktheta alpha Na3 ntype

%%
%% Find the separator, 2-cstr arrangement taht achieves the same outlet
%% concentration as a single pfr. 
%% Marty Feinberg mentioned result that you need (s+1) cstrs in which s
%% is the number of linearly independent reactions to achieve the pfr
%% concentraion vector
%%
%% A -- > B, r=kc_A
%%
%% 11/8/99
%%
k = 1;
theta = 1;
ktheta=k*theta;
xpfr = 1-exp(-ktheta);
xcstr = ktheta/(1+ktheta);
%%
%% compute the overall conversion (Na3) for various alpha fraction
%% values of recycle, ntype = 1
%%
ntype = 1;
nalpha = 250;
xalpha = linspace(0,1,nalpha)';
x= [1;1/(1+ktheta);1/(1+ktheta)];
xrec = zeros (nalpha,1);
xpass = zeros (nalpha,1);
for i = 1: nalpha
  alpha = xalpha(i);
  x0 = x;
  [x, fval, info] = fsolve('recycle_reactor',x0);
  Na1 = x(1);
  Na2 = x(2);
  Na3 = x(3);
  xrec(i) = 1. - Na3;
  xpass(i) = (Na1-Na2)/Na1;
end
%plot(xalpha,xrec)
table =[xalpha xrec xpass];
%%
%% find the alpha recycle fraction for the PFR overall conversion,
%% ntype=2 
%%
ntype = 2;
x= [1;1/(1+ktheta);0];
Na3 = 1 - xpfr;
x0 = x;
[x, fval, info] = fsolve('recycle_reactor',x0);
Na1   = x(1);
Na2   = x(2);
alpha = x(3);
auxtable = [0 xpfr xcstr alpha 0;
	    1 xpfr xcstr alpha 1   ];
 
plot (table(:,1),[table(:,2:3)],...
      auxtable(:,1),[auxtable(:,2:3)],...
      auxtable(:,4),auxtable(:,5));
title ('Figure 4.27')

recycle_reactor.m

function resid = recycle_reactor(x)
  global ktheta alpha Na3 ntype
  Na1 = x(1);
  Na2 = x(2);
  if (ntype == 1)
    Na3 = x(3);
  elseif (ntype == 2)
    alpha = x(3);
  else
    error ('recycle_reactor: ntype out of range')
  end
  %% reactor balance
  resid = zeros(size(x));
  resid(1) = (1+ktheta/Na1)*Na2 - Na1;
  %% feed mixer
  resid(2) = alpha*Na2 + 1. -Na1;
  %% outlet splitter
  resid(3) = Na3 - (1-alpha)*Na2;