\hypertarget{namespacemom__obsolete__diagnostics}{}\section{mom\+\_\+obsolete\+\_\+diagnostics Module Reference}
\label{namespacemom__obsolete__diagnostics}\index{mom\+\_\+obsolete\+\_\+diagnostics@{mom\+\_\+obsolete\+\_\+diagnostics}}


\subsection{Detailed Description}
Provides a mechanism for recording diagnostic variables that are no longer valid, along with their replacement name if appropriate. \subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \hyperlink{namespacemom__obsolete__diagnostics_ad5e890c09abd2c650beb9ac36bbb49b4}{register\+\_\+obsolete\+\_\+diagnostics} (param\+\_\+file, diag)
\begin{DoxyCompactList}\small\item\em Scan through the diag\+\_\+table searching for obsolete parameters and issue informational messages and optionallly a F\+A\+T\+AL error. \end{DoxyCompactList}\item 
logical function \hyperlink{namespacemom__obsolete__diagnostics_a137ff7cb882b715d0ccf915fef52386c}{found\+\_\+in\+\_\+diagtable} (diag, var\+Name, new\+Var\+Name)
\begin{DoxyCompactList}\small\item\em Fakes a register of a diagnostic to find out if an obsolete parameter appears in the diag\+\_\+table. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__obsolete__diagnostics_a137ff7cb882b715d0ccf915fef52386c}\label{namespacemom__obsolete__diagnostics_a137ff7cb882b715d0ccf915fef52386c}} 
\index{mom\+\_\+obsolete\+\_\+diagnostics@{mom\+\_\+obsolete\+\_\+diagnostics}!found\+\_\+in\+\_\+diagtable@{found\+\_\+in\+\_\+diagtable}}
\index{found\+\_\+in\+\_\+diagtable@{found\+\_\+in\+\_\+diagtable}!mom\+\_\+obsolete\+\_\+diagnostics@{mom\+\_\+obsolete\+\_\+diagnostics}}
\subsubsection{\texorpdfstring{found\+\_\+in\+\_\+diagtable()}{found\_in\_diagtable()}}
{\footnotesize\ttfamily logical function mom\+\_\+obsolete\+\_\+diagnostics\+::found\+\_\+in\+\_\+diagtable (\begin{DoxyParamCaption}\item[{type(diag\+\_\+ctrl), intent(in)}]{diag,  }\item[{character(len=$\ast$), intent(in)}]{var\+Name,  }\item[{character(len=$\ast$), intent(in), optional}]{new\+Var\+Name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Fakes a register of a diagnostic to find out if an obsolete parameter appears in the diag\+\_\+table. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em diag} & A structure used to control diagnostics.\\
\hline
\mbox{\tt in}  & {\em varname} & The obsolete diagnostic name\\
\hline
\mbox{\tt in}  & {\em newvarname} & The valid name of this diagnostic \\
\hline
\end{DoxyParams}


Definition at line 67 of file M\+O\+M\+\_\+obsolete\+\_\+diagnostics.\+F90.


\begin{DoxyCode}
67   \textcolor{keywordtype}{type}(diag\_ctrl),            \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{       !< A structure used to control diagnostics.}
68   \textcolor{keywordtype}{character(len=*)},           \textcolor{keywordtype}{intent(in)} :: varname\textcolor{comment}{    !< The obsolete diagnostic name}
69   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: newvarname\textcolor{comment}{ !< The valid name of this diagnostic}
70   \textcolor{comment}{! Local}
71   \textcolor{keywordtype}{integer} :: handle \textcolor{comment}{! Integer handle returned from diag\_manager}
72 
73   \textcolor{comment}{! We use register\_static\_field\_fms() instead of register\_static\_field() so}
74   \textcolor{comment}{! that the diagnostic does not appear in the available diagnostics list.}
75   handle = register\_static\_field\_fms(\textcolor{stringliteral}{'ocean\_model'}, varname, &
76             diag%axesT1%handles, \textcolor{stringliteral}{'Obsolete parameter'}, \textcolor{stringliteral}{'N/A'})
77 
78   found\_in\_diagtable = (handle>0)
79 
80   \textcolor{keywordflow}{if} (handle>0 .and. is\_root\_pe()) \textcolor{keywordflow}{then}
81     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(newvarname)) \textcolor{keywordflow}{then}
82       \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{'MOM\_obsolete\_params: '}//                        &
83           \textcolor{stringliteral}{'diag\_table entry "'}//trim(varname)//\textcolor{stringliteral}{'" found. Use '}// &
84           \textcolor{stringliteral}{'"'}//trim(newvarname)//\textcolor{stringliteral}{'" instead.'} )
85     \textcolor{keywordflow}{else}
86       \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{'MOM\_obsolete\_params: '}//                        &
87           \textcolor{stringliteral}{'diag\_table entry "'}//trim(varname)//\textcolor{stringliteral}{'" is obsolete.'} )
88 \textcolor{keywordflow}{    endif}
89 \textcolor{keywordflow}{  endif}
90 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__obsolete__diagnostics_ad5e890c09abd2c650beb9ac36bbb49b4}\label{namespacemom__obsolete__diagnostics_ad5e890c09abd2c650beb9ac36bbb49b4}} 
\index{mom\+\_\+obsolete\+\_\+diagnostics@{mom\+\_\+obsolete\+\_\+diagnostics}!register\+\_\+obsolete\+\_\+diagnostics@{register\+\_\+obsolete\+\_\+diagnostics}}
\index{register\+\_\+obsolete\+\_\+diagnostics@{register\+\_\+obsolete\+\_\+diagnostics}!mom\+\_\+obsolete\+\_\+diagnostics@{mom\+\_\+obsolete\+\_\+diagnostics}}
\subsubsection{\texorpdfstring{register\+\_\+obsolete\+\_\+diagnostics()}{register\_obsolete\_diagnostics()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+obsolete\+\_\+diagnostics\+::register\+\_\+obsolete\+\_\+diagnostics (\begin{DoxyParamCaption}\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(diag\+\_\+ctrl), intent(in)}]{diag }\end{DoxyParamCaption})}



Scan through the diag\+\_\+table searching for obsolete parameters and issue informational messages and optionallly a F\+A\+T\+AL error. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em param\+\_\+file} & The parameter file handle.\\
\hline
\mbox{\tt in}  & {\em diag} & A structure used to control diagnostics. \\
\hline
\end{DoxyParams}


Definition at line 23 of file M\+O\+M\+\_\+obsolete\+\_\+diagnostics.\+F90.


\begin{DoxyCode}
23   \textcolor{keywordtype}{type}(param\_file\_type),       \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< The parameter file handle.}
24   \textcolor{keywordtype}{type}(diag\_ctrl),             \textcolor{keywordtype}{intent(in)}    :: diag\textcolor{comment}{       !< A structure used to control diagnostics.}
25 \textcolor{comment}{! This include declares and sets the variable "version".}
26 \textcolor{preprocessor}{#include "version\_variable.h"}
27 \textcolor{preprocessor}{}  \textcolor{comment}{! Local variables}
28   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_obsolete\_diagnostics"}\textcolor{comment}{  !< This module's name.}
29   \textcolor{keywordtype}{logical} :: foundentry, causefatal
30   \textcolor{keywordtype}{integer} :: errtype
31 
32   \textcolor{keyword}{call }log\_version(param\_file, mdl, version)
33   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"OBSOLETE\_DIAGNOSTIC\_IS\_FATAL"}, causefatal,              &
34                  \textcolor{stringliteral}{"If an obsolete diagnostic variable appears in the diag\_table, "}//        &
35                  \textcolor{stringliteral}{"cause a FATAL error rather than issue a WARNING."}, default=.true.)
36 
37   foundentry = .false.
38   \textcolor{comment}{! Each obsolete entry, with replacement name is available.}
39   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'Net\_Heat'}, \textcolor{stringliteral}{'net\_heat\_surface or net\_heat\_coupler'})) foundentry = .true.
40   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'PmE'}, \textcolor{stringliteral}{'PRCmE'}))                                     foundentry = .true.
41   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'froz\_precip'}, \textcolor{stringliteral}{'fprec'}))                             foundentry = .true.
42   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'liq\_precip'}, \textcolor{stringliteral}{'lprec'}))                              foundentry = .true.
43   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'virt\_precip'}, \textcolor{stringliteral}{'vprec'}))                             foundentry = .true.
44   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'froz\_runoff'}, \textcolor{stringliteral}{'frunoff'}))                           foundentry = .true.
45   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'liq\_runoff'}, \textcolor{stringliteral}{'lrunoff'}))                            foundentry = .true.
46   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'calving\_heat\_content'}, \textcolor{stringliteral}{'heat\_content\_frunoff'}))     foundentry = .true.
47   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'precip\_heat\_content'}, \textcolor{stringliteral}{'heat\_content\_lprec'}))        foundentry = .true.
48   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'evap\_heat\_content'}, \textcolor{stringliteral}{'heat\_content\_massout'}))        foundentry = .true.
49   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'runoff\_heat\_content'}, \textcolor{stringliteral}{'heat\_content\_lrunoff'}))      foundentry = .true.
50   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'latent\_fprec'}))                                     foundentry = .true.
51   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'latent\_calve'}))                                     foundentry = .true.
52   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'heat\_rest'}, \textcolor{stringliteral}{'heat\_restore'}))                        foundentry = .true.
53   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'KPP\_dTdt'}, \textcolor{stringliteral}{'KPP\_NLT\_dTdt'}))                         foundentry = .true.
54   \textcolor{keywordflow}{if} (found\_in\_diagtable(diag, \textcolor{stringliteral}{'KPP\_dSdt'}, \textcolor{stringliteral}{'KPP\_NLT\_dSdt'}))                         foundentry = .true.
55 
56   \textcolor{keywordflow}{if} (causefatal) then; errtype = fatal
57   \textcolor{keywordflow}{else} ; errtype = warning ;\textcolor{keywordflow}{ endif}
58   \textcolor{keywordflow}{if} (foundentry .and. is\_root\_pe()) &
59     \textcolor{keyword}{call }mom\_error(errtype, \textcolor{stringliteral}{'MOM\_obsolete\_diagnostics: '}//&
60                             \textcolor{stringliteral}{'Obsolete diagnostics found in diag\_table'})
61 
\end{DoxyCode}
