Example4.7rev 1.mw

Example 4.7 Unsteady State Diffusion with a First-Order Reacton

Consider the transient diffusion problem.[6] The governing equation is

=D

u(x,0) = 0 (4.1.7)

(0,t) = 1 and u(∞,t) is defined

where D is the diffusivity (m2/s) and k is the rate constant (s-1) . Equation (4.1.7) is solved in Maple below using the Laplace transform technique:

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

> | eq:=diff(u(x,t),t)=D*diff(u(x,t),x$2)-k*u(x,t);

| (1)

> | u(x,0):=0;

| (2)

> | bc1:=u(0,t)=1;

| (3)

> | bc2:=u(infinity,t)=defined;

| (4)

> | eqs:=laplace(eq,t,s);

| (5)

> | eqs:=subs(laplace(u(x,t),t,s)=U(x),eqs);

| (6)

> | bc1:=laplace(bc1,t,s);

| (7)

> | bc1:=subs(laplace(u(0,t),t,s)=U(0),bc1);

| (8)

> | U(x):=rhs(dsolve({eqs,bc1}));

| (9)

> | eqc:=coeff(U(x),exp(1/D^(1/2)*(s+k)^(1/2)*x));

| (10)

> | _C2:=solve(eqc,_C2);

| (11)

> | U(x):=eval(U(x));

| (12)

Here again Maple cannot find the inverse Laplace transform:

> | invlaplace(U(x),s,t);

| (13)

From the poperty of the laplace transform,[7] we n=know that

> | U1:=U(x)*s;

| (14)

Again, Maple cannot invert U1 directly:

> | invlaplace(U1,s,t);

| (15)

Another formula[7] is used:

> | U2:=subs(s=s-k,U1);

| (16)

The inverse transform for U2 is:

> | U2:=subs({D=D1,x=x1},U2);

| (17)

> | assume(D1>0,x1>0);

> | u2:=invlaplace(U2,s,t);

| (18)

> | u2:=subs({D1=D,x1=x},u2);

| (19)

The inverse transform for U1 iS:

> | u1:=exp(-k*t)*u2;

| (20)

> | I1:=int(u1,t);

| (21)

> | with(student):

> | I1:=simplify(changevar(t=x^2/4/D/T^2,I1,T));

| (22)

> | I1:=subs(T=T1,x=x1,D=D1,I1);

| (23)

> | assume(T1>0);

> | I1:=simplify(I1);

| (24)

> | I1:=subs({x1=x,T1=T,D1=D},I1);

| (25)

> | I1:=expand(I1);

| (26)

> | I2:=eval(subs(T=infinity,I1));

| (27)

> | u:=I1-I2;

| (28)

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

| (29)

> | u:=convert(u,erfc);

| (30)

> | u:=subs(T=x/2/(D*t)^(1/2),u);

| (31)

> | convert(expand(simplify(eval(subs(k=0,u)))),erfc);

| (32)

> | expand(D*(expand(-eval(subs(x=0,diff(u,x))))));

| (33)

> | pars:={D=1e-6,k=0.1};

| (34)

> | plot3d(subs(pars,u),x=1e-3..0,t=10..0,axes=boxed,labels=[x,t,"u"],orientation=[-60,60]);

> | plot([subs(pars,t=0.01,u),subs(pars,t=0.1,u),subs(pars,t=1,u),subs(pars,t=2,u)],x=0..1e-3,axes=boxed,thickness=5,labels=[x,"u"]);

> |