Algorithm Search⌘K

Algorithmadvanced

Reverse time migration

Propagate the source wavefield forward and the recorded data backward in time with the full wave equation and apply the imaging condition.

Time
O(s g) per_shot
Space
O(s g) stored_source_field
Where
g = the number of grid points; s = the number of time steps
Properties
adjoint of born modelingdeterministiclinear in dataneeds cflno dip limittwo way
Origin
Edip Baysal, Dan D. Kosloff, John W. C. Sherwood, George A. McMechan, N. Dan Whitmore, 1983

Reverse time migration (RTM) images the subsurface with the full two-way wave equation. It propagates the source wavefield forward in time, propagates the recorded data backward in time from the receivers, and applies the imaging condition: at every point it correlates the two fields at zero lag. RTM is not a new way to solve the wave equation; both propagations use an ordinary finite-difference method in time and space, with its CFL condition. What RTM adds is the backward run and the correlation. In the form below, the backward run is the transpose of the discrete scheme, so the image is the exact adjoint of discrete Born modeling (a theorem), the operator that least-squares migration inverts and the gradient that full-waveform inversion uses. Because it solves the two-way equation, RTM has no dip limit and images turning waves and steep salt flanks that one-way methods miss.

In plain words

A shot sends a wave into the ground, and receivers at the surface record the echoes. RTM first simulates the shot wave going down, using a computer model of the wave speed, and keeps a copy of it at every time step. Then it plays the recording backward: it injects the echoes at the receivers, last sample first, and lets the simulation send them back into the ground. A reflector is at the place where the wave going down and the echo played back meet at the same moment. So at every point RTM multiplies the two fields at each time and adds up the products. The sum is large at reflectors and small elsewhere.

The problem

Given the recorded data drnd^n_r of one shot at the receivers rr and the time steps nn, and a smooth background model m0=1/v02m_0 = 1/v_0^2, compute the image of the model perturbation. The data are modeled by the constant-density acoustic equation m utt−Δu=fm\,u_{tt} - \Delta u = f. Linearizing about m0m_0 (the Born approximation) gives the scattered field δu\delta u that solves m0 δutt−Δδu=−δm u0,ttm_0\,\delta u_{tt} - \Delta\delta u = -\delta m\, u_{0,tt}, where u0u_0 is the source field. RTM computes BTdB^{\mathsf T} d, the adjoint of the linear map B:δm↦δuB : \delta m \mapsto \delta u at the receivers. This is seismic migration with the cross-correlation imaging condition.

The algorithm

The scheme is un+1=2un−un−1+w (Lun+fn)u^{n+1} = 2u^n - u^{n-1} + w\,(L u^n + f^n) with w=Δt2/mw = \Delta t^2/m, the 5-point Laplacian LL, u0=u−1=0u^0 = u^{-1} = 0 and u=0u = 0 outside the grid. First run it with the source to get the source field u0u_0 and store its second time differences D2u0n=(u0n+1−2u0n+u0n−1)/Δt2D_2 u_0^n = (u_0^{n+1} - 2u_0^n + u_0^{n-1})/\Delta t^2. Then run the transposed scheme backward with the data as the source.

  1. REVERSE-TIME-MIGRATION(d, m, D2u0, receivers, Δt, h) ▷ D2u0[n]: stored, from the forward run
  2. 1N ← the number of time steps of the source field; w ← Δt² / m
  3. 2λ1 ← 0; λ2 ← 0; image ← 0 ▷ the adjoint field at the steps n + 1 and n + 2
  4. 3for n ← N down to 1 do
  5. 4λ ← 2 λ1 + L(w · λ1) - λ2 ▷ the transposed scheme, run backward in time
  6. 5λ[r] ← λ[r] + d[n][r] for every receiver r ▷ inject the data
  7. 6image ← image - D2u0[n - 1] · w · λ; λ2 ← λ1; λ1 ← λ ▷ the imaging condition
  8. 7return image

Line L4 is the transpose of one forward step: the forward step applies ww after the Laplacian, so the transpose applies ww before it. Line L5 injects the recorded sample of every receiver, last time first. Line L6 is the imaging condition: the zero-lag correlation of the backward field with the second time derivative of the source field, summed over time. With μ=wλ\mu = w\lambda the recursion of line L4 becomes μn=2μn+1−μn+2+wLμn+1\mu^n = 2\mu^{n+1} - \mu^{n+2} + w L\mu^{n+1}, which is the forward scheme run backward in time, so it is stable under the same CFL condition.

Example

The time step by hand. With h=10h = 10 m, Δt=2\Delta t = 2 ms and v=2000v = 2000 m/s, the CFL number is vΔt/h=2000⋅0.002/10=0.4v\Delta t/h = 2000 \cdot 0.002/10 = 0.4. The 2D bound for this scheme is 1/2=0.7071/\sqrt{2} = 0.707, so the scheme is stable. Doubling Δt\Delta t to 4 ms gives 0.8, which is above the bound, and the fields grow without limit.

One scatterer. The test uses a 32×3232 \times 32 grid with these values, a 20 Hz Ricker source at row 2 and column 16, receivers along row 2, 180 time steps (0.36 s), and a scatterer δm=0.2/v2\delta m = 0.2/v^2 at row 18 and column 12. RTM of the Born data puts the largest absolute value below row 5 at exactly row 18, column 12, and the value there is positive, the sign of δm\delta m (a measurement on this case). The rows next to the source and the receivers hold strong artifacts from the direct wave.

Adjointness. For random δm\delta m and random data rr, ⟨B δm,r⟩\langle B\,\delta m, r\rangle and ⟨δm,BTr⟩\langle \delta m, B^{\mathsf T} r\rangle agree to a relative 10−1010^{-10} in the test.

Correctness

The full proof is in proofs/correctness.md.

  • Born is the derivative (theorem). The discrete Born modeling is the exact derivative of the discrete forward scheme with respect to mm, applied to δm\delta m.
  • Exact adjoint (theorem). Write all time steps of the forward scheme as one block lower-triangular system Au=sA u = s. Its transpose is block upper triangular, and back substitution from the last step is exactly lines L3 to L6. A loop invariant shows that after the pass for step nn, λ1\lambda1 holds the adjoint field at step nn. So the returned image is BTdB^{\mathsf T} d for the discrete BB.
  • The imaging condition (corollary). The image is −∑nD2u0n−1 w λn-\sum_n D_2u_0^{n-1}\, w\, \lambda^n, a zero-lag cross-correlation of the source field (second time derivative) and the backward field, as the imaging condition says.
  • Stability. The backward recursion is the forward scheme in μ=wλ\mu = w\lambda, so it is stable exactly when the forward scheme is, under the CFL condition vΔt/h≤1/2v\Delta t/h \le 1/\sqrt{2} in 2D.

That the adjoint image puts its peaks at the reflectors is not a theorem; it holds when the background velocity is close to the true one and the acquisition covers the target (a heuristic, supported by the test above).

Proof: Correctness of reverse-time migrationfull

Setting. Grid fields are vectors indexed by the grid points. LL is the 5-point Laplacian with zero values outside the grid; it is a real symmetric matrix. mm is the background squared slowness, W=diag⁡(Δt2/m)W = \operatorname{diag}(\Delta t^2/m), and RR samples a field at the receivers, so RTR^{\mathsf T} puts a receiver vector back at the receiver points. The background field u0u_0 solves the scheme

m⊙(u0n+1−2u0n+u0n−1)=Δt2(Lu0n+fn),u00=u0−1=0,m \odot (u_0^{n+1} - 2u_0^n + u_0^{n-1}) = \Delta t^2 (L u_0^n + f^n), \qquad u_0^0 = u_0^{-1} = 0,

for n=0,…,N−1n = 0, \ldots, N - 1, and gn=(u0n+1−2u0n+u0n−1)/Δt2g^n = (u_0^{n+1} - 2u_0^n + u_0^{n-1})/\Delta t^2 is its second time difference (the array d2u0). Born modeling BB maps a perturbation δm\delta m to the data (R un)n=0N(R\,u^n)_{n=0}^{N} of the scheme

un+1=2un−un−1+W(Lun+sn),sn=−δm⊙gn,u0=u−1=0.u^{n+1} = 2u^n - u^{n-1} + W(L u^n + s^n), \qquad s^n = -\delta m \odot g^n, \qquad u^0 = u^{-1} = 0.

Dot products are the plain sums over all entries.

Lemma 1 (Born modeling is the exact derivative). Let F(m)F(m) be the receiver data of the scheme for u0u_0 as a function of mm. Then F′(m) δm=B δmF'(m)\,\delta m = B\,\delta m.

Proof. Differentiate the scheme in the direction δm\delta m, with δun\delta u^n the derivative of u0nu_0^n: δm⊙(u0n+1−2u0n+u0n−1)+m⊙(δun+1−2δun+δun−1)=Δt2L δun\delta m \odot (u_0^{n+1} - 2u_0^n + u_0^{n-1}) + m \odot (\delta u^{n+1} - 2\delta u^n + \delta u^{n-1}) = \Delta t^2 L\,\delta u^n, because ff does not depend on mm. Divide by mm: δun+1=2δun−δun−1+W(L δun−δm⊙gn)\delta u^{n+1} = 2\delta u^n - \delta u^{n-1} + W(L\,\delta u^n - \delta m \odot g^n), with zero initial values. This is the Born scheme, and RR is linear. □\square

So migration with the adjoint of BB is the adjoint of the linearized forward map of the same discrete model; no continuous approximation is involved.

Theorem 1 (exact adjoint). For every data set y=(yn)n=0Ny = (y^n)_{n=0}^{N}, the array returned at line L7 is

BTy=−∑n=1Ngn−1⊙Wλn,B^{\mathsf T} y = -\sum_{n=1}^{N} g^{n-1} \odot W\lambda^n,

where λN+1=λN+2=0\lambda^{N+1} = \lambda^{N+2} = 0 and, for n=N,…,1n = N, \ldots, 1,

λn=RTyn+2λn+1+L(Wλn+1)−λn+2.\lambda^n = R^{\mathsf T} y^n + 2\lambda^{n+1} + L(W\lambda^{n+1}) - \lambda^{n+2}.

So ⟨B δm,y⟩=⟨δm,RTM(y)⟩\langle B\,\delta m, y\rangle = \langle \delta m, \mathrm{RTM}(y)\rangle for all δm\delta m and yy.

Proof. Collect u=(u1,…,uN)u = (u^1, \ldots, u^N). The Born scheme is the block lower-triangular system Au=WsA u = W s, where

(Au)k=uk−(2I+WL) uk−1+uk−2,k=1,…,N,(A u)^k = u^k - (2I + WL)\,u^{k-1} + u^{k-2}, \qquad k = 1, \ldots, N,

with u0=u−1=0u^0 = u^{-1} = 0 and (Ws)k=Wsk−1(Ws)^k = W s^{k-1}. AA has the identity on its block diagonal, so it is invertible. Its transpose is block upper triangular,

(ATλ)k=λk−(2I+WL)Tλk+1+λk+2=λk−2λk+1−LWλk+1+λk+2,(A^{\mathsf T}\lambda)^k = \lambda^k - (2I + WL)^{\mathsf T}\lambda^{k+1} + \lambda^{k+2} = \lambda^k - 2\lambda^{k+1} - L W \lambda^{k+1} + \lambda^{k+2},

with λN+1=λN+2=0\lambda^{N+1} = \lambda^{N+2} = 0, because (WL)T=LTWT=LW(WL)^{\mathsf T} = L^{\mathsf T}W^{\mathsf T} = LW (LL symmetric, WW diagonal). So the recursion for λ\lambda is the solution of ATλ=(RTyk)k=1NA^{\mathsf T}\lambda = (R^{\mathsf T}y^k)_{k=1}^{N}, solved from k=Nk = N down to k=1k = 1. Now, with u0=0u^0 = 0,

⟨B δm,y⟩=∑k=1N⟨uk,RTyk⟩=⟨u,ATλ⟩=⟨Au,λ⟩=∑k=1N⟨Wsk−1,λk⟩=⟨δm,  −∑k=1Ngk−1⊙Wλk⟩,\langle B\,\delta m, y\rangle = \sum_{k=1}^{N}\langle u^k, R^{\mathsf T} y^k\rangle = \langle u, A^{\mathsf T}\lambda\rangle = \langle A u, \lambda\rangle = \sum_{k=1}^{N}\langle W s^{k-1}, \lambda^k\rangle = \Big\langle \delta m,\; -\sum_{k=1}^{N} g^{k-1} \odot W\lambda^k\Big\rangle,

where the last step uses WW diagonal and sk−1=−δm⊙gk−1s^{k-1} = -\delta m \odot g^{k-1}.

It remains to match the code. Line L1 sets NN. Line L2 sets the two stored fields to λN+1=λN+2=0\lambda^{N+1} = \lambda^{N+2} = 0. Loop invariant: at the start of the pass for nn at line L3, lam1 =λn+1= \lambda^{n+1}, lam2 =λn+2= \lambda^{n+2}, and image =−∑k=n+1Ngk−1⊙Wλk= -\sum_{k=n+1}^{N} g^{k-1}\odot W\lambda^k. It holds for n=Nn = N. In the pass, line L4 computes 2λn+1+L(Wλn+1)−λn+22\lambda^{n+1} + L(W\lambda^{n+1}) - \lambda^{n+2} and line L5 adds RTynR^{\mathsf T} y^n, so lam =λn= \lambda^n; line L6 subtracts gn−1⊙Wλng^{n-1}\odot W\lambda^n; the shift of the stored fields gives the invariant for n−1n - 1. The loop has NN passes, so it stops, and line L7 returns the sum for k=1,…,Nk = 1, \ldots, N. The sample y0y^0 is not used, which is right because u0=0u^0 = 0. ■\blacksquare

Corollary (the imaging condition). The image is a zero-lag cross-correlation, summed over time, of the second time difference of the source field and the receiver field λ\lambda propagated backward in time, weighted by Δt2/m\Delta t^2/m. This is the cross-correlation imaging condition applied to the data residual or to the data. For several shots, BB stacks the shot operators, so the adjoint is the sum of the shot images.

What is not claimed. BTB^{\mathsf T} is not the inverse of BB; amplitudes and the low-wavenumber artifacts of the correlation are not corrected (least-squares migration does that). The edges of the grid reflect waves, since u=0u = 0 outside the grid; the adjoint statement holds with these edges, and it also holds with an absorbing layer if the same layer is used in both directions. Stability of the forward scheme needs the CFL condition v Δt/h≤1/2v\,\Delta t/h \le 1/\sqrt{2}; with μn=Wλn\mu^n = W\lambda^n the backward recursion reads μn=2μn+1−μn+2+W(Lμn+1+RTyn)\mu^n = 2\mu^{n+1} - \mu^{n+2} + W(L\mu^{n+1} + R^{\mathsf T}y^n), which is the forward scheme run backward in time, so it is stable under the same condition.

Complexity

  • Real-ram. Each propagation costs O(1)O(1) per grid point and time step, so one shot costs O(sg)O(s g) for the forward run, the same for the backward run, and the same for the correlation: O(sg)O(s g) in total.
  • Memory. The imaging condition pairs the source field at step n−1n - 1 with the backward field at step nn, but the source field is computed forward and the backward field backward. Storing the source field costs O(sg)O(s g) memory, the main cost of RTM in 3D.
  • Checkpointing. Storing the source field at O(s)O(\sqrt{s}) checkpoints and recomputing between them cuts the memory to O(s g)O(\sqrt{s}\, g) for one extra forward run; the logarithmic checkpointing schedules of automatic differentiation cut it further.
  • Many shots. Shots are independent, so the cost is O(sg)O(s g) per shot and the shots run in parallel.

Properties

  • Two-way propagation. RTM uses the full wave equation, so it has no dip limit, and it images with turning waves and prism waves.
  • Exact adjoint. In this discrete form the image is the exact transpose of Born modeling, the property that least-squares migration and the adjoint-state method need.
  • Not an inverse. The adjoint does not undo the wavelet, the illumination or the finite aperture; amplitudes are not reflection coefficients.
  • Low-frequency artifacts. Waves reflected from sharp contrasts in the background correlate with the source field along their whole path and give strong low-wavenumber noise, especially near the source.
  • Edge reflections. Dirichlet edges, as in the test, reflect waves back into the grid. Production codes surround the grid with a perfectly matched layer that absorbs them.

Variants and improvements

  • Absorbing boundaries. A perfectly matched layer on all sides except the free surface removes edge reflections. The adjoint of the absorbing scheme must be used for the backward run to keep exact adjointness.
  • Higher-order stencils. Spatial stencils of order 8 to 16 allow fewer grid points per wavelength, which reduces the cost in 3D.
  • Laplacian filtering. Applying a Laplacian to the image, or separating the fields into up-going and down-going parts before the correlation, reduces the low-frequency artifacts.
  • Source field reconstruction. Store only the boundary values of the source field and run it backward together with the receiver field, which cuts the memory to O(sg)O(s\sqrt{g}) in 2D, when the scheme has no absorption.
  • Extended imaging conditions. Correlate with a space or time lag to build gathers for velocity analysis; see imaging condition.
  • Elastic and anisotropic RTM. Use the elastic or anisotropic wave equation for the two runs.

When to use it

Use RTM for complex geology with steep dips and strong lateral velocity contrasts, such as below salt, where Kirchhoff and one-way methods fail. It is the most expensive standard migration. For smooth media and moderate dips, one-way methods such as split-step Fourier migration cost much less. RTM is also the inner adjoint of least-squares migration and of the gradient of full-waveform inversion.

Pitfalls

  • A time step above the CFL bound. Choosing Δt\Delta t with vmax⁡Δt/h>1/2v_{\max}\Delta t/h > 1/\sqrt{2} makes both runs blow up. Check the bound with the largest velocity before line L1.
  • The wrong transpose. Applying ww after the Laplacian in line L4, as in the forward step, gives a field that is not the adjoint when mm varies, and the dot-product test fails. Apply ww before the Laplacian, as in line L4.
  • A time shift in the correlation. Pairing D2u0nD_2u_0^n instead of D2u0n−1D_2u_0^{n-1} with λn\lambda^n in line L6 shifts the image by one step and breaks exact adjointness.
  • Too few grid points per wavelength. The second-order stencil has numerical dispersion; with fewer than about 10 points per shortest wavelength the waves arrive late (a common rule of thumb).

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.

reverse_time_migration.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/reverse-time-migration/. The authors are listed in prov/Y8PCJ8.jsonl.
"""Reverse-time migration (RTM) of one shot as the exact adjoint of discrete Born modeling.

Conventions (the imaging and inverse problems pages):
- The 2D constant density acoustic wave equation m u_tt - Laplacian u = f with
  m = 1 / v^2 (s^2/m^2), u = 0 for t <= 0. A grid field is a list of rows,
  u[i][j] at depth z = i h and position x = j h.
- The scheme of second order in time and space, for n = 0 .. N - 1:
      u^{n+1} = 2 u^n - u^{n-1} + (dt^2 / m) (L u^n + f^n),  u^0 = u^{-1} = 0,
  with the 5-point Laplacian L and u = 0 outside the grid (Dirichlet edges,
  which reflect; a production code adds an absorbing layer). It is stable for
  v dt / h <= 1 / sqrt(2) (the CFL condition in 2D).
- Receivers record d^n = u^n at the grid points recs, for n = 0 .. N.
- Born modeling: with m = m0 + dm, the first order scattered field solves the
  same scheme with the source s^n = -dm * D2u0^n, where
  D2u0^n = (u0^{n+1} - 2 u0^n + u0^{n-1}) / dt^2 is the second time difference
  of the background field u0.
- RTM: propagate the receiver data backward in time with the transposed
  scheme (the adjoint field lam), and correlate it with D2u0 at zero lag:
      lam^n = R^T r^n + 2 lam^{n+1} + L ((dt^2 / m) lam^{n+1}) - lam^{n+2},
      image = - sum_n D2u0^{n-1} * (dt^2 / m) lam^n.
  This is the exact adjoint of born_modeling, so <B dm, r> = <dm, B^T r>.

Cost: O(N n^2) time per propagation for an n x n grid, and O(N n^2) memory to
store the background field (the main cost of RTM).
"""

import math


def laplacian(u, h):
    """The 5-point Laplacian with u = 0 outside the grid."""
    nz, nx = len(u), len(u[0])
    out = [[0.0] * nx for _ in range(nz)]
    c = 1.0 / (h * h)
    for i in range(nz):
        up = u[i - 1] if i > 0 else None
        dn = u[i + 1] if i < nz - 1 else None
        row = u[i]
        o = out[i]
        for j in range(nx):
            s = -4.0 * row[j]
            if j > 0:
                s += row[j - 1]
            if j < nx - 1:
                s += row[j + 1]
            if up is not None:
                s += up[j]
            if dn is not None:
                s += dn[j]
            o[j] = c * s
    return out


def zeros(nz, nx):
    return [[0.0] * nx for _ in range(nz)]


def propagate(m, src, nsteps, dt, h):
    """Run the scheme with the source field src(n) (a grid, or None for zero).

    Returns the list of the fields u^0 .. u^N and the list of D2u^0 .. D2u^{N-1}.
    """
    nz, nx = len(m), len(m[0])
    prev, cur = zeros(nz, nx), zeros(nz, nx)
    fields, d2 = [cur], []
    for n in range(nsteps):
        lap = laplacian(cur, h)
        f = src(n)
        acc = [[(lap[i][j] + (f[i][j] if f is not None else 0.0)) / m[i][j] for j in range(nx)] for i in range(nz)]
        nxt = [[2.0 * cur[i][j] - prev[i][j] + dt * dt * acc[i][j] for j in range(nx)] for i in range(nz)]
        d2.append(acc)
        fields.append(nxt)
        prev, cur = cur, nxt
    return fields, d2


def point_source(nz, nx, isrc, jsrc, wavelet, h):
    """The source function n -> grid with wavelet[n] / h^2 at one point (a discrete delta)."""
    def src(n):
        g = zeros(nz, nx)
        g[isrc][jsrc] = wavelet[n] / (h * h)
        return g
    return src


def background_field(m, isrc, jsrc, wavelet, dt, h):
    """The source wavefield u0 and its second time differences D2u0."""
    nz, nx = len(m), len(m[0])
    return propagate(m, point_source(nz, nx, isrc, jsrc, wavelet, h), len(wavelet), dt, h)


def born_modeling(dm, m, d2u0, recs, dt, h):
    """Linearized data: the scattered field at the receivers for the perturbation dm.

    Returns a list over n = 0 .. N of lists over the receivers.
    """
    nz, nx = len(m), len(m[0])

    def src(n):
        return [[-dm[i][j] * d2u0[n][i][j] for j in range(nx)] for i in range(nz)]

    fields, _ = propagate(m, src, len(d2u0), dt, h)
    return [[u[i][j] for (i, j) in recs] for u in fields]


def reverse_time_migration(data, m, d2u0, recs, dt, h):
    """The RTM image of one shot: the exact adjoint of born_modeling applied to data.

    data: a list over n = 0 .. N of lists over the receivers.
    """
    nz, nx = len(m), len(m[0])
    nsteps = len(d2u0)  # @line L1
    w = [[dt * dt / m[i][j] for j in range(nx)] for i in range(nz)]
    lam1, lam2 = zeros(nz, nx), zeros(nz, nx)  # @line L2
    image = zeros(nz, nx)
    for n in range(nsteps, 0, -1):  # @line L3
        wl = [[w[i][j] * lam1[i][j] for j in range(nx)] for i in range(nz)]
        lap = laplacian(wl, h)
        lam = [[2.0 * lam1[i][j] + lap[i][j] - lam2[i][j] for j in range(nx)] for i in range(nz)]  # @line L4
        for r, (i, j) in enumerate(recs):
            lam[i][j] += data[n][r]  # @line L5
        g = d2u0[n - 1]
        for i in range(nz):
            for j in range(nx):
                image[i][j] -= g[i][j] * w[i][j] * lam[i][j]  # @line L6
        lam1, lam2 = lam, lam1
    return image  # @line L7


def ricker(t, f0):
    """The Ricker wavelet (1 - 2 a) exp(-a) with a = (pi f0 t)^2, peak frequency f0."""
    a = (math.pi * f0 * t) ** 2
    return (1.0 - 2.0 * a) * math.exp(-a)
test_reverse_time_migration.py 68 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/reverse-time-migration/. The authors are listed in prov/Y8PCJ8.jsonl.
import random
import unittest

from reverse_time_migration import (
    background_field,
    born_modeling,
    laplacian,
    reverse_time_migration,
    ricker,
    zeros,
)

H, DT, V = 10.0, 0.002, 2000.0  # v dt / h = 0.4 < 1 / sqrt(2)


def setup(n, nsteps):
    m = [[1.0 / V ** 2] * n for _ in range(n)]
    wav = [ricker(k * DT - 0.06, 20.0) for k in range(nsteps)]
    _, d2 = background_field(m, 2, n // 2, wav, DT, H)
    recs = [(2, j) for j in range(n)]
    return m, d2, recs


class TestReverseTimeMigration(unittest.TestCase):
    def test_image_peaks_at_the_scatterer(self):
        n, nsteps = 32, 180
        m, d2, recs = setup(n, nsteps)
        dm = zeros(n, n)
        dm[18][12] = 0.2 / V ** 2
        data = born_modeling(dm, m, d2, recs, DT, H)
        img = reverse_time_migration(data, m, d2, recs, DT, H)
        # Rows near the source and receivers hold strong direct-wave artifacts; skip them.
        best = max((abs(img[i][j]), i, j) for i in range(5, n) for j in range(n))
        self.assertEqual(best[1:], (18, 12))
        self.assertGreater(img[18][12], 0.0)

    def test_adjoint_of_born_modeling(self):
        n, nsteps = 14, 50
        m, d2, recs = setup(n, nsteps)
        rng = random.Random(3)
        dm = [[rng.gauss(0.0, 1.0) / V ** 2 for _ in range(n)] for _ in range(n)]
        r = [[rng.gauss(0.0, 1.0) for _ in recs] for _ in range(nsteps + 1)]
        a = born_modeling(dm, m, d2, recs, DT, H)
        b = reverse_time_migration(r, m, d2, recs, DT, H)
        left = sum(a[k][q] * r[k][q] for k in range(nsteps + 1) for q in range(len(recs)))
        right = sum(dm[i][j] * b[i][j] for i in range(n) for j in range(n))
        self.assertLess(abs(left - right), 1e-10 * abs(left))

    def test_zero_data_gives_zero_image(self):
        n, nsteps = 8, 10
        m, d2, recs = setup(n, nsteps)
        img = reverse_time_migration([[0.0] * n for _ in range(nsteps + 1)], m, d2, recs, DT, H)
        self.assertEqual(max(abs(v) for row in img for v in row), 0.0)

    def test_laplacian_of_a_quadratic(self):
        # The 5-point Laplacian of x^2 + z^2 is 4 away from the edges.
        n = 6
        u = [[(i * H) ** 2 + (j * H) ** 2 for j in range(n)] for i in range(n)]
        lap = laplacian(u, H)
        for i in range(1, n - 1):
            for j in range(1, n - 1):
                self.assertAlmostEqual(lap[i][j], 4.0, places=9)


if __name__ == "__main__":
    unittest.main()

History

Claerbout (1971) stated the imaging principle: reflectors are where the down-going and up-going waves coincide in time. In 1983 three groups independently proposed migration by backward time propagation of the full wave equation: Baysal, Kosloff and Sherwood; McMechan; and Whitmore. Baysal, Kosloff and Sherwood migrated stacked data with the exploding reflector model. In the same years Lailly (1983) and Tarantola (1984) showed that the cross-correlation of a forward field and a backward-propagated residual is the gradient of a least-squares misfit, which tied RTM to the adjoint-state method. Prestack RTM became a standard industry tool for subsalt imaging once computers had enough memory and speed for 3D two-way propagation.

References

  1. Edip Baysal, Dan D. Kosloff and John W. C. Sherwood, Reverse time migration, Geophysics 48(11), 1983, 1514 to 1524, the backward time propagation of the full wave equation with the exploding reflector imaging condition
  2. George A. McMechan, Migration by extrapolation of time-dependent boundary values, Geophysical Prospecting 31(3), 1983, 413 to 420, the recorded data as a time-dependent boundary value, propagated backward in time
  3. N. Dan Whitmore, Iterative depth migration by backward time propagation, SEG Technical Program Expanded Abstracts, 1983, 382 to 385, depth migration by backward time propagation
  4. Jon F. Claerbout, Toward a unified theory of reflector mapping, Geophysics 36(3), 1971, 467 to 481, the imaging principle that reflectors exist where the downgoing and upgoing waves coincide in time

Where this leads

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.per_shot
  • a full proof of space.stored_source_field
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