\hypertarget{namespacemom__restart}{}\doxysection{mom\+\_\+restart Module Reference}
\label{namespacemom__restart}\index{mom\_restart@{mom\_restart}}


\doxysubsection{Detailed Description}
The M\+O\+M6 facility for reading and writing restart files, and querying what has been read. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structmom__restart_1_1field__restart}{field\+\_\+restart}}
\begin{DoxyCompactList}\small\item\em A structure with information about a single restart field. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}
\begin{DoxyCompactList}\small\item\em A restart registry and the control structure for restarts. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__restart_1_1obsolete__restart}{obsolete\+\_\+restart}}
\begin{DoxyCompactList}\small\item\em A structure to store information about restart fields that are no longer used. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__restart_1_1p0d}{p0d}}
\begin{DoxyCompactList}\small\item\em A type for making arrays of pointers to scalars. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__restart_1_1p1d}{p1d}}
\begin{DoxyCompactList}\small\item\em A type for making arrays of pointers to 1-\/d arrays. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__restart_1_1p2d}{p2d}}
\begin{DoxyCompactList}\small\item\em A type for making arrays of pointers to 2-\/d arrays. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__restart_1_1p3d}{p3d}}
\begin{DoxyCompactList}\small\item\em A type for making arrays of pointers to 3-\/d arrays. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__restart_1_1p4d}{p4d}}
\begin{DoxyCompactList}\small\item\em A type for making arrays of pointers to 4-\/d arrays. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__restart_1_1query__initialized}{query\+\_\+initialized}}
\begin{DoxyCompactList}\small\item\em Indicate whether a field has been read from a restart file. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__restart_1_1register__restart__field}{register\+\_\+restart\+\_\+field}}
\begin{DoxyCompactList}\small\item\em Register fields for restarts. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__restart_1_1register__restart__pair}{register\+\_\+restart\+\_\+pair}}
\begin{DoxyCompactList}\small\item\em Register a pair of restart fieilds whose rotations map onto each other. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__restart_ab507e13911b906934fd4ff6dbf183cfd}{register\+\_\+restart\+\_\+field\+\_\+as\+\_\+obsolete}} (field\+\_\+name, replacement\+\_\+name, CS)
\item 
subroutine \mbox{\hyperlink{namespacemom__restart_a8ce4ab90691d8178c4558fbdbf79b240}{register\+\_\+restart\+\_\+field\+\_\+ptr3d}} (f\+\_\+ptr, var\+\_\+desc, mandatory, CS)
\begin{DoxyCompactList}\small\item\em Register a 3-\/d field for restarts, providing the metadata in a structure. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_a5db9d35748527c8179fd603c5d67f9eb}{register\+\_\+restart\+\_\+field\+\_\+ptr4d}} (f\+\_\+ptr, var\+\_\+desc, mandatory, CS)
\begin{DoxyCompactList}\small\item\em Register a 4-\/d field for restarts, providing the metadata in a structure. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_a63d6d9ab1d5534897e226ac5c19dfd08}{register\+\_\+restart\+\_\+field\+\_\+ptr2d}} (f\+\_\+ptr, var\+\_\+desc, mandatory, CS)
\begin{DoxyCompactList}\small\item\em Register a 2-\/d field for restarts, providing the metadata in a structure. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_ada3e7d606fa9080e98c9da40d62be3bc}{register\+\_\+restart\+\_\+field\+\_\+ptr1d}} (f\+\_\+ptr, var\+\_\+desc, mandatory, CS)
\begin{DoxyCompactList}\small\item\em Register a 1-\/d field for restarts, providing the metadata in a structure. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_a85aa83bcbaf8ca0992ef542d75441873}{register\+\_\+restart\+\_\+field\+\_\+ptr0d}} (f\+\_\+ptr, var\+\_\+desc, mandatory, CS)
\begin{DoxyCompactList}\small\item\em Register a 0-\/d field for restarts, providing the metadata in a structure. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_ac3c8515bd0544d26102b5e81d09a6586}{register\+\_\+restart\+\_\+pair\+\_\+ptr2d}} (a\+\_\+ptr, b\+\_\+ptr, a\+\_\+desc, b\+\_\+desc, mandatory, CS)
\begin{DoxyCompactList}\small\item\em Register a pair of rotationally equivalent 2d restart fields. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_a5d8f80120cfa78fe0161f93f67d86836}{register\+\_\+restart\+\_\+pair\+\_\+ptr3d}} (a\+\_\+ptr, b\+\_\+ptr, a\+\_\+desc, b\+\_\+desc, mandatory, CS)
\begin{DoxyCompactList}\small\item\em Register a pair of rotationally equivalent 3d restart fields. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_af23a3f82ea3c786e50e7991b67144582}{register\+\_\+restart\+\_\+pair\+\_\+ptr4d}} (a\+\_\+ptr, b\+\_\+ptr, a\+\_\+desc, b\+\_\+desc, mandatory, CS)
\begin{DoxyCompactList}\small\item\em Register a pair of rotationally equivalent 2d restart fields. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_a8629faf9333934af51ef1605795467a9}{register\+\_\+restart\+\_\+field\+\_\+4d}} (f\+\_\+ptr, name, mandatory, CS, longname, units, hor\+\_\+grid, z\+\_\+grid, t\+\_\+grid)
\begin{DoxyCompactList}\small\item\em Register a 4-\/d field for restarts, providing the metadata as individual arguments. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_a7d067c88e93f53ec678706711aace49b}{register\+\_\+restart\+\_\+field\+\_\+3d}} (f\+\_\+ptr, name, mandatory, CS, longname, units, hor\+\_\+grid, z\+\_\+grid, t\+\_\+grid)
\begin{DoxyCompactList}\small\item\em Register a 3-\/d field for restarts, providing the metadata as individual arguments. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_ae9df9723a9a053c8ce149cfd44570666}{register\+\_\+restart\+\_\+field\+\_\+2d}} (f\+\_\+ptr, name, mandatory, CS, longname, units, hor\+\_\+grid, z\+\_\+grid, t\+\_\+grid)
\begin{DoxyCompactList}\small\item\em Register a 2-\/d field for restarts, providing the metadata as individual arguments. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_a54d4c48b06ab2bb2fa40bd86adbaa761}{register\+\_\+restart\+\_\+field\+\_\+1d}} (f\+\_\+ptr, name, mandatory, CS, longname, units, hor\+\_\+grid, z\+\_\+grid, t\+\_\+grid)
\begin{DoxyCompactList}\small\item\em Register a 1-\/d field for restarts, providing the metadata as individual arguments. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_a8d4cdf98668368caff5284de45174b86}{register\+\_\+restart\+\_\+field\+\_\+0d}} (f\+\_\+ptr, name, mandatory, CS, longname, units, t\+\_\+grid)
\begin{DoxyCompactList}\small\item\em Register a 0-\/d field for restarts, providing the metadata as individual arguments. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__restart_a7c9521908e6149d6434fc0611afc3054}{query\+\_\+initialized\+\_\+name}} (name, CS)
\begin{DoxyCompactList}\small\item\em query\+\_\+initialized\+\_\+name determines whether a named field has been successfully read from a restart file yet. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__restart_a9dfaebbadaef08ed425beeb702391d6c}{query\+\_\+initialized\+\_\+0d}} (f\+\_\+ptr, CS)
\begin{DoxyCompactList}\small\item\em Indicate whether the field pointed to by f\+\_\+ptr has been initialized from a restart file. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__restart_ad01401819c16db2630321415488af4fd}{query\+\_\+initialized\+\_\+1d}} (f\+\_\+ptr, CS)
\begin{DoxyCompactList}\small\item\em Indicate whether the field pointed to by f\+\_\+ptr has been initialized from a restart file. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__restart_aeee4854da077d24fb8618c88972ee2c1}{query\+\_\+initialized\+\_\+2d}} (f\+\_\+ptr, CS)
\begin{DoxyCompactList}\small\item\em Indicate whether the field pointed to by f\+\_\+ptr has been initialized from a restart file. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__restart_ad8cd9a08f434e6193d642b08251aee90}{query\+\_\+initialized\+\_\+3d}} (f\+\_\+ptr, CS)
\begin{DoxyCompactList}\small\item\em Indicate whether the field pointed to by f\+\_\+ptr has been initialized from a restart file. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__restart_a91cf0baa54a2d21017252d431635c74a}{query\+\_\+initialized\+\_\+4d}} (f\+\_\+ptr, CS)
\begin{DoxyCompactList}\small\item\em Indicate whether the field pointed to by f\+\_\+ptr has been initialized from a restart file. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__restart_a7abca14dfc4fa1efcec27f8f8f7d6762}{query\+\_\+initialized\+\_\+0d\+\_\+name}} (f\+\_\+ptr, name, CS)
\begin{DoxyCompactList}\small\item\em Indicate whether the field pointed to by f\+\_\+ptr or with the specified variable name has been initialized from a restart file. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__restart_a3c999a09696203fd104cf5ea7786ae39}{query\+\_\+initialized\+\_\+1d\+\_\+name}} (f\+\_\+ptr, name, CS)
\begin{DoxyCompactList}\small\item\em Indicate whether the field pointed to by f\+\_\+ptr or with the specified variable name has been initialized from a restart file. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__restart_ac2916c91f2b110463b8b6ffd5330c683}{query\+\_\+initialized\+\_\+2d\+\_\+name}} (f\+\_\+ptr, name, CS)
\begin{DoxyCompactList}\small\item\em Indicate whether the field pointed to by f\+\_\+ptr or with the specified variable name has been initialized from a restart file. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__restart_a0ff886233ff24e93349a1f1c8e547da4}{query\+\_\+initialized\+\_\+3d\+\_\+name}} (f\+\_\+ptr, name, CS)
\begin{DoxyCompactList}\small\item\em Indicate whether the field pointed to by f\+\_\+ptr or with the specified variable name has been initialized from a restart file. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__restart_a5223057ec731f74507fd800511c01ab2}{query\+\_\+initialized\+\_\+4d\+\_\+name}} (f\+\_\+ptr, name, CS)
\begin{DoxyCompactList}\small\item\em Indicate whether the field pointed to by f\+\_\+ptr or with the specified variable name has been initialized from a restart file. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__restart_a7086116ef9be7656d32ef9c3a7c3f201}{save\+\_\+restart}} (directory, time, G, CS, time\+\_\+stamped, filename, GV, num\+\_\+rest\+\_\+files)
\begin{DoxyCompactList}\small\item\em save\+\_\+restart saves all registered variables to restart files. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__restart_aec60d8a437fc858db4a020f9985b449d}{restore\+\_\+state}} (filename, directory, day, G, CS)
\begin{DoxyCompactList}\small\item\em restore\+\_\+state reads the model state from previously generated files. All restart variables are read from the first file in the input filename list in which they are found. \end{DoxyCompactList}\item 
logical function, public \mbox{\hyperlink{namespacemom__restart_a252c2d46a89c5e4db14cc8ebfefd01b5}{restart\+\_\+files\+\_\+exist}} (filename, directory, G, CS)
\begin{DoxyCompactList}\small\item\em restart\+\_\+files\+\_\+exist determines whether any restart files exist. \end{DoxyCompactList}\item 
logical function, public \mbox{\hyperlink{namespacemom__restart_aa0656a2a04e437574054ef3411aeee8c}{determine\+\_\+is\+\_\+new\+\_\+run}} (filename, directory, G, CS)
\begin{DoxyCompactList}\small\item\em determine\+\_\+is\+\_\+new\+\_\+run determines from the value of filename and the existence automatically named restart files in directory whether this would be a new, and as a side effect stores this information in CS. \end{DoxyCompactList}\item 
logical function, public \mbox{\hyperlink{namespacemom__restart_a39d14aecb41df2cc730035cca8467f69}{is\+\_\+new\+\_\+run}} (CS)
\begin{DoxyCompactList}\small\item\em is\+\_\+new\+\_\+run returns whether this is going to be a new run based on the information stored in CS by a previous call to determine\+\_\+is\+\_\+new\+\_\+run. \end{DoxyCompactList}\item 
integer function \mbox{\hyperlink{namespacemom__restart_aa4e2dbb538be7a86468409131316da96}{open\+\_\+restart\+\_\+units}} (filename, directory, G, CS, units, file\+\_\+paths, global\+\_\+files)
\begin{DoxyCompactList}\small\item\em open\+\_\+restart\+\_\+units determines the number of existing restart files and optionally opens them and returns unit ids, paths and whether the files are global or spatially decomposed. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__restart_a0ad0a0207dceeb1d9e68c7af7fd39bdc}{restart\+\_\+init}} (param\+\_\+file, CS, restart\+\_\+root)
\begin{DoxyCompactList}\small\item\em Initialize this module and set up a restart control structure. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__restart_a304183ab574d06ac810b41b1e82eb89c}{restart\+\_\+init\+\_\+end}} (CS)
\begin{DoxyCompactList}\small\item\em Indicate that all variables have now been registered. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__restart_ab1ebc8fc62c81dd175b09d376ca2a564}{restart\+\_\+end}} (CS)
\begin{DoxyCompactList}\small\item\em Deallocate memory associated with a M\+O\+M\+\_\+restart\+\_\+\+CS variable. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__restart_a4b143fb18dab7c0825e426fbf9532623}{restart\+\_\+error}} (CS)
\item 
subroutine \mbox{\hyperlink{namespacemom__restart_ac31159d0fec067a0a07ac1ac44a5ff8e}{get\+\_\+checksum\+\_\+loop\+\_\+ranges}} (G, pos, isL, ieL, jsL, jeL)
\begin{DoxyCompactList}\small\item\em Return bounds for computing checksums to store in restart files. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__restart_aa0656a2a04e437574054ef3411aeee8c}\label{namespacemom__restart_aa0656a2a04e437574054ef3411aeee8c}} 
\index{mom\_restart@{mom\_restart}!determine\_is\_new\_run@{determine\_is\_new\_run}}
\index{determine\_is\_new\_run@{determine\_is\_new\_run}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{determine\_is\_new\_run()}{determine\_is\_new\_run()}}
{\footnotesize\ttfamily logical function, public mom\+\_\+restart\+::determine\+\_\+is\+\_\+new\+\_\+run (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{filename,  }\item[{character(len=$\ast$), intent(in)}]{directory,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



determine\+\_\+is\+\_\+new\+\_\+run determines from the value of filename and the existence automatically named restart files in directory whether this would be a new, and as a side effect stores this information in CS. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em filename} & The list of restart file names or a single character \textquotesingle{}r\textquotesingle{} to read automatically named files. \\
\hline
\mbox{\texttt{ in}}  & {\em directory} & The directory in which to find restart files \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
 & {\em cs} & The control structure returned by a previous call to restart\+\_\+init. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The function result, which indicates whether this is a new run, based on the value of filename and whether restart files exist. 
\end{DoxyReturn}


Definition at line 1319 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1320   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)}  :: filename\textcolor{comment}{  !< The list of restart file names or a single}}
\DoxyCodeLine{1321 \textcolor{comment}{                                                  !! character 'r' to read automatically named files.}}
\DoxyCodeLine{1322   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)}  :: directory\textcolor{comment}{ !< The directory in which to find restart files}}
\DoxyCodeLine{1323   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{         !< The ocean's grid structure}}
\DoxyCodeLine{1324   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer}     :: CS\textcolor{comment}{        !< The control structure returned by a previous}}
\DoxyCodeLine{1325 \textcolor{comment}{                                                  !! call to restart\_init.}}
\DoxyCodeLine{1326   \textcolor{keywordtype}{logical} :: is\_new\_run\textcolor{comment}{                           !< The function result, which indicates whether}}
\DoxyCodeLine{1327 \textcolor{comment}{                                                  !! this is a new run, based on the value of}}
\DoxyCodeLine{1328 \textcolor{comment}{                                                  !! filename and whether restart files exist.}}
\DoxyCodeLine{1329 }
\DoxyCodeLine{1330   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{1331       \textcolor{stringliteral}{"determine\_is\_new\_run: Module must be initialized before it is used."})}
\DoxyCodeLine{1332   \textcolor{keywordflow}{if} (len\_trim(filename) > 1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1333     cs\%new\_run = .false.}
\DoxyCodeLine{1334   \textcolor{keywordflow}{elseif} (len\_trim(filename) == 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1335     cs\%new\_run = .true.}
\DoxyCodeLine{1336   \textcolor{keywordflow}{elseif} (filename(1:1) == \textcolor{stringliteral}{'n'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1337     cs\%new\_run = .true.}
\DoxyCodeLine{1338   \textcolor{keywordflow}{elseif} (filename(1:1) == \textcolor{stringliteral}{'F'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1339     cs\%new\_run = (open\_restart\_units(\textcolor{stringliteral}{'r'}, directory, g, cs) == 0)}
\DoxyCodeLine{1340   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1341     cs\%new\_run = .false.}
\DoxyCodeLine{1342 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1343 }
\DoxyCodeLine{1344   cs\%new\_run\_set = .true.}
\DoxyCodeLine{1345   is\_new\_run = cs\%new\_run}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_ac31159d0fec067a0a07ac1ac44a5ff8e}\label{namespacemom__restart_ac31159d0fec067a0a07ac1ac44a5ff8e}} 
\index{mom\_restart@{mom\_restart}!get\_checksum\_loop\_ranges@{get\_checksum\_loop\_ranges}}
\index{get\_checksum\_loop\_ranges@{get\_checksum\_loop\_ranges}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{get\_checksum\_loop\_ranges()}{get\_checksum\_loop\_ranges()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::get\+\_\+checksum\+\_\+loop\+\_\+ranges (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{integer, intent(in)}]{pos,  }\item[{integer, intent(out)}]{isL,  }\item[{integer, intent(out)}]{ieL,  }\item[{integer, intent(out)}]{jsL,  }\item[{integer, intent(out)}]{jeL }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Return bounds for computing checksums to store in restart files. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em pos} & An integer indicating staggering of variable \\
\hline
\mbox{\texttt{ out}}  & {\em isl} & i-\/start for checksum \\
\hline
\mbox{\texttt{ out}}  & {\em iel} & i-\/end for checksum \\
\hline
\mbox{\texttt{ out}}  & {\em jsl} & j-\/start for checksum \\
\hline
\mbox{\texttt{ out}}  & {\em jel} & j-\/end for checksum \\
\hline
\end{DoxyParams}


Definition at line 1631 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1632   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{ !< The ocean's grid structure}}
\DoxyCodeLine{1633   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(in)}  :: pos\textcolor{comment}{ !< An integer indicating staggering of variable}}
\DoxyCodeLine{1634   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(out)} :: isL\textcolor{comment}{ !< i-\/start for checksum}}
\DoxyCodeLine{1635   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(out)} :: ieL\textcolor{comment}{ !< i-\/end for checksum}}
\DoxyCodeLine{1636   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(out)} :: jsL\textcolor{comment}{ !< j-\/start for checksum}}
\DoxyCodeLine{1637   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(out)} :: jeL\textcolor{comment}{ !< j-\/end for checksum}}
\DoxyCodeLine{1638 }
\DoxyCodeLine{1639   \textcolor{comment}{! Regular non-\/symmetric compute domain}}
\DoxyCodeLine{1640   isl = g\%isc-\/g\%isd+1}
\DoxyCodeLine{1641   iel = g\%iec-\/g\%isd+1}
\DoxyCodeLine{1642   jsl = g\%jsc-\/g\%jsd+1}
\DoxyCodeLine{1643   jel = g\%jec-\/g\%jsd+1}
\DoxyCodeLine{1644 }
\DoxyCodeLine{1645   \textcolor{comment}{! Expand range east or south for symmetric arrays}}
\DoxyCodeLine{1646   \textcolor{keywordflow}{if} (g\%symmetric) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1647     \textcolor{keywordflow}{if} ((pos == east\_face) .or. (pos == corner)) \textcolor{keywordflow}{then} \textcolor{comment}{! For u-\/, q-\/points only}}
\DoxyCodeLine{1648       \textcolor{keywordflow}{if} (g\%idg\_offset == 0) isl = isl -\/ 1 \textcolor{comment}{! include western edge in checksums only for western PEs}}
\DoxyCodeLine{1649 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1650     \textcolor{keywordflow}{if} ((pos == north\_face) .or. (pos == corner)) \textcolor{keywordflow}{then} \textcolor{comment}{! For v-\/, q-\/points only}}
\DoxyCodeLine{1651       \textcolor{keywordflow}{if} (g\%jdg\_offset == 0) jsl = jsl -\/ 1 \textcolor{comment}{! include western edge in checksums only for southern PEs}}
\DoxyCodeLine{1652 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1653 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1654 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a39d14aecb41df2cc730035cca8467f69}\label{namespacemom__restart_a39d14aecb41df2cc730035cca8467f69}} 
\index{mom\_restart@{mom\_restart}!is\_new\_run@{is\_new\_run}}
\index{is\_new\_run@{is\_new\_run}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{is\_new\_run()}{is\_new\_run()}}
{\footnotesize\ttfamily logical function, public mom\+\_\+restart\+::is\+\_\+new\+\_\+run (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



is\+\_\+new\+\_\+run returns whether this is going to be a new run based on the information stored in CS by a previous call to determine\+\_\+is\+\_\+new\+\_\+run. 


\begin{DoxyParams}{Parameters}
{\em cs} & The control structure returned by a previous call to restart\+\_\+init. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The function result, which indicates whether this is a new run, based on the value of filename and whether restart files exist. 
\end{DoxyReturn}


Definition at line 1350 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1351   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{ !< The control structure returned by a previous}}
\DoxyCodeLine{1352 \textcolor{comment}{                                       !! call to restart\_init.}}
\DoxyCodeLine{1353   \textcolor{keywordtype}{logical} :: is\_new\_run\textcolor{comment}{                !< The function result, which indicates whether}}
\DoxyCodeLine{1354 \textcolor{comment}{                                       !! this is a new run, based on the value of}}
\DoxyCodeLine{1355 \textcolor{comment}{                                       !! filename and whether restart files exist.}}
\DoxyCodeLine{1356 }
\DoxyCodeLine{1357   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{1358       \textcolor{stringliteral}{"is\_new\_run: Module must be initialized before it is used."})}
\DoxyCodeLine{1359   \textcolor{keywordflow}{if} (.not.cs\%new\_run\_set) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{1360       \textcolor{stringliteral}{"determine\_is\_new\_run must be called for a restart file before is\_new\_run."})}
\DoxyCodeLine{1361 }
\DoxyCodeLine{1362   is\_new\_run = cs\%new\_run}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_aa4e2dbb538be7a86468409131316da96}\label{namespacemom__restart_aa4e2dbb538be7a86468409131316da96}} 
\index{mom\_restart@{mom\_restart}!open\_restart\_units@{open\_restart\_units}}
\index{open\_restart\_units@{open\_restart\_units}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{open\_restart\_units()}{open\_restart\_units()}}
{\footnotesize\ttfamily integer function mom\+\_\+restart\+::open\+\_\+restart\+\_\+units (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{filename,  }\item[{character(len=$\ast$), intent(in)}]{directory,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS,  }\item[{integer, dimension(\+:), intent(out), optional}]{units,  }\item[{character(len=$\ast$), dimension(\+:), intent(out), optional}]{file\+\_\+paths,  }\item[{logical, dimension(\+:), intent(out), optional}]{global\+\_\+files }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



open\+\_\+restart\+\_\+units determines the number of existing restart files and optionally opens them and returns unit ids, paths and whether the files are global or spatially decomposed. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em filename} & The list of restart file names or a single character \textquotesingle{}r\textquotesingle{} to read automatically named files. \\
\hline
\mbox{\texttt{ in}}  & {\em directory} & The directory in which to find restart files \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
 & {\em cs} & The control structure returned by a previous call to restart\+\_\+init. \\
\hline
\mbox{\texttt{ out}}  & {\em units} & The mpp units of all opened files. \\
\hline
\mbox{\texttt{ out}}  & {\em file\+\_\+paths} & The full paths to open files. \\
\hline
\mbox{\texttt{ out}}  & {\em global\+\_\+files} & True if a file is global. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The number of files (both automatically named restart files and others explicitly in filename) that have been opened. 
\end{DoxyReturn}


Definition at line 1367 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1369   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)}  :: filename\textcolor{comment}{  !< The list of restart file names or a single}}
\DoxyCodeLine{1370 \textcolor{comment}{                                                  !! character 'r' to read automatically named files.}}
\DoxyCodeLine{1371   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)}  :: directory\textcolor{comment}{ !< The directory in which to find restart files}}
\DoxyCodeLine{1372   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{         !< The ocean's grid structure}}
\DoxyCodeLine{1373   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer}     :: CS\textcolor{comment}{        !< The control structure returned by a previous}}
\DoxyCodeLine{1374 \textcolor{comment}{                                                  !! call to restart\_init.}}
\DoxyCodeLine{1375   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(:)}, \&}
\DoxyCodeLine{1376                \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: units\textcolor{comment}{     !< The mpp units of all opened files.}}
\DoxyCodeLine{1377   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{dimension(:)}, \&}
\DoxyCodeLine{1378                \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: file\_paths\textcolor{comment}{   !< The full paths to open files.}}
\DoxyCodeLine{1379   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{dimension(:)}, \&}
\DoxyCodeLine{1380                \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: global\_files\textcolor{comment}{ !< True if a file is global.}}
\DoxyCodeLine{1381 }
\DoxyCodeLine{1382   \textcolor{keywordtype}{integer} :: num\_files\textcolor{comment}{  !< The number of files (both automatically named restart}}
\DoxyCodeLine{1383 \textcolor{comment}{                        !! files and others explicitly in filename) that have been opened.}}
\DoxyCodeLine{1384 }
\DoxyCodeLine{1385 \textcolor{comment}{!    This subroutine reads the model state from previously}}
\DoxyCodeLine{1386 \textcolor{comment}{!  generated files.  All restart variables are read from the first}}
\DoxyCodeLine{1387 \textcolor{comment}{!  file in the input filename list in which they are found.}}
\DoxyCodeLine{1388 }
\DoxyCodeLine{1389   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1390   \textcolor{keywordtype}{character(len=256)} :: filepath  \textcolor{comment}{! The path (dir/file) to the file being opened.}}
\DoxyCodeLine{1391   \textcolor{keywordtype}{character(len=256)} :: fname     \textcolor{comment}{! The name of the current file.}}
\DoxyCodeLine{1392   \textcolor{keywordtype}{character(len=8)}   :: suffix    \textcolor{comment}{! A suffix (like "\_2") that is added to any}}
\DoxyCodeLine{1393                                   \textcolor{comment}{! additional restart files.}}
\DoxyCodeLine{1394 \textcolor{comment}{! character(len=256) :: mesg      ! A message for warnings.}}
\DoxyCodeLine{1395   \textcolor{keywordtype}{integer} :: num\_restart     \textcolor{comment}{! The number of restart files that have already}}
\DoxyCodeLine{1396                              \textcolor{comment}{! been opened.}}
\DoxyCodeLine{1397   \textcolor{keywordtype}{integer} :: start\_char      \textcolor{comment}{! The location of the starting character in the}}
\DoxyCodeLine{1398                              \textcolor{comment}{! current file name.}}
\DoxyCodeLine{1399   \textcolor{keywordtype}{integer} :: n, m, err, length}
\DoxyCodeLine{1400 }
\DoxyCodeLine{1401 }
\DoxyCodeLine{1402   \textcolor{keywordtype}{logical} :: fexists}
\DoxyCodeLine{1403   \textcolor{keywordtype}{character(len=32)} :: filename\_appendix = \textcolor{stringliteral}{''} \textcolor{comment}{!fms appendix to filename for ensemble runs}}
\DoxyCodeLine{1404   \textcolor{keywordtype}{character(len=80)} :: restartname}
\DoxyCodeLine{1405 }
\DoxyCodeLine{1406   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{1407       \textcolor{stringliteral}{"open\_restart\_units: Module must be initialized before it is used."})}
\DoxyCodeLine{1408 }
\DoxyCodeLine{1409 \textcolor{comment}{! Get NetCDF ids for all of the restart files.}}
\DoxyCodeLine{1410   num\_restart = 0 ; n = 1 ; start\_char = 1}
\DoxyCodeLine{1411   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (start\_char <= len\_trim(filename) )}
\DoxyCodeLine{1412     \textcolor{keywordflow}{do} m=start\_char,len\_trim(filename)}
\DoxyCodeLine{1413       \textcolor{keywordflow}{if} (filename(m:m) == \textcolor{stringliteral}{' '}) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{1414 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{1415     fname = filename(start\_char:m-\/1)}
\DoxyCodeLine{1416     start\_char = m}
\DoxyCodeLine{1417     \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (start\_char <= len\_trim(filename))}
\DoxyCodeLine{1418       \textcolor{keywordflow}{if} (filename(start\_char:start\_char) == \textcolor{stringliteral}{' '}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1419         start\_char = start\_char + 1}
\DoxyCodeLine{1420       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1421         \textcolor{keywordflow}{exit}}
\DoxyCodeLine{1422 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1423 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{1424 }
\DoxyCodeLine{1425     \textcolor{keywordflow}{if} ((fname(1:1)==\textcolor{stringliteral}{'r'}) .and. ( len\_trim(fname) == 1)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1426       err = 0}
\DoxyCodeLine{1427       \textcolor{keywordflow}{if} (num\_restart > 0) err = 1 \textcolor{comment}{! Avoid going through the file list twice.}}
\DoxyCodeLine{1428       \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (err == 0)}
\DoxyCodeLine{1429         restartname = trim(cs\%restartfile)}
\DoxyCodeLine{1430 }
\DoxyCodeLine{1431        \textcolor{comment}{!query fms\_io if there is a filename\_appendix (for ensemble runs)}}
\DoxyCodeLine{1432        \textcolor{keyword}{call }get\_filename\_appendix(filename\_appendix)}
\DoxyCodeLine{1433        \textcolor{keywordflow}{if} (len\_trim(filename\_appendix) > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1434          length = len\_trim(restartname)}
\DoxyCodeLine{1435          \textcolor{keywordflow}{if} (restartname(length-\/2:length) == \textcolor{stringliteral}{'.nc'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1436            restartname = restartname(1:length-\/3)//\textcolor{stringliteral}{'.'}//trim(filename\_appendix)//\textcolor{stringliteral}{'.nc'}}
\DoxyCodeLine{1437          \textcolor{keywordflow}{else}}
\DoxyCodeLine{1438            restartname = restartname(1:length)  //\textcolor{stringliteral}{'.'}//trim(filename\_appendix)}
\DoxyCodeLine{1439 \textcolor{keywordflow}{         endif}}
\DoxyCodeLine{1440 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{1441         filepath = trim(directory) // trim(restartname)}
\DoxyCodeLine{1442 }
\DoxyCodeLine{1443         \textcolor{keywordflow}{if} (num\_restart < 10) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1444           \textcolor{keyword}{write}(suffix,\textcolor{stringliteral}{'("\_",I1)'}) num\_restart}
\DoxyCodeLine{1445         \textcolor{keywordflow}{else}}
\DoxyCodeLine{1446           \textcolor{keyword}{write}(suffix,\textcolor{stringliteral}{'("\_",I2)'}) num\_restart}
\DoxyCodeLine{1447 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{1448         \textcolor{keywordflow}{if} (num\_restart > 0) filepath = trim(filepath) // suffix}
\DoxyCodeLine{1449 }
\DoxyCodeLine{1450         \textcolor{comment}{! if (.not.file\_exists(filepath)) \&}}
\DoxyCodeLine{1451           filepath = trim(filepath)//\textcolor{stringliteral}{".nc"}}
\DoxyCodeLine{1452 }
\DoxyCodeLine{1453         num\_restart = num\_restart + 1}
\DoxyCodeLine{1454         \textcolor{keyword}{inquire}(file=filepath, exist=fexists)}
\DoxyCodeLine{1455         \textcolor{keywordflow}{if} (fexists) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1456           \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(units)) \&}
\DoxyCodeLine{1457             \textcolor{keyword}{call }open\_file(units(n), trim(filepath), readonly\_file, netcdf\_file, \&}
\DoxyCodeLine{1458                            threading = multiple, fileset = single\_file)}
\DoxyCodeLine{1459           \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(global\_files)) global\_files(n) = .true.}
\DoxyCodeLine{1460         \textcolor{keywordflow}{elseif} (cs\%parallel\_restartfiles) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1461           \textcolor{comment}{! Look for decomposed files using the I/O Layout.}}
\DoxyCodeLine{1462           fexists = file\_exists(filepath, g\%Domain)}
\DoxyCodeLine{1463           \textcolor{keywordflow}{if} (fexists .and. (\textcolor{keyword}{present}(units))) \&}
\DoxyCodeLine{1464             \textcolor{keyword}{call }open\_file(units(n), trim(filepath), readonly\_file, netcdf\_file, \&}
\DoxyCodeLine{1465                            domain=g\%Domain\%mpp\_domain)}
\DoxyCodeLine{1466           \textcolor{keywordflow}{if} (fexists .and. \textcolor{keyword}{present}(global\_files)) global\_files(n) = .false.}
\DoxyCodeLine{1467 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{1468 }
\DoxyCodeLine{1469         \textcolor{keywordflow}{if} (fexists) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1470           \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(file\_paths)) file\_paths(n) = filepath}
\DoxyCodeLine{1471           n = n + 1}
\DoxyCodeLine{1472           \textcolor{keywordflow}{if} (is\_root\_pe() .and. (\textcolor{keyword}{present}(units))) \&}
\DoxyCodeLine{1473             \textcolor{keyword}{call }mom\_error(note, \textcolor{stringliteral}{"MOM\_restart: MOM run restarted using : "}//trim(filepath))}
\DoxyCodeLine{1474         \textcolor{keywordflow}{else}}
\DoxyCodeLine{1475           err = 1 ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{1476 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{1477 \textcolor{keywordflow}{      enddo} \textcolor{comment}{! while (err == 0) loop}}
\DoxyCodeLine{1478     \textcolor{keywordflow}{else}}
\DoxyCodeLine{1479       filepath = trim(directory)//trim(fname)}
\DoxyCodeLine{1480       \textcolor{keyword}{inquire}(file=filepath, exist=fexists)}
\DoxyCodeLine{1481       \textcolor{keywordflow}{if} (.not. fexists) filepath = trim(filepath)//\textcolor{stringliteral}{".nc"}}
\DoxyCodeLine{1482 }
\DoxyCodeLine{1483       \textcolor{keyword}{inquire}(file=filepath, exist=fexists)}
\DoxyCodeLine{1484       \textcolor{keywordflow}{if} (fexists) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1485         \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(units)) \&}
\DoxyCodeLine{1486           \textcolor{keyword}{call }open\_file(units(n), trim(filepath), readonly\_file, netcdf\_file, \&}
\DoxyCodeLine{1487                        threading = multiple, fileset = single\_file)}
\DoxyCodeLine{1488         \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(global\_files)) global\_files(n) = .true.}
\DoxyCodeLine{1489         \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(file\_paths)) file\_paths(n) = filepath}
\DoxyCodeLine{1490         n = n + 1}
\DoxyCodeLine{1491         \textcolor{keywordflow}{if} (is\_root\_pe() .and. (\textcolor{keyword}{present}(units))) \&}
\DoxyCodeLine{1492           \textcolor{keyword}{call }mom\_error(note,\textcolor{stringliteral}{"MOM\_restart: MOM run restarted using : "}//trim(filepath))}
\DoxyCodeLine{1493       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1494         \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(units)) \&}
\DoxyCodeLine{1495           \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"MOM\_restart: Unable to find restart file : "}//trim(filepath))}
\DoxyCodeLine{1496 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1497 }
\DoxyCodeLine{1498 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1499 \textcolor{keywordflow}{  enddo} \textcolor{comment}{! while (start\_char < strlen(filename)) loop}}
\DoxyCodeLine{1500   num\_files = n-\/1}
\DoxyCodeLine{1501 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a9dfaebbadaef08ed425beeb702391d6c}\label{namespacemom__restart_a9dfaebbadaef08ed425beeb702391d6c}} 
\index{mom\_restart@{mom\_restart}!query\_initialized\_0d@{query\_initialized\_0d}}
\index{query\_initialized\_0d@{query\_initialized\_0d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{query\_initialized\_0d()}{query\_initialized\_0d()}}
{\footnotesize\ttfamily logical function mom\+\_\+restart\+::query\+\_\+initialized\+\_\+0d (\begin{DoxyParamCaption}\item[{real, intent(in), target}]{f\+\_\+ptr,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Indicate whether the field pointed to by f\+\_\+ptr has been initialized from a restart file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field that is being queried \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in) \\
\hline
\end{DoxyParams}


Definition at line 535 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{536 \textcolor{keywordtype}{  real},         \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< A pointer to the field that is being queried}}
\DoxyCodeLine{537   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object (intent in)}}
\DoxyCodeLine{538   \textcolor{keywordtype}{logical} :: query\_initialized}
\DoxyCodeLine{539 \textcolor{comment}{!   This subroutine tests whether the field pointed to by f\_ptr has}}
\DoxyCodeLine{540 \textcolor{comment}{! been initialized from a restart file.}}
\DoxyCodeLine{541 }
\DoxyCodeLine{542   \textcolor{keywordtype}{integer} :: m,n}
\DoxyCodeLine{543   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{544       \textcolor{stringliteral}{"query\_initialized: Module must be initialized before it is used."})}
\DoxyCodeLine{545   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{546 }
\DoxyCodeLine{547   query\_initialized = .false.}
\DoxyCodeLine{548   n = cs\%novars+1}
\DoxyCodeLine{549   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{550     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr0d(m)\%p,f\_ptr)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{551       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) query\_initialized = .true.}
\DoxyCodeLine{552       n = m ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{553 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{554 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{555 \textcolor{comment}{! Assume that you are going to initialize it now, so set flag to initialized if}}
\DoxyCodeLine{556 \textcolor{comment}{! queried again.}}
\DoxyCodeLine{557   \textcolor{keywordflow}{if} (n<=cs\%novars) cs\%restart\_field(n)\%initialized = .true.}
\DoxyCodeLine{558 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a7abca14dfc4fa1efcec27f8f8f7d6762}\label{namespacemom__restart_a7abca14dfc4fa1efcec27f8f8f7d6762}} 
\index{mom\_restart@{mom\_restart}!query\_initialized\_0d\_name@{query\_initialized\_0d\_name}}
\index{query\_initialized\_0d\_name@{query\_initialized\_0d\_name}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{query\_initialized\_0d\_name()}{query\_initialized\_0d\_name()}}
{\footnotesize\ttfamily logical function mom\+\_\+restart\+::query\+\_\+initialized\+\_\+0d\+\_\+name (\begin{DoxyParamCaption}\item[{real, intent(in), target}]{f\+\_\+ptr,  }\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Indicate whether the field pointed to by f\+\_\+ptr or with the specified variable name has been initialized from a restart file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field that is being queried \\
\hline
\mbox{\texttt{ in}}  & {\em name} & The name of the field that is being queried \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in) \\
\hline
\end{DoxyParams}


Definition at line 674 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{675 \textcolor{keywordtype}{  real},         \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< A pointer to the field that is being queried}}
\DoxyCodeLine{676   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{ !< The name of the field that is being queried}}
\DoxyCodeLine{677   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object (intent in)}}
\DoxyCodeLine{678   \textcolor{keywordtype}{logical} :: query\_initialized}
\DoxyCodeLine{679 \textcolor{comment}{!   This subroutine tests whether the field pointed to by f\_ptr or with the}}
\DoxyCodeLine{680 \textcolor{comment}{! specified variable name has been initialized from a restart file.}}
\DoxyCodeLine{681 }
\DoxyCodeLine{682   \textcolor{keywordtype}{integer} :: m,n}
\DoxyCodeLine{683   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{684       \textcolor{stringliteral}{"query\_initialized: Module must be initialized before it is used."})}
\DoxyCodeLine{685   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{686 }
\DoxyCodeLine{687   query\_initialized = .false.}
\DoxyCodeLine{688   n = cs\%novars+1}
\DoxyCodeLine{689   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{690     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr0d(m)\%p,f\_ptr)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{691       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) query\_initialized = .true.}
\DoxyCodeLine{692       n = m ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{693 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{694 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{695 \textcolor{comment}{! Assume that you are going to initialize it now, so set flag to initialized if}}
\DoxyCodeLine{696 \textcolor{comment}{! queried again.}}
\DoxyCodeLine{697   \textcolor{keywordflow}{if} (n<=cs\%novars) cs\%restart\_field(n)\%initialized = .true.}
\DoxyCodeLine{698   \textcolor{keywordflow}{if} (n==cs\%novars+1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{699     \textcolor{keywordflow}{if} (is\_root\_pe()) \&}
\DoxyCodeLine{700       \textcolor{keyword}{call }mom\_error(note,\textcolor{stringliteral}{"MOM\_restart: Unable to find "}//name//\textcolor{stringliteral}{" queried by pointer, "}//\&}
\DoxyCodeLine{701         \textcolor{stringliteral}{"probably because of the suspect comparison of pointers by ASSOCIATED."})}
\DoxyCodeLine{702     query\_initialized = query\_initialized\_name(name, cs)}
\DoxyCodeLine{703 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{704 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_ad01401819c16db2630321415488af4fd}\label{namespacemom__restart_ad01401819c16db2630321415488af4fd}} 
\index{mom\_restart@{mom\_restart}!query\_initialized\_1d@{query\_initialized\_1d}}
\index{query\_initialized\_1d@{query\_initialized\_1d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{query\_initialized\_1d()}{query\_initialized\_1d()}}
{\footnotesize\ttfamily logical function mom\+\_\+restart\+::query\+\_\+initialized\+\_\+1d (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Indicate whether the field pointed to by f\+\_\+ptr has been initialized from a restart file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field that is being queried \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in) \\
\hline
\end{DoxyParams}


Definition at line 562 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{563 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< A pointer to the field that is being queried}}
\DoxyCodeLine{564   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object (intent in)}}
\DoxyCodeLine{565   \textcolor{keywordtype}{logical} :: query\_initialized}
\DoxyCodeLine{566 \textcolor{comment}{!   This subroutine tests whether the field pointed to by f\_ptr has}}
\DoxyCodeLine{567 \textcolor{comment}{! been initialized from a restart file.}}
\DoxyCodeLine{568 }
\DoxyCodeLine{569   \textcolor{keywordtype}{integer} :: m,n}
\DoxyCodeLine{570   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{571       \textcolor{stringliteral}{"query\_initialized: Module must be initialized before it is used."})}
\DoxyCodeLine{572   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{573 }
\DoxyCodeLine{574   query\_initialized = .false.}
\DoxyCodeLine{575   n = cs\%novars+1}
\DoxyCodeLine{576   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{577     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr1d(m)\%p,f\_ptr)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{578       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) query\_initialized = .true.}
\DoxyCodeLine{579       n = m ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{580 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{581 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{582 \textcolor{comment}{! Assume that you are going to initialize it now, so set flag to initialized if}}
\DoxyCodeLine{583 \textcolor{comment}{! queried again.}}
\DoxyCodeLine{584   \textcolor{keywordflow}{if} (n<=cs\%novars) cs\%restart\_field(n)\%initialized = .true.}
\DoxyCodeLine{585 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a3c999a09696203fd104cf5ea7786ae39}\label{namespacemom__restart_a3c999a09696203fd104cf5ea7786ae39}} 
\index{mom\_restart@{mom\_restart}!query\_initialized\_1d\_name@{query\_initialized\_1d\_name}}
\index{query\_initialized\_1d\_name@{query\_initialized\_1d\_name}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{query\_initialized\_1d\_name()}{query\_initialized\_1d\_name()}}
{\footnotesize\ttfamily logical function mom\+\_\+restart\+::query\+\_\+initialized\+\_\+1d\+\_\+name (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Indicate whether the field pointed to by f\+\_\+ptr or with the specified variable name has been initialized from a restart file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field that is being queried \\
\hline
\mbox{\texttt{ in}}  & {\em name} & The name of the field that is being queried \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in) \\
\hline
\end{DoxyParams}


Definition at line 709 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{710 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},  \&}
\DoxyCodeLine{711                 \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< A pointer to the field that is being queried}}
\DoxyCodeLine{712   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{ !< The name of the field that is being queried}}
\DoxyCodeLine{713   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object (intent in)}}
\DoxyCodeLine{714   \textcolor{keywordtype}{logical} :: query\_initialized}
\DoxyCodeLine{715 \textcolor{comment}{!   This subroutine tests whether the field pointed to by f\_ptr or with the}}
\DoxyCodeLine{716 \textcolor{comment}{! specified variable name has been initialized from a restart file.}}
\DoxyCodeLine{717 }
\DoxyCodeLine{718   \textcolor{keywordtype}{integer} :: m,n}
\DoxyCodeLine{719   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{720       \textcolor{stringliteral}{"query\_initialized: Module must be initialized before it is used."})}
\DoxyCodeLine{721   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{722 }
\DoxyCodeLine{723   query\_initialized = .false.}
\DoxyCodeLine{724   n = cs\%novars+1}
\DoxyCodeLine{725   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{726     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr1d(m)\%p,f\_ptr)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{727       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) query\_initialized = .true.}
\DoxyCodeLine{728       n = m ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{729 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{730 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{731 \textcolor{comment}{! Assume that you are going to initialize it now, so set flag to initialized if}}
\DoxyCodeLine{732 \textcolor{comment}{! queried again.}}
\DoxyCodeLine{733   \textcolor{keywordflow}{if} (n<=cs\%novars) cs\%restart\_field(n)\%initialized = .true.}
\DoxyCodeLine{734   \textcolor{keywordflow}{if} (n==cs\%novars+1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{735     \textcolor{keywordflow}{if} (is\_root\_pe()) \&}
\DoxyCodeLine{736       \textcolor{keyword}{call }mom\_error(note,\textcolor{stringliteral}{"MOM\_restart: Unable to find "}//name//\textcolor{stringliteral}{" queried by pointer, "}//\&}
\DoxyCodeLine{737         \textcolor{stringliteral}{"probably because of the suspect comparison of pointers by ASSOCIATED."})}
\DoxyCodeLine{738     query\_initialized = query\_initialized\_name(name, cs)}
\DoxyCodeLine{739 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{740 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_aeee4854da077d24fb8618c88972ee2c1}\label{namespacemom__restart_aeee4854da077d24fb8618c88972ee2c1}} 
\index{mom\_restart@{mom\_restart}!query\_initialized\_2d@{query\_initialized\_2d}}
\index{query\_initialized\_2d@{query\_initialized\_2d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{query\_initialized\_2d()}{query\_initialized\_2d()}}
{\footnotesize\ttfamily logical function mom\+\_\+restart\+::query\+\_\+initialized\+\_\+2d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Indicate whether the field pointed to by f\+\_\+ptr has been initialized from a restart file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field that is being queried \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in) \\
\hline
\end{DoxyParams}


Definition at line 589 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{590 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \&}
\DoxyCodeLine{591                 \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< A pointer to the field that is being queried}}
\DoxyCodeLine{592   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object (intent in)}}
\DoxyCodeLine{593   \textcolor{keywordtype}{logical} :: query\_initialized}
\DoxyCodeLine{594 \textcolor{comment}{!   This subroutine tests whether the field pointed to by f\_ptr has}}
\DoxyCodeLine{595 \textcolor{comment}{! been initialized from a restart file.}}
\DoxyCodeLine{596 }
\DoxyCodeLine{597   \textcolor{keywordtype}{integer} :: m,n}
\DoxyCodeLine{598   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{599       \textcolor{stringliteral}{"query\_initialized: Module must be initialized before it is used."})}
\DoxyCodeLine{600   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{601 }
\DoxyCodeLine{602   query\_initialized = .false.}
\DoxyCodeLine{603   n = cs\%novars+1}
\DoxyCodeLine{604   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{605     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr2d(m)\%p,f\_ptr)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{606       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) query\_initialized = .true.}
\DoxyCodeLine{607       n = m ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{608 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{609 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{610 \textcolor{comment}{! Assume that you are going to initialize it now, so set flag to initialized if}}
\DoxyCodeLine{611 \textcolor{comment}{! queried again.}}
\DoxyCodeLine{612   \textcolor{keywordflow}{if} (n<=cs\%novars) cs\%restart\_field(n)\%initialized = .true.}
\DoxyCodeLine{613 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_ac2916c91f2b110463b8b6ffd5330c683}\label{namespacemom__restart_ac2916c91f2b110463b8b6ffd5330c683}} 
\index{mom\_restart@{mom\_restart}!query\_initialized\_2d\_name@{query\_initialized\_2d\_name}}
\index{query\_initialized\_2d\_name@{query\_initialized\_2d\_name}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{query\_initialized\_2d\_name()}{query\_initialized\_2d\_name()}}
{\footnotesize\ttfamily logical function mom\+\_\+restart\+::query\+\_\+initialized\+\_\+2d\+\_\+name (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Indicate whether the field pointed to by f\+\_\+ptr or with the specified variable name has been initialized from a restart file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field that is being queried \\
\hline
\mbox{\texttt{ in}}  & {\em name} & The name of the field that is being queried \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in) \\
\hline
\end{DoxyParams}


Definition at line 745 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{746 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)},  \&}
\DoxyCodeLine{747                 \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< A pointer to the field that is being queried}}
\DoxyCodeLine{748   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{ !< The name of the field that is being queried}}
\DoxyCodeLine{749   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object (intent in)}}
\DoxyCodeLine{750   \textcolor{keywordtype}{logical} :: query\_initialized}
\DoxyCodeLine{751 \textcolor{comment}{!   This subroutine tests whether the field pointed to by f\_ptr or with the}}
\DoxyCodeLine{752 \textcolor{comment}{! specified variable name has been initialized from a restart file.}}
\DoxyCodeLine{753 }
\DoxyCodeLine{754   \textcolor{keywordtype}{integer} :: m,n}
\DoxyCodeLine{755   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{756       \textcolor{stringliteral}{"query\_initialized: Module must be initialized before it is used."})}
\DoxyCodeLine{757   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{758 }
\DoxyCodeLine{759   query\_initialized = .false.}
\DoxyCodeLine{760   n = cs\%novars+1}
\DoxyCodeLine{761   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{762     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr2d(m)\%p,f\_ptr)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{763       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) query\_initialized = .true.}
\DoxyCodeLine{764       n = m ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{765 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{766 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{767 \textcolor{comment}{! Assume that you are going to initialize it now, so set flag to initialized if}}
\DoxyCodeLine{768 \textcolor{comment}{! queried again.}}
\DoxyCodeLine{769   \textcolor{keywordflow}{if} (n<=cs\%novars) cs\%restart\_field(n)\%initialized = .true.}
\DoxyCodeLine{770   \textcolor{keywordflow}{if} (n==cs\%novars+1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{771     \textcolor{keywordflow}{if} (is\_root\_pe()) \&}
\DoxyCodeLine{772       \textcolor{keyword}{call }mom\_error(note,\textcolor{stringliteral}{"MOM\_restart: Unable to find "}//name//\textcolor{stringliteral}{" queried by pointer, "}//\&}
\DoxyCodeLine{773         \textcolor{stringliteral}{"probably because of the suspect comparison of pointers by ASSOCIATED."})}
\DoxyCodeLine{774     query\_initialized = query\_initialized\_name(name, cs)}
\DoxyCodeLine{775 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{776 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_ad8cd9a08f434e6193d642b08251aee90}\label{namespacemom__restart_ad8cd9a08f434e6193d642b08251aee90}} 
\index{mom\_restart@{mom\_restart}!query\_initialized\_3d@{query\_initialized\_3d}}
\index{query\_initialized\_3d@{query\_initialized\_3d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{query\_initialized\_3d()}{query\_initialized\_3d()}}
{\footnotesize\ttfamily logical function mom\+\_\+restart\+::query\+\_\+initialized\+\_\+3d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Indicate whether the field pointed to by f\+\_\+ptr has been initialized from a restart file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field that is being queried \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in) \\
\hline
\end{DoxyParams}


Definition at line 617 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{618 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \&}
\DoxyCodeLine{619                 \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< A pointer to the field that is being queried}}
\DoxyCodeLine{620   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object (intent in)}}
\DoxyCodeLine{621   \textcolor{keywordtype}{logical} :: query\_initialized}
\DoxyCodeLine{622 \textcolor{comment}{!   This subroutine tests whether the field pointed to by f\_ptr has}}
\DoxyCodeLine{623 \textcolor{comment}{! been initialized from a restart file.}}
\DoxyCodeLine{624 }
\DoxyCodeLine{625   \textcolor{keywordtype}{integer} :: m,n}
\DoxyCodeLine{626   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{627       \textcolor{stringliteral}{"query\_initialized: Module must be initialized before it is used."})}
\DoxyCodeLine{628   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{629 }
\DoxyCodeLine{630   query\_initialized = .false.}
\DoxyCodeLine{631   n = cs\%novars+1}
\DoxyCodeLine{632   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{633     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr3d(m)\%p,f\_ptr)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{634       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) query\_initialized = .true.}
\DoxyCodeLine{635       n = m ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{636 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{637 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{638 \textcolor{comment}{! Assume that you are going to initialize it now, so set flag to initialized if}}
\DoxyCodeLine{639 \textcolor{comment}{! queried again.}}
\DoxyCodeLine{640   \textcolor{keywordflow}{if} (n<=cs\%novars) cs\%restart\_field(n)\%initialized = .true.}
\DoxyCodeLine{641 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a0ff886233ff24e93349a1f1c8e547da4}\label{namespacemom__restart_a0ff886233ff24e93349a1f1c8e547da4}} 
\index{mom\_restart@{mom\_restart}!query\_initialized\_3d\_name@{query\_initialized\_3d\_name}}
\index{query\_initialized\_3d\_name@{query\_initialized\_3d\_name}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{query\_initialized\_3d\_name()}{query\_initialized\_3d\_name()}}
{\footnotesize\ttfamily logical function mom\+\_\+restart\+::query\+\_\+initialized\+\_\+3d\+\_\+name (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Indicate whether the field pointed to by f\+\_\+ptr or with the specified variable name has been initialized from a restart file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field that is being queried \\
\hline
\mbox{\texttt{ in}}  & {\em name} & The name of the field that is being queried \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in) \\
\hline
\end{DoxyParams}


Definition at line 781 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{782 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)},  \&}
\DoxyCodeLine{783                 \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< A pointer to the field that is being queried}}
\DoxyCodeLine{784   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{ !< The name of the field that is being queried}}
\DoxyCodeLine{785   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object (intent in)}}
\DoxyCodeLine{786   \textcolor{keywordtype}{logical} :: query\_initialized}
\DoxyCodeLine{787 \textcolor{comment}{!   This subroutine tests whether the field pointed to by f\_ptr or with the}}
\DoxyCodeLine{788 \textcolor{comment}{! specified variable name has been initialized from a restart file.}}
\DoxyCodeLine{789 }
\DoxyCodeLine{790   \textcolor{keywordtype}{integer} :: m, n}
\DoxyCodeLine{791   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{792       \textcolor{stringliteral}{"query\_initialized: Module must be initialized before it is used."})}
\DoxyCodeLine{793   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{794 }
\DoxyCodeLine{795   query\_initialized = .false.}
\DoxyCodeLine{796   n = cs\%novars+1}
\DoxyCodeLine{797   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{798     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr3d(m)\%p,f\_ptr)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{799       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) query\_initialized = .true.}
\DoxyCodeLine{800       n = m ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{801 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{802 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{803 \textcolor{comment}{! Assume that you are going to initialize it now, so set flag to initialized if}}
\DoxyCodeLine{804 \textcolor{comment}{! queried again.}}
\DoxyCodeLine{805   \textcolor{keywordflow}{if} (n<=cs\%novars) cs\%restart\_field(n)\%initialized = .true.}
\DoxyCodeLine{806   \textcolor{keywordflow}{if} (n==cs\%novars+1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{807     \textcolor{keywordflow}{if} (is\_root\_pe()) \&}
\DoxyCodeLine{808       \textcolor{keyword}{call }mom\_error(note, \textcolor{stringliteral}{"MOM\_restart: Unable to find "}//name//\textcolor{stringliteral}{" queried by pointer, "}//\&}
\DoxyCodeLine{809         \textcolor{stringliteral}{"possibly because of the suspect comparison of pointers by ASSOCIATED."})}
\DoxyCodeLine{810     query\_initialized = query\_initialized\_name(name, cs)}
\DoxyCodeLine{811 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{812 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a91cf0baa54a2d21017252d431635c74a}\label{namespacemom__restart_a91cf0baa54a2d21017252d431635c74a}} 
\index{mom\_restart@{mom\_restart}!query\_initialized\_4d@{query\_initialized\_4d}}
\index{query\_initialized\_4d@{query\_initialized\_4d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{query\_initialized\_4d()}{query\_initialized\_4d()}}
{\footnotesize\ttfamily logical function mom\+\_\+restart\+::query\+\_\+initialized\+\_\+4d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Indicate whether the field pointed to by f\+\_\+ptr has been initialized from a restart file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field that is being queried \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in) \\
\hline
\end{DoxyParams}


Definition at line 645 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{646 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:,:)},  \&}
\DoxyCodeLine{647                 \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< A pointer to the field that is being queried}}
\DoxyCodeLine{648   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object (intent in)}}
\DoxyCodeLine{649   \textcolor{keywordtype}{logical} :: query\_initialized}
\DoxyCodeLine{650 \textcolor{comment}{!   This subroutine tests whether the field pointed to by f\_ptr has}}
\DoxyCodeLine{651 \textcolor{comment}{! been initialized from a restart file.}}
\DoxyCodeLine{652 }
\DoxyCodeLine{653   \textcolor{keywordtype}{integer} :: m,n}
\DoxyCodeLine{654   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{655       \textcolor{stringliteral}{"query\_initialized: Module must be initialized before it is used."})}
\DoxyCodeLine{656   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{657 }
\DoxyCodeLine{658   query\_initialized = .false.}
\DoxyCodeLine{659   n = cs\%novars+1}
\DoxyCodeLine{660   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{661     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr4d(m)\%p,f\_ptr)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{662       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) query\_initialized = .true.}
\DoxyCodeLine{663       n = m ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{664 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{665 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{666 \textcolor{comment}{! Assume that you are going to initialize it now, so set flag to initialized if}}
\DoxyCodeLine{667 \textcolor{comment}{! queried again.}}
\DoxyCodeLine{668   \textcolor{keywordflow}{if} (n<=cs\%novars) cs\%restart\_field(n)\%initialized = .true.}
\DoxyCodeLine{669 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a5223057ec731f74507fd800511c01ab2}\label{namespacemom__restart_a5223057ec731f74507fd800511c01ab2}} 
\index{mom\_restart@{mom\_restart}!query\_initialized\_4d\_name@{query\_initialized\_4d\_name}}
\index{query\_initialized\_4d\_name@{query\_initialized\_4d\_name}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{query\_initialized\_4d\_name()}{query\_initialized\_4d\_name()}}
{\footnotesize\ttfamily logical function mom\+\_\+restart\+::query\+\_\+initialized\+\_\+4d\+\_\+name (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Indicate whether the field pointed to by f\+\_\+ptr or with the specified variable name has been initialized from a restart file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field that is being queried \\
\hline
\mbox{\texttt{ in}}  & {\em name} & The name of the field that is being queried \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in) \\
\hline
\end{DoxyParams}


Definition at line 817 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{818 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:,:)},  \&}
\DoxyCodeLine{819                 \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{ !< A pointer to the field that is being queried}}
\DoxyCodeLine{820   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{ !< The name of the field that is being queried}}
\DoxyCodeLine{821   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object (intent in)}}
\DoxyCodeLine{822   \textcolor{keywordtype}{logical} :: query\_initialized}
\DoxyCodeLine{823 \textcolor{comment}{!   This subroutine tests whether the field pointed to by f\_ptr or with the}}
\DoxyCodeLine{824 \textcolor{comment}{! specified variable name has been initialized from a restart file.}}
\DoxyCodeLine{825 }
\DoxyCodeLine{826   \textcolor{keywordtype}{integer} :: m, n}
\DoxyCodeLine{827   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{828       \textcolor{stringliteral}{"query\_initialized: Module must be initialized before it is used."})}
\DoxyCodeLine{829   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{830 }
\DoxyCodeLine{831   query\_initialized = .false.}
\DoxyCodeLine{832   n = cs\%novars+1}
\DoxyCodeLine{833   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{834     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr4d(m)\%p,f\_ptr)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{835       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) query\_initialized = .true.}
\DoxyCodeLine{836       n = m ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{837 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{838 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{839 \textcolor{comment}{! Assume that you are going to initialize it now, so set flag to initialized if}}
\DoxyCodeLine{840 \textcolor{comment}{! queried again.}}
\DoxyCodeLine{841   \textcolor{keywordflow}{if} (n<=cs\%novars) cs\%restart\_field(n)\%initialized = .true.}
\DoxyCodeLine{842   \textcolor{keywordflow}{if} (n==cs\%novars+1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{843     \textcolor{keywordflow}{if} (is\_root\_pe()) \&}
\DoxyCodeLine{844       \textcolor{keyword}{call }mom\_error(note, \textcolor{stringliteral}{"MOM\_restart: Unable to find "}//name//\textcolor{stringliteral}{" queried by pointer, "}//\&}
\DoxyCodeLine{845         \textcolor{stringliteral}{"possibly because of the suspect comparison of pointers by ASSOCIATED."})}
\DoxyCodeLine{846     query\_initialized = query\_initialized\_name(name, cs)}
\DoxyCodeLine{847 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{848 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a7c9521908e6149d6434fc0611afc3054}\label{namespacemom__restart_a7c9521908e6149d6434fc0611afc3054}} 
\index{mom\_restart@{mom\_restart}!query\_initialized\_name@{query\_initialized\_name}}
\index{query\_initialized\_name@{query\_initialized\_name}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{query\_initialized\_name()}{query\_initialized\_name()}}
{\footnotesize\ttfamily logical function mom\+\_\+restart\+::query\+\_\+initialized\+\_\+name (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



query\+\_\+initialized\+\_\+name determines whether a named field has been successfully read from a restart file yet. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em name} & The name of the field that is being queried \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in) \\
\hline
\end{DoxyParams}


Definition at line 501 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{502   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{ !< The name of the field that is being queried}}
\DoxyCodeLine{503   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object (intent in)}}
\DoxyCodeLine{504   \textcolor{keywordtype}{logical} :: query\_initialized}
\DoxyCodeLine{505 \textcolor{comment}{!   This subroutine returns .true. if the field referred to by name has}}
\DoxyCodeLine{506 \textcolor{comment}{! initialized from a restart file, and .false. otherwise.}}
\DoxyCodeLine{507 }
\DoxyCodeLine{508   \textcolor{keywordtype}{integer} :: m,n}
\DoxyCodeLine{509   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{510       \textcolor{stringliteral}{"query\_initialized: Module must be initialized before it is used."})}
\DoxyCodeLine{511   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{512 }
\DoxyCodeLine{513   query\_initialized = .false.}
\DoxyCodeLine{514   n = cs\%novars+1}
\DoxyCodeLine{515   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{516     \textcolor{keywordflow}{if} (trim(name) == cs\%restart\_field(m)\%var\_name) \textcolor{keywordflow}{then}}
\DoxyCodeLine{517       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) query\_initialized = .true.}
\DoxyCodeLine{518       n = m ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{519 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{520 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{521 \textcolor{comment}{! Assume that you are going to initialize it now, so set flag to initialized if}}
\DoxyCodeLine{522 \textcolor{comment}{! queried again.}}
\DoxyCodeLine{523   \textcolor{keywordflow}{if} (n<=cs\%novars) cs\%restart\_field(n)\%initialized = .true.}
\DoxyCodeLine{524   \textcolor{keywordflow}{if} ((n==cs\%novars+1) .and. (is\_root\_pe())) \&}
\DoxyCodeLine{525     \textcolor{keyword}{call }mom\_error(note,\textcolor{stringliteral}{"MOM\_restart: Unknown restart variable "}//name// \&}
\DoxyCodeLine{526                         \textcolor{stringliteral}{" queried for initialization."})}
\DoxyCodeLine{527 }
\DoxyCodeLine{528   \textcolor{keywordflow}{if} ((is\_root\_pe()) .and. query\_initialized) \&}
\DoxyCodeLine{529     \textcolor{keyword}{call }mom\_error(note,\textcolor{stringliteral}{"MOM\_restart: "}//name// \&}
\DoxyCodeLine{530                          \textcolor{stringliteral}{" initialization confirmed by name."})}
\DoxyCodeLine{531 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a8d4cdf98668368caff5284de45174b86}\label{namespacemom__restart_a8d4cdf98668368caff5284de45174b86}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_field\_0d@{register\_restart\_field\_0d}}
\index{register\_restart\_field\_0d@{register\_restart\_field\_0d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_field\_0d()}{register\_restart\_field\_0d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+field\+\_\+0d (\begin{DoxyParamCaption}\item[{real, intent(in), target}]{f\+\_\+ptr,  }\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS,  }\item[{character(len=$\ast$), intent(in), optional}]{longname,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{character(len=$\ast$), intent(in), optional}]{t\+\_\+grid }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a 0-\/d field for restarts, providing the metadata as individual arguments. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written \\
\hline
\mbox{\texttt{ in}}  & {\em name} & variable name to be used in the restart file \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, the run will abort if this field is not successfully read from the restart file. \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in/out) \\
\hline
\mbox{\texttt{ in}}  & {\em longname} & variable long name \\
\hline
\mbox{\texttt{ in}}  & {\em units} & variable units \\
\hline
\mbox{\texttt{ in}}  & {\em t\+\_\+grid} & time description\+: s, p, or 1, \textquotesingle{}s\textquotesingle{} if absent \\
\hline
\end{DoxyParams}


Definition at line 476 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{478 \textcolor{keywordtype}{  real},               \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{     !< A pointer to the field to be read or written}}
\DoxyCodeLine{479   \textcolor{keywordtype}{character(len=*)},           \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{      !< variable name to be used in the restart file}}
\DoxyCodeLine{480   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}}
\DoxyCodeLine{481 \textcolor{comment}{                                                      !! successfully read from the restart file.}}
\DoxyCodeLine{482   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent in/out)}}
\DoxyCodeLine{483   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: longname\textcolor{comment}{  !< variable long name}}
\DoxyCodeLine{484   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{     !< variable units}}
\DoxyCodeLine{485   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: t\_grid\textcolor{comment}{    !< time description: s, p, or 1, 's' if absent}}
\DoxyCodeLine{486 }
\DoxyCodeLine{487   \textcolor{keywordtype}{type}(vardesc) :: vd}
\DoxyCodeLine{488   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart: "} // \&}
\DoxyCodeLine{489       \textcolor{stringliteral}{"register\_restart\_field\_0d: Module must be initialized before "}//\&}
\DoxyCodeLine{490       \textcolor{stringliteral}{"it is used to register "}//trim(name))}
\DoxyCodeLine{491   vd = var\_desc(name, units=units, longname=longname, hor\_grid=\textcolor{stringliteral}{'1'}, \&}
\DoxyCodeLine{492                 z\_grid=\textcolor{stringliteral}{'1'}, t\_grid=t\_grid)}
\DoxyCodeLine{493 }
\DoxyCodeLine{494   \textcolor{keyword}{call }register\_restart\_field\_ptr0d(f\_ptr, vd, mandatory, cs)}
\DoxyCodeLine{495 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a54d4c48b06ab2bb2fa40bd86adbaa761}\label{namespacemom__restart_a54d4c48b06ab2bb2fa40bd86adbaa761}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_field\_1d@{register\_restart\_field\_1d}}
\index{register\_restart\_field\_1d@{register\_restart\_field\_1d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_field\_1d()}{register\_restart\_field\_1d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+field\+\_\+1d (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS,  }\item[{character(len=$\ast$), intent(in), optional}]{longname,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{character(len=$\ast$), intent(in), optional}]{hor\+\_\+grid,  }\item[{character(len=$\ast$), intent(in), optional}]{z\+\_\+grid,  }\item[{character(len=$\ast$), intent(in), optional}]{t\+\_\+grid }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a 1-\/d field for restarts, providing the metadata as individual arguments. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written \\
\hline
\mbox{\texttt{ in}}  & {\em name} & variable name to be used in the restart file \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, the run will abort if this field is not successfully read from the restart file. \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in/out) \\
\hline
\mbox{\texttt{ in}}  & {\em longname} & variable long name \\
\hline
\mbox{\texttt{ in}}  & {\em units} & variable units \\
\hline
\mbox{\texttt{ in}}  & {\em hor\+\_\+grid} & variable horizonal staggering, \textquotesingle{}1\textquotesingle{} if absent \\
\hline
\mbox{\texttt{ in}}  & {\em z\+\_\+grid} & variable vertical staggering, \textquotesingle{}L\textquotesingle{} if absent \\
\hline
\mbox{\texttt{ in}}  & {\em t\+\_\+grid} & time description\+: s, p, or 1, \textquotesingle{}s\textquotesingle{} if absent \\
\hline
\end{DoxyParams}


Definition at line 448 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{450 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{     !< A pointer to the field to be read or written}}
\DoxyCodeLine{451   \textcolor{keywordtype}{character(len=*)},           \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{      !< variable name to be used in the restart file}}
\DoxyCodeLine{452   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}}
\DoxyCodeLine{453 \textcolor{comment}{                                                      !! successfully read from the restart file.}}
\DoxyCodeLine{454   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent in/out)}}
\DoxyCodeLine{455   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: longname\textcolor{comment}{  !< variable long name}}
\DoxyCodeLine{456   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{     !< variable units}}
\DoxyCodeLine{457   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: hor\_grid\textcolor{comment}{  !< variable horizonal staggering, '1' if absent}}
\DoxyCodeLine{458   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: z\_grid\textcolor{comment}{    !< variable vertical staggering, 'L' if absent}}
\DoxyCodeLine{459   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: t\_grid\textcolor{comment}{    !< time description: s, p, or 1, 's' if absent}}
\DoxyCodeLine{460 }
\DoxyCodeLine{461   \textcolor{keywordtype}{type}(vardesc) :: vd}
\DoxyCodeLine{462   \textcolor{keywordtype}{character(len=8)} :: hgrid}
\DoxyCodeLine{463 }
\DoxyCodeLine{464   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart: "} // \&}
\DoxyCodeLine{465       \textcolor{stringliteral}{"register\_restart\_field\_3d: Module must be initialized before "}//\&}
\DoxyCodeLine{466       \textcolor{stringliteral}{"it is used to register "}//trim(name))}
\DoxyCodeLine{467   hgrid = \textcolor{stringliteral}{'1'} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(hor\_grid)) hgrid = hor\_grid}
\DoxyCodeLine{468   vd = var\_desc(name, units=units, longname=longname, hor\_grid=hgrid, \&}
\DoxyCodeLine{469                 z\_grid=z\_grid, t\_grid=t\_grid)}
\DoxyCodeLine{470 }
\DoxyCodeLine{471   \textcolor{keyword}{call }register\_restart\_field\_ptr1d(f\_ptr, vd, mandatory, cs)}
\DoxyCodeLine{472 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_ae9df9723a9a053c8ce149cfd44570666}\label{namespacemom__restart_ae9df9723a9a053c8ce149cfd44570666}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_field\_2d@{register\_restart\_field\_2d}}
\index{register\_restart\_field\_2d@{register\_restart\_field\_2d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_field\_2d()}{register\_restart\_field\_2d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+field\+\_\+2d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS,  }\item[{character(len=$\ast$), intent(in), optional}]{longname,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{character(len=$\ast$), intent(in), optional}]{hor\+\_\+grid,  }\item[{character(len=$\ast$), intent(in), optional}]{z\+\_\+grid,  }\item[{character(len=$\ast$), intent(in), optional}]{t\+\_\+grid }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a 2-\/d field for restarts, providing the metadata as individual arguments. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written \\
\hline
\mbox{\texttt{ in}}  & {\em name} & variable name to be used in the restart file \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, the run will abort if this field is not successfully read from the restart file. \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in/out) \\
\hline
\mbox{\texttt{ in}}  & {\em longname} & variable long name \\
\hline
\mbox{\texttt{ in}}  & {\em units} & variable units \\
\hline
\mbox{\texttt{ in}}  & {\em hor\+\_\+grid} & variable horizonal staggering, \textquotesingle{}h\textquotesingle{} if absent \\
\hline
\mbox{\texttt{ in}}  & {\em z\+\_\+grid} & variable vertical staggering, \textquotesingle{}1\textquotesingle{} if absent \\
\hline
\mbox{\texttt{ in}}  & {\em t\+\_\+grid} & time description\+: s, p, or 1, \textquotesingle{}s\textquotesingle{} if absent \\
\hline
\end{DoxyParams}


Definition at line 419 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{421 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \&}
\DoxyCodeLine{422                       \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{     !< A pointer to the field to be read or written}}
\DoxyCodeLine{423   \textcolor{keywordtype}{character(len=*)},           \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{      !< variable name to be used in the restart file}}
\DoxyCodeLine{424   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}}
\DoxyCodeLine{425 \textcolor{comment}{                                                      !! successfully read from the restart file.}}
\DoxyCodeLine{426   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent in/out)}}
\DoxyCodeLine{427   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: longname\textcolor{comment}{  !< variable long name}}
\DoxyCodeLine{428   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{     !< variable units}}
\DoxyCodeLine{429   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: hor\_grid\textcolor{comment}{  !< variable horizonal staggering, 'h' if absent}}
\DoxyCodeLine{430   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: z\_grid\textcolor{comment}{    !< variable vertical staggering, '1' if absent}}
\DoxyCodeLine{431   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: t\_grid\textcolor{comment}{    !< time description: s, p, or 1, 's' if absent}}
\DoxyCodeLine{432 }
\DoxyCodeLine{433   \textcolor{keywordtype}{type}(vardesc) :: vd}
\DoxyCodeLine{434   \textcolor{keywordtype}{character(len=8)} :: Zgrid}
\DoxyCodeLine{435 }
\DoxyCodeLine{436   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart: "} // \&}
\DoxyCodeLine{437       \textcolor{stringliteral}{"register\_restart\_field\_2d: Module must be initialized before "}//\&}
\DoxyCodeLine{438       \textcolor{stringliteral}{"it is used to register "}//trim(name))}
\DoxyCodeLine{439   zgrid = \textcolor{stringliteral}{'1'} ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(z\_grid)) zgrid = z\_grid}
\DoxyCodeLine{440   vd = var\_desc(name, units=units, longname=longname, hor\_grid=hor\_grid, \&}
\DoxyCodeLine{441                 z\_grid=zgrid, t\_grid=t\_grid)}
\DoxyCodeLine{442 }
\DoxyCodeLine{443   \textcolor{keyword}{call }register\_restart\_field\_ptr2d(f\_ptr, vd, mandatory, cs)}
\DoxyCodeLine{444 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a7d067c88e93f53ec678706711aace49b}\label{namespacemom__restart_a7d067c88e93f53ec678706711aace49b}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_field\_3d@{register\_restart\_field\_3d}}
\index{register\_restart\_field\_3d@{register\_restart\_field\_3d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_field\_3d()}{register\_restart\_field\_3d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+field\+\_\+3d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS,  }\item[{character(len=$\ast$), intent(in), optional}]{longname,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{character(len=$\ast$), intent(in), optional}]{hor\+\_\+grid,  }\item[{character(len=$\ast$), intent(in), optional}]{z\+\_\+grid,  }\item[{character(len=$\ast$), intent(in), optional}]{t\+\_\+grid }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a 3-\/d field for restarts, providing the metadata as individual arguments. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written \\
\hline
\mbox{\texttt{ in}}  & {\em name} & variable name to be used in the restart file \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, the run will abort if this field is not successfully read from the restart file. \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in/out) \\
\hline
\mbox{\texttt{ in}}  & {\em longname} & variable long name \\
\hline
\mbox{\texttt{ in}}  & {\em units} & variable units \\
\hline
\mbox{\texttt{ in}}  & {\em hor\+\_\+grid} & variable horizonal staggering, \textquotesingle{}h\textquotesingle{} if absent \\
\hline
\mbox{\texttt{ in}}  & {\em z\+\_\+grid} & variable vertical staggering, \textquotesingle{}L\textquotesingle{} if absent \\
\hline
\mbox{\texttt{ in}}  & {\em t\+\_\+grid} & time description\+: s, p, or 1, \textquotesingle{}s\textquotesingle{} if absent \\
\hline
\end{DoxyParams}


Definition at line 392 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{394 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \&}
\DoxyCodeLine{395                       \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{     !< A pointer to the field to be read or written}}
\DoxyCodeLine{396   \textcolor{keywordtype}{character(len=*)},           \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{      !< variable name to be used in the restart file}}
\DoxyCodeLine{397   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}}
\DoxyCodeLine{398 \textcolor{comment}{                                                      !! successfully read from the restart file.}}
\DoxyCodeLine{399   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent in/out)}}
\DoxyCodeLine{400   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: longname\textcolor{comment}{  !< variable long name}}
\DoxyCodeLine{401   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{     !< variable units}}
\DoxyCodeLine{402   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: hor\_grid\textcolor{comment}{  !< variable horizonal staggering, 'h' if absent}}
\DoxyCodeLine{403   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: z\_grid\textcolor{comment}{    !< variable vertical staggering, 'L' if absent}}
\DoxyCodeLine{404   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: t\_grid\textcolor{comment}{    !< time description: s, p, or 1, 's' if absent}}
\DoxyCodeLine{405 }
\DoxyCodeLine{406   \textcolor{keywordtype}{type}(vardesc) :: vd}
\DoxyCodeLine{407 }
\DoxyCodeLine{408   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart: "} // \&}
\DoxyCodeLine{409       \textcolor{stringliteral}{"register\_restart\_field\_3d: Module must be initialized before "}//\&}
\DoxyCodeLine{410       \textcolor{stringliteral}{"it is used to register "}//trim(name))}
\DoxyCodeLine{411   vd = var\_desc(name, units=units, longname=longname, hor\_grid=hor\_grid, \&}
\DoxyCodeLine{412                 z\_grid=z\_grid, t\_grid=t\_grid)}
\DoxyCodeLine{413 }
\DoxyCodeLine{414   \textcolor{keyword}{call }register\_restart\_field\_ptr3d(f\_ptr, vd, mandatory, cs)}
\DoxyCodeLine{415 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a8629faf9333934af51ef1605795467a9}\label{namespacemom__restart_a8629faf9333934af51ef1605795467a9}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_field\_4d@{register\_restart\_field\_4d}}
\index{register\_restart\_field\_4d@{register\_restart\_field\_4d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_field\_4d()}{register\_restart\_field\_4d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+field\+\_\+4d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS,  }\item[{character(len=$\ast$), intent(in), optional}]{longname,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{character(len=$\ast$), intent(in), optional}]{hor\+\_\+grid,  }\item[{character(len=$\ast$), intent(in), optional}]{z\+\_\+grid,  }\item[{character(len=$\ast$), intent(in), optional}]{t\+\_\+grid }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a 4-\/d field for restarts, providing the metadata as individual arguments. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written \\
\hline
\mbox{\texttt{ in}}  & {\em name} & variable name to be used in the restart file \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, the run will abort if this field is not successfully read from the restart file. \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in/out) \\
\hline
\mbox{\texttt{ in}}  & {\em longname} & variable long name \\
\hline
\mbox{\texttt{ in}}  & {\em units} & variable units \\
\hline
\mbox{\texttt{ in}}  & {\em hor\+\_\+grid} & variable horizonal staggering, \textquotesingle{}h\textquotesingle{} if absent \\
\hline
\mbox{\texttt{ in}}  & {\em z\+\_\+grid} & variable vertical staggering, \textquotesingle{}L\textquotesingle{} if absent \\
\hline
\mbox{\texttt{ in}}  & {\em t\+\_\+grid} & time description\+: s, p, or 1, \textquotesingle{}s\textquotesingle{} if absent \\
\hline
\end{DoxyParams}


Definition at line 365 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{367 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, \&}
\DoxyCodeLine{368                       \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{     !< A pointer to the field to be read or written}}
\DoxyCodeLine{369   \textcolor{keywordtype}{character(len=*)},           \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{      !< variable name to be used in the restart file}}
\DoxyCodeLine{370   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}}
\DoxyCodeLine{371 \textcolor{comment}{                                                      !! successfully read from the restart file.}}
\DoxyCodeLine{372   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent in/out)}}
\DoxyCodeLine{373   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: longname\textcolor{comment}{  !< variable long name}}
\DoxyCodeLine{374   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{     !< variable units}}
\DoxyCodeLine{375   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: hor\_grid\textcolor{comment}{  !< variable horizonal staggering, 'h' if absent}}
\DoxyCodeLine{376   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: z\_grid\textcolor{comment}{    !< variable vertical staggering, 'L' if absent}}
\DoxyCodeLine{377   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: t\_grid\textcolor{comment}{    !< time description: s, p, or 1, 's' if absent}}
\DoxyCodeLine{378 }
\DoxyCodeLine{379   \textcolor{keywordtype}{type}(vardesc) :: vd}
\DoxyCodeLine{380 }
\DoxyCodeLine{381   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart: "} // \&}
\DoxyCodeLine{382       \textcolor{stringliteral}{"register\_restart\_field\_4d: Module must be initialized before "}//\&}
\DoxyCodeLine{383       \textcolor{stringliteral}{"it is used to register "}//trim(name))}
\DoxyCodeLine{384   vd = var\_desc(name, units=units, longname=longname, hor\_grid=hor\_grid, \&}
\DoxyCodeLine{385                 z\_grid=z\_grid, t\_grid=t\_grid)}
\DoxyCodeLine{386 }
\DoxyCodeLine{387   \textcolor{keyword}{call }register\_restart\_field\_ptr4d(f\_ptr, vd, mandatory, cs)}
\DoxyCodeLine{388 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_ab507e13911b906934fd4ff6dbf183cfd}\label{namespacemom__restart_ab507e13911b906934fd4ff6dbf183cfd}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_field\_as\_obsolete@{register\_restart\_field\_as\_obsolete}}
\index{register\_restart\_field\_as\_obsolete@{register\_restart\_field\_as\_obsolete}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_field\_as\_obsolete()}{register\_restart\_field\_as\_obsolete()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+restart\+::register\+\_\+restart\+\_\+field\+\_\+as\+\_\+obsolete (\begin{DoxyParamCaption}\item[{character($\ast$), intent(in)}]{field\+\_\+name,  }\item[{character($\ast$), intent(in)}]{replacement\+\_\+name,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em field\+\_\+name} & Name of restart field that is no longer in use\\
\hline
\mbox{\texttt{ in}}  & {\em replacement\+\_\+name} & Name of replacement restart field, if applicable\\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in/out) \\
\hline
\end{DoxyParams}


Definition at line 138 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{139   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)} :: field\_name\textcolor{comment}{       !< Name of restart field that is no longer in use}}
\DoxyCodeLine{140   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)} :: replacement\_name\textcolor{comment}{ !< Name of replacement restart field, if applicable}}
\DoxyCodeLine{141   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{          !< A pointer to a MOM\_restart\_CS object (intent in/out)}}
\DoxyCodeLine{142 }
\DoxyCodeLine{143   cs\%num\_obsolete\_vars = cs\%num\_obsolete\_vars+1}
\DoxyCodeLine{144   cs\%restart\_obsolete(cs\%num\_obsolete\_vars)\%field\_name = field\_name}
\DoxyCodeLine{145   cs\%restart\_obsolete(cs\%num\_obsolete\_vars)\%replacement\_name = replacement\_name}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a85aa83bcbaf8ca0992ef542d75441873}\label{namespacemom__restart_a85aa83bcbaf8ca0992ef542d75441873}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_field\_ptr0d@{register\_restart\_field\_ptr0d}}
\index{register\_restart\_field\_ptr0d@{register\_restart\_field\_ptr0d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_field\_ptr0d()}{register\_restart\_field\_ptr0d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+field\+\_\+ptr0d (\begin{DoxyParamCaption}\item[{real, intent(in), target}]{f\+\_\+ptr,  }\item[{type(vardesc), intent(in)}]{var\+\_\+desc,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a 0-\/d field for restarts, providing the metadata in a structure. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written \\
\hline
\mbox{\texttt{ in}}  & {\em var\+\_\+desc} & A structure with metadata about this variable \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, the run will abort if this field is not successfully read from the restart file. \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in/out) \\
\hline
\end{DoxyParams}


Definition at line 272 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{273 \textcolor{keywordtype}{  real},               \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{     !< A pointer to the field to be read or written}}
\DoxyCodeLine{274   \textcolor{keywordtype}{type}(vardesc),              \textcolor{keywordtype}{intent(in)} :: var\_desc\textcolor{comment}{  !< A structure with metadata about this variable}}
\DoxyCodeLine{275   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}}
\DoxyCodeLine{276 \textcolor{comment}{                                                      !! successfully read from the restart file.}}
\DoxyCodeLine{277   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent in/out)}}
\DoxyCodeLine{278 }
\DoxyCodeLine{279   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{280       \textcolor{stringliteral}{"register\_restart\_field: Module must be initialized before it is used."})}
\DoxyCodeLine{281 }
\DoxyCodeLine{282   cs\%novars = cs\%novars+1}
\DoxyCodeLine{283   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keywordflow}{return} \textcolor{comment}{! This is an error that will be reported}}
\DoxyCodeLine{284                                      \textcolor{comment}{! once the total number of fields is known.}}
\DoxyCodeLine{285 }
\DoxyCodeLine{286   cs\%restart\_field(cs\%novars)\%vars = var\_desc}
\DoxyCodeLine{287   cs\%restart\_field(cs\%novars)\%mand\_var = mandatory}
\DoxyCodeLine{288   cs\%restart\_field(cs\%novars)\%initialized = .false.}
\DoxyCodeLine{289   \textcolor{keyword}{call }query\_vardesc(cs\%restart\_field(cs\%novars)\%vars, \&}
\DoxyCodeLine{290                      name=cs\%restart\_field(cs\%novars)\%var\_name, \&}
\DoxyCodeLine{291                      caller=\textcolor{stringliteral}{"register\_restart\_field\_ptr0d"})}
\DoxyCodeLine{292 }
\DoxyCodeLine{293   cs\%var\_ptr0d(cs\%novars)\%p => f\_ptr}
\DoxyCodeLine{294   cs\%var\_ptr4d(cs\%novars)\%p => null()}
\DoxyCodeLine{295   cs\%var\_ptr3d(cs\%novars)\%p => null()}
\DoxyCodeLine{296   cs\%var\_ptr2d(cs\%novars)\%p => null()}
\DoxyCodeLine{297   cs\%var\_ptr1d(cs\%novars)\%p => null()}
\DoxyCodeLine{298 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_ada3e7d606fa9080e98c9da40d62be3bc}\label{namespacemom__restart_ada3e7d606fa9080e98c9da40d62be3bc}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_field\_ptr1d@{register\_restart\_field\_ptr1d}}
\index{register\_restart\_field\_ptr1d@{register\_restart\_field\_ptr1d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_field\_ptr1d()}{register\_restart\_field\_ptr1d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+field\+\_\+ptr1d (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{type(vardesc), intent(in)}]{var\+\_\+desc,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a 1-\/d field for restarts, providing the metadata in a structure. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written \\
\hline
\mbox{\texttt{ in}}  & {\em var\+\_\+desc} & A structure with metadata about this variable \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, the run will abort if this field is not successfully read from the restart file. \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in/out) \\
\hline
\end{DoxyParams}


Definition at line 242 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{243 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{     !< A pointer to the field to be read or written}}
\DoxyCodeLine{244   \textcolor{keywordtype}{type}(vardesc),              \textcolor{keywordtype}{intent(in)} :: var\_desc\textcolor{comment}{  !< A structure with metadata about this variable}}
\DoxyCodeLine{245   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}}
\DoxyCodeLine{246 \textcolor{comment}{                                                      !! successfully read from the restart file.}}
\DoxyCodeLine{247   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent in/out)}}
\DoxyCodeLine{248 }
\DoxyCodeLine{249   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{250       \textcolor{stringliteral}{"register\_restart\_field: Module must be initialized before it is used."})}
\DoxyCodeLine{251 }
\DoxyCodeLine{252   cs\%novars = cs\%novars+1}
\DoxyCodeLine{253   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keywordflow}{return} \textcolor{comment}{! This is an error that will be reported}}
\DoxyCodeLine{254                                      \textcolor{comment}{! once the total number of fields is known.}}
\DoxyCodeLine{255 }
\DoxyCodeLine{256   cs\%restart\_field(cs\%novars)\%vars = var\_desc}
\DoxyCodeLine{257   cs\%restart\_field(cs\%novars)\%mand\_var = mandatory}
\DoxyCodeLine{258   cs\%restart\_field(cs\%novars)\%initialized = .false.}
\DoxyCodeLine{259   \textcolor{keyword}{call }query\_vardesc(cs\%restart\_field(cs\%novars)\%vars, \&}
\DoxyCodeLine{260                      name=cs\%restart\_field(cs\%novars)\%var\_name, \&}
\DoxyCodeLine{261                      caller=\textcolor{stringliteral}{"register\_restart\_field\_ptr1d"})}
\DoxyCodeLine{262 }
\DoxyCodeLine{263   cs\%var\_ptr1d(cs\%novars)\%p => f\_ptr}
\DoxyCodeLine{264   cs\%var\_ptr4d(cs\%novars)\%p => null()}
\DoxyCodeLine{265   cs\%var\_ptr3d(cs\%novars)\%p => null()}
\DoxyCodeLine{266   cs\%var\_ptr2d(cs\%novars)\%p => null()}
\DoxyCodeLine{267   cs\%var\_ptr0d(cs\%novars)\%p => null()}
\DoxyCodeLine{268 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a63d6d9ab1d5534897e226ac5c19dfd08}\label{namespacemom__restart_a63d6d9ab1d5534897e226ac5c19dfd08}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_field\_ptr2d@{register\_restart\_field\_ptr2d}}
\index{register\_restart\_field\_ptr2d@{register\_restart\_field\_ptr2d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_field\_ptr2d()}{register\_restart\_field\_ptr2d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+field\+\_\+ptr2d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{type(vardesc), intent(in)}]{var\+\_\+desc,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a 2-\/d field for restarts, providing the metadata in a structure. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written \\
\hline
\mbox{\texttt{ in}}  & {\em var\+\_\+desc} & A structure with metadata about this variable \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, the run will abort if this field is not successfully read from the restart file. \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in/out) \\
\hline
\end{DoxyParams}


Definition at line 211 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{212 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \&}
\DoxyCodeLine{213                       \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{     !< A pointer to the field to be read or written}}
\DoxyCodeLine{214   \textcolor{keywordtype}{type}(vardesc),              \textcolor{keywordtype}{intent(in)} :: var\_desc\textcolor{comment}{  !< A structure with metadata about this variable}}
\DoxyCodeLine{215   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}}
\DoxyCodeLine{216 \textcolor{comment}{                                                      !! successfully read from the restart file.}}
\DoxyCodeLine{217   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent in/out)}}
\DoxyCodeLine{218 }
\DoxyCodeLine{219   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{220       \textcolor{stringliteral}{"register\_restart\_field: Module must be initialized before it is used."})}
\DoxyCodeLine{221 }
\DoxyCodeLine{222   cs\%novars = cs\%novars+1}
\DoxyCodeLine{223   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keywordflow}{return} \textcolor{comment}{! This is an error that will be reported}}
\DoxyCodeLine{224                                      \textcolor{comment}{! once the total number of fields is known.}}
\DoxyCodeLine{225 }
\DoxyCodeLine{226   cs\%restart\_field(cs\%novars)\%vars = var\_desc}
\DoxyCodeLine{227   cs\%restart\_field(cs\%novars)\%mand\_var = mandatory}
\DoxyCodeLine{228   cs\%restart\_field(cs\%novars)\%initialized = .false.}
\DoxyCodeLine{229   \textcolor{keyword}{call }query\_vardesc(cs\%restart\_field(cs\%novars)\%vars, \&}
\DoxyCodeLine{230                      name=cs\%restart\_field(cs\%novars)\%var\_name, \&}
\DoxyCodeLine{231                      caller=\textcolor{stringliteral}{"register\_restart\_field\_ptr2d"})}
\DoxyCodeLine{232 }
\DoxyCodeLine{233   cs\%var\_ptr2d(cs\%novars)\%p => f\_ptr}
\DoxyCodeLine{234   cs\%var\_ptr4d(cs\%novars)\%p => null()}
\DoxyCodeLine{235   cs\%var\_ptr3d(cs\%novars)\%p => null()}
\DoxyCodeLine{236   cs\%var\_ptr1d(cs\%novars)\%p => null()}
\DoxyCodeLine{237   cs\%var\_ptr0d(cs\%novars)\%p => null()}
\DoxyCodeLine{238 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a8ce4ab90691d8178c4558fbdbf79b240}\label{namespacemom__restart_a8ce4ab90691d8178c4558fbdbf79b240}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_field\_ptr3d@{register\_restart\_field\_ptr3d}}
\index{register\_restart\_field\_ptr3d@{register\_restart\_field\_ptr3d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_field\_ptr3d()}{register\_restart\_field\_ptr3d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+field\+\_\+ptr3d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{type(vardesc), intent(in)}]{var\+\_\+desc,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a 3-\/d field for restarts, providing the metadata in a structure. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written \\
\hline
\mbox{\texttt{ in}}  & {\em var\+\_\+desc} & A structure with metadata about this variable \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, the run will abort if this field is not successfully read from the restart file. \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in/out) \\
\hline
\end{DoxyParams}


Definition at line 149 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{150 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \&}
\DoxyCodeLine{151                       \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{     !< A pointer to the field to be read or written}}
\DoxyCodeLine{152   \textcolor{keywordtype}{type}(vardesc),              \textcolor{keywordtype}{intent(in)} :: var\_desc\textcolor{comment}{  !< A structure with metadata about this variable}}
\DoxyCodeLine{153   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}}
\DoxyCodeLine{154 \textcolor{comment}{                                                      !! successfully read from the restart file.}}
\DoxyCodeLine{155   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent in/out)}}
\DoxyCodeLine{156 }
\DoxyCodeLine{157   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{158       \textcolor{stringliteral}{"register\_restart\_field: Module must be initialized before it is used."})}
\DoxyCodeLine{159 }
\DoxyCodeLine{160   cs\%novars = cs\%novars+1}
\DoxyCodeLine{161   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keywordflow}{return} \textcolor{comment}{! This is an error that will be reported}}
\DoxyCodeLine{162                                      \textcolor{comment}{! once the total number of fields is known.}}
\DoxyCodeLine{163 }
\DoxyCodeLine{164   cs\%restart\_field(cs\%novars)\%vars = var\_desc}
\DoxyCodeLine{165   cs\%restart\_field(cs\%novars)\%mand\_var = mandatory}
\DoxyCodeLine{166   cs\%restart\_field(cs\%novars)\%initialized = .false.}
\DoxyCodeLine{167   \textcolor{keyword}{call }query\_vardesc(cs\%restart\_field(cs\%novars)\%vars, \&}
\DoxyCodeLine{168                      name=cs\%restart\_field(cs\%novars)\%var\_name, \&}
\DoxyCodeLine{169                      caller=\textcolor{stringliteral}{"register\_restart\_field\_ptr3d"})}
\DoxyCodeLine{170 }
\DoxyCodeLine{171   cs\%var\_ptr3d(cs\%novars)\%p => f\_ptr}
\DoxyCodeLine{172   cs\%var\_ptr4d(cs\%novars)\%p => null()}
\DoxyCodeLine{173   cs\%var\_ptr2d(cs\%novars)\%p => null()}
\DoxyCodeLine{174   cs\%var\_ptr1d(cs\%novars)\%p => null()}
\DoxyCodeLine{175   cs\%var\_ptr0d(cs\%novars)\%p => null()}
\DoxyCodeLine{176 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a5db9d35748527c8179fd603c5d67f9eb}\label{namespacemom__restart_a5db9d35748527c8179fd603c5d67f9eb}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_field\_ptr4d@{register\_restart\_field\_ptr4d}}
\index{register\_restart\_field\_ptr4d@{register\_restart\_field\_ptr4d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_field\_ptr4d()}{register\_restart\_field\_ptr4d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+field\+\_\+ptr4d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:,\+:), intent(in), target}]{f\+\_\+ptr,  }\item[{type(vardesc), intent(in)}]{var\+\_\+desc,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a 4-\/d field for restarts, providing the metadata in a structure. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written \\
\hline
\mbox{\texttt{ in}}  & {\em var\+\_\+desc} & A structure with metadata about this variable \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, the run will abort if this field is not successfully read from the restart file. \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object (intent in/out) \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{181 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, \&}
\DoxyCodeLine{182                       \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{     !< A pointer to the field to be read or written}}
\DoxyCodeLine{183   \textcolor{keywordtype}{type}(vardesc),              \textcolor{keywordtype}{intent(in)} :: var\_desc\textcolor{comment}{  !< A structure with metadata about this variable}}
\DoxyCodeLine{184   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}}
\DoxyCodeLine{185 \textcolor{comment}{                                                      !! successfully read from the restart file.}}
\DoxyCodeLine{186   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent in/out)}}
\DoxyCodeLine{187 }
\DoxyCodeLine{188   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{189       \textcolor{stringliteral}{"register\_restart\_field: Module must be initialized before it is used."})}
\DoxyCodeLine{190 }
\DoxyCodeLine{191   cs\%novars = cs\%novars+1}
\DoxyCodeLine{192   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keywordflow}{return} \textcolor{comment}{! This is an error that will be reported}}
\DoxyCodeLine{193                                      \textcolor{comment}{! once the total number of fields is known.}}
\DoxyCodeLine{194 }
\DoxyCodeLine{195   cs\%restart\_field(cs\%novars)\%vars = var\_desc}
\DoxyCodeLine{196   cs\%restart\_field(cs\%novars)\%mand\_var = mandatory}
\DoxyCodeLine{197   cs\%restart\_field(cs\%novars)\%initialized = .false.}
\DoxyCodeLine{198   \textcolor{keyword}{call }query\_vardesc(cs\%restart\_field(cs\%novars)\%vars, \&}
\DoxyCodeLine{199                      name=cs\%restart\_field(cs\%novars)\%var\_name, \&}
\DoxyCodeLine{200                      caller=\textcolor{stringliteral}{"register\_restart\_field\_ptr4d"})}
\DoxyCodeLine{201 }
\DoxyCodeLine{202   cs\%var\_ptr4d(cs\%novars)\%p => f\_ptr}
\DoxyCodeLine{203   cs\%var\_ptr3d(cs\%novars)\%p => null()}
\DoxyCodeLine{204   cs\%var\_ptr2d(cs\%novars)\%p => null()}
\DoxyCodeLine{205   cs\%var\_ptr1d(cs\%novars)\%p => null()}
\DoxyCodeLine{206   cs\%var\_ptr0d(cs\%novars)\%p => null()}
\DoxyCodeLine{207 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_ac3c8515bd0544d26102b5e81d09a6586}\label{namespacemom__restart_ac3c8515bd0544d26102b5e81d09a6586}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_pair\_ptr2d@{register\_restart\_pair\_ptr2d}}
\index{register\_restart\_pair\_ptr2d@{register\_restart\_pair\_ptr2d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_pair\_ptr2d()}{register\_restart\_pair\_ptr2d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+pair\+\_\+ptr2d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), intent(in), target}]{a\+\_\+ptr,  }\item[{real, dimension(\+:,\+:), intent(in), target}]{b\+\_\+ptr,  }\item[{type(vardesc), intent(in)}]{a\+\_\+desc,  }\item[{type(vardesc), intent(in)}]{b\+\_\+desc,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a pair of rotationally equivalent 2d restart fields. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em a\+\_\+ptr} & First field pointer \\
\hline
\mbox{\texttt{ in}}  & {\em b\+\_\+ptr} & Second field pointer \\
\hline
\mbox{\texttt{ in}}  & {\em a\+\_\+desc} & First field descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em b\+\_\+desc} & Second field descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, abort if field is missing \\
\hline
 & {\em cs} & M\+OM restart control structure \\
\hline
\end{DoxyParams}


Definition at line 303 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{305 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: a\_ptr\textcolor{comment}{   !< First field pointer}}
\DoxyCodeLine{306 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: b\_ptr\textcolor{comment}{   !< Second field pointer}}
\DoxyCodeLine{307   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: a\_desc\textcolor{comment}{   !< First field descriptor}}
\DoxyCodeLine{308   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: b\_desc\textcolor{comment}{   !< Second field descriptor}}
\DoxyCodeLine{309   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{      !< If true, abort if field is missing}}
\DoxyCodeLine{310   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{   !< MOM restart control structure}}
\DoxyCodeLine{311 }
\DoxyCodeLine{312   \textcolor{keywordflow}{if} (modulo(cs\%turns, 2) /= 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{313     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, a\_desc, mandatory, cs)}
\DoxyCodeLine{314     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, b\_desc, mandatory, cs)}
\DoxyCodeLine{315   \textcolor{keywordflow}{else}}
\DoxyCodeLine{316     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, a\_desc, mandatory, cs)}
\DoxyCodeLine{317     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, b\_desc, mandatory, cs)}
\DoxyCodeLine{318 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a5d8f80120cfa78fe0161f93f67d86836}\label{namespacemom__restart_a5d8f80120cfa78fe0161f93f67d86836}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_pair\_ptr3d@{register\_restart\_pair\_ptr3d}}
\index{register\_restart\_pair\_ptr3d@{register\_restart\_pair\_ptr3d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_pair\_ptr3d()}{register\_restart\_pair\_ptr3d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+pair\+\_\+ptr3d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), intent(in), target}]{a\+\_\+ptr,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), target}]{b\+\_\+ptr,  }\item[{type(vardesc), intent(in)}]{a\+\_\+desc,  }\item[{type(vardesc), intent(in)}]{b\+\_\+desc,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a pair of rotationally equivalent 3d restart fields. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em a\+\_\+ptr} & First field pointer \\
\hline
\mbox{\texttt{ in}}  & {\em b\+\_\+ptr} & Second field pointer \\
\hline
\mbox{\texttt{ in}}  & {\em a\+\_\+desc} & First field descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em b\+\_\+desc} & Second field descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, abort if field is missing \\
\hline
 & {\em cs} & M\+OM restart control structure \\
\hline
\end{DoxyParams}


Definition at line 323 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{325 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: a\_ptr\textcolor{comment}{   !< First field pointer}}
\DoxyCodeLine{326 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: b\_ptr\textcolor{comment}{   !< Second field pointer}}
\DoxyCodeLine{327   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: a\_desc\textcolor{comment}{   !< First field descriptor}}
\DoxyCodeLine{328   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: b\_desc\textcolor{comment}{   !< Second field descriptor}}
\DoxyCodeLine{329   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{      !< If true, abort if field is missing}}
\DoxyCodeLine{330   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{   !< MOM restart control structure}}
\DoxyCodeLine{331 }
\DoxyCodeLine{332   \textcolor{keywordflow}{if} (modulo(cs\%turns, 2) /= 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{333     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, a\_desc, mandatory, cs)}
\DoxyCodeLine{334     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, b\_desc, mandatory, cs)}
\DoxyCodeLine{335   \textcolor{keywordflow}{else}}
\DoxyCodeLine{336     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, a\_desc, mandatory, cs)}
\DoxyCodeLine{337     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, b\_desc, mandatory, cs)}
\DoxyCodeLine{338 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_af23a3f82ea3c786e50e7991b67144582}\label{namespacemom__restart_af23a3f82ea3c786e50e7991b67144582}} 
\index{mom\_restart@{mom\_restart}!register\_restart\_pair\_ptr4d@{register\_restart\_pair\_ptr4d}}
\index{register\_restart\_pair\_ptr4d@{register\_restart\_pair\_ptr4d}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{register\_restart\_pair\_ptr4d()}{register\_restart\_pair\_ptr4d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::register\+\_\+restart\+\_\+pair\+\_\+ptr4d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:,\+:), intent(in), target}]{a\+\_\+ptr,  }\item[{real, dimension(\+:,\+:,\+:,\+:), intent(in), target}]{b\+\_\+ptr,  }\item[{type(vardesc), intent(in)}]{a\+\_\+desc,  }\item[{type(vardesc), intent(in)}]{b\+\_\+desc,  }\item[{logical, intent(in)}]{mandatory,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Register a pair of rotationally equivalent 2d restart fields. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em a\+\_\+ptr} & First field pointer \\
\hline
\mbox{\texttt{ in}}  & {\em b\+\_\+ptr} & Second field pointer \\
\hline
\mbox{\texttt{ in}}  & {\em a\+\_\+desc} & First field descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em b\+\_\+desc} & Second field descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em mandatory} & If true, abort if field is missing \\
\hline
 & {\em cs} & M\+OM restart control structure \\
\hline
\end{DoxyParams}


Definition at line 343 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{345 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: a\_ptr\textcolor{comment}{ !< First field pointer}}
\DoxyCodeLine{346 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: b\_ptr\textcolor{comment}{ !< Second field pointer}}
\DoxyCodeLine{347   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: a\_desc\textcolor{comment}{   !< First field descriptor}}
\DoxyCodeLine{348   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: b\_desc\textcolor{comment}{   !< Second field descriptor}}
\DoxyCodeLine{349   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{      !< If true, abort if field is missing}}
\DoxyCodeLine{350   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{   !< MOM restart control structure}}
\DoxyCodeLine{351 }
\DoxyCodeLine{352   \textcolor{keywordflow}{if} (modulo(cs\%turns, 2) /= 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{353     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, a\_desc, mandatory, cs)}
\DoxyCodeLine{354     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, b\_desc, mandatory, cs)}
\DoxyCodeLine{355   \textcolor{keywordflow}{else}}
\DoxyCodeLine{356     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, a\_desc, mandatory, cs)}
\DoxyCodeLine{357     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, b\_desc, mandatory, cs)}
\DoxyCodeLine{358 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_ab1ebc8fc62c81dd175b09d376ca2a564}\label{namespacemom__restart_ab1ebc8fc62c81dd175b09d376ca2a564}} 
\index{mom\_restart@{mom\_restart}!restart\_end@{restart\_end}}
\index{restart\_end@{restart\_end}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{restart\_end()}{restart\_end()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+restart\+::restart\+\_\+end (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Deallocate memory associated with a M\+O\+M\+\_\+restart\+\_\+\+CS variable. 


\begin{DoxyParams}{Parameters}
{\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object \\
\hline
\end{DoxyParams}


Definition at line 1601 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1602   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object}}
\DoxyCodeLine{1603 }
\DoxyCodeLine{1604   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%restart\_field)) \textcolor{keyword}{deallocate}(cs\%restart\_field)}
\DoxyCodeLine{1605   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%restart\_obsolete)) \textcolor{keyword}{deallocate}(cs\%restart\_obsolete)}
\DoxyCodeLine{1606   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr0d)) \textcolor{keyword}{deallocate}(cs\%var\_ptr0d)}
\DoxyCodeLine{1607   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr1d)) \textcolor{keyword}{deallocate}(cs\%var\_ptr1d)}
\DoxyCodeLine{1608   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr2d)) \textcolor{keyword}{deallocate}(cs\%var\_ptr2d)}
\DoxyCodeLine{1609   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr3d)) \textcolor{keyword}{deallocate}(cs\%var\_ptr3d)}
\DoxyCodeLine{1610   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr4d)) \textcolor{keyword}{deallocate}(cs\%var\_ptr4d)}
\DoxyCodeLine{1611   \textcolor{keyword}{deallocate}(cs)}
\DoxyCodeLine{1612 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a4b143fb18dab7c0825e426fbf9532623}\label{namespacemom__restart_a4b143fb18dab7c0825e426fbf9532623}} 
\index{mom\_restart@{mom\_restart}!restart\_error@{restart\_error}}
\index{restart\_error@{restart\_error}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{restart\_error()}{restart\_error()}}
{\footnotesize\ttfamily subroutine mom\+\_\+restart\+::restart\+\_\+error (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}


\begin{DoxyParams}{Parameters}
{\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object \\
\hline
\end{DoxyParams}


Definition at line 1615 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1616   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object}}
\DoxyCodeLine{1617 }
\DoxyCodeLine{1618   \textcolor{keywordtype}{character(len=16)}  :: num  \textcolor{comment}{! String for error messages}}
\DoxyCodeLine{1619 }
\DoxyCodeLine{1620   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1621     \textcolor{keyword}{write}(num,\textcolor{stringliteral}{'(I0)'}) cs\%novars}
\DoxyCodeLine{1622     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"MOM\_restart: Too many fields registered for "} // \&}
\DoxyCodeLine{1623            \textcolor{stringliteral}{"restart.  Set MAX\_FIELDS to be at least "} // \&}
\DoxyCodeLine{1624            trim(adjustl(num)) // \textcolor{stringliteral}{" in the MOM input file."})}
\DoxyCodeLine{1625   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1626     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"MOM\_restart: Unspecified fatal error."})}
\DoxyCodeLine{1627 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a252c2d46a89c5e4db14cc8ebfefd01b5}\label{namespacemom__restart_a252c2d46a89c5e4db14cc8ebfefd01b5}} 
\index{mom\_restart@{mom\_restart}!restart\_files\_exist@{restart\_files\_exist}}
\index{restart\_files\_exist@{restart\_files\_exist}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{restart\_files\_exist()}{restart\_files\_exist()}}
{\footnotesize\ttfamily logical function, public mom\+\_\+restart\+::restart\+\_\+files\+\_\+exist (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{filename,  }\item[{character(len=$\ast$), intent(in)}]{directory,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



restart\+\_\+files\+\_\+exist determines whether any restart files exist. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em filename} & The list of restart file names or a single character \textquotesingle{}r\textquotesingle{} to read automatically named files. \\
\hline
\mbox{\texttt{ in}}  & {\em directory} & The directory in which to find restart files \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
 & {\em cs} & The control structure returned by a previous call to restart\+\_\+init. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The function result, which indicates whether any of the explicitly or automatically named restart files exist in directory. 
\end{DoxyReturn}


Definition at line 1292 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1293   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)}  :: filename\textcolor{comment}{  !< The list of restart file names or a single}}
\DoxyCodeLine{1294 \textcolor{comment}{                                                  !! character 'r' to read automatically named files.}}
\DoxyCodeLine{1295   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)}  :: directory\textcolor{comment}{ !< The directory in which to find restart files}}
\DoxyCodeLine{1296   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{         !< The ocean's grid structure}}
\DoxyCodeLine{1297   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer}     :: CS\textcolor{comment}{        !< The control structure returned by a previous}}
\DoxyCodeLine{1298 \textcolor{comment}{                                                  !! call to restart\_init.}}
\DoxyCodeLine{1299   \textcolor{keywordtype}{logical} :: restart\_files\_exist\textcolor{comment}{                  !< The function result, which indicates whether}}
\DoxyCodeLine{1300 \textcolor{comment}{                                                  !! any of the explicitly or automatically named}}
\DoxyCodeLine{1301 \textcolor{comment}{                                                  !! restart files exist in directory.}}
\DoxyCodeLine{1302   \textcolor{keywordtype}{integer} :: num\_files}
\DoxyCodeLine{1303 }
\DoxyCodeLine{1304   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{1305       \textcolor{stringliteral}{"restart\_files\_exist: Module must be initialized before it is used."})}
\DoxyCodeLine{1306 }
\DoxyCodeLine{1307   \textcolor{keywordflow}{if} ((len\_trim(filename) == 1) .and. (filename(1:1) == \textcolor{stringliteral}{'F'})) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1308     num\_files = open\_restart\_units(\textcolor{stringliteral}{'r'}, directory, g, cs)}
\DoxyCodeLine{1309   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1310     num\_files = open\_restart\_units(filename, directory, g, cs)}
\DoxyCodeLine{1311 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1312   restart\_files\_exist = (num\_files > 0)}
\DoxyCodeLine{1313 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a0ad0a0207dceeb1d9e68c7af7fd39bdc}\label{namespacemom__restart_a0ad0a0207dceeb1d9e68c7af7fd39bdc}} 
\index{mom\_restart@{mom\_restart}!restart\_init@{restart\_init}}
\index{restart\_init@{restart\_init}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{restart\_init()}{restart\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+restart\+::restart\+\_\+init (\begin{DoxyParamCaption}\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS,  }\item[{character(len=$\ast$), intent(in), optional}]{restart\+\_\+root }\end{DoxyParamCaption})}



Initialize this module and set up a restart control structure. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
 & {\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object that is allocated here \\
\hline
\mbox{\texttt{ in}}  & {\em restart\+\_\+root} & A filename root that overrides the value \\
\hline
\end{DoxyParams}


Definition at line 1505 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1506   \textcolor{keywordtype}{type}(param\_file\_type), \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< A structure to parse for run-\/time parameters}}
\DoxyCodeLine{1507   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object that is allocated here}}
\DoxyCodeLine{1508   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \&}
\DoxyCodeLine{1509                          \textcolor{keywordtype}{intent(in)} :: restart\_root\textcolor{comment}{ !< A filename root that overrides the value}}
\DoxyCodeLine{1510 \textcolor{comment}{                                          !! set by RESTARTFILE to enable the use of this module by}}
\DoxyCodeLine{1511 \textcolor{comment}{                                          !! other components than MOM.}}
\DoxyCodeLine{1512 }
\DoxyCodeLine{1513   \textcolor{keywordtype}{logical} :: rotate\_index}
\DoxyCodeLine{1514 }
\DoxyCodeLine{1515 \textcolor{comment}{! This include declares and sets the variable "version".}}
\DoxyCodeLine{1516 \textcolor{preprocessor}{\#include "version\_variable.h"}}
\DoxyCodeLine{1517 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_restart"}   \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{1518   \textcolor{keywordtype}{logical} :: all\_default   \textcolor{comment}{! If true, all parameters are using their default values.}}
\DoxyCodeLine{1519 }
\DoxyCodeLine{1520   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1521     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"restart\_init called with an associated control structure."})}
\DoxyCodeLine{1522     \textcolor{keywordflow}{return}}
\DoxyCodeLine{1523 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1524   \textcolor{keyword}{allocate}(cs)}
\DoxyCodeLine{1525 }
\DoxyCodeLine{1526   \textcolor{comment}{! Determine whether all paramters are set to their default values.}}
\DoxyCodeLine{1527   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"PARALLEL\_RESTARTFILES"}, cs\%parallel\_restartfiles, \&}
\DoxyCodeLine{1528                  default=.false., do\_not\_log=.true.)}
\DoxyCodeLine{1529   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"LARGE\_FILE\_SUPPORT"}, cs\%large\_file\_support, \&}
\DoxyCodeLine{1530                  default=.true., do\_not\_log=.true.)}
\DoxyCodeLine{1531   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MAX\_FIELDS"}, cs\%max\_fields, default=100, do\_not\_log=.true.)}
\DoxyCodeLine{1532   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RESTART\_CHECKSUMS\_REQUIRED"}, cs\%checksum\_required, \&}
\DoxyCodeLine{1533                  default=.true., do\_not\_log=.true.)}
\DoxyCodeLine{1534   all\_default = ((.not.cs\%parallel\_restartfiles) .and. (cs\%large\_file\_support) .and. \&}
\DoxyCodeLine{1535                  (cs\%max\_fields == 100) .and. (cs\%checksum\_required))}
\DoxyCodeLine{1536   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{present}(restart\_root)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1537     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RESTARTFILE"}, cs\%restartfile, \&}
\DoxyCodeLine{1538                    default=\textcolor{stringliteral}{"MOM.res"}, do\_not\_log=.true.)}
\DoxyCodeLine{1539     all\_default = (all\_default .and. (trim(cs\%restartfile) == trim(\textcolor{stringliteral}{"MOM.res"})))}
\DoxyCodeLine{1540 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1541 }
\DoxyCodeLine{1542   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}}
\DoxyCodeLine{1543   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""}, all\_default=all\_default)}
\DoxyCodeLine{1544   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"PARALLEL\_RESTARTFILES"}, cs\%parallel\_restartfiles, \&}
\DoxyCodeLine{1545                  \textcolor{stringliteral}{"If true, each processor writes its own restart file, "}//\&}
\DoxyCodeLine{1546                  \textcolor{stringliteral}{"otherwise a single restart file is generated"}, \&}
\DoxyCodeLine{1547                  default=.false.)}
\DoxyCodeLine{1548 }
\DoxyCodeLine{1549   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(restart\_root)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1550     cs\%restartfile = restart\_root}
\DoxyCodeLine{1551     \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"RESTARTFILE from argument"}, cs\%restartfile)}
\DoxyCodeLine{1552   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1553     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RESTARTFILE"}, cs\%restartfile, \&}
\DoxyCodeLine{1554                  \textcolor{stringliteral}{"The name-\/root of the restart file."}, default=\textcolor{stringliteral}{"MOM.res"})}
\DoxyCodeLine{1555 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1556   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"LARGE\_FILE\_SUPPORT"}, cs\%large\_file\_support, \&}
\DoxyCodeLine{1557                  \textcolor{stringliteral}{"If true, use the file-\/size limits with NetCDF large "}//\&}
\DoxyCodeLine{1558                  \textcolor{stringliteral}{"file support (4Gb), otherwise the limit is 2Gb."}, \&}
\DoxyCodeLine{1559                  default=.true.)}
\DoxyCodeLine{1560   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MAX\_FIELDS"}, cs\%max\_fields, \&}
\DoxyCodeLine{1561                  \textcolor{stringliteral}{"The maximum number of restart fields that can be used."}, \&}
\DoxyCodeLine{1562                  default=100)}
\DoxyCodeLine{1563   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RESTART\_CHECKSUMS\_REQUIRED"}, cs\%checksum\_required, \&}
\DoxyCodeLine{1564                  \textcolor{stringliteral}{"If true, require the restart checksums to match and error out otherwise. "}//\&}
\DoxyCodeLine{1565                  \textcolor{stringliteral}{"Users may want to avoid this comparison if for example the restarts are "}//\&}
\DoxyCodeLine{1566                  \textcolor{stringliteral}{"made from a run with a different mask\_table than the current run, "}//\&}
\DoxyCodeLine{1567                  \textcolor{stringliteral}{"in which case the checksums will not match and cause crash."},\&}
\DoxyCodeLine{1568                  default=.true.)}
\DoxyCodeLine{1569 }
\DoxyCodeLine{1570   \textcolor{comment}{! Maybe not the best place to do this?}}
\DoxyCodeLine{1571   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ROTATE\_INDEX"}, rotate\_index, \&}
\DoxyCodeLine{1572       default=.false., do\_not\_log=.true.)}
\DoxyCodeLine{1573 }
\DoxyCodeLine{1574   cs\%turns = 0}
\DoxyCodeLine{1575   \textcolor{keywordflow}{if} (rotate\_index) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1576     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INDEX\_TURNS"}, cs\%turns, \&}
\DoxyCodeLine{1577         default=1, do\_not\_log=.true.)}
\DoxyCodeLine{1578 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1579 }
\DoxyCodeLine{1580   \textcolor{keyword}{allocate}(cs\%restart\_field(cs\%max\_fields))}
\DoxyCodeLine{1581   \textcolor{keyword}{allocate}(cs\%restart\_obsolete(cs\%max\_fields))}
\DoxyCodeLine{1582   \textcolor{keyword}{allocate}(cs\%var\_ptr0d(cs\%max\_fields))}
\DoxyCodeLine{1583   \textcolor{keyword}{allocate}(cs\%var\_ptr1d(cs\%max\_fields))}
\DoxyCodeLine{1584   \textcolor{keyword}{allocate}(cs\%var\_ptr2d(cs\%max\_fields))}
\DoxyCodeLine{1585   \textcolor{keyword}{allocate}(cs\%var\_ptr3d(cs\%max\_fields))}
\DoxyCodeLine{1586   \textcolor{keyword}{allocate}(cs\%var\_ptr4d(cs\%max\_fields))}
\DoxyCodeLine{1587 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a304183ab574d06ac810b41b1e82eb89c}\label{namespacemom__restart_a304183ab574d06ac810b41b1e82eb89c}} 
\index{mom\_restart@{mom\_restart}!restart\_init\_end@{restart\_init\_end}}
\index{restart\_init\_end@{restart\_init\_end}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{restart\_init\_end()}{restart\_init\_end()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+restart\+::restart\+\_\+init\+\_\+end (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Indicate that all variables have now been registered. 


\begin{DoxyParams}{Parameters}
{\em cs} & A pointer to a M\+O\+M\+\_\+restart\+\_\+\+CS object \\
\hline
\end{DoxyParams}


Definition at line 1591 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1592   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object}}
\DoxyCodeLine{1593 }
\DoxyCodeLine{1594   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1595     \textcolor{keywordflow}{if} (cs\%novars == 0) \textcolor{keyword}{call }restart\_end(cs)}
\DoxyCodeLine{1596 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1597 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_aec60d8a437fc858db4a020f9985b449d}\label{namespacemom__restart_aec60d8a437fc858db4a020f9985b449d}} 
\index{mom\_restart@{mom\_restart}!restore\_state@{restore\_state}}
\index{restore\_state@{restore\_state}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{restore\_state()}{restore\_state()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+restart\+::restore\+\_\+state (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{filename,  }\item[{character(len=$\ast$), intent(in)}]{directory,  }\item[{type(time\+\_\+type), intent(out)}]{day,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



restore\+\_\+state reads the model state from previously generated files. All restart variables are read from the first file in the input filename list in which they are found. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em filename} & The list of restart file names or a single character \textquotesingle{}r\textquotesingle{} to read automatically named files. \\
\hline
\mbox{\texttt{ in}}  & {\em directory} & The directory in which to find restart files \\
\hline
\mbox{\texttt{ out}}  & {\em day} & The time of the restarted run \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
 & {\em cs} & The control structure returned by a previous call to restart\+\_\+init. \\
\hline
\end{DoxyParams}


Definition at line 1068 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1069   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)}  :: filename\textcolor{comment}{  !< The list of restart file names or a single}}
\DoxyCodeLine{1070 \textcolor{comment}{                                                  !! character 'r' to read automatically named files.}}
\DoxyCodeLine{1071   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)}  :: directory\textcolor{comment}{ !< The directory in which to find restart files}}
\DoxyCodeLine{1072   \textcolor{keywordtype}{type}(time\_type),       \textcolor{keywordtype}{intent(out)} :: day\textcolor{comment}{       !< The time of the restarted run}}
\DoxyCodeLine{1073   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{         !< The ocean's grid structure}}
\DoxyCodeLine{1074   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer}     :: CS\textcolor{comment}{        !< The control structure returned by a previous}}
\DoxyCodeLine{1075 \textcolor{comment}{                                                  !! call to restart\_init.}}
\DoxyCodeLine{1076 }
\DoxyCodeLine{1077 \textcolor{comment}{!    This subroutine reads the model state from previously}}
\DoxyCodeLine{1078 \textcolor{comment}{!  generated files.  All restart variables are read from the first}}
\DoxyCodeLine{1079 \textcolor{comment}{!  file in the input filename list in which they are found.}}
\DoxyCodeLine{1080 }
\DoxyCodeLine{1081   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1082   \textcolor{keywordtype}{character(len=200)} :: filepath  \textcolor{comment}{! The path (dir/file) to the file being opened.}}
\DoxyCodeLine{1083   \textcolor{keywordtype}{character(len=80)} :: fname     \textcolor{comment}{! The name of the current file.}}
\DoxyCodeLine{1084   \textcolor{keywordtype}{character(len=8)}  :: suffix     \textcolor{comment}{! A suffix (like "\_2") that is added to any}}
\DoxyCodeLine{1085                                   \textcolor{comment}{! additional restart files.}}
\DoxyCodeLine{1086   \textcolor{keywordtype}{character(len=512)} :: mesg      \textcolor{comment}{! A message for warnings.}}
\DoxyCodeLine{1087   \textcolor{keywordtype}{character(len=80)} :: varname    \textcolor{comment}{! A variable's name.}}
\DoxyCodeLine{1088   \textcolor{keywordtype}{integer} :: num\_file        \textcolor{comment}{! The number of files (restart files and others}}
\DoxyCodeLine{1089                              \textcolor{comment}{! explicitly in filename) that are open.}}
\DoxyCodeLine{1090   \textcolor{keywordtype}{integer} :: i, n, m, missing\_fields}
\DoxyCodeLine{1091   \textcolor{keywordtype}{integer} :: isL, ieL, jsL, jeL, is0, js0}
\DoxyCodeLine{1092   \textcolor{keywordtype}{integer} :: sizes(7)}
\DoxyCodeLine{1093   \textcolor{keywordtype}{integer} :: ndim, nvar, natt, ntime, pos}
\DoxyCodeLine{1094 }
\DoxyCodeLine{1095   \textcolor{keywordtype}{integer} :: unit(CS\%max\_fields) \textcolor{comment}{! The mpp unit of all open files.}}
\DoxyCodeLine{1096   \textcolor{keywordtype}{character(len=200)} :: unit\_path(CS\%max\_fields) \textcolor{comment}{! The file names.}}
\DoxyCodeLine{1097   \textcolor{keywordtype}{logical} :: unit\_is\_global(CS\%max\_fields) \textcolor{comment}{! True if the file is global.}}
\DoxyCodeLine{1098 }
\DoxyCodeLine{1099   \textcolor{keywordtype}{character(len=8)}   :: hor\_grid \textcolor{comment}{! Variable grid info.}}
\DoxyCodeLine{1100 \textcolor{keywordtype}{  real}    :: t1, t2 \textcolor{comment}{! Two times.}}
\DoxyCodeLine{1101 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{allocatable} :: time\_vals(:)}
\DoxyCodeLine{1102   \textcolor{keywordtype}{type}(fieldtype), \textcolor{keywordtype}{allocatable} :: fields(:)}
\DoxyCodeLine{1103   \textcolor{keywordtype}{logical}                          :: check\_exist, is\_there\_a\_checksum}
\DoxyCodeLine{1104   \textcolor{keywordtype}{integer(kind=8)},\textcolor{keywordtype}{dimension(3)}     :: checksum\_file}
\DoxyCodeLine{1105   \textcolor{keywordtype}{integer(kind=8)}                  :: checksum\_data}
\DoxyCodeLine{1106 }
\DoxyCodeLine{1107   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{1108       \textcolor{stringliteral}{"restore\_state: Module must be initialized before it is used."})}
\DoxyCodeLine{1109   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{1110 }
\DoxyCodeLine{1111 \textcolor{comment}{! Get NetCDF ids for all of the restart files.}}
\DoxyCodeLine{1112   \textcolor{keywordflow}{if} ((len\_trim(filename) == 1) .and. (filename(1:1) == \textcolor{stringliteral}{'F'})) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1113     num\_file = open\_restart\_units(\textcolor{stringliteral}{'r'}, directory, g, cs, units=unit, \&}
\DoxyCodeLine{1114                      file\_paths=unit\_path, global\_files=unit\_is\_global)}
\DoxyCodeLine{1115   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1116     num\_file = open\_restart\_units(filename, directory, g, cs, units=unit, \&}
\DoxyCodeLine{1117                      file\_paths=unit\_path, global\_files=unit\_is\_global)}
\DoxyCodeLine{1118 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1119 }
\DoxyCodeLine{1120   \textcolor{keywordflow}{if} (num\_file == 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1121     \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("Unable to find any restart files specified by  ",A,"  in directory ",A,".")'}) \&}
\DoxyCodeLine{1122                   trim(filename), trim(directory)}
\DoxyCodeLine{1123     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"MOM\_restart: "}//mesg)}
\DoxyCodeLine{1124 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1125 }
\DoxyCodeLine{1126 \textcolor{comment}{! Get the time from the first file in the list that has one.}}
\DoxyCodeLine{1127   \textcolor{keywordflow}{do} n=1,num\_file}
\DoxyCodeLine{1128     \textcolor{keyword}{call }get\_file\_info(unit(n), ndim, nvar, natt, ntime)}
\DoxyCodeLine{1129     \textcolor{keywordflow}{if} (ntime < 1) cycle}
\DoxyCodeLine{1130 }
\DoxyCodeLine{1131     \textcolor{keyword}{allocate}(time\_vals(ntime))}
\DoxyCodeLine{1132     \textcolor{keyword}{call }get\_file\_times(unit(n), time\_vals)}
\DoxyCodeLine{1133     t1 = time\_vals(1)}
\DoxyCodeLine{1134     \textcolor{keyword}{deallocate}(time\_vals)}
\DoxyCodeLine{1135 }
\DoxyCodeLine{1136     day = real\_to\_time(t1*86400.0)}
\DoxyCodeLine{1137     \textcolor{keywordflow}{exit}}
\DoxyCodeLine{1138 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{1139 }
\DoxyCodeLine{1140   \textcolor{keywordflow}{if} (n>num\_file) \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"MOM\_restart: "} // \&}
\DoxyCodeLine{1141                                  \textcolor{stringliteral}{"No times found in restart files."})}
\DoxyCodeLine{1142 }
\DoxyCodeLine{1143 \textcolor{comment}{! Check the remaining files for different times and issue a warning}}
\DoxyCodeLine{1144 \textcolor{comment}{! if they differ from the first time.}}
\DoxyCodeLine{1145   \textcolor{keywordflow}{if} (is\_root\_pe()) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1146     \textcolor{keywordflow}{do} m = n+1,num\_file}
\DoxyCodeLine{1147       \textcolor{keyword}{call }get\_file\_info(unit(n), ndim, nvar, natt, ntime)}
\DoxyCodeLine{1148       \textcolor{keywordflow}{if} (ntime < 1) cycle}
\DoxyCodeLine{1149 }
\DoxyCodeLine{1150       \textcolor{keyword}{allocate}(time\_vals(ntime))}
\DoxyCodeLine{1151       \textcolor{keyword}{call }get\_file\_times(unit(n), time\_vals)}
\DoxyCodeLine{1152       t2 = time\_vals(1)}
\DoxyCodeLine{1153       \textcolor{keyword}{deallocate}(time\_vals)}
\DoxyCodeLine{1154 }
\DoxyCodeLine{1155       \textcolor{keywordflow}{if} (t1 /= t2) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1156         \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("WARNING: Restart file ",I2," has time ",F10.4,"whereas \&}}
\DoxyCodeLine{1157 \textcolor{stringliteral}{}\textcolor{stringliteral}{         \&simulation is restarted at ",F10.4," (differing by ",F10.4,").")'})\&}
\DoxyCodeLine{1158                m,t1,t2,t1-\/t2}
\DoxyCodeLine{1159         \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"MOM\_restart: "}//mesg)}
\DoxyCodeLine{1160 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1161 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{1162 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1163 }
\DoxyCodeLine{1164 \textcolor{comment}{! Read each variable from the first file in which it is found.}}
\DoxyCodeLine{1165   \textcolor{keywordflow}{do} n=1,num\_file}
\DoxyCodeLine{1166     \textcolor{keyword}{call }get\_file\_info(unit(n), ndim, nvar, natt, ntime)}
\DoxyCodeLine{1167 }
\DoxyCodeLine{1168     \textcolor{keyword}{allocate}(fields(nvar))}
\DoxyCodeLine{1169     \textcolor{keyword}{call }get\_file\_fields(unit(n),fields(1:nvar))}
\DoxyCodeLine{1170 }
\DoxyCodeLine{1171     \textcolor{keywordflow}{do} m=1, nvar}
\DoxyCodeLine{1172       \textcolor{keyword}{call }get\_file\_atts(fields(m),name=varname)}
\DoxyCodeLine{1173       \textcolor{keywordflow}{do} i=1,cs\%num\_obsolete\_vars}
\DoxyCodeLine{1174         \textcolor{keywordflow}{if} (adjustl(lowercase(trim(varname))) == adjustl(lowercase(trim(cs\%restart\_obsolete(i)\%field\_name)))) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1175             \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart restore\_state: Attempting to use obsolete restart field "}//\&}
\DoxyCodeLine{1176                            trim(varname)//\textcolor{stringliteral}{" -\/ the new corresponding restart field is "}//\&}
\DoxyCodeLine{1177                            trim(cs\%restart\_obsolete(i)\%replacement\_name))}
\DoxyCodeLine{1178 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{1179 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{1180 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{1181 }
\DoxyCodeLine{1182     missing\_fields = 0}
\DoxyCodeLine{1183 }
\DoxyCodeLine{1184     \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{1185       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%initialized) cycle}
\DoxyCodeLine{1186       \textcolor{keyword}{call }query\_vardesc(cs\%restart\_field(m)\%vars, hor\_grid=hor\_grid, \&}
\DoxyCodeLine{1187                          caller=\textcolor{stringliteral}{"restore\_state"})}
\DoxyCodeLine{1188       \textcolor{keywordflow}{select case} (hor\_grid)}
\DoxyCodeLine{1189         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'q'}) ; pos = corner}
\DoxyCodeLine{1190         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'h'}) ; pos = center}
\DoxyCodeLine{1191         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'u'}) ; pos = east\_face}
\DoxyCodeLine{1192         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'v'}) ; pos = north\_face}
\DoxyCodeLine{1193         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'Bu'}) ; pos = corner}
\DoxyCodeLine{1194         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'T'})  ; pos = center}
\DoxyCodeLine{1195         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'Cu'}) ; pos = east\_face}
\DoxyCodeLine{1196         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'Cv'}) ; pos = north\_face}
\DoxyCodeLine{1197         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'1'}) ; pos = 0}
\DoxyCodeLine{1198 \textcolor{keywordflow}{        case default} ; pos = 0}
\DoxyCodeLine{1199 \textcolor{keywordflow}{      end select}}
\DoxyCodeLine{1200 }
\DoxyCodeLine{1201       \textcolor{keyword}{call }get\_checksum\_loop\_ranges(g, pos, isl, iel, jsl, jel)}
\DoxyCodeLine{1202       \textcolor{keywordflow}{do} i=1, nvar}
\DoxyCodeLine{1203         \textcolor{keyword}{call }get\_file\_atts(fields(i),name=varname)}
\DoxyCodeLine{1204         \textcolor{keywordflow}{if} (lowercase(trim(varname)) == lowercase(trim(cs\%restart\_field(m)\%var\_name))) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1205           check\_exist = mpp\_attribute\_exist(fields(i),\textcolor{stringliteral}{"checksum"})}
\DoxyCodeLine{1206           checksum\_file(:) = -\/1}
\DoxyCodeLine{1207           checksum\_data = -\/1}
\DoxyCodeLine{1208           is\_there\_a\_checksum = .false.}
\DoxyCodeLine{1209           \textcolor{keywordflow}{if} ( check\_exist ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1210             \textcolor{keyword}{call }mpp\_get\_atts(fields(i),checksum=checksum\_file)}
\DoxyCodeLine{1211             is\_there\_a\_checksum = .true.}
\DoxyCodeLine{1212 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{1213           \textcolor{keywordflow}{if} (.NOT. cs\%checksum\_required) is\_there\_a\_checksum = .false. \textcolor{comment}{! Do not need to do data checksumming.}}
\DoxyCodeLine{1214 }
\DoxyCodeLine{1215           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr1d(m)\%p))  \textcolor{keywordflow}{then}}
\DoxyCodeLine{1216             \textcolor{comment}{! Read a 1d array, which should be invariant to domain decomposition.}}
\DoxyCodeLine{1217             \textcolor{keyword}{call }read\_data(unit\_path(n), varname, cs\%var\_ptr1d(m)\%p, \&}
\DoxyCodeLine{1218                            g\%Domain\%mpp\_domain, timelevel=1)}
\DoxyCodeLine{1219             \textcolor{keywordflow}{if} (is\_there\_a\_checksum) checksum\_data = mpp\_chksum(cs\%var\_ptr1d(m)\%p)}
\DoxyCodeLine{1220           \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr0d(m)\%p)) \textcolor{keywordflow}{then} \textcolor{comment}{! Read a scalar...}}
\DoxyCodeLine{1221             \textcolor{keyword}{call }read\_data(unit\_path(n), varname, cs\%var\_ptr0d(m)\%p, \&}
\DoxyCodeLine{1222                            g\%Domain\%mpp\_domain, timelevel=1)}
\DoxyCodeLine{1223             \textcolor{keywordflow}{if} (is\_there\_a\_checksum) checksum\_data = mpp\_chksum(cs\%var\_ptr0d(m)\%p,pelist=(/mpp\_pe()/))}
\DoxyCodeLine{1224           \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr2d(m)\%p)) \textcolor{keywordflow}{then}  \textcolor{comment}{! Read a 2d array.}}
\DoxyCodeLine{1225             \textcolor{keywordflow}{if} (pos /= 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1226               \textcolor{keyword}{call }mom\_read\_data(unit\_path(n), varname, cs\%var\_ptr2d(m)\%p, \&}
\DoxyCodeLine{1227                                  g\%Domain, timelevel=1, position=pos)}
\DoxyCodeLine{1228             \textcolor{keywordflow}{else} \textcolor{comment}{! This array is not domain-\/decomposed.  This variant may be under-\/tested.}}
\DoxyCodeLine{1229               \textcolor{keyword}{call }read\_data(unit\_path(n), varname, cs\%var\_ptr2d(m)\%p, \&}
\DoxyCodeLine{1230                              no\_domain=.true., timelevel=1)}
\DoxyCodeLine{1231 \textcolor{keywordflow}{            endif}}
\DoxyCodeLine{1232             \textcolor{keywordflow}{if} (is\_there\_a\_checksum) checksum\_data = mpp\_chksum(cs\%var\_ptr2d(m)\%p(isl:iel,jsl:jel))}
\DoxyCodeLine{1233           \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr3d(m)\%p)) \textcolor{keywordflow}{then}  \textcolor{comment}{! Read a 3d array.}}
\DoxyCodeLine{1234             \textcolor{keywordflow}{if} (pos /= 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1235               \textcolor{keyword}{call }mom\_read\_data(unit\_path(n), varname, cs\%var\_ptr3d(m)\%p, \&}
\DoxyCodeLine{1236                                  g\%Domain, timelevel=1, position=pos)}
\DoxyCodeLine{1237             \textcolor{keywordflow}{else} \textcolor{comment}{! This array is not domain-\/decomposed.  This variant may be under-\/tested.}}
\DoxyCodeLine{1238               \textcolor{keyword}{call }read\_data(unit\_path(n), varname, cs\%var\_ptr3d(m)\%p, \&}
\DoxyCodeLine{1239                              no\_domain=.true., timelevel=1)}
\DoxyCodeLine{1240 \textcolor{keywordflow}{            endif}}
\DoxyCodeLine{1241             \textcolor{keywordflow}{if} (is\_there\_a\_checksum) checksum\_data = mpp\_chksum(cs\%var\_ptr3d(m)\%p(isl:iel,jsl:jel,:))}
\DoxyCodeLine{1242           \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr4d(m)\%p)) \textcolor{keywordflow}{then}  \textcolor{comment}{! Read a 4d array.}}
\DoxyCodeLine{1243             \textcolor{keywordflow}{if} (pos /= 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1244               \textcolor{keyword}{call }mom\_read\_data(unit\_path(n), varname, cs\%var\_ptr4d(m)\%p, \&}
\DoxyCodeLine{1245                                  g\%Domain, timelevel=1, position=pos)}
\DoxyCodeLine{1246             \textcolor{keywordflow}{else} \textcolor{comment}{! This array is not domain-\/decomposed.  This variant may be under-\/tested.}}
\DoxyCodeLine{1247               \textcolor{keyword}{call }read\_data(unit\_path(n), varname, cs\%var\_ptr4d(m)\%p, \&}
\DoxyCodeLine{1248                              no\_domain=.true., timelevel=1)}
\DoxyCodeLine{1249 \textcolor{keywordflow}{            endif}}
\DoxyCodeLine{1250             \textcolor{keywordflow}{if} (is\_there\_a\_checksum) checksum\_data = mpp\_chksum(cs\%var\_ptr4d(m)\%p(isl:iel,jsl:jel,:,:))}
\DoxyCodeLine{1251           \textcolor{keywordflow}{else}}
\DoxyCodeLine{1252             \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart restore\_state: No pointers set for "}//trim(varname))}
\DoxyCodeLine{1253 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{1254 }
\DoxyCodeLine{1255           \textcolor{keywordflow}{if} (is\_root\_pe() .and. is\_there\_a\_checksum .and. (checksum\_file(1) /= checksum\_data)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1256              \textcolor{keyword}{write} (mesg,\textcolor{stringliteral}{'(a,Z16,a,Z16,a)'}) \textcolor{stringliteral}{"Checksum of input field "}// trim(varname)//\textcolor{stringliteral}{" "},checksum\_data,\&}
\DoxyCodeLine{1257                                           \textcolor{stringliteral}{" does not match value "}, checksum\_file(1), \&}
\DoxyCodeLine{1258                                           \textcolor{stringliteral}{" stored in "}//trim(unit\_path(n)//\textcolor{stringliteral}{"."} )}
\DoxyCodeLine{1259              \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart(restore\_state): "}//trim(mesg) )}
\DoxyCodeLine{1260 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{1261 }
\DoxyCodeLine{1262           cs\%restart\_field(m)\%initialized = .true.}
\DoxyCodeLine{1263           \textcolor{keywordflow}{exit} \textcolor{comment}{! Start search for next restart variable.}}
\DoxyCodeLine{1264 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{1265 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{1266       \textcolor{keywordflow}{if} (i>nvar) missing\_fields = missing\_fields+1}
\DoxyCodeLine{1267 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{1268 }
\DoxyCodeLine{1269     \textcolor{keyword}{deallocate}(fields)}
\DoxyCodeLine{1270     \textcolor{keywordflow}{if} (missing\_fields == 0) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{1271 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{1272 }
\DoxyCodeLine{1273   \textcolor{keywordflow}{do} n=1,num\_file}
\DoxyCodeLine{1274     \textcolor{keyword}{call }close\_file(unit(n))}
\DoxyCodeLine{1275 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{1276 }
\DoxyCodeLine{1277 \textcolor{comment}{! Check whether any mandatory fields have not been found.}}
\DoxyCodeLine{1278   cs\%restart = .true.}
\DoxyCodeLine{1279   \textcolor{keywordflow}{do} m=1,cs\%novars}
\DoxyCodeLine{1280     \textcolor{keywordflow}{if} (.not.(cs\%restart\_field(m)\%initialized)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1281       cs\%restart = .false.}
\DoxyCodeLine{1282       \textcolor{keywordflow}{if} (cs\%restart\_field(m)\%mand\_var) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1283         \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"MOM\_restart: Unable to find mandatory variable "} \&}
\DoxyCodeLine{1284                        //trim(cs\%restart\_field(m)\%var\_name)//\textcolor{stringliteral}{" in restart files."})}
\DoxyCodeLine{1285 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1286 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1287 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{1288 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__restart_a7086116ef9be7656d32ef9c3a7c3f201}\label{namespacemom__restart_a7086116ef9be7656d32ef9c3a7c3f201}} 
\index{mom\_restart@{mom\_restart}!save\_restart@{save\_restart}}
\index{save\_restart@{save\_restart}!mom\_restart@{mom\_restart}}
\doxysubsubsection{\texorpdfstring{save\_restart()}{save\_restart()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+restart\+::save\+\_\+restart (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{directory,  }\item[{type(time\+\_\+type), intent(in)}]{time,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{CS,  }\item[{logical, intent(in), optional}]{time\+\_\+stamped,  }\item[{character(len=$\ast$), intent(in), optional}]{filename,  }\item[{type(verticalgrid\+\_\+type), intent(in), optional}]{GV,  }\item[{integer, intent(out), optional}]{num\+\_\+rest\+\_\+files }\end{DoxyParamCaption})}



save\+\_\+restart saves all registered variables to restart files. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em directory} & The directory where the restart files are to be written \\
\hline
\mbox{\texttt{ in}}  & {\em time} & The current model time \\
\hline
\mbox{\texttt{ in,out}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
 & {\em cs} & The control structure returned by a previous call to restart\+\_\+init. \\
\hline
\mbox{\texttt{ in}}  & {\em time\+\_\+stamped} & If present and true, add time-\/stamp to the restart file names. \\
\hline
\mbox{\texttt{ in}}  & {\em filename} & A filename that overrides the name in CSrestartfile. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure \\
\hline
\mbox{\texttt{ out}}  & {\em num\+\_\+rest\+\_\+files} & number of restart files written \\
\hline
\end{DoxyParams}


Definition at line 852 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{853   \textcolor{keywordtype}{character(len=*)},        \textcolor{keywordtype}{intent(in)}    :: directory\textcolor{comment}{ !< The directory where the restart files}}
\DoxyCodeLine{854 \textcolor{comment}{                                                  !! are to be written}}
\DoxyCodeLine{855   \textcolor{keywordtype}{type}(time\_type),         \textcolor{keywordtype}{intent(in)}    :: time\textcolor{comment}{  !< The current model time}}
\DoxyCodeLine{856   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{     !< The ocean's grid structure}}
\DoxyCodeLine{857   \textcolor{keywordtype}{type}(MOM\_restart\_CS),    \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{    !< The control structure returned by a previous}}
\DoxyCodeLine{858 \textcolor{comment}{                                                  !! call to restart\_init.}}
\DoxyCodeLine{859   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: time\_stamped\textcolor{comment}{ !< If present and true, add time-\/stamp}}
\DoxyCodeLine{860 \textcolor{comment}{                                                  !! to the restart file names.}}
\DoxyCodeLine{861   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: filename\textcolor{comment}{ !< A filename that overrides the name in CS\%restartfile.}}
\DoxyCodeLine{862   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}}
\DoxyCodeLine{863   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: num\_rest\_files\textcolor{comment}{      !< number of restart files written}}
\DoxyCodeLine{864 }
\DoxyCodeLine{865   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{866   \textcolor{keywordtype}{type}(vardesc) :: vars(CS\%max\_fields)  \textcolor{comment}{! Descriptions of the fields that}}
\DoxyCodeLine{867                                         \textcolor{comment}{! are to be read from the restart file.}}
\DoxyCodeLine{868   \textcolor{keywordtype}{type}(fieldtype) :: fields(CS\%max\_fields) \textcolor{comment}{!}}
\DoxyCodeLine{869   \textcolor{keywordtype}{character(len=512)} :: restartpath     \textcolor{comment}{! The restart file path (dir/file).}}
\DoxyCodeLine{870   \textcolor{keywordtype}{character(len=256)} :: restartname     \textcolor{comment}{! The restart file name (no dir).}}
\DoxyCodeLine{871   \textcolor{keywordtype}{character(len=8)}   :: suffix          \textcolor{comment}{! A suffix (like \_2) that is appended}}
\DoxyCodeLine{872                                         \textcolor{comment}{! to the name of files after the first.}}
\DoxyCodeLine{873   \textcolor{keywordtype}{integer(kind=8)} :: var\_sz, size\_in\_file \textcolor{comment}{! The size in bytes of each variable}}
\DoxyCodeLine{874                                         \textcolor{comment}{! and the variables already in a file.}}
\DoxyCodeLine{875   \textcolor{keywordtype}{integer(kind=8)} :: max\_file\_size = 2147483647\_8 \textcolor{comment}{! The maximum size in bytes}}
\DoxyCodeLine{876                                         \textcolor{comment}{! for any one file.  With NetCDF3,}}
\DoxyCodeLine{877                                         \textcolor{comment}{! this should be 2 Gb or less.}}
\DoxyCodeLine{878   \textcolor{keywordtype}{integer} :: start\_var, next\_var        \textcolor{comment}{! The starting variables of the}}
\DoxyCodeLine{879                                         \textcolor{comment}{! current and next files.}}
\DoxyCodeLine{880   \textcolor{keywordtype}{integer} :: unit                       \textcolor{comment}{! The mpp unit of the open file.}}
\DoxyCodeLine{881   \textcolor{keywordtype}{integer} :: m, nz, num\_files, var\_periods}
\DoxyCodeLine{882   \textcolor{keywordtype}{integer} :: seconds, days, year, month, hour, minute}
\DoxyCodeLine{883   \textcolor{keywordtype}{character(len=8)} :: hor\_grid, z\_grid, t\_grid \textcolor{comment}{! Variable grid info.}}
\DoxyCodeLine{884   \textcolor{keywordtype}{character(len=8)} :: t\_grid\_read}
\DoxyCodeLine{885   \textcolor{keywordtype}{character(len=64)} :: var\_name         \textcolor{comment}{! A variable's name.}}
\DoxyCodeLine{886 \textcolor{keywordtype}{  real} :: restart\_time}
\DoxyCodeLine{887   \textcolor{keywordtype}{character(len=32)} :: filename\_appendix = \textcolor{stringliteral}{''} \textcolor{comment}{!fms appendix to filename for ensemble runs}}
\DoxyCodeLine{888   \textcolor{keywordtype}{integer} :: length}
\DoxyCodeLine{889   \textcolor{keywordtype}{integer(kind=8)} :: check\_val(CS\%max\_fields,1)}
\DoxyCodeLine{890   \textcolor{keywordtype}{integer} :: isL, ieL, jsL, jeL, pos}
\DoxyCodeLine{891   \textcolor{keywordtype}{integer} :: turns}
\DoxyCodeLine{892 }
\DoxyCodeLine{893   turns = cs\%turns}
\DoxyCodeLine{894 }
\DoxyCodeLine{895   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // \&}
\DoxyCodeLine{896       \textcolor{stringliteral}{"save\_restart: Module must be initialized before it is used."})}
\DoxyCodeLine{897   \textcolor{keywordflow}{if} (cs\%novars > cs\%max\_fields) \textcolor{keyword}{call }restart\_error(cs)}
\DoxyCodeLine{898 }
\DoxyCodeLine{899   \textcolor{comment}{! With parallel read \& write, it is possible to disable the following...}}
\DoxyCodeLine{900 }
\DoxyCodeLine{901   \textcolor{comment}{! The maximum file size is 4294967292, according to the NetCDF documentation.}}
\DoxyCodeLine{902   \textcolor{keywordflow}{if} (cs\%large\_file\_support) max\_file\_size = 4294967292\_8}
\DoxyCodeLine{903 }
\DoxyCodeLine{904   num\_files = 0}
\DoxyCodeLine{905   next\_var = 0}
\DoxyCodeLine{906   nz = 1 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(gv)) nz = gv\%ke}
\DoxyCodeLine{907 }
\DoxyCodeLine{908   restart\_time = time\_type\_to\_real(time) / 86400.0}
\DoxyCodeLine{909 }
\DoxyCodeLine{910   restartname = trim(cs\%restartfile)}
\DoxyCodeLine{911   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(filename)) restartname = trim(filename)}
\DoxyCodeLine{912   \textcolor{keywordflow}{if} (\textcolor{keyword}{PRESENT}(time\_stamped)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (time\_stamped) \textcolor{keywordflow}{then}}
\DoxyCodeLine{913     \textcolor{keyword}{call }get\_date(time,year,month,days,hour,minute,seconds)}
\DoxyCodeLine{914     \textcolor{comment}{! Compute the year-\/day, because I don't like months. -\/ RWH}}
\DoxyCodeLine{915     \textcolor{keywordflow}{do} m=1,month-\/1}
\DoxyCodeLine{916       days = days + days\_in\_month(set\_date(year,m,2,0,0,0))}
\DoxyCodeLine{917 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{918     seconds = seconds + 60*minute + 3600*hour}
\DoxyCodeLine{919     \textcolor{keywordflow}{if} (year <= 9999) \textcolor{keywordflow}{then}}
\DoxyCodeLine{920       \textcolor{keyword}{write}(restartname,\textcolor{stringliteral}{'("\_Y",I4.4,"\_D",I3.3,"\_S",I5.5)'}) year, days, seconds}
\DoxyCodeLine{921     \textcolor{keywordflow}{elseif} (year <= 99999) \textcolor{keywordflow}{then}}
\DoxyCodeLine{922       \textcolor{keyword}{write}(restartname,\textcolor{stringliteral}{'("\_Y",I5.5,"\_D",I3.3,"\_S",I5.5)'}) year, days, seconds}
\DoxyCodeLine{923     \textcolor{keywordflow}{else}}
\DoxyCodeLine{924       \textcolor{keyword}{write}(restartname,\textcolor{stringliteral}{'("\_Y",I10.10,"\_D",I3.3,"\_S",I5.5)'}) year, days, seconds}
\DoxyCodeLine{925 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{926     restartname = trim(cs\%restartfile)//trim(restartname)}
\DoxyCodeLine{927 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{928 }
\DoxyCodeLine{929   next\_var = 1}
\DoxyCodeLine{930   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (next\_var <= cs\%novars )}
\DoxyCodeLine{931     start\_var = next\_var}
\DoxyCodeLine{932     size\_in\_file = 8*(2*g\%Domain\%niglobal+2*g\%Domain\%njglobal+2*nz+1000)}
\DoxyCodeLine{933 }
\DoxyCodeLine{934     \textcolor{keywordflow}{do} m=start\_var,cs\%novars}
\DoxyCodeLine{935       \textcolor{keyword}{call }query\_vardesc(cs\%restart\_field(m)\%vars, hor\_grid=hor\_grid, \&}
\DoxyCodeLine{936                          z\_grid=z\_grid, t\_grid=t\_grid, caller=\textcolor{stringliteral}{"save\_restart"})}
\DoxyCodeLine{937       \textcolor{keywordflow}{if} (hor\_grid == \textcolor{stringliteral}{'1'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{938         var\_sz = 8}
\DoxyCodeLine{939       \textcolor{keywordflow}{else}}
\DoxyCodeLine{940         var\_sz = 8*(g\%Domain\%niglobal+1)*(g\%Domain\%njglobal+1)}
\DoxyCodeLine{941 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{942       \textcolor{keywordflow}{select case} (z\_grid)}
\DoxyCodeLine{943         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'L'}) ; var\_sz = var\_sz * nz}
\DoxyCodeLine{944         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'i'}) ; var\_sz = var\_sz * (nz+1)}
\DoxyCodeLine{945 \textcolor{keywordflow}{      end select}}
\DoxyCodeLine{946       t\_grid = adjustl(t\_grid)}
\DoxyCodeLine{947       \textcolor{keywordflow}{if} (t\_grid(1:1) == \textcolor{stringliteral}{'p'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{948         \textcolor{keywordflow}{if} (len\_trim(t\_grid(2:8)) > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{949           var\_periods = -\/1}
\DoxyCodeLine{950           t\_grid\_read = adjustl(t\_grid(2:8))}
\DoxyCodeLine{951           \textcolor{keyword}{read}(t\_grid\_read,*) var\_periods}
\DoxyCodeLine{952           \textcolor{keywordflow}{if} (var\_periods > 1) var\_sz = var\_sz * var\_periods}
\DoxyCodeLine{953 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{954 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{955 }
\DoxyCodeLine{956       \textcolor{keywordflow}{if} ((m==start\_var) .OR. (size\_in\_file < max\_file\_size-\/var\_sz)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{957         size\_in\_file = size\_in\_file + var\_sz}
\DoxyCodeLine{958       \textcolor{keywordflow}{else} ; \textcolor{keywordflow}{exit}}
\DoxyCodeLine{959 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{960 }
\DoxyCodeLine{961 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{962     next\_var = m}
\DoxyCodeLine{963 }
\DoxyCodeLine{964     \textcolor{comment}{!query fms\_io if there is a filename\_appendix (for ensemble runs)}}
\DoxyCodeLine{965     \textcolor{keyword}{call }get\_filename\_appendix(filename\_appendix)}
\DoxyCodeLine{966     \textcolor{keywordflow}{if} (len\_trim(filename\_appendix) > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{967       length = len\_trim(restartname)}
\DoxyCodeLine{968       \textcolor{keywordflow}{if} (restartname(length-\/2:length) == \textcolor{stringliteral}{'.nc'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{969         restartname = restartname(1:length-\/3)//\textcolor{stringliteral}{'.'}//trim(filename\_appendix)//\textcolor{stringliteral}{'.nc'}}
\DoxyCodeLine{970       \textcolor{keywordflow}{else}}
\DoxyCodeLine{971         restartname = restartname(1:length)  //\textcolor{stringliteral}{'.'}//trim(filename\_appendix)}
\DoxyCodeLine{972 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{973 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{974 }
\DoxyCodeLine{975     restartpath = trim(directory)// trim(restartname)}
\DoxyCodeLine{976 }
\DoxyCodeLine{977     \textcolor{keywordflow}{if} (num\_files < 10) \textcolor{keywordflow}{then}}
\DoxyCodeLine{978       \textcolor{keyword}{write}(suffix,\textcolor{stringliteral}{'("\_",I1)'}) num\_files}
\DoxyCodeLine{979     \textcolor{keywordflow}{else}}
\DoxyCodeLine{980       \textcolor{keyword}{write}(suffix,\textcolor{stringliteral}{'("\_",I2)'}) num\_files}
\DoxyCodeLine{981 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{982 }
\DoxyCodeLine{983     \textcolor{keywordflow}{if} (num\_files > 0) restartpath = trim(restartpath) // trim(suffix)}
\DoxyCodeLine{984 }
\DoxyCodeLine{985     \textcolor{keywordflow}{do} m=start\_var,next\_var-\/1}
\DoxyCodeLine{986       vars(m-\/start\_var+1) = cs\%restart\_field(m)\%vars}
\DoxyCodeLine{987 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{988     \textcolor{keyword}{call }query\_vardesc(vars(1), t\_grid=t\_grid, hor\_grid=hor\_grid, caller=\textcolor{stringliteral}{"save\_restart"})}
\DoxyCodeLine{989     t\_grid = adjustl(t\_grid)}
\DoxyCodeLine{990     \textcolor{keywordflow}{if} (t\_grid(1:1) /= \textcolor{stringliteral}{'p'}) \&}
\DoxyCodeLine{991       \textcolor{keyword}{call }modify\_vardesc(vars(1), t\_grid=\textcolor{stringliteral}{'s'}, caller=\textcolor{stringliteral}{"save\_restart"})}
\DoxyCodeLine{992     \textcolor{keywordflow}{select case} (hor\_grid)}
\DoxyCodeLine{993       \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'q'}) ; pos = corner}
\DoxyCodeLine{994       \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'h'}) ; pos = center}
\DoxyCodeLine{995       \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'u'}) ; pos = east\_face}
\DoxyCodeLine{996       \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'v'}) ; pos = north\_face}
\DoxyCodeLine{997       \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'Bu'}) ; pos = corner}
\DoxyCodeLine{998       \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'T'})  ; pos = center}
\DoxyCodeLine{999       \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'Cu'}) ; pos = east\_face}
\DoxyCodeLine{1000       \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'Cv'}) ; pos = north\_face}
\DoxyCodeLine{1001       \textcolor{keywordflow}{case} (\textcolor{stringliteral}{'1'}) ; pos = 0}
\DoxyCodeLine{1002 \textcolor{keywordflow}{      case default} ; pos = 0}
\DoxyCodeLine{1003 \textcolor{keywordflow}{    end select}}
\DoxyCodeLine{1004 }
\DoxyCodeLine{1005     \textcolor{comment}{!Prepare the checksum of the restart fields to be written to restart files}}
\DoxyCodeLine{1006     \textcolor{keywordflow}{if} (modulo(turns, 2) /= 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1007       \textcolor{keyword}{call }get\_checksum\_loop\_ranges(g, pos, jsl, jel, isl, iel)}
\DoxyCodeLine{1008     \textcolor{keywordflow}{else}}
\DoxyCodeLine{1009       \textcolor{keyword}{call }get\_checksum\_loop\_ranges(g, pos, isl, iel, jsl, jel)}
\DoxyCodeLine{1010 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1011     \textcolor{keywordflow}{do} m=start\_var,next\_var-\/1}
\DoxyCodeLine{1012       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr3d(m)\%p)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1013         check\_val(m-\/start\_var+1,1) = \&}
\DoxyCodeLine{1014             mpp\_chksum(cs\%var\_ptr3d(m)\%p(isl:iel,jsl:jel,:), turns=-\/turns)}
\DoxyCodeLine{1015       \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr2d(m)\%p)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1016         check\_val(m-\/start\_var+1,1) = \&}
\DoxyCodeLine{1017             mpp\_chksum(cs\%var\_ptr2d(m)\%p(isl:iel,jsl:jel), turns=-\/turns)}
\DoxyCodeLine{1018       \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr4d(m)\%p)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1019         check\_val(m-\/start\_var+1,1) = \&}
\DoxyCodeLine{1020             mpp\_chksum(cs\%var\_ptr4d(m)\%p(isl:iel,jsl:jel,:,:), turns=-\/turns)}
\DoxyCodeLine{1021       \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr1d(m)\%p)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1022         check\_val(m-\/start\_var+1,1) = mpp\_chksum(cs\%var\_ptr1d(m)\%p)}
\DoxyCodeLine{1023       \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr0d(m)\%p)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1024         check\_val(m-\/start\_var+1,1) = mpp\_chksum(cs\%var\_ptr0d(m)\%p,pelist=(/mpp\_pe()/))}
\DoxyCodeLine{1025 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1026 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{1027 }
\DoxyCodeLine{1028     \textcolor{keywordflow}{if} (cs\%parallel\_restartfiles) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1029       \textcolor{keyword}{call }create\_file(unit, trim(restartpath), vars, (next\_var-\/start\_var), \&}
\DoxyCodeLine{1030                        fields, multiple, g=g, gv=gv, checksums=check\_val)}
\DoxyCodeLine{1031     \textcolor{keywordflow}{else}}
\DoxyCodeLine{1032       \textcolor{keyword}{call }create\_file(unit, trim(restartpath), vars, (next\_var-\/start\_var), \&}
\DoxyCodeLine{1033                        fields, single\_file, g=g, gv=gv, checksums=check\_val)}
\DoxyCodeLine{1034 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1035 }
\DoxyCodeLine{1036     \textcolor{keywordflow}{do} m=start\_var,next\_var-\/1}
\DoxyCodeLine{1037       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%var\_ptr3d(m)\%p)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1038         \textcolor{keyword}{call }write\_field(unit,fields(m-\/start\_var+1), g\%Domain\%mpp\_domain, \&}
\DoxyCodeLine{1039                          cs\%var\_ptr3d(m)\%p, restart\_time, turns=-\/turns)}
\DoxyCodeLine{1040       \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr2d(m)\%p)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1041         \textcolor{keyword}{call }write\_field(unit,fields(m-\/start\_var+1), g\%Domain\%mpp\_domain, \&}
\DoxyCodeLine{1042                          cs\%var\_ptr2d(m)\%p, restart\_time, turns=-\/turns)}
\DoxyCodeLine{1043       \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr4d(m)\%p)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1044         \textcolor{keyword}{call }write\_field(unit,fields(m-\/start\_var+1), g\%Domain\%mpp\_domain, \&}
\DoxyCodeLine{1045                          cs\%var\_ptr4d(m)\%p, restart\_time, turns=-\/turns)}
\DoxyCodeLine{1046       \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr1d(m)\%p)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1047         \textcolor{keyword}{call }write\_field(unit, fields(m-\/start\_var+1), cs\%var\_ptr1d(m)\%p, \&}
\DoxyCodeLine{1048                          restart\_time)}
\DoxyCodeLine{1049       \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(cs\%var\_ptr0d(m)\%p)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1050         \textcolor{keyword}{call }write\_field(unit, fields(m-\/start\_var+1), cs\%var\_ptr0d(m)\%p, \&}
\DoxyCodeLine{1051                          restart\_time)}
\DoxyCodeLine{1052 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1053 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{1054 }
\DoxyCodeLine{1055     \textcolor{keyword}{call }close\_file(unit)}
\DoxyCodeLine{1056 }
\DoxyCodeLine{1057     num\_files = num\_files+1}
\DoxyCodeLine{1058 }
\DoxyCodeLine{1059 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{1060 }
\DoxyCodeLine{1061   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(num\_rest\_files)) num\_rest\_files = num\_files}
\DoxyCodeLine{1062 }

\end{DoxyCode}
