A benchmark suite for unsteady incompressible CFD: From MATLAB fundamentals to industrial applications
A benchmark suite for unsteady incompressible CFD: From MATLAB fundamentals to industrial applications
- Introduction
- Features
- Why the Lid-Driven Cavity?
- Why the SIMPLE Algorithm?
- Governing Equations
- SIMPLE Algorithm Steps
- Numerical Methods & Boundary Conditions
- Project Roadmap
- Project Structure
- Benchmark Table
- Getting Started
- Contributing
- Code of Conduct
- Security
- Support & Discussion
- License
- References
- Citation
- Contact
Lid Cavity Evolution is an open-source benchmark suite that chronicles the development of the classic lid-driven cavity CFD problem—from foundational MATLAB scripts to industrial-grade solvers. The project emphasizes accuracy, performance, and reproducibility for unsteady incompressible flow simulation.
- Standard Test Case: Simple geometry, well-defined boundaries, and established reference solutions make it ideal for CFD code verification.
- Rich Physics: Captures vortex formation, boundary layers, and evolving flow structures.
- Unsteady Simulation: Tracks time evolution of flow fields, including transient and nonlinear phenomena.
Simulating incompressible flows is numerically challenging due to tight coupling of velocity and pressure. The SIMPLE (Semi-Implicit Method for Pressure-Linked Equations) algorithm is widely used because it:
- Decouples momentum and continuity equations for robust convergence.
- Uses a staggered grid to prevent checkerboard pressure artifacts.
- Applies under-relaxation for improved stability and efficiency.
The solver models unsteady, incompressible, two-dimensional flow in a square cavity with a moving lid.
-
$\mathbf{u}$ : Velocity vector,$\mathbf{u} = (u, v)$ -
$u$ : velocity in$x$ -direction -
$v$ : velocity in$y$ -direction
-
This equation enforces conservation of mass for incompressible flow: the net flow into any control volume is zero.
Where each term means:
-
$\frac{\partial \mathbf{u}}{\partial t}$ : Unsteady term — Time rate of change of velocity. -
$(\mathbf{u} \cdot \nabla)\mathbf{u}$ : Convection term — Transport of momentum by fluid motion. -
$- \nabla p$ : Pressure gradient term — Acceleration caused by pressure differences. -
$\frac{1}{Re}\nabla^2 \mathbf{u}$ : Diffusion term — Viscous spreading of momentum. -
$Re = \frac{UL}{\nu}$ : Reynolds number-
$U$ : Lid velocity -
$L$ : Cavity length -
$\nu$ : Kinematic viscosity
-
-
x-Momentum:
$\frac{\partial u}{\partial t} + u \frac{\partial u}{\partial x} + v \frac{\partial u}{\partial y} = -\frac{\partial p}{\partial x} + \frac{1}{Re} \left( \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} \right )$ -
$\frac{\partial u}{\partial t}$ : Time derivative of$u$ -
$u \frac{\partial u}{\partial x}$ : Convection of$u$ in$x$ -
$v \frac{\partial u}{\partial y}$ : Convection of$u$ in$y$ -
$-\frac{\partial p}{\partial x}$ : Pressure gradient in$x$ -
$\frac{1}{Re} \frac{\partial^2 u}{\partial x^2}$ : Viscous diffusion in$x$ -
$\frac{1}{Re} \frac{\partial^2 u}{\partial y^2}$ : Viscous diffusion in$y$
-
-
y-Momentum:
$\frac{\partial v}{\partial t} + u \frac{\partial v}{\partial x} + v \frac{\partial v}{\partial y} = -\frac{\partial p}{\partial y} + \frac{1}{Re} \left( \frac{\partial^2 v}{\partial x^2} + \frac{\partial^2 v}{\partial y^2} \right )$ -
$\frac{\partial v}{\partial t}$ : Time derivative of$v$ -
$u \frac{\partial v}{\partial x}$ : Convection of$v$ in$x$ -
$v \frac{\partial v}{\partial y}$ : Convection of$v$ in$y$ -
$-\frac{\partial p}{\partial y}$ : Pressure gradient in$y$ -
$\frac{1}{Re} \frac{\partial^2 v}{\partial x^2}$ : Viscous diffusion in$x$ -
$\frac{1}{Re} \frac{\partial^2 v}{\partial y^2}$ : Viscous diffusion in$y$
-
The SIMPLE algorithm solves these equations with the following procedure:
-
Predictor Step:
- Solve momentum equations for an intermediate velocity
$\mathbf{u}^*$ using the current pressure estimate.
- Solve momentum equations for an intermediate velocity
-
Pressure Correction:
- Solve the pressure correction Poisson equation:
$\nabla^2 p' = \frac{1}{\Delta t} \nabla \cdot \mathbf{u}^*$
where$p'$ is the pressure correction and$\Delta t$ is the time step.
- Solve the pressure correction Poisson equation:
-
Corrector Step:
- Update velocities and pressure:
$\mathbf{u}^{n+1} = \mathbf{u}^* - \Delta t \nabla p'$
$p^{n+1} = p^{n} + \alpha p'$
where$\alpha$ is the under-relaxation factor ($0 < \alpha \leq 1$ ).
- Update velocities and pressure:
- Spatial Discretization: Second-order central differencing
- Time Discretization: First-order implicit Euler
- Grid: Staggered (pressure at cell centers, velocities at faces)
-
Boundary Conditions:
-
Top lid:
$u = 1$ ,$v = 0$ (moving wall) -
Other walls:
$u = v = 0$ (no-slip) -
Pressure: Neumann (
$\frac{\partial p}{\partial n} = 0$ ) at boundaries
-
Top lid:
| Phase | Description | Status |
|---|---|---|
| Phase 1 | MATLAB loop-based SIMPLE solver | ✅ Complete |
| Vectorized MATLAB implementation | ✅ Complete | |
| Phase 2 | Python/NumPy serial port | ✅ Complete |
| Vectorized NumPy solver | ✅ Complete | |
| Parallel Python (Numba/Dask) | 🚧 In Progress | |
| Phase 3 | OpenFOAM case setup | 📋 Planned |
| STAR-CCM+ case setup | 📋 Planned | |
| Phase 4 | Validation & analysis | 📋 Planned |
main/
├── matlab/
│ ├── iterative-solver/
│ │ ├── IterativeSolver.m
│ │ └── README.md
│ ├── vectorized-solver/
│ │ ├── VectorizedSolver.m
│ │ └── README.md
│ └── README.md # MATLAB-specific overview
├── python/
│ ├── serial/
│ │ ├── iterative/
│ │ │ ├── IterativeSolver.py
│ │ │ └── README.md
│ │ ├── vectorized/
│ │ │ ├── VectorizedSolver.py
│ │ │ └── README.md
│ │ └── README.md # Serial solvers overview
│ ├── parallel/
│ │ ├── mpi/
│ │ │ ├── MPISolver.py
│ │ │ └── README.md
│ │ ├── openmp/
│ │ │ ├── OpenMPSolver.py
│ │ │ └── README.md
│ │ └── README.md # Parallel solvers overview
│ └── README.md # Python-specific overview
├── logos/ # Technology logos
├── assets/
├── .github/ISSUE_TEMPLATE/ # GitHub issue templates
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── SECURITY.md
└── README.md # Main project documentation
Note: This is for a 50x50 Grid
| Solver | Language | Paradigm | Elapsed Time (s) | Speedup | Status |
|---|---|---|---|---|---|
| SIMPLE2D_LidDrivenCavity | MATLAB | Serial (Loops) | 1126,03 | 1x | ✅ Complete |
| SimpleLidCavityVector | MATLAB | Serial (Vectorized) | 1266,38 | 1.125x | ✅ Complete |
| lid_cavity_serial.py | Python/NumPy | Serial (Loops) | 85703.92 | 76x | ✅ Complete |
| lid_cavity_vectorized.py | Python/NumPy | Serial (Vectorized) | 3732.37 | 3.3x | ✅ Complete |
| _lid_cavity_parallel.py_mpi | Python | Parallel | TBD | TBD | 🚧 In Progress |
| _lid_cavity_parallel.py_openmp | Python | Parallel | TBD | TBD | 🚧 In Progress |
| OpenFOAM Case | OpenFOAM | Industrial CFD | TBD | TBD | 📋 Planned |
| STAR-CCM+ Case | STAR-CCM+ | Commercial CFD | TBD | TBD | 📋 Planned |
Note: This is for a 150x150 Grid
| Solver | Language | Paradigm | Elapsed Time (s) | Speedup | Status |
|---|---|---|---|---|---|
| SIMPLE2D_LidDrivenCavity | MATLAB | Serial (Loops) | TDB | TBD | 🚧 In Progress |
| SimpleLidCavityVector | MATLAB | Serial (Vectorized) | TDB | TBD | 🚧 In Progress |
| lid_cavity_serial.py | Python/NumPy | Serial (Loops) | TDB | TBD | 🚧 In Progress |
| lid_cavity_vectorized.py | Python/NumPy | Serial (Vectorized) | TDB | TBD | 🚧 In Progress |
| _lid_cavity_parallel.py_mpi | Python | Parallel | TBD | TBD | 🚧 In Progress |
| _lid_cavity_parallel.py_openmp | Python | Parallel | TBD | TBD | 🚧 In Progress |
| OpenFOAM Case | OpenFOAM | Industrial CFD | TBD | TBD | 📋 Planned |
| STAR-CCM+ Case | STAR-CCM+ | Commercial CFD | TBD | TBD | 📋 Planned |
_Hardware:
- MATLAB: R2020a or later (for initial implementations)
- Python: 3.8+ (NumPy, planned)
- OpenFOAM: (planned)
- STAR-CCM+: (planned)
We welcome all contributions! Please see CONTRIBUTING.md for guidelines on:
- Adding new solver implementations
- Improving code or documentation
- Adding validation cases
- Reporting issues or suggesting enhancements Feel free to open an issue or submit a pull request!
Please note that this project follows a Code of Conduct. By participating, you are expected to uphold this code.
If you discover a vulnerability, please see our SECURITY.md for instructions on reporting it.
- For bug reports or feature requests, please use our issue tracker.
- For general questions, open an issue or reach out via email.
This project is licensed under the MIT License.
See LICENSE for details.
- Ghia, U., Ghia, K. N., & Shin, C. T. (1982). High-Re solutions for incompressible flow using the Navier-Stokes equations and a multigrid method. J. Comput. Phys., 48(3), 387-411.
- Patankar, S. V. (1980). Numerical Heat Transfer and Fluid Flow. Hemisphere Publishing.
- Ferziger, J. H., Perić, M., & Street, R. L. (2002). Computational Methods for Fluid Dynamics. Springer.
For questions, suggestions, or collaboration inquiries, feel free to:
- Open an issue on GitHub
- Reach out via email: [email protected]
- Connect on LinkedIn
Note: This project is under active development. Check back for updates and new solver releases!