A13 · Lesson 29 · Multigrid
Why simple iterations stall on smooth errors, and how coarse grids fix it
Lessons 27 and 28 showed that Jacobi and conjugate gradients slow down as a grid is refined: the model problem needs millions of Jacobi sweeps or thousands of CG steps on a large grid. The reason is specific. Simple iterations remove rough, rapidly varying error almost at once, but smooth error barely moves, because each update only looks at its neighbors. Multigrid turns that weakness into a method: smooth error looks rough on a coarser grid, so solve for it there. The result solves the model problem in a fixed number of cycles whatever the grid size, with work proportional to the number of unknowns. The same idea, used as a preconditioner, makes CG converge in a handful of steps.
- The curve shows how much one sweep of weighted Jacobi multiplies each Fourier mode of the error, against the mode's frequency θ (0 is smoothest, π roughest), for the 1D model problem.
- With ω = 1 (plain Jacobi), the roughest mode isn't damped at all: its factor is −1.
- With , every mode from θ = π/2 to π shrinks by at least a factor of 3 per sweep. The smooth modes near θ = 0 still barely shrink: that's the job left for the coarse grid.
Predict
A 2D model problem has a million unknowns (1000 × 1000). Roughly how many multigrid V-cycles gain 6 digits?
About 6 to 10. A good V-cycle cuts the error by a factor of about 10 regardless of the grid size, and each cycle costs only a few sweeps' worth of work. On the same problem, Jacobi would need about 2.8 million sweeps and CG about 4600 steps.
Name it
Smoothing
For the 1D model problem, weighted Jacobi multiplies the error mode with frequency θ by
The smooth modes, θ near 0, have , barely below 1. For the rough half, , choosing makes : a few sweeps make the error smooth, though not small. Gauss–Seidel smooths similarly.
The coarse-grid correction
Once the error e is smooth, it can be represented on a grid with twice the spacing. Compute the residual , restrict it to the coarse grid, solve there (where the problem is 2, 4 or 8 times smaller), interpolate back and add it to u. Modes that were smooth on the fine grid are only half as smooth on the coarse one, so the coarse grid's own smoothing handles them.
The V-cycle
Apply the idea recursively: smooth, restrict, recurse down to a tiny grid solved directly, then interpolate and smooth on the way back up. The work is a geometric series. In d dimensions each coarser grid has as many points, so a V-cycle costs about times the work on the finest grid: 2 in 1D, in 2D, in 3D. Each cycle cuts the error by a fixed factor, typically 0.1, so the total work is O(n).
Preconditioning
CG's steps grow as . A preconditioner M is an approximation to A that's cheap to solve with; CG applied to converges at a rate set by . Common choices: the diagonal (Jacobi), incomplete Cholesky (Cholesky that drops fill), and one multigrid V-cycle, which makes bounded independent of the grid.
Worked example
For weighted Jacobi with on the 1D model problem with h = 1/64, how fast are the roughest, the middle and the smoothest modes damped?
Show the solution
- The roughest mode, θ = π.
- The middle mode, θ = π/2.
- The smoothest mode, θ = πh.
- What that means. Three sweeps cut every rough mode by at least 27, while the smoothest mode needs about 1250 sweeps just to fall by a factor of e.
- How multigrid uses it. That's the signature of every simple iteration on elliptic problems, and it's exactly what multigrid exploits: three sweeps, then hand the smooth remainder to the coarse grid.
Answer each sweep multiplies the roughest mode by , the middle mode by and the smoothest by 0.9992.
Worked example
How much work does one V-cycle take on a 2D grid with unknowns, with two smoothing sweeps on each level going down and coming up?
Show the solution
- The levels. They have , , , … points, a quarter as many each time, down to a tiny grid.
- Sweeps on all levels. Four sweeps per level (two down, two up) cost fine-grid sweeps, plus residual and transfer work of the same order.
- The whole cycle. So a V-cycle costs about as much as 8 to 10 Jacobi sweeps on the fine grid, and gains about a digit.
- Compare with Jacobi. Six digits take some 60 sweep-equivalents, against the 2.9 million sweeps plain Jacobi would need on a grid this size.
Answer about 5.3 fine-grid sweeps plus transfers, roughly the cost of 8 to 10 Jacobi sweeps.
Worked example
Compare the number of iterations Jacobi, CG and multigrid need for 6 digits on the 2D model problem with N = 1000 points per side.
Show the solution
- Jacobi. with , so the count is sweeps.
- CG's condition number. so .
- CG's steps.
- Multigrid. About 6 V-cycles.
- Compare the work. Each step of each method costs O(n) work, so the counts compare total work directly, and only multigrid's count doesn't grow when N does.
Answer about Jacobi sweeps, 4600 CG steps and 6 multigrid V-cycles.
Check
Weighted Jacobi on the 1D model problem with ω = 0.67.
(a)
What does one sweep multiply the mode with θ = 0.5π by?
Check
In d = 2 dimensions, each coarser grid has as many points. How many fine-grid sweeps' worth of smoothing does a V-cycle with one sweep per level cost?
Check
A V-cycle cuts the error by 0.2. How many cycles gain 6 digits?
Check
A preconditioner lowers the condition number from 10000 to 10. By about what factor does it cut CG's step count?
Check
A multigrid hierarchy halves an grid until it's 4 × 4. With N = 1024, how many levels are there, counting both ends?
Check
Why do Jacobi and Gauss–Seidel need so many sweeps on fine grids?
Check
Weighted Jacobi on the 1D model problem, with θ written as t and ω as w.
Step 1
What factor multiplies the error mode with frequency θ?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
What is it for the roughest mode, θ = π?
Check
On the 1D model problem with N = 31 interior points, start with the error and apply 3 sweeps of weighted Jacobi with to : , with zero ends. Set smooth and rough to the remaining amplitudes of the two modes (project onto each sine).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Explain why
Why does a coarse grid solve the problem that slows simple iterations?
Simple iterations change each value using only its neighbors, so they quickly remove error that varies from point to point but hardly touch error that varies slowly across many points. Slowly varying error, though, can be represented accurately with far fewer points. On a grid with twice the spacing, the same error varies twice as fast relative to the grid, so the coarse grid's own smoothing attacks it efficiently, and the coarse problem is several times smaller. Doing this recursively hands each band of frequencies to the grid where it looks rough, so every component of the error is reduced quickly, and the total work stays proportional to the number of unknowns.
Practice
Keep practicing
7 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.