Initial Condition in 3D flows.
Hi everybody, I am writing my own code in 3d cylindrical coordinate for unsteady flow using MAC. I solve the pressure poisson equation. Everything goes fine and the solution converges, but the solution is comming out to be wrong. I guess I applied correct B.C. However I am not sure with the initial condition as a solenoidal velocity field, which satisfies the B.C., is to be used as initial condition. Could any of you please tell me how to obtain such a velocity field for 3D. As far as I know, the stream function approach fails in 3D.
Thanks in anticipation, chandra 
Re: Initial Condition in 3D flows.
Even if your initial field is nonsolenoidal, the poisson equation should take care of it. Could you be more specific about the initial condition that you provide and also what you mean by "wrong solution"? Have you tested your code to solve standard problems with known solutions?

Re: Initial Condition in 3D flows.
What exactly do you mean by "wrong"? I see three possibilities for getting a "wrong" solution.
(a) your solution does satisfy your governing equations but differs from experimental results. This could be due to various reasons  the initial condition not being one of them. (b) your solution does not satisfy the governing equations. In this case your implementation is faulty. This, again, has nothing to do with initial conditions. (c) your boundary conditions are wrong (which you ruled out, already). Has nothing to do with initial conditions. It is possible, though very unlikely, that your solution depends on the initial conditions. As far as I know, there is so far no mathematical proof that there is a unique solution to the NavierStokes equations for any kind of BCs. In numerical practice, some cases with multiple solutions have been found for strongly nonlinear flows. However, I would guess that you are most likely dealing with a modeling problem (faulty implementation, or model does not adequately represent physics), if you really find that your solution depends on the initial condition. This should not be the case in the vast majority of flow problems. If you are confident that your code is working, and your governing equations are correct, I would spend more time on checking the boundary conditions. 
Re: Initial Condition in 3D flows.
Heyy, thanks for your suggestions. However, in MAC algorithm, it is specified that your initial velocity field should be divergence free. I think it is because if you advance in time, you are building the time dependent solution upon the initial velocity field and if your initial velocity field is not divengencefree, it is equivalent to the fact that some compressibility has been introduced in the fluid. I am in process to check my code and the solution obtained. Lets c if it is faulty implementation or some other kind of bug:)
By the way, could you please suggest me an unsteady problem whose analytical solution is available so that I can use it for checking the correctness of my code. Thank you very much, Chandra 
Re: Initial Condition in 3D flows.
Try a flow in a circular pipe (HagenPoiseuille fow), the exact solution is given in White, "Viscous fluid flow" (second ed.) equation (334). It is for steady flow, but you should get a steady solution even for unsteady case after flow is fully developed.

Re: Initial Condition in 3D flows.
Interesting... If there is no mechanism provided to diminish random numerical divergence errors, then how do you maintain the initial zero divergence throughout the computation?
On the other hand: If there is such mechanism to reduce divergence, then why do you need to start with a perfect initial condition? Am I missing something? 
Re: Initial Condition in 3D flows.
If you look into the MAC paper by Harlow and Welch, they recommended to use any but divergencefree velocity field as initial condition...solve the poisson equation to get the pressure field corresponding to this velocity field....and use this velocity and pressure field to get a velocity field at next timelevel using the N.S. Equation...and so on. i.e. use pressure and velocity fields at nth level to estimate velocity field at n+1th level (starting from n = 0), then obtain the pressure poisson equation at n+1th level using this newly obtained velocity field and solve this to get the pressure field at n+1th level. So, if your velocity field is not divergencefree at n=0 (initial condition), you can't get a divergencefree velocity field at the next time level(n = 1). It is because you have used velocity field at the n=0(which is not divergence free) and corresponding pressure field to get the solution of n = 1. I don't think if your velocity field at n = 0 is not divergence free, the pressure poisson equation can produce a pressure field just in one step so that you can advance to a divergencefree velocity field in next step. This means, if you are investigation how the flow will b developing during the course of time, the results may not be correct. However, if you are looking for a steadystate flow after a long span of time, you may get correct steadystate flow because the divergence in the velocity field decreases with the time advance and at last you get a field having sufficiently low divergence to be accepted as correct steady state solution.
Please correct me if there went something wrong in my understanding. chandra 
Re: Initial Condition in 3D flows.
As long as your initial conditions are well posed, if it is not divergencefree at n=0, the pressure poisson equation will produce a pressure field such that your solution at n=1 is divergence free (machine accuracy). I use a similar technique in my code. The two conditions under which your solution is not divergence free are: 1) You are starting off with a field which is not divergence free. The poisson equation will immediately correct this in the next step. 2) When you are iterating for pressure and you do not converge the solution, the velocity field obtained will not be divergence free.

Re: Initial Condition in 3D flows.
seems more clear now. thanks.

Re: Initial Condition in 3D flows.
Hmmm...i c...this means I can start with any velocity field, solve the P.E. obtained from this initial velocity field...and the next velocity field would b divergence free...great!! This is indeed quite helpful for me...I was meshing around to find some procedure for getting a divergencefree field...phew!!
Thanks!! Chandra 
All times are GMT 4. The time now is 23:47. 