Example 3.3

Consider diffusion with a first order reaction in a semi-infinite plane:

C

where C is the dimensionless concentration, D1 is the diffusion and k is the rate constant. This equation is solved below using the procedure described above.

> | restart:

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

> | N:=2;

| (1)

> | eq:=diff(C(x),x$2)-k/D1*C(x);

| (2)

> | A:=matrix(N,N,[0,1,k/D1,0]);

| (3)

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

| (4)

> | Y0:=matrix(N,1,[1,c[1]]);

| (5)

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

| (6)

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

| (7)

This can be rewritten as

> | C:=collect(C,exp(1/D1*(D1*k)^(1/2)*x));

| (8)

> | C:=collect(C,exp(-1/D1*(D1*k)^(1/2)*x));

| (9)

Since C is finite as x tends to infinity, the second parenthesis must go to zero because exp(x) goes to infinity as x goes to infinity. Consequently, the equation for c1 can be found by setting the coefficient of the second term equal to zero:

> | eqbc:=coeff(C,exp(1/D1*(D1*k)^(1/2)*x));

| (10)

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

| (11)

Thus, the desired solution for C is simply:

> | C:=eval(C);

| (12)

Plots can be made by substituting values for the parameters D1 and k:

> | pars:={D1=1e-5,k=1};

| (13)

> | plot(subs(pars,C),x=0..1e-2,labels=[x,"C"],thickness=4,axes=boxed,title="Figure Exp. 3.1.6.");

New plots can be made by substituting different values for the paramters.

> | pars:={D1=1e-7,k=1};

| (14)

> | plot(subs(pars,C),x=0..1e-2,labels=[x,"C"],thickness=4,axes=boxed,color=black,title="Figure Exp. 3.1.7.");

We observe that as the diffusion coefficient decreases mass transfer limitations increase the length of the diffusion layer (distance required for C to drop to approximately 0) which decreases as expected.

> |