CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   plot streamline (

taw December 15, 2008 01:49

plot streamline
Can some one give me the method to plot streamline, suppose I have the grid data for x,y,u,v?

I tried tecplot and got streamlines with using streamtrace, but I want streamline values at some specific values.

Does anyone has a code to produce this?

Or do I have to calculate omega (the vorticity) and should solve d^2 psi/dx^2+d^2 psi/dy^2=omega, where psi is the streamfunction?

Or does some one give me the script for gnuplot, that is most appreciated also.

Or any suggestion appreciated.



Andrew December 15, 2008 20:27

Re: plot streamline
Yes, just solve the Poisson equation with vorticity on the rhs.

taw December 15, 2008 23:25

Re: plot streamline
I have appreciated the confirmation. I will do that. Cheers TAW

Ananda Himansu December 16, 2008 05:24

Re: plot streamline
Pick any curve that you already know is a streamline, which is closed, or for which both ends lie on domain boundaries. Typically, you would pick the surface of a solid wall. Then integrate away from the curve systematically until you have a value of psi at all nodes. Use the basic definition of psi, so that d(psi)= rho*u*dy or d(psi)= -rho*v*dx, depending on whether you are integrating in the vertical or horizontal direction. If you are forced to integrate in a direction which is neither vertical or horizontal, then d(psi)=rho*(u*dy-v*dx). If you have obtained the solution with a finite volume scheme, use the same numerical integration formula for psi that is used by the FV scheme in evaluating the mass flux through the faces of the cell (control volume). This would give consistent values of psi at each node, regardless of the integration path. Otherwise, you may have to integrate both vertically and horizontally and do some averaging to get a single-valued psi.

The above integration can be done starting from a single node to which you assign an arbitrary value of the stream function. The only reasons for starting from a curve are to get the wall to exactly be a streamline, and to enable integration in a single direction rather than having to integrate in both directions. For example, for a cylinder in crossflow, you would define the cylinder surface as having a constant value of psi, and then integrate radially away from that surface.

student_58 April 27, 2009 02:19

İf you know Matlab, you can use contoutf(x,y,w) or contour(x,y,w) commands.

Jonas Holdeman April 27, 2009 09:15

You can, of course, assume a scalar (stream) function defined on your mesh (I am thinking finite element method here). Do a least squares fit of the curl of this function to your velocity field (you will have to constrain the function at one point to establish the reference level because you are fitting a derivative). Stream lines can be found by contouring the stream function. You can use your fitted function to evaluate the stream function at any point as you specified.

Hussam August 16, 2009 12:26

velocity vector, streamline and stream function
Dear Sir
My name is Hussam Ali Khalaf, postgraduate student in Iraq and Am currently working on “A Solution Algorithm for Transient Fluid Flow with Multiple Free Boundaries”
I have results for velocities values (u and v) in directions x and y for undular bore evolution (please, note the file attachment), rectangular uniform mesh (2Dimension, (i,j)=(22,10)) consists of 20 cells in the horizontal direction (length=12 , ∆x=0.6) and 8 cells in the vertical direction (height=1.6, ∆y=0.2).
Am supposed to draw velocity vector, streamline and stream function . I have a program TecPLOT, I have tried several times but I don’t fully understand how TecPLOT reads the results, would you please help me if you have any idea on how to go about it.
Thank in advance

Yours sincerely
Hussam Ali Khalaf

All times are GMT -4. The time now is 01:28.