HELP  stream function from the velocity field
Could anyone please help me with the following problem
I have some solutions to the 2D driven cavity problem, where the solutions have been obtained using primitive variables. I would like to be able to plot contours of stream function, but as I only have the u and v velocity fields, I would need to derive the stream function from this. Does anyone out there know how to do this? If so, your help would be much appreciated. Many thanks. 
Re: HELP  stream function from the velocity field
Hi in my diploma work i had the same problem. You can get the streamfunktion by a integrating over the velocityfield.
I think you can find the formular in a fluid dynamics book. Then you must transform the integration into a summation. 
Re: HELP  stream function from the velocity field
you can calculate that by preapearing a subroutine , where for every cell position you caculate the derivate of the stream function U=d (ksi)/dy and V= d ( ksi)/dx , by using a finite difference method you can get the value of the variation of the stream function at the bondaries of your cell.
Generate this for your whole volume good luck 
Re: HELP  stream function from the velocity field
A quick correction:
caculate the derivate of the stream function U=d (ksi)/dy and V= d ( ksi)/dx should read: caculate the derivative of the stream function U=d (ksi)/dy and V=  d ( ksi)/dx but this is going the wrong way. The question is how to go from velocity to stream function NOT the other way. The guy from Stuttgart has the right idea this means that one has to integrate!! 
Re: HELP  stream function from the velocity field
I believe Essemiani is also right. A PDE can be either integrated or finitedifferenced for a solution. I guess the latter is preferable for a general problem. Hope you agree with me.
Michael 
Re: HELP  stream function from the velocity field
Simple.
Set u=d(Psi)/d(y) and v=d(Psi)/d(x), where Psi is supposed to be the stream function. Take the definition of the vorticity, omega=d(u)/d(y)d(v)/d(x) and express u and v in this equation using the stream function. This will give you a poisson equation for the stream function, div grad (Psi) = d^2(Psi)/dx^2+d^2(Psi)/dy^2 = omega, which can easily be solved by any method you like. Applying this equation to your driven cavity problem you should use Psi=0 on all boundaries, even on the upper (or whatever) moving plate. For some reference data you could check Sohn, J.L., Int.J.for Num. Meth. in Fluids, 8, (1988), 144691490. Chris. 
Re: HELP  stream function from the velocity field
Ah! A long trip from the primitivevariableapproach back to the streamfunctionvorticityapproach. It is an acceptable approach. For the directlineintegrationapproach, the derived streamfunction value may not be unique, depending on the direction of integration ( you can integrate the definition in either x or ydirection). Most of the time, the particle trajectory method is used for the primitivevariableapproach to obtain the streamline information. This is because neither streamfunction nor vorticity is used directly in the formulation. And the vorticity calculation has to be defined through out the flow field and boundary consistently.

Re: HELP  stream function from the velocity field
Hi John,
in what way do you think will your response to my response to fred's original question be of any help to fred ? With the incompressibility constraint satisfied only in the mean I can for a given velocity field  at least for the driven cavity problem in question  not think of any other method as simple as the one described. If you have a (concrete) better suggestion I am of course interested to hear about it. 
Re: HELP  stream function from the velocity field
For a particle trajectory method, how do you decide where to 'start' each streamline? I am looking at a similar problem with a triangular mesh and primitive variables.
Ronan 
Re: HELP  stream function from the velocity field
When I answer a question, normally, I don't have any particular person in mind. But rather the issues related to the original question. The practical answer to the original question first: the field approach of solving the streamfunction equation with the vorticity source term derived from the U,V velocity field is the nature selection. Because this will eliminate the uniqueness issue associated with the directional integration of the velocity component to obtain the streamfunction. This does not mean that the direct integration is not practical. When you have fine mesh solution, the error will be small. Therefore, if you have fine mesh solution, you can do it either way. Otherwise, I would say, the field approach is a more formal solution. Now that I have answered the original question, I'd like to expand it a little more in this primitivevariablestreamfunctionvorticity loop. Suppose that we derive the vorticity from the velocity components field and obtain the streamfunction from streamfunction field equation with vorticity source term, then ask a question: " Will the derived vorticity function still follow the vorticity governing equation ?" If it does not satisfy the vorticity equation, then " Is the derived streamfunction still valid ?"

Re: HELP  stream function from the velocity field
Based on my experience with the commercial CFD codes and postprocessors, I normally pick a point a couple of points aways from the wall and several points away from the inlet to start the trajectory tracing to begin with. Once I have some general picture of the flow field, I then move to other neighboring points ( skipping a point is a good idea).Once the general flow pattern ( or separation regions) is defined, I can move into the specific region and start a trajectory tracing process there. You will get better pictures when you are dealing with fine mesh solutions. In 3D simulation, trajectory tracing is extremely important, because there is no replacement for it yet. It is a great tool for viscous flows. So, if you have not used this tool before, you are encouraged to check it out. It will help you a great deal in your CFD career.

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