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.
- Solves
- Seismic migration
- 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
- Model
- Real RAM
- Properties
- adjoint of born modelingdeterministiclinear in dataneeds cflno dip limittwo way
- Evidence
- Proof sketchCode in 1 languages
- 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 of one shot at the receivers and the time steps , and a smooth background model , compute the image of the model perturbation. The data are modeled by the constant-density acoustic equation . Linearizing about (the Born approximation) gives the scattered field that solves , where is the source field. RTM computes , the adjoint of the linear map at the receivers. This is seismic migration with the cross-correlation imaging condition.
The algorithm
The scheme is with , the 5-point Laplacian , and outside the grid. First run it with the source to get the source field and store its second time differences . Then run the transposed scheme backward with the data as the source.
REVERSE-TIME-MIGRATION(d, m, D2u0, receivers, Δt, h) ▷ D2u0[n]: stored, from the forward run- 1
N ← the number of time steps of the source field; w ← Δt² / m - 2
λ1 ← 0; λ2 ← 0; image ← 0 ▷ the adjoint field at the steps n + 1 and n + 2 - 3
for n ← N down to 1 do - 4
λ ← 2 λ1 + L(w · λ1) - λ2 ▷ the transposed scheme, run backward in time - 5
λ[r] ← λ[r] + d[n][r] for every receiver r ▷ inject the data - 6
image ← image - D2u0[n - 1] · w · λ; λ2 ← λ1; λ1 ← λ ▷ the imaging condition - 7
return image
Line L4 is the transpose of one forward step: the forward step applies after the Laplacian, so the transpose applies 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 the recursion of line L4 becomes , 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 m, ms and m/s, the CFL number is . The 2D bound for this scheme is , so the scheme is stable. Doubling to 4 ms gives 0.8, which is above the bound, and the fields grow without limit.
One scatterer. The test uses a 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 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 (a measurement on this case). The rows next to the source and the receivers hold strong artifacts from the direct wave.
Adjointness. For random and random data , and agree to a relative 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 , applied to .
- Exact adjoint (theorem). Write all time steps of the forward scheme as one block lower-triangular system . 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 , holds the adjoint field at step . So the returned image is for the discrete .
- The imaging condition (corollary). The image is , 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 , so it is stable exactly when the forward scheme is, under the CFL condition 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. is the 5-point Laplacian with zero values outside the grid; it is a real symmetric matrix. is the background squared slowness, , and samples a field at the receivers, so puts a receiver vector back at the receiver points. The background field solves the scheme
for , and is its second time difference (the array d2u0). Born modeling maps a perturbation to the data of the scheme
Dot products are the plain sums over all entries.
Lemma 1 (Born modeling is the exact derivative). Let be the receiver data of the scheme for as a function of . Then .
Proof. Differentiate the scheme in the direction , with the derivative of : , because does not depend on . Divide by : , with zero initial values. This is the Born scheme, and is linear.
So migration with the adjoint of 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 , the array returned at line L7 is
where and, for ,
So for all and .
Proof. Collect . The Born scheme is the block lower-triangular system , where
with and . has the identity on its block diagonal, so it is invertible. Its transpose is block upper triangular,
with , because ( symmetric, diagonal). So the recursion for is the solution of , solved from down to . Now, with ,
where the last step uses diagonal and .
It remains to match the code. Line L1 sets . Line L2 sets the two stored fields to . Loop invariant: at the start of the pass for at line L3, lam1 , lam2 , and image . It holds for . In the pass, line L4 computes and line L5 adds , so lam ; line L6 subtracts ; the shift of the stored fields gives the invariant for . The loop has passes, so it stops, and line L7 returns the sum for . The sample is not used, which is right because .
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 propagated backward in time, weighted by . This is the cross-correlation imaging condition applied to the data residual or to the data. For several shots, stacks the shot operators, so the adjoint is the sum of the shot images.
What is not claimed. is not the inverse of ; 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 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 ; with the backward recursion reads , which is the forward scheme run backward in time, so it is stable under the same condition.
Complexity
- Real-ram. Each propagation costs per grid point and time step, so one shot costs for the forward run, the same for the backward run, and the same for the correlation: in total.
- Memory. The imaging condition pairs the source field at step with the backward field at step , but the source field is computed forward and the backward field backward. Storing the source field costs memory, the main cost of RTM in 3D.
- Checkpointing. Storing the source field at checkpoints and recomputing between them cuts the memory to for one extra forward run; the logarithmic checkpointing schedules of automatic differentiation cut it further.
- Many shots. Shots are independent, so the cost is 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 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 with makes both runs blow up. Check the bound with the largest velocity before line L1.
- The wrong transpose. Applying after the Laplacian in line L4, as in the forward step, gives a field that is not the adjoint when varies, and the dot-product test fails. Apply before the Laplacian, as in line L4.
- A time shift in the correlation. Pairing instead of with 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.
# 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
- 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
- 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
- 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
- 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.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag Y8PCJ8 Edit this page History Report an error Markdown