\hypertarget{namespacemom__get__input}{}\doxysection{mom\+\_\+get\+\_\+input Module Reference}
\label{namespacemom__get__input}\index{mom\_get\_input@{mom\_get\_input}}


\doxysubsection{Detailed Description}
Reads the only Fortran name list needed to boot-\/strap the model. 

The name list parameters indicate which directories to use for certain types of input and output, and which files to look in for the full parsable input parameter file(s). \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structmom__get__input_1_1directories}{directories}}
\begin{DoxyCompactList}\small\item\em Container for paths and parameter file names. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__get__input_a46e89b56d1317f17ccb44b3fa7694731}{get\+\_\+mom\+\_\+input}} (param\+\_\+file, dirs, check\+\_\+params, default\+\_\+input\+\_\+filename, ensemble\+\_\+num)
\begin{DoxyCompactList}\small\item\em Get the names of the I/O directories and initialization file. Also calls the subroutine that opens run-\/time parameter files. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__get__input_a46e89b56d1317f17ccb44b3fa7694731}\label{namespacemom__get__input_a46e89b56d1317f17ccb44b3fa7694731}} 
\index{mom\_get\_input@{mom\_get\_input}!get\_mom\_input@{get\_mom\_input}}
\index{get\_mom\_input@{get\_mom\_input}!mom\_get\_input@{mom\_get\_input}}
\doxysubsubsection{\texorpdfstring{get\_mom\_input()}{get\_mom\_input()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+get\+\_\+input\+::get\+\_\+mom\+\_\+input (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__file__parser_1_1param__file__type}{param\+\_\+file\+\_\+type}}), intent(out), optional}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__get__input_1_1directories}{directories}}), intent(out), optional}]{dirs,  }\item[{logical, intent(in), optional}]{check\+\_\+params,  }\item[{character(len=$\ast$), intent(in), optional}]{default\+\_\+input\+\_\+filename,  }\item[{integer, intent(in), optional}]{ensemble\+\_\+num }\end{DoxyParamCaption})}



Get the names of the I/O directories and initialization file. Also calls the subroutine that opens run-\/time parameter files. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters. \\
\hline
\mbox{\texttt{ out}}  & {\em dirs} & Container for paths and parameter file names. \\
\hline
\mbox{\texttt{ in}}  & {\em check\+\_\+params} & If present and False will stop error checking for run-\/time parameters. \\
\hline
\mbox{\texttt{ in}}  & {\em default\+\_\+input\+\_\+filename} & If present, is the value assumed for input\+\_\+filename if input\+\_\+filename is not listed in the namelist M\+O\+M\+\_\+input\+\_\+nml. \\
\hline
\mbox{\texttt{ in}}  & {\em ensemble\+\_\+num} & The ensemble id of the current member \\
\hline
\end{DoxyParams}


Definition at line 34 of file M\+O\+M\+\_\+get\+\_\+input.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{35   \textcolor{keywordtype}{type}(param\_file\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: param\_file\textcolor{comment}{   !< A structure to parse for run-\/time parameters.}}
\DoxyCodeLine{36   \textcolor{keywordtype}{type}(directories),     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: dirs\textcolor{comment}{         !< Container for paths and parameter file names.}}
\DoxyCodeLine{37   \textcolor{keywordtype}{logical},               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: check\_params\textcolor{comment}{ !< If present and False will stop error checking for}}
\DoxyCodeLine{38 \textcolor{comment}{                                                               !! run-\/time parameters.}}
\DoxyCodeLine{39   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: default\_input\_filename\textcolor{comment}{ !< If present, is the value assumed for}}
\DoxyCodeLine{40 \textcolor{comment}{                                                               !! input\_filename if input\_filename is not listed}}
\DoxyCodeLine{41 \textcolor{comment}{                                                               !! in the namelist MOM\_input\_nml.}}
\DoxyCodeLine{42   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: ensemble\_num\textcolor{comment}{ !< The ensemble id of the current member}}
\DoxyCodeLine{43   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{44   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{parameter} :: npf = 5 \textcolor{comment}{! Maximum number of parameter files}}
\DoxyCodeLine{45 }
\DoxyCodeLine{46   \textcolor{keywordtype}{character(len=240)} :: \&}
\DoxyCodeLine{47     parameter\_filename(npf), \& \textcolor{comment}{! List of files containing parameters.}}
\DoxyCodeLine{48     output\_directory,        \& \textcolor{comment}{! Directory to use to write the model output.}}
\DoxyCodeLine{49     restart\_input\_dir,       \& \textcolor{comment}{! Directory for reading restart and input files.}}
\DoxyCodeLine{50     restart\_output\_dir         \textcolor{comment}{! Directory into which to write restart files.}}
\DoxyCodeLine{51   \textcolor{keywordtype}{character(len=2048)} :: \&}
\DoxyCodeLine{52     input\_filename             \textcolor{comment}{! A string that indicates the input files or how}}
\DoxyCodeLine{53                                \textcolor{comment}{! the run segment should be started.}}
\DoxyCodeLine{54   \textcolor{keywordtype}{character(len=240)} :: output\_dir}
\DoxyCodeLine{55   \textcolor{keywordtype}{integer} :: unit, io, ierr, valid\_param\_files}
\DoxyCodeLine{56 }
\DoxyCodeLine{57   namelist /mom\_input\_nml/ output\_directory, input\_filename, parameter\_filename, \&}
\DoxyCodeLine{58                            restart\_input\_dir, restart\_output\_dir}
\DoxyCodeLine{59 }
\DoxyCodeLine{60   \textcolor{comment}{! Default values in case parameter is not set in file input.nml}}
\DoxyCodeLine{61   parameter\_filename(:) = \textcolor{stringliteral}{' '}}
\DoxyCodeLine{62   output\_directory = \textcolor{stringliteral}{' '}}
\DoxyCodeLine{63   restart\_input\_dir = \textcolor{stringliteral}{' '}}
\DoxyCodeLine{64   restart\_output\_dir = \textcolor{stringliteral}{' '}}
\DoxyCodeLine{65   input\_filename  = \textcolor{stringliteral}{' '}}
\DoxyCodeLine{66   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(default\_input\_filename)) input\_filename = trim(default\_input\_filename)}
\DoxyCodeLine{67 }
\DoxyCodeLine{68   \textcolor{comment}{! Open namelist}}
\DoxyCodeLine{69   \textcolor{keywordflow}{if} (file\_exists(\textcolor{stringliteral}{'input.nml'})) \textcolor{keywordflow}{then}}
\DoxyCodeLine{70     unit = open\_namelist\_file(file=\textcolor{stringliteral}{'input.nml'})}
\DoxyCodeLine{71   \textcolor{keywordflow}{else}}
\DoxyCodeLine{72     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{'Required namelist file input.nml does not exist.'})}
\DoxyCodeLine{73 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{74 }
\DoxyCodeLine{75   \textcolor{comment}{! Read namelist parameters}}
\DoxyCodeLine{76   ierr=1 ; \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (ierr /= 0)}
\DoxyCodeLine{77     \textcolor{keyword}{read}(unit, nml=mom\_input\_nml, iostat=io, \textcolor{keyword}{end}=10)}
\DoxyCodeLine{78     ierr = check\_nml\_error(io, \textcolor{stringliteral}{'MOM\_input\_nml'})}
\DoxyCodeLine{79 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{80 10 \textcolor{keyword}{call }close\_file(unit)}
\DoxyCodeLine{81 }
\DoxyCodeLine{82   \textcolor{comment}{! Store parameters in container}}
\DoxyCodeLine{83   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dirs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{84     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(ensemble\_num)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{85       dirs\%output\_directory = slasher(ensembler(output\_directory,ensemble\_num))}
\DoxyCodeLine{86       dirs\%restart\_output\_dir = slasher(ensembler(restart\_output\_dir,ensemble\_num))}
\DoxyCodeLine{87       dirs\%restart\_input\_dir = slasher(ensembler(restart\_input\_dir,ensemble\_num))}
\DoxyCodeLine{88       dirs\%input\_filename = ensembler(input\_filename,ensemble\_num)}
\DoxyCodeLine{89     \textcolor{keywordflow}{else}}
\DoxyCodeLine{90       dirs\%output\_directory = slasher(ensembler(output\_directory))}
\DoxyCodeLine{91       dirs\%restart\_output\_dir = slasher(ensembler(restart\_output\_dir))}
\DoxyCodeLine{92       dirs\%restart\_input\_dir = slasher(ensembler(restart\_input\_dir))}
\DoxyCodeLine{93       dirs\%input\_filename = ensembler(input\_filename)}
\DoxyCodeLine{94 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{95 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{96 }
\DoxyCodeLine{97   \textcolor{comment}{! Open run-\/time parameter file(s)}}
\DoxyCodeLine{98   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(param\_file)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{99     output\_dir = slasher(ensembler(output\_directory))}
\DoxyCodeLine{100     valid\_param\_files = 0}
\DoxyCodeLine{101     \textcolor{keywordflow}{do} io = 1, npf}
\DoxyCodeLine{102       \textcolor{keywordflow}{if} (len\_trim(trim(parameter\_filename(io))) > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{103         \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(ensemble\_num)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{104           \textcolor{keyword}{call }open\_param\_file(ensembler(parameter\_filename(io),ensemble\_num), param\_file, \&}
\DoxyCodeLine{105                check\_params, doc\_file\_dir=output\_dir)}
\DoxyCodeLine{106         \textcolor{keywordflow}{else}}
\DoxyCodeLine{107           \textcolor{keyword}{call }open\_param\_file(ensembler(parameter\_filename(io)), param\_file, \&}
\DoxyCodeLine{108                check\_params, doc\_file\_dir=output\_dir)}
\DoxyCodeLine{109 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{110         valid\_param\_files = valid\_param\_files + 1}
\DoxyCodeLine{111 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{112 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{113     \textcolor{keywordflow}{if} (valid\_param\_files == 0) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"{}There must be at "{}}//\&}
\DoxyCodeLine{114          \textcolor{stringliteral}{"{}least 1 valid entry in input\_filename in MOM\_input\_nml in input.nml."{}})}
\DoxyCodeLine{115 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{116 }

\end{DoxyCode}
