## Derivation of the ray equations

Mathematically rays are characteristics of the dispersion equation. In an inhomogeneous medium the dispersion equation reads:
$F\left(\omega ,k$i,t,xi)=0
Here $\omega$ and $k$i are derivatives of the phase function $\psi \left(t,x$i), i.e. $\omega = \partial \psi /\partial t$ and $k$i = -∂ψ/∂xi.

Thus equation (1) is an example of a nonlinear partial differential equation of first order.
In general such an equation is written as: $F\left(\psi , \psi$,i, xi)=0 where $\psi$,i are the partial derivatives of $\psi$ with respect to independent coordinates $x$i. Such an equation has characteristics for which holds (see e.g. Webster, 1955, section 24, eq. 45):
$dx$i/du = -∂F/∂ψ,i
$d\psi /du = \Sigma \psi$,i ∗ ∂F/∂ψ,i,
$d\psi$,i/du = -∂F/∂xi - ψ,i ∗ ∂F/∂ψ

Equation (1) is written more specifically as:
$\omega -k$iUi-[g k tanh(kd)]1/2 = 0,
we obtain the following ray equations:
$dt/du = \partial F/\partial \omega = 1$, so that the parameter $u$ in fact is time $t$.

Furthermore:
$dx$i/dt = -∂F/∂ki = Ui + ∂σ/∂k ∗ ki/k ,    where    $\sigma = \left[g k tanh\left(kd\right)\right]1/2$
$d\psi /dt = \omega \ast \partial F/\partial \omega + \Sigma k$i ∗ ∂F/∂ki = ω - ki Ui - ki ∗ ∂σ/∂ki,
$d\omega /dt = -\partial F/\partial t = k$i ∗ ∂Ui/∂t - ∂σ/∂d ∗ ∂d/∂t, showing that $\omega$ is constant in stationary cases.
$dk$i/dt = ∂F/∂xi = -kj ∗ ∂Uj/∂xi - ∂σ/∂d ∗ ∂d/∂xi

Refraction can be found from the last equation since $\theta$ is the direction of the vector $k$i:
$d\theta /dt = -k$i/k ∗ ∂Ui/∂n - 1/k ∗ ∂σ/∂d ∗ ∂d/∂n,
where    $n$ is the spatial coordinate perpendicular to $\theta$.
This equation is used in SWAN together with the frequency shift equation:
$d\sigma /dt = \partial \sigma /\partial d \ast dd/dt + \partial \sigma /\partial k \ast dk/dt$

The picture below shows a ray pattern for the Haringvliet estuary in the Netherlands. At the same time it shows the weakness of the ray method: it is unsuitable to predict wave heights in areas with irregular bottom.

## Action conservation

In presence of a current (also in the spacial case that the current velocity is 0) wave action is conserved. The action density is denoted as N.
If N is formulated in (x, k)-space it is constant along wave rays assuming that source terms (dissipation and generation) are 0.
$dN/dt = \partial N/\partial t + c$xi∂N/∂xi + cki∂N/∂ki = 0
This is equivalent to the well-known conservation equation:
$\partial N/\partial t + \partial /\partial x$i[cxiN] + ∂/∂ki[ckiN] = 0
because it can be seen from the equations above that
$\partial /\partial x$i [dxi/dt] = -∂2F/∂ki∂xi = -∂/∂ki [dki/dt]
If N is formulated in other variables, e.g. $\sigma$ and $\theta$, the only valid form is the conservation equation:
$\partial N\text{'}/\partial t + \partial /\partial x$i [cxiN'] + ∂/∂σ [cσN'] + ∂/∂θ [cθN'] = 0

In a grid model the conservation form is the efficient formulation; in a ray-based model it is more efficient to use the constancy of N(t,x,k). Thus also $\left(c$g/k) N'(t,x,σ,θ) is constant along a wave ray.
In presence of source terms N is not constant; now one can use:
$d/dt \left[N\left(t,$x,k)] = SN(t,x,k)
or: $d/dt \left[\left(c$g/k) N'(t,x,σ,θ)] = (cg/k) S'(t,x,σ,θ).

### References

Webster, A.G. (1955)
Partial Differential Equations of Mathematical Physics, Dover Publ. 1955