\hypertarget{namespacemom__checksum__packages}{}\doxysection{mom\+\_\+checksum\+\_\+packages Module Reference}
\label{namespacemom__checksum__packages}\index{mom\_checksum\_packages@{mom\_checksum\_packages}}


\doxysubsection{Detailed Description}
Provides routines that do checksums of groups of M\+OM variables. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
interface \mbox{\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 \mbox{\hyperlink{structmom__checksum__packages_1_1stats}{stats}}
\begin{DoxyCompactList}\small\item\em A type for storing statistica about a variable. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \mbox{\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 \mbox{\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 \mbox{\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 \mbox{\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 \mbox{\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 \mbox{\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}


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


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


\begin{DoxyCode}{0}
\DoxyCodeLine{182   \textcolor{keywordtype}{character(len=*)},         \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{ !< A message that appears on the chksum lines.}}
\DoxyCodeLine{183   \textcolor{keywordtype}{type}(ocean\_grid\_type),    \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure.}}
\DoxyCodeLine{184   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure.}}
\DoxyCodeLine{185 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{186                             \textcolor{keywordtype}{intent(in)} :: CAu\textcolor{comment}{  !< Zonal acceleration due to Coriolis}}
\DoxyCodeLine{187 \textcolor{comment}{                                               !! and momentum advection terms [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{188 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{189                             \textcolor{keywordtype}{intent(in)} :: CAv\textcolor{comment}{  !< Meridional acceleration due to Coriolis}}
\DoxyCodeLine{190 \textcolor{comment}{                                               !! and momentum advection terms [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{191 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{192                             \textcolor{keywordtype}{intent(in)} :: PFu\textcolor{comment}{  !< Zonal acceleration due to pressure gradients}}
\DoxyCodeLine{193 \textcolor{comment}{                                               !! (equal to -\/dM/dx) [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{194 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{195                             \textcolor{keywordtype}{intent(in)} :: PFv\textcolor{comment}{  !< Meridional acceleration due to pressure gradients}}
\DoxyCodeLine{196 \textcolor{comment}{                                               !! (equal to -\/dM/dy) [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{197 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{198                             \textcolor{keywordtype}{intent(in)} :: diffu\textcolor{comment}{ !< Zonal acceleration due to convergence of the}}
\DoxyCodeLine{199 \textcolor{comment}{                                                !! along-\/isopycnal stress tensor [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{200 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{201                             \textcolor{keywordtype}{intent(in)} :: diffv\textcolor{comment}{ !< Meridional acceleration due to convergence of}}
\DoxyCodeLine{202 \textcolor{comment}{                                                !! the along-\/isopycnal stress tensor [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{203   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{    !< A dimensional unit scaling type}}
\DoxyCodeLine{204 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{205                   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: pbce\textcolor{comment}{ !< The baroclinic pressure anomaly in each layer}}
\DoxyCodeLine{206 \textcolor{comment}{                                               !! due to free surface height anomalies}}
\DoxyCodeLine{207 \textcolor{comment}{                                               !! [L2 T-\/2 H-\/1 \string~> m s-\/2 or m4 s-\/2 kg-\/1].}}
\DoxyCodeLine{208 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{209                   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: u\_accel\_bt\textcolor{comment}{ !< The zonal acceleration from terms in the}}
\DoxyCodeLine{210 \textcolor{comment}{                                                     !! barotropic solver [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{211 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{212                   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: v\_accel\_bt\textcolor{comment}{ !< The meridional acceleration from terms in}}
\DoxyCodeLine{213 \textcolor{comment}{                                                     !! the barotropic solver [L T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{214   \textcolor{keywordtype}{logical},        \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: symmetric\textcolor{comment}{ !< If true, do checksums on the fully symmetric}}
\DoxyCodeLine{215 \textcolor{comment}{                                                    !! computational domain.}}
\DoxyCodeLine{216 }
\DoxyCodeLine{217   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz}
\DoxyCodeLine{218   \textcolor{keywordtype}{logical} :: sym}
\DoxyCodeLine{219 }
\DoxyCodeLine{220   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{221   sym=.false.; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(symmetric)) sym=symmetric}
\DoxyCodeLine{222 }
\DoxyCodeLine{223   \textcolor{comment}{! Note that for the chksum calls to be useful for reproducing across PE}}
\DoxyCodeLine{224   \textcolor{comment}{! counts, there must be no redundant points, so all variables use is..ie}}
\DoxyCodeLine{225   \textcolor{comment}{! and js...je as their extent.}}
\DoxyCodeLine{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)}
\DoxyCodeLine{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)}
\DoxyCodeLine{228   \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" diffu"}, diffu, diffv, g\%HI,haloshift=0, symmetric=sym, scale=us\%L\_T2\_to\_m\_s2)}
\DoxyCodeLine{229   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(pbce)) \&}
\DoxyCodeLine{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)}
\DoxyCodeLine{231   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(u\_accel\_bt) .and. \textcolor{keyword}{present}(v\_accel\_bt)) \&}
\DoxyCodeLine{232     \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" [uv]\_accel\_bt"}, u\_accel\_bt, v\_accel\_bt, g\%HI,haloshift=0, symmetric=sym, \&}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em mesg} & A message that appears on the chksum lines. \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em u} & Zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} or \mbox{[}m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em v} & Meridional velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} or \mbox{[}m s-\/1\mbox{]}.. \\
\hline
\mbox{\texttt{ in}}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type, which is used to rescale u and v if present. \\
\hline
\mbox{\texttt{ in}}  & {\em haloshift} & The width of halos to check (default 0). \\
\hline
\mbox{\texttt{ in}}  & {\em symmetric} & If true, do checksums on the fully symmetric computational domain. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{87   \textcolor{keywordtype}{character(len=*)},                \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{ !< A message that appears on the chksum lines.}}
\DoxyCodeLine{88   \textcolor{keywordtype}{type}(ocean\_grid\_type),           \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{  !< The ocean's grid structure.}}
\DoxyCodeLine{89   \textcolor{keywordtype}{type}(verticalGrid\_type),         \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{ !< The ocean's vertical grid structure.}}
\DoxyCodeLine{90 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{91                                    \textcolor{keywordtype}{intent(in)} :: u\textcolor{comment}{  !< Zonal velocity [L T-\/1 \string~> m s-\/1] or [m s-\/1].}}
\DoxyCodeLine{92 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{93                                    \textcolor{keywordtype}{intent(in)} :: v\textcolor{comment}{  !< Meridional velocity [L T-\/1 \string~> m s-\/1] or [m s-\/1]..}}
\DoxyCodeLine{94 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{95                                    \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{  !< Layer thicknesses [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{96   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{ !< A dimensional unit scaling type, which is}}
\DoxyCodeLine{97 \textcolor{comment}{                                                    !! used to rescale u and v if present.}}
\DoxyCodeLine{98   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: haloshift\textcolor{comment}{ !< The width of halos to check (default 0).}}
\DoxyCodeLine{99   \textcolor{keywordtype}{logical},               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: symmetric\textcolor{comment}{ !< If true, do checksums on the fully}}
\DoxyCodeLine{100 \textcolor{comment}{                                                    !! symmetric computational domain.}}
\DoxyCodeLine{101 \textcolor{keywordtype}{  real} :: L\_T\_to\_m\_s \textcolor{comment}{! A rescaling factor for velocities [m T s-\/1 L-\/1 \string~> nondim] or [nondim]}}
\DoxyCodeLine{102   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz, hs}
\DoxyCodeLine{103   \textcolor{keywordtype}{logical} :: sym}
\DoxyCodeLine{104 }
\DoxyCodeLine{105   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{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}
\DoxyCodeLine{107 }
\DoxyCodeLine{108   \textcolor{comment}{! Note that for the chksum calls to be useful for reproducing across PE}}
\DoxyCodeLine{109   \textcolor{comment}{! counts, there must be no redundant points, so all variables use is..ie}}
\DoxyCodeLine{110   \textcolor{comment}{! and js...je as their extent.}}
\DoxyCodeLine{111   hs=1; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(haloshift)) hs=haloshift}
\DoxyCodeLine{112   sym=.false.; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(symmetric)) sym=symmetric}
\DoxyCodeLine{113   \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" u"}, u, v, g\%HI, haloshift=hs, symmetric=sym, scale=l\_t\_to\_m\_s)}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em mesg} & A message that appears on the chksum lines. \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em u} & The zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} or other units. \\
\hline
\mbox{\texttt{ in}}  & {\em v} & The meridional velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} or other units. \\
\hline
\mbox{\texttt{ in}}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em uh} & Volume flux through zonal faces = u$\ast$h$\ast$dy \\
\hline
\mbox{\texttt{ in}}  & {\em vh} & Volume flux through meridional faces = v$\ast$h$\ast$dx \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em haloshift} & The width of halos to check (default 0). \\
\hline
\mbox{\texttt{ in}}  & {\em symmetric} & If true, do checksums on the fully symmetric computational domain. \\
\hline
\mbox{\texttt{ in}}  & {\em vel\+\_\+scale} & The scaling factor to convert velocities to \mbox{[}m s-\/1\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{43   \textcolor{keywordtype}{character(len=*)},                          \&}
\DoxyCodeLine{44                            \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{ !< A message that appears on the chksum lines.}}
\DoxyCodeLine{45   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure.}}
\DoxyCodeLine{46   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure.}}
\DoxyCodeLine{47 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{48                            \textcolor{keywordtype}{intent(in)} :: u\textcolor{comment}{    !< The zonal velocity [L T-\/1 \string~> m s-\/1] or other units.}}
\DoxyCodeLine{49 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{50                            \textcolor{keywordtype}{intent(in)} :: v\textcolor{comment}{    !< The meridional velocity [L T-\/1 \string~> m s-\/1] or other units.}}
\DoxyCodeLine{51 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{52                            \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{    !< Layer thicknesses [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{53 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{54                            \textcolor{keywordtype}{intent(in)} :: uh\textcolor{comment}{   !< Volume flux through zonal faces = u*h*dy}}
\DoxyCodeLine{55 \textcolor{comment}{                                              !! [H L2 T-\/1 \string~> m3 s-\/1 or kg s-\/1].}}
\DoxyCodeLine{56 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{57                            \textcolor{keywordtype}{intent(in)} :: vh\textcolor{comment}{   !< Volume flux through meridional faces = v*h*dx}}
\DoxyCodeLine{58 \textcolor{comment}{                                              !! [H L2 T-\/1 \string~> m3 s-\/1 or kg s-\/1].}}
\DoxyCodeLine{59   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{   !< A dimensional unit scaling type}}
\DoxyCodeLine{60   \textcolor{keywordtype}{integer},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: haloshift\textcolor{comment}{ !< The width of halos to check (default 0).}}
\DoxyCodeLine{61   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: symmetric\textcolor{comment}{ !< If true, do checksums on the fully symmetric}}
\DoxyCodeLine{62 \textcolor{comment}{                                                   !! computational domain.}}
\DoxyCodeLine{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]}}
\DoxyCodeLine{64 }
\DoxyCodeLine{65 \textcolor{keywordtype}{  real} :: scale\_vel \textcolor{comment}{! The scaling factor to convert velocities to [m s-\/1]}}
\DoxyCodeLine{66   \textcolor{keywordtype}{logical} :: sym}
\DoxyCodeLine{67   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz, hs}
\DoxyCodeLine{68   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{69 }
\DoxyCodeLine{70   \textcolor{comment}{! Note that for the chksum calls to be useful for reproducing across PE}}
\DoxyCodeLine{71   \textcolor{comment}{! counts, there must be no redundant points, so all variables use is..ie}}
\DoxyCodeLine{72   \textcolor{comment}{! and js...je as their extent.}}
\DoxyCodeLine{73   hs = 1 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(haloshift)) hs=haloshift}
\DoxyCodeLine{74   sym = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(symmetric)) sym=symmetric}
\DoxyCodeLine{75   scale\_vel = us\%L\_T\_to\_m\_s ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(vel\_scale)) scale\_vel = vel\_scale}
\DoxyCodeLine{76 }
\DoxyCodeLine{77   \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" [uv]"}, u, v, g\%HI, haloshift=hs, symmetric=sym, scale=scale\_vel)}
\DoxyCodeLine{78   \textcolor{keyword}{call }hchksum(h, mesg//\textcolor{stringliteral}{" h"}, g\%HI, haloshift=hs, scale=gv\%H\_to\_m)}
\DoxyCodeLine{79   \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" [uv]h"}, uh, vh, g\%HI, haloshift=hs, \&}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em mesg} & A message that appears on the chksum lines. \\
\hline
\mbox{\texttt{ in}}  & {\em u} & The zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em v} & The meridional velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em temp} & Temperature \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em salt} & Salinity \mbox{[}ppt\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em allowchange} & do not flag an error if the statistics change. \\
\hline
\mbox{\texttt{ in}}  & {\em permitdiminishing} & do not flag error if the extrema are diminishing. \\
\hline
\end{DoxyParams}


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


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


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


\begin{DoxyCode}{0}
\DoxyCodeLine{145   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)}    :: mesg\textcolor{comment}{ !< A message that appears on the chksum lines.}}
\DoxyCodeLine{146   \textcolor{keywordtype}{type}(surface),         \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< transparent ocean surface state structure}}
\DoxyCodeLine{147 \textcolor{comment}{                                               !! shared with the calling routine data in this}}
\DoxyCodeLine{148 \textcolor{comment}{                                               !! structure is intent out.}}
\DoxyCodeLine{149   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{    !< The ocean's grid structure.}}
\DoxyCodeLine{150   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{    !< A dimensional unit scaling type}}
\DoxyCodeLine{151   \textcolor{keywordtype}{integer},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: haloshift\textcolor{comment}{ !< The width of halos to check (default 0).}}
\DoxyCodeLine{152   \textcolor{keywordtype}{logical},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: symmetric\textcolor{comment}{ !< If true, do checksums on the fully symmetric}}
\DoxyCodeLine{153 \textcolor{comment}{                                               !! computational domain.}}
\DoxyCodeLine{154 }
\DoxyCodeLine{155   \textcolor{keywordtype}{integer} :: hs}
\DoxyCodeLine{156   \textcolor{keywordtype}{logical} :: sym}
\DoxyCodeLine{157 }
\DoxyCodeLine{158   sym = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(symmetric)) sym = symmetric}
\DoxyCodeLine{159   hs = 1 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(haloshift)) hs = haloshift}
\DoxyCodeLine{160 }
\DoxyCodeLine{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)}
\DoxyCodeLine{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)}
\DoxyCodeLine{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, \&}
\DoxyCodeLine{164                                                  haloshift=hs, scale=us\%Z\_to\_m)}
\DoxyCodeLine{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, \&}
\DoxyCodeLine{166                                              scale=us\%Z\_to\_m)}
\DoxyCodeLine{167   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%u) .and. \textcolor{keyword}{allocated}(sfc\_state\%v)) \&}
\DoxyCodeLine{168     \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" SSU"}, sfc\_state\%u, sfc\_state\%v, g\%HI, haloshift=hs, symmetric=sym, \&}
\DoxyCodeLine{169                   scale=us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{170 \textcolor{comment}{!  if (allocated(sfc\_state\%salt\_deficit)) \&}}
\DoxyCodeLine{171 \textcolor{comment}{!    call hchksum(sfc\_state\%salt\_deficit, mesg//" salt deficit", G\%HI, haloshift=hs, scale=US\%RZ\_to\_kg\_m2)}}
\DoxyCodeLine{172   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%frazil)) \textcolor{keyword}{call }hchksum(sfc\_state\%frazil, mesg//\textcolor{stringliteral}{" frazil"}, g\%HI, \&}
\DoxyCodeLine{173                                                 haloshift=hs, scale=us\%Q\_to\_J\_kg*us\%RZ\_to\_kg\_m2)}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em mesg} & A message that appears on the chksum lines. \\
\hline
\mbox{\texttt{ in}}  & {\em tv} & A structure pointing to various thermodynamic variables. \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em haloshift} & The width of halos to check (default 0). \\
\hline
\end{DoxyParams}


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


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

\end{DoxyCode}
