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


\subsection{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. \subsection*{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}
\subsection*{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}


\subsection{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}}
\subsubsection{\texorpdfstring{pointaccel\+\_\+init()}{pointaccel\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+pointaccel\+::pointaccel\+\_\+init (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+internal\+\_\+state), intent(in), target}]{M\+IS,  }\item[{type(time\+\_\+type), intent(in), target}]{Time,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(diag\+\_\+ctrl), intent(inout), target}]{diag,  }\item[{type(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{\tt in}  & {\em mis} & For \char`\"{}\+M\+O\+M Internal State\char`\"{} a set of pointers\\
\hline
\mbox{\tt in}  & {\em time} & The current model time.\\
\hline
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure.\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters.\\
\hline
\mbox{\tt in,out}  & {\em diag} & A structure that is used to regulate diagnostic output.\\
\hline
\mbox{\tt 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 732 of file M\+O\+M\+\_\+\+Point\+Accel.\+F90.


\begin{DoxyCode}
732   \textcolor{keywordtype}{type}(ocean\_internal\_state), &
733                         \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)}    :: MIS\textcolor{comment}{  !< For "MOM Internal State" a set of pointers}
734 \textcolor{comment}{                                                      !! to the fields and accelerations that make}
735 \textcolor{comment}{                                                      !! up the ocean's physical state.}
736   \textcolor{keywordtype}{type}(time\_type),      \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)}    :: Time\textcolor{comment}{ !< The current model time.}
737   \textcolor{keywordtype}{type}(ocean\_grid\_type),        \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{    !< The ocean's grid structure.}
738   \textcolor{keywordtype}{type}(param\_file\_type),        \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< A structure to parse for run-time}
739 \textcolor{comment}{                                                      !! parameters.}
740   \textcolor{keywordtype}{type}(diag\_ctrl),      \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{ !< A structure that is used to regulate}
741 \textcolor{comment}{                                                      !! diagnostic output.}
742   \textcolor{keywordtype}{type}(directories),            \textcolor{keywordtype}{intent(in)}    :: dirs\textcolor{comment}{ !< A structure containing several relevant}
743 \textcolor{comment}{                                                      !! directory paths.}
744   \textcolor{keywordtype}{type}(PointAccel\_CS),          \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{   !< A pointer that is set to point to the}
745 \textcolor{comment}{                                                      !! control structure for this module.}
746 \textcolor{comment}{! This include declares and sets the variable "version".}
747 \textcolor{preprocessor}{#include "version\_variable.h"}
748 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_PointAccel"} \textcolor{comment}{! This module's name.}
749 
750   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
751   \textcolor{keyword}{allocate}(cs)
752 
753   cs%diag => diag ; cs%Time => time
754 
755   cs%T => mis%T ; cs%S => mis%S ; cs%pbce => mis%pbce
756   cs%u\_accel\_bt => mis%u\_accel\_bt ; cs%v\_accel\_bt => mis%v\_accel\_bt
757   cs%u\_prev => mis%u\_prev ; cs%v\_prev => mis%v\_prev
758   cs%u\_av => mis%u\_av; \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(mis%u\_av)) cs%u\_av => mis%u(:,:,:)
759   cs%v\_av => mis%v\_av; \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(mis%v\_av)) cs%v\_av => mis%v(:,:,:)
760 
761   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}
762   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""}, debugging=.true.)
763   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"U\_TRUNC\_FILE"}, cs%u\_trunc\_file, &
764                  \textcolor{stringliteral}{"The absolute path to the file where the accelerations "}//&
765                  \textcolor{stringliteral}{"leading to zonal velocity truncations are written. \(\backslash\)n"}//&
766                  \textcolor{stringliteral}{"Leave this empty for efficiency if this diagnostic is "}//&
767                  \textcolor{stringliteral}{"not needed."}, default=\textcolor{stringliteral}{""}, debuggingparam=.true.)
768   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"V\_TRUNC\_FILE"}, cs%v\_trunc\_file, &
769                  \textcolor{stringliteral}{"The absolute path to the file where the accelerations "}//&
770                  \textcolor{stringliteral}{"leading to meridional velocity truncations are written. \(\backslash\)n"}//&
771                  \textcolor{stringliteral}{"Leave this empty for efficiency if this diagnostic is "}//&
772                  \textcolor{stringliteral}{"not needed."}, default=\textcolor{stringliteral}{""}, debuggingparam=.true.)
773   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MAX\_TRUNC\_FILE\_SIZE\_PER\_PE"}, cs%max\_writes, &
774                  \textcolor{stringliteral}{"The maximum number of columns of truncations that any PE "}//&
775                  \textcolor{stringliteral}{"will write out during a run."}, default=50, debuggingparam=.true.)
776 
777   \textcolor{keywordflow}{if} (len\_trim(dirs%output\_directory) > 0) \textcolor{keywordflow}{then}
778     \textcolor{keywordflow}{if} (len\_trim(cs%u\_trunc\_file) > 0) &
779       cs%u\_trunc\_file = trim(dirs%output\_directory)//trim(cs%u\_trunc\_file)
780     \textcolor{keywordflow}{if} (len\_trim(cs%v\_trunc\_file) > 0) &
781       cs%v\_trunc\_file = trim(dirs%output\_directory)//trim(cs%v\_trunc\_file)
782     \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"output\_dir/U\_TRUNC\_FILE"}, cs%u\_trunc\_file, debuggingparam=.true.)
783     \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"output\_dir/V\_TRUNC\_FILE"}, cs%v\_trunc\_file, debuggingparam=.true.)
784 \textcolor{keywordflow}{  endif}
785   cs%u\_file = -1 ; cs%v\_file = -1 ; cs%cols\_written = 0
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}}
\subsubsection{\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(accel\+\_\+diag\+\_\+ptrs), intent(in)}]{A\+Dp,  }\item[{type(cont\+\_\+diag\+\_\+ptrs), intent(in)}]{C\+Dp,  }\item[{real, intent(in)}]{dt\+\_\+in\+\_\+T,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{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{\tt in}  & {\em i} & The zonal index of the column to be documented.\\
\hline
\mbox{\tt in}  & {\em j} & The meridional index of the column to be documented.\\
\hline
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure.\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em um} & The new zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em hin} & The layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em adp} & A structure pointing to the various accelerations in the momentum equations.\\
\hline
\mbox{\tt in}  & {\em cdp} & A structure with pointers to various terms in the continuity equations.\\
\hline
\mbox{\tt 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{\tt in}  & {\em vel\+\_\+rpt} & The velocity magnitude that triggers a report \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em str} & The surface wind stress integrated over a time step divided by the Boussinesq density \mbox{[}m2 s-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em a} & The layer coupling coefficients from vertvisc \mbox{[}Z s-\/1 $\sim$$>$ m s-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em hv} & The layer thicknesses at velocity grid points, \\
\hline
\end{DoxyParams}


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


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


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


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