Package extensions for DifferentialEquations.jl, Makie.jl, RecordedArrays.jl, and JLD2.jl — plug into the broader Julia ecosystem.
⚡
High Performance
StaticArrays for node positions, multi-threaded velocity and energy computation, O(log C) spatial indexing for surgery, and zero-allocation time stepping.
using ContourDynamics# Create a circular vortex patch and set up the problemprob = Problem(; contours=[circular_patch(1.0, 128, 2π)], dt=0.01)# Evolve with RK4 + surgeryevolve!(prob; nsteps=1000)# Check conserved quantitiesprintln("Energy: $(energy(prob))")println("Circulation: $(circulation(prob))")
GPU Acceleration
Pass dev=:gpu to run velocity computations on an NVIDIA GPU:
julia
using CUDAprob = Problem(; contours=[circular_patch(1.0, 128, 2π)], dt=0.01, dev=:gpu)
Contour dynamics is a Lagrangian numerical method for simulating inviscid, incompressible vortex flows. Instead of solving the vorticity equation on a grid, the method tracks the boundaries of uniform potential vorticity (PV) patches.
The key idea: for piecewise-constant PV distributions, the velocity at any point can be written as a boundary integral over the contour edges:
where is the Green's function ( for 2D Euler, for SQG, for QG). Each segment integral is computed analytically (Euler, SQG) or with high-order quadrature (QG), so the method introduces no numerical diffusion.
Contour surgery (Dritschel, 1988) extends this to long-time integrations by automatically handling topological changes — vortex mergers, contour splitting, and filament removal — that would otherwise cause the contour to develop unresolvable complexity.