Heat Equation Examples
Heat Equation Examples
Matthew J. Hancock
Fall 2006
1. A bar with initial temperature profile f (x) > 0, with ends held at 0o C, will cool
as t → ∞, and approach a steady-state temperature 0o C. However, whether or
not all parts of the bar start cooling initially depends on the shape of the initial
temperature profile. The following example may enable you to discover the
relationship.
The first two equations yield the same thing, 3a = −b. Substituting this
into the last equation gives
1 3
a=− , b= .
2 2
Thus
1 3
f (x) = − sin 3πx + sin πx (1)
2 2
1
(b) Solve the problem
Note: you can just write down the solution we had in class, but make sure
you know how to get it!
Solution: This is the basic heat problem we considered in class, with
solution ∞
X 2 2
u (x, t) = Bn sin (nπx) e−n π t (2)
n=1
where Z 1
Bn = 2 f (x) sin (nπx) dx (3)
0
and f (x) is given in (1). The form of (1) is already a sine series, with
B1 = 3/2, B3 = −1/2 and Bn = 0 for all other n. You can check this
for yourself by computing integrals in (3) for f (x) given by (1), from the
orthogonality of sin nπx. Therefore,
3 2 1 2
u (x, t) = sin (πx) e−π t − sin (3πx) e−9π t (4)
2 2
(c) Show that for some x, 0 ≤ x ≤ 1, ut (x, 0) is positive and for others
it is negative. How is the sign of ut (x, 0) related to the shape of the
initial temperature profile? How is the sign of ut (x, t), t > 0, related
to subsequent temperature profiles? Graph the temperature profile for
t = 0, 0.2, 0.5, 1 on the same axis (you may use Matlab).
Solution: Differentiating u (x, t) in time gives
2 3 −π 2 t 9 −9π 2 t
ut (x, t) = −π sin (πx) e − sin (3πx) e
2 2
Setting t = 0 gives
3
ut (x, 0) = − π 2 (sin (πx) − 3 sin (3πx))
2
Note that
1 15 1
ut , 0 = π 2 > 0, ut , 0 = −6π 2 < 0
6 4 2
2
2
1.8
t=0
1.6
1.4
1.2
u(x,t )
0
0.8
0.6
t=0.5,1
0.4
t=0.2
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
and hence the sign of ut gives the concavity of the temperature profile
u (x, t0 ), t0 constant. Note that for uxx (x, t0 ) > 0, the profile u (x, t0 ) is
concave up, and for uxx (x, t0 ) < 0, the profile u (x, t0 ) is concave down.
At t0 = 0, the sign of ut (x, 0) give the concavity of the initial temperature
profile u (x, 0) = f (x).
In Figure 1, u(x, t0 ) is plotted for t0 = 0, 0.2, 0.5, 1.
2. Initial temperature pulse. Solve the inhomogeneous heat problem with Type I
boundary conditions:
∂u ∂ 2u
= ; u (0, t) = 0 = u (1, t) ; u (x, 0) = Pw (x)
∂t ∂x2
where t > 0, 0 ≤ x ≤ 1, and
0
if 0 < x < 21 − w2
u0
Pw (x) = w
if 21 − w2 < x < 12 + w2 (5)
if 12 + w2 < x < 1
0
Note: we derived the form of the solution in class. You may simply use this
and replace Pw (x) with f (x).
(a) Show that the temperature at the midpoint of the rod when t = 1/π 2
(dimensionless) is approximated by
1 1 2u0 sin (πw/2)
u , ≈
2 π2 e πw/2
3
Can you distinguish between a pulse with width w = 1/1000 from one with
w = 1/2000, say, by measuring u 21 , π12 ?
(b) Illustrate the solution qualitatively by sketching (i) some typical tempera-
ture profiles in the u − t plane (i.e. x = constant) and in the u − x plane
(i.e. t = constant), and (ii) some typical level curves u (x, t) = constant in
the x − t plane. At what points of the set D = {(x, t) : 0 ≤ x ≤ 1, t ≥ 0}
is u (x, t) discontinuous?
Solution: This is the Heat Problem with Type I homogeneous BCs. The
solution we derived in class is, with f (x) replaced by Pw (x),
∞
X ∞
X 2 π2 t
u (x, t) = un (x, t) = Bn sin (nπx) e−n (6)
n=1 n=1
Breaking the integral into three pieces and substituting for Pε (x) from (5)
gives
Z 1/2−w/2 Z 1/2+w/2
Bn = 2 Pw (x) sin (nπx) dx + 2 Pw (x) sin (nπx) dx
0 1/2−w/2
Z 1
+2 Pw (x) sin (nπx) dx
1/2+w/2
Z 1/2+w/2
u0
= 0+2 sin (nπx) dx + 0
1/2−w/2 w
1/2+w/2
2u0 cos (nπx)
= −
w nπ 1/2−w/2
nπ nπ
cos 2
(1 − w) − cos 2
(1 + w)
= u0 (7)
wnπ/2
We apply the cosine rule
4
When n is odd, i.e. n = 2m − 1 for some integer m,
sin ((2m − 1) πw/2)
B2m−1 = 2u0 (−1)m+1 . (8)
(2m − 1) πw/2
(a) The temperature at the midpoint of the rod, x = 1/2, at scaled time
t = 1/π 2 is, from (6) and (8),
∞
X sin ((2m − 1) πw/2) π −(2m−1)2
u (x, t) = 2u0 (−1)m+1 sin (2m − 1) e
m=1
(2m − 1) πw/2 2
∞
X 2u0 sin ((2m − 1) πw/2)
= 2 .
m=1
e(2m−1) (2m − 1) πw/2
For t ≥ 1/π 2 , the first term gives a good approximation to u (x, t),
1 1 1 1 2u0 sin (πw/2)
u , ≈ u1 , = .
2 π2 2 π2 e πw/2
π 2 ε2
1 1 1 1 2u0
u , ≈ u1 , = 1− + ··· , w ≪ 1.
2 π2 2 π2 e 2 · 3!
In particular,
1 1 1 1 1 1
u1 , ;w = − u1 , ;w =
2 π2 1000 2 π2 2000
2u0 sin (π/2000) sin (π/4000)
= −
e π/2000 π/4000
2u0
≈ − × 3.1 × 10−7
e
Thus it is hard to distinguish these two temperature distributions, at least
by measuring the temperature at the center of the rod at time t = 1/π 2 .
By this time, diffusion has smoothed out some of the details of the initial
condition.
(b) The solution u (x, t) is discontinuous at t = 0 at the points x =
(1 ± w) /2. That said, u (x, t) is piecewise continuous on the entire in-
terval [0, 1]. Thus, the Fourier series for u (x, 0) converges everywhere on
the interval and equals u (x, 0) at all points except x = (1 ± w) /2. The
temperature profiles (u−t plane, u−x plane), 3D solution and level curves
are shown.
5
u−t plot
10
6
u(x0,t)/u0
0
0 0.02 0.04 0.06 0.08 0.1
t
Figure 2: Time temperature profiles u (x0 , t) at x0 = 0.5, 0.4 and 0.1 (from top to
bottom). The t-axis is the time profile corresponding to x0 = 0, 1.
Recall that to draw the level curves, it is easiest to already have drawn
the spatial temperature profiles. Draw a few horizontal broken lines across
your u vs. x plot. Suppose you draw a horizontal line u = u1 . Suppose
this line u = u1 crosses one of your profiles u (x, t0 ) at position x = x1 .
Then (x1 , t0 ) is a point on the level curve u (x, t) = u1 . Now plot this point
in your level curve plot. By observing where the line u = u1 crosses your
various spatial profiles, you fill in the level curve u (x, t) = u1 . Repeat this
process for a few values of u1 to obtain a few representative level curves.
Plot also the special case level curves: u (x, t) = u0 /w, u (x, t) = 0, etc.
Come and see me if you still have problems.
∂u ∂ 2u ∂u ∂u
= ; (0, t) = 0 = (1, t) ; u (x, 0) = f (x) (9)
∂t ∂x2 ∂x ∂x
where t > 0, 0 ≤ x ≤ 1 and f is a piecewise smooth function on [0, 1].
(a) Find the eigenvalues λn and the eigenfunctions Xn (x) for this problem.
Write the formal solution of the problem (a), and express the constant
coefficients as integrals involving f (x).
6
u−x plot
12
10
8
0
u(x,t )/u
0
0
0 0.2 0.4 0.6 0.8 1
x
Figure 3: Spatial temperature profiles u (x, t0 ) at t0 = 0 (dash), 0.001, 0.01, 0.1. The
x-axis from 0 to 1 is the limiting temperature profile u (x, t0 ) as t0 → ∞.
3D plot of u(x,t)
10
u(x,t)/u0
0
0
0.02
0.04 1
0.06
0.08 0.5
t 0.1 0 x
Figure 4:
7
Level curves u(x,t)=const
0.1
0.08
0.06
t
1
0.5
0.04 0.25
0.5
0.25
0.02
2
4
0
0 0.2 0.4 0.6 0.8 1
x
Figure 5: Level curves u (x, t) /u0 = C for various values of the constant C. Numbers
adjacent to curves indicate the value of C. The line segment (1 − w) /2 ≤ x ≤
(1 + w) /2 at t = 0 is the level curve with C = 1/w = 10. The lines x = 0 and x = 1
are also level curves with C = 0.
(b) Find a series solution in the case that f (x) = u0 , u0 a constant. Find an
approximate solution good for large times. Sketch temperature profiles (u
vs. x) for different times.
(c) Evaluate limt→∞ u (x, t) for the solution (a) when f (x) = Pw (x) with
Pw (x) defined in (5). Illustrate the solution qualitatively by sketching
temperature profiles and level curves as in Problem 2(b). It is not necessary
to find the complete formal solution.
Solution: (a) To find a series solution, we use separation of variables,
X ′′ T′
= = −λ
X T
where λ is constant since the left hand side is a function of x only and the
middle is a function of t only. Substituting (10) into the BCs in (9) gives
X ′ (0) = X ′ (1) = 0
8
The Sturm-Liouville boundary value problem for X (x) is thus
The first equation gives c1 = −c2 and substituting this into the second, we
have √ √
p − |λ|
0 = |λ|c2 e + e |λ|
Since λ < 0, the bracketed expression is positive. Hence c1 = c2 = 0, i.e.
X (x) must be the trivial solution, and we discard the case λ < 0.
For λ = 0, X (x) = c1 x + c2 and both BCs are satisfied by taking c1 = 0.
Thus X (x) = c2 = A0 (we’ll use A0 by convention - it’s just another way
to name the constant). Hence, the case λ = 0 is allowed and yields a
non-trivial solution.
For λ > 0, we have
√ √
X = c1 sin λx + c2 cos λx
λ n = n2 π 2 , n = 1, 2, 3, ...
For each n, the solution for T (t) is Tn (t) = e−λn t . Hence the series solution
for u (x, t) is
∞
X
An cos (nπx) exp −n2 π 2 t
u (x, t) = A0 + (12)
n=1
9
At t = 0, the initial condition gives
∞
X
f (x) = u (x, 0) = A0 + An cos (nπx) (13)
n=1
2 cos (nπx) cos (mπx) = cos ((m − n) πx) + cos ((m + n) πx)
u (x, t) = u0 = f (x) .
10
u−t plot
10
6
u(x0,t)/u0
0
0 0.02 0.04 0.06 0.08 0.1
t
Figure 6: Time temperature profiles u (x0 , t) at x0 = 0.5, 0.4 and 0.1 (from top to
bottom).
Thus the temperature along rod eventually becomes the constant u0 . Lastly,
we illustrate the solution qualitatively by sketching temperature profiles
and level curves in Figures 6 to 9.
4. Consider the homogeneous heat problem with type III (mixed) BCs:
∂u ∂ 2u ∂u
= 2
; (0, t) = 0 = u (1, t) ; u (x, 0) = f (x)
∂t ∂x ∂x
where t > 0, 0 ≤ x ≤ 1 and f is a piecewise smooth function on [0, 1].
(a) Find the eigenvalues λn and the eigenfunctions Xn (x) for this problem.
Write the formal solution of the problem (a), and express the constant
coefficients as integrals involving f (x).
(b) Find a series solution in the case that f (x) = u0 , u0 a constant. Find an
approximate solution good for large times. Sketch temperature profiles (u
vs. x) for different times.
11
u−x plot
12
10
8
0
u(x,t )/u
0
0
0 0.2 0.4 0.6 0.8 1
x
Figure 7: Spatial temperature profiles u (x, t0 ) at t0 = 0 (dash), 0.001, 0.03, 0.1. The
line u(x, t0 )/u0 = 1 is the limiting temperature profile as t0 → ∞. Note that the ends
of the rod heat up!
3D plot of u(x,t)
10
u(x,t)/u0
0
0
0.02
0.04 1
0.06
0.08 0.5
t 0.1 0 x
Figure 8:
12
Level curves u(x,t)=const
0.1
0.08
0.06 1
t
0.04
1
0.02 0.5 0.5
2
0.25
4 0.25
0
0 0.2 0.4 0.6 0.8 1
x
Figure 9: Level curves u (x, t) /u0 = C for various values of the constant C. Numbers
adjacent to curves indicate the value of C. The line segment (1 − w) /2 ≤ x ≤
(1 + w) /2 at t = 0 is the level curve with C = 1/w = 10.
(c) Evaluate limt→∞ u (x, t) for the solution (a) when f (x) = Pw (x) with
Pw (x) defined in (5). Illustrate the solution qualitatively by sketching
temperature profiles and level curves as in Problem 2(b). It is not necessary
to find the complete formal solution.
Solution: (a) To find a series solution, we use separation of variables as
before (Eq. (10)), but now obtain the Sturm Liouville problem
The first equation gives c1 = −c2 and substituting this into the second, we
have √ √
0 = c2 e− |λ| 1 − e2 |λ|
13
√
Since λ < 0, then e2 |λ| > 1 and the bracketed expression is negative.
Hence c2 = c1 = 0, i.e. X (x) must be the trivial solution, and we discard
the case λ < 0.
For λ = 0, X (x) = c1 x + c2 and imposing the BCs gives c1 = c2 = 0. Thus
we discard the λ = 0 case.
For λ > 0, we have
√ √
X = c1 sin λx + c2 cos λx
(2n − 1)2 π 2
λn = , n = 1, 2, 3, ...
4
and the eigenfunctions are
2n − 1
Xn (x) = cos πx
2
For each n, the solution for T (t) is Tn (t) = e−λn t . Hence the series solution
for u (x, t) is
∞
!
(2n − 1)2 π 2
X 2n − 1
u (x, t) = An cos πx exp − t (19)
n=1
2 4
At t = 0,
∞
X (2n − 1) π
f (x) = u (x, 0) = An cos πx (20)
n=1
2
The orthogonality conditions are found using the identity
2n − 1 2m − 1
2 cos πx cos πx = cos ((m − n) πx)+cos ((m + n − 1) πx)
2 2
Note also that for m, n = 1, 2, 3..., we have
(
1
1 m=n= 6 0
Z
cos ((m − n) πx) dx =
0 0 m 6= n
Z 1
cos ((m + n − 1) πx) dx = 0
0
14
The last integral follows since m+n−1 cannot be zero for any positive inte-
gers m, n. Combining the three previous equations gives the orthogonality
conditions
Z 1 (
2n − 1 2m − 1 1/2 m = n 6= 0
cos πx cos πx dx = (21)
0 2 2 0 m 6= n
The temperature profiles (u vs. x) for different times are given below in
Figures 10 to 13.
(c) Taking the limit t → ∞ of (19) gives
lim u (x, t) = 0
t→∞
Thus the temperature along rod eventually goes to zero. Lastly, we illus-
trate the solution qualitatively by sketching temperature profiles and level
curves (Figures 14 to 17).
15
u−t plot
1
0.8
0.6
u(x0,t)/u0
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
t
Figure 10: Time temperature profiles u (x0 , t) at x0 = 0.01, 0.4 and 0.9 (from top to
bottom).
u−x plot
1
0.8
0.6
u(x,t0)/u0
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
x
Figure 11: Spatial temperature profiles u (x, t0 ) at t = 0.001, 0.01, 0.1, 0.5 and 1 from
top to bottom. The line u(x, t0 )/u0 = 1 is the initial temperature profile at t = 0.
16
3D plot of u(x,t)
1
0
u(x,t)/u
0.5
0
0
0.5
0.8 1
0.4 0.6
t 1 0 0.2
x
Figure 12:
0.8
0.1
0.6
0.25
t
0.4
0.2 0.5
0.99 0.9
0
0 0.2 0.4 0.6 0.8 1
x
Figure 13: Level curves u (x, t) /u0 = C for various values of the constant C. Numbers
adjacent to curves indicate the value of C.
17
u−t plot
10
6
u(x0,t)/u0
4
x =0.5
0
2
0.4
0.1
0
0 0.1 0.2 0.3 0.4 0.5
t
Figure 14: Time temperature profiles u (x0 , t) at x0 = 0.5, 0.4 and 0.1 (from top to
bottom).
u−x plot
12
10
t=0
8
0
u(x,t )/u
0
4
0.001
2
0.1 0.03
0.5
0
0 0.2 0.4 0.6 0.8 1
x
Figure 15: Spatial temperature profiles u (x, t0 ) at t0 = 0 (dash), 0.001, 0.03, 0.1 and
0.5.
18
3D plot of u(x,t)
10
u(x,t)/u0
0
0
0.1
0.2 1
0.3
0.4 0.5
t 0.5 0 x
Figure 16:
0.4
0.3
0.5 0.25
t
0.2
0.1
1
0.5
0.25 2
0 4
0 0.2 0.4 0.6 0.8 1
x
Figure 17: Level curves u (x, t) /u0 = C for various values of the constant C. Numbers
adjacent to curves indicate the value of C. The line segment (1 − w) /2 ≤ x ≤
(1 + w) /2 at t = 0 is the level curve with C = 1/w = 10.
19