Completed · MATLAB · CFD solver development
MATLAB Lid-Driven Cavity Solver
A transparent two-dimensional incompressible-flow solver and automated 72-case study developed to examine pressure–velocity coupling, numerical schemes, mesh resolution, convergence behavior, and benchmark agreement.
Problem
The lid-driven cavity is a compact benchmark for incompressible-flow solvers. It tests pressure–velocity coupling, wall boundary conditions, vortex formation, numerical diffusion, mesh sensitivity, convergence behavior, and comparison with established reference data.
My contribution
- Developed loop-based and vectorized MATLAB momentum predictors.
- Automated the parameter study across mesh resolution, Reynolds number, convection scheme, pressure solver, and implementation.
- Implemented residual tracking, structured result export, plotting, and Ghia centerline comparison.
- Retained and documented limited cases rather than presenting only favorable results.
Numerical methodology
Flow model
Two-dimensional incompressible Navier–Stokes equations with a moving top wall.
Pressure coupling
Pseudo-transient pressure correction on a structured collocated Cartesian grid.
Study matrix
N = 32, 64, 128; Re = 100, 400, 1000; upwind/central; RBGS/RBSOR; loop/vectorized.
Representative results




Results and interpretation
- 44 of the 72 cases met the selected Ghia centerline-error limits.
- Every case reached its configured outer-iteration limit before satisfying the strict stopping criteria, so the results are not described as fully converged.
- All
N = 128cases met the selected comparison limits; coarse high-Reynolds-number cases were less accurate. - RBSOR reduced pressure-solver iterations and runtime compared with RBGS.
- Vectorizing the momentum predictor had a limited effect on total runtime because the pressure solve remained the main cost.
Relationship to the comparison project
This completed MATLAB solver is the reference implementation for the work-in-progress Lid-Driven Cavity Solver Comparison, which extends the same benchmark across MATLAB/Octave, Python, C, C++, OpenMP, MPI, and a CUDA prototype.
Limitations
The solver prioritizes transparency and numerical comparison over production performance. It uses a collocated grid without Rhie–Chow interpolation and an iterative pressure solver without multigrid acceleration. All uploaded full-study cases reached the configured outer-iteration limit, so execution status, profile agreement, and numerical convergence are reported separately.