Problem in modeling 2D Couette flow
1 Attachment(s)
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. 
Try reducing your dt (see also at the bottom of page 440 of the book you mentioned) ;)

@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! :D
Regards, Shantanu. 
couette 2D flow ploting of u,v,p vs y
1 Attachment(s)
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 .... 
help needed
1 Attachment(s)
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 .... Attachment 26416 
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.

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. 
Quote:
wat u meant by divergencefree constraint..??? iam a beginer sir .. it will be helpful if u explained a little more 
1 Attachment(s)
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. 
Thanks
@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 
@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. 
@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!

@shantanu could you please help me in what you did to satisfy the convergence criterion?

@shantanu...hi me too need your fixed code for reference...please mail me ramkumar21194@gmail.com
Thanks in advance 
All times are GMT 4. The time now is 09:31. 