# Stream function waves

The Stream function wave theory describes the water particules kinematics with a stream function
$$\Psi$$
such that the horizontal and vertical water particle velocities
$$u$$
and
$$v$$
are given by

$$u=\frac{\partial\Psi}{\partial y}$$
and
$$v=-\frac{\partial\Psi}{\partial x}$$

where
$$x$$
and
$$y$$
are the horizontal and vertical spatial coordinates. Assuming that the fluid is irrotational, the governing equation becomes the Laplace equation:

$$\frac{\partial^2{\Psi}}{\partial{y^2}}+\frac{\partial^2{\Psi}}{\partial{x^2}}=0$$

The boundary conditions can be established following for the stream function. The stream function wave theory  thensolves the governing equation with the boundary conditions for the stream function instead of the velocity potential. The problem is solved in a frame that moves at the celerity of the wave
$$c$$
, and the stream function is expressed as a Fourier series of finite number of terms
$$N$$
, such as

$$\Psi(x,y) = B_0y+\displaystyle\sum_{n=1}^{N} B_n\frac{\sinh{nk(h+y)}}{\cosh{nkh}}\cos{nkx}$$

where the
$$B_N$$
are dimensionlress constants and
$$h$$
is the water depth.

Note:
$$N$$
is called the order of the stream function and higher order means that the boundary conditions are solved at a higher order. Consequently, more non-linear waves require higher order in the stream function to correctly depict the wave kinematics, and a higher computational effort is required.

This expression for
$$\Psi$$
is then inserted into the boundary conditions. If the water depth, the wave height, the wave period and the current velocity are known, a solution that describes the wave kinematics as a sum of
$$N+1$$
components can be found.

Note: the first component corresponds to a constant, so for a regular wave of circular frequency
$$\omega$$
, the highest harmonics will oscillate at
$$N\omega$$

The implementation of the solution in Ashes follows the procedure described in Fenton (1988a). The algorithm implemented to find the solution is as follows:
1. The characterisics of the regular wave (height
$$H$$
and period
$$T$$
, as well as water depth
$$h$$
and stream function order
$$N$$
) are input by the user
2. The wave height is divided into
$$M$$
steps.
3. At the first height step 0, the solution of the equations is taken as the linear solution for a wave of those characteristics.
4. At the second height step, the equations are solved for a wave of height
$$H/M$$
. The equations are solved using the Newton method with, as initial conditions, the linear solution for such a wave.
5. At the ith height step, the equations are solved for a wave of height
$$H/[(i+1)M]$$
, using the Newton method. The initial condition is a linear interpolation of the solution of the two previous height steps.
6. At any height step, the algorithm moves to the next height step if the Newton method has converged to a value lower than a criteria specified by the user. If, after a maximum number of iterations, the algorithm has not converged, the last converged height step is returned..

Please refer to Fenton (1988a)  for a detailed explanation on the derivation of the equations and the algorithm implemented in Ashes.