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.

Step 13 -- Channel Flow (Poiseuille) and Taylor-Green Vortex

Authors
Affiliations
University of Valencia

The final step in the “13 Steps to Navier--Stokes” series validates the full incompressible solver with two problems that have exact analytical solutions.

Part A -- Poiseuille flow: We verify that the solver maintains the exact steady-state parabolic velocity profile of pressure-driven channel flow.

Part B -- Taylor-Green vortex: We verify that the solver correctly reproduces the exponential decay of a vortex with a known analytical solution.

What you will learn:

  1. How to initialise the NS solver with a known analytical vorticity field

  2. How to validate against exact steady-state and decaying solutions

  3. How to differentiate through the full Navier--Stokes solver with jax.grad

Arakawa C-Grid and Boundary Conditions

Both problems use Dirichlet BCs (ψ=0\psi = 0 on all walls) with the cavity model (all walls stationary, u_lid = 0).

             u=0, v=0 (no-slip)
        +------------------------+
        |                        |
 u=0    |    omega, psi          |  u=0
 v=0    |    (interior)          |  v=0
        |                        |
        +------------------------+
             u=0, v=0 (no-slip)

Wall vorticity is set via Thom’s formula (see Step 12).


Part A: Poiseuille (Channel) Flow

For flow between two plates driven by a constant pressure gradient GG, the exact steady-state velocity profile is parabolic:

u(y)=G2ν y (Ly−y)u(y) = \frac{G}{2\nu}\,y\,(L_y - y)

The corresponding vorticity is:

ω(y)=−∂u∂y=−G2ν(Ly−2y)\omega(y) = -\frac{\partial u}{\partial y} = -\frac{G}{2\nu}(L_y - 2y)

We initialise the solver with this exact vorticity profile and verify that the solution remains steady (the tendency should be nearly zero).

Grid: 34 x 34
nu = 0.1, G = 1.0
Max analytical u = G*Ly^2/(8*nu) = 1.2500

Integrate and check steadiness

If the initialisation is correct, the vorticity should remain almost unchanged.

All finite: True
Max vorticity change after t=0.5: 9.307435e+00

Recover velocity and compare to analytical

<Figure size 1200x500 with 2 Axes>
RMS velocity error: 8.979095e-01

The parabolic profile is well captured. Residual errors come from the finite grid resolution and the wall vorticity approximation (Thom’s formula).


Part B: Taylor-Green Vortex

The Taylor-Green vortex is a decaying flow with an exact solution. The vorticity decays exponentially:

ω(x,y,t)=A sin⁡(kxx)sin⁡(kyy) e−ν(kx2+ky2)t\omega(x,y,t) = A\,\sin(k_x x)\sin(k_y y)\,e^{-\nu(k_x^2+k_y^2)t}

where kx=π/Lxk_x = \pi/L_x, ky=π/Lyk_y = \pi/L_y and A=kx+ky2/kxA = k_x + k_y^2/k_x.

Decay rate: 1.9739
e-folding time: 0.5066

Integrate and compare

All finite: True

Visualize the vortex decay

<Figure size 1400x900 with 12 Axes>

Peak vorticity: numerical vs analytical

<Figure size 800x400 with 1 Axes>
L2 error at t=0.5: 4.171352e+00

Differentiability -- gradient through the NS solver

We compute ∂E/∂ν\partial \mathcal{E} / \partial \nu where E\mathcal{E} is the final enstrophy. This tells us how viscosity affects the vortex decay rate.

dEnstrophy/dnu = -0.838467
Sign: negative (more viscosity = faster decay)

The negative gradient confirms that increasing viscosity reduces the final enstrophy -- the vortex decays faster.

Summary

ProblemValidationKey result
Poiseuille flowParabolic u(y)u(y) profileSteady state maintained
Taylor-Green vortexExponential ω\omega decayL2 error <10−3< 10^{-3}
Differentiability∂E/∂ν\partial\mathcal{E}/\partial\nuNegative (physical)

Congratulations! You have completed all 13 steps from linear advection to the full incompressible Navier-Stokes equations. The somax model contract -- vector_field, integrate, diagnose, jax.grad -- scales from the simplest 1D PDE to a validated 2D fluid solver.