\hypertarget{namespacemom__dynamics__split__rk2}{}\doxysection{mom\+\_\+dynamics\+\_\+split\+\_\+rk2 Module Reference}
\label{namespacemom__dynamics__split__rk2}\index{mom\_dynamics\_split\_rk2@{mom\_dynamics\_split\_rk2}}


\doxysubsection{Detailed Description}
Time step the adiabatic dynamic core of M\+OM using R\+K2 method. 

This file time steps the adiabatic dynamic core by splitting between baroclinic and barotropic modes. It uses a pseudo-\/second order Runge-\/\+Kutta time stepping scheme for the baroclinic momentum equation and a forward-\/backward coupling between the baroclinic momentum and continuity equations. This split time-\/stepping scheme is described in detail in Hallberg (J\+CP, 1997). Additional issues related to exact tracer conservation and how to ensure consistency between the barotropic and layered estimates of the free surface height are described in Hallberg and Adcroft (Ocean Modelling, 2009). This was the time stepping code that is used for most G\+O\+LD applications, including G\+F\+DL\textquotesingle{}s E\+S\+M2G Earth system model, and all of the examples provided with the M\+OM code (although several of these solutions are routinely verified by comparison with the slower unsplit schemes).

The subroutine step\+\_\+\+M\+O\+M\+\_\+dyn\+\_\+split\+\_\+\+R\+K2 actually does the time stepping, while register\+\_\+restarts\+\_\+dyn\+\_\+split\+\_\+\+R\+K2 sets the fields that are found in a full restart file with this scheme, and initialize\+\_\+dyn\+\_\+split\+\_\+\+R\+K2 initializes the cpu clocks that are used in this module. For largely historical reasons, this module does not have its own control structure, but shares the same control structure with \mbox{\hyperlink{MOM_8F90_source}{M\+O\+M.\+F90}} and the other M\+O\+M\+\_\+dynamics\+\_\+... modules. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structmom__dynamics__split__rk2_1_1mom__dyn__split__rk2__cs}{mom\+\_\+dyn\+\_\+split\+\_\+rk2\+\_\+cs}}
\begin{DoxyCompactList}\small\item\em M\+O\+M\+\_\+dynamics\+\_\+split\+\_\+\+R\+K2 module control structure. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__dynamics__split__rk2_a976e700971f232fc11bc69b31d611c32}{step\+\_\+mom\+\_\+dyn\+\_\+split\+\_\+rk2}} (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, calc\+\_\+dtbt, Var\+Mix, M\+E\+KE, thickness\+\_\+diffuse\+\_\+\+C\+Sp, Waves)
\begin{DoxyCompactList}\small\item\em R\+K2 splitting for time stepping M\+OM adiabatic dynamics. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__dynamics__split__rk2_a9f889b82fd5ed29a854da99d3c929366}{register\+\_\+restarts\+\_\+dyn\+\_\+split\+\_\+rk2}} (HI, GV, param\+\_\+file, CS, restart\+\_\+\+CS, uh, vh)
\begin{DoxyCompactList}\small\item\em This subroutine sets up 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. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__dynamics__split__rk2_a3995d7e0c8fb36abdc7166ea4fe586d1}{initialize\+\_\+dyn\+\_\+split\+\_\+rk2}} (u, v, h, uh, vh, eta, Time, G, GV, US, param\+\_\+file, diag, CS, restart\+\_\+\+CS, dt, Accel\+\_\+diag, Cont\+\_\+diag, M\+IS, Var\+Mix, M\+E\+KE, thickness\+\_\+diffuse\+\_\+\+C\+Sp, O\+BC, update\+\_\+\+O\+B\+C\+\_\+\+C\+Sp, A\+L\+E\+\_\+\+C\+Sp, set\+Visc\+\_\+\+C\+Sp, visc, dirs, ntrunc, calc\+\_\+dtbt, cont\+\_\+stencil)
\begin{DoxyCompactList}\small\item\em This subroutine initializes all of the variables that are used by this dynamic core, including diagnostics and the cpu clocks. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__dynamics__split__rk2_a2dedc57e0443d33d9713aa987de22564}{end\+\_\+dyn\+\_\+split\+\_\+rk2}} (CS)
\begin{DoxyCompactList}\small\item\em Close the dyn\+\_\+split\+\_\+\+R\+K2 module. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__dynamics__split__rk2_a2dedc57e0443d33d9713aa987de22564}\label{namespacemom__dynamics__split__rk2_a2dedc57e0443d33d9713aa987de22564}} 
\index{mom\_dynamics\_split\_rk2@{mom\_dynamics\_split\_rk2}!end\_dyn\_split\_rk2@{end\_dyn\_split\_rk2}}
\index{end\_dyn\_split\_rk2@{end\_dyn\_split\_rk2}!mom\_dynamics\_split\_rk2@{mom\_dynamics\_split\_rk2}}
\doxysubsubsection{\texorpdfstring{end\_dyn\_split\_rk2()}{end\_dyn\_split\_rk2()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+dynamics\+\_\+split\+\_\+rk2\+::end\+\_\+dyn\+\_\+split\+\_\+rk2 (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__dynamics__split__rk2_1_1mom__dyn__split__rk2__cs}{mom\+\_\+dyn\+\_\+split\+\_\+rk2\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Close the dyn\+\_\+split\+\_\+\+R\+K2 module. 


\begin{DoxyParams}{Parameters}
{\em cs} & module control structure \\
\hline
\end{DoxyParams}


Definition at line 1443 of file M\+O\+M\+\_\+dynamics\+\_\+split\+\_\+\+R\+K2.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1444   \textcolor{keywordtype}{type}(MOM\_dyn\_split\_RK2\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{  !< module control structure}}
\DoxyCodeLine{1445 }
\DoxyCodeLine{1446   dealloc\_(cs\%diffu) ; dealloc\_(cs\%diffv)}
\DoxyCodeLine{1447   dealloc\_(cs\%CAu)   ; dealloc\_(cs\%CAv)}
\DoxyCodeLine{1448   dealloc\_(cs\%PFu)   ; dealloc\_(cs\%PFv)}
\DoxyCodeLine{1449 }
\DoxyCodeLine{1450   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%taux\_bot)) \textcolor{keyword}{deallocate}(cs\%taux\_bot)}
\DoxyCodeLine{1451   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%tauy\_bot)) \textcolor{keyword}{deallocate}(cs\%tauy\_bot)}
\DoxyCodeLine{1452   dealloc\_(cs\%uhbt) ; dealloc\_(cs\%vhbt)}
\DoxyCodeLine{1453   dealloc\_(cs\%u\_accel\_bt) ; dealloc\_(cs\%v\_accel\_bt)}
\DoxyCodeLine{1454   dealloc\_(cs\%visc\_rem\_u) ; dealloc\_(cs\%visc\_rem\_v)}
\DoxyCodeLine{1455 }
\DoxyCodeLine{1456   dealloc\_(cs\%eta) ; dealloc\_(cs\%eta\_PF) ; dealloc\_(cs\%pbce)}
\DoxyCodeLine{1457   dealloc\_(cs\%h\_av) ; dealloc\_(cs\%u\_av) ; dealloc\_(cs\%v\_av)}
\DoxyCodeLine{1458 }
\DoxyCodeLine{1459   \textcolor{keyword}{call }dealloc\_bt\_cont\_type(cs\%BT\_cont)}
\DoxyCodeLine{1460 }
\DoxyCodeLine{1461   \textcolor{keyword}{deallocate}(cs)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__dynamics__split__rk2_a3995d7e0c8fb36abdc7166ea4fe586d1}\label{namespacemom__dynamics__split__rk2_a3995d7e0c8fb36abdc7166ea4fe586d1}} 
\index{mom\_dynamics\_split\_rk2@{mom\_dynamics\_split\_rk2}!initialize\_dyn\_split\_rk2@{initialize\_dyn\_split\_rk2}}
\index{initialize\_dyn\_split\_rk2@{initialize\_dyn\_split\_rk2}!mom\_dynamics\_split\_rk2@{mom\_dynamics\_split\_rk2}}
\doxysubsubsection{\texorpdfstring{initialize\_dyn\_split\_rk2()}{initialize\_dyn\_split\_rk2()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+dynamics\+\_\+split\+\_\+rk2\+::initialize\+\_\+dyn\+\_\+split\+\_\+rk2 (\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[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(inout), target}]{uh,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(inout), target}]{vh,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed), intent(inout)}]{eta,  }\item[{type(time\+\_\+type), intent(in), target}]{Time,  }\item[{type(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(inout)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV,  }\item[{type(\mbox{\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\+\_\+scale\+\_\+type}}), intent(in)}]{US,  }\item[{type(\mbox{\hyperlink{structmom__file__parser_1_1param__file__type}{param\+\_\+file\+\_\+type}}), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout), target}]{diag,  }\item[{type(\mbox{\hyperlink{structmom__dynamics__split__rk2_1_1mom__dyn__split__rk2__cs}{mom\+\_\+dyn\+\_\+split\+\_\+rk2\+\_\+cs}}), pointer}]{CS,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{restart\+\_\+\+CS,  }\item[{real, intent(in)}]{dt,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1accel__diag__ptrs}{accel\+\_\+diag\+\_\+ptrs}}), intent(inout), target}]{Accel\+\_\+diag,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1cont__diag__ptrs}{cont\+\_\+diag\+\_\+ptrs}}), intent(inout), target}]{Cont\+\_\+diag,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1ocean__internal__state}{ocean\+\_\+internal\+\_\+state}}), intent(inout)}]{M\+IS,  }\item[{type(\mbox{\hyperlink{structmom__lateral__mixing__coeffs_1_1varmix__cs}{varmix\+\_\+cs}}), pointer}]{Var\+Mix,  }\item[{type(\mbox{\hyperlink{structmom__meke__types_1_1meke__type}{meke\+\_\+type}}), pointer}]{M\+E\+KE,  }\item[{type(\mbox{\hyperlink{structmom__thickness__diffuse_1_1thickness__diffuse__cs}{thickness\+\_\+diffuse\+\_\+cs}}), pointer}]{thickness\+\_\+diffuse\+\_\+\+C\+Sp,  }\item[{type(\mbox{\hyperlink{structmom__open__boundary_1_1ocean__obc__type}{ocean\+\_\+obc\+\_\+type}}), pointer}]{O\+BC,  }\item[{type(\mbox{\hyperlink{structmom__boundary__update_1_1update__obc__cs}{update\+\_\+obc\+\_\+cs}}), pointer}]{update\+\_\+\+O\+B\+C\+\_\+\+C\+Sp,  }\item[{type(\mbox{\hyperlink{structmom__ale_1_1ale__cs}{ale\+\_\+cs}}), pointer}]{A\+L\+E\+\_\+\+C\+Sp,  }\item[{type(\mbox{\hyperlink{structmom__set__visc_1_1set__visc__cs}{set\+\_\+visc\+\_\+cs}}), pointer}]{set\+Visc\+\_\+\+C\+Sp,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1vertvisc__type}{vertvisc\+\_\+type}}), intent(inout)}]{visc,  }\item[{type(\mbox{\hyperlink{structmom__get__input_1_1directories}{directories}}), intent(in)}]{dirs,  }\item[{integer, intent(inout), target}]{ntrunc,  }\item[{logical, intent(out)}]{calc\+\_\+dtbt,  }\item[{integer, intent(out), optional}]{cont\+\_\+stencil }\end{DoxyParamCaption})}



This subroutine initializes all of the variables that are used by this dynamic core, including diagnostics and the cpu clocks. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & ocean grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in,out}}  & {\em u} & zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em v} & merid velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em h} & layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em uh} & zonal volume/mass transport \mbox{[}H L2 T-\/1 $\sim$$>$ m3 s-\/1 or kg s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em vh} & merid volume/mass transport \mbox{[}H L2 T-\/1 $\sim$$>$ m3 s-\/1 or kg s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em eta} & free surface height or column mass \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em time} & current model time \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & parameter file for parsing \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag} & to control diagnostics \\
\hline
 & {\em cs} & module control structure \\
\hline
 & {\em restart\+\_\+cs} & restart control structure \\
\hline
\mbox{\texttt{ in}}  & {\em dt} & time step \mbox{[}T $\sim$$>$ s\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em accel\+\_\+diag} & points to momentum equation terms for budget analysis \\
\hline
\mbox{\texttt{ in,out}}  & {\em cont\+\_\+diag} & points to terms in continuity equation \\
\hline
\mbox{\texttt{ in,out}}  & {\em mis} & \char`\"{}\+M\+O\+M6 internal state\char`\"{} used to pass diagnostic pointers \\
\hline
 & {\em varmix} & points to spatially variable viscosities \\
\hline
 & {\em meke} & points to mesoscale eddy kinetic energy fields \\
\hline
 & {\em thickness\+\_\+diffuse\+\_\+csp} & Pointer to the control structure used for the isopycnal height diffusive transport. \\
\hline
 & {\em obc} & points to O\+BC related fields \\
\hline
 & {\em update\+\_\+obc\+\_\+csp} & points to O\+BC update related fields \\
\hline
 & {\em ale\+\_\+csp} & points to A\+LE control structure \\
\hline
 & {\em setvisc\+\_\+csp} & points to the set\+\_\+visc control structure. \\
\hline
\mbox{\texttt{ in,out}}  & {\em visc} & vertical viscosities, bottom drag, and related \\
\hline
\mbox{\texttt{ in}}  & {\em dirs} & contains 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 calc\+\_\+dtbt} & If true, recalculate the barotropic time step \\
\hline
\mbox{\texttt{ out}}  & {\em cont\+\_\+stencil} & The stencil for thickness from the continuity solver. \\
\hline
\end{DoxyParams}


Definition at line 1072 of file M\+O\+M\+\_\+dynamics\+\_\+split\+\_\+\+R\+K2.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1077   \textcolor{keywordtype}{type}(ocean\_grid\_type),            \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{          !< ocean grid structure}}
\DoxyCodeLine{1078   \textcolor{keywordtype}{type}(verticalGrid\_type),          \textcolor{keywordtype}{intent(in)}    :: GV\textcolor{comment}{         !< ocean vertical grid structure}}
\DoxyCodeLine{1079   \textcolor{keywordtype}{type}(unit\_scale\_type),            \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{         !< A dimensional unit scaling type}}
\DoxyCodeLine{1080 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{1081                                     \textcolor{keywordtype}{intent(inout)} :: u\textcolor{comment}{          !< zonal velocity [L T-\/1 \string~> m s-\/1]}}
\DoxyCodeLine{1082 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{1083                                     \textcolor{keywordtype}{intent(inout)} :: v\textcolor{comment}{          !< merid velocity [L T-\/1 \string~> m s-\/1]}}
\DoxyCodeLine{1084 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))} , \textcolor{keywordtype}{intent(inout)} :: h\textcolor{comment}{ !< layer thickness [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{1085 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{1086                             \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: uh\textcolor{comment}{    !< zonal volume/mass transport [H L2 T-\/1 \string~> m3 s-\/1 or kg s-\/1]}}
\DoxyCodeLine{1087 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{1088                             \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: vh\textcolor{comment}{    !< merid volume/mass transport [H L2 T-\/1 \string~> m3 s-\/1 or kg s-\/1]}}
\DoxyCodeLine{1089 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))}, \textcolor{keywordtype}{intent(inout)} :: eta\textcolor{comment}{        !< free surface height or column mass [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{1090   \textcolor{keywordtype}{type}(time\_type),          \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)}    :: Time\textcolor{comment}{       !< current model time}}
\DoxyCodeLine{1091   \textcolor{keywordtype}{type}(param\_file\_type),            \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< parameter file for parsing}}
\DoxyCodeLine{1092   \textcolor{keywordtype}{type}(diag\_ctrl),          \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{       !< to control diagnostics}}
\DoxyCodeLine{1093   \textcolor{keywordtype}{type}(MOM\_dyn\_split\_RK2\_CS),       \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{         !< module control structure}}
\DoxyCodeLine{1094   \textcolor{keywordtype}{type}(MOM\_restart\_CS),             \textcolor{keywordtype}{pointer}       :: restart\_CS\textcolor{comment}{ !< restart control structure}}
\DoxyCodeLine{1095 \textcolor{keywordtype}{  real},                             \textcolor{keywordtype}{intent(in)}    :: dt\textcolor{comment}{         !< time step [T \string~> s]}}
\DoxyCodeLine{1096   \textcolor{keywordtype}{type}(accel\_diag\_ptrs),    \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: Accel\_diag\textcolor{comment}{ !< points to momentum equation terms for}}
\DoxyCodeLine{1097 \textcolor{comment}{                                                                !! budget analysis}}
\DoxyCodeLine{1098   \textcolor{keywordtype}{type}(cont\_diag\_ptrs),     \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: Cont\_diag\textcolor{comment}{  !< points to terms in continuity equation}}
\DoxyCodeLine{1099   \textcolor{keywordtype}{type}(ocean\_internal\_state),       \textcolor{keywordtype}{intent(inout)} :: MIS\textcolor{comment}{        !< "{}MOM6 internal state"{} used to pass}}
\DoxyCodeLine{1100 \textcolor{comment}{                                                                !! diagnostic pointers}}
\DoxyCodeLine{1101   \textcolor{keywordtype}{type}(VarMix\_CS),                  \textcolor{keywordtype}{pointer}       :: VarMix\textcolor{comment}{     !< points to spatially variable viscosities}}
\DoxyCodeLine{1102   \textcolor{keywordtype}{type}(MEKE\_type),                  \textcolor{keywordtype}{pointer}       :: MEKE\textcolor{comment}{       !< points to mesoscale eddy kinetic energy fields}}
\DoxyCodeLine{1103 \textcolor{comment}{!  type(Barotropic\_CS),              pointer       :: Barotropic\_CSp !< Pointer to the control structure for}}
\DoxyCodeLine{1104 \textcolor{comment}{!                                                                !! the barotropic module}}
\DoxyCodeLine{1105   \textcolor{keywordtype}{type}(thickness\_diffuse\_CS),       \textcolor{keywordtype}{pointer}       :: thickness\_diffuse\_CSp\textcolor{comment}{ !< Pointer to the control structure}}
\DoxyCodeLine{1106 \textcolor{comment}{                                                  !! used for the isopycnal height diffusive transport.}}
\DoxyCodeLine{1107   \textcolor{keywordtype}{type}(ocean\_OBC\_type),             \textcolor{keywordtype}{pointer}       :: OBC\textcolor{comment}{        !< points to OBC related fields}}
\DoxyCodeLine{1108   \textcolor{keywordtype}{type}(update\_OBC\_CS),              \textcolor{keywordtype}{pointer}       :: update\_OBC\_CSp\textcolor{comment}{ !< points to OBC update related fields}}
\DoxyCodeLine{1109   \textcolor{keywordtype}{type}(ALE\_CS),                     \textcolor{keywordtype}{pointer}       :: ALE\_CSp\textcolor{comment}{    !< points to ALE control structure}}
\DoxyCodeLine{1110   \textcolor{keywordtype}{type}(set\_visc\_CS),                \textcolor{keywordtype}{pointer}       :: setVisc\_CSp\textcolor{comment}{ !< points to the set\_visc control structure.}}
\DoxyCodeLine{1111   \textcolor{keywordtype}{type}(vertvisc\_type),              \textcolor{keywordtype}{intent(inout)} :: visc\textcolor{comment}{       !< vertical viscosities, bottom drag, and related}}
\DoxyCodeLine{1112   \textcolor{keywordtype}{type}(directories),                \textcolor{keywordtype}{intent(in)}    :: dirs\textcolor{comment}{       !< contains directory paths}}
\DoxyCodeLine{1113   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{target},                  \textcolor{keywordtype}{intent(inout)} :: ntrunc\textcolor{comment}{     !< A target for the variable that records}}
\DoxyCodeLine{1114 \textcolor{comment}{                                                                !! the number of times the velocity is}}
\DoxyCodeLine{1115 \textcolor{comment}{                                                                !! truncated (this should be 0).}}
\DoxyCodeLine{1116   \textcolor{keywordtype}{logical},                          \textcolor{keywordtype}{intent(out)}   :: calc\_dtbt\textcolor{comment}{  !< If true, recalculate the barotropic time step}}
\DoxyCodeLine{1117   \textcolor{keywordtype}{integer},                \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}   :: cont\_stencil\textcolor{comment}{ !< The stencil for thickness}}
\DoxyCodeLine{1118 \textcolor{comment}{                                                                !! from the continuity solver.}}
\DoxyCodeLine{1119 }
\DoxyCodeLine{1120   \textcolor{comment}{! local variables}}
\DoxyCodeLine{1121 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))} :: h\_tmp}
\DoxyCodeLine{1122   \textcolor{keywordtype}{character(len=40)} :: mdl = \textcolor{stringliteral}{"{}MOM\_dynamics\_split\_RK2"{}} \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{1123   \textcolor{comment}{! This include declares and sets the variable "{}version"{}.}}
\DoxyCodeLine{1124 \textcolor{preprocessor}{\# include "{}version\_variable.h"{}}}
\DoxyCodeLine{1125 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=48)} :: thickness\_units, flux\_units, eta\_rest\_name}
\DoxyCodeLine{1126 \textcolor{keywordtype}{  real} :: H\_rescale  \textcolor{comment}{! A rescaling factor for thicknesses from the representation in}}
\DoxyCodeLine{1127                      \textcolor{comment}{! a restart file to the internal representation in this run.}}
\DoxyCodeLine{1128 \textcolor{keywordtype}{  real} :: vel\_rescale  \textcolor{comment}{! A rescaling factor for velocities from the representation in}}
\DoxyCodeLine{1129                      \textcolor{comment}{! a restart file to the internal representation in this run.}}
\DoxyCodeLine{1130 \textcolor{keywordtype}{  real} :: uH\_rescale \textcolor{comment}{! A rescaling factor for thickness transports from the representation in}}
\DoxyCodeLine{1131                      \textcolor{comment}{! a restart file to the internal representation in this run.}}
\DoxyCodeLine{1132 \textcolor{keywordtype}{  real} :: accel\_rescale \textcolor{comment}{! A rescaling factor for accelerations from the representation in}}
\DoxyCodeLine{1133                      \textcolor{comment}{! a restart file to the internal representation in this run.}}
\DoxyCodeLine{1134 \textcolor{keywordtype}{  real} :: H\_convert}
\DoxyCodeLine{1135   \textcolor{keywordtype}{type}(group\_pass\_type) :: pass\_av\_h\_uvh}
\DoxyCodeLine{1136   \textcolor{keywordtype}{logical} :: use\_tides, debug\_truncations}
\DoxyCodeLine{1137 }
\DoxyCodeLine{1138   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz}
\DoxyCodeLine{1139   \textcolor{keywordtype}{integer} :: IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{1140   is   = g\%isc  ; ie   = g\%iec  ; js   = g\%jsc  ; je   = g\%jec ; nz = g\%ke}
\DoxyCodeLine{1141   isd  = g\%isd  ; ied  = g\%ied  ; jsd  = g\%jsd  ; jed  = g\%jed}
\DoxyCodeLine{1142   isdb = g\%IsdB ; iedb = g\%IedB ; jsdb = g\%JsdB ; jedb = g\%JedB}
\DoxyCodeLine{1143 }
\DoxyCodeLine{1144   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1145       \textcolor{stringliteral}{"{}initialize\_dyn\_split\_RK2 called with an unassociated control structure."{}})}
\DoxyCodeLine{1146   \textcolor{keywordflow}{if} (cs\%module\_is\_initialized) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1147     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"{}initialize\_dyn\_split\_RK2 called with a control "{}}// \&}
\DoxyCodeLine{1148                             \textcolor{stringliteral}{"{}structure that has already been initialized."{}})}
\DoxyCodeLine{1149     \textcolor{keywordflow}{return}}
\DoxyCodeLine{1150 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1151   cs\%module\_is\_initialized = .true.}
\DoxyCodeLine{1152 }
\DoxyCodeLine{1153   cs\%diag => diag}
\DoxyCodeLine{1154 }
\DoxyCodeLine{1155   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{"{}"{}})}
\DoxyCodeLine{1156   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}TIDES"{}}, use\_tides, \&}
\DoxyCodeLine{1157                  \textcolor{stringliteral}{"{}If true, apply tidal momentum forcing."{}}, default=.false.)}
\DoxyCodeLine{1158   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}BE"{}}, cs\%be, \&}
\DoxyCodeLine{1159                  \textcolor{stringliteral}{"{}If SPLIT is true, BE determines the relative weighting "{}}//\&}
\DoxyCodeLine{1160                  \textcolor{stringliteral}{"{}of a  2nd-\/order Runga-\/Kutta baroclinic time stepping "{}}//\&}
\DoxyCodeLine{1161                  \textcolor{stringliteral}{"{}scheme (0.5) and a backward Euler scheme (1) that is "{}}//\&}
\DoxyCodeLine{1162                  \textcolor{stringliteral}{"{}used for the Coriolis and inertial terms.  BE may be "{}}//\&}
\DoxyCodeLine{1163                  \textcolor{stringliteral}{"{}from 0.5 to 1, but instability may occur near 0.5. "{}}//\&}
\DoxyCodeLine{1164                  \textcolor{stringliteral}{"{}BE is also applicable if SPLIT is false and USE\_RK2 "{}}//\&}
\DoxyCodeLine{1165                  \textcolor{stringliteral}{"{}is true."{}}, units=\textcolor{stringliteral}{"{}nondim"{}}, default=0.6)}
\DoxyCodeLine{1166   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}BEGW"{}}, cs\%begw, \&}
\DoxyCodeLine{1167                  \textcolor{stringliteral}{"{}If SPLIT is true, BEGW is a number from 0 to 1 that "{}}//\&}
\DoxyCodeLine{1168                  \textcolor{stringliteral}{"{}controls the extent to which the treatment of gravity "{}}//\&}
\DoxyCodeLine{1169                  \textcolor{stringliteral}{"{}waves is forward-\/backward (0) or simulated backward "{}}//\&}
\DoxyCodeLine{1170                  \textcolor{stringliteral}{"{}Euler (1).  0 is almost always used. "{}}//\&}
\DoxyCodeLine{1171                  \textcolor{stringliteral}{"{}If SPLIT is false and USE\_RK2 is true, BEGW can be "{}}//\&}
\DoxyCodeLine{1172                  \textcolor{stringliteral}{"{}between 0 and 0.5 to damp gravity waves."{}}, \&}
\DoxyCodeLine{1173                  units=\textcolor{stringliteral}{"{}nondim"{}}, default=0.0)}
\DoxyCodeLine{1174 }
\DoxyCodeLine{1175   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}SPLIT\_BOTTOM\_STRESS"{}}, cs\%split\_bottom\_stress, \&}
\DoxyCodeLine{1176                  \textcolor{stringliteral}{"{}If true, provide the bottom stress calculated by the "{}}//\&}
\DoxyCodeLine{1177                  \textcolor{stringliteral}{"{}vertical viscosity to the barotropic solver."{}}, default=.false.)}
\DoxyCodeLine{1178   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}BT\_USE\_LAYER\_FLUXES"{}}, cs\%BT\_use\_layer\_fluxes, \&}
\DoxyCodeLine{1179                  \textcolor{stringliteral}{"{}If true, use the summed layered fluxes plus an "{}}//\&}
\DoxyCodeLine{1180                  \textcolor{stringliteral}{"{}adjustment due to the change in the barotropic velocity "{}}//\&}
\DoxyCodeLine{1181                  \textcolor{stringliteral}{"{}in the barotropic continuity equation."{}}, default=.true.)}
\DoxyCodeLine{1182   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}DEBUG"{}}, cs\%debug, \&}
\DoxyCodeLine{1183                  \textcolor{stringliteral}{"{}If true, write out verbose debugging data."{}}, \&}
\DoxyCodeLine{1184                  default=.false., debuggingparam=.true.)}
\DoxyCodeLine{1185   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}DEBUG\_OBC"{}}, cs\%debug\_OBC, default=.false.)}
\DoxyCodeLine{1186   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}DEBUG\_TRUNCATIONS"{}}, debug\_truncations, \&}
\DoxyCodeLine{1187                  default=.false.)}
\DoxyCodeLine{1188 }
\DoxyCodeLine{1189   \textcolor{keyword}{allocate}(cs\%taux\_bot(isdb:iedb,jsd:jed)) ; cs\%taux\_bot(:,:) = 0.0}
\DoxyCodeLine{1190   \textcolor{keyword}{allocate}(cs\%tauy\_bot(isd:ied,jsdb:jedb)) ; cs\%tauy\_bot(:,:) = 0.0}
\DoxyCodeLine{1191 }
\DoxyCodeLine{1192   alloc\_(cs\%uhbt(isdb:iedb,jsd:jed))          ; cs\%uhbt(:,:)         = 0.0}
\DoxyCodeLine{1193   alloc\_(cs\%vhbt(isd:ied,jsdb:jedb))          ; cs\%vhbt(:,:)         = 0.0}
\DoxyCodeLine{1194   alloc\_(cs\%visc\_rem\_u(isdb:iedb,jsd:jed,nz)) ; cs\%visc\_rem\_u(:,:,:) = 0.0}
\DoxyCodeLine{1195   alloc\_(cs\%visc\_rem\_v(isd:ied,jsdb:jedb,nz)) ; cs\%visc\_rem\_v(:,:,:) = 0.0}
\DoxyCodeLine{1196   alloc\_(cs\%eta\_PF(isd:ied,jsd:jed))          ; cs\%eta\_PF(:,:)       = 0.0}
\DoxyCodeLine{1197   alloc\_(cs\%pbce(isd:ied,jsd:jed,nz))         ; cs\%pbce(:,:,:)       = 0.0}
\DoxyCodeLine{1198 }
\DoxyCodeLine{1199   alloc\_(cs\%u\_accel\_bt(isdb:iedb,jsd:jed,nz)) ; cs\%u\_accel\_bt(:,:,:) = 0.0}
\DoxyCodeLine{1200   alloc\_(cs\%v\_accel\_bt(isd:ied,jsdb:jedb,nz)) ; cs\%v\_accel\_bt(:,:,:) = 0.0}
\DoxyCodeLine{1201 }
\DoxyCodeLine{1202   mis\%diffu      => cs\%diffu}
\DoxyCodeLine{1203   mis\%diffv      => cs\%diffv}
\DoxyCodeLine{1204   mis\%PFu        => cs\%PFu}
\DoxyCodeLine{1205   mis\%PFv        => cs\%PFv}
\DoxyCodeLine{1206   mis\%CAu        => cs\%CAu}
\DoxyCodeLine{1207   mis\%CAv        => cs\%CAv}
\DoxyCodeLine{1208   mis\%pbce       => cs\%pbce}
\DoxyCodeLine{1209   mis\%u\_accel\_bt => cs\%u\_accel\_bt}
\DoxyCodeLine{1210   mis\%v\_accel\_bt => cs\%v\_accel\_bt}
\DoxyCodeLine{1211   mis\%u\_av       => cs\%u\_av}
\DoxyCodeLine{1212   mis\%v\_av       => cs\%v\_av}
\DoxyCodeLine{1213 }
\DoxyCodeLine{1214   cs\%ADp           => accel\_diag}
\DoxyCodeLine{1215   cs\%CDp           => cont\_diag}
\DoxyCodeLine{1216   accel\_diag\%diffu => cs\%diffu}
\DoxyCodeLine{1217   accel\_diag\%diffv => cs\%diffv}
\DoxyCodeLine{1218   accel\_diag\%PFu   => cs\%PFu}
\DoxyCodeLine{1219   accel\_diag\%PFv   => cs\%PFv}
\DoxyCodeLine{1220   accel\_diag\%CAu   => cs\%CAu}
\DoxyCodeLine{1221   accel\_diag\%CAv   => cs\%CAv}
\DoxyCodeLine{1222 }
\DoxyCodeLine{1223 \textcolor{comment}{!  Accel\_diag\%pbce => CS\%pbce}}
\DoxyCodeLine{1224 \textcolor{comment}{!  Accel\_diag\%u\_accel\_bt => CS\%u\_accel\_bt ; Accel\_diag\%v\_accel\_bt => CS\%v\_accel\_bt}}
\DoxyCodeLine{1225 \textcolor{comment}{!  Accel\_diag\%u\_av => CS\%u\_av ; Accel\_diag\%v\_av => CS\%v\_av}}
\DoxyCodeLine{1226 }
\DoxyCodeLine{1227   id\_clock\_pass\_init = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean init message passing)'}, \&}
\DoxyCodeLine{1228                                      grain=clock\_routine)}
\DoxyCodeLine{1229 }
\DoxyCodeLine{1230   \textcolor{keyword}{call }continuity\_init(time, g, gv, us, param\_file, diag, cs\%continuity\_CSp)}
\DoxyCodeLine{1231   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cont\_stencil)) cont\_stencil = continuity\_stencil(cs\%continuity\_CSp)}
\DoxyCodeLine{1232   \textcolor{keyword}{call }coriolisadv\_init(time, g, gv, us, param\_file, diag, cs\%ADp, cs\%CoriolisAdv\_CSp)}
\DoxyCodeLine{1233   \textcolor{keywordflow}{if} (use\_tides) \textcolor{keyword}{call }tidal\_forcing\_init(time, g, param\_file, cs\%tides\_CSp)}
\DoxyCodeLine{1234   \textcolor{keyword}{call }pressureforce\_init(time, g, gv, us, param\_file, diag, cs\%PressureForce\_CSp, \&}
\DoxyCodeLine{1235                           cs\%tides\_CSp)}
\DoxyCodeLine{1236   \textcolor{keyword}{call }hor\_visc\_init(time, g, us, param\_file, diag, cs\%hor\_visc\_CSp, meke, adp=cs\%ADp)}
\DoxyCodeLine{1237   \textcolor{keyword}{call }vertvisc\_init(mis, time, g, gv, us, param\_file, diag, cs\%ADp, dirs, \&}
\DoxyCodeLine{1238                      ntrunc, cs\%vertvisc\_CSp)}
\DoxyCodeLine{1239   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(setvisc\_csp)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1240     \textcolor{stringliteral}{"{}initialize\_dyn\_split\_RK2 called with setVisc\_CSp unassociated."{}})}
\DoxyCodeLine{1241   cs\%set\_visc\_CSp => setvisc\_csp}
\DoxyCodeLine{1242   \textcolor{keyword}{call }updatecfltruncationvalue(time, cs\%vertvisc\_CSp, \&}
\DoxyCodeLine{1243                                 activate=is\_new\_run(restart\_cs) )}
\DoxyCodeLine{1244 }
\DoxyCodeLine{1245   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(ale\_csp)) cs\%ALE\_CSp => ale\_csp}
\DoxyCodeLine{1246   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(obc)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1247     cs\%OBC => obc}
\DoxyCodeLine{1248     \textcolor{keywordflow}{if} (obc\%ramp) \textcolor{keyword}{call }update\_obc\_ramp(time, cs\%OBC, \&}
\DoxyCodeLine{1249                                 activate=is\_new\_run(restart\_cs) )}
\DoxyCodeLine{1250 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1251   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(update\_obc\_csp)) cs\%update\_OBC\_CSp => update\_obc\_csp}
\DoxyCodeLine{1252 }
\DoxyCodeLine{1253   eta\_rest\_name = \textcolor{stringliteral}{"{}sfc"{}} ; \textcolor{keywordflow}{if} (.not.gv\%Boussinesq) eta\_rest\_name = \textcolor{stringliteral}{"{}p\_bot"{}}}
\DoxyCodeLine{1254   \textcolor{keywordflow}{if} (.not. query\_initialized(cs\%eta, trim(eta\_rest\_name), restart\_cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1255     \textcolor{comment}{! Estimate eta based on the layer thicknesses -\/ h.  With the Boussinesq}}
\DoxyCodeLine{1256     \textcolor{comment}{! approximation, eta is the free surface height anomaly, while without it}}
\DoxyCodeLine{1257     \textcolor{comment}{! eta is the mass of ocean per unit area.  eta always has the same}}
\DoxyCodeLine{1258     \textcolor{comment}{! dimensions as h, either m or kg m-\/3.}}
\DoxyCodeLine{1259     \textcolor{comment}{!   CS\%eta(:,:) = 0.0 already from initialization.}}
\DoxyCodeLine{1260     \textcolor{keywordflow}{if} (gv\%Boussinesq) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1261       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; cs\%eta(i,j) = -\/gv\%Z\_to\_H * g\%bathyT(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1262 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1263     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{1264        cs\%eta(i,j) = cs\%eta(i,j) + h(i,j,k)}
\DoxyCodeLine{1265 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1266   \textcolor{keywordflow}{elseif} ((gv\%m\_to\_H\_restart /= 0.0) .and. (gv\%m\_to\_H\_restart /= gv\%m\_to\_H)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1267     h\_rescale = gv\%m\_to\_H / gv\%m\_to\_H\_restart}
\DoxyCodeLine{1268     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; cs\%eta(i,j) = h\_rescale * cs\%eta(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1269 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1270   \textcolor{comment}{! Copy eta into an output array.}}
\DoxyCodeLine{1271   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; eta(i,j) = cs\%eta(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1272 }
\DoxyCodeLine{1273   \textcolor{keyword}{call }barotropic\_init(u, v, h, cs\%eta, time, g, gv, us, param\_file, diag, \&}
\DoxyCodeLine{1274                        cs\%barotropic\_CSp, restart\_cs, calc\_dtbt, cs\%BT\_cont, \&}
\DoxyCodeLine{1275                        cs\%tides\_CSp)}
\DoxyCodeLine{1276 }
\DoxyCodeLine{1277   \textcolor{keywordflow}{if} (.not. query\_initialized(cs\%diffu,\textcolor{stringliteral}{"{}diffu"{}},restart\_cs) .or. \&}
\DoxyCodeLine{1278       .not. query\_initialized(cs\%diffv,\textcolor{stringliteral}{"{}diffv"{}},restart\_cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1279     \textcolor{keyword}{call }horizontal\_viscosity(u, v, h, cs\%diffu, cs\%diffv, meke, varmix, \&}
\DoxyCodeLine{1280                               g, gv, us, cs\%hor\_visc\_CSp, \&}
\DoxyCodeLine{1281                               obc=cs\%OBC, bt=cs\%barotropic\_CSp, \&}
\DoxyCodeLine{1282                               td=thickness\_diffuse\_csp)}
\DoxyCodeLine{1283   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1284     \textcolor{keywordflow}{if} ( (us\%s\_to\_T\_restart * us\%m\_to\_L\_restart /= 0.0) .and. \&}
\DoxyCodeLine{1285          (us\%m\_to\_L * us\%s\_to\_T\_restart**2 /= us\%m\_to\_L\_restart * us\%s\_to\_T**2) ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1286       accel\_rescale = (us\%m\_to\_L * us\%s\_to\_T\_restart**2) / (us\%m\_to\_L\_restart * us\%s\_to\_T**2)}
\DoxyCodeLine{1287       \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=g\%IscB,g\%IecB}
\DoxyCodeLine{1288         cs\%diffu(i,j,k) = accel\_rescale * cs\%diffu(i,j,k)}
\DoxyCodeLine{1289 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1290       \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=g\%JscB,g\%JecB ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{1291         cs\%diffv(i,j,k) = accel\_rescale * cs\%diffv(i,j,k)}
\DoxyCodeLine{1292 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1293 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1294 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1295 }
\DoxyCodeLine{1296   \textcolor{keywordflow}{if} (.not. query\_initialized(cs\%u\_av,\textcolor{stringliteral}{"{}u2"{}}, restart\_cs) .or. \&}
\DoxyCodeLine{1297       .not. query\_initialized(cs\%u\_av,\textcolor{stringliteral}{"{}v2"{}}, restart\_cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1298     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isdb,iedb ; cs\%u\_av(i,j,k) = u(i,j,k) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1299     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsdb,jedb ; \textcolor{keywordflow}{do} i=isd,ied ; cs\%v\_av(i,j,k) = v(i,j,k) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1300   \textcolor{keywordflow}{elseif} ( (us\%s\_to\_T\_restart * us\%m\_to\_L\_restart /= 0.0) .and. \&}
\DoxyCodeLine{1301          ((us\%m\_to\_L * us\%s\_to\_T\_restart) /= (us\%m\_to\_L\_restart * us\%s\_to\_T)) ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1302     vel\_rescale = (us\%m\_to\_L * us\%s\_to\_T\_restart) /  (us\%m\_to\_L\_restart * us\%s\_to\_T)}
\DoxyCodeLine{1303     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isdb,iedb ; cs\%u\_av(i,j,k) = vel\_rescale * cs\%u\_av(i,j,k) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1304     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsdb,jedb ; \textcolor{keywordflow}{do} i=isd,ied ; cs\%v\_av(i,j,k) = vel\_rescale * cs\%v\_av(i,j,k) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1305 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1306 }
\DoxyCodeLine{1307   \textcolor{comment}{! This call is just here to initialize uh and vh.}}
\DoxyCodeLine{1308   \textcolor{keywordflow}{if} (.not. query\_initialized(uh,\textcolor{stringliteral}{"{}uh"{}},restart\_cs) .or. \&}
\DoxyCodeLine{1309       .not. query\_initialized(vh,\textcolor{stringliteral}{"{}vh"{}},restart\_cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1310     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isd,ied ; h\_tmp(i,j,k) = h(i,j,k) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1311     \textcolor{keyword}{call }continuity(u, v, h, h\_tmp, uh, vh, dt, g, gv, us, cs\%continuity\_CSp, obc=cs\%OBC)}
\DoxyCodeLine{1312     \textcolor{keyword}{call }pass\_var(h\_tmp, g\%Domain, clock=id\_clock\_pass\_init)}
\DoxyCodeLine{1313     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isd,ied}
\DoxyCodeLine{1314       cs\%h\_av(i,j,k) = 0.5*(h(i,j,k) + h\_tmp(i,j,k))}
\DoxyCodeLine{1315 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1316   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1317     \textcolor{keywordflow}{if} (.not. query\_initialized(cs\%h\_av,\textcolor{stringliteral}{"{}h2"{}},restart\_cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1318       cs\%h\_av(:,:,:) = h(:,:,:)}
\DoxyCodeLine{1319     \textcolor{keywordflow}{elseif} ((gv\%m\_to\_H\_restart /= 0.0) .and. (gv\%m\_to\_H\_restart /= gv\%m\_to\_H)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1320       h\_rescale = gv\%m\_to\_H / gv\%m\_to\_H\_restart}
\DoxyCodeLine{1321       \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; cs\%h\_av(i,j,k) = h\_rescale * cs\%h\_av(i,j,k) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1322 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1323     \textcolor{keywordflow}{if} ( (gv\%m\_to\_H\_restart * us\%s\_to\_T\_restart * us\%m\_to\_L\_restart /= 0.0) .and. \&}
\DoxyCodeLine{1324          ((gv\%m\_to\_H * us\%m\_to\_L**2 * us\%s\_to\_T\_restart) /= \&}
\DoxyCodeLine{1325           (gv\%m\_to\_H\_restart * us\%m\_to\_L\_restart**2 * us\%s\_to\_T)) ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1326       uh\_rescale = (gv\%m\_to\_H * us\%m\_to\_L**2 * us\%s\_to\_T\_restart) / \&}
\DoxyCodeLine{1327                    (gv\%m\_to\_H\_restart * us\%m\_to\_L\_restart**2 * us\%s\_to\_T)}
\DoxyCodeLine{1328       \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=g\%IscB,g\%IecB ; uh(i,j,k) = uh\_rescale * uh(i,j,k) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1329       \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=g\%JscB,g\%JecB ; \textcolor{keywordflow}{do} i=is,ie ; vh(i,j,k) = uh\_rescale * vh(i,j,k) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1330 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1331 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1332 }
\DoxyCodeLine{1333   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_pass\_init)}
\DoxyCodeLine{1334   \textcolor{keyword}{call }create\_group\_pass(pass\_av\_h\_uvh, cs\%u\_av, cs\%v\_av, g\%Domain, halo=2)}
\DoxyCodeLine{1335   \textcolor{keyword}{call }create\_group\_pass(pass\_av\_h\_uvh, cs\%h\_av, g\%Domain, halo=2)}
\DoxyCodeLine{1336   \textcolor{keyword}{call }create\_group\_pass(pass\_av\_h\_uvh, uh, vh, g\%Domain, halo=2)}
\DoxyCodeLine{1337   \textcolor{keyword}{call }do\_group\_pass(pass\_av\_h\_uvh, g\%Domain)}
\DoxyCodeLine{1338   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_pass\_init)}
\DoxyCodeLine{1339 }
\DoxyCodeLine{1340   flux\_units = get\_flux\_units(gv)}
\DoxyCodeLine{1341   h\_convert = gv\%H\_to\_m ; \textcolor{keywordflow}{if} (.not.gv\%Boussinesq) h\_convert = gv\%H\_to\_kg\_m2}
\DoxyCodeLine{1342   cs\%id\_uh = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'uh'}, diag\%axesCuL, time, \&}
\DoxyCodeLine{1343       \textcolor{stringliteral}{'Zonal Thickness Flux'}, flux\_units, y\_cell\_method=\textcolor{stringliteral}{'sum'}, v\_extensive=.true., \&}
\DoxyCodeLine{1344       conversion=h\_convert*us\%L\_to\_m**2*us\%s\_to\_T)}
\DoxyCodeLine{1345   cs\%id\_vh = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'vh'}, diag\%axesCvL, time, \&}
\DoxyCodeLine{1346       \textcolor{stringliteral}{'Meridional Thickness Flux'}, flux\_units, x\_cell\_method=\textcolor{stringliteral}{'sum'}, v\_extensive=.true., \&}
\DoxyCodeLine{1347       conversion=h\_convert*us\%L\_to\_m**2*us\%s\_to\_T)}
\DoxyCodeLine{1348 }
\DoxyCodeLine{1349   cs\%id\_CAu = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'CAu'}, diag\%axesCuL, time, \&}
\DoxyCodeLine{1350       \textcolor{stringliteral}{'Zonal Coriolis and Advective Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1351   cs\%id\_CAv = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'CAv'}, diag\%axesCvL, time, \&}
\DoxyCodeLine{1352       \textcolor{stringliteral}{'Meridional Coriolis and Advective Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1353   cs\%id\_PFu = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'PFu'}, diag\%axesCuL, time, \&}
\DoxyCodeLine{1354       \textcolor{stringliteral}{'Zonal Pressure Force Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1355   cs\%id\_PFv = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'PFv'}, diag\%axesCvL, time, \&}
\DoxyCodeLine{1356       \textcolor{stringliteral}{'Meridional Pressure Force Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1357 }
\DoxyCodeLine{1358   \textcolor{comment}{!CS\%id\_hf\_PFu = register\_diag\_field('ocean\_model', 'hf\_PFu', diag\%axesCuL, Time, \&}}
\DoxyCodeLine{1359   \textcolor{comment}{!    'Fractional Thickness-\/weighted Zonal Pressure Force Acceleration', 'm s-\/2', \&}}
\DoxyCodeLine{1360   \textcolor{comment}{!    v\_extensive=.true., conversion=US\%L\_T2\_to\_m\_s2)}}
\DoxyCodeLine{1361   \textcolor{comment}{!if(CS\%id\_hf\_PFu > 0) call safe\_alloc\_ptr(CS\%ADp\%diag\_hfrac\_u,IsdB,IedB,jsd,jed,nz)}}
\DoxyCodeLine{1362 }
\DoxyCodeLine{1363   \textcolor{comment}{!CS\%id\_hf\_PFv = register\_diag\_field('ocean\_model', 'hf\_PFv', diag\%axesCvL, Time, \&}}
\DoxyCodeLine{1364   \textcolor{comment}{!    'Fractional Thickness-\/weighted Meridional Pressure Force Acceleration', 'm s-\/2', \&}}
\DoxyCodeLine{1365   \textcolor{comment}{!    v\_extensive=.true., conversion=US\%L\_T2\_to\_m\_s2)}}
\DoxyCodeLine{1366   \textcolor{comment}{!if(CS\%id\_hf\_PFv > 0) call safe\_alloc\_ptr(CS\%ADp\%diag\_hfrac\_v,isd,ied,Jsd,JedB,nz)}}
\DoxyCodeLine{1367 }
\DoxyCodeLine{1368   \textcolor{comment}{!CS\%id\_hf\_CAu = register\_diag\_field('ocean\_model', 'hf\_CAu', diag\%axesCuL, Time, \&}}
\DoxyCodeLine{1369   \textcolor{comment}{!    'Fractional Thickness-\/weighted Zonal Coriolis and Advective Acceleration', 'm s-\/2', \&}}
\DoxyCodeLine{1370   \textcolor{comment}{!    v\_extensive=.true., conversion=US\%L\_T2\_to\_m\_s2)}}
\DoxyCodeLine{1371   \textcolor{comment}{!if(CS\%id\_hf\_CAu > 0) call safe\_alloc\_ptr(CS\%ADp\%diag\_hfrac\_u,IsdB,IedB,jsd,jed,nz)}}
\DoxyCodeLine{1372 }
\DoxyCodeLine{1373   \textcolor{comment}{!CS\%id\_hf\_CAv = register\_diag\_field('ocean\_model', 'hf\_CAv', diag\%axesCvL, Time, \&}}
\DoxyCodeLine{1374   \textcolor{comment}{!    'Fractional Thickness-\/weighted Meridional Coriolis and Advective Acceleration', 'm s-\/2', \&}}
\DoxyCodeLine{1375   \textcolor{comment}{!    v\_extensive=.true., conversion=US\%L\_T2\_to\_m\_s2)}}
\DoxyCodeLine{1376   \textcolor{comment}{!if(CS\%id\_hf\_CAv > 0) call safe\_alloc\_ptr(CS\%ADp\%diag\_hfrac\_v,isd,ied,Jsd,JedB,nz)}}
\DoxyCodeLine{1377 }
\DoxyCodeLine{1378   cs\%id\_hf\_PFu\_2d = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'hf\_PFu\_2d'}, diag\%axesCu1, time, \&}
\DoxyCodeLine{1379       \textcolor{stringliteral}{'Depth-\/sum Fractional Thickness-\/weighted Zonal Pressure Force Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, \&}
\DoxyCodeLine{1380       conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1381   \textcolor{keywordflow}{if}(cs\%id\_hf\_PFu\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(cs\%ADp\%diag\_hfrac\_u,isdb,iedb,jsd,jed,nz)}
\DoxyCodeLine{1382 }
\DoxyCodeLine{1383   cs\%id\_hf\_PFv\_2d = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'hf\_PFv\_2d'}, diag\%axesCv1, time, \&}
\DoxyCodeLine{1384       \textcolor{stringliteral}{'Depth-\/sum Fractional Thickness-\/weighted Meridional Pressure Force Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, \&}
\DoxyCodeLine{1385       conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1386   \textcolor{keywordflow}{if}(cs\%id\_hf\_PFv\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(cs\%ADp\%diag\_hfrac\_v,isd,ied,jsd,jedb,nz)}
\DoxyCodeLine{1387 }
\DoxyCodeLine{1388   cs\%id\_hf\_CAu\_2d = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'hf\_CAu\_2d'}, diag\%axesCu1, time, \&}
\DoxyCodeLine{1389       \textcolor{stringliteral}{'Depth-\/sum Fractional Thickness-\/weighted Zonal Coriolis and Advective Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, \&}
\DoxyCodeLine{1390       conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1391   \textcolor{keywordflow}{if}(cs\%id\_hf\_CAu\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(cs\%ADp\%diag\_hfrac\_u,isdb,iedb,jsd,jed,nz)}
\DoxyCodeLine{1392 }
\DoxyCodeLine{1393   cs\%id\_hf\_CAv\_2d = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'hf\_CAv\_2d'}, diag\%axesCv1, time, \&}
\DoxyCodeLine{1394       \textcolor{stringliteral}{'Depth-\/sum Fractional Thickness-\/weighted Meridional Coriolis and Advective Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, \&}
\DoxyCodeLine{1395       conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1396   \textcolor{keywordflow}{if}(cs\%id\_hf\_CAv\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(cs\%ADp\%diag\_hfrac\_v,isd,ied,jsd,jedb,nz)}
\DoxyCodeLine{1397 }
\DoxyCodeLine{1398   cs\%id\_uav = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'uav'}, diag\%axesCuL, time, \&}
\DoxyCodeLine{1399       \textcolor{stringliteral}{'Barotropic-\/step Averaged Zonal Velocity'}, \textcolor{stringliteral}{'m s-\/1'}, conversion=us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{1400   cs\%id\_vav = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'vav'}, diag\%axesCvL, time, \&}
\DoxyCodeLine{1401       \textcolor{stringliteral}{'Barotropic-\/step Averaged Meridional Velocity'}, \textcolor{stringliteral}{'m s-\/1'}, conversion=us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{1402 }
\DoxyCodeLine{1403   cs\%id\_u\_BT\_accel = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'u\_BT\_accel'}, diag\%axesCuL, time, \&}
\DoxyCodeLine{1404     \textcolor{stringliteral}{'Barotropic Anomaly Zonal Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1405   cs\%id\_v\_BT\_accel = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'v\_BT\_accel'}, diag\%axesCvL, time, \&}
\DoxyCodeLine{1406     \textcolor{stringliteral}{'Barotropic Anomaly Meridional Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1407 }
\DoxyCodeLine{1408   \textcolor{comment}{!CS\%id\_hf\_u\_BT\_accel = register\_diag\_field('ocean\_model', 'hf\_u\_BT\_accel', diag\%axesCuL, Time, \&}}
\DoxyCodeLine{1409   \textcolor{comment}{!    'Fractional Thickness-\/weighted Barotropic Anomaly Zonal Acceleration', 'm s-\/2', \&}}
\DoxyCodeLine{1410   \textcolor{comment}{!    v\_extensive=.true., conversion=US\%L\_T2\_to\_m\_s2)}}
\DoxyCodeLine{1411   \textcolor{comment}{!if(CS\%id\_hf\_u\_BT\_accel > 0) call safe\_alloc\_ptr(CS\%ADp\%diag\_hfrac\_u,IsdB,IedB,jsd,jed,nz)}}
\DoxyCodeLine{1412 }
\DoxyCodeLine{1413   \textcolor{comment}{!CS\%id\_hf\_v\_BT\_accel = register\_diag\_field('ocean\_model', 'hf\_v\_BT\_accel', diag\%axesCvL, Time, \&}}
\DoxyCodeLine{1414   \textcolor{comment}{!    'Fractional Thickness-\/weighted Barotropic Anomaly Meridional Acceleration', 'm s-\/2', \&}}
\DoxyCodeLine{1415   \textcolor{comment}{!    v\_extensive=.true., conversion=US\%L\_T2\_to\_m\_s2)}}
\DoxyCodeLine{1416   \textcolor{comment}{!if(CS\%id\_hf\_v\_BT\_accel > 0) call safe\_alloc\_ptr(CS\%ADp\%diag\_hfrac\_v,isd,ied,Jsd,JedB,nz)}}
\DoxyCodeLine{1417 }
\DoxyCodeLine{1418   cs\%id\_hf\_u\_BT\_accel\_2d = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'hf\_u\_BT\_accel\_2d'}, diag\%axesCu1, time, \&}
\DoxyCodeLine{1419       \textcolor{stringliteral}{'Depth-\/sum Fractional Thickness-\/weighted Barotropic Anomaly Zonal Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, \&}
\DoxyCodeLine{1420       conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1421   \textcolor{keywordflow}{if}(cs\%id\_hf\_u\_BT\_accel\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(cs\%ADp\%diag\_hfrac\_u,isdb,iedb,jsd,jed,nz)}
\DoxyCodeLine{1422 }
\DoxyCodeLine{1423   cs\%id\_hf\_v\_BT\_accel\_2d = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'hf\_v\_BT\_accel\_2d'}, diag\%axesCv1, time, \&}
\DoxyCodeLine{1424       \textcolor{stringliteral}{'Depth-\/sum Fractional Thickness-\/weighted Barotropic Anomaly Meridional Acceleration'}, \textcolor{stringliteral}{'m s-\/2'}, \&}
\DoxyCodeLine{1425       conversion=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{1426   \textcolor{keywordflow}{if}(cs\%id\_hf\_v\_BT\_accel\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(cs\%ADp\%diag\_hfrac\_v,isd,ied,jsd,jedb,nz)}
\DoxyCodeLine{1427 }
\DoxyCodeLine{1428   id\_clock\_cor        = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean Coriolis \& mom advection)'}, grain=clock\_module)}
\DoxyCodeLine{1429   id\_clock\_continuity = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean continuity equation)'},      grain=clock\_module)}
\DoxyCodeLine{1430   id\_clock\_pres       = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean pressure force)'},           grain=clock\_module)}
\DoxyCodeLine{1431   id\_clock\_vertvisc   = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean vertical viscosity)'},       grain=clock\_module)}
\DoxyCodeLine{1432   id\_clock\_horvisc    = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean horizontal viscosity)'},     grain=clock\_module)}
\DoxyCodeLine{1433   id\_clock\_mom\_update = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean momentum increments)'},      grain=clock\_module)}
\DoxyCodeLine{1434   id\_clock\_pass       = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean message passing)'},          grain=clock\_module)}
\DoxyCodeLine{1435   id\_clock\_btcalc     = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean barotropic mode calc)'},     grain=clock\_module)}
\DoxyCodeLine{1436   id\_clock\_btstep     = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean barotropic mode stepping)'}, grain=clock\_module)}
\DoxyCodeLine{1437   id\_clock\_btforce    = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean barotropic forcing calc)'},  grain=clock\_module)}
\DoxyCodeLine{1438 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__dynamics__split__rk2_a9f889b82fd5ed29a854da99d3c929366}\label{namespacemom__dynamics__split__rk2_a9f889b82fd5ed29a854da99d3c929366}} 
\index{mom\_dynamics\_split\_rk2@{mom\_dynamics\_split\_rk2}!register\_restarts\_dyn\_split\_rk2@{register\_restarts\_dyn\_split\_rk2}}
\index{register\_restarts\_dyn\_split\_rk2@{register\_restarts\_dyn\_split\_rk2}!mom\_dynamics\_split\_rk2@{mom\_dynamics\_split\_rk2}}
\doxysubsubsection{\texorpdfstring{register\_restarts\_dyn\_split\_rk2()}{register\_restarts\_dyn\_split\_rk2()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+dynamics\+\_\+split\+\_\+rk2\+::register\+\_\+restarts\+\_\+dyn\+\_\+split\+\_\+rk2 (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__hor__index_1_1hor__index__type}{hor\+\_\+index\+\_\+type}}), intent(in)}]{HI,  }\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV,  }\item[{type(\mbox{\hyperlink{structmom__file__parser_1_1param__file__type}{param\+\_\+file\+\_\+type}}), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__dynamics__split__rk2_1_1mom__dyn__split__rk2__cs}{mom\+\_\+dyn\+\_\+split\+\_\+rk2\+\_\+cs}}), pointer}]{CS,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{restart\+\_\+\+CS,  }\item[{real, dimension(szib\+\_\+(hi),szj\+\_\+(hi),szk\+\_\+(gv)), intent(inout), target}]{uh,  }\item[{real, dimension(szi\+\_\+(hi),szjb\+\_\+(hi),szk\+\_\+(gv)), intent(inout), target}]{vh }\end{DoxyParamCaption})}



This subroutine sets up 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} & Horizontal index structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & parameter file \\
\hline
 & {\em cs} & module control structure \\
\hline
 & {\em restart\+\_\+cs} & restart control structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em uh} & zonal volume/mass transport \mbox{[}H L2 T-\/1 $\sim$$>$ m3 s-\/1 or kg s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em vh} & merid volume/mass transport \mbox{[}H L2 T-\/1 $\sim$$>$ m3 s-\/1 or kg s-\/1\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 1000 of file M\+O\+M\+\_\+dynamics\+\_\+split\+\_\+\+R\+K2.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1001   \textcolor{keywordtype}{type}(hor\_index\_type),          \textcolor{keywordtype}{intent(in)}    :: HI\textcolor{comment}{         !< Horizontal index structure}}
\DoxyCodeLine{1002   \textcolor{keywordtype}{type}(verticalGrid\_type),       \textcolor{keywordtype}{intent(in)}    :: GV\textcolor{comment}{         !< ocean vertical grid structure}}
\DoxyCodeLine{1003   \textcolor{keywordtype}{type}(param\_file\_type),         \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< parameter file}}
\DoxyCodeLine{1004   \textcolor{keywordtype}{type}(MOM\_dyn\_split\_RK2\_CS),    \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{         !< module control structure}}
\DoxyCodeLine{1005   \textcolor{keywordtype}{type}(MOM\_restart\_CS),          \textcolor{keywordtype}{pointer}       :: restart\_CS\textcolor{comment}{ !< restart control structure}}
\DoxyCodeLine{1006 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(HI),SZJ\_(HI),SZK\_(GV))}, \&}
\DoxyCodeLine{1007                          \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: uh\textcolor{comment}{ !< zonal volume/mass transport [H L2 T-\/1 \string~> m3 s-\/1 or kg s-\/1]}}
\DoxyCodeLine{1008 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(HI),SZJB\_(HI),SZK\_(GV))}, \&}
\DoxyCodeLine{1009                          \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: vh\textcolor{comment}{ !< merid volume/mass transport [H L2 T-\/1 \string~> m3 s-\/1 or kg s-\/1]}}
\DoxyCodeLine{1010 }
\DoxyCodeLine{1011   \textcolor{keywordtype}{type}(vardesc)      :: vd(2)}
\DoxyCodeLine{1012   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"{}MOM\_dynamics\_split\_RK2"{}} \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{1013   \textcolor{keywordtype}{character(len=48)}  :: thickness\_units, flux\_units}
\DoxyCodeLine{1014 }
\DoxyCodeLine{1015   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, nz, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{1016 }
\DoxyCodeLine{1017   isd  = hi\%isd  ; ied  = hi\%ied  ; jsd  = hi\%jsd  ; jed  = hi\%jed ; nz = gv\%ke}
\DoxyCodeLine{1018   isdb = hi\%IsdB ; iedb = hi\%IedB ; jsdb = hi\%JsdB ; jedb = hi\%JedB}
\DoxyCodeLine{1019 }
\DoxyCodeLine{1020   \textcolor{comment}{! This is where a control structure specific to this module would be allocated.}}
\DoxyCodeLine{1021   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1022     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"{}register\_restarts\_dyn\_split\_RK2 called with an associated "{}}// \&}
\DoxyCodeLine{1023                              \textcolor{stringliteral}{"{}control structure."{}})}
\DoxyCodeLine{1024     \textcolor{keywordflow}{return}}
\DoxyCodeLine{1025 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1026   \textcolor{keyword}{allocate}(cs)}
\DoxyCodeLine{1027 }
\DoxyCodeLine{1028   alloc\_(cs\%diffu(isdb:iedb,jsd:jed,nz)) ; cs\%diffu(:,:,:) = 0.0}
\DoxyCodeLine{1029   alloc\_(cs\%diffv(isd:ied,jsdb:jedb,nz)) ; cs\%diffv(:,:,:) = 0.0}
\DoxyCodeLine{1030   alloc\_(cs\%CAu(isdb:iedb,jsd:jed,nz))   ; cs\%CAu(:,:,:)   = 0.0}
\DoxyCodeLine{1031   alloc\_(cs\%CAv(isd:ied,jsdb:jedb,nz))   ; cs\%CAv(:,:,:)   = 0.0}
\DoxyCodeLine{1032   alloc\_(cs\%PFu(isdb:iedb,jsd:jed,nz))   ; cs\%PFu(:,:,:)   = 0.0}
\DoxyCodeLine{1033   alloc\_(cs\%PFv(isd:ied,jsdb:jedb,nz))   ; cs\%PFv(:,:,:)   = 0.0}
\DoxyCodeLine{1034 }
\DoxyCodeLine{1035   alloc\_(cs\%eta(isd:ied,jsd:jed))       ; cs\%eta(:,:)    = 0.0}
\DoxyCodeLine{1036   alloc\_(cs\%u\_av(isdb:iedb,jsd:jed,nz)) ; cs\%u\_av(:,:,:) = 0.0}
\DoxyCodeLine{1037   alloc\_(cs\%v\_av(isd:ied,jsdb:jedb,nz)) ; cs\%v\_av(:,:,:) = 0.0}
\DoxyCodeLine{1038   alloc\_(cs\%h\_av(isd:ied,jsd:jed,nz))   ; cs\%h\_av(:,:,:) = gv\%Angstrom\_H}
\DoxyCodeLine{1039 }
\DoxyCodeLine{1040   thickness\_units = get\_thickness\_units(gv)}
\DoxyCodeLine{1041   flux\_units = get\_flux\_units(gv)}
\DoxyCodeLine{1042 }
\DoxyCodeLine{1043   \textcolor{keywordflow}{if} (gv\%Boussinesq) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1044     vd(1) = var\_desc(\textcolor{stringliteral}{"{}sfc"{}},thickness\_units,\textcolor{stringliteral}{"{}Free surface Height"{}},\textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1045   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1046     vd(1) = var\_desc(\textcolor{stringliteral}{"{}p\_bot"{}},thickness\_units,\textcolor{stringliteral}{"{}Bottom Pressure"{}},\textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1047 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1048   \textcolor{keyword}{call }register\_restart\_field(cs\%eta, vd(1), .false., restart\_cs)}
\DoxyCodeLine{1049 }
\DoxyCodeLine{1050   vd(1) = var\_desc(\textcolor{stringliteral}{"{}u2"{}},\textcolor{stringliteral}{"{}m s-\/1"{}},\textcolor{stringliteral}{"{}Auxiliary Zonal velocity"{}},\textcolor{stringliteral}{'u'},\textcolor{stringliteral}{'L'})}
\DoxyCodeLine{1051   vd(2) = var\_desc(\textcolor{stringliteral}{"{}v2"{}},\textcolor{stringliteral}{"{}m s-\/1"{}},\textcolor{stringliteral}{"{}Auxiliary Meridional velocity"{}},\textcolor{stringliteral}{'v'},\textcolor{stringliteral}{'L'})}
\DoxyCodeLine{1052   \textcolor{keyword}{call }register\_restart\_pair(cs\%u\_av, cs\%v\_av, vd(1), vd(2), .false., restart\_cs)}
\DoxyCodeLine{1053 }
\DoxyCodeLine{1054   vd(1) = var\_desc(\textcolor{stringliteral}{"{}h2"{}},thickness\_units,\textcolor{stringliteral}{"{}Auxiliary Layer Thickness"{}},\textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'L'})}
\DoxyCodeLine{1055   \textcolor{keyword}{call }register\_restart\_field(cs\%h\_av, vd(1), .false., restart\_cs)}
\DoxyCodeLine{1056 }
\DoxyCodeLine{1057   vd(1) = var\_desc(\textcolor{stringliteral}{"{}uh"{}},flux\_units,\textcolor{stringliteral}{"{}Zonal thickness flux"{}},\textcolor{stringliteral}{'u'},\textcolor{stringliteral}{'L'})}
\DoxyCodeLine{1058   vd(2) = var\_desc(\textcolor{stringliteral}{"{}vh"{}},flux\_units,\textcolor{stringliteral}{"{}Meridional thickness flux"{}},\textcolor{stringliteral}{'v'},\textcolor{stringliteral}{'L'})}
\DoxyCodeLine{1059   \textcolor{keyword}{call }register\_restart\_pair(uh, vh, vd(1), vd(2), .false., restart\_cs)}
\DoxyCodeLine{1060 }
\DoxyCodeLine{1061   vd(1) = var\_desc(\textcolor{stringliteral}{"{}diffu"{}},\textcolor{stringliteral}{"{}m s-\/2"{}},\textcolor{stringliteral}{"{}Zonal horizontal viscous acceleration"{}},\textcolor{stringliteral}{'u'},\textcolor{stringliteral}{'L'})}
\DoxyCodeLine{1062   vd(2) = var\_desc(\textcolor{stringliteral}{"{}diffv"{}},\textcolor{stringliteral}{"{}m s-\/2"{}},\textcolor{stringliteral}{"{}Meridional horizontal viscous acceleration"{}},\textcolor{stringliteral}{'v'},\textcolor{stringliteral}{'L'})}
\DoxyCodeLine{1063   \textcolor{keyword}{call }register\_restart\_pair(cs\%diffu, cs\%diffv, vd(1), vd(2), .false., restart\_cs)}
\DoxyCodeLine{1064 }
\DoxyCodeLine{1065   \textcolor{keyword}{call }register\_barotropic\_restarts(hi, gv, param\_file, cs\%barotropic\_CSp, \&}
\DoxyCodeLine{1066                                     restart\_cs)}
\DoxyCodeLine{1067 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__dynamics__split__rk2_a976e700971f232fc11bc69b31d611c32}\label{namespacemom__dynamics__split__rk2_a976e700971f232fc11bc69b31d611c32}} 
\index{mom\_dynamics\_split\_rk2@{mom\_dynamics\_split\_rk2}!step\_mom\_dyn\_split\_rk2@{step\_mom\_dyn\_split\_rk2}}
\index{step\_mom\_dyn\_split\_rk2@{step\_mom\_dyn\_split\_rk2}!mom\_dynamics\_split\_rk2@{mom\_dynamics\_split\_rk2}}
\doxysubsubsection{\texorpdfstring{step\_mom\_dyn\_split\_rk2()}{step\_mom\_dyn\_split\_rk2()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+dynamics\+\_\+split\+\_\+rk2\+::step\+\_\+mom\+\_\+dyn\+\_\+split\+\_\+rk2 (\begin{DoxyParamCaption}\item[{real, dimension(szib\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout), target}]{u,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(inout), target}]{v,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{h,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1thermo__var__ptrs}{thermo\+\_\+var\+\_\+ptrs}}), intent(in)}]{tv,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1vertvisc__type}{vertvisc\+\_\+type}}), intent(inout)}]{visc,  }\item[{type(time\+\_\+type), intent(in)}]{Time\+\_\+local,  }\item[{real, intent(in)}]{dt,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{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), target}]{uh,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(inout), target}]{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(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(inout)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV,  }\item[{type(\mbox{\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\+\_\+scale\+\_\+type}}), intent(in)}]{US,  }\item[{type(\mbox{\hyperlink{structmom__dynamics__split__rk2_1_1mom__dyn__split__rk2__cs}{mom\+\_\+dyn\+\_\+split\+\_\+rk2\+\_\+cs}}), pointer}]{CS,  }\item[{logical, intent(in)}]{calc\+\_\+dtbt,  }\item[{type(\mbox{\hyperlink{structmom__lateral__mixing__coeffs_1_1varmix__cs}{varmix\+\_\+cs}}), pointer}]{Var\+Mix,  }\item[{type(\mbox{\hyperlink{structmom__meke__types_1_1meke__type}{meke\+\_\+type}}), pointer}]{M\+E\+KE,  }\item[{type(\mbox{\hyperlink{structmom__thickness__diffuse_1_1thickness__diffuse__cs}{thickness\+\_\+diffuse\+\_\+cs}}), pointer}]{thickness\+\_\+diffuse\+\_\+\+C\+Sp,  }\item[{type(\mbox{\hyperlink{structmom__wave__interface_1_1wave__parameters__cs}{wave\+\_\+parameters\+\_\+cs}}), optional, pointer}]{Waves }\end{DoxyParamCaption})}



R\+K2 splitting for time stepping M\+OM adiabatic dynamics. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & ocean grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in,out}}  & {\em u} & zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em v} & merid velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em h} & layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em tv} & thermodynamic type \\
\hline
\mbox{\texttt{ in,out}}  & {\em visc} & vertical visc, bottom drag, and related \\
\hline
\mbox{\texttt{ in}}  & {\em time\+\_\+local} & model time at end of time step \\
\hline
\mbox{\texttt{ in}}  & {\em dt} & 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} & surf pressure at the start of this dynamic time step \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
 & {\em p\+\_\+surf\+\_\+end} & surf pressure at the end of this dynamic time step \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em uh} & zonal volume/mass transport \\
\hline
\mbox{\texttt{ in,out}}  & {\em vh} & merid volume/mass transport \\
\hline
\mbox{\texttt{ in,out}}  & {\em uhtr} & accumulatated zonal volume/mass transport \\
\hline
\mbox{\texttt{ in,out}}  & {\em vhtr} & accumulatated merid volume/mass transport \\
\hline
\mbox{\texttt{ out}}  & {\em eta\+\_\+av} & free surface height or column mass time averaged over time step \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
 & {\em cs} & module control structure \\
\hline
\mbox{\texttt{ in}}  & {\em calc\+\_\+dtbt} & if true, recalculate barotropic time step \\
\hline
 & {\em varmix} & specify the spatially varying viscosities \\
\hline
 & {\em meke} & related to mesoscale eddy kinetic energy param \\
\hline
 & {\em thickness\+\_\+diffuse\+\_\+csp} & Pointer to a structure containing interface height diffusivities \\
\hline
 & {\em waves} & A pointer to a structure containing fields related to the surface wave conditions \\
\hline
\end{DoxyParams}


Definition at line 242 of file M\+O\+M\+\_\+dynamics\+\_\+split\+\_\+\+R\+K2.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{245   \textcolor{keywordtype}{type}(ocean\_grid\_type),             \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{            !< ocean grid structure}}
\DoxyCodeLine{246   \textcolor{keywordtype}{type}(verticalGrid\_type),           \textcolor{keywordtype}{intent(in)}    :: GV\textcolor{comment}{           !< ocean vertical grid structure}}
\DoxyCodeLine{247   \textcolor{keywordtype}{type}(unit\_scale\_type),             \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{           !< A dimensional unit scaling type}}
\DoxyCodeLine{248 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{249                              \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: u\textcolor{comment}{            !< zonal velocity [L T-\/1 \string~> m s-\/1]}}
\DoxyCodeLine{250 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{251                              \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: v\textcolor{comment}{            !< merid velocity [L T-\/1 \string~> m s-\/1]}}
\DoxyCodeLine{252 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{253                                      \textcolor{keywordtype}{intent(inout)} :: h\textcolor{comment}{            !< layer thickness [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{254   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),             \textcolor{keywordtype}{intent(in)}    :: tv\textcolor{comment}{           !< thermodynamic type}}
\DoxyCodeLine{255   \textcolor{keywordtype}{type}(vertvisc\_type),               \textcolor{keywordtype}{intent(inout)} :: visc\textcolor{comment}{         !< vertical visc, bottom drag, and related}}
\DoxyCodeLine{256   \textcolor{keywordtype}{type}(time\_type),                   \textcolor{keywordtype}{intent(in)}    :: Time\_local\textcolor{comment}{   !< model time at end of time step}}
\DoxyCodeLine{257 \textcolor{keywordtype}{  real},                              \textcolor{keywordtype}{intent(in)}    :: dt\textcolor{comment}{           !< time step [T \string~> s]}}
\DoxyCodeLine{258   \textcolor{keywordtype}{type}(mech\_forcing),                \textcolor{keywordtype}{intent(in)}    :: forces\textcolor{comment}{       !< A structure with the driving mechanical forces}}
\DoxyCodeLine{259 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)},              \textcolor{keywordtype}{pointer}       :: p\_surf\_begin\textcolor{comment}{ !< surf pressure at the start of this dynamic}}
\DoxyCodeLine{260 \textcolor{comment}{                                                                   !! time step [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{261 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)},              \textcolor{keywordtype}{pointer}       :: p\_surf\_end\textcolor{comment}{   !< surf pressure at the end of this dynamic}}
\DoxyCodeLine{262 \textcolor{comment}{                                                                   !! time step [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{263 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{264                              \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: uh\textcolor{comment}{           !< zonal volume/mass transport}}
\DoxyCodeLine{265 \textcolor{comment}{                                                                   !! [H L2 T-\/1 \string~> m3 s-\/1 or kg s-\/1]}}
\DoxyCodeLine{266 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{267                              \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: vh\textcolor{comment}{           !< merid volume/mass transport}}
\DoxyCodeLine{268 \textcolor{comment}{                                                                   !! [H L2 T-\/1 \string~> m3 s-\/1 or kg s-\/1]}}
\DoxyCodeLine{269 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{270                                      \textcolor{keywordtype}{intent(inout)} :: uhtr\textcolor{comment}{         !< accumulatated zonal volume/mass transport}}
\DoxyCodeLine{271 \textcolor{comment}{                                                                   !! since last tracer advection [H L2 \string~> m3 or kg]}}
\DoxyCodeLine{272 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{273                                      \textcolor{keywordtype}{intent(inout)} :: vhtr\textcolor{comment}{         !< accumulatated merid volume/mass transport}}
\DoxyCodeLine{274 \textcolor{comment}{                                                                   !! since last tracer advection [H L2 \string~> m3 or kg]}}
\DoxyCodeLine{275 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))},  \textcolor{keywordtype}{intent(out)}   :: eta\_av\textcolor{comment}{       !< free surface height or column mass time}}
\DoxyCodeLine{276 \textcolor{comment}{                                                                   !! averaged over time step [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{277   \textcolor{keywordtype}{type}(MOM\_dyn\_split\_RK2\_CS),        \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{           !< module control structure}}
\DoxyCodeLine{278   \textcolor{keywordtype}{logical},                           \textcolor{keywordtype}{intent(in)}    :: calc\_dtbt\textcolor{comment}{    !< if true, recalculate barotropic time step}}
\DoxyCodeLine{279   \textcolor{keywordtype}{type}(VarMix\_CS),                   \textcolor{keywordtype}{pointer}       :: VarMix\textcolor{comment}{       !< specify the spatially varying viscosities}}
\DoxyCodeLine{280   \textcolor{keywordtype}{type}(MEKE\_type),                   \textcolor{keywordtype}{pointer}       :: MEKE\textcolor{comment}{         !< related to mesoscale eddy kinetic energy param}}
\DoxyCodeLine{281   \textcolor{keywordtype}{type}(thickness\_diffuse\_CS),        \textcolor{keywordtype}{pointer}       :: thickness\_diffuse\_CSp\textcolor{comment}{ !< Pointer to a structure containing}}
\DoxyCodeLine{282 \textcolor{comment}{                                                                   !! interface height diffusivities}}
\DoxyCodeLine{283   \textcolor{keywordtype}{type}(wave\_parameters\_CS), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}      :: Waves\textcolor{comment}{        !< A pointer to a structure containing}}
\DoxyCodeLine{284 \textcolor{comment}{                                                                   !! fields related to the surface wave conditions}}
\DoxyCodeLine{285 }
\DoxyCodeLine{286   \textcolor{comment}{! local variables}}
\DoxyCodeLine{287 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))} :: up   \textcolor{comment}{! Predicted zonal velocity [L T-\/1 \string~> m s-\/1].}}
\DoxyCodeLine{288 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))} :: vp   \textcolor{comment}{! Predicted meridional velocity [L T-\/1 \string~> m s-\/1].}}
\DoxyCodeLine{289 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}  :: hp   \textcolor{comment}{! Predicted thickness [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{290 }
\DoxyCodeLine{291 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))} :: u\_bc\_accel}
\DoxyCodeLine{292 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))} :: v\_bc\_accel}
\DoxyCodeLine{293     \textcolor{comment}{! u\_bc\_accel and v\_bc\_accel are the summed baroclinic accelerations of each}}
\DoxyCodeLine{294     \textcolor{comment}{! layer calculated by the non-\/barotropic part of the model [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{295 }
\DoxyCodeLine{296 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{target} :: uh\_in}
\DoxyCodeLine{297 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \textcolor{keywordtype}{target} :: vh\_in}
\DoxyCodeLine{298     \textcolor{comment}{! uh\_in and vh\_in are the zonal or meridional mass transports that would be}}
\DoxyCodeLine{299     \textcolor{comment}{! obtained using the initial velocities [H L2 T-\/1 \string~> m3 s-\/1 or kg s-\/1].}}
\DoxyCodeLine{300 }
\DoxyCodeLine{301 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G))} :: uhbt\_out}
\DoxyCodeLine{302 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G))} :: vhbt\_out}
\DoxyCodeLine{303     \textcolor{comment}{! uhbt\_out and vhbt\_out are the vertically summed transports from the}}
\DoxyCodeLine{304     \textcolor{comment}{! barotropic solver based on its final velocities [H m2 s-\/1 \string~> m3 s-\/1 or kg s-\/1].}}
\DoxyCodeLine{305 }
\DoxyCodeLine{306 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))} :: eta\_pred}
\DoxyCodeLine{307     \textcolor{comment}{! eta\_pred is the predictor value of the free surface height or column mass,}}
\DoxyCodeLine{308     \textcolor{comment}{! [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{309 }
\DoxyCodeLine{310 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))} :: u\_old\_rad\_OBC}
\DoxyCodeLine{311 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))} :: v\_old\_rad\_OBC}
\DoxyCodeLine{312     \textcolor{comment}{! u\_old\_rad\_OBC and v\_old\_rad\_OBC are the starting velocities, which are}}
\DoxyCodeLine{313     \textcolor{comment}{! saved for use in the Flather open boundary condition code [L T-\/1 \string~> m s-\/1].}}
\DoxyCodeLine{314 }
\DoxyCodeLine{315 \textcolor{keywordtype}{  real} :: pres\_to\_eta \textcolor{comment}{! A factor that converts pressures to the units of eta}}
\DoxyCodeLine{316                       \textcolor{comment}{! [H T2 R-\/1 L-\/2 \string~> m Pa-\/1 or kg m-\/2 Pa-\/1]}}
\DoxyCodeLine{317 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{dimension(:,:)} :: \&}
\DoxyCodeLine{318     p\_surf => null(), eta\_pf\_start => null(), \&}
\DoxyCodeLine{319     taux\_bot => null(), tauy\_bot => null(), \&}
\DoxyCodeLine{320     eta => null()}
\DoxyCodeLine{321 }
\DoxyCodeLine{322 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{dimension(:,:,:)} :: \&}
\DoxyCodeLine{323     uh\_ptr => null(), u\_ptr => null(),  vh\_ptr => null(), v\_ptr => null(), \&}
\DoxyCodeLine{324     u\_av, \& \textcolor{comment}{! The zonal velocity time-\/averaged over a time step [L T-\/1 \string~> m s-\/1].}}
\DoxyCodeLine{325     v\_av, \& \textcolor{comment}{! The meridional velocity time-\/averaged over a time step [L T-\/1 \string~> m s-\/1].}}
\DoxyCodeLine{326     h\_av    \textcolor{comment}{! The layer thickness time-\/averaged over a time step [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{327 }
\DoxyCodeLine{328   \textcolor{comment}{! real, allocatable, dimension(:,:,:) :: \&}}
\DoxyCodeLine{329     \textcolor{comment}{! hf\_PFu, hf\_PFv, \& ! Pressure force accel. x fract. thickness [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{330     \textcolor{comment}{! hf\_CAu, hf\_CAv, \& ! Coriolis force accel. x fract. thickness [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{331     \textcolor{comment}{! hf\_u\_BT\_accel, hf\_v\_BT\_accel ! barotropic correction accel. x fract. thickness [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{332     \textcolor{comment}{! 3D diagnostics hf\_PFu etc. are commented because there is no clarity on proper remapping grid option.}}
\DoxyCodeLine{333     \textcolor{comment}{! The code is retained for degugging purposes in the future.}}
\DoxyCodeLine{334 }
\DoxyCodeLine{335 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{dimension(:,:)} :: \&}
\DoxyCodeLine{336     hf\_PFu\_2d, hf\_PFv\_2d, \& \textcolor{comment}{! Depth integeral of hf\_PFu, hf\_PFv [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{337     hf\_CAu\_2d, hf\_CAv\_2d, \& \textcolor{comment}{! Depth integeral of hf\_CAu, hf\_CAv [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{338     hf\_u\_BT\_accel\_2d, hf\_v\_BT\_accel\_2d \textcolor{comment}{! Depth integeral of hf\_u\_BT\_accel, hf\_v\_BT\_accel}}
\DoxyCodeLine{339 }
\DoxyCodeLine{340 \textcolor{keywordtype}{  real} :: dt\_pred   \textcolor{comment}{! The time step for the predictor part of the baroclinic time stepping [T \string~> s].}}
\DoxyCodeLine{341 }
\DoxyCodeLine{342   \textcolor{keywordtype}{logical} :: dyn\_p\_surf}
\DoxyCodeLine{343   \textcolor{keywordtype}{logical} :: BT\_cont\_BT\_thick \textcolor{comment}{! If true, use the BT\_cont\_type to estimate the}}
\DoxyCodeLine{344                               \textcolor{comment}{! relative weightings of the layers in calculating}}
\DoxyCodeLine{345                               \textcolor{comment}{! the barotropic accelerations.}}
\DoxyCodeLine{346   \textcolor{comment}{!-\/-\/-\/For group halo pass}}
\DoxyCodeLine{347   \textcolor{keywordtype}{logical} :: showCallTree, sym}
\DoxyCodeLine{348 }
\DoxyCodeLine{349   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, Isq, Ieq, Jsq, Jeq, nz}
\DoxyCodeLine{350   \textcolor{keywordtype}{integer} :: cont\_stencil}
\DoxyCodeLine{351   is  = g\%isc  ; ie  = g\%iec  ; js  = g\%jsc  ; je  = g\%jec ; nz = g\%ke}
\DoxyCodeLine{352   isq = g\%IscB ; ieq = g\%IecB ; jsq = g\%JscB ; jeq = g\%JecB}
\DoxyCodeLine{353   u\_av => cs\%u\_av ; v\_av => cs\%v\_av ; h\_av => cs\%h\_av ; eta => cs\%eta}
\DoxyCodeLine{354 }
\DoxyCodeLine{355   sym=.false.;\textcolor{keywordflow}{if} (g\%Domain\%symmetric) sym=.true.  \textcolor{comment}{! switch to include symmetric domain in checksums}}
\DoxyCodeLine{356 }
\DoxyCodeLine{357   showcalltree = calltree\_showquery()}
\DoxyCodeLine{358   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_enter(\textcolor{stringliteral}{"{}step\_MOM\_dyn\_split\_RK2(), MOM\_dynamics\_split\_RK2.F90"{}})}
\DoxyCodeLine{359 }
\DoxyCodeLine{360   \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{361   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{362     \textcolor{keywordflow}{do} j=g\%jsd,g\%jed   ; \textcolor{keywordflow}{do} i=g\%isdB,g\%iedB ;  up(i,j,k) = 0.0 ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{363     \textcolor{keywordflow}{do} j=g\%jsdB,g\%jedB ; \textcolor{keywordflow}{do} i=g\%isd,g\%ied   ;  vp(i,j,k) = 0.0 ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{364     \textcolor{keywordflow}{do} j=g\%jsd,g\%jed   ; \textcolor{keywordflow}{do} i=g\%isd,g\%ied   ;  hp(i,j,k) = h(i,j,k) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{365 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{366 }
\DoxyCodeLine{367   \textcolor{comment}{! Update CFL truncation value as function of time}}
\DoxyCodeLine{368   \textcolor{keyword}{call }updatecfltruncationvalue(time\_local, cs\%vertvisc\_CSp)}
\DoxyCodeLine{369 }
\DoxyCodeLine{370   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{371     \textcolor{keyword}{call }mom\_state\_chksum(\textcolor{stringliteral}{"{}Start predictor "{}}, u, v, h, uh, vh, g, gv, us, symmetric=sym)}
\DoxyCodeLine{372     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}Start predictor u "{}}, u, v, g)}
\DoxyCodeLine{373     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}Start predictor uh "{}}, uh, vh, g)}
\DoxyCodeLine{374 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{375 }
\DoxyCodeLine{376   dyn\_p\_surf = \textcolor{keyword}{associated}(p\_surf\_begin) .and. \textcolor{keyword}{associated}(p\_surf\_end)}
\DoxyCodeLine{377   \textcolor{keywordflow}{if} (dyn\_p\_surf) \textcolor{keywordflow}{then}}
\DoxyCodeLine{378     p\_surf => p\_surf\_end}
\DoxyCodeLine{379     \textcolor{keyword}{call }safe\_alloc\_ptr(eta\_pf\_start,g\%isd,g\%ied,g\%jsd,g\%jed)}
\DoxyCodeLine{380     eta\_pf\_start(:,:) = 0.0}
\DoxyCodeLine{381   \textcolor{keywordflow}{else}}
\DoxyCodeLine{382     p\_surf => forces\%p\_surf}
\DoxyCodeLine{383 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{384 }
\DoxyCodeLine{385   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{386     \textcolor{keywordflow}{if} (cs\%debug\_OBC) \textcolor{keyword}{call }open\_boundary\_test\_extern\_h(g, gv, cs\%OBC, h)}
\DoxyCodeLine{387 }
\DoxyCodeLine{388     \textcolor{comment}{! Update OBC ramp value as function of time}}
\DoxyCodeLine{389     \textcolor{keyword}{call }update\_obc\_ramp(time\_local, cs\%OBC)}
\DoxyCodeLine{390 }
\DoxyCodeLine{391     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=g\%jsd,g\%jed ; \textcolor{keywordflow}{do} i=g\%IsdB,g\%IedB}
\DoxyCodeLine{392       u\_old\_rad\_obc(i,j,k) = u\_av(i,j,k)}
\DoxyCodeLine{393 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{394     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=g\%JsdB,g\%JedB ; \textcolor{keywordflow}{do} i=g\%isd,g\%ied}
\DoxyCodeLine{395       v\_old\_rad\_obc(i,j,k) = v\_av(i,j,k)}
\DoxyCodeLine{396 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{397 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{398 }
\DoxyCodeLine{399   bt\_cont\_bt\_thick = .false.}
\DoxyCodeLine{400   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%BT\_cont)) bt\_cont\_bt\_thick = \&}
\DoxyCodeLine{401     (\textcolor{keyword}{allocated}(cs\%BT\_cont\%h\_u) .and. \textcolor{keyword}{allocated}(cs\%BT\_cont\%h\_v))}
\DoxyCodeLine{402 }
\DoxyCodeLine{403   \textcolor{keywordflow}{if} (cs\%split\_bottom\_stress) \textcolor{keywordflow}{then}}
\DoxyCodeLine{404     taux\_bot => cs\%taux\_bot ; tauy\_bot => cs\%tauy\_bot}
\DoxyCodeLine{405 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{406 }
\DoxyCodeLine{407   \textcolor{comment}{!-\/-\/-\/ begin set up for group halo pass}}
\DoxyCodeLine{408 }
\DoxyCodeLine{409   cont\_stencil = continuity\_stencil(cs\%continuity\_CSp)}
\DoxyCodeLine{410   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_pass)}
\DoxyCodeLine{411   \textcolor{keyword}{call }create\_group\_pass(cs\%pass\_eta, eta, g\%Domain, halo=1)}
\DoxyCodeLine{412   \textcolor{keyword}{call }create\_group\_pass(cs\%pass\_visc\_rem, cs\%visc\_rem\_u, cs\%visc\_rem\_v, g\%Domain, \&}
\DoxyCodeLine{413                          to\_all+scalar\_pair, cgrid\_ne, halo=max(1,cont\_stencil))}
\DoxyCodeLine{414   \textcolor{keyword}{call }create\_group\_pass(cs\%pass\_uvp, up, vp, g\%Domain, halo=max(1,cont\_stencil))}
\DoxyCodeLine{415   \textcolor{keyword}{call }create\_group\_pass(cs\%pass\_hp\_uv, hp, g\%Domain, halo=2)}
\DoxyCodeLine{416   \textcolor{keyword}{call }create\_group\_pass(cs\%pass\_hp\_uv, u\_av, v\_av, g\%Domain, halo=2)}
\DoxyCodeLine{417   \textcolor{keyword}{call }create\_group\_pass(cs\%pass\_hp\_uv, uh(:,:,:), vh(:,:,:), g\%Domain, halo=2)}
\DoxyCodeLine{418 }
\DoxyCodeLine{419   \textcolor{keyword}{call }create\_group\_pass(cs\%pass\_uv, u, v, g\%Domain, halo=max(2,cont\_stencil))}
\DoxyCodeLine{420   \textcolor{keyword}{call }create\_group\_pass(cs\%pass\_h, h, g\%Domain, halo=max(2,cont\_stencil))}
\DoxyCodeLine{421   \textcolor{keyword}{call }create\_group\_pass(cs\%pass\_av\_uvh, u\_av, v\_av, g\%Domain, halo=2)}
\DoxyCodeLine{422   \textcolor{keyword}{call }create\_group\_pass(cs\%pass\_av\_uvh, uh(:,:,:), vh(:,:,:), g\%Domain, halo=2)}
\DoxyCodeLine{423   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_pass)}
\DoxyCodeLine{424   \textcolor{comment}{!-\/-\/-\/ end set up for group halo pass}}
\DoxyCodeLine{425 }
\DoxyCodeLine{426 }
\DoxyCodeLine{427 \textcolor{comment}{! PFu = d/dx M(h,T,S)}}
\DoxyCodeLine{428 \textcolor{comment}{! pbce = dM/deta}}
\DoxyCodeLine{429   \textcolor{keywordflow}{if} (cs\%begw == 0.0) \textcolor{keyword}{call }enable\_averages(dt, time\_local, cs\%diag)}
\DoxyCodeLine{430   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_pres)}
\DoxyCodeLine{431   \textcolor{keyword}{call }pressureforce(h, tv, cs\%PFu, cs\%PFv, g, gv, us, cs\%PressureForce\_CSp, \&}
\DoxyCodeLine{432                      cs\%ALE\_CSp, p\_surf, cs\%pbce, cs\%eta\_PF)}
\DoxyCodeLine{433   \textcolor{keywordflow}{if} (dyn\_p\_surf) \textcolor{keywordflow}{then}}
\DoxyCodeLine{434     pres\_to\_eta = 1.0 / (gv\%g\_Earth * gv\%H\_to\_RZ)}
\DoxyCodeLine{435     \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{436     \textcolor{keywordflow}{do} j=jsq,jeq+1 ; \textcolor{keywordflow}{do} i=isq,ieq+1}
\DoxyCodeLine{437       eta\_pf\_start(i,j) = cs\%eta\_PF(i,j) -\/ pres\_to\_eta * (p\_surf\_begin(i,j) -\/ p\_surf\_end(i,j))}
\DoxyCodeLine{438 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{439 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{440   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_pres)}
\DoxyCodeLine{441   \textcolor{keyword}{call }disable\_averaging(cs\%diag)}
\DoxyCodeLine{442   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with PressureForce (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{443 }
\DoxyCodeLine{444   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) then; \textcolor{keywordflow}{if} (cs\%OBC\%update\_OBC) \textcolor{keywordflow}{then}}
\DoxyCodeLine{445     \textcolor{keyword}{call }update\_obc\_data(cs\%OBC, g, gv, us, tv, h, cs\%update\_OBC\_CSp, time\_local)}
\DoxyCodeLine{446   endif;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{447   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC) .and. cs\%debug\_OBC) \&}
\DoxyCodeLine{448     \textcolor{keyword}{call }open\_boundary\_zero\_normal\_flow(cs\%OBC, g, cs\%PFu, cs\%PFv)}
\DoxyCodeLine{449 }
\DoxyCodeLine{450   \textcolor{keywordflow}{if} (g\%nonblocking\_updates) \&}
\DoxyCodeLine{451     \textcolor{keyword}{call }start\_group\_pass(cs\%pass\_eta, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{452 }
\DoxyCodeLine{453 \textcolor{comment}{! CAu = -\/(f+zeta\_av)/h\_av vh + d/dx KE\_av}}
\DoxyCodeLine{454   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_cor)}
\DoxyCodeLine{455   \textcolor{keyword}{call }coradcalc(u\_av, v\_av, h\_av, uh, vh, cs\%CAu, cs\%CAv, cs\%OBC, cs\%ADp, \&}
\DoxyCodeLine{456                  g, gv, us, cs\%CoriolisAdv\_CSp)}
\DoxyCodeLine{457   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_cor)}
\DoxyCodeLine{458   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with CorAdCalc (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{459 }
\DoxyCodeLine{460 \textcolor{comment}{! u\_bc\_accel = CAu + PFu + diffu(u[n-\/1])}}
\DoxyCodeLine{461   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_btforce)}
\DoxyCodeLine{462   \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{463   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{464     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{465       u\_bc\_accel(i,j,k) = (cs\%CAu(i,j,k) + cs\%PFu(i,j,k)) + cs\%diffu(i,j,k)}
\DoxyCodeLine{466 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{467     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{468       v\_bc\_accel(i,j,k) = (cs\%CAv(i,j,k) + cs\%PFv(i,j,k)) + cs\%diffv(i,j,k)}
\DoxyCodeLine{469 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{470 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{471   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{472     \textcolor{keyword}{call }open\_boundary\_zero\_normal\_flow(cs\%OBC, g, u\_bc\_accel, v\_bc\_accel)}
\DoxyCodeLine{473 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{474   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_btforce)}
\DoxyCodeLine{475 }
\DoxyCodeLine{476   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{477     \textcolor{keyword}{call }mom\_accel\_chksum(\textcolor{stringliteral}{"{}pre-\/btstep accel"{}}, cs\%CAu, cs\%CAv, cs\%PFu, cs\%PFv, \&}
\DoxyCodeLine{478                           cs\%diffu, cs\%diffv, g, gv, us, cs\%pbce, u\_bc\_accel, v\_bc\_accel, \&}
\DoxyCodeLine{479                           symmetric=sym)}
\DoxyCodeLine{480     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}pre-\/btstep CS\%Ca "{}}, cs\%Cau, cs\%Cav, g)}
\DoxyCodeLine{481     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}pre-\/btstep CS\%PF "{}}, cs\%PFu, cs\%PFv, g)}
\DoxyCodeLine{482     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}pre-\/btstep CS\%diff "{}}, cs\%diffu, cs\%diffv, g)}
\DoxyCodeLine{483     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}pre-\/btstep u\_bc\_accel "{}}, u\_bc\_accel, v\_bc\_accel, g)}
\DoxyCodeLine{484 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{485 }
\DoxyCodeLine{486   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_vertvisc)}
\DoxyCodeLine{487   \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{488   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{489     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{490       up(i,j,k) = g\%mask2dCu(i,j) * (u(i,j,k) + dt * u\_bc\_accel(i,j,k))}
\DoxyCodeLine{491 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{492     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{493       vp(i,j,k) = g\%mask2dCv(i,j) * (v(i,j,k) + dt * v\_bc\_accel(i,j,k))}
\DoxyCodeLine{494 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{495 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{496 }
\DoxyCodeLine{497   \textcolor{keyword}{call }enable\_averages(dt, time\_local, cs\%diag)}
\DoxyCodeLine{498   \textcolor{keyword}{call }set\_viscous\_ml(u, v, h, tv, forces, visc, dt, g, gv, us, \&}
\DoxyCodeLine{499                       cs\%set\_visc\_CSp)}
\DoxyCodeLine{500   \textcolor{keyword}{call }disable\_averaging(cs\%diag)}
\DoxyCodeLine{501 }
\DoxyCodeLine{502   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{503     \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"{}before vertvisc: up"{}}, up, vp, g\%HI, haloshift=0, symmetric=sym, scale=us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{504 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{505   \textcolor{keyword}{call }vertvisc\_coef(up, vp, h, forces, visc, dt, g, gv, us, cs\%vertvisc\_CSp, cs\%OBC)}
\DoxyCodeLine{506   \textcolor{keyword}{call }vertvisc\_remnant(visc, cs\%visc\_rem\_u, cs\%visc\_rem\_v, dt, g, gv, us, cs\%vertvisc\_CSp)}
\DoxyCodeLine{507   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_vertvisc)}
\DoxyCodeLine{508   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with vertvisc\_coef (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{509 }
\DoxyCodeLine{510 }
\DoxyCodeLine{511   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_pass)}
\DoxyCodeLine{512   \textcolor{keywordflow}{if} (g\%nonblocking\_updates) \textcolor{keywordflow}{then}}
\DoxyCodeLine{513     \textcolor{keyword}{call }complete\_group\_pass(cs\%pass\_eta, g\%Domain)}
\DoxyCodeLine{514     \textcolor{keyword}{call }start\_group\_pass(cs\%pass\_visc\_rem, g\%Domain)}
\DoxyCodeLine{515   \textcolor{keywordflow}{else}}
\DoxyCodeLine{516     \textcolor{keyword}{call }do\_group\_pass(cs\%pass\_eta, g\%Domain)}
\DoxyCodeLine{517     \textcolor{keyword}{call }do\_group\_pass(cs\%pass\_visc\_rem, g\%Domain)}
\DoxyCodeLine{518 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{519   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_pass)}
\DoxyCodeLine{520 }
\DoxyCodeLine{521   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_btcalc)}
\DoxyCodeLine{522   \textcolor{comment}{! Calculate the relative layer weights for determining barotropic quantities.}}
\DoxyCodeLine{523   \textcolor{keywordflow}{if} (.not.bt\_cont\_bt\_thick) \&}
\DoxyCodeLine{524     \textcolor{keyword}{call }btcalc(h, g, gv, cs\%barotropic\_CSp, obc=cs\%OBC)}
\DoxyCodeLine{525   \textcolor{keyword}{call }bt\_mass\_source(h, eta, .true., g, gv, cs\%barotropic\_CSp)}
\DoxyCodeLine{526   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_btcalc)}
\DoxyCodeLine{527 }
\DoxyCodeLine{528   \textcolor{keywordflow}{if} (g\%nonblocking\_updates) \&}
\DoxyCodeLine{529     \textcolor{keyword}{call }complete\_group\_pass(cs\%pass\_visc\_rem, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{530 }
\DoxyCodeLine{531 \textcolor{comment}{! u\_accel\_bt = layer accelerations due to barotropic solver}}
\DoxyCodeLine{532   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%BT\_cont) .or. cs\%BT\_use\_layer\_fluxes) \textcolor{keywordflow}{then}}
\DoxyCodeLine{533     \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_continuity)}
\DoxyCodeLine{534     \textcolor{keyword}{call }continuity(u, v, h, hp, uh\_in, vh\_in, dt, g, gv, us, cs\%continuity\_CSp, \&}
\DoxyCodeLine{535                     obc=cs\%OBC, visc\_rem\_u=cs\%visc\_rem\_u, visc\_rem\_v=cs\%visc\_rem\_v, bt\_cont=cs\%BT\_cont)}
\DoxyCodeLine{536     \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_continuity)}
\DoxyCodeLine{537     \textcolor{keywordflow}{if} (bt\_cont\_bt\_thick) \textcolor{keywordflow}{then}}
\DoxyCodeLine{538       \textcolor{keyword}{call }btcalc(h, g, gv, cs\%barotropic\_CSp, cs\%BT\_cont\%h\_u, cs\%BT\_cont\%h\_v, \&}
\DoxyCodeLine{539                   obc=cs\%OBC)}
\DoxyCodeLine{540 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{541     \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with continuity[BT\_cont] (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{542 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{543 }
\DoxyCodeLine{544   \textcolor{keywordflow}{if} (cs\%BT\_use\_layer\_fluxes) \textcolor{keywordflow}{then}}
\DoxyCodeLine{545     uh\_ptr => uh\_in ; vh\_ptr => vh\_in; u\_ptr => u ; v\_ptr => v}
\DoxyCodeLine{546 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{547 }
\DoxyCodeLine{548   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_btstep)}
\DoxyCodeLine{549   \textcolor{keywordflow}{if} (calc\_dtbt) \textcolor{keyword}{call }set\_dtbt(g, gv, us, cs\%barotropic\_CSp, eta, cs\%pbce)}
\DoxyCodeLine{550   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_enter(\textcolor{stringliteral}{"{}btstep(), MOM\_barotropic.F90"{}})}
\DoxyCodeLine{551   \textcolor{comment}{! This is the predictor step call to btstep.}}
\DoxyCodeLine{552   \textcolor{keyword}{call }btstep(u, v, eta, dt, u\_bc\_accel, v\_bc\_accel, forces, cs\%pbce, cs\%eta\_PF, \&}
\DoxyCodeLine{553               u\_av, v\_av, cs\%u\_accel\_bt, cs\%v\_accel\_bt, eta\_pred, cs\%uhbt, cs\%vhbt, \&}
\DoxyCodeLine{554               g, gv, us, cs\%barotropic\_CSp, cs\%visc\_rem\_u, cs\%visc\_rem\_v, adp=cs\%ADp, \&}
\DoxyCodeLine{555               obc=cs\%OBC, bt\_cont=cs\%BT\_cont, eta\_pf\_start=eta\_pf\_start, \&}
\DoxyCodeLine{556               taux\_bot=taux\_bot, tauy\_bot=tauy\_bot, \&}
\DoxyCodeLine{557               uh0=uh\_ptr, vh0=vh\_ptr, u\_uh0=u\_ptr, v\_vh0=v\_ptr)}
\DoxyCodeLine{558   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_leave(\textcolor{stringliteral}{"{}btstep()"{}})}
\DoxyCodeLine{559   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_btstep)}
\DoxyCodeLine{560 }
\DoxyCodeLine{561 \textcolor{comment}{! up = u + dt\_pred*( u\_bc\_accel + u\_accel\_bt )}}
\DoxyCodeLine{562   dt\_pred = dt * cs\%be}
\DoxyCodeLine{563   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_mom\_update)}
\DoxyCodeLine{564 }
\DoxyCodeLine{565   \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{566   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{567     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{568       vp(i,j,k) = g\%mask2dCv(i,j) * (v(i,j,k) + dt\_pred * \&}
\DoxyCodeLine{569                       (v\_bc\_accel(i,j,k) + cs\%v\_accel\_bt(i,j,k)))}
\DoxyCodeLine{570 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{571     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{572       up(i,j,k) = g\%mask2dCu(i,j) * (u(i,j,k) + dt\_pred * \&}
\DoxyCodeLine{573                       (u\_bc\_accel(i,j,k) + cs\%u\_accel\_bt(i,j,k)))}
\DoxyCodeLine{574 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{575 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{576   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_mom\_update)}
\DoxyCodeLine{577 }
\DoxyCodeLine{578   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{579     \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"{}Predictor 1 [uv]"{}}, up, vp, g\%HI, haloshift=0, symmetric=sym, scale=us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{580     \textcolor{keyword}{call }hchksum(h, \textcolor{stringliteral}{"{}Predictor 1 h"{}}, g\%HI, haloshift=1, scale=gv\%H\_to\_m)}
\DoxyCodeLine{581     \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"{}Predictor 1 [uv]h"{}}, uh, vh, g\%HI,haloshift=2, \&}
\DoxyCodeLine{582                   symmetric=sym, scale=gv\%H\_to\_m*us\%L\_to\_m**2*us\%s\_to\_T)}
\DoxyCodeLine{583 \textcolor{comment}{!   call MOM\_state\_chksum("{}Predictor 1"{}, up, vp, h, uh, vh, G, GV, US, haloshift=1)}}
\DoxyCodeLine{584     \textcolor{keyword}{call }mom\_accel\_chksum(\textcolor{stringliteral}{"{}Predictor accel"{}}, cs\%CAu, cs\%CAv, cs\%PFu, cs\%PFv, \&}
\DoxyCodeLine{585              cs\%diffu, cs\%diffv, g, gv, us, cs\%pbce, cs\%u\_accel\_bt, cs\%v\_accel\_bt, symmetric=sym)}
\DoxyCodeLine{586     \textcolor{keyword}{call }mom\_state\_chksum(\textcolor{stringliteral}{"{}Predictor 1 init"{}}, u, v, h, uh, vh, g, gv, us, haloshift=2, \&}
\DoxyCodeLine{587                           symmetric=sym)}
\DoxyCodeLine{588     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}Predictor 1 up"{}}, up, vp, g)}
\DoxyCodeLine{589     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}Predictor 1 uh"{}}, uh, vh, g)}
\DoxyCodeLine{590 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{591 }
\DoxyCodeLine{592 \textcolor{comment}{! up <-\/ up + dt\_pred d/dz visc d/dz up}}
\DoxyCodeLine{593 \textcolor{comment}{! u\_av  <-\/ u\_av  + dt\_pred d/dz visc d/dz u\_av}}
\DoxyCodeLine{594   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_vertvisc)}
\DoxyCodeLine{595   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{596     \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"{}0 before vertvisc: [uv]p"{}}, up, vp, g\%HI,haloshift=0, symmetric=sym, scale=us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{597 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{598   \textcolor{keyword}{call }vertvisc\_coef(up, vp, h, forces, visc, dt\_pred, g, gv, us, cs\%vertvisc\_CSp, \&}
\DoxyCodeLine{599                      cs\%OBC)}
\DoxyCodeLine{600   \textcolor{keyword}{call }vertvisc(up, vp, h, forces, visc, dt\_pred, cs\%OBC, cs\%ADp, cs\%CDp, g, \&}
\DoxyCodeLine{601                 gv, us, cs\%vertvisc\_CSp, cs\%taux\_bot, cs\%tauy\_bot, waves=waves)}
\DoxyCodeLine{602   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with vertvisc (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{603   \textcolor{keywordflow}{if} (g\%nonblocking\_updates) \textcolor{keywordflow}{then}}
\DoxyCodeLine{604     \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_vertvisc)}
\DoxyCodeLine{605     \textcolor{keyword}{call }start\_group\_pass(cs\%pass\_uvp, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{606     \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_vertvisc)}
\DoxyCodeLine{607 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{608   \textcolor{keyword}{call }vertvisc\_remnant(visc, cs\%visc\_rem\_u, cs\%visc\_rem\_v, dt\_pred, g, gv, us, cs\%vertvisc\_CSp)}
\DoxyCodeLine{609   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_vertvisc)}
\DoxyCodeLine{610 }
\DoxyCodeLine{611   \textcolor{keyword}{call }do\_group\_pass(cs\%pass\_visc\_rem, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{612   \textcolor{keywordflow}{if} (g\%nonblocking\_updates) \textcolor{keywordflow}{then}}
\DoxyCodeLine{613     \textcolor{keyword}{call }complete\_group\_pass(cs\%pass\_uvp, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{614   \textcolor{keywordflow}{else}}
\DoxyCodeLine{615     \textcolor{keyword}{call }do\_group\_pass(cs\%pass\_uvp, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{616 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{617 }
\DoxyCodeLine{618   \textcolor{comment}{! uh = u\_av * h}}
\DoxyCodeLine{619   \textcolor{comment}{! hp = h + dt * div . uh}}
\DoxyCodeLine{620   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_continuity)}
\DoxyCodeLine{621   \textcolor{keyword}{call }continuity(up, vp, h, hp, uh, vh, dt, g, gv, us, cs\%continuity\_CSp, \&}
\DoxyCodeLine{622                   cs\%uhbt, cs\%vhbt, cs\%OBC, cs\%visc\_rem\_u, cs\%visc\_rem\_v, \&}
\DoxyCodeLine{623                   u\_av, v\_av, bt\_cont=cs\%BT\_cont)}
\DoxyCodeLine{624   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_continuity)}
\DoxyCodeLine{625   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with continuity (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{626 }
\DoxyCodeLine{627   \textcolor{keyword}{call }do\_group\_pass(cs\%pass\_hp\_uv, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{628 }
\DoxyCodeLine{629   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{630 }
\DoxyCodeLine{631     \textcolor{keywordflow}{if} (cs\%debug) \&}
\DoxyCodeLine{632       \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"{}Pre OBC avg [uv]"{}}, u\_av, v\_av, g\%HI, haloshift=1, symmetric=sym, scale=us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{633 }
\DoxyCodeLine{634     \textcolor{keyword}{call }radiation\_open\_bdry\_conds(cs\%OBC, u\_av, u\_old\_rad\_obc, v\_av, v\_old\_rad\_obc, g, us, dt\_pred)}
\DoxyCodeLine{635 }
\DoxyCodeLine{636     \textcolor{keywordflow}{if} (cs\%debug) \&}
\DoxyCodeLine{637       \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"{}Post OBC avg [uv]"{}}, u\_av, v\_av, g\%HI, haloshift=1, symmetric=sym, scale=us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{638 }
\DoxyCodeLine{639     \textcolor{comment}{! These should be done with a pass that excludes uh \& vh.}}
\DoxyCodeLine{640 \textcolor{comment}{!   call do\_group\_pass(CS\%pass\_hp\_uv, G\%Domain, clock=id\_clock\_pass)}}
\DoxyCodeLine{641 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{642 }
\DoxyCodeLine{643   \textcolor{keywordflow}{if} (g\%nonblocking\_updates) \textcolor{keywordflow}{then}}
\DoxyCodeLine{644     \textcolor{keyword}{call }start\_group\_pass(cs\%pass\_av\_uvh, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{645 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{646 }
\DoxyCodeLine{647   \textcolor{comment}{! h\_av = (h + hp)/2}}
\DoxyCodeLine{648   \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{649   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js-\/2,je+2 ; \textcolor{keywordflow}{do} i=is-\/2,ie+2}
\DoxyCodeLine{650     h\_av(i,j,k) = 0.5*(h(i,j,k) + hp(i,j,k))}
\DoxyCodeLine{651 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{652 }
\DoxyCodeLine{653   \textcolor{comment}{! The correction phase of the time step starts here.}}
\DoxyCodeLine{654   \textcolor{keyword}{call }enable\_averages(dt, time\_local, cs\%diag)}
\DoxyCodeLine{655 }
\DoxyCodeLine{656   \textcolor{comment}{! Calculate a revised estimate of the free-\/surface height correction to be}}
\DoxyCodeLine{657   \textcolor{comment}{! used in the next call to btstep.  This call is at this point so that}}
\DoxyCodeLine{658   \textcolor{comment}{! hp can be changed if CS\%begw /= 0.}}
\DoxyCodeLine{659   \textcolor{comment}{! eta\_cor = ...                 (hidden inside CS\%barotropic\_CSp)}}
\DoxyCodeLine{660   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_btcalc)}
\DoxyCodeLine{661   \textcolor{keyword}{call }bt\_mass\_source(hp, eta\_pred, .false., g, gv, cs\%barotropic\_CSp)}
\DoxyCodeLine{662   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_btcalc)}
\DoxyCodeLine{663 }
\DoxyCodeLine{664   \textcolor{keywordflow}{if} (cs\%begw /= 0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{665     \textcolor{comment}{! hp <-\/ (1-\/begw)*h\_in + begw*hp}}
\DoxyCodeLine{666     \textcolor{comment}{! Back up hp to the value it would have had after a time-\/step of}}
\DoxyCodeLine{667     \textcolor{comment}{! begw*dt.  hp is not used again until recalculated by continuity.}}
\DoxyCodeLine{668     \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{669     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js-\/1,je+1 ; \textcolor{keywordflow}{do} i=is-\/1,ie+1}
\DoxyCodeLine{670       hp(i,j,k) = (1.0-\/cs\%begw)*h(i,j,k) + cs\%begw*hp(i,j,k)}
\DoxyCodeLine{671 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{672 }
\DoxyCodeLine{673     \textcolor{comment}{! PFu = d/dx M(hp,T,S)}}
\DoxyCodeLine{674     \textcolor{comment}{! pbce = dM/deta}}
\DoxyCodeLine{675     \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_pres)}
\DoxyCodeLine{676     \textcolor{keyword}{call }pressureforce(hp, tv, cs\%PFu, cs\%PFv, g, gv, us, cs\%PressureForce\_CSp, \&}
\DoxyCodeLine{677                        cs\%ALE\_CSp, p\_surf, cs\%pbce, cs\%eta\_PF)}
\DoxyCodeLine{678     \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_pres)}
\DoxyCodeLine{679     \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with PressureForce[hp=(1-\/b).h+b.h] (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{680 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{681 }
\DoxyCodeLine{682   \textcolor{keywordflow}{if} (g\%nonblocking\_updates) \&}
\DoxyCodeLine{683     \textcolor{keyword}{call }complete\_group\_pass(cs\%pass\_av\_uvh, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{684 }
\DoxyCodeLine{685   \textcolor{keywordflow}{if} (bt\_cont\_bt\_thick) \textcolor{keywordflow}{then}}
\DoxyCodeLine{686     \textcolor{keyword}{call }btcalc(h, g, gv, cs\%barotropic\_CSp, cs\%BT\_cont\%h\_u, cs\%BT\_cont\%h\_v, \&}
\DoxyCodeLine{687                 obc=cs\%OBC)}
\DoxyCodeLine{688     \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with btcalc[BT\_cont\_BT\_thick] (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{689 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{690 }
\DoxyCodeLine{691   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{692     \textcolor{keyword}{call }mom\_state\_chksum(\textcolor{stringliteral}{"{}Predictor "{}}, up, vp, hp, uh, vh, g, gv, us, symmetric=sym)}
\DoxyCodeLine{693     \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"{}Predictor avg [uv]"{}}, u\_av, v\_av, g\%HI, haloshift=1, symmetric=sym, scale=us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{694     \textcolor{keyword}{call }hchksum(h\_av, \textcolor{stringliteral}{"{}Predictor avg h"{}}, g\%HI, haloshift=0, scale=gv\%H\_to\_m)}
\DoxyCodeLine{695   \textcolor{comment}{! call MOM\_state\_chksum("{}Predictor avg "{}, u\_av, v\_av, h\_av, uh, vh, G, GV, US)}}
\DoxyCodeLine{696     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}Predictor up "{}}, up, vp, g)}
\DoxyCodeLine{697     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}Predictor uh "{}}, uh, vh, g)}
\DoxyCodeLine{698 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{699 }
\DoxyCodeLine{700 \textcolor{comment}{! diffu = horizontal viscosity terms (u\_av)}}
\DoxyCodeLine{701   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_horvisc)}
\DoxyCodeLine{702   \textcolor{keyword}{call }horizontal\_viscosity(u\_av, v\_av, h\_av, cs\%diffu, cs\%diffv, \&}
\DoxyCodeLine{703                             meke, varmix, g, gv, us, cs\%hor\_visc\_CSp, \&}
\DoxyCodeLine{704                             obc=cs\%OBC, bt=cs\%barotropic\_CSp, td=thickness\_diffuse\_csp, \&}
\DoxyCodeLine{705                             adp=cs\%ADp)}
\DoxyCodeLine{706   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_horvisc)}
\DoxyCodeLine{707   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with horizontal\_viscosity (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{708 }
\DoxyCodeLine{709 \textcolor{comment}{! CAu = -\/(f+zeta\_av)/h\_av vh + d/dx KE\_av}}
\DoxyCodeLine{710   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_cor)}
\DoxyCodeLine{711   \textcolor{keyword}{call }coradcalc(u\_av, v\_av, h\_av, uh, vh, cs\%CAu, cs\%CAv, cs\%OBC, cs\%ADp, \&}
\DoxyCodeLine{712                  g, gv, us, cs\%CoriolisAdv\_CSp)}
\DoxyCodeLine{713   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_cor)}
\DoxyCodeLine{714   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with CorAdCalc (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{715 }
\DoxyCodeLine{716 \textcolor{comment}{! Calculate the momentum forcing terms for the barotropic equations.}}
\DoxyCodeLine{717 }
\DoxyCodeLine{718 \textcolor{comment}{! u\_bc\_accel = CAu + PFu + diffu(u[n-\/1])}}
\DoxyCodeLine{719   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_btforce)}
\DoxyCodeLine{720   \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{721   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{722     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{723       u\_bc\_accel(i,j,k) = (cs\%Cau(i,j,k) + cs\%PFu(i,j,k)) + cs\%diffu(i,j,k)}
\DoxyCodeLine{724 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{725     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{726       v\_bc\_accel(i,j,k) = (cs\%Cav(i,j,k) + cs\%PFv(i,j,k)) + cs\%diffv(i,j,k)}
\DoxyCodeLine{727 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{728 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{729   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{730     \textcolor{keyword}{call }open\_boundary\_zero\_normal\_flow(cs\%OBC, g, u\_bc\_accel, v\_bc\_accel)}
\DoxyCodeLine{731 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{732   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_btforce)}
\DoxyCodeLine{733 }
\DoxyCodeLine{734   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{735     \textcolor{keyword}{call }mom\_accel\_chksum(\textcolor{stringliteral}{"{}corr pre-\/btstep accel"{}}, cs\%CAu, cs\%CAv, cs\%PFu, cs\%PFv, \&}
\DoxyCodeLine{736                           cs\%diffu, cs\%diffv, g, gv, us, cs\%pbce, u\_bc\_accel, v\_bc\_accel, \&}
\DoxyCodeLine{737                           symmetric=sym)}
\DoxyCodeLine{738     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}corr pre-\/btstep CS\%Ca "{}}, cs\%Cau, cs\%Cav, g)}
\DoxyCodeLine{739     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}corr pre-\/btstep CS\%PF "{}}, cs\%PFu, cs\%PFv, g)}
\DoxyCodeLine{740     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}corr pre-\/btstep CS\%diff "{}}, cs\%diffu, cs\%diffv, g)}
\DoxyCodeLine{741     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}corr pre-\/btstep u\_bc\_accel "{}}, u\_bc\_accel, v\_bc\_accel, g)}
\DoxyCodeLine{742 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{743 }
\DoxyCodeLine{744   \textcolor{comment}{! u\_accel\_bt = layer accelerations due to barotropic solver}}
\DoxyCodeLine{745   \textcolor{comment}{! pbce = dM/deta}}
\DoxyCodeLine{746   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_btstep)}
\DoxyCodeLine{747   \textcolor{keywordflow}{if} (cs\%BT\_use\_layer\_fluxes) \textcolor{keywordflow}{then}}
\DoxyCodeLine{748     uh\_ptr => uh ; vh\_ptr => vh ; u\_ptr => u\_av ; v\_ptr => v\_av}
\DoxyCodeLine{749 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{750 }
\DoxyCodeLine{751   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_enter(\textcolor{stringliteral}{"{}btstep(), MOM\_barotropic.F90"{}})}
\DoxyCodeLine{752   \textcolor{comment}{! This is the corrector step call to btstep.}}
\DoxyCodeLine{753   \textcolor{keyword}{call }btstep(u, v, eta, dt, u\_bc\_accel, v\_bc\_accel, forces, cs\%pbce, \&}
\DoxyCodeLine{754               cs\%eta\_PF, u\_av, v\_av, cs\%u\_accel\_bt, cs\%v\_accel\_bt, \&}
\DoxyCodeLine{755               eta\_pred, cs\%uhbt, cs\%vhbt, g, gv, us, cs\%barotropic\_CSp, \&}
\DoxyCodeLine{756               cs\%visc\_rem\_u, cs\%visc\_rem\_v, etaav=eta\_av, adp=cs\%ADp, \&}
\DoxyCodeLine{757               obc=cs\%OBC, bt\_cont = cs\%BT\_cont, eta\_pf\_start=eta\_pf\_start, \&}
\DoxyCodeLine{758               taux\_bot=taux\_bot, tauy\_bot=tauy\_bot, \&}
\DoxyCodeLine{759               uh0=uh\_ptr, vh0=vh\_ptr, u\_uh0=u\_ptr, v\_vh0=v\_ptr)}
\DoxyCodeLine{760   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; eta(i,j) = eta\_pred(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{761 }
\DoxyCodeLine{762   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_btstep)}
\DoxyCodeLine{763   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_leave(\textcolor{stringliteral}{"{}btstep()"{}})}
\DoxyCodeLine{764 }
\DoxyCodeLine{765   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{766     \textcolor{keyword}{call }check\_redundant(\textcolor{stringliteral}{"{}u\_accel\_bt "{}}, cs\%u\_accel\_bt, cs\%v\_accel\_bt, g)}
\DoxyCodeLine{767 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{768 }
\DoxyCodeLine{769   \textcolor{comment}{! u = u + dt*( u\_bc\_accel + u\_accel\_bt )}}
\DoxyCodeLine{770   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_mom\_update)}
\DoxyCodeLine{771   \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{772   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{773     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{774       u(i,j,k) = g\%mask2dCu(i,j) * (u(i,j,k) + dt * \&}
\DoxyCodeLine{775                       (u\_bc\_accel(i,j,k) + cs\%u\_accel\_bt(i,j,k)))}
\DoxyCodeLine{776 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{777     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{778       v(i,j,k) = g\%mask2dCv(i,j) * (v(i,j,k) + dt * \&}
\DoxyCodeLine{779                       (v\_bc\_accel(i,j,k) + cs\%v\_accel\_bt(i,j,k)))}
\DoxyCodeLine{780 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{781 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{782   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_mom\_update)}
\DoxyCodeLine{783 }
\DoxyCodeLine{784   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{785     \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"{}Corrector 1 [uv]"{}}, u, v, g\%HI,haloshift=0, symmetric=sym, scale=us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{786     \textcolor{keyword}{call }hchksum(h, \textcolor{stringliteral}{"{}Corrector 1 h"{}}, g\%HI, haloshift=2, scale=gv\%H\_to\_m)}
\DoxyCodeLine{787     \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"{}Corrector 1 [uv]h"{}}, uh, vh, g\%HI, haloshift=2, \&}
\DoxyCodeLine{788                   symmetric=sym, scale=gv\%H\_to\_m*us\%L\_to\_m**2*us\%s\_to\_T)}
\DoxyCodeLine{789   \textcolor{comment}{! call MOM\_state\_chksum("{}Corrector 1"{}, u, v, h, uh, vh, G, GV, US, haloshift=1)}}
\DoxyCodeLine{790     \textcolor{keyword}{call }mom\_accel\_chksum(\textcolor{stringliteral}{"{}Corrector accel"{}}, cs\%CAu, cs\%CAv, cs\%PFu, cs\%PFv, \&}
\DoxyCodeLine{791                           cs\%diffu, cs\%diffv, g, gv, us, cs\%pbce, cs\%u\_accel\_bt, cs\%v\_accel\_bt, \&}
\DoxyCodeLine{792                           symmetric=sym)}
\DoxyCodeLine{793 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{794 }
\DoxyCodeLine{795   \textcolor{comment}{! u <-\/ u + dt d/dz visc d/dz u}}
\DoxyCodeLine{796   \textcolor{comment}{! u\_av <-\/ u\_av + dt d/dz visc d/dz u\_av}}
\DoxyCodeLine{797   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_vertvisc)}
\DoxyCodeLine{798   \textcolor{keyword}{call }vertvisc\_coef(u, v, h, forces, visc, dt, g, gv, us, cs\%vertvisc\_CSp, cs\%OBC)}
\DoxyCodeLine{799   \textcolor{keyword}{call }vertvisc(u, v, h, forces, visc, dt, cs\%OBC, cs\%ADp, cs\%CDp, g, gv, us, \&}
\DoxyCodeLine{800                 cs\%vertvisc\_CSp, cs\%taux\_bot, cs\%tauy\_bot,waves=waves)}
\DoxyCodeLine{801   \textcolor{keywordflow}{if} (g\%nonblocking\_updates) \textcolor{keywordflow}{then}}
\DoxyCodeLine{802     \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_vertvisc)}
\DoxyCodeLine{803     \textcolor{keyword}{call }start\_group\_pass(cs\%pass\_uv, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{804     \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_vertvisc)}
\DoxyCodeLine{805 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{806   \textcolor{keyword}{call }vertvisc\_remnant(visc, cs\%visc\_rem\_u, cs\%visc\_rem\_v, dt, g, gv, us, cs\%vertvisc\_CSp)}
\DoxyCodeLine{807   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_vertvisc)}
\DoxyCodeLine{808   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with vertvisc (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{809 }
\DoxyCodeLine{810 \textcolor{comment}{! Later, h\_av = (h\_in + h\_out)/2, but for now use h\_av to store h\_in.}}
\DoxyCodeLine{811   \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{812   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js-\/2,je+2 ; \textcolor{keywordflow}{do} i=is-\/2,ie+2}
\DoxyCodeLine{813     h\_av(i,j,k) = h(i,j,k)}
\DoxyCodeLine{814 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{815 }
\DoxyCodeLine{816   \textcolor{keyword}{call }do\_group\_pass(cs\%pass\_visc\_rem, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{817   \textcolor{keywordflow}{if} (g\%nonblocking\_updates) \textcolor{keywordflow}{then}}
\DoxyCodeLine{818     \textcolor{keyword}{call }complete\_group\_pass(cs\%pass\_uv, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{819   \textcolor{keywordflow}{else}}
\DoxyCodeLine{820     \textcolor{keyword}{call }do\_group\_pass(cs\%pass\_uv, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{821 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{822 }
\DoxyCodeLine{823   \textcolor{comment}{! uh = u\_av * h}}
\DoxyCodeLine{824   \textcolor{comment}{! h  = h + dt * div . uh}}
\DoxyCodeLine{825   \textcolor{comment}{! u\_av and v\_av adjusted so their mass transports match uhbt and vhbt.}}
\DoxyCodeLine{826   \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_continuity)}
\DoxyCodeLine{827   \textcolor{keyword}{call }continuity(u, v, h, h, uh, vh, dt, g, gv, us, cs\%continuity\_CSp, \&}
\DoxyCodeLine{828                   cs\%uhbt, cs\%vhbt, cs\%OBC, cs\%visc\_rem\_u, cs\%visc\_rem\_v, u\_av, v\_av)}
\DoxyCodeLine{829   \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_continuity)}
\DoxyCodeLine{830   \textcolor{keyword}{call }do\_group\_pass(cs\%pass\_h, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{831   \textcolor{comment}{! Whenever thickness changes let the diag manager know, target grids}}
\DoxyCodeLine{832   \textcolor{comment}{! for vertical remapping may need to be regenerated.}}
\DoxyCodeLine{833   \textcolor{keyword}{call }diag\_update\_remap\_grids(cs\%diag)}
\DoxyCodeLine{834   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_waypoint(\textcolor{stringliteral}{"{}done with continuity (step\_MOM\_dyn\_split\_RK2)"{}})}
\DoxyCodeLine{835 }
\DoxyCodeLine{836   \textcolor{keywordflow}{if} (g\%nonblocking\_updates) \textcolor{keywordflow}{then}}
\DoxyCodeLine{837     \textcolor{keyword}{call }start\_group\_pass(cs\%pass\_av\_uvh, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{838   \textcolor{keywordflow}{else}}
\DoxyCodeLine{839     \textcolor{keyword}{call }do\_group\_pass(cs\%pass\_av\_uvh, g\%domain, clock=id\_clock\_pass)}
\DoxyCodeLine{840 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{841 }
\DoxyCodeLine{842   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%OBC)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{843     \textcolor{keyword}{call }radiation\_open\_bdry\_conds(cs\%OBC, u, u\_old\_rad\_obc, v, v\_old\_rad\_obc, g, us, dt)}
\DoxyCodeLine{844 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{845 }
\DoxyCodeLine{846 \textcolor{comment}{! h\_av = (h\_in + h\_out)/2 . Going in to this line, h\_av = h\_in.}}
\DoxyCodeLine{847   \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{848   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js-\/2,je+2 ; \textcolor{keywordflow}{do} i=is-\/2,ie+2}
\DoxyCodeLine{849     h\_av(i,j,k) = 0.5*(h\_av(i,j,k) + h(i,j,k))}
\DoxyCodeLine{850 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{851 }
\DoxyCodeLine{852   \textcolor{keywordflow}{if} (g\%nonblocking\_updates) \&}
\DoxyCodeLine{853     \textcolor{keyword}{call }complete\_group\_pass(cs\%pass\_av\_uvh, g\%Domain, clock=id\_clock\_pass)}
\DoxyCodeLine{854 }
\DoxyCodeLine{855   \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{856   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{857     \textcolor{keywordflow}{do} j=js-\/2,je+2 ; \textcolor{keywordflow}{do} i=isq-\/2,ieq+2}
\DoxyCodeLine{858       uhtr(i,j,k) = uhtr(i,j,k) + uh(i,j,k)*dt}
\DoxyCodeLine{859 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{860     \textcolor{keywordflow}{do} j=jsq-\/2,jeq+2 ; \textcolor{keywordflow}{do} i=is-\/2,ie+2}
\DoxyCodeLine{861       vhtr(i,j,k) = vhtr(i,j,k) + vh(i,j,k)*dt}
\DoxyCodeLine{862 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{863 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{864 }
\DoxyCodeLine{865   \textcolor{comment}{!   The time-\/averaged free surface height has already been set by the last}}
\DoxyCodeLine{866   \textcolor{comment}{!  call to btstep.}}
\DoxyCodeLine{867 }
\DoxyCodeLine{868   \textcolor{comment}{!  Here various terms used in to update the momentum equations are}}
\DoxyCodeLine{869   \textcolor{comment}{!  offered for time averaging.}}
\DoxyCodeLine{870   \textcolor{keywordflow}{if} (cs\%id\_PFu > 0) \textcolor{keyword}{call }post\_data(cs\%id\_PFu, cs\%PFu, cs\%diag)}
\DoxyCodeLine{871   \textcolor{keywordflow}{if} (cs\%id\_PFv > 0) \textcolor{keyword}{call }post\_data(cs\%id\_PFv, cs\%PFv, cs\%diag)}
\DoxyCodeLine{872   \textcolor{keywordflow}{if} (cs\%id\_CAu > 0) \textcolor{keyword}{call }post\_data(cs\%id\_CAu, cs\%CAu, cs\%diag)}
\DoxyCodeLine{873   \textcolor{keywordflow}{if} (cs\%id\_CAv > 0) \textcolor{keyword}{call }post\_data(cs\%id\_CAv, cs\%CAv, cs\%diag)}
\DoxyCodeLine{874 }
\DoxyCodeLine{875   \textcolor{comment}{! Here the thickness fluxes are offered for time averaging.}}
\DoxyCodeLine{876   \textcolor{keywordflow}{if} (cs\%id\_uh         > 0) \textcolor{keyword}{call }post\_data(cs\%id\_uh , uh,                   cs\%diag)}
\DoxyCodeLine{877   \textcolor{keywordflow}{if} (cs\%id\_vh         > 0) \textcolor{keyword}{call }post\_data(cs\%id\_vh , vh,                   cs\%diag)}
\DoxyCodeLine{878   \textcolor{keywordflow}{if} (cs\%id\_uav        > 0) \textcolor{keyword}{call }post\_data(cs\%id\_uav, u\_av,                 cs\%diag)}
\DoxyCodeLine{879   \textcolor{keywordflow}{if} (cs\%id\_vav        > 0) \textcolor{keyword}{call }post\_data(cs\%id\_vav, v\_av,                 cs\%diag)}
\DoxyCodeLine{880   \textcolor{keywordflow}{if} (cs\%id\_u\_BT\_accel > 0) \textcolor{keyword}{call }post\_data(cs\%id\_u\_BT\_accel, cs\%u\_accel\_bt, cs\%diag)}
\DoxyCodeLine{881   \textcolor{keywordflow}{if} (cs\%id\_v\_BT\_accel > 0) \textcolor{keyword}{call }post\_data(cs\%id\_v\_BT\_accel, cs\%v\_accel\_bt, cs\%diag)}
\DoxyCodeLine{882 }
\DoxyCodeLine{883   \textcolor{comment}{! Diagnostics for terms multiplied by fractional thicknesses}}
\DoxyCodeLine{884 }
\DoxyCodeLine{885   \textcolor{comment}{! 3D diagnostics hf\_PFu etc. are commented because there is no clarity on proper remapping grid option.}}
\DoxyCodeLine{886   \textcolor{comment}{! The code is retained for degugging purposes in the future.}}
\DoxyCodeLine{887   \textcolor{comment}{!if (CS\%id\_hf\_PFu > 0) then}}
\DoxyCodeLine{888   \textcolor{comment}{!  allocate(hf\_PFu(G\%IsdB:G\%IedB,G\%jsd:G\%jed,G\%ke))}}
\DoxyCodeLine{889   \textcolor{comment}{!  do k=1,nz ; do j=js,je ; do I=Isq,Ieq}}
\DoxyCodeLine{890   \textcolor{comment}{!    hf\_PFu(I,j,k) = CS\%PFu(I,j,k) * CS\%ADp\%diag\_hfrac\_u(I,j,k)}}
\DoxyCodeLine{891   \textcolor{comment}{!  enddo ; enddo ; enddo}}
\DoxyCodeLine{892   \textcolor{comment}{!  call post\_data(CS\%id\_hf\_PFu, hf\_PFu, CS\%diag)}}
\DoxyCodeLine{893   \textcolor{comment}{!endif}}
\DoxyCodeLine{894   \textcolor{comment}{!if (CS\%id\_hf\_PFv > 0) then}}
\DoxyCodeLine{895   \textcolor{comment}{!  allocate(hf\_PFv(G\%isd:G\%ied,G\%JsdB:G\%JedB,G\%ke))}}
\DoxyCodeLine{896   \textcolor{comment}{!  do k=1,nz ; do J=Jsq,Jeq ; do i=is,ie}}
\DoxyCodeLine{897   \textcolor{comment}{!    hf\_PFv(i,J,k) = CS\%PFv(i,J,k) * CS\%ADp\%diag\_hfrac\_v(i,J,k)}}
\DoxyCodeLine{898   \textcolor{comment}{!  enddo ; enddo ; enddo}}
\DoxyCodeLine{899   \textcolor{comment}{!  call post\_data(CS\%id\_hf\_PFv, hf\_PFv, CS\%diag)}}
\DoxyCodeLine{900   \textcolor{comment}{!endif}}
\DoxyCodeLine{901   \textcolor{keywordflow}{if} (cs\%id\_hf\_PFu\_2d > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{902     \textcolor{keyword}{allocate}(hf\_pfu\_2d(g\%IsdB:g\%IedB,g\%jsd:g\%jed))}
\DoxyCodeLine{903     hf\_pfu\_2d(:,:) = 0.0}
\DoxyCodeLine{904     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{905       hf\_pfu\_2d(i,j) = hf\_pfu\_2d(i,j) + cs\%PFu(i,j,k) * cs\%ADp\%diag\_hfrac\_u(i,j,k)}
\DoxyCodeLine{906 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{907     \textcolor{keyword}{call }post\_data(cs\%id\_hf\_PFu\_2d, hf\_pfu\_2d, cs\%diag)}
\DoxyCodeLine{908     \textcolor{keyword}{deallocate}(hf\_pfu\_2d)}
\DoxyCodeLine{909 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{910   \textcolor{keywordflow}{if} (cs\%id\_hf\_PFv\_2d > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{911     \textcolor{keyword}{allocate}(hf\_pfv\_2d(g\%isd:g\%ied,g\%JsdB:g\%JedB))}
\DoxyCodeLine{912     hf\_pfv\_2d(:,:) = 0.0}
\DoxyCodeLine{913     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{914       hf\_pfv\_2d(i,j) = hf\_pfv\_2d(i,j) + cs\%PFv(i,j,k) * cs\%ADp\%diag\_hfrac\_v(i,j,k)}
\DoxyCodeLine{915 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{916     \textcolor{keyword}{call }post\_data(cs\%id\_hf\_PFv\_2d, hf\_pfv\_2d, cs\%diag)}
\DoxyCodeLine{917     \textcolor{keyword}{deallocate}(hf\_pfv\_2d)}
\DoxyCodeLine{918 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{919 }
\DoxyCodeLine{920   \textcolor{comment}{!if (CS\%id\_hf\_CAu > 0) then}}
\DoxyCodeLine{921   \textcolor{comment}{!  allocate(hf\_CAu(G\%IsdB:G\%IedB,G\%jsd:G\%jed,G\%ke))}}
\DoxyCodeLine{922   \textcolor{comment}{!  do k=1,nz ; do j=js,je ; do I=Isq,Ieq}}
\DoxyCodeLine{923   \textcolor{comment}{!    hf\_CAu(I,j,k) = CS\%CAu(I,j,k) * CS\%ADp\%diag\_hfrac\_u(I,j,k)}}
\DoxyCodeLine{924   \textcolor{comment}{!  enddo ; enddo ; enddo}}
\DoxyCodeLine{925   \textcolor{comment}{!  call post\_data(CS\%id\_hf\_CAu, hf\_CAu, CS\%diag)}}
\DoxyCodeLine{926   \textcolor{comment}{!endif}}
\DoxyCodeLine{927   \textcolor{comment}{!if (CS\%id\_hf\_CAv > 0) then}}
\DoxyCodeLine{928   \textcolor{comment}{!  allocate(hf\_CAv(G\%isd:G\%ied,G\%JsdB:G\%JedB,G\%ke))}}
\DoxyCodeLine{929   \textcolor{comment}{!  do k=1,nz ; do J=Jsq,Jeq ; do i=is,ie}}
\DoxyCodeLine{930   \textcolor{comment}{!    hf\_CAv(i,J,k) = CS\%CAv(i,J,k) * CS\%ADp\%diag\_hfrac\_v(i,J,k)}}
\DoxyCodeLine{931   \textcolor{comment}{!  enddo ; enddo ; enddo}}
\DoxyCodeLine{932   \textcolor{comment}{!  call post\_data(CS\%id\_hf\_CAv, hf\_CAv, CS\%diag)}}
\DoxyCodeLine{933   \textcolor{comment}{!endif}}
\DoxyCodeLine{934   \textcolor{keywordflow}{if} (cs\%id\_hf\_CAu\_2d > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{935     \textcolor{keyword}{allocate}(hf\_cau\_2d(g\%IsdB:g\%IedB,g\%jsd:g\%jed))}
\DoxyCodeLine{936     hf\_cau\_2d(:,:) = 0.0}
\DoxyCodeLine{937     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{938       hf\_cau\_2d(i,j) = hf\_cau\_2d(i,j) + cs\%CAu(i,j,k) * cs\%ADp\%diag\_hfrac\_u(i,j,k)}
\DoxyCodeLine{939 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{940     \textcolor{keyword}{call }post\_data(cs\%id\_hf\_CAu\_2d, hf\_cau\_2d, cs\%diag)}
\DoxyCodeLine{941     \textcolor{keyword}{deallocate}(hf\_cau\_2d)}
\DoxyCodeLine{942 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{943   \textcolor{keywordflow}{if} (cs\%id\_hf\_CAv\_2d > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{944     \textcolor{keyword}{allocate}(hf\_cav\_2d(g\%isd:g\%ied,g\%JsdB:g\%JedB))}
\DoxyCodeLine{945     hf\_cav\_2d(:,:) = 0.0}
\DoxyCodeLine{946     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{947       hf\_cav\_2d(i,j) = hf\_cav\_2d(i,j) + cs\%CAv(i,j,k) * cs\%ADp\%diag\_hfrac\_v(i,j,k)}
\DoxyCodeLine{948 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{949     \textcolor{keyword}{call }post\_data(cs\%id\_hf\_CAv\_2d, hf\_cav\_2d, cs\%diag)}
\DoxyCodeLine{950     \textcolor{keyword}{deallocate}(hf\_cav\_2d)}
\DoxyCodeLine{951 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{952 }
\DoxyCodeLine{953   \textcolor{comment}{!if (CS\%id\_hf\_u\_BT\_accel > 0) then}}
\DoxyCodeLine{954   \textcolor{comment}{!  allocate(hf\_u\_BT\_accel(G\%IsdB:G\%IedB,G\%jsd:G\%jed,G\%ke))}}
\DoxyCodeLine{955   \textcolor{comment}{!  do k=1,nz ; do j=js,je ; do I=Isq,Ieq}}
\DoxyCodeLine{956   \textcolor{comment}{!    hf\_u\_BT\_accel(I,j,k) = CS\%u\_accel\_bt(I,j,k) * CS\%ADp\%diag\_hfrac\_u(I,j,k)}}
\DoxyCodeLine{957   \textcolor{comment}{!  enddo ; enddo ; enddo}}
\DoxyCodeLine{958   \textcolor{comment}{!  call post\_data(CS\%id\_hf\_u\_BT\_accel, hf\_u\_BT\_accel, CS\%diag)}}
\DoxyCodeLine{959   \textcolor{comment}{!endif}}
\DoxyCodeLine{960   \textcolor{comment}{!if (CS\%id\_hf\_v\_BT\_accel > 0) then}}
\DoxyCodeLine{961   \textcolor{comment}{!  allocate(hf\_v\_BT\_accel(G\%isd:G\%ied,G\%JsdB:G\%JedB,G\%ke))}}
\DoxyCodeLine{962   \textcolor{comment}{!  do k=1,nz ; do J=Jsq,Jeq ; do i=is,ie}}
\DoxyCodeLine{963   \textcolor{comment}{!    hf\_v\_BT\_accel(i,J,k) = CS\%v\_accel\_bt(i,J,k) * CS\%ADp\%diag\_hfrac\_v(i,J,k)}}
\DoxyCodeLine{964   \textcolor{comment}{!  enddo ; enddo ; enddo}}
\DoxyCodeLine{965   \textcolor{comment}{!  call post\_data(CS\%id\_hf\_v\_BT\_accel, hf\_v\_BT\_accel, CS\%diag)}}
\DoxyCodeLine{966   \textcolor{comment}{!endif}}
\DoxyCodeLine{967   \textcolor{keywordflow}{if} (cs\%id\_hf\_u\_BT\_accel\_2d > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{968     \textcolor{keyword}{allocate}(hf\_u\_bt\_accel\_2d(g\%IsdB:g\%IedB,g\%jsd:g\%jed))}
\DoxyCodeLine{969     hf\_u\_bt\_accel\_2d(:,:) = 0.0}
\DoxyCodeLine{970     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq}
\DoxyCodeLine{971       hf\_u\_bt\_accel\_2d(i,j) = hf\_u\_bt\_accel\_2d(i,j) + cs\%u\_accel\_bt(i,j,k) * cs\%ADp\%diag\_hfrac\_u(i,j,k)}
\DoxyCodeLine{972 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{973     \textcolor{keyword}{call }post\_data(cs\%id\_hf\_u\_BT\_accel\_2d, hf\_u\_bt\_accel\_2d, cs\%diag)}
\DoxyCodeLine{974     \textcolor{keyword}{deallocate}(hf\_u\_bt\_accel\_2d)}
\DoxyCodeLine{975 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{976   \textcolor{keywordflow}{if} (cs\%id\_hf\_v\_BT\_accel\_2d > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{977     \textcolor{keyword}{allocate}(hf\_v\_bt\_accel\_2d(g\%isd:g\%ied,g\%JsdB:g\%JedB))}
\DoxyCodeLine{978     hf\_v\_bt\_accel\_2d(:,:) = 0.0}
\DoxyCodeLine{979     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{980       hf\_v\_bt\_accel\_2d(i,j) = hf\_v\_bt\_accel\_2d(i,j) + cs\%v\_accel\_bt(i,j,k) * cs\%ADp\%diag\_hfrac\_v(i,j,k)}
\DoxyCodeLine{981 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{982     \textcolor{keyword}{call }post\_data(cs\%id\_hf\_v\_BT\_accel\_2d, hf\_v\_bt\_accel\_2d, cs\%diag)}
\DoxyCodeLine{983     \textcolor{keyword}{deallocate}(hf\_v\_bt\_accel\_2d)}
\DoxyCodeLine{984 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{985 }
\DoxyCodeLine{986   \textcolor{keywordflow}{if} (cs\%debug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{987     \textcolor{keyword}{call }mom\_state\_chksum(\textcolor{stringliteral}{"{}Corrector "{}}, u, v, h, uh, vh, g, gv, us, symmetric=sym)}
\DoxyCodeLine{988     \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"{}Corrector avg [uv]"{}}, u\_av, v\_av, g\%HI, haloshift=1, symmetric=sym, scale=us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{989     \textcolor{keyword}{call }hchksum(h\_av, \textcolor{stringliteral}{"{}Corrector avg h"{}}, g\%HI, haloshift=1, scale=gv\%H\_to\_m)}
\DoxyCodeLine{990  \textcolor{comment}{!  call MOM\_state\_chksum("{}Corrector avg "{}, u\_av, v\_av, h\_av, uh, vh, G, GV, US)}}
\DoxyCodeLine{991 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{992 }
\DoxyCodeLine{993   \textcolor{keywordflow}{if} (showcalltree) \textcolor{keyword}{call }calltree\_leave(\textcolor{stringliteral}{"{}step\_MOM\_dyn\_split\_RK2()"{}})}
\DoxyCodeLine{994 }

\end{DoxyCode}
