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.

12. The projection method and the Taylor–Green vortex

School of Engineering, Nazarbayev University

In compressible gas dynamics (Euler’s equations), density ρ\rho obeys a hyperbolic continuity PDE and pressure follows algebraically from an equation of state p=p(ρ,e)p = p(\rho, e). Yet the moment we pass to the incompressible Navier–Stokes limit (Ma→0\mathrm{Ma} \to 0, ρ=const\rho = \mathrm{const}), ∂tρ\partial_t \rho vanishes and there is no explicit ∂tp\partial_t p evolution equation anywhere in the system. Instead, kinematic pressure p/ρp/\rho acts across the entire fluid domain as an elliptic Lagrange multiplier enforcing the solenoidal constraint ∇⋅u=0\nabla \cdot \mathbf{u} = 0. In 1968, Chorin introduced the fractional-step projection method, splitting each step into an unconstrained momentum predictor u∗\mathbf{u}^* followed by an orthogonal Helmholtz–Hodge projection onto divergence-free vector fields. In this lecture we derive Chorin’s projection, show why discrete Fourier wavenumbers must match the discrete central-difference stencil to reach ∥∇h⋅un+1∥∞<10−14\|\nabla_h \cdot \mathbf{u}^{n+1}\|_\infty < 10^{-14}, and verify O(Δx2)O(\Delta x^2) spatial accuracy and Ek(t)=Ek(0)e−4νtE_k(t) = E_k(0)e^{-4\nu t} dissipation against G. I. Taylor & A. E. Green’s (1937) exact unsteady vortex solution.

Learning objectives

  1. Explain why incompressible pressure lacks a ∂tp\partial_t p equation, acting as a Lagrange multiplier governed by the pressure Poisson equation ∇2p=−∇⋅[(u⋅∇)u]\nabla^2 p = -\nabla \cdot [(\mathbf{u}\cdot\nabla)\mathbf{u}] (for ρ=1\rho = 1).

  2. Verify the exact 2-D unsteady Taylor–Green decaying vortex (navier_stokes.taylor_green_vortex_exact), including exact cancellation (u⋅∇)u=−∇p(\mathbf{u}\cdot\nabla)\mathbf{u} = -\nabla p and viscous kinetic-energy decay Ek(t)=Ek(0)e−4νtE_k(t) = E_k(0)e^{-4\nu t}.

  3. Apply Helmholtz–Hodge decomposition in navier_stokes.taylor_green_projection_2d using modified discrete wavenumbers keff=sin⁡(kΔx)/Δxk_{\mathrm{eff}} = \sin(k\Delta x)/\Delta x to achieve machine-precision incompressibility ∥∇h⋅un+1∥∞<10−14\|\nabla_h \cdot \mathbf{u}^{n+1}\|_\infty < 10^{-14}.

  4. Confirm O(Δx2)O(\Delta x^2) spatial convergence and audit viscosity sensitivity across laminar Reynolds regimes.

Time: about 60 min

1. Principles and governing equations

For a constant-density Newtonian fluid (ρ=1\rho = 1 by kinematic normalization, p←p/ρp \leftarrow p/\rho), the 2-D incompressible Navier–Stokes equations couple momentum transport to the instantaneous kinematic divergence constraint:

∂u∂t+(u⋅∇)u=−∇p+ν∇2u,∇⋅u=0(1.1)\frac{\partial \mathbf{u}}{\partial t} + (\mathbf{u} \cdot \nabla)\mathbf{u} = -\nabla p + \nu \nabla^2 \mathbf{u}, \qquad \nabla \cdot \mathbf{u} = 0 \tag{1.1}

Why is incompressible flow numerically stiffer to couple than explicit compressible flow? Taking the divergence ∇⋅(⋅)\nabla \cdot (\cdot) of the momentum equation and enforcing ∇⋅(∂tu)=∂t(∇⋅u)=0\nabla \cdot (\partial_t \mathbf{u}) = \partial_t (\nabla \cdot \mathbf{u}) = 0 eliminates ν∇⋅(∇2u)=ν∇2(∇⋅u)=0\nu \nabla \cdot (\nabla^2 \mathbf{u}) = \nu \nabla^2(\nabla \cdot \mathbf{u}) = 0, yielding the elliptic Pressure Poisson Equation (PPE):

∇2p=−∇⋅[(u⋅∇)u]=2(∂u∂x∂v∂y−∂u∂y∂v∂x)(1.2)\nabla^2 p = -\nabla \cdot \left[(\mathbf{u} \cdot \nabla)\mathbf{u}\right] = 2\left(\frac{\partial u}{\partial x}\frac{\partial v}{\partial y} - \frac{\partial u}{\partial y}\frac{\partial v}{\partial x}\right) \tag{1.2}

Pressure therefore adjusts elliptically (infinite acoustic wave speed cs→∞c_s \to \infty) as the Lagrange multiplier that prevents convective self-advection (u⋅∇)u(\mathbf{u}\cdot\nabla)\mathbf{u} from compressing fluid elements.

1.1 Exact Benchmark: The 2-D Taylor–Green Decaying Vortex

On the doubly periodic square [0,2π)2[0, 2\pi)^2, Taylor & Green (1937) discovered a closed-form unsteady solution of the full nonlinear Navier–Stokes PDE (navier_stokes.taylor_green_vortex_exact) in which nonlinear advection (u⋅∇)u(\mathbf{u}\cdot\nabla)\mathbf{u} is purely irrotational and balances −∇p-\nabla p point-by-point, leaving pure viscous decay of velocity, vorticity ω=∂xv−∂yu\omega = \partial_x v - \partial_y u, and domain-averaged kinetic energy Ek(t)=12⟨u2+v2⟩E_k(t) = \frac{1}{2}\langle u^2 + v^2 \rangle:

u(x,y,t)=sin⁡xcos⁡y e−2νt,v(x,y,t)=−cos⁡xsin⁡y e−2νtp(x,y,t)=14(cos⁡2x+cos⁡2y)e−4νt,ω(x,y,t)=−2sin⁡xsin⁡y e−2νtEk(t)=14π2∬[0,2π)2u2+v22 dx dy=14e−4νt=Ek(0)e−4νt(1.3)\begin{aligned} u(x, y, t) &= \sin x \cos y \, e^{-2\nu t}, \qquad v(x, y, t) = -\cos x \sin y \, e^{-2\nu t} \\ p(x, y, t) &= \frac{1}{4}\left(\cos 2x + \cos 2y\right) e^{-4\nu t}, \qquad \omega(x, y, t) = -2\sin x \sin y \, e^{-2\nu t} \\ E_k(t) &= \frac{1}{4\pi^2}\iint_{[0,2\pi)^2} \frac{u^2 + v^2}{2}\,dx\,dy = \frac{1}{4}e^{-4\nu t} = E_k(0)e^{-4\nu t} \end{aligned} \tag{1.3}

Demonstration 1: Exact 2-D Taylor-Green Vortex — Advection-Pressure Balance & Kinetic Energy Decay
==================================================================================================
Max |(u.grad)u_x - (-dp/dx)| at t=0 : 2.220e-16
Initial kinetic energy E_k(0)       : 0.25000000 (exact 1/4 = 0.25000000)
E_k(0.5) / E_k(0)                   : 0.81873075 vs exp(-4*nu*t) = 0.81873075
Viscous dissipation -dE_k/dt|_{t=0}: 2*nu*Z(0) = 0.100000 == 4*nu*E_k(0) = 0.100000
<Figure size 1210x473 with 3 Axes>

Figure 12.1. The Taylor–Green vortex. (a) Velocity vectors and pressure at t=0t = 0. (b) Exact decay of the velocity amplitude and of the kinetic energy for ν=0.10\nu = 0.10.

What Demonstration 1 shows. Every vortex core (ω=±2\omega = \pm 2) sits at a pressure minimum (p=−1/2p = -1/2, centrifugal low-pressure eye), while stagnation points where counter-rotating streams collide sit at pressure maxima (p=+1/2p = +1/2). Because p∝ρ∣u∣2p \propto \rho |\mathbf{u}|^2, kinematic pressure and kinetic energy both decay as e−4νte^{-4\nu t}, twice as fast as velocity amplitude e−2νte^{-2\nu t}, satisfying the exact enstrophy dissipation balance dEkdt=−2νZ(t)\frac{dE_k}{dt} = -2\nu \mathcal{Z}(t).


2. Helmholtz–Hodge Decomposition & Chorin’s Projection Method

The Helmholtz–Hodge theorem states that any smooth vector field u∗\mathbf{u}^* on a periodic (or impermeable-wall) domain decomposes uniquely into a divergence-free (solenoidal) part un+1\mathbf{u}^{n+1} and a curl-free (irrotational) gradient Δt∇pn+1\Delta t \nabla p^{n+1}:

u∗=un+1+Δt∇pn+1,∇⋅un+1=0⟹⟨un+1,∇pn+1⟩L2=−⟨∇⋅un+1,pn+1⟩L2=0(2.1)\mathbf{u}^* = \mathbf{u}^{n+1} + \Delta t \nabla p^{n+1}, \qquad \nabla \cdot \mathbf{u}^{n+1} = 0 \quad \Longrightarrow \quad \langle \mathbf{u}^{n+1}, \nabla p^{n+1} \rangle_{L^2} = -\langle \nabla \cdot \mathbf{u}^{n+1}, p^{n+1} \rangle_{L^2} = 0 \tag{2.1}

Chorin’s fractional-step algorithm (navier_stokes.taylor_green_projection_2d) advances (un→un+1)(\mathbf{u}^n \to \mathbf{u}^{n+1}) in three stages:

  1. Advection–Diffusion Predictor (ignoring −∇p-\nabla p): u∗=un+Δt[−(un⋅∇h)un+ν∇h2un]\mathbf{u}^* = \mathbf{u}^n + \Delta t \left[-(\mathbf{u}^n \cdot \nabla_h)\mathbf{u}^n + \nu \nabla_h^2 \mathbf{u}^n\right].

  2. Pressure Poisson Solve: Taking ∇h⋅(⋅)\nabla_h \cdot (\cdot) of Eq. (2.1) requires ∇h⋅(∇hpn+1)=1Δt∇h⋅u∗\nabla_h \cdot (\nabla_h p^{n+1}) = \frac{1}{\Delta t}\nabla_h \cdot \mathbf{u}^*.

  3. Orthogonal Velocity Correction: un+1=u∗−Δt∇hpn+1\mathbf{u}^{n+1} = \mathbf{u}^* - \Delta t \nabla_h p^{n+1}.

2.1 Why Modified Discrete Wavenumbers Are Mandatory.

On a periodic collocated mesh of spacing Δx=2π/N\Delta x = 2\pi / N, applying central differences Dxfj=fj+1−fj−12ΔxD_x f_j = \frac{f_{j+1} - f_{j-1}}{2\Delta x} to a Fourier mode eikxxje^{i k_x x_j} multiplies by ikx,effi k_{x,\mathrm{eff}} where:

kx,eff=sin⁡(kxΔx)Δx,ky,eff=sin⁡(kyΔx)Δx,Dx(Dxp)+Dy(Dyp)^=−(kx,eff2+ky,eff2)p^(2.2)k_{x,\mathrm{eff}} = \frac{\sin(k_x \Delta x)}{\Delta x}, \qquad k_{y,\mathrm{eff}} = \frac{\sin(k_y \Delta x)}{\Delta x}, \qquad \widehat{D_x(D_x p) + D_y(D_y p)} = -\left(k_{x,\mathrm{eff}}^2 + k_{y,\mathrm{eff}}^2\right)\hat{p} \tag{2.2}

If you carelessly divide by the continuum symbol kx2+ky2k_x^2 + k_y^2 instead of keff2=kx,eff2+ky,eff2k_{\mathrm{eff}}^2 = k_{x,\mathrm{eff}}^2 + k_{y,\mathrm{eff}}^2, Dxun+1+Dyvn+1D_x u^{n+1} + D_y v^{n+1} fails to cancel Dxu∗+Dyv∗D_x u^* + D_y v^*, leaving an O(Δx2)O(\Delta x^2) divergence leak. Using keff2k_{\mathrm{eff}}^2 drives ∥∇h⋅un+1∥∞\|\nabla_h \cdot \mathbf{u}^{n+1}\|_\infty down to 10-15.


Demonstration 2: Chorin Fractional-Step Solver on [0, 2*pi)^2 — Machine-Zero Discrete Divergence
================================================================================================
Grid 48x48, t_end = 0.50 s:
  Max discrete divergence ||div_h(u)||_inf : 5.551e-16 (< 1e-14)
  Velocity L2 error ||u - u_exact||_2      : 5.5542e-05
  Pressure L2 error ||p - p_exact||_2      : 1.9820e-03
  Kinetic energy E_k(0.5): Chorin = 0.2047329 vs Exact = 0.2046827 (rel err = 2.46e-04)
<Figure size 1210x462 with 2 Axes>

Figure 12.2. Projection-method solution at t=0.50t = 0.50 s (symbols) and the analytical solution (lines). (a) Velocity components along two grid lines. (b) Pressure along y=0y = 0.

What Demonstration 2 shows. Starting with p = 0 and no initial pressure field whatsoever, Chorin’s FFT Poisson projection reconstructs the exact doubly harmonic pressure wave p(x,y,t)=14(cos⁡2x+cos⁡2y)e−4νtp(x, y, t) = \frac{1}{4}(\cos 2x + \cos 2y)e^{-4\nu t} purely from the divergence of the nonlinear convective predictor ∇h⋅u∗\nabla_h \cdot \mathbf{u}^*. Simultaneously, modified discrete wavenumbers enforce ∥∇h⋅un+1∥∞≈6×10−16\|\nabla_h \cdot \mathbf{u}^{n+1}\|_\infty \approx 6 \times 10^{-16}.


3. Spatial O(Δx2)O(\Delta x^2) Mesh-Refinement Verification

Because both central differences Dx,DyD_x, D_y and the 5-point discrete Laplacian ∇h2\nabla_h^2 have second-order truncation error O(Δx2)O(\Delta x^2), fixing a small time step Δt=5×10−4\Delta t = 5 \times 10^{-4} (so forward-Euler O(Δt)O(\Delta t) temporal error is small compared with spatial discretization error) must exhibit clean second-order spatial convergence EL2(Δx)∝Δx2E_{L_2}(\Delta x) \propto \Delta x^2 across N∈{16,32,64}N \in \{16, 32, 64\} (4×4\times error reduction per 2×2\times grid doubling).


Demonstration 3: Spatial O(dx^2) Convergence Study Across N = 16, 32, 64
========================================================================
  Grid N |   dx [rad] |  ||u - u_ex||_2 |  Observed Order p |  Max |div_h u|
----------------------------------------------------------------------------
      16 |    0.39270 |      2.4480e-04 |               --- |      2.220e-16
      32 |    0.19635 |      6.0706e-05 |             2.012 |      3.331e-16
      64 |    0.09817 |      1.4470e-05 |             2.069 |      6.661e-16
<Figure size 748x451 with 1 Axes>

Figure 12.3. L2L_2 error of the velocity against the grid spacing, with a line of slope 2.

What Demonstration 3 shows. Doubling grid resolution from 162→322→64216^2 \to 32^2 \to 64^2 cuts the L2L_2 velocity error by factors of 4.03×4.03\times (p=2.01p = 2.01) and 4.20×4.20\times (p=2.07p = 2.07), while discrete divergence remains below 10-14 on every mesh.


4. Sensitivity to the parameters

How does kinematic viscosity ν\nu (or Reynolds number Re=U0L0/ν=1/ν\mathrm{Re} = U_0 L_0 / \nu = 1/\nu for U0=1,L0=1U_0 = 1, L_0 = 1) control kinetic-energy dissipation in a decaying vortex array? We sweep ν∈{0.01,0.05,0.10,0.25}\nu \in \{0.01, 0.05, 0.10, 0.25\} (Re from 100 down to 4) at t=1.0 st = 1.0\text{ s} and verify that the logarithmic decay rate −1tln⁡ ⁣(Ek(t)Ek(0))=4ν-\frac{1}{t}\ln\!\left(\frac{E_k(t)}{E_k(0)}\right) = 4\nu scales strictly linearly with ν\nu.


Demonstration 4: Viscosity Sensitivity Sweep nu in {0.01, 0.05, 0.10, 0.25} (Re = 100 down to 4)
================================================================================================
 nu [m^2/s] |  Re = 1/nu |  E_k(1)/E_k(0) num |  exp(-4*nu) exact | Measured rate / (4*nu)
----------------------------------------------------------------------------------------
       0.01 |      100.0 |           0.960912 |          0.960789 |                0.99682
       0.05 |       20.0 |           0.819236 |          0.818731 |                0.99692
       0.10 |       10.0 |           0.671114 |          0.670320 |                0.99704
       0.25 |        4.0 |           0.368832 |          0.367879 |                0.99741
<Figure size 748x440 with 1 Axes>

Figure 12.4. Fraction of the kinetic energy that remains at t=1t = 1 against the kinematic viscosity: simulation on a 32×3232 \times 32 grid (points) and the analytical result e−4νe^{-4\nu} (line).

Inside the algorithm

What Demonstration 4 shows. At Re=100\mathrm{Re} = 100 (ν=0.01\nu = 0.01), 96.1%96.1\% of initial kinetic energy survives at t=1t = 1, whereas at Re=4\mathrm{Re} = 4 (ν=0.25\nu = 0.25), viscous shear converts 63.2%63.2\% (1−e−11 - e^{-1}) of kinetic energy into heat within one eddy turnover. The source code below shows how valid_k = k2_eff > 1e-12 masks both the k=(0,0)\mathbf{k} = (0,0) mean-pressure gauge mode and the (N/2,N/2)(N/2, N/2) Nyquist modes where sin⁡(π)=0\sin(\pi) = 0.

Check against the library


Inside the Algorithm: navier_stokes.taylor_green_projection_2d & Modified Wavenumber Check
==========================================================================================
def taylor_green_projection_2d(
    nx: int,
    dt: float,
    n_steps: int,
    nu: float,
) -> dict:
    """Solve 2-D periodic Taylor-Green Navier-Stokes via Chorin fractional-step projection on [0, 2*pi)^2."""
    L = 2.0 * np.pi
    dx = L / int(nx)
    x = np.linspace(0.0, L, int(nx), endpoint=False)
    xx, yy = np.meshgrid(x, x, indexing="ij")
    init = taylor_green_vortex_exact(xx, yy, 0.0, nu=nu)
    u = init["u"].copy()
    v = init["v"].copy()

    k1d = 2.0 * np.pi * np.fft.fftfreq(nx, d=dx)
    kx, ky = np.meshgrid(k1d, k1d, indexing="ij")
    # Exact discrete central-difference modified wavenumbers (masking zero/Nyquist modes where sin(pi) == 0):
    kx_eff = np.sin(kx * dx) / dx
    ky_eff = np.sin(ky * dx) / dx
    k2_eff = kx_eff**2 + ky_eff**2
    valid_k = k2_eff > 1e-12
    k2_safe = np.where(valid_k, k2_eff, 1.0)

    def ddx(f: np.ndarray) -> np.ndarray:
        return (np.roll(f, -1, axis=0) - np.roll(f, 1, axis=0)) / (2.0 * dx)

    def ddy(f: np.ndarray) -> np.ndarray:
        return (np.roll(f, -1, axis=1) - np.roll(f, 1, axis=1)) / (2.0 * dx)

    def lap(f: np.ndarray) -> np.ndarray:
        return (
            np.roll(f, -1, axis=0)
            + np.roll(f, 1, axis=0)
            + np.roll(f, -1, axis=1)
            + np.roll(f, 1, axis=1)
            - 4.0 * f
        ) / (dx**2)

    p = np.zeros_like(u)
    for _ in range(n_steps):
        u_star = u + dt * (-(u * ddx(u) + v * ddy(u)) + nu * lap(u))
        v_star = v + dt * (-(u * ddx(v) + v * ddy(v)) + nu * lap(v))
        div_star = ddx(u_star) + ddy(v_star)
        p_hat = np.where(valid_k, -np.fft.fft2(div_star) / (dt * k2_safe), 0.0)
        p = np.real(np.fft.ifft2(p_hat))
        u = u_star - dt * ddx(p)
        v = v_star - dt * ddy(p)

    t_end = n_steps * dt
    exact = taylor_green_vortex_exact(xx, yy, t_end, nu=nu)
    div_final = ddx(u) + ddy(v)
    return {
        "X": xx,
        "Y": yy,
        "u": u,
        "v": v,
        "p": p,
        "exact": exact,
        "u_l2_error": float(np.sqrt(np.mean((u - exact["u"]) ** 2))),
        "max_divergence": float(np.max(np.abs(div_final))),
    }

Initial ||div_h u*||_inf = 4.9546
Residual divergence with naive k^2 = 4.5559e-01 (not zero) vs modified k_eff^2 = 4.2188e-15

Exercises

Worked solutions are in 12_solutions.ipynb. The cell below the list is a short self-check to start from.

  1. Verify a result. On a 64×6464 \times 64 periodic mesh [0,2π)2[0, 2\pi)^2 with ν=0.08\nu = 0.08 at t=0.4 st = 0.4\text{ s}, evaluate navier_stokes.taylor_green_vortex_exact and verify pointwise to <10−14< 10^{-14} that ∇2p=+2(∂xu ∂yv−∂yu ∂xv)\nabla^2 p = +2(\partial_x u\,\partial_y v - \partial_y u\,\partial_x v), and verify across t∈{0.0,0.4,1.0}t \in \{0.0, 0.4, 1.0\} that mean enstrophy Z(t)=12⟨ω2⟩\mathcal{Z}(t) = \frac{1}{2}\langle \omega^2 \rangle equals 2Ek(t)2 E_k(t).

  2. Find how it fails. Demonstrate numerically: (a) on a 24×2424 \times 24 mesh, projecting a divergent velocity field with continuum kx2+ky2k_x^2 + k_y^2 leaves >10−2> 10^{-2} discrete divergence whereas keff2k_{\mathrm{eff}}^2 achieves <10−14< 10^{-14}; and (b) running taylor_green_projection_2d(nx=32, dt=0.18, n_steps=90, nu=0.25) exceeds the 2-D explicit Fourier diffusion bound Δtmax⁡=Δx2/(4ν)≈0.0386\Delta t_{\max} = \Delta x^2 / (4\nu) \approx 0.0386 and blows up.

  3. Implement it yourself. Implement my_taylor_green_projection_2d(nx, dt, n_steps, nu) from scratch in pure NumPy, verify that u, v, and p match navier_stokes.taylor_green_projection_2d on a 40×4040 \times 40 grid (dt=0.0025, n_steps=160, nu=0.12) to < 1e-14, and verify max_divergence < 1e-14.


Self-check for the exercises
============================
Max |lap(p) - 2*(u_x*v_y - u_y*v_x)| = 6.661e-16
All checks passed.