Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Finite-volume advection

Part 5.3: Finite Volume Advection on a Staggered Grid

Staggered grids (Arakawa C-grid) place velocities at cell faces and scalars at cell centers. Coordax’s distinct named axes prevent accidental mixing of the two grids.

Staggered Grid Configuration

T-grid (centers):  |--T--|--T--|--T--|
U-grid (int faces):    |--U--|--U--|

U[i] lies between T[i] and T[i+1].

T-grid: 16 × 32  (lat × lon_centers)
U-grid: 16 × 31  (lat × lon_faces)

T-axis: 'longitude', len=32
U-axis: 'longitude_u', len=31
✓ Distinct coordinate systems prevent accidental mixing!

Temperature Field (T-grid, cell centers)

T field: ('latitude', 'longitude'), shape: (16, 32)
T range: 294.2 — 323.9 K

Velocity Field (U-grid, cell faces)

U field: ('latitude', 'longitude_u'), shape: (16, 31)
U range: 0.0 — 26.0 m/s

✓ T: ('latitude', 'longitude')
✓ U: ('latitude', 'longitude_u')  ← different coordinate system!

Interpolate Temperature from T-grid to U-grid

Centered average of adjacent cell centers.

T at U-points: ('latitude', 'longitude_u'), shape: (16, 31)
Interpolation error (mean): 3.81e-02 K

Advective Flux: Centered Scheme

Centered flux: ('latitude', 'longitude_u'), shape: (16, 31)
Flux range: 0.0 — 8040.9 K·m/s

Advective Flux: Upwind Scheme

Upwind flux: ('latitude', 'longitude_u'), shape: (16, 31)
Max |upwind - centered|: 31.8 K·m/s

Flux Divergence: Faces → Interior Centers

Delta-flux (interior centers): ('latitude', 'longitude'), shape: (16, 30)

Temperature Tendency ∂T/∂t

∂T/∂t: ('latitude', 'longitude'), shape: (16, 30)
Range: -1.19e-03 — 1.22e-03 K/s
Max heating: 4.38 K/h

Forward Euler Time Step

CFL = 0.008  (must be < 1 for stability)
Updated T: ('latitude', 'longitude'), shape: (16, 32)
Updated T range: 294.2 — 323.9 K
Mass conservation: 1.87e-06 relative change

Complete One-Step Advection Function

Complete step — T: ('latitude', 'longitude'), shape: (16, 32)
T range: 294.2 — 323.9 K

Key Patterns Summary

  1. T-grid (longitude) and U-grid (longitude_u) are distinct coordinate systems
  2. Interpolation: T_face[i] = 0.5*(T[i] + T[i+1]) (centers → interior faces)
  3. Upwind flux: choose upstream value based on sign of velocity
  4. Flux divergence: F[i] - F[i-1] at interior centers
  5. Tendency: ∂T/∂t = -delta_F / dx; update T[:, 1:-1] only