2D Lid Driven Cavity Matlab Program

Hi all,
I share my codes to help someone who is interested to work on lattice boltzmann method. D2Q9 Multi-Relaxation Time have been used to simulate fluid flow inside a lid-driven cavity. As well as, Bounce Back BC is used for static walls (left,right and bottom walls) and Zou and He BC scheme is implemented for moving wall (top wall).
Please, if you have any suggestion I will so glad if you inform me.

download link : here

It is very nice of you to share your code - I’m sure it’s compactness will of of much use to many people.

Just a quick comment to anyone who is simulating such a flow (with any code). If you wish to asses the accuracy and capabilities of the LB method, especially compared to other numerical methods, then you should probably find the value of the stream function at the centre of the vortices (and indeed the position of the centres), both for the primary vortex (which will be near the middle of the domain, depending on the Re number),and at the corners (there will be one in the bottom left and one in the bottom right, and an additional one in the top left when the Re number gets closer to 5000. Note also that these is not a steady solution above 8000). This is why lid driven cavity is a nice benchmark test for CFD.

Happy computing!