TIPS for those working on SIMPLE
Hey guys!
I am a Master student and i'm programming SIMPLE method on myself.(duct flow) I have been confused for a very very long time,and now I eventually get familiar with SIMPLE and I'd like to share some of experience to all of you. 1.Use Poiseuille flow to check your momentum equation.Apply the exact solution of velocity and pressure drop as boundary and initial condition.If your momentum equation is correct, it should never change the velocity field.Especially pay attention to the wall boundary condition. 2.Check mass balance over all flow field.This is VERY important and have NOT been stressed in most books,like Patankar's and HK.Versteeg's text book. For example,u assumed a pressure field to be even as an initial condition.Then u solve the momentum equation,the result is that velocity field will definitely NOT fulfill the overall mass balance,i.e.,the mass flux on outlet will not equal flux you set on the inlet. Terrible thing is,If u don't correct the velocity on outlet to make overall mass balance,the pressure correction equation will BLOW UP!You can never get a pressure correction solution, and the pressure correction will grow up and never stop. By the way,you may wonder, that why all the sample codes are written for a cavity flow, one important reason I guess, cavity flow is INTERNAL flow and u never worry about overall mass balance,so there is no necessary to correct. However, if u modify them to a duct flow you will definitely FAIL,because of the blow up of pressure correction equation. Hope this can help someone,good luck! 
Quote:

I think that is just the difference between duct flow & cavity flow.
for duct flow, you need to add outlet type of BC which check the global mass balance. 
hey houkensjtu
I am coding the driven cavity using SIMPLE in C++ using the staggered grid and ghost cell approach, however my pressure keeps growing and the residuals start diverging after the 15th iteration or so. Any ideas why this might be happening. Thanks 
Quote:
Then I still suggest u to check the overall mass balance,i.e.,(u(i,j+1)u(i,j))+(v(i+1,j+1)v(i,j+1)),is the sum of this term being zero?If so,u should get a solution for pressure correction,and CHECK after u apply the correction to velocity,the velocity field should be divergence free. Also,u need to pay attention to underrelaxation factor,usually,factor for pressure should be less than 0.2,and 0.6~0.8 for momentum equation.This also might be a reason cause diverging. 
Thanks houkensjtu
I had taken care of the under relaxation. However the sum of (u(i,j+1)u(i,j))+(v(i+1,j+1)v(i,j+1)) for each cell is not zero. I will try fixing it. Thanks again. 
Quote:

Yeah I realized that later when you mentioned overall mass balance. Unfortunately the overall mass balance for my code is not resulting in zero.

The other problem that I am facing is when i update either u or v then I get the u or v to look like it should. How ever when I update both u and v then i get junk values.

sad ...
I guess you come from shanghai jiao tong university ....China
well, as for your tips ... i would like to share some words with you .... the all stuff you mentioned is really too simple and basic ... the essence is how to treat open boundary conditions , that is all ... if you want to talk about something useful, please read carefully Tao 's book named 'recent development of numerical heat transfer' (2001, pp234  248) or you can also read J.H. Fergizer, M. Peric, Computational Methods for Fluid Dynamics, Springer, 2002. pp. and its code _ the implemented details for Backwardfacing step flow ; The reason why people like liddriven cavity flow can be summarized as, This problem is a nice one for testing for several reasons. First, as mentioned above, there is a great deal of literature to compare with. Second, the (laminar) solution is steady. Third, the boundary conditions are simple and compatible with most numerical approaches. as for open boundary condition and its treatment for mass conservation is another topic ... best wishes ... and it is so nice to meet people from china who would like to write some codes by himself, if possible, we can share some more in CFD, xikuanghit@gmail.com 
hey houkensjtu,
I have kind of narrowed down the cause for divergence. When a moving lid is horizontal then the divergence occurs in the xvelocity but no divergence in the yvelocity. The viceversa occurs when the moving lid is vertical. Any ideas why this is happening. Thanks 
Hi everyone!
I know that I am being an absolute pest on this forum, but desperate times call for desperate measures! I am about 80% complete on my implementation of the SIMPLE algorithm in MATLAB for steady flow between two flat plates, and similar to this thread, I am having issues with the pressure correction equation... also, I am struggling to understand how to implement residuals and what is involved... as with most CFD textbooks, everything always seems a little vague, well, to me anyway! I'd greatly appreciate any assistance, the purpose of my project is for educatinal reasons. the code follows versteeg, and is easily readable to both beginners to cfd AND to Matlab, and I fully intend on making it a "go to code" for anyone with no experience, as I (and everyone else on this thread) have experienced the blood sweat and tears behinf a cfd code!! (mine continues!:( ) best regards, Michael 0565113@gmail.com 
Quote:
Read peric's book. There is nothing vague in it. There are all the information in it to write a perfectly working code and all these information are provided systematically and in a language that is easy to understand. As far as writing codes is concerned, here is small but the most important aspect that i have learned in last 8 years. If you do everything correctly, it will all work correctly. Doing everything correctly is hardest part , get this and you will see that things do work for you too like they work for others. 
Quote:
After that, my first question is, what kind of outlet are you applying? NOTING in Versteeg text book, all SIMPLE algorithm examples are done with a pressure outlet, NOT velocity outlet. Velocity outlet need extra modification to insure pressure correction equation being solvable. Good luck! 
Hello everyone, thanks for the advice! I went through it again and found a mistake, but things are still not right.. I am trying to solve for steady Poiseulle flow on a backward staggered grid using FVM and SIMPLE, these are the initial boundary conditions that I set...
%% Wall 1,The inlet u(2,:)=uin; % U values are stored at i=2 v(1,:)=vin; % V values are stored at I=1 p(1:2,:)=pstaticin; % Pressure is stored at I=1, and using dp/dx=0 enters the domain at I=2 %% Wall 2, The top plate %For Poiseulle flow; No slip boundary condition: u(:,nYp)=0; v(:,nY)=0; p(:,nYp)=0; %% Wall 3, Outlet u(nX,2:nYp1)=u(nX1,2:nYp1); % First extrapolate values from the domain u(nX,2:nYp1)=u(nX1,2:nYp1)*sum(u(2,2:nYp1))/sum(u(nX,2:nYp1)); % This multiplier is the mass in divided by the mass out, which ensures continuity. v(nXp,:)=v(nXp1,:); % See Versteeg page 273 p(nXp,2:nYp1)=0; % Constant static pressure value of '0' set at the outlet (I = NI) %% Wall 4, Plate %For Poiseulle flow; No slip boundary condition: u(:,1)=0; v(:,2)=0; p(:,1)=0; From here, I solve for the momentum equations, noting that the source term is the pressure gradient, as well as the source terms in appendix C of Versteeg. The wall shear stress also enters the umomentum equations in the central coefficient, Versteeg: Sp = (mu/delta yp)*Acell ... eqn 9.11 pg 275. Since I am using a backward staggered grid, there is no need to incorporate the inlet and outlet boundary conditions as source terms (right hand side of equation), since the hybrid differencing scheme ustilizes the already stored inlet value of uin at i=2, and the umomentum equations are calculated from i=3. Once u* and v* are calculated, solve for the pressure correction equaiton, being sure to cut the coefficients to the inlet (aW), outlet (aE), and the top and bottom plates (aN and aS), noting also that the coefficients are simply the central coeficients of the u & v momentum equations, multiplied by the density and the cellface area (rho*d*a)i,J etc... and that the source term is the continuity imbalance accross a pressure volume, i.e West face  East face + south face north face. I am using the MATLAB function BICGSTAB to solve the sets of equations... can anyone point out something wrong? REgards, 0565113@gmail.com 
Quote:
Also, I think BICGSTAB is ok but not necessary, because your grid number is certainly not so huge(maybe several hundreds or thousands). Usually backslash is far more quick for small problem. Matlab's backslash is very capable. good luck! 
Quote:
this is source of error for you, you do not apply fixed pressure boundary at the walls. Walls are always neumann conditions. 
Quote:
For pressure correction equation, as you said it is neumann boundary condition, so pressure correction on wall side is cut. For the source term because velocity on wall is 0 so it also doesn't matter. 
Quote:
Quote:

Quote:

All times are GMT 4. The time now is 06:08. 