CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFD-Wiki (
-   -   Sample code for SIMPLE-algorithm and solving Lid-Driven Cavity flow test is uploaded (

Michail May 3, 2010 11:05

Sample code for SIMPLE-algorithm and solving Lid-Driven Cavity flow test is uploaded
Dear colleagues!

I uploaded sample code for SIMPLE-algorithm and solving lid-driven cavity flow test (Re=1000).

It has a lot of shortcomings, but I think that it will be useful for all newcomers. I intend to develop it further, but now it very slowly converges. All notes will be useful, and hope it can be discussed.

The code can be found here:

It predecessor - the code for solving Smith-Hutton test can be found here:

I'll be glad and grateful to get your opinion about it

Mijail May 18, 2010 12:05

HI, I started programming a SIMPLE-algorithm myself based on Malalaskera's book on a staggered grid for a 1-d constant density permanent flow. It's not working properly, velocities converge in 2 or 3 iterations but pressures don't, I think I have a problem with BC's treatment (constant known velocity on one side and constant known pressure on the other). Do you know any book that shows a clear example on boundary conditions treatment?, I mean, all books, from Patankar, Anderson, Versteg, etc talk about it, but no one has a clear example.
The code you wrote is on a colocated grid, do you think it has advantages over a staggered grid for the 1-d problem I'm trying to solve?

Thanks in advance

Michail May 18, 2010 12:23

Hi! Look here, may be this will be useful

bikash89 June 14, 2010 13:38

SIMPLE Algortihm in Matlab
Hi all..I have been trying to code for viscous incompressible flows using SIMPLE algorithm in Matlab using a staggered grid approach. The code worked really well for Couette flow. However for lid driven cavity, it is not showing required results. I have tried using different Reynolds number like 10, 100, 1000. Initially the code seems as if it will give the required result, however after a few iterations, oscillations begin and the solution fails. Is there any stability criteria for this flow problem? The time step I had used was 0.001 secs. Any kind of help in this regards will be highly appreciated. Thanks a lot.

All times are GMT -4. The time now is 17:39.