\hypertarget{namespacemom__checksum__packages}{}\section{mom\+\_\+checksum\+\_\+packages Module Reference}
\label{namespacemom__checksum__packages}\index{mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}}


\subsection{Detailed Description}
Provides routines that do checksums of groups of M\+OM variables. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
interface \hyperlink{interfacemom__checksum__packages_1_1mom__state__chksum}{mom\+\_\+state\+\_\+chksum}
\begin{DoxyCompactList}\small\item\em Write out checksums of the M\+O\+M6 state variables. \end{DoxyCompactList}\item 
type \hyperlink{structmom__checksum__packages_1_1stats}{stats}
\begin{DoxyCompactList}\small\item\em A type for storing statistica about a variable. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{namespacemom__checksum__packages_a37164032fcd0a881c8c6d03fdc2c2028}{mom\+\_\+state\+\_\+chksum\+\_\+5arg} (mesg, u, v, h, uh, vh, G, GV, US, haloshift, symmetric, vel\+\_\+scale)
\begin{DoxyCompactList}\small\item\em Write out chksums for the model\textquotesingle{}s basic state variables, including transports. \end{DoxyCompactList}\item 
subroutine \hyperlink{namespacemom__checksum__packages_abe6d83a86e9140978554611cc86beaef}{mom\+\_\+state\+\_\+chksum\+\_\+3arg} (mesg, u, v, h, G, GV, US, haloshift, symmetric)
\begin{DoxyCompactList}\small\item\em Write out chksums for the model\textquotesingle{}s basic state variables. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__checksum__packages_a4deb4c81b07de30df5c0e719849a4ef6}{mom\+\_\+thermo\+\_\+chksum} (mesg, tv, G, US, haloshift)
\begin{DoxyCompactList}\small\item\em Write out chksums for the model\textquotesingle{}s thermodynamic state variables. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__checksum__packages_a08ce62d457cefb539b6919601ca70a75}{mom\+\_\+surface\+\_\+chksum} (mesg, sfc\+\_\+state, G, US, haloshift, symmetric)
\begin{DoxyCompactList}\small\item\em Write out chksums for the ocean surface variables. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__checksum__packages_ab65c45c111975e2804be7a008e3c17c7}{mom\+\_\+accel\+\_\+chksum} (mesg, C\+Au, C\+Av, P\+Fu, P\+Fv, diffu, diffv, G, GV, US, pbce, u\+\_\+accel\+\_\+bt, v\+\_\+accel\+\_\+bt, symmetric)
\begin{DoxyCompactList}\small\item\em Write out chksums for the model\textquotesingle{}s accelerations. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__checksum__packages_a6d09d11c188659dd5ebd0b36fc42aa2b}{mom\+\_\+state\+\_\+stats} (mesg, u, v, h, Temp, Salt, G, GV, US, allow\+Change, permit\+Diminishing)
\begin{DoxyCompactList}\small\item\em Monitor and write out statistics for the model\textquotesingle{}s state variables. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__checksum__packages_ab65c45c111975e2804be7a008e3c17c7}\label{namespacemom__checksum__packages_ab65c45c111975e2804be7a008e3c17c7}} 
\index{mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}!mom\+\_\+accel\+\_\+chksum@{mom\+\_\+accel\+\_\+chksum}}
\index{mom\+\_\+accel\+\_\+chksum@{mom\+\_\+accel\+\_\+chksum}!mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}}
\subsubsection{\texorpdfstring{mom\+\_\+accel\+\_\+chksum()}{mom\_accel\_chksum()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+checksum\+\_\+packages\+::mom\+\_\+accel\+\_\+chksum (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{mesg,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{C\+Au,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in)}]{C\+Av,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{P\+Fu,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in)}]{P\+Fv,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{diffu,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in)}]{diffv,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in), optional}]{pbce,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in), optional}]{u\+\_\+accel\+\_\+bt,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in), optional}]{v\+\_\+accel\+\_\+bt,  }\item[{logical, intent(in), optional}]{symmetric }\end{DoxyParamCaption})}



Write out chksums for the model\textquotesingle{}s accelerations. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em mesg} & A message that appears on the chksum lines.\\
\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 cau} & Zonal acceleration due to Coriolis\\
\hline
\mbox{\tt in}  & {\em cav} & Meridional acceleration due to Coriolis\\
\hline
\mbox{\tt in}  & {\em pfu} & Zonal acceleration due to pressure gradients\\
\hline
\mbox{\tt in}  & {\em pfv} & Meridional acceleration due to pressure gradients\\
\hline
\mbox{\tt in}  & {\em diffu} & Zonal acceleration due to convergence of the\\
\hline
\mbox{\tt in}  & {\em diffv} & Meridional acceleration due to convergence of\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em pbce} & The baroclinic pressure anomaly in each layer\\
\hline
\mbox{\tt in}  & {\em u\+\_\+accel\+\_\+bt} & The zonal acceleration from terms in the\\
\hline
\mbox{\tt in}  & {\em v\+\_\+accel\+\_\+bt} & The meridional acceleration from terms in\\
\hline
\mbox{\tt in}  & {\em symmetric} & If true, do checksums on the fully symmetric computational domain. \\
\hline
\end{DoxyParams}


Definition at line 182 of file M\+O\+M\+\_\+checksum\+\_\+packages.\+F90.


\begin{DoxyCode}
182   \textcolor{keywordtype}{character(len=*)},         \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{ !< A message that appears on the chksum lines.}
183   \textcolor{keywordtype}{type}(ocean\_grid\_type),    \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{    !< The ocean's grid structure.}
184   \textcolor{keywordtype}{type}(verticalgrid\_type),  \textcolor{keywordtype}{intent(in)} :: gv\textcolor{comment}{   !< The ocean's vertical grid structure.}
185   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, &
186                             \textcolor{keywordtype}{intent(in)} :: cau\textcolor{comment}{  !< Zonal acceleration due to Coriolis}
187 \textcolor{comment}{                                               !! and momentum advection terms [L T-2 ~> m s-2].}
188   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, &
189                             \textcolor{keywordtype}{intent(in)} :: cav\textcolor{comment}{  !< Meridional acceleration due to Coriolis}
190 \textcolor{comment}{                                               !! and momentum advection terms [L T-2 ~> m s-2].}
191   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, &
192                             \textcolor{keywordtype}{intent(in)} :: pfu\textcolor{comment}{  !< Zonal acceleration due to pressure gradients}
193 \textcolor{comment}{                                               !! (equal to -dM/dx) [L T-2 ~> m s-2].}
194   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, &
195                             \textcolor{keywordtype}{intent(in)} :: pfv\textcolor{comment}{  !< Meridional acceleration due to pressure gradients}
196 \textcolor{comment}{                                               !! (equal to -dM/dy) [L T-2 ~> m s-2].}
197   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, &
198                             \textcolor{keywordtype}{intent(in)} :: diffu\textcolor{comment}{ !< Zonal acceleration due to convergence of the}
199 \textcolor{comment}{                                                !! along-isopycnal stress tensor [L T-2 ~> m s-2].}
200   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, &
201                             \textcolor{keywordtype}{intent(in)} :: diffv\textcolor{comment}{ !< Meridional acceleration due to convergence of}
202 \textcolor{comment}{                                                !! the along-isopycnal stress tensor [L T-2 ~> m s-2].}
203   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)} :: us\textcolor{comment}{    !< A dimensional unit scaling type}
204   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  &
205                   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: pbce\textcolor{comment}{ !< The baroclinic pressure anomaly in each layer}
206 \textcolor{comment}{                                               !! due to free surface height anomalies}
207 \textcolor{comment}{                                               !! [L2 T-2 H-1 ~> m s-2 or m4 s-2 kg-1].}
208   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, &
209                   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: u\_accel\_bt\textcolor{comment}{ !< The zonal acceleration from terms in the}
210 \textcolor{comment}{                                                     !! barotropic solver [L T-2 ~> m s-2].}
211   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, &
212                   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: v\_accel\_bt\textcolor{comment}{ !< The meridional acceleration from terms in}
213 \textcolor{comment}{                                                     !! the barotropic solver [L T-2 ~> m s-2].}
214   \textcolor{keywordtype}{logical},        \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: symmetric\textcolor{comment}{ !< If true, do checksums on the fully symmetric}
215 \textcolor{comment}{                                                    !! computational domain.}
216 
217   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz
218   \textcolor{keywordtype}{logical} :: sym
219 
220   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
221   sym=.false.; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(symmetric)) sym=symmetric
222 
223   \textcolor{comment}{! Note that for the chksum calls to be useful for reproducing across PE}
224   \textcolor{comment}{! counts, there must be no redundant points, so all variables use is..ie}
225   \textcolor{comment}{! and js...je as their extent.}
226   \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" CA[uv]"}, cau, cav, g%HI, haloshift=0, symmetric=sym, scale=us%L\_T2\_to\_m\_s2)
227   \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" PF[uv]"}, pfu, pfv, g%HI, haloshift=0, symmetric=sym, scale=us%L\_T2\_to\_m\_s2)
228   \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" diffu"}, diffu, diffv, g%HI,haloshift=0, symmetric=sym, scale=us%L\_T2\_to\_m\_s2)
229   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(pbce)) &
230     \textcolor{keyword}{call }hchksum(pbce, mesg//\textcolor{stringliteral}{" pbce"},g%HI,haloshift=0, scale=gv%m\_to\_H*us%L\_T\_to\_m\_s**2)
231   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(u\_accel\_bt) .and. \textcolor{keyword}{present}(v\_accel\_bt)) &
232     \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" [uv]\_accel\_bt"}, u\_accel\_bt, v\_accel\_bt, g%HI,haloshift=0, symmetric=sym, &
233                   scale=us%L\_T2\_to\_m\_s2)
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__checksum__packages_abe6d83a86e9140978554611cc86beaef}\label{namespacemom__checksum__packages_abe6d83a86e9140978554611cc86beaef}} 
\index{mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}!mom\+\_\+state\+\_\+chksum\+\_\+3arg@{mom\+\_\+state\+\_\+chksum\+\_\+3arg}}
\index{mom\+\_\+state\+\_\+chksum\+\_\+3arg@{mom\+\_\+state\+\_\+chksum\+\_\+3arg}!mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}}
\subsubsection{\texorpdfstring{mom\+\_\+state\+\_\+chksum\+\_\+3arg()}{mom\_state\_chksum\_3arg()}}
{\footnotesize\ttfamily subroutine mom\+\_\+checksum\+\_\+packages\+::mom\+\_\+state\+\_\+chksum\+\_\+3arg (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{mesg,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{u,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in)}]{v,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US,  }\item[{integer, intent(in), optional}]{haloshift,  }\item[{logical, intent(in), optional}]{symmetric }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Write out chksums for the model\textquotesingle{}s basic state variables. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em mesg} & A message that appears on the chksum lines.\\
\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 u} & Zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} or \mbox{[}m s-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em v} & Meridional velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} or \mbox{[}m s-\/1\mbox{]}..\\
\hline
\mbox{\tt in}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type, which is used to rescale u and v if present.\\
\hline
\mbox{\tt in}  & {\em haloshift} & The width of halos to check (default 0).\\
\hline
\mbox{\tt in}  & {\em symmetric} & If true, do checksums on the fully symmetric computational domain. \\
\hline
\end{DoxyParams}


Definition at line 87 of file M\+O\+M\+\_\+checksum\+\_\+packages.\+F90.


\begin{DoxyCode}
87   \textcolor{keywordtype}{character(len=*)},                \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{ !< A message that appears on the chksum lines.}
88   \textcolor{keywordtype}{type}(ocean\_grid\_type),           \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{  !< The ocean's grid structure.}
89   \textcolor{keywordtype}{type}(verticalgrid\_type),         \textcolor{keywordtype}{intent(in)} :: gv\textcolor{comment}{ !< The ocean's vertical grid structure.}
90   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, &
91                                    \textcolor{keywordtype}{intent(in)} :: u\textcolor{comment}{  !< Zonal velocity [L T-1 ~> m s-1] or [m s-1].}
92   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, &
93                                    \textcolor{keywordtype}{intent(in)} :: v\textcolor{comment}{  !< Meridional velocity [L T-1 ~> m s-1] or [m s-1]..}
94   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  &
95                                    \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{  !< Layer thicknesses [H ~> m or kg m-2].}
96   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: us\textcolor{comment}{ !< A dimensional unit scaling type, which is}
97 \textcolor{comment}{                                                    !! used to rescale u and v if present.}
98   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: haloshift\textcolor{comment}{ !< The width of halos to check (default 0).}
99   \textcolor{keywordtype}{logical},               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: symmetric\textcolor{comment}{ !< If true, do checksums on the fully}
100 \textcolor{comment}{                                                    !! symmetric computational domain.}
101   \textcolor{keywordtype}{real} :: l\_t\_to\_m\_s \textcolor{comment}{! A rescaling factor for velocities [m T s-1 L-1 ~> nondim] or [nondim]}
102   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz, hs
103   \textcolor{keywordtype}{logical} :: sym
104 
105   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
106   l\_t\_to\_m\_s = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) l\_t\_to\_m\_s = us%L\_T\_to\_m\_s
107 
108   \textcolor{comment}{! Note that for the chksum calls to be useful for reproducing across PE}
109   \textcolor{comment}{! counts, there must be no redundant points, so all variables use is..ie}
110   \textcolor{comment}{! and js...je as their extent.}
111   hs=1; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(haloshift)) hs=haloshift
112   sym=.false.; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(symmetric)) sym=symmetric
113   \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" u"}, u, v, g%HI, haloshift=hs, symmetric=sym, scale=l\_t\_to\_m\_s)
114   \textcolor{keyword}{call }hchksum(h, mesg//\textcolor{stringliteral}{" h"},g%HI, haloshift=hs, scale=gv%H\_to\_m)
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__checksum__packages_a37164032fcd0a881c8c6d03fdc2c2028}\label{namespacemom__checksum__packages_a37164032fcd0a881c8c6d03fdc2c2028}} 
\index{mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}!mom\+\_\+state\+\_\+chksum\+\_\+5arg@{mom\+\_\+state\+\_\+chksum\+\_\+5arg}}
\index{mom\+\_\+state\+\_\+chksum\+\_\+5arg@{mom\+\_\+state\+\_\+chksum\+\_\+5arg}!mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}}
\subsubsection{\texorpdfstring{mom\+\_\+state\+\_\+chksum\+\_\+5arg()}{mom\_state\_chksum\_5arg()}}
{\footnotesize\ttfamily subroutine mom\+\_\+checksum\+\_\+packages\+::mom\+\_\+state\+\_\+chksum\+\_\+5arg (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{mesg,  }\item[{real, dimension(szib\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{u,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(in)}]{v,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h,  }\item[{real, dimension(szib\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{uh,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(in)}]{vh,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{integer, intent(in), optional}]{haloshift,  }\item[{logical, intent(in), optional}]{symmetric,  }\item[{real, intent(in), optional}]{vel\+\_\+scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Write out chksums for the model\textquotesingle{}s basic state variables, including transports. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em mesg} & A message that appears on the chksum lines.\\
\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 u} & The zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} or other units.\\
\hline
\mbox{\tt in}  & {\em v} & The meridional velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} or other units.\\
\hline
\mbox{\tt in}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em uh} & Volume flux through zonal faces = u$\ast$h$\ast$dy\\
\hline
\mbox{\tt in}  & {\em vh} & Volume flux through meridional faces = v$\ast$h$\ast$dx\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em haloshift} & The width of halos to check (default 0).\\
\hline
\mbox{\tt in}  & {\em symmetric} & If true, do checksums on the fully symmetric computational domain.\\
\hline
\mbox{\tt in}  & {\em vel\+\_\+scale} & The scaling factor to convert velocities to \mbox{[}m s-\/1\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 43 of file M\+O\+M\+\_\+checksum\+\_\+packages.\+F90.


\begin{DoxyCode}
43   \textcolor{keywordtype}{character(len=*)},                          &
44                            \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{ !< A message that appears on the chksum lines.}
45   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{    !< The ocean's grid structure.}
46   \textcolor{keywordtype}{type}(verticalgrid\_type), \textcolor{keywordtype}{intent(in)} :: gv\textcolor{comment}{   !< The ocean's vertical grid structure.}
47   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, &
48                            \textcolor{keywordtype}{intent(in)} :: u\textcolor{comment}{    !< The zonal velocity [L T-1 ~> m s-1] or other units.}
49   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, &
50                            \textcolor{keywordtype}{intent(in)} :: v\textcolor{comment}{    !< The meridional velocity [L T-1 ~> m s-1] or other units.}
51   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  &
52                            \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{    !< Layer thicknesses [H ~> m or kg m-2].}
53   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, &
54                            \textcolor{keywordtype}{intent(in)} :: uh\textcolor{comment}{   !< Volume flux through zonal faces = u*h*dy}
55 \textcolor{comment}{                                              !! [H L2 T-1 ~> m3 s-1 or kg s-1].}
56   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, &
57                            \textcolor{keywordtype}{intent(in)} :: vh\textcolor{comment}{   !< Volume flux through meridional faces = v*h*dx}
58 \textcolor{comment}{                                              !! [H L2 T-1 ~> m3 s-1 or kg s-1].}
59   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: us\textcolor{comment}{   !< A dimensional unit scaling type}
60   \textcolor{keywordtype}{integer},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: haloshift\textcolor{comment}{ !< The width of halos to check (default 0).}
61   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: symmetric\textcolor{comment}{ !< If true, do checksums on the fully symmetric}
62 \textcolor{comment}{                                                   !! computational domain.}
63   \textcolor{keywordtype}{real},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: vel\_scale\textcolor{comment}{ !< The scaling factor to convert velocities to [m s-1]}
64 
65   \textcolor{keywordtype}{real} :: scale\_vel \textcolor{comment}{! The scaling factor to convert velocities to [m s-1]}
66   \textcolor{keywordtype}{logical} :: sym
67   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz, hs
68   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
69 
70   \textcolor{comment}{! Note that for the chksum calls to be useful for reproducing across PE}
71   \textcolor{comment}{! counts, there must be no redundant points, so all variables use is..ie}
72   \textcolor{comment}{! and js...je as their extent.}
73   hs = 1 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(haloshift)) hs=haloshift
74   sym = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(symmetric)) sym=symmetric
75   scale\_vel = us%L\_T\_to\_m\_s ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(vel\_scale)) scale\_vel = vel\_scale
76 
77   \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" [uv]"}, u, v, g%HI, haloshift=hs, symmetric=sym, scale=scale\_vel)
78   \textcolor{keyword}{call }hchksum(h, mesg//\textcolor{stringliteral}{" h"}, g%HI, haloshift=hs, scale=gv%H\_to\_m)
79   \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" [uv]h"}, uh, vh, g%HI, haloshift=hs, &
80                 symmetric=sym, scale=gv%H\_to\_m*us%L\_to\_m**2*us%s\_to\_T)
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__checksum__packages_a6d09d11c188659dd5ebd0b36fc42aa2b}\label{namespacemom__checksum__packages_a6d09d11c188659dd5ebd0b36fc42aa2b}} 
\index{mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}!mom\+\_\+state\+\_\+stats@{mom\+\_\+state\+\_\+stats}}
\index{mom\+\_\+state\+\_\+stats@{mom\+\_\+state\+\_\+stats}!mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}}
\subsubsection{\texorpdfstring{mom\+\_\+state\+\_\+stats()}{mom\_state\_stats()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+checksum\+\_\+packages\+::mom\+\_\+state\+\_\+stats (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{mesg,  }\item[{real, dimension(szib\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{u,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(in)}]{v,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), pointer}]{Temp,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), pointer}]{Salt,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{logical, intent(in), optional}]{allow\+Change,  }\item[{logical, intent(in), optional}]{permit\+Diminishing }\end{DoxyParamCaption})}



Monitor and write out statistics for the model\textquotesingle{}s state variables. 


\begin{DoxyParams}[1]{Parameters}
\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 mesg} & A message that appears on the chksum lines.\\
\hline
\mbox{\tt in}  & {\em u} & The zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em v} & The meridional velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em temp} & Temperature \mbox{[}degC\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em salt} & Salinity \mbox{[}ppt\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em allowchange} & do not flag an error if the statistics change.\\
\hline
\mbox{\tt in}  & {\em permitdiminishing} & do not flag error if the extrema are diminishing. \\
\hline
\end{DoxyParams}


Definition at line 240 of file M\+O\+M\+\_\+checksum\+\_\+packages.\+F90.


\begin{DoxyCode}
240   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{    !< The ocean's grid structure.}
241   \textcolor{keywordtype}{type}(verticalgrid\_type), \textcolor{keywordtype}{intent(in)} :: gv\textcolor{comment}{   !< The ocean's vertical grid structure.}
242   \textcolor{keywordtype}{character(len=*)},        \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{ !< A message that appears on the chksum lines.}
243   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, &
244                            \textcolor{keywordtype}{intent(in)} :: u\textcolor{comment}{    !< The zonal velocity [L T-1 ~> m s-1].}
245   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, &
246                            \textcolor{keywordtype}{intent(in)} :: v\textcolor{comment}{    !< The meridional velocity [L T-1 ~> m s-1].}
247   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  &
248                            \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{    !< Layer thicknesses [H ~> m or kg m-2].}
249   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{dimension(:,:,:)},           &
250                            \textcolor{keywordtype}{intent(in)} :: temp\textcolor{comment}{ !< Temperature [degC].}
251   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{dimension(:,:,:)},           &
252                            \textcolor{keywordtype}{intent(in)} :: salt\textcolor{comment}{ !< Salinity [ppt].}
253   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: us\textcolor{comment}{    !< A dimensional unit scaling type}
254   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: allowchange\textcolor{comment}{ !< do not flag an error}
255 \textcolor{comment}{                                                     !! if the statistics change.}
256   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: permitdiminishing\textcolor{comment}{ !< do not flag error if the}
257 \textcolor{comment}{                                                           !! extrema are diminishing.}
258 
259   \textcolor{comment}{! Local variables}
260   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(G%isc:G%iec, G%jsc:G%jec)} :: &
261     tmp\_a, &  \textcolor{comment}{! The area per cell [m2] (unscaled to permit reproducing sum).}
262     tmp\_v, &  \textcolor{comment}{! The column-integrated volume [m3] (unscaled to permit reproducing sum)}
263     tmp\_t, &  \textcolor{comment}{! The column-integrated temperature [degC m3]}
264     tmp\_s     \textcolor{comment}{! The column-integrated salinity [ppt m3]}
265   \textcolor{keywordtype}{real} :: vol, dv    \textcolor{comment}{! The total ocean volume and its change [m3] (unscaled to permit reproducing sum).}
266   \textcolor{keywordtype}{real} :: area       \textcolor{comment}{! The total ocean surface area [m2] (unscaled to permit reproducing sum).}
267   \textcolor{keywordtype}{real} :: h\_minimum  \textcolor{comment}{! The minimum layer thicknesses [H ~> m or kg m-2]}
268   \textcolor{keywordtype}{logical} :: do\_ts   \textcolor{comment}{! If true, evaluate statistics for temperature and salinity}
269   \textcolor{keywordtype}{type}(stats) :: t, s, delt, dels
270 
271   \textcolor{comment}{! NOTE: save data is not normally allowed but we use it for debugging purposes here on the}
272   \textcolor{comment}{!       assumption we will not turn this on with threads}
273   \textcolor{keywordtype}{type}(stats), \textcolor{keywordtype}{save} :: oldt, olds
274   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{save} :: firstcall = .true.
275   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{save} :: oldvol \textcolor{comment}{! The previous total ocean volume [m3]}
276 
277   \textcolor{keywordtype}{character(len=80)} :: lmsg
278   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz, i, j, k
279 
280   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
281   do\_ts = \textcolor{keyword}{associated}(temp) .and. \textcolor{keyword}{associated}(salt)
282 
283   tmp\_a(:,:) = 0.0
284   tmp\_v(:,:) = 0.0
285   tmp\_t(:,:) = 0.0
286   tmp\_s(:,:) = 0.0
287 
288   \textcolor{comment}{! First collect local stats}
289   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
290     tmp\_a(i,j) = tmp\_a(i,j) + us%L\_to\_m**2*g%areaT(i,j)
291 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
292   t%minimum = 1.e34 ; t%maximum = -1.e34 ; t%average = 0.
293   s%minimum = 1.e34 ; s%maximum = -1.e34 ; s%average = 0.
294   h\_minimum = 1.e34*gv%m\_to\_H
295   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
296     \textcolor{keywordflow}{if} (g%mask2dT(i,j)>0.) \textcolor{keywordflow}{then}
297       dv = us%L\_to\_m**2*g%areaT(i,j)*gv%H\_to\_m*h(i,j,k)
298       tmp\_v(i,j) = tmp\_v(i,j) + dv
299       \textcolor{keywordflow}{if} (do\_ts .and. h(i,j,k)>0.) \textcolor{keywordflow}{then}
300         t%minimum = min( t%minimum, temp(i,j,k) ) ; t%maximum = max( t%maximum, temp(i,j,k) )
301         t%average = t%average + dv*temp(i,j,k)
302         s%minimum = min( s%minimum, salt(i,j,k) ) ; s%maximum = max( s%maximum, salt(i,j,k) )
303         s%average = s%average + dv*salt(i,j,k)
304 \textcolor{keywordflow}{      endif}
305       \textcolor{keywordflow}{if} (h\_minimum > h(i,j,k)) h\_minimum = h(i,j,k)
306 \textcolor{keywordflow}{    endif}
307 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
308   area = reproducing\_sum( tmp\_a ) ; vol = reproducing\_sum( tmp\_v )
309   \textcolor{keywordflow}{if} (do\_ts) \textcolor{keywordflow}{then}
310     \textcolor{keyword}{call }min\_across\_pes( t%minimum ) ; \textcolor{keyword}{call }max\_across\_pes( t%maximum )
311     \textcolor{keyword}{call }min\_across\_pes( s%minimum ) ; \textcolor{keyword}{call }max\_across\_pes( s%maximum )
312     t%average = reproducing\_sum( tmp\_t ) ; s%average = reproducing\_sum( tmp\_s )
313     t%average = t%average / vol ; s%average = s%average / vol
314 \textcolor{keywordflow}{  endif}
315   \textcolor{keywordflow}{if} (is\_root\_pe()) \textcolor{keywordflow}{then}
316     \textcolor{keywordflow}{if} (.not.firstcall) \textcolor{keywordflow}{then}
317       dv = vol - oldvol
318       delt%minimum = t%minimum - oldt%minimum ; delt%maximum = t%maximum - oldt%maximum
319       delt%average = t%average - oldt%average
320       dels%minimum = s%minimum - olds%minimum ; dels%maximum = s%maximum - olds%maximum
321       dels%average = s%average - olds%average
322       \textcolor{keyword}{write}(lmsg(1:80),\textcolor{stringliteral}{'(2(a,es12.4))'}) \textcolor{stringliteral}{'Mean thickness ='}, vol/area,\textcolor{stringliteral}{' frac. delta='},dv/vol
323       \textcolor{keyword}{call }mom\_mesg(lmsg//trim(mesg))
324       \textcolor{keywordflow}{if} (do\_ts) \textcolor{keywordflow}{then}
325         \textcolor{keyword}{write}(lmsg(1:80),\textcolor{stringliteral}{'(a,3es12.4)'}) \textcolor{stringliteral}{'Temp min/mean/max ='},t%minimum,t%average,t%maximum
326         \textcolor{keyword}{call }mom\_mesg(lmsg//trim(mesg))
327         \textcolor{keyword}{write}(lmsg(1:80),\textcolor{stringliteral}{'(a,3es12.4)'}) \textcolor{stringliteral}{'delT min/mean/max ='},delt%minimum,delt%average,delt%maximum
328         \textcolor{keyword}{call }mom\_mesg(lmsg//trim(mesg))
329         \textcolor{keyword}{write}(lmsg(1:80),\textcolor{stringliteral}{'(a,3es12.4)'}) \textcolor{stringliteral}{'Salt min/mean/max ='},s%minimum,s%average,s%maximum
330         \textcolor{keyword}{call }mom\_mesg(lmsg//trim(mesg))
331         \textcolor{keyword}{write}(lmsg(1:80),\textcolor{stringliteral}{'(a,3es12.4)'}) \textcolor{stringliteral}{'delS min/mean/max ='},dels%minimum,dels%average,dels%maximum
332         \textcolor{keyword}{call }mom\_mesg(lmsg//trim(mesg))
333 \textcolor{keywordflow}{      endif}
334     \textcolor{keywordflow}{else}
335       \textcolor{keyword}{write}(lmsg(1:80),\textcolor{stringliteral}{'(a,es12.4)'}) \textcolor{stringliteral}{'Mean thickness ='}, vol/area
336       \textcolor{keyword}{call }mom\_mesg(lmsg//trim(mesg))
337       \textcolor{keywordflow}{if} (do\_ts) \textcolor{keywordflow}{then}
338         \textcolor{keyword}{write}(lmsg(1:80),\textcolor{stringliteral}{'(a,3es12.4)'}) \textcolor{stringliteral}{'Temp min/mean/max ='}, t%minimum, t%average, t%maximum
339         \textcolor{keyword}{call }mom\_mesg(lmsg//trim(mesg))
340         \textcolor{keyword}{write}(lmsg(1:80),\textcolor{stringliteral}{'(a,3es12.4)'}) \textcolor{stringliteral}{'Salt min/mean/max ='}, s%minimum, s%average, s%maximum
341         \textcolor{keyword}{call }mom\_mesg(lmsg//trim(mesg))
342 \textcolor{keywordflow}{      endif}
343 \textcolor{keywordflow}{    endif}
344 \textcolor{keywordflow}{  endif}
345   firstcall = .false. ; oldvol = vol
346   oldt%minimum = t%minimum ; oldt%maximum = t%maximum ; oldt%average = t%average
347   olds%minimum = s%minimum ; olds%maximum = s%maximum ; olds%average = s%average
348 
349   \textcolor{keywordflow}{if} (do\_ts .and. t%minimum<-5.0) \textcolor{keywordflow}{then}
350     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
351       \textcolor{keywordflow}{if} (minval(temp(i,j,:)) == t%minimum) \textcolor{keywordflow}{then}
352         \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(a,2f12.5)'}) \textcolor{stringliteral}{'x,y='}, g%geoLonT(i,j), g%geoLatT(i,j)
353         \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(a3,3a12)'}) \textcolor{stringliteral}{'k'},\textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'Temp'},\textcolor{stringliteral}{'Salt'}
354         \textcolor{keywordflow}{do} k = 1, nz
355           \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(i3,3es12.4)'}) k, h(i,j,k), temp(i,j,k), salt(i,j,k)
356 \textcolor{keywordflow}{        enddo}
357         stop \textcolor{stringliteral}{'Extremum detected'}
358 \textcolor{keywordflow}{      endif}
359 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
360 \textcolor{keywordflow}{  endif}
361 
362   \textcolor{keywordflow}{if} (h\_minimum<0.0) \textcolor{keywordflow}{then}
363     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
364       \textcolor{keywordflow}{if} (minval(h(i,j,:)) == h\_minimum) \textcolor{keywordflow}{then}
365         \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(a,2f12.5)'}) \textcolor{stringliteral}{'x,y='},g%geoLonT(i,j),g%geoLatT(i,j)
366         \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(a3,3a12)'}) \textcolor{stringliteral}{'k'},\textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'Temp'},\textcolor{stringliteral}{'Salt'}
367         \textcolor{keywordflow}{do} k = 1, nz
368           \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(i3,3es12.4)'}) k, h(i,j,k), temp(i,j,k), salt(i,j,k)
369 \textcolor{keywordflow}{        enddo}
370         stop \textcolor{stringliteral}{'Negative thickness detected'}
371 \textcolor{keywordflow}{      endif}
372 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
373 \textcolor{keywordflow}{  endif}
374 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__checksum__packages_a08ce62d457cefb539b6919601ca70a75}\label{namespacemom__checksum__packages_a08ce62d457cefb539b6919601ca70a75}} 
\index{mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}!mom\+\_\+surface\+\_\+chksum@{mom\+\_\+surface\+\_\+chksum}}
\index{mom\+\_\+surface\+\_\+chksum@{mom\+\_\+surface\+\_\+chksum}!mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}}
\subsubsection{\texorpdfstring{mom\+\_\+surface\+\_\+chksum()}{mom\_surface\_chksum()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+checksum\+\_\+packages\+::mom\+\_\+surface\+\_\+chksum (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{mesg,  }\item[{type(surface), intent(inout)}]{sfc\+\_\+state,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{integer, intent(in), optional}]{haloshift,  }\item[{logical, intent(in), optional}]{symmetric }\end{DoxyParamCaption})}



Write out chksums for the ocean surface variables. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em mesg} & A message that appears on the chksum lines.\\
\hline
\mbox{\tt in,out}  & {\em sfc\+\_\+state} & transparent ocean surface state structure shared with the calling routine data in this structure is intent out.\\
\hline
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em haloshift} & The width of halos to check (default 0).\\
\hline
\mbox{\tt in}  & {\em symmetric} & If true, do checksums on the fully symmetric computational domain. \\
\hline
\end{DoxyParams}


Definition at line 145 of file M\+O\+M\+\_\+checksum\+\_\+packages.\+F90.


\begin{DoxyCode}
145   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)}    :: mesg\textcolor{comment}{ !< A message that appears on the chksum lines.}
146   \textcolor{keywordtype}{type}(surface),         \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< transparent ocean surface state structure}
147 \textcolor{comment}{                                               !! shared with the calling routine data in this}
148 \textcolor{comment}{                                               !! structure is intent out.}
149   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)}    :: g\textcolor{comment}{    !< The ocean's grid structure.}
150   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{intent(in)}    :: us\textcolor{comment}{    !< A dimensional unit scaling type}
151   \textcolor{keywordtype}{integer},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: haloshift\textcolor{comment}{ !< The width of halos to check (default 0).}
152   \textcolor{keywordtype}{logical},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: symmetric\textcolor{comment}{ !< If true, do checksums on the fully symmetric}
153 \textcolor{comment}{                                               !! computational domain.}
154 
155   \textcolor{keywordtype}{integer} :: hs
156   \textcolor{keywordtype}{logical} :: sym
157 
158   sym = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(symmetric)) sym = symmetric
159   hs = 1 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(haloshift)) hs = haloshift
160 
161   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%SST)) \textcolor{keyword}{call }hchksum(sfc\_state%SST, mesg//\textcolor{stringliteral}{" SST"}, g%HI, haloshift=hs)
162   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%SSS)) \textcolor{keyword}{call }hchksum(sfc\_state%SSS, mesg//\textcolor{stringliteral}{" SSS"}, g%HI, haloshift=hs)
163   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%sea\_lev)) \textcolor{keyword}{call }hchksum(sfc\_state%sea\_lev, mesg//\textcolor{stringliteral}{" sea\_lev"}, g%HI, &
164                                                  haloshift=hs, scale=us%Z\_to\_m)
165   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%Hml)) \textcolor{keyword}{call }hchksum(sfc\_state%Hml, mesg//\textcolor{stringliteral}{" Hml"}, g%HI, haloshift=hs, &
166                                              scale=us%Z\_to\_m)
167   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%u) .and. \textcolor{keyword}{allocated}(sfc\_state%v)) &
168     \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" SSU"}, sfc\_state%u, sfc\_state%v, g%HI, haloshift=hs, symmetric=sym, &
169                   scale=us%L\_T\_to\_m\_s)
170 \textcolor{comment}{!  if (allocated(sfc\_state%salt\_deficit)) &}
171 \textcolor{comment}{!    call hchksum(sfc\_state%salt\_deficit, mesg//" salt deficit", G%HI, haloshift=hs, scale=US%RZ\_to\_kg\_m2)}
172   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%frazil)) \textcolor{keyword}{call }hchksum(sfc\_state%frazil, mesg//\textcolor{stringliteral}{" frazil"}, g%HI, &
173                                                 haloshift=hs, scale=us%Q\_to\_J\_kg*us%RZ\_to\_kg\_m2)
174 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__checksum__packages_a4deb4c81b07de30df5c0e719849a4ef6}\label{namespacemom__checksum__packages_a4deb4c81b07de30df5c0e719849a4ef6}} 
\index{mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}!mom\+\_\+thermo\+\_\+chksum@{mom\+\_\+thermo\+\_\+chksum}}
\index{mom\+\_\+thermo\+\_\+chksum@{mom\+\_\+thermo\+\_\+chksum}!mom\+\_\+checksum\+\_\+packages@{mom\+\_\+checksum\+\_\+packages}}
\subsubsection{\texorpdfstring{mom\+\_\+thermo\+\_\+chksum()}{mom\_thermo\_chksum()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+checksum\+\_\+packages\+::mom\+\_\+thermo\+\_\+chksum (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{mesg,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(in)}]{tv,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{integer, intent(in), optional}]{haloshift }\end{DoxyParamCaption})}



Write out chksums for the model\textquotesingle{}s thermodynamic state variables. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em mesg} & A message that appears on the chksum lines.\\
\hline
\mbox{\tt in}  & {\em tv} & A structure pointing to various thermodynamic variables.\\
\hline
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em haloshift} & The width of halos to check (default 0). \\
\hline
\end{DoxyParams}


Definition at line 121 of file M\+O\+M\+\_\+checksum\+\_\+packages.\+F90.


\begin{DoxyCode}
121   \textcolor{keywordtype}{character(len=*)},         \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{ !< A message that appears on the chksum lines.}
122   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),    \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{   !< A structure pointing to various}
123 \textcolor{comment}{                                               !! thermodynamic variables.}
124   \textcolor{keywordtype}{type}(ocean\_grid\_type),    \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{    !< The ocean's grid structure.}
125   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)} :: us\textcolor{comment}{   !< A dimensional unit scaling type}
126   \textcolor{keywordtype}{integer},        \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: haloshift\textcolor{comment}{ !< The width of halos to check (default 0).}
127 
128   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz, hs
129   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
130   hs=1; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(haloshift)) hs=haloshift
131 
132   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv%T)) \textcolor{keyword}{call }hchksum(tv%T, mesg//\textcolor{stringliteral}{" T"}, g%HI, haloshift=hs)
133   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv%S)) \textcolor{keyword}{call }hchksum(tv%S, mesg//\textcolor{stringliteral}{" S"}, g%HI, haloshift=hs)
134   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv%frazil)) \textcolor{keyword}{call }hchksum(tv%frazil, mesg//\textcolor{stringliteral}{" frazil"}, g%HI, haloshift=hs, &
135                                           scale=us%Q\_to\_J\_kg*us%R\_to\_kg\_m3*us%Z\_to\_m)
136   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv%salt\_deficit)) &
137     \textcolor{keyword}{call }hchksum(tv%salt\_deficit, mesg//\textcolor{stringliteral}{" salt deficit"}, g%HI, haloshift=hs, scale=us%RZ\_to\_kg\_m2)
138 
\end{DoxyCode}
