File Exchange

image thumbnail

Navier-Stokes Solver using SIMPLE

version 1.0.0 (7.04 KB) by R Surya Narayan
A MATLAB code to solve the steady and incompressible form Navier-Stokes Equations for a Lid-Driven Cavity


Updated 14 Apr 2020

View License

This is a MATLAB code that solves the 2D, steady and incompressible form of the Navier-Stokes Equations using the Semi-Implicit Method for Pressure-Linked Equation (SIMPLE). Meshes for the U and V momentum are staggered whereas the Pressure mesh is the regular control volume formed by a grid generated to discretize the flow domain. The Pressure correction equations are over-relaxed while the velocity solvers are under-relaxed. Velocity corrections are not carried through for the boundary conditions and are terminated by setting the corresponding P coefficient to a large value. Velocity solvers use the upwind interpolation scheme for obtaining velocities at the staggered-cell faces. Mass conservation monitor is displayed every 100 iterations to see the computed mass-imbalance die out as successive iterations follow. Post-processing is done in the same code using quiver function by interpolating U, V velocities from the staggered mesh to the cell corners of the regular mesh. Contour plots are obtained using the contourf function by setting the colormap to 'jet' or 'hsv' .

Cite As

R Surya Narayan (2020). Navier-Stokes Solver using SIMPLE (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (12)

Dongjun Lee

Sir, can i ask you about the references that you applied on your code?

inderpreet singh

Dear sir i want to contact you for some enquiries regarding heating problem and some basic doubts.Kindly suggest

inderpreet singh

sir in deeply observing solver ...i think for mommetum coefficient ap=ae+ae+me-mw? Kindly suggest the reason

R Surya Narayan

Yes you are right.

inderpreet singh

thanks sir for kind knowledge ...In other words these boundary cells also be called as ghost cells?

R Surya Narayan

@inderpreet Regarding the corner velocities, the entire north side has been initialised to the required flow velocity we wish to analyse. When computing the velocities for the quiver plot, values to the quiver function must be specified at the grid points rather than cell centers, be it staggered or the main control volume cell.
Regarding the corner values for the velocities, the staggered grid is not defined outside on two sides for the velocities. To be precise, for the u velocity the mesh extends beyond the east and west boundaries but not beyond the north and south. Hence assigning a random value of zero to those non-physical velocities would be erroneous.

inderpreet singh

also you use upwind scheme at boundaries not average for wall velocities determination

inderpreet singh

Sir there is one doubt i found finding all grid points you take corner value of velocities zero for U why so, on north side it should be 5?

R Surya Narayan

@inderpreet singh the solver I coded using SIMPLE remains the same for both the driven-cavity and the channel flow except for the channel flow I ensure the exit velocities are well in agreement with mass conservation after the end of each loop and correction-update. Regarding heating from one side to another, I shall see what I can do. Thank you for your response!

inderpreet singh

sir can the coeficients of pressure equation in SIMPLE should be same as we applied for projection method for lid driven cavity?Kindly help if possible

inderpreet singh

Dear Sir you have done excellent work .I have doubts in same driven cavity with heating from one side to other, Adding energy equation .Hope you may help in this matter

shreepad narasimhan

MATLAB Release Compatibility
Created with R2019a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!