Example 3.2
Diffusion with a convection and simultaneous first orderrreaction in a rectangular plate can be simulated using the program described above by using minor modifications. Consider the composition profile in a packed tube reactor undergoing isothermal linear kinetics with axial diffusion. The equation is

Solving this boundary value problem by hand is difficult and the solution for this problem is very long. This boundary value problem is solbed below easilty by following the procedure described earlier.
| > |
with(linalg):with(plots): |
 |
(1) |
| > |
eq:=diff(C(x),x$2)-Pe*diff(C(x),x)-Ha*C(x); |
 |
(2) |
| > |
A:=matrix(N,N,[0,1,Ha,Pe]); |
 |
(3) |
Note that for this boundary value problem both C and
at x=0 are not known. However, using the boundary condition at x=0,
can be written in terms of the unknown constant c1, which is the concentration at x=0.
| > |
Y0:=matrix(N,1,[c[1],-Pe*(1-c[1])]); |
 |
(5) |
To find c1, we can use the known boundary condition at x=0.
The equation for c1 can be solved easily by using Maple's 'solve' command.
Now that we have c1, the complete solution can be determined for C by using Maple's 'eval' command:
Next, one can plot the concentration profile by substituting values for the parameters Ha and Pe:
 |
(11) |
| > |
plot(subs(pars,C),x=0..1,thickness=4,axes=boxed,labels=[x,"C"],title="Figure Exp. 3.1.3."); |
New plots can be made for different sets of parameters such as:
| > |
plot(subs(pars,C),x=0..1,thickness=4,axes=boxed,labels=[x,"C"],color=green,title="Figure Exp. 3.1.4."); |
When we get weird plots, we can solve this problem by increasing the number of digits as:
 |
(12) |
| > |
plot(subs(pars,C),x=0..1,thickness=4,axes=boxed,labels=[x,"C"],color=gold,title="Figure Exp. 3.1.5."); |