Algorithm Search⌘K

Algorithmintro

Nudging

Also called Newtonian relaxation.

Adds a term G (y^o - H x) to the model equations that pulls the state toward the observations with a time scale 1/g; the simplest continuous data assimilation.

Time
Θ(m (c + n + p + z)) worst
Space
Θ(n + p + z) extra
Where
c = the cost of one evaluation of the model tendency; m = the number of time steps; n = the state dimension; p = the number of observed quantities; z = the number of nonzero entries of H and G
Properties
continuous in timedeterministic
Origin
John E. Hoke, Richard A. Anthes, 1976

Nudging, also called Newtonian relaxation, assimilates observations by adding a relaxation term to the equations of the model, x˙=f(x)+G (yo(t)−Hx)\dot x = f(x) + G\,(y^o(t) - Hx), and integrating the result in time. The term pulls each observed quantity toward its observed value with the rate set by the gain GG, and the model dynamics carry the information to the unobserved parts of the state. The gain is a tuned constant, not a quantity derived from error statistics, so nudging is cheap, easy to add to any model and continuous in time, but it is not an optimal estimator. With a constant gain the nudged model is a Luenberger observer for the model, and with full exact observations and a large enough gain the nudged state converges to the truth even for a chaotic model.

In plain words

Take a weather model and run it forward. At the same time, look at the measurements. Wherever the model has a value that is measured, push the model a little toward the measurement at every time step. The push is stronger when the model is farther from the measurement, like a spring. The model then moves the corrected values to the places that are not measured, through its own physics. If the spring is too weak, the model drifts away on its own. If it is too strong for poor or sparse measurements, the model copies the noise or is pulled into a state that its physics do not like. The strength of the spring is chosen by trial, not by a formula.

The problem

Input. A model tendency f:Rn→Rnf : \mathbb R^n \to \mathbb R^n, an initial state x0x_0, a linear observation operator HH (p×np \times n), observations yo(t)∈Rpy^o(t) \in \mathbb R^p given at every time, usually by interpolation in time between observation times, a gain GG (n×pn \times p), a time step dtdt and a number of steps mm. Here nn is the state dimension and pp the number of observed quantities. The common choice is G=gH⊤G = gH^\top, which relaxes each observed quantity with the rate gg and the time scale 1/g1/g.

Output. An approximation xk≈x(tk)x_k \approx x(t_k), tk=k dtt_k = k\,dt, of the solution of

x˙=f(x)+G(yo(t)−Hx),x(0)=x0.\dot x = f(x) + G\big(y^o(t) - Hx\big), \qquad x(0) = x_0.

The algorithm

  1. NUDGE(f, x_0, H, G, y^o, dt, m)
  2. 1x <- x_0
  3. 2for k <- 0 to m - 1 do
  4. 3q(t, z) := f(z) + G (y^o(t) - H z) ▷ model plus relaxation
  5. 4x_{k+1} <- RK4 step of dz/dt = q(t, z) from t_k to t_{k+1}
  6. 5return x_0, x_1, ..., x_m

Line L3 is the only change to the model. Line L4 is one step of the classical Runge-Kutta method, which evaluates qq at tkt_k, twice at tk+dt/2t_k + dt/2 and at tk+1t_{k+1}, so yoy^o must be available between observation times. The reference code interpolates it linearly in time. The step must also be stable for the relaxation: for G=gIG = gI this needs about g dt<2.78g\,dt < 2.78, the limit of RK4 on the negative real axis. With G=0G = 0 the algorithm is the free model run.

Example

Scalar check. For x˙=−ax+g(y−x)\dot x = -ax + g(y - x) with constants, the solution is xe+(x0−xe)e−(a+g)tx_e + (x_0 - x_e)e^{-(a+g)t} with xe=gy/(a+g)x_e = gy/(a + g). With a=0.7a = 0.7, g=2.5g = 2.5, y=3y = 3 and x0=−1x_0 = -1, the state relaxes to xe=2.344x_e = 2.344, not to y=3y = 3: the model and the observation compromise.

Lorenz-96 with full exact observations. A truth run of the Lorenz-96 model with n=40n = 40 and F=8F = 8, RK4 with dt=0.01dt = 0.01, is observed at every variable without error. The nudged run starts from the truth plus Gaussian noise of standard deviation 3 (seed 1), with H=IH = I and G=gIG = gI. The table gives the root mean square error over the 40 variables (measurements).

gg t=0t = 0 t=5t = 5 t=10t = 10 t=20t = 20
0 (free run) 2.49 5.50 4.80 4.49
0.5 2.49 2.19 4.15 3.38
1 2.49 1.35 2.37 2.39
1.5 2.49 1.05 0.34 1.64
2 2.49 0.11 0.006 0.003
3 2.49 0.003 0.001 0.002
5 2.49 0.0009 0.0009 0.001

For g≤1.5g \le 1.5 the error stays of the order of the spread of the attractor. For g≥2g \ge 2 the nudged run locks onto the truth. The remaining error of about 10−310^{-3} comes from the linear interpolation of the truth in time at the half steps of RK4. The largest growth rate of small errors on this attractor is about 1.7, which is close to the measured threshold (measurement, see the Lorenz-96 page). The sufficient condition of Corollary 5 in the proof, g>4max⁡j∣xjt∣−1≈54g > 4\max_j|x^t_j| - 1 \approx 54, is far from sharp.

Noisy observations. The same truth is observed every 0.050.05 time units with Gaussian errors of standard deviation σo=1\sigma_o = 1, and the observations are interpolated linearly in time. The mean root mean square error between t=10t = 10 and t=30t = 30 is 3.93 for g=0.5g = 0.5, 2.44 for g=1g = 1, 0.71 for g=2g = 2, 0.40 for g=5g = 5 and 0.46 for g=10g = 10 (measurements). A moderate gain averages the noise over a time of about 1/g1/g; a large gain follows the noise more closely.

Half the variables observed. With only the even variables observed and G=gH⊤G = gH^\top, the error after t=30t = 30 was 2.7 for g=2g = 2, 0.3 for g=5g = 5, 0.003 for g=10g = 10 and 0.6 for g=20g = 20 (measurements). Here a gain that is too large is worse than a moderate one.

Correctness

The proof shows that the loop stops after mm Runge-Kutta steps of the nudged equation, and three facts about that equation. For a linear scalar model it relaxes to the weighted mean gy/(a+g)gy/(a + g) with the rate a+ga + g. If the model satisfies the one-sided bound e⊤(f(xt+e)−f(xt))≤ℓ∣e∣2e^\top(f(x^t + e) - f(x^t)) \le \ell|e|^2 along the truth, and the observations are full and exact with G=gIG = gI, then ∣e(t)∣≤e(ℓ−g)t∣e(0)∣|e(t)| \le e^{(\ell - g)t}|e(0)| (a theorem). For Lorenz-96 the bound holds with ℓ=4max⁡j∣xjt∣−1\ell = 4\max_j|x^t_j| - 1, because the advection term conserves energy. With partial observations, convergence needs more: Azouani, Olson and Titi (2014) prove it for the 2D Navier-Stokes equations when the observations resolve the flow finely enough and the gain is large enough, but not too large for that resolution.

Proof: Nudging integrates the relaxed model, and a large enough gain makes the error decayfull

Setting. The model is x˙=f(x)\dot x = f(x) on Rn\mathbb R^n with a locally Lipschitz ff. The observations are yo(t)∈Rpy^o(t) \in \mathbb R^p, HH is a p×np \times n matrix and GG an n×pn \times p matrix. The nudged equation is

x˙=q(t,x)=f(x)+G(yo(t)−Hx).(1)\dot x = q(t, x) = f(x) + G\big(y^o(t) - Hx\big). \qquad (1)

Termination and what the code computes. Line L1 sets x0x_0. Line L3 defines the right side qq of (1). The loop of line L2 runs mm times, and each pass does one classical Runge-Kutta step of (1) in line L4, with four evaluations of qq. So the algorithm stops after 4m4m evaluations of ff and returns at line L5. The output is the Runge-Kutta solution of (1). For a yoy^o with four continuous derivatives its global error on a fixed interval is O(dt4)O(dt^4), the order of the method. With yoy^o linear in time between observation times, qq is only continuous in tt at those times, and the error of the forcing term is O(dt2)O(dt^2); the tests use a tolerance that allows for this. The statements below are about the exact solution of (1).

Theorem 1 (linear scalar case). For x˙=−ax+g(y−x)\dot x = -a x + g(y - x) with constants aa, gg, yy and a+g≠0a + g \ne 0, the solution is

x(t)=xe+(x(0)−xe) e−(a+g)t,xe=gya+g.x(t) = x_e + (x(0) - x_e)\,e^{-(a + g)t}, \qquad x_e = \frac{g y}{a + g}.

Proof. The equation is x˙=−(a+g)(x−xe)\dot x = -(a + g)(x - x_e), a linear equation for x−xex - x_e with the solution (x(0)−xe)e−(a+g)t(x(0) - x_e)e^{-(a + g)t}. □\square

For a+g>0a + g > 0 the solution relaxes to xex_e with the time scale 1/(a+g)1/(a + g). The limit xex_e is between the free equilibrium 00 and the observation yy: nudging does not reach the observation unless the model agrees with it.

Theorem 2 (error decay with full observations). Let the truth xtx^t solve x˙t=f(xt)\dot x^t = f(x^t) and be observed exactly and completely, yo(t)=xt(t)y^o(t) = x^t(t), with H=IH = I and G=gIG = gI. Suppose that along the truth

e⊤(f(xt(t)+e)−f(xt(t)))≤ℓ ∣e∣2for all e∈Rn and t≥0.(2)e^\top\big(f(x^t(t) + e) - f(x^t(t))\big) \le \ell\,|e|^2 \quad \text{for all } e \in \mathbb R^n \text{ and } t \ge 0. \qquad (2)

Then the error e(t)=x(t)−xt(t)e(t) = x(t) - x^t(t) of the solution of (1) satisfies ∣e(t)∣≤e(ℓ−g)t∣e(0)∣|e(t)| \le e^{(\ell - g)t}|e(0)|. So for g>ℓg > \ell the nudged solution converges to the truth exponentially, whatever its initial value.

Proof. Subtract the two equations: e˙=f(xt+e)−f(xt)−ge\dot e = f(x^t + e) - f(x^t) - g e. Then

12ddt∣e∣2=e⊤e˙=e⊤(f(xt+e)−f(xt))−g∣e∣2≤(ℓ−g)∣e∣2.\tfrac12 \tfrac{d}{dt}|e|^2 = e^\top \dot e = e^\top\big(f(x^t + e) - f(x^t)\big) - g|e|^2 \le (\ell - g)|e|^2.

So ddt(e−2(ℓ−g)t∣e∣2)≤0\tfrac{d}{dt}\big(e^{-2(\ell - g)t}|e|^2\big) \le 0, which gives ∣e(t)∣2≤e2(ℓ−g)t∣e(0)∣2|e(t)|^2 \le e^{2(\ell - g)t}|e(0)|^2. □\square

If f(x)=Axf(x) = Ax with a skew-symmetric AA, then e⊤Ae=0e^\top A e = 0, so (2) holds with ℓ=0\ell = 0 and the proof gives the equality ∣e(t)∣=e−gt∣e(0)∣|e(t)| = e^{-gt}|e(0)|. The tests check this for a rotation.

Lemma 3 (energy conservation of the Lorenz-96 advection). For N(x)j=(xj+1−xj−2)xj−1N(x)_j = (x_{j+1} - x_{j-2})x_{j-1} with indices modulo nn, x⊤N(x)=0x^\top N(x) = 0 for every xx.

Proof. x⊤N(x)=∑jxj+1xjxj−1−∑jxjxj−1xj−2x^\top N(x) = \sum_j x_{j+1}x_j x_{j-1} - \sum_j x_j x_{j-1} x_{j-2}. Replace jj by j+1j + 1 in the second sum: it becomes ∑jxj+1xjxj−1\sum_j x_{j+1} x_j x_{j-1}, the first sum. □\square

Lemma 4 (one-sided bound for Lorenz-96). For the Lorenz-96 tendency f(x)=N(x)−x+Ff(x) = N(x) - x + F and any xtx^t, ee,

e⊤(f(xt+e)−f(xt))≤(4M−1)∣e∣2,M=max⁡j∣xjt∣.e^\top\big(f(x^t + e) - f(x^t)\big) \le (4M - 1)|e|^2, \qquad M = \max_j |x^t_j|.

Proof. Expand: N(xt+e)j−N(xt)j=(ej+1−ej−2)xj−1t+(xj+1t−xj−2t)ej−1+N(e)jN(x^t + e)_j - N(x^t)_j = (e_{j+1} - e_{j-2})x^t_{j-1} + (x^t_{j+1} - x^t_{j-2})e_{j-1} + N(e)_j. By Lemma 3, e⊤N(e)=0e^\top N(e) = 0. The other terms give

∑jejej+1xj−1t−∑jejej−2xj−1t+∑jejej−1(xj+1t−xj−2t),\sum_j e_j e_{j+1} x^t_{j-1} - \sum_j e_j e_{j-2} x^t_{j-1} + \sum_j e_j e_{j-1}(x^t_{j+1} - x^t_{j-2}),

whose absolute value is at most M∑j∣ej∣∣ej+1∣+M∑j∣ej∣∣ej−2∣+2M∑j∣ej∣∣ej−1∣M\sum_j|e_j||e_{j+1}| + M\sum_j|e_j||e_{j-2}| + 2M\sum_j|e_j||e_{j-1}|. Each sum ∑j∣ej∣∣ej+s∣\sum_j |e_j||e_{j+s}| is at most ∣e∣2|e|^2 by the Cauchy-Schwarz inequality, because the shift does not change the norm. So these terms are at most 4M∣e∣24M|e|^2. The linear term gives e⊤(−e)=−∣e∣2e^\top(-e) = -|e|^2, and the constant FF cancels. □\square

Corollary 5 (synchronization of Lorenz-96). With full exact observations, H=IH = I and G=gIG = gI, let MM bound ∣xjt(t)∣|x^t_j(t)| for all jj and t≥0t \ge 0. If g>4M−1g > 4M - 1, the nudged Lorenz-96 solution converges to the truth exponentially, at the rate g+1−4Mg + 1 - 4M.

Proof. Lemma 4 gives (2) with ℓ=4M−1\ell = 4M - 1, and Theorem 2 applies. □\square

The truth enters the bound only through MM, so the bound holds for any initial value of the nudged run. The condition is sufficient, not necessary: the measured threshold on the page is much smaller than 4M−14M - 1.

Summary. The algorithm stops after mm Runge-Kutta steps of the nudged equation (1). For a linear scalar model the nudged solution relaxes to a weighted mean of the model equilibrium and the observation. With full exact observations, G=gIG = gI and a model that satisfies the one-sided bound (2), the error decays like e(ℓ−g)te^{(\ell - g)t}, and for Lorenz-96 the bound holds with ℓ=4max⁡j∣xjt∣−1\ell = 4\max_j|x^t_j| - 1. ■\blacksquare

Complexity

Each step evaluates the tendency four times, at the cost cc each, and forms G(yo−Hz)G(y^o - Hz) four times in Θ(n+p+z)\Theta(n + p + z) time with sparse HH and GG (zz nonzero entries). So mm steps cost Θ(m(c+n+p+z))\Theta(m(c + n + p + z)), which for a local HH is a small fraction more than the free model run. The extra memory is the current state and the observations needed for the current step. This is much less than for any method that stores or evolves a covariance matrix.

Properties

  • Not optimal. The gain does not come from BB and RR, so the result is not the minimum variance estimate. With noisy observations the error does not go to zero; it settles at a level set by the gain, the noise and the model.
  • Continuous in time. The state is corrected at every step, so there are no jumps in the forecast at analysis times, and the run is smooth enough to drive other models.
  • Balance. A gentle relaxation lets the model adjust the unobserved fields to the observed ones, which is why it was first used to initialize models (Hoke and Anthes 1976).
  • Observer form. For a constant GG the nudged model is a Luenberger observer of the model. The Kalman filter gives the gain that minimizes the error variance for linear Gaussian models.
  • Synchronization. For full exact observations, convergence of the nudged run to the truth is synchronization of two copies of the model through a coupling, which needs a coupling strength above a threshold set by the instability of the model.

Variants and improvements

  • Observation nudging and analysis nudging. Relax toward individual observations, with weights that fall off with distance and time from each observation, or toward gridded analyses. Regional models use both.
  • Spectral nudging. Relax only the large scales of the model toward a global analysis, and leave the small scales free. Regional climate runs use this.
  • Back and forth nudging. Run the nudged model forward and then backward in time with the opposite sign of relaxation, several times, to improve the initial state (Asch, Bocquet and Nodet 2016, Chapter 4).
  • Interpolant observables. Replace HxHx by an interpolant of the coarse observations, as in Azouani, Olson and Titi (2014), which gives proofs of convergence for dissipative partial differential equations.
  • Statistical gains. Take GG from optimal interpolation weights, or from a Kalman gain computed once, to give more weight to good observations.

When to use it

Use nudging when a cheap continuous assimilation is needed for a model with no tangent linear or adjoint code, for example to keep a regional or climate model close to a reanalysis, to spin up a model, or to prepare initial conditions with balanced fields. Use it also as a baseline in an observing system simulation experiment. For the best estimate from noisy observations, use optimal interpolation, 3D-Var or an ensemble Kalman filter.

Pitfalls

  • Gain too large for the time step (line L4). RK4 is unstable for the relaxation term when g dtg\,dt is larger than about 2.782.78, and the run blows up. Reduce dtdt or treat the relaxation implicitly.
  • Sign of the relaxation (line L3). Writing Hz−yoHz - y^o in place of yo−Hzy^o - Hz pushes the model away from the observations, and the error grows like egte^{gt}. A test with f=0f = 0 and a constant observation shows it at once.
  • Observations only at the observation times (line L3). If yo(t)y^o(t) is used only at the exact observation times and the term is set to zero between them, the effective gain depends on the time step. Interpolate the observations in time, or spread each one over a time window.
  • Gain too large for partial or noisy data. A strong relaxation of a few observed quantities forces the model into states that its dynamics do not support, and it copies the noise. In the half observed example above, g=20g = 20 was worse than g=10g = 10. Tune the gain by experiment.
  • Treating the output as an error estimate. Nudging gives no analysis error variance. Measure the error against independent observations or in a twin experiment.

Implementations

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

nudging.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/nudging/. The authors are listed in prov/A44WD4.jsonl.

"""Nudging (Newtonian relaxation) of a model toward observations.

The model dx/dt = f(x) gets a relaxation term:

    dx/dt = f(x) + G (y^o(t) - H x),

where H (p by n) maps the state to the observed quantities, y^o(t) gives the
observations at any time t (usually by interpolation in time between
observation times), and G (n by p) is the nudging gain. The common choice
G = g H^T relaxes each observed component with the time scale 1/g.

The nudged equation is integrated with the classical Runge-Kutta method.
The module also holds the Lorenz-96 tendency for the tests and the page.
"""


def lorenz96(F):
    """Return the Lorenz-96 tendency f(x)_j = (x_{j+1} - x_{j-2}) x_{j-1} - x_j + F."""

    def f(x):
        n = len(x)
        return [(x[(j + 1) % n] - x[j - 2]) * x[j - 1] - x[j] + F for j in range(n)]

    return f


def rk4_step(q, t, x, dt):
    """Return one classical Runge-Kutta step of dx/dt = q(t, x)."""
    k1 = q(t, x)
    k2 = q(t + dt / 2, [a + dt / 2 * b for a, b in zip(x, k1)])
    k3 = q(t + dt / 2, [a + dt / 2 * b for a, b in zip(x, k2)])
    k4 = q(t + dt, [a + dt * b for a, b in zip(x, k3)])
    return [a + dt / 6 * (b + 2 * c + 2 * d + e) for a, b, c, d, e in zip(x, k1, k2, k3, k4)]


def nudge(f, x0, H, G, yobs, dt, m, t0=0.0):
    """Return the nudged trajectory [x_0, x_1, ..., x_m] at t_k = t0 + k dt.

    f(x) is the model tendency, H a p by n matrix, G an n by p matrix and
    yobs(t) the list of p observed values at time t. With G = 0 this is
    the free model run.
    """
    n, p = len(x0), len(H)
    # Keep only the nonzero entries: H and G are usually very sparse.
    Hs = [[(j, H[k][j]) for j in range(n) if H[k][j] != 0] for k in range(p)]
    Gs = [[(k, G[i][k]) for k in range(p) if G[i][k] != 0] for i in range(n)]
    x = [float(v) for v in x0]  # @line L1
    path = [list(x)]

    def q(t, z):  # @line L3
        y = yobs(t)
        r = [y[k] - sum(h * z[j] for j, h in Hs[k]) for k in range(p)]
        fz = f(z)
        return [fz[i] + sum(gik * r[k] for k, gik in Gs[i]) for i in range(n)]

    for k in range(m):  # @line L2
        x = rk4_step(q, t0 + k * dt, x, dt)  # @line L4
        path.append(x)
    return path  # @line L5


def gain(H, g):
    """Return G = g H^T, which relaxes each observed quantity with the rate g."""
    return [[g * H[k][i] for k in range(len(H))] for i in range(len(H[0]))]


def time_interpolant(times, values):
    """Return y(t), linear in t between the given times and constant outside them.

    times must be equally spaced and increasing.
    """
    t0, step, last = times[0], times[1] - times[0], len(times) - 1

    def y(t):
        s = (t - t0) / step
        if s <= 0:
            return list(values[0])
        if s >= last:
            return list(values[last])
        k = int(s)
        a = s - k
        return [(1 - a) * u + a * v for u, v in zip(values[k], values[k + 1])]

    return y
test_nudging.py 120 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/nudging/. The authors are listed in prov/A44WD4.jsonl.

import math
import random

from nudging import gain, lorenz96, nudge, rk4_step, time_interpolant

N, F, DT = 40, 8.0, 0.01


def rmse(a, b):
    return math.sqrt(sum((u - v) ** 2 for u, v in zip(a, b)) / len(a))


def identity(n):
    return [[1.0 if i == j else 0.0 for j in range(n)] for i in range(n)]


def lorenz96_truth(steps, seed=1):
    f = lorenz96(F)
    x = [F + (0.01 if j == 0 else 0.0) for j in range(N)]
    for _ in range(1000):  # spin-up onto the attractor
        x = rk4_step(lambda t, z: f(z), 0.0, x, DT)
    truth = [x]
    for _ in range(steps):
        truth.append(rk4_step(lambda t, z: f(z), 0.0, truth[-1], DT))
    rng = random.Random(seed)
    x0 = [v + rng.gauss(0, 3) for v in truth[0]]
    return f, truth, [k * DT for k in range(steps + 1)], x0


def test_scalar_linear_exact_solution():
    # dx/dt = -a x + g (y - x) with a constant y.
    a, g, y, x0, dt = 0.7, 2.5, 3.0, -1.0, 0.01
    path = nudge(lambda x: [-a * x[0]], [x0], [[1.0]], [[g]], lambda t: [y], dt, 300)
    xe = g * y / (a + g)
    for k in (0, 50, 300):
        exact = xe + (x0 - xe) * math.exp(-(a + g) * k * dt)
        assert abs(path[k][0] - exact) < 1e-7  # RK4 error for (a + g) dt = 0.032


def test_zero_gain_is_the_free_run():
    f, truth, times, x0 = lorenz96_truth(50)
    G = [[0.0] * N for _ in range(N)]
    path = nudge(f, x0, identity(N), G, time_interpolant(times, truth), DT, 50)
    free = [list(map(float, x0))]
    for _ in range(50):
        free.append(rk4_step(lambda t, z: f(z), 0.0, free[-1], DT))
    assert path == free


def test_rotation_error_decays_at_rate_g():
    # f(x) = A x with A skew-symmetric; truth is a rotation, observed exactly.
    g, dt = 1.5, 0.01
    f = lambda x: [x[1], -x[0]]
    truth = lambda t: [math.cos(t), -math.sin(t)]
    x0 = [3.0, 2.0]
    path = nudge(f, x0, identity(2), gain(identity(2), g), truth, dt, 400)
    e0 = math.hypot(x0[0] - 1.0, x0[1])
    for k in (100, 200, 400):
        xt = truth(k * dt)
        e = math.hypot(path[k][0] - xt[0], path[k][1] - xt[1])
        assert abs(e - math.exp(-g * k * dt) * e0) < 1e-8


def test_error_bound_for_large_gain():
    # Theorem: with H = I and G = g I, |e(t)| <= exp((4M - 1 - g) t) |e(0)| for M = max |x^t_j|.
    steps = 300
    f, truth, times, x0 = lorenz96_truth(steps)
    M = max(max(abs(v) for v in s) for s in truth)
    g = 4 * M
    path = nudge(f, x0, identity(N), gain(identity(N), g), time_interpolant(times, truth), DT, steps)
    e0 = math.sqrt(sum((a - b) ** 2 for a, b in zip(path[0], truth[0])))
    for k in range(0, steps + 1, 10):
        e = math.sqrt(sum((a - b) ** 2 for a, b in zip(path[k], truth[k])))
        assert e <= math.exp((4 * M - 1 - g) * k * DT) * e0 + 1e-4


def test_error_identity_bound():
    # e^T (f(x^t + e) - f(x^t)) <= (4 max|x^t_j| - 1) |e|^2 for Lorenz-96.
    rng = random.Random(5)
    f = lorenz96(F)
    for _ in range(300):
        n = rng.randint(4, 12)
        xt = [rng.uniform(-10, 10) for _ in range(n)]
        e = [rng.uniform(-10, 10) for _ in range(n)]
        lhs = sum(ei * (a - b) for ei, a, b in zip(e, f([u + v for u, v in zip(xt, e)]), f(xt)))
        rhs = (4 * max(abs(v) for v in xt) - 1) * sum(v * v for v in e)
        assert lhs <= rhs + 1e-9


def test_lorenz96_synchronizes_with_full_observations():
    steps = 500
    f, truth, times, x0 = lorenz96_truth(steps)
    y = time_interpolant(times, truth)
    path = nudge(f, x0, identity(N), gain(identity(N), 5.0), y, DT, steps)
    assert rmse(path[0], truth[0]) > 2.0
    assert rmse(path[steps], truth[steps]) < 5e-3
    free = nudge(f, x0, identity(N), gain(identity(N), 0.0), y, DT, steps)
    assert rmse(free[steps], truth[steps]) > 1.0


def test_noisy_observations_error_below_observation_error():
    steps, sigma = 1500, 1.0
    f, truth, times, x0 = lorenz96_truth(steps)
    rng = random.Random(7)
    otimes = times[::5]
    ovals = [[v + rng.gauss(0, sigma) for v in truth[5 * i]] for i in range(len(otimes))]
    path = nudge(f, x0, identity(N), gain(identity(N), 5.0), time_interpolant(otimes, ovals), DT, steps)
    e = [rmse(path[k], truth[k]) for k in range(500, steps + 1)]
    assert sum(e) / len(e) < 0.6 * sigma


def test_time_interpolant():
    y = time_interpolant([0.0, 0.5, 1.0], [[0.0, 1.0], [1.0, 1.0], [3.0, 0.0]])
    assert y(-1.0) == [0.0, 1.0]
    assert y(0.25) == [0.5, 1.0]
    assert y(0.75) == [2.0, 0.5]
    assert y(2.0) == [3.0, 0.0]

History

Hoke and Anthes in 1976 used Newtonian relaxation for dynamic initialization, adding a relaxation term to the equations of a numerical weather prediction model so that the model adjusts gradually to the observed fields. The method then spread to continuous assimilation in regional models and to nudged climate runs. Its mathematical analysis as continuous data assimilation came later: Azouani, Olson and Titi gave in 2014 a proof of convergence for the 2D Navier-Stokes equations with general interpolant observables, and Law, Stuart and Zygalakis (2015) analyze the closely related synchronization filter.

References

  1. J. E. Hoke and R. A. Anthes, The initialization of numerical models by a dynamic-initialization technique, Monthly Weather Review 104 (1976) 1551-1556, the relaxation term added to the model equations
  2. A. Azouani, E. Olson and E. S. Titi, Continuous data assimilation using general interpolant observables, Journal of Nonlinear Science 24(2) (2014) 277-304, exponential convergence of nudging with interpolated coarse observations for the 2D Navier-Stokes equations
  3. M. Asch, M. Bocquet and M. Nodet, Data Assimilation, Methods, Algorithms, and Applications, SIAM, 2016, Chapter 4 (nudging methods)
  4. K. Law, A. Stuart and K. Zygalakis, Data Assimilation, A Mathematical Introduction, Springer, 2015, Section 4.4.3 (the synchronization filter)
  5. Eugenia Kalnay, Atmospheric Modeling, Data Assimilation and Predictability, Cambridge University Press, 2003, Chapter 5 (data assimilation)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example