Lesson 2
Stability and the Time-Step Restriction
The CFL condition, where it comes from, and why it cannot be avoided within an explicit framework.
1 Modelling context
A numerical scheme is useful only if it produces a bounded solution. A scheme is stable for a given problem if small perturbations in the initial data do not grow without bound as the integration proceeds. An unstable scheme produces a numerical solution that blows up, regardless of how accurate the underlying discretization might be on paper.
The FTCS scheme is conditionally stable: it is stable if and only
if the diffusion number satisfies r ≤ 1/2. This is
the CFL condition for the explicit heat equation,
named for Courant, Friedrichs, and Lewy, who derived analogous
conditions for hyperbolic problems.
The condition is not a technicality. It is a fundamental constraint that determines the cost of the simulation, and it explains why explicit schemes are impractical for fine spatial grids.
Stability is a prerequisite for accuracy
An unstable scheme produces a solution that grows without bound. The accuracy of the discretization is irrelevant if the solution does not exist. Stability must be established before any accuracy claim is meaningful.
2 Learning objectives
By the end of this lesson you will be able to
- Define stability for a finite-difference scheme.
- Apply the von Neumann method to derive the stability condition for the FTCS scheme.
-
State the CFL condition
Δt ≤ Δx² / (2α)and explain its origin. - Recognise the numerical symptoms of instability and diagnose them.
- Explain why the CFL condition cannot be avoided within an explicit framework.
- Compute the cost implications of grid refinement for an explicit scheme.
3 Prerequisite review
- Stability
- A property of a numerical scheme applied to a particular problem: small perturbations in the data do not grow without bound as the integration proceeds.
- Fourier mode
-
A solution of the form
u_i^n = G^n e^{i k x_i}, wherekis a wavenumber andGis the amplification factor. Fourier modes are the building blocks of any smooth initial condition. - Amplification factor
-
The complex number
G(k)such that a Fourier mode with wavenumberkis multiplied byGat each time step. Stability requires|G(k)| ≤ 1for allk. - Consistency
- A scheme is consistent with a PDE if its truncation error tends to zero as the grid spacings tend to zero. FTCS is consistent.
- Lax equivalence theorem
- For a consistent scheme applied to a well-posed linear problem, stability is equivalent to convergence.
4 Mathematical formulation
Von Neumann stability analysis
The von Neumann method analyses the growth of Fourier modes in the numerical solution. It is the standard tool for deriving stability conditions for linear schemes with constant coefficients.
Consider the FTCS update rule from Lesson 1:
u_i^{n+1} = r u_{i−1}^n + ( 1 − 2r ) u_i^n + r u_{i+1}^n
Substitute a Fourier mode of the form
u_i^n = G^n e^{i k i Δx}:
G^{n+1} e^{i k i Δx} = r G^n e^{i k (i−1) Δx} + (1 − 2r) G^n e^{i k i Δx} + r G^n e^{i k (i+1) Δx}
Dividing by G^n e^{i k i Δx}:
G = r e^{−i k Δx} + ( 1 − 2r ) + r e^{i k Δx}
Using e^{iθ} + e^{−iθ} = 2 cos θ:
G = 1 − 2r + 2r cos( k Δx )
= 1 − 2r ( 1 − cos( k Δx ) )
The amplification factor G is real, and depends on
the wavenumber through the product k Δx. Since
1 − cos θ ∈ [0, 2], the factor ranges over
G ∈ [ 1 − 4r, 1 ]
For stability, we require |G| ≤ 1 for all
wavenumbers. Since G ≤ 1 automatically, the binding
constraint is G ≥ −1:
1 − 4r ≥ −1
4r ≤ 2
r ≤ 1/2
This is the CFL condition for the FTCS scheme:
r = α Δt / Δx² ≤ 1/2
Equivalently,
Δt ≤ Δx² / ( 2 α )
The most unstable mode
The stability limit is set by the Fourier mode with
k Δx = π, which corresponds to the highest wavenumber
representable on the grid — the alternating mode that changes sign
at every grid point:
cos(π) = −1 ⟹ G = 1 − 2r (1 − (−1)) = 1 − 4r
This mode is the most unstable. When r > 1/2, the
amplification factor for this mode has absolute value greater than
1, and the mode grows by a factor of 4r − 1 at each
time step. The signature of instability is a numerical solution
dominated by alternating-sign oscillations, growing in magnitude.
r = 0.25, |G| ≤ 1 for all modes. For
r = 0.5, the highest-wavenumber mode is marginally
stable. For r = 0.6, the highest-wavenumber mode
grows, and the scheme is unstable.
Why the condition cannot be avoided
The CFL condition is a property of the explicit scheme, not of the PDE. Its origin is the coupling between the spatial and temporal discretizations: the explicit update rule at each grid point combines information from neighbouring points, and the ratio of the time step to the spatial step determines how far that information can travel within a single step.
Implicit schemes avoid the restriction by coupling all grid points at the new time level, requiring the solution of a linear system at each step. The additional cost per step is usually far less than the savings from the reduced number of steps, especially for fine grids. Implicit schemes for the heat equation are unconditionally stable.
Higher-order explicit schemes have larger stability regions but remain conditionally stable. No explicit scheme for the heat equation is unconditionally stable.
5 Worked example
Demonstrating instability when r > 1/2
Use the same problem as in Lesson 1:
∂u/∂t = 0.1 ∂²u/∂x², u(x, 0) = sin(π x), u(0, t) = u(1, t) = 0
with Δx = 0.1. Run two simulations: one with
r = 0.4 (stable), and one with r = 0.6
(unstable).
Stable case (r = 0.4).
Δt = 0.4 · 0.01 / 0.1 = 0.04. After 10 time steps
(t = 0.4):
- Maximum value of
u: 0.711. - Minimum value: 0.
- Solution remains smooth and decays toward zero.
Unstable case (r = 0.6).
Δt = 0.6 · 0.01 / 0.1 = 0.06. After 7 time steps
(t ≈ 0.42):
-
Maximum value of
u: grows with each time step. - Alternating positive and negative values appear at adjacent grid points.
-
By step 7, the numerical solution has values of order
10²— wildly outside the physical range[0, 1].
Diagnosis.
The growth pattern is the signature of the highest-wavenumber
mode becoming unstable. The amplification factor for that mode
is
G = 1 − 4r = 1 − 2.4 = −1.4, so the mode grows by a
factor of 1.4 in magnitude at each step, while alternating in
sign.
Recovery.
Reducing r back to 0.4 (that is, halving the time
step) immediately restores stability. The instability is not a
permanent failure of the scheme; it is a consequence of the step
size being above the stability limit. This is one of the most
useful properties of the CFL condition: violations are
self-diagnosing, because the pattern is unmistakable.
Cost implications.
Running with r = 0.4 requires
Δt = 0.04, about 10 time steps over the interval.
If r could be increased to 0.5 (the maximum stable
value), the number of steps would drop to 8. But if
Δx were halved to 0.05, the time step would have to
drop by a factor of 4 to 0.01, increasing the
number of steps by the same factor. The stability condition is
what makes grid refinement expensive for explicit schemes.
6 Verification check
Checks to perform
-
Compute
rbefore every run. A change inα,Δx, orΔtchangesr. Document the value and confirm it is below 0.5. - Look for the signature of instability. Growing alternating-sign oscillations at adjacent grid points are the diagnostic pattern.
-
Test the marginal case
r = 0.5. The scheme is marginally stable: oscillations neither grow nor decay. Confirm that the numerical solution neither blows up nor decays artificially fast. -
Verify the amplification factor numerically.
Apply the update rule to a single alternating mode (values
+1, −1, +1, −1, …in space) and confirm the amplitude changes by a factor of|1 − 4r|per step. -
Check that reductions in
Δtrestore stability. If an unstable run becomes stable whenΔtis reduced, the diagnosis is confirmed. - Confirm the CFL condition is not a numerical artefact. The condition applies to any explicit scheme with the same stencil. A different explicit scheme may have a different stability limit, but a limit always exists.
7 Interpretation
The CFL condition r ≤ 1/2 has three implications that
every user of the FTCS scheme should understand.
- The time step is bounded by the spatial step. Refining the spatial grid forces a reduction in the time step. The two cannot be chosen independently.
-
The bound is quadratic in
Δx. Halving the spatial grid requires quartering the time step. The total computational work scales as1/Δx³, which is why explicit schemes become impractical for very fine grids. - The instability is self-diagnosing. Violating the CFL condition produces a distinctive, unmistakable growth pattern. It is not a subtle error.
Choosing the diffusion number
In practice, a diffusion number of 0.4 is a common choice: it is
below the stability limit, leaving a margin of safety, while
still allowing reasonably large time steps. Choosing
r closer to 0.5 reduces the number of time steps
but eliminates the safety margin. Choosing
r substantially below 0.4 increases the number of
steps without a proportional benefit in accuracy.
8 Uncertainty and limitations
The von Neumann stability analysis is a powerful tool, but it has limitations.
| Limitation | Impact |
|---|---|
| Requires constant coefficients |
Cannot be applied directly to problems with variable
α or nonlinear terms
|
| Assumes periodic boundary conditions | Other boundary conditions may introduce different stability constraints |
| Assumes linearity | Nonlinear problems require alternative analyses or empirical testing |
| Gives necessary and sufficient conditions only for linear constant-coefficient schemes | For more complex problems, it provides necessary conditions but not sufficient ones |
| Does not address accuracy | A stable scheme may still be inaccurate |
For the FTCS scheme applied to the constant-coefficient heat
equation with periodic boundary conditions, the von Neumann
condition
r ≤ 1/2 is both necessary and sufficient. For other
problems, it should be treated as a necessary condition, and
additional testing may be required to confirm stability.
Stability is not accuracy
A stable scheme produces a bounded solution, but the solution may still be inaccurate. The two properties are independent. Stability must be established first; accuracy is a separate question addressed by the truncation error analysis.
9 Common implementation errors
Watch for these
-
Choosing the time step without checking
r. A natural impulse is to chooseΔtto match the desired output times, without considering the stability condition. Always computerfirst. - Assuming the CFL condition is a rule of thumb. It is a precise mathematical condition. Violating it produces a blow-up, not a gradual degradation.
-
Confusing the diffusion number with other stability
parameters.
For convection problems, the analogous condition involves
c Δt / Δx. For the heat equation, it involvesα Δt / Δx². The two are different. - Believing the CFL condition is avoided by implicit schemes. Implicit schemes for the heat equation are unconditionally stable; they do not require a CFL condition for stability. They may still require a small step for accuracy.
-
Ignoring the cost implications. A scheme that
is stable at
r = 0.4may be impractical for fine grids. RefiningΔxby a factor of 10 increases the cost by a factor of 1000. - Reducing the time step below the accuracy requirement. A time step that is too small wastes computation without improving accuracy, once the truncation error is already negligible. The time step should be chosen to balance stability, accuracy, and cost.
10 Independent modelling task
Your turn
- Use the FTCS implementation from Lesson 1, with the sine initial condition and zero Dirichlet boundary conditions.
-
Run the scheme with
r = 0.4and again withr = 0.6. Use the sameΔxfor both runs, adjustingΔtaccordingly. - Plot the numerical solution at several time steps for both runs. Describe the qualitative difference between the two.
-
Compute the maximum absolute value of the solution at each
time step for the unstable case. Confirm that the growth
factor per step is approximately
4r − 1 = 1.4. -
Test the marginal case
r = 0.5. Confirm that the solution remains bounded but oscillates with constant amplitude at the highest wavenumber. -
For the stable case, refine the grid by a factor of 2 in
Δx. Compute the new time step needed to maintainr = 0.4. Compute the ratio of the total number of operations to the previous grid. - Write a short paragraph on the practical significance of the CFL condition for the cost of PDE simulation.
This exercise forms part of Laboratory 6 and the stability-analysis component of Assignment 3.
11 Reflection prompt
Reflect before continuing
The CFL condition is derived by analysing the growth of Fourier modes. Why is it the highest-wavenumber mode, rather than the lowest, that determines the stability limit?
Two or three sentences. Consider how the amplification factor depends on the wavenumber.
12 Lesson summary
Key takeaways
- A scheme is stable if small perturbations do not grow. Stability is a prerequisite for meaningful numerical results.
-
Von Neumann analysis derives the stability condition from
the amplification factor of Fourier modes.
For FTCS, the amplification factor is
G = 1 − 2r (1 − cos kΔx). -
The CFL condition is
r ≤ 1/2. Equivalently,Δt ≤ Δx² / (2α). -
The highest-wavenumber mode determines the stability
limit.
Its amplification factor is
1 − 4r, which becomes greater than 1 in magnitude whenr > 1/2. - Instability is self-diagnosing. Growing alternating-sign oscillations are unmistakable.
- Explicit schemes are conditionally stable. The CFL condition cannot be avoided within an explicit framework. Implicit schemes remove the restriction.
Coming next
Lesson 3 develops a full PDE case study, applying the FTCS scheme to a diffusion or wave problem and analysing the results end to end.
§ Self-quiz, practice, and homework
Self-quiz
Q1
The amplification factor for the FTCS scheme is:
Show answer
G = 1 − 2r (1 − cos kΔx).
Q2
The most unstable mode corresponds to:
Show answer
kΔx = π. The alternating
mode.
Q3
When r > 1/2, the numerical solution typically
exhibits:
Show answer
Growing oscillations at the highest wavenumber.
Q4
An implicit scheme for the heat equation is:
Show answer
Unconditionally stable. This is the principal motivation for implicit methods.
Q5
Halving Δx in the FTCS scheme increases the total
grid operations by approximately:
Show answer
8. N_x doubles,
N_t quadruples.
Practice exercises
-
Derive the amplification factor for the FTCS scheme by
substituting
u_i^n = G^n e^{i k i Δx}. -
Compute
GforkΔx = πandr = 0.4, 0.5, 0.6. Interpret each. -
For
α = 0.02andΔx = 0.05, compute the maximum stableΔt. -
If
Δtis set to twice the maximum stable value, predict the growth factor per step for the most unstable mode.
Homework problems
-
Stability demonstration. Implement the FTCS
scheme and run with
r = 0.4andr = 0.6. Plot the solution at several time steps for each. Confirm the growth factor of the unstable case matches the theoretical prediction. - Von Neumann analysis. Apply the von Neumann method to a different explicit scheme (e.g. the leapfrog scheme for the wave equation). Derive its stability condition. Compare with the FTCS condition.
-
Cost of refinement. For a fixed target time
T, compute the total grid operations forΔx,Δx/2,Δx/4, andΔx/8in the FTCS scheme. Plot on a log-log scale and fit the exponent.
Mini project
Produce a complete stability report for the FTCS scheme applied
to a problem of your choice. Include: the von Neumann derivation
for the specific scheme, the stability condition, a numerical
demonstration of stability at r = 0.4 and
instability at r = 0.6, and the cost implications
of grid refinement. Submit the spreadsheet and a two-page
report. This is the basis for Laboratory 6 and Assignment 3.