\hypertarget{namespacemom__shared__initialization}{}\doxysection{mom\+\_\+shared\+\_\+initialization Module Reference}
\label{namespacemom__shared__initialization}\index{mom\_shared\_initialization@{mom\_shared\_initialization}}


\doxysubsection{Detailed Description}
Code that initializes fixed aspects of the model grid, such as horizontal grid metrics, topography and Coriolis, and can be shared between components. \doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a9e9d95233423f98871c9e1864563f10d}{mom\+\_\+shared\+\_\+init\+\_\+init}} (PF)
\begin{DoxyCompactList}\small\item\em M\+O\+M\+\_\+shared\+\_\+init\+\_\+init just writes the code version. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a1e501ab8351b666491169c804418e9df}{mom\+\_\+initialize\+\_\+rotation}} (f, G, PF, US)
\begin{DoxyCompactList}\small\item\em M\+O\+M\+\_\+initialize\+\_\+rotation makes the appropriate call to set up the Coriolis parameter. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a4ec3c9951969b11a90acf193a423d893}{mom\+\_\+calculate\+\_\+grad\+\_\+coriolis}} (d\+F\+\_\+dx, d\+F\+\_\+dy, G, US)
\begin{DoxyCompactList}\small\item\em Calculates the components of grad f (Coriolis parameter) \end{DoxyCompactList}\item 
real function, public \mbox{\hyperlink{namespacemom__shared__initialization_aab0fe8b21fe93b75e1bec9c652deb2a0}{diagnosemaximumdepth}} (D, G)
\begin{DoxyCompactList}\small\item\em Return the global maximum ocean bottom depth in the same units as the input depth. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a3b944f383cd2586189347532539656ef}{initialize\+\_\+topography\+\_\+from\+\_\+file}} (D, G, param\+\_\+file, US)
\begin{DoxyCompactList}\small\item\em Read gridded depths from file. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a053b97ada59fb2f5893a0bbe592eaac3}{apply\+\_\+topography\+\_\+edits\+\_\+from\+\_\+file}} (D, G, param\+\_\+file, US)
\begin{DoxyCompactList}\small\item\em Applies a list of topography overrides read from a netcdf file. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a852dd7dc66a31abe47dc83b769fb4ae4}{initialize\+\_\+topography\+\_\+named}} (D, G, param\+\_\+file, topog\+\_\+config, max\+\_\+depth, US)
\begin{DoxyCompactList}\small\item\em initialize the bathymetry based on one of several named idealized configurations \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_ae2e3b3c739630c8746c533102b8c5d76}{limit\+\_\+topography}} (D, G, param\+\_\+file, max\+\_\+depth, US)
\begin{DoxyCompactList}\small\item\em limit\+\_\+topography ensures that min\+\_\+depth $<$ D(x,y) $<$ max\+\_\+depth \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a6aa6b883534fee4616137b7174414b8e}{set\+\_\+rotation\+\_\+planetary}} (f, G, param\+\_\+file, US)
\begin{DoxyCompactList}\small\item\em This subroutine sets up the Coriolis parameter for a sphere. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a330014f05a823d5434ad0156d361b6ff}{set\+\_\+rotation\+\_\+beta\+\_\+plane}} (f, G, param\+\_\+file, US)
\begin{DoxyCompactList}\small\item\em This subroutine sets up the Coriolis parameter for a beta-\/plane or f-\/plane. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_acf73ad1980ac8b8253fa085a1d8afc17}{initialize\+\_\+grid\+\_\+rotation\+\_\+angle}} (G, PF)
\begin{DoxyCompactList}\small\item\em initialize\+\_\+grid\+\_\+rotation\+\_\+angle initializes the arrays with the sine and cosine of the angle between logical north on the grid and true north. \end{DoxyCompactList}\item 
real function \mbox{\hyperlink{namespacemom__shared__initialization_ac024655ad7fa6e243ceb90e9daa14388}{modulo\+\_\+around\+\_\+point}} (x, xc, Lx)
\begin{DoxyCompactList}\small\item\em Return the modulo value of x in an interval \mbox{[}xc-\/(Lx/2) xc+(Lx/2)\mbox{]} If Lx$<$=0, then it returns x without applying modulo arithmetic. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_af506ce66cc9fdd478b4e2bd44e594f18}{reset\+\_\+face\+\_\+lengths\+\_\+named}} (G, param\+\_\+file, name, US)
\begin{DoxyCompactList}\small\item\em This subroutine sets the open face lengths at selected points to restrict passages to their observed widths based on a named set of sizes. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a27bab8da74b45855db4466ce4942456f}{reset\+\_\+face\+\_\+lengths\+\_\+file}} (G, param\+\_\+file, US)
\begin{DoxyCompactList}\small\item\em This subroutine sets the open face lengths at selected points to restrict passages to their observed widths from a arrays read from a file. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_aea0f76e5a7193df606ba3f09703ca30a}{reset\+\_\+face\+\_\+lengths\+\_\+list}} (G, param\+\_\+file, US)
\begin{DoxyCompactList}\small\item\em This subroutine sets the open face lengths at selected points to restrict passages to their observed widths from a list read from a file. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a49c0443c10514a0d5ce5d8df4d68bce8}{read\+\_\+face\+\_\+length\+\_\+list}} (iounit, filename, num\+\_\+lines, lines)
\begin{DoxyCompactList}\small\item\em This subroutine reads and counts the non-\/blank lines in the face length list file, after removing comments. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_ab4e226886998bcc8a43011bd8ed4dd29}{set\+\_\+velocity\+\_\+depth\+\_\+max}} (G)
\begin{DoxyCompactList}\small\item\em Set the bathymetry at velocity points to be the maximum of the depths at the neighoring tracer points. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a4db4d57d710d61a5e910b437f9ab1455}{set\+\_\+velocity\+\_\+depth\+\_\+min}} (G)
\begin{DoxyCompactList}\small\item\em Set the bathymetry at velocity points to be the minimum of the depths at the neighoring tracer points. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a25f3025f93e75f70fa21f444014345be}{compute\+\_\+global\+\_\+grid\+\_\+integrals}} (G, US)
\begin{DoxyCompactList}\small\item\em Pre-\/compute global integrals of grid quantities (like masked ocean area) for later use in reporting diagnostics. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__shared__initialization_a4375db47a43535f8f2eecd5992a788ea}{write\+\_\+ocean\+\_\+geometry\+\_\+file}} (G, param\+\_\+file, directory, geom\+\_\+file, US)
\begin{DoxyCompactList}\small\item\em Write out a file describing the topography, Coriolis parameter, grid locations and various other fixed fields from the grid. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__shared__initialization_a053b97ada59fb2f5893a0bbe592eaac3}\label{namespacemom__shared__initialization_a053b97ada59fb2f5893a0bbe592eaac3}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!apply\_topography\_edits\_from\_file@{apply\_topography\_edits\_from\_file}}
\index{apply\_topography\_edits\_from\_file@{apply\_topography\_edits\_from\_file}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{apply\_topography\_edits\_from\_file()}{apply\_topography\_edits\_from\_file()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::apply\+\_\+topography\+\_\+edits\+\_\+from\+\_\+file (\begin{DoxyParamCaption}\item[{real, dimension(g\%isd\+:g\%ied,g\%jsd\+:g\%jed), intent(inout)}]{D,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(in)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



Applies a list of topography overrides read from a netcdf file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The dynamic horizontal grid type \\
\hline
\mbox{\texttt{ in,out}}  & {\em d} & Ocean bottom depth in m or Z if US is present \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 186 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{186   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),           \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{ !< The dynamic horizontal grid type}}
\DoxyCodeLine{187 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd:G\%ied,G\%jsd:G\%jed)}, \&}
\DoxyCodeLine{188                                     \textcolor{keywordtype}{intent(inout)} :: D\textcolor{comment}{ !< Ocean bottom depth in m or Z if US is present}}
\DoxyCodeLine{189   \textcolor{keywordtype}{type}(param\_file\_type),            \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{190   \textcolor{keywordtype}{type}(unit\_scale\_type),  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{191 }
\DoxyCodeLine{192   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{193 \textcolor{keywordtype}{  real} :: m\_to\_Z  \textcolor{comment}{! A dimensional rescaling factor.}}
\DoxyCodeLine{194   \textcolor{keywordtype}{character(len=200)} :: topo\_edits\_file, inputdir \textcolor{comment}{! Strings for file/path}}
\DoxyCodeLine{195   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"apply\_topography\_edits\_from\_file"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{196   \textcolor{keywordtype}{integer} :: n\_edits, n, ashape(5), i, j, ncid, id, ncstatus, iid, jid, zid}
\DoxyCodeLine{197   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{allocatable} :: ig, jg}
\DoxyCodeLine{198 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{allocatable} :: new\_depth}
\DoxyCodeLine{199 }
\DoxyCodeLine{200   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_shared\_initialization.F90"})}
\DoxyCodeLine{201 }
\DoxyCodeLine{202   m\_to\_z = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) m\_to\_z = us\%m\_to\_Z}
\DoxyCodeLine{203 }
\DoxyCodeLine{204   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR"}, inputdir, default=\textcolor{stringliteral}{"."})}
\DoxyCodeLine{205   inputdir = slasher(inputdir)}
\DoxyCodeLine{206   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TOPO\_EDITS\_FILE"}, topo\_edits\_file, \&}
\DoxyCodeLine{207                  \textcolor{stringliteral}{"The file from which to read a list of i,j,z topography overrides."}, \&}
\DoxyCodeLine{208                  default=\textcolor{stringliteral}{""})}
\DoxyCodeLine{209 }
\DoxyCodeLine{210   \textcolor{keywordflow}{if} (len\_trim(topo\_edits\_file)==0) \textcolor{keywordflow}{return}}
\DoxyCodeLine{211 }
\DoxyCodeLine{212   topo\_edits\_file = trim(inputdir)//trim(topo\_edits\_file)}
\DoxyCodeLine{213   \textcolor{keywordflow}{if} (.not.file\_exists(topo\_edits\_file, g\%Domain)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{214      \textcolor{stringliteral}{'initialize\_topography\_from\_file: Unable to open '}//trim(topo\_edits\_file))}
\DoxyCodeLine{215 }
\DoxyCodeLine{216   ncstatus = nf90\_open(trim(topo\_edits\_file), nf90\_nowrite, ncid)}
\DoxyCodeLine{217   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{218                                 \textcolor{stringliteral}{'Failed to open '}//trim(topo\_edits\_file))}
\DoxyCodeLine{219 }
\DoxyCodeLine{220   \textcolor{comment}{! Get nEdits}}
\DoxyCodeLine{221   ncstatus = nf90\_inq\_dimid(ncid, \textcolor{stringliteral}{'nEdits'}, id)}
\DoxyCodeLine{222   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{223                                 \textcolor{stringliteral}{'Failed to inq\_dimid nEdits for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{224   ncstatus = nf90\_inquire\_dimension(ncid, id, len=n\_edits)}
\DoxyCodeLine{225   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{226                                 \textcolor{stringliteral}{'Failed to inquire\_dimension nEdits for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{227 }
\DoxyCodeLine{228   \textcolor{comment}{! Read ni}}
\DoxyCodeLine{229   ncstatus = nf90\_inq\_varid(ncid, \textcolor{stringliteral}{'ni'}, id)}
\DoxyCodeLine{230   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{231                                 \textcolor{stringliteral}{'Failed to inq\_varid ni for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{232   ncstatus = nf90\_get\_var(ncid, id, i)}
\DoxyCodeLine{233   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{234                               \textcolor{stringliteral}{'Failed to get\_var ni for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{235   \textcolor{keywordflow}{if} (i /= g\%ieg) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{236                               \textcolor{stringliteral}{'Incompatible i-\/dimension of grid in '}//trim(topo\_edits\_file))}
\DoxyCodeLine{237 }
\DoxyCodeLine{238   \textcolor{comment}{! Read nj}}
\DoxyCodeLine{239   ncstatus = nf90\_inq\_varid(ncid, \textcolor{stringliteral}{'nj'}, id)}
\DoxyCodeLine{240   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{241                                 \textcolor{stringliteral}{'Failed to inq\_varid nj for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{242   ncstatus = nf90\_get\_var(ncid, id, j)}
\DoxyCodeLine{243   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{244                               \textcolor{stringliteral}{'Failed to get\_var nj for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{245   \textcolor{keywordflow}{if} (j /= g\%jeg) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{246                               \textcolor{stringliteral}{'Incompatible j-\/dimension of grid in '}//trim(topo\_edits\_file))}
\DoxyCodeLine{247 }
\DoxyCodeLine{248   \textcolor{comment}{! Read iEdit}}
\DoxyCodeLine{249   ncstatus = nf90\_inq\_varid(ncid, \textcolor{stringliteral}{'iEdit'}, id)}
\DoxyCodeLine{250   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{251                                 \textcolor{stringliteral}{'Failed to inq\_varid iEdit for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{252   \textcolor{keyword}{allocate}(ig(n\_edits))}
\DoxyCodeLine{253   ncstatus = nf90\_get\_var(ncid, id, ig)}
\DoxyCodeLine{254   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{255                               \textcolor{stringliteral}{'Failed to get\_var iEdit for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{256 }
\DoxyCodeLine{257   \textcolor{comment}{! Read jEdit}}
\DoxyCodeLine{258   ncstatus = nf90\_inq\_varid(ncid, \textcolor{stringliteral}{'jEdit'}, id)}
\DoxyCodeLine{259   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{260                                 \textcolor{stringliteral}{'Failed to inq\_varid jEdit for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{261   \textcolor{keyword}{allocate}(jg(n\_edits))}
\DoxyCodeLine{262   ncstatus = nf90\_get\_var(ncid, id, jg)}
\DoxyCodeLine{263   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{264                               \textcolor{stringliteral}{'Failed to get\_var jEdit for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{265 }
\DoxyCodeLine{266   \textcolor{comment}{! Read zEdit}}
\DoxyCodeLine{267   ncstatus = nf90\_inq\_varid(ncid, \textcolor{stringliteral}{'zEdit'}, id)}
\DoxyCodeLine{268   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{269                                 \textcolor{stringliteral}{'Failed to inq\_varid zEdit for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{270   \textcolor{keyword}{allocate}(new\_depth(n\_edits))}
\DoxyCodeLine{271   ncstatus = nf90\_get\_var(ncid, id, new\_depth)}
\DoxyCodeLine{272   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{273                               \textcolor{stringliteral}{'Failed to get\_var zEdit for '}//trim(topo\_edits\_file))}
\DoxyCodeLine{274 }
\DoxyCodeLine{275   \textcolor{comment}{! Close file}}
\DoxyCodeLine{276   ncstatus = nf90\_close(ncid)}
\DoxyCodeLine{277   \textcolor{keywordflow}{if} (ncstatus /= nf90\_noerr) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{278                                 \textcolor{stringliteral}{'Failed to close '}//trim(topo\_edits\_file))}
\DoxyCodeLine{279 }
\DoxyCodeLine{280   \textcolor{keywordflow}{do} n = 1, n\_edits}
\DoxyCodeLine{281     i = ig(n) -\/ g\%isd\_global + 2 \textcolor{comment}{! +1 for python indexing and +1 for ig-\/isd\_global+1}}
\DoxyCodeLine{282     j = jg(n) -\/ g\%jsd\_global + 2}
\DoxyCodeLine{283     \textcolor{keywordflow}{if} (i>=g\%isc .and. i<=g\%iec .and. j>=g\%jsc .and. j<=g\%jec) \textcolor{keywordflow}{then}}
\DoxyCodeLine{284       \textcolor{keywordflow}{if} (new\_depth(n)/=0.) \textcolor{keywordflow}{then}}
\DoxyCodeLine{285         \textcolor{keyword}{write}(*,\textcolor{stringliteral}{'(a,3i5,f8.2,a,f8.2,2i4)'}) \&}
\DoxyCodeLine{286           \textcolor{stringliteral}{'Ocean topography edit: '},n,ig(n),jg(n),d(i,j)/m\_to\_z,\textcolor{stringliteral}{'-\/>'},abs(new\_depth(n)),i,j}
\DoxyCodeLine{287         d(i,j) = abs(m\_to\_z*new\_depth(n)) \textcolor{comment}{! Allows for height-\/file edits (i.e. converts negatives)}}
\DoxyCodeLine{288       \textcolor{keywordflow}{else}}
\DoxyCodeLine{289         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{' apply\_topography\_edits\_from\_file: '}//\&}
\DoxyCodeLine{290           \textcolor{stringliteral}{"A zero depth edit would change the land mask and is not allowed in"}//trim(topo\_edits\_file))}
\DoxyCodeLine{291 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{292 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{293 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{294 }
\DoxyCodeLine{295   \textcolor{keyword}{deallocate}( ig, jg, new\_depth )}
\DoxyCodeLine{296 }
\DoxyCodeLine{297   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a25f3025f93e75f70fa21f444014345be}\label{namespacemom__shared__initialization_a25f3025f93e75f70fa21f444014345be}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!compute\_global\_grid\_integrals@{compute\_global\_grid\_integrals}}
\index{compute\_global\_grid\_integrals@{compute\_global\_grid\_integrals}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{compute\_global\_grid\_integrals()}{compute\_global\_grid\_integrals()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::compute\+\_\+global\+\_\+grid\+\_\+integrals (\begin{DoxyParamCaption}\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(inout)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



Pre-\/compute global integrals of grid quantities (like masked ocean area) for later use in reporting diagnostics. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The dynamic horizontal grid \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 1149 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1149   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),          \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{  !< The dynamic horizontal grid}}
\DoxyCodeLine{1150   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{1151 }
\DoxyCodeLine{1152   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1153 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isc:G\%iec, G\%jsc:G\%jec)} :: tmpForSumming}
\DoxyCodeLine{1154 \textcolor{keywordtype}{  real} :: area\_scale  \textcolor{comment}{! A scaling factor for area into MKS units}}
\DoxyCodeLine{1155   \textcolor{keywordtype}{integer} :: i,j}
\DoxyCodeLine{1156 }
\DoxyCodeLine{1157   area\_scale = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) area\_scale = us\%L\_to\_m**2}
\DoxyCodeLine{1158 }
\DoxyCodeLine{1159   tmpforsumming(:,:) = 0.}
\DoxyCodeLine{1160   g\%areaT\_global = 0.0 ; g\%IareaT\_global = 0.0}
\DoxyCodeLine{1161   \textcolor{keywordflow}{do} j=g\%jsc,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc,g\%iec}
\DoxyCodeLine{1162     tmpforsumming(i,j) = area\_scale*g\%areaT(i,j) * g\%mask2dT(i,j)}
\DoxyCodeLine{1163 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1164   g\%areaT\_global = \mbox{\hyperlink{interfacemom__coms_1_1reproducing__sum}{reproducing\_sum}}(tmpforsumming)}
\DoxyCodeLine{1165 }
\DoxyCodeLine{1166   \textcolor{keywordflow}{if} (g\%areaT\_global == 0.0) \&}
\DoxyCodeLine{1167     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"compute\_global\_grid\_integrals: "}//\&}
\DoxyCodeLine{1168                     \textcolor{stringliteral}{"zero ocean area (check topography?)"})}
\DoxyCodeLine{1169 }
\DoxyCodeLine{1170   g\%IareaT\_global = 1.0 / (g\%areaT\_global)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_aab0fe8b21fe93b75e1bec9c652deb2a0}\label{namespacemom__shared__initialization_aab0fe8b21fe93b75e1bec9c652deb2a0}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!diagnosemaximumdepth@{diagnosemaximumdepth}}
\index{diagnosemaximumdepth@{diagnosemaximumdepth}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{diagnosemaximumdepth()}{diagnosemaximumdepth()}}
{\footnotesize\ttfamily real function, public mom\+\_\+shared\+\_\+initialization\+::diagnosemaximumdepth (\begin{DoxyParamCaption}\item[{real, dimension(g\%isd\+:g\%ied,g\%jsd\+:g\%jed), intent(in)}]{D,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(in)}]{G }\end{DoxyParamCaption})}



Return the global maximum ocean bottom depth in the same units as the input depth. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The dynamic horizontal grid type \\
\hline
\mbox{\texttt{ in}}  & {\em d} & Ocean bottom depth in m or Z \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The global maximum ocean bottom depth in m or Z 
\end{DoxyReturn}


Definition at line 125 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{125   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),  \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{ !< The dynamic horizontal grid type}}
\DoxyCodeLine{126 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd:G\%ied,G\%jsd:G\%jed)}, \&}
\DoxyCodeLine{127                            \textcolor{keywordtype}{intent(in)} :: D\textcolor{comment}{ !< Ocean bottom depth in m or Z}}
\DoxyCodeLine{128 \textcolor{keywordtype}{  real} :: diagnoseMaximumDepth\textcolor{comment}{             !< The global maximum ocean bottom depth in m or Z}}
\DoxyCodeLine{129   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{130   \textcolor{keywordtype}{integer} :: i,j}
\DoxyCodeLine{131   diagnosemaximumdepth = d(g\%isc,g\%jsc)}
\DoxyCodeLine{132   \textcolor{keywordflow}{do} j=g\%jsc, g\%jec ; \textcolor{keywordflow}{do} i=g\%isc, g\%iec}
\DoxyCodeLine{133     diagnosemaximumdepth = max(diagnosemaximumdepth,d(i,j))}
\DoxyCodeLine{134 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{135   \textcolor{keyword}{call }max\_across\_pes(diagnosemaximumdepth)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_acf73ad1980ac8b8253fa085a1d8afc17}\label{namespacemom__shared__initialization_acf73ad1980ac8b8253fa085a1d8afc17}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!initialize\_grid\_rotation\_angle@{initialize\_grid\_rotation\_angle}}
\index{initialize\_grid\_rotation\_angle@{initialize\_grid\_rotation\_angle}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{initialize\_grid\_rotation\_angle()}{initialize\_grid\_rotation\_angle()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::initialize\+\_\+grid\+\_\+rotation\+\_\+angle (\begin{DoxyParamCaption}\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(inout)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{PF }\end{DoxyParamCaption})}



initialize\+\_\+grid\+\_\+rotation\+\_\+angle initializes the arrays with the sine and cosine of the angle between logical north on the grid and true north. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The dynamic horizontal grid \\
\hline
\mbox{\texttt{ in}}  & {\em pf} & A structure indicating the open file to parse for model parameter values. \\
\hline
\end{DoxyParams}


Definition at line 548 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{548   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{   !< The dynamic horizontal grid}}
\DoxyCodeLine{549   \textcolor{keywordtype}{type}(param\_file\_type),  \textcolor{keywordtype}{intent(in)}    :: PF\textcolor{comment}{  !< A structure indicating the open file}}
\DoxyCodeLine{550 \textcolor{comment}{                                               !! to parse for model parameter values.}}
\DoxyCodeLine{551 }
\DoxyCodeLine{552 \textcolor{keywordtype}{  real}    :: angle, lon\_scale}
\DoxyCodeLine{553 \textcolor{keywordtype}{  real}    :: len\_lon    \textcolor{comment}{! The periodic range of longitudes, usually 360 degrees.}}
\DoxyCodeLine{554 \textcolor{keywordtype}{  real}    :: pi\_720deg  \textcolor{comment}{! One quarter the conversion factor from degrees to radians.}}
\DoxyCodeLine{555 \textcolor{keywordtype}{  real}    :: lonB(2,2)  \textcolor{comment}{! The longitude of a point, shifted to have about the same value.}}
\DoxyCodeLine{556   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"initialize\_grid\_rotation\_angle"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{557   \textcolor{keywordtype}{logical} :: use\_bugs}
\DoxyCodeLine{558   \textcolor{keywordtype}{integer} :: i, j, m, n}
\DoxyCodeLine{559 }
\DoxyCodeLine{560   \textcolor{keyword}{call }get\_param(pf, mdl, \textcolor{stringliteral}{"GRID\_ROTATION\_ANGLE\_BUGS"}, use\_bugs, \&}
\DoxyCodeLine{561                  \textcolor{stringliteral}{"If true, use an older algorithm to calculate the sine and "}//\&}
\DoxyCodeLine{562                  \textcolor{stringliteral}{"cosines needed rotate between grid-\/oriented directions and "}//\&}
\DoxyCodeLine{563                  \textcolor{stringliteral}{"true north and east.  Differences arise at the tripolar fold."}, \&}
\DoxyCodeLine{564                  default=.false.)}
\DoxyCodeLine{565 }
\DoxyCodeLine{566   \textcolor{keywordflow}{if} (use\_bugs) \textcolor{keywordflow}{then}}
\DoxyCodeLine{567     \textcolor{keywordflow}{do} j=g\%jsc,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc,g\%iec}
\DoxyCodeLine{568       lon\_scale    = cos((g\%geoLatBu(i-\/1,j-\/1) + g\%geoLatBu(i,j-\/1  ) + \&}
\DoxyCodeLine{569                           g\%geoLatBu(i-\/1,j) + g\%geoLatBu(i,j)) * atan(1.0)/180)}
\DoxyCodeLine{570       angle        = atan2((g\%geoLonBu(i-\/1,j) + g\%geoLonBu(i,j) -\/ \&}
\DoxyCodeLine{571                             g\%geoLonBu(i-\/1,j-\/1) -\/ g\%geoLonBu(i,j-\/1))*lon\_scale, \&}
\DoxyCodeLine{572                             g\%geoLatBu(i-\/1,j) + g\%geoLatBu(i,j) -\/ \&}
\DoxyCodeLine{573                             g\%geoLatBu(i-\/1,j-\/1) -\/ g\%geoLatBu(i,j-\/1) )}
\DoxyCodeLine{574       g\%sin\_rot(i,j) = sin(angle) \textcolor{comment}{! angle is the clockwise angle from lat/lon to ocean}}
\DoxyCodeLine{575       g\%cos\_rot(i,j) = cos(angle) \textcolor{comment}{! grid (e.g. angle of ocean "north" from true north)}}
\DoxyCodeLine{576 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{577 }
\DoxyCodeLine{578     \textcolor{comment}{! This is not right at a tripolar or cubed-\/sphere fold.}}
\DoxyCodeLine{579     \textcolor{keyword}{call }pass\_var(g\%cos\_rot, g\%Domain)}
\DoxyCodeLine{580     \textcolor{keyword}{call }pass\_var(g\%sin\_rot, g\%Domain)}
\DoxyCodeLine{581   \textcolor{keywordflow}{else}}
\DoxyCodeLine{582     pi\_720deg = atan(1.0) / 180.0}
\DoxyCodeLine{583     len\_lon = 360.0 ; \textcolor{keywordflow}{if} (g\%len\_lon > 0.0) len\_lon = g\%len\_lon}
\DoxyCodeLine{584     \textcolor{keywordflow}{do} j=g\%jsc,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc,g\%iec}
\DoxyCodeLine{585       \textcolor{keywordflow}{do} n=1,2 ; \textcolor{keywordflow}{do} m=1,2}
\DoxyCodeLine{586         lonb(m,n) = modulo\_around\_point(g\%geoLonBu(i+m-\/2,j+n-\/2), g\%geoLonT(i,j), len\_lon)}
\DoxyCodeLine{587 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{588       lon\_scale = cos(pi\_720deg*((g\%geoLatBu(i-\/1,j-\/1) + g\%geoLatBu(i,j)) + \&}
\DoxyCodeLine{589                                  (g\%geoLatBu(i,j-\/1) + g\%geoLatBu(i-\/1,j)) ) )}
\DoxyCodeLine{590       angle = atan2(lon\_scale*((lonb(1,2) -\/ lonb(2,1)) + (lonb(2,2) -\/ lonb(1,1))), \&}
\DoxyCodeLine{591                     (g\%geoLatBu(i-\/1,j) -\/ g\%geoLatBu(i,j-\/1)) + \&}
\DoxyCodeLine{592                     (g\%geoLatBu(i,j) -\/ g\%geoLatBu(i-\/1,j-\/1)) )}
\DoxyCodeLine{593       g\%sin\_rot(i,j) = sin(angle) \textcolor{comment}{! angle is the clockwise angle from lat/lon to ocean}}
\DoxyCodeLine{594       g\%cos\_rot(i,j) = cos(angle) \textcolor{comment}{! grid (e.g. angle of ocean "north" from true north)}}
\DoxyCodeLine{595 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{596 }
\DoxyCodeLine{597     \textcolor{keyword}{call }pass\_vector(g\%cos\_rot, g\%sin\_rot, g\%Domain, stagger=agrid)}
\DoxyCodeLine{598 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{599 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a3b944f383cd2586189347532539656ef}\label{namespacemom__shared__initialization_a3b944f383cd2586189347532539656ef}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!initialize\_topography\_from\_file@{initialize\_topography\_from\_file}}
\index{initialize\_topography\_from\_file@{initialize\_topography\_from\_file}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{initialize\_topography\_from\_file()}{initialize\_topography\_from\_file()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::initialize\+\_\+topography\+\_\+from\+\_\+file (\begin{DoxyParamCaption}\item[{real, dimension(g\%isd\+:g\%ied,g\%jsd\+:g\%jed), intent(out)}]{D,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(in)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



Read gridded depths from file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The dynamic horizontal grid type \\
\hline
\mbox{\texttt{ out}}  & {\em d} & Ocean bottom depth in m or Z if US is present \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 141 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{141   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),           \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{ !< The dynamic horizontal grid type}}
\DoxyCodeLine{142 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd:G\%ied,G\%jsd:G\%jed)}, \&}
\DoxyCodeLine{143                                     \textcolor{keywordtype}{intent(out)} :: D\textcolor{comment}{ !< Ocean bottom depth in m or Z if US is present}}
\DoxyCodeLine{144   \textcolor{keywordtype}{type}(param\_file\_type),            \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{145   \textcolor{keywordtype}{type}(unit\_scale\_type),  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{146   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{147 \textcolor{keywordtype}{  real} :: m\_to\_Z  \textcolor{comment}{! A dimensional rescaling factor.}}
\DoxyCodeLine{148   \textcolor{keywordtype}{character(len=200)} :: filename, topo\_file, inputdir \textcolor{comment}{! Strings for file/path}}
\DoxyCodeLine{149   \textcolor{keywordtype}{character(len=200)} :: topo\_varname                  \textcolor{comment}{! Variable name in file}}
\DoxyCodeLine{150   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"initialize\_topography\_from\_file"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{151 }
\DoxyCodeLine{152   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_shared\_initialization.F90"})}
\DoxyCodeLine{153 }
\DoxyCodeLine{154   m\_to\_z = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) m\_to\_z = us\%m\_to\_Z}
\DoxyCodeLine{155 }
\DoxyCodeLine{156   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR"}, inputdir, default=\textcolor{stringliteral}{"."})}
\DoxyCodeLine{157   inputdir = slasher(inputdir)}
\DoxyCodeLine{158   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TOPO\_FILE"}, topo\_file, \&}
\DoxyCodeLine{159                  \textcolor{stringliteral}{"The file from which the bathymetry is read."}, \&}
\DoxyCodeLine{160                  default=\textcolor{stringliteral}{"topog.nc"})}
\DoxyCodeLine{161   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TOPO\_VARNAME"}, topo\_varname, \&}
\DoxyCodeLine{162                  \textcolor{stringliteral}{"The name of the bathymetry variable in TOPO\_FILE."}, \&}
\DoxyCodeLine{163                  default=\textcolor{stringliteral}{"depth"})}
\DoxyCodeLine{164 }
\DoxyCodeLine{165   filename = trim(inputdir)//trim(topo\_file)}
\DoxyCodeLine{166   \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR/TOPO\_FILE"}, filename)}
\DoxyCodeLine{167 }
\DoxyCodeLine{168   \textcolor{keywordflow}{if} (.not.file\_exists(filename, g\%Domain)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{169        \textcolor{stringliteral}{" initialize\_topography\_from\_file: Unable to open "}//trim(filename))}
\DoxyCodeLine{170 }
\DoxyCodeLine{171   d(:,:) = -\/9.e30*m\_to\_z \textcolor{comment}{! Initializing to a very large negative depth (tall mountains) everywhere}}
\DoxyCodeLine{172                          \textcolor{comment}{! before reading from a file should do nothing. However, in the instance of}}
\DoxyCodeLine{173                          \textcolor{comment}{! masked-\/out PEs, halo regions are not updated when a processor does not}}
\DoxyCodeLine{174                          \textcolor{comment}{! exist. We need to ensure the depth in masked-\/out PEs appears to be that}}
\DoxyCodeLine{175                          \textcolor{comment}{! of land so this line does that in the halo regions. For non-\/masked PEs}}
\DoxyCodeLine{176                          \textcolor{comment}{! the halo region is filled properly with a later pass\_var().}}
\DoxyCodeLine{177   \textcolor{keyword}{call }mom\_read\_data(filename, trim(topo\_varname), d, g\%Domain, scale=m\_to\_z)}
\DoxyCodeLine{178 }
\DoxyCodeLine{179   \textcolor{keyword}{call }apply\_topography\_edits\_from\_file(d, g, param\_file, us)}
\DoxyCodeLine{180 }
\DoxyCodeLine{181   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a852dd7dc66a31abe47dc83b769fb4ae4}\label{namespacemom__shared__initialization_a852dd7dc66a31abe47dc83b769fb4ae4}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!initialize\_topography\_named@{initialize\_topography\_named}}
\index{initialize\_topography\_named@{initialize\_topography\_named}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{initialize\_topography\_named()}{initialize\_topography\_named()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::initialize\+\_\+topography\+\_\+named (\begin{DoxyParamCaption}\item[{real, dimension(g\%isd\+:g\%ied,g\%jsd\+:g\%jed), intent(out)}]{D,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(in)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{character(len=$\ast$), intent(in)}]{topog\+\_\+config,  }\item[{real, intent(in)}]{max\+\_\+depth,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



initialize the bathymetry based on one of several named idealized configurations 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The dynamic horizontal grid type \\
\hline
\mbox{\texttt{ out}}  & {\em d} & Ocean bottom depth in m or Z if US is present \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
\mbox{\texttt{ in}}  & {\em topog\+\_\+config} & The name of an idealized topographic configuration \\
\hline
\mbox{\texttt{ in}}  & {\em max\+\_\+depth} & Maximum depth of model in the units of D \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 302 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{302   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),           \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{ !< The dynamic horizontal grid type}}
\DoxyCodeLine{303 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd:G\%ied,G\%jsd:G\%jed)}, \&}
\DoxyCodeLine{304                                     \textcolor{keywordtype}{intent(out)} :: D\textcolor{comment}{ !< Ocean bottom depth in m or Z if US is present}}
\DoxyCodeLine{305   \textcolor{keywordtype}{type}(param\_file\_type),            \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{306   \textcolor{keywordtype}{character(len=*)},                 \textcolor{keywordtype}{intent(in)}  :: topog\_config\textcolor{comment}{ !< The name of an idealized}}
\DoxyCodeLine{307 \textcolor{comment}{                                                              !! topographic configuration}}
\DoxyCodeLine{308 \textcolor{keywordtype}{  real},                             \textcolor{keywordtype}{intent(in)}  :: max\_depth\textcolor{comment}{  !< Maximum depth of model in the units of D}}
\DoxyCodeLine{309   \textcolor{keywordtype}{type}(unit\_scale\_type),  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{310 }
\DoxyCodeLine{311   \textcolor{comment}{! This subroutine places the bottom depth in m into D(:,:), shaped according to the named config.}}
\DoxyCodeLine{312 }
\DoxyCodeLine{313   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{314 \textcolor{keywordtype}{  real} :: m\_to\_Z               \textcolor{comment}{! A dimensional rescaling factor.}}
\DoxyCodeLine{315 \textcolor{keywordtype}{  real} :: min\_depth            \textcolor{comment}{! The minimum depth [Z \string~> m].}}
\DoxyCodeLine{316 \textcolor{keywordtype}{  real} :: PI                   \textcolor{comment}{! 3.1415926... calculated as 4*atan(1)}}
\DoxyCodeLine{317 \textcolor{keywordtype}{  real} :: D0                   \textcolor{comment}{! A constant to make the maximum  basin depth MAXIMUM\_DEPTH.}}
\DoxyCodeLine{318 \textcolor{keywordtype}{  real} :: expdecay             \textcolor{comment}{! A decay scale of associated with the sloping boundaries [m].}}
\DoxyCodeLine{319 \textcolor{keywordtype}{  real} :: Dedge                \textcolor{comment}{! The depth [Z \string~> m], at the basin edge}}
\DoxyCodeLine{320 \textcolor{comment}{! real :: south\_lat, west\_lon, len\_lon, len\_lat, Rad\_earth}}
\DoxyCodeLine{321   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, isd, ied, jsd, jed}
\DoxyCodeLine{322   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"initialize\_topography\_named"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{323   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{324   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{325 }
\DoxyCodeLine{326   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_shared\_initialization.F90"})}
\DoxyCodeLine{327   \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"  MOM\_shared\_initialization.F90, initialize\_topography\_named: "}//\&}
\DoxyCodeLine{328                  \textcolor{stringliteral}{"TOPO\_CONFIG = "}//trim(topog\_config), 5)}
\DoxyCodeLine{329 }
\DoxyCodeLine{330   m\_to\_z = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) m\_to\_z = us\%m\_to\_Z}
\DoxyCodeLine{331 }
\DoxyCodeLine{332   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MINIMUM\_DEPTH"}, min\_depth, \&}
\DoxyCodeLine{333                  \textcolor{stringliteral}{"The minimum depth of the ocean."}, units=\textcolor{stringliteral}{"m"}, default=0.0, scale=m\_to\_z)}
\DoxyCodeLine{334   \textcolor{keywordflow}{if} (max\_depth<=0.) \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"initialize\_topography\_named: "}// \&}
\DoxyCodeLine{335       \textcolor{stringliteral}{"MAXIMUM\_DEPTH has a non-\/sensical value! Was it set?"})}
\DoxyCodeLine{336 }
\DoxyCodeLine{337   \textcolor{keywordflow}{if} (trim(topog\_config) /= \textcolor{stringliteral}{"flat"}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{338     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"EDGE\_DEPTH"}, dedge, \&}
\DoxyCodeLine{339                    \textcolor{stringliteral}{"The depth at the edge of one of the named topographies."}, \&}
\DoxyCodeLine{340                    units=\textcolor{stringliteral}{"m"}, default=100.0, scale=m\_to\_z)}
\DoxyCodeLine{341 \textcolor{comment}{!   call get\_param(param\_file, mdl, "SOUTHLAT", south\_lat, \&}}
\DoxyCodeLine{342 \textcolor{comment}{!                  "The southern latitude of the domain.", units="degrees", \&}}
\DoxyCodeLine{343 \textcolor{comment}{!                  fail\_if\_missing=.true.)}}
\DoxyCodeLine{344 \textcolor{comment}{!   call get\_param(param\_file, mdl, "LENLAT", len\_lat, \&}}
\DoxyCodeLine{345 \textcolor{comment}{!                  "The latitudinal length of the domain.", units="degrees", \&}}
\DoxyCodeLine{346 \textcolor{comment}{!                  fail\_if\_missing=.true.)}}
\DoxyCodeLine{347 \textcolor{comment}{!   call get\_param(param\_file, mdl, "WESTLON", west\_lon, \&}}
\DoxyCodeLine{348 \textcolor{comment}{!                  "The western longitude of the domain.", units="degrees", \&}}
\DoxyCodeLine{349 \textcolor{comment}{!                  default=0.0)}}
\DoxyCodeLine{350 \textcolor{comment}{!   call get\_param(param\_file, mdl, "LENLON", len\_lon, \&}}
\DoxyCodeLine{351 \textcolor{comment}{!                  "The longitudinal length of the domain.", units="degrees", \&}}
\DoxyCodeLine{352 \textcolor{comment}{!                  fail\_if\_missing=.true.)}}
\DoxyCodeLine{353 \textcolor{comment}{!   call get\_param(param\_file, mdl, "RAD\_EARTH", Rad\_Earth, \&}}
\DoxyCodeLine{354 \textcolor{comment}{!                  "The radius of the Earth.", units="m", default=6.378e6)}}
\DoxyCodeLine{355     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TOPOG\_SLOPE\_SCALE"}, expdecay, \&}
\DoxyCodeLine{356                    \textcolor{stringliteral}{"The exponential decay scale used in defining some of "}//\&}
\DoxyCodeLine{357                    \textcolor{stringliteral}{"the named topographies."}, units=\textcolor{stringliteral}{"m"}, default=400000.0)}
\DoxyCodeLine{358 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{359 }
\DoxyCodeLine{360 }
\DoxyCodeLine{361   pi = 4.0*atan(1.0)}
\DoxyCodeLine{362 }
\DoxyCodeLine{363   \textcolor{keywordflow}{if} (trim(topog\_config) == \textcolor{stringliteral}{"flat"}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{364     \textcolor{keywordflow}{do} i=is,ie ; \textcolor{keywordflow}{do} j=js,je ; d(i,j) = max\_depth ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{365   \textcolor{keywordflow}{elseif} (trim(topog\_config) == \textcolor{stringliteral}{"spoon"}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{366     d0 = (max\_depth -\/ dedge) / \&}
\DoxyCodeLine{367              ((1.0 -\/ exp(-\/0.5*g\%len\_lat*g\%Rad\_earth*pi/(180.0 *expdecay))) * \&}
\DoxyCodeLine{368               (1.0 -\/ exp(-\/0.5*g\%len\_lat*g\%Rad\_earth*pi/(180.0 *expdecay))))}
\DoxyCodeLine{369     \textcolor{keywordflow}{do} i=is,ie ; \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{370   \textcolor{comment}{!  This sets a bowl shaped (sort of) bottom topography, with a       !}}
\DoxyCodeLine{371   \textcolor{comment}{!  maximum depth of max\_depth.                                   !}}
\DoxyCodeLine{372       d(i,j) =  dedge + d0 * \&}
\DoxyCodeLine{373              (sin(pi * (g\%geoLonT(i,j) -\/ (g\%west\_lon)) / g\%len\_lon) * \&}
\DoxyCodeLine{374            (1.0 -\/ exp((g\%geoLatT(i,j) -\/ (g\%south\_lat+g\%len\_lat))*g\%Rad\_earth*pi / \&}
\DoxyCodeLine{375                       (180.0*expdecay)) ))}
\DoxyCodeLine{376 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{377   \textcolor{keywordflow}{elseif} (trim(topog\_config) == \textcolor{stringliteral}{"bowl"}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{378     d0 = (max\_depth -\/ dedge) / \&}
\DoxyCodeLine{379              ((1.0 -\/ exp(-\/0.5*g\%len\_lat*g\%Rad\_earth*pi/(180.0 *expdecay))) * \&}
\DoxyCodeLine{380               (1.0 -\/ exp(-\/0.5*g\%len\_lat*g\%Rad\_earth*pi/(180.0 *expdecay))))}
\DoxyCodeLine{381 }
\DoxyCodeLine{382   \textcolor{comment}{!  This sets a bowl shaped (sort of) bottom topography, with a}}
\DoxyCodeLine{383   \textcolor{comment}{!  maximum depth of max\_depth.}}
\DoxyCodeLine{384     \textcolor{keywordflow}{do} i=is,ie ; \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{385       d(i,j) =  dedge + d0 * \&}
\DoxyCodeLine{386              (sin(pi * (g\%geoLonT(i,j) -\/ g\%west\_lon) / g\%len\_lon) * \&}
\DoxyCodeLine{387              ((1.0 -\/ exp(-\/(g\%geoLatT(i,j) -\/ g\%south\_lat)*g\%Rad\_Earth*pi/ \&}
\DoxyCodeLine{388                           (180.0*expdecay))) * \&}
\DoxyCodeLine{389              (1.0 -\/ exp((g\%geoLatT(i,j) -\/ (g\%south\_lat+g\%len\_lat))* \&}
\DoxyCodeLine{390                          g\%Rad\_Earth*pi/(180.0*expdecay)))))}
\DoxyCodeLine{391 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{392   \textcolor{keywordflow}{elseif} (trim(topog\_config) == \textcolor{stringliteral}{"halfpipe"}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{393     d0 = max\_depth -\/ dedge}
\DoxyCodeLine{394     \textcolor{keywordflow}{do} i=is,ie ; \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{395       d(i,j) =  dedge + d0 * abs(sin(pi*(g\%geoLatT(i,j) -\/ g\%south\_lat)/g\%len\_lat))}
\DoxyCodeLine{396 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{397   \textcolor{keywordflow}{else}}
\DoxyCodeLine{398     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"initialize\_topography\_named: "}// \&}
\DoxyCodeLine{399       \textcolor{stringliteral}{"Unrecognized topography name "}//trim(topog\_config))}
\DoxyCodeLine{400 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{401 }
\DoxyCodeLine{402   \textcolor{comment}{! This is here just for safety.  Hopefully it doesn't do anything.}}
\DoxyCodeLine{403   \textcolor{keywordflow}{do} i=is,ie ; \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{404     \textcolor{keywordflow}{if} (d(i,j) > max\_depth) d(i,j) = max\_depth}
\DoxyCodeLine{405     \textcolor{keywordflow}{if} (d(i,j) < min\_depth) d(i,j) = 0.5*min\_depth}
\DoxyCodeLine{406 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{407 }
\DoxyCodeLine{408   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_ae2e3b3c739630c8746c533102b8c5d76}\label{namespacemom__shared__initialization_ae2e3b3c739630c8746c533102b8c5d76}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!limit\_topography@{limit\_topography}}
\index{limit\_topography@{limit\_topography}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{limit\_topography()}{limit\_topography()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::limit\+\_\+topography (\begin{DoxyParamCaption}\item[{real, dimension(g\%isd\+:g\%ied,g\%jsd\+:g\%jed), intent(inout)}]{D,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(in)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{real, intent(in)}]{max\+\_\+depth,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



limit\+\_\+topography ensures that min\+\_\+depth $<$ D(x,y) $<$ max\+\_\+depth 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The dynamic horizontal grid type \\
\hline
\mbox{\texttt{ in,out}}  & {\em d} & Ocean bottom depth in m or Z if US is present \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
\mbox{\texttt{ in}}  & {\em max\+\_\+depth} & Maximum depth of model in the units of D \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 415 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{415   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{ !< The dynamic horizontal grid type}}
\DoxyCodeLine{416 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd:G\%ied,G\%jsd:G\%jed)}, \&}
\DoxyCodeLine{417                           \textcolor{keywordtype}{intent(inout)} :: D\textcolor{comment}{ !< Ocean bottom depth in m or Z if US is present}}
\DoxyCodeLine{418   \textcolor{keywordtype}{type}(param\_file\_type),  \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{419 \textcolor{keywordtype}{  real},                   \textcolor{keywordtype}{intent(in)}    :: max\_depth\textcolor{comment}{  !< Maximum depth of model in the units of D}}
\DoxyCodeLine{420   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{   !< A dimensional unit scaling type}}
\DoxyCodeLine{421 }
\DoxyCodeLine{422   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{423 \textcolor{keywordtype}{  real} :: m\_to\_Z  \textcolor{comment}{! A dimensional rescaling factor.}}
\DoxyCodeLine{424   \textcolor{keywordtype}{integer} :: i, j}
\DoxyCodeLine{425   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"limit\_topography"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{426 \textcolor{keywordtype}{  real} :: min\_depth, mask\_depth}
\DoxyCodeLine{427 }
\DoxyCodeLine{428   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_shared\_initialization.F90"})}
\DoxyCodeLine{429 }
\DoxyCodeLine{430   m\_to\_z = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) m\_to\_z = us\%m\_to\_Z}
\DoxyCodeLine{431 }
\DoxyCodeLine{432   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MINIMUM\_DEPTH"}, min\_depth, \&}
\DoxyCodeLine{433                  \textcolor{stringliteral}{"If MASKING\_DEPTH is unspecified, then anything shallower than "}//\&}
\DoxyCodeLine{434                  \textcolor{stringliteral}{"MINIMUM\_DEPTH is assumed to be land and all fluxes are masked out. "}//\&}
\DoxyCodeLine{435                  \textcolor{stringliteral}{"If MASKING\_DEPTH is specified, then all depths shallower than "}//\&}
\DoxyCodeLine{436                  \textcolor{stringliteral}{"MINIMUM\_DEPTH but deeper than MASKING\_DEPTH are rounded to MINIMUM\_DEPTH."}, \&}
\DoxyCodeLine{437                  units=\textcolor{stringliteral}{"m"}, default=0.0, scale=m\_to\_z)}
\DoxyCodeLine{438   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MASKING\_DEPTH"}, mask\_depth, \&}
\DoxyCodeLine{439                  \textcolor{stringliteral}{"The depth below which to mask the ocean as land."}, \&}
\DoxyCodeLine{440                  units=\textcolor{stringliteral}{"m"}, default=-\/9999.0, scale=m\_to\_z, do\_not\_log=.true.)}
\DoxyCodeLine{441 }
\DoxyCodeLine{442 \textcolor{comment}{! Make sure that min\_depth < D(x,y) < max\_depth}}
\DoxyCodeLine{443   \textcolor{keywordflow}{if} (mask\_depth < -\/9990.*m\_to\_z) \textcolor{keywordflow}{then}}
\DoxyCodeLine{444     \textcolor{keywordflow}{do} j=g\%jsd,g\%jed ; \textcolor{keywordflow}{do} i=g\%isd,g\%ied}
\DoxyCodeLine{445       d(i,j) = min( max( d(i,j), 0.5*min\_depth ), max\_depth )}
\DoxyCodeLine{446 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{447   \textcolor{keywordflow}{else}}
\DoxyCodeLine{448     \textcolor{keywordflow}{do} j=g\%jsd,g\%jed ; \textcolor{keywordflow}{do} i=g\%isd,g\%ied}
\DoxyCodeLine{449       \textcolor{keywordflow}{if} (d(i,j)>0.) \textcolor{keywordflow}{then}}
\DoxyCodeLine{450         d(i,j) = min( max( d(i,j), min\_depth ), max\_depth )}
\DoxyCodeLine{451       \textcolor{keywordflow}{else}}
\DoxyCodeLine{452         d(i,j) = 0.}
\DoxyCodeLine{453 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{454 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{455 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{456 }
\DoxyCodeLine{457   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_ac024655ad7fa6e243ceb90e9daa14388}\label{namespacemom__shared__initialization_ac024655ad7fa6e243ceb90e9daa14388}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!modulo\_around\_point@{modulo\_around\_point}}
\index{modulo\_around\_point@{modulo\_around\_point}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{modulo\_around\_point()}{modulo\_around\_point()}}
{\footnotesize\ttfamily real function mom\+\_\+shared\+\_\+initialization\+::modulo\+\_\+around\+\_\+point (\begin{DoxyParamCaption}\item[{real, intent(in)}]{x,  }\item[{real, intent(in)}]{xc,  }\item[{real, intent(in)}]{Lx }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Return the modulo value of x in an interval \mbox{[}xc-\/(Lx/2) xc+(Lx/2)\mbox{]} If Lx$<$=0, then it returns x without applying modulo arithmetic. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em x} & Value to which to apply modulo arithmetic \\
\hline
\mbox{\texttt{ in}}  & {\em xc} & Center of modulo range \\
\hline
\mbox{\texttt{ in}}  & {\em lx} & Modulo range width \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
x shifted by an integer multiple of Lx to be close to xc. 
\end{DoxyReturn}


Definition at line 606 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{606 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)} :: x\textcolor{comment}{  !< Value to which to apply modulo arithmetic}}
\DoxyCodeLine{607 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)} :: xc\textcolor{comment}{ !< Center of modulo range}}
\DoxyCodeLine{608 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)} :: Lx\textcolor{comment}{ !< Modulo range width}}
\DoxyCodeLine{609 \textcolor{keywordtype}{  real} :: x\_mod\textcolor{comment}{          !< x shifted by an integer multiple of Lx to be close to xc.}}
\DoxyCodeLine{610 }
\DoxyCodeLine{611   \textcolor{keywordflow}{if} (lx > 0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{612     x\_mod = modulo(x -\/ (xc -\/ 0.5*lx), lx) + (xc -\/ 0.5*lx)}
\DoxyCodeLine{613   \textcolor{keywordflow}{else}}
\DoxyCodeLine{614     x\_mod = x}
\DoxyCodeLine{615 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a4ec3c9951969b11a90acf193a423d893}\label{namespacemom__shared__initialization_a4ec3c9951969b11a90acf193a423d893}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!mom\_calculate\_grad\_coriolis@{mom\_calculate\_grad\_coriolis}}
\index{mom\_calculate\_grad\_coriolis@{mom\_calculate\_grad\_coriolis}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{mom\_calculate\_grad\_coriolis()}{mom\_calculate\_grad\_coriolis()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::mom\+\_\+calculate\+\_\+grad\+\_\+coriolis (\begin{DoxyParamCaption}\item[{real, dimension(g\%isd\+:g\%ied,g\%jsd\+:g\%jed), intent(out)}]{d\+F\+\_\+dx,  }\item[{real, dimension(g\%isd\+:g\%ied,g\%jsd\+:g\%jed), intent(out)}]{d\+F\+\_\+dy,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(inout)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



Calculates the components of grad f (Coriolis parameter) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The dynamic horizontal grid type \\
\hline
\mbox{\texttt{ out}}  & {\em df\+\_\+dx} & x-\/component of grad f \mbox{[}T-\/1 L-\/1 $\sim$$>$ s-\/1 m-\/1\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em df\+\_\+dy} & y-\/component of grad f \mbox{[}T-\/1 L-\/1 $\sim$$>$ s-\/1 m-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 91 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{91   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),             \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{ !< The dynamic horizontal grid type}}
\DoxyCodeLine{92 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd:G\%ied,G\%jsd:G\%jed)}, \&}
\DoxyCodeLine{93                                       \textcolor{keywordtype}{intent(out)}   :: dF\_dx\textcolor{comment}{ !< x-\/component of grad f [T-\/1 L-\/1 \string~> s-\/1 m-\/1]}}
\DoxyCodeLine{94 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd:G\%ied,G\%jsd:G\%jed)}, \&}
\DoxyCodeLine{95                                       \textcolor{keywordtype}{intent(out)}   :: dF\_dy\textcolor{comment}{ !< y-\/component of grad f [T-\/1 L-\/1 \string~> s-\/1 m-\/1]}}
\DoxyCodeLine{96   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{97   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{98   \textcolor{keywordtype}{integer} :: i,j}
\DoxyCodeLine{99 \textcolor{keywordtype}{  real} :: m\_to\_L  \textcolor{comment}{! A unit conversion factor [L m-\/1 \string~> nondim]}}
\DoxyCodeLine{100 \textcolor{keywordtype}{  real} :: f1, f2}
\DoxyCodeLine{101 }
\DoxyCodeLine{102   m\_to\_l = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) m\_to\_l = us\%m\_to\_L}
\DoxyCodeLine{103 }
\DoxyCodeLine{104   \textcolor{keywordflow}{if} ((lbound(g\%CoriolisBu,1) > g\%isc-\/1) .or. \&}
\DoxyCodeLine{105       (lbound(g\%CoriolisBu,2) > g\%isc-\/1)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{106     \textcolor{comment}{! The gradient of the Coriolis parameter can not be calculated with this grid.}}
\DoxyCodeLine{107     df\_dx(:,:) = 0.0 ; df\_dy(:,:) = 0.0}
\DoxyCodeLine{108     \textcolor{keywordflow}{return}}
\DoxyCodeLine{109 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{110 }
\DoxyCodeLine{111   \textcolor{keywordflow}{do} j=g\%jsc, g\%jec ; \textcolor{keywordflow}{do} i=g\%isc, g\%iec}
\DoxyCodeLine{112     f1 = 0.5*( g\%CoriolisBu(i,j) + g\%CoriolisBu(i,j-\/1) )}
\DoxyCodeLine{113     f2 = 0.5*( g\%CoriolisBu(i-\/1,j) + g\%CoriolisBu(i-\/1,j-\/1) )}
\DoxyCodeLine{114     df\_dx(i,j) = g\%IdxT(i,j) * ( f1 -\/ f2 )}
\DoxyCodeLine{115     f1 = 0.5*( g\%CoriolisBu(i,j) + g\%CoriolisBu(i-\/1,j) )}
\DoxyCodeLine{116     f2 = 0.5*( g\%CoriolisBu(i,j-\/1) + g\%CoriolisBu(i-\/1,j-\/1) )}
\DoxyCodeLine{117     df\_dy(i,j) = g\%IdyT(i,j) * ( f1 -\/ f2 )}
\DoxyCodeLine{118 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{119   \textcolor{keyword}{call }pass\_vector(df\_dx, df\_dy, g\%Domain, stagger=agrid)}
\DoxyCodeLine{120 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a1e501ab8351b666491169c804418e9df}\label{namespacemom__shared__initialization_a1e501ab8351b666491169c804418e9df}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!mom\_initialize\_rotation@{mom\_initialize\_rotation}}
\index{mom\_initialize\_rotation@{mom\_initialize\_rotation}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{mom\_initialize\_rotation()}{mom\_initialize\_rotation()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::mom\+\_\+initialize\+\_\+rotation (\begin{DoxyParamCaption}\item[{real, dimension(g\%isdb\+:g\%iedb,g\%jsdb\+:g\%jedb), intent(out)}]{f,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(in)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{PF,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



M\+O\+M\+\_\+initialize\+\_\+rotation makes the appropriate call to set up the Coriolis parameter. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The dynamic horizontal grid type \\
\hline
\mbox{\texttt{ out}}  & {\em f} & The Coriolis parameter \mbox{[}T-\/1 $\sim$$>$ s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pf} & Parameter file structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 58 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{58   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),                       \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{  !< The dynamic horizontal grid type}}
\DoxyCodeLine{59 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%IsdB:G\%IedB,G\%JsdB:G\%JedB)}, \textcolor{keywordtype}{intent(out)} :: f\textcolor{comment}{  !< The Coriolis parameter [T-\/1 \string~> s-\/1]}}
\DoxyCodeLine{60   \textcolor{keywordtype}{type}(param\_file\_type),                        \textcolor{keywordtype}{intent(in)}  :: PF\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{61   \textcolor{keywordtype}{type}(unit\_scale\_type),              \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{62 }
\DoxyCodeLine{63 \textcolor{comment}{!   This subroutine makes the appropriate call to set up the Coriolis parameter.}}
\DoxyCodeLine{64 \textcolor{comment}{! This is a separate subroutine so that it can be made public and shared with}}
\DoxyCodeLine{65 \textcolor{comment}{! the ice-\/sheet code or other components.}}
\DoxyCodeLine{66 \textcolor{comment}{! Set up the Coriolis parameter, f, either analytically or from file.}}
\DoxyCodeLine{67   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_initialize\_rotation"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{68   \textcolor{keywordtype}{character(len=200)} :: config}
\DoxyCodeLine{69 }
\DoxyCodeLine{70   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_shared\_initialization.F90"})}
\DoxyCodeLine{71   \textcolor{keyword}{call }get\_param(pf, mdl, \textcolor{stringliteral}{"ROTATION"}, config, \&}
\DoxyCodeLine{72                  \textcolor{stringliteral}{"This specifies how the Coriolis parameter is specified: \(\backslash\)n"}//\&}
\DoxyCodeLine{73                  \textcolor{stringliteral}{" \(\backslash\)t 2omegasinlat -\/ Use twice the planetary rotation rate \(\backslash\)n"}//\&}
\DoxyCodeLine{74                  \textcolor{stringliteral}{" \(\backslash\)t\(\backslash\)t times the sine of latitude.\(\backslash\)n"}//\&}
\DoxyCodeLine{75                  \textcolor{stringliteral}{" \(\backslash\)t betaplane -\/ Use a beta-\/plane or f-\/plane.\(\backslash\)n"}//\&}
\DoxyCodeLine{76                  \textcolor{stringliteral}{" \(\backslash\)t USER -\/ call a user modified routine."}, \&}
\DoxyCodeLine{77                  default=\textcolor{stringliteral}{"2omegasinlat"})}
\DoxyCodeLine{78   \textcolor{keywordflow}{select case} (trim(config))}
\DoxyCodeLine{79     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"2omegasinlat"}); \textcolor{keyword}{call }set\_rotation\_planetary(f, g, pf, us)}
\DoxyCodeLine{80     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"beta"}); \textcolor{keyword}{call }set\_rotation\_beta\_plane(f, g, pf, us)}
\DoxyCodeLine{81     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"betaplane"}); \textcolor{keyword}{call }set\_rotation\_beta\_plane(f, g, pf, us)}
\DoxyCodeLine{82    \textcolor{comment}{!case ("nonrotating") ! Note from AJA: Missing case?}}
\DoxyCodeLine{83 \textcolor{keywordflow}{    case default} ; \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"MOM\_initialize: "}// \&}
\DoxyCodeLine{84       \textcolor{stringliteral}{"Unrecognized rotation setup "}//trim(config))}
\DoxyCodeLine{85 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{86   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a9e9d95233423f98871c9e1864563f10d}\label{namespacemom__shared__initialization_a9e9d95233423f98871c9e1864563f10d}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!mom\_shared\_init\_init@{mom\_shared\_init\_init}}
\index{mom\_shared\_init\_init@{mom\_shared\_init\_init}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{mom\_shared\_init\_init()}{mom\_shared\_init\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::mom\+\_\+shared\+\_\+init\+\_\+init (\begin{DoxyParamCaption}\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{PF }\end{DoxyParamCaption})}



M\+O\+M\+\_\+shared\+\_\+init\+\_\+init just writes the code version. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em pf} & A structure indicating the open file to parse for model parameter values. \\
\hline
\end{DoxyParams}


Definition at line 43 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{43   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}    :: PF\textcolor{comment}{   !< A structure indicating the open file}}
\DoxyCodeLine{44 \textcolor{comment}{                                                 !! to parse for model parameter values.}}
\DoxyCodeLine{45 }
\DoxyCodeLine{46   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_shared\_initialization"} \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{47 }
\DoxyCodeLine{48 \textcolor{comment}{! This include declares and sets the variable "version".}}
\DoxyCodeLine{49 \textcolor{preprocessor}{\#include "version\_variable.h"}}
\DoxyCodeLine{50 \textcolor{preprocessor}{}  \textcolor{keyword}{call }log\_version(pf, mdl, version, \&}
\DoxyCodeLine{51    \textcolor{stringliteral}{"Sharable code to initialize time-\/invariant fields, like bathymetry and Coriolis parameters."})}
\DoxyCodeLine{52 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a49c0443c10514a0d5ce5d8df4d68bce8}\label{namespacemom__shared__initialization_a49c0443c10514a0d5ce5d8df4d68bce8}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!read\_face\_length\_list@{read\_face\_length\_list}}
\index{read\_face\_length\_list@{read\_face\_length\_list}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{read\_face\_length\_list()}{read\_face\_length\_list()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::read\+\_\+face\+\_\+length\+\_\+list (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{iounit,  }\item[{character(len=$\ast$), intent(in)}]{filename,  }\item[{integer, intent(out)}]{num\+\_\+lines,  }\item[{character(len=120), dimension(\+:), pointer}]{lines }\end{DoxyParamCaption})}



This subroutine reads and counts the non-\/blank lines in the face length list file, after removing comments. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iounit} & An open I/O unit number for the file \\
\hline
\mbox{\texttt{ in}}  & {\em filename} & The name of the face-\/length file to read \\
\hline
\mbox{\texttt{ out}}  & {\em num\+\_\+lines} & The number of non-\/blank lines in the file \\
\hline
 & {\em lines} & The non-\/blank lines, after removing comments \\
\hline
\end{DoxyParams}


Definition at line 1055 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1055   \textcolor{keywordtype}{integer},                          \textcolor{keywordtype}{intent(in)}  :: iounit\textcolor{comment}{    !< An open I/O unit number for the file}}
\DoxyCodeLine{1056   \textcolor{keywordtype}{character(len=*)},                 \textcolor{keywordtype}{intent(in)}  :: filename\textcolor{comment}{  !< The name of the face-\/length file to read}}
\DoxyCodeLine{1057   \textcolor{keywordtype}{integer},                          \textcolor{keywordtype}{intent(out)} :: num\_lines\textcolor{comment}{ !< The number of non-\/blank lines in the file}}
\DoxyCodeLine{1058   \textcolor{keywordtype}{character(len=120)}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{pointer}     :: lines\textcolor{comment}{  !< The non-\/blank lines, after removing comments}}
\DoxyCodeLine{1059 }
\DoxyCodeLine{1060   \textcolor{comment}{!   This subroutine reads and counts the non-\/blank lines in the face length}}
\DoxyCodeLine{1061   \textcolor{comment}{! list file, after removing comments.}}
\DoxyCodeLine{1062   \textcolor{keywordtype}{character(len=120)} :: line, line\_up}
\DoxyCodeLine{1063   \textcolor{keywordtype}{logical} :: found\_u, found\_v}
\DoxyCodeLine{1064   \textcolor{keywordtype}{integer} :: isu, isv, icom, verbose}
\DoxyCodeLine{1065   \textcolor{keywordtype}{integer} :: last}
\DoxyCodeLine{1066 }
\DoxyCodeLine{1067   num\_lines = 0}
\DoxyCodeLine{1068 }
\DoxyCodeLine{1069   \textcolor{keywordflow}{if} (iounit <= 0) \textcolor{keywordflow}{return}}
\DoxyCodeLine{1070   rewind(iounit)}
\DoxyCodeLine{1071   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while}(.true.)}
\DoxyCodeLine{1072     \textcolor{keyword}{read}(iounit, \textcolor{stringliteral}{'(a)'}, \textcolor{keyword}{end}=8, err=9) line}
\DoxyCodeLine{1073     last = len\_trim(line)}
\DoxyCodeLine{1074     \textcolor{comment}{! Eliminate either F90 or C comments from the line.}}
\DoxyCodeLine{1075     icom = index(line(:last), \textcolor{stringliteral}{"!"}) ; \textcolor{keywordflow}{if} (icom > 0) last = icom-\/1}
\DoxyCodeLine{1076     icom = index(line(:last), \textcolor{stringliteral}{"/*"}) ; \textcolor{keywordflow}{if} (icom > 0) last = icom-\/1}
\DoxyCodeLine{1077     \textcolor{keywordflow}{if} (last < 1) cycle}
\DoxyCodeLine{1078 }
\DoxyCodeLine{1079     \textcolor{comment}{! Detect keywords}}
\DoxyCodeLine{1080     line\_up = uppercase(line)}
\DoxyCodeLine{1081     found\_u = .false.; found\_v = .false.}
\DoxyCodeLine{1082     isu = index(line\_up(:last), \textcolor{stringliteral}{"U\_WIDTH"} ); \textcolor{keywordflow}{if} (isu > 0) found\_u = .true.}
\DoxyCodeLine{1083     isv = index(line\_up(:last), \textcolor{stringliteral}{"V\_WIDTH"} ); \textcolor{keywordflow}{if} (isv > 0) found\_v = .true.}
\DoxyCodeLine{1084 }
\DoxyCodeLine{1085     \textcolor{keywordflow}{if} (found\_u .and. found\_v) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1086       \textcolor{stringliteral}{"read\_face\_length\_list : both U\_WIDTH and V\_WIDTH found when "}//\&}
\DoxyCodeLine{1087       \textcolor{stringliteral}{"reading the line "}//trim(line(:last))//\textcolor{stringliteral}{" in file "}//trim(filename))}
\DoxyCodeLine{1088     \textcolor{keywordflow}{if} (found\_u .or. found\_v) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1089       num\_lines = num\_lines + 1}
\DoxyCodeLine{1090       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(lines)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1091         lines(num\_lines) = line(1:last)}
\DoxyCodeLine{1092 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1093 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1094 \textcolor{keywordflow}{  enddo} \textcolor{comment}{! while (.true.)}}
\DoxyCodeLine{1095 }
\DoxyCodeLine{1096 8 \textcolor{keywordflow}{continue}}
\DoxyCodeLine{1097   \textcolor{keywordflow}{return}}
\DoxyCodeLine{1098 }
\DoxyCodeLine{1099 9 \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"read\_face\_length\_list : "}//\&}
\DoxyCodeLine{1100                   \textcolor{stringliteral}{"Error while reading file "}//trim(filename))}
\DoxyCodeLine{1101 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a27bab8da74b45855db4466ce4942456f}\label{namespacemom__shared__initialization_a27bab8da74b45855db4466ce4942456f}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!reset\_face\_lengths\_file@{reset\_face\_lengths\_file}}
\index{reset\_face\_lengths\_file@{reset\_face\_lengths\_file}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{reset\_face\_lengths\_file()}{reset\_face\_lengths\_file()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::reset\+\_\+face\+\_\+lengths\+\_\+file (\begin{DoxyParamCaption}\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(inout)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



This subroutine sets the open face lengths at selected points to restrict passages to their observed widths from a arrays read from a file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The dynamic horizontal grid \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 750 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{750   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{  !< The dynamic horizontal grid}}
\DoxyCodeLine{751   \textcolor{keywordtype}{type}(param\_file\_type),  \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< A structure to parse for run-\/time parameters}}
\DoxyCodeLine{752   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{753 }
\DoxyCodeLine{754   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{755   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"reset\_face\_lengths\_file"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{756   \textcolor{keywordtype}{character(len=256)} :: mesg    \textcolor{comment}{! Message for error messages.}}
\DoxyCodeLine{757   \textcolor{keywordtype}{character(len=200)} :: filename, chan\_file, inputdir \textcolor{comment}{! Strings for file/path}}
\DoxyCodeLine{758 \textcolor{keywordtype}{  real} :: m\_to\_L  \textcolor{comment}{! A unit conversion factor [L m-\/1 \string~> nondim]}}
\DoxyCodeLine{759 \textcolor{keywordtype}{  real} :: L\_to\_m  \textcolor{comment}{! A unit conversion factor [m L-\/1 \string~> nondim]}}
\DoxyCodeLine{760   \textcolor{keywordtype}{integer} :: i, j, isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{761   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{762   isdb = g\%IsdB ; iedb = g\%IedB ; jsdb = g\%JsdB ; jedb = g\%JedB}
\DoxyCodeLine{763   \textcolor{comment}{! These checks apply regardless of the chosen option.}}
\DoxyCodeLine{764 }
\DoxyCodeLine{765   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_shared\_initialization.F90"})}
\DoxyCodeLine{766   m\_to\_l = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) m\_to\_l = us\%m\_to\_L}
\DoxyCodeLine{767   l\_to\_m = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) l\_to\_m = us\%L\_to\_m}
\DoxyCodeLine{768 }
\DoxyCodeLine{769   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"CHANNEL\_WIDTH\_FILE"}, chan\_file, \&}
\DoxyCodeLine{770                  \textcolor{stringliteral}{"The file from which the list of narrowed channels is read."}, \&}
\DoxyCodeLine{771                  default=\textcolor{stringliteral}{"ocean\_geometry.nc"})}
\DoxyCodeLine{772   \textcolor{keyword}{call }get\_param(param\_file,  mdl, \textcolor{stringliteral}{"INPUTDIR"}, inputdir, default=\textcolor{stringliteral}{"."})}
\DoxyCodeLine{773   inputdir = slasher(inputdir)}
\DoxyCodeLine{774   filename = trim(inputdir)//trim(chan\_file)}
\DoxyCodeLine{775   \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR/CHANNEL\_WIDTH\_FILE"}, filename)}
\DoxyCodeLine{776 }
\DoxyCodeLine{777   \textcolor{keywordflow}{if} (is\_root\_pe()) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (.not.file\_exists(filename)) \&}
\DoxyCodeLine{778     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{" reset\_face\_lengths\_file: Unable to open "}//\&}
\DoxyCodeLine{779                            trim(filename))}
\DoxyCodeLine{780 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{781 }
\DoxyCodeLine{782   \textcolor{keyword}{call }mom\_read\_vector(filename, \textcolor{stringliteral}{"dyCuo"}, \textcolor{stringliteral}{"dxCvo"}, g\%dy\_Cu, g\%dx\_Cv, g\%Domain, scale=m\_to\_l)}
\DoxyCodeLine{783   \textcolor{keyword}{call }pass\_vector(g\%dy\_Cu, g\%dx\_Cv, g\%Domain, to\_all+scalar\_pair, cgrid\_ne)}
\DoxyCodeLine{784 }
\DoxyCodeLine{785   \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isdb,iedb}
\DoxyCodeLine{786     \textcolor{keywordflow}{if} (l\_to\_m*g\%dy\_Cu(i,j) > l\_to\_m*g\%dyCu(i,j)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{787       \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("dy\_Cu of ",ES11.4," exceeds unrestricted width of ",ES11.4,\&}}
\DoxyCodeLine{788 \textcolor{stringliteral}{}\textcolor{stringliteral}{                   \&" by ",ES11.4," at lon/lat of ", ES11.4, ES11.4)'}) \&}
\DoxyCodeLine{789                    l\_to\_m*g\%dy\_Cu(i,j), l\_to\_m*g\%dyCu(i,j), l\_to\_m*g\%dy\_Cu(i,j)-\/l\_to\_m*g\%dyCu(i,j), \&}
\DoxyCodeLine{790                    g\%geoLonCu(i,j), g\%geoLatCu(i,j)}
\DoxyCodeLine{791       \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"reset\_face\_lengths\_file "}//mesg)}
\DoxyCodeLine{792 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{793     g\%areaCu(i,j) = g\%dxCu(i,j) * g\%dy\_Cu(i,j)}
\DoxyCodeLine{794     g\%IareaCu(i,j) = 0.0}
\DoxyCodeLine{795     \textcolor{keywordflow}{if} (g\%areaCu(i,j) > 0.0) g\%IareaCu(i,j) = g\%mask2dCu(i,j) / (g\%areaCu(i,j))}
\DoxyCodeLine{796 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{797 }
\DoxyCodeLine{798   \textcolor{keywordflow}{do} j=jsdb,jedb ; \textcolor{keywordflow}{do} i=isd,ied}
\DoxyCodeLine{799     \textcolor{keywordflow}{if} (l\_to\_m*g\%dx\_Cv(i,j) > l\_to\_m*g\%dxCv(i,j)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{800       \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("dx\_Cv of ",ES11.4," exceeds unrestricted width of ",ES11.4,\&}}
\DoxyCodeLine{801 \textcolor{stringliteral}{}\textcolor{stringliteral}{                   \&" by ",ES11.4, " at lon/lat of ", ES11.4, ES11.4)'}) \&}
\DoxyCodeLine{802                    l\_to\_m*g\%dx\_Cv(i,j), l\_to\_m*g\%dxCv(i,j), l\_to\_m*g\%dx\_Cv(i,j)-\/l\_to\_m*g\%dxCv(i,j), \&}
\DoxyCodeLine{803                    g\%geoLonCv(i,j), g\%geoLatCv(i,j)}
\DoxyCodeLine{804 }
\DoxyCodeLine{805       \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"reset\_face\_lengths\_file "}//mesg)}
\DoxyCodeLine{806 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{807     g\%areaCv(i,j) = g\%dyCv(i,j) * g\%dx\_Cv(i,j)}
\DoxyCodeLine{808     g\%IareaCv(i,j) = 0.0}
\DoxyCodeLine{809     \textcolor{keywordflow}{if} (g\%areaCv(i,j) > 0.0) g\%IareaCv(i,j) = g\%mask2dCv(i,j) / (g\%areaCv(i,j))}
\DoxyCodeLine{810 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{811 }
\DoxyCodeLine{812   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_aea0f76e5a7193df606ba3f09703ca30a}\label{namespacemom__shared__initialization_aea0f76e5a7193df606ba3f09703ca30a}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!reset\_face\_lengths\_list@{reset\_face\_lengths\_list}}
\index{reset\_face\_lengths\_list@{reset\_face\_lengths\_list}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{reset\_face\_lengths\_list()}{reset\_face\_lengths\_list()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::reset\+\_\+face\+\_\+lengths\+\_\+list (\begin{DoxyParamCaption}\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(inout)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



This subroutine sets the open face lengths at selected points to restrict passages to their observed widths from a list read from a file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The dynamic horizontal grid \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 820 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{820   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{  !< The dynamic horizontal grid}}
\DoxyCodeLine{821   \textcolor{keywordtype}{type}(param\_file\_type),  \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< A structure to parse for run-\/time parameters}}
\DoxyCodeLine{822   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{823 }
\DoxyCodeLine{824   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{825   \textcolor{keywordtype}{character(len=120)}, \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{dimension(:)} :: lines => null()}
\DoxyCodeLine{826   \textcolor{keywordtype}{character(len=120)} :: line}
\DoxyCodeLine{827   \textcolor{keywordtype}{character(len=200)} :: filename, chan\_file, inputdir, mesg \textcolor{comment}{! Strings for file/path}}
\DoxyCodeLine{828   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"reset\_face\_lengths\_list"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{829 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{dimension(:,:)} :: \&}
\DoxyCodeLine{830     u\_lat => null(), u\_lon => null(), v\_lat => null(), v\_lon => null()}
\DoxyCodeLine{831 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{dimension(:)} :: \&}
\DoxyCodeLine{832     u\_width => null(), v\_width => null()}
\DoxyCodeLine{833 \textcolor{keywordtype}{  real}    :: m\_to\_L  \textcolor{comment}{! A unit conversion factor [L m-\/1 \string~> nondim]}}
\DoxyCodeLine{834 \textcolor{keywordtype}{  real}    :: L\_to\_m  \textcolor{comment}{! A unit conversion factor [m L-\/1 \string~> nondim]}}
\DoxyCodeLine{835 \textcolor{keywordtype}{  real}    :: lat, lon     \textcolor{comment}{! The latitude and longitude of a point.}}
\DoxyCodeLine{836 \textcolor{keywordtype}{  real}    :: len\_lon      \textcolor{comment}{! The periodic range of longitudes, usually 360 degrees.}}
\DoxyCodeLine{837 \textcolor{keywordtype}{  real}    :: len\_lat      \textcolor{comment}{! The range of latitudes, usually 180 degrees.}}
\DoxyCodeLine{838 \textcolor{keywordtype}{  real}    :: lon\_p, lon\_m \textcolor{comment}{! The longitude of a point shifted by 360 degrees.}}
\DoxyCodeLine{839   \textcolor{keywordtype}{logical} :: check\_360    \textcolor{comment}{! If true, check for longitudes that are shifted by}}
\DoxyCodeLine{840                           \textcolor{comment}{! +/-\/ 360 degrees from the specified range of values.}}
\DoxyCodeLine{841   \textcolor{keywordtype}{logical} :: found\_u, found\_v}
\DoxyCodeLine{842   \textcolor{keywordtype}{logical} :: unit\_in\_use}
\DoxyCodeLine{843   \textcolor{keywordtype}{integer} :: ios, iounit, isu, isv}
\DoxyCodeLine{844   \textcolor{keywordtype}{integer} :: last, num\_lines, nl\_read, ln, npt, u\_pt, v\_pt}
\DoxyCodeLine{845   \textcolor{keywordtype}{integer} :: i, j, isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{846   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{847   isdb = g\%IsdB ; iedb = g\%IedB ; jsdb = g\%JsdB ; jedb = g\%JedB}
\DoxyCodeLine{848 }
\DoxyCodeLine{849   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_shared\_initialization.F90"})}
\DoxyCodeLine{850   m\_to\_l = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) m\_to\_l = us\%m\_to\_L}
\DoxyCodeLine{851   l\_to\_m = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) l\_to\_m = us\%L\_to\_m}
\DoxyCodeLine{852 }
\DoxyCodeLine{853   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"CHANNEL\_LIST\_FILE"}, chan\_file, \&}
\DoxyCodeLine{854                  \textcolor{stringliteral}{"The file from which the list of narrowed channels is read."}, \&}
\DoxyCodeLine{855                  default=\textcolor{stringliteral}{"MOM\_channel\_list"})}
\DoxyCodeLine{856   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR"}, inputdir, default=\textcolor{stringliteral}{"."})}
\DoxyCodeLine{857   inputdir = slasher(inputdir)}
\DoxyCodeLine{858   filename = trim(inputdir)//trim(chan\_file)}
\DoxyCodeLine{859   \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR/CHANNEL\_LIST\_FILE"}, filename)}
\DoxyCodeLine{860   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"CHANNEL\_LIST\_360\_LON\_CHECK"}, check\_360, \&}
\DoxyCodeLine{861                  \textcolor{stringliteral}{"If true, the channel configuration list works for any "}//\&}
\DoxyCodeLine{862                  \textcolor{stringliteral}{"longitudes in the range of -\/360 to 360."}, default=.true.)}
\DoxyCodeLine{863 }
\DoxyCodeLine{864   \textcolor{keywordflow}{if} (is\_root\_pe()) \textcolor{keywordflow}{then}}
\DoxyCodeLine{865     \textcolor{comment}{! Open the input file.}}
\DoxyCodeLine{866     \textcolor{keywordflow}{if} (.not.file\_exists(filename)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{867         \textcolor{stringliteral}{" reset\_face\_lengths\_list: Unable to open "}//trim(filename))}
\DoxyCodeLine{868 }
\DoxyCodeLine{869     \textcolor{comment}{! Find an unused unit number.}}
\DoxyCodeLine{870     \textcolor{keywordflow}{do} iounit=10,512}
\DoxyCodeLine{871       \textcolor{keyword}{INQUIRE}(iounit,opened=unit\_in\_use) ; \textcolor{keywordflow}{if} (.not.unit\_in\_use) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{872 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{873     \textcolor{keywordflow}{if} (iounit >= 512) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{874         \textcolor{stringliteral}{"reset\_face\_lengths\_list: No unused file unit could be found."})}
\DoxyCodeLine{875 }
\DoxyCodeLine{876     \textcolor{comment}{! Open the parameter file.}}
\DoxyCodeLine{877     \textcolor{keyword}{open}(iounit, file=trim(filename), access=\textcolor{stringliteral}{'SEQUENTIAL'}, \&}
\DoxyCodeLine{878          form=\textcolor{stringliteral}{'FORMATTED'}, action=\textcolor{stringliteral}{'READ'}, position=\textcolor{stringliteral}{'REWIND'}, iostat=ios)}
\DoxyCodeLine{879     \textcolor{keywordflow}{if} (ios /= 0) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{880             \textcolor{stringliteral}{"reset\_face\_lengths\_list: Error opening "}//trim(filename))}
\DoxyCodeLine{881 }
\DoxyCodeLine{882     \textcolor{comment}{! Count the number of u\_width and v\_width entries.}}
\DoxyCodeLine{883     \textcolor{keyword}{call }read\_face\_length\_list(iounit, filename, num\_lines, lines)}
\DoxyCodeLine{884 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{885 }
\DoxyCodeLine{886   len\_lon = 360.0 ; \textcolor{keywordflow}{if} (g\%len\_lon > 0.0) len\_lon = g\%len\_lon}
\DoxyCodeLine{887   len\_lat = 180.0 ; \textcolor{keywordflow}{if} (g\%len\_lat > 0.0) len\_lat = g\%len\_lat}
\DoxyCodeLine{888   \textcolor{comment}{! Broadcast the number of lines and allocate the required space.}}
\DoxyCodeLine{889   \textcolor{keyword}{call }broadcast(num\_lines, root\_pe())}
\DoxyCodeLine{890   u\_pt = 0 ; v\_pt = 0}
\DoxyCodeLine{891   \textcolor{keywordflow}{if} (num\_lines > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{892     \textcolor{keyword}{allocate} (lines(num\_lines))}
\DoxyCodeLine{893     \textcolor{keywordflow}{if} (num\_lines > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{894       \textcolor{keyword}{allocate}(u\_lat(2,num\_lines)) ; u\_lat(:,:) = -\/1e34}
\DoxyCodeLine{895       \textcolor{keyword}{allocate}(u\_lon(2,num\_lines)) ; u\_lon(:,:) = -\/1e34}
\DoxyCodeLine{896       \textcolor{keyword}{allocate}(u\_width(num\_lines)) ; u\_width(:) = -\/1e34}
\DoxyCodeLine{897 }
\DoxyCodeLine{898       \textcolor{keyword}{allocate}(v\_lat(2,num\_lines)) ; v\_lat(:,:) = -\/1e34}
\DoxyCodeLine{899       \textcolor{keyword}{allocate}(v\_lon(2,num\_lines)) ; v\_lon(:,:) = -\/1e34}
\DoxyCodeLine{900       \textcolor{keyword}{allocate}(v\_width(num\_lines)) ; v\_width(:) = -\/1e34}
\DoxyCodeLine{901 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{902 }
\DoxyCodeLine{903     \textcolor{comment}{! Actually read the lines.}}
\DoxyCodeLine{904     \textcolor{keywordflow}{if} (is\_root\_pe()) \textcolor{keywordflow}{then}}
\DoxyCodeLine{905       \textcolor{keyword}{call }read\_face\_length\_list(iounit, filename, nl\_read, lines)}
\DoxyCodeLine{906       \textcolor{keywordflow}{if} (nl\_read /= num\_lines) \&}
\DoxyCodeLine{907         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'reset\_face\_lengths\_list : Found different '}// \&}
\DoxyCodeLine{908                   \textcolor{stringliteral}{'number of valid lines on second reading of '}//trim(filename))}
\DoxyCodeLine{909       \textcolor{keyword}{close}(iounit) ; iounit = -\/1}
\DoxyCodeLine{910 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{911 }
\DoxyCodeLine{912     \textcolor{comment}{! Broadcast the lines.}}
\DoxyCodeLine{913     \textcolor{keyword}{call }broadcast(lines, 120, root\_pe())}
\DoxyCodeLine{914 }
\DoxyCodeLine{915     \textcolor{comment}{! Populate the u\_width, etc., data.}}
\DoxyCodeLine{916     \textcolor{keywordflow}{do} ln=1,num\_lines}
\DoxyCodeLine{917       line = lines(ln)}
\DoxyCodeLine{918       \textcolor{comment}{! Detect keywords}}
\DoxyCodeLine{919       found\_u = .false.; found\_v = .false.}
\DoxyCodeLine{920       isu = index(uppercase(line), \textcolor{stringliteral}{"U\_WIDTH"} ); \textcolor{keywordflow}{if} (isu > 0) found\_u = .true.}
\DoxyCodeLine{921       isv = index(uppercase(line), \textcolor{stringliteral}{"V\_WIDTH"} ); \textcolor{keywordflow}{if} (isv > 0) found\_v = .true.}
\DoxyCodeLine{922 }
\DoxyCodeLine{923       \textcolor{comment}{! Store and check the relevant values.}}
\DoxyCodeLine{924       \textcolor{keywordflow}{if} (found\_u) \textcolor{keywordflow}{then}}
\DoxyCodeLine{925         u\_pt = u\_pt + 1}
\DoxyCodeLine{926         \textcolor{keyword}{read}(line(isu+8:),*) u\_lon(1:2,u\_pt), u\_lat(1:2,u\_pt), u\_width(u\_pt)}
\DoxyCodeLine{927         \textcolor{keywordflow}{if} (is\_root\_pe()) \textcolor{keywordflow}{then}}
\DoxyCodeLine{928           \textcolor{keywordflow}{if} (check\_360) \textcolor{keywordflow}{then}}
\DoxyCodeLine{929             \textcolor{keywordflow}{if} ((abs(u\_lon(1,u\_pt)) > len\_lon) .or. (abs(u\_lon(2,u\_pt)) > len\_lon)) \&}
\DoxyCodeLine{930               \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"reset\_face\_lengths\_list : Out-\/of-\/bounds "}//\&}
\DoxyCodeLine{931                  \textcolor{stringliteral}{"u-\/longitude found when reading line "}//trim(line)//\textcolor{stringliteral}{" from file "}//\&}
\DoxyCodeLine{932                  trim(filename))}
\DoxyCodeLine{933             \textcolor{keywordflow}{if} ((abs(u\_lat(1,u\_pt)) > len\_lat) .or. (abs(u\_lat(2,u\_pt)) > len\_lat)) \&}
\DoxyCodeLine{934               \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"reset\_face\_lengths\_list : Out-\/of-\/bounds "}//\&}
\DoxyCodeLine{935                  \textcolor{stringliteral}{"u-\/latitude found when reading line "}//trim(line)//\textcolor{stringliteral}{" from file "}//\&}
\DoxyCodeLine{936                  trim(filename))}
\DoxyCodeLine{937 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{938           \textcolor{keywordflow}{if} (u\_lat(1,u\_pt) > u\_lat(2,u\_pt)) \&}
\DoxyCodeLine{939             \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"reset\_face\_lengths\_list : Out-\/of-\/order "}//\&}
\DoxyCodeLine{940                \textcolor{stringliteral}{"u-\/face latitudes found when reading line "}//trim(line)//\textcolor{stringliteral}{" from file "}//\&}
\DoxyCodeLine{941                trim(filename))}
\DoxyCodeLine{942           \textcolor{keywordflow}{if} (u\_lon(1,u\_pt) > u\_lon(2,u\_pt)) \&}
\DoxyCodeLine{943             \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"reset\_face\_lengths\_list : Out-\/of-\/order "}//\&}
\DoxyCodeLine{944                \textcolor{stringliteral}{"u-\/face longitudes found when reading line "}//trim(line)//\textcolor{stringliteral}{" from file "}//\&}
\DoxyCodeLine{945                trim(filename))}
\DoxyCodeLine{946           \textcolor{keywordflow}{if} (u\_width(u\_pt) < 0.0) \&}
\DoxyCodeLine{947             \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"reset\_face\_lengths\_list : Negative "}//\&}
\DoxyCodeLine{948                \textcolor{stringliteral}{"u-\/width found when reading line "}//trim(line)//\textcolor{stringliteral}{" from file "}//\&}
\DoxyCodeLine{949                trim(filename))}
\DoxyCodeLine{950 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{951       \textcolor{keywordflow}{elseif} (found\_v) \textcolor{keywordflow}{then}}
\DoxyCodeLine{952         v\_pt = v\_pt + 1}
\DoxyCodeLine{953         \textcolor{keyword}{read}(line(isv+8:),*) v\_lon(1:2,v\_pt), v\_lat(1:2,v\_pt), v\_width(v\_pt)}
\DoxyCodeLine{954         \textcolor{keywordflow}{if} (is\_root\_pe()) \textcolor{keywordflow}{then}}
\DoxyCodeLine{955           \textcolor{keywordflow}{if} (check\_360) \textcolor{keywordflow}{then}}
\DoxyCodeLine{956             \textcolor{keywordflow}{if} ((abs(v\_lon(1,v\_pt)) > len\_lon) .or. (abs(v\_lon(2,v\_pt)) > len\_lon)) \&}
\DoxyCodeLine{957               \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"reset\_face\_lengths\_list : Out-\/of-\/bounds "}//\&}
\DoxyCodeLine{958                  \textcolor{stringliteral}{"v-\/longitude found when reading line "}//trim(line)//\textcolor{stringliteral}{" from file "}//\&}
\DoxyCodeLine{959                  trim(filename))}
\DoxyCodeLine{960             \textcolor{keywordflow}{if} ((abs(v\_lat(1,v\_pt)) > len\_lat) .or. (abs(v\_lat(2,v\_pt)) > len\_lat)) \&}
\DoxyCodeLine{961               \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"reset\_face\_lengths\_list : Out-\/of-\/bounds "}//\&}
\DoxyCodeLine{962                  \textcolor{stringliteral}{"v-\/latitude found when reading line "}//trim(line)//\textcolor{stringliteral}{" from file "}//\&}
\DoxyCodeLine{963                  trim(filename))}
\DoxyCodeLine{964 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{965           \textcolor{keywordflow}{if} (v\_lat(1,v\_pt) > v\_lat(2,v\_pt)) \&}
\DoxyCodeLine{966             \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"reset\_face\_lengths\_list : Out-\/of-\/order "}//\&}
\DoxyCodeLine{967                \textcolor{stringliteral}{"v-\/face latitudes found when reading line "}//trim(line)//\textcolor{stringliteral}{" from file "}//\&}
\DoxyCodeLine{968                trim(filename))}
\DoxyCodeLine{969           \textcolor{keywordflow}{if} (v\_lon(1,v\_pt) > v\_lon(2,v\_pt)) \&}
\DoxyCodeLine{970             \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"reset\_face\_lengths\_list : Out-\/of-\/order "}//\&}
\DoxyCodeLine{971                \textcolor{stringliteral}{"v-\/face longitudes found when reading line "}//trim(line)//\textcolor{stringliteral}{" from file "}//\&}
\DoxyCodeLine{972                trim(filename))}
\DoxyCodeLine{973           \textcolor{keywordflow}{if} (v\_width(v\_pt) < 0.0) \&}
\DoxyCodeLine{974             \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"reset\_face\_lengths\_list : Negative "}//\&}
\DoxyCodeLine{975                \textcolor{stringliteral}{"v-\/width found when reading line "}//trim(line)//\textcolor{stringliteral}{" from file "}//\&}
\DoxyCodeLine{976                trim(filename))}
\DoxyCodeLine{977 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{978 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{979 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{980 }
\DoxyCodeLine{981     \textcolor{keyword}{deallocate}(lines)}
\DoxyCodeLine{982 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{983 }
\DoxyCodeLine{984   \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isdb,iedb}
\DoxyCodeLine{985     lat = g\%geoLatCu(i,j) ; lon = g\%geoLonCu(i,j)}
\DoxyCodeLine{986     \textcolor{keywordflow}{if} (check\_360) \textcolor{keywordflow}{then} ; lon\_p = lon+len\_lon ; lon\_m = lon-\/len\_lon}
\DoxyCodeLine{987     \textcolor{keywordflow}{else} ; lon\_p = lon ; lon\_m = lon ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{988 }
\DoxyCodeLine{989     \textcolor{keywordflow}{do} npt=1,u\_pt}
\DoxyCodeLine{990       \textcolor{keywordflow}{if} (((lat >= u\_lat(1,npt)) .and. (lat <= u\_lat(2,npt))) .and. \&}
\DoxyCodeLine{991           (((lon >= u\_lon(1,npt)) .and. (lon <= u\_lon(2,npt))) .or. \&}
\DoxyCodeLine{992            ((lon\_p >= u\_lon(1,npt)) .and. (lon\_p <= u\_lon(2,npt))) .or. \&}
\DoxyCodeLine{993            ((lon\_m >= u\_lon(1,npt)) .and. (lon\_m <= u\_lon(2,npt)))) ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{994 }
\DoxyCodeLine{995         g\%dy\_Cu(i,j) = g\%mask2dCu(i,j) * m\_to\_l*min(l\_to\_m*g\%dyCu(i,j), max(u\_width(npt), 0.0))}
\DoxyCodeLine{996         \textcolor{keywordflow}{if} (j>=g\%jsc .and. j<=g\%jec .and. i>=g\%isc .and. i<=g\%iec) \textcolor{keywordflow}{then} \textcolor{comment}{! Limit messages/checking to compute domain}}
\DoxyCodeLine{997           \textcolor{keywordflow}{if} ( g\%mask2dCu(i,j) == 0.0 )  \textcolor{keywordflow}{then}}
\DoxyCodeLine{998             \textcolor{keyword}{write}(*,\textcolor{stringliteral}{'(A,2F8.2,A,4F8.2,A)'}) \textcolor{stringliteral}{"read\_face\_lengths\_list : G\%mask2dCu=0 at "},lat,lon,\textcolor{stringliteral}{" ("},\&}
\DoxyCodeLine{999                 u\_lat(1,npt), u\_lat(2,npt), u\_lon(1,npt), u\_lon(2,npt),\textcolor{stringliteral}{") so grid metric is unmodified."}}
\DoxyCodeLine{1000           \textcolor{keywordflow}{else}}
\DoxyCodeLine{1001             \textcolor{keyword}{write}(*,\textcolor{stringliteral}{'(A,2F8.2,A,4F8.2,A5,F9.2,A1)'}) \&}
\DoxyCodeLine{1002                   \textcolor{stringliteral}{"read\_face\_lengths\_list : Modifying dy\_Cu gridpoint at "},lat,lon,\textcolor{stringliteral}{" ("},\&}
\DoxyCodeLine{1003                   u\_lat(1,npt), u\_lat(2,npt), u\_lon(1,npt), u\_lon(2,npt),\textcolor{stringliteral}{") to "},l\_to\_m*g\%dy\_Cu(i,j),\textcolor{stringliteral}{"m"}}
\DoxyCodeLine{1004 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{1005 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{1006 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1007 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{1008 }
\DoxyCodeLine{1009     g\%areaCu(i,j) = g\%dxCu(i,j) * g\%dy\_Cu(i,j)}
\DoxyCodeLine{1010     g\%IareaCu(i,j) = 0.0}
\DoxyCodeLine{1011     \textcolor{keywordflow}{if} (g\%areaCu(i,j) > 0.0) g\%IareaCu(i,j) = g\%mask2dCu(i,j) / (g\%areaCu(i,j))}
\DoxyCodeLine{1012 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1013 }
\DoxyCodeLine{1014   \textcolor{keywordflow}{do} j=jsdb,jedb ; \textcolor{keywordflow}{do} i=isd,ied}
\DoxyCodeLine{1015     lat = g\%geoLatCv(i,j) ; lon = g\%geoLonCv(i,j)}
\DoxyCodeLine{1016     \textcolor{keywordflow}{if} (check\_360) \textcolor{keywordflow}{then} ; lon\_p = lon+len\_lon ; lon\_m = lon-\/len\_lon}
\DoxyCodeLine{1017     \textcolor{keywordflow}{else} ; lon\_p = lon ; lon\_m = lon ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{1018 }
\DoxyCodeLine{1019     \textcolor{keywordflow}{do} npt=1,v\_pt}
\DoxyCodeLine{1020       \textcolor{keywordflow}{if} (((lat >= v\_lat(1,npt)) .and. (lat <= v\_lat(2,npt))) .and. \&}
\DoxyCodeLine{1021           (((lon >= v\_lon(1,npt)) .and. (lon <= v\_lon(2,npt))) .or. \&}
\DoxyCodeLine{1022            ((lon\_p >= v\_lon(1,npt)) .and. (lon\_p <= v\_lon(2,npt))) .or. \&}
\DoxyCodeLine{1023            ((lon\_m >= v\_lon(1,npt)) .and. (lon\_m <= v\_lon(2,npt)))) ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1024         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j) * m\_to\_l*min(l\_to\_m*g\%dxCv(i,j), max(v\_width(npt), 0.0))}
\DoxyCodeLine{1025         \textcolor{keywordflow}{if} (i>=g\%isc .and. i<=g\%iec .and. j>=g\%jsc .and. j<=g\%jec) \textcolor{keywordflow}{then} \textcolor{comment}{! Limit messages/checking to compute domain}}
\DoxyCodeLine{1026           \textcolor{keywordflow}{if} ( g\%mask2dCv(i,j) == 0.0 )  \textcolor{keywordflow}{then}}
\DoxyCodeLine{1027             \textcolor{keyword}{write}(*,\textcolor{stringliteral}{'(A,2F8.2,A,4F8.2,A)'}) \textcolor{stringliteral}{"read\_face\_lengths\_list : G\%mask2dCv=0 at "},lat,lon,\textcolor{stringliteral}{" ("},\&}
\DoxyCodeLine{1028                   v\_lat(1,npt), v\_lat(2,npt), v\_lon(1,npt), v\_lon(2,npt),\textcolor{stringliteral}{") so grid metric is unmodified."}}
\DoxyCodeLine{1029           \textcolor{keywordflow}{else}}
\DoxyCodeLine{1030             \textcolor{keyword}{write}(*,\textcolor{stringliteral}{'(A,2F8.2,A,4F8.2,A5,F9.2,A1)'}) \&}
\DoxyCodeLine{1031                   \textcolor{stringliteral}{"read\_face\_lengths\_list : Modifying dx\_Cv gridpoint at "},lat,lon,\textcolor{stringliteral}{" ("},\&}
\DoxyCodeLine{1032                   v\_lat(1,npt), v\_lat(2,npt), v\_lon(1,npt), v\_lon(2,npt),\textcolor{stringliteral}{") to "},l\_to\_m*g\%dx\_Cv(i,j),\textcolor{stringliteral}{"m"}}
\DoxyCodeLine{1033 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{1034 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{1035 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1036 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{1037 }
\DoxyCodeLine{1038     g\%areaCv(i,j) = g\%dyCv(i,j) * g\%dx\_Cv(i,j)}
\DoxyCodeLine{1039     g\%IareaCv(i,j) = 0.0}
\DoxyCodeLine{1040     \textcolor{keywordflow}{if} (g\%areaCv(i,j) > 0.0) g\%IareaCv(i,j) = g\%mask2dCv(i,j) / (g\%areaCv(i,j))}
\DoxyCodeLine{1041 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1042 }
\DoxyCodeLine{1043   \textcolor{keywordflow}{if} (num\_lines > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1044     \textcolor{keyword}{deallocate}(u\_lat) ; \textcolor{keyword}{deallocate}(u\_lon) ; \textcolor{keyword}{deallocate}(u\_width)}
\DoxyCodeLine{1045     \textcolor{keyword}{deallocate}(v\_lat) ; \textcolor{keyword}{deallocate}(v\_lon) ; \textcolor{keyword}{deallocate}(v\_width)}
\DoxyCodeLine{1046 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1047 }
\DoxyCodeLine{1048   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_af506ce66cc9fdd478b4e2bd44e594f18}\label{namespacemom__shared__initialization_af506ce66cc9fdd478b4e2bd44e594f18}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!reset\_face\_lengths\_named@{reset\_face\_lengths\_named}}
\index{reset\_face\_lengths\_named@{reset\_face\_lengths\_named}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{reset\_face\_lengths\_named()}{reset\_face\_lengths\_named()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::reset\+\_\+face\+\_\+lengths\+\_\+named (\begin{DoxyParamCaption}\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(inout)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{character(len=$\ast$), intent(in)}]{name,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



This subroutine sets the open face lengths at selected points to restrict passages to their observed widths based on a named set of sizes. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The dynamic horizontal grid \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\mbox{\texttt{ in}}  & {\em name} & The name for the set of face lengths. Only \char`\"{}global\+\_\+1deg\char`\"{} is currently implemented. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 622 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{622   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{  !< The dynamic horizontal grid}}
\DoxyCodeLine{623   \textcolor{keywordtype}{type}(param\_file\_type),  \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< A structure to parse for run-\/time parameters}}
\DoxyCodeLine{624   \textcolor{keywordtype}{character(len=*)},       \textcolor{keywordtype}{intent(in)}    :: name\textcolor{comment}{ !< The name for the set of face lengths. Only "global\_1deg"}}
\DoxyCodeLine{625 \textcolor{comment}{                                                !! is currently implemented.}}
\DoxyCodeLine{626   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{627 }
\DoxyCodeLine{628   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{629   \textcolor{keywordtype}{character(len=256)} :: mesg    \textcolor{comment}{! Message for error messages.}}
\DoxyCodeLine{630 \textcolor{keywordtype}{  real} :: m\_to\_L  \textcolor{comment}{! A unit conversion factor [L m-\/1 \string~> nondim]}}
\DoxyCodeLine{631 \textcolor{keywordtype}{  real} :: L\_to\_m  \textcolor{comment}{! A unit conversion factor [m L-\/1 \string~> nondim]}}
\DoxyCodeLine{632 \textcolor{keywordtype}{  real}    :: dx\_2 = -\/1.0, dy\_2 = -\/1.0}
\DoxyCodeLine{633 \textcolor{keywordtype}{  real}    :: pi\_180}
\DoxyCodeLine{634   \textcolor{keywordtype}{integer} :: option = -\/1}
\DoxyCodeLine{635   \textcolor{keywordtype}{integer} :: i, j, isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{636   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{637   isdb = g\%IsdB ; iedb = g\%IedB ; jsdb = g\%JsdB ; jedb = g\%JedB}
\DoxyCodeLine{638   pi\_180 = (4.0*atan(1.0))/180.0}
\DoxyCodeLine{639 }
\DoxyCodeLine{640   \textcolor{keywordflow}{select case} ( trim(name) )}
\DoxyCodeLine{641     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"global\_1deg"})    ; option = 1 ; dx\_2 = 0.5*1.0}
\DoxyCodeLine{642 \textcolor{keywordflow}{    case default} ; \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"reset\_face\_lengths\_named: "}//\&}
\DoxyCodeLine{643       \textcolor{stringliteral}{"Unrecognized channel configuration name "}//trim(name))}
\DoxyCodeLine{644 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{645 }
\DoxyCodeLine{646   m\_to\_l = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) m\_to\_l = us\%m\_to\_L}
\DoxyCodeLine{647   l\_to\_m = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) l\_to\_m = us\%L\_to\_m}
\DoxyCodeLine{648 }
\DoxyCodeLine{649   \textcolor{keywordflow}{if} (option==1) \textcolor{keywordflow}{then} \textcolor{comment}{! 1-\/degree settings.}}
\DoxyCodeLine{650     \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isdb,iedb  \textcolor{comment}{! Change any u-\/face lengths within this loop.}}
\DoxyCodeLine{651       dy\_2 = dx\_2 * g\%dyCu(i,j)*g\%IdxCu(i,j) * cos(pi\_180 * g\%geoLatCu(i,j))}
\DoxyCodeLine{652 }
\DoxyCodeLine{653       \textcolor{keywordflow}{if} ((abs(g\%geoLatCu(i,j)-\/35.5) < dy\_2) .and. (g\%geoLonCu(i,j) < -\/4.5) .and. \&}
\DoxyCodeLine{654           (g\%geoLonCu(i,j) > -\/6.5)) \&}
\DoxyCodeLine{655         g\%dy\_Cu(i,j) = g\%mask2dCu(i,j)*12000.0*m\_to\_l   \textcolor{comment}{! Gibraltar}}
\DoxyCodeLine{656 }
\DoxyCodeLine{657       \textcolor{keywordflow}{if} ((abs(g\%geoLatCu(i,j)-\/12.5) < dy\_2) .and. (abs(g\%geoLonCu(i,j)-\/43.0) < dx\_2)) \&}
\DoxyCodeLine{658         g\%dy\_Cu(i,j) = g\%mask2dCu(i,j)*10000.0*m\_to\_l   \textcolor{comment}{! Red Sea}}
\DoxyCodeLine{659 }
\DoxyCodeLine{660       \textcolor{keywordflow}{if} ((abs(g\%geoLatCu(i,j)-\/40.5) < dy\_2) .and. (abs(g\%geoLonCu(i,j)-\/26.0) < dx\_2)) \&}
\DoxyCodeLine{661         g\%dy\_Cu(i,j) = g\%mask2dCu(i,j)*5000.0*m\_to\_l   \textcolor{comment}{! Dardanelles}}
\DoxyCodeLine{662 }
\DoxyCodeLine{663       \textcolor{keywordflow}{if} ((abs(g\%geoLatCu(i,j)-\/41.5) < dy\_2) .and. (abs(g\%geoLonCu(i,j)+220.0) < dx\_2)) \&}
\DoxyCodeLine{664         g\%dy\_Cu(i,j) = g\%mask2dCu(i,j)*35000.0*m\_to\_l   \textcolor{comment}{! Tsugaru strait at 140.0e}}
\DoxyCodeLine{665 }
\DoxyCodeLine{666       \textcolor{keywordflow}{if} ((abs(g\%geoLatCu(i,j)-\/45.5) < dy\_2) .and. (abs(g\%geoLonCu(i,j)+217.5) < 0.9)) \&}
\DoxyCodeLine{667         g\%dy\_Cu(i,j) = g\%mask2dCu(i,j)*15000.0*m\_to\_l   \textcolor{comment}{! Betw Hokkaido and Sakhalin at 217\&218 = 142e}}
\DoxyCodeLine{668 }
\DoxyCodeLine{669       \textcolor{comment}{! Greater care needs to be taken in the tripolar region.}}
\DoxyCodeLine{670       \textcolor{keywordflow}{if} ((abs(g\%geoLatCu(i,j)-\/80.84) < 0.2) .and. (abs(g\%geoLonCu(i,j)+64.9) < 0.8)) \&}
\DoxyCodeLine{671         g\%dy\_Cu(i,j) = g\%mask2dCu(i,j)*38000.0*m\_to\_l   \textcolor{comment}{! Smith Sound in Canadian Arch -\/ tripolar region}}
\DoxyCodeLine{672 }
\DoxyCodeLine{673 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{674 }
\DoxyCodeLine{675     \textcolor{keywordflow}{do} j=jsdb,jedb ; \textcolor{keywordflow}{do} i=isd,ied  \textcolor{comment}{! Change any v-\/face lengths within this loop.}}
\DoxyCodeLine{676       dy\_2 = dx\_2 * g\%dyCv(i,j)*g\%IdxCv(i,j) * cos(pi\_180 * g\%geoLatCv(i,j))}
\DoxyCodeLine{677       \textcolor{keywordflow}{if} ((abs(g\%geoLatCv(i,j)-\/41.0) < dy\_2) .and. (abs(g\%geoLonCv(i,j)-\/28.5) < dx\_2)) \&}
\DoxyCodeLine{678         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j)*2500.0*m\_to\_l   \textcolor{comment}{! Bosporus -\/ should be 1000.0 m wide.}}
\DoxyCodeLine{679 }
\DoxyCodeLine{680       \textcolor{keywordflow}{if} ((abs(g\%geoLatCv(i,j)-\/13.0) < dy\_2) .and. (abs(g\%geoLonCv(i,j)-\/42.5) < dx\_2)) \&}
\DoxyCodeLine{681         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j)*10000.0*m\_to\_l   \textcolor{comment}{! Red Sea}}
\DoxyCodeLine{682 }
\DoxyCodeLine{683       \textcolor{keywordflow}{if} ((abs(g\%geoLatCv(i,j)+2.8) < 0.8) .and. (abs(g\%geoLonCv(i,j)+241.5) < dx\_2)) \&}
\DoxyCodeLine{684         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j)*40000.0*m\_to\_l   \textcolor{comment}{! Makassar Straits at 241.5 W = 118.5 E}}
\DoxyCodeLine{685 }
\DoxyCodeLine{686       \textcolor{keywordflow}{if} ((abs(g\%geoLatCv(i,j)-\/0.56) < 0.5) .and. (abs(g\%geoLonCv(i,j)+240.5) < dx\_2)) \&}
\DoxyCodeLine{687         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j)*80000.0*m\_to\_l   \textcolor{comment}{! entry to Makassar Straits at 240.5 W = 119.5 E}}
\DoxyCodeLine{688 }
\DoxyCodeLine{689       \textcolor{keywordflow}{if} ((abs(g\%geoLatCv(i,j)-\/0.19) < 0.5) .and. (abs(g\%geoLonCv(i,j)+230.5) < dx\_2)) \&}
\DoxyCodeLine{690         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j)*25000.0*m\_to\_l   \textcolor{comment}{! Channel betw N Guinea and Halmahara 230.5 W = 129.5 E}}
\DoxyCodeLine{691 }
\DoxyCodeLine{692       \textcolor{keywordflow}{if} ((abs(g\%geoLatCv(i,j)-\/0.19) < 0.5) .and. (abs(g\%geoLonCv(i,j)+229.5) < dx\_2)) \&}
\DoxyCodeLine{693         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j)*25000.0*m\_to\_l   \textcolor{comment}{! Channel betw N Guinea and Halmahara 229.5 W = 130.5 E}}
\DoxyCodeLine{694 }
\DoxyCodeLine{695       \textcolor{keywordflow}{if} ((abs(g\%geoLatCv(i,j)-\/0.0) < 0.25) .and. (abs(g\%geoLonCv(i,j)+228.5) < dx\_2)) \&}
\DoxyCodeLine{696         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j)*25000.0*m\_to\_l   \textcolor{comment}{! Channel betw N Guinea and Halmahara 228.5 W = 131.5 E}}
\DoxyCodeLine{697 }
\DoxyCodeLine{698       \textcolor{keywordflow}{if} ((abs(g\%geoLatCv(i,j)+8.5) < 0.5) .and. (abs(g\%geoLonCv(i,j)+244.5) < dx\_2)) \&}
\DoxyCodeLine{699         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j)*20000.0*m\_to\_l   \textcolor{comment}{! Lombok Straits at 244.5 W = 115.5 E}}
\DoxyCodeLine{700 }
\DoxyCodeLine{701       \textcolor{keywordflow}{if} ((abs(g\%geoLatCv(i,j)+8.5) < 0.5) .and. (abs(g\%geoLonCv(i,j)+235.5) < dx\_2)) \&}
\DoxyCodeLine{702         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j)*20000.0*m\_to\_l   \textcolor{comment}{! Timor Straits at 235.5 W = 124.5 E}}
\DoxyCodeLine{703 }
\DoxyCodeLine{704       \textcolor{keywordflow}{if} ((abs(g\%geoLatCv(i,j)-\/52.5) < dy\_2) .and. (abs(g\%geoLonCv(i,j)+218.5) < dx\_2)) \&}
\DoxyCodeLine{705         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j)*2500.0*m\_to\_l    \textcolor{comment}{! Russia and Sakhalin Straits at 218.5 W = 141.5 E}}
\DoxyCodeLine{706 }
\DoxyCodeLine{707       \textcolor{comment}{! Greater care needs to be taken in the tripolar region.}}
\DoxyCodeLine{708       \textcolor{keywordflow}{if} ((abs(g\%geoLatCv(i,j)-\/76.8) < 0.06) .and. (abs(g\%geoLonCv(i,j)+88.7) < dx\_2)) \&}
\DoxyCodeLine{709         g\%dx\_Cv(i,j) = g\%mask2dCv(i,j)*8400.0*m\_to\_l    \textcolor{comment}{! Jones Sound in Canadian Arch -\/ tripolar region}}
\DoxyCodeLine{710 }
\DoxyCodeLine{711 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{712 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{713 }
\DoxyCodeLine{714   \textcolor{comment}{! These checks apply regardless of the chosen option.}}
\DoxyCodeLine{715 }
\DoxyCodeLine{716   \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isdb,iedb}
\DoxyCodeLine{717     \textcolor{keywordflow}{if} (l\_to\_m*g\%dy\_Cu(i,j) > l\_to\_m*g\%dyCu(i,j)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{718       \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("dy\_Cu of ",ES11.4," exceeds unrestricted width of ",ES11.4,\&}}
\DoxyCodeLine{719 \textcolor{stringliteral}{}\textcolor{stringliteral}{                   \&" by ",ES11.4," at lon/lat of ", ES11.4, ES11.4)'}) \&}
\DoxyCodeLine{720                    l\_to\_m*g\%dy\_Cu(i,j), l\_to\_m*g\%dyCu(i,j), l\_to\_m*g\%dy\_Cu(i,j)-\/l\_to\_m*g\%dyCu(i,j), \&}
\DoxyCodeLine{721                    g\%geoLonCu(i,j), g\%geoLatCu(i,j)}
\DoxyCodeLine{722       \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"reset\_face\_lengths\_named "}//mesg)}
\DoxyCodeLine{723 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{724     g\%areaCu(i,j) = g\%dxCu(i,j) * g\%dy\_Cu(i,j)}
\DoxyCodeLine{725     g\%IareaCu(i,j) = 0.0}
\DoxyCodeLine{726     \textcolor{keywordflow}{if} (g\%areaCu(i,j) > 0.0) g\%IareaCu(i,j) = g\%mask2dCu(i,j) / (g\%areaCu(i,j))}
\DoxyCodeLine{727 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{728 }
\DoxyCodeLine{729   \textcolor{keywordflow}{do} j=jsdb,jedb ; \textcolor{keywordflow}{do} i=isd,ied}
\DoxyCodeLine{730     \textcolor{keywordflow}{if} (l\_to\_m*g\%dx\_Cv(i,j) > l\_to\_m*g\%dxCv(i,j)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{731       \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("dx\_Cv of ",ES11.4," exceeds unrestricted width of ",ES11.4,\&}}
\DoxyCodeLine{732 \textcolor{stringliteral}{}\textcolor{stringliteral}{                   \&" by ",ES11.4, " at lon/lat of ", ES11.4, ES11.4)'}) \&}
\DoxyCodeLine{733                    l\_to\_m*g\%dx\_Cv(i,j), l\_to\_m*g\%dxCv(i,j), l\_to\_m*g\%dx\_Cv(i,j)-\/l\_to\_m*g\%dxCv(i,j), \&}
\DoxyCodeLine{734                    g\%geoLonCv(i,j), g\%geoLatCv(i,j)}
\DoxyCodeLine{735 }
\DoxyCodeLine{736       \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"reset\_face\_lengths\_named "}//mesg)}
\DoxyCodeLine{737 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{738     g\%areaCv(i,j) = g\%dyCv(i,j) * g\%dx\_Cv(i,j)}
\DoxyCodeLine{739     g\%IareaCv(i,j) = 0.0}
\DoxyCodeLine{740     \textcolor{keywordflow}{if} (g\%areaCv(i,j) > 0.0) g\%IareaCv(i,j) = g\%mask2dCv(i,j) / (g\%areaCv(i,j))}
\DoxyCodeLine{741 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{742 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a330014f05a823d5434ad0156d361b6ff}\label{namespacemom__shared__initialization_a330014f05a823d5434ad0156d361b6ff}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!set\_rotation\_beta\_plane@{set\_rotation\_beta\_plane}}
\index{set\_rotation\_beta\_plane@{set\_rotation\_beta\_plane}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{set\_rotation\_beta\_plane()}{set\_rotation\_beta\_plane()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::set\+\_\+rotation\+\_\+beta\+\_\+plane (\begin{DoxyParamCaption}\item[{real, dimension(g\%isdb\+:g\%iedb,g\%jsdb\+:g\%jedb), intent(out)}]{f,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(in)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



This subroutine sets up the Coriolis parameter for a beta-\/plane or f-\/plane. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The dynamic horizontal grid \\
\hline
\mbox{\texttt{ out}}  & {\em f} & Coriolis parameter (vertical component) \mbox{[}T-\/1 $\sim$$>$ s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 497 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{497   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{  !< The dynamic horizontal grid}}
\DoxyCodeLine{498 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%IsdB:G\%IedB,G\%JsdB:G\%JedB)}, \&}
\DoxyCodeLine{499                           \textcolor{keywordtype}{intent(out)} :: f\textcolor{comment}{  !< Coriolis parameter (vertical component) [T-\/1 \string~> s-\/1]}}
\DoxyCodeLine{500   \textcolor{keywordtype}{type}(param\_file\_type),  \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-\/time parameters}}
\DoxyCodeLine{501   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{502 }
\DoxyCodeLine{503 \textcolor{comment}{! This subroutine sets up the Coriolis parameter for a beta-\/plane}}
\DoxyCodeLine{504   \textcolor{keywordtype}{integer} :: I, J}
\DoxyCodeLine{505 \textcolor{keywordtype}{  real}    :: f\_0    \textcolor{comment}{! The reference value of the Coriolis parameter [T-\/1 \string~> s-\/1]}}
\DoxyCodeLine{506 \textcolor{keywordtype}{  real}    :: beta   \textcolor{comment}{! The meridional gradient of the Coriolis parameter [T-\/1 m-\/1 \string~> s-\/1 m-\/1]}}
\DoxyCodeLine{507 \textcolor{keywordtype}{  real}    :: y\_scl, Rad\_Earth}
\DoxyCodeLine{508 \textcolor{keywordtype}{  real}    :: T\_to\_s \textcolor{comment}{! A time unit conversion factor}}
\DoxyCodeLine{509 \textcolor{keywordtype}{  real}    :: PI}
\DoxyCodeLine{510   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"set\_rotation\_beta\_plane"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{511   \textcolor{keywordtype}{character(len=200)} :: axis\_units}
\DoxyCodeLine{512 }
\DoxyCodeLine{513   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_shared\_initialization.F90"})}
\DoxyCodeLine{514 }
\DoxyCodeLine{515   t\_to\_s = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) t\_to\_s = us\%T\_to\_s}
\DoxyCodeLine{516 }
\DoxyCodeLine{517   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"F\_0"}, f\_0, \&}
\DoxyCodeLine{518                  \textcolor{stringliteral}{"The reference value of the Coriolis parameter with the "}//\&}
\DoxyCodeLine{519                  \textcolor{stringliteral}{"betaplane option."}, units=\textcolor{stringliteral}{"s-\/1"}, default=0.0, scale=t\_to\_s)}
\DoxyCodeLine{520   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"BETA"}, beta, \&}
\DoxyCodeLine{521                  \textcolor{stringliteral}{"The northward gradient of the Coriolis parameter with "}//\&}
\DoxyCodeLine{522                  \textcolor{stringliteral}{"the betaplane option."}, units=\textcolor{stringliteral}{"m-\/1 s-\/1"}, default=0.0, scale=t\_to\_s)}
\DoxyCodeLine{523   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"AXIS\_UNITS"}, axis\_units, default=\textcolor{stringliteral}{"degrees"})}
\DoxyCodeLine{524 }
\DoxyCodeLine{525   pi = 4.0*atan(1.0)}
\DoxyCodeLine{526   \textcolor{keywordflow}{select case} (axis\_units(1:1))}
\DoxyCodeLine{527     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"d"})}
\DoxyCodeLine{528       \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RAD\_EARTH"}, rad\_earth, \&}
\DoxyCodeLine{529                    \textcolor{stringliteral}{"The radius of the Earth."}, units=\textcolor{stringliteral}{"m"}, default=6.378e6)}
\DoxyCodeLine{530       y\_scl = rad\_earth/pi}
\DoxyCodeLine{531     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"k"}); y\_scl = 1.e3}
\DoxyCodeLine{532     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"m"}); y\_scl = 1.}
\DoxyCodeLine{533     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"c"}); y\_scl = 1.e-\/2}
\DoxyCodeLine{534 \textcolor{keywordflow}{    case default} ; \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{535       \textcolor{stringliteral}{" set\_rotation\_beta\_plane: unknown AXIS\_UNITS = "}//trim(axis\_units))}
\DoxyCodeLine{536 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{537 }
\DoxyCodeLine{538   \textcolor{keywordflow}{do} i=g\%IsdB,g\%IedB ; \textcolor{keywordflow}{do} j=g\%JsdB,g\%JedB}
\DoxyCodeLine{539     f(i,j) = f\_0 + beta * ( g\%geoLatBu(i,j) * y\_scl )}
\DoxyCodeLine{540 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{541 }
\DoxyCodeLine{542   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a6aa6b883534fee4616137b7174414b8e}\label{namespacemom__shared__initialization_a6aa6b883534fee4616137b7174414b8e}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!set\_rotation\_planetary@{set\_rotation\_planetary}}
\index{set\_rotation\_planetary@{set\_rotation\_planetary}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{set\_rotation\_planetary()}{set\_rotation\_planetary()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::set\+\_\+rotation\+\_\+planetary (\begin{DoxyParamCaption}\item[{real, dimension(g\%isdb\+:g\%iedb,g\%jsdb\+:g\%jedb), intent(out)}]{f,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(in)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



This subroutine sets up the Coriolis parameter for a sphere. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The dynamic horizontal grid \\
\hline
\mbox{\texttt{ out}}  & {\em f} & Coriolis parameter (vertical component) \mbox{[}T-\/1 $\sim$$>$ s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 464 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{464   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{  !< The dynamic horizontal grid}}
\DoxyCodeLine{465 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%IsdB:G\%IedB,G\%JsdB:G\%JedB)}, \&}
\DoxyCodeLine{466                           \textcolor{keywordtype}{intent(out)} :: f\textcolor{comment}{  !< Coriolis parameter (vertical component) [T-\/1 \string~> s-\/1]}}
\DoxyCodeLine{467   \textcolor{keywordtype}{type}(param\_file\_type),  \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-\/time parameters}}
\DoxyCodeLine{468   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{469 }
\DoxyCodeLine{470 \textcolor{comment}{! This subroutine sets up the Coriolis parameter for a sphere}}
\DoxyCodeLine{471   \textcolor{keywordtype}{character(len=30)} :: mdl = \textcolor{stringliteral}{"set\_rotation\_planetary"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{472   \textcolor{keywordtype}{integer} :: I, J}
\DoxyCodeLine{473 \textcolor{keywordtype}{  real}    :: PI}
\DoxyCodeLine{474 \textcolor{keywordtype}{  real}    :: omega  \textcolor{comment}{! The planetary rotation rate [T-\/1 \string~> s-\/1]}}
\DoxyCodeLine{475 \textcolor{keywordtype}{  real}    :: T\_to\_s \textcolor{comment}{! A time unit conversion factor}}
\DoxyCodeLine{476 }
\DoxyCodeLine{477   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_shared\_initialization.F90"})}
\DoxyCodeLine{478 }
\DoxyCodeLine{479   t\_to\_s = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) t\_to\_s = us\%T\_to\_s}
\DoxyCodeLine{480 }
\DoxyCodeLine{481   \textcolor{keyword}{call }get\_param(param\_file, \textcolor{stringliteral}{"set\_rotation\_planetary"}, \textcolor{stringliteral}{"OMEGA"}, omega, \&}
\DoxyCodeLine{482                  \textcolor{stringliteral}{"The rotation rate of the earth."}, units=\textcolor{stringliteral}{"s-\/1"}, \&}
\DoxyCodeLine{483                  default=7.2921e-\/5, scale=t\_to\_s)}
\DoxyCodeLine{484   pi = 4.0*atan(1.0)}
\DoxyCodeLine{485 }
\DoxyCodeLine{486   \textcolor{keywordflow}{do} i=g\%IsdB,g\%IedB ; \textcolor{keywordflow}{do} j=g\%JsdB,g\%JedB}
\DoxyCodeLine{487     f(i,j) = ( 2.0 * omega ) * sin( ( pi * g\%geoLatBu(i,j) ) / 180.)}
\DoxyCodeLine{488 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{489 }
\DoxyCodeLine{490   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_ab4e226886998bcc8a43011bd8ed4dd29}\label{namespacemom__shared__initialization_ab4e226886998bcc8a43011bd8ed4dd29}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!set\_velocity\_depth\_max@{set\_velocity\_depth\_max}}
\index{set\_velocity\_depth\_max@{set\_velocity\_depth\_max}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{set\_velocity\_depth\_max()}{set\_velocity\_depth\_max()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::set\+\_\+velocity\+\_\+depth\+\_\+max (\begin{DoxyParamCaption}\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(inout)}]{G }\end{DoxyParamCaption})}



Set the bathymetry at velocity points to be the maximum of the depths at the neighoring tracer points. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The dynamic horizontal grid \\
\hline
\end{DoxyParams}


Definition at line 1109 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1109   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{   !< The dynamic horizontal grid}}
\DoxyCodeLine{1110   \textcolor{comment}{! This subroutine sets the 4 bottom depths at velocity points to be the}}
\DoxyCodeLine{1111   \textcolor{comment}{! maximum of the adjacent depths.}}
\DoxyCodeLine{1112   \textcolor{keywordtype}{integer} :: i, j}
\DoxyCodeLine{1113 }
\DoxyCodeLine{1114   \textcolor{keywordflow}{do} i=g\%isd,g\%ied-\/1 ; \textcolor{keywordflow}{do} j=g\%jsd,g\%jed}
\DoxyCodeLine{1115     g\%Dblock\_u(i,j) = g\%mask2dCu(i,j) * max(g\%bathyT(i,j), g\%bathyT(i+1,j))}
\DoxyCodeLine{1116     g\%Dopen\_u(i,j) = g\%Dblock\_u(i,j)}
\DoxyCodeLine{1117 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1118   \textcolor{keywordflow}{do} i=g\%isd,g\%ied ; \textcolor{keywordflow}{do} j=g\%jsd,g\%jed-\/1}
\DoxyCodeLine{1119     g\%Dblock\_v(i,j) = g\%mask2dCv(i,j) * max(g\%bathyT(i,j), g\%bathyT(i,j+1))}
\DoxyCodeLine{1120     g\%Dopen\_v(i,j) = g\%Dblock\_v(i,j)}
\DoxyCodeLine{1121 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a4db4d57d710d61a5e910b437f9ab1455}\label{namespacemom__shared__initialization_a4db4d57d710d61a5e910b437f9ab1455}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!set\_velocity\_depth\_min@{set\_velocity\_depth\_min}}
\index{set\_velocity\_depth\_min@{set\_velocity\_depth\_min}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{set\_velocity\_depth\_min()}{set\_velocity\_depth\_min()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::set\+\_\+velocity\+\_\+depth\+\_\+min (\begin{DoxyParamCaption}\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(inout)}]{G }\end{DoxyParamCaption})}



Set the bathymetry at velocity points to be the minimum of the depths at the neighoring tracer points. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The dynamic horizontal grid \\
\hline
\end{DoxyParams}


Definition at line 1129 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1129   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{  !< The dynamic horizontal grid}}
\DoxyCodeLine{1130   \textcolor{comment}{! This subroutine sets the 4 bottom depths at velocity points to be the}}
\DoxyCodeLine{1131   \textcolor{comment}{! minimum of the adjacent depths.}}
\DoxyCodeLine{1132   \textcolor{keywordtype}{integer} :: i, j}
\DoxyCodeLine{1133 }
\DoxyCodeLine{1134   \textcolor{keywordflow}{do} i=g\%isd,g\%ied-\/1 ; \textcolor{keywordflow}{do} j=g\%jsd,g\%jed}
\DoxyCodeLine{1135     g\%Dblock\_u(i,j) = g\%mask2dCu(i,j) * min(g\%bathyT(i,j), g\%bathyT(i+1,j))}
\DoxyCodeLine{1136     g\%Dopen\_u(i,j) = g\%Dblock\_u(i,j)}
\DoxyCodeLine{1137 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1138   \textcolor{keywordflow}{do} i=g\%isd,g\%ied ; \textcolor{keywordflow}{do} j=g\%jsd,g\%jed-\/1}
\DoxyCodeLine{1139     g\%Dblock\_v(i,j) = g\%mask2dCv(i,j) * min(g\%bathyT(i,j), g\%bathyT(i,j+1))}
\DoxyCodeLine{1140     g\%Dopen\_v(i,j) = g\%Dblock\_v(i,j)}
\DoxyCodeLine{1141 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__shared__initialization_a4375db47a43535f8f2eecd5992a788ea}\label{namespacemom__shared__initialization_a4375db47a43535f8f2eecd5992a788ea}} 
\index{mom\_shared\_initialization@{mom\_shared\_initialization}!write\_ocean\_geometry\_file@{write\_ocean\_geometry\_file}}
\index{write\_ocean\_geometry\_file@{write\_ocean\_geometry\_file}!mom\_shared\_initialization@{mom\_shared\_initialization}}
\doxysubsubsection{\texorpdfstring{write\_ocean\_geometry\_file()}{write\_ocean\_geometry\_file()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+shared\+\_\+initialization\+::write\+\_\+ocean\+\_\+geometry\+\_\+file (\begin{DoxyParamCaption}\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(inout)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{character(len=$\ast$), intent(in)}]{directory,  }\item[{character(len=$\ast$), intent(in), optional}]{geom\+\_\+file,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



Write out a file describing the topography, Coriolis parameter, grid locations and various other fixed fields from the grid. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The dynamic horizontal grid \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
\mbox{\texttt{ in}}  & {\em directory} & The directory into which to place the geometry file. \\
\hline
\mbox{\texttt{ in}}  & {\em geom\+\_\+file} & If present, the name of the geometry file (otherwise the file is \char`\"{}ocean\+\_\+geometry\char`\"{}) \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 1178 of file M\+O\+M\+\_\+shared\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1178   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),       \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{         !< The dynamic horizontal grid}}
\DoxyCodeLine{1179   \textcolor{keywordtype}{type}(param\_file\_type),        \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{1180   \textcolor{keywordtype}{character(len=*)},             \textcolor{keywordtype}{intent(in)}    :: directory\textcolor{comment}{ !< The directory into which to place the geometry file.}}
\DoxyCodeLine{1181   \textcolor{keywordtype}{character(len=*)},   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: geom\_file\textcolor{comment}{ !< If present, the name of the geometry file}}
\DoxyCodeLine{1182 \textcolor{comment}{                                                           !! (otherwise the file is "ocean\_geometry")}}
\DoxyCodeLine{1183   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{        !< A dimensional unit scaling type}}
\DoxyCodeLine{1184 }
\DoxyCodeLine{1185   \textcolor{comment}{! Local variables.}}
\DoxyCodeLine{1186   \textcolor{keywordtype}{character(len=240)} :: filepath}
\DoxyCodeLine{1187   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"write\_ocean\_geometry\_file"}}
\DoxyCodeLine{1188   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{parameter} :: nFlds=23}
\DoxyCodeLine{1189   \textcolor{keywordtype}{type}(vardesc) :: vars(nFlds)}
\DoxyCodeLine{1190   \textcolor{keywordtype}{type}(fieldtype) :: fields(nFlds)}
\DoxyCodeLine{1191 \textcolor{keywordtype}{  real} :: Z\_to\_m\_scale \textcolor{comment}{! A unit conversion factor from Z to m.}}
\DoxyCodeLine{1192 \textcolor{keywordtype}{  real} :: s\_to\_T\_scale \textcolor{comment}{! A unit conversion factor from T-\/1 to s-\/1.}}
\DoxyCodeLine{1193 \textcolor{keywordtype}{  real} :: L\_to\_m\_scale \textcolor{comment}{! A unit conversion factor from L to m.}}
\DoxyCodeLine{1194   \textcolor{keywordtype}{integer} :: unit}
\DoxyCodeLine{1195   \textcolor{keywordtype}{integer} :: file\_threading}
\DoxyCodeLine{1196   \textcolor{keywordtype}{integer} :: nFlds\_used}
\DoxyCodeLine{1197   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, Isq, Ieq, Jsq, Jeq}
\DoxyCodeLine{1198   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{1199   \textcolor{keywordtype}{logical} :: multiple\_files}
\DoxyCodeLine{1200 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd :G\%ied ,G\%jsd :G\%jed )} :: out\_h}
\DoxyCodeLine{1201 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%IsdB:G\%IedB,G\%JsdB:G\%JedB)} :: out\_q}
\DoxyCodeLine{1202 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%IsdB:G\%IedB,G\%jsd :G\%jed )} :: out\_u}
\DoxyCodeLine{1203 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd :G\%ied ,G\%JsdB:G\%JedB)} :: out\_v}
\DoxyCodeLine{1204 }
\DoxyCodeLine{1205   \textcolor{keyword}{call }calltree\_enter(\textcolor{stringliteral}{'write\_ocean\_geometry\_file()'})}
\DoxyCodeLine{1206 }
\DoxyCodeLine{1207   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{1208   isq = g\%IscB ; ieq = g\%IecB ; jsq = g\%JscB ; jeq = g\%JecB}
\DoxyCodeLine{1209   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{1210   isdb = g\%IsdB ; iedb = g\%IedB ; jsdb = g\%JsdB ; jedb = g\%JedB}
\DoxyCodeLine{1211 }
\DoxyCodeLine{1212   z\_to\_m\_scale = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) z\_to\_m\_scale = us\%Z\_to\_m}
\DoxyCodeLine{1213   s\_to\_t\_scale = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) s\_to\_t\_scale = us\%s\_to\_T}
\DoxyCodeLine{1214   l\_to\_m\_scale = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) l\_to\_m\_scale = us\%L\_to\_m}
\DoxyCodeLine{1215 }
\DoxyCodeLine{1216 \textcolor{comment}{!   vardesc is a structure defined in MOM\_io.F90.  The elements of}}
\DoxyCodeLine{1217 \textcolor{comment}{! this structure, in order, are:}}
\DoxyCodeLine{1218 \textcolor{comment}{! (1) the variable name for the NetCDF file}}
\DoxyCodeLine{1219 \textcolor{comment}{! (2) the variable's long name}}
\DoxyCodeLine{1220 \textcolor{comment}{! (3) a character indicating the  horizontal grid, which may be '1' (column),}}
\DoxyCodeLine{1221 \textcolor{comment}{!     'h', 'q', 'u', or 'v', for the corresponding C-\/grid variable}}
\DoxyCodeLine{1222 \textcolor{comment}{! (4) a character indicating the vertical grid, which may be 'L' (layer),}}
\DoxyCodeLine{1223 \textcolor{comment}{!     'i' (interface), or '1' (no vertical location)}}
\DoxyCodeLine{1224 \textcolor{comment}{! (5) a character indicating the time levels of the field, which may be}}
\DoxyCodeLine{1225 \textcolor{comment}{!    's' (snap-\/shot), 'p' (periodic), or '1' (no time variation)}}
\DoxyCodeLine{1226 \textcolor{comment}{! (6) the variable's units}}
\DoxyCodeLine{1227   vars(1) = var\_desc(\textcolor{stringliteral}{"geolatb"},\textcolor{stringliteral}{"degree"},\textcolor{stringliteral}{"latitude at corner (Bu) points"},\textcolor{stringliteral}{'q'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1228   vars(2) = var\_desc(\textcolor{stringliteral}{"geolonb"},\textcolor{stringliteral}{"degree"},\textcolor{stringliteral}{"longitude at corner (Bu) points"},\textcolor{stringliteral}{'q'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1229   vars(3) = var\_desc(\textcolor{stringliteral}{"geolat"},\textcolor{stringliteral}{"degree"}, \textcolor{stringliteral}{"latitude at tracer (T) points"}, \textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1230   vars(4) = var\_desc(\textcolor{stringliteral}{"geolon"},\textcolor{stringliteral}{"degree"},\textcolor{stringliteral}{"longitude at tracer (T) points"},\textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1231   vars(5) = var\_desc(\textcolor{stringliteral}{"D"},\textcolor{stringliteral}{"meter"},\textcolor{stringliteral}{"Basin Depth"},\textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1232   vars(6) = var\_desc(\textcolor{stringliteral}{"f"},\textcolor{stringliteral}{"s-\/1"},\textcolor{stringliteral}{"Coriolis Parameter"},\textcolor{stringliteral}{'q'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1233   vars(7) = var\_desc(\textcolor{stringliteral}{"dxCv"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Zonal grid spacing at v points"},\textcolor{stringliteral}{'v'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1234   vars(8) = var\_desc(\textcolor{stringliteral}{"dyCu"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Meridional grid spacing at u points"},\textcolor{stringliteral}{'u'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1235   vars(9) = var\_desc(\textcolor{stringliteral}{"dxCu"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Zonal grid spacing at u points"},\textcolor{stringliteral}{'u'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1236   vars(10)= var\_desc(\textcolor{stringliteral}{"dyCv"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Meridional grid spacing at v points"},\textcolor{stringliteral}{'v'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1237   vars(11)= var\_desc(\textcolor{stringliteral}{"dxT"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Zonal grid spacing at h points"},\textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1238   vars(12)= var\_desc(\textcolor{stringliteral}{"dyT"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Meridional grid spacing at h points"},\textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1239   vars(13)= var\_desc(\textcolor{stringliteral}{"dxBu"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Zonal grid spacing at q points"},\textcolor{stringliteral}{'q'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1240   vars(14)= var\_desc(\textcolor{stringliteral}{"dyBu"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Meridional grid spacing at q points"},\textcolor{stringliteral}{'q'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1241   vars(15)= var\_desc(\textcolor{stringliteral}{"Ah"},\textcolor{stringliteral}{"m2"},\textcolor{stringliteral}{"Area of h cells"},\textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1242   vars(16)= var\_desc(\textcolor{stringliteral}{"Aq"},\textcolor{stringliteral}{"m2"},\textcolor{stringliteral}{"Area of q cells"},\textcolor{stringliteral}{'q'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1243 }
\DoxyCodeLine{1244   vars(17)= var\_desc(\textcolor{stringliteral}{"dxCvo"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Open zonal grid spacing at v points"},\textcolor{stringliteral}{'v'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1245   vars(18)= var\_desc(\textcolor{stringliteral}{"dyCuo"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Open meridional grid spacing at u points"},\textcolor{stringliteral}{'u'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1246   vars(19)= var\_desc(\textcolor{stringliteral}{"wet"}, \textcolor{stringliteral}{"nondim"}, \textcolor{stringliteral}{"land or ocean?"}, \textcolor{stringliteral}{'h'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1247 }
\DoxyCodeLine{1248   vars(20) = var\_desc(\textcolor{stringliteral}{"Dblock\_u"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Blocked depth at u points"},\textcolor{stringliteral}{'u'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1249   vars(21) = var\_desc(\textcolor{stringliteral}{"Dopen\_u"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Open depth at u points"},\textcolor{stringliteral}{'u'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1250   vars(22) = var\_desc(\textcolor{stringliteral}{"Dblock\_v"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Blocked depth at v points"},\textcolor{stringliteral}{'v'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1251   vars(23) = var\_desc(\textcolor{stringliteral}{"Dopen\_v"},\textcolor{stringliteral}{"m"},\textcolor{stringliteral}{"Open depth at v points"},\textcolor{stringliteral}{'v'},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'1'})}
\DoxyCodeLine{1252 }
\DoxyCodeLine{1253 }
\DoxyCodeLine{1254   nflds\_used = 19 ; \textcolor{keywordflow}{if} (g\%bathymetry\_at\_vel) nflds\_used = 23}
\DoxyCodeLine{1255 }
\DoxyCodeLine{1256   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(geom\_file)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1257     filepath = trim(directory) // trim(geom\_file)}
\DoxyCodeLine{1258   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1259     filepath = trim(directory) // \textcolor{stringliteral}{"ocean\_geometry"}}
\DoxyCodeLine{1260 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1261 }
\DoxyCodeLine{1262   out\_h(:,:) = 0.0}
\DoxyCodeLine{1263   out\_u(:,:) = 0.0}
\DoxyCodeLine{1264   out\_v(:,:) = 0.0}
\DoxyCodeLine{1265   out\_q(:,:) = 0.0}
\DoxyCodeLine{1266 }
\DoxyCodeLine{1267   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"PARALLEL\_RESTARTFILES"}, multiple\_files, \&}
\DoxyCodeLine{1268                  \textcolor{stringliteral}{"If true, each processor writes its own restart file, "}//\&}
\DoxyCodeLine{1269                  \textcolor{stringliteral}{"otherwise a single restart file is generated"}, \&}
\DoxyCodeLine{1270                  default=.false.)}
\DoxyCodeLine{1271   file\_threading = single\_file}
\DoxyCodeLine{1272   \textcolor{keywordflow}{if} (multiple\_files) file\_threading = multiple}
\DoxyCodeLine{1273 }
\DoxyCodeLine{1274   \textcolor{keyword}{call }create\_file(unit, trim(filepath), vars, nflds\_used, fields, \&}
\DoxyCodeLine{1275                    file\_threading, dg=g)}
\DoxyCodeLine{1276 }
\DoxyCodeLine{1277   \textcolor{keywordflow}{do} j=jsq,jeq; \textcolor{keywordflow}{do} i=isq,ieq; out\_q(i,j) = g\%geoLatBu(i,j);\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1278   \textcolor{keyword}{call }write\_field(unit, fields(1), g\%Domain\%mpp\_domain, out\_q)}
\DoxyCodeLine{1279   \textcolor{keywordflow}{do} j=jsq,jeq; \textcolor{keywordflow}{do} i=isq,ieq; out\_q(i,j) = g\%geoLonBu(i,j);\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1280   \textcolor{keyword}{call }write\_field(unit, fields(2), g\%Domain\%mpp\_domain, out\_q)}
\DoxyCodeLine{1281   \textcolor{keyword}{call }write\_field(unit, fields(3), g\%Domain\%mpp\_domain, g\%geoLatT)}
\DoxyCodeLine{1282   \textcolor{keyword}{call }write\_field(unit, fields(4), g\%Domain\%mpp\_domain, g\%geoLonT)}
\DoxyCodeLine{1283 }
\DoxyCodeLine{1284   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; out\_h(i,j) = z\_to\_m\_scale*g\%bathyT(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1285   \textcolor{keyword}{call }write\_field(unit, fields(5), g\%Domain\%mpp\_domain, out\_h)}
\DoxyCodeLine{1286   \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=isq,ieq ; out\_q(i,j) = s\_to\_t\_scale*g\%CoriolisBu(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1287   \textcolor{keyword}{call }write\_field(unit, fields(6), g\%Domain\%mpp\_domain, out\_q)}
\DoxyCodeLine{1288 }
\DoxyCodeLine{1289   \textcolor{comment}{!   I think that all of these copies are holdovers from a much earlier}}
\DoxyCodeLine{1290   \textcolor{comment}{! ancestor code in which many of the metrics were macros that could have}}
\DoxyCodeLine{1291   \textcolor{comment}{! had reduced dimensions, and that they are no longer needed in MOM6. -\/RWH}}
\DoxyCodeLine{1292   \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie ; out\_v(i,j) = l\_to\_m\_scale*g\%dxCv(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1293   \textcolor{keyword}{call }write\_field(unit, fields(7), g\%Domain\%mpp\_domain, out\_v)}
\DoxyCodeLine{1294   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq ; out\_u(i,j) = l\_to\_m\_scale*g\%dyCu(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1295   \textcolor{keyword}{call }write\_field(unit, fields(8), g\%Domain\%mpp\_domain, out\_u)}
\DoxyCodeLine{1296 }
\DoxyCodeLine{1297   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq ; out\_u(i,j) = l\_to\_m\_scale*g\%dxCu(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1298   \textcolor{keyword}{call }write\_field(unit, fields(9), g\%Domain\%mpp\_domain, out\_u)}
\DoxyCodeLine{1299   \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie ; out\_v(i,j) = l\_to\_m\_scale*g\%dyCv(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1300   \textcolor{keyword}{call }write\_field(unit, fields(10), g\%Domain\%mpp\_domain, out\_v)}
\DoxyCodeLine{1301 }
\DoxyCodeLine{1302   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; out\_h(i,j) = l\_to\_m\_scale*g\%dxT(i,j);\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1303   \textcolor{keyword}{call }write\_field(unit, fields(11), g\%Domain\%mpp\_domain, out\_h)}
\DoxyCodeLine{1304   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; out\_h(i,j) = l\_to\_m\_scale*g\%dyT(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1305   \textcolor{keyword}{call }write\_field(unit, fields(12), g\%Domain\%mpp\_domain, out\_h)}
\DoxyCodeLine{1306 }
\DoxyCodeLine{1307   \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=isq,ieq ; out\_q(i,j) = l\_to\_m\_scale*g\%dxBu(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1308   \textcolor{keyword}{call }write\_field(unit, fields(13), g\%Domain\%mpp\_domain, out\_q)}
\DoxyCodeLine{1309   \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=isq,ieq ; out\_q(i,j) = l\_to\_m\_scale*g\%dyBu(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1310   \textcolor{keyword}{call }write\_field(unit, fields(14), g\%Domain\%mpp\_domain, out\_q)}
\DoxyCodeLine{1311 }
\DoxyCodeLine{1312   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; out\_h(i,j) = g\%areaT(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1313   \textcolor{keyword}{call }write\_field(unit, fields(15), g\%Domain\%mpp\_domain, out\_h)}
\DoxyCodeLine{1314   \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=isq,ieq ; out\_q(i,j) = g\%areaBu(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1315   \textcolor{keyword}{call }write\_field(unit, fields(16), g\%Domain\%mpp\_domain, out\_q)}
\DoxyCodeLine{1316 }
\DoxyCodeLine{1317   \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie ; out\_v(i,j) = l\_to\_m\_scale*g\%dx\_Cv(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1318   \textcolor{keyword}{call }write\_field(unit, fields(17), g\%Domain\%mpp\_domain, out\_v)}
\DoxyCodeLine{1319   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq ; out\_u(i,j) = l\_to\_m\_scale*g\%dy\_Cu(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1320   \textcolor{keyword}{call }write\_field(unit, fields(18), g\%Domain\%mpp\_domain, out\_u)}
\DoxyCodeLine{1321   \textcolor{keyword}{call }write\_field(unit, fields(19), g\%Domain\%mpp\_domain, g\%mask2dT)}
\DoxyCodeLine{1322 }
\DoxyCodeLine{1323   \textcolor{keywordflow}{if} (g\%bathymetry\_at\_vel) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1324     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq ; out\_u(i,j) = z\_to\_m\_scale*g\%Dblock\_u(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1325     \textcolor{keyword}{call }write\_field(unit, fields(20), g\%Domain\%mpp\_domain, out\_u)}
\DoxyCodeLine{1326     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq ; out\_u(i,j) = z\_to\_m\_scale*g\%Dopen\_u(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1327     \textcolor{keyword}{call }write\_field(unit, fields(21), g\%Domain\%mpp\_domain, out\_u)}
\DoxyCodeLine{1328     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie ; out\_v(i,j) = z\_to\_m\_scale*g\%Dblock\_v(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1329     \textcolor{keyword}{call }write\_field(unit, fields(22), g\%Domain\%mpp\_domain, out\_v)}
\DoxyCodeLine{1330     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie ; out\_v(i,j) = z\_to\_m\_scale*g\%Dopen\_v(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1331     \textcolor{keyword}{call }write\_field(unit, fields(23), g\%Domain\%mpp\_domain, out\_v)}
\DoxyCodeLine{1332 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1333 }
\DoxyCodeLine{1334   \textcolor{keyword}{call }close\_file(unit)}
\DoxyCodeLine{1335 }
\DoxyCodeLine{1336   \textcolor{keyword}{call }calltree\_leave(\textcolor{stringliteral}{'write\_ocean\_geometry\_file()'})}

\end{DoxyCode}
