
[Sponsors] 
February 16, 2013, 12:39 
Problem in modeling 2D Couette flow

#1 
New Member
Shantanu Bailoor
Join Date: Feb 2013
Posts: 4
Rep Power: 4 
Hey guys, this was my first attempt at modeling incompressible flow. I've been studying J.D. Anderson's "CFD Basics and applications" and took up the Couette flow problem described in chapter 9 and tried writing code for it in Matlab. I've used a finite difference scheme and a pressure correction method that is explained in the book. Also, I've tried keeping the implementation as identical to what is described in the text. The matlab script file has been attached for reference.
The test runs for a couple of iterations but then the xvelocity near the top (moving) wall and the inlet oscillates and soon the program crashes with the velocity developing inordinate values. I'm using the following boundary conditions and I guess that's where i'm messing up: Velocity BC: Inlet : v = 0 Top : u = Ue, v = 0 (noslip) Bottom : u = v= 0 (noslip) Pressure BC dp/dn = 0 (all boundaries) Could someone help me with what I could be doing wrong? Thank you, Shantanu. Last edited by shantanu; February 18, 2013 at 06:07. 

February 23, 2013, 17:25 

#2 
Senior Member
Lefteris
Join Date: Oct 2011
Location: UK, Greece
Posts: 186
Rep Power: 5 
Try reducing your dt (see also at the bottom of page 440 of the book you mentioned)
__________________
Lefteris 

March 11, 2013, 12:38 

#3 
New Member
Shantanu Bailoor
Join Date: Feb 2013
Posts: 4
Rep Power: 4 
@Lefteris: I tried decreasing the time step and it really worked. Of course, there was also a small change that had to be made in the for loops. Thanks a ton for bringing that to my notice. And it's funny how the value of dt used by the author, himself, did not work!
Regards, Shantanu. 

October 14, 2013, 13:58 
couette 2D flow ploting of u,v,p vs y

#4 
New Member
jatin kumar
Join Date: Oct 2013
Posts: 5
Rep Power: 3 
hey shantanu,
I have made some changes in that couette flow coding of matlab....... n while ploting its gving an error as ''Attempted to access v(3,4); index out of bounds because numel(v)=1. Error in couette_2D_flow (line 41) vb = 0.5*(v(j+1,i+1) + v(j+1,i+2));'' pls check it find the solution if u can see the attached file .... 

October 28, 2013, 04:47 
help needed

#5 
New Member
christy issac
Join Date: Oct 2013
Posts: 5
Rep Power: 3 
hi
iam working on the same problem.. iam trying to code it using c++ .. iam also suffering from the sam problem, my program crashes after 30 iterations .... i tried changing dt.. bt stil its not running 300 iterations iam giving my programme here .... couettenew2.c 

October 28, 2013, 04:54 

#6 
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,328
Rep Power: 17 
apart from the dt required for the numerical stability, don't forget to check that the divergencefree constraint is satisfied cellbycell since the first timestep.


October 28, 2013, 05:06 

#7 
New Member
Shantanu Bailoor
Join Date: Feb 2013
Posts: 4
Rep Power: 4 
The reason my code did not converge in the previous attempt was because I would iterate the x and ymomentum equations only once at each pseudotime step, and assumed that satisfying the divergencefree constraint would, lead to velocity fields which satisfy the momentum equations. This, in fact, is not so. Normally, you would want the velocity fields to satisfy the momentum equations at each iteration, irrespective of the pressure fields. It is only then that you can expect the velocity fields to eventually satisfy the continuity equation. I don't remember the value of dt that Anderson uses, but finally, the corrected code worked with anything up to 1e3. (I don't think I tried higher values).
Hope this helps. 

October 28, 2013, 05:27 

#8  
New Member
christy issac
Join Date: Oct 2013
Posts: 5
Rep Power: 3 
Quote:
wat u meant by divergencefree constraint..??? iam a beginer sir .. it will be helpful if u explained a little more 

February 25, 2014, 06:38 

#9  
New Member
Jack
Join Date: Dec 2013
Posts: 6
Rep Power: 3 
Quote:
Hey, I can see that you are making a number of small mistakes in your code. For example, take the pressure boundary conditions. While Anderson uses the zero pressure gradient b/c on the walls in section 6.8.6 to introduce the pressure correction method, he simplifies it to p' = 0 at the top and bottom walls during the implementation of this method for Couette flow in section 9.4.1. Secondly, check your indices for u and v velocity components. You are meant to solve all interior grid points and then use the zero order interpolation where necessary. I don't think you are doing this at the moment. Third, check the order you solve the u* and v* velocity components. I think you should start iterating from the top wall where the u velocity is 1 ft/s and go down. If you do the reverse and iterate from the bottom up, you will get different results (and I don't think this is correct). Check my code (attached). It is similar to yours but converges to the final steady state value after 300 iterations for dt = 0.001 seconds. The only thing I can't understand is why my horizontal velocity profile at K = 4 and K = 20 iterations, etc is not the same as Anderson's. The steady state is very similar however. Let me know if you can spot why that is. 

May 2, 2014, 01:44 
Thanks

#10 
New Member
Ema Amalia
Join Date: Feb 2012
Location: BandungIndonesia and TokyoJapan
Posts: 1
Rep Power: 0 
@Shantanu and Mulchah,
Thank you for sharing your program code, I have a plan to make a code to analyze Coutte Flow on a ribleted surface based on your code. I found that the code attached at Mulchah`s last message worked very well in Matlab 2013. Regards, Ema 

May 2, 2014, 02:07 

#11 
New Member
Shantanu Bailoor
Join Date: Feb 2013
Posts: 4
Rep Power: 4 
@mulchah: Thanks for your input on that code. While I'm not sure of my implementation of p'  I had tried writing that code a very long time back  you are right about the indices of u and v. I had tried fixing the code later and I noticed a bunch of errors and the velocity index issue was definitely one of them. The major problem was that I did not test each variable (u, v, p') for convergence and, thus, the correct solution was never attained.
@ema_amalia: That's good, best of luck. If either of you needs the fixed version of the code, feel free to mail me. Thanks. 

May 3, 2014, 00:22 

#12 
New Member
Jack
Join Date: Dec 2013
Posts: 6
Rep Power: 3 
@shantanu, please send me your version of the code. I think mine still has a tiny bug or two in it. My email is: hiten.m@gmail.com. Thanks!


December 18, 2014, 08:52 

#13 
New Member
Join Date: Dec 2014
Posts: 1
Rep Power: 0 
@shantanu could you please help me in what you did to satisfy the convergence criterion?


Tags 
boundary conditions, couette, incompressible, matlab code 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Domain format problem on airfoil flow simulation  andrenonaka  CFX  6  December 4, 2014 04:57 
Multiphase phase (gassolid) flow using EulerianGranular medel ( divergence problem)  jessie  FLUENT  3  May 29, 2014 11:05 
Viscoelastic flow modeling in Fluent  Ankur Navra  FLUENT  3  July 26, 2013 05:56 
transient, impregnating flow problem  fgommer  FLUENT  0  February 29, 2012 17:10 
Poiseuille flow problem  Rosie  FLUENT  1  December 6, 2002 17:52 