\hypertarget{namespacemom__coord__initialization}{}\section{mom\+\_\+coord\+\_\+initialization Module Reference}
\label{namespacemom__coord__initialization}\index{mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}}


\subsection{Detailed Description}
Initializes fixed aspects of the related to its vertical coordinate. \subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__coord__initialization_a08150041e51696069c49248793248c77}{mom\+\_\+initialize\+\_\+coord}} (GV, US, PF, write\+\_\+geom, output\+\_\+dir, tv, max\+\_\+depth)
\begin{DoxyCompactList}\small\item\em M\+O\+M\+\_\+initialize\+\_\+coord sets up time-\/invariant quantities related to M\+O\+M6\textquotesingle{}s vertical coordinate. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__coord__initialization_a0fb7238fdddaa390ba05616d5c719304}{set\+\_\+coord\+\_\+from\+\_\+gprime}} (Rlay, g\+\_\+prime, GV, US, param\+\_\+file)
\begin{DoxyCompactList}\small\item\em Sets the layer densities (Rlay) and the interface reduced gravities (g). \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__coord__initialization_a516787d58e9ed5036b5093afcad12a5d}{set\+\_\+coord\+\_\+from\+\_\+layer\+\_\+density}} (Rlay, g\+\_\+prime, GV, US, param\+\_\+file)
\begin{DoxyCompactList}\small\item\em Sets the layer densities (Rlay) and the interface reduced gravities (g). \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__coord__initialization_ad01a90ddd579883d7be3795703b13c93}{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+ref}} (Rlay, g\+\_\+prime, GV, US, param\+\_\+file, eqn\+\_\+of\+\_\+state, P\+\_\+\+Ref)
\begin{DoxyCompactList}\small\item\em Sets the layer densities (Rlay) and the interface reduced gravities (g) from a profile of g\textquotesingle{}. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__coord__initialization_ab8bc8326f34ac58a6299e469bca20268}{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+profile}} (Rlay, g\+\_\+prime, GV, US, param\+\_\+file, eqn\+\_\+of\+\_\+state, P\+\_\+\+Ref)
\begin{DoxyCompactList}\small\item\em Sets the layer densities (Rlay) and the interface reduced gravities (g) from a T-\/S profile. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__coord__initialization_ae66d4537aa49c517b7f575762deb25bf}{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+range}} (Rlay, g\+\_\+prime, GV, US, param\+\_\+file, eqn\+\_\+of\+\_\+state, P\+\_\+\+Ref)
\begin{DoxyCompactList}\small\item\em Sets the layer densities (Rlay) and the interface reduced gravities (g) from a linear T-\/S profile. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__coord__initialization_ac3e54de3cb5255fc13fc3318a5636f5a}{set\+\_\+coord\+\_\+from\+\_\+file}} (Rlay, g\+\_\+prime, GV, US, param\+\_\+file)
\item 
subroutine \mbox{\hyperlink{namespacemom__coord__initialization_a0cf7c5ab79446898b961e227eabc724b}{set\+\_\+coord\+\_\+linear}} (Rlay, g\+\_\+prime, GV, US, param\+\_\+file)
\begin{DoxyCompactList}\small\item\em Sets the layer densities (Rlay) and the interface reduced gravities (g) according to a linear profile starting at a reference surface layer density and spanning a range of densities to the bottom defined by the parameter R\+L\+A\+Y\+\_\+\+R\+A\+N\+GE (defaulting to 2.\+0 if not defined) \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__coord__initialization_a4b03f15c6e6f4f3b45144ba03f515d74}{set\+\_\+coord\+\_\+to\+\_\+none}} (Rlay, g\+\_\+prime, GV, US, param\+\_\+file)
\begin{DoxyCompactList}\small\item\em Sets Rlay to Rho0 and g\+\_\+prime to zero except for the free surface. This is for use only in A\+LE mode where Rlay should not be used and g\+\_\+prime(1) alone might be used. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__coord__initialization_adcabf6100c5e5daa4919fa1e3f62c7a7}{write\+\_\+vertgrid\+\_\+file}} (GV, US, param\+\_\+file, directory)
\begin{DoxyCompactList}\small\item\em Writes out a file containing any available data related to the vertical grid used by the M\+OM ocean model. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacemom__coord__initialization_a195e9d47a1315dba24c1a5b50145b85c}\label{namespacemom__coord__initialization_a195e9d47a1315dba24c1a5b50145b85c}} 
character(len=40) \mbox{\hyperlink{namespacemom__coord__initialization_a195e9d47a1315dba24c1a5b50145b85c}{mdl}} = \char`\"{}M\+O\+M\+\_\+coord\+\_\+initialization\char`\"{}
\begin{DoxyCompactList}\small\item\em This module\textquotesingle{}s name. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__coord__initialization_a08150041e51696069c49248793248c77}\label{namespacemom__coord__initialization_a08150041e51696069c49248793248c77}} 
\index{mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}!mom\+\_\+initialize\+\_\+coord@{mom\+\_\+initialize\+\_\+coord}}
\index{mom\+\_\+initialize\+\_\+coord@{mom\+\_\+initialize\+\_\+coord}!mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}}
\subsubsection{\texorpdfstring{mom\+\_\+initialize\+\_\+coord()}{mom\_initialize\_coord()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+coord\+\_\+initialization\+::mom\+\_\+initialize\+\_\+coord (\begin{DoxyParamCaption}\item[{type(verticalgrid\+\_\+type), intent(inout)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{PF,  }\item[{logical, intent(in)}]{write\+\_\+geom,  }\item[{character(len=$\ast$), intent(in)}]{output\+\_\+dir,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(inout)}]{tv,  }\item[{real, intent(in)}]{max\+\_\+depth }\end{DoxyParamCaption})}



M\+O\+M\+\_\+initialize\+\_\+coord sets up time-\/invariant quantities related to M\+O\+M6\textquotesingle{}s vertical coordinate. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in,out}  & {\em gv} & Ocean vertical grid structure.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em pf} & A structure indicating the open file to parse for model parameter values.\\
\hline
\mbox{\tt in}  & {\em write\+\_\+geom} & If true, write grid geometry files.\\
\hline
\mbox{\tt in}  & {\em output\+\_\+dir} & The directory into which to write files.\\
\hline
\mbox{\tt in,out}  & {\em tv} & The thermodynamic variable structure.\\
\hline
\mbox{\tt in}  & {\em max\+\_\+depth} & The ocean\textquotesingle{}s maximum depth \mbox{[}Z $\sim$$>$ m\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 40 of file M\+O\+M\+\_\+coord\+\_\+initialization.\+F90.


\begin{DoxyCode}
40   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(inout)} :: GV\textcolor{comment}{         !< Ocean vertical grid structure.}
41   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{         !< A dimensional unit scaling type}
42   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}    :: PF\textcolor{comment}{         !< A structure indicating the open file}
43 \textcolor{comment}{                                                       !! to parse for model parameter values.}
44   \textcolor{keywordtype}{logical},                 \textcolor{keywordtype}{intent(in)}    :: write\_geom\textcolor{comment}{ !< If true, write grid geometry files.}
45   \textcolor{keywordtype}{character(len=*)},        \textcolor{keywordtype}{intent(in)}    :: output\_dir\textcolor{comment}{ !< The directory into which to write files.}
46   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),   \textcolor{keywordtype}{intent(inout)} :: tv\textcolor{comment}{         !< The thermodynamic variable structure.}
47   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(in)}    :: max\_depth\textcolor{comment}{  !< The ocean's maximum depth [Z ~> m].}
48   \textcolor{comment}{! Local}
49   \textcolor{keywordtype}{character(len=200)} :: config
50   \textcolor{keywordtype}{logical} :: debug
51 \textcolor{comment}{! This include declares and sets the variable "version".}
52 \textcolor{preprocessor}{#include "version\_variable.h"}
53 \textcolor{preprocessor}{}  \textcolor{keywordtype}{integer} :: nz
54   \textcolor{keywordtype}{type}(EOS\_type), \textcolor{keywordtype}{pointer} :: eos => null()
55 
56   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv%eqn\_of\_state)) eos => tv%eqn\_of\_state
57 
58   nz = gv%ke
59 
60   \textcolor{keyword}{call }calltree\_enter(\textcolor{stringliteral}{"MOM\_initialize\_coord(), MOM\_coord\_initialization.F90"})
61   \textcolor{keyword}{call }log\_version(pf, mdl, version, \textcolor{stringliteral}{""})
62   \textcolor{keyword}{call }get\_param(pf, mdl, \textcolor{stringliteral}{"DEBUG"}, debug, default=.false.)
63 
64 \textcolor{comment}{! Set-up the layer densities, GV%Rlay, and reduced gravities, GV%g\_prime.}
65   \textcolor{keyword}{call }get\_param(pf, mdl, \textcolor{stringliteral}{"COORD\_CONFIG"}, config, &
66                  \textcolor{stringliteral}{"This specifies how layers are to be defined: \(\backslash\)n"}//&
67                  \textcolor{stringliteral}{" \(\backslash\)t ALE or none - used to avoid defining layers in ALE mode \(\backslash\)n"}//&
68                  \textcolor{stringliteral}{" \(\backslash\)t file - read coordinate information from the file \(\backslash\)n"}//&
69                  \textcolor{stringliteral}{" \(\backslash\)t\(\backslash\)t specified by (COORD\_FILE).\(\backslash\)n"}//&
70                  \textcolor{stringliteral}{" \(\backslash\)t BFB - Custom coords for buoyancy-forced basin case \(\backslash\)n"}//&
71                  \textcolor{stringliteral}{" \(\backslash\)t\(\backslash\)t based on SST\_S, T\_BOT and DRHO\_DT.\(\backslash\)n"}//&
72                  \textcolor{stringliteral}{" \(\backslash\)t linear - linear based on interfaces not layers \(\backslash\)n"}//&
73                  \textcolor{stringliteral}{" \(\backslash\)t layer\_ref - linear based on layer densities \(\backslash\)n"}//&
74                  \textcolor{stringliteral}{" \(\backslash\)t ts\_ref - use reference temperature and salinity \(\backslash\)n"}//&
75                  \textcolor{stringliteral}{" \(\backslash\)t ts\_range - use range of temperature and salinity \(\backslash\)n"}//&
76                  \textcolor{stringliteral}{" \(\backslash\)t\(\backslash\)t (T\_REF and S\_REF) to determine surface density \(\backslash\)n"}//&
77                  \textcolor{stringliteral}{" \(\backslash\)t\(\backslash\)t and GINT calculate internal densities. \(\backslash\)n"}//&
78                  \textcolor{stringliteral}{" \(\backslash\)t gprime - use reference density (RHO\_0) for surface \(\backslash\)n"}//&
79                  \textcolor{stringliteral}{" \(\backslash\)t\(\backslash\)t density and GINT calculate internal densities. \(\backslash\)n"}//&
80                  \textcolor{stringliteral}{" \(\backslash\)t ts\_profile - use temperature and salinity profiles \(\backslash\)n"}//&
81                  \textcolor{stringliteral}{" \(\backslash\)t\(\backslash\)t (read from COORD\_FILE) to set layer densities. \(\backslash\)n"}//&
82                  \textcolor{stringliteral}{" \(\backslash\)t USER - call a user modified routine."}, &
83                  default=\textcolor{stringliteral}{"none"})
84   \textcolor{keywordflow}{select case} ( trim(config) )
85     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"gprime"})
86       \textcolor{keyword}{call }set\_coord\_from\_gprime(gv%Rlay, gv%g\_prime, gv, us, pf)
87     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"layer\_ref"})
88       \textcolor{keyword}{call }set\_coord\_from\_layer\_density(gv%Rlay, gv%g\_prime, gv, us, pf)
89     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"linear"})
90       \textcolor{keyword}{call }set\_coord\_linear(gv%Rlay, gv%g\_prime, gv, us, pf)
91     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"ts\_ref"})
92       \textcolor{keyword}{call }set\_coord\_from\_ts\_ref(gv%Rlay, gv%g\_prime, gv, us, pf, eos, tv%P\_Ref)
93     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"ts\_profile"})
94       \textcolor{keyword}{call }set\_coord\_from\_ts\_profile(gv%Rlay, gv%g\_prime, gv, us, pf, eos, tv%P\_Ref)
95     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"ts\_range"})
96       \textcolor{keyword}{call }set\_coord\_from\_ts\_range(gv%Rlay, gv%g\_prime, gv, us, pf, eos, tv%P\_Ref)
97     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"file"})
98       \textcolor{keyword}{call }set\_coord\_from\_file(gv%Rlay, gv%g\_prime, gv, us, pf)
99     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"USER"})
100       \textcolor{keyword}{call }user\_set\_coord(gv%Rlay, gv%g\_prime, gv, us, pf, eos)
101     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"BFB"})
102       \textcolor{keyword}{call }bfb\_set\_coord(gv%Rlay, gv%g\_prime, gv, us, pf, eos)
103     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"none"}, \textcolor{stringliteral}{"ALE"})
104       \textcolor{keyword}{call }set\_coord\_to\_none(gv%Rlay, gv%g\_prime, gv, us, pf)
105 \textcolor{keywordflow}{    case default} ; \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"MOM\_initialize\_coord: "}// &
106       \textcolor{stringliteral}{"Unrecognized coordinate setup"}//trim(config))
107 \textcolor{keywordflow}{  end select}
108   \textcolor{comment}{! There are nz+1 values of g\_prime because it is an interface field, but the value at the bottom}
109   \textcolor{comment}{! should not matter.  This is here just to avoid having an uninitialized value in some output.}
110   gv%g\_prime(nz+1) = 10.0*gv%g\_Earth
111 
112   \textcolor{keywordflow}{if} (debug) \textcolor{keyword}{call }chksum(us%R\_to\_kg\_m3*gv%Rlay(:), \textcolor{stringliteral}{"MOM\_initialize\_coord: Rlay "}, 1, nz)
113   \textcolor{keywordflow}{if} (debug) \textcolor{keyword}{call }chksum(us%m\_to\_Z*us%L\_to\_m**2*us%s\_to\_T**2*gv%g\_prime(:), \textcolor{stringliteral}{"MOM\_initialize\_coord: g\_prime
       "}, 1, nz)
114   \textcolor{keyword}{call }setverticalgridaxes( gv%Rlay, gv, scale=us%R\_to\_kg\_m3 )
115 
116 \textcolor{comment}{! Copy the maximum depth across from the input argument}
117   gv%max\_depth = max\_depth
118 
119 \textcolor{comment}{! Write out all of the grid data used by this run.}
120   \textcolor{keywordflow}{if} (write\_geom) \textcolor{keyword}{call }write\_vertgrid\_file(gv, us, pf, output\_dir)
121 
122   \textcolor{keyword}{call }calltree\_leave(\textcolor{stringliteral}{'MOM\_initialize\_coord()'})
123 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__coord__initialization_ac3e54de3cb5255fc13fc3318a5636f5a}\label{namespacemom__coord__initialization_ac3e54de3cb5255fc13fc3318a5636f5a}} 
\index{mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}!set\+\_\+coord\+\_\+from\+\_\+file@{set\+\_\+coord\+\_\+from\+\_\+file}}
\index{set\+\_\+coord\+\_\+from\+\_\+file@{set\+\_\+coord\+\_\+from\+\_\+file}!mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}}
\subsubsection{\texorpdfstring{set\+\_\+coord\+\_\+from\+\_\+file()}{set\_coord\_from\_file()}}
{\footnotesize\ttfamily subroutine mom\+\_\+coord\+\_\+initialization\+::set\+\_\+coord\+\_\+from\+\_\+file (\begin{DoxyParamCaption}\item[{real, dimension(gv\%ke), intent(out)}]{Rlay,  }\item[{real, dimension(gv\%ke+1), intent(out)}]{g\+\_\+prime,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt out}  & {\em rlay} & Layer potential density \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em g\+\_\+prime} & The reduced gravity at each interface \mbox{[}L2 Z-\/1 T-\/2 $\sim$$>$ m s-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\end{DoxyParams}


Definition at line 390 of file M\+O\+M\+\_\+coord\+\_\+initialization.\+F90.


\begin{DoxyCode}
390   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{      !< The ocean's vertical grid structure}
391   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke)},   \textcolor{keywordtype}{intent(out)} :: Rlay\textcolor{comment}{    !< Layer potential density [R ~> kg m-3].}
392   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke+1)}, \textcolor{keywordtype}{intent(out)} :: g\_prime\textcolor{comment}{ !< The reduced gravity at each}
393 \textcolor{comment}{                                                   !! interface [L2 Z-1 T-2 ~> m s-2].}
394   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{      !< A dimensional unit scaling type}
395   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
396 
397   \textcolor{comment}{! Local variables}
398   \textcolor{keywordtype}{real} :: g\_fs    \textcolor{comment}{! Reduced gravity across the free surface [L2 Z-1 T-2 ~> m s-2].}
399   \textcolor{keywordtype}{integer} :: k, nz
400   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"set\_coord\_from\_file"} \textcolor{comment}{! This subroutine's name.}
401   \textcolor{keywordtype}{character(len=40)}  :: coord\_var
402   \textcolor{keywordtype}{character(len=200)} :: filename,coord\_file,inputdir \textcolor{comment}{! Strings for file/path}
403   nz = gv%ke
404 
405   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_coord\_initialization.F90"})
406 
407   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GFS"}, g\_fs, &
408                  \textcolor{stringliteral}{"The reduced gravity at the free surface."}, units=\textcolor{stringliteral}{"m s-2"}, &
409                  default=gv%g\_Earth*us%L\_T\_to\_m\_s**2*us%m\_to\_Z, scale=us%m\_s\_to\_L\_T**2*us%Z\_to\_m)
410   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR"}, inputdir, default=\textcolor{stringliteral}{"."})
411   inputdir = slasher(inputdir)
412   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"COORD\_FILE"}, coord\_file, &
413                  \textcolor{stringliteral}{"The file from which the coordinate densities are read."}, &
414                  fail\_if\_missing=.true.)
415   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"COORD\_VAR"}, coord\_var, &
416                  \textcolor{stringliteral}{"The variable in COORD\_FILE that is to be used for the "}//&
417                  \textcolor{stringliteral}{"coordinate densities."}, default=\textcolor{stringliteral}{"Layer"})
418   filename = trim(inputdir)//trim(coord\_file)
419   \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR/COORD\_FILE"}, filename)
420   \textcolor{keywordflow}{if} (.not.file\_exists(filename)) \textcolor{keyword}{call }mom\_error(fatal, &
421       \textcolor{stringliteral}{" set\_coord\_from\_file: Unable to open "}//trim(filename))
422 
423   \textcolor{keyword}{call }read\_axis\_data(filename, coord\_var, rlay)
424   \textcolor{keywordflow}{do} k=1,nz ; rlay(k) = us%kg\_m3\_to\_R*rlay(k) ;\textcolor{keywordflow}{ enddo}
425   g\_prime(1) = g\_fs
426   \textcolor{keywordflow}{do} k=2,nz ; g\_prime(k) = (gv%g\_Earth/(gv%Rho0)) * (rlay(k) - rlay(k-1)) ;\textcolor{keywordflow}{ enddo}
427   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{if} (g\_prime(k) <= 0.0) \textcolor{keywordflow}{then}
428     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_initialization set\_coord\_from\_file: "}//&
429        \textcolor{stringliteral}{"Zero or negative g\_primes read from variable "}//\textcolor{stringliteral}{"Layer"}//\textcolor{stringliteral}{" in file "}//&
430        trim(filename))
431 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ enddo}
432 
433   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__coord__initialization_a0fb7238fdddaa390ba05616d5c719304}\label{namespacemom__coord__initialization_a0fb7238fdddaa390ba05616d5c719304}} 
\index{mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}!set\+\_\+coord\+\_\+from\+\_\+gprime@{set\+\_\+coord\+\_\+from\+\_\+gprime}}
\index{set\+\_\+coord\+\_\+from\+\_\+gprime@{set\+\_\+coord\+\_\+from\+\_\+gprime}!mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}}
\subsubsection{\texorpdfstring{set\+\_\+coord\+\_\+from\+\_\+gprime()}{set\_coord\_from\_gprime()}}
{\footnotesize\ttfamily subroutine mom\+\_\+coord\+\_\+initialization\+::set\+\_\+coord\+\_\+from\+\_\+gprime (\begin{DoxyParamCaption}\item[{real, dimension(gv\%ke), intent(out)}]{Rlay,  }\item[{real, dimension(gv\%ke+1), intent(out)}]{g\+\_\+prime,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Sets the layer densities (Rlay) and the interface reduced gravities (g). 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure.\\
\hline
\mbox{\tt out}  & {\em rlay} & The layers\textquotesingle{} target coordinate values (potential density) \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em g\+\_\+prime} & The reduced gravity across the interfaces \mbox{[}L2 Z-\/1 T-\/2 $\sim$$>$ m s-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\end{DoxyParams}


Definition at line 130 of file M\+O\+M\+\_\+coord\+\_\+initialization.\+F90.


\begin{DoxyCode}
130   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{         !< The ocean's vertical grid structure.}
131   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke)},   \textcolor{keywordtype}{intent(out)} :: Rlay\textcolor{comment}{       !< The layers' target coordinate values}
132 \textcolor{comment}{                                                      !! (potential density) [R ~> kg m-3].}
133   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke+1)}, \textcolor{keywordtype}{intent(out)} :: g\_prime\textcolor{comment}{    !< The reduced gravity across the interfaces}
134 \textcolor{comment}{                                                      !! [L2 Z-1 T-2 ~> m s-2].}
135   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{         !< A dimensional unit scaling type}
136   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
137   \textcolor{comment}{! Local variables}
138   \textcolor{keywordtype}{real} :: g\_int   \textcolor{comment}{! Reduced gravities across the internal interfaces [L2 Z-1 T-2 ~> m s-2].}
139   \textcolor{keywordtype}{real} :: g\_fs    \textcolor{comment}{! Reduced gravity across the free surface [L2 Z-1 T-2 ~> m s-2].}
140   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"set\_coord\_from\_gprime"} \textcolor{comment}{! This subroutine's name.}
141   \textcolor{keywordtype}{integer} :: k, nz
142   nz = gv%ke
143 
144   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_coord\_initialization.F90"})
145 
146   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GFS"} , g\_fs, &
147                  \textcolor{stringliteral}{"The reduced gravity at the free surface."}, units=\textcolor{stringliteral}{"m s-2"}, &
148                  default=gv%g\_Earth*us%L\_T\_to\_m\_s**2*us%m\_to\_Z, scale=us%m\_s\_to\_L\_T**2*us%Z\_to\_m)
149   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GINT"}, g\_int, &
150                  \textcolor{stringliteral}{"The reduced gravity across internal interfaces."}, &
151                  units=\textcolor{stringliteral}{"m s-2"}, fail\_if\_missing=.true., scale=us%m\_s\_to\_L\_T**2*us%Z\_to\_m)
152 
153   g\_prime(1) = g\_fs
154   \textcolor{keywordflow}{do} k=2,nz ; g\_prime(k) = g\_int ;\textcolor{keywordflow}{ enddo}
155   rlay(1) = gv%Rho0
156   \textcolor{keywordflow}{do} k=2,nz ; rlay(k) = rlay(k-1) + g\_prime(k)*(gv%Rho0/gv%g\_Earth) ;\textcolor{keywordflow}{ enddo}
157 
158   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})
159 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__coord__initialization_a516787d58e9ed5036b5093afcad12a5d}\label{namespacemom__coord__initialization_a516787d58e9ed5036b5093afcad12a5d}} 
\index{mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}!set\+\_\+coord\+\_\+from\+\_\+layer\+\_\+density@{set\+\_\+coord\+\_\+from\+\_\+layer\+\_\+density}}
\index{set\+\_\+coord\+\_\+from\+\_\+layer\+\_\+density@{set\+\_\+coord\+\_\+from\+\_\+layer\+\_\+density}!mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}}
\subsubsection{\texorpdfstring{set\+\_\+coord\+\_\+from\+\_\+layer\+\_\+density()}{set\_coord\_from\_layer\_density()}}
{\footnotesize\ttfamily subroutine mom\+\_\+coord\+\_\+initialization\+::set\+\_\+coord\+\_\+from\+\_\+layer\+\_\+density (\begin{DoxyParamCaption}\item[{real, dimension(gv\%ke), intent(out)}]{Rlay,  }\item[{real, dimension(gv\%ke+1), intent(out)}]{g\+\_\+prime,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Sets the layer densities (Rlay) and the interface reduced gravities (g). 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure.\\
\hline
\mbox{\tt out}  & {\em rlay} & The layers\textquotesingle{} target coordinate values (potential density) \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em g\+\_\+prime} & The reduced gravity across the interfaces \mbox{[}L2 Z-\/1 T-\/2 $\sim$$>$ m s-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\end{DoxyParams}


Definition at line 164 of file M\+O\+M\+\_\+coord\+\_\+initialization.\+F90.


\begin{DoxyCode}
164   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{         !< The ocean's vertical grid structure.}
165   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke)},   \textcolor{keywordtype}{intent(out)} :: Rlay\textcolor{comment}{       !< The layers' target coordinate values}
166 \textcolor{comment}{                                                      !! (potential density) [R ~> kg m-3].}
167   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke+1)}, \textcolor{keywordtype}{intent(out)} :: g\_prime\textcolor{comment}{    !< The reduced gravity across the interfaces}
168 \textcolor{comment}{                                                      !! [L2 Z-1 T-2 ~> m s-2].}
169   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{         !< A dimensional unit scaling type}
170   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
171 
172   \textcolor{comment}{! Local variables}
173   \textcolor{keywordtype}{real} :: g\_fs    \textcolor{comment}{! Reduced gravity across the free surface [L2 Z-1 T-2 ~> m s-2].}
174   \textcolor{keywordtype}{real} :: Rlay\_Ref\textcolor{comment}{! The surface layer's target density [R ~> kg m-3].}
175   \textcolor{keywordtype}{real} :: RLay\_range \textcolor{comment}{! The range of densities [R ~> kg m-3].}
176   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"set\_coord\_from\_layer\_density"} \textcolor{comment}{! This subroutine's name.}
177   \textcolor{keywordtype}{integer} :: k, nz
178   nz = gv%ke
179 
180   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_coord\_initialization.F90"})
181 
182   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GFS"}, g\_fs, &
183                  \textcolor{stringliteral}{"The reduced gravity at the free surface."}, units=\textcolor{stringliteral}{"m s-2"}, &
184                  default=gv%g\_Earth*us%L\_T\_to\_m\_s**2*us%m\_to\_Z, scale=us%m\_s\_to\_L\_T**2*us%Z\_to\_m)
185   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"LIGHTEST\_DENSITY"}, rlay\_ref, &
186                  \textcolor{stringliteral}{"The reference potential density used for layer 1."}, &
187                  units=\textcolor{stringliteral}{"kg m-3"}, default=us%R\_to\_kg\_m3*gv%Rho0, scale=us%kg\_m3\_to\_R)
188   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DENSITY\_RANGE"}, rlay\_range, &
189                  \textcolor{stringliteral}{"The range of reference potential densities in the layers."}, &
190                  units=\textcolor{stringliteral}{"kg m-3"}, default=2.0, scale=us%kg\_m3\_to\_R)
191 
192   rlay(1) = rlay\_ref
193   \textcolor{keywordflow}{do} k=2,nz
194     rlay(k) = rlay(k-1) + rlay\_range/(\textcolor{keywordtype}{real}(nz-1))
195 \textcolor{keywordflow}{  enddo}
196 \textcolor{comment}{!    These statements set the interface reduced gravities.           !}
197   g\_prime(1) = g\_fs
198   \textcolor{keywordflow}{do} k=2,nz
199     g\_prime(k) = (gv%g\_Earth/(gv%Rho0)) * (rlay(k) - rlay(k-1))
200 \textcolor{keywordflow}{  enddo}
201 
202   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__coord__initialization_ab8bc8326f34ac58a6299e469bca20268}\label{namespacemom__coord__initialization_ab8bc8326f34ac58a6299e469bca20268}} 
\index{mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}!set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+profile@{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+profile}}
\index{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+profile@{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+profile}!mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}}
\subsubsection{\texorpdfstring{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+profile()}{set\_coord\_from\_ts\_profile()}}
{\footnotesize\ttfamily subroutine mom\+\_\+coord\+\_\+initialization\+::set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+profile (\begin{DoxyParamCaption}\item[{real, dimension(gv\%ke), intent(out)}]{Rlay,  }\item[{real, dimension(gv\%ke+1), intent(out)}]{g\+\_\+prime,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(eos\+\_\+type), pointer}]{eqn\+\_\+of\+\_\+state,  }\item[{real, intent(in)}]{P\+\_\+\+Ref }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Sets the layer densities (Rlay) and the interface reduced gravities (g) from a T-\/S profile. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt out}  & {\em rlay} & Layer potential density \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em g\+\_\+prime} & The reduced gravity at each interface \mbox{[}L2 Z-\/1 T-\/2 $\sim$$>$ m s-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters\\
\hline
 & {\em eqn\+\_\+of\+\_\+state} & Equation of state structure\\
\hline
\mbox{\tt in}  & {\em p\+\_\+ref} & The coordinate-\/density reference pressure \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 258 of file M\+O\+M\+\_\+coord\+\_\+initialization.\+F90.


\begin{DoxyCode}
258   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{      !< The ocean's vertical grid structure}
259   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke)},   \textcolor{keywordtype}{intent(out)} :: Rlay\textcolor{comment}{    !< Layer potential density [R ~> kg m-3].}
260   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke+1)}, \textcolor{keywordtype}{intent(out)} :: g\_prime\textcolor{comment}{ !< The reduced gravity at each}
261 \textcolor{comment}{                                                   !! interface [L2 Z-1 T-2 ~> m s-2].}
262   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{      !< A dimensional unit scaling type}
263   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
264   \textcolor{keywordtype}{type}(EOS\_type),           \textcolor{keywordtype}{pointer}     :: eqn\_of\_state\textcolor{comment}{ !< Equation of state structure}
265   \textcolor{keywordtype}{real},                     \textcolor{keywordtype}{intent(in)}  :: P\_Ref\textcolor{comment}{   !< The coordinate-density reference pressure}
266 \textcolor{comment}{                                                   !! [R L2 T-2 ~> Pa].}
267 
268   \textcolor{comment}{! Local variables}
269   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke)} :: T0, S0,  Pref
270   \textcolor{keywordtype}{real} :: g\_fs    \textcolor{comment}{! Reduced gravity across the free surface [L2 Z-1 T-2 ~> m s-2].}
271   \textcolor{keywordtype}{integer} :: k, nz
272   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"set\_coord\_from\_TS\_profile"} \textcolor{comment}{! This subroutine's name.}
273   \textcolor{keywordtype}{character(len=200)} :: filename, coord\_file, inputdir \textcolor{comment}{! Strings for file/path}
274   nz = gv%ke
275 
276   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_coord\_initialization.F90"})
277 
278   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GFS"}, g\_fs, &
279                  \textcolor{stringliteral}{"The reduced gravity at the free surface."}, units=\textcolor{stringliteral}{"m s-2"}, &
280                  default=gv%g\_Earth*us%L\_T\_to\_m\_s**2*us%m\_to\_Z, scale=us%m\_s\_to\_L\_T**2*us%Z\_to\_m)
281   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"COORD\_FILE"}, coord\_file, &
282                  \textcolor{stringliteral}{"The file from which the coordinate temperatures and "}//&
283                  \textcolor{stringliteral}{"salinities are read."}, fail\_if\_missing=.true.)
284 
285   \textcolor{keyword}{call }get\_param(param\_file,  mdl, \textcolor{stringliteral}{"INPUTDIR"}, inputdir, default=\textcolor{stringliteral}{"."})
286   filename = trim(slasher(inputdir))//trim(coord\_file)
287   \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR/COORD\_FILE"}, filename)
288 
289   \textcolor{keyword}{call }mom\_read\_data(filename,\textcolor{stringliteral}{"PTEMP"},t0(:))
290   \textcolor{keyword}{call }mom\_read\_data(filename,\textcolor{stringliteral}{"SALT"},s0(:))
291 
292   \textcolor{keywordflow}{if} (.not.file\_exists(filename)) \textcolor{keyword}{call }mom\_error(fatal, &
293       \textcolor{stringliteral}{" set\_coord\_from\_TS\_profile: Unable to open "} //trim(filename))
294 \textcolor{comment}{!    These statements set the interface reduced gravities.           !}
295   g\_prime(1) = g\_fs
296   \textcolor{keywordflow}{do} k=1,nz ; pref(k) = p\_ref ;\textcolor{keywordflow}{ enddo}
297   \textcolor{keyword}{call }calculate\_density(t0, s0, pref, rlay, eqn\_of\_state, (/1,nz/) )
298   \textcolor{keywordflow}{do} k=2,nz; g\_prime(k) = (gv%g\_Earth/(gv%Rho0)) * (rlay(k) - rlay(k-1)) ;\textcolor{keywordflow}{ enddo}
299 
300   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__coord__initialization_ae66d4537aa49c517b7f575762deb25bf}\label{namespacemom__coord__initialization_ae66d4537aa49c517b7f575762deb25bf}} 
\index{mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}!set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+range@{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+range}}
\index{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+range@{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+range}!mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}}
\subsubsection{\texorpdfstring{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+range()}{set\_coord\_from\_ts\_range()}}
{\footnotesize\ttfamily subroutine mom\+\_\+coord\+\_\+initialization\+::set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+range (\begin{DoxyParamCaption}\item[{real, dimension(gv\%ke), intent(out)}]{Rlay,  }\item[{real, dimension(gv\%ke+1), intent(out)}]{g\+\_\+prime,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(eos\+\_\+type), pointer}]{eqn\+\_\+of\+\_\+state,  }\item[{real, intent(in)}]{P\+\_\+\+Ref }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Sets the layer densities (Rlay) and the interface reduced gravities (g) from a linear T-\/S profile. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt out}  & {\em rlay} & Layer potential density \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em g\+\_\+prime} & The reduced gravity at each interface \mbox{[}L2 Z-\/1 T-\/2 $\sim$$>$ m s-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters\\
\hline
 & {\em eqn\+\_\+of\+\_\+state} & Equation of state structure\\
\hline
\mbox{\tt in}  & {\em p\+\_\+ref} & The coordinate-\/density reference pressure \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}
305   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{      !< The ocean's vertical grid structure}
306   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke)},   \textcolor{keywordtype}{intent(out)} :: Rlay\textcolor{comment}{    !< Layer potential density [R ~> kg m-3].}
307   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke+1)}, \textcolor{keywordtype}{intent(out)} :: g\_prime\textcolor{comment}{ !< The reduced gravity at each}
308 \textcolor{comment}{                                                   !! interface [L2 Z-1 T-2 ~> m s-2].}
309   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{      !< A dimensional unit scaling type}
310   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
311   \textcolor{keywordtype}{type}(EOS\_type),           \textcolor{keywordtype}{pointer}     :: eqn\_of\_state\textcolor{comment}{ !< Equation of state structure}
312   \textcolor{keywordtype}{real},                     \textcolor{keywordtype}{intent(in)}  :: P\_Ref\textcolor{comment}{   !< The coordinate-density reference pressure}
313 \textcolor{comment}{                                                   !! [R L2 T-2 ~> Pa].}
314 
315   \textcolor{comment}{! Local variables}
316   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke)} :: T0, S0,  Pref
317   \textcolor{keywordtype}{real} :: S\_Ref, S\_Light, S\_Dense \textcolor{comment}{! Salinity range parameters [ppt].}
318   \textcolor{keywordtype}{real} :: T\_Ref, T\_Light, T\_Dense \textcolor{comment}{! Temperature range parameters [decC].}
319   \textcolor{keywordtype}{real} :: res\_rat \textcolor{comment}{! The ratio of density space resolution in the denser part}
320                   \textcolor{comment}{! of the range to that in the lighter part of the range.}
321                   \textcolor{comment}{! Setting this greater than 1 increases the resolution for}
322                   \textcolor{comment}{! the denser water.}
323   \textcolor{keywordtype}{real} :: g\_fs    \textcolor{comment}{! Reduced gravity across the free surface [L2 Z-1 T-2 ~> m s-2].}
324   \textcolor{keywordtype}{real} :: a1, frac\_dense, k\_frac
325   \textcolor{keywordtype}{integer} :: k, nz, k\_light
326   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"set\_coord\_from\_TS\_range"} \textcolor{comment}{! This subroutine's name.}
327   \textcolor{keywordtype}{character(len=200)} :: filename, coord\_file, inputdir \textcolor{comment}{! Strings for file/path}
328   nz = gv%ke
329 
330   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_coord\_initialization.F90"})
331 
332   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"T\_REF"}, t\_ref, &
333                  \textcolor{stringliteral}{"The default initial temperatures."}, units=\textcolor{stringliteral}{"degC"}, default=10.0)
334   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TS\_RANGE\_T\_LIGHT"}, t\_light, &
335                  \textcolor{stringliteral}{"The initial temperature of the lightest layer when "}//&
336                  \textcolor{stringliteral}{"COORD\_CONFIG is set to ts\_range."}, units=\textcolor{stringliteral}{"degC"}, default=t\_ref)
337   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TS\_RANGE\_T\_DENSE"}, t\_dense, &
338                  \textcolor{stringliteral}{"The initial temperature of the densest layer when "}//&
339                  \textcolor{stringliteral}{"COORD\_CONFIG is set to ts\_range."}, units=\textcolor{stringliteral}{"degC"}, default=t\_ref)
340 
341   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"S\_REF"}, s\_ref, &
342                  \textcolor{stringliteral}{"The default initial salinities."}, units=\textcolor{stringliteral}{"PSU"}, default=35.0)
343   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TS\_RANGE\_S\_LIGHT"}, s\_light, &
344                  \textcolor{stringliteral}{"The initial lightest salinities when COORD\_CONFIG "}//&
345                  \textcolor{stringliteral}{"is set to ts\_range."}, default = s\_ref, units=\textcolor{stringliteral}{"PSU"})
346   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TS\_RANGE\_S\_DENSE"}, s\_dense, &
347                  \textcolor{stringliteral}{"The initial densest salinities when COORD\_CONFIG "}//&
348                  \textcolor{stringliteral}{"is set to ts\_range."}, default = s\_ref, units=\textcolor{stringliteral}{"PSU"})
349 
350   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TS\_RANGE\_RESOLN\_RATIO"}, res\_rat, &
351                  \textcolor{stringliteral}{"The ratio of density space resolution in the densest "}//&
352                  \textcolor{stringliteral}{"part of the range to that in the lightest part of the "}//&
353                  \textcolor{stringliteral}{"range when COORD\_CONFIG is set to ts\_range. Values "}//&
354                  \textcolor{stringliteral}{"greater than 1 increase the resolution of the denser water."},&
355                  default=1.0, units=\textcolor{stringliteral}{"nondim"})
356 
357   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GFS"}, g\_fs, &
358                  \textcolor{stringliteral}{"The reduced gravity at the free surface."}, units=\textcolor{stringliteral}{"m s-2"}, &
359                  default=gv%g\_Earth*us%L\_T\_to\_m\_s**2*us%m\_to\_Z, scale=us%m\_s\_to\_L\_T**2*us%Z\_to\_m)
360 
361   \textcolor{keywordflow}{if} ((gv%nk\_rho\_varies > 0) .and. (nz < gv%nk\_rho\_varies+2)) &
362     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"set\_coord\_from\_TS\_range requires that NZ >= NKML+NKBL+2."})
363 
364   k\_light = gv%nk\_rho\_varies + 1
365 
366   \textcolor{comment}{! Set T0(k) to range from T\_LIGHT to T\_DENSE, and simliarly for S0(k).}
367   t0(k\_light) = t\_light ; s0(k\_light) = s\_light
368   a1 = 2.0 * res\_rat / (1.0 + res\_rat)
369   \textcolor{keywordflow}{do} k=k\_light+1,nz
370     k\_frac = \textcolor{keywordtype}{real}(k-k\_light)/\textcolor{keywordtype}{real}(nz-k\_light)
371     frac\_dense = a1 * k\_frac + (1.0 - a1) * k\_frac**2
372     t0(k) = frac\_dense * (t\_dense - t\_light) + t\_light
373     s0(k) = frac\_dense * (s\_dense - s\_light) + s\_light
374 \textcolor{keywordflow}{  enddo}
375 
376   g\_prime(1) = g\_fs
377   \textcolor{keywordflow}{do} k=1,nz ; pref(k) = p\_ref ;\textcolor{keywordflow}{ enddo}
378   \textcolor{keyword}{call }calculate\_density(t0, s0, pref, rlay, eqn\_of\_state, (/k\_light,nz/) )
379   \textcolor{comment}{! Extrapolate target densities for the variable density mixed and buffer layers.}
380   \textcolor{keywordflow}{do} k=k\_light-1,1,-1
381     rlay(k) = 2.0*rlay(k+1) - rlay(k+2)
382 \textcolor{keywordflow}{  enddo}
383   \textcolor{keywordflow}{do} k=2,nz ; g\_prime(k) = (gv%g\_Earth/gv%Rho0) * (rlay(k) - rlay(k-1)) ;\textcolor{keywordflow}{ enddo}
384 
385   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__coord__initialization_ad01a90ddd579883d7be3795703b13c93}\label{namespacemom__coord__initialization_ad01a90ddd579883d7be3795703b13c93}} 
\index{mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}!set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+ref@{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+ref}}
\index{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+ref@{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+ref}!mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}}
\subsubsection{\texorpdfstring{set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+ref()}{set\_coord\_from\_ts\_ref()}}
{\footnotesize\ttfamily subroutine mom\+\_\+coord\+\_\+initialization\+::set\+\_\+coord\+\_\+from\+\_\+ts\+\_\+ref (\begin{DoxyParamCaption}\item[{real, dimension(gv\%ke), intent(out)}]{Rlay,  }\item[{real, dimension(gv\%ke+1), intent(out)}]{g\+\_\+prime,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(eos\+\_\+type), pointer}]{eqn\+\_\+of\+\_\+state,  }\item[{real, intent(in)}]{P\+\_\+\+Ref }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Sets the layer densities (Rlay) and the interface reduced gravities (g) from a profile of g\textquotesingle{}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure.\\
\hline
\mbox{\tt out}  & {\em rlay} & The layers\textquotesingle{} target coordinate values (potential density) \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em g\+\_\+prime} & The reduced gravity across the interfaces \mbox{[}L2 Z-\/1 T-\/2 $\sim$$>$ m s-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters\\
\hline
 & {\em eqn\+\_\+of\+\_\+state} & Equation of state structure\\
\hline
\mbox{\tt in}  & {\em p\+\_\+ref} & The coordinate-\/density reference pressure \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 207 of file M\+O\+M\+\_\+coord\+\_\+initialization.\+F90.


\begin{DoxyCode}
207   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{         !< The ocean's vertical grid structure.}
208   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke)},   \textcolor{keywordtype}{intent(out)} :: Rlay\textcolor{comment}{       !< The layers' target coordinate values}
209 \textcolor{comment}{                                                      !! (potential density) [R ~> kg m-3].}
210   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke+1)}, \textcolor{keywordtype}{intent(out)} :: g\_prime\textcolor{comment}{    !< The reduced gravity across the interfaces}
211 \textcolor{comment}{                                                      !! [L2 Z-1 T-2 ~> m s-2].}
212   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{         !< A dimensional unit scaling type}
213   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
214   \textcolor{keywordtype}{type}(EOS\_type),           \textcolor{keywordtype}{pointer}     :: eqn\_of\_state\textcolor{comment}{ !< Equation of state structure}
215   \textcolor{keywordtype}{real},                     \textcolor{keywordtype}{intent(in)}  :: P\_Ref\textcolor{comment}{      !< The coordinate-density reference pressure}
216 \textcolor{comment}{                                                      !! [R L2 T-2 ~> Pa].}
217 
218   \textcolor{comment}{! Local variables}
219   \textcolor{keywordtype}{real} :: T\_ref   \textcolor{comment}{! Reference temperature}
220   \textcolor{keywordtype}{real} :: S\_ref   \textcolor{comment}{! Reference salinity}
221   \textcolor{keywordtype}{real} :: g\_int   \textcolor{comment}{! Reduced gravities across the internal interfaces [L2 Z-1 T-2 ~> m s-2].}
222   \textcolor{keywordtype}{real} :: g\_fs    \textcolor{comment}{! Reduced gravity across the free surface [L2 Z-1 T-2 ~> m s-2].}
223   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"set\_coord\_from\_TS\_ref"} \textcolor{comment}{! This subroutine's name.}
224   \textcolor{keywordtype}{integer} :: k, nz
225   nz = gv%ke
226 
227   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_coord\_initialization.F90"})
228 
229   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"T\_REF"}, t\_ref, &
230                  \textcolor{stringliteral}{"The initial temperature of the lightest layer."}, units=\textcolor{stringliteral}{"degC"}, &
231                  fail\_if\_missing=.true.)
232   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"S\_REF"}, s\_ref, &
233                  \textcolor{stringliteral}{"The initial salinities."}, units=\textcolor{stringliteral}{"PSU"}, default=35.0)
234   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GFS"}, g\_fs, &
235                  \textcolor{stringliteral}{"The reduced gravity at the free surface."}, units=\textcolor{stringliteral}{"m s-2"}, &
236                  default=gv%g\_Earth*us%L\_T\_to\_m\_s**2*us%m\_to\_Z, scale=us%m\_s\_to\_L\_T**2*us%Z\_to\_m)
237   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GINT"}, g\_int, &
238                  \textcolor{stringliteral}{"The reduced gravity across internal interfaces."}, &
239                  units=\textcolor{stringliteral}{"m s-2"}, fail\_if\_missing=.true., scale=us%m\_s\_to\_L\_T**2*us%Z\_to\_m)
240 
241 \textcolor{comment}{!    These statements set the interface reduced gravities.           !}
242   g\_prime(1) = g\_fs
243   \textcolor{keywordflow}{do} k=2,nz ; g\_prime(k) = g\_int ;\textcolor{keywordflow}{ enddo}
244 
245 \textcolor{comment}{!    The uppermost layer's density is set here.  Subsequent layers'  !}
246 \textcolor{comment}{!  densities are determined from this value and the g values.        !}
247 \textcolor{comment}{!        T0 = 28.228 ; S0 = 34.5848 ; Pref = P\_Ref}
248   \textcolor{keyword}{call }calculate\_density(t\_ref, s\_ref, p\_ref, rlay(1), eqn\_of\_state)
249 
250 \textcolor{comment}{!    These statements set the layer densities.                       !}
251   \textcolor{keywordflow}{do} k=2,nz ; rlay(k) = rlay(k-1) + g\_prime(k)*(gv%Rho0/gv%g\_Earth) ;\textcolor{keywordflow}{ enddo}
252 
253   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__coord__initialization_a0cf7c5ab79446898b961e227eabc724b}\label{namespacemom__coord__initialization_a0cf7c5ab79446898b961e227eabc724b}} 
\index{mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}!set\+\_\+coord\+\_\+linear@{set\+\_\+coord\+\_\+linear}}
\index{set\+\_\+coord\+\_\+linear@{set\+\_\+coord\+\_\+linear}!mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}}
\subsubsection{\texorpdfstring{set\+\_\+coord\+\_\+linear()}{set\_coord\_linear()}}
{\footnotesize\ttfamily subroutine mom\+\_\+coord\+\_\+initialization\+::set\+\_\+coord\+\_\+linear (\begin{DoxyParamCaption}\item[{real, dimension(gv\%ke), intent(out)}]{Rlay,  }\item[{real, dimension(gv\%ke+1), intent(out)}]{g\+\_\+prime,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Sets the layer densities (Rlay) and the interface reduced gravities (g) according to a linear profile starting at a reference surface layer density and spanning a range of densities to the bottom defined by the parameter R\+L\+A\+Y\+\_\+\+R\+A\+N\+GE (defaulting to 2.\+0 if not defined) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt out}  & {\em rlay} & Layer potential density \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em g\+\_\+prime} & The reduced gravity at each interface \mbox{[}L2 Z-\/1 T-\/2 $\sim$$>$ m s-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\end{DoxyParams}


Definition at line 442 of file M\+O\+M\+\_\+coord\+\_\+initialization.\+F90.


\begin{DoxyCode}
442   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{      !< The ocean's vertical grid structure}
443   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke)},   \textcolor{keywordtype}{intent(out)} :: Rlay\textcolor{comment}{    !< Layer potential density [R ~> kg m-3].}
444   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke+1)}, \textcolor{keywordtype}{intent(out)} :: g\_prime\textcolor{comment}{ !< The reduced gravity at each}
445 \textcolor{comment}{                                                   !! interface [L2 Z-1 T-2 ~> m s-2].}
446   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{      !< A dimensional unit scaling type}
447   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
448 
449   \textcolor{comment}{! Local variables}
450   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"set\_coord\_linear"} \textcolor{comment}{! This subroutine}
451   \textcolor{keywordtype}{real} :: Rlay\_ref, Rlay\_range, g\_fs
452   \textcolor{keywordtype}{integer} :: k, nz
453   nz = gv%ke
454 
455   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_coord\_initialization.F90"})
456 
457   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"LIGHTEST\_DENSITY"}, rlay\_ref, &
458                  \textcolor{stringliteral}{"The reference potential density used for the surface interface."}, &
459                  units=\textcolor{stringliteral}{"kg m-3"}, default=us%R\_to\_kg\_m3*gv%Rho0, scale=us%kg\_m3\_to\_R)
460   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DENSITY\_RANGE"}, rlay\_range, &
461                  \textcolor{stringliteral}{"The range of reference potential densities across all interfaces."}, &
462                  units=\textcolor{stringliteral}{"kg m-3"}, default=2.0, scale=us%kg\_m3\_to\_R)
463   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GFS"}, g\_fs, &
464                  \textcolor{stringliteral}{"The reduced gravity at the free surface."}, units=\textcolor{stringliteral}{"m s-2"}, &
465                  default=gv%g\_Earth*us%L\_T\_to\_m\_s**2*us%m\_to\_Z, scale=us%m\_s\_to\_L\_T**2*us%Z\_to\_m)
466 
467   \textcolor{comment}{! This following sets the target layer densities such that a the}
468   \textcolor{comment}{! surface interface has density Rlay\_ref and the bottom}
469   \textcolor{comment}{! is Rlay\_range larger}
470   \textcolor{keywordflow}{do} k=1,nz
471     rlay(k) = rlay\_ref + rlay\_range*((\textcolor{keywordtype}{real}(k)-0.5)/\textcolor{keywordtype}{real}(nz))
472 \textcolor{keywordflow}{  enddo}
473   \textcolor{comment}{! These statements set the interface reduced gravities.}
474   g\_prime(1) = g\_fs
475   \textcolor{keywordflow}{do} k=2,nz
476     g\_prime(k) = (gv%g\_Earth/(gv%Rho0)) * (rlay(k) - rlay(k-1))
477 \textcolor{keywordflow}{  enddo}
478 
479   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__coord__initialization_a4b03f15c6e6f4f3b45144ba03f515d74}\label{namespacemom__coord__initialization_a4b03f15c6e6f4f3b45144ba03f515d74}} 
\index{mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}!set\+\_\+coord\+\_\+to\+\_\+none@{set\+\_\+coord\+\_\+to\+\_\+none}}
\index{set\+\_\+coord\+\_\+to\+\_\+none@{set\+\_\+coord\+\_\+to\+\_\+none}!mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}}
\subsubsection{\texorpdfstring{set\+\_\+coord\+\_\+to\+\_\+none()}{set\_coord\_to\_none()}}
{\footnotesize\ttfamily subroutine mom\+\_\+coord\+\_\+initialization\+::set\+\_\+coord\+\_\+to\+\_\+none (\begin{DoxyParamCaption}\item[{real, dimension(gv\%ke), intent(out)}]{Rlay,  }\item[{real, dimension(gv\%ke+1), intent(out)}]{g\+\_\+prime,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Sets Rlay to Rho0 and g\+\_\+prime to zero except for the free surface. This is for use only in A\+LE mode where Rlay should not be used and g\+\_\+prime(1) alone might be used. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt out}  & {\em rlay} & Layer potential density \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em g\+\_\+prime} & The reduced gravity at each interface \mbox{[}L2 Z-\/1 T-\/2 $\sim$$>$ m s-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\end{DoxyParams}


Definition at line 486 of file M\+O\+M\+\_\+coord\+\_\+initialization.\+F90.


\begin{DoxyCode}
486   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{      !< The ocean's vertical grid structure}
487   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke)},   \textcolor{keywordtype}{intent(out)} :: Rlay\textcolor{comment}{    !< Layer potential density [R ~> kg m-3].}
488   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke+1)}, \textcolor{keywordtype}{intent(out)} :: g\_prime\textcolor{comment}{ !< The reduced gravity at each}
489 \textcolor{comment}{                                                   !! interface [L2 Z-1 T-2 ~> m s-2].}
490   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{      !< A dimensional unit scaling type}
491   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
492   \textcolor{comment}{! Local variables}
493   \textcolor{keywordtype}{real} :: g\_fs    \textcolor{comment}{! Reduced gravity across the free surface [L2 Z-1 T-2 ~> m s-2].}
494   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"set\_coord\_to\_none"} \textcolor{comment}{! This subroutine's name.}
495   \textcolor{keywordtype}{integer} :: k, nz
496   nz = gv%ke
497 
498   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"(), MOM\_coord\_initialization.F90"})
499 
500   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GFS"} , g\_fs, &
501                  \textcolor{stringliteral}{"The reduced gravity at the free surface."}, units=\textcolor{stringliteral}{"m s-2"}, &
502                  default=gv%g\_Earth*us%L\_T\_to\_m\_s**2*us%m\_to\_Z, scale=us%m\_s\_to\_L\_T**2*us%Z\_to\_m)
503 
504   g\_prime(1) = g\_fs
505   \textcolor{keywordflow}{do} k=2,nz ; g\_prime(k) = 0. ;\textcolor{keywordflow}{ enddo}
506   rlay(1) = gv%Rho0
507   \textcolor{keywordflow}{do} k=2,nz ; rlay(k) = rlay(k-1) + g\_prime(k)*(gv%Rho0/gv%g\_Earth) ;\textcolor{keywordflow}{ enddo}
508 
509   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})
510 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__coord__initialization_adcabf6100c5e5daa4919fa1e3f62c7a7}\label{namespacemom__coord__initialization_adcabf6100c5e5daa4919fa1e3f62c7a7}} 
\index{mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}!write\+\_\+vertgrid\+\_\+file@{write\+\_\+vertgrid\+\_\+file}}
\index{write\+\_\+vertgrid\+\_\+file@{write\+\_\+vertgrid\+\_\+file}!mom\+\_\+coord\+\_\+initialization@{mom\+\_\+coord\+\_\+initialization}}
\subsubsection{\texorpdfstring{write\+\_\+vertgrid\+\_\+file()}{write\_vertgrid\_file()}}
{\footnotesize\ttfamily subroutine mom\+\_\+coord\+\_\+initialization\+::write\+\_\+vertgrid\+\_\+file (\begin{DoxyParamCaption}\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{character(len=$\ast$), intent(in)}]{directory }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Writes out a file containing any available data related to the vertical grid used by the M\+OM ocean model. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters\\
\hline
\mbox{\tt in}  & {\em directory} & The directory into which to place the file. \\
\hline
\end{DoxyParams}


Definition at line 516 of file M\+O\+M\+\_\+coord\+\_\+initialization.\+F90.


\begin{DoxyCode}
516   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{         !< The ocean's vertical grid structure}
517   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{         !< A dimensional unit scaling type}
518   \textcolor{keywordtype}{type}(param\_file\_type), \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
519   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)}    :: directory\textcolor{comment}{  !< The directory into which to place the file.}
520   \textcolor{comment}{! Local variables}
521   \textcolor{keywordtype}{character(len=240)} :: filepath
522   \textcolor{keywordtype}{type}(vardesc) :: vars(2)
523   \textcolor{keywordtype}{type}(fieldtype) :: fields(2)
524   \textcolor{keywordtype}{integer} :: unit
525 
526   filepath = trim(directory) // trim(\textcolor{stringliteral}{"Vertical\_coordinate"})
527 
528   vars(1) = var\_desc(\textcolor{stringliteral}{"R"},\textcolor{stringliteral}{"kilogram meter-3"},\textcolor{stringliteral}{"Target Potential Density"},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'L'},\textcolor{stringliteral}{'1'})
529   vars(2) = var\_desc(\textcolor{stringliteral}{"g"},\textcolor{stringliteral}{"meter second-2"},\textcolor{stringliteral}{"Reduced gravity"},\textcolor{stringliteral}{'1'},\textcolor{stringliteral}{'L'},\textcolor{stringliteral}{'1'})
530 
531   \textcolor{keyword}{call }create\_file(unit, trim(filepath), vars, 2, fields, single\_file, gv=gv)
532 
533   \textcolor{keyword}{call }write\_field(unit, fields(1), us%R\_to\_kg\_m3*gv%Rlay(:))
534   \textcolor{keyword}{call }write\_field(unit, fields(2), us%L\_T\_to\_m\_s**2*us%m\_to\_Z*gv%g\_prime(:))
535 
536   \textcolor{keyword}{call }close\_file(unit)
537 
\end{DoxyCode}
