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.

> | restart:

> | with(linalg):with(plots):

> | N:=2;

| (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)

> | mat:=exponential(A,x);

| (4)

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)

> | sol:=evalm(mat&*Y0):

> | C:=sol[1,1];

| (6)

> | dCdx:=sol[2,1];

| (7)

To find c1, we can use the known boundary condition at x=0.

> | bc2:=subs(x=1,dCdx)=0;

| (8)

The equation for c1 can be solved easily by using Maple's 'solve' command.

> | c[1]:=solve(bc2,c[1]);

| (9)

Now that we have c1, the complete solution can be determined for C by using Maple's 'eval' command:

> | C:=eval(C);

| (10)

Next, one can plot the concentration profile by substituting values for the parameters Ha and Pe:

> | pars:={Ha=1,Pe=10};

| (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:

> | pars:={Ha=1,Pe=50};

> | 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:

> | Digits:=30;

| (12)

> | plot(subs(pars,C),x=0..1,thickness=4,axes=boxed,labels=[x,"C"],color=gold,title="Figure Exp. 3.1.5.");

> |