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


\subsection{Detailed Description}
The M\+O\+M6 facility for reading and writing restart files, and querying what has been read. \subsection*{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}
\subsection*{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}


\subsection{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}}
\subsubsection{\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{\tt in}  & {\em filename} & The list of restart file names or a single character \textquotesingle{}r\textquotesingle{} to read automatically named files.\\
\hline
\mbox{\tt in}  & {\em directory} & The directory in which to find restart files\\
\hline
\mbox{\tt 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 1320 of file M\+O\+M\+\_\+restart.\+F90.


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


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


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


\begin{DoxyCode}
1351   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{ !< The control structure returned by a previous}
1352 \textcolor{comment}{                                       !! call to restart\_init.}
1353   \textcolor{keywordtype}{logical} :: is\_new\_run\textcolor{comment}{                !< The function result, which indicates whether}
1354 \textcolor{comment}{                                       !! this is a new run, based on the value of}
1355 \textcolor{comment}{                                       !! filename and whether restart files exist.}
1356 
1357   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // &
1358       \textcolor{stringliteral}{"is\_new\_run: Module must be initialized before it is used."})
1359   \textcolor{keywordflow}{if} (.not.cs%new\_run\_set) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart "} // &
1360       \textcolor{stringliteral}{"determine\_is\_new\_run must be called for a restart file before is\_new\_run."})
1361 
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}}
\subsubsection{\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{\tt in}  & {\em filename} & The list of restart file names or a single character \textquotesingle{}r\textquotesingle{} to read automatically named files.\\
\hline
\mbox{\tt in}  & {\em directory} & The directory in which to find restart files\\
\hline
\mbox{\tt 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{\tt out}  & {\em units} & The mpp units of all opened files.\\
\hline
\mbox{\tt out}  & {\em file\+\_\+paths} & The full paths to open files.\\
\hline
\mbox{\tt 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 1369 of file M\+O\+M\+\_\+restart.\+F90.


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


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


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


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


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


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


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


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


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


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


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


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


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


\begin{DoxyCode}
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}
479   \textcolor{keywordtype}{character(len=*)},           \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{      !< variable name to be used in the restart file}
480   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}
481 \textcolor{comment}{                                                      !! successfully read from the restart file.}
482   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent
       in/out)}
483   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: longname\textcolor{comment}{  !< variable long name}
484   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{     !< variable units}
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}
486 
487   \textcolor{keywordtype}{type}(vardesc) :: vd
488   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart: "} // &
489       \textcolor{stringliteral}{"register\_restart\_field\_0d: Module must be initialized before "}//&
490       \textcolor{stringliteral}{"it is used to register "}//trim(name))
491   vd = var\_desc(name, units=units, longname=longname, hor\_grid=\textcolor{stringliteral}{'1'}, &
492                 z\_grid=\textcolor{stringliteral}{'1'}, t\_grid=t\_grid)
493 
494   \textcolor{keyword}{call }register\_restart\_field\_ptr0d(f\_ptr, vd, mandatory, cs)
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}}
\subsubsection{\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{\tt in}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written\\
\hline
\mbox{\tt in}  & {\em name} & variable name to be used in the restart file\\
\hline
\mbox{\tt 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{\tt in}  & {\em longname} & variable long name\\
\hline
\mbox{\tt in}  & {\em units} & variable units\\
\hline
\mbox{\tt in}  & {\em hor\+\_\+grid} & variable horizonal staggering, \textquotesingle{}1\textquotesingle{} if absent\\
\hline
\mbox{\tt in}  & {\em z\+\_\+grid} & variable vertical staggering, \textquotesingle{}L\textquotesingle{} if absent\\
\hline
\mbox{\tt in}  & {\em t\+\_\+grid} & time description\+: s, p, or 1, \textquotesingle{}s\textquotesingle{} if absent \\
\hline
\end{DoxyParams}


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


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


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


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


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


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


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


\begin{DoxyCode}
367   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, &
368                       \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: f\_ptr\textcolor{comment}{     !< A pointer to the field to be read or written}
369   \textcolor{keywordtype}{character(len=*)},           \textcolor{keywordtype}{intent(in)} :: name\textcolor{comment}{      !< variable name to be used in the restart file}
370   \textcolor{keywordtype}{logical},                    \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{ !< If true, the run will abort if this field is not}
371 \textcolor{comment}{                                                      !! successfully read from the restart file.}
372   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{        !< A pointer to a MOM\_restart\_CS object (intent
       in/out)}
373   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: longname\textcolor{comment}{  !< variable long name}
374   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{     !< variable units}
375   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: hor\_grid\textcolor{comment}{  !< variable horizonal staggering, 'h' if absent}
376   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: z\_grid\textcolor{comment}{    !< variable vertical staggering, 'L' if absent}
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}
378 
379   \textcolor{keywordtype}{type}(vardesc) :: vd
380 
381   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_restart: "} // &
382       \textcolor{stringliteral}{"register\_restart\_field\_4d: Module must be initialized before "}//&
383       \textcolor{stringliteral}{"it is used to register "}//trim(name))
384   vd = var\_desc(name, units=units, longname=longname, hor\_grid=hor\_grid, &
385                 z\_grid=z\_grid, t\_grid=t\_grid)
386 
387   \textcolor{keyword}{call }register\_restart\_field\_ptr4d(f\_ptr, vd, mandatory, cs)
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}}
\subsubsection{\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{\tt in}  & {\em field\+\_\+name} & Name of restart field that is no longer in use\\
\hline
\mbox{\tt 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 139 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}
139   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)} :: field\_name\textcolor{comment}{       !< Name of restart field that is no longer in use}
140   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)} :: replacement\_name\textcolor{comment}{ !< Name of replacement restart field, if applicable}
141   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{          !< A pointer to a MOM\_restart\_CS object (intent in/out)}
142 
143   cs%num\_obsolete\_vars = cs%num\_obsolete\_vars+1
144   cs%restart\_obsolete(cs%num\_obsolete\_vars)%field\_name = field\_name
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}}
\subsubsection{\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{\tt in}  & {\em f\+\_\+ptr} & A pointer to the field to be read or written\\
\hline
\mbox{\tt in}  & {\em var\+\_\+desc} & A structure with metadata about this variable\\
\hline
\mbox{\tt 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 273 of file M\+O\+M\+\_\+restart.\+F90.


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


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


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


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


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


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


\begin{DoxyCode}
305   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: a\_ptr\textcolor{comment}{   !< First field pointer}
306   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: b\_ptr\textcolor{comment}{   !< Second field pointer}
307   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: a\_desc\textcolor{comment}{   !< First field descriptor}
308   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: b\_desc\textcolor{comment}{   !< Second field descriptor}
309   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{      !< If true, abort if field is missing}
310   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{   !< MOM restart control structure}
311 
312   \textcolor{keywordflow}{if} (modulo(cs%turns, 2) /= 0) \textcolor{keywordflow}{then}
313     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, a\_desc, mandatory, cs)
314     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, b\_desc, mandatory, cs)
315   \textcolor{keywordflow}{else}
316     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, a\_desc, mandatory, cs)
317     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, b\_desc, mandatory, cs)
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}}
\subsubsection{\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{\tt in}  & {\em a\+\_\+ptr} & First field pointer\\
\hline
\mbox{\tt in}  & {\em b\+\_\+ptr} & Second field pointer\\
\hline
\mbox{\tt in}  & {\em a\+\_\+desc} & First field descriptor\\
\hline
\mbox{\tt in}  & {\em b\+\_\+desc} & Second field descriptor\\
\hline
\mbox{\tt in}  & {\em mandatory} & If true, abort if field is missing\\
\hline
 & {\em cs} & M\+OM restart control structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}
325   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: a\_ptr\textcolor{comment}{   !< First field pointer}
326   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: b\_ptr\textcolor{comment}{   !< Second field pointer}
327   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: a\_desc\textcolor{comment}{   !< First field descriptor}
328   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: b\_desc\textcolor{comment}{   !< Second field descriptor}
329   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{      !< If true, abort if field is missing}
330   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{   !< MOM restart control structure}
331 
332   \textcolor{keywordflow}{if} (modulo(cs%turns, 2) /= 0) \textcolor{keywordflow}{then}
333     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, a\_desc, mandatory, cs)
334     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, b\_desc, mandatory, cs)
335   \textcolor{keywordflow}{else}
336     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, a\_desc, mandatory, cs)
337     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, b\_desc, mandatory, cs)
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}}
\subsubsection{\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{\tt in}  & {\em a\+\_\+ptr} & First field pointer\\
\hline
\mbox{\tt in}  & {\em b\+\_\+ptr} & Second field pointer\\
\hline
\mbox{\tt in}  & {\em a\+\_\+desc} & First field descriptor\\
\hline
\mbox{\tt in}  & {\em b\+\_\+desc} & Second field descriptor\\
\hline
\mbox{\tt in}  & {\em mandatory} & If true, abort if field is missing\\
\hline
 & {\em cs} & M\+OM restart control structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}
345   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: a\_ptr\textcolor{comment}{ !< First field pointer}
346   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: b\_ptr\textcolor{comment}{ !< Second field pointer}
347   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: a\_desc\textcolor{comment}{   !< First field descriptor}
348   \textcolor{keywordtype}{type}(vardesc), \textcolor{keywordtype}{intent(in)} :: b\_desc\textcolor{comment}{   !< Second field descriptor}
349   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)} :: mandatory\textcolor{comment}{      !< If true, abort if field is missing}
350   \textcolor{keywordtype}{type}(MOM\_restart\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{   !< MOM restart control structure}
351 
352   \textcolor{keywordflow}{if} (modulo(cs%turns, 2) /= 0) \textcolor{keywordflow}{then}
353     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, a\_desc, mandatory, cs)
354     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, b\_desc, mandatory, cs)
355   \textcolor{keywordflow}{else}
356     \textcolor{keyword}{call }register\_restart\_field(a\_ptr, a\_desc, mandatory, cs)
357     \textcolor{keyword}{call }register\_restart\_field(b\_ptr, b\_desc, mandatory, cs)
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}}
\subsubsection{\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 1602 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}
1602   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object}
1603 
1604   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs%restart\_field)) \textcolor{keyword}{deallocate}(cs%restart\_field)
1605   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs%restart\_obsolete)) \textcolor{keyword}{deallocate}(cs%restart\_obsolete)
1606   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs%var\_ptr0d)) \textcolor{keyword}{deallocate}(cs%var\_ptr0d)
1607   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs%var\_ptr1d)) \textcolor{keyword}{deallocate}(cs%var\_ptr1d)
1608   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs%var\_ptr2d)) \textcolor{keyword}{deallocate}(cs%var\_ptr2d)
1609   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs%var\_ptr3d)) \textcolor{keyword}{deallocate}(cs%var\_ptr3d)
1610   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs%var\_ptr4d)) \textcolor{keyword}{deallocate}(cs%var\_ptr4d)
1611   \textcolor{keyword}{deallocate}(cs)
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}}
\subsubsection{\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 1616 of file M\+O\+M\+\_\+restart.\+F90.


\begin{DoxyCode}
1616   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object}
1617 
1618   \textcolor{keywordtype}{character(len=16)}  :: num  \textcolor{comment}{! String for error messages}
1619 
1620   \textcolor{keywordflow}{if} (cs%novars > cs%max\_fields) \textcolor{keywordflow}{then}
1621     \textcolor{keyword}{write}(num,\textcolor{stringliteral}{'(I0)'}) cs%novars
1622     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"MOM\_restart: Too many fields registered for "} // &
1623            \textcolor{stringliteral}{"restart.  Set MAX\_FIELDS to be at least "} // &
1624            trim(adjustl(num)) // \textcolor{stringliteral}{" in the MOM input file."})
1625   \textcolor{keywordflow}{else}
1626     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"MOM\_restart: Unspecified fatal error."})
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}}
\subsubsection{\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{\tt in}  & {\em filename} & The list of restart file names or a single character \textquotesingle{}r\textquotesingle{} to read automatically named files.\\
\hline
\mbox{\tt in}  & {\em directory} & The directory in which to find restart files\\
\hline
\mbox{\tt 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 1293 of file M\+O\+M\+\_\+restart.\+F90.


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


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


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


\begin{DoxyCode}
1592   \textcolor{keywordtype}{type}(MOM\_restart\_CS),  \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to a MOM\_restart\_CS object}
1593 
1594   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
1595     \textcolor{keywordflow}{if} (cs%novars == 0) \textcolor{keyword}{call }restart\_end(cs)
1596 \textcolor{keywordflow}{  endif}
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}}
\subsubsection{\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{\tt in}  & {\em filename} & The list of restart file names or a single character \textquotesingle{}r\textquotesingle{} to read automatically named files.\\
\hline
\mbox{\tt in}  & {\em directory} & The directory in which to find restart files\\
\hline
\mbox{\tt out}  & {\em day} & The time of the restarted run\\
\hline
\mbox{\tt 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 1069 of file M\+O\+M\+\_\+restart.\+F90.


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


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


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