# Sample code for SIMPLE-algorithm and solving Lid-Driven Cavity flow test is uploaded

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 May 3, 2010, 11:05 Sample code for SIMPLE-algorithm and solving Lid-Driven Cavity flow test is uploaded #1 Member     Michail Join Date: Apr 2009 Location: Lithuania Posts: 41 Rep Power: 17 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: http://www.cfd-online.com/Wiki/Sampl...9_-_Fortran_90 It predecessor - the code for solving Smith-Hutton test can be found here: http://www.cfd-online.com/Wiki/Appro...s_and_examples http://www.cfd-online.com/Wiki/Sampl...t_-_Fortran_90 I'll be glad and grateful to get your opinion about it hamza dg, siddiquesil and L2e2o4 like this.

 May 18, 2010, 12:05 Simple-Algorithm #2 New Member   Mijail Febres Join Date: May 2010 Posts: 4 Rep Power: 15 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

 May 18, 2010, 12:23 #3 Member     Michail Join Date: Apr 2009 Location: Lithuania Posts: 41 Rep Power: 17 Hi! Look here, may be this will be useful http://www.cfd-online.com/Forums/mai...flow-pipe.html

 June 14, 2010, 13:38 SIMPLE Algortihm in Matlab #4 New Member   Jame Join Date: Jun 2010 Posts: 3 Rep Power: 15 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.

 October 12, 2018, 08:14 #5 New Member   Join Date: Oct 2018 Posts: 4 Rep Power: 7 hi, 1- in boundary conditions, the velocity in the wall is Up or Uface? 2- or we need to define the boundary conditions for both velocities? and how?

 October 12, 2018, 16:52 #6 Member     Michail Join Date: Apr 2009 Location: Lithuania Posts: 41 Rep Power: 17 Hi Hamza We specify both velocity components on the wall u and v (0,0 for solid walls, 1,0 for moving wall) Just fixed them (they are not corrected during solution). U_face calculated inside program. check the code,it's quite simple.

 December 27, 2018, 12:28 #7 New Member   Join Date: Oct 2018 Posts: 4 Rep Power: 7 Hi, thank you Michail for your answers they are very useful, i realized the code for Newtonian and Non-Newtionian fluids. Now i am trayin the viscoelastic case, but i have a problem of numerical stability when increasing WE (WE is a parameter in the equations), i want to know if you have an idea about this. you can find the problem and equations in the article "Finite volume simulation of viscoelastic laminar flow in a lid-driven cavity" (Kerim Yapici, Bulent Karasozen, Yusuf Uludag) (2009)

 December 28, 2018, 20:30 #8 Member     Michail Join Date: Apr 2009 Location: Lithuania Posts: 41 Rep Power: 17 hallo Hamza I took a glance through the paper You referred. First of all I would like to ask - how many equations do You solve? If 3 You are wrong. There are 3 additional equations for stresses. They are solving the same way as momentum equations. so if You want to apply my code for this problem You should: 1) Add to solver 3 equations for stresses, likewise for scalar here https://www.cfd-online.com/Wiki/Samp...t_-_Fortran_90 (the same scheme i used here for momentum equations U,V) 2) Modify source term in momentum equations 3) Modify boundary conditions (eq. 7 in that paper) so there is some work here. But not too complicated )

 December 29, 2018, 11:42 #9 New Member   Join Date: Oct 2018 Posts: 4 Rep Power: 7 Hi michail, yes i see, we have three unknowns added so automatically we need 3 others equations which are given in the constitutive equations. i have applied all your remarks, and when i take WE=0 (newtonian case) the results are good, but for WE#0 here the convergence problem occurs, I think i need a special treatment of source term !!

 December 29, 2018, 15:09 #10 Member     Michail Join Date: Apr 2009 Location: Lithuania Posts: 41 Rep Power: 17 Hallo the source term in equations of motion (for U and V) summarized from pressure gradient and stresses.] I guess, You should implement underrelaxation for stresses' equations: (look in S. Patankar) !---------------------------- under-relaxation --------------------------------- Alfa = 0.8 Urf = 1. / Alfa Ap(1:NXmaxC,1:NYmaxC,1) = Ap(1:NXmaxC,1:NYmaxC,1) * Urf Sp(1:NXmaxC,1:NYmaxC,1) = Sp(1:NXmaxC,1:NYmaxC,1) + (1. - Alfa )* & Ap(1:NXmaxC,1:NYmaxC,1)*F(1:NXmaxC,1:NYmaxC,1) ! / Alfa Ap(1:NXmaxC,1:NYmaxC,2) = Ap(1:NXmaxC,1:NYmaxC,2) * Urf Sp(1:NXmaxC,1:NYmaxC,2) = Sp(1:NXmaxC,1:NYmaxC,2) + (1. - Alfa )* & Ap(1:NXmaxC,1:NYmaxC,2)*F(1:NXmaxC,1:NYmaxC,2) ! / Alfa !--------------------------------------------------------------------------------- I would make relaxation koeffitient alfa=0.2..0.3 in stress equations. and... Check for bugs. Check for bugs. sleep a night and again: Check for bugs Good luck!

 December 30, 2018, 14:20 #11 New Member   Join Date: Oct 2018 Posts: 4 Rep Power: 7 Hi Michail, I hope you had a good day, Yes i am used the underrelaxation for stresses equations. and now i am trying again... thank you for your encouragement

 December 30, 2018, 21:37 #12 Member     Michail Join Date: Apr 2009 Location: Lithuania Posts: 41 Rep Power: 17 Okay, then let's take it more seriously: 1) First of all, check all math in Your code. For this: a) go through all possible references-issues - at least 20, better 30. a0) the solution of the problem is already found, search it in publications b) make yourself sure, that you have complete understanding of mathematical formulation of governing equations and solution algorithm c) check all signs and coefficients in your code, write out all math with pencil and paper, compare them. 2) Debug Your code. a) make UDS scheme for momentum ans stresses equations b) make the lowest possible underrelaxation coefficients - 0.5-0.7 for velocities, 0.1 for pressure. c) search for suitable relaxation coefficients for stresses - vary them from 0.01 till 0.99 d) get convergence. then you can go for improvement L2e2o4 likes this.

January 29, 2019, 01:14
Boundary Condition Treatment
#13
New Member

Osman
Join Date: Jul 2018
Posts: 7
Rep Power: 7
Hello Mijail,
I am solving the lid driven cavity using SIMPLE algorithm in C++. I am facing same problem as yours, the treatment of boundary condition as no clear example is available in Patankar and Malalaskera's Book.
Please recommend me some solution to your problem

Quote:
 Originally Posted by Mijail 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

 January 28, 2020, 03:43 #14 New Member   Mateja Join Date: Jan 2020 Posts: 20 Rep Power: 6 Hello, I just started solving Lid Driven Cavity with PISO algorithm. I am using FORTRAN for this. Can someone tell me about the implementation of the pressure boundary condition? I would be thankful if you can refer to any literature.

 February 23, 2020, 10:26 SIMPLE algorithm in collocated non orthogonal body fitted grid in 3D #15 New Member   Waliur Rahman Join Date: Apr 2018 Location: Dhaka,Bangladesh Posts: 27 Rep Power: 7 Dear all, Can anyone give me any book or paper that describe SIMPLE algorithm in collocated non orthogonal body fitted grid in 3D? Regards, Waliur Rahman

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post mia Main CFD Forum 0 February 27, 2009 23:22 Lisa Main CFD Forum 11 July 5, 2000 14:37

All times are GMT -4. The time now is 23:43.

 Contact Us - CFD Online - Privacy Statement - Top