Example4.5 rev1.mw

Example 4.5 Heat Conduction with a Source Term

The technique illustrated in the previous examples can be applied for the case where there is a source term (this source term can be a function of x and t). Consider the transient heat conduction problem in a slab[5]

=α

u(x,0) =0 (4.1.5)

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

Equation (4.1.5) is solved in Maple below. The programs given for the previous example can be modified to solve equation (4.1.5).

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

Only the governing equation has to be changed since:

> | eq:=diff(u(x,t),t)=alpha*diff(u(x,t),x$2)+sin(x)*exp(-t);

| (1)

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

| (2)

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

| (3)

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

| (4)

The following solution and plots are obtained:

> | 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},U(x)));

| (9)

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

| (10)

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

| (11)

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

| (12)

> | u:=invlaplace(U(x),s,t);

| (13)

> | pars:={alpha=1/5};

| (14)

> | plot3d(subs(pars,u),t=5..0,x=10..0,axes=boxed,title="Figure Exp. 4.1.11.",labels=[x,t,"u"]);

> | plot([subs(pars,t=0,u),subs(pars,t=0.5,u),subs(pars,t=1,u),subs(pars,t=2,u)],x=0..10,axes=boxed,title="Figure Exp. 4.1.12.",thickness=5,labels=[x,"u"]);

> | animate(subs(pars,u),x=0..10,t=0..5,thickness=5,axes=boxed,labels=[x,"u"]);

> |