Skip to content

Lid-driven Cavity

Steady incompressible flow in a square cavity driven by a moving lid — a boundary-value problem (no time variable):

(u)u+pν2u=0,u=0in [0,1]2.

Problem setup

The domain is the unit square (x,y)[0,1]2. The top lid slides tangentially with u=1,v=0, while the left, right, and bottom walls are no-slip (u=v=0). The Reynolds number is Re=UL/ν with lid speed U=1 and cavity size L=1; the showcase runs at Re=5000 (ν=1/5000), where a strong primary vortex fills the cavity and counter-rotating eddies develop in the bottom corners.

Lid-driven cavity setup

Geometry and boundary conditions. The lid velocity is discontinuous at the two top corners, which concentrates error and makes high-Re training stiff.

Both boundary conditions enter the loss as sampled point sets: a u_bc term fitting the lid profile (including the discontinuous corners) and a v_bc term enforcing zero normal flow, alongside the three momentum/continuity residuals — five loss terms balanced by grad-norm weighting.

Results

relative L2 error 0.043recipe adaptive pseudo-timeRe 5000, 50k steps, single GPU

Direct training at Re 5000 stalls: the baseline plateaus at a relative L2 error of 0.64 in the velocity magnitude, trapped in a low-circulation spurious solution (swapping SOAP for Adam changes nothing — 0.68). Adaptive pseudo-time stepping acts as an artificial-time continuation toward the steady state and reaches 0.043 — a 15× improvement and the difference between a wrong flow field and a quantitatively correct one. The comparison is sharp: constant pseudo-time weights do not help here (0.84); the adaptive step-size estimate is what tracks the slowly developing circulation.

Lid-driven cavity prediction vs reference

Reference and predicted velocity magnitude at Re 5000, and the absolute error.

Lid-driven cavity convergence

Training losses and relative L2 error of the showcase (adaptive pseudo-time) run.

Run

bash
cd examples/lid_driven_cavity
python3 main.py --config=configs/pseudo_time.py
ConfigDescription
configs/baseline.pyModified MLP baseline
configs/pseudo_time.pyAdaptive pseudo-time stepping (showcase)
configs/fixed_pseudo_time.pyConstant pseudo-time weights

Notes

  • Steady problems subclass ForwardBVP — same trainer, no causal weighting.
  • Reference data ships for Re ∈ {100, 400, 1000, 1600, 3200, 5000} (--config.Re=...).

Released under the Apache 2.0 License.