9.2 The Heat (Diffusion) Equation ended with a promise. A ripple solves the heat equation exactly, with its own decay rate, and any initial profile is made of ripples. 8.4 Even & Odd Extensions: Sine and Cosine Series then showed how to write a profile given on as a sine or a cosine series. This lesson joins the two halves: separation of variables turns the PDE into two ODEs you already know how to solve, the boundary conditions pick the list of ripples, and Fourier coefficients pick the amounts. The result is a formula for at any time, with no time step and no stability limit.
The same recipe serves the viscous term of Navier-Stokes and, with other eigenfunctions, the wave and Laplace equations later in this module.
Transcript
- Start from u t equals alpha u x x and guess something simple: a product of a shape in x and an amplitude in t. Substitute, and divide by alpha X T. The left side depends on t alone, the right side on x alone. Move x and the left cannot change. Move t and the right cannot change. So both are one constant, which we call minus lambda, and one PDE has become two ODEs.
- The time equation is exponential decay: T equals e to the minus alpha lambda t. The space equation, minus X double prime equals lambda X, is the eigenvalue problem from before. Only special values of lambda have a nonzero solution that obeys the walls. So the question changes from what are the solutions, to what are the eigenpairs. Once we know an eigenvalue lambda, its decay rate alpha lambda comes free.
- Hold both ends at zero. A product then needs X of 0 and X of L to vanish, and that gives sine of k pi x over L, with lambda equal to k pi over L, squared. Each product solves the equation and both walls, and so does any sum of them, by superposition. Sum them all, with one amount c k per mode. At time zero this is exactly the sine series of the initial profile, so each c k is a single integral.
- The recipe has four steps. Separate. Let the boundary conditions act on X alone, to pick the eigenvalues and shapes. Superpose all the products. Then project the initial profile onto the shapes. Everything before the last step is independent of the initial data, so you do the hard work once for a given rod.
- Example: a hot rod plunged into ice water. Length 1, alpha 1, start at 1, both ends at 0. The coefficients are 4 over k pi for odd k: 1.273240, then 0.424413. Now run time. The corners at the walls are gone almost at once, because the high modes die first. At t equal 0.05 the centre is 0.772312 from the full series. One mode alone says 0.777310, and three modes give 0.772310. Late on, one mode is the whole solution.
- Insulate the ends instead. The condition is now zero slope, and the shapes are cosines, starting with a constant mode that never decays. So the rod settles at the average of the initial profile. For a half hot rod, the left end falls from 0.886156 at t equal 0.05 to 0.737244 at 0.1, while the right end rises to 0.113844 and then 0.262756. Hold one end and insulate the other, and the slowest rate drops to pi squared over 4: the rod keeps its heat 4 times longer.
- Now hold one end at zero and the other at one. A sum of solutions would double the end values, so superposition fails here. Peel off the part that never changes: the steady straight line w. Write u as w plus a transient v. The transient solves the same equation with zero ends and starting profile f minus w, which is the problem we already solved. For a cold rod, c k is 2 times minus 1 to the k, over k pi, so c 1 is minus 0.636620. At the centre the temperature climbs 0.113844, 0.262756, then 0.467040, toward 0.5.
- The whole solution is a list of amplitudes, and the rates grow as k squared. Mode 3 fades 9 times faster than mode 1, mode 10 a hundred times faster. For a tolerance of one millionth, the ice-water rod needs 31 modes at t equal 0.001, 9 at 0.01, and 3 at 0.1. Fine detail goes first, so even a jump at the walls smooths out the instant time starts. Run time backwards and the factor grows, which no coefficient list survives. To settle within 10 to the minus 3 takes ln of 1273.2 over pi squared, which is 0.7244.
- Small swirls die first. For air, nu is 1.47 times 10 to the minus 5. A ripple 1 centimetre long decays at 5.80 per second, an e-folding time of 0.172 seconds. A ripple 10 centimetres long decays a hundred times slower, 17.2 seconds. As numerics, the series gives u at any time in one evaluation, with no time loop and no stability limit. Explicit FTCS needs 625 steps to reach t equal 0.1, and at the centre of the tent rod it gives 0.302080 against the exact 0.302118.
- To recap. Separate, let the walls pick the eigenvalues, superpose, and project the initial profile. Held ends give sines. Insulated ends give cosines, with a mode that never decays. Unequal end temperatures give a straight line plus a transient. And every mode fades at its own rate, the fine ones first. Next, Burgers' equation adds a term u times u x to a diffusion equation. Solutions no longer add, and this whole recipe breaks.
Try a product
Take on and look for solutions that are a product of a function of alone and a function of alone, . This is a guess: most solutions are not products, but products turn out to be enough building blocks. Substituting,
The left side depends on only and the right side on only. Fix and move : the left side does not change, so the right side cannot either. Fix and move : the same argument runs the other way. A quantity that cannot change with either variable is a constant; call it (the sign is a convenience, and it anticipates the answer). The one PDE has become two ODEs:
The time equation is exponential decay, . The space equation is the eigenvalue problem of 8.2 Eigenvalue Problems & Sturm–Liouville Theory: only for special does it have a nonzero solution that obeys the boundary conditions, and those are the eigenvalues. Separation has turned the question “what are the solutions?” into “what are the eigenpairs?”, and the PDE’s time dependence is then free: eigenvalue means decay rate .
Ends held at zero: the sine series
Hold both ends at zero temperature, for all . A product has for all , which forces (otherwise and we have only the zero solution), and likewise . The Dirichlet problem of the eigenvalue lesson gives
(The cases give only ; that was shown there.) Each product solves the PDE and both boundary conditions. The PDE and the boundary conditions are linear and homogeneous, so any sum of such products does too (superposition, the property that 9.1 What Is a PDE? Conservation Laws & Classification listed in its table of linear equations). Take all of them:
The last condition is the initial profile, . That is exactly the sine series of , and 8.4 Even & Odd Extensions: Sine and Cosine Series gave its coefficients: . So one integral per mode finishes the problem. The recipe in full:
Worked example 1: a rod dropped into ice water
Take and , so time is in units of . The rod starts at everywhere and both ends are held at , which is what happens when you plunge a hot rod into ice water. The sine coefficients of are
So , , and
Look at the centre, , where alternates for . At the full series gives . One mode gives and three give : the first term has the right answer to and the second correction fixes it to six digits, because the factor has already shrunk to . At the full value is and the single first term gives , which is off in relative terms. Late on one mode is the whole solution, matching the time constant of 9.2.
At the profile jumps from to at the walls, and the sine series converges slowly there (like ). Yet the very next instant is smooth: at the centre value is and the high modes are gone.
How long until the rod is within of the ice-water temperature? Late on only the first mode matters, so gives
The sim’s direct search over the full series returns .
Insulated ends: the cosine series
Now insulate both ends: . The condition on a product is . The Neumann problem of the eigenvalue lesson has eigenvalues again, but now for with shapes : the list starts at with the constant shape, which decays at rate zero.
The constant mode never decays, so as the rod settles at , the average of the initial profile: insulated means the heat has nowhere to go. This is the conservation law of 9.2 seen mode by mode: every cosine with integrates to zero.
Example 2. With , start with the left half hot, for and for . The mean is and . That gives , , . The sim reports the left end falling from at to at , while the right end rises to and then . The two ends add to by symmetry. After the whole rod is within of , in agreement with the FTCS run of 9.2 (step , ).
A mixed rod, held at zero at and insulated at , has and . The shapes are and the decay rates . The slowest one is in our units, a quarter of the both-ends-held rate : leaving one end insulated lets the rod keep its heat four times longer (time constant against ).
One end hot, one end cold: the steady shift
Suppose and . Now a sum of products is not allowed: the boundary condition is not homogeneous, so a sum of two solutions has end value , not . The fix is to peel off the part that does not change. From 9.2 the steady state is the straight line , which solves and has the right end values. Write . Since and , the transient solves the same heat equation, with and initial profile . That is the zero-ends problem already solved: expand in sines and let each mode decay.
Example 3. Cold rod, , with ends at and , and . The initial transient is . Using ,
The sim gives and . At the centre the temperature climbs at , at and at , toward the steady . A quarter of the way along, . The profile is within of the straight line everywhere after , the same time as in Example 2 because both start with a leading amplitude and rate .
Decay rates: why fine detail vanishes first
The whole solution is the list of amplitudes , and the rates grow as . Mode decays times faster than mode 1 (the sim’s bars at the right show this on a log scale: the amplitudes fall on a downward parabola in ). Its time constant is .
Two consequences for a solver. First, truncation: keep only modes whose amplitude is above your tolerance. For the ice-water rod at the sim reports modes at , at and at (the count falls roughly like , a scaling and not an exact law).
Second, smoothing. At the series for the jumpy profile converges only like . For any the factor decays faster than any power of , so even the series for or converges; the solution is smooth for every , even when jumps (stated here from the convergence of those series, not proved in full). Run time backwards and the factor becomes , which no coefficient list can survive: the ill-posedness of 9.1 in one line.
Is the series really the solution?
Three honest questions, answered briefly.
Does it solve the PDE? Each term does, and for termwise differentiation is legitimate because is summable for every (sketched, not proved).
Does it match at ? In the rms sense of 8.3 Fourier Series, always; pointwise away from jumps, yes. The Gibbs ringing belongs to 8.5 Convergence & the Gibbs Phenomenon.
Is it the only solution? Suppose is the difference of two solutions with the same data. Then solves the heat equation with zero initial data and either or at each end. Compute the “energy” :
The boundary term vanishes for either kind of end, and , so and . The solution we built is the solution.
The lab
The rod has . Panel 1 shows from modes, the initial dashed, a -mode reference dotted and (if ticked) FTCS on intervals with . Panel 2 shows in grey and of the current amplitude in colour (red for dropped modes). Panel 3 shows the rms error of the -mode sum against . Coefficients come from the midpoint rule on cells, with closed forms beside them as a check.
- Ice-water rod (Dirichlet, ). Move from to and watch the bars on the right fall: mode is multiplied by at . The panel-3 rms error against the reference at is for and for .
- Insulated ends with the half step. The profile levels off at and the “integral of ” readout stays at .
- Shift, , , . The solution climbs to the line .
- Tick FTCS. For the tent profile ( then , peak ) at , which is steps of , the largest difference at the nodes is ; for it is , ten times worse, because the jump at the walls is what the grid resolves least well.
Computing it
The first loop should print , and in the last column; the second reports , and modes (fewer than for at early times, since the tent is smoother), and FTCS gives .
Concept checks
Problems
A copper bar of length m, with m/s (a rounded value, from memory), has both ends held at C and starts at . How long until the peak temperature falls to C?
Show worked solution
The initial profile is a single mode, so and the peak is at the centre. Set , giving s, about minutes. The time constant is s, and of them are needed.
With , ends at , start from . (a) Find and evaluate it at . (b) At what time is the second mode one percent of the first, as measured by its amplitude?
Show worked solution
(a) The initial profile is already a sum of two eigenfunctions, so . At , and , so . At : and , so .
(b) The amplitude ratio is . Setting this to gives .
A rod with is held at at and insulated at , and starts at . (a) Separate variables and show the shapes are with rates . (b) Find the coefficients. (c) Estimate when the insulated end falls to .
Show worked solution
(a) A product needs with and . For we have (it vanishes at ) and requires , . (The cases give only .)
(b) With , , since . So and , and .
(c) At , , so . With only the first term, gives . The second term then is only .
Key Takeaways
- Substituting into gives ; both sides are constant, which splits the PDE into and .
- The boundary conditions act on and pick the eigenvalues: ends at give , insulated ends give including a constant mode of rate , and one held plus one insulated end gives .
- , with the Fourier projection of . For and ends at : for odd , and .
- Insulated rods approach the mean of (the half step settles to , within after ); a held-end rod approaches the straight line between and , found by the shift and a zero-ends problem for .
- Mode decays at rate : fine detail dies first, jumps smooth out instantly, and late in time one mode is the whole solution (a time constant for held ends, four times longer for one insulated end).
- The series needs , and modes at , , for the ice-water rod at tolerance ; FTCS takes steps to reach and agrees to for the tent profile.
- Everything rested on superposition. Time-dependent ends or sources need 9.7 Nonhomogeneous Problems & Eigenfunction Expansions.
- Next in the build order is 9.11 Nonlinear Waves: Burgers' Equation & Shocks (Burgers’ equation), which adds to a diffusion equation. That term breaks superposition: solutions no longer add, energy passes from mode toward mode , and the characteristics of 9.10 First-Order PDEs: Advection & Characteristics cross. The Cole-Hopf substitution turns viscous Burgers back into this lesson’s heat equation (checked: with , finite differences give a Burgers residual of against a of ; the derivation is not given here).