Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    A scalar wave packet can keep almost exactly the right energy while arriving with the wrong phase. Conversely, refining the time step cannot repair a boundary condition that reflects part of a massive wave even in the continuum. To understand a field evolution, we must distinguish the time integrator, spatial dispersion and boundary model.

    We evolve one real Klein–Gordon packet with velocity Verlet and implicit midpoint, compare both with exact evolution of the same spatial grid, and then test the spatial and boundary errors separately.

    Preparation: Hamiltonian evolution of a harmonic oscillator, finite differences and Fourier differentiation. All variables in the numerical example are dimensionless.

    A spatial grid is already a dynamical model

    With the mostly-minus convention, a free scalar of mass μ>0\mu>0 obeys

    ∂t2ϕ=∂x2ϕ−μ2ϕ.\partial_t^2\phi=\partial_x^2\phi-\mu^2\phi.

    Set π=∂tϕ\pi=\partial_t\phi and use NN periodic points with spacing h=L/Nh=L/N. Centered differences give

    q˙=p,p˙=−Khq,(Khq)j=μ2qj+2qj−qj+1−qj−1h2.\dot q=p,\qquad \dot p=-K_hq, \qquad (K_hq)_j=\mu^2q_j+\frac{2q_j-q_{j+1}-q_{j-1}}{h^2}.

    Indices are periodic. The positive quadratic energy is

    Hh=h2∑j[pj2+μ2qj2+(qj+1−qj)2h2].H_h=\frac h2\sum_j\left[ p_j^2+\mu^2q_j^2+\frac{(q_{j+1}-q_j)^2}{h^2} \right].

    Here pj=ϕ˙jp_j=\dot\phi_j is the sampled momentum density: its Poisson bracket is {qj,pk}=δjk/h\{q_j,p_k\}=\delta_{jk}/h. Equivalently, the canonical site momentum is Pj=hpjP_j=hp_j, with {qj,Pk}=δjk\{q_j,P_k\}=\delta_{jk}. With this normalization, HhH_h generates exactly the displayed equations. The constant momentum rescaling also preserves the stated symplectic character of the time maps.

    This is the Hamiltonian of the chosen spatial discretization. For a Fourier mode with wave number k=2πn/Lk=2\pi n/L,

    ωh(k)2=μ2+4h2sin⁡2kh2.\omega_h(k)^2=\mu^2+\frac4{h^2}\sin^2\frac{kh}{2}.

    The assumption μ>0\mu>0 makes HhH_h positive definite and all mode frequencies nonzero. A massless periodic zero mode instead needs the limit q0(t)=q0(0)+tp0(0)q_0(t)=q_0(0)+t p_0(0) in the formulas below. For the massive modes, the grid frequency differs from the continuum frequency ω(k)=μ2+k2\omega(k)=\sqrt{\mu^2+k^2}. At fixed resolved kk,

    ωh2=μ2+k2−h2k412+O(h4).\omega_h^2=\mu^2+k^2-\frac{h^2k^4}{12}+O(h^4).

    Thus even exact integration of the spatial grid accumulates a phase error relative to the continuum. It is useful to retain an exact semidiscrete reference:

    q^(t)=q^(0)cos⁡(ωht)+p^(0)ωhsin⁡(ωht),p^(t)=p^(0)cos⁡(ωht)−ωhq^(0)sin⁡(ωht).\begin{aligned} \widehat q(t)&=\widehat q(0)\cos(\omega_ht) +\frac{\widehat p(0)}{\omega_h}\sin(\omega_ht),\\ \widehat p(t)&=\widehat p(0)\cos(\omega_ht) -\omega_h\widehat q(0)\sin(\omega_ht). \end{aligned}

    Here hats denote spatial Fourier coefficients. This reference isolates time-step error without changing the initial arrays or the spatial operator.

    Two second-order time integrators

    Velocity Verlet is a kick, drift and kick:

    pn+1/2=pn−Δt2Khqn,qn+1=qn+Δt pn+1/2,pn+1=pn+1/2−Δt2Khqn+1.\begin{aligned} p^{n+1/2}&=p^n-\frac{\Delta t}{2}K_hq^n,\\ q^{n+1}&=q^n+\Delta t\,p^{n+1/2},\\ p^{n+1}&=p^{n+1/2}-\frac{\Delta t}{2}K_hq^{n+1}. \end{aligned}

    It is explicit, reversible and symplectic for this Hamiltonian. Its structure and relation to splitting are discussed in Hairer, Lubich and Wanner, Sections 1.1–1.5, pp. 400–404 (PDF). Symplectic does not mean that the original energy is conserved exactly.

    Implicit midpoint instead uses

    qn+1−qnΔt=pn+1+pn2,pn+1−pnΔt=−Khqn+1+qn2.\begin{aligned} \frac{q^{n+1}-q^n}{\Delta t} &=\frac{p^{n+1}+p^n}{2},\\ \frac{p^{n+1}-p^n}{\Delta t} &=-K_h\frac{q^{n+1}+q^n}{2}. \end{aligned}

    Eliminating the new momentum gives an actual linear solve,

    (I+Δt24Kh)qn+1=(I−Δt24Kh)qn+Δt pn.\left(I+\frac{\Delta t^2}{4}K_h\right)q^{n+1} =\left(I-\frac{\Delta t^2}{4}K_h\right)q^n+\Delta t\,p^n.

    Then update pn+1p^{n+1} using the second midpoint equation. The companion solves the cyclic positive matrix by Fourier diagonalization at each step. This Cayley update is not the exact cosine/sine propagator above.

    For a nonlinear field equation, midpoint generally requires a nonlinear solve, whose residual becomes another error source. Our linear model avoids that extra uncertainty so that the two time maps can be tested directly.

    Stability and phase from one oscillator

    Consider one spatial mode with frequency ωh\omega_h. In (q,p)(q,p) order, Verlet has propagation matrix

    V=(1−12aΔt−Δt ωh2(1−a/4)1−12a),a=Δt2ωh2.V= \begin{pmatrix} 1-\frac12a & \Delta t\\ -\Delta t\,\omega_h^2(1-a/4)&1-\frac12a \end{pmatrix}, \qquad a=\Delta t^2\omega_h^2.

    Its determinant is one and its eigenvalues are e±iθVe^{\pm i\theta_V} when

    Δt ωh<2,θV=2arcsin⁡Δt ωh2.\Delta t\,\omega_h<2,\qquad \theta_V=2\arcsin\frac{\Delta t\,\omega_h}{2}.

    At the endpoint 22 the repeated eigenvalue can have a Jordan block, so bounded generic evolution requires the strict inequality. Apply this condition to the largest grid frequency, not just the carrier of the packet:

    Δt<2μ2+4/h2.\Delta t<\frac{2}{\sqrt{\mu^2+4/h^2}}.

    The harmonic-oscillator example in Hairer, Lubich and Wanner, Example 3.4, pp. 417–418 (PDF) makes the distinction between energy and amplification explicit.

    Verlet preserves the modified quadratic form

    H~mode=12[p2+ωh2(1−Δt2ωh24)q2],\widetilde H_{\mathrm{mode}} =\frac12\left[p^2+ \omega_h^2\left(1-\frac{\Delta t^2\omega_h^2}{4}\right)q^2\right],

    which is positive in the stable range. The physical oscillator energy generally oscillates. Midpoint preserves the original quadratic energy, but advances each mode through

    θM=2arctan⁡Δt ωh2.\theta_M=2\arctan\frac{\Delta t\,\omega_h}{2}.

    Therefore

    θVΔt=ωh+Δt2ωh324+O(Δt4),θMΔt=ωh−Δt2ωh312+O(Δt4).\frac{\theta_V}{\Delta t} =\omega_h+\frac{\Delta t^2\omega_h^3}{24}+O(\Delta t^4), \qquad \frac{\theta_M}{\Delta t} =\omega_h-\frac{\Delta t^2\omega_h^3}{12}+O(\Delta t^4).

    Verlet runs ahead and midpoint lags. Both have second-order phase errors even though their energy behavior differs.

    Implicit stability is not itself an accuracy guarantee. For comparison, forward Euler has amplification modulus 1+Δt2ωh2>1\sqrt{1+\Delta t^2\omega_h^2}>1 for an oscillator; backward Euler has modulus 1/1+Δt2ωh2<11/\sqrt{1+\Delta t^2\omega_h^2}<1 and damps it. Midpoint avoids that artificial damping for this linear problem, but its phase still needs refinement.

    A packet with fully specified initial data

    Use μ=2\mu=2, L=40L=40, N=256N=256 and final time T=20T=20. The packet is specified through continuum Fourier-series data before any time stepping:

    kn=2πnL,AL(k)=2πσLexp⁡ ⁣[−σ2(k−k0)22]e−ikx0,ϕ(x,0)=Re⁡∑nAL(kn)eiknx,π(x,0)=Re⁡∑n[−iω(kn)]AL(kn)eiknx,\begin{aligned} k_n&=\frac{2\pi n}{L},\\ A_L(k)&=\frac{\sqrt{2\pi}\sigma}{L} \exp\!\left[-\frac{\sigma^2(k-k_0)^2}{2}\right]e^{-ikx_0},\\ \phi(x,0)&=\operatorname{Re}\sum_n A_L(k_n)e^{ik_nx},\\ \pi(x,0)&=\operatorname{Re}\sum_n[-i\omega(k_n)]A_L(k_n)e^{ik_nx}, \end{aligned}

    with σ=2\sigma=2, k0=1.5k_0=1.5 and x0=0x_0=0. The initial field is a periodized Gaussian carrier. The frequency prescription fixes its initial momentum and makes it predominantly right-moving; the Gaussian has a small negative-wave-number tail, so it is not an exactly one-directional compact packet.

    The sampled initial arrays are identical for both time integrators and their semidiscrete reference. In particular, the continuum ω(k)\omega(k) used to prepare π\pi is not silently replaced by ωh(k)\omega_h(k) in one comparison.

    Measure the relative state distance by

    dH(t)=[Hh(qnum−qref,pnum−pref)Hh(q(0),p(0))]1/2.d_H(t)= \left[ \frac{H_h(q_{\mathrm{num}}-q_{\mathrm{ref}}, p_{\mathrm{num}}-p_{\mathrm{ref}})} {H_h(q(0),p(0))} \right]^{1/2}.

    For the resolved positive mode nearest k0k_0, also follow the phase of zk=ωhq^k+ip^kz_k=\omega_h\widehat q_k+i\widehat p_k. Exact semidiscrete evolution rotates this quantity as e−iωhte^{-i\omega_ht}. The driver unwraps numerical and reference phases along the actual step histories before taking their difference.

    MethodΔt\Delta tdH(T)d_H(T)Maximum relative energy errorPhase difference at TT
    Verlet0.10.10.14660.14661.56×10−41.56\times10^{-4}−0.1377-0.1377
    Verlet0.050.050.036460.036461.31×10−51.31\times10^{-5}−0.03423-0.03423
    Verlet0.0250.0250.0091030.0091031.70×10−61.70\times10^{-6}−0.008546-0.008546
    Verlet0.01250.01250.0022750.0022753.25×10−73.25\times10^{-7}−0.002136-0.002136
    Midpoint0.10.10.28660.28663.46×10−153.46\times10^{-15}+0.2707+0.2707
    Midpoint0.050.050.072510.072511.89×10−141.89\times10^{-14}+0.06817+0.06817
    Midpoint0.0250.0250.018170.018172.68×10−152.68\times10^{-15}+0.01707+0.01707
    Midpoint0.01250.01250.0045450.0045451.16×10−131.16\times10^{-13}+0.004270+0.004270

    The phase differences are in radians. All maxima are over the actual retained integration-step grids, not rigorous suprema over continuous time. The state and phase errors decrease by approximately four when the time step is halved. The energy error also depends on the initial state.

    Time-step convergence of the Klein–Gordon state error, next to opposite accumulated phase errors for Verlet and midpoint at time step 0.05.

    Both methods evolve the same L=40L=40, N=256N=256, μ=2\mu=2 spatial Hamiltonian and initial packet. Left: state error at T=20T=20 against exact semidiscrete evolution. Right: phase histories at Δt=0.05\Delta t=0.05, unwrapped on all steps and displayed every 0.10.1 time unit. Midpoint's nearly exact energy does not eliminate its phase lag.

    A deliberate unstable-mode test uses qj=(−1)jq_j=(-1)^j, pj=0p_j=0 and Δt=0.16\Delta t=0.16. Then Δt ωmax⁡=2.07285>2\Delta t\,\omega_{\max}=2.07285>2. After twenty Verlet steps the field amplitude has grown from 11 to 2.3637×1042.3637\times10^4, agreeing with the exact 2×22\times2 amplification-matrix prediction to relative 4.03×10−154.03\times10^{-15}. The unstable mode is explicitly present in the initial data; this test does not depend on roundoff accidentally exciting it.

    Spatial and periodic-domain errors

    Next eliminate time-step error by using exact semidiscrete evolution. Compare with the continuum periodic Fourier solution at the same L=40L=40 and T=20T=20:

    Spatial points NNhhRelative state difference
    1281280.31250.31250.28810.2881
    2562560.156250.156250.073570.07357
    5125120.0781250.0781250.018450.01845
    102410240.03906250.03906250.0046150.004615

    The difference again decreases at second order, now for a spatial reason. The independently refined continuum Fourier cutoff changes the reference by less than 3×10−163\times10^{-16} in the sampled field and momentum; initial Fourier-truncation differences are below 5×10−155\times10^{-15}. At the primary N=256N=256, reducing Δt\Delta t far enough leaves a spatial error near 0.0740.074 relative to this continuum solution.

    Finally use continuum Fourier evolution to vary the periodic length itself. On the common observation window [−8,8][-8,8], the maximum field differences from a length-320320 reference are:

    Periodic lengthAt t=0t=0At t=20t=20
    20201.01×10−81.01\times10^{-8}0.77460.7746
    40404.44×10−164.44\times10^{-16}3.27×10−133.27\times10^{-13}
    80803.33×10−163.33\times10^{-16}1.61×10−151.61\times10^{-15}

    Lengths 160160 and 320320 differ by less than 2.5×10−152.5\times10^{-15} in the sampled field and momentum. Changing the periodic length also changes the initial periodization, which is why its t=0t=0 effect is recorded. These are finite-window, finite-time checks of periodic images. They do not establish an outgoing boundary condition or accuracy at all later times.

    A massive wave reflects from a simple Sommerfeld boundary

    A separate stationary calculation isolates an outgoing-boundary approximation. Put the right boundary at x=0x=0 and write an incident and reflected monochromatic wave as

    ϕ=Re⁡[e−iωt(eikx+Re−ikx)],ω2=k2+μ2,k>0.\phi=\operatorname{Re}\left[ e^{-i\omega t}(e^{ikx}+\mathcal R e^{-ikx})\right], \qquad \omega^2=k^2+\mu^2,\quad k>0.

    Imposing (∂t+∂x)ϕ=0(\partial_t+\partial_x)\phi=0 gives

    R=k−ωk+ω.\mathcal R=\frac{k-\omega}{k+\omega}.

    This local condition is exactly transparent for the massless right-moving wave, but not for a massive one. At μ=2\mu=2, k=1.5k=1.5, ω=2.5\omega=2.5, the reflection amplitude is −1/4-1/4 and the reflected-to-incident energy-flux ratio is ∣R∣2=1/16|\mathcal R|^2=1/16.

    The companion also discretizes the boundary derivative:

    D−q0=3q0−4q−1+q−22h.D_-q_0=\frac{3q_0-4q_{-1}+q_{-2}}{2h}.

    For fixed ω=2.5\omega=2.5, use the interior difference dispersion to set

    kh=2harcsin⁡ ⁣(h2ω2−μ2).k_h=\frac2h\arcsin\!\left(\frac h2\sqrt{\omega^2-\mu^2}\right).

    Applying D−D_- to the incident and reflected exponentials and solving the complex boundary equation gives reflected energy fractions 0.051280.05128, 0.059480.05948, 0.061730.06173, 0.062310.06231 at h=0.25,0.125,0.0625,0.03125h=0.25,0.125,0.0625,0.03125. They approach 0.06250.0625, not zero. Refinement removes the boundary discretization error while preserving the continuum error of the chosen boundary model.

    This monochromatic test is separate from the periodic packet evolution. It neither implements a broadband transparent boundary nor certifies one. For a general packet, the correct massive outgoing relation is frequency dependent, and a useful approximation must be checked over its occupied band.

    Holding the continuum Hamiltonian fixed above separated the time step from the spatial grid. If the Hamiltonian itself comes from fitted trajectories, a third error enters. Conserved quantities in learned dynamics varies the step for a fixed fitted model before measuring the physical phase drift.

    Summary

    The spatial Hamiltonian provides an exact reference for isolating time-step error. Verlet has a frequency-dependent stability limit and bounded energy oscillations in its stable range; midpoint preserves the linear quadratic energy but still accumulates phase error. Separate spatial and domain refinements, followed by a distinct boundary-model test, explain which approximation must change to improve a field trajectory.

    Exercises

    1. Conserved energy with an inaccurate phase

    Derive the two numerical mode phases. Show directly that midpoint preserves H=(p2+ω2q2)/2H=(p^2+\omega^2q^2)/2, and that Verlet preserves the modified quadratic form above. Why do these identities not establish small error at arbitrarily long time?

    Solution

    For Verlet, det⁡V=1\det V=1 and tr⁡V=2−Δt2ω2\operatorname{tr}V=2-\Delta t^2\omega^2. Writing its stable eigenvalues as e±iθe^{\pm i\theta} gives

    cos⁡θ=1−Δt2ω22,θ=2arcsin⁡(Δt ω/2).\cos\theta=1-\frac{\Delta t^2\omega^2}{2}, \qquad \theta=2\arcsin(\Delta t\,\omega/2).

    Direct multiplication gives VTM~V=M~V^{\mathsf T}\widetilde MV=\widetilde M with M~=diag⁡(ω2[1−Δt2ω2/4],1)\widetilde M=\operatorname{diag}(\omega^2[1-\Delta t^2\omega^2/4],1).

    For midpoint, put

    A=(01−ω20),C=(I−Δt A/2)−1(I+Δt A/2).A=\begin{pmatrix}0&1\\-\omega^2&0\end{pmatrix}, \qquad C=(I-\Delta t\,A/2)^{-1}(I+\Delta t\,A/2).

    The eigenvalues of AA are ±iω\pm i\omega, so the eigenvalues of CC are (1±iΔt ω/2)/(1∓iΔt ω/2)(1\pm i\Delta t\,\omega/2)/(1\mp i\Delta t\,\omega/2), with phase θ=2arctan⁡(Δt ω/2)\theta=2\arctan(\Delta t\,\omega/2). Also ATM+MA=0A^{\mathsf T}M+MA=0 for M=diag⁡(ω2,1)M=\operatorname{diag}(\omega^2,1), which implies CTMC=MC^{\mathsf T}MC=M.

    Equivalently, subtract the old and new energies and use the midpoint equations:

    Hn+1−Hn=pˉ(pn+1−pn)+ω2qˉ(qn+1−qn)=−Δt ω2pˉqˉ+Δt ω2qˉpˉ=0.H_{n+1}-H_n =\bar p(p_{n+1}-p_n)+\omega^2\bar q(q_{n+1}-q_n) =-\Delta t\,\omega^2\bar p\bar q +\Delta t\,\omega^2\bar q\bar p=0.

    Here bars mean the arithmetic average across a step. Neither quadratic identity fixes the rotation angle to ωΔt\omega\Delta t. The frequency error is O(Δt2)O(\Delta t^2) and can accumulate an O(TΔt2)O(T\Delta t^2) phase difference. A trajectory can stay on the correct energy ellipse while reaching the wrong point on it.

    2. Refining an imperfect outgoing condition

    Derive the Sommerfeld reflection coefficient for a massive plane wave. Compute its high-frequency behavior and explain the nonzero limiting reflection in the numerical boundary scan.

    Solution

    At the boundary,

    (∂t+∂x)e−iωt(eikx+Re−ikx)=ie−iωt[(k−ω)−(k+ω)R].(\partial_t+\partial_x) e^{-i\omega t}(e^{ikx}+\mathcal R e^{-ikx}) =i e^{-i\omega t} \left[(k-\omega)-(k+\omega)\mathcal R\right].

    Setting this to zero gives R=(k−ω)/(k+ω)\mathcal R=(k-\omega)/(k+\omega). Since ω2−k2=μ2\omega^2-k^2=\mu^2,

    R=−μ2(k+ω)2=−μ24k2+O(k−4).\mathcal R=-\frac{\mu^2}{(k+\omega)^2} =-\frac{\mu^2}{4k^2}+O(k^{-4}).

    The two waves have equal frequency and equal magnitude of group velocity, so the reflected energy fraction is ∣R∣2|\mathcal R|^2. It vanishes for μ=0\mu=0 and becomes small when k≫μk\gg\mu, but at k=1.5,μ=2k=1.5,\mu=2 it equals 1/161/16.

    The backward derivative converges to ∂x\partial_x, and the difference dispersion converges to the continuum dispersion. Their reflection coefficient must therefore approach this nonzero continuum value. More points or smaller time steps cannot change the boundary condition being approximated. One must improve the boundary model, move the boundary outside the relevant propagation region, or explicitly tolerate and quantify the reflected component.

    References

    • E. Hairer, C. Lubich and G. Wanner, “Geometric Numerical Integration Illustrated by the Störmer–Verlet Method,” Acta Numerica 12 (2003), 399–450, DOI: 10.1017/S0962492902000144. Consulted Sections 1.1–1.5, pp. 400–404, and Example 3.4, pp. 417–418, in the published paper (PDF). The midpoint and massive-boundary formulas used here are derived explicitly above.

    Scrollable formula. Use Left and Right arrow keys to reveal hidden content.

    Scrollable table. Use Left and Right arrow keys to reveal hidden columns.

    Scrollable figure. Use Left and Right arrow keys to reveal hidden content.