\hypertarget{namespacemom__verticalgrid}{}\section{mom\+\_\+verticalgrid Module Reference}
\label{namespacemom__verticalgrid}\index{mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}}


\subsection{Detailed Description}
Provides a transparent vertical ocean grid type and supporting routines. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}
\begin{DoxyCompactList}\small\item\em Describes the vertical ocean grid, including unit conversion factors. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__verticalgrid_a2fbde8b173a9ce56fbd41e5b96d4b2f8}{verticalgridinit}} (param\+\_\+file, GV, US)
\begin{DoxyCompactList}\small\item\em Allocates and initializes the ocean model vertical grid structure. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__verticalgrid_af1789a763ad75b54bbbf61daf1153f06}{fix\+\_\+restart\+\_\+scaling}} (GV)
\begin{DoxyCompactList}\small\item\em Set the scaling factors for restart files to the scaling factors for this run. \end{DoxyCompactList}\item 
character(len=48) function, public \mbox{\hyperlink{namespacemom__verticalgrid_a1eea13d63bdc910462ffba406d32fe04}{get\+\_\+thickness\+\_\+units}} (GV)
\begin{DoxyCompactList}\small\item\em Returns the model\textquotesingle{}s thickness units, usually m or kg/m$^\wedge$2. \end{DoxyCompactList}\item 
character(len=48) function, public \mbox{\hyperlink{namespacemom__verticalgrid_af027c312e660a932b3f430f4c7a9675d}{get\+\_\+flux\+\_\+units}} (GV)
\begin{DoxyCompactList}\small\item\em Returns the model\textquotesingle{}s thickness flux units, usually m$^\wedge$3/s or kg/s. \end{DoxyCompactList}\item 
character(len=48) function, public \mbox{\hyperlink{namespacemom__verticalgrid_a908fc7025e6cf5d60885dbb7565093cd}{get\+\_\+tr\+\_\+flux\+\_\+units}} (GV, tr\+\_\+units, tr\+\_\+vol\+\_\+conc\+\_\+units, tr\+\_\+mass\+\_\+conc\+\_\+units)
\begin{DoxyCompactList}\small\item\em Returns the model\textquotesingle{}s tracer flux units. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__verticalgrid_a0de628611339a946b2b4a1daa7efd181}{setverticalgridaxes}} (Rlay, GV, scale)
\begin{DoxyCompactList}\small\item\em This sets the coordinate data for the \char`\"{}layer mode\char`\"{} of the isopycnal model. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__verticalgrid_a64fe319acba142cde9c35f21257ff64f}{verticalgridend}} (GV)
\begin{DoxyCompactList}\small\item\em Deallocates the model\textquotesingle{}s vertical grid structure. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__verticalgrid_af1789a763ad75b54bbbf61daf1153f06}\label{namespacemom__verticalgrid_af1789a763ad75b54bbbf61daf1153f06}} 
\index{mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}!fix\+\_\+restart\+\_\+scaling@{fix\+\_\+restart\+\_\+scaling}}
\index{fix\+\_\+restart\+\_\+scaling@{fix\+\_\+restart\+\_\+scaling}!mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}}
\subsubsection{\texorpdfstring{fix\+\_\+restart\+\_\+scaling()}{fix\_restart\_scaling()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+verticalgrid\+::fix\+\_\+restart\+\_\+scaling (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(inout)}]{GV }\end{DoxyParamCaption})}



Set the scaling factors for restart files to the scaling factors for this run. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in,out}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure \\
\hline
\end{DoxyParams}


Definition at line 183 of file M\+O\+M\+\_\+vertical\+Grid.\+F90.


\begin{DoxyCode}
183   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(inout)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}
184 
185   gv%m\_to\_H\_restart = gv%m\_to\_H
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__verticalgrid_af027c312e660a932b3f430f4c7a9675d}\label{namespacemom__verticalgrid_af027c312e660a932b3f430f4c7a9675d}} 
\index{mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}!get\+\_\+flux\+\_\+units@{get\+\_\+flux\+\_\+units}}
\index{get\+\_\+flux\+\_\+units@{get\+\_\+flux\+\_\+units}!mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}}
\subsubsection{\texorpdfstring{get\+\_\+flux\+\_\+units()}{get\_flux\_units()}}
{\footnotesize\ttfamily character(len=48) function, public mom\+\_\+verticalgrid\+::get\+\_\+flux\+\_\+units (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV }\end{DoxyParamCaption})}



Returns the model\textquotesingle{}s thickness flux units, usually m$^\wedge$3/s or kg/s. 

\begin{DoxyReturn}{Returns}
The thickness flux units
\end{DoxyReturn}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure \\
\hline
\end{DoxyParams}


Definition at line 205 of file M\+O\+M\+\_\+vertical\+Grid.\+F90.


\begin{DoxyCode}
205   \textcolor{keywordtype}{character(len=48)}                   :: get\_flux\_units\textcolor{comment}{ !< The thickness flux units}
206   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}
207   \textcolor{comment}{!   This subroutine returns the appropriate units for thickness fluxes,}
208   \textcolor{comment}{! depending on whether the model is Boussinesq or not and the scaling for}
209   \textcolor{comment}{! the vertical thickness.}
210 
211   \textcolor{keywordflow}{if} (gv%Boussinesq) \textcolor{keywordflow}{then}
212     get\_flux\_units = \textcolor{stringliteral}{"m3 s-1"}
213   \textcolor{keywordflow}{else}
214     get\_flux\_units = \textcolor{stringliteral}{"kg s-1"}
215 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__verticalgrid_a1eea13d63bdc910462ffba406d32fe04}\label{namespacemom__verticalgrid_a1eea13d63bdc910462ffba406d32fe04}} 
\index{mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}!get\+\_\+thickness\+\_\+units@{get\+\_\+thickness\+\_\+units}}
\index{get\+\_\+thickness\+\_\+units@{get\+\_\+thickness\+\_\+units}!mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}}
\subsubsection{\texorpdfstring{get\+\_\+thickness\+\_\+units()}{get\_thickness\_units()}}
{\footnotesize\ttfamily character(len=48) function, public mom\+\_\+verticalgrid\+::get\+\_\+thickness\+\_\+units (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV }\end{DoxyParamCaption})}



Returns the model\textquotesingle{}s thickness units, usually m or kg/m$^\wedge$2. 

\begin{DoxyReturn}{Returns}
The vertical thickness units
\end{DoxyReturn}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure \\
\hline
\end{DoxyParams}


Definition at line 190 of file M\+O\+M\+\_\+vertical\+Grid.\+F90.


\begin{DoxyCode}
190   \textcolor{keywordtype}{character(len=48)}                   :: get\_thickness\_units\textcolor{comment}{ !< The vertical thickness units}
191   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}
192   \textcolor{comment}{!   This subroutine returns the appropriate units for thicknesses,}
193   \textcolor{comment}{! depending on whether the model is Boussinesq or not and the scaling for}
194   \textcolor{comment}{! the vertical thickness.}
195 
196   \textcolor{keywordflow}{if} (gv%Boussinesq) \textcolor{keywordflow}{then}
197     get\_thickness\_units = \textcolor{stringliteral}{"m"}
198   \textcolor{keywordflow}{else}
199     get\_thickness\_units = \textcolor{stringliteral}{"kg m-2"}
200 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__verticalgrid_a908fc7025e6cf5d60885dbb7565093cd}\label{namespacemom__verticalgrid_a908fc7025e6cf5d60885dbb7565093cd}} 
\index{mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}!get\+\_\+tr\+\_\+flux\+\_\+units@{get\+\_\+tr\+\_\+flux\+\_\+units}}
\index{get\+\_\+tr\+\_\+flux\+\_\+units@{get\+\_\+tr\+\_\+flux\+\_\+units}!mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}}
\subsubsection{\texorpdfstring{get\+\_\+tr\+\_\+flux\+\_\+units()}{get\_tr\_flux\_units()}}
{\footnotesize\ttfamily character(len=48) function, public mom\+\_\+verticalgrid\+::get\+\_\+tr\+\_\+flux\+\_\+units (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV,  }\item[{character(len=$\ast$), intent(in), optional}]{tr\+\_\+units,  }\item[{character(len=$\ast$), intent(in), optional}]{tr\+\_\+vol\+\_\+conc\+\_\+units,  }\item[{character(len=$\ast$), intent(in), optional}]{tr\+\_\+mass\+\_\+conc\+\_\+units }\end{DoxyParamCaption})}



Returns the model\textquotesingle{}s tracer flux units. 

\begin{DoxyReturn}{Returns}
The model\textquotesingle{}s flux units for a tracer.
\end{DoxyReturn}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure.\\
\hline
\mbox{\tt in}  & {\em tr\+\_\+units} & Units for a tracer, for example Celsius or P\+SU.\\
\hline
\mbox{\tt in}  & {\em tr\+\_\+vol\+\_\+conc\+\_\+units} & The concentration units per unit volume, for example if the units are umol m-\/3, tr\+\_\+vol\+\_\+conc\+\_\+units would be umol.\\
\hline
\mbox{\tt in}  & {\em tr\+\_\+mass\+\_\+conc\+\_\+units} & The concentration units per unit mass of sea water, for example if the units are mol kg-\/1, tr\+\_\+vol\+\_\+conc\+\_\+units would be mol. \\
\hline
\end{DoxyParams}


Definition at line 220 of file M\+O\+M\+\_\+vertical\+Grid.\+F90.


\begin{DoxyCode}
220   \textcolor{keywordtype}{character(len=48)}                      :: get\_tr\_flux\_units\textcolor{comment}{ !< The model's flux units}
221 \textcolor{comment}{                                                              !! for a tracer.}
222   \textcolor{keywordtype}{type}(verticalGrid\_type),    \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{                !< The ocean's vertical}
223 \textcolor{comment}{                                                              !! grid structure.}
224   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: tr\_units\textcolor{comment}{          !< Units for a tracer, for example}
225 \textcolor{comment}{                                                              !! Celsius or PSU.}
226   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: tr\_vol\_conc\_units\textcolor{comment}{ !< The concentration units per unit}
227 \textcolor{comment}{                                                              !! volume, for example if the units are}
228 \textcolor{comment}{                                                              !! umol m-3, tr\_vol\_conc\_units would}
229 \textcolor{comment}{                                                              !! be umol.}
230   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: tr\_mass\_conc\_units\textcolor{comment}{ !< The concentration units per unit}
231 \textcolor{comment}{                                                              !! mass of sea water, for example if}
232 \textcolor{comment}{                                                              !! the units are mol kg-1,}
233 \textcolor{comment}{                                                              !! tr\_vol\_conc\_units would be mol.}
234 
235   \textcolor{comment}{!   This subroutine returns the appropriate units for thicknesses and fluxes,}
236   \textcolor{comment}{! depending on whether the model is Boussinesq or not and the scaling for}
237   \textcolor{comment}{! the vertical thickness.}
238   \textcolor{keywordtype}{integer} :: cnt
239 
240   cnt = 0
241   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_units)) cnt = cnt+1
242   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_vol\_conc\_units)) cnt = cnt+1
243   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_mass\_conc\_units)) cnt = cnt+1
244 
245   \textcolor{keywordflow}{if} (cnt == 0) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"get\_tr\_flux\_units: One of the three "}//&
246     \textcolor{stringliteral}{"arguments tr\_units, tr\_vol\_conc\_units, or tr\_mass\_conc\_units "}//&
247     \textcolor{stringliteral}{"must be present."})
248   \textcolor{keywordflow}{if} (cnt > 1) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"get\_tr\_flux\_units: Only one of "}//&
249     \textcolor{stringliteral}{"tr\_units, tr\_vol\_conc\_units, and tr\_mass\_conc\_units may be present."})
250   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_units)) \textcolor{keywordflow}{then}
251     \textcolor{keywordflow}{if} (gv%Boussinesq) \textcolor{keywordflow}{then}
252       get\_tr\_flux\_units = trim(tr\_units)//\textcolor{stringliteral}{" m3 s-1"}
253     \textcolor{keywordflow}{else}
254       get\_tr\_flux\_units = trim(tr\_units)//\textcolor{stringliteral}{" kg s-1"}
255 \textcolor{keywordflow}{    endif}
256 \textcolor{keywordflow}{  endif}
257   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_vol\_conc\_units)) \textcolor{keywordflow}{then}
258     \textcolor{keywordflow}{if} (gv%Boussinesq) \textcolor{keywordflow}{then}
259       get\_tr\_flux\_units = trim(tr\_vol\_conc\_units)//\textcolor{stringliteral}{" s-1"}
260     \textcolor{keywordflow}{else}
261       get\_tr\_flux\_units = trim(tr\_vol\_conc\_units)//\textcolor{stringliteral}{" m-3 kg s-1"}
262 \textcolor{keywordflow}{    endif}
263 \textcolor{keywordflow}{  endif}
264   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_mass\_conc\_units)) \textcolor{keywordflow}{then}
265     \textcolor{keywordflow}{if} (gv%Boussinesq) \textcolor{keywordflow}{then}
266       get\_tr\_flux\_units = trim(tr\_mass\_conc\_units)//\textcolor{stringliteral}{" kg-1 m3 s-1"}
267     \textcolor{keywordflow}{else}
268       get\_tr\_flux\_units = trim(tr\_mass\_conc\_units)//\textcolor{stringliteral}{" s-1"}
269 \textcolor{keywordflow}{    endif}
270 \textcolor{keywordflow}{  endif}
271 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__verticalgrid_a0de628611339a946b2b4a1daa7efd181}\label{namespacemom__verticalgrid_a0de628611339a946b2b4a1daa7efd181}} 
\index{mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}!setverticalgridaxes@{setverticalgridaxes}}
\index{setverticalgridaxes@{setverticalgridaxes}!mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}}
\subsubsection{\texorpdfstring{setverticalgridaxes()}{setverticalgridaxes()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+verticalgrid\+::setverticalgridaxes (\begin{DoxyParamCaption}\item[{real, dimension(gv\%ke), intent(in)}]{Rlay,  }\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(inout)}]{GV,  }\item[{real, intent(in)}]{scale }\end{DoxyParamCaption})}



This sets the coordinate data for the \char`\"{}layer mode\char`\"{} of the isopycnal model. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in,out}  & {\em gv} & The container for vertical grid data\\
\hline
\mbox{\tt in}  & {\em rlay} & The layer target density \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}\\
\hline
\mbox{\tt in}  & {\em scale} & A unit scaling factor for Rlay \\
\hline
\end{DoxyParams}


Definition at line 276 of file M\+O\+M\+\_\+vertical\+Grid.\+F90.


\begin{DoxyCode}
276   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(inout)} :: GV\textcolor{comment}{   !< The container for vertical grid data}
277   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(GV%ke)},  \textcolor{keywordtype}{intent(in)}    :: Rlay\textcolor{comment}{ !< The layer target density [R ~> kg m-3]}
278   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(in)}    :: scale\textcolor{comment}{ !< A unit scaling factor for Rlay}
279   \textcolor{comment}{! Local variables}
280   \textcolor{keywordtype}{integer} :: k, nk
281 
282   nk = gv%ke
283 
284   gv%zAxisLongName = \textcolor{stringliteral}{'Target Potential Density'}
285   gv%zAxisUnits = \textcolor{stringliteral}{'kg m-3'}
286   \textcolor{keywordflow}{do} k=1,nk ; gv%sLayer(k) = scale*rlay(k) ;\textcolor{keywordflow}{ enddo}
287   \textcolor{keywordflow}{if} (nk > 1) \textcolor{keywordflow}{then}
288     gv%sInterface(1) = scale * (1.5*rlay(1) - 0.5*rlay(2))
289     \textcolor{keywordflow}{do} k=2,nk ; gv%sInterface(k) = scale * 0.5*( rlay(k-1) + rlay(k) ) ;\textcolor{keywordflow}{ enddo}
290     gv%sInterface(nk+1) = scale * (1.5*rlay(nk) - 0.5*rlay(nk-1))
291   \textcolor{keywordflow}{else}
292     gv%sInterface(1) = 0.0 ; gv%sInterface(nk+1) = 2.0*scale*rlay(nk)
293 \textcolor{keywordflow}{  endif}
294 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__verticalgrid_a64fe319acba142cde9c35f21257ff64f}\label{namespacemom__verticalgrid_a64fe319acba142cde9c35f21257ff64f}} 
\index{mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}!verticalgridend@{verticalgridend}}
\index{verticalgridend@{verticalgridend}!mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}}
\subsubsection{\texorpdfstring{verticalgridend()}{verticalgridend()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+verticalgrid\+::verticalgridend (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), pointer}]{GV }\end{DoxyParamCaption})}



Deallocates the model\textquotesingle{}s vertical grid structure. 


\begin{DoxyParams}{Parameters}
{\em gv} & The ocean\textquotesingle{}s vertical grid structure \\
\hline
\end{DoxyParams}


Definition at line 299 of file M\+O\+M\+\_\+vertical\+Grid.\+F90.


\begin{DoxyCode}
299   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{pointer} :: GV\textcolor{comment}{ !< The ocean's vertical grid structure}
300 
301   \textcolor{keyword}{deallocate}( gv%g\_prime, gv%Rlay )
302   \textcolor{keyword}{deallocate}( gv%sInterface , gv%sLayer )
303   \textcolor{keyword}{deallocate}( gv )
304 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__verticalgrid_a2fbde8b173a9ce56fbd41e5b96d4b2f8}\label{namespacemom__verticalgrid_a2fbde8b173a9ce56fbd41e5b96d4b2f8}} 
\index{mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}!verticalgridinit@{verticalgridinit}}
\index{verticalgridinit@{verticalgridinit}!mom\+\_\+verticalgrid@{mom\+\_\+verticalgrid}}
\subsubsection{\texorpdfstring{verticalgridinit()}{verticalgridinit()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+verticalgrid\+::verticalgridinit (\begin{DoxyParamCaption}\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), pointer}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US }\end{DoxyParamCaption})}



Allocates and initializes the ocean model vertical grid structure. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em param\+\_\+file} & Parameter file handle/type\\
\hline
 & {\em gv} & The container for vertical grid data\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 76 of file M\+O\+M\+\_\+vertical\+Grid.\+F90.


\begin{DoxyCode}
76   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< Parameter file handle/type}
77   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{pointer}    :: GV\textcolor{comment}{         !< The container for vertical grid data}
78   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{         !< A dimensional unit scaling type}
79   \textcolor{comment}{! This routine initializes the verticalGrid\_type structure (GV).}
80   \textcolor{comment}{! All memory is allocated but not necessarily set to meaningful values until later.}
81 
82   \textcolor{comment}{! Local variables}
83   \textcolor{keywordtype}{integer} :: nk, H\_power
84   \textcolor{keywordtype}{real}    :: H\_rescale\_factor
85   \textcolor{comment}{! This include declares and sets the variable "version".}
86 \textcolor{preprocessor}{# include "version\_variable.h"}
87 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=16)} :: mdl = \textcolor{stringliteral}{'MOM\_verticalGrid'}
88 
89   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(gv)) \textcolor{keyword}{call }mom\_error(fatal, &
90      \textcolor{stringliteral}{'verticalGridInit: called with an associated GV pointer.'})
91   \textcolor{keyword}{allocate}(gv)
92 
93   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}
94   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, &
95                    \textcolor{stringliteral}{"Parameters providing information about the vertical grid."}, &
96                    log\_to\_all=.true., debugging=.true.)
97   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"G\_EARTH"}, gv%g\_Earth, &
98                  \textcolor{stringliteral}{"The gravitational acceleration of the Earth."}, &
99                  units=\textcolor{stringliteral}{"m s-2"}, default = 9.80, scale=us%Z\_to\_m*us%m\_s\_to\_L\_T**2)
100   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RHO\_0"}, gv%Rho0, &
101                  \textcolor{stringliteral}{"The mean ocean density used with BOUSSINESQ true to "}//&
102                  \textcolor{stringliteral}{"calculate accelerations and the mass for conservation "}//&
103                  \textcolor{stringliteral}{"properties, or with BOUSSINSEQ false to convert some "}//&
104                  \textcolor{stringliteral}{"parameters from vertical units of m to kg m-2."}, &
105                  units=\textcolor{stringliteral}{"kg m-3"}, default=1035.0, scale=us%kg\_m3\_to\_R)
106   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"BOUSSINESQ"}, gv%Boussinesq, &
107                  \textcolor{stringliteral}{"If true, make the Boussinesq approximation."}, default=.true.)
108   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ANGSTROM"}, gv%Angstrom\_m, &
109                  \textcolor{stringliteral}{"The minimum layer thickness, usually one-Angstrom."}, &
110                  units=\textcolor{stringliteral}{"m"}, default=1.0e-10)
111   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"H\_RESCALE\_POWER"}, h\_power, &
112                  \textcolor{stringliteral}{"An integer power of 2 that is used to rescale the model's "}//&
113                  \textcolor{stringliteral}{"intenal units of thickness.  Valid values range from -300 to 300."}, &
114                  units=\textcolor{stringliteral}{"nondim"}, default=0, debuggingparam=.true.)
115   \textcolor{keywordflow}{if} (abs(h\_power) > 300) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"verticalGridInit: "}//&
116                  \textcolor{stringliteral}{"H\_RESCALE\_POWER is outside of the valid range of -300 to 300."})
117   h\_rescale\_factor = 1.0
118   \textcolor{keywordflow}{if} (h\_power /= 0) h\_rescale\_factor = 2.0**h\_power
119   \textcolor{keywordflow}{if} (.not.gv%Boussinesq) \textcolor{keywordflow}{then}
120     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"H\_TO\_KG\_M2"}, gv%H\_to\_kg\_m2,&
121                  \textcolor{stringliteral}{"A constant that translates thicknesses from the model's "}//&
122                  \textcolor{stringliteral}{"internal units of thickness to kg m-2."}, units=\textcolor{stringliteral}{"kg m-2 H-1"}, &
123                  default=1.0)
124     gv%H\_to\_kg\_m2 = gv%H\_to\_kg\_m2 * h\_rescale\_factor
125   \textcolor{keywordflow}{else}
126     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"H\_TO\_M"}, gv%H\_to\_m, &
127                  \textcolor{stringliteral}{"A constant that translates the model's internal "}//&
128                  \textcolor{stringliteral}{"units of thickness into m."}, units=\textcolor{stringliteral}{"m H-1"}, default=1.0)
129     gv%H\_to\_m = gv%H\_to\_m * h\_rescale\_factor
130 \textcolor{keywordflow}{  endif}
131   gv%mks\_g\_Earth = us%L\_T\_to\_m\_s**2*us%m\_to\_Z * gv%g\_Earth
132 \textcolor{preprocessor}{#ifdef STATIC\_MEMORY\_}
133 \textcolor{preprocessor}{}  \textcolor{comment}{! Here NK\_ is a macro, while nk is a variable.}
134   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"NK"}, nk, &
135                  \textcolor{stringliteral}{"The number of model layers."}, units=\textcolor{stringliteral}{"nondim"}, &
136                  static\_value=nk\_)
137   \textcolor{keywordflow}{if} (nk /= nk\_) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"verticalGridInit: "} // &
138        \textcolor{stringliteral}{"Mismatched number of layers NK\_ between MOM\_memory.h and param\_file"})
139 
140 \textcolor{preprocessor}{#else}
141 \textcolor{preprocessor}{}  \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"NK"}, nk, &
142                  \textcolor{stringliteral}{"The number of model layers."}, units=\textcolor{stringliteral}{"nondim"}, fail\_if\_missing=.true.)
143 \textcolor{preprocessor}{#endif}
144 \textcolor{preprocessor}{}  gv%ke = nk
145 
146   \textcolor{keywordflow}{if} (gv%Boussinesq) \textcolor{keywordflow}{then}
147     gv%H\_to\_kg\_m2 = us%R\_to\_kg\_m3*gv%Rho0 * gv%H\_to\_m
148     gv%kg\_m2\_to\_H = 1.0 / gv%H\_to\_kg\_m2
149     gv%m\_to\_H = 1.0 / gv%H\_to\_m
150     gv%Angstrom\_H = gv%m\_to\_H * gv%Angstrom\_m
151     gv%H\_to\_MKS = gv%H\_to\_m
152   \textcolor{keywordflow}{else}
153     gv%kg\_m2\_to\_H = 1.0 / gv%H\_to\_kg\_m2
154     gv%m\_to\_H = us%R\_to\_kg\_m3*gv%Rho0 * gv%kg\_m2\_to\_H
155     gv%H\_to\_m = gv%H\_to\_kg\_m2 / (us%R\_to\_kg\_m3*gv%Rho0)
156     gv%Angstrom\_H = gv%Angstrom\_m*1000.0*gv%kg\_m2\_to\_H
157     gv%H\_to\_MKS = gv%H\_to\_kg\_m2
158 \textcolor{keywordflow}{  endif}
159   gv%H\_subroundoff = 1e-20 * max(gv%Angstrom\_H,gv%m\_to\_H*1e-17)
160   gv%H\_to\_Pa = us%L\_T\_to\_m\_s**2*us%m\_to\_Z * gv%g\_Earth * gv%H\_to\_kg\_m2
161 
162   gv%H\_to\_Z = gv%H\_to\_m * us%m\_to\_Z
163   gv%Z\_to\_H = us%Z\_to\_m * gv%m\_to\_H
164   gv%Angstrom\_Z = us%m\_to\_Z * gv%Angstrom\_m
165 
166   gv%H\_to\_RZ = gv%H\_to\_kg\_m2 * us%kg\_m3\_to\_R * us%m\_to\_Z
167   gv%RZ\_to\_H = gv%kg\_m2\_to\_H * us%R\_to\_kg\_m3 * us%Z\_to\_m
168 
169 \textcolor{comment}{! Log derivative values.}
170   \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"M to THICKNESS"}, gv%m\_to\_H*h\_rescale\_factor)
171   \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"M to THICKNESS rescaled by 2^-n"}, gv%m\_to\_H)
172   \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"THICKNESS to M rescaled by 2^n"}, gv%H\_to\_m)
173 
174   \textcolor{keyword}{allocate}( gv%sInterface(nk+1) )
175   \textcolor{keyword}{allocate}( gv%sLayer(nk) )
176   \textcolor{keyword}{allocate}( gv%g\_prime(nk+1) ) ; gv%g\_prime(:) = 0.0
177   \textcolor{keyword}{allocate}( gv%Rlay(nk) )      ; gv%Rlay(:) = 0.0
178 
\end{DoxyCode}
