\hypertarget{namespacemom__tracer__registry}{}\doxysection{mom\+\_\+tracer\+\_\+registry Module Reference}
\label{namespacemom__tracer__registry}\index{mom\_tracer\_registry@{mom\_tracer\_registry}}


\doxysubsection{Detailed Description}
This module contains the \mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}} and the subroutines that handle registration of tracers and related subroutines. The primary subroutine, register\+\_\+tracer, is called to indicate the tracers advected and diffused. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}
\begin{DoxyCompactList}\small\item\em Type to carry basic tracer information. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__tracer__registry_1_1tracer__type}{tracer\+\_\+type}}
\begin{DoxyCompactList}\small\item\em The tracer type. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_a97a70989bd0318f51d90c2fc6f87c6f5}{register\+\_\+tracer}} (tr\+\_\+ptr, Reg, param\+\_\+file, HI, GV, name, longname, units, cmor\+\_\+name, cmor\+\_\+units, cmor\+\_\+longname, tr\+\_\+desc, O\+B\+C\+\_\+inflow, O\+B\+C\+\_\+in\+\_\+u, O\+B\+C\+\_\+in\+\_\+v, ad\+\_\+x, ad\+\_\+y, df\+\_\+x, df\+\_\+y, ad\+\_\+2d\+\_\+x, ad\+\_\+2d\+\_\+y, df\+\_\+2d\+\_\+x, df\+\_\+2d\+\_\+y, advection\+\_\+xy, registry\+\_\+diags, flux\+\_\+nameroot, flux\+\_\+longname, flux\+\_\+units, flux\+\_\+scale, convergence\+\_\+units, convergence\+\_\+scale, cmor\+\_\+tendprefix, diag\+\_\+form, restart\+\_\+\+CS, mandatory)
\begin{DoxyCompactList}\small\item\em This subroutine registers a tracer to be advected and laterally diffused. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_af9889848c1f3801951b0c79cace52e8d}{lock\+\_\+tracer\+\_\+registry}} (Reg)
\begin{DoxyCompactList}\small\item\em This subroutine locks the tracer registry to prevent the addition of more tracers. After locked=.true., can then register common diagnostics. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_a6210cf64994a49ae3c14e3500c957fb1}{register\+\_\+tracer\+\_\+diagnostics}} (Reg, h, Time, diag, G, GV, US, use\+\_\+\+A\+LE)
\begin{DoxyCompactList}\small\item\em register\+\_\+tracer\+\_\+diagnostics does a set of register\+\_\+diag\+\_\+field calls for any previously registered in a tracer registry with a value of registry\+\_\+diags set to .true. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_a32c2b2e308a5183cd7681084e07d1624}{preale\+\_\+tracer\+\_\+diagnostics}} (Reg, G, GV)
\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_ada71d85c8d29e91166c59601c0e799ef}{postale\+\_\+tracer\+\_\+diagnostics}} (Reg, G, GV, diag, dt)
\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_a6840b8bb4ec1b2a2f023046ea47f509c}{post\+\_\+tracer\+\_\+diagnostics\+\_\+at\+\_\+sync}} (Reg, h, diag\+\_\+prev, diag, G, GV, dt)
\begin{DoxyCompactList}\small\item\em Post tracer diganostics when that should only be posted when M\+OM\textquotesingle{}s state is self-\/consistent (also referred to as \textquotesingle{}synchronized\textquotesingle{}) \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_afac59be6855cac7e3021295ae1e501b4}{post\+\_\+tracer\+\_\+transport\+\_\+diagnostics}} (G, GV, Reg, h\+\_\+diag, diag)
\begin{DoxyCompactList}\small\item\em Post the advective and diffusive tendencies. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_ad350bb834bb3dcfd6e603bb136bd8098}{mom\+\_\+tracer\+\_\+chksum}} (mesg, Tr, ntr, G)
\begin{DoxyCompactList}\small\item\em This subroutine writes out chksums for tracers. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_a86cd924ede0ff77b15065f5b3bd2cb29}{mom\+\_\+tracer\+\_\+chkinv}} (mesg, G, h, Tr, ntr)
\begin{DoxyCompactList}\small\item\em Calculates and prints the global inventory of all tracers in the registry. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_a67e71e90d3747dd97a917f6541f39b56}{tracer\+\_\+name\+\_\+lookup}} (Reg, tr\+\_\+ptr, name)
\begin{DoxyCompactList}\small\item\em Find a tracer in the tracer registry by name. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_a452937bf1f9d01a47d1a80793e317b33}{tracer\+\_\+registry\+\_\+init}} (param\+\_\+file, Reg)
\begin{DoxyCompactList}\small\item\em Initialize the tracer registry. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__tracer__registry_aaca7f6bcdb5f1d8cb247e24719d37df9}{tracer\+\_\+registry\+\_\+end}} (Reg)
\begin{DoxyCompactList}\small\item\em This routine closes the tracer registry module. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__tracer__registry_af9889848c1f3801951b0c79cace52e8d}\label{namespacemom__tracer__registry_af9889848c1f3801951b0c79cace52e8d}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!lock\_tracer\_registry@{lock\_tracer\_registry}}
\index{lock\_tracer\_registry@{lock\_tracer\_registry}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{lock\_tracer\_registry()}{lock\_tracer\_registry()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::lock\+\_\+tracer\+\_\+registry (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{Reg }\end{DoxyParamCaption})}



This subroutine locks the tracer registry to prevent the addition of more tracers. After locked=.true., can then register common diagnostics. 


\begin{DoxyParams}{Parameters}
{\em reg} & pointer to the tracer registry \\
\hline
\end{DoxyParams}


Definition at line 332 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{332   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer}    :: Reg\textcolor{comment}{    !< pointer to the tracer registry}}
\DoxyCodeLine{333 }
\DoxyCodeLine{334   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(reg)) \textcolor{keyword}{call }mom\_error(warning, \&}
\DoxyCodeLine{335     \textcolor{stringliteral}{"lock\_tracer\_registry called with an unassociated registry."})}
\DoxyCodeLine{336 }
\DoxyCodeLine{337   reg\%locked = .true.}
\DoxyCodeLine{338 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__tracer__registry_a86cd924ede0ff77b15065f5b3bd2cb29}\label{namespacemom__tracer__registry_a86cd924ede0ff77b15065f5b3bd2cb29}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!mom\_tracer\_chkinv@{mom\_tracer\_chkinv}}
\index{mom\_tracer\_chkinv@{mom\_tracer\_chkinv}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{mom\_tracer\_chkinv()}{mom\_tracer\_chkinv()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::mom\+\_\+tracer\+\_\+chkinv (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{mesg,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h,  }\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__type}{tracer\+\_\+type}}), dimension(\+:), intent(in)}]{Tr,  }\item[{integer, intent(in)}]{ntr }\end{DoxyParamCaption})}



Calculates and prints the global inventory of all tracers in the registry. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mesg} & message that appears on the chksum lines \\
\hline
\mbox{\texttt{ in}}  & {\em g} & ocean grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em tr} & array of all of registered tracers \\
\hline
\mbox{\texttt{ in}}  & {\em h} & Layer thicknesses \\
\hline
\mbox{\texttt{ in}}  & {\em ntr} & number of registered tracers \\
\hline
\end{DoxyParams}


Definition at line 826 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{826   \textcolor{keywordtype}{character(len=*)},                         \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{ !< message that appears on the chksum lines}}
\DoxyCodeLine{827   \textcolor{keywordtype}{type}(ocean\_grid\_type),                    \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< ocean grid structure}}
\DoxyCodeLine{828   \textcolor{keywordtype}{type}(tracer\_type), \textcolor{keywordtype}{dimension(:)},          \textcolor{keywordtype}{intent(in)} :: Tr\textcolor{comment}{   !< array of all of registered tracers}}
\DoxyCodeLine{829 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{    !< Layer thicknesses}}
\DoxyCodeLine{830   \textcolor{keywordtype}{integer},                                  \textcolor{keywordtype}{intent(in)} :: ntr\textcolor{comment}{  !< number of registered tracers}}
\DoxyCodeLine{831 }
\DoxyCodeLine{832 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))} :: tr\_inv\textcolor{comment}{ !< Tracer inventory}}
\DoxyCodeLine{833 \textcolor{keywordtype}{  real} :: total\_inv}
\DoxyCodeLine{834   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz}
\DoxyCodeLine{835   \textcolor{keywordtype}{integer} :: i, j, k, m}
\DoxyCodeLine{836 }
\DoxyCodeLine{837   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{838   \textcolor{keywordflow}{do} m=1,ntr}
\DoxyCodeLine{839     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{840       tr\_inv(i,j,k) = tr(m)\%t(i,j,k)*h(i,j,k)*g\%US\%L\_to\_m**2*g\%areaT(i,j)*g\%mask2dT(i,j)}
\DoxyCodeLine{841 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{842     total\_inv = \mbox{\hyperlink{interfacemom__coms_1_1reproducing__sum}{reproducing\_sum}}(tr\_inv, is+(1-\/g\%isd), ie+(1-\/g\%isd), js+(1-\/g\%jsd), je+(1-\/g\%jsd))}
\DoxyCodeLine{843     \textcolor{keywordflow}{if} (is\_root\_pe()) \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(A,1X,A5,1X,ES25.16,1X,A)'}) \textcolor{stringliteral}{"h-\/point: inventory"}, tr(m)\%name, total\_inv, mesg}
\DoxyCodeLine{844 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{845 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__tracer__registry_ad350bb834bb3dcfd6e603bb136bd8098}\label{namespacemom__tracer__registry_ad350bb834bb3dcfd6e603bb136bd8098}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!mom\_tracer\_chksum@{mom\_tracer\_chksum}}
\index{mom\_tracer\_chksum@{mom\_tracer\_chksum}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{mom\_tracer\_chksum()}{mom\_tracer\_chksum()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::mom\+\_\+tracer\+\_\+chksum (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{mesg,  }\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__type}{tracer\+\_\+type}}), dimension(\+:), intent(in)}]{Tr,  }\item[{integer, intent(in)}]{ntr,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G }\end{DoxyParamCaption})}



This subroutine writes out chksums for tracers. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mesg} & message that appears on the chksum lines \\
\hline
\mbox{\texttt{ in}}  & {\em tr} & array of all of registered tracers \\
\hline
\mbox{\texttt{ in}}  & {\em ntr} & number of registered tracers \\
\hline
\mbox{\texttt{ in}}  & {\em g} & ocean grid structure \\
\hline
\end{DoxyParams}


Definition at line 809 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{809   \textcolor{keywordtype}{character(len=*)},         \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{   !< message that appears on the chksum lines}}
\DoxyCodeLine{810   \textcolor{keywordtype}{type}(tracer\_type),        \textcolor{keywordtype}{intent(in)} :: Tr(:)\textcolor{comment}{  !< array of all of registered tracers}}
\DoxyCodeLine{811   \textcolor{keywordtype}{integer},                  \textcolor{keywordtype}{intent(in)} :: ntr\textcolor{comment}{    !< number of registered tracers}}
\DoxyCodeLine{812   \textcolor{keywordtype}{type}(ocean\_grid\_type),    \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{      !< ocean grid structure}}
\DoxyCodeLine{813 }
\DoxyCodeLine{814   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz}
\DoxyCodeLine{815   \textcolor{keywordtype}{integer} :: i, j, k, m}
\DoxyCodeLine{816 }
\DoxyCodeLine{817   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{818   \textcolor{keywordflow}{do} m=1,ntr}
\DoxyCodeLine{819     \textcolor{keyword}{call }hchksum(tr(m)\%t, mesg//trim(tr(m)\%name), g\%HI)}
\DoxyCodeLine{820 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{821 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__tracer__registry_a6840b8bb4ec1b2a2f023046ea47f509c}\label{namespacemom__tracer__registry_a6840b8bb4ec1b2a2f023046ea47f509c}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!post\_tracer\_diagnostics\_at\_sync@{post\_tracer\_diagnostics\_at\_sync}}
\index{post\_tracer\_diagnostics\_at\_sync@{post\_tracer\_diagnostics\_at\_sync}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{post\_tracer\_diagnostics\_at\_sync()}{post\_tracer\_diagnostics\_at\_sync()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::post\+\_\+tracer\+\_\+diagnostics\+\_\+at\+\_\+sync (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{Reg,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(gv)), intent(in)}]{h,  }\item[{type(diag\+\_\+grid\+\_\+storage), intent(in)}]{diag\+\_\+prev,  }\item[{type(diag\+\_\+ctrl), intent(inout)}]{diag,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{real, intent(in)}]{dt }\end{DoxyParamCaption})}



Post tracer diganostics when that should only be posted when M\+OM\textquotesingle{}s state is self-\/consistent (also referred to as \textquotesingle{}synchronized\textquotesingle{}) 


\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
 & {\em reg} & pointer to the tracer registry \\
\hline
\mbox{\texttt{ in}}  & {\em h} & Layer thicknesses \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+prev} & Contains diagnostic grids from previous timestep \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag} & structure to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em dt} & total time step for tracer updates \mbox{[}T $\sim$$>$ s\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 718 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{718   \textcolor{keywordtype}{type}(ocean\_grid\_type),      \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{719   \textcolor{keywordtype}{type}(verticalGrid\_type),    \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}}
\DoxyCodeLine{720   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer}    :: Reg\textcolor{comment}{  !< pointer to the tracer registry}}
\DoxyCodeLine{721 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \&}
\DoxyCodeLine{722                               \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{    !< Layer thicknesses}}
\DoxyCodeLine{723   \textcolor{keywordtype}{type}(diag\_grid\_storage),    \textcolor{keywordtype}{intent(in)} :: diag\_prev\textcolor{comment}{ !< Contains diagnostic grids from previous timestep}}
\DoxyCodeLine{724   \textcolor{keywordtype}{type}(diag\_ctrl),            \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{ !< structure to regulate diagnostic output}}
\DoxyCodeLine{725 \textcolor{keywordtype}{  real},                       \textcolor{keywordtype}{intent(in)} :: dt\textcolor{comment}{   !< total time step for tracer updates [T \string~> s]}}
\DoxyCodeLine{726 }
\DoxyCodeLine{727 \textcolor{keywordtype}{  real}    :: work3d(SZI\_(G),SZJ\_(G),SZK\_(GV))}
\DoxyCodeLine{728 \textcolor{keywordtype}{  real}    :: work2d(SZI\_(G),SZJ\_(G))}
\DoxyCodeLine{729 \textcolor{keywordtype}{  real}    :: Idt \textcolor{comment}{! The inverse of the time step [T-\/1 \string~> s-\/1]}}
\DoxyCodeLine{730   \textcolor{keywordtype}{type}(tracer\_type), \textcolor{keywordtype}{pointer} :: Tr=>null()}
\DoxyCodeLine{731   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, m}
\DoxyCodeLine{732   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{733 }
\DoxyCodeLine{734   idt = 0.; \textcolor{keywordflow}{if} (dt/=0.) idt = 1.0 / dt \textcolor{comment}{! The "if" is in case the diagnostic is called for a zero length interval}}
\DoxyCodeLine{735 }
\DoxyCodeLine{736   \textcolor{comment}{! Tendency diagnostics need to be posted on the grid from the last call to this routine}}
\DoxyCodeLine{737   \textcolor{keyword}{call }diag\_save\_grids(diag)}
\DoxyCodeLine{738   \textcolor{keyword}{call }diag\_copy\_storage\_to\_diag(diag, diag\_prev)}
\DoxyCodeLine{739   \textcolor{keywordflow}{do} m=1,reg\%ntr ; \textcolor{keywordflow}{if} (reg\%Tr(m)\%registry\_diags) \textcolor{keywordflow}{then}}
\DoxyCodeLine{740     tr => reg\%Tr(m)}
\DoxyCodeLine{741     \textcolor{keywordflow}{if} (tr\%id\_tr > 0) \textcolor{keyword}{call }post\_data(tr\%id\_tr, tr\%t, diag)}
\DoxyCodeLine{742     \textcolor{keywordflow}{if} (tr\%id\_tendency > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{743       work3d(:,:,:) = 0.0}
\DoxyCodeLine{744       \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{745         work3d(i,j,k)    = (tr\%t(i,j,k) -\/ tr\%t\_prev(i,j,k))*idt}
\DoxyCodeLine{746         tr\%t\_prev(i,j,k) =  tr\%t(i,j,k)}
\DoxyCodeLine{747 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{748       \textcolor{keyword}{call }post\_data(tr\%id\_tendency, work3d, diag, alt\_h=diag\_prev\%h\_state)}
\DoxyCodeLine{749 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{750     \textcolor{keywordflow}{if} ((tr\%id\_trxh\_tendency > 0) .or. (tr\%id\_trxh\_tendency\_2d > 0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{751       \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{752         work3d(i,j,k)     = (tr\%t(i,j,k)*h(i,j,k) -\/ tr\%Trxh\_prev(i,j,k)) * idt}
\DoxyCodeLine{753         tr\%Trxh\_prev(i,j,k) =  tr\%t(i,j,k) * h(i,j,k)}
\DoxyCodeLine{754 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{755       \textcolor{keywordflow}{if} (tr\%id\_trxh\_tendency > 0) \textcolor{keyword}{call }post\_data(tr\%id\_trxh\_tendency, work3d, diag, alt\_h=diag\_prev\%h\_state)}
\DoxyCodeLine{756       \textcolor{keywordflow}{if} (tr\%id\_trxh\_tendency\_2d > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{757         work2d(:,:) = 0.0}
\DoxyCodeLine{758         \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{759           work2d(i,j) = work2d(i,j) + work3d(i,j,k)}
\DoxyCodeLine{760 \textcolor{keywordflow}{        enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{761         \textcolor{keyword}{call }post\_data(tr\%id\_trxh\_tendency\_2d, work2d, diag)}
\DoxyCodeLine{762 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{763 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{764 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{765   \textcolor{keyword}{call }diag\_restore\_grids(diag)}
\DoxyCodeLine{766 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__tracer__registry_afac59be6855cac7e3021295ae1e501b4}\label{namespacemom__tracer__registry_afac59be6855cac7e3021295ae1e501b4}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!post\_tracer\_transport\_diagnostics@{post\_tracer\_transport\_diagnostics}}
\index{post\_tracer\_transport\_diagnostics@{post\_tracer\_transport\_diagnostics}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{post\_tracer\_transport\_diagnostics()}{post\_tracer\_transport\_diagnostics()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::post\+\_\+tracer\+\_\+transport\+\_\+diagnostics (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{Reg,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(gv)), intent(in)}]{h\+\_\+diag,  }\item[{type(diag\+\_\+ctrl), intent(in)}]{diag }\end{DoxyParamCaption})}



Post the advective and diffusive tendencies. 


\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
 & {\em reg} & pointer to the tracer registry \\
\hline
\mbox{\texttt{ in}}  & {\em h\+\_\+diag} & Layer thicknesses on which to post fields \\
\hline
\mbox{\texttt{ in}}  & {\em diag} & structure to regulate diagnostic output \\
\hline
\end{DoxyParams}


Definition at line 771 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{771   \textcolor{keywordtype}{type}(ocean\_grid\_type),      \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{772   \textcolor{keywordtype}{type}(verticalGrid\_type),    \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}}
\DoxyCodeLine{773   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer}    :: Reg\textcolor{comment}{  !< pointer to the tracer registry}}
\DoxyCodeLine{774 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \&}
\DoxyCodeLine{775                               \textcolor{keywordtype}{intent(in)} :: h\_diag\textcolor{comment}{ !< Layer thicknesses on which to post fields}}
\DoxyCodeLine{776   \textcolor{keywordtype}{type}(diag\_ctrl),            \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{ !< structure to regulate diagnostic output}}
\DoxyCodeLine{777 }
\DoxyCodeLine{778   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, m}
\DoxyCodeLine{779 \textcolor{keywordtype}{  real}    :: work2d(SZI\_(G),SZJ\_(G))}
\DoxyCodeLine{780   \textcolor{keywordtype}{type}(tracer\_type), \textcolor{keywordtype}{pointer} :: Tr=>null()}
\DoxyCodeLine{781 }
\DoxyCodeLine{782   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{783 }
\DoxyCodeLine{784   \textcolor{keywordflow}{do} m=1,reg\%ntr ; \textcolor{keywordflow}{if} (reg\%Tr(m)\%registry\_diags) \textcolor{keywordflow}{then}}
\DoxyCodeLine{785     tr => reg\%Tr(m)}
\DoxyCodeLine{786     \textcolor{keywordflow}{if} (tr\%id\_tr\_post\_horzn> 0) \textcolor{keyword}{call }post\_data(tr\%id\_tr\_post\_horzn, tr\%t, diag)}
\DoxyCodeLine{787     \textcolor{keywordflow}{if} (tr\%id\_adx > 0) \textcolor{keyword}{call }post\_data(tr\%id\_adx, tr\%ad\_x, diag, alt\_h=h\_diag)}
\DoxyCodeLine{788     \textcolor{keywordflow}{if} (tr\%id\_ady > 0) \textcolor{keyword}{call }post\_data(tr\%id\_ady, tr\%ad\_y, diag, alt\_h=h\_diag)}
\DoxyCodeLine{789     \textcolor{keywordflow}{if} (tr\%id\_dfx > 0) \textcolor{keyword}{call }post\_data(tr\%id\_dfx, tr\%df\_x, diag, alt\_h=h\_diag)}
\DoxyCodeLine{790     \textcolor{keywordflow}{if} (tr\%id\_dfy > 0) \textcolor{keyword}{call }post\_data(tr\%id\_dfy, tr\%df\_y, diag, alt\_h=h\_diag)}
\DoxyCodeLine{791     \textcolor{keywordflow}{if} (tr\%id\_adx\_2d > 0) \textcolor{keyword}{call }post\_data(tr\%id\_adx\_2d, tr\%ad2d\_x, diag)}
\DoxyCodeLine{792     \textcolor{keywordflow}{if} (tr\%id\_ady\_2d > 0) \textcolor{keyword}{call }post\_data(tr\%id\_ady\_2d, tr\%ad2d\_y, diag)}
\DoxyCodeLine{793     \textcolor{keywordflow}{if} (tr\%id\_dfx\_2d > 0) \textcolor{keyword}{call }post\_data(tr\%id\_dfx\_2d, tr\%df2d\_x, diag)}
\DoxyCodeLine{794     \textcolor{keywordflow}{if} (tr\%id\_dfy\_2d > 0) \textcolor{keyword}{call }post\_data(tr\%id\_dfy\_2d, tr\%df2d\_y, diag)}
\DoxyCodeLine{795     \textcolor{keywordflow}{if} (tr\%id\_adv\_xy > 0) \textcolor{keyword}{call }post\_data(tr\%id\_adv\_xy, tr\%advection\_xy, diag, alt\_h=h\_diag)}
\DoxyCodeLine{796     \textcolor{keywordflow}{if} (tr\%id\_adv\_xy\_2d > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{797       work2d(:,:) = 0.0}
\DoxyCodeLine{798       \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{799         work2d(i,j) = work2d(i,j) + tr\%advection\_xy(i,j,k)}
\DoxyCodeLine{800 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{801       \textcolor{keyword}{call }post\_data(tr\%id\_adv\_xy\_2d, work2d, diag)}
\DoxyCodeLine{802 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{803 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{804 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__tracer__registry_ada71d85c8d29e91166c59601c0e799ef}\label{namespacemom__tracer__registry_ada71d85c8d29e91166c59601c0e799ef}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!postale\_tracer\_diagnostics@{postale\_tracer\_diagnostics}}
\index{postale\_tracer\_diagnostics@{postale\_tracer\_diagnostics}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{postale\_tracer\_diagnostics()}{postale\_tracer\_diagnostics()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::postale\+\_\+tracer\+\_\+diagnostics (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{Reg,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(diag\+\_\+ctrl), intent(in)}]{diag,  }\item[{real, intent(in)}]{dt }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
 & {\em reg} & pointer to the tracer registry\\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure\\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure\\
\hline
\mbox{\texttt{ in}}  & {\em diag} & regulates diagnostic output\\
\hline
\mbox{\texttt{ in}}  & {\em dt} & total time interval for these diagnostics \mbox{[}T $\sim$$>$ s\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 689 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{689   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer}    :: Reg\textcolor{comment}{  !< pointer to the tracer registry}}
\DoxyCodeLine{690   \textcolor{keywordtype}{type}(ocean\_grid\_type),      \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{691   \textcolor{keywordtype}{type}(verticalGrid\_type),    \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< ocean vertical grid structure}}
\DoxyCodeLine{692   \textcolor{keywordtype}{type}(diag\_ctrl),            \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{ !< regulates diagnostic output}}
\DoxyCodeLine{693 \textcolor{keywordtype}{  real},                       \textcolor{keywordtype}{intent(in)} :: dt\textcolor{comment}{   !< total time interval for these diagnostics [T \string~> s]}}
\DoxyCodeLine{694 }
\DoxyCodeLine{695 \textcolor{keywordtype}{  real}    :: work(SZI\_(G),SZJ\_(G),SZK\_(G))}
\DoxyCodeLine{696 \textcolor{keywordtype}{  real}    :: Idt \textcolor{comment}{! The inverse of the time step [T-\/1 \string~> s-\/1]}}
\DoxyCodeLine{697   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, m, m2}
\DoxyCodeLine{698   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{699 }
\DoxyCodeLine{700   \textcolor{comment}{! The "if" is to avoid NaNs if the diagnostic is called for a zero length interval}}
\DoxyCodeLine{701   idt = 0.0 ; \textcolor{keywordflow}{if} (dt /= 0.0) idt = 1.0 / dt}
\DoxyCodeLine{702 }
\DoxyCodeLine{703   \textcolor{keywordflow}{do} m=1,reg\%ntr ; \textcolor{keywordflow}{if} (reg\%Tr(m)\%id\_tr\_vardec > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{704     m2 = reg\%Tr(m)\%ind\_tr\_squared}
\DoxyCodeLine{705     \textcolor{keywordflow}{if} (m2 < 1) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"Bad value of Tr\%ind\_tr\_squared for "}//trim(reg\%Tr(m)\%name))}
\DoxyCodeLine{706   \textcolor{comment}{! Update squared quantities}}
\DoxyCodeLine{707     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{708       work(i,j,k) = (reg\%Tr(m2)\%T(i,j,k) -\/ reg\%Tr(m)\%T(i,j,k)**2) * idt}
\DoxyCodeLine{709 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{710     \textcolor{keyword}{call }post\_data(reg\%Tr(m)\%id\_tr\_vardec, work, diag)}
\DoxyCodeLine{711 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{712 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__tracer__registry_a32c2b2e308a5183cd7681084e07d1624}\label{namespacemom__tracer__registry_a32c2b2e308a5183cd7681084e07d1624}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!preale\_tracer\_diagnostics@{preale\_tracer\_diagnostics}}
\index{preale\_tracer\_diagnostics@{preale\_tracer\_diagnostics}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{preale\_tracer\_diagnostics()}{preale\_tracer\_diagnostics()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::preale\+\_\+tracer\+\_\+diagnostics (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{Reg,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
 & {\em reg} & pointer to the tracer registry\\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure\\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure \\
\hline
\end{DoxyParams}


Definition at line 671 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{671   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer}    :: Reg\textcolor{comment}{  !< pointer to the tracer registry}}
\DoxyCodeLine{672   \textcolor{keywordtype}{type}(ocean\_grid\_type),      \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{673   \textcolor{keywordtype}{type}(verticalGrid\_type),    \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< ocean vertical grid structure}}
\DoxyCodeLine{674 }
\DoxyCodeLine{675   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, m, m2}
\DoxyCodeLine{676   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{677 }
\DoxyCodeLine{678   \textcolor{keywordflow}{do} m=1,reg\%ntr ; \textcolor{keywordflow}{if} (reg\%Tr(m)\%ind\_tr\_squared > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{679     m2 = reg\%Tr(m)\%ind\_tr\_squared}
\DoxyCodeLine{680   \textcolor{comment}{! Update squared quantities}}
\DoxyCodeLine{681     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{682       reg\%Tr(m2)\%T(i,j,k) = reg\%Tr(m)\%T(i,j,k)**2}
\DoxyCodeLine{683 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{684 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{685 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__tracer__registry_a97a70989bd0318f51d90c2fc6f87c6f5}\label{namespacemom__tracer__registry_a97a70989bd0318f51d90c2fc6f87c6f5}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!register\_tracer@{register\_tracer}}
\index{register\_tracer@{register\_tracer}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{register\_tracer()}{register\_tracer()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::register\+\_\+tracer (\begin{DoxyParamCaption}\item[{real, dimension( hi \%isd\+: hi \%ied, hi \%jsd\+: hi \%jed, gv \%ke), target}]{tr\+\_\+ptr,  }\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{Reg,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(hor\+\_\+index\+\_\+type), intent(in)}]{HI,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{character(len=$\ast$), intent(in), optional}]{name,  }\item[{character(len=$\ast$), intent(in), optional}]{longname,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+units,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+longname,  }\item[{type(vardesc), intent(in), optional}]{tr\+\_\+desc,  }\item[{real, intent(in), optional}]{O\+B\+C\+\_\+inflow,  }\item[{real, dimension(\+:,\+:,\+:), optional, pointer}]{O\+B\+C\+\_\+in\+\_\+u,  }\item[{real, dimension(\+:,\+:,\+:), optional, pointer}]{O\+B\+C\+\_\+in\+\_\+v,  }\item[{real, dimension(\+:,\+:,\+:), optional, pointer}]{ad\+\_\+x,  }\item[{real, dimension(\+:,\+:,\+:), optional, pointer}]{ad\+\_\+y,  }\item[{real, dimension(\+:,\+:,\+:), optional, pointer}]{df\+\_\+x,  }\item[{real, dimension(\+:,\+:,\+:), optional, pointer}]{df\+\_\+y,  }\item[{real, dimension(\+:,\+:), optional, pointer}]{ad\+\_\+2d\+\_\+x,  }\item[{real, dimension(\+:,\+:), optional, pointer}]{ad\+\_\+2d\+\_\+y,  }\item[{real, dimension(\+:,\+:), optional, pointer}]{df\+\_\+2d\+\_\+x,  }\item[{real, dimension(\+:,\+:), optional, pointer}]{df\+\_\+2d\+\_\+y,  }\item[{real, dimension(\+:,\+:,\+:), optional, pointer}]{advection\+\_\+xy,  }\item[{logical, intent(in), optional}]{registry\+\_\+diags,  }\item[{character(len=$\ast$), intent(in), optional}]{flux\+\_\+nameroot,  }\item[{character(len=$\ast$), intent(in), optional}]{flux\+\_\+longname,  }\item[{character(len=$\ast$), intent(in), optional}]{flux\+\_\+units,  }\item[{real, intent(in), optional}]{flux\+\_\+scale,  }\item[{character(len=$\ast$), intent(in), optional}]{convergence\+\_\+units,  }\item[{real, intent(in), optional}]{convergence\+\_\+scale,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+tendprefix,  }\item[{integer, intent(in), optional}]{diag\+\_\+form,  }\item[{type(mom\+\_\+restart\+\_\+cs), optional, pointer}]{restart\+\_\+\+CS,  }\item[{logical, intent(in), optional}]{mandatory }\end{DoxyParamCaption})}



This subroutine registers a tracer to be advected and laterally diffused. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em hi} & horizontal index type \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure \\
\hline
 & {\em reg} & pointer to the tracer registry \\
\hline
 & {\em tr\+\_\+ptr} & target or pointer to the tracer array \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & file to parse for model parameter values \\
\hline
\mbox{\texttt{ in}}  & {\em name} & Short tracer name \\
\hline
\mbox{\texttt{ in}}  & {\em longname} & The long tracer name \\
\hline
\mbox{\texttt{ in}}  & {\em units} & The units of this tracer \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+name} & C\+M\+OR name \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+units} & C\+M\+OR physical dimensions of variable \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+longname} & C\+M\+OR long name \\
\hline
\mbox{\texttt{ in}}  & {\em tr\+\_\+desc} & A structure with metadata about the tracer \\
\hline
\mbox{\texttt{ in}}  & {\em obc\+\_\+inflow} & the tracer for all inflows via O\+BC for which O\+B\+C\+\_\+in\+\_\+u or O\+B\+C\+\_\+in\+\_\+v are not specified (units of tracer C\+O\+NC) \\
\hline
 & {\em obc\+\_\+in\+\_\+u} & tracer at inflows through u-\/faces of tracer cells (units of tracer C\+O\+NC) \\
\hline
 & {\em obc\+\_\+in\+\_\+v} & tracer at inflows through v-\/faces of tracer cells (units of tracer C\+O\+NC) \\
\hline
 & {\em ad\+\_\+x} & diagnostic x-\/advective flux \mbox{[}conc H L2 T-\/1 $\sim$$>$ C\+O\+NC m3 s-\/1 or C\+O\+NC kg s-\/1\mbox{]} \\
\hline
 & {\em ad\+\_\+y} & diagnostic y-\/advective flux \mbox{[}conc H L2 T-\/1 $\sim$$>$ C\+O\+NC m3 s-\/1 or C\+O\+NC kg s-\/1\mbox{]} \\
\hline
 & {\em df\+\_\+x} & diagnostic x-\/diffusive flux \mbox{[}conc H L2 T-\/1 $\sim$$>$ C\+O\+NC m3 s-\/1 or C\+O\+NC kg s-\/1\mbox{]} \\
\hline
 & {\em df\+\_\+y} & diagnostic y-\/diffusive flux \mbox{[}conc H L2 T-\/1 $\sim$$>$ C\+O\+NC m3 s-\/1 or C\+O\+NC kg s-\/1\mbox{]} \\
\hline
 & {\em ad\+\_\+2d\+\_\+x} & vert sum of diagnostic x-\/advect flux \mbox{[}conc H L2 T-\/1 $\sim$$>$ C\+O\+NC m3 s-\/1 or C\+O\+NC kg s-\/1\mbox{]} \\
\hline
 & {\em ad\+\_\+2d\+\_\+y} & vert sum of diagnostic y-\/advect flux \mbox{[}conc H L2 T-\/1 $\sim$$>$ C\+O\+NC m3 s-\/1 or C\+O\+NC kg s-\/1\mbox{]} \\
\hline
 & {\em df\+\_\+2d\+\_\+x} & vert sum of diagnostic x-\/diffuse flux \mbox{[}conc H L2 T-\/1 $\sim$$>$ C\+O\+NC m3 s-\/1 or C\+O\+NC kg s-\/1\mbox{]} \\
\hline
 & {\em df\+\_\+2d\+\_\+y} & vert sum of diagnostic y-\/diffuse flux \mbox{[}conc H L2 T-\/1 $\sim$$>$ C\+O\+NC m3 s-\/1 or C\+O\+NC kg s-\/1\mbox{]} \\
\hline
 & {\em advection\+\_\+xy} & convergence of lateral advective tracer fluxes \\
\hline
\mbox{\texttt{ in}}  & {\em registry\+\_\+diags} & If present and true, use the registry for the diagnostics of this tracer. \\
\hline
\mbox{\texttt{ in}}  & {\em flux\+\_\+nameroot} & Short tracer name snippet used construct the names of flux diagnostics. \\
\hline
\mbox{\texttt{ in}}  & {\em flux\+\_\+longname} & A word or phrase used construct the long names of flux diagnostics. \\
\hline
\mbox{\texttt{ in}}  & {\em flux\+\_\+units} & The units for the fluxes of this tracer. \\
\hline
\mbox{\texttt{ in}}  & {\em flux\+\_\+scale} & A scaling factor used to convert the fluxes of this tracer to its desired units. \\
\hline
\mbox{\texttt{ in}}  & {\em convergence\+\_\+units} & The units for the flux convergence of this tracer. \\
\hline
\mbox{\texttt{ in}}  & {\em convergence\+\_\+scale} & A scaling factor used to convert the flux convergence of this tracer to its desired units. \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+tendprefix} & The C\+M\+OR name for the layer-\/integrated tendencies of this tracer. \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+form} & An integer (1 or 2, 1 by default) indicating the character string template to use in labeling diagnostics \\
\hline
 & {\em restart\+\_\+cs} & A pointer to the restart control structure this tracer will be registered for restarts if this argument is present \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, this tracer must be read from a restart file. \\
\hline
\end{DoxyParams}


Definition at line 158 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{158   \textcolor{keywordtype}{type}(hor\_index\_type),           \textcolor{keywordtype}{intent(in)}    :: HI\textcolor{comment}{           !< horizontal index type}}
\DoxyCodeLine{159   \textcolor{keywordtype}{type}(verticalGrid\_type),        \textcolor{keywordtype}{intent(in)}    :: GV\textcolor{comment}{           !< ocean vertical grid structure}}
\DoxyCodeLine{160   \textcolor{keywordtype}{type}(tracer\_registry\_type),     \textcolor{keywordtype}{pointer}       :: Reg\textcolor{comment}{          !< pointer to the tracer registry}}
\DoxyCodeLine{161 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(HI),SZJ\_(HI),SZK\_(GV))}, \&}
\DoxyCodeLine{162                                   \textcolor{keywordtype}{target}        :: tr\_ptr\textcolor{comment}{       !< target or pointer to the tracer array}}
\DoxyCodeLine{163   \textcolor{keywordtype}{type}(param\_file\_type), \textcolor{keywordtype}{intent(in)}             :: param\_file\textcolor{comment}{   !< file to parse for model parameter values}}
\DoxyCodeLine{164   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: name\textcolor{comment}{         !< Short tracer name}}
\DoxyCodeLine{165   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: longname\textcolor{comment}{     !< The long tracer name}}
\DoxyCodeLine{166   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: units\textcolor{comment}{        !< The units of this tracer}}
\DoxyCodeLine{167   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: cmor\_name\textcolor{comment}{    !< CMOR name}}
\DoxyCodeLine{168   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: cmor\_units\textcolor{comment}{   !< CMOR physical dimensions of variable}}
\DoxyCodeLine{169   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: cmor\_longname\textcolor{comment}{ !< CMOR long name}}
\DoxyCodeLine{170   \textcolor{keywordtype}{type}(vardesc),        \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: tr\_desc\textcolor{comment}{      !< A structure with metadata about the tracer}}
\DoxyCodeLine{171 }
\DoxyCodeLine{172 \textcolor{keywordtype}{  real},                 \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: OBC\_inflow\textcolor{comment}{   !< the tracer for all inflows via OBC for which OBC\_in\_u}}
\DoxyCodeLine{173 \textcolor{comment}{                                                                !! or OBC\_in\_v are not specified (units of tracer CONC)}}
\DoxyCodeLine{174 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}     :: OBC\_in\_u\textcolor{comment}{     !< tracer at inflows through u-\/faces of}}
\DoxyCodeLine{175 \textcolor{comment}{                                                                !! tracer cells (units of tracer CONC)}}
\DoxyCodeLine{176 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}     :: OBC\_in\_v\textcolor{comment}{     !< tracer at inflows through v-\/faces of}}
\DoxyCodeLine{177 \textcolor{comment}{                                                                !! tracer cells (units of tracer CONC)}}
\DoxyCodeLine{178 }
\DoxyCodeLine{179   \textcolor{comment}{! The following are probably not necessary if registry\_diags is present and true.}}
\DoxyCodeLine{180 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}     :: ad\_x\textcolor{comment}{         !< diagnostic x-\/advective flux}}
\DoxyCodeLine{181 \textcolor{comment}{                                                                !! [conc H L2 T-\/1 \string~> CONC m3 s-\/1 or CONC kg s-\/1]}}
\DoxyCodeLine{182 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}     :: ad\_y\textcolor{comment}{         !< diagnostic y-\/advective flux}}
\DoxyCodeLine{183 \textcolor{comment}{                                                                !! [conc H L2 T-\/1 \string~> CONC m3 s-\/1 or CONC kg s-\/1]}}
\DoxyCodeLine{184 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}     :: df\_x\textcolor{comment}{         !< diagnostic x-\/diffusive flux}}
\DoxyCodeLine{185 \textcolor{comment}{                                                                !! [conc H L2 T-\/1 \string~> CONC m3 s-\/1 or CONC kg s-\/1]}}
\DoxyCodeLine{186 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}     :: df\_y\textcolor{comment}{         !< diagnostic y-\/diffusive flux}}
\DoxyCodeLine{187 \textcolor{comment}{                                                                !! [conc H L2 T-\/1 \string~> CONC m3 s-\/1 or CONC kg s-\/1]}}
\DoxyCodeLine{188 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)},   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}     :: ad\_2d\_x\textcolor{comment}{      !< vert sum of diagnostic x-\/advect flux}}
\DoxyCodeLine{189 \textcolor{comment}{                                                                !! [conc H L2 T-\/1 \string~> CONC m3 s-\/1 or CONC kg s-\/1]}}
\DoxyCodeLine{190 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)},   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}     :: ad\_2d\_y\textcolor{comment}{      !< vert sum of diagnostic y-\/advect flux}}
\DoxyCodeLine{191 \textcolor{comment}{                                                                !! [conc H L2 T-\/1 \string~> CONC m3 s-\/1 or CONC kg s-\/1]}}
\DoxyCodeLine{192 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)},   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}     :: df\_2d\_x\textcolor{comment}{      !< vert sum of diagnostic x-\/diffuse flux}}
\DoxyCodeLine{193 \textcolor{comment}{                                                                !! [conc H L2 T-\/1 \string~> CONC m3 s-\/1 or CONC kg s-\/1]}}
\DoxyCodeLine{194 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)},   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}     :: df\_2d\_y\textcolor{comment}{      !< vert sum of diagnostic y-\/diffuse flux}}
\DoxyCodeLine{195 \textcolor{comment}{                                                                !! [conc H L2 T-\/1 \string~> CONC m3 s-\/1 or CONC kg s-\/1]}}
\DoxyCodeLine{196 }
\DoxyCodeLine{197 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}     :: advection\_xy\textcolor{comment}{ !< convergence of lateral advective tracer fluxes}}
\DoxyCodeLine{198   \textcolor{keywordtype}{logical},              \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: registry\_diags\textcolor{comment}{ !< If present and true, use the registry for}}
\DoxyCodeLine{199 \textcolor{comment}{                                                                !! the diagnostics of this tracer.}}
\DoxyCodeLine{200   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: flux\_nameroot\textcolor{comment}{ !< Short tracer name snippet used construct the}}
\DoxyCodeLine{201 \textcolor{comment}{                                                                !! names of flux diagnostics.}}
\DoxyCodeLine{202   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: flux\_longname\textcolor{comment}{ !< A word or phrase used construct the long}}
\DoxyCodeLine{203 \textcolor{comment}{                                                                !! names of flux diagnostics.}}
\DoxyCodeLine{204   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: flux\_units\textcolor{comment}{   !< The units for the fluxes of this tracer.}}
\DoxyCodeLine{205 \textcolor{keywordtype}{  real},                 \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: flux\_scale\textcolor{comment}{   !< A scaling factor used to convert the fluxes}}
\DoxyCodeLine{206 \textcolor{comment}{                                                                !! of this tracer to its desired units.}}
\DoxyCodeLine{207   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: convergence\_units\textcolor{comment}{ !< The units for the flux convergence of}}
\DoxyCodeLine{208 \textcolor{comment}{                                                                !! this tracer.}}
\DoxyCodeLine{209 \textcolor{keywordtype}{  real},                 \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: convergence\_scale\textcolor{comment}{ !< A scaling factor used to convert the flux}}
\DoxyCodeLine{210 \textcolor{comment}{                                                                !! convergence of this tracer to its desired units.}}
\DoxyCodeLine{211   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: cmor\_tendprefix\textcolor{comment}{ !< The CMOR name for the layer-\/integrated}}
\DoxyCodeLine{212 \textcolor{comment}{                                                                !! tendencies of this tracer.}}
\DoxyCodeLine{213   \textcolor{keywordtype}{integer},              \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: diag\_form\textcolor{comment}{    !< An integer (1 or 2, 1 by default) indicating the}}
\DoxyCodeLine{214 \textcolor{comment}{                                                                !! character string template to use in}}
\DoxyCodeLine{215 \textcolor{comment}{                                                                !! labeling diagnostics}}
\DoxyCodeLine{216   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{pointer}       :: restart\_CS\textcolor{comment}{   !< A pointer to the restart control structure}}
\DoxyCodeLine{217 \textcolor{comment}{                                                                !! this tracer will be registered for}}
\DoxyCodeLine{218 \textcolor{comment}{                                                                !! restarts if this argument is present}}
\DoxyCodeLine{219   \textcolor{keywordtype}{logical},              \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: mandatory\textcolor{comment}{    !< If true, this tracer must be read}}
\DoxyCodeLine{220 \textcolor{comment}{                                                                !! from a restart file.}}
\DoxyCodeLine{221 }
\DoxyCodeLine{222   \textcolor{keywordtype}{logical} :: mand}
\DoxyCodeLine{223   \textcolor{keywordtype}{type}(tracer\_type), \textcolor{keywordtype}{pointer} :: Tr=>null()}
\DoxyCodeLine{224   \textcolor{keywordtype}{character(len=256)} :: mesg    \textcolor{comment}{! Message for error messages.}}
\DoxyCodeLine{225 }
\DoxyCodeLine{226   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(reg)) \textcolor{keyword}{call }tracer\_registry\_init(param\_file, reg)}
\DoxyCodeLine{227 }
\DoxyCodeLine{228   \textcolor{keywordflow}{if} (reg\%ntr>=max\_fields\_) \textcolor{keywordflow}{then}}
\DoxyCodeLine{229     \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("Increase MAX\_FIELDS\_ in MOM\_memory.h to at least ",I3," to allow for \&}}
\DoxyCodeLine{230 \textcolor{stringliteral}{}\textcolor{stringliteral}{        \&all the tracers being registered via register\_tracer.")'}) reg\%ntr+1}
\DoxyCodeLine{231     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"MOM register\_tracer: "}//mesg)}
\DoxyCodeLine{232 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{233   reg\%ntr = reg\%ntr + 1}
\DoxyCodeLine{234 }
\DoxyCodeLine{235   tr => reg\%Tr(reg\%ntr)}
\DoxyCodeLine{236 }
\DoxyCodeLine{237   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(name)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{238     tr\%name = name}
\DoxyCodeLine{239     tr\%longname = name ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(longname)) tr\%longname = longname}
\DoxyCodeLine{240     tr\%units = \textcolor{stringliteral}{"Conc"} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(units)) tr\%units = units}
\DoxyCodeLine{241 }
\DoxyCodeLine{242     tr\%cmor\_name = \textcolor{stringliteral}{""}}
\DoxyCodeLine{243     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_name)) tr\%cmor\_name = cmor\_name}
\DoxyCodeLine{244 }
\DoxyCodeLine{245     tr\%cmor\_units = tr\%units}
\DoxyCodeLine{246     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_units)) tr\%cmor\_units = cmor\_units}
\DoxyCodeLine{247 }
\DoxyCodeLine{248     tr\%cmor\_longname = \textcolor{stringliteral}{""}}
\DoxyCodeLine{249     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_longname)) tr\%cmor\_longname = cmor\_longname}
\DoxyCodeLine{250 }
\DoxyCodeLine{251     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_desc)) \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"MOM register\_tracer: "}//\&}
\DoxyCodeLine{252       \textcolor{stringliteral}{"It is a bad idea to use both name and tr\_desc when registring "}//trim(name))}
\DoxyCodeLine{253   \textcolor{keywordflow}{elseif} (\textcolor{keyword}{present}(tr\_desc)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{254     \textcolor{keyword}{call }query\_vardesc(tr\_desc, name=tr\%name, units=tr\%units, \&}
\DoxyCodeLine{255                        longname=tr\%longname, cmor\_field\_name=tr\%cmor\_name, \&}
\DoxyCodeLine{256                        cmor\_longname=tr\%cmor\_longname, caller=\textcolor{stringliteral}{"register\_tracer"})}
\DoxyCodeLine{257     tr\%cmor\_units = tr\%units}
\DoxyCodeLine{258   \textcolor{keywordflow}{else}}
\DoxyCodeLine{259     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"MOM register\_tracer: Either name or "}//\&}
\DoxyCodeLine{260                    \textcolor{stringliteral}{"tr\_desc must be present when registering a tracer."})}
\DoxyCodeLine{261 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{262 }
\DoxyCodeLine{263   \textcolor{keywordflow}{if} (reg\%locked) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{264       \textcolor{stringliteral}{"MOM register\_tracer was called for variable "}//trim(tr\%name)//\&}
\DoxyCodeLine{265       \textcolor{stringliteral}{" with a locked tracer registry."})}
\DoxyCodeLine{266 }
\DoxyCodeLine{267   tr\%flux\_nameroot = tr\%name}
\DoxyCodeLine{268   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(flux\_nameroot)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{269     \textcolor{keywordflow}{if} (len\_trim(flux\_nameroot) > 0) tr\%flux\_nameroot = flux\_nameroot}
\DoxyCodeLine{270 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{271 }
\DoxyCodeLine{272   tr\%flux\_longname = tr\%longname}
\DoxyCodeLine{273   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(flux\_longname)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{274     \textcolor{keywordflow}{if} (len\_trim(flux\_longname) > 0) tr\%flux\_longname = flux\_longname}
\DoxyCodeLine{275 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{276 }
\DoxyCodeLine{277   tr\%flux\_units = \textcolor{stringliteral}{""}}
\DoxyCodeLine{278   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(flux\_units)) tr\%flux\_units = flux\_units}
\DoxyCodeLine{279 }
\DoxyCodeLine{280   tr\%flux\_scale = 1.0}
\DoxyCodeLine{281   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(flux\_scale)) tr\%flux\_scale = flux\_scale}
\DoxyCodeLine{282 }
\DoxyCodeLine{283   tr\%conv\_units = \textcolor{stringliteral}{""}}
\DoxyCodeLine{284   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(convergence\_units)) tr\%conv\_units = convergence\_units}
\DoxyCodeLine{285 }
\DoxyCodeLine{286   tr\%cmor\_tendprefix = \textcolor{stringliteral}{""}}
\DoxyCodeLine{287   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_tendprefix)) tr\%cmor\_tendprefix = cmor\_tendprefix}
\DoxyCodeLine{288 }
\DoxyCodeLine{289   tr\%conv\_scale = 1.0}
\DoxyCodeLine{290   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(convergence\_scale)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{291     tr\%conv\_scale = convergence\_scale}
\DoxyCodeLine{292   \textcolor{keywordflow}{elseif} (\textcolor{keyword}{present}(flux\_scale)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{293     tr\%conv\_scale = flux\_scale}
\DoxyCodeLine{294 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{295 }
\DoxyCodeLine{296   tr\%diag\_form = 1}
\DoxyCodeLine{297   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(diag\_form)) tr\%diag\_form = diag\_form}
\DoxyCodeLine{298 }
\DoxyCodeLine{299   tr\%t => tr\_ptr}
\DoxyCodeLine{300 }
\DoxyCodeLine{301   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(registry\_diags)) tr\%registry\_diags = registry\_diags}
\DoxyCodeLine{302 }
\DoxyCodeLine{303   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(ad\_x)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(ad\_x)) tr\%ad\_x => ad\_x ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{304   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(ad\_y)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(ad\_y)) tr\%ad\_y => ad\_y ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{305   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(df\_x)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(df\_x)) tr\%df\_x => df\_x ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{306   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(df\_y)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(df\_y)) tr\%df\_y => df\_y ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{307 \textcolor{comment}{! if (present(OBC\_inflow)) Tr\%OBC\_inflow\_conc = OBC\_inflow}}
\DoxyCodeLine{308 \textcolor{comment}{! if (present(OBC\_in\_u)) then ; if (associated(OBC\_in\_u)) \&}}
\DoxyCodeLine{309 \textcolor{comment}{!                                   Tr\%OBC\_in\_u => OBC\_in\_u ; endif}}
\DoxyCodeLine{310 \textcolor{comment}{! if (present(OBC\_in\_v)) then ; if (associated(OBC\_in\_v)) \&}}
\DoxyCodeLine{311 \textcolor{comment}{!                                   Tr\%OBC\_in\_v => OBC\_in\_v ; endif}}
\DoxyCodeLine{312   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(ad\_2d\_x)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(ad\_2d\_x)) tr\%ad2d\_x => ad\_2d\_x ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{313   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(ad\_2d\_y)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(ad\_2d\_y)) tr\%ad2d\_y => ad\_2d\_y ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{314   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(df\_2d\_x)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(df\_2d\_x)) tr\%df2d\_x => df\_2d\_x ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{315 }
\DoxyCodeLine{316   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(advection\_xy)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(advection\_xy)) tr\%advection\_xy => advection\_xy ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{317 }
\DoxyCodeLine{318   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(restart\_cs)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(restart\_cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{319     \textcolor{comment}{! Register this tracer to be read from and written to restart files.}}
\DoxyCodeLine{320     mand = .true. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mandatory)) mand = mandatory}
\DoxyCodeLine{321 }
\DoxyCodeLine{322     \textcolor{keyword}{call }register\_restart\_field(tr\_ptr, tr\%name, mand, restart\_cs, \&}
\DoxyCodeLine{323                                 longname=tr\%longname, units=tr\%units)}
\DoxyCodeLine{324 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{325 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__tracer__registry_a6210cf64994a49ae3c14e3500c957fb1}\label{namespacemom__tracer__registry_a6210cf64994a49ae3c14e3500c957fb1}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!register\_tracer\_diagnostics@{register\_tracer\_diagnostics}}
\index{register\_tracer\_diagnostics@{register\_tracer\_diagnostics}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{register\_tracer\_diagnostics()}{register\_tracer\_diagnostics()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::register\+\_\+tracer\+\_\+diagnostics (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{Reg,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, gv \%ke), intent(in)}]{h,  }\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(diag\+\_\+ctrl), intent(in)}]{diag,  }\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)}]{use\+\_\+\+A\+LE }\end{DoxyParamCaption})}



register\+\_\+tracer\+\_\+diagnostics does a set of register\+\_\+diag\+\_\+field calls for any previously registered in a tracer registry with a value of registry\+\_\+diags set to .true. 


\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 us} & A dimensional unit scaling type \\
\hline
 & {\em reg} & pointer to the tracer registry \\
\hline
\mbox{\texttt{ in}}  & {\em h} & Layer thicknesses \\
\hline
\mbox{\texttt{ in}}  & {\em time} & current model time \\
\hline
\mbox{\texttt{ in}}  & {\em diag} & structure to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em use\+\_\+ale} & If true active diagnostics that only apply to A\+LE configurations \\
\hline
\end{DoxyParams}


Definition at line 344 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{344   \textcolor{keywordtype}{type}(ocean\_grid\_type),      \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{345   \textcolor{keywordtype}{type}(verticalGrid\_type),    \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}}
\DoxyCodeLine{346   \textcolor{keywordtype}{type}(unit\_scale\_type),      \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{   !< A dimensional unit scaling type}}
\DoxyCodeLine{347   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer}    :: Reg\textcolor{comment}{  !< pointer to the tracer registry}}
\DoxyCodeLine{348 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \&}
\DoxyCodeLine{349                               \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{    !< Layer thicknesses}}
\DoxyCodeLine{350   \textcolor{keywordtype}{type}(time\_type),            \textcolor{keywordtype}{intent(in)} :: Time\textcolor{comment}{ !< current model time}}
\DoxyCodeLine{351   \textcolor{keywordtype}{type}(diag\_ctrl),            \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{ !< structure to regulate diagnostic output}}
\DoxyCodeLine{352   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: use\_ALE\textcolor{comment}{ !< If true active diagnostics that only}}
\DoxyCodeLine{353 \textcolor{comment}{                                                 !! apply to ALE configurations}}
\DoxyCodeLine{354 }
\DoxyCodeLine{355   \textcolor{keywordtype}{character(len=24)} :: name     \textcolor{comment}{! A variable's name in a NetCDF file.}}
\DoxyCodeLine{356   \textcolor{keywordtype}{character(len=24)} :: shortnm  \textcolor{comment}{! A shortened version of a variable's name for}}
\DoxyCodeLine{357                                 \textcolor{comment}{! creating additional diagnostics.}}
\DoxyCodeLine{358   \textcolor{keywordtype}{character(len=72)} :: longname \textcolor{comment}{! The long name of that tracer variable.}}
\DoxyCodeLine{359   \textcolor{keywordtype}{character(len=72)} :: flux\_longname \textcolor{comment}{! The tracer name in the long names of fluxes.}}
\DoxyCodeLine{360   \textcolor{keywordtype}{character(len=48)} :: units    \textcolor{comment}{! The dimensions of the tracer.}}
\DoxyCodeLine{361   \textcolor{keywordtype}{character(len=48)} :: flux\_units \textcolor{comment}{! The units for fluxes, either}}
\DoxyCodeLine{362                                 \textcolor{comment}{! [units] m3 s-\/1 or [units] kg s-\/1.}}
\DoxyCodeLine{363   \textcolor{keywordtype}{character(len=48)} :: conv\_units \textcolor{comment}{! The units for flux convergences, either}}
\DoxyCodeLine{364                                 \textcolor{comment}{! [units] m2 s-\/1 or [units] kg s-\/1.}}
\DoxyCodeLine{365   \textcolor{keywordtype}{character(len=48)} :: unit2    \textcolor{comment}{! The dimensions of the tracer squared}}
\DoxyCodeLine{366   \textcolor{keywordtype}{character(len=72)}  :: cmorname \textcolor{comment}{! The CMOR name of this tracer.}}
\DoxyCodeLine{367   \textcolor{keywordtype}{character(len=120)} :: cmor\_longname \textcolor{comment}{! The CMOR long name of that variable.}}
\DoxyCodeLine{368   \textcolor{keywordtype}{character(len=120)} :: var\_lname      \textcolor{comment}{! A temporary longname for a diagnostic.}}
\DoxyCodeLine{369   \textcolor{keywordtype}{character(len=120)} :: cmor\_var\_lname \textcolor{comment}{! The temporary CMOR long name for a diagnostic}}
\DoxyCodeLine{370   \textcolor{keywordtype}{character(len=72)}  :: cmor\_varname \textcolor{comment}{! The temporary CMOR name for a diagnostic}}
\DoxyCodeLine{371   \textcolor{keywordtype}{type}(tracer\_type), \textcolor{keywordtype}{pointer} :: Tr=>null()}
\DoxyCodeLine{372   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, m, m2, nTr\_in}
\DoxyCodeLine{373   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{374   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{375   isd  = g\%isd  ; ied  = g\%ied  ; jsd  = g\%jsd  ; jed  = g\%jed}
\DoxyCodeLine{376   isdb = g\%IsdB ; iedb = g\%IedB ; jsdb = g\%JsdB ; jedb = g\%JedB}
\DoxyCodeLine{377 }
\DoxyCodeLine{378   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(reg)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"register\_tracer\_diagnostics: "}//\&}
\DoxyCodeLine{379        \textcolor{stringliteral}{"register\_tracer must be called before register\_tracer\_diagnostics"})}
\DoxyCodeLine{380 }
\DoxyCodeLine{381   ntr\_in = reg\%ntr}
\DoxyCodeLine{382 }
\DoxyCodeLine{383   \textcolor{keywordflow}{do} m=1,ntr\_in ; \textcolor{keywordflow}{if} (reg\%Tr(m)\%registry\_diags) \textcolor{keywordflow}{then}}
\DoxyCodeLine{384     tr => reg\%Tr(m)}
\DoxyCodeLine{385 \textcolor{comment}{!    call query\_vardesc(Tr\%vd, name, units=units, longname=longname, \&}}
\DoxyCodeLine{386 \textcolor{comment}{!                       cmor\_field\_name=cmorname, cmor\_longname=cmor\_longname, \&}}
\DoxyCodeLine{387 \textcolor{comment}{!                       caller="register\_tracer\_diagnostics")}}
\DoxyCodeLine{388     name = tr\%name ; units=adjustl(tr\%units) ; longname = tr\%longname}
\DoxyCodeLine{389     cmorname = tr\%cmor\_name ; cmor\_longname = tr\%cmor\_longname}
\DoxyCodeLine{390     shortnm = tr\%flux\_nameroot}
\DoxyCodeLine{391     flux\_longname = tr\%flux\_longname}
\DoxyCodeLine{392     \textcolor{keywordflow}{if} (len\_trim(cmor\_longname) == 0) cmor\_longname = longname}
\DoxyCodeLine{393 }
\DoxyCodeLine{394     \textcolor{keywordflow}{if} (len\_trim(tr\%flux\_units) > 0) \textcolor{keywordflow}{then} ; flux\_units = tr\%flux\_units}
\DoxyCodeLine{395     \textcolor{keywordflow}{elseif} (gv\%Boussinesq) \textcolor{keywordflow}{then} ; flux\_units = trim(units)//\textcolor{stringliteral}{" m3 s-\/1"}}
\DoxyCodeLine{396     \textcolor{keywordflow}{else} ; flux\_units = trim(units)//\textcolor{stringliteral}{" kg s-\/1"} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{397 }
\DoxyCodeLine{398     \textcolor{keywordflow}{if} (len\_trim(tr\%conv\_units) > 0) \textcolor{keywordflow}{then} ; conv\_units = tr\%conv\_units}
\DoxyCodeLine{399     \textcolor{keywordflow}{elseif} (gv\%Boussinesq) \textcolor{keywordflow}{then} ; conv\_units = trim(units)//\textcolor{stringliteral}{" m s-\/1"}}
\DoxyCodeLine{400     \textcolor{keywordflow}{else} ; conv\_units = trim(units)//\textcolor{stringliteral}{" kg m-\/2 s-\/1"} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{401 }
\DoxyCodeLine{402     \textcolor{keywordflow}{if} (len\_trim(cmorname) == 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{403       tr\%id\_tr = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(name), diag\%axesTL, \&}
\DoxyCodeLine{404         time, trim(longname), trim(units))}
\DoxyCodeLine{405     \textcolor{keywordflow}{else}}
\DoxyCodeLine{406       tr\%id\_tr = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(name), diag\%axesTL, \&}
\DoxyCodeLine{407         time, trim(longname), trim(units), cmor\_field\_name=cmorname, \&}
\DoxyCodeLine{408         cmor\_long\_name=cmor\_longname, cmor\_units=tr\%cmor\_units, \&}
\DoxyCodeLine{409         cmor\_standard\_name=cmor\_long\_std(cmor\_longname))}
\DoxyCodeLine{410 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{411     tr\%id\_tr\_post\_horzn = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"},                \&}
\DoxyCodeLine{412       trim(name)//\textcolor{stringliteral}{"\_post\_horzn"}, diag\%axesTL, time,                         \&}
\DoxyCodeLine{413       trim(longname)//\textcolor{stringliteral}{" after horizontal transport (advection/diffusion) "}//\&}
\DoxyCodeLine{414       \textcolor{stringliteral}{"has occurred"}, trim(units))}
\DoxyCodeLine{415     \textcolor{keywordflow}{if} (tr\%diag\_form == 1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{416       tr\%id\_adx = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_adx"}, \&}
\DoxyCodeLine{417           diag\%axesCuL, time, trim(flux\_longname)//\textcolor{stringliteral}{" advective zonal flux"} , \&}
\DoxyCodeLine{418           trim(flux\_units), v\_extensive = .true., y\_cell\_method = \textcolor{stringliteral}{'sum'}, \&}
\DoxyCodeLine{419           conversion=tr\%flux\_scale*(us\%L\_to\_m**2)*us\%s\_to\_T)}
\DoxyCodeLine{420       tr\%id\_ady = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_ady"}, \&}
\DoxyCodeLine{421           diag\%axesCvL, time, trim(flux\_longname)//\textcolor{stringliteral}{" advective meridional flux"} , \&}
\DoxyCodeLine{422           trim(flux\_units), v\_extensive = .true., x\_cell\_method = \textcolor{stringliteral}{'sum'}, \&}
\DoxyCodeLine{423           conversion=tr\%flux\_scale*(us\%L\_to\_m**2)*us\%s\_to\_T)}
\DoxyCodeLine{424       tr\%id\_dfx = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_dfx"}, \&}
\DoxyCodeLine{425           diag\%axesCuL, time, trim(flux\_longname)//\textcolor{stringliteral}{" diffusive zonal flux"} , \&}
\DoxyCodeLine{426           trim(flux\_units), v\_extensive = .true., y\_cell\_method = \textcolor{stringliteral}{'sum'}, \&}
\DoxyCodeLine{427           conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T)}
\DoxyCodeLine{428       tr\%id\_dfy = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_dfy"}, \&}
\DoxyCodeLine{429           diag\%axesCvL, time, trim(flux\_longname)//\textcolor{stringliteral}{" diffusive zonal flux"} , \&}
\DoxyCodeLine{430           trim(flux\_units), v\_extensive = .true., x\_cell\_method = \textcolor{stringliteral}{'sum'}, \&}
\DoxyCodeLine{431           conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T)}
\DoxyCodeLine{432       tr\%id\_lbd\_dfx = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_lbd\_diffx"}, \&}
\DoxyCodeLine{433           diag\%axesCuL, time, trim(flux\_longname)//\textcolor{stringliteral}{" diffusive zonal flux from the lateral boundary diffusion "}//\&}
\DoxyCodeLine{434           \textcolor{stringliteral}{"scheme"}, trim(flux\_units), v\_extensive = .true., y\_cell\_method = \textcolor{stringliteral}{'sum'}, \&}
\DoxyCodeLine{435           conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T)}
\DoxyCodeLine{436       tr\%id\_lbd\_dfy = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_lbd\_diffy"}, \&}
\DoxyCodeLine{437           diag\%axesCvL, time, trim(flux\_longname)//\textcolor{stringliteral}{" diffusive meridional flux from the lateral boundary diffusion "}//\&}
\DoxyCodeLine{438           \textcolor{stringliteral}{"scheme"}, trim(flux\_units), v\_extensive = .true., x\_cell\_method = \textcolor{stringliteral}{'sum'}, \&}
\DoxyCodeLine{439           conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T)}
\DoxyCodeLine{440     \textcolor{keywordflow}{else}}
\DoxyCodeLine{441       tr\%id\_adx = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_adx"}, \&}
\DoxyCodeLine{442           diag\%axesCuL, time, \textcolor{stringliteral}{"Advective (by residual mean) Zonal Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{443           flux\_units, v\_extensive=.true., conversion=tr\%flux\_scale*(us\%L\_to\_m**2)*us\%s\_to\_T, y\_cell\_method = \textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{444       tr\%id\_ady = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_ady"}, \&}
\DoxyCodeLine{445           diag\%axesCvL, time, \textcolor{stringliteral}{"Advective (by residual mean) Meridional Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{446           flux\_units, v\_extensive=.true., conversion=tr\%flux\_scale*(us\%L\_to\_m**2)*us\%s\_to\_T, x\_cell\_method = \textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{447       tr\%id\_dfx = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_diffx"}, \&}
\DoxyCodeLine{448           diag\%axesCuL, time, \textcolor{stringliteral}{"Diffusive Zonal Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{449           flux\_units, v\_extensive=.true., conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{450           y\_cell\_method=\textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{451       tr\%id\_dfy = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_diffy"}, \&}
\DoxyCodeLine{452           diag\%axesCvL, time, \textcolor{stringliteral}{"Diffusive Meridional Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{453           flux\_units, v\_extensive=.true., conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{454           x\_cell\_method=\textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{455       tr\%id\_lbd\_dfx = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_lbd\_diffx"}, \&}
\DoxyCodeLine{456           diag\%axesCuL, time, \textcolor{stringliteral}{"Lateral Boundary Diffusive Zonal Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{457           flux\_units, v\_extensive=.true., conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{458           y\_cell\_method=\textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{459       tr\%id\_lbd\_dfy = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_lbd\_diffy"}, \&}
\DoxyCodeLine{460           diag\%axesCvL, time, \textcolor{stringliteral}{"Lateral Boundary Diffusive Meridional Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{461           flux\_units, v\_extensive=.true., conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{462           x\_cell\_method=\textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{463 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{464     \textcolor{keywordflow}{if} (tr\%id\_adx > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%ad\_x,isdb,iedb,jsd,jed,nz)}
\DoxyCodeLine{465     \textcolor{keywordflow}{if} (tr\%id\_ady > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%ad\_y,isd,ied,jsdb,jedb,nz)}
\DoxyCodeLine{466     \textcolor{keywordflow}{if} (tr\%id\_dfx > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%df\_x,isdb,iedb,jsd,jed,nz)}
\DoxyCodeLine{467     \textcolor{keywordflow}{if} (tr\%id\_dfy > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%df\_y,isd,ied,jsdb,jedb,nz)}
\DoxyCodeLine{468     \textcolor{keywordflow}{if} (tr\%id\_lbd\_dfx > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%lbd\_dfx,isdb,iedb,jsd,jed,nz)}
\DoxyCodeLine{469     \textcolor{keywordflow}{if} (tr\%id\_lbd\_dfy > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%lbd\_dfy,isd,ied,jsdb,jedb,nz)}
\DoxyCodeLine{470 }
\DoxyCodeLine{471     tr\%id\_adx\_2d = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_adx\_2d"}, \&}
\DoxyCodeLine{472         diag\%axesCu1, time, \&}
\DoxyCodeLine{473         \textcolor{stringliteral}{"Vertically Integrated Advective Zonal Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{474         flux\_units, conversion=tr\%flux\_scale*(us\%L\_to\_m**2)*us\%s\_to\_T, y\_cell\_method = \textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{475     tr\%id\_ady\_2d = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_ady\_2d"}, \&}
\DoxyCodeLine{476         diag\%axesCv1, time, \&}
\DoxyCodeLine{477         \textcolor{stringliteral}{"Vertically Integrated Advective Meridional Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{478         flux\_units, conversion=tr\%flux\_scale*(us\%L\_to\_m**2)*us\%s\_to\_T, x\_cell\_method = \textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{479     tr\%id\_dfx\_2d = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_diffx\_2d"}, \&}
\DoxyCodeLine{480         diag\%axesCu1, time, \&}
\DoxyCodeLine{481         \textcolor{stringliteral}{"Vertically Integrated Diffusive Zonal Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{482         flux\_units, conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{483         y\_cell\_method=\textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{484     tr\%id\_dfy\_2d = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_diffy\_2d"}, \&}
\DoxyCodeLine{485         diag\%axesCv1, time, \&}
\DoxyCodeLine{486         \textcolor{stringliteral}{"Vertically Integrated Diffusive Meridional Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{487         flux\_units, conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{488         x\_cell\_method=\textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{489     tr\%id\_lbd\_bulk\_dfx = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_lbd\_bulk\_diffx"}, \&}
\DoxyCodeLine{490         diag\%axesCu1, time, \&}
\DoxyCodeLine{491         \textcolor{stringliteral}{"Total Bulk Diffusive Zonal Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{492         flux\_units, conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{493         y\_cell\_method=\textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{494     tr\%id\_lbd\_bulk\_dfy = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_lbd\_bulk\_diffy"}, \&}
\DoxyCodeLine{495         diag\%axesCv1, time, \&}
\DoxyCodeLine{496         \textcolor{stringliteral}{"Total Bulk Diffusive Meridional Flux of "}//trim(flux\_longname), \&}
\DoxyCodeLine{497         flux\_units, conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{498         x\_cell\_method=\textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{499     tr\%id\_lbd\_dfx\_2d = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_lbd\_diffx\_2d"}, \&}
\DoxyCodeLine{500           diag\%axesCu1, time, \textcolor{stringliteral}{"Vertically-\/integrated zonal diffusive flux from the lateral boundary diffusion "}//\&}
\DoxyCodeLine{501           \textcolor{stringliteral}{"scheme for "}//trim(flux\_longname), flux\_units, conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{502           y\_cell\_method = \textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{503     tr\%id\_lbd\_dfy\_2d = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{"\_lbd\_diffy\_2d"}, \&}
\DoxyCodeLine{504           diag\%axesCv1, time, \textcolor{stringliteral}{"Vertically-\/integrated meridional diffusive flux from the lateral boundary diffusion "}//\&}
\DoxyCodeLine{505           \textcolor{stringliteral}{"scheme for "}//trim(flux\_longname), flux\_units, conversion=(us\%L\_to\_m**2)*tr\%flux\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{506            x\_cell\_method = \textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{507 }
\DoxyCodeLine{508     \textcolor{keywordflow}{if} (tr\%id\_adx\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%ad2d\_x,isdb,iedb,jsd,jed)}
\DoxyCodeLine{509     \textcolor{keywordflow}{if} (tr\%id\_ady\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%ad2d\_y,isd,ied,jsdb,jedb)}
\DoxyCodeLine{510     \textcolor{keywordflow}{if} (tr\%id\_dfx\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%df2d\_x,isdb,iedb,jsd,jed)}
\DoxyCodeLine{511     \textcolor{keywordflow}{if} (tr\%id\_dfy\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%df2d\_y,isd,ied,jsdb,jedb)}
\DoxyCodeLine{512     \textcolor{keywordflow}{if} (tr\%id\_lbd\_bulk\_dfx > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%lbd\_bulk\_df\_x,isdb,iedb,jsd,jed)}
\DoxyCodeLine{513     \textcolor{keywordflow}{if} (tr\%id\_lbd\_bulk\_dfy > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%lbd\_bulk\_df\_y,isd,ied,jsdb,jedb)}
\DoxyCodeLine{514     \textcolor{keywordflow}{if} (tr\%id\_lbd\_dfx\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%lbd\_dfx\_2d,isdb,iedb,jsd,jed)}
\DoxyCodeLine{515     \textcolor{keywordflow}{if} (tr\%id\_lbd\_dfy\_2d > 0) \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%lbd\_dfy\_2d,isd,ied,jsdb,jedb)}
\DoxyCodeLine{516 }
\DoxyCodeLine{517     tr\%id\_adv\_xy = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, trim(shortnm)//\textcolor{stringliteral}{"\_advection\_xy"}, \&}
\DoxyCodeLine{518         diag\%axesTL, time, \&}
\DoxyCodeLine{519         \textcolor{stringliteral}{'Horizontal convergence of residual mean advective fluxes of '}//\&}
\DoxyCodeLine{520         trim(lowercase(flux\_longname)), conv\_units, v\_extensive=.true., \&}
\DoxyCodeLine{521         conversion=tr\%conv\_scale*us\%s\_to\_T)}
\DoxyCodeLine{522     tr\%id\_adv\_xy\_2d = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, trim(shortnm)//\textcolor{stringliteral}{"\_advection\_xy\_2d"}, \&}
\DoxyCodeLine{523         diag\%axesT1, time, \&}
\DoxyCodeLine{524         \textcolor{stringliteral}{'Vertical sum of horizontal convergence of residual mean advective fluxes of '}//\&}
\DoxyCodeLine{525         trim(lowercase(flux\_longname)), conv\_units, conversion=tr\%conv\_scale*us\%s\_to\_T)}
\DoxyCodeLine{526     \textcolor{keywordflow}{if} ((tr\%id\_adv\_xy > 0) .or. (tr\%id\_adv\_xy\_2d > 0)) \&}
\DoxyCodeLine{527       \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%advection\_xy,isd,ied,jsd,jed,nz)}
\DoxyCodeLine{528 }
\DoxyCodeLine{529     tr\%id\_tendency = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, trim(shortnm)//\textcolor{stringliteral}{'\_tendency'}, \&}
\DoxyCodeLine{530         diag\%axesTL, time, \&}
\DoxyCodeLine{531         \textcolor{stringliteral}{'Net time tendency for '}//trim(lowercase(longname)), trim(units)//\textcolor{stringliteral}{' s-\/1'}, conversion=us\%s\_to\_T)}
\DoxyCodeLine{532 }
\DoxyCodeLine{533     \textcolor{keywordflow}{if} (tr\%id\_tendency > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{534       \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%t\_prev,isd,ied,jsd,jed,nz)}
\DoxyCodeLine{535       \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{536         tr\%t\_prev(i,j,k) = tr\%t(i,j,k)}
\DoxyCodeLine{537 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{538 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{539 }
\DoxyCodeLine{540     \textcolor{comment}{! Neutral/Lateral diffusion convergence tendencies}}
\DoxyCodeLine{541     \textcolor{keywordflow}{if} (tr\%diag\_form == 1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{542       tr\%id\_dfxy\_cont = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{'\_dfxy\_cont\_tendency'}, \&}
\DoxyCodeLine{543           diag\%axesTL, time, \textcolor{stringliteral}{"Neutral diffusion tracer content tendency for "}//trim(shortnm), \&}
\DoxyCodeLine{544           conv\_units, conversion=tr\%conv\_scale*us\%s\_to\_T, x\_cell\_method=\textcolor{stringliteral}{'sum'}, y\_cell\_method=\textcolor{stringliteral}{'sum'}, v\_extensive=.true.)}
\DoxyCodeLine{545 }
\DoxyCodeLine{546       tr\%id\_dfxy\_cont\_2d = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{'\_dfxy\_cont\_tendency\_2d'}, \&}
\DoxyCodeLine{547           diag\%axesT1, time, \textcolor{stringliteral}{"Depth integrated neutral diffusion tracer content "}//\&}
\DoxyCodeLine{548           \textcolor{stringliteral}{"tendency for "}//trim(shortnm), conv\_units, conversion=tr\%conv\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{549           x\_cell\_method=\textcolor{stringliteral}{'sum'}, y\_cell\_method= \textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{550 }
\DoxyCodeLine{551       tr\%id\_lbdxy\_cont = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{'\_lbdxy\_cont\_tendency'}, \&}
\DoxyCodeLine{552           diag\%axesTL, time, \textcolor{stringliteral}{"Lateral diffusion tracer content tendency for "}//trim(shortnm), \&}
\DoxyCodeLine{553           conv\_units, conversion=tr\%conv\_scale*us\%s\_to\_T, x\_cell\_method=\textcolor{stringliteral}{'sum'}, y\_cell\_method=\textcolor{stringliteral}{'sum'}, v\_extensive=.true.)}
\DoxyCodeLine{554 }
\DoxyCodeLine{555       tr\%id\_lbdxy\_cont\_2d = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{'\_lbdxy\_cont\_tendency\_2d'}, \&}
\DoxyCodeLine{556           diag\%axesT1, time, \textcolor{stringliteral}{"Depth integrated lateral diffusion tracer content "}//\&}
\DoxyCodeLine{557           \textcolor{stringliteral}{"tendency for "}//trim(shortnm), conv\_units, conversion=tr\%conv\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{558           x\_cell\_method=\textcolor{stringliteral}{'sum'}, y\_cell\_method= \textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{559     \textcolor{keywordflow}{else}}
\DoxyCodeLine{560       cmor\_var\_lname = \textcolor{stringliteral}{'Tendency of '}//trim(lowercase(cmor\_longname))//\&}
\DoxyCodeLine{561            \textcolor{stringliteral}{' expressed as '}//trim(lowercase(flux\_longname))//\&}
\DoxyCodeLine{562            \textcolor{stringliteral}{' content due to parameterized mesoscale neutral diffusion'}}
\DoxyCodeLine{563       tr\%id\_dfxy\_cont = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{'\_dfxy\_cont\_tendency'}, \&}
\DoxyCodeLine{564           diag\%axesTL, time, \textcolor{stringliteral}{"Neutral diffusion tracer content tendency for "}//trim(shortnm), \&}
\DoxyCodeLine{565           conv\_units, conversion=tr\%conv\_scale*us\%s\_to\_T, cmor\_field\_name = trim(tr\%cmor\_tendprefix)//\textcolor{stringliteral}{'pmdiff'}, \&}
\DoxyCodeLine{566           cmor\_long\_name = trim(cmor\_var\_lname), cmor\_standard\_name = trim(cmor\_long\_std(cmor\_var\_lname)), \&}
\DoxyCodeLine{567           x\_cell\_method = \textcolor{stringliteral}{'sum'}, y\_cell\_method = \textcolor{stringliteral}{'sum'}, v\_extensive = .true.)}
\DoxyCodeLine{568 }
\DoxyCodeLine{569       cmor\_var\_lname = \textcolor{stringliteral}{'Tendency of '}//trim(lowercase(cmor\_longname))//\textcolor{stringliteral}{' expressed as '}//\&}
\DoxyCodeLine{570                        trim(lowercase(flux\_longname))//\textcolor{stringliteral}{' content due to parameterized mesoscale neutral diffusion'}}
\DoxyCodeLine{571       tr\%id\_dfxy\_cont\_2d = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{'\_dfxy\_cont\_tendency\_2d'}, \&}
\DoxyCodeLine{572           diag\%axesT1, time, \textcolor{stringliteral}{"Depth integrated neutral diffusion tracer "}//\&}
\DoxyCodeLine{573           \textcolor{stringliteral}{"content tendency for "}//trim(shortnm), conv\_units, \&}
\DoxyCodeLine{574           conversion=tr\%conv\_scale*us\%s\_to\_T, cmor\_field\_name=trim(tr\%cmor\_tendprefix)//\textcolor{stringliteral}{'pmdiff\_2d'}, \&}
\DoxyCodeLine{575           cmor\_long\_name=trim(cmor\_var\_lname), cmor\_standard\_name=trim(cmor\_long\_std(cmor\_var\_lname)), \&}
\DoxyCodeLine{576           x\_cell\_method=\textcolor{stringliteral}{'sum'}, y\_cell\_method=\textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{577 }
\DoxyCodeLine{578       tr\%id\_lbdxy\_cont = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{'\_lbdxy\_cont\_tendency'}, \&}
\DoxyCodeLine{579           diag\%axesTL, time, \textcolor{stringliteral}{"Lateral diffusion tracer content tendency for "}//trim(shortnm), \&}
\DoxyCodeLine{580           conv\_units, conversion=tr\%conv\_scale*us\%s\_to\_T, \&}
\DoxyCodeLine{581           x\_cell\_method = \textcolor{stringliteral}{'sum'}, y\_cell\_method = \textcolor{stringliteral}{'sum'}, v\_extensive = .true.)}
\DoxyCodeLine{582 }
\DoxyCodeLine{583       tr\%id\_lbdxy\_cont\_2d = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{'\_lbdxy\_cont\_tendency\_2d'}, \&}
\DoxyCodeLine{584           diag\%axesT1, time, \textcolor{stringliteral}{"Depth integrated lateral diffusion tracer "}//\&}
\DoxyCodeLine{585           \textcolor{stringliteral}{"content tendency for "}//trim(shortnm), conv\_units, \&}
\DoxyCodeLine{586           conversion=tr\%conv\_scale*us\%s\_to\_T, x\_cell\_method=\textcolor{stringliteral}{'sum'}, y\_cell\_method=\textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{587 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{588     tr\%id\_dfxy\_conc = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{'\_dfxy\_conc\_tendency'}, \&}
\DoxyCodeLine{589         diag\%axesTL, time, \textcolor{stringliteral}{"Neutral diffusion tracer concentration tendency for "}//trim(shortnm), \&}
\DoxyCodeLine{590         trim(units)//\textcolor{stringliteral}{' s-\/1'}, conversion=us\%s\_to\_T)}
\DoxyCodeLine{591 }
\DoxyCodeLine{592     tr\%id\_lbdxy\_conc = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(shortnm)//\textcolor{stringliteral}{'\_lbdxy\_conc\_tendency'}, \&}
\DoxyCodeLine{593         diag\%axesTL, time, \textcolor{stringliteral}{"Lateral diffusion tracer concentration tendency for "}//trim(shortnm), \&}
\DoxyCodeLine{594         trim(units)//\textcolor{stringliteral}{' s-\/1'}, conversion=us\%s\_to\_T)}
\DoxyCodeLine{595 }
\DoxyCodeLine{596     var\_lname = \textcolor{stringliteral}{"Net time tendency for "}//lowercase(flux\_longname)}
\DoxyCodeLine{597     \textcolor{keywordflow}{if} (len\_trim(tr\%cmor\_tendprefix) == 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{598       tr\%id\_trxh\_tendency = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, trim(shortnm)//\textcolor{stringliteral}{'h\_tendency'}, \&}
\DoxyCodeLine{599           diag\%axesTL, time, var\_lname, conv\_units, v\_extensive=.true., \&}
\DoxyCodeLine{600           conversion=tr\%conv\_scale*us\%s\_to\_T)}
\DoxyCodeLine{601       tr\%id\_trxh\_tendency\_2d = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, trim(shortnm)//\textcolor{stringliteral}{'h\_tendency\_2d'}, \&}
\DoxyCodeLine{602           diag\%axesT1, time, \textcolor{stringliteral}{"Vertical sum of "}//trim(lowercase(var\_lname)), conv\_units, \&}
\DoxyCodeLine{603           conversion=tr\%conv\_scale*us\%s\_to\_T)}
\DoxyCodeLine{604     \textcolor{keywordflow}{else}}
\DoxyCodeLine{605       cmor\_var\_lname = \textcolor{stringliteral}{"Tendency of "}//trim(cmor\_longname)//\textcolor{stringliteral}{" Expressed as "}//\&}
\DoxyCodeLine{606                         trim(flux\_longname)//\textcolor{stringliteral}{" Content"}}
\DoxyCodeLine{607       tr\%id\_trxh\_tendency = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, trim(shortnm)//\textcolor{stringliteral}{'h\_tendency'}, \&}
\DoxyCodeLine{608           diag\%axesTL, time, var\_lname, conv\_units, \&}
\DoxyCodeLine{609           cmor\_field\_name=trim(tr\%cmor\_tendprefix)//\textcolor{stringliteral}{"tend"}, \&}
\DoxyCodeLine{610           cmor\_standard\_name=cmor\_long\_std(cmor\_var\_lname), cmor\_long\_name=cmor\_var\_lname, \&}
\DoxyCodeLine{611           v\_extensive=.true., conversion=tr\%conv\_scale*us\%s\_to\_T)}
\DoxyCodeLine{612       cmor\_var\_lname = trim(cmor\_var\_lname)//\textcolor{stringliteral}{" Vertical Sum"}}
\DoxyCodeLine{613       tr\%id\_trxh\_tendency\_2d = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, trim(shortnm)//\textcolor{stringliteral}{'h\_tendency\_2d'}, \&}
\DoxyCodeLine{614           diag\%axesT1, time, \textcolor{stringliteral}{"Vertical sum of "}//trim(lowercase(var\_lname)), conv\_units, \&}
\DoxyCodeLine{615           cmor\_field\_name=trim(tr\%cmor\_tendprefix)//\textcolor{stringliteral}{"tend\_2d"}, \&}
\DoxyCodeLine{616           cmor\_standard\_name=cmor\_long\_std(cmor\_var\_lname), cmor\_long\_name=cmor\_var\_lname, \&}
\DoxyCodeLine{617           conversion=tr\%conv\_scale*us\%s\_to\_T)}
\DoxyCodeLine{618 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{619     \textcolor{keywordflow}{if} ((tr\%id\_trxh\_tendency > 0) .or. (tr\%id\_trxh\_tendency\_2d > 0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{620       \textcolor{keyword}{call }safe\_alloc\_ptr(tr\%Trxh\_prev,isd,ied,jsd,jed,nz)}
\DoxyCodeLine{621       \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{622         tr\%Trxh\_prev(i,j,k) = tr\%t(i,j,k) * h(i,j,k)}
\DoxyCodeLine{623 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{624 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{625 }
\DoxyCodeLine{626     \textcolor{comment}{! Vertical regridding/remapping tendencies}}
\DoxyCodeLine{627     \textcolor{keywordflow}{if} (use\_ale .and. tr\%remap\_tr) \textcolor{keywordflow}{then}}
\DoxyCodeLine{628       var\_lname = \textcolor{stringliteral}{"Vertical remapping tracer concentration tendency for "}//trim(reg\%Tr(m)\%name)}
\DoxyCodeLine{629       tr\%id\_remap\_conc= register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'},                          \&}
\DoxyCodeLine{630         trim(tr\%flux\_nameroot)//\textcolor{stringliteral}{'\_tendency\_vert\_remap'}, diag\%axesTL, time, var\_lname, \&}
\DoxyCodeLine{631         trim(units)//\textcolor{stringliteral}{' s-\/1'}, conversion=us\%s\_to\_T)}
\DoxyCodeLine{632 }
\DoxyCodeLine{633       var\_lname = \textcolor{stringliteral}{"Vertical remapping tracer content tendency for "}//trim(reg\%Tr(m)\%flux\_longname)}
\DoxyCodeLine{634       tr\%id\_remap\_cont = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \&}
\DoxyCodeLine{635         trim(tr\%flux\_nameroot)//\textcolor{stringliteral}{'h\_tendency\_vert\_remap'},         \&}
\DoxyCodeLine{636         diag\%axesTL, time, var\_lname, flux\_units, v\_extensive=.true., conversion=tr\%conv\_scale*us\%s\_to\_T)}
\DoxyCodeLine{637 }
\DoxyCodeLine{638       var\_lname = \textcolor{stringliteral}{"Vertical sum of vertical remapping tracer content tendency for "}//\&}
\DoxyCodeLine{639                   trim(reg\%Tr(m)\%flux\_longname)}
\DoxyCodeLine{640       tr\%id\_remap\_cont\_2d = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \&}
\DoxyCodeLine{641         trim(tr\%flux\_nameroot)//\textcolor{stringliteral}{'h\_tendency\_vert\_remap\_2d'},         \&}
\DoxyCodeLine{642         diag\%axesT1, time, var\_lname, flux\_units, conversion=tr\%conv\_scale*us\%s\_to\_T)}
\DoxyCodeLine{643 }
\DoxyCodeLine{644 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{645 }
\DoxyCodeLine{646     \textcolor{keywordflow}{if} (use\_ale .and. (reg\%ntr<max\_fields\_) .and. tr\%remap\_tr) \textcolor{keywordflow}{then}}
\DoxyCodeLine{647       unit2 = trim(units)//\textcolor{stringliteral}{"2"}}
\DoxyCodeLine{648       \textcolor{keywordflow}{if} (index(units(1:len\_trim(units)),\textcolor{stringliteral}{" "}) > 0) unit2 = \textcolor{stringliteral}{"("}//trim(units)//\textcolor{stringliteral}{")2"}}
\DoxyCodeLine{649       tr\%id\_tr\_vardec = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, trim(shortnm)//\textcolor{stringliteral}{"\_vardec"}, diag\%axesTL, \&}
\DoxyCodeLine{650         time, \textcolor{stringliteral}{"ALE variance decay for "}//lowercase(longname), trim(unit2)//\textcolor{stringliteral}{" s-\/1"}, conversion=us\%s\_to\_T)}
\DoxyCodeLine{651       \textcolor{keywordflow}{if} (tr\%id\_tr\_vardec > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{652         \textcolor{comment}{! Set up a new tracer for this tracer squared}}
\DoxyCodeLine{653         m2 = reg\%ntr+1}
\DoxyCodeLine{654         tr\%ind\_tr\_squared = m2}
\DoxyCodeLine{655         \textcolor{keyword}{call }safe\_alloc\_ptr(reg\%Tr(m2)\%t,isd,ied,jsd,jed,nz) ; reg\%Tr(m2)\%t(:,:,:) = 0.0}
\DoxyCodeLine{656         reg\%Tr(m2)\%name = trim(shortnm)//\textcolor{stringliteral}{"2"}}
\DoxyCodeLine{657         reg\%Tr(m2)\%longname = \textcolor{stringliteral}{"Squared "}//trim(longname)}
\DoxyCodeLine{658         reg\%Tr(m2)\%units = unit2}
\DoxyCodeLine{659         reg\%Tr(m2)\%registry\_diags = .false.}
\DoxyCodeLine{660         reg\%Tr(m2)\%ind\_tr\_squared = -\/1}
\DoxyCodeLine{661         \textcolor{comment}{! Augment the total number of tracers, including the squared tracers.}}
\DoxyCodeLine{662         reg\%ntr = reg\%ntr + 1}
\DoxyCodeLine{663 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{664 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{665 }
\DoxyCodeLine{666 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{667 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__tracer__registry_a67e71e90d3747dd97a917f6541f39b56}\label{namespacemom__tracer__registry_a67e71e90d3747dd97a917f6541f39b56}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!tracer\_name\_lookup@{tracer\_name\_lookup}}
\index{tracer\_name\_lookup@{tracer\_name\_lookup}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{tracer\_name\_lookup()}{tracer\_name\_lookup()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::tracer\+\_\+name\+\_\+lookup (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{Reg,  }\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__type}{tracer\+\_\+type}}), pointer}]{tr\+\_\+ptr,  }\item[{character(len=32), intent(in)}]{name }\end{DoxyParamCaption})}



Find a tracer in the tracer registry by name. 


\begin{DoxyParams}[1]{Parameters}
 & {\em reg} & pointer to tracer registry \\
\hline
 & {\em tr\+\_\+ptr} & target or pointer to the tracer array \\
\hline
\mbox{\texttt{ in}}  & {\em name} & tracer name \\
\hline
\end{DoxyParams}


Definition at line 850 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{850   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer}    :: Reg\textcolor{comment}{     !< pointer to tracer registry}}
\DoxyCodeLine{851   \textcolor{keywordtype}{type}(tracer\_type), \textcolor{keywordtype}{pointer}             :: tr\_ptr\textcolor{comment}{  !< target or pointer to the tracer array}}
\DoxyCodeLine{852   \textcolor{keywordtype}{character(len=32)}, \textcolor{keywordtype}{intent(in)}          :: name\textcolor{comment}{    !< tracer name}}
\DoxyCodeLine{853 }
\DoxyCodeLine{854   \textcolor{keywordtype}{integer} n}
\DoxyCodeLine{855   \textcolor{keywordflow}{do} n=1,reg\%ntr}
\DoxyCodeLine{856     \textcolor{keywordflow}{if} (lowercase(reg\%Tr(n)\%name) == lowercase(name)) tr\_ptr => reg\%Tr(n)}
\DoxyCodeLine{857 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{858 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__tracer__registry_aaca7f6bcdb5f1d8cb247e24719d37df9}\label{namespacemom__tracer__registry_aaca7f6bcdb5f1d8cb247e24719d37df9}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!tracer\_registry\_end@{tracer\_registry\_end}}
\index{tracer\_registry\_end@{tracer\_registry\_end}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{tracer\_registry\_end()}{tracer\_registry\_end()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::tracer\+\_\+registry\+\_\+end (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{Reg }\end{DoxyParamCaption})}



This routine closes the tracer registry module. 


\begin{DoxyParams}{Parameters}
{\em reg} & The tracer registry that will be deallocated \\
\hline
\end{DoxyParams}


Definition at line 891 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{891   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer} :: Reg\textcolor{comment}{ !< The tracer registry that will be deallocated}}
\DoxyCodeLine{892   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(reg)) \textcolor{keyword}{deallocate}(reg)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__tracer__registry_a452937bf1f9d01a47d1a80793e317b33}\label{namespacemom__tracer__registry_a452937bf1f9d01a47d1a80793e317b33}} 
\index{mom\_tracer\_registry@{mom\_tracer\_registry}!tracer\_registry\_init@{tracer\_registry\_init}}
\index{tracer\_registry\_init@{tracer\_registry\_init}!mom\_tracer\_registry@{mom\_tracer\_registry}}
\doxysubsubsection{\texorpdfstring{tracer\_registry\_init()}{tracer\_registry\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+tracer\+\_\+registry\+::tracer\+\_\+registry\+\_\+init (\begin{DoxyParamCaption}\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{Reg }\end{DoxyParamCaption})}



Initialize the tracer registry. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & open file to parse for model parameters \\
\hline
 & {\em reg} & pointer to tracer registry \\
\hline
\end{DoxyParams}


Definition at line 863 of file M\+O\+M\+\_\+tracer\+\_\+registry.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{863   \textcolor{keywordtype}{type}(param\_file\_type),      \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< open file to parse for model parameters}}
\DoxyCodeLine{864   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer}    :: Reg\textcolor{comment}{        !< pointer to tracer registry}}
\DoxyCodeLine{865 }
\DoxyCodeLine{866   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{save} :: init\_calls = 0}
\DoxyCodeLine{867 }
\DoxyCodeLine{868 \textcolor{comment}{! This include declares and sets the variable "version".}}
\DoxyCodeLine{869 \textcolor{preprocessor}{\#include "version\_variable.h"}}
\DoxyCodeLine{870 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_tracer\_registry"} \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{871   \textcolor{keywordtype}{character(len=256)} :: mesg    \textcolor{comment}{! Message for error messages.}}
\DoxyCodeLine{872 }
\DoxyCodeLine{873   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(reg)) \textcolor{keywordflow}{then} ; \textcolor{keyword}{allocate}(reg)}
\DoxyCodeLine{874   \textcolor{keywordflow}{else} ; \textcolor{keywordflow}{return} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{875 }
\DoxyCodeLine{876   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}}
\DoxyCodeLine{877   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""}, all\_default=.true.)}
\DoxyCodeLine{878 }
\DoxyCodeLine{879   init\_calls = init\_calls + 1}
\DoxyCodeLine{880   \textcolor{keywordflow}{if} (init\_calls > 1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{881     \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("tracer\_registry\_init called ",I3, \&}}
\DoxyCodeLine{882 \textcolor{stringliteral}{}\textcolor{stringliteral}{      \&" times with different registry pointers.")'}) init\_calls}
\DoxyCodeLine{883     \textcolor{keywordflow}{if} (is\_root\_pe()) \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"MOM\_tracer"}//mesg)}
\DoxyCodeLine{884 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{885 }

\end{DoxyCode}
