Key Concepts

Core concepts for understanding QGYBJ+.jl — no code, just ideas.


What We Simulate

The ocean has two interacting components at very different scales:

Mesoscale Eddies

Scale: ~100 km
Timescale: Weeks to months
Description: Slow spinning vortices that contain most of the ocean's kinetic energy

Near-Inertial Waves

Scale: ~10 km
Timescale: ~17 hours
Description: Fast oscillations driven by wind, crucial for ocean mixing

QGYBJ+.jl simulates both components and their interactions: eddies refract waves, and waves feed energy back to the eddies.


The Two Main Variables

Streamfunction (ψ) — Eddies

The streamfunction describes the balanced (geostrophic) eddy flow:

  • High ψ = anticyclone (clockwise in Northern Hemisphere)
  • Low ψ = cyclone (counter-clockwise in Northern Hemisphere)
  • Velocities derived as: u = -∂ψ/∂y, v = ∂ψ/∂x
  • Vorticity: ζ = ∇²ψ (positive = cyclonic, negative = anticyclonic)

Wave Envelope (L⁺A) — Waves

The wave envelope captures wave energy without tracking fast oscillations:

  • Complex-valued: L⁺A = (L⁺A)ᵣ + i·(L⁺A)ᵢ
  • Related to physical wave amplitude via: L⁺A = L⁺(A) where L⁺ = L - k_h²/4
  • Evolves on the slow (eddy) timescale
  • The code uses the Unicode variable name L⁺A for mathematical clarity

Wave-Eddy Interaction

Three key processes govern how waves and eddies interact:

ProcessWhat HappensPhysical Effect
AdvectionJ(ψ, L⁺A)Waves are carried by the eddy velocity field
Refraction½ζ(L⁺A)Waves bend toward regions of negative vorticity
Dispersionik²AWaves spread horizontally over time
Wave Trapping

The effective wave frequency is f_eff = f₀ + ζ/2. In anticyclones where ζ < 0, waves slow down and get trapped — this is a key mechanism for wave energy concentration.


L⁺A vs A: Why Two Wave Variables?

We evolve L⁺A (mathematically convenient) but diagnose A (physically meaningful):

\[L^+A = \frac{\partial}{\partial z}\left[\frac{f_0^2}{N^2}\frac{\partial A}{\partial z}\right] - \frac{k^2}{4}A\]

VariableRoleWhy We Need It
L⁺APrognostic (evolved)Simpler time-stepping equations
ADiagnostic (computed)Represents physical wave amplitude
LADerivedWave velocity amplitude: LA = L⁺A + (k_h²/4)A, used for wave kinetic energy

Coordinate System

Spatial Coordinates

  • Horizontal: x (east), y (north) — doubly periodic domain
  • Vertical: z = 0 at surface, z = -Lz at bottom

Spectral vs Physical Space

  • Derivatives computed in spectral space (fast, accurate)
  • Nonlinear products computed in physical space (avoid aliasing)
  • Transform between spaces using FFT

Time Stepping Options

MethodSpeedBest ForHow It Works
LeapfrogStandardGeneral useExplicit, simple, stable
IMEX-CN10× fasterWave-dominatedTreats fast dispersion implicitly
Choosing a Method

Use IMEX-CN when wave dispersion limits your timestep. Leapfrog is simpler and sufficient when eddies dominate.


Quick Glossary

SymbolNameMeaning
ψStreamfunctionDescribes eddy flow
qPotential vorticityConserved quantity for eddies
L⁺AWave envelopeEvolved wave variable (YBJ+)
AWave amplitudePhysical wave amplitude (diagnostic)
LAWave velocity amplitudeLA = L⁺A + (k_h²/4)A, used for energy
ζRelative vorticity∇²ψ, measures rotation
f₀Coriolis parameterEarth's rotation effect
NBuoyancy frequencyStratification strength
Lx, LyDomain sizeHorizontal extent
LzDomain depthVertical extent

Next Steps

Quick Start — Run your first simulation
Physics Overview — See the full equations