File Exchange

image thumbnail

2D Lid driven Cavity Flow

version 1.0 (3.27 KB) by

Simulation of the 2D lid driven Cavity Flow of a Newtonian Fluid (laminar flow) using FD.

7 Ratings



View License

Cavity flow is simulated using the pressure correction method on a staggered grid using explicit differencing for the hyperbolic terms (CD, MacCormack and Richtmyer method) while both explicit and implicit methods are considered for the diffusive (parabolic) terms. For the implicit steps, preconditioned matrices are used using LU decomposition. The Pressure Poisson equation is also solved implicitly. Neumann boundary conditions are used for pressure and Dirichlet conditions for the velocity field

Comments and Ratings (13)


Sagar (view profile)

Wei Ting-Kai



lee (view profile)

Shubham Maurya


sigur (view profile)

I tried to set simply (u,v) = (1,0) as a test for plausibility. The result seems incorrect, due to a strange recirculation in the upper right corner.

Seems to be caused by the projection step.

Do you know how to fix that?

Hung Nguyen


Mehdi Kh

Thank you for the code.
Is it possible to have documentation of code?

Especially, defining boundaries.

For example:
- why Dirichlet B.Cs should be like " bcT(:,1)=TS/dy^2 " ?

What is the highest Re number, this code can cope with?


scott (view profile)


scott (view profile)

Suraj Shankar

Suraj Shankar (view profile)

The code is meant to be pedagogical in nature and has been made in line with the 12-steps to Navier-Stokes practical module, for which I would like to credit Lorena Barba and her online course on CFD.

Suraj Shankar

Suraj Shankar (view profile)



Mike (view profile)

very good

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video