Stream function

The stream function is defined for incompressible (divergence-free) flows in two dimensions – as well as in three dimensions with axisymmetry. The flow velocity components can be expressed as the derivatives of the scalar stream function. The stream function can be used to plot streamlines, which represent the trajectories of particles in a steady flow. The two-dimensional Lagrange stream function was introduced by Joseph Louis Lagrange in 1781. The Stokes stream function is for axisymmetrical three-dimensional flow, and is named after George Gabriel Stokes.
Considering the particular case of fluid dynamics, the difference between the stream function values at any two points gives the volumetric flow rate (or volumetric flux) through a line connecting the two points.
Since streamlines are tangent to the flow velocity vector of the flow, the value of the stream function must be constant along a streamline. The usefulness of the stream function lies in the fact that the flow velocity components in the "x"- and "y"- directions at a given point are given by the partial derivatives of the stream function at that point. A stream function may be defined for any flow of dimensions greater than or equal to two, however the two-dimensional case is generally the easiest to visualize and derive.
For two-dimensional potential flow, streamlines are perpendicular to equipotential lines. Taken together with the velocity potential, the stream function may be used to derive a complex potential. In other words, the stream function accounts for the solenoidal part of a two-dimensional Helmholtz decomposition, while the velocity potential accounts for the irrotational part.
Two-dimensional stream function.
Definitions.
Lamb and Batchelor define the stream function formula_1 for an incompressible flow velocity field formula_2 as follows. Given a point formula_3 and a point formula_4, 
is the integral of the dot product of the flow velocity vector formula_6 and the normal formula_7 to the curve element formula_8 In other words, the stream function formula_9 is the volume flux through the curve formula_10. The point formula_4 is simply a reference point that defines where the stream function is identically zero. A shift in formula_4 results in adding a constant to the stream function formula_9 at formula_3.
An infinitesimal shift formula_15 of the position formula_3 results in a change of the stream function:
From the exact differential 
the flow velocity components in relation to the stream function formula_9
have to be
in which case they indeed satisfy 
the condition of zero divergence resulting from flow incompressibility, i.e.
Definition by use of a vector potential.
The sign of the stream function depends on the definition used.
One way is to define the stream function formula_9 for a two-dimensional flow such that the flow velocity can be expressed through the vector potential formula_23
Where formula_25 if the flow velocity vector formula_26.
In Cartesian coordinate system this is equivalent to
Where formula_28 and formula_29 are the flow velocity components in the cartesian formula_30 and formula_31 coordinate directions, respectively.
Alternative definition (opposite sign).
Another definition (used more widely in meteorology and oceanography than the above) is
where formula_33 is a unit vector in the formula_34 direction and the subscripts indicate partial derivatives.
Note that this definition has the opposite sign to that given above (formula_35), so we have
in Cartesian coordinates.
All formulations of the stream function constrain the velocity to satisfy the two-dimensional continuity equation exactly:
The last two definitions of stream function are related through the vector calculus identity
Note that formula_39 in this two-dimensional flow.
Derivation of the two-dimensional stream function.
Consider two points A and B in two-dimensional plane flow. If the distance between these two points is very small: δn, and a stream of flow passes between these points with an average velocity, q perpendicular to the line AB, the volume flow rate per unit thickness, δΨ is given by:
As δn → 0, rearranging this expression, we get:
Now consider two-dimensional plane flow with reference to a coordinate system. Suppose an observer looks along an arbitrary axis in the direction of increase and sees flow crossing the axis from "left to right". A sign convention is adopted such that the flow velocity is "positive".
Flow in Cartesian coordinates.
By observing the flow into an elemental square in an x-y Cartesian coordinate system, we have:
where u is the flow velocity parallel to and in the direction of the x-axis, and v is the flow velocity parallel to and in the direction of the y-axis. Thus, as δn → 0 and by rearranging, we have:
Continuity: the derivation.
Consider two-dimensional plane flow within a Cartesian coordinate system. Continuity states that if we consider incompressible flow into an elemental square, the flow into that small element must equal the flow out of that element.
The total flow into the element is given by:
The total flow out of the element is given by:
Thus we have:
and simplifying to:
Substituting the expressions of the stream function into this equation, we have:
Vorticity.
The stream function can be found from vorticity using the following Poisson's equation:
or
where the vorticity vector formula_51 – defined as the curl of the flow velocity vector formula_52 – for this two-dimensional flow has formula_53 i.e. only the formula_54-component formula_55 can be non-zero.
Proof that a constant value for the stream function corresponds to a streamline.
Consider two-dimensional plane flow within a Cartesian coordinate system. Consider two infinitesimally close points formula_56 and formula_57. From calculus we have that
Say formula_9 takes the same value, say formula_60, at the two points formula_3 and formula_62, then formula_63 is tangent to the curve formula_64 at formula_3 and
implying that the vector formula_67 is normal to the curve formula_64. If we can show that everywhere formula_69, using the formula for formula_70 in terms of formula_9, then we will have proved the result. This easily follows,