\appendix

\renewcommand{\theequation}{A\arabic{equation}}
\setcounter{equation}{0}

\section{Mathematical formulation of ocean model}
\label{section:appendix}

The ocean model solves the full three-dimensional Navier-Stokes
equations for an incompressible Boussinesq fluid in a highly irregular
domain such  as that of an ocean basin.  Development of such a model
is of general interest because:
\begin{itemize}
\item Navier-Stokes models can be applied to a vast range of fluid flow
problems in engineering and myriad phenomenon in the atmosphere and ocean.
In particular, when viewed isomorphically, the incompressible Navier-Stokes
equations can be used to study a compressible atmosphere -- they are the
basis of the pressure-coordinate quasi-hydrostatic atmospheric convection
models of Miller and Pearce \cite{miller-pearce} -- see \cite{brugge}. Thus
incompressible Navier-Stokes algorithms can be used to study motion in the
atmosphere by exploiting a mathematical isomorphism.
\item In oceanographic applications, the model is appropriate for the study
of convective scales, where the hydrostatic relation breaks down, right up
to planetary-scale motions. Thus if the resolution of the model were to be
continually increased the model equations would be capable of representing
motions down to the scale of meters.
\item Numerical algorithms based on the Navier-Stokes equations need not be
any more complicated (and are sometimes simpler) than those based on
approximated forms and may offer advantages. For example, a common problem
in hydrostatic ocean models is the noise in the vertical velocity field on
the grid-scale of the model, particularly in the presence of steep
topography.  This noise may be inherent in the numerical algorithm; the
equation that expresses the condition of incompressibility -- the
continuity equation -- is used to compute the vertical velocity, leading to
an accumulation of errors as the vertical integration proceeds upwards from
the bottom.
\end{itemize}

%%\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%%  THE CONTINUOUS EQUATIONS
%%%

\subsection{The continuous equations}
\label{appendix:equations}

The physical variables of the ocean model are the fluid velocity
$\vel$, the density $\rho$, the scaled pressure $p$ defined as the
physical pressure divided by a constant average density, the
temperature $T$, and the salinity $S$. The equations of motion are: 

Newton's Law
%%
\begin{equation}
\dt{\vel} = \Gvel - \dvel p
\label{equation:law-of-newton}
\end{equation}
%%
where
%%
\begin{equation}
\Gvel = - \vel \cdot \dvel \vel + \fvel + \Fvel - \Dvel - g \hat{e}_{z}
\label{equation:gu}
\end{equation}
%%
and $\fvel$ is the Coriolis force, $\Fvel$ are forcing and dissipation
terms and $g \hat{e}_{z}$ is the gravitational force.

The heat equation is
%%
\begin{equation}
\dt{T} = \Gt
\end{equation}
%%
where
%%
\begin{equation}
\Gt = - \vel \cdot \dvel T + \Ft + \Dt
\end{equation}
%%
and the salinity equation has the analogous form
%%
\begin{equation}
\dt{S} = \Gs
\end{equation}
%%
%%
\begin{equation}
\Gs = - \vel \cdot \dvel S + \Fs + \Ds
\label{equation:salinity-equation-2}
\end{equation}
%%
In Equations~\ref{equation:law-of-newton}~$-$~\ref{equation:salinity-equation-2}, 
$\Fvel$, $\Ft$ and $\Fs$ are specified force terms and the $D$'s are
anisotropic dissipation terms of the form
%%
\begin{equation}
\left\{\begin{array}{c} \Dvel \\ \Dt \\ \Ds \end{array}\right\}
 = - K_H (\dxs + \dys) - K_V \dzs 
\left\{\begin{array}{c} \vel \\ T \\ S \end{array}\right\}
\end{equation}
%%
The velocity field satisfies the continuity equation
%%
\begin{equation}
\dvel \cdot \vel = 0
\end{equation}
%%
and the density is given by a ten-term polynomial approximation to the
local equation of state
$\rho(T,S)$


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%%  METHOD OF SOLUTION
%%%

\subsection{Method of solution}
\label{appendix:numerical-method}

Given the variables $\veln$, $\Pn$, $\Tn$ and $\Sn$, a predictor step
of size $\delt$ is first taken to compute an approximate velocity at
step $n+1$ 
%%
\begin{equation}
\veli = \veln + \delt ( \Gvel ( \veln, \rho(\Tn,\Sn)) - \dvel \Pn )
\label{equation:predict-velocity-1}
\end{equation}
%%
from which the Euler-backward driving term $G$ at step $n+1$ is
determined 
%%
\begin{equation}
\Gveli = \Gvel ( \veli, \rho(\Tn,\Sn) )
\end{equation}
%%
To enforce $\dvel \cdot \velm = 0$, the pressure at step $n+1$ is
calculated from the Poisson equation 
%%
\begin{equation}
\nabla^2 \Pm = \dvel \cdot \Gveli - \frac{1}{\delt} \dvel \cdot \veln
\end{equation}
%%
where the last term is retained to control rounding errors and the
velocity is then evolved to step 
$n+1$
%%
\begin{equation}
\velm = \veln + \delt ( \Gveli - \dvel \Pm )
\end{equation}
%%
The temperature and salinity are updated analogously, with predictor
step 
%%
\begin{eqnarray}
\Ti & = & \Tn + \delt \Gt (\velm, T) \\
\Si & = & \Sn + \delt \Gs (\velm, S)
\end{eqnarray}
%%
followed by the Euler-backward step
%%
\begin{eqnarray}
\Tm & = & \Tn + \delt \Gt (\velm, \Ti) \\
\Sm & = & \Sn + \delt \Gs (\velm, \Si) \label{equation:correct-salinity}
\end{eqnarray}
%%

All derivatives in
Equations~\ref{equation:predict-velocity-1}~$-$~\ref{equation:correct-salinity}  
are approximated by second-order differences with velocities being
defined on the centers of the mesh cell faces and $P$, $S$, and $T$
defined at the cell centers. The Poisson equation is solved by
conjugate gradient iteration.
