# Problematic lid-driven cavity using SIMPLE on collocated grid

 Register Blogs Members List Search Today's Posts Mark Forums Read

May 27, 2020, 11:13
Problematic lid-driven cavity using SIMPLE on collocated grid
#1
New Member

Join Date: Aug 2014
Posts: 18
Rep Power: 11
Dear all,

I tried the lid-driven cavity case by solving 2-D imcompressible steady Navier-Stokes equation using SIMPLE algorithm.

Basically, I followed Versteeg & Malalasekera's textbook (Versteeg & Malalasekera 2007, An Introduction to Computational Fluid Dynamics: The Finite Volume Method, Pearson Education, 2nd ed.) step by step, except for using of the collocated grid.

For simplicity, detailed calculation can be seen in the attached flow chart.

In my codes, the momentum interpolation is preoperly working (because face values u_w_star, u_e_star, v_s_star, v_n_star match node values u_star, u_star, v_star, v_star well).

Results seems normal and the codes behaves properly, but only very SMALL value of pressure under-relaxtion factor is allowed to keep SIMPLE iteration convergent.

It seems that large pressure correction (P', serveral order of magnitude higher than correction of velocoity u', v') in the Step-2 is yield when solve continuity equation, but I don't know why.

Can anybody help me?

I modularized the codes including:
2. solveStokesEqXTVD.m - solve the x-momentum equation to get u*, u*_pseudo
3. solveStokesEqYTVD.m - solve the y-momentum equation to get v*, v*_pseudo
4. solveContinuityEq.m - solve the continuity Eq. and get correction value P' of P
5. getVelCorrections.m - get corrections u', v' for u, v
6. correctVelocityPressure.m - correct u, v, P
Intermediate variables are shown. Codes are attached.

Best,

Fw.
Attached Images
 Figuire 1.png (128.6 KB, 72 views) Figuire 2.png (53.5 KB, 53 views)
Attached Files
 flow chart.pdf (171.6 KB, 67 views) codes.zip (20.1 KB, 51 views)

Last edited by Freewill1; June 10, 2020 at 10:30. Reason: Updating data

June 17, 2020, 05:14
Bug found and fixed.
#2
New Member

Join Date: Aug 2014
Posts: 18
Rep Power: 11
Bug found and fixed with the help of tas38 here:

https://www.cfd-online.com/Forums/cfd-freelancers/227828-looking-2-d-simple-code.html

Quote:
 Originally Posted by tas38 I do not have a matlab code to provide you. But I do notice that you previously posted a lid-driven cavity code (written in matlab) for which you were having some difficulty. Problematic lid-driven cavity using SIMPLE on collocated grid I took a look at your code, and I think the issue is that you do not properly apply under-relaxation to the momentum equations. The momentum under-relaxation parameters are applied when solving the momentum equations and will therefore implictly impact the pressure-correction equation solution. They will affect the stability and convergence rates of both the momentum and pressure correction equations. See Section 6.4 in Versteeg and Malalasekera (1995 copy) for more details on this. In your code (see link above), you apply relaxation to the u- and v-velocity components at the point at which the pressure correction equations are applied. Something like --> This is NOT correct. Note that in equation 6.15 in the aforementioned text that . The under-relaxation has already impacted the computation via the momentum equations and via the mass imbalance (source) terms within the pressure-correction equation. Hopefully you can get your own code working as a result of this suggestion.
New code are attached here for people who may need, although looks a little bit tedious.
Attached Files
 code_relaxation_fixed.zip (19.3 KB, 76 views)

 May 25, 2023, 00:18 #3 New Member   Join Date: May 2023 Posts: 1 Rep Power: 0 Thank you very much for sharing Freewill1! I am a cfd beginner and looking for a code of a simple algorithm. And you made me understand where the velocity under-relaxtion work.

 Tags collocated, lid-driven cavity, simple