Weather on a Grid

A forecast is a field on a grid, marched forward by a clock. Set those two against each other and a model whose physics is entirely correct will hand you numbers no atmosphere could hold.

Loading interactive simulation...

Lesson

The theory — Weather on a Grid

A forecast model holds the atmosphere as numbers on a grid and moves them forward in time steps. The simplest thing it does is advection: wind carries a pattern along, ∂u/∂t + c ∂u/∂x = 0. This page solves that on a ring 160 km round, and the choice matters, because advection has an exact answer — after a time t the field is the starting field shifted by c·t and nothing more — so every error reported here is measured against the truth rather than against a finer run. The Courant number ν = c·Δt/Δx is how many cells the wind crosses in one step, and the CFL condition ν ≤ 1 is the rule the explicit schemes here obey or fail. Courant, Friedrichs and Lewy published it in 1928, eighteen years before anyone ran a numerical forecast.

What each symbol means

c
the wind speed, in m/s. Constant here; in a real model it is part of the answer rather than a setting
Δx
the grid spacing, which is 160 km divided by the number of cells
Δt
the time step, in seconds
ν
the Courant number, c·Δt/Δx. Everything on the page turns on whether it is above or below 1
N
cells around the ring, from 10 to 400
Assumes
One equation, one dimension, one wind speed, and a ring with no edges. Because the exact answer is known, the error reported is the scheme's own and nothing else. It also assumes an explicit scheme, where each new value is built only out of old ones. That is the assumption the CFL condition is really about, and it is the one a real model partly escapes.
Breaks when
On most of what a forecast centre deals with. A real model carries several wave speeds at once and the fastest is sound, about 340 m/s: obeying CFL for sound waves nobody is forecasting would force a time step thirty times smaller than the weather needs, which is why operational models are semi-implicit and treat those waves apart. Wind is not constant either, so ν has to hold against the fastest wind anywhere on the grid rather than an average one. A limited-area model has boundaries, and what to do at them is a research subject of its own. An implicit scheme escapes the CFL limit altogether, at the price of solving a system of equations every step instead of sweeping an array.

The clock is set by the grid, not by the equation 🖖

Press Exactly on the edge, then Finer grid, same clock. Same wind, same time step, same equation; the cells go from 1 km to 667 m and nothing else moves. The first run is exact. The second passes ten times its starting peak at step 44 and reaches 1.8 × 10³⁰. The third row of the table says why: the wind covers 1.000 km in one step of 100 s. While a cell is at least as wide as that, the air arriving in it came from somewhere between the cell and its upwind neighbour, so the new value is a blend of those two — which is all the upwind scheme ever does. Narrow the cell below it and the air arriving came from further back than the neighbour the scheme asks. The weight on the cell’s own value, 1 − ν, goes negative, and a negative weight does not average. It amplifies. ν = c·Δt/Δx ≤ 1 is that sentence written in symbols. Refining a grid improves the physics and endangers the arithmetic, and the equations say nothing about it.

Crossing the line does not break a forecast. It decides that it will. 🖖

The second panel sweeps the Courant number and counts the steps until the field grows tenfold. At 1.05 that takes 330 steps; at 1.2 it takes 93; at 2.0 it takes 19. Just over the line, at 1.01, it takes 1,588, which is more steps than the first three presets run put together. Nothing in those early steps looks wrong, because the growth is exponential and exponential growth is invisible until it is not. A forecaster reading the output has already spent the compute. The Courant number can be read off three numbers before the run starts, which is where an operational centre reads it.

The most accurate setting is the one at the edge of failure 🖖

At exactly ν = 1 the upwind scheme is not merely accurate. It is exact: the error against the true answer is 5.4 × 10⁻²² and the feature keeps 100.0% of its height, because a Courant number of 1 makes each step a clean shift of one cell, and a shift is all advection ever was. Any smaller value smears the feature into neighbours the wind had not reached. Over the same 11.11 simulated hours on the same 1 km grid, ν = 0.99 keeps 94.3%, ν = 0.90 keeps 66.7%, ν = 0.50 keeps 37.1% and ν = 0.25 keeps 31.0%. Backing away from the limit for safety is the cheapest way there is to lose a weather feature. And the obvious remedy is worse than the disease: press The better scheme and watch a method whose truncation error is one order smaller than upwind’s blow up at step 39 from half the Courant limit.

Problem solved in full

  1. The 4 km model takes 40 minutes. What does 500 m cost? 7 steps

    A 4 km forecast model covers its domain in 40 minutes of computer time, and you are asked what the same forecast would cost at 500 m. Work it out before reading on, and notice which of the three factors you were not expecting. Press Exactly on the edge to put the tool on the 1 km row of the table.

    Open this problem in the tool

    1. Start with the cells. Halving the spacing doubles the count along each side, and a forecast domain has two horizontal dimensions, so one halving is four times the cells: 4 km gives 40 × 40 where 2 km gives 80 × 80.

    2. Now the factor that catches people. The time step is not yours to keep. CFL ties it to the spacing, so halving Δx halves the largest Δt allowed: at a 10 m/s wind and ν = 0.9, a 4 km grid permits 360 s and a 2 km grid permits 180 s. Steps for one simulated day go from 240 to 480.

    3. Multiply them. Four times the cells and twice the steps is eight times the work for one halving: 384,000 cell updates a day at 4 km against 3,072,000 at 2 km. The table's last column reads 8.00 on every row, which is the factor rather than an estimate of it.

    4. From 4 km to 500 m is three halvings, so the factor is 8³ = 512. The table agrees end to end: 384,000 updates a day at 4 km, 196,608,000 at 500 m.

    5. The 40 minutes becomes 40 × 512 = 20,480 minutes, which is a fortnight, for one day of weather. That is the answer to why a forecast grid is the size it is rather than as fine as anyone would like, and why a centre buying twice the resolution is buying eight times the machine.

    6. The estimate is honest about its own shape. It assumes the work per cell update does not change, which is about right for one advection term and increasingly generous as the physics gets richer. It assumes ν stays at 0.9, which no real model can promise, because ν has to hold against the fastest wind on the grid and a jet stream does not consult the modeller.

    7. Where the page stops: a centre facing this arithmetic does not simply pay it. Part of the factor is bought back with a semi-implicit scheme, which escapes CFL for the fast waves at the cost of solving a system each step, and part by spending resolution only where it is needed, in a nested or variable-resolution grid. Both are real, neither is free, and this page computes neither.

    Answer

    512 times the work, so roughly a fortnight for a single day of forecast. Four times the cells and twice the steps per halving, three halvings, 8³ = 512. The factor nobody expects is the third one: the Courant condition spends your time step for you.

Learning path

How a weather forecast is made

References (4)