Skip to content

Theory & Method

This page describes the mathematical foundations of the contour dynamics method as implemented in ContourDynamics.jl.

Contour Dynamics

Vortex Patches and Green's Functions

Consider a 2D inviscid flow with piecewise-constant potential vorticity (PV). The streamfunction ψ satisfies:

Lψ=q(x)

where L is the PV inversion operator (2 for Euler, 2Ld2 for QG). The solution is:

ψ(x)=G(|xx|)q(x)dA

For a single vortex patch with uniform PV jump q bounded by contour C, the velocity u=(ψy,ψx) can be converted from an area integral to a contour integral via Green's theorem:

u(x)=q4πClog|xx|2dx

This is the contour dynamics equation: the velocity at any point depends only on the boundary of the PV patch, not its interior.

Segment Integration

The contour is discretized into piecewise-linear segments connecting nodes {xj}. Each segment from a to b contributes:

vseg(x)=14π(ba)01log|xat(ba)|2dt

Euler Kernel

For the Euler kernel, this integral has a closed-form antiderivative. Projecting onto the segment's tangent and normal directions:

F(u)=ulog(u2+h2)2u+2|h|arctan(u/|h|)

where u is the tangential coordinate and h is the normal distance from x to the segment line. The segment velocity is:

vseg=14πt^[F(ua)F(ub)]

This is exact — no quadrature error.

QG Kernel

For the QG scalar kernel G(r)=12πK0(r/Ld) used in the contour integral, we use singular subtraction:

K0(r/Ld)=log(r)+[K0(r/Ld)+log(r)]smooth at r=0

The logarithmic singularity is handled by the exact Euler antiderivative. The smooth remainder K0(r/Ld)+log(r)log(2Ld)γ as r0 is integrated with 5-point Gauss-Legendre quadrature.

SQG Kernel

Surface quasi-geostrophic (SQG) dynamics replaces the Laplacian PV inversion with a fractional Laplacian:

(2)1/2ψ=θ

where θ is the surface buoyancy. The Green's function is G(r)=1/(2πr), and the contour integral becomes:

u(x)=12πCdx|xx|

The segment integral has a closed-form antiderivative:

F(u)=log(u+u2+heff2)=arcsinh(uheff2)+const

Unlike the Euler and QG kernels, the SQG velocity is singular at the contour boundary — the tangential component diverges logarithmically. A regularization δ>0 is required, replacing 1/r with 1/r2+δ2 so that heff2=h2+δ2. The segment velocity remains exact (no quadrature):

vseg=12πt^[F(ua)F(ub)]

Ewald Summation

Periodic Green's Functions

On a doubly-periodic domain [Lx,Lx)×[Ly,Ly), the Green's function includes contributions from all periodic images. Direct summation converges slowly, so we use Ewald splitting to decompose:

Gper(r)=Greal(r)+GFourier(r)

Real-Space Sum

Greal(r)=14πnE1(α2|rLn|2)

where E1 is the exponential integral, α=π/min(Lx,Ly) is the splitting parameter, and the sum runs over periodic images Ln=(2nLx,2mLy). The Gaussian damping ensures rapid convergence (typically 2 images suffice).

Fourier-Space Sum

GFourier(r)=1Ak0e|k|2/(4α2)|k|2cos(kr)

where A=4LxLy is the domain area. The Gaussian factor ek2/(4α2) ensures rapid convergence in Fourier space.

Singular Subtraction for Periodic Velocity

The periodic segment velocity uses the same singular-subtraction approach: the log singularity from the central image is handled by the exact unbounded Euler formula, and the smooth correction GperG is integrated with 3-point Gauss-Legendre quadrature.

QG Periodic Decomposition

For the QG kernel on a periodic domain, we decompose:

GQG,per=GEuler,per1Ak0κ2|k|2(|k|2+κ2)cos(kr)smooth QG correction

where κ=1/Ld. The Euler periodic part uses the full Ewald machinery, and the QG correction is a smooth, rapidly convergent (1/k4) Fourier series.

SQG Periodic Decomposition

For the SQG kernel G(r)=1/(2πr) on a periodic domain, the Ewald splitting decomposes the periodic sum of 1/r into:

n1|rLn|=nerfc(α|rLn|)|rLn|+2πAk0e|k|2/(4α2)|k|cos(kr)

The Fourier coefficients decay as 1/|k| (compared to 1/k2 for Euler), reflecting the fractional Laplacian's half-order nature.

The periodic segment velocity uses singular subtraction: the regularized unbounded SQG velocity (exact arcsinh antiderivative with δ>0) handles the 1/r singularity, and the smooth correction is integrated with 3-point Gauss-Legendre quadrature. The central-image correction erfc(αr)/r1/r2+δ2 is finite at all quadrature points since the evaluation distance r>0.

Contour Surgery

The Dritschel surgery algorithm (Dritschel, 1988) handles the topological changes that arise during long-time evolution.

Node Redistribution (Remeshing)

After each surgery pass, nodes are redistributed along each contour to maintain segment lengths between μ (minimum) and Δmax (maximum):

  1. Compute cumulative arc lengths along the contour

  2. Walk the perimeter, placing new nodes at arc-length intervals

  3. Short segments (<μ) are merged; long segments (>Δmax) are subdivided

Reconnection

When two contour segments approach within distance δ:

  • Same contour: the contour is split (pinched) into two daughter contours

  • Different contours with same PV: the contours are merged (stitched together)

Reconnection uses a spatial index (hash-map binned by δ-sized grid) for O(NlogC) candidate detection, where N is the total node count and C is the number of contours.

Filament Removal

After reconnection, contours with |A|<Amin (where A is the signed area) are removed. Spanning contours (which encode the periodic domain topology) are always preserved.

Surgery Parameters

ParameterSymbolDescription
deltaδProximity threshold for detecting close segments
muμMinimum segment length after remeshing
Delta_maxΔmaxMaximum segment length after remeshing
area_minAminMinimum contour area; smaller contours are removed
n_surgeryNumber of time steps between surgery passes

Typical choices: δμ, Δmax1040μ, Aminδ2.

Multi-Layer QG

For an N-layer QG system, the PV in each layer is coupled to the streamfunction via the coupling matrix C:

qi=jCijψj

The coupling matrix is diagonalized: C=PΛP1. Each eigenmode with eigenvalue λm evolves independently:

  • If |λm|0: barotropic mode — uses the Euler kernel

  • Otherwise: Ld(mode)=1/|λm| — uses a QG kernel

The velocity in physical layers is recovered by projecting back through the eigenvector matrix.

Time Integration

RK4

The classical 4th-order Runge-Kutta scheme advances all node positions simultaneously:

xn+1=xn+Δt6(k1+2k2+2k3+k4)

This is the recommended integrator for most applications.

Leapfrog with Robert-Asselin Filter

The leapfrog scheme is 2nd-order centred:

xn+1=xn1+2Δtu(xn)

A Robert-Asselin filter (ν=0.05 by default) damps the computational mode. The first step is bootstrapped with a 2nd-order midpoint (RK2) method.

References

Contour Dynamics and Surgery

  • Dritschel, D. G. (1988). Contour surgery: a topological reconnection scheme for extended integrations using contour dynamics. J. Comput. Phys., 77(1), 240-266. doi:10.1016/0021-9991(88)90165-9

  • Dritschel, D. G. (1989). Contour dynamics and contour surgery: numerical algorithms for extended, high-resolution modelling of vortex dynamics in two-dimensional, inviscid, incompressible flows. Comput. Phys. Rep., 10(3), 77-146. doi:10.1016/0167-7977(89)90004-X

  • Dritschel, D. G. & Ambaum, M. H. P. (1997). A contour-advective semi-Lagrangian numerical algorithm for simulating fine-scale conservative dynamical fields. Q. J. R. Meteorol. Soc., 123(540), 1097-1130. doi:10.1002/qj.49712354015

Surface Quasi-Geostrophic Dynamics

  • Held, I. M., Pierrehumbert, R. T., Garner, S. T. & Swanson, K. L. (1995). Surface quasi-geostrophic dynamics. J. Fluid Mech., 282, 1-20. doi:10.1017/S0022112095000012

  • Constantin, P., Majda, A. J. & Tabak, E. (1994). Formation of strong fronts in the 2-D quasigeostrophic thermal active scalar. Nonlinearity, 7(6), 1495-1533. doi:10.1088/0951-7715/7/6/001

  • Scott, R. K. & Dritschel, D. G. (2014). Numerical simulation of a self-similar cascade of filament instabilities in the surface quasigeostrophic system. Phys. Rev. Lett., 112, 144505. doi:10.1103/PhysRevLett.112.144505

  • Rodrigo, J. L. (2005). On the evolution of sharp fronts for the quasi-geostrophic equation. Comm. Pure Appl. Math., 58(6), 821-866. doi:10.1002/cpa.20059