\hypertarget{namespacemom__pointaccel}{}\doxysection{mom\+\_\+pointaccel Module Reference}
\label{namespacemom__pointaccel}\index{mom\_pointaccel@{mom\_pointaccel}}


\doxysubsection{Detailed Description}
Debug accelerations at a given point. 

The two subroutines in this file write out all of the terms in the u-\/ or v-\/momentum balance at a given point. Usually these subroutines are called after the velocities exceed some threshold, in order to determine which term is culpable. often this is done for debugging purposes. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structmom__pointaccel_1_1pointaccel__cs}{pointaccel\+\_\+cs}}
\begin{DoxyCompactList}\small\item\em The control structure for the M\+O\+M\+\_\+\+Point\+Accel module. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__pointaccel_ad0c48b7ad457f12ff654c58118f3e7a9}{write\+\_\+u\+\_\+accel}} (I, j, um, hin, A\+Dp, C\+Dp, dt\+\_\+in\+\_\+T, G, GV, US, CS, vel\+\_\+rpt, str, a, hv)
\begin{DoxyCompactList}\small\item\em This subroutine writes to an output file all of the accelerations that have been applied to a column of zonal velocities over the previous timestep. This subroutine is called from vertvisc. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__pointaccel_a5dcb6d93272fda6e551bb5275b6b1e3d}{write\+\_\+v\+\_\+accel}} (i, J, vm, hin, A\+Dp, C\+Dp, dt\+\_\+in\+\_\+T, G, GV, US, CS, vel\+\_\+rpt, str, a, hv)
\begin{DoxyCompactList}\small\item\em This subroutine writes to an output file all of the accelerations that have been applied to a column of meridional velocities over the previous timestep. This subroutine is called from vertvisc. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__pointaccel_a87921a442c770b070110314588ec654a}{pointaccel\+\_\+init}} (M\+IS, Time, G, param\+\_\+file, diag, dirs, CS)
\begin{DoxyCompactList}\small\item\em This subroutine initializes the parameters regulating how truncations are logged. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__pointaccel_a87921a442c770b070110314588ec654a}\label{namespacemom__pointaccel_a87921a442c770b070110314588ec654a}} 
\index{mom\_pointaccel@{mom\_pointaccel}!pointaccel\_init@{pointaccel\_init}}
\index{pointaccel\_init@{pointaccel\_init}!mom\_pointaccel@{mom\_pointaccel}}
\doxysubsubsection{\texorpdfstring{pointaccel\_init()}{pointaccel\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+pointaccel\+::pointaccel\+\_\+init (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__variables_1_1ocean__internal__state}{ocean\+\_\+internal\+\_\+state}}), intent(in), target}]{M\+IS,  }\item[{type(time\+\_\+type), intent(in), target}]{Time,  }\item[{type(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(in)}]{G,  }\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__get__input_1_1directories}{directories}}), intent(in)}]{dirs,  }\item[{type(\mbox{\hyperlink{structmom__pointaccel_1_1pointaccel__cs}{pointaccel\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



This subroutine initializes the parameters regulating how truncations are logged. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mis} & For \char`\"{}\+M\+O\+M Internal State\char`\"{} a set of pointers \\
\hline
\mbox{\texttt{ in}}  & {\em time} & The current model time. \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters. \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag} & A structure that is used to regulate diagnostic output. \\
\hline
\mbox{\texttt{ in}}  & {\em dirs} & A structure containing several relevant directory paths. \\
\hline
 & {\em cs} & A pointer that is set to point to the control structure for this module. \\
\hline
\end{DoxyParams}


Definition at line 731 of file M\+O\+M\+\_\+\+Point\+Accel.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{732   \textcolor{keywordtype}{type}(ocean\_internal\_state), \&}
\DoxyCodeLine{733                         \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)}    :: MIS\textcolor{comment}{  !< For "{}MOM Internal State"{} a set of pointers}}
\DoxyCodeLine{734 \textcolor{comment}{                                                      !! to the fields and accelerations that make}}
\DoxyCodeLine{735 \textcolor{comment}{                                                      !! up the ocean's physical state.}}
\DoxyCodeLine{736   \textcolor{keywordtype}{type}(time\_type),      \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)}    :: Time\textcolor{comment}{ !< The current model time.}}
\DoxyCodeLine{737   \textcolor{keywordtype}{type}(ocean\_grid\_type),        \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{    !< The ocean's grid structure.}}
\DoxyCodeLine{738   \textcolor{keywordtype}{type}(param\_file\_type),        \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< A structure to parse for run-\/time}}
\DoxyCodeLine{739 \textcolor{comment}{                                                      !! parameters.}}
\DoxyCodeLine{740   \textcolor{keywordtype}{type}(diag\_ctrl),      \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{ !< A structure that is used to regulate}}
\DoxyCodeLine{741 \textcolor{comment}{                                                      !! diagnostic output.}}
\DoxyCodeLine{742   \textcolor{keywordtype}{type}(directories),            \textcolor{keywordtype}{intent(in)}    :: dirs\textcolor{comment}{ !< A structure containing several relevant}}
\DoxyCodeLine{743 \textcolor{comment}{                                                      !! directory paths.}}
\DoxyCodeLine{744   \textcolor{keywordtype}{type}(PointAccel\_CS),          \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{   !< A pointer that is set to point to the}}
\DoxyCodeLine{745 \textcolor{comment}{                                                      !! control structure for this module.}}
\DoxyCodeLine{746 \textcolor{comment}{! This include declares and sets the variable "{}version"{}.}}
\DoxyCodeLine{747 \textcolor{preprocessor}{\#include "{}version\_variable.h"{}}}
\DoxyCodeLine{748 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"{}MOM\_PointAccel"{}} \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{749 }
\DoxyCodeLine{750   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{751   \textcolor{keyword}{allocate}(cs)}
\DoxyCodeLine{752 }
\DoxyCodeLine{753   cs\%diag => diag ; cs\%Time => time}
\DoxyCodeLine{754 }
\DoxyCodeLine{755   cs\%T => mis\%T ; cs\%S => mis\%S ; cs\%pbce => mis\%pbce}
\DoxyCodeLine{756   cs\%u\_accel\_bt => mis\%u\_accel\_bt ; cs\%v\_accel\_bt => mis\%v\_accel\_bt}
\DoxyCodeLine{757   cs\%u\_prev => mis\%u\_prev ; cs\%v\_prev => mis\%v\_prev}
\DoxyCodeLine{758   cs\%u\_av => mis\%u\_av; \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(mis\%u\_av)) cs\%u\_av => mis\%u(:,:,:)}
\DoxyCodeLine{759   cs\%v\_av => mis\%v\_av; \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(mis\%v\_av)) cs\%v\_av => mis\%v(:,:,:)}
\DoxyCodeLine{760 }
\DoxyCodeLine{761   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}}
\DoxyCodeLine{762   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{"{}"{}}, debugging=.true.)}
\DoxyCodeLine{763   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}U\_TRUNC\_FILE"{}}, cs\%u\_trunc\_file, \&}
\DoxyCodeLine{764                  \textcolor{stringliteral}{"{}The absolute path to the file where the accelerations "{}}//\&}
\DoxyCodeLine{765                  \textcolor{stringliteral}{"{}leading to zonal velocity truncations are written. \(\backslash\)n"{}}//\&}
\DoxyCodeLine{766                  \textcolor{stringliteral}{"{}Leave this empty for efficiency if this diagnostic is "{}}//\&}
\DoxyCodeLine{767                  \textcolor{stringliteral}{"{}not needed."{}}, default=\textcolor{stringliteral}{"{}"{}}, debuggingparam=.true.)}
\DoxyCodeLine{768   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}V\_TRUNC\_FILE"{}}, cs\%v\_trunc\_file, \&}
\DoxyCodeLine{769                  \textcolor{stringliteral}{"{}The absolute path to the file where the accelerations "{}}//\&}
\DoxyCodeLine{770                  \textcolor{stringliteral}{"{}leading to meridional velocity truncations are written. \(\backslash\)n"{}}//\&}
\DoxyCodeLine{771                  \textcolor{stringliteral}{"{}Leave this empty for efficiency if this diagnostic is "{}}//\&}
\DoxyCodeLine{772                  \textcolor{stringliteral}{"{}not needed."{}}, default=\textcolor{stringliteral}{"{}"{}}, debuggingparam=.true.)}
\DoxyCodeLine{773   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}MAX\_TRUNC\_FILE\_SIZE\_PER\_PE"{}}, cs\%max\_writes, \&}
\DoxyCodeLine{774                  \textcolor{stringliteral}{"{}The maximum number of columns of truncations that any PE "{}}//\&}
\DoxyCodeLine{775                  \textcolor{stringliteral}{"{}will write out during a run."{}}, default=50, debuggingparam=.true.)}
\DoxyCodeLine{776 }
\DoxyCodeLine{777   \textcolor{keywordflow}{if} (len\_trim(dirs\%output\_directory) > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{778     \textcolor{keywordflow}{if} (len\_trim(cs\%u\_trunc\_file) > 0) \&}
\DoxyCodeLine{779       cs\%u\_trunc\_file = trim(dirs\%output\_directory)//trim(cs\%u\_trunc\_file)}
\DoxyCodeLine{780     \textcolor{keywordflow}{if} (len\_trim(cs\%v\_trunc\_file) > 0) \&}
\DoxyCodeLine{781       cs\%v\_trunc\_file = trim(dirs\%output\_directory)//trim(cs\%v\_trunc\_file)}
\DoxyCodeLine{782     \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"{}output\_dir/U\_TRUNC\_FILE"{}}, cs\%u\_trunc\_file, debuggingparam=.true.)}
\DoxyCodeLine{783     \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"{}output\_dir/V\_TRUNC\_FILE"{}}, cs\%v\_trunc\_file, debuggingparam=.true.)}
\DoxyCodeLine{784 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{785   cs\%u\_file = -\/1 ; cs\%v\_file = -\/1 ; cs\%cols\_written = 0}
\DoxyCodeLine{786 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__pointaccel_ad0c48b7ad457f12ff654c58118f3e7a9}\label{namespacemom__pointaccel_ad0c48b7ad457f12ff654c58118f3e7a9}} 
\index{mom\_pointaccel@{mom\_pointaccel}!write\_u\_accel@{write\_u\_accel}}
\index{write\_u\_accel@{write\_u\_accel}!mom\_pointaccel@{mom\_pointaccel}}
\doxysubsubsection{\texorpdfstring{write\_u\_accel()}{write\_u\_accel()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+pointaccel\+::write\+\_\+u\+\_\+accel (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{I,  }\item[{integer, intent(in)}]{j,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{um,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{hin,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1accel__diag__ptrs}{accel\+\_\+diag\+\_\+ptrs}}), intent(in)}]{A\+Dp,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1cont__diag__ptrs}{cont\+\_\+diag\+\_\+ptrs}}), intent(in)}]{C\+Dp,  }\item[{real, intent(in)}]{dt\+\_\+in\+\_\+T,  }\item[{type(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(in)}]{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__pointaccel_1_1pointaccel__cs}{pointaccel\+\_\+cs}}), pointer}]{CS,  }\item[{real, intent(in)}]{vel\+\_\+rpt,  }\item[{real, intent(in), optional}]{str,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in), optional}]{a,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in), optional}]{hv }\end{DoxyParamCaption})}



This subroutine writes to an output file all of the accelerations that have been applied to a column of zonal velocities over the previous timestep. This subroutine is called from vertvisc. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em i} & The zonal index of the column to be documented. \\
\hline
\mbox{\texttt{ in}}  & {\em j} & The meridional index of the column to be documented. \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em um} & The new zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em hin} & The layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em adp} & A structure pointing to the various accelerations in the momentum equations. \\
\hline
\mbox{\texttt{ in}}  & {\em cdp} & A structure with pointers to various terms in the continuity equations. \\
\hline
\mbox{\texttt{ in}}  & {\em dt\+\_\+in\+\_\+t} & The ocean dynamics time step \mbox{[}T $\sim$$>$ s\mbox{]}. \\
\hline
 & {\em cs} & The control structure returned by a previous call to Point\+Accel\+\_\+init. \\
\hline
\mbox{\texttt{ in}}  & {\em vel\+\_\+rpt} & The velocity magnitude that triggers a report \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em str} & The surface wind stress integrated over a time step divided by the Boussinesq density \mbox{[}m2 s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em a} & The layer coupling coefficients from vertvisc \mbox{[}Z s-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em hv} & The layer thicknesses at velocity grid points, \\
\hline
\end{DoxyParams}


Definition at line 68 of file M\+O\+M\+\_\+\+Point\+Accel.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{69   \textcolor{keywordtype}{integer},                     \textcolor{keywordtype}{intent(in)} :: I\textcolor{comment}{   !< The zonal index of the column to be documented.}}
\DoxyCodeLine{70   \textcolor{keywordtype}{integer},                     \textcolor{keywordtype}{intent(in)} :: j\textcolor{comment}{   !< The meridional index of the column to be documented.}}
\DoxyCodeLine{71   \textcolor{keywordtype}{type}(ocean\_grid\_type),       \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{   !< The ocean's grid structure.}}
\DoxyCodeLine{72   \textcolor{keywordtype}{type}(verticalGrid\_type),     \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{  !< The ocean's vertical grid structure.}}
\DoxyCodeLine{73   \textcolor{keywordtype}{type}(unit\_scale\_type),       \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{  !< A dimensional unit scaling type}}
\DoxyCodeLine{74 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{75                                \textcolor{keywordtype}{intent(in)} :: um\textcolor{comment}{  !< The new zonal velocity [L T-\/1 \string~> m s-\/1].}}
\DoxyCodeLine{76 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{77                                \textcolor{keywordtype}{intent(in)} :: hin\textcolor{comment}{ !< The layer thickness [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{78   \textcolor{keywordtype}{type}(accel\_diag\_ptrs),       \textcolor{keywordtype}{intent(in)} :: ADp\textcolor{comment}{ !< A structure pointing to the various}}
\DoxyCodeLine{79 \textcolor{comment}{                                                 !! accelerations in the momentum equations.}}
\DoxyCodeLine{80   \textcolor{keywordtype}{type}(cont\_diag\_ptrs),        \textcolor{keywordtype}{intent(in)} :: CDp\textcolor{comment}{ !<  A structure with pointers to various terms}}
\DoxyCodeLine{81 \textcolor{comment}{                                                 !! in the continuity equations.}}
\DoxyCodeLine{82 \textcolor{keywordtype}{  real},                        \textcolor{keywordtype}{intent(in)} :: dt\_in\_T\textcolor{comment}{  !< The ocean dynamics time step [T \string~> s].}}
\DoxyCodeLine{83   \textcolor{keywordtype}{type}(PointAccel\_CS),         \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{  !< The control structure returned by a previous}}
\DoxyCodeLine{84 \textcolor{comment}{                                                 !! call to PointAccel\_init.}}
\DoxyCodeLine{85 \textcolor{keywordtype}{  real},                        \textcolor{keywordtype}{intent(in)} :: vel\_rpt\textcolor{comment}{ !< The velocity magnitude that triggers a report [L T-\/1 \string~> m s-\/1].}}
\DoxyCodeLine{86 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional},              \textcolor{keywordtype}{intent(in)} :: str\textcolor{comment}{ !< The surface wind stress integrated over a time}}
\DoxyCodeLine{87 \textcolor{comment}{                                                 !! step divided by the Boussinesq density [m2 s-\/1].}}
\DoxyCodeLine{88 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{89                      \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: a\textcolor{comment}{   !< The layer coupling coefficients from vertvisc [Z s-\/1 \string~> m s-\/1].}}
\DoxyCodeLine{90 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{91                      \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: hv\textcolor{comment}{  !< The layer thicknesses at velocity grid points,}}
\DoxyCodeLine{92 \textcolor{comment}{                                                 !! from vertvisc [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{93   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{94 \textcolor{keywordtype}{  real}    :: f\_eff, CFL}
\DoxyCodeLine{95 \textcolor{keywordtype}{  real}    :: Angstrom}
\DoxyCodeLine{96 \textcolor{keywordtype}{  real}    :: truncvel, du}
\DoxyCodeLine{97 \textcolor{keywordtype}{  real}    :: dt  \textcolor{comment}{! The time step [s]}}
\DoxyCodeLine{98 \textcolor{keywordtype}{  real}    :: Inorm(SZK\_(G))}
\DoxyCodeLine{99 \textcolor{keywordtype}{  real}    :: e(SZK\_(G)+1)}
\DoxyCodeLine{100 \textcolor{keywordtype}{  real}    :: h\_scale, uh\_scale}
\DoxyCodeLine{101   \textcolor{keywordtype}{integer} :: yr, mo, day, hr, minute, sec, yearday}
\DoxyCodeLine{102   \textcolor{keywordtype}{integer} :: k, ks, ke}
\DoxyCodeLine{103   \textcolor{keywordtype}{integer} :: nz}
\DoxyCodeLine{104   \textcolor{keywordtype}{logical} :: do\_k(SZK\_(G)+1)}
\DoxyCodeLine{105   \textcolor{keywordtype}{logical} :: prev\_avail}
\DoxyCodeLine{106   \textcolor{keywordtype}{integer} :: file}
\DoxyCodeLine{107 }
\DoxyCodeLine{108   angstrom = gv\%Angstrom\_H + gv\%H\_subroundoff}
\DoxyCodeLine{109   dt = us\%T\_to\_s*dt\_in\_t}
\DoxyCodeLine{110   h\_scale = gv\%H\_to\_m ; uh\_scale = gv\%H\_to\_m*us\%L\_T\_to\_m\_s}
\DoxyCodeLine{111 }
\DoxyCodeLine{112 \textcolor{comment}{!  if (.not.associated(CS)) return}}
\DoxyCodeLine{113   nz = g\%ke}
\DoxyCodeLine{114   \textcolor{keywordflow}{if} (cs\%cols\_written < cs\%max\_writes) \textcolor{keywordflow}{then}}
\DoxyCodeLine{115     cs\%cols\_written = cs\%cols\_written + 1}
\DoxyCodeLine{116 }
\DoxyCodeLine{117     ks = 1 ; ke = nz}
\DoxyCodeLine{118     do\_k(:) = .false.}
\DoxyCodeLine{119 }
\DoxyCodeLine{120   \textcolor{comment}{! Open up the file for output if this is the first call.}}
\DoxyCodeLine{121     \textcolor{keywordflow}{if} (cs\%u\_file < 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{122       \textcolor{keywordflow}{if} (len\_trim(cs\%u\_trunc\_file) < 1) \textcolor{keywordflow}{return}}
\DoxyCodeLine{123       \textcolor{keyword}{call }open\_file(cs\%u\_file, trim(cs\%u\_trunc\_file), action=append\_file, \&}
\DoxyCodeLine{124                      form=ascii\_file, threading=multiple, fileset=single\_file)}
\DoxyCodeLine{125       \textcolor{keywordflow}{if} (cs\%u\_file < 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{126         \textcolor{keyword}{call }mom\_error(note, \textcolor{stringliteral}{'Unable to open file '}//trim(cs\%u\_trunc\_file)//\textcolor{stringliteral}{'.'})}
\DoxyCodeLine{127         \textcolor{keywordflow}{return}}
\DoxyCodeLine{128 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{129 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{130     file = cs\%u\_file}
\DoxyCodeLine{131 }
\DoxyCodeLine{132     prev\_avail = (\textcolor{keyword}{associated}(cs\%u\_prev) .and. \textcolor{keyword}{associated}(cs\%v\_prev))}
\DoxyCodeLine{133 }
\DoxyCodeLine{134   \textcolor{comment}{! Determine which layers to write out accelerations for.}}
\DoxyCodeLine{135     \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{136       \textcolor{keywordflow}{if} (((max(cs\%u\_av(i,j,k),um(i,j,k)) >= vel\_rpt) .or. \&}
\DoxyCodeLine{137            (min(cs\%u\_av(i,j,k),um(i,j,k)) <= -\/vel\_rpt)) .and. \&}
\DoxyCodeLine{138           ((hin(i,j,k) + hin(i+1,j,k)) > 3.0*angstrom)) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{139 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{140     ks = k}
\DoxyCodeLine{141     \textcolor{keywordflow}{do} k=nz,1,-\/1}
\DoxyCodeLine{142       \textcolor{keywordflow}{if} (((max(cs\%u\_av(i,j,k), um(i,j,k)) >= vel\_rpt) .or. \&}
\DoxyCodeLine{143            (min(cs\%u\_av(i,j,k), um(i,j,k)) <= -\/vel\_rpt)) .and. \&}
\DoxyCodeLine{144           ((hin(i,j,k) + hin(i+1,j,k)) > 3.0*angstrom)) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{145 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{146     ke = k}
\DoxyCodeLine{147     \textcolor{keywordflow}{if} (ke < ks) \textcolor{keywordflow}{then}}
\DoxyCodeLine{148       ks = 1; ke = nz; \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'("{}U: Unable to set ks \& ke."{})'})}
\DoxyCodeLine{149 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{150 }
\DoxyCodeLine{151     \textcolor{keyword}{call }get\_date(cs\%Time, yr, mo, day, hr, minute, sec)}
\DoxyCodeLine{152     \textcolor{keyword}{call }get\_time((cs\%Time -\/ set\_date(yr, 1, 1, 0, 0, 0)), sec, yearday)}
\DoxyCodeLine{153     \textcolor{keyword}{write} (file,\textcolor{stringliteral}{'(/,"{}-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/"{})'})}
\DoxyCodeLine{154     \textcolor{keyword}{write} (file,\textcolor{stringliteral}{'(/,"{}Time "{},i5,i4,F6.2,"{} U-\/velocity violation at "{},I4,"{}: "{},2(I3), \&}}
\DoxyCodeLine{155 \textcolor{stringliteral}{}\textcolor{stringliteral}{        \& "{} ("{},F7.2,"{} E "{}F7.2,"{} N) Layers "{},I3,"{} to "{},I3,"{}. dt = "{},1PG10.4)'}) \&}
\DoxyCodeLine{156         yr, yearday, (real(sec)/3600.0), pe\_here(), i, j, \&}
\DoxyCodeLine{157         g\%geoLonCu(i,j), g\%geoLatCu(i,j), ks, ke, dt}
\DoxyCodeLine{158 }
\DoxyCodeLine{159     \textcolor{keywordflow}{if} (ks <= gv\%nk\_rho\_varies) ks = 1}
\DoxyCodeLine{160     \textcolor{keywordflow}{do} k=ks,ke}
\DoxyCodeLine{161       \textcolor{keywordflow}{if} ((hin(i,j,k) + hin(i+1,j,k)) > 3.0*angstrom) do\_k(k) = .true.}
\DoxyCodeLine{162 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{163 }
\DoxyCodeLine{164     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}Layers:"{},\$)'})}
\DoxyCodeLine{165     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(I10,"{} "{},\$)'}) (k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{166     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}u(m):  "{},\$)'})}
\DoxyCodeLine{167     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (us\%L\_T\_to\_m\_s*um(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{168     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{169       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}u(mp): "{},\$)'})}
\DoxyCodeLine{170       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (us\%L\_T\_to\_m\_s*cs\%u\_prev(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{171 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{172     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}u(3):  "{},\$)'})}
\DoxyCodeLine{173     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (us\%L\_T\_to\_m\_s*cs\%u\_av(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{174 }
\DoxyCodeLine{175     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}CFL u: "{},\$)'})}
\DoxyCodeLine{176     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{177       cfl = abs(um(i,j,k)) * us\%s\_to\_T*dt * g\%dy\_Cu(i,j)}
\DoxyCodeLine{178       \textcolor{keywordflow}{if} (um(i,j,k) < 0.0) \textcolor{keywordflow}{then} ; cfl = cfl * g\%IareaT(i+1,j)}
\DoxyCodeLine{179       \textcolor{keywordflow}{else} ; cfl = cfl * g\%IareaT(i,j) ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{180       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cfl}
\DoxyCodeLine{181 \textcolor{keywordflow}{    endif} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{182     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}CFL0 u:"{},\$)'})}
\DoxyCodeLine{183     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{184                                     abs(um(i,j,k)) * us\%s\_to\_T*dt * g\%IdxCu(i,j) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{185 }
\DoxyCodeLine{186     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{187       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}du:    "{},\$)'})}
\DoxyCodeLine{188       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{189                                       (us\%L\_T\_to\_m\_s*(um(i,j,k)-\/cs\%u\_prev(i,j,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{190 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{191     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}CAu:   "{},\$)'})}
\DoxyCodeLine{192     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (dt*us\%L\_T2\_to\_m\_s2*adp\%CAu(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{193     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}PFu:   "{},\$)'})}
\DoxyCodeLine{194     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (dt*us\%L\_T2\_to\_m\_s2*adp\%PFu(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{195     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}diffu: "{},\$)'})}
\DoxyCodeLine{196     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (dt*us\%L\_T2\_to\_m\_s2*adp\%diffu(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{197 }
\DoxyCodeLine{198     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%gradKEu)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{199       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}KEu:   "{},\$)'})}
\DoxyCodeLine{200       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{201                                       (dt*us\%L\_T2\_to\_m\_s2*adp\%gradKEu(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{202 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{203     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%rv\_x\_v)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{204       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}Coru:  "{},\$)'})}
\DoxyCodeLine{205       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{206           dt*us\%L\_T2\_to\_m\_s2*(adp\%CAu(i,j,k)-\/adp\%rv\_x\_v(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{207 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{208     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%du\_dt\_visc)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{209       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}ubv:   "{},\$)'})}
\DoxyCodeLine{210       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{211           us\%L\_T\_to\_m\_s*(um(i,j,k) -\/ us\%s\_to\_T*dt*adp\%du\_dt\_visc(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{212       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}duv:   "{},\$)'})}
\DoxyCodeLine{213       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{214                                       (dt*us\%L\_T2\_to\_m\_s2*adp\%du\_dt\_visc(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{215 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{216     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%du\_other)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{217       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}du\_other: "{},\$)'})}
\DoxyCodeLine{218       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{219                                       (us\%L\_T\_to\_m\_s*adp\%du\_other(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{220 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{221     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(a)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{222       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}a:     "{},\$)'})}
\DoxyCodeLine{223       \textcolor{keywordflow}{do} k=ks,ke+1 ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) a(i,j,k)*us\%Z\_to\_m*dt;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{224 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{225     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(hv)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{226       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}hvel:  "{},\$)'})}
\DoxyCodeLine{227       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) hv(i,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{228 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{229     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}Stress:  "{},ES10.3)'}) str}
\DoxyCodeLine{230 }
\DoxyCodeLine{231     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%u\_accel\_bt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{232       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'("{}dubt:  "{},\$)'})}
\DoxyCodeLine{233       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{234                                       (dt*us\%L\_T2\_to\_m\_s2*cs\%u\_accel\_bt(i,j,k)) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{235       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/)'})}
\DoxyCodeLine{236 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{237 }
\DoxyCodeLine{238     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}h-\/-\/:   "{},\$)'})}
\DoxyCodeLine{239     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (h\_scale*hin(i,j-\/1,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{240     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}h+-\/:   "{},\$)'})}
\DoxyCodeLine{241     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (h\_scale*hin(i+1,j-\/1,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{242     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}h-\/0:   "{},\$)'})}
\DoxyCodeLine{243     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (h\_scale*hin(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{244     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}h+0:   "{},\$)'})}
\DoxyCodeLine{245     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (h\_scale*hin(i+1,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{246     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}h-\/+:   "{},\$)'})}
\DoxyCodeLine{247     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (h\_scale*hin(i,j+1,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{248     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}h++:   "{},\$)'})}
\DoxyCodeLine{249     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (h\_scale*hin(i+1,j+1,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{250 }
\DoxyCodeLine{251 }
\DoxyCodeLine{252     e(nz+1) = -\/us\%Z\_to\_m*g\%bathyT(i,j)}
\DoxyCodeLine{253     \textcolor{keywordflow}{do} k=nz,1,-\/1 ; e(k) = e(k+1) + h\_scale*hin(i,j,k) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{254     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}e-\/:    "{},\$)'})}
\DoxyCodeLine{255     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) e(ks)}
\DoxyCodeLine{256     \textcolor{keywordflow}{do} k=ks+1,ke+1 ; \textcolor{keywordflow}{if} (do\_k(k-\/1)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) e(k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{257 }
\DoxyCodeLine{258     e(nz+1) = -\/us\%Z\_to\_m*g\%bathyT(i+1,j)}
\DoxyCodeLine{259     \textcolor{keywordflow}{do} k=nz,1,-\/1 ; e(k) = e(k+1) + h\_scale*hin(i+1,j,k) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{260     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}e+:    "{},\$)'})}
\DoxyCodeLine{261     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) e(ks)}
\DoxyCodeLine{262     \textcolor{keywordflow}{do} k=ks+1,ke+1 ; \textcolor{keywordflow}{if} (do\_k(k-\/1)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) e(k) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{263     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%T)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{264       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}T-\/:    "{},\$)'})}
\DoxyCodeLine{265       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%T(i,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{266       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}T+:    "{},\$)'})}
\DoxyCodeLine{267       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%T(i+1,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{268 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{269     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%S)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{270       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}S-\/:    "{},\$)'})}
\DoxyCodeLine{271       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%S(i,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{272       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}S+:    "{},\$)'})}
\DoxyCodeLine{273       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%S(i+1,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{274 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{275 }
\DoxyCodeLine{276     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{277       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}v-\/-\/:   "{},\$)'})}
\DoxyCodeLine{278       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (cs\%v\_prev(i,j-\/1,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{279       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}v-\/+:   "{},\$)'})}
\DoxyCodeLine{280       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (cs\%v\_prev(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{281       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}v+-\/:   "{},\$)'})}
\DoxyCodeLine{282       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (cs\%v\_prev(i+1,j-\/1,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{283       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}v++:   "{},\$)'})}
\DoxyCodeLine{284       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (cs\%v\_prev(i+1,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{285 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{286 }
\DoxyCodeLine{287     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}vh-\/-\/:  "{},\$)'})}
\DoxyCodeLine{288     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{289                                     (uh\_scale*cdp\%vh(i,j-\/1,k)*g\%IdxCv(i,j-\/1));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{290     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} vhC-\/-\/:"{},\$)'})}
\DoxyCodeLine{291     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{292                         (0.5*us\%L\_T\_to\_m\_s*cs\%v\_av(i,j-\/1,k)*h\_scale*(hin(i,j-\/1,k) + hin(i,j,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{293     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{294       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} vhCp-\/-\/:"{},\$)'})}
\DoxyCodeLine{295       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{296                           (0.5*cs\%v\_prev(i,j-\/1,k)*h\_scale*(hin(i,j-\/1,k) + hin(i,j,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{297 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{298 }
\DoxyCodeLine{299     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}vh-\/+:  "{},\$)'})}
\DoxyCodeLine{300     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{301                                     (uh\_scale*cdp\%vh(i,j,k)*g\%IdxCv(i,j));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{302     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} vhC-\/+:"{},\$)'})}
\DoxyCodeLine{303     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{304                         (0.5*us\%L\_T\_to\_m\_s*cs\%v\_av(i,j,k)*h\_scale*(hin(i,j,k) + hin(i,j+1,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{305     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{306       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} vhCp-\/+:"{},\$)'})}
\DoxyCodeLine{307       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{308                           (0.5*cs\%v\_prev(i,j,k)*h\_scale*(hin(i,j,k) + hin(i,j+1,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{309 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{310 }
\DoxyCodeLine{311     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}vh+-\/:  "{},\$)'})}
\DoxyCodeLine{312     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{313                                       (uh\_scale*cdp\%vh(i+1,j-\/1,k)*g\%IdxCv(i+1,j-\/1));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{314     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} vhC+-\/:"{},\$)'})}
\DoxyCodeLine{315     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{316                     (0.5*us\%L\_T\_to\_m\_s*cs\%v\_av(i+1,j-\/1,k)*h\_scale*(hin(i+1,j-\/1,k) + hin(i+1,j,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{317     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{318       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} vhCp+-\/:"{},\$)'})}
\DoxyCodeLine{319       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{320                       (0.5*cs\%v\_prev(i+1,j-\/1,k)*h\_scale*(hin(i+1,j-\/1,k) + hin(i+1,j,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{321 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{322 }
\DoxyCodeLine{323     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}vh++:  "{},\$)'})}
\DoxyCodeLine{324     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{325                           (uh\_scale*cdp\%vh(i+1,j,k)*g\%IdxCv(i+1,j));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{326     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} vhC++:"{},\$)'})}
\DoxyCodeLine{327          \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{328                      (0.5*us\%L\_T\_to\_m\_s*cs\%v\_av(i+1,j,k)*h\_scale*(hin(i+1,j,k) + hin(i+1,j+1,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{329     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{330       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} vhCp++:"{},\$)'})}
\DoxyCodeLine{331            \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{332                        (0.5*us\%L\_T\_to\_m\_s*cs\%v\_av(i+1,j,k)*h\_scale*(hin(i+1,j,k) + hin(i+1,j+1,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{333 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{334 }
\DoxyCodeLine{335     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}D:     "{},2(ES10.3))'}) us\%Z\_to\_m*g\%bathyT(i,j),us\%Z\_to\_m*g\%bathyT(i+1,j)}
\DoxyCodeLine{336 }
\DoxyCodeLine{337   \textcolor{comment}{!  From here on, the normalized accelerations are written.}}
\DoxyCodeLine{338     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{339       \textcolor{keywordflow}{do} k=ks,ke}
\DoxyCodeLine{340         du = us\%L\_T\_to\_m\_s*(um(i,j,k) -\/ cs\%u\_prev(i,j,k))}
\DoxyCodeLine{341         \textcolor{keywordflow}{if} (abs(du) < 1.0e-\/6) du = 1.0e-\/6}
\DoxyCodeLine{342         inorm(k) = 1.0 / du}
\DoxyCodeLine{343 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{344 }
\DoxyCodeLine{345       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(2/,"{}Norm:  "{},\$)'})}
\DoxyCodeLine{346       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) (1.0/inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{347 }
\DoxyCodeLine{348       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}du:    "{},\$)'})}
\DoxyCodeLine{349       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{350                         (us\%L\_T\_to\_m\_s*(um(i,j,k)-\/cs\%u\_prev(i,j,k))*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{351 }
\DoxyCodeLine{352       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}CAu:   "{},\$)'})}
\DoxyCodeLine{353       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{354                                       (dt*us\%L\_T2\_to\_m\_s2*adp\%CAu(i,j,k)*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{355 }
\DoxyCodeLine{356       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}PFu:   "{},\$)'})}
\DoxyCodeLine{357       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{358                                       (dt*us\%L\_T2\_to\_m\_s2*adp\%PFu(i,j,k)*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{359 }
\DoxyCodeLine{360       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}diffu: "{},\$)'})}
\DoxyCodeLine{361       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{362                                       (dt*us\%L\_T2\_to\_m\_s2*adp\%diffu(i,j,k)*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{363 }
\DoxyCodeLine{364       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%gradKEu)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{365         \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}KEu:   "{},\$)'})}
\DoxyCodeLine{366         \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{367                                         (dt*us\%L\_T2\_to\_m\_s2*adp\%gradKEu(i,j,k)*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{368 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{369       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%rv\_x\_v)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{370         \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}Coru:  "{},\$)'})}
\DoxyCodeLine{371         \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{372             dt*us\%L\_T2\_to\_m\_s2*(adp\%CAu(i,j,k)-\/adp\%rv\_x\_v(i,j,k))*inorm(k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{373 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{374       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%du\_dt\_visc)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{375         \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}duv:   "{},\$)'})}
\DoxyCodeLine{376         \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{377             (dt*us\%L\_T2\_to\_m\_s2*adp\%du\_dt\_visc(i,j,k))*inorm(k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{378 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{379       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%du\_other)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{380         \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}du\_other: "{},\$)'})}
\DoxyCodeLine{381         \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{382             (us\%L\_T\_to\_m\_s*adp\%du\_other(i,j,k))*inorm(k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{383 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{384       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%u\_accel\_bt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{385         \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}dubt:  "{},\$)'})}
\DoxyCodeLine{386         \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{387                                         (dt*us\%L\_T2\_to\_m\_s2*cs\%u\_accel\_bt(i,j,k)*inorm(k)) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{388 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{389 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{390 }
\DoxyCodeLine{391     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(2/)'})}
\DoxyCodeLine{392 }
\DoxyCodeLine{393     \textcolor{keyword}{call }flush(file)}
\DoxyCodeLine{394 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{395 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__pointaccel_a5dcb6d93272fda6e551bb5275b6b1e3d}\label{namespacemom__pointaccel_a5dcb6d93272fda6e551bb5275b6b1e3d}} 
\index{mom\_pointaccel@{mom\_pointaccel}!write\_v\_accel@{write\_v\_accel}}
\index{write\_v\_accel@{write\_v\_accel}!mom\_pointaccel@{mom\_pointaccel}}
\doxysubsubsection{\texorpdfstring{write\_v\_accel()}{write\_v\_accel()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+pointaccel\+::write\+\_\+v\+\_\+accel (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{i,  }\item[{integer, intent(in)}]{J,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in)}]{vm,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{hin,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1accel__diag__ptrs}{accel\+\_\+diag\+\_\+ptrs}}), intent(in)}]{A\+Dp,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1cont__diag__ptrs}{cont\+\_\+diag\+\_\+ptrs}}), intent(in)}]{C\+Dp,  }\item[{real, intent(in)}]{dt\+\_\+in\+\_\+T,  }\item[{type(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(in)}]{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__pointaccel_1_1pointaccel__cs}{pointaccel\+\_\+cs}}), pointer}]{CS,  }\item[{real, intent(in)}]{vel\+\_\+rpt,  }\item[{real, intent(in), optional}]{str,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in), optional}]{a,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in), optional}]{hv }\end{DoxyParamCaption})}



This subroutine writes to an output file all of the accelerations that have been applied to a column of meridional velocities over the previous timestep. This subroutine is called from vertvisc. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em i} & The zonal index of the column to be documented. \\
\hline
\mbox{\texttt{ in}}  & {\em j} & The meridional index of the column to be documented. \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em vm} & The new meridional velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em hin} & The layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em adp} & A structure pointing to the various accelerations in the momentum equations. \\
\hline
\mbox{\texttt{ in}}  & {\em cdp} & A structure with pointers to various terms in the continuity equations. \\
\hline
\mbox{\texttt{ in}}  & {\em dt\+\_\+in\+\_\+t} & The ocean dynamics time step \mbox{[}T $\sim$$>$ s\mbox{]}. \\
\hline
 & {\em cs} & The control structure returned by a previous call to Point\+Accel\+\_\+init. \\
\hline
\mbox{\texttt{ in}}  & {\em vel\+\_\+rpt} & The velocity magnitude that triggers a report \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em str} & The surface wind stress integrated over a time step divided by the Boussinesq density \mbox{[}m2 s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em a} & The layer coupling coefficients from vertvisc \mbox{[}Z s-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em hv} & The layer thicknesses at velocity grid points, \\
\hline
\end{DoxyParams}


Definition at line 401 of file M\+O\+M\+\_\+\+Point\+Accel.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{402   \textcolor{keywordtype}{integer},                     \textcolor{keywordtype}{intent(in)} :: i\textcolor{comment}{   !< The zonal index of the column to be documented.}}
\DoxyCodeLine{403   \textcolor{keywordtype}{integer},                     \textcolor{keywordtype}{intent(in)} :: J\textcolor{comment}{   !< The meridional index of the column to be documented.}}
\DoxyCodeLine{404   \textcolor{keywordtype}{type}(ocean\_grid\_type),       \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{   !< The ocean's grid structure.}}
\DoxyCodeLine{405   \textcolor{keywordtype}{type}(verticalGrid\_type),     \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{  !< The ocean's vertical grid structure.}}
\DoxyCodeLine{406   \textcolor{keywordtype}{type}(unit\_scale\_type),       \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{  !< A dimensional unit scaling type}}
\DoxyCodeLine{407 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{408                                \textcolor{keywordtype}{intent(in)} :: vm\textcolor{comment}{  !< The new meridional velocity [L T-\/1 \string~> m s-\/1].}}
\DoxyCodeLine{409 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{410                                \textcolor{keywordtype}{intent(in)} :: hin\textcolor{comment}{ !< The layer thickness [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{411   \textcolor{keywordtype}{type}(accel\_diag\_ptrs),       \textcolor{keywordtype}{intent(in)} :: ADp\textcolor{comment}{ !< A structure pointing to the various}}
\DoxyCodeLine{412 \textcolor{comment}{                                                 !! accelerations in the momentum equations.}}
\DoxyCodeLine{413   \textcolor{keywordtype}{type}(cont\_diag\_ptrs),        \textcolor{keywordtype}{intent(in)} :: CDp\textcolor{comment}{ !< A structure with pointers to various terms in}}
\DoxyCodeLine{414 \textcolor{comment}{                                                 !! the continuity equations.}}
\DoxyCodeLine{415 \textcolor{keywordtype}{  real},                        \textcolor{keywordtype}{intent(in)} :: dt\_in\_T\textcolor{comment}{  !< The ocean dynamics time step [T \string~> s].}}
\DoxyCodeLine{416   \textcolor{keywordtype}{type}(PointAccel\_CS),         \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{  !< The control structure returned by a previous}}
\DoxyCodeLine{417 \textcolor{comment}{                                                 !! call to PointAccel\_init.}}
\DoxyCodeLine{418 \textcolor{keywordtype}{  real},                        \textcolor{keywordtype}{intent(in)} :: vel\_rpt\textcolor{comment}{ !< The velocity magnitude that triggers a report [L T-\/1 \string~> m s-\/1].}}
\DoxyCodeLine{419 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional},              \textcolor{keywordtype}{intent(in)} :: str\textcolor{comment}{ !< The surface wind stress integrated over a time}}
\DoxyCodeLine{420 \textcolor{comment}{                                                 !! step divided by the Boussinesq density [m2 s-\/1].}}
\DoxyCodeLine{421 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{422                      \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: a\textcolor{comment}{   !< The layer coupling coefficients from vertvisc [Z s-\/1 \string~> m s-\/1].}}
\DoxyCodeLine{423 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{424                      \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: hv\textcolor{comment}{  !< The layer thicknesses at velocity grid points,}}
\DoxyCodeLine{425 \textcolor{comment}{                                                 !! from vertvisc [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{426   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{427 \textcolor{keywordtype}{  real}    :: f\_eff, CFL}
\DoxyCodeLine{428 \textcolor{keywordtype}{  real}    :: Angstrom}
\DoxyCodeLine{429 \textcolor{keywordtype}{  real}    :: truncvel, dv}
\DoxyCodeLine{430 \textcolor{keywordtype}{  real}    :: dt  \textcolor{comment}{! The time step [s]}}
\DoxyCodeLine{431 \textcolor{keywordtype}{  real}    :: Inorm(SZK\_(G))}
\DoxyCodeLine{432 \textcolor{keywordtype}{  real}    :: e(SZK\_(G)+1)}
\DoxyCodeLine{433 \textcolor{keywordtype}{  real}    :: h\_scale, uh\_scale}
\DoxyCodeLine{434   \textcolor{keywordtype}{integer} :: yr, mo, day, hr, minute, sec, yearday}
\DoxyCodeLine{435   \textcolor{keywordtype}{integer} :: k, ks, ke}
\DoxyCodeLine{436   \textcolor{keywordtype}{integer} :: nz}
\DoxyCodeLine{437   \textcolor{keywordtype}{logical} :: do\_k(SZK\_(G)+1)}
\DoxyCodeLine{438   \textcolor{keywordtype}{logical} :: prev\_avail}
\DoxyCodeLine{439   \textcolor{keywordtype}{integer} :: file}
\DoxyCodeLine{440 }
\DoxyCodeLine{441   angstrom = gv\%Angstrom\_H + gv\%H\_subroundoff}
\DoxyCodeLine{442   dt = us\%T\_to\_s*dt\_in\_t}
\DoxyCodeLine{443   h\_scale = gv\%H\_to\_m ; uh\_scale = gv\%H\_to\_m*us\%L\_T\_to\_m\_s}
\DoxyCodeLine{444 }
\DoxyCodeLine{445 \textcolor{comment}{!  if (.not.associated(CS)) return}}
\DoxyCodeLine{446   nz = g\%ke}
\DoxyCodeLine{447   \textcolor{keywordflow}{if} (cs\%cols\_written < cs\%max\_writes) \textcolor{keywordflow}{then}}
\DoxyCodeLine{448     cs\%cols\_written = cs\%cols\_written + 1}
\DoxyCodeLine{449 }
\DoxyCodeLine{450     ks = 1 ; ke = nz}
\DoxyCodeLine{451     do\_k(:) = .false.}
\DoxyCodeLine{452 }
\DoxyCodeLine{453   \textcolor{comment}{! Open up the file for output if this is the first call.}}
\DoxyCodeLine{454     \textcolor{keywordflow}{if} (cs\%v\_file < 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{455       \textcolor{keywordflow}{if} (len\_trim(cs\%v\_trunc\_file) < 1) \textcolor{keywordflow}{return}}
\DoxyCodeLine{456       \textcolor{keyword}{call }open\_file(cs\%v\_file, trim(cs\%v\_trunc\_file), action=append\_file, \&}
\DoxyCodeLine{457                      form=ascii\_file, threading=multiple, fileset=single\_file)}
\DoxyCodeLine{458       \textcolor{keywordflow}{if} (cs\%v\_file < 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{459         \textcolor{keyword}{call }mom\_error(note, \textcolor{stringliteral}{'Unable to open file '}//trim(cs\%v\_trunc\_file)//\textcolor{stringliteral}{'.'})}
\DoxyCodeLine{460         \textcolor{keywordflow}{return}}
\DoxyCodeLine{461 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{462 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{463     file = cs\%v\_file}
\DoxyCodeLine{464 }
\DoxyCodeLine{465     prev\_avail = (\textcolor{keyword}{associated}(cs\%u\_prev) .and. \textcolor{keyword}{associated}(cs\%v\_prev))}
\DoxyCodeLine{466 }
\DoxyCodeLine{467     \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{468       \textcolor{keywordflow}{if} (((max(cs\%v\_av(i,j,k), vm(i,j,k)) >= vel\_rpt) .or. \&}
\DoxyCodeLine{469            (min(cs\%v\_av(i,j,k), vm(i,j,k)) <= -\/vel\_rpt)) .and. \&}
\DoxyCodeLine{470           ((hin(i,j,k) + hin(i,j+1,k)) > 3.0*angstrom)) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{471 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{472     ks = k}
\DoxyCodeLine{473     \textcolor{keywordflow}{do} k=nz,1,-\/1}
\DoxyCodeLine{474       \textcolor{keywordflow}{if} (((max(cs\%v\_av(i,j,k), vm(i,j,k)) >= vel\_rpt) .or. \&}
\DoxyCodeLine{475            (min(cs\%v\_av(i,j,k), vm(i,j,k)) <= -\/vel\_rpt)) .and. \&}
\DoxyCodeLine{476           ((hin(i,j,k) + hin(i,j+1,k)) > 3.0*angstrom)) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{477 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{478     ke = k}
\DoxyCodeLine{479     \textcolor{keywordflow}{if} (ke < ks) \textcolor{keywordflow}{then}}
\DoxyCodeLine{480       ks = 1; ke = nz; \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'("{}V: Unable to set ks \& ke."{})'})}
\DoxyCodeLine{481 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{482 }
\DoxyCodeLine{483     \textcolor{keyword}{call }get\_date(cs\%Time, yr, mo, day, hr, minute, sec)}
\DoxyCodeLine{484     \textcolor{keyword}{call }get\_time((cs\%Time -\/ set\_date(yr, 1, 1, 0, 0, 0)), sec, yearday)}
\DoxyCodeLine{485     \textcolor{keyword}{write} (file,\textcolor{stringliteral}{'(/,"{}-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/"{})'})}
\DoxyCodeLine{486     \textcolor{keyword}{write} (file,\textcolor{stringliteral}{'(/,"{}Time "{},i5,i4,F6.2,"{} V-\/velocity violation at "{},I4,"{}: "{},2(I3), \&}}
\DoxyCodeLine{487 \textcolor{stringliteral}{}\textcolor{stringliteral}{        \& "{} ("{},F7.2,"{} E "{},F7.2,"{} N) Layers "{},I3,"{} to "{},I3,"{}. dt = "{},1PG10.4)'}) \&}
\DoxyCodeLine{488         yr, yearday, (real(sec)/3600.0), pe\_here(), i, j, \&}
\DoxyCodeLine{489         g\%geoLonCv(i,j), g\%geoLatCv(i,j), ks, ke, dt}
\DoxyCodeLine{490 }
\DoxyCodeLine{491     \textcolor{keywordflow}{if} (ks <= gv\%nk\_rho\_varies) ks = 1}
\DoxyCodeLine{492     \textcolor{keywordflow}{do} k=ks,ke}
\DoxyCodeLine{493       \textcolor{keywordflow}{if} ((hin(i,j,k) + hin(i,j+1,k)) > 3.0*angstrom) do\_k(k) = .true.}
\DoxyCodeLine{494 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{495 }
\DoxyCodeLine{496     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}Layers:"{},\$)'})}
\DoxyCodeLine{497     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(I10,"{} "{},\$)'}) (k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{498     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}v(m):  "{},\$)'})}
\DoxyCodeLine{499     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (us\%L\_T\_to\_m\_s*vm(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{500 }
\DoxyCodeLine{501     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{502       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}v(mp): "{},\$)'})}
\DoxyCodeLine{503       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (us\%L\_T\_to\_m\_s*cs\%v\_prev(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{504 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{505 }
\DoxyCodeLine{506     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}v(3):  "{},\$)'})}
\DoxyCodeLine{507     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (us\%L\_T\_to\_m\_s*cs\%v\_av(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{508     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}CFL v: "{},\$)'})}
\DoxyCodeLine{509     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{510       cfl = abs(vm(i,j,k)) * us\%s\_to\_T*dt * g\%dx\_Cv(i,j)}
\DoxyCodeLine{511       \textcolor{keywordflow}{if} (vm(i,j,k) < 0.0) \textcolor{keywordflow}{then} ; cfl = cfl * g\%IareaT(i,j+1)}
\DoxyCodeLine{512       \textcolor{keywordflow}{else} ; cfl = cfl * g\%IareaT(i,j) ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{513       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cfl}
\DoxyCodeLine{514 \textcolor{keywordflow}{    endif} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{515     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}CFL0 v:"{},\$)'})}
\DoxyCodeLine{516     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{517                                     abs(vm(i,j,k)) * us\%s\_to\_T*dt * g\%IdyCv(i,j) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{518 }
\DoxyCodeLine{519     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{520       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}dv:    "{},\$)'})}
\DoxyCodeLine{521       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{522                                       (us\%L\_T\_to\_m\_s*(vm(i,j,k)-\/cs\%v\_prev(i,j,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{523 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{524 }
\DoxyCodeLine{525     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}CAv:   "{},\$)'})}
\DoxyCodeLine{526     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (dt*us\%L\_T2\_to\_m\_s2*adp\%CAv(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{527 }
\DoxyCodeLine{528     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}PFv:   "{},\$)'})}
\DoxyCodeLine{529     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (dt*us\%L\_T2\_to\_m\_s2*adp\%PFv(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{530 }
\DoxyCodeLine{531     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}diffv: "{},\$)'})}
\DoxyCodeLine{532     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) (dt*us\%L\_T2\_to\_m\_s2*adp\%diffv(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{533 }
\DoxyCodeLine{534     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%gradKEv)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{535       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}KEv:   "{},\$)'})}
\DoxyCodeLine{536       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{537                                       (dt*us\%L\_T2\_to\_m\_s2*adp\%gradKEv(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{538 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{539     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%rv\_x\_u)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{540       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}Corv:  "{},\$)'})}
\DoxyCodeLine{541       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{542                                  dt*us\%L\_T2\_to\_m\_s2*(adp\%CAv(i,j,k)-\/adp\%rv\_x\_u(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{543 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{544     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%dv\_dt\_visc)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{545       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}vbv:   "{},\$)'})}
\DoxyCodeLine{546       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{547           us\%L\_T\_to\_m\_s*(vm(i,j,k) -\/ us\%s\_to\_T*dt*adp\%dv\_dt\_visc(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{548 }
\DoxyCodeLine{549       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}dvv:   "{},\$)'})}
\DoxyCodeLine{550       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{551                                       (dt*us\%L\_T2\_to\_m\_s2*adp\%dv\_dt\_visc(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{552 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{553     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%dv\_other)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{554       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}dv\_other: "{},\$)'})}
\DoxyCodeLine{555       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{556                                       (us\%L\_T\_to\_m\_s*adp\%dv\_other(i,j,k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{557 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{558     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(a)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{559       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}a:     "{},\$)'})}
\DoxyCodeLine{560       \textcolor{keywordflow}{do} k=ks,ke+1 ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) a(i,j,k)*us\%Z\_to\_m*dt;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{561 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{562     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(hv)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{563       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}hvel:  "{},\$)'})}
\DoxyCodeLine{564       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) hv(i,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{565 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{566     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}Stress:  "{},ES10.3)'}) str}
\DoxyCodeLine{567 }
\DoxyCodeLine{568     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%v\_accel\_bt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{569       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'("{}dvbt:  "{},\$)'})}
\DoxyCodeLine{570       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{571                                       (dt*us\%L\_T2\_to\_m\_s2*cs\%v\_accel\_bt(i,j,k)) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{572       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/)'})}
\DoxyCodeLine{573 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{574 }
\DoxyCodeLine{575     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'("{}h-\/-\/:   "{},\$)'})}
\DoxyCodeLine{576     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) h\_scale*hin(i-\/1,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{577     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}h0-\/:   "{},\$)'})}
\DoxyCodeLine{578     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) h\_scale*hin(i,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{579     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}h+-\/:   "{},\$)'})}
\DoxyCodeLine{580     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) h\_scale*hin(i+1,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{581     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}h-\/+:   "{},\$)'})}
\DoxyCodeLine{582     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) h\_scale*hin(i-\/1,j+1,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{583     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}h0+:   "{},\$)'})}
\DoxyCodeLine{584     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) h\_scale*hin(i,j+1,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{585     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}h++:   "{},\$)'})}
\DoxyCodeLine{586     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) h\_scale*hin(i+1,j+1,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{587 }
\DoxyCodeLine{588     e(nz+1) = -\/us\%Z\_to\_m*g\%bathyT(i,j)}
\DoxyCodeLine{589     \textcolor{keywordflow}{do} k=nz,1,-\/1 ; e(k) = e(k+1) + h\_scale*hin(i,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{590     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}e-\/:    "{},\$)'})}
\DoxyCodeLine{591     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) e(ks)}
\DoxyCodeLine{592     \textcolor{keywordflow}{do} k=ks+1,ke+1 ; \textcolor{keywordflow}{if} (do\_k(k-\/1)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) e(k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{593 }
\DoxyCodeLine{594     e(nz+1) = -\/us\%Z\_to\_m*g\%bathyT(i,j+1)}
\DoxyCodeLine{595     \textcolor{keywordflow}{do} k=nz,1,-\/1 ; e(k) = e(k+1) + h\_scale*hin(i,j+1,k) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{596     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}e+:    "{},\$)'})}
\DoxyCodeLine{597     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) e(ks)}
\DoxyCodeLine{598     \textcolor{keywordflow}{do} k=ks+1,ke+1 ; \textcolor{keywordflow}{if} (do\_k(k-\/1)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) e(k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{599     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%T)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{600       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}T-\/:    "{},\$)'})}
\DoxyCodeLine{601       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%T(i,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{602       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}T+:    "{},\$)'})}
\DoxyCodeLine{603       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%T(i,j+1,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{604 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{605     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%S)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{606       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}S-\/:    "{},\$)'})}
\DoxyCodeLine{607       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%S(i,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{608       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}S+:    "{},\$)'})}
\DoxyCodeLine{609       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%S(i,j+1,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{610 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{611 }
\DoxyCodeLine{612     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{613       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}u-\/-\/:   "{},\$)'})}
\DoxyCodeLine{614       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%u\_prev(i-\/1,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{615       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}u-\/+:   "{},\$)'})}
\DoxyCodeLine{616       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%u\_prev(i-\/1,j+1,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{617       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}u+-\/:   "{},\$)'})}
\DoxyCodeLine{618       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%u\_prev(i,j,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{619       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}u++:   "{},\$)'})}
\DoxyCodeLine{620       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) cs\%u\_prev(i,j+1,k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{621 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{622 }
\DoxyCodeLine{623     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}uh-\/-\/:  "{},\$)'})}
\DoxyCodeLine{624     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{625                                     (uh\_scale*cdp\%uh(i-\/1,j,k)*g\%IdyCu(i-\/1,j));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{626     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} uhC-\/-\/: "{},\$)'})}
\DoxyCodeLine{627     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{628             (us\%L\_T\_to\_m\_s*cs\%u\_av(i-\/1,j,k) * h\_scale*0.5*(hin(i-\/1,j,k) + hin(i,j,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{629     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{630       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} uhCp-\/-\/:"{},\$)'})}
\DoxyCodeLine{631       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{632             (cs\%u\_prev(i-\/1,j,k) * h\_scale*0.5*(hin(i-\/1,j,k) + hin(i,j,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{633 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{634 }
\DoxyCodeLine{635     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}uh-\/+:  "{},\$)'})}
\DoxyCodeLine{636     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{637                                     (uh\_scale*cdp\%uh(i-\/1,j+1,k)*g\%IdyCu(i-\/1,j+1));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{638     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} uhC-\/+: "{},\$)'})}
\DoxyCodeLine{639     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{640             (us\%L\_T\_to\_m\_s*cs\%u\_av(i-\/1,j+1,k) * h\_scale*0.5*(hin(i-\/1,j+1,k) + hin(i,j+1,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{641     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{642       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} uhCp-\/+:"{},\$)'})}
\DoxyCodeLine{643       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{644             (cs\%u\_prev(i-\/1,j+1,k) * h\_scale*0.5*(hin(i-\/1,j+1,k) + hin(i,j+1,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{645 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{646 }
\DoxyCodeLine{647     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}uh+-\/:  "{},\$)'})}
\DoxyCodeLine{648     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{649                                     (uh\_scale*cdp\%uh(i,j,k)*g\%IdyCu(i,j));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{650     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} uhC+-\/: "{},\$)'})}
\DoxyCodeLine{651     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{652             (us\%L\_T\_to\_m\_s*cs\%u\_av(i,j,k) * h\_scale*0.5*(hin(i,j,k) + hin(i+1,j,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{653     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{654       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} uhCp+-\/:"{},\$)'})}
\DoxyCodeLine{655       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{656             (cs\%u\_prev(i,j,k) * h\_scale*0.5*(hin(i,j,k) + hin(i+1,j,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{657 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{658 }
\DoxyCodeLine{659     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}uh++:  "{},\$)'})}
\DoxyCodeLine{660     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{661                                     (uh\_scale*cdp\%uh(i,j+1,k)*g\%IdyCu(i,j+1));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{662     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} uhC++: "{},\$)'})}
\DoxyCodeLine{663     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{664             (us\%L\_T\_to\_m\_s*cs\%u\_av(i,j+1,k) * 0.5*h\_scale*(hin(i,j+1,k) + hin(i+1,j+1,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{665     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{666       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{} uhCp++:"{},\$)'})}
\DoxyCodeLine{667       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(ES10.3,"{} "{},\$)'}) \&}
\DoxyCodeLine{668             (cs\%u\_prev(i,j+1,k) * h\_scale*0.5*(hin(i,j+1,k) + hin(i+1,j+1,k)));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{669 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{670 }
\DoxyCodeLine{671     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}D:     "{},2(ES10.3))'}) us\%Z\_to\_m*g\%bathyT(i,j),us\%Z\_to\_m*g\%bathyT(i,j+1)}
\DoxyCodeLine{672 }
\DoxyCodeLine{673   \textcolor{comment}{!  From here on, the normalized accelerations are written.}}
\DoxyCodeLine{674     \textcolor{keywordflow}{if} (prev\_avail) \textcolor{keywordflow}{then}}
\DoxyCodeLine{675       \textcolor{keywordflow}{do} k=ks,ke}
\DoxyCodeLine{676         dv = us\%L\_T\_to\_m\_s*(vm(i,j,k)-\/cs\%v\_prev(i,j,k))}
\DoxyCodeLine{677         \textcolor{keywordflow}{if} (abs(dv) < 1.0e-\/6) dv = 1.0e-\/6}
\DoxyCodeLine{678         inorm(k) = 1.0 / dv}
\DoxyCodeLine{679 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{680 }
\DoxyCodeLine{681       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(2/,"{}Norm:  "{},\$)'})}
\DoxyCodeLine{682       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) (1.0/inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{683       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}dv:    "{},\$)'})}
\DoxyCodeLine{684       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{685                                       (us\%L\_T\_to\_m\_s*(vm(i,j,k)-\/cs\%v\_prev(i,j,k))*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{686       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}CAv:   "{},\$)'})}
\DoxyCodeLine{687       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{688                                       (dt*us\%L\_T2\_to\_m\_s2*adp\%CAv(i,j,k)*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{689       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}PFv:   "{},\$)'})}
\DoxyCodeLine{690       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{691                                       (dt*us\%L\_T2\_to\_m\_s2*adp\%PFv(i,j,k)*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{692       \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}diffv: "{},\$)'})}
\DoxyCodeLine{693       \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{694                                       (dt*us\%L\_T2\_to\_m\_s2*adp\%diffv(i,j,k)*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{695 }
\DoxyCodeLine{696       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%gradKEu)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{697         \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}KEv:   "{},\$)'})}
\DoxyCodeLine{698         \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{699                                       (dt*us\%L\_T2\_to\_m\_s2*adp\%gradKEv(i,j,k)*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{700 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{701       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%rv\_x\_u)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{702         \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}Corv:  "{},\$)'})}
\DoxyCodeLine{703         \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{704             dt*us\%L\_T2\_to\_m\_s2*(adp\%CAv(i,j,k)-\/adp\%rv\_x\_u(i,j,k))*inorm(k);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{705 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{706       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%dv\_dt\_visc)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{707         \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}dvv:   "{},\$)'})}
\DoxyCodeLine{708         \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{709             (dt*us\%L\_T2\_to\_m\_s2*adp\%dv\_dt\_visc(i,j,k)*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{710 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{711       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(adp\%dv\_other)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{712         \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}dv\_other: "{},\$)'})}
\DoxyCodeLine{713         \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{714             (us\%L\_T\_to\_m\_s*adp\%dv\_other(i,j,k)*inorm(k));\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{715 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{716       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%v\_accel\_bt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{717         \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(/,"{}dvbt:  "{},\$)'})}
\DoxyCodeLine{718         \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{if} (do\_k(k)) \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(F10.6,"{} "{},\$)'}) \&}
\DoxyCodeLine{719                                         (dt*us\%L\_T2\_to\_m\_s2*cs\%v\_accel\_bt(i,j,k)*inorm(k)) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{720 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{721 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{722 }
\DoxyCodeLine{723     \textcolor{keyword}{write}(file,\textcolor{stringliteral}{'(2/)'})}
\DoxyCodeLine{724 }
\DoxyCodeLine{725     \textcolor{keyword}{call }flush(file)}
\DoxyCodeLine{726 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{727 }

\end{DoxyCode}
