\hypertarget{namespacemom__dynamics__unsplit}{}\section{mom\+\_\+dynamics\+\_\+unsplit Module Reference}
\label{namespacemom__dynamics__unsplit}\index{mom\_dynamics\_unsplit@{mom\_dynamics\_unsplit}}


\subsection{Detailed Description}
Time steps the ocean dynamics with an unsplit quasi 3rd order scheme. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structmom__dynamics__unsplit_1_1mom__dyn__unsplit__cs}{mom\+\_\+dyn\+\_\+unsplit\+\_\+cs}}
\begin{DoxyCompactList}\small\item\em M\+O\+M\+\_\+dynamics\+\_\+unsplit module control structure. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__dynamics__unsplit_ab72d911d187f9247b6cc72d87e815370}{step\+\_\+mom\+\_\+dyn\+\_\+unsplit}} (u, v, h, tv, visc, Time\+\_\+local, dt, forces, p\+\_\+surf\+\_\+begin, p\+\_\+surf\+\_\+end, uh, vh, uhtr, vhtr, eta\+\_\+av, G, GV, US, CS, Var\+Mix, M\+E\+KE, Waves)
\begin{DoxyCompactList}\small\item\em Step the M\+O\+M6 dynamics using an unsplit mixed 2nd order (for continuity) and 3rd order (for the inviscid momentum equations) order scheme. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__dynamics__unsplit_a5a650785f745fd9cf42e1e014dd2d89a}{register\+\_\+restarts\+\_\+dyn\+\_\+unsplit}} (HI, GV, param\+\_\+file, CS, restart\+\_\+\+CS)
\begin{DoxyCompactList}\small\item\em Allocate the control structure for this module, allocates memory in it, and registers any auxiliary restart variables that are specific to the unsplit time stepping scheme. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__dynamics__unsplit_aa428b0ad5ed3e6cbbb1fd83484eba2f8}{initialize\+\_\+dyn\+\_\+unsplit}} (u, v, h, Time, G, GV, US, param\+\_\+file, diag, CS, restart\+\_\+\+CS, Accel\+\_\+diag, Cont\+\_\+diag, M\+IS, M\+E\+KE, O\+BC, update\+\_\+\+O\+B\+C\+\_\+\+C\+Sp, A\+L\+E\+\_\+\+C\+Sp, set\+Visc\+\_\+\+C\+Sp, visc, dirs, ntrunc, cont\+\_\+stencil)
\begin{DoxyCompactList}\small\item\em Initialize parameters and allocate memory associated with the unsplit dynamics module. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__dynamics__unsplit_a8f8e05fcc926eb5c1d41517f6b8cf1cb}{end\+\_\+dyn\+\_\+unsplit}} (CS)
\begin{DoxyCompactList}\small\item\em Clean up and deallocate memory associated with the unsplit dynamics module. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\textbf{ }\par
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_a9ebe0aaf06b20d3401139aaee12fef4a}\label{namespacemom__dynamics__unsplit_a9ebe0aaf06b20d3401139aaee12fef4a}} 
integer \mbox{\hyperlink{namespacemom__dynamics__unsplit_a9ebe0aaf06b20d3401139aaee12fef4a}{id\+\_\+clock\+\_\+cor}}
\begin{DoxyCompactList}\small\item\em C\+PU time clock I\+Ds. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_adc6cdd4ab179eb08a54b9af6a0afcb9d}\label{namespacemom__dynamics__unsplit_adc6cdd4ab179eb08a54b9af6a0afcb9d}} 
integer \mbox{\hyperlink{namespacemom__dynamics__unsplit_adc6cdd4ab179eb08a54b9af6a0afcb9d}{id\+\_\+clock\+\_\+pres}}
\begin{DoxyCompactList}\small\item\em C\+PU time clock I\+Ds. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_af864cc832cfa9afe699729b7a1ffe771}\label{namespacemom__dynamics__unsplit_af864cc832cfa9afe699729b7a1ffe771}} 
integer \mbox{\hyperlink{namespacemom__dynamics__unsplit_af864cc832cfa9afe699729b7a1ffe771}{id\+\_\+clock\+\_\+vertvisc}}
\begin{DoxyCompactList}\small\item\em C\+PU time clock I\+Ds. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_acef00db07a4b4452681805a38d32cd42}\label{namespacemom__dynamics__unsplit_acef00db07a4b4452681805a38d32cd42}} 
integer \mbox{\hyperlink{namespacemom__dynamics__unsplit_acef00db07a4b4452681805a38d32cd42}{id\+\_\+clock\+\_\+continuity}}
\begin{DoxyCompactList}\small\item\em C\+PU time clock I\+Ds. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_abd538ee02d6d7eed31ecabd28112878f}\label{namespacemom__dynamics__unsplit_abd538ee02d6d7eed31ecabd28112878f}} 
integer \mbox{\hyperlink{namespacemom__dynamics__unsplit_abd538ee02d6d7eed31ecabd28112878f}{id\+\_\+clock\+\_\+horvisc}}
\begin{DoxyCompactList}\small\item\em C\+PU time clock I\+Ds. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_abdefb2afd3276cea01a19bb1abf8b000}\label{namespacemom__dynamics__unsplit_abdefb2afd3276cea01a19bb1abf8b000}} 
integer \mbox{\hyperlink{namespacemom__dynamics__unsplit_abdefb2afd3276cea01a19bb1abf8b000}{id\+\_\+clock\+\_\+mom\+\_\+update}}
\begin{DoxyCompactList}\small\item\em C\+PU time clock I\+Ds. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_aa92d65d25a49356373b1371643e71e28}\label{namespacemom__dynamics__unsplit_aa92d65d25a49356373b1371643e71e28}} 
integer \mbox{\hyperlink{namespacemom__dynamics__unsplit_aa92d65d25a49356373b1371643e71e28}{id\+\_\+clock\+\_\+pass}}
\begin{DoxyCompactList}\small\item\em C\+PU time clock I\+Ds. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_a785a58754b93e29c25bec43e6130a3cb}\label{namespacemom__dynamics__unsplit_a785a58754b93e29c25bec43e6130a3cb}} 
integer \mbox{\hyperlink{namespacemom__dynamics__unsplit_a785a58754b93e29c25bec43e6130a3cb}{id\+\_\+clock\+\_\+pass\+\_\+init}}
\begin{DoxyCompactList}\small\item\em C\+PU time clock I\+Ds. \end{DoxyCompactList}\end{DoxyCompactItemize}



\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_a8f8e05fcc926eb5c1d41517f6b8cf1cb}\label{namespacemom__dynamics__unsplit_a8f8e05fcc926eb5c1d41517f6b8cf1cb}} 
\index{mom\_dynamics\_unsplit@{mom\_dynamics\_unsplit}!end\_dyn\_unsplit@{end\_dyn\_unsplit}}
\index{end\_dyn\_unsplit@{end\_dyn\_unsplit}!mom\_dynamics\_unsplit@{mom\_dynamics\_unsplit}}
\subsubsection{\texorpdfstring{end\_dyn\_unsplit()}{end\_dyn\_unsplit()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+dynamics\+\_\+unsplit\+::end\+\_\+dyn\+\_\+unsplit (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__dynamics__unsplit_1_1mom__dyn__unsplit__cs}{mom\+\_\+dyn\+\_\+unsplit\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Clean up and deallocate memory associated with the unsplit dynamics module. 


\begin{DoxyParams}{Parameters}
{\em cs} & unsplit dynamics control structure that will be deallocated in this subroutine. \\
\hline
\end{DoxyParams}


Definition at line 709 of file M\+O\+M\+\_\+dynamics\+\_\+unsplit.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{709   \textcolor{keywordtype}{type}(MOM\_dyn\_unsplit\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{ !< unsplit dynamics control structure that}}
\DoxyCodeLine{710 \textcolor{comment}{                                          !! will be deallocated in this subroutine.}}
\DoxyCodeLine{711 }
\DoxyCodeLine{712   dealloc\_(cs\%diffu) ; dealloc\_(cs\%diffv)}
\DoxyCodeLine{713   dealloc\_(cs\%CAu)   ; dealloc\_(cs\%CAv)}
\DoxyCodeLine{714   dealloc\_(cs\%PFu)   ; dealloc\_(cs\%PFv)}
\DoxyCodeLine{715 }
\DoxyCodeLine{716   \textcolor{keyword}{deallocate}(cs)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_aa428b0ad5ed3e6cbbb1fd83484eba2f8}\label{namespacemom__dynamics__unsplit_aa428b0ad5ed3e6cbbb1fd83484eba2f8}} 
\index{mom\_dynamics\_unsplit@{mom\_dynamics\_unsplit}!initialize\_dyn\_unsplit@{initialize\_dyn\_unsplit}}
\index{initialize\_dyn\_unsplit@{initialize\_dyn\_unsplit}!mom\_dynamics\_unsplit@{mom\_dynamics\_unsplit}}
\subsubsection{\texorpdfstring{initialize\_dyn\_unsplit()}{initialize\_dyn\_unsplit()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+dynamics\+\_\+unsplit\+::initialize\+\_\+dyn\+\_\+unsplit (\begin{DoxyParamCaption}\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(inout)}]{u,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(inout)}]{v,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(inout)}]{h,  }\item[{type(time\+\_\+type), intent(in), target}]{Time,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(diag\+\_\+ctrl), intent(inout), target}]{diag,  }\item[{type(\mbox{\hyperlink{structmom__dynamics__unsplit_1_1mom__dyn__unsplit__cs}{mom\+\_\+dyn\+\_\+unsplit\+\_\+cs}}), pointer}]{CS,  }\item[{type(mom\+\_\+restart\+\_\+cs), pointer}]{restart\+\_\+\+CS,  }\item[{type(accel\+\_\+diag\+\_\+ptrs), intent(inout), target}]{Accel\+\_\+diag,  }\item[{type(cont\+\_\+diag\+\_\+ptrs), intent(inout), target}]{Cont\+\_\+diag,  }\item[{type(ocean\+\_\+internal\+\_\+state), intent(inout)}]{M\+IS,  }\item[{type(meke\+\_\+type), pointer}]{M\+E\+KE,  }\item[{type(ocean\+\_\+obc\+\_\+type), pointer}]{O\+BC,  }\item[{type(update\+\_\+obc\+\_\+cs), pointer}]{update\+\_\+\+O\+B\+C\+\_\+\+C\+Sp,  }\item[{type(ale\+\_\+cs), pointer}]{A\+L\+E\+\_\+\+C\+Sp,  }\item[{type(set\+\_\+visc\+\_\+cs), pointer}]{set\+Visc\+\_\+\+C\+Sp,  }\item[{type(vertvisc\+\_\+type), intent(inout)}]{visc,  }\item[{type(directories), intent(in)}]{dirs,  }\item[{integer, intent(inout), target}]{ntrunc,  }\item[{integer, intent(out), optional}]{cont\+\_\+stencil }\end{DoxyParamCaption})}



Initialize parameters and allocate memory associated with the unsplit dynamics module. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in,out}}  & {\em u} & The zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in,out}}  & {\em v} & The meridional velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in,out}}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em time} & The current model time. \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters. \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag} & A structure that is used to regulate diagnostic output. \\
\hline
 & {\em cs} & The control structure set up by initialize\+\_\+dyn\+\_\+unsplit. \\
\hline
 & {\em restart\+\_\+cs} & A pointer to the restart control structure. \\
\hline
\mbox{\texttt{ in,out}}  & {\em accel\+\_\+diag} & A set of pointers to the various accelerations in the momentum equations, which can be used for later derived diagnostics, like energy budgets. \\
\hline
\mbox{\texttt{ in,out}}  & {\em cont\+\_\+diag} & A structure with pointers to various terms in the continuity equations. \\
\hline
\mbox{\texttt{ in,out}}  & {\em mis} & The \char`\"{}\+M\+O\+M6 Internal State\char`\"{} structure, used to pass around pointers to various arrays for diagnostic purposes. \\
\hline
 & {\em meke} & M\+E\+KE data \\
\hline
 & {\em obc} & If open boundary conditions are used, this points to the ocean\+\_\+\+O\+B\+C\+\_\+type that was set up in M\+O\+M\+\_\+initialization. \\
\hline
 & {\em update\+\_\+obc\+\_\+csp} & If open boundary condition updates are used, this points to the appropriate control structure. \\
\hline
 & {\em ale\+\_\+csp} & This points to the A\+LE control structure. \\
\hline
 & {\em setvisc\+\_\+csp} & This points to the set\+\_\+visc control structure. \\
\hline
\mbox{\texttt{ in,out}}  & {\em visc} & A structure containing vertical viscosities, bottom drag viscosities, and related fields. \\
\hline
\mbox{\texttt{ in}}  & {\em dirs} & A structure containing several relevant directory paths. \\
\hline
\mbox{\texttt{ in,out}}  & {\em ntrunc} & A target for the variable that records the number of times the velocity is truncated (this should be 0). \\
\hline
\mbox{\texttt{ out}}  & {\em cont\+\_\+stencil} & The stencil for thickness from the continuity solver. \\
\hline
\end{DoxyParams}


Definition at line 560 of file M\+O\+M\+\_\+dynamics\+\_\+unsplit.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{560   \textcolor{keywordtype}{type}(ocean\_grid\_type),          \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{          !< The ocean's grid structure.}}
\DoxyCodeLine{561   \textcolor{keywordtype}{type}(verticalGrid\_type),        \textcolor{keywordtype}{intent(in)}    :: GV\textcolor{comment}{         !< The ocean's vertical grid structure.}}
\DoxyCodeLine{562   \textcolor{keywordtype}{type}(unit\_scale\_type),          \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{         !< A dimensional unit scaling type}}
\DoxyCodeLine{563 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{564                                   \textcolor{keywordtype}{intent(inout)} :: u\textcolor{comment}{          !< The zonal velocity [L T-1 ~> m s-1].}}
\DoxyCodeLine{565 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{566                                   \textcolor{keywordtype}{intent(inout)} :: v\textcolor{comment}{          !< The meridional velocity [L T-1 ~> m s-1].}}
\DoxyCodeLine{567 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))} , \&}
\DoxyCodeLine{568                                   \textcolor{keywordtype}{intent(inout)} :: h\textcolor{comment}{          !< Layer thicknesses [H ~> m or kg m-2]}}
\DoxyCodeLine{569   \textcolor{keywordtype}{type}(time\_type),        \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)}    :: Time\textcolor{comment}{       !< The current model time.}}
\DoxyCodeLine{570   \textcolor{keywordtype}{type}(param\_file\_type),          \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< A structure to parse}}
\DoxyCodeLine{571 \textcolor{comment}{                                                              !! for run-time parameters.}}
\DoxyCodeLine{572   \textcolor{keywordtype}{type}(diag\_ctrl),        \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{       !< A structure that is used to}}
\DoxyCodeLine{573 \textcolor{comment}{                                                              !! regulate diagnostic output.}}
\DoxyCodeLine{574   \textcolor{keywordtype}{type}(MOM\_dyn\_unsplit\_CS),       \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{         !< The control structure set up}}
\DoxyCodeLine{575 \textcolor{comment}{                                                              !! by initialize\_dyn\_unsplit.}}
\DoxyCodeLine{576   \textcolor{keywordtype}{type}(MOM\_restart\_CS),           \textcolor{keywordtype}{pointer}       :: restart\_CS\textcolor{comment}{ !< A pointer to the restart control}}
\DoxyCodeLine{577 \textcolor{comment}{                                                              !!structure.}}
\DoxyCodeLine{578   \textcolor{keywordtype}{type}(accel\_diag\_ptrs),  \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: Accel\_diag\textcolor{comment}{ !< A set of pointers to the various}}
\DoxyCodeLine{579 \textcolor{comment}{                                     !! accelerations in the momentum equations, which can be used}}
\DoxyCodeLine{580 \textcolor{comment}{                                     !! for later derived diagnostics, like energy budgets.}}
\DoxyCodeLine{581   \textcolor{keywordtype}{type}(cont\_diag\_ptrs),   \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: Cont\_diag\textcolor{comment}{  !< A structure with pointers to}}
\DoxyCodeLine{582 \textcolor{comment}{                                                              !! various terms in the continuity}}
\DoxyCodeLine{583 \textcolor{comment}{                                                              !! equations.}}
\DoxyCodeLine{584   \textcolor{keywordtype}{type}(ocean\_internal\_state),     \textcolor{keywordtype}{intent(inout)} :: MIS\textcolor{comment}{        !< The "MOM6 Internal State"}}
\DoxyCodeLine{585 \textcolor{comment}{                                                   !! structure, used to pass around pointers}}
\DoxyCodeLine{586 \textcolor{comment}{                                                   !! to various arrays for diagnostic purposes.}}
\DoxyCodeLine{587   \textcolor{keywordtype}{type}(MEKE\_type),                \textcolor{keywordtype}{pointer}       :: MEKE\textcolor{comment}{ !< MEKE data}}
\DoxyCodeLine{588   \textcolor{keywordtype}{type}(ocean\_OBC\_type),           \textcolor{keywordtype}{pointer}       :: OBC\textcolor{comment}{        !< If open boundary conditions are}}
\DoxyCodeLine{589 \textcolor{comment}{                                                       !! used, this points to the ocean\_OBC\_type}}
\DoxyCodeLine{590 \textcolor{comment}{                                                       !! that was set up in MOM\_initialization.}}
\DoxyCodeLine{591   \textcolor{keywordtype}{type}(update\_OBC\_CS),            \textcolor{keywordtype}{pointer}       :: update\_OBC\_CSp\textcolor{comment}{ !< If open boundary condition}}
\DoxyCodeLine{592 \textcolor{comment}{                                                            !! updates are used, this points to}}
\DoxyCodeLine{593 \textcolor{comment}{                                                            !! the appropriate control structure.}}
\DoxyCodeLine{594   \textcolor{keywordtype}{type}(ALE\_CS),                   \textcolor{keywordtype}{pointer}       :: ALE\_CSp\textcolor{comment}{    !< This points to the ALE control}}
\DoxyCodeLine{595 \textcolor{comment}{                                                              !! structure.}}
\DoxyCodeLine{596   \textcolor{keywordtype}{type}(set\_visc\_CS),              \textcolor{keywordtype}{pointer}       :: setVisc\_CSp\textcolor{comment}{ !< This points to the set\_visc}}
\DoxyCodeLine{597 \textcolor{comment}{                                                               !! control structure.}}
\DoxyCodeLine{598   \textcolor{keywordtype}{type}(vertvisc\_type),            \textcolor{keywordtype}{intent(inout)} :: visc\textcolor{comment}{       !< A structure containing vertical}}
\DoxyCodeLine{599 \textcolor{comment}{                                                              !! viscosities, bottom drag}}
\DoxyCodeLine{600 \textcolor{comment}{                                                              !! viscosities, and related fields.}}
\DoxyCodeLine{601   \textcolor{keywordtype}{type}(directories),              \textcolor{keywordtype}{intent(in)}    :: dirs\textcolor{comment}{       !< A structure containing several}}
\DoxyCodeLine{602 \textcolor{comment}{                                                              !! relevant directory paths.}}
\DoxyCodeLine{603   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{target},                \textcolor{keywordtype}{intent(inout)} :: ntrunc\textcolor{comment}{     !< A target for the variable that}}
\DoxyCodeLine{604 \textcolor{comment}{                                                        !! records the number of times the velocity}}
\DoxyCodeLine{605 \textcolor{comment}{                                                        !! is truncated (this should be 0).}}
\DoxyCodeLine{606   \textcolor{keywordtype}{integer},              \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}   :: cont\_stencil\textcolor{comment}{ !< The stencil for thickness}}
\DoxyCodeLine{607 \textcolor{comment}{                                                                !! from the continuity solver.}}
\DoxyCodeLine{608 }
\DoxyCodeLine{609   \textcolor{comment}{!   This subroutine initializes all of the variables that are used by this}}
\DoxyCodeLine{610   \textcolor{comment}{! dynamic core, including diagnostics and the cpu clocks.}}
\DoxyCodeLine{611 }
\DoxyCodeLine{612   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{613   \textcolor{keywordtype}{character(len=40)} :: mdl = \textcolor{stringliteral}{"MOM\_dynamics\_unsplit"} \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{614   \textcolor{keywordtype}{character(len=48)} :: thickness\_units, flux\_units}
\DoxyCodeLine{615   \textcolor{comment}{! This include declares and sets the variable "version".}}
\DoxyCodeLine{616 \textcolor{preprocessor}{\# include "version\_variable.h"}}
\DoxyCodeLine{617 \textcolor{preprocessor}{}\textcolor{keywordtype}{  real} :: H\_convert}
\DoxyCodeLine{618   \textcolor{keywordtype}{logical} :: use\_tides}
\DoxyCodeLine{619   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, nz, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{620   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed ; nz = g\%ke}
\DoxyCodeLine{621   isdb = g\%IsdB ; iedb = g\%IedB ; jsdb = g\%JsdB ; jedb = g\%JedB}
\DoxyCodeLine{622 }
\DoxyCodeLine{623   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{624       \textcolor{stringliteral}{"initialize\_dyn\_unsplit called with an unassociated control structure."})}
\DoxyCodeLine{625   \textcolor{keywordflow}{if} (cs\%module\_is\_initialized) \textcolor{keywordflow}{then}}
\DoxyCodeLine{626     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"initialize\_dyn\_unsplit called with a control "}// \&}
\DoxyCodeLine{627                             \textcolor{stringliteral}{"structure that has already been initialized."})}
\DoxyCodeLine{628     \textcolor{keywordflow}{return}}
\DoxyCodeLine{629 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{630   cs\%module\_is\_initialized = .true.}
\DoxyCodeLine{631 }
\DoxyCodeLine{632   cs\%diag => diag}
\DoxyCodeLine{633 }
\DoxyCodeLine{634   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})}
\DoxyCodeLine{635   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"FIX\_UNSPLIT\_DT\_VISC\_BUG"}, cs\%use\_correct\_dt\_visc, \&}
\DoxyCodeLine{636                  \textcolor{stringliteral}{"If true, use the correct timestep in the viscous terms applied in the first "}//\&}
\DoxyCodeLine{637                  \textcolor{stringliteral}{"predictor step with the unsplit time stepping scheme, and in the calculation "}//\&}
\DoxyCodeLine{638                  \textcolor{stringliteral}{"of the turbulent mixed layer properties for viscosity with unsplit or "}//\&}
\DoxyCodeLine{639                  \textcolor{stringliteral}{"unsplit\_RK2."}, default=.true.)}
\DoxyCodeLine{640   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DEBUG"}, cs\%debug, \&}
\DoxyCodeLine{641                  \textcolor{stringliteral}{"If true, write out verbose debugging data."}, \&}
\DoxyCodeLine{642                  default=.false., debuggingparam=.true.)}
\DoxyCodeLine{643   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TIDES"}, use\_tides, \&}
\DoxyCodeLine{644                  \textcolor{stringliteral}{"If true, apply tidal momentum forcing."}, default=.false.)}
\DoxyCodeLine{645 }
\DoxyCodeLine{646   \textcolor{keyword}{allocate}(cs\%taux\_bot(isdb:iedb,jsd:jed)) ; cs\%taux\_bot(:,:) = 0.0}
\DoxyCodeLine{647   \textcolor{keyword}{allocate}(cs\%tauy\_bot(isd:ied,jsdb:jedb)) ; cs\%tauy\_bot(:,:) = 0.0}
\DoxyCodeLine{648 }
\DoxyCodeLine{649   mis\%diffu => cs\%diffu ; mis\%diffv => cs\%diffv}
\DoxyCodeLine{650   mis\%PFu => cs\%PFu ; mis\%PFv => cs\%PFv}
\DoxyCodeLine{651   mis\%CAu => cs\%CAu ; mis\%CAv => cs\%CAv}
\DoxyCodeLine{652 }
\DoxyCodeLine{653   cs\%ADp => accel\_diag ; cs\%CDp => cont\_diag}
\DoxyCodeLine{654   accel\_diag\%diffu => cs\%diffu ; accel\_diag\%diffv => cs\%diffv}
\DoxyCodeLine{655   accel\_diag\%PFu => cs\%PFu ; accel\_diag\%PFv => cs\%PFv}
\DoxyCodeLine{656   accel\_diag\%CAu => cs\%CAu ; accel\_diag\%CAv => cs\%CAv}
\DoxyCodeLine{657 }
\DoxyCodeLine{658   \textcolor{keyword}{call }continuity\_init(time, g, gv, us, param\_file, diag, cs\%continuity\_CSp)}
\DoxyCodeLine{659   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cont\_stencil)) cont\_stencil = continuity\_stencil(cs\%continuity\_CSp)}
\DoxyCodeLine{660   \textcolor{keyword}{call }coriolisadv\_init(time, g, gv, us, param\_file, diag, cs\%ADp, cs\%CoriolisAdv\_CSp)}
\DoxyCodeLine{661   \textcolor{keywordflow}{if} (use\_tides) \textcolor{keyword}{call }tidal\_forcing\_init(time, g, param\_file, cs\%tides\_CSp)}
\DoxyCodeLine{662   \textcolor{keyword}{call }pressureforce\_init(time, g, gv, us, param\_file, diag, cs\%PressureForce\_CSp, \&}
\DoxyCodeLine{663                           cs\%tides\_CSp)}
\DoxyCodeLine{664   \textcolor{keyword}{call }hor\_visc\_init(time, g, us, param\_file, diag, cs\%hor\_visc\_CSp, meke)}
\DoxyCodeLine{665   \textcolor{keyword}{call }vertvisc\_init(mis, time, g, gv, us, param\_file, diag, cs\%ADp, dirs, \&}
\DoxyCodeLine{666                      ntrunc, cs\%vertvisc\_CSp)}
\DoxyCodeLine{667   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(setvisc\_csp)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{668     \textcolor{stringliteral}{"initialize\_dyn\_unsplit called with setVisc\_CSp unassociated."})}
\DoxyCodeLine{669   cs\%set\_visc\_CSp => setvisc\_csp}
\DoxyCodeLine{670 }
\DoxyCodeLine{671   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(ale\_csp)) cs\%ALE\_CSp => ale\_csp}
\DoxyCodeLine{672   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(obc)) cs\%OBC => obc}
\DoxyCodeLine{673   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(update\_obc\_csp)) cs\%update\_OBC\_CSp => update\_obc\_csp}
\DoxyCodeLine{674 }
\DoxyCodeLine{675   flux\_units = get\_flux\_units(gv)}
\DoxyCodeLine{676   h\_convert = gv\%H\_to\_m ; \textcolor{keywordflow}{if} (.not.gv\%Boussinesq) h\_convert = gv\%H\_to\_kg\_m2}
\DoxyCodeLine{677   cs\%id\_uh = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'uh'}, diag\%axesCuL, time, \&}
\DoxyCodeLine{678       \textcolor{stringliteral}{'Zonal Thickness Flux'}, flux\_units, y\_cell\_method=\textcolor{stringliteral}{'sum'}, v\_extensive=.true., \&}
\DoxyCodeLine{679       conversion=h\_convert*us\%L\_to\_m**2*us\%s\_to\_T)}
\DoxyCodeLine{680   cs\%id\_vh = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'vh'}, diag\%axesCvL, time, \&}
\DoxyCodeLine{681       \textcolor{stringliteral}{'Meridional Thickness Flux'}, flux\_units, x\_cell\_method=\textcolor{stringliteral}{'sum'}, v\_extensive=.true., \&}
\DoxyCodeLine{682       conversion=h\_convert*us\%L\_to\_m**2*us\%s\_to\_T)}
\DoxyCodeLine{683   cs\%id\_CAu = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'CAu'}, diag\%axesCuL, time, \&}
\DoxyCodeLine{684       \textcolor{stringliteral}{'Zonal Coriolis and Advective Acceleration'}, \textcolor{stringliteral}{'m s-2'}, \&}
\DoxyCodeLine{685       conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{686   cs\%id\_CAv = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'CAv'}, diag\%axesCvL, time, \&}
\DoxyCodeLine{687       \textcolor{stringliteral}{'Meridional Coriolis and Advective Acceleration'}, \textcolor{stringliteral}{'m s-2'}, \&}
\DoxyCodeLine{688       conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{689   cs\%id\_PFu = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'PFu'}, diag\%axesCuL, time, \&}
\DoxyCodeLine{690       \textcolor{stringliteral}{'Zonal Pressure Force Acceleration'}, \textcolor{stringliteral}{'m s-2'}, \&}
\DoxyCodeLine{691       conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{692   cs\%id\_PFv = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'PFv'}, diag\%axesCvL, time, \&}
\DoxyCodeLine{693       \textcolor{stringliteral}{'Meridional Pressure Force Acceleration'}, \textcolor{stringliteral}{'m s-2'}, \&}
\DoxyCodeLine{694       conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{695 }
\DoxyCodeLine{696   id\_clock\_cor = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean Coriolis \& mom advection)'}, grain=clock\_module)}
\DoxyCodeLine{697   id\_clock\_continuity = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean continuity equation)'}, grain=clock\_module)}
\DoxyCodeLine{698   id\_clock\_pres = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean pressure force)'}, grain=clock\_module)}
\DoxyCodeLine{699   id\_clock\_vertvisc = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean vertical viscosity)'}, grain=clock\_module)}
\DoxyCodeLine{700   id\_clock\_horvisc = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean horizontal viscosity)'}, grain=clock\_module)}
\DoxyCodeLine{701   id\_clock\_mom\_update = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean momentum increments)'}, grain=clock\_module)}
\DoxyCodeLine{702   id\_clock\_pass = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean message passing)'}, grain=clock\_module)}
\DoxyCodeLine{703   id\_clock\_pass\_init = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean init message passing)'}, grain=clock\_routine)}
\DoxyCodeLine{704 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_a5a650785f745fd9cf42e1e014dd2d89a}\label{namespacemom__dynamics__unsplit_a5a650785f745fd9cf42e1e014dd2d89a}} 
\index{mom\_dynamics\_unsplit@{mom\_dynamics\_unsplit}!register\_restarts\_dyn\_unsplit@{register\_restarts\_dyn\_unsplit}}
\index{register\_restarts\_dyn\_unsplit@{register\_restarts\_dyn\_unsplit}!mom\_dynamics\_unsplit@{mom\_dynamics\_unsplit}}
\subsubsection{\texorpdfstring{register\_restarts\_dyn\_unsplit()}{register\_restarts\_dyn\_unsplit()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+dynamics\+\_\+unsplit\+::register\+\_\+restarts\+\_\+dyn\+\_\+unsplit (\begin{DoxyParamCaption}\item[{type(hor\+\_\+index\+\_\+type), intent(in)}]{HI,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__dynamics__unsplit_1_1mom__dyn__unsplit__cs}{mom\+\_\+dyn\+\_\+unsplit\+\_\+cs}}), pointer}]{CS,  }\item[{type(mom\+\_\+restart\+\_\+cs), pointer}]{restart\+\_\+\+CS }\end{DoxyParamCaption})}



Allocate the control structure for this module, allocates memory in it, and registers any auxiliary restart variables that are specific to the unsplit time stepping scheme. 

All variables registered here should have the ability to be recreated if they are not present in a restart file. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em hi} & A horizontal index type structure. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters. \\
\hline
 & {\em cs} & The control structure set up by initialize\+\_\+dyn\+\_\+unsplit. \\
\hline
 & {\em restart\+\_\+cs} & A pointer to the restart control structure. \\
\hline
\end{DoxyParams}


Definition at line 518 of file M\+O\+M\+\_\+dynamics\+\_\+unsplit.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{518   \textcolor{keywordtype}{type}(hor\_index\_type),      \textcolor{keywordtype}{intent(in)} :: HI\textcolor{comment}{         !< A horizontal index type structure.}}
\DoxyCodeLine{519   \textcolor{keywordtype}{type}(verticalGrid\_type),   \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{         !< The ocean's vertical grid structure.}}
\DoxyCodeLine{520   \textcolor{keywordtype}{type}(param\_file\_type),     \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< A structure to parse for}}
\DoxyCodeLine{521 \textcolor{comment}{                                                      !! run-time parameters.}}
\DoxyCodeLine{522   \textcolor{keywordtype}{type}(MOM\_dyn\_unsplit\_CS),  \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{         !< The control structure set up by}}
\DoxyCodeLine{523 \textcolor{comment}{                                                      !! initialize\_dyn\_unsplit.}}
\DoxyCodeLine{524   \textcolor{keywordtype}{type}(MOM\_restart\_CS),      \textcolor{keywordtype}{pointer}    :: restart\_CS\textcolor{comment}{ !< A pointer to the restart control structure.}}
\DoxyCodeLine{525 }
\DoxyCodeLine{526   \textcolor{comment}{! Local arguments}}
\DoxyCodeLine{527   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_dynamics\_unsplit"} \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{528   \textcolor{keywordtype}{character(len=48)} :: thickness\_units, flux\_units}
\DoxyCodeLine{529   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, nz, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{530   isd = hi\%isd ; ied = hi\%ied ; jsd = hi\%jsd ; jed = hi\%jed ; nz = gv\%ke}
\DoxyCodeLine{531   isdb = hi\%IsdB ; iedb = hi\%IedB ; jsdb = hi\%JsdB ; jedb = hi\%JedB}
\DoxyCodeLine{532 }
\DoxyCodeLine{533   \textcolor{comment}{! This is where a control structure that is specific to this module is allocated.}}
\DoxyCodeLine{534   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{535     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"register\_restarts\_dyn\_unsplit called with an associated "}// \&}
\DoxyCodeLine{536                              \textcolor{stringliteral}{"control structure."})}
\DoxyCodeLine{537     \textcolor{keywordflow}{return}}
\DoxyCodeLine{538 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{539   \textcolor{keyword}{allocate}(cs)}
\DoxyCodeLine{540 }
\DoxyCodeLine{541   alloc\_(cs\%diffu(isdb:iedb,jsd:jed,nz)) ; cs\%diffu(:,:,:) = 0.0}
\DoxyCodeLine{542   alloc\_(cs\%diffv(isd:ied,jsdb:jedb,nz)) ; cs\%diffv(:,:,:) = 0.0}
\DoxyCodeLine{543   alloc\_(cs\%CAu(isdb:iedb,jsd:jed,nz)) ; cs\%CAu(:,:,:) = 0.0}
\DoxyCodeLine{544   alloc\_(cs\%CAv(isd:ied,jsdb:jedb,nz)) ; cs\%CAv(:,:,:) = 0.0}
\DoxyCodeLine{545   alloc\_(cs\%PFu(isdb:iedb,jsd:jed,nz)) ; cs\%PFu(:,:,:) = 0.0}
\DoxyCodeLine{546   alloc\_(cs\%PFv(isd:ied,jsdb:jedb,nz)) ; cs\%PFv(:,:,:) = 0.0}
\DoxyCodeLine{547 }
\DoxyCodeLine{548   thickness\_units = get\_thickness\_units(gv)}
\DoxyCodeLine{549   flux\_units = get\_flux\_units(gv)}
\DoxyCodeLine{550 }
\DoxyCodeLine{551 \textcolor{comment}{!  No extra restart fields are needed with this time stepping scheme.}}
\DoxyCodeLine{552 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__dynamics__unsplit_ab72d911d187f9247b6cc72d87e815370}\label{namespacemom__dynamics__unsplit_ab72d911d187f9247b6cc72d87e815370}} 
\index{mom\_dynamics\_unsplit@{mom\_dynamics\_unsplit}!step\_mom\_dyn\_unsplit@{step\_mom\_dyn\_unsplit}}
\index{step\_mom\_dyn\_unsplit@{step\_mom\_dyn\_unsplit}!mom\_dynamics\_unsplit@{mom\_dynamics\_unsplit}}
\subsubsection{\texorpdfstring{step\_mom\_dyn\_unsplit()}{step\_mom\_dyn\_unsplit()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+dynamics\+\_\+unsplit\+::step\+\_\+mom\+\_\+dyn\+\_\+unsplit (\begin{DoxyParamCaption}\item[{real, dimension(szib\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{u,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{v,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{h,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(in)}]{tv,  }\item[{type(vertvisc\+\_\+type), intent(inout)}]{visc,  }\item[{type(time\+\_\+type), intent(in)}]{Time\+\_\+local,  }\item[{real, intent(in)}]{dt,  }\item[{type(mech\+\_\+forcing), intent(in)}]{forces,  }\item[{real, dimension(\+:,\+:), pointer}]{p\+\_\+surf\+\_\+begin,  }\item[{real, dimension(\+:,\+:), pointer}]{p\+\_\+surf\+\_\+end,  }\item[{real, dimension(szib\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{uh,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{vh,  }\item[{real, dimension(szib\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{uhtr,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{vhtr,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g)), intent(out)}]{eta\+\_\+av,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(\mbox{\hyperlink{structmom__dynamics__unsplit_1_1mom__dyn__unsplit__cs}{mom\+\_\+dyn\+\_\+unsplit\+\_\+cs}}), pointer}]{CS,  }\item[{type(varmix\+\_\+cs), pointer}]{Var\+Mix,  }\item[{type(meke\+\_\+type), pointer}]{M\+E\+KE,  }\item[{type(wave\+\_\+parameters\+\_\+cs), optional, pointer}]{Waves }\end{DoxyParamCaption})}



Step the M\+O\+M6 dynamics using an unsplit mixed 2nd order (for continuity) and 3rd order (for the inviscid momentum equations) order scheme. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in,out}}  & {\em u} & The zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in,out}}  & {\em v} & The meridional velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in,out}}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em tv} & A structure pointing to various thermodynamic variables. \\
\hline
\mbox{\texttt{ in,out}}  & {\em visc} & A structure containing vertical viscosities, bottom drag viscosities, and related fields. \\
\hline
\mbox{\texttt{ in}}  & {\em time\+\_\+local} & The model time at the end of the time step. \\
\hline
\mbox{\texttt{ in}}  & {\em dt} & The dynamics time step \mbox{[}T $\sim$$>$ s\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em forces} & A structure with the driving mechanical forces \\
\hline
 & {\em p\+\_\+surf\+\_\+begin} & A pointer (perhaps N\+U\+LL) to the surface pressure at the start of this dynamic step \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]}. \\
\hline
 & {\em p\+\_\+surf\+\_\+end} & A pointer (perhaps N\+U\+LL) to the surface pressure at the end of this dynamic step \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]}. \\
\hline
\mbox{\texttt{ in,out}}  & {\em uh} & The zonal volume or mass transport \mbox{[}H L2 T-\/1 $\sim$$>$ m3 s-\/1 or kg s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in,out}}  & {\em vh} & The meridional volume or mass transport \mbox{[}H L2 T-\/1 $\sim$$>$ m3 s-\/1 or kg s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in,out}}  & {\em uhtr} & The accumulated zonal volume or mass transport since the last tracer advection \mbox{[}H L2 $\sim$$>$ m3 or kg\mbox{]}. \\
\hline
\mbox{\texttt{ in,out}}  & {\em vhtr} & The accumulated meridional volume or mass transport since the last tracer advection \mbox{[}H L2 $\sim$$>$ m3 or kg\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em eta\+\_\+av} & The time-\/mean free surface height or column mass \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
 & {\em cs} & The control structure set up by initialize\+\_\+dyn\+\_\+unsplit. \\
\hline
 & {\em varmix} & A pointer to a structure with fields that specify the spatially variable viscosities. \\
\hline
 & {\em meke} & A pointer to a structure containing fields related to the Mesoscale Eddy Kinetic Energy. \\
\hline
 & {\em waves} & A pointer to a structure containing fields related to the surface wave conditions \\
\hline
\end{DoxyParams}


Definition at line 192 of file M\+O\+M\+\_\+dynamics\+\_\+unsplit.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{192   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{      !< The ocean's grid structure.}}
\DoxyCodeLine{193   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}    :: GV\textcolor{comment}{     !< The ocean's vertical grid structure.}}
\DoxyCodeLine{194   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{     !< A dimensional unit scaling type}}
\DoxyCodeLine{195 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(inout)} :: u\textcolor{comment}{ !< The zonal velocity [L T-1 ~> m s-1].}}
\DoxyCodeLine{196 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(inout)} :: v\textcolor{comment}{ !< The meridional velocity [L T-1 ~> m s-1].}}
\DoxyCodeLine{197 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \textcolor{keywordtype}{intent(inout)} :: h\textcolor{comment}{ !< Layer thicknesses [H ~> m or kg m-2].}}
\DoxyCodeLine{198   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),   \textcolor{keywordtype}{intent(in)}    :: tv\textcolor{comment}{     !< A structure pointing to various}}
\DoxyCodeLine{199 \textcolor{comment}{                                                   !! thermodynamic variables.}}
\DoxyCodeLine{200   \textcolor{keywordtype}{type}(vertvisc\_type),     \textcolor{keywordtype}{intent(inout)} :: visc\textcolor{comment}{   !< A structure containing vertical}}
\DoxyCodeLine{201 \textcolor{comment}{                                 !! viscosities, bottom drag viscosities, and related fields.}}
\DoxyCodeLine{202   \textcolor{keywordtype}{type}(time\_type),         \textcolor{keywordtype}{intent(in)}    :: Time\_local\textcolor{comment}{   !< The model time at the end}}
\DoxyCodeLine{203 \textcolor{comment}{                                                         !! of the time step.}}
\DoxyCodeLine{204 \textcolor{keywordtype}{  real},                    \textcolor{keywordtype}{intent(in)}    :: dt\textcolor{comment}{     !< The dynamics time step [T ~> s].}}
\DoxyCodeLine{205   \textcolor{keywordtype}{type}(mech\_forcing),      \textcolor{keywordtype}{intent(in)}    :: forces\textcolor{comment}{ !< A structure with the driving mechanical forces}}
\DoxyCodeLine{206 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)},    \textcolor{keywordtype}{pointer}       :: p\_surf\_begin\textcolor{comment}{ !< A pointer (perhaps NULL) to the surface}}
\DoxyCodeLine{207 \textcolor{comment}{                                                   !! pressure at the start of this dynamic step [R L2 T-2 ~> Pa].}}
\DoxyCodeLine{208 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)},    \textcolor{keywordtype}{pointer}       :: p\_surf\_end\textcolor{comment}{   !< A pointer (perhaps NULL) to the surface}}
\DoxyCodeLine{209 \textcolor{comment}{                                                   !! pressure at the end of this dynamic step [R L2 T-2 ~> Pa].}}
\DoxyCodeLine{210 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(inout)} :: uh\textcolor{comment}{ !< The zonal volume or mass transport}}
\DoxyCodeLine{211 \textcolor{comment}{                                                   !! [H L2 T-1 ~> m3 s-1 or kg s-1].}}
\DoxyCodeLine{212 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(inout)} :: vh\textcolor{comment}{ !< The meridional volume or mass}}
\DoxyCodeLine{213 \textcolor{comment}{                                                   !! transport [H L2 T-1 ~> m3 s-1 or kg s-1].}}
\DoxyCodeLine{214 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(inout)} :: uhtr\textcolor{comment}{ !< The accumulated zonal volume or mass}}
\DoxyCodeLine{215 \textcolor{comment}{                                                   !! transport since the last tracer advection [H L2 ~> m3 or kg].}}
\DoxyCodeLine{216 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(inout)} :: vhtr\textcolor{comment}{ !< The accumulated meridional volume or mass}}
\DoxyCodeLine{217 \textcolor{comment}{                                                   !! transport since the last tracer advection [H L2 ~> m3 or kg].}}
\DoxyCodeLine{218 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))}, \textcolor{keywordtype}{intent(out)} :: eta\_av\textcolor{comment}{ !< The time-mean free surface height or}}
\DoxyCodeLine{219 \textcolor{comment}{                                                   !! column mass [H ~> m or kg m-2].}}
\DoxyCodeLine{220   \textcolor{keywordtype}{type}(MOM\_dyn\_unsplit\_CS), \textcolor{keywordtype}{pointer}      :: CS\textcolor{comment}{     !< The control structure set up by}}
\DoxyCodeLine{221 \textcolor{comment}{                                                   !! initialize\_dyn\_unsplit.}}
\DoxyCodeLine{222   \textcolor{keywordtype}{type}(VarMix\_CS),         \textcolor{keywordtype}{pointer}       :: VarMix\textcolor{comment}{ !< A pointer to a structure with fields}}
\DoxyCodeLine{223 \textcolor{comment}{                                 !! that specify the spatially variable viscosities.}}
\DoxyCodeLine{224   \textcolor{keywordtype}{type}(MEKE\_type),         \textcolor{keywordtype}{pointer}       :: MEKE\textcolor{comment}{   !< A pointer to a structure containing}}
\DoxyCodeLine{225 \textcolor{comment}{                                 !! fields related to the Mesoscale Eddy Kinetic Energy.}}
\DoxyCodeLine{226   \textcolor{keywordtype}{type}(wave\_parameters\_CS), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer} :: Waves\textcolor{comment}{ !< A pointer to a structure containing}}
\DoxyCodeLine{227 \textcolor{comment}{                                 !! fields related to the surface wave conditions}}
\DoxyCodeLine{228 }
\DoxyCodeLine{229   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{230 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))} :: h\_av, hp \textcolor{comment}{! Prediced or averaged layer thicknesses [H ~> m or kg m-2]}}
\DoxyCodeLine{231 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))} :: up, upp \textcolor{comment}{! Predicted zonal velocities [L T-1 ~> m s-1]}}
\DoxyCodeLine{232 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))} :: vp, vpp \textcolor{comment}{! Predicted meridional velocities [L T-1 ~> m s-1]}}
\DoxyCodeLine{233 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: p\_surf => null()}
\DoxyCodeLine{234 \textcolor{keywordtype}{  real} :: dt\_pred   \textcolor{comment}{! The time step for the predictor part of the baroclinic time stepping [T ~> s].}}
\DoxyCodeLine{235 \textcolor{keywordtype}{  real} :: dt\_visc   \textcolor{comment}{! The time step for a part of the update due to viscosity [T ~> s].}}
\DoxyCodeLine{236   \textcolor{keywordtype}{logical} :: dyn\_p\_surf}
\DoxyCodeLine{237   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, Isq, Ieq, Jsq, Jeq, nz}
\DoxyCodeLine{238   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{239   isq = g\%IscB ; ieq = g\%IecB ; jsq = g\%JscB ; jeq = g\%JecB}
\DoxyCodeLine{240   dt\_pred = dt / 3.0}
\DoxyCodeLine{241 }
\DoxyCodeLine{242   h\_av(:,:,:) = 0; hp(:,:,:) = 0}
\DoxyCodeLine{243   up(:,:,:) = 0; upp(:,:,:) = 0}
\DoxyCodeLine{244   vp(:,:,:) = 0; vpp(:,:,:) = 0}
\DoxyCodeLine{245 }
\DoxyCodeLine{246   dyn\_p\_surf = \textcolor{keyword}{associated}(p\_surf\_begin) .and. \textcolor{keyword}{associated}(p\_surf\_end)}
\DoxyCodeLine{247   \textcolor{keywordflow}{if} (dyn\_p\_surf) \textcolor{keywordflow}{then}}
\DoxyCodeLine{248     \textcolor{keyword}{call }safe\_alloc\_ptr(p\_surf,g\%isd,g\%ied,g\%jsd,g\%jed) ; p\_surf(:,:) = 0.0}
\DoxyCodeLine{249   \textcolor{keywordflow}{else}}
\DoxyCodeLine{250     p\_surf => forces\%p\_surf}
\DoxyCodeLine{251 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{252 }
\DoxyCodeLine{253 \textcolor{comment}{! Matsuno's third order accurate three step scheme is used to step}}
\DoxyCodeLine{254 \textcolor{comment}{! all of the fields except h.  h is stepped separately.}}
\DoxyCodeLine{255 }
\DoxyCodeLine{256   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{257     \textcolor{keyword}{call }mom\_state\_chksum(\textcolor{stringliteral}{"Start First Predictor "}, u, v, h, uh, vh, g, gv, us)}
\DoxyCodeLine{258 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{259 }
\DoxyCodeLine{260 \textcolor{comment}{! diffu = horizontal viscosity terms (u,h)}}
\DoxyCodeLine{261   \textcolor{keyword}{call }enable\_averages(dt, time\_local, cs\%diag)}
\DoxyCodeLine{262   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_horvisc)}
\DoxyCodeLine{263   \textcolor{keyword}{call }horizontal\_viscosity(u, v, h, cs\%diffu, cs\%diffv, meke, varmix, g, gv, us, cs\%hor\_visc\_CSp)}
\DoxyCodeLine{264   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_horvisc)}
\DoxyCodeLine{265   \textcolor{keyword}{call }disable\_averaging(cs\%diag)}
\DoxyCodeLine{266 }
\DoxyCodeLine{267 \textcolor{comment}{! uh = u*h}}
\DoxyCodeLine{268 \textcolor{comment}{! hp = h + dt/2 div . uh}}
\DoxyCodeLine{269   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_continuity)}
\DoxyCodeLine{270   \textcolor{keyword}{call }continuity(u, v, h, hp, uh, vh, dt*0.5, g, gv, us, cs\%continuity\_CSp, obc=cs\%OBC)}
\DoxyCodeLine{271   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_continuity)}
\DoxyCodeLine{272   \textcolor{keyword}{call }pass\_var(hp, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{273   \textcolor{keyword}{call }pass\_vector(uh, vh, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{274 }
\DoxyCodeLine{275   \textcolor{keyword}{call }enable\_averages(0.5*dt, time\_local-real\_to\_time(0.5*us\%T\_to\_s*dt), cs\%diag)}
\DoxyCodeLine{276 \textcolor{comment}{!   Here the first half of the thickness fluxes are offered for averaging.}}
\DoxyCodeLine{277   \textcolor{keywordflow}{if} (cs\%id\_uh > 0) \textcolor{keyword}{call }post\_data(cs\%id\_uh, uh, cs\%diag)}
\DoxyCodeLine{278   \textcolor{keywordflow}{if} (cs\%id\_vh > 0) \textcolor{keyword}{call }post\_data(cs\%id\_vh, vh, cs\%diag)}
\DoxyCodeLine{279   \textcolor{keyword}{call }disable\_averaging(cs\%diag)}
\DoxyCodeLine{280 }
\DoxyCodeLine{281 \textcolor{comment}{! h\_av = (h + hp)/2}}
\DoxyCodeLine{282 \textcolor{comment}{! u = u + dt diffu}}
\DoxyCodeLine{283   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_mom\_update)}
\DoxyCodeLine{284   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{285     \textcolor{keywordflow}{do} j=js-2,je+2 ; \textcolor{keywordflow}{do} i=is-2,ie+2}
\DoxyCodeLine{286       h\_av(i,j,k) = (h(i,j,k) + hp(i,j,k)) * 0.5}
\DoxyCodeLine{287 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{288     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{289       u(i,j,k) = u(i,j,k) + dt * cs\%diffu(i,j,k) * g\%mask2dCu(i,j)}
\DoxyCodeLine{290 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{291     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{292       v(i,j,k) = v(i,j,k) + dt * cs\%diffv(i,j,k) * g\%mask2dCv(i,j)}
\DoxyCodeLine{293 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{294     \textcolor{keywordflow}{do} j=js-2,je+2 ; \textcolor{keywordflow}{do} i=isq-2,ieq+2}
\DoxyCodeLine{295       uhtr(i,j,k) = uhtr(i,j,k) + 0.5*dt*uh(i,j,k)}
\DoxyCodeLine{296 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{297     \textcolor{keywordflow}{do} j=jsq-2,jeq+2 ; \textcolor{keywordflow}{do} i=is-2,ie+2}
\DoxyCodeLine{298       vhtr(i,j,k) = vhtr(i,j,k) + 0.5*dt*vh(i,j,k)}
\DoxyCodeLine{299 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{300 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{301   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_mom\_update)}
\DoxyCodeLine{302   \textcolor{keyword}{call }pass\_vector(u, v, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{303 }
\DoxyCodeLine{304 \textcolor{comment}{! CAu = -(f+zeta)/h\_av vh + d/dx KE}}
\DoxyCodeLine{305   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_cor)}
\DoxyCodeLine{306   \textcolor{keyword}{call }coradcalc(u, v, h\_av, uh, vh, cs\%CAu, cs\%CAv, cs\%OBC, cs\%ADp, \&}
\DoxyCodeLine{307                  g, gv, us, cs\%CoriolisAdv\_CSp)}
\DoxyCodeLine{308   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_cor)}
\DoxyCodeLine{309 }
\DoxyCodeLine{310 \textcolor{comment}{! PFu = d/dx M(h\_av,T,S)}}
\DoxyCodeLine{311   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_pres)}
\DoxyCodeLine{312   \textcolor{keywordflow}{if} (dyn\_p\_surf) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=js-2,je+2 ; \textcolor{keywordflow}{do} i=is-2,ie+2}
\DoxyCodeLine{313     p\_surf(i,j) = 0.75*p\_surf\_begin(i,j) + 0.25*p\_surf\_end(i,j)}
\DoxyCodeLine{314 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{315   \textcolor{keyword}{call }pressureforce(h\_av, tv, cs\%PFu, cs\%PFv, g, gv, us, \&}
\DoxyCodeLine{316                      cs\%PressureForce\_CSp, cs\%ALE\_CSp, p\_surf)}
\DoxyCodeLine{317   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_pres)}
\DoxyCodeLine{318 }
\DoxyCodeLine{319   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) then; \textcolor{keywordflow}{if} (cs\%OBC\%update\_OBC) \textcolor{keywordflow}{then}}
\DoxyCodeLine{320     \textcolor{keyword}{call }update\_obc\_data(cs\%OBC, g, gv, us, tv, h, cs\%update\_OBC\_CSp, time\_local)}
\DoxyCodeLine{321 \textcolor{keyword}{  end}if; endif}
\DoxyCodeLine{322   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{323     \textcolor{keyword}{call }open\_boundary\_zero\_normal\_flow(cs\%OBC, g, cs\%PFu, cs\%PFv)}
\DoxyCodeLine{324     \textcolor{keyword}{call }open\_boundary\_zero\_normal\_flow(cs\%OBC, g, cs\%CAu, cs\%CAv)}
\DoxyCodeLine{325 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{326 }
\DoxyCodeLine{327 \textcolor{comment}{! up = u + dt\_pred * (PFu + CAu)}}
\DoxyCodeLine{328   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_mom\_update)}
\DoxyCodeLine{329   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{330     up(i,j,k) = g\%mask2dCu(i,j) * (u(i,j,k) + dt\_pred * (cs\%PFu(i,j,k) + cs\%CAu(i,j,k)))}
\DoxyCodeLine{331 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{332   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{333     vp(i,j,k) = g\%mask2dCv(i,j) * (v(i,j,k) + dt\_pred * (cs\%PFv(i,j,k) + cs\%CAv(i,j,k)))}
\DoxyCodeLine{334 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{335   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_mom\_update)}
\DoxyCodeLine{336 }
\DoxyCodeLine{337   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{338     \textcolor{keyword}{call }mom\_state\_chksum(\textcolor{stringliteral}{"Predictor 1"}, up, vp, h\_av, uh, vh, g, gv, us)}
\DoxyCodeLine{339     \textcolor{keyword}{call }mom\_accel\_chksum(\textcolor{stringliteral}{"Predictor 1 accel"}, cs\%CAu, cs\%CAv, cs\%PFu, cs\%PFv, \&}
\DoxyCodeLine{340                           cs\%diffu, cs\%diffv, g, gv, us)}
\DoxyCodeLine{341 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{342 }
\DoxyCodeLine{343  \textcolor{comment}{! up <- up + dt/2 d/dz visc d/dz up}}
\DoxyCodeLine{344   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_vertvisc)}
\DoxyCodeLine{345   \textcolor{keyword}{call }enable\_averages(dt, time\_local, cs\%diag)}
\DoxyCodeLine{346   dt\_visc = 0.5*dt ; \textcolor{keywordflow}{if} (cs\%use\_correct\_dt\_visc) dt\_visc = dt}
\DoxyCodeLine{347   \textcolor{keyword}{call }set\_viscous\_ml(u, v, h\_av, tv, forces, visc, dt\_visc, g, gv, us, cs\%set\_visc\_CSp)}
\DoxyCodeLine{348   \textcolor{keyword}{call }disable\_averaging(cs\%diag)}
\DoxyCodeLine{349 }
\DoxyCodeLine{350   dt\_visc = 0.5*dt ; \textcolor{keywordflow}{if} (cs\%use\_correct\_dt\_visc) dt\_visc = dt\_pred}
\DoxyCodeLine{351   \textcolor{keyword}{call }vertvisc\_coef(up, vp, h\_av, forces, visc, dt\_visc, g, gv, us, cs\%vertvisc\_CSp, cs\%OBC)}
\DoxyCodeLine{352   \textcolor{keyword}{call }vertvisc(up, vp, h\_av, forces, visc, dt\_visc, cs\%OBC, cs\%ADp, cs\%CDp, \&}
\DoxyCodeLine{353                 g, gv, us, cs\%vertvisc\_CSp, waves=waves)}
\DoxyCodeLine{354   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_vertvisc)}
\DoxyCodeLine{355   \textcolor{keyword}{call }pass\_vector(up, vp, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{356 }
\DoxyCodeLine{357 \textcolor{comment}{! uh = up * hp}}
\DoxyCodeLine{358 \textcolor{comment}{! h\_av = hp + dt/2 div . uh}}
\DoxyCodeLine{359   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_continuity)}
\DoxyCodeLine{360   \textcolor{keyword}{call }continuity(up, vp, hp, h\_av, uh, vh, (0.5*dt), g, gv, us, cs\%continuity\_CSp, obc=cs\%OBC)}
\DoxyCodeLine{361   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_continuity)}
\DoxyCodeLine{362   \textcolor{keyword}{call }pass\_var(h\_av, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{363   \textcolor{keyword}{call }pass\_vector(uh, vh, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{364 }
\DoxyCodeLine{365 \textcolor{comment}{! h\_av <- (hp + h\_av)/2}}
\DoxyCodeLine{366   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js-2,je+2 ; \textcolor{keywordflow}{do} i=is-2,ie+2}
\DoxyCodeLine{367     h\_av(i,j,k) = (hp(i,j,k) + h\_av(i,j,k)) * 0.5}
\DoxyCodeLine{368 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{369 }
\DoxyCodeLine{370 \textcolor{comment}{! CAu = -(f+zeta(up))/h\_av vh + d/dx KE(up)}}
\DoxyCodeLine{371   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_cor)}
\DoxyCodeLine{372   \textcolor{keyword}{call }coradcalc(up, vp, h\_av, uh, vh, cs\%CAu, cs\%CAv, cs\%OBC, cs\%ADp, \&}
\DoxyCodeLine{373                  g, gv, us, cs\%CoriolisAdv\_CSp)}
\DoxyCodeLine{374   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_cor)}
\DoxyCodeLine{375 }
\DoxyCodeLine{376 \textcolor{comment}{! PFu = d/dx M(h\_av,T,S)}}
\DoxyCodeLine{377   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_pres)}
\DoxyCodeLine{378   \textcolor{keywordflow}{if} (dyn\_p\_surf) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=js-2,je+2 ; \textcolor{keywordflow}{do} i=is-2,ie+2}
\DoxyCodeLine{379     p\_surf(i,j) = 0.25*p\_surf\_begin(i,j) + 0.75*p\_surf\_end(i,j)}
\DoxyCodeLine{380 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{381   \textcolor{keyword}{call }pressureforce(h\_av, tv, cs\%PFu, cs\%PFv, g, gv, us, \&}
\DoxyCodeLine{382                      cs\%PressureForce\_CSp, cs\%ALE\_CSp, p\_surf)}
\DoxyCodeLine{383   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_pres)}
\DoxyCodeLine{384 }
\DoxyCodeLine{385   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) then; \textcolor{keywordflow}{if} (cs\%OBC\%update\_OBC) \textcolor{keywordflow}{then}}
\DoxyCodeLine{386     \textcolor{keyword}{call }update\_obc\_data(cs\%OBC, g, gv, us, tv, h, cs\%update\_OBC\_CSp, time\_local)}
\DoxyCodeLine{387 \textcolor{keyword}{  end}if; endif}
\DoxyCodeLine{388   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{389     \textcolor{keyword}{call }open\_boundary\_zero\_normal\_flow(cs\%OBC, g, cs\%PFu, cs\%PFv)}
\DoxyCodeLine{390     \textcolor{keyword}{call }open\_boundary\_zero\_normal\_flow(cs\%OBC, g, cs\%CAu, cs\%CAv)}
\DoxyCodeLine{391 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{392 }
\DoxyCodeLine{393 \textcolor{comment}{! upp = u + dt/2 * ( PFu + CAu )}}
\DoxyCodeLine{394   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_mom\_update)}
\DoxyCodeLine{395   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{396     upp(i,j,k) = g\%mask2dCu(i,j) * (u(i,j,k) + dt * 0.5 * (cs\%PFu(i,j,k) + cs\%CAu(i,j,k)))}
\DoxyCodeLine{397 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{398   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{399     vpp(i,j,k) = g\%mask2dCv(i,j) * (v(i,j,k) + dt * 0.5 * (cs\%PFv(i,j,k) + cs\%CAv(i,j,k)))}
\DoxyCodeLine{400 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{401   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_mom\_update)}
\DoxyCodeLine{402 }
\DoxyCodeLine{403   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{404     \textcolor{keyword}{call }mom\_state\_chksum(\textcolor{stringliteral}{"Predictor 2"}, upp, vpp, h\_av, uh, vh, g, gv, us)}
\DoxyCodeLine{405     \textcolor{keyword}{call }mom\_accel\_chksum(\textcolor{stringliteral}{"Predictor 2 accel"}, cs\%CAu, cs\%CAv, cs\%PFu, cs\%PFv, \&}
\DoxyCodeLine{406                           cs\%diffu, cs\%diffv, g, gv, us)}
\DoxyCodeLine{407 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{408 }
\DoxyCodeLine{409 \textcolor{comment}{! upp <- upp + dt/2 d/dz visc d/dz upp}}
\DoxyCodeLine{410   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_vertvisc)}
\DoxyCodeLine{411   \textcolor{keyword}{call }vertvisc\_coef(upp, vpp, hp, forces, visc, dt*0.5, g, gv, us, cs\%vertvisc\_CSp, cs\%OBC)}
\DoxyCodeLine{412   \textcolor{keyword}{call }vertvisc(upp, vpp, hp, forces, visc, dt*0.5, cs\%OBC, cs\%ADp, cs\%CDp, \&}
\DoxyCodeLine{413                 g, gv, us, cs\%vertvisc\_CSp, waves=waves)}
\DoxyCodeLine{414   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_vertvisc)}
\DoxyCodeLine{415   \textcolor{keyword}{call }pass\_vector(upp, vpp, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{416 }
\DoxyCodeLine{417 \textcolor{comment}{! uh = upp * hp}}
\DoxyCodeLine{418 \textcolor{comment}{! h = hp + dt/2 div . uh}}
\DoxyCodeLine{419   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_continuity)}
\DoxyCodeLine{420   \textcolor{keyword}{call }continuity(upp, vpp, hp, h, uh, vh, (dt*0.5), g, gv, us, cs\%continuity\_CSp, obc=cs\%OBC)}
\DoxyCodeLine{421   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_continuity)}
\DoxyCodeLine{422   \textcolor{keyword}{call }pass\_var(h, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{423   \textcolor{keyword}{call }pass\_vector(uh, vh, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{424   \textcolor{comment}{! Whenever thickness changes let the diag manager know, target grids}}
\DoxyCodeLine{425   \textcolor{comment}{! for vertical remapping may need to be regenerated.}}
\DoxyCodeLine{426   \textcolor{keyword}{call }diag\_update\_remap\_grids(cs\%diag)}
\DoxyCodeLine{427 }
\DoxyCodeLine{428   \textcolor{keyword}{call }enable\_averages(0.5*dt, time\_local, cs\%diag)}
\DoxyCodeLine{429 \textcolor{comment}{!   Here the second half of the thickness fluxes are offered for averaging.}}
\DoxyCodeLine{430   \textcolor{keywordflow}{if} (cs\%id\_uh > 0) \textcolor{keyword}{call }post\_data(cs\%id\_uh, uh, cs\%diag)}
\DoxyCodeLine{431   \textcolor{keywordflow}{if} (cs\%id\_vh > 0) \textcolor{keyword}{call }post\_data(cs\%id\_vh, vh, cs\%diag)}
\DoxyCodeLine{432   \textcolor{keyword}{call }disable\_averaging(cs\%diag)}
\DoxyCodeLine{433   \textcolor{keyword}{call }enable\_averages(dt, time\_local, cs\%diag)}
\DoxyCodeLine{434 }
\DoxyCodeLine{435 \textcolor{comment}{! h\_av = (h + hp)/2}}
\DoxyCodeLine{436   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{437     \textcolor{keywordflow}{do} j=js-2,je+2 ; \textcolor{keywordflow}{do} i=is-2,ie+2}
\DoxyCodeLine{438       h\_av(i,j,k) = 0.5*(h(i,j,k) + hp(i,j,k))}
\DoxyCodeLine{439 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{440     \textcolor{keywordflow}{do} j=js-2,je+2 ; \textcolor{keywordflow}{do} i=isq-2,ieq+2}
\DoxyCodeLine{441       uhtr(i,j,k) = uhtr(i,j,k) + 0.5*dt*uh(i,j,k)}
\DoxyCodeLine{442 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{443     \textcolor{keywordflow}{do} j=jsq-2,jeq+2 ; \textcolor{keywordflow}{do} i=is-2,ie+2}
\DoxyCodeLine{444       vhtr(i,j,k) = vhtr(i,j,k) + 0.5*dt*vh(i,j,k)}
\DoxyCodeLine{445 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{446 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{447 }
\DoxyCodeLine{448 \textcolor{comment}{! CAu = -(f+zeta(upp))/h\_av vh + d/dx KE(upp)}}
\DoxyCodeLine{449   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_cor)}
\DoxyCodeLine{450   \textcolor{keyword}{call }coradcalc(upp, vpp, h\_av, uh, vh, cs\%CAu, cs\%CAv, cs\%OBC, cs\%ADp, \&}
\DoxyCodeLine{451                  g, gv, us, cs\%CoriolisAdv\_CSp)}
\DoxyCodeLine{452   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_cor)}
\DoxyCodeLine{453 }
\DoxyCodeLine{454 \textcolor{comment}{! PFu = d/dx M(h\_av,T,S)}}
\DoxyCodeLine{455   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_pres)}
\DoxyCodeLine{456   \textcolor{keyword}{call }pressureforce(h\_av, tv, cs\%PFu, cs\%PFv, g, gv, us, \&}
\DoxyCodeLine{457                      cs\%PressureForce\_CSp, cs\%ALE\_CSp, p\_surf)}
\DoxyCodeLine{458   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_pres)}
\DoxyCodeLine{459 }
\DoxyCodeLine{460   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) then; \textcolor{keywordflow}{if} (cs\%OBC\%update\_OBC) \textcolor{keywordflow}{then}}
\DoxyCodeLine{461     \textcolor{keyword}{call }update\_obc\_data(cs\%OBC, g, gv, us, tv, h, cs\%update\_OBC\_CSp, time\_local)}
\DoxyCodeLine{462 \textcolor{keyword}{  end}if; endif}
\DoxyCodeLine{463 }
\DoxyCodeLine{464 \textcolor{comment}{! u = u + dt * ( PFu + CAu )}}
\DoxyCodeLine{465   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{466     \textcolor{keyword}{call }open\_boundary\_zero\_normal\_flow(cs\%OBC, g, cs\%PFu, cs\%PFv)}
\DoxyCodeLine{467     \textcolor{keyword}{call }open\_boundary\_zero\_normal\_flow(cs\%OBC, g, cs\%CAu, cs\%CAv)}
\DoxyCodeLine{468 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{469   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{470     u(i,j,k) = g\%mask2dCu(i,j) * (u(i,j,k) + dt * (cs\%PFu(i,j,k) + cs\%CAu(i,j,k)))}
\DoxyCodeLine{471 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{472   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{473     v(i,j,k) = g\%mask2dCv(i,j) * (v(i,j,k) + dt * (cs\%PFv(i,j,k) + cs\%CAv(i,j,k)))}
\DoxyCodeLine{474 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{475 }
\DoxyCodeLine{476 \textcolor{comment}{! u <- u + dt d/dz visc d/dz u}}
\DoxyCodeLine{477   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_vertvisc)}
\DoxyCodeLine{478   \textcolor{keyword}{call }vertvisc\_coef(u, v, h\_av, forces, visc, dt, g, gv, us, cs\%vertvisc\_CSp, cs\%OBC)}
\DoxyCodeLine{479   \textcolor{keyword}{call }vertvisc(u, v, h\_av, forces, visc, dt, cs\%OBC, cs\%ADp, cs\%CDp, \&}
\DoxyCodeLine{480                 g, gv, us, cs\%vertvisc\_CSp, cs\%taux\_bot, cs\%tauy\_bot, waves=waves)}
\DoxyCodeLine{481   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_vertvisc)}
\DoxyCodeLine{482   \textcolor{keyword}{call }pass\_vector(u, v, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{483 }
\DoxyCodeLine{484   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{485     \textcolor{keyword}{call }mom\_state\_chksum(\textcolor{stringliteral}{"Corrector"}, u, v, h, uh, vh, g, gv, us)}
\DoxyCodeLine{486     \textcolor{keyword}{call }mom\_accel\_chksum(\textcolor{stringliteral}{"Corrector accel"}, cs\%CAu, cs\%CAv, cs\%PFu, cs\%PFv, \&}
\DoxyCodeLine{487                           cs\%diffu, cs\%diffv, g, gv, us)}
\DoxyCodeLine{488 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{489 }
\DoxyCodeLine{490   \textcolor{keywordflow}{if} (gv\%Boussinesq) \textcolor{keywordflow}{then}}
\DoxyCodeLine{491     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; eta\_av(i,j) = -gv\%Z\_to\_H*g\%bathyT(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{492   \textcolor{keywordflow}{else}}
\DoxyCodeLine{493     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; eta\_av(i,j) = 0.0 ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{494 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{495   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{496     eta\_av(i,j) = eta\_av(i,j) + h\_av(i,j,k)}
\DoxyCodeLine{497 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{498 }
\DoxyCodeLine{499   \textcolor{keywordflow}{if} (dyn\_p\_surf) \textcolor{keyword}{deallocate}(p\_surf)}
\DoxyCodeLine{500 }
\DoxyCodeLine{501 \textcolor{comment}{!   Here various terms used in to update the momentum equations are}}
\DoxyCodeLine{502 \textcolor{comment}{! offered for averaging.}}
\DoxyCodeLine{503   \textcolor{keywordflow}{if} (cs\%id\_PFu > 0) \textcolor{keyword}{call }post\_data(cs\%id\_PFu, cs\%PFu, cs\%diag)}
\DoxyCodeLine{504   \textcolor{keywordflow}{if} (cs\%id\_PFv > 0) \textcolor{keyword}{call }post\_data(cs\%id\_PFv, cs\%PFv, cs\%diag)}
\DoxyCodeLine{505   \textcolor{keywordflow}{if} (cs\%id\_CAu > 0) \textcolor{keyword}{call }post\_data(cs\%id\_CAu, cs\%CAu, cs\%diag)}
\DoxyCodeLine{506   \textcolor{keywordflow}{if} (cs\%id\_CAv > 0) \textcolor{keyword}{call }post\_data(cs\%id\_CAv, cs\%CAv, cs\%diag)}
\DoxyCodeLine{507 }

\end{DoxyCode}
