Hexa Scholar

Implicit schemes and Crank–Nicolson

A copper rod rests in two navy holders with a gold heater beneath its center.
A heater beneath the center of a copper rod gives the heat-flow experiment a starting point.

The question

Which methods keep a warm rod’s computed temperature under control when you take a large time step?

Start from the same temperatures and compare three ways to march forward.

  1. 1 SeeChoose a method for a large step.
  2. 2 TryChange the grid and measure error.
  3. 3 ProveBuild a bound for each step.
  4. 4 ApplyAssemble and solve heat updates.
Before you start · 3 quick checks on differences, equations, and repeated multiplication

Two ideas before you start

2 ideas

A grid replaces the rod

Samples on a smooth curve. The center and two adjacent grid points form a stencil.

The three marked grid points supply the centered second difference. Move the stencil to see which samples enter it.

Exact definition

On a rod of length \(L\), use \(N\) equal intervals of length \(h=L/N\). The \(j\)-th node is \(x_j=jh\). Write \(u_j^n\) for the excess temperature above the fixed end temperature at time \(n\Delta t\). The end values are held at zero excess temperature.

For an interior vector \(u\), write \(D\) for the unscaled second-difference operator that uses those zero endpoints.

\[(Du)_j=u_{j-1}-2u_j+u_{j+1}.\]

Dividing \(Du\) by \(h^2\) approximates the spatial second derivative. The explicit heat scheme uses it at the old time level.

Choose which time level supplies the slope

Two rows of grid nodes show which time levels contribute to an update.

A slope taken at the new time uses temperatures you still have to find. When neighboring unknowns appear in the same equation, solve the rows together.

Exact definition

Assume one-dimensional heat flow with constant diffusivity \(\kappa\gt 0\), no heat source after the start, and both ends held at the same fixed temperature. Excess temperature \(u(x,t)\) satisfies \(u_t=\kappa u_{xx}\), where the subscripts denote derivatives. Set \(r=\kappa\Delta t/h^2\) for a positive time step \(\Delta t\).

Let \(\theta\) be the weight of the new slope. The update is

\[\begin{aligned} u^{n+1}-u^n &= r\big((1-\theta)Du^n\\ &\qquad +\theta Du^{n+1}\big). \end{aligned}\]

Forward Euler uses the old slope (\(\theta=0\)). Backward Euler, also called fully implicit Euler, uses the new slope (\(\theta=1\)). Crank–Nicolson gives the two slopes equal weight (\(\theta=\tfrac12\)). Each choice uses the same spatial difference.

Refresher on solving a grid row

Move all terms at the new time to the left. Each row can then contain a new value at its own node and at either adjacent interior node. A matrix whose nonzero entries lie on the main diagonal and the two adjacent diagonals is called tridiagonal. Boundary values are given, so they need no columns in the matrix.

The old values determine the right-hand side. The lesson on linear systems explains why these rows must hold at the same time.

1 See

Choose which schemes can take the step

2 Try

Two ways to measure the error

Use a unit rod with diffusivity one, zero excess at both ends, and a smooth start \(u(x,0)=\sin(\pi x)\). Keep the final time \(T\) fixed and use equal time steps. For time error, compare with the exact evolution on your chosen space grid. For total error, compare with the exact heat equation on the continuous rod. Both measurements use the absolute difference at the center.

The reference values and the goals open after you answer.

3 Prove

Follow a single mode through the solve

Theorem

Use a uniform grid with \(N\ge2\) intervals, fixed zero excess at the two ends, constant \(\kappa\gt0\), and \(\Delta t\gt0\). For backward Euler and Crank–Nicolson, a step cannot increase the Euclidean norm \(\|v\|_2\) of an interior perturbation \(v\) that evolves by the homogeneous update. The norm is the square root of the sum of the squares of its interior values.

The matrix \(D\) is real and symmetric. Extend a vector \(v\) with zero at both endpoints. Here \(v^\mathsf{T}\) is its transpose. Expanding the squares gives

\[\begin{aligned} v^\mathsf{T}Dv &=-\sum_{j=0}^{N-1} (v_{j+1}-v_j)^2 . \end{aligned}\]

If the sum vanishes, all the differences vanish and the endpoint value gives \(v=0\). So every eigenvalue of \(D\) is negative, and by the spectral theorem \(D\) has an orthonormal basis of eigenvectors. Fix one such vector \(w\), write \(Dw=-\mu w\), and call the coefficient of \(w\) in the perturbation \(v^n\) its amplitude \(a^n\). Use \(s=r\mu\). The one-step factor \(g\) sends \(a^n\) to \(g a^n\). Because the basis is orthonormal, \(\|v^n\|_2^2\) is the sum of the squared amplitudes, so it is enough to show \(|g|\le1\) for every mode.

Pick the valid statement at each line. The coefficient question is about the scalar equation itself, even when the current amplitude is zero. The last line restricts attention to the modes with \(s\gt2\).

4 Apply

Compute an implicit step

Work through a right-hand side, a coupled solve, a sign change, a physical rod, and an error calculation. Enter a decimal. Each problem shows its accepted absolute error and has hints and a worked solution.

Key point Form the right-hand side from old temperatures, then solve for the new temperatures together. A stable step can still have sizeable error, so check its accuracy at the time and location that matter.
Level Intermediate Prerequisites Explicit heat schemes, linear systems Time ~30 min

Further reading