Example 5.2 rev1.mw

Example 5.2  

 

Consider the heat conduction/mass transfer problem in a cylinder.[6] [9] [10] The governing equation in dimensionless form is 

 

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

 

                                                                                        u(x,0) = 0                                                               (5.1.19)             

              

Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mo((0,t) = 0 and u(1,t) = 1 

 

The nonhomogeneous boundary condition at x = 1 contributes to the forcing function vector b.  However, in this case the b vector is a constant, and hence, equation (5.1.18) can be used.  (Note that equation (5.1.17) is valid even when the b vector is a constant.)  When the governing equation is applied at x = 0 in cylindrical or spherical coordinate, we have singularity at x = 0.[11] [12] This singularity is avoided in our semianalytical technique as we use the boundary condition at x = 0 (symmetry boundary condition) to eliminate the dependent variable.  Equation (5.1.19) is solved in Maple below using the procedure described above. 

 

> restart;
 

> with(linalg):with(plots):
 

> ge:=diff(u(x,t),t)=diff(u(x,t),x$2)+1/x*diff(u(x,t),x);
 

diff(u(x, t), t) = `+`(diff(diff(u(x, t), x), x), `/`(`*`(diff(u(x, t), x)), `*`(x))) (1)
 

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

diff(u(x, t), x) (2)
 

> bc2:=u(x,t)-1;
 

`+`(u(x, t), `-`(1)) (3)
 

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

u(x, 0) = 0 (4)
 

> N:=10;
 

10 (5)
 

> L:=1;
 

1 (6)
 

> dydxf:=1/2*(-u[2](t)-3*u[0](t)+4*u[1](t))/h:
 

> dydxb:=1/2*(u[N-1](t)+3*u[N+1](t)-4*u[N](t))/h:
 

> dydx:=1/2/h*(u[m+1](t)-u[m-1](t)):
 

> d2ydx2:=1/h^2*(u[m-1](t)-2*u[m](t)+u[m+1](t)):
 

> bc1:=subs(diff(u(x,t),x)=dydxf,u(x,t)=u[0](t),x=0,bc1):
 

> bc2:=subs(diff(u(x,t),x)=dydxb,u(x,t)=u[N+1](t),x=1,bc2):
 

> eq[0]:=bc1;
 

`+`(`/`(`*`(`/`(1, 2), `*`(`+`(`-`(u[2](t)), `-`(`*`(3, `*`(u[0](t)))), `*`(4, `*`(u[1](t)))))), `*`(h))) (7)
 

> eq[N+1]:=bc2;
 

`+`(u[11](t), `-`(1)) (8)
 

> for i from 1 to N do eq[i]:=diff(u[i](t),t)= subs(diff(u(x,t),x$2) = subs(m=i,d2ydx2),diff(u(x,t),x) = subs(m=i,dydx),u(x,t)=u[i](t),x=i*h,rhs(ge));od:
 

> u[0](t):=(solve(eq[0],u[0](t)));
 

`+`(`-`(`*`(`/`(1, 3), `*`(u[2](t)))), `*`(`/`(4, 3), `*`(u[1](t)))) (9)
 

> u[N+1](t):=solve(eq[N+1],u[N+1](t));
 

1 (10)
 

> for i from 1 to N do eq[i]:=eval(eq[i]);od;
 

 

 

 

 

 

 

 

 

 

diff(u[1](t), t) = `+`(`/`(`*`(`+`(`*`(`/`(2, 3), `*`(u[2](t))), `-`(`*`(`/`(2, 3), `*`(u[1](t)))))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 2), `*`(`+`(`*`(`/`(4, 3), `*`(u[2](t))), `-`(`*`(`/`(4, 3), `*`(u...
diff(u[2](t), t) = `+`(`/`(`*`(`+`(u[1](t), `-`(`*`(2, `*`(u[2](t)))), u[3](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 4), `*`(`+`(u[3](t), `-`(u[1](t))))), `*`(`^`(h, 2))))
diff(u[3](t), t) = `+`(`/`(`*`(`+`(u[2](t), `-`(`*`(2, `*`(u[3](t)))), u[4](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 6), `*`(`+`(u[4](t), `-`(u[2](t))))), `*`(`^`(h, 2))))
diff(u[4](t), t) = `+`(`/`(`*`(`+`(u[3](t), `-`(`*`(2, `*`(u[4](t)))), u[5](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 8), `*`(`+`(u[5](t), `-`(u[3](t))))), `*`(`^`(h, 2))))
diff(u[5](t), t) = `+`(`/`(`*`(`+`(u[4](t), `-`(`*`(2, `*`(u[5](t)))), u[6](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 10), `*`(`+`(u[6](t), `-`(u[4](t))))), `*`(`^`(h, 2))))
diff(u[6](t), t) = `+`(`/`(`*`(`+`(u[5](t), `-`(`*`(2, `*`(u[6](t)))), u[7](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 12), `*`(`+`(u[7](t), `-`(u[5](t))))), `*`(`^`(h, 2))))
diff(u[7](t), t) = `+`(`/`(`*`(`+`(u[6](t), `-`(`*`(2, `*`(u[7](t)))), u[8](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 14), `*`(`+`(u[8](t), `-`(u[6](t))))), `*`(`^`(h, 2))))
diff(u[8](t), t) = `+`(`/`(`*`(`+`(u[7](t), `-`(`*`(2, `*`(u[8](t)))), u[9](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 16), `*`(`+`(u[9](t), `-`(u[7](t))))), `*`(`^`(h, 2))))
diff(u[9](t), t) = `+`(`/`(`*`(`+`(u[8](t), `-`(`*`(2, `*`(u[9](t)))), u[10](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 18), `*`(`+`(u[10](t), `-`(u[8](t))))), `*`(`^`(h, 2))))
diff(u[10](t), t) = `+`(`/`(`*`(`+`(u[9](t), `-`(`*`(2, `*`(u[10](t)))), 1)), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 20), `*`(`+`(1, `-`(u[9](t))))), `*`(`^`(h, 2)))) (11)
 

> eqs:=[seq(rhs(eq[j]),j=1..N)]:
 

> Y:=[seq(u[i](t),i=1..N)];
 

[u[1](t), u[2](t), u[3](t), u[4](t), u[5](t), u[6](t), u[7](t), u[8](t), u[9](t), u[10](t)] (12)
 

> A:=genmatrix(eqs,Y,'b1'):
 

> b:=matrix(N,1):for i to N do b[i,1]:=-eval(b1[i]);od:evalm(b);
 

array( 1 .. 10, 1 .. 1, [( 10, 1 ) = `+`(`/`(`*`(`/`(21, 20)), `*`(`^`(h, 2)))), ( 4, 1 ) = 0, ( 6, 1 ) = 0, ( 3, 1 ) = 0, ( 2, 1 ) = 0, ( 7, 1 ) = 0, ( 9, 1 ) = 0, ( 5, 1 ) = 0, ( 8, 1 ) = 0, ( 1, 1 ... (13)
 

> h:=eval(L/(N+1));
 

`/`(1, 11) (14)
 

> A:=map(eval,A):
 

> if N > 4 then A:=map(evalf,A);end:
 

> evalm(A);
 

array( 1 .. 10, 1 .. 10, [( 4, 8 ) = 0., ( 10, 1 ) = 0., ( 3, 7 ) = 0., ( 5, 6 ) = 133.1000000, ( 10, 10 ) = -242., ( 8, 4 ) = 0., ( 4, 1 ) = 0., ( 4, 9 ) = 0., ( 7, 7 ) = -242., ( 3, 4 ) = 141.166666...
array( 1 .. 10, 1 .. 10, [( 4, 8 ) = 0., ( 10, 1 ) = 0., ( 3, 7 ) = 0., ( 5, 6 ) = 133.1000000, ( 10, 10 ) = -242., ( 8, 4 ) = 0., ( 4, 1 ) = 0., ( 4, 9 ) = 0., ( 7, 7 ) = -242., ( 3, 4 ) = 141.166666...
array( 1 .. 10, 1 .. 10, [( 4, 8 ) = 0., ( 10, 1 ) = 0., ( 3, 7 ) = 0., ( 5, 6 ) = 133.1000000, ( 10, 10 ) = -242., ( 8, 4 ) = 0., ( 4, 1 ) = 0., ( 4, 9 ) = 0., ( 7, 7 ) = -242., ( 3, 4 ) = 141.166666...
array( 1 .. 10, 1 .. 10, [( 4, 8 ) = 0., ( 10, 1 ) = 0., ( 3, 7 ) = 0., ( 5, 6 ) = 133.1000000, ( 10, 10 ) = -242., ( 8, 4 ) = 0., ( 4, 1 ) = 0., ( 4, 9 ) = 0., ( 7, 7 ) = -242., ( 3, 4 ) = 141.166666...
array( 1 .. 10, 1 .. 10, [( 4, 8 ) = 0., ( 10, 1 ) = 0., ( 3, 7 ) = 0., ( 5, 6 ) = 133.1000000, ( 10, 10 ) = -242., ( 8, 4 ) = 0., ( 4, 1 ) = 0., ( 4, 9 ) = 0., ( 7, 7 ) = -242., ( 3, 4 ) = 141.166666...
array( 1 .. 10, 1 .. 10, [( 4, 8 ) = 0., ( 10, 1 ) = 0., ( 3, 7 ) = 0., ( 5, 6 ) = 133.1000000, ( 10, 10 ) = -242., ( 8, 4 ) = 0., ( 4, 1 ) = 0., ( 4, 9 ) = 0., ( 7, 7 ) = -242., ( 3, 4 ) = 141.166666...
array( 1 .. 10, 1 .. 10, [( 4, 8 ) = 0., ( 10, 1 ) = 0., ( 3, 7 ) = 0., ( 5, 6 ) = 133.1000000, ( 10, 10 ) = -242., ( 8, 4 ) = 0., ( 4, 1 ) = 0., ( 4, 9 ) = 0., ( 7, 7 ) = -242., ( 3, 4 ) = 141.166666...
array( 1 .. 10, 1 .. 10, [( 4, 8 ) = 0., ( 10, 1 ) = 0., ( 3, 7 ) = 0., ( 5, 6 ) = 133.1000000, ( 10, 10 ) = -242., ( 8, 4 ) = 0., ( 4, 1 ) = 0., ( 4, 9 ) = 0., ( 7, 7 ) = -242., ( 3, 4 ) = 141.166666...
array( 1 .. 10, 1 .. 10, [( 4, 8 ) = 0., ( 10, 1 ) = 0., ( 3, 7 ) = 0., ( 5, 6 ) = 133.1000000, ( 10, 10 ) = -242., ( 8, 4 ) = 0., ( 4, 1 ) = 0., ( 4, 9 ) = 0., ( 7, 7 ) = -242., ( 3, 4 ) = 141.166666...
array( 1 .. 10, 1 .. 10, [( 4, 8 ) = 0., ( 10, 1 ) = 0., ( 3, 7 ) = 0., ( 5, 6 ) = 133.1000000, ( 10, 10 ) = -242., ( 8, 4 ) = 0., ( 4, 1 ) = 0., ( 4, 9 ) = 0., ( 7, 7 ) = -242., ( 3, 4 ) = 141.166666...
(15)
 

> mat:=exponential(A,t):
 

> mat:=map(evalf,mat):
 

> Y0:=matrix(N,1):for i from 1 to N do Y0[i,1]:=evalf(subs(x=i*h,rhs(IC)));od:evalm(Y0);
 

array( 1 .. 10, 1 .. 1, [( 10, 1 ) = 0., ( 4, 1 ) = 0., ( 6, 1 ) = 0., ( 3, 1 ) = 0., ( 2, 1 ) = 0., ( 7, 1 ) = 0., ( 9, 1 ) = 0., ( 5, 1 ) = 0., ( 8, 1 ) = 0., ( 1, 1 ) = 0. ] ) (16)
 

The nonhomogeneous solution (equation (5.17b)) is found and added to the homogeneous solution. 

> s1:=evalm(Y0+inverse(A)&*b):
 

> Y:=evalm(mat&*s1-inverse(A)&*b):
 

> Y:=map(simplify,Y):
 

The number of digits is decreased to five for brevity.  However, for accuracy, one has to use a minimum of 10 digits, which is the default in Maple. 

> Digits:=5;
 

5 (17)
 

> for i from 1 to N do u[i](t):=evalf((Y[i,1]));od:
 

> for i from 0 to N+1 do u[i](t):=eval(u[i](t));od;
 

 

 

 

 

 

 

 

 

 

 

 

`+`(`*`(0.15562e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `-`(`*`(0.59845e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `*`(.12905, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `-`(`*`(.22028, `*`(e...
`+`(`*`(0.15562e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `-`(`*`(0.59845e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `*`(.12905, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `-`(`*`(.22028, `*`(e...
`+`(`*`(0.78565e-2, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `-`(`*`(0.31207e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `*`(0.71018e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `-`(`*`(.13041, `...
`+`(`*`(0.78565e-2, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `-`(`*`(0.31207e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `*`(0.71018e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `-`(`*`(.13041, `...
`+`(`-`(`*`(0.15262e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `*`(0.54709e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `-`(`*`(.10309, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `*`(.13920, `*`(...
`+`(`-`(`*`(0.15262e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `*`(0.54709e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `-`(`*`(.10309, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `*`(.13920, `*`(...
`+`(`*`(0.18770e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `-`(`*`(0.54402e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `*`(0.62025e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `-`(`*`(0.60035e-...
`+`(`*`(0.18770e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `-`(`*`(0.54402e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `*`(0.62025e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `-`(`*`(0.60035e-...
`+`(`-`(`*`(0.20044e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `*`(0.38831e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `*`(0.61803e-2, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `-`(`*`(0.95535e-...
`+`(`-`(`*`(0.20044e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `*`(0.38831e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `*`(0.61803e-2, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `-`(`*`(0.95535e-...
`+`(`*`(0.19671e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `-`(`*`(0.15357e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `-`(`*`(0.55213e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `*`(0.68916e...
`+`(`*`(0.19671e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `-`(`*`(0.15357e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `-`(`*`(0.55213e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `*`(0.68916e...
`+`(`*`(0.19671e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `-`(`*`(0.15357e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `-`(`*`(0.55213e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `*`(0.68916e...
`+`(`-`(`*`(0.17996e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `-`(`*`(0.84442e-2, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `*`(0.58627e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `*`(0.30767e...
`+`(`-`(`*`(0.17996e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `-`(`*`(0.84442e-2, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `*`(0.58627e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `*`(0.30767e...
`+`(`-`(`*`(0.17996e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `-`(`*`(0.84442e-2, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `*`(0.58627e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `*`(0.30767e...
`+`(`*`(0.15306e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `*`(0.26019e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `-`(`*`(0.21944e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `-`(`*`(0.79799e-...
`+`(`*`(0.15306e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `*`(0.26019e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `-`(`*`(0.21944e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `-`(`*`(0.79799e-...
`+`(`*`(0.15306e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `*`(0.26019e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `-`(`*`(0.21944e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `-`(`*`(0.79799e-...
`+`(`-`(`*`(0.11882e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `-`(`*`(0.33254e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `-`(`*`(0.24824e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `*`(0.2...
`+`(`-`(`*`(0.11882e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `-`(`*`(0.33254e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `-`(`*`(0.24824e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `*`(0.2...
`+`(`-`(`*`(0.11882e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `-`(`*`(0.33254e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `-`(`*`(0.24824e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `*`(0.2...
`+`(`*`(0.80034e-2, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `*`(0.29336e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `*`(0.49007e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `*`(0.49276e-1, `*`(ex...
`+`(`*`(0.80034e-2, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `*`(0.29336e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `*`(0.49007e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `*`(0.49276e-1, `*`(ex...
`+`(`*`(0.80034e-2, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `*`(0.29336e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `*`(0.49007e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `*`(0.49276e-1, `*`(ex...
`+`(`-`(`*`(0.39531e-2, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `-`(`*`(0.16680e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `-`(`*`(0.36693e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `-`(`*`...
`+`(`-`(`*`(0.39531e-2, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `-`(`*`(0.16680e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `-`(`*`(0.36693e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `-`(`*`...
`+`(`-`(`*`(0.39531e-2, `*`(exp(`+`(`-`(`*`(474.73, `*`(t)))))))), `-`(`*`(0.16680e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `-`(`*`(0.36693e-1, `*`(exp(`+`(`-`(`*`(395.52, `*`(t)))))))), `-`(`*`...
1 (18)
 

Hence, we have obtained a semianalytical solution (analytical in time and numerical in x).  Next, plots are made: 

> for i from 0 to N+1 do
 p[i]:=plot(u[i](t),t=0..0.4,color=COLOR(HUE,i/(N+2)),thickness=3):
end do:
 

> arw:=arrow(<0.26,0.6>,<-0.2,0.3>,width=[1/300,relative],head_width=[5,relative],head_length=[1/20,relative]):
pt:=textplot([[0.3,0.55,"Follow the arrow:"],seq([0.26,0.5-i*0.05,typeset(u[i],"(t)")],i=0..2),[0.26,0.35,"..."],[0.265,0.3,typeset(u[11],"(t)")]]):
 

> display([seq(p[i],i=0..11),arw,pt],axes=boxed,labels=[t,"u"],title="Figure Exp. 5.5.");
 

Plot_2d
 

> tf:=0.2;
 

.2 (19)
 

> M:=30;
 

30 (20)
 

> T1:=[seq(tf*i/M,i=0..M)];
 

[0., 0.66667e-2, 0.13333e-1, 0.20000e-1, 0.26667e-1, 0.33333e-1, 0.40000e-1, 0.46667e-1, 0.53333e-1, 0.60000e-1, 0.66667e-1, 0.73333e-1, 0.80000e-1, 0.86667e-1, 0.93333e-1, .10000, .10667, .11333, .12...
[0., 0.66667e-2, 0.13333e-1, 0.20000e-1, 0.26667e-1, 0.33333e-1, 0.40000e-1, 0.46667e-1, 0.53333e-1, 0.60000e-1, 0.66667e-1, 0.73333e-1, 0.80000e-1, 0.86667e-1, 0.93333e-1, .10000, .10667, .11333, .12...
[0., 0.66667e-2, 0.13333e-1, 0.20000e-1, 0.26667e-1, 0.33333e-1, 0.40000e-1, 0.46667e-1, 0.53333e-1, 0.60000e-1, 0.66667e-1, 0.73333e-1, 0.80000e-1, 0.86667e-1, 0.93333e-1, .10000, .10667, .11333, .12...
(21)
 

> PP:=matrix(N+2,M+1);
 

array( 1 .. 12, 1 .. 31, [ ] ) (22)
 

> for i from 1 to N+2 do PP[i,1]:=evalf(subs(x=(i-1)*h,rhs(IC)));od:
 

> for i from 1 to N+2 do for j from 2 to M+1 do PP[i,j]:=evalf(subs(t=T1[j],u[i-1](t)));od;od:
 

> plotdata := [seq([ seq([(i-1)*h,T1[j],PP[i,j]], i=1..N+2)], j=1..M+1)]:
 

> surfdata( plotdata, axes=boxed, title="Figure Exp. 5.6.",labels=[x,t,u],orientation=[-145,45]);
 

Plot
 

It is some times important to know how the temperature or concentration at the center of the cylinder changes with time.  Analytical solutions for cylinders involve Bessel functions and an infinite series.  With our semianalytical method, we can find how the temperature varies analytically with time.  The time dependent variable at the center of the cylinder varies with time as: 

> u[0](t);
 

`+`(`*`(0.15562e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `-`(`*`(0.59845e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `*`(.12905, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `-`(`*`(.22028, `*`(e...
`+`(`*`(0.15562e-1, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `-`(`*`(0.59845e-1, `*`(exp(`+`(`-`(`*`(444.17, `*`(t)))))))), `*`(.12905, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `-`(`*`(.22028, `*`(e...
(23)
 

We can find the time taken for the center of the cylinder to reach 0.5 (i.e., 50% of the steady state): 

> fsolve(u[0](t)-0.5,t=0..2);
 

.20048 (24)
 

In this example temperature (or concentration) at the surface is fixed (u(1,t) = 1).  With our semianalytical solution we can find how the flux at the surface varies as a function of time.  This flux is given bya three point backward difference at x = 1. 

> flux:=dydxb;
 

`+`(`*`(.13098, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `*`(.52830, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `*`(1.0768, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `*`(1.6323, `*`(exp(`+`(`-`(`*`(33...
`+`(`*`(.13098, `*`(exp(`+`(`-`(`*`(474.73, `*`(t))))))), `*`(.52830, `*`(exp(`+`(`-`(`*`(444.17, `*`(t))))))), `*`(1.0768, `*`(exp(`+`(`-`(`*`(395.52, `*`(t))))))), `*`(1.6323, `*`(exp(`+`(`-`(`*`(33...
(25)
 

>