CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Problem in modeling 2D Couette flow (http://www.cfd-online.com/Forums/main/113278-problem-modeling-2d-couette-flow.html)

 shantanu February 16, 2013 12:39

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 x-velocity 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 (no-slip)
Bottom : u = v= 0 (no-slip)

Pressure BC
dp/dn = 0 (all boundaries)

Could someone help me with what I could be doing wrong?

Thank you,
Shantanu.

 Aeronautics El. K. February 23, 2013 17:25

Try reducing your dt (see also at the bottom of page 440 of the book you mentioned) ;)

 shantanu March 11, 2013 12:38

@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.

 jatin October 14, 2013 13:58

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 ....

 chrisnitk October 28, 2013 04:47

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

 FMDenaro October 28, 2013 04:54

apart from the dt required for the numerical stability, don't forget to check that the divergence-free constraint is satisfied cell-by-cell since the first time-step.

 shantanu October 28, 2013 05:06

The reason my code did not converge in the previous attempt was because I would iterate the x- and y-momentum equations only once at each pseudo-time step, and assumed that satisfying the divergence-free 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 1e-3. (I don't think I tried higher values).

Hope this helps.

 chrisnitk October 28, 2013 05:27

Quote:
 Originally Posted by FMDenaro (Post 459361) apart from the dt required for the numerical stability, don't forget to check that the divergence-free constraint is satisfied cell-by-cell since the first time-step.
sir.
wat u meant by divergence-free constraint..??? iam a beginer sir .. it will be helpful if u explained a little more

 mulchah February 25, 2014 06:38

1 Attachment(s)
Quote:
 Originally Posted by shantanu (Post 408193) 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 x-velocity 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 (no-slip) Bottom : u = v= 0 (no-slip) Pressure BC dp/dn = 0 (all boundaries) Could someone help me with what I could be doing wrong? Thank you, Shantanu.

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.

 ema_amalia May 2, 2014 01:44

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

 shantanu May 2, 2014 02:07

@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.

 mulchah May 3, 2014 00:22

@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!

 ORO December 18, 2014 08:52