17convec.mws

Partial Differential Equations PowerTool

by Dr. Jim Herod

Section 4.4: Convection Across Boundaries

Maple Packages for Section 4.4

>    restart;

>    with(plots):

Warning, the name changecoords has been redefined

     

Suppose that we take a well insulated rod -- sides and ends insulated-- which has initial heat distribution as indicated by the function

                         4 x  (1 - x ) + 2,    0 < x  < 1.

We can see that this rod will be hottest in the middle, and that as the heat diffuses, a uniform distribution of heat will be achieved with total heat the same as the total heat of the original distribution. After all, no heat has been lost or gained in this well-insulated rod. Here is the definition of the initial distribution of heat, and the value of the total heat in the system.

>    f:=x->4*x*(1-x)+2;

f := proc (x) options operator, arrow; 4*x*(1-x)+2 end proc

>    int(f(x),x=0..1);

8/3

>   

How to model the redistribution of heat was discussed in Section 4.3. Consider this alternate problem. Keep the rod well insulated, except at one end. There heat escapes or gathers according as to whether it is more or less than the outside temperature equal to 2. More specifically, We suppose

The PDE:           diff(u,t) = diff(u,`$`(x,2))  ,

The Boundary Conditions:    diff(u,x)  (t, 0) = 0 and diff(u,x)  (t,1) = - ( u (t, 1) - 2).

The Initial Condition:      u (0, x) = 4 x (1-x) + 2.

Now this problem is more interesting. From the equation for the distribution for the initial temperature, we can calculate that the temperature is 2 at the two ends and 3 in the exact middle. The heat begins to diffuse, causing temperatures to rise or fall along the rod. As soon as the temperature goes above 2 on the right, the rod begins to cool by heat loss at that end. Heat will continue to leak out until the temperature over the entire rod is 2. But what happens at the left side. Surely heat will start to spread there from the middle. We calculated in the lines above that with no leakage out the right side or anywhere else, the temperature at the left would rise to 8/3. How high will it go now with this leakage out the right side? Will it go above 2, and then settle back down? And what about the hot spot? Will it move left as heat leaks out the right side, or will it drop straight down?

     Maybe you agree this problem will be interesting to consider.

The PDE is homogeneous, but the boundary conditions are not. Homogeneous boundary conditions would be

The Boundary Conditions:    diff(w,x)  (t, 0) = 0 and diff(w,x)  (t,1) = - w(t, 1).

Thus, we need to find a particular solution, or what we call the steady state solution, for the original problem. Is it clear that the steady state solution is

               v(x) = 2?

That solution satisfies the PDE and the non-homogeneous boundary conditions. The u which satisfied the original problem is related to the transient solution w

by u = w + 2.

Now, we try to find the general solution for the PDE with homogeneous boundary conditions.

The general solution for the homogeneous problem

By now, we know to perform what was called Step 1 in Section 4.1: using separation of variables create two ordinary differential equations with boundary conditions whose solutions will determine the solution for the partial differential equation:

          X '' = mu  X, with X'(0) = 0 and X '(1) +X(1) = 0,

and

          T ' = mu  T.

Step 2 was to solve the two ordinary differential equations with boundary conditions. The constant mu  must be negative, call it -lambda^2  . Solutions for the differential equation

                     X '' = -lambda^2  X

are         A sin( lambda  x) + B cos( lambda  x).

We invoke the boundary conditions.

>    X:=x->A*sin(lambda*x)+B*cos(lambda*x);

X := proc (x) options operator, arrow; A*sin(lambda*x)+B*cos(lambda*x) end proc

The left boundary condition is used first.

>    D(X)(0)=0;

A*lambda = 0

This condition implies A = 0.

>    A:=0;

A := 0

We now use the remaining boundary condition.

>    D(X)(1)+X(1)=0;

-B*sin(lambda)*lambda+B*cos(lambda) = 0

This implies that tan( lambda ) = 1/lambda  .

We must find lambda  's that satisfy this requirement. Then, mu  = -lambda^2   and the eigenfunction corresponding to this eigenvalue is cos( lambda  x). We have only to find the lambda  's.

     Is it now clear that there is going to be no nice, closed form solution for these   lambda  's? We must find them numerically. To help in doing this, we look at where the graph of tan(x) crosses the graph of 1/x.

>    plot([tan(x),1/x],x=0..20,y=0..3/2,discont=true,color=[RED,BLACK]);

[Maple Plot]

We see there are roots between all the places where tan(x) is zero and where it is undefined.

     Maybe seven will be enough.

>    for n from 1 to 7 do
   lambda[n]:=fsolve(tan(x)=1/x,x,(n-1)*Pi..(2*n-1)*Pi/2);
od;

lambda[1] := .8603335890

lambda[2] := 3.425618459

lambda[3] := 6.437298179

lambda[4] := 9.529334405

lambda[5] := 12.64528722

lambda[6] := 15.77128487

lambda[7] := 18.90240996

>   

We now have approximations for seven of the eigenvalues. We are ready to take Step 3: construct the general solution for the partial differential equation. We have

          w(t, x) = sum(c[n]*exp(-lambda[n]^2*t)*cos(lambda[n]*x),n)  .

We go back to solve the original problem. We need the general solution plus the particular solutions. These add together to give the solution to this problem.

The solution for the original problem

Now, we find the c's by using the initial condition:     f(x) = w(0, x)  + 2

or           f ( x ) -2 = sum(c[n]*cos(lambda[n]*x),n)  .

We compute coefficients.

>    for n from 1 to 7 do
   c[n]:=int((f(x)-2)*cos(lambda[n]*x), x=0..1)/
                    int(cos(lambda[n]*x)^2,x=0..1);
od;
n:='n':

c[1] := .7554571809

c[2] := -.1287379660

c[3] := -.3659922186

c[4] := -.2384837324e-2

c[5] := -.9866775175e-1

c[6] := -.3212681665e-3

c[7] := -.4449954206e-1

We check to see how close this is to our f .

>    plot([f(x),2+sum(c[n]*cos(lambda[n]*x),n=1..7)],x=0..1);

[Maple Plot]

We now define the solution, check to see that it really is a solution, and plot its graph.

>    u:=(t,x)->2+sum(c[n]*exp(-lambda[n]^2*t)*cos(lambda[n]*x),n=1..7);

u := proc (t, x) options operator, arrow; 2+sum(c[n]*exp(-lambda[n]^2*t)*cos(lambda[n]*x),n = 1 .. 7) end proc

Check the solution

We check the differential equation and boundary conditions.

>    diff(u(t,x),t)-diff(u(t,x),x,x);

.1e-10*exp(-248.7334265*t)*cos(15.77128487*x)

>    D[2](u)(t,0); D[2](u)(t,1)+(u(t,1)-2);

0.

.3e-9*exp(-11.73486183*t)-.4e-9*exp(-41.43880785*t)+.9e-11*exp(-90.80821420*t)-.488e-8*exp(-159.9032889*t)+.245e-10*exp(-248.7334265*t)+.266e-8*exp(-357.3011023*t)
.3e-9*exp(-11.73486183*t)-.4e-9*exp(-41.43880785*t)+.9e-11*exp(-90.80821420*t)-.488e-8*exp(-159.9032889*t)+.245e-10*exp(-248.7334265*t)+.266e-8*exp(-357.3011023*t)

The above answers might be a surprise. They are not all zeros. Not to worry.
The
lambda 's we computed above were only an approximation for the real ones. (Remember that we used fsolve?) So, the numbers computed just above that we thought would be zero are approximations for zero. Of course! Just look at their magnitude.

Finally, we observe how good a fit we have for the initial value.

>    plot([f(x),u(0,x)],x=0..1);

[Maple Plot]

>   

Graph the solution

>    plot3d(u(t,x),x=0..1,t=0..3,axes=NORMAL,orientation=[-20,60]);

[Maple Plot]

Does this graph have the properties we predicted? Does it appear that the graph changes from being the same shape at t  = 0 as the graph of f ( x ) and that the graph changes toward being constant 2 as t  evolves.

 

We are satisfied that we have an approximation for the solution for the original problem.

In order to watch the maximum move from one side to the other, we animate u ( t , x ) as t  increases. Using the cursor, touch the graph of the animation which comes next. Use the Move To The Next Frame  button to watch how the maximum temperature moves to the left.

>    animate(u(t,x),x=0..1,t=0..1,frames=100,view=[0..1,1.5..3.5]);

[Maple Plot]

We ask: At what time would the left end point and right end point have maximum temperatures? This graph gives some answer. The red graph is the left endpoint temperature and the green is the right endpoint temperature.

>    plot([u(t,0),u(t,1)],t=0..2,y=0..3,color=[red,green]);

[Maple Plot]

>   

This problem was important for it led to an eigenvalue problem for which we could not find the eigenvalues in closed form. It was necessary to use numerical methods to generate these eigenvalues. From an applications perspective, the boundary conditions are more realistic for it is unlikely that the end points can be held fixed or perfectly insulated.

Unassisted Maple

We have seen how Maple suggests separation of variables in previous sections for the diffusion equation and variations. In this section, we allow Maple freedom on a different problem.

Perhaps here the user felt uncomfortable with having to make approximations for where solutions for the equation

       tan( lambda ) = 1/ lambda  

should lie. After all, if we wanted 20 or 200 such lambda 's, we would not want to go searching for the intervals in which to seek solutions. The question we address is how to let Maple find these without human assistance.

The answer is to ask the right question. This question is suggested by the following graphs of 1/x and tan(x).

>    plot([tan(x),1/x],x=0..20,y=-2..2, discont=true);

[Maple Plot]

This graph makes clear the obvious. There is a solution for the equation tan(x) = 1/x between successive odd multiples of Pi /2. Thus, we let Maple determine these values unassisted by our searching out specific intervals for each solution.

>    for n from 0 to 7 do
  mu[n]:=fsolve(tan(x)=1/x,x,max(0,(2*n-1)*Pi/2)..(2*n+1)*Pi/2);

>    od;

mu[0] := .8603335890

mu[1] := 3.425618459

mu[2] := 6.437298179

mu[3] := 9.529334405

mu[4] := 12.64528722

mu[5] := 15.77128487

mu[6] := 18.90240996

mu[7] := 22.03649673

>   

EMAIL: herod@math.gatech.edu   or   jherod@tds.net

URL: http://www.math.gatech.edu/~herod

Copyright ©  2003  by James V. Herod

All rights reserved