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


\doxysubsection{Detailed Description}
Provides a transparent vertical ocean grid type and supporting routines. \doxysubsection*{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}
\doxysubsection*{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}


\doxysubsection{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}}
\doxysubsubsection{\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{\texttt{ in,out}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{183   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(inout)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}}
\DoxyCodeLine{184 }
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{205   \textcolor{keywordtype}{character(len=48)}                   :: get\_flux\_units\textcolor{comment}{ !< The thickness flux units}}
\DoxyCodeLine{206   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}}
\DoxyCodeLine{207   \textcolor{comment}{!   This subroutine returns the appropriate units for thickness fluxes,}}
\DoxyCodeLine{208   \textcolor{comment}{! depending on whether the model is Boussinesq or not and the scaling for}}
\DoxyCodeLine{209   \textcolor{comment}{! the vertical thickness.}}
\DoxyCodeLine{210 }
\DoxyCodeLine{211   \textcolor{keywordflow}{if} (gv\%Boussinesq) \textcolor{keywordflow}{then}}
\DoxyCodeLine{212     get\_flux\_units = \textcolor{stringliteral}{"m3 s-\/1"}}
\DoxyCodeLine{213   \textcolor{keywordflow}{else}}
\DoxyCodeLine{214     get\_flux\_units = \textcolor{stringliteral}{"kg s-\/1"}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{190   \textcolor{keywordtype}{character(len=48)}                   :: get\_thickness\_units\textcolor{comment}{ !< The vertical thickness units}}
\DoxyCodeLine{191   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}}
\DoxyCodeLine{192   \textcolor{comment}{!   This subroutine returns the appropriate units for thicknesses,}}
\DoxyCodeLine{193   \textcolor{comment}{! depending on whether the model is Boussinesq or not and the scaling for}}
\DoxyCodeLine{194   \textcolor{comment}{! the vertical thickness.}}
\DoxyCodeLine{195 }
\DoxyCodeLine{196   \textcolor{keywordflow}{if} (gv\%Boussinesq) \textcolor{keywordflow}{then}}
\DoxyCodeLine{197     get\_thickness\_units = \textcolor{stringliteral}{"m"}}
\DoxyCodeLine{198   \textcolor{keywordflow}{else}}
\DoxyCodeLine{199     get\_thickness\_units = \textcolor{stringliteral}{"kg m-\/2"}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em tr\+\_\+units} & Units for a tracer, for example Celsius or P\+SU. \\
\hline
\mbox{\texttt{ 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{\texttt{ 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 219 of file M\+O\+M\+\_\+vertical\+Grid.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{220   \textcolor{keywordtype}{character(len=48)}                      :: get\_tr\_flux\_units\textcolor{comment}{ !< The model's flux units}}
\DoxyCodeLine{221 \textcolor{comment}{                                                              !! for a tracer.}}
\DoxyCodeLine{222   \textcolor{keywordtype}{type}(verticalGrid\_type),    \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{                !< The ocean's vertical}}
\DoxyCodeLine{223 \textcolor{comment}{                                                              !! grid structure.}}
\DoxyCodeLine{224   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: tr\_units\textcolor{comment}{          !< Units for a tracer, for example}}
\DoxyCodeLine{225 \textcolor{comment}{                                                              !! Celsius or PSU.}}
\DoxyCodeLine{226   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: tr\_vol\_conc\_units\textcolor{comment}{ !< The concentration units per unit}}
\DoxyCodeLine{227 \textcolor{comment}{                                                              !! volume, for example if the units are}}
\DoxyCodeLine{228 \textcolor{comment}{                                                              !! umol m-\/3, tr\_vol\_conc\_units would}}
\DoxyCodeLine{229 \textcolor{comment}{                                                              !! be umol.}}
\DoxyCodeLine{230   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: tr\_mass\_conc\_units\textcolor{comment}{ !< The concentration units per unit}}
\DoxyCodeLine{231 \textcolor{comment}{                                                              !! mass of sea water, for example if}}
\DoxyCodeLine{232 \textcolor{comment}{                                                              !! the units are mol kg-\/1,}}
\DoxyCodeLine{233 \textcolor{comment}{                                                              !! tr\_vol\_conc\_units would be mol.}}
\DoxyCodeLine{234 }
\DoxyCodeLine{235   \textcolor{comment}{!   This subroutine returns the appropriate units for thicknesses and fluxes,}}
\DoxyCodeLine{236   \textcolor{comment}{! depending on whether the model is Boussinesq or not and the scaling for}}
\DoxyCodeLine{237   \textcolor{comment}{! the vertical thickness.}}
\DoxyCodeLine{238   \textcolor{keywordtype}{integer} :: cnt}
\DoxyCodeLine{239 }
\DoxyCodeLine{240   cnt = 0}
\DoxyCodeLine{241   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_units)) cnt = cnt+1}
\DoxyCodeLine{242   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_vol\_conc\_units)) cnt = cnt+1}
\DoxyCodeLine{243   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_mass\_conc\_units)) cnt = cnt+1}
\DoxyCodeLine{244 }
\DoxyCodeLine{245   \textcolor{keywordflow}{if} (cnt == 0) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"get\_tr\_flux\_units: One of the three "}//\&}
\DoxyCodeLine{246     \textcolor{stringliteral}{"arguments tr\_units, tr\_vol\_conc\_units, or tr\_mass\_conc\_units "}//\&}
\DoxyCodeLine{247     \textcolor{stringliteral}{"must be present."})}
\DoxyCodeLine{248   \textcolor{keywordflow}{if} (cnt > 1) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"get\_tr\_flux\_units: Only one of "}//\&}
\DoxyCodeLine{249     \textcolor{stringliteral}{"tr\_units, tr\_vol\_conc\_units, and tr\_mass\_conc\_units may be present."})}
\DoxyCodeLine{250   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_units)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{251     \textcolor{keywordflow}{if} (gv\%Boussinesq) \textcolor{keywordflow}{then}}
\DoxyCodeLine{252       get\_tr\_flux\_units = trim(tr\_units)//\textcolor{stringliteral}{" m3 s-\/1"}}
\DoxyCodeLine{253     \textcolor{keywordflow}{else}}
\DoxyCodeLine{254       get\_tr\_flux\_units = trim(tr\_units)//\textcolor{stringliteral}{" kg s-\/1"}}
\DoxyCodeLine{255 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{256 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{257   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_vol\_conc\_units)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{258     \textcolor{keywordflow}{if} (gv\%Boussinesq) \textcolor{keywordflow}{then}}
\DoxyCodeLine{259       get\_tr\_flux\_units = trim(tr\_vol\_conc\_units)//\textcolor{stringliteral}{" s-\/1"}}
\DoxyCodeLine{260     \textcolor{keywordflow}{else}}
\DoxyCodeLine{261       get\_tr\_flux\_units = trim(tr\_vol\_conc\_units)//\textcolor{stringliteral}{" m-\/3 kg s-\/1"}}
\DoxyCodeLine{262 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{263 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{264   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tr\_mass\_conc\_units)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{265     \textcolor{keywordflow}{if} (gv\%Boussinesq) \textcolor{keywordflow}{then}}
\DoxyCodeLine{266       get\_tr\_flux\_units = trim(tr\_mass\_conc\_units)//\textcolor{stringliteral}{" kg-\/1 m3 s-\/1"}}
\DoxyCodeLine{267     \textcolor{keywordflow}{else}}
\DoxyCodeLine{268       get\_tr\_flux\_units = trim(tr\_mass\_conc\_units)//\textcolor{stringliteral}{" s-\/1"}}
\DoxyCodeLine{269 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{270 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in,out}}  & {\em gv} & The container for vertical grid data \\
\hline
\mbox{\texttt{ in}}  & {\em rlay} & The layer target density \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A unit scaling factor for Rlay \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{276   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(inout)} :: GV\textcolor{comment}{   !< The container for vertical grid data}}
\DoxyCodeLine{277 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(GV\%ke)},  \textcolor{keywordtype}{intent(in)}    :: Rlay\textcolor{comment}{ !< The layer target density [R \string~> kg m-\/3]}}
\DoxyCodeLine{278 \textcolor{keywordtype}{  real},                    \textcolor{keywordtype}{intent(in)}    :: scale\textcolor{comment}{ !< A unit scaling factor for Rlay}}
\DoxyCodeLine{279   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{280   \textcolor{keywordtype}{integer} :: k, nk}
\DoxyCodeLine{281 }
\DoxyCodeLine{282   nk = gv\%ke}
\DoxyCodeLine{283 }
\DoxyCodeLine{284   gv\%zAxisLongName = \textcolor{stringliteral}{'Target Potential Density'}}
\DoxyCodeLine{285   gv\%zAxisUnits = \textcolor{stringliteral}{'kg m-\/3'}}
\DoxyCodeLine{286   \textcolor{keywordflow}{do} k=1,nk ; gv\%sLayer(k) = scale*rlay(k) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{287   \textcolor{keywordflow}{if} (nk > 1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{288     gv\%sInterface(1) = scale * (1.5*rlay(1) -\/ 0.5*rlay(2))}
\DoxyCodeLine{289     \textcolor{keywordflow}{do} k=2,nk ; gv\%sInterface(k) = scale * 0.5*( rlay(k-\/1) + rlay(k) ) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{290     gv\%sInterface(nk+1) = scale * (1.5*rlay(nk) -\/ 0.5*rlay(nk-\/1))}
\DoxyCodeLine{291   \textcolor{keywordflow}{else}}
\DoxyCodeLine{292     gv\%sInterface(1) = 0.0 ; gv\%sInterface(nk+1) = 2.0*scale*rlay(nk)}
\DoxyCodeLine{293 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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 298 of file M\+O\+M\+\_\+vertical\+Grid.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{299   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{pointer} :: GV\textcolor{comment}{ !< The ocean's vertical grid structure}}
\DoxyCodeLine{300 }
\DoxyCodeLine{301   \textcolor{keyword}{deallocate}( gv\%g\_prime, gv\%Rlay )}
\DoxyCodeLine{302   \textcolor{keyword}{deallocate}( gv\%sInterface , gv\%sLayer )}
\DoxyCodeLine{303   \textcolor{keyword}{deallocate}( gv )}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file handle/type \\
\hline
 & {\em gv} & The container for vertical grid data \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


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


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

\end{DoxyCode}
