
% ================================================================
% Chapter Ñ Appendix A : Curvilinear s-Coordinate Equations
% ================================================================
\chapter{Curvilinear $s$-Coordinate Equations}
\label{Apdx_A}
\minitoc


In order to establish the set of Primitive Equation in curvilinear $s$-coordinates ($i.e.$ 
orthogonal curvilinear coordinate in the horizontal and $s$-coordinate in the vertical), we 
start from the set of equation established in \S\ref{PE_zco_Eq} for the special case 
$k = z$ and thus $e_3 = 1$, and we introduce an arbitrary vertical coordinate 
$s = s(i,j,z,t)$. Let us define a new vertical scale factor by $e_3 = \partial z / \partial s$ 
(which now depends on $(i,j,z,t)$) and the horizontal slope of $s$-surfaces by :
\begin{equation} \label{Apdx_A_s_slope}
\sigma _1 =\frac{1}{e_1 }\;\left. {\frac{\partial z}{\partial i}} \right|_s 
\quad \text{and} \quad 
\sigma _2 =\frac{1}{e_2 }\;\left. {\frac{\partial z}{\partial j}} \right|_s 
\end{equation}

The chain rule to establish the model equations in the curvilinear $s$-coordinate system 
is:
\begin{equation} \label{Apdx_A_s_chain_rule}
\begin{aligned}
&\left. {\frac{\partial \bullet }{\partial t}} \right|_z  =
\left. {\frac{\partial \bullet }{\partial t}} \right|_s 
	 -\frac{\partial \bullet }{\partial s}\;\frac{\partial s}{\partial t} \\
&\left. {\frac{\partial \bullet }{\partial i}} \right|_z  =
  \left. {\frac{\partial \bullet }{\partial i}} \right|_s 
  	  -\frac{\partial \bullet }{\partial s}\;\frac{\partial s}{\partial i}=
	  \left. {\frac{\partial \bullet }{\partial i}} \right|_s 
	  -\frac{e_1 }{e_3 }\sigma _1 \frac{\partial \bullet }{\partial s} \\
&\left. {\frac{\partial \bullet }{\partial j}} \right|_z  =
\left. {\frac{\partial \bullet }{\partial j}} \right|_s 
	- \frac{\partial \bullet }{\partial s}\;\frac{\partial s}{\partial j}=
\left. {\frac{\partial \bullet }{\partial j}} \right|_s 
	- \frac{e_2 }{e_3 }\sigma _2 \frac{\partial \bullet }{\partial s} \\
&\;\frac{\partial \bullet }{\partial z}  \;\; = \frac{1}{e_3 }\frac{\partial \bullet }{\partial s} \\
\end{aligned}
\end{equation}

In particular applying the time derivative chain rule to $z$ provide the expression of $w_s$,  the vertical velocity of the $s-$surfaces:
\begin{equation} \label{Apdx_A_w_in_s}
w_s   =  \left.   \frac{\partial z }{\partial t}   \right|_s 
				= \frac{\partial z}{\partial s} \; \frac{\partial s}{\partial t} 
			    = e_3 \, \frac{\partial s}{\partial t} 
\end{equation}

% ================================================================
% continuity equation
% ================================================================
\section{Continuity Equation}
\label{Apdx_B_continuity}

Using (\ref{Apdx_A_s_chain_rule}) and the fact that the horizontal scale factors $e_1$ and $e_2$ do not depend on the vertical coordinate, the divergence of the velocity relative to the ($i$,$j$,$z$) coordinate system is transformed as follows:

\begin{align*}
\nabla \cdot {\rm {\bf U}} 
&= \frac{1}{e_1 \,e_2 }  \left[ \left. {\frac{\partial (e_2 \,u)}{\partial i}} \right|_z 
						+\left. {\frac{\partial(e_1 \,v)}{\partial j}} \right|_z  \right]
+ \frac{\partial w}{\partial z} 		\\
\\
&     = \frac{1}{e_1 \,e_2 }  \left[ 
		  \left.   \frac{\partial (e_2 \,u)}{\partial i}    \right|_s       
		  - \frac{e_1 }{e_3 } \sigma _1 \frac{\partial (e_2 \,u)}{\partial s}
		+ \left.   \frac{\partial (e_1 \,v)}{\partial j}    \right|_s       
		  - \frac{e_2 }{e_3 } \sigma _2 \frac{\partial (e_1 \,v)}{\partial s}	\right]
	+ \frac{\partial w}{\partial s} \; \frac{\partial s}{\partial z}                        \\
\\
&     = \frac{1}{e_1 \,e_2 }   \left[ 
		  \left.   \frac{\partial (e_2 \,u)}{\partial i}    \right|_s       
		+ \left.   \frac{\partial (e_1 \,v)}{\partial j}    \right|_s       	\right]
	+ \frac{1}{e_3 }\left[        \frac{\partial w}{\partial s}
						-  \sigma _1 \frac{\partial u}{\partial s}
						-  \sigma _2 \frac{\partial v}{\partial s}      \right]          \\
\\
&     = \frac{1}{e_1 \,e_2 \,e_3 }   \left[ 
		  \left.   \frac{\partial (e_2 \,e_3 \,u)}{\partial i}    \right|_s  
		  -\left.    e_2 \,u    \frac{\partial e_3 }{\partial i}     \right|_s      
		+ \left.  \frac{\partial (e_1 \,e_3 \,v)}{\partial j}    \right|_s
		  - \left.    e_1 v      \frac{\partial e_3 }{\partial j}    \right|_s   \right]          \\
& \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad
	+ \frac{1}{e_3 } \left[        \frac{\partial w}{\partial s}
						-  \sigma _1 \frac{\partial u}{\partial s}
						-  \sigma _2 \frac{\partial v}{\partial s}      \right]      \\
\\
\end{align*}

Noting that $\frac{1}{e_1 }\left. {\frac{\partial e_3 }{\partial i}} 
\right|_s =\frac{1}{e_1 }\left. {\frac{\partial ^2z}{\partial i\,\partial 
s}} \right|_s =\frac{\partial }{\partial s}\left( {\frac{1}{e_1 }\left. 
{\frac{\partial z}{\partial i}} \right|_s } \right)=\frac{\partial \sigma _1 
}{\partial s}$ and $\frac{1}{e_2 }\left. {\frac{\partial e_3 }{\partial j}} 
\right|_s =\frac{\partial \sigma _2 }{\partial s}$, it becomes:

\begin{align*}
\nabla \cdot {\rm {\bf U}} 
& = \frac{1}{e_1 \,e_2 \,e_3 }  \left[   
		  \left.  \frac{\partial (e_2 \,e_3 \,u)}{\partial i} \right|_s 
		+\left.  \frac{\partial (e_1 \,e_3 \,v)}{\partial j} \right|_s        \right]        \\ 
& \qquad \qquad \qquad \qquad \qquad \quad
 +\frac{1}{e_3 }\left[ {\frac{\partial w}{\partial s}-u\frac{\partial \sigma _1 }{\partial s}-v\frac{\partial \sigma _2 }{\partial s}-\sigma _1 \frac{\partial u}{\partial s}-\sigma _2 \frac{\partial v}{\partial s}} \right] \\ 
\\
& = \frac{1}{e_1 \,e_2 \,e_3 }  \left[   
		  \left.  \frac{\partial (e_2 \,e_3 \,u)}{\partial i} \right|_s 
		+\left.  \frac{\partial (e_1 \,e_3 \,v)}{\partial j} \right|_s        \right]      
   + \frac{1}{e_3 } \; \frac{\partial}{\partial s}   \left[  w -  u\;\sigma _1  - v\;\sigma _2  \right]
 \end{align*} 
 
Here, $w$ is the vertical velocity relative to the $z-$coordinate system. Introducing the dia-surface velocity component, $\omega $, defined as the velocity relative to the moving $s$-surfaces and normal to them:
\begin{equation} \label{Apdx_A_w_s}
\omega  = w - w_s - \sigma _1 \,u - \sigma _2 \,v    \\
\end{equation}
with $w_s$ given by \eqref{Apdx_A_w_in_s}, we obtain the expression of the divergence of the velocity in the curvilinear $s$-coordinate system:
\begin{align*} \label{Apdx_A_A4}
\nabla \cdot {\rm {\bf U}} 
&= \frac{1}{e_1 \,e_2 \,e_3 }    \left[ 
		  \left.  \frac{\partial (e_2 \,e_3 \,u)}{\partial i} \right|_s 
		+\left.  \frac{\partial (e_1 \,e_3 \,v)}{\partial j} \right|_s        \right]      
+ \frac{1}{e_3 } \frac{\partial \omega }{\partial s} 
+ \frac{1}{e_3 } \frac{\partial w_s       }{\partial s}    \\
\\
&= \frac{1}{e_1 \,e_2 \,e_3 }    \left[ 
		  \left.  \frac{\partial (e_2 \,e_3 \,u)}{\partial i} \right|_s 
		+\left.  \frac{\partial (e_1 \,e_3 \,v)}{\partial j} \right|_s        \right]      
+ \frac{1}{e_3 } \frac{\partial \omega }{\partial s} 
+ \frac{1}{e_3 } \frac{\partial}{\partial s}  \left(  e_3 \; \frac{\partial s}{\partial t}   \right)   \\
\\
&= \frac{1}{e_1 \,e_2 \,e_3 }    \left[ 
		  \left.  \frac{\partial (e_2 \,e_3 \,u)}{\partial i} \right|_s 
		+\left.  \frac{\partial (e_1 \,e_3 \,v)}{\partial j} \right|_s        \right]      
+ \frac{1}{e_3 } \frac{\partial \omega }{\partial s} 
+ \frac{\partial}{\partial s} \frac{\partial s}{\partial t}
+ \frac{1}{e_3 } \frac{\partial s}{\partial t} \frac{\partial e_3}{\partial s}     \\
\\
&= \frac{1}{e_1 \,e_2 \,e_3 }    \left[ 
		  \left.  \frac{\partial (e_2 \,e_3 \,u)}{\partial i} \right|_s 
		+\left.  \frac{\partial (e_1 \,e_3 \,v)}{\partial j} \right|_s        \right]      
+ \frac{1}{e_3 } \frac{\partial \omega }{\partial s} 
+ \frac{1}{e_3 } \frac{\partial e_3}{\partial t}     \\
\end{align*}

As a result, the continuity equation \eqref{Eq_PE_continuity} in $s$-coordinates becomes:
\begin{equation} \label{Apdx_A_A5}
\frac{1}{e_3 } \frac{\partial e_3}{\partial t} 
+ \frac{1}{e_1 \,e_2 \,e_3 }\left[ 
			{\left. {\frac{\partial (e_2 \,e_3 \,u)}{\partial i}} \right|_s 
		    +  \left. {\frac{\partial (e_1 \,e_3 \,v)}{\partial j}} \right|_s } \right]
 +\frac{1}{e_3 }\frac{\partial \omega }{\partial s} = 0   
\end{equation}

% ================================================================
% momentum equation
% ================================================================
\section{Momentum Equation}
\label{Apdx_B_momentum}

Let us consider \eqref{Eq_PE_dyn_vect}, the first component of the 
momentum equation in the vector invariant form (similar manipulations can be performed on the second one). Its non linear term can be transformed 
as follows:

\begin{align*}
&+\left. \zeta \right|_z v-\frac{1}{2e_1 }\left. {\frac{\partial (u^2+v^2)}{\partial i}} \right|_z 
- w \;\frac{\partial u}{\partial z} \\
\\
&\qquad=\frac{1}{e_1 \,e_2 }\left[ {\left. {\frac{\partial (e_2 \,v)}{\partial i}} 
\right|_z -\left. {\frac{\partial (e_1 \,u)}{\partial j}} \right|_z } 
\right]\;v-\frac{1}{2e_1 }\left. {\frac{\partial (u^2+v^2)}{\partial i}} 
\right|_z -w\frac{\partial u}{\partial z}      \\
\\
&\qquad =\frac{1}{e_1 \,e_2 }\left[ {\left. {\frac{\partial (e_2 \,v)}{\partial i}} 
\right|_s -\left. {\frac{\partial (e_1 \,u)}{\partial j}} \right|_s }     \right. 
 \left. {-\frac{e_1 }{e_3 }\sigma _1 \frac{\partial (e_2 \,v)}{\partial s}+\frac{e_2 }{e_3 }\sigma _2 \frac{\partial (e_1 \,u)}{\partial s}} \right]\;v \\ 
&\qquad \qquad \qquad \qquad \qquad
{ -\frac{1}{2e_1 }\left( {\left. {\frac{\partial (u^2+v^2)}{\partial i}} \right|_s -\frac{e_1 }{e_3 }\sigma _1 \frac{\partial (u^2+v^2)}{\partial s}} \right)
-\frac{w}{e_3 }\frac{\partial u}{\partial s} }    \\
\end{align*}
\begin{align*}
\qquad  &= \left. \zeta \right|_s \;v
	- \frac{1}{2\,e_1}\left. {\frac{\partial (u^2+v^2)}{\partial i}} \right|_s 
	- \frac{w}{e_3 }\frac{\partial u}{\partial s}
	- \left[   {\frac{\sigma _1 }{e_3 }\frac{\partial v}{\partial s}
	           - \frac{\sigma_2 }{e_3 }\frac{\partial u}{\partial s}}   \right]\;v      \\
\qquad&\qquad \qquad \qquad \qquad \qquad \qquad
\qquad  \qquad \qquad \qquad \quad
	+\frac{\sigma _1 }{2e_3 }\frac{\partial (u^2+v^2)}{\partial s}      \\
%\\
\qquad &= \left. \zeta \right|_s \;v
		- \frac{1}{2e_1 }\left. {\frac{\partial (u^2+v^2)}{\partial i}} \right|_s \\ 
\qquad&\qquad \qquad \qquad
 -\frac{1}{e_3} \left[    {w\frac{\partial u}{\partial s}
	+\sigma _1 v\frac{\partial v}{\partial s} - \sigma _2 v\frac{\partial u}{\partial s}
	-\sigma _1 u\frac{\partial u}{\partial s} - \sigma _1 v\frac{\partial v}{\partial s}} \right] \\
\\
\qquad &= \left. \zeta \right|_s \;v
		- \frac{1}{2e_1 }\left. \frac{\partial (u^2+v^2)}{\partial i} \right|_s    
		  - \frac{1}{e_3} \left[  w - \sigma _2 v - \sigma _1 u  \right] 
		  			 \; \frac{\partial u}{\partial s}   \\
\\
\qquad &= \left. \zeta \right|_s \;v
		- \frac{1}{2e_1 }\left. {\frac{\partial (u^2+v^2)}{\partial i}} \right|_s   
		  - \frac{1}{e_3 }\omega \frac{\partial u}{\partial s} 
		  - \frac{\partial s}{\partial t}  \frac{\partial u}{\partial s} 
\end{align*}

Therefore, the non-linear terms of the momentum equation have the same form 
in $z-$ and $s-$coordinates but with the addition of the time derivative of the velocity: 
\begin{multline}  \label{Apdx_A_momentum_NL}
+\left. \zeta \right|_z v-\frac{1}{2e_1 }\left. {\frac{\partial (u^2+v^2)}{\partial i}} \right|_z 
- w \;\frac{\partial u}{\partial z}    \\
= - \frac{\partial u}{\partial t} + \left. \zeta \right|_s \;v
	- \frac{1}{2e_1 }\left. {\frac{\partial (u^2+v^2)}{\partial i}} \right|_s   
	- \frac{1}{e_3 }\omega \frac{\partial u}{\partial s} 
\end{multline}

The pressure gradient term can be transformed as follows:
\begin{equation} \label{Apdx_A_grad_p}
\begin{split}
 -\frac{1}{\rho _o e_1 }\left. {\frac{\partial p}{\partial i}} \right|_z& =-\frac{1}{\rho _o e_1 }\left[ {\left. {\frac{\partial p}{\partial i}} \right|_s -\frac{e_1 }{e_3 }\sigma _1 \frac{\partial p}{\partial s}} \right] \\
& =-\frac{1}{\rho _o \,e_1 }\left. {\frac{\partial p}{\partial i}} \right|_s +\frac{\sigma _1 }{\rho _o \,e_3 }\left( {-g\;\rho \;e_3 } \right) \\
&=-\frac{1}{\rho _o \,e_1 }\left. {\frac{\partial p}{\partial i}} \right|_s -\frac{g\;\rho }{\rho _o }\sigma _1
\end{split}
\end{equation}

An additional term appears in (\ref{Apdx_A_grad_p}) which accounts for the tilt of model 
levels.

Introducing \eqref{Apdx_A_momentum_NL} and \eqref{Apdx_A_grad_p} in \eqref{Eq_PE_dyn_vect} and regrouping the time derivative terms in the left hand side, and performing the same manipulation on the second component, we obtain the vector invariant form of momentum equation in $s-$coordinate :
\begin{subequations} \label{Apdx_A_dyn_vect}
\begin{multline} \label{Apdx_A_PE_dyn_vect_u}
 \frac{1}{e_3} \frac{\partial \left(  e_3\,u  \right) }{\partial t}=
	+   \left( {\zeta +f} \right)\,v                                    
	-   \frac{1}{2\,e_1} \frac{\partial}{\partial i} \left(  u^2+v^2   \right) 
	-   \frac{1}{e_3} \omega \frac{\partial u}{\partial k}       \\
	-   \frac{1}{e_1} \frac{\partial}{\partial i} \left( \frac{p_s + p_h}{\rho _o}    \right)    
	+  g\frac{\rho }{\rho _o}\sigma _1 
	+   D_u^{\vect{U}}  +   F_u^{\vect{U}}
\end{multline}
\begin{multline} \label{Apdx_A_dyn_vect_v}
 \frac{1}{e_3}\frac{\partial \left(  e_3\,v  \right) }{\partial t}=
	-   \left( {\zeta +f} \right)\,u   
	-   \frac{1}{2\,e_2 }\frac{\partial }{\partial j}\left(  u^2+v^2  \right)     	
	-   \frac{1}{e_3 } \omega \frac{\partial v}{\partial k}         \\
	-   \frac{1}{e_2 }\frac{\partial }{\partial j}\left( \frac{p_s+p_h }{\rho _o}  \right) 
	 +  g\frac{\rho }{\rho _o }\sigma _2   
	+  D_v^{\vect{U}}  +   F_v^{\vect{U}}
\end{multline}
\end{subequations}

It has the same form as in $z-$coordinate but the vertical scale factor that has appeared inside the time derivative. The form of the vertical physics and forcing terms remain unchanged. The form of the lateral physics is discussed in appendix~\ref{Apdx_B}.  

% ================================================================
% Tracer equation
% ================================================================
\section{Tracer Equation}
\label{Apdx_B_tracer}

The tracer equation is obtained using the same calculation as for the 
continuity equation and then regrouping the time derivative terms in the left hand side :

\begin{multline} \label{Apdx_A_tracer}
 \frac{1}{e_3} \frac{\partial \left(  e_3 T  \right)}{\partial t} 
 	= -\frac{1}{e_1 \,e_2 \,e_3 } 
		\left[ {\frac{\partial }{\partial i}} \left( {e_2 \,e_3 \;Tu} \right) \right .
		    +         \frac{\partial }{\partial j} \left( {e_1 \,e_3 \;Tv} \right)                \\
		    + \left. \frac{\partial }{\partial j} \left( {e_1 \,e_3 \;Tv} \right) \right] +D^{T} +F^{T} \; \;
\end{multline}


The expression of the advection term is a straight consequence of (A.4), the 
expression of the 3D divergence in $s$-coordinates established above. 

