Example4.2 rev 1.mw

Example  4.2  Heat Conduction with Transient Boundary Conditions 

Heat condition with a constant boundary condition at x =0 was considered in example 4.1.  The same technique can be applied for time dependent boundary conditions.  Consider the transient heat conduction problem in a slab.[4]  The governing equation is: 

 

Typesetting:-mrow(Typesetting:-mo(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mo( 

 

                                                                            u(x,0) = 1 

                                                                              

                                                   

                                                                            u(0,t) = Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mi( and u(∞,t) is defined                                   (4.1.2) 

 

 

 

 

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

> eq:=diff(u(x,t),t)=alpha*diff(u(x,t),x$2);
 

diff(u(x, t), t) = `*`(alpha, `*`(diff(diff(u(x, t), x), x))) (1)
 

> u(x,0):=0;
 

0 (2)
 

> bc1:=u(0,t)=k/t^(1/2);
 

u(0, t) = `/`(`*`(k), `*`(`^`(t, `/`(1, 2)))) (3)
 

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

u(infinity, t) = defined (4)
 

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

The governing equation in the Laplace domain is: 

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

`*`(s, `*`(U(x))) = `*`(alpha, `*`(diff(diff(U(x), x), x))) (5)
 

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

laplace(u(0, t), t, s) = `*`(`^`(`/`(`*`(Pi), `*`(s)), `/`(1, 2)), `*`(k)) (6)
 

The boundary condition in the Laplace domain is: 

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

U(0) = `*`(`^`(`/`(`*`(Pi), `*`(s)), `/`(1, 2)), `*`(k)) (7)
 

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

`+`(`*`(`+`(`*`(`^`(`/`(`*`(Pi), `*`(s)), `/`(1, 2)), `*`(k)), `-`(_C2)), `*`(exp(`/`(`*`(`^`(s, `/`(1, 2)), `*`(x)), `*`(`^`(alpha, `/`(1, 2))))))), `*`(_C2, `*`(exp(`+`(`-`(`/`(`*`(`^`(s, `/`(1, 2))... (8)
 

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

`+`(`*`(`^`(`/`(`*`(Pi), `*`(s)), `/`(1, 2)), `*`(k)), `-`(_C2)) (9)
 

> _C2:=solve(eqc,_C2);
 

`*`(`^`(`/`(`*`(Pi), `*`(s)), `/`(1, 2)), `*`(k)) (10)
 

The dimensionless temperature in the Laplace domain is: 

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

`*`(`^`(`/`(`*`(Pi), `*`(s)), `/`(1, 2)), `*`(k, `*`(exp(`+`(`-`(`/`(`*`(`^`(s, `/`(1, 2)), `*`(x)), `*`(`^`(alpha, `/`(1, 2)))))))))) (11)
 

Next, the solution is inverted to the time domain: 

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

`*`(k, `*`(`^`(Pi, `/`(1, 2)), `*`(invlaplace(`/`(`*`(exp(`+`(`-`(`/`(`*`(`^`(s, `/`(1, 2)), `*`(x)), `*`(`^`(alpha, `/`(1, 2)))))))), `*`(`^`(s, `/`(1, 2)))), s, t)))) (12)
 

Maple is not able to invert the solution in the Laplace domain.  This can be solved by using dummy variables for x and α and defining them to be positive: 

> U(x):=subs(x=x1,alpha=alpha1,U(x));
 

`*`(`^`(`/`(`*`(Pi), `*`(s)), `/`(1, 2)), `*`(k, `*`(exp(`+`(`-`(`/`(`*`(`^`(s, `/`(1, 2)), `*`(x1)), `*`(`^`(alpha1, `/`(1, 2)))))))))) (13)
 

> assume(x1>0,alpha1>0);
 

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

`/`(`*`(k, `*`(exp(`+`(`-`(`/`(`*`(`/`(1, 4), `*`(`^`(x1, 2))), `*`(alpha1, `*`(t)))))))), `*`(`^`(t, `/`(1, 2)))) (14)
 

> u:=subs(x1=x,alpha1=alpha,u);
 

`/`(`*`(k, `*`(exp(`+`(`-`(`/`(`*`(`/`(1, 4), `*`(`^`(x, 2))), `*`(alpha, `*`(t)))))))), `*`(`^`(t, `/`(1, 2)))) (15)
 

Hence, the final solution is: 

> pars:={alpha=0.001,k=1};
 

{alpha = 0.1e-2, k = 1} (16)
 

> plot3d(subs(pars,u),x=1..0,t=300..0,axes=boxed,title="Figure Exp. 4.1.5.",labels=[x,t,"u"],orientation=[45,45]);
 

Plot
 

> plot([subs(pars,t=1,u),subs(pars,t=10,u),subs(pars,t=100,u),subs(pars,t=200,u)],x=0..1,axes=boxed,title="Figure Exp. 4.1.6.",thickness=5,labels=[x,"u"],legend=["t=1","t=10","t=100","t=200"]);
 

Plot_2d
 

> animate(subs(pars,u),x=0..1,t=1..100,thickness=5,title="Figure Exp. 4.1.6.",axes=boxed,labels=[x,"u"]);

 

Plot_2d
 

You can make an animation using the command illustrated in example 4.1. 

>