CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Extracting Stream Function from nodal u,v data (

Abhijit Tilak March 4, 2004 16:09

Extracting Stream Function from nodal u,v data
Hi all,

I have a 2-D generalised structured mesh finite volume code based on SIMPLE Scheme. I have another finite element code that can do the mesh adaptation based on Least squares finite element. Currently I am trying out usual driven-cavity flow problem. I dump the nodal data i.e. x,y,u,v,p,T from finite volume code and read it into finite element code. Initially I used vorticity (w) as my mesh adaptation criteria. But the adapted mesh does'nt capture the primary and secondary vortices well. Extracting vorticity from nodal u,v was very easy. many papers I saw recommend using stream-function as adaptation criteria. I am at loss how to extract stream-function values from nodal values of u and v in my finite element code. Here is what I thought would work (but does'nt) {u} = [B]{psi} (B is the shape-func derivative matrix) so {psi} = Inv[B].{u}

Anybody know how to get this done.....


Abhijit Tilak.

Praveen March 6, 2004 12:25

Re: Extracting Stream Function from nodal u,v data
Solve for stream-function

Δψ = - ω in Ω

∇ψ . n = 0 on ∂Ω

Abhijit Tilak March 6, 2004 13:56

Re: Extracting Stream Function from nodal u,v data
Thanks for your reply. Yep!! that's excatly what I did yestarday as last resort. Use FEM code to first evaluate vorticity "w", then solve for streamfunction and adapt the mesh.

I wonder how commercial softwares like TECPLOT evaluate streamfunction from velocity. I could'nt find any info on the web.

An intresting observation about the BC you specified. I imagined that a solid surface can be thought of as a streamline and so the streamfunction is constant. You can assign an arbritrary value. so I used psi=0 on entire cavity boundary. Also psi=constant satisfies your BC. Numerically speaking...using your B.C i would not be able to invert the global stiffness matrix...ofcourse i can solve the problem iteratively... Psi=0 still means no flow through the boundary... It is also possible that psi = psi(x,y) and still satisfies no-penetration. In the driven-cavity problem I can specify psi=U*y for the moving lid....still it means psi is constant!!! any thoughts??

Thanks Abhijit

Praveen March 6, 2004 14:20

Re: Extracting Stream Function from nodal u,v data
You are right about the bc: the correct one is ψ=constant.

I think the visualization softwares are not calculating stream-function but evaluate the streamline directly by integration (you can think of passive advection of massless particles which are moving at the local fluid velocity), ie., you start at some point (x0,y0) with velocity (u0,v0) and integrate

dx/dt=u and dy/dt=v

A high order Runge-Kutta time integration may be used. The full implementation may be more involved since only discrete values of (u,v) are known.

Jonas Holdeman March 8, 2004 12:26

Re: Extracting Stream Function from nodal u,v data
There is another way to extract stream function data. There exist four-node Hermite finite elements with the stream function and the solenoidal field components as degrees of freedom. If you take the curl of these functions, you have divergence-free elements with the same degrees of freedom. You can take the vector form and fit it to your computed data using least squares or whatever. Then, simply contour the stream function. The functional form of these elements can be found in a paper titled "II, Some Hermite Interpolation Functions for Solenoidal and Irrotational Vector Fields" at the web site "". Of course you could solve your problem using these elements without the extra step.

Jim Park March 8, 2004 17:13

Re: Extracting Stream Function from nodal u,v data
This is the way I recall TecPlot generating stream lines. Of course, this is actually a particle streak line.

It has the advantage of being useful in 3 dimensions. The usual stream function becomes a vector in 3 dimensions. Also, for a 2-d compressible flow, the stream function is useful only for steady state.

But for your garden-variety 2-d flows, incompressible or steady-state compressible, it's a great way to visualize a flow pattern.

All times are GMT -4. The time now is 15:22.