Chaos & Predictability Notation How to run

Chapter 15 · Tangent linear and adjoint models

Part V — The machinery of prediction Knob: lead time $\tau$, perturbation amplitude live notebook

Overview

Monday’s forecast for Thursday was badly wrong. Which part of Monday’s initial state was responsible, and by how much would each part have had to change to fix it?

That is a question about a gradient — the derivative of one forecast quantity with respect to every component of the initial state. The obvious way to get it is to perturb each component in turn and re-run the model. For Lorenz 63 that is four runs. For an operational model with 10810^8 state variables it is a hundred million runs, and it is never going to happen.

The adjoint delivers the whole gradient in one extra model-sized integration, at a cost independent of the state dimension. That single fact is why 4D-Var (chapter 18) exists, why singular vectors (chapter 16) are computable, and why targeted observing is a real technique rather than a thought experiment.

State dimension nnFinite differencesAdjoint
3 (Lorenz 63)4 model runs2
40 (Lorenz 96)412
10810^8 (operational NWP)108+110^8 + 12

The model

The tangent linear propagator M(x0,τ)=M/x\mathbf{M}(x_0,\tau) = \partial\mathcal{M}/\partial x satisfies δx˙=J(x(t))δx\dot{\delta x} = \mathbf{J}(x(t))\,\delta x along the nonlinear trajectory. It is state-dependent — the same flow-dependence chapter 7 measured as finite-time exponents — and it is linear, so once you have it the effect of any small perturbation is a matrix-vector product.

One detail is easy to get wrong and hard to notice: the model you actually run is the discretised one, so the tangent must be stepped through the same RK4 stages, with J\mathbf{J} evaluated at each intermediate state. Freezing J\mathbf{J} across the step leaves an O(h)O(h) inconsistency between the tangent and the discrete map.

The adjoint is defined by the identity Mu,v=u,Mv\langle \mathbf{M}u, v\rangle = \langle u, \mathbf{M}^{*}v\rangle. Under the Euclidean inner product M=M\mathbf{M}^{*} = \mathbf{M}^{\top}, which makes it look trivial — but the identity is the definition, and under a weighted norm the adjoint acquires the weights, which is where operational adjoints go wrong.

Prefer to run it yourself? Download as a Jupyter notebook — it installs its own dependencies in the first cell. The sliders are static in Jupyter; edit value= and re-run to change a parameter.

Two limits, and two tests

The linearisation has a shelf life. The neglected term is O(δx2)O(\|\delta x\|^2) and δx\|\delta x\| grows like eλ1te^{\lambda_1 t}, so the window over which the tangent model is trustworthy is

τvalid1λ1lnδcδ0,\tau_{\text{valid}} \approx \frac{1}{\lambda_1}\ln\frac{\delta_c}{\delta_0},

measured here at 1.18 MTU per e-fold of δ0\delta_0 against 1/λ1=1.101/\lambda_1 = 1.10. This is the logarithmic law for the third time — chapter 7 found it in the growth rate, chapter 20 in the forecast horizon, and here it sets how long a 4D-Var assimilation window can be. A hundredfold smaller perturbation buys about five extra MTU of linearity, not a hundredfold longer window.

There are exactly two tests worth running, and you need both:

  1. The adjoint identity, which must hold to machine precision (1014\sim10^{-14}) because it is algebraic rather than approximate. It tests M\mathbf{M}^{\top} against M\mathbf{M} and says nothing about whether M\mathbf{M} is right.
  2. The finite-difference check, in which the relative discrepancy against the true nonlinear difference must fall linearly with the perturbation amplitude — slope 1 on log–log, down to round-off. This is what catches a wrong Jacobian.

An adjoint that passes only the first can be the perfect adjoint of the wrong tangent linear model.

Three bugs these tests caught, in this book

Not hypothetical. All three were live in chaoslib during writing, and each was found by a test rather than by reading the code:

Exercises

Analytic. Show that J/x0=MJ/xτ\partial J/\partial x_0 = \mathbf{M}^{\top}\,\partial J/\partial x_\tau, and hence that the cost of the gradient is independent of nn. Then derive the adjoint under a weighted inner product u,vE=uEv\langle u,v\rangle_E = u^{\top}\mathbf{E}v and say what changes.

Computational. Verify Liouville’s theorem for this system: detM\det\mathbf{M} must equal e(σ+1+β)τe^{-(\sigma+1+\beta)\tau} for every trajectory and every τ\tau. Why does that test constrain the interval the propagator covers, when the trace identity of chapter 7 constrains the exponents?

Exploratory. Move the lead time from 0.25 to 4 MTU and watch the validation curve shift upward while its slope stays at 1. Accuracy and correctness are different properties — only one of them is a bug. At what amplitude does the round-off floor set in, and what does that imply about testing an adjoint with α=1012\alpha = 10^{-12}?

Further reading