Completed · CFD solver development · C++17
C++ Lid-Driven Cavity Solver
A completed serial C++17 implementation and parameter study of the two-dimensional incompressible lid-driven cavity benchmark.
Problem
The lid-driven cavity benchmark is used as a controlled CFD case for pressure-velocity coupling, mesh sensitivity, convection schemes, convergence behavior, and comparison with Ghia et al. centerline velocity data.
Why this version matters
This implementation moves the reference study into a lower-level compiled language while keeping the numerical setup aligned with the MATLAB version. It provides a completed serial baseline for the broader work-in-progress comparison project.
My contribution
- Implemented the pressure-correction workflow in serial C++17.
- Kept the study structure aligned with the MATLAB benchmark.
- Added CSV export for fields, residual histories, and study summaries.
- Used Python post-processing for contours, streamlines, Ghia comparisons, and study-level figures.
Numerical methodology
Flow model
Two-dimensional incompressible Navier-Stokes equations with a moving lid and no-slip cavity walls.
Pressure coupling
Pseudo-transient pressure-correction algorithm on a structured collocated Cartesian grid.
Study matrix
N = 32, 64, 128; Re = 100, 400, 1000; upwind/central; RBGS/RBSOR.
Representative results
Results and interpretation
- All 36 configured cases executed.
- 22 cases met the selected Ghia centerline-error thresholds.
- All
N = 128cases met the selected validation thresholds. - RBSOR reduced pressure-solver cost while producing similar validation errors to RBGS.
- All full-study cases reached the configured maximum outer-iteration limit, so execution completion must not be confused with residual convergence.
Completed scope and limitations
The repository records the completed solver and parameter study as configured. It is an educational solver, not a production CFD package. It uses a collocated grid without Rhie-Chow interpolation, has no multigrid acceleration, and requires stronger convergence control for the high-Reynolds-number cases. These limitations are documented rather than hidden.