Solution (source code)

= Solution

For steady depth and no sources of fluid mass, the <continuity equation> gives $\nabla_h\cdot(H\mathbf u)=0$. In a simply connected region this defines an <ocean transport streamfunction>:
$$
\boxed{Hu=-\psi_y,\qquad Hv=\psi_x.}
$$
A multiply connected basin additionally needs its circulation or boundary-constant data. Taking the vertical curl of $\mathbf u=(-\psi_y,\psi_x)/H$ gives the exact <relative vorticity from a variable-depth transport streamfunction> relation
$$
\boxed{\zeta=\nabla_h\cdot\left(\frac{\nabla_h\psi}{H}\right)=\frac{\nabla_h^2\psi}{H}-\frac{\nabla_hH\cdot\nabla_h\psi}{H^2}.}
$$
No small-depth-variation expansion has been made. No normal flow at a basin wall means that $\psi$ is constant along that connected wall.