Example 8.15.mw

Example 8.15 Heat Conduction in a Rectangle with a Time Dependent Boundary Condition 

Equation (8.1.35) is solved in Maple below for a general time dependent function, w(t), and plots are obtained for a particular step function. 

> restart; -1; with(inttrans); -1; with(plots); -1
 

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

diff(u(x, t), t) = diff(diff(u(x, t), x), x) (1)
 

> u(x,0):=0;
 

0 (2)
 

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

u(x, t) = 0 (3)
 

> bc2:=u(x,t)=w(t);
 

u(x, t) = w(t) (4)
 

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

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

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

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

> bc1:=subs(laplace(u(x,t),t,s)=U(x),laplace(w(t),t,s)=W(s),bc1);
 

U(x) = 0 (6)
 

> bc2:=laplace(bc2,t,s):
 

> bc2:=subs(laplace(u(x,t),t,s)=U(x),laplace(w(t),t,s)=W(s),bc2);
 

U(x) = W(s) (7)
 

> dsolve(eqs,U(x));
 

U(x) = `+`(`*`(_C1, `*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `*`(_C2, `*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(x)))))))) (8)
 

> U(x):=c[1]*cosh(s^(1/2)*x)+c[2]*sinh(s^(1/2)*x);
 

`+`(`*`(c[1], `*`(cosh(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `*`(c[2], `*`(sinh(`*`(`^`(s, `/`(1, 2)), `*`(x)))))) (9)
 

> eq0:=eval(subs(x=0,bc1)):
 

> eq1:=eval(subs(x=1,bc2)):
 

> con:=solve({eq0,eq1},{c[1],c[2]}):
 

> U(x):=subs(con,U(x));
 

`/`(`*`(W(s), `*`(sinh(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `*`(sinh(`*`(`^`(s, `/`(1, 2)))))) (10)
 

> U(x):=factor(combine(simplify(U(x))));
 

`/`(`*`(W(s), `*`(sinh(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `*`(sinh(`*`(`^`(s, `/`(1, 2)))))) (11)
 

Next U1(x) is written as a product of two functions (see equations (8.1.31) and (8.1.33)): 

> U1(x):=simplify(U(x)/W(s)/s);
 

`/`(`*`(sinh(`*`(`^`(s, `/`(1, 2)), `*`(x)))), `*`(sinh(`*`(`^`(s, `/`(1, 2)))), `*`(s))) (12)
 

U1(x) is chosen so that q(s) is a higher order than p(s) (see equation (8.1.32)): 

> G(s):=W(s)*s;
 

`*`(W(s), `*`(s)) (13)
 

where W(s) is the Laplace transform of the time dependent boundary condition w(t) in equation (8.11.35.).  Next, U1(X) is inverted to the time domain as illustrated in section 8.1.7 to obtain f(t) as: 

> P(s):=numer(U1(x));
 

sinh(`*`(`^`(s, `/`(1, 2)), `*`(x))) (14)
 

> Q(s):=denom(U1(x));
 

`*`(sinh(`*`(`^`(s, `/`(1, 2)))), `*`(s)) (15)
 

> solve(Q(s),s);
 

0 (16)
 

> _EnvAllSolutions := true;
 

true (17)
 

> solve(Q(s),s);
 

`+`(`-`(`*`(`^`(Pi, 2), `*`(`^`(_Z1, 2))))), 0 (18)
 

> 0,0,-n^2*Pi^2;
 

0, 0, `+`(`-`(`*`(`^`(n, 2), `*`(`^`(Pi, 2))))) (19)
 

> mu0:=0;
 

0 (20)
 

> b[2]:=(s-mu0)^2*P(s)/Q(s);
 

`/`(`*`(s, `*`(sinh(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `*`(sinh(`*`(`^`(s, `/`(1, 2)))))) (21)
 

> B[2]:=limit(b[2],s=0);
 

0 (22)
 

> b[1]:=diff(b[2],s):
 

> B[1]:=limit(b[1],s=0);
 

x (23)
 

> A(s):=P(s)/diff(Q(s),s):
 

> A[n]:=simplify(subs(s=mu,A(s)));
 

`+`(`/`(`*`(2, `*`(sinh(`*`(`^`(mu, `/`(1, 2)), `*`(x))))), `*`(`+`(`*`(cosh(`*`(`^`(mu, `/`(1, 2)))), `*`(`^`(mu, `/`(1, 2)))), `*`(2, `*`(sinh(`*`(`^`(mu, `/`(1, 2)))))))))) (24)
 

> A[n]:=simplify(subs(mu^(1/2)=I*n*Pi,mu^(3/2)=-I*n^3*Pi^3,mu=-n^2*Pi^2,A[n])):
 

> vars:={sin(n*Pi)=0};
 

{sin(`*`(n, `*`(Pi))) = 0} (25)
 

> A[n]:=simplify(subs(vars,A[n])):
 

> A[n]:=simplify(subs(vars,expand(A[n])));
 

`+`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))))), `*`(cos(`*`(n, `*`(Pi))), `*`(n, `*`(Pi))))) (26)
 

> b1s:=B[1]*subs(mu0=0,1/(s-mu0));
 

`/`(`*`(x), `*`(s)) (27)
 

> b1t:=invlaplace(b1s,s,t);
 

x (28)
 

> b2s:=B[2]*subs(mu0=0,1/(s-mu0)^2);
 

0 (29)
 

> b2t:=invlaplace(b2s,s,t);
 

0 (30)
 

> uns:=A[n]/(s-mu);
 

`+`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))))), `*`(cos(`*`(n, `*`(Pi))), `*`(n, `*`(Pi, `*`(`+`(s, `-`(mu)))))))) (31)
 

> unt:=invlaplace(uns,s,t);
 

`+`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))), `*`(exp(`*`(mu, `*`(t)))))), `*`(cos(`*`(n, `*`(Pi))), `*`(n, `*`(Pi))))) (32)
 

> unt:=subs(mu=-n^2*Pi^2,unt);
 

`+`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))), `*`(exp(`+`(`-`(`*`(`^`(n, 2), `*`(`^`(Pi, 2), `*`(t))))))))), `*`(cos(`*`(n, `*`(Pi))), `*`(n, `*`(Pi))))) (33)
 

> f(t):=b1t+b2t+Sum(unt,n=1..infinity);
 

`+`(x, Sum(`+`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))), `*`(exp(`+`(`-`(`*`(`^`(n, 2), `*`(`^`(Pi, 2), `*`(t))))))))), `*`(cos(`*`(n, `*`(Pi))), `*`(n, `*`(Pi))))), n = 1 .. infinity)) (34)
 

Next, a step function is chosen for w(t) and plotted: 

> w(t):=Heaviside(t-1)-1/2*Heaviside(t-2);
 

`+`(Heaviside(`+`(t, `-`(1))), `-`(`*`(`/`(1, 2), `*`(Heaviside(`+`(t, `-`(2))))))) (35)
 

> plot(w(t),t=0..5,thickness=3,title="Figure Exp. 8.28.",axes=boxed);
 

Plot_2d
 

The Laplace transform of w(t) is: 

> W(s):=laplace(w(t),t,s);
 

`+`(`/`(`*`(`/`(1, 2), `*`(`+`(`*`(2, `*`(exp(`+`(`-`(s))))), `-`(exp(`+`(`-`(`*`(2, `*`(s))))))))), `*`(s))) (36)
 

The function g(t) is obtained by inverting G(s): 

> G(s):=s*W(s);
 

`+`(exp(`+`(`-`(s))), `-`(`*`(`/`(1, 2), `*`(exp(`+`(`-`(`*`(2, `*`(s))))))))) (37)
 

> g(t):=invlaplace(G(s),s,t);
 

`+`(Dirac(`+`(t, `-`(1))), `-`(`*`(`/`(1, 2), `*`(Dirac(`+`(t, `-`(2))))))) (38)
 

Next, the convolution integral is carried out to obtain the final time domain solution as: 

> gtau:=subs(t=tau,g(t));
 

`+`(Dirac(`+`(tau, `-`(1))), `-`(`*`(`/`(1, 2), `*`(Dirac(`+`(tau, `-`(2))))))) (39)
 

> ftau:=subs(t=t-tau,f(t));
 

`+`(x, Sum(`+`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))), `*`(exp(`+`(`-`(`*`(`^`(n, 2), `*`(`^`(Pi, 2), `*`(`+`(t, `-`(tau))))))))))), `*`(cos(`*`(n, `*`(Pi))), `*`(n, `*`(Pi))))), n = 1 .. infinit... (40)
 

> U:=int(ftau*gtau,tau=0..t);
 

`+`(`-`(`*`(`/`(1, 2), `*`(Heaviside(`+`(t, `-`(2))), `*`(`+`(x, Sum(`+`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))), `*`(exp(`+`(`-`(`*`(`^`(n, 2), `*`(`^`(Pi, 2), `*`(`+`(t, `-`(2))))))))))), `*`(co...
`+`(`-`(`*`(`/`(1, 2), `*`(Heaviside(`+`(t, `-`(2))), `*`(`+`(x, Sum(`+`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))), `*`(exp(`+`(`-`(`*`(`^`(n, 2), `*`(`^`(Pi, 2), `*`(`+`(t, `-`(2))))))))))), `*`(co...
(41)
 

> u:=piecewise(t=0,0,t>0,subs(infinity=20,U)):
 

> plot3d(simplify(u),x=0..1,t=0..5,axes=boxed,title="Figure Exp. 8.29.",labels=[x,t,"u"],orientation=[135,45]);
 

Plot
 

The dimensionless temperature at different points inside the rectangle are plotted as: 

> plot([simplify(subs(x=1,u)),simplify(subs(x=0.75,u)),simplify(subs(x=0.5,u)),simplify(subs(x=0.25,u)),simplify(subs(x=0.0,u))],t=0..5.,thickness=3,axes=boxed,title="Figure Exp. 8.30.",labels=[t,"u"]);
 

Plot_2d
 

>