
[Sponsors] 
Sample code for SIMPLEalgorithm and solving LidDriven Cavity flow test is uploaded 

LinkBack  Thread Tools  Search this Thread  Display Modes 
May 3, 2010, 11:05 
Sample code for SIMPLEalgorithm and solving LidDriven Cavity flow test is uploaded

#1 
Member
Michail
Join Date: Apr 2009
Location: Lithuania
Posts: 41
Rep Power: 12 
Dear colleagues!
I uploaded sample code for SIMPLEalgorithm and solving liddriven 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.cfdonline.com/Wiki/Sampl...9__Fortran_90 It predecessor  the code for solving SmithHutton test can be found here: http://www.cfdonline.com/Wiki/Appro...s_and_examples http://www.cfdonline.com/Wiki/Sampl...t__Fortran_90 I'll be glad and grateful to get your opinion about it 

May 18, 2010, 12:05 
SimpleAlgorithm

#2 
New Member
Mijail Febres
Join Date: May 2010
Posts: 4
Rep Power: 11 
HI, I started programming a SIMPLEalgorithm myself based on Malalaskera's book on a staggered grid for a 1d 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 1d 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: 12 
Hi! Look here, may be this will be useful http://www.cfdonline.com/Forums/mai...flowpipe.html


June 14, 2010, 13:38 
SIMPLE Algortihm in Matlab

#4 
New Member
Jame
Join Date: Jun 2010
Posts: 3
Rep Power: 11 
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: 2 
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: 12 
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: 2 
Hi, thank you Michail for your answers they are very useful, i realized the code for Newtonian and NonNewtionian 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 liddriven 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: 12 
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.cfdonline.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: 2 
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: 12 
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) ! underrelaxation  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: 2 
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: 12 
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 referencesissues  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.50.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 

January 29, 2019, 01:14 
Boundary Condition Treatment

#13  
New Member
Usman
Join Date: Jul 2018
Posts: 7
Rep Power: 2 
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:


Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
sample MAPLE code for SIMPLE algorithm  mia  Main CFD Forum  0  February 27, 2009 23:22 
About the difference between steady and unsteady problems  Lisa  Main CFD Forum  11  July 5, 2000 14:37 