CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Plotting Streamlines (

James Date March 14, 2000 10:47

Plotting Streamlines
Hi there, I wonder if anyone could help me. What is the simplest method for tracing streamlines in flows containing vortices, using the velocity vector and grid node data from a CFD solution field output? I have been told that it is possible to calculate the stream function at the node points and then simply plot contours of iso-stream function. Is this an easy method to implement? If so, how do you do it, or what references can I look at which detail this type of approach. I have access to AVS/Express. I've tried using the streamline plotting function within this, but it is of no use when you need to plot the closed streamlines of shed vortices.

Many thanks.

James Date

Sheng March 14, 2000 11:56

Re: Plotting Streamlines
There are lots of Postprocess package on the market, which can be used to draw the streamline.

I remember my director asking me to draw streamline on the PC/286 screen using Quickbasic long time ago. Then, I used a little bit 'Lazy' way. I put a zero-mass particle in the cell center, then using local velocity time small time step to calculate movement, drawing the point on the screen again, then loop... If the point reaching next cell, using next cell's velocity. If reaching the wall, stop...

Now, using too much of the package, maybe more 'Lazy'....

Axel Rohde March 14, 2000 13:28

Re: Plotting Streamlines

The "Lazy" way described by Sheng is essentially the method I have incorporated into my program MicroTunnel (which can still be downloaded for free from my website, by the way).

The problem of closed loops within the wake can be solved by manually inserting these zero mass particle tracers at selected points of interest.

Also you can easily control the number of trace particles, depending on how detailed or "cluttered" you want things to look.

Axel Rohde

Patrick Godon March 14, 2000 14:00

Re: Plotting Streamlines: the "Lazy Way is the wrong one"
Since you have vortices in your flow, the vortices interact (the same sign attract each others and merge, opposite sign repulse each others), and your flow I guess is not steady at all.

When the flow is not steady, the streamlines are determined by the tangeant to the velocity of the flow locally (in an Eulerian frame I would say). These streamlines do not coincide with the tangeant to the velocity of the element of the flow (a Lagrangian Frame, say). In short the elements of the flow do not follow the streamlines. The streamline are the local and momentary tangeant of the flow in a physical space and you should draw the velocity vectors rather than follow the motion of tracers in the flow, because the tracers (particles) follow the motion of the elements of the flow rather than the streamlines.

See for example Landau Lifshitz, Hydrodynamics, pages 12 16 I think. You can also find there information about the stream function.

However, if you are interested in drawing the closed streamline around vortices, you might want to consider drawing the vorticity itself. THe vorticity will give you the vortices, I guess that's what you are looking for.

The vorticity is simply the curl of the velocity vector. you can then draw a grayscale of the vorticity, etc...


Patrick Godon March 14, 2000 14:39

use only 1(one) time step
THe Lazy way is right only if you use only one time step for the particles. So I am not quite sure what is meant by "loop", if it reaches the wall, stop, etc...

Sheng March 14, 2000 14:45

Asking it to package developer!
Maybe we should ask this question to each postprocess package's developer! What's their code behind the beautiful streamline on the screen?

regards, Sheng

Sheng March 14, 2000 15:15

Re: use only 1(one) time step
When viewing the animation of several packages, I saw there are lots of zero-mass small balls moving along the sreamline.Then I guess they may also code the stream from the 'Lazy Way'. Two direction can reach that animation: 1, velo---stream function---streamline--animation balls 2, velo-- balls moving----streamline---animaton balls

regards Sheng

Axel Rohde March 14, 2000 15:41

Re: Plotting Streamlines: the "Lazy Way is the wrong one"
True! There are streamlines, streaklines and pathlines, and their definition depends on your reference frame, as well as the steadiness or unsteadiness of the flow. The term streamlines is used "loosely" nowadays.

Patrick Godon March 14, 2000 18:41

Re: Plotting vortices
In any case the difference between the two kinds of lines (streamlines and particles path) is not too large when advancing only one grid cell. I guess for general purpose it maybe enough. <HR> For vortices, I guess the amplitude of the vorticity and its sign is enough to get what James wants, see this <A HREF="". <LI> example <\A> <HR>

James Date March 15, 2000 05:06

Re: Streamfunction Method
Thanks for your comments. With regard to the time step method, this is the method used by the AVS modules i have tried. I problem however occurs when you place the massless particle within one of vortices. The streamline trace just spirals up on itself and does not stop when it arrives back/near at its start point. I believe the module uses a Runge Kutta method in tracing these streamlines. You have control over the order of accuracy, no. segments. However there is no stopping criteria when the streamline reaches its start point, which it rarley does anyway, probably due to numerical errors. So the only way really to get something resembling a closed streamline is to look at the plot and vary the no. of segments until they arrive back/near the start point. This is tedious to say the least especially if you have say 10+ of these closed streamlines to plot. This is why i'm trying to find out how to carry out the streamfunction streamline tracing method, whereby you find the streamfunction at the nodes within the flow and then just plot iso contours of streamfunction, since the streamfunction is constant along a streamline. I'm familiar with streamfunction mathematics, however i'm unsure of how to implement this method on a grid of vector data from a CFD output. I can't seem to find any books/refs detailing how its done. I'm sure this method is widely used in many commerical packages such as Fluent. Thanks again for all your help.

Regards James Date

Joshua Lee March 15, 2000 07:40

Re: use only 1(one) time step
I would agree to use 1 time step if and only if the flow is steady after all. Because 'Lazy' way actually present streakline instead of streamline, and they are identical to each other as long as the flow is steady.


Patrick Godon March 15, 2000 11:10

Re: use only 1(one) time step
The one time step condition follows from the fact that the streamline are tangeant to the local velocties of the flow at a given moment, and these velocities coincide with the particles (tracers) velocities at the same place at the same moment. SO if the time step is very short, arrows can be used to draw the path of the particle, which actually are parallel to the flow velocities, and these will give the general streamline of the flow to a given accuracy. However, for more than one time step, the tracers moves from place to place, changing veloctiy and direction, and the lines they trace are their paths, and they do not coincide with the streamlines.

So you can use the one-time-step advance of tracers in the flow to find out about the streamlines.

Patrick Godon March 15, 2000 11:31

Re: Streamfunction Method
When you place a particle in a votex, and there is no local shear or global motion/rotation of the flow, but only the rotation of the flow inside the vortex, then the particle and the fluid are subject to the centrifugal force inside the vortex. For particles denser than the flow, they experience a net force outwards, while for particle less dense than the fluid the force is inwards (because the 'heavy' fluid is itself going outwards, it is like buoyancy, where gravity is replaced by centrifugal force). Therefore, if you put 'light' particles in a vortex, they will concentrate in the core of the vortex, they will spiral inwards. You might want to try to put particles that have the same density as the flow and use a very large drag parameter, to make sure that the particle actually 'follow' the flow. If the drag parameter is huge then in any case the particles should follow the flow.

I hope this helps, Patrick.

Jim Park March 15, 2000 16:42

Re: Streamfunction Method
"I'm sure this method is widely used in many commerical packages such as Fluent." Maybe someone who uses Fluent can say for sure, but I'm dubious.

I know that, at least a few months ago, CFX did not do streamlines. Two reasons given:

1. for transient compressible flow, a stream function (density x velocity given by the curl of the stream function vector) that satisfies continuity does not exist,

2. for three-dimensional flows, the stream function is a three-dimensional vector function and the 2-dim plots aren't so meaningful (although, for incompressible flow, that vector satisfies continuity).

My colleagues who were using CFX used the massless particle traces and/or velocity vectors to show the fluid flow patterns. That approach was recommended by the CFX technical support team.

All times are GMT -4. The time now is 18:46.