sci.math.numanalysis
SUNA14, Stream Function & Flow Potential
========================================
A sci.math.numanalysis article with ID , dated
11 Jun 91, posted by an (unknown) netlander, says:
> Hello
> I am looking for a contour Plot which can plot a streamline with
> ( U, V ) output form, ...
A streamline plot is simply a contourplot of the streamfunction. But that is
not the point here, of course. He/she has the velocity field (u,v) given ...
The relationship between the streamfunction F and the velocities u , v in
two dimensions is given by:
u = dF/dy ; v =  dF/dx (signs correct)
BTW. Similar relationships exist for the flow potential P :
dP/dx = u ; dP/dy = v
Let's take a linear triangle as an element (Re: SUNA, Triangle Isoparametrics).
We seek a discretization of partial derivatives dF/d(x,y) at such triangles.
First repeat the isoparametrics, F.D. representation:
x = x1 + (x2  x1).h + (x3  x1).k
y = y1 + (y2  y1).h + (y3  y1).k
F = F1 + (F2  F1).h + (F3  F1).k
The derivatives to the global coordinates will be expressed in derivatives to
the local coordinates, and vice versa. This is done as follows:
dF/dh = dx/dh.dF/dx + dy/dh.dF/dy
dF/dk = dx/dk.dF/dx + dy/dk.dF/dy
We easily find: dx/dh = (x2  x1) ; dx/dk = (x3  x1)
dy/dh = (y2  y1) ; dy/dk = (y3  y1)
So:
F2  F1 = (x2  x1).dF/dx + (y2  y1).dF/dy = (y2  y1).u  (x2  x1).v
F3  F1 = (x3  x1).dF/dx + (y3  y1).dF/dy = (y3  y1).u  (x3  x1).v
And:
P2  P1 = (x2  x1).dP/dx + (y2  y1).dP/dy = (x2  x1).u + (y2  y1).v
P3  P1 = (x3  x1).dP/dx + (y3  y1).dP/dy = (x3  x1).u + (y3  y1).v
It is seen that triangles are in fact superfluous. The discretization can be
carried out over ONEdimensional linear elements alone as:
F2  F1 = (y2  y1).u  (x2  x1).v ; P2  P1 = (x2  x1).u + (y2  y1).v
Compare this with wellknown analytic expressions:
2 2
/ /
F2  F1 =  (u.dy  v.dx) ; P2  P1 =  (u.dx + v.dy)
/ /
1 1
No coincidence, of course.
Suppose that we have determined the streamfunction F , one way or another.
We want to calculate now the velocity field (u,v). This can be done as follows.
Choose the points where the velocities are calculated at STAGGERED positions
with respect to the points where the streamfunction values are defined. Thus:
o o o o o Here o = streamfunction nodes
* * * * * = velocity nodes
o o o o o
* * * * Consider the following "element":
o o o o o
* * * * F3 o o F4 The accompanying equations are:
o o o o o \ /
* * * * * u,v (y4  y1).u  (x4  x1).v = F4  F1
o o o o o / \ (y3  y2).u  (x3  x2).v = F3  F2
F1 o o F2
We arrive at two equations with two unknowns. Not too difficult to solve.
A similar story can be told in case the potential function is already known.
Then solve (u,v) from:
(x4  x1).u + (y4  y1).v = P4  P1
(x3  x2).u + (y3  y2).v = P3  P2
This was the inverse of the problem, huh? Back now to the original question.
Suppose that we have calculated a velocity field (u,v) and we want to calculate
streamfunction contours from this velocity field. This can be done as follows.
Choose the points where the streamfunction is calculated at STAGGERED positions
with respect to the points where the velocities are defined. The picture looks
a bit different, however, since half of the previous nodes (o) is "missing":
o o o Here * = velocity nodes
* * * * o = streamfunction nodes / potential nodes
o o
* * * * Consider the following "element":
o o o
* * * * o F2,P2 The accompanying equations are:
o o o /
* * * * * u,v F2  F1 = (y2  y1).u  (x2  x1).v
O o o /
^ F1,P1 o P2  P1 = (x2  x1).u + (y2  y1).v

The one and only "boundary condition" is indicated: it is a starting value
(reference point) for F , say F1 = FO . Then successive values F2 , F3 , F4
are found by travelling through the elements, and solving the equations one by
one at a time.
If the flow field (u,v) is calculated well, the outcome of this exercise should
not be dependent upon the paths chosen, at least not for the streamfunction.
A similar story (well, a bit different) can be told for the flow potential.
Huh, graph theorists? Do we have a travelling salesman problem here? ;)

* Han de Bruijn; Applications&Graphics  "A little bit of Physics * No
* TUD Computing Centre; P.O. Box 354  would be NO idleness in * Oil
* 2600 AJ Delft; The Netherlands.  Mathematics" (HdB). * for
* Email: Han.deBruijn@RC.TUDelft.NL  Fax: +31 15 78 37 87 * Blood