14heat.mws

Partial Differential Equations PowerTool

by Dr. Jim Herod

Section 4.1: The Simple Heat Equation

Maple Packages for Section 4.1

>    restart;

>    with(plots):

Warning, the name changecoords has been redefined

>    with(PDEtools):

>   

We consider the simple heat equation. This is a standard linear realization for diffusion in one dimension. Derivations for this model can be found in most texts in this subject. The equation typically has the following form:   u  is a function of t  and x  and is written as u ( t , x ). We suppose that u  is differentiable as a function of t  and twice differentiable as a function of x . In this model, these derivatives are related by

             diff(u,t)  =   diff(u,`$`(x,2))  

In the heat equation, there are boundary conditions and initial conditions. In this Section, we will take the boundary conditions to be specified at x  = 0 and at x  = 1:

        u (t, 0) = 0 and u (t, 1) = 0.

We suppose that the value of u  when t  = 0 is specified as, say, f ( x ). Thus, we have an initial condition:

       u (0, x) = f ( x ).

A physical realization of the above equation is generally taken to be a thin, uniform bar over the interval [0, 1]. In this simple model, one takes the lateral surface of the rod to be insulated. Both ends of the rod are held at a fixed temperature. There are no internal or external heat sources. The rod has an initial heat distribution given by f ( x ). The heat diffuses from the places where it is warm toward the places where it is cooler. The rate of diffusion is proportional to the curvature of the present heat distribution. This statement about curvature takes the form of the second derivative. Thus, if the current distribution is concave down, the second derivative is negative and the temperature at that point will be decreasing. If the distribution is concave up, the temperature is increasing.

We will make the model more complicated later. For now, let's analyze this situation with the experience and knowledge we have. To this point, the principle idea we have used is the Fourier Idea . Here, we introduce the second idea: We suppose that the solution can be separate into a function of t  alone and of x  alone, so that

           u ( t , x ) = X( x ) T( t ).

This notion for approaching the problem is called the Method of Separation of Variables .

As we will see, this assumption leads to ordinary differential equations.

>    u:=(t,x)->X(x)*T(t);

u := proc (t, x) options operator, arrow; X(x)*T(t) end proc

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

X(x)*diff(T(t),t) = diff(X(x),`$`(x,2))*T(t)

>   

If we bring all the functions of t  to one side and all the functions of x  to the other side, we have

          T ' / T  = X '' / X.

Since the left side is independent of x , then as x  changes, X '' / X does not change. This quotient is constant. In a similar manner, the quotient T ' / T is constant, and, from the equality, is the same constant. Call it mu .

The boundary conditions give that T( t ) X(0) = 0. If there is a single t  so that T( t ) is not zero, we can conclude that X(0) = 0. In a similar manner, X(1) = 0. Thus, we have a differential equation

          X '' = mu  X, with X(0) = 0 = X(1).

We have already examined this differential equation. We found that there are an infinite number of such mu  's and they are all of the form

           mu = -n^2*Pi^2

and corresponding to each such constant, there is the solution

          X ` `[n]  ( x ) = sin( n pi   x ).

What about the possible T solutions? The quotient T '/ T is the same quotient, so that

          T ' = -n^2*Pi^2  T.

Solutions for this equation are

          T ` `[n]  ( t ) = exp(   -n^2*Pi^2   t ).

Consequently, for each integer n, we have a solution

          u( t , x ) = exp(   -n^2*Pi^2   t ) sin( n pi   x ).

But, since this is a linear problem, constant multiples of these solutions are also solutions, and (infinite) sums of solutions are solutions. Hence, a general solution can be written in the form of

          u( t , x ) = sum(c[n]*exp(-n^2*Pi^2*t)*sin(n*Pi*x),n)  .

There is one more piece of information we have not used. We have not used the initial value. This condition determines the coefficients:

           f ( x ) = u(0, x ) = sum(c[n]*sin(n*Pi*x),n) .

This looks like a job for Fourier Series. We know that c[n]  can be written as a quotient of integrals which resolve as

         c[n]   =   int(f(x)*sin(n*Pi*x),x = 0 .. 1)/int(sin(n*Pi*x)^2,x = 0 .. 1)  .

It will be valuable at this point to take a particular f , solve the equation, and draw some pictures. We take
          
f ( x ) = x*(1-x)^3  .

To visualize the initial value, we draw a graph.

>    f:=x->x*(1-x)^3;

f := proc (x) options operator, arrow; x*(1-x)^3 end proc

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

[Maple Plot]

>   

We form the Fourier representation for this f  and compare the graph of f  and of our series representation. First, note that the function is continuous and its periodic extension is continuous, so that the Fourier series will converge uniformly.

>    for n from 1 to 7 do
   c[n]:=int(f(x)*sin(n*Pi*x),x=0..1)/int(sin(n*Pi*x)^2,x=0..1):
end do:
n:='n';

n := 'n'

>    approx:=x->sum(c[n]*sin(n*Pi*x),n=1..7):

>    plot([f(x),approx(x)],x=0..1,color=[BLACK,RED]);

[Maple Plot]

As you can see, this is a very good fit. Now, we form the truncated series expansion for u.

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

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

Check that this is a solution.

There are three things that should be checked. First, does this u satisfy the partial differential equation?

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

0

Second, does it satisfy the boundary conditions?

>    u(t,0),u(t,1);

0, `and`, 0

Finally, is it a good approximation for f as an initial value?

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

[Maple Plot]

>   

The graph of the solution

Before drawing the graph of u, what is expected? We should expect that when t  = 0, the graph of u(0, x ) looks like the graph of f ( x ). Further, as t  increases, solution decreases to the stationary solution determined by the boundary conditions:

                u(infinity,x) = 0  .

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

[Maple Plot]

>   

A character of the solution

In designing this problem, I deliberately chose an initial distribution for which the highpoint of the graph is off center. It appears that this highpoint moves in toward the center of the interval [0, 1]. We can look at this movement in an animation.

>    animate(u(t,x),x=0..1,t=0..1/3, frames=30);

[Maple Plot]

>   

Observe that the point of highest temperature moves. We trace the movement of the high point. First note that the high point of the initial distribution is at 1/4. Here's how to see that: It was clear that the first derivative was zero in the interval [0, 1/2].

>    solve({diff(f(x),x)=0,x<1/2},x);

{x = 1/4}

Now we find where the temperature is highest as time evolves. Solving the equation for where the first derivative is zero in the approximation is harder to do. We make this determination numerically. That is, we get a floating point approximation for the derivatives. We expect to see the first derivatives converge to 1/2.

>    for p from 0 to 10 do
fsolve(subs(t=p/30,diff(u(t,x),x))=0,x,0..1/2);
od;

.2410107223

.3748920695

.4444469814

.4784210182

.4919031249

.4969792664

.4988739921

.4995803198

.4998435815

.4999417016

.4999782717

>   

     In this worksheet, we have solved a simple heat equation with zero boundary conditions and with an initial distribution. Here are the main steps:

Step 1:  By separation of variables, give two differential equations with boundary conditions whose solutions will determine the solution for the partial differential equation.

Step 2:  Solve the two ordinary differential equations with boundary conditions.

Step 3:  Construct the general solution for the partial differential equation with boundary condition.

Step 4:  Find the particular solution determined by the initial conditions.

Unassisted Maple

Finally, it is of interest to see what progress Maple can make with this problem unassisted by humans. Note that we have read in the PDE package.

We define the partial differential equation.

>    PDE:=diff(v(t,x),t)-diff(v(t,x),x,x)=0;

PDE := diff(v(t,x),t)-diff(v(t,x),`$`(x,2)) = 0

Look to see what form Maple gets for a solutions.

>    ans := pdsolve(PDE);

ans := `&where`(v(t,x) = _F1(t)*_F2(x),[{diff(_F1(t),t) = _c[1]*_F1(t), diff(_F2(x),`$`(x,2)) = _c[1]*_F2(x)}])

Maple reminds us that we should take a product of solutions, just as we had suggested above.

>    build(ans);

v(t,x) = _C1*exp(_c[1]*t)*_C2*exp(_c[1]^(1/2)*x)+_C1*exp(_c[1]*t)*_C3/exp(_c[1]^(1/2)*x)

Maple gets generic solutions to these two partial differential equations that it specified. Exercise care. Neither the initial condition nor the boundary conditions have been used. This really is a solution, only it does not satisfy the boundary conditions.

>    v:=(t,x)->A*exp(9*t)*exp(3*x)+B*exp(9*t)*exp(-3*x);

v := proc (t, x) options operator, arrow; A*exp(9*t)*exp(3*x)+B*exp(9*t)*exp(-3*x) end proc

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

0

>    v(t,0);
v(t,1);

A*exp(9*t)+B*exp(9*t)

A*exp(9*t)*exp(3)+B*exp(9*t)*exp(-3)

We could take sums of these, but then we would have lost the orthogonality. It seems that sine functions makes a better choice. The structure of the Fourier Series has many advantages.

Be aware that Maple can handle this problem very well with other techniques.

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