\hypertarget{namespacemom__coord__initialization}{}\doxysection{mom\+\_\+coord\+\_\+initialization Module Reference}
\label{namespacemom__coord__initialization}\index{mom\_coord\_initialization@{mom\_coord\_initialization}}


\doxysubsection{Detailed Description}
Initializes fixed aspects of the related to its vertical coordinate. \doxysubsection*{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}
\doxysubsection*{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}


\doxysubsection{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}}
\doxysubsubsection{\texorpdfstring{mom\_initialize\_coord()}{mom\_initialize\_coord()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+coord\+\_\+initialization\+::mom\+\_\+initialize\+\_\+coord (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(inout)}]{GV,  }\item[{type(\mbox{\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\+\_\+scale\+\_\+type}}), intent(in)}]{US,  }\item[{type(\mbox{\hyperlink{structmom__file__parser_1_1param__file__type}{param\+\_\+file\+\_\+type}}), intent(in)}]{PF,  }\item[{logical, intent(in)}]{write\+\_\+geom,  }\item[{character(len=$\ast$), intent(in)}]{output\+\_\+dir,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1thermo__var__ptrs}{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{\texttt{ in,out}}  & {\em gv} & Ocean vertical grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em pf} & A structure indicating the open file to parse for model parameter values. \\
\hline
\mbox{\texttt{ in}}  & {\em write\+\_\+geom} & If true, write grid geometry files. \\
\hline
\mbox{\texttt{ in}}  & {\em output\+\_\+dir} & The directory into which to write files. \\
\hline
\mbox{\texttt{ in,out}}  & {\em tv} & The thermodynamic variable structure. \\
\hline
\mbox{\texttt{ in}}  & {\em max\+\_\+depth} & The ocean\textquotesingle{}s maximum depth \mbox{[}Z $\sim$$>$ m\mbox{]}. \\
\hline
\end{DoxyParams}


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


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


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


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


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


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


\begin{DoxyCode}{0}
\DoxyCodeLine{130   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{         !< The ocean's vertical grid structure.}}
\DoxyCodeLine{131 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(GV\%ke)},   \textcolor{keywordtype}{intent(out)} :: Rlay\textcolor{comment}{       !< The layers' target coordinate values}}
\DoxyCodeLine{132 \textcolor{comment}{                                                      !! (potential density) [R \string~> kg m-\/3].}}
\DoxyCodeLine{133 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(GV\%ke+1)}, \textcolor{keywordtype}{intent(out)} :: g\_prime\textcolor{comment}{    !< The reduced gravity across the interfaces}}
\DoxyCodeLine{134 \textcolor{comment}{                                                      !! [L2 Z-\/1 T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{135   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{         !< A dimensional unit scaling type}}
\DoxyCodeLine{136   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-\/time parameters}}
\DoxyCodeLine{137   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{138 \textcolor{keywordtype}{  real} :: g\_int   \textcolor{comment}{! Reduced gravities across the internal interfaces [L2 Z-\/1 T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{139 \textcolor{keywordtype}{  real} :: g\_fs    \textcolor{comment}{! Reduced gravity across the free surface [L2 Z-\/1 T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{140   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"{}set\_coord\_from\_gprime"{}} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{141   \textcolor{keywordtype}{integer} :: k, nz}
\DoxyCodeLine{142   nz = gv\%ke}
\DoxyCodeLine{143 }
\DoxyCodeLine{144   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"{}(), MOM\_coord\_initialization.F90"{}})}
\DoxyCodeLine{145 }
\DoxyCodeLine{146   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}GFS"{}} , g\_fs, \&}
\DoxyCodeLine{147                  \textcolor{stringliteral}{"{}The reduced gravity at the free surface."{}}, units=\textcolor{stringliteral}{"{}m s-\/2"{}}, \&}
\DoxyCodeLine{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)}
\DoxyCodeLine{149   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}GINT"{}}, g\_int, \&}
\DoxyCodeLine{150                  \textcolor{stringliteral}{"{}The reduced gravity across internal interfaces."{}}, \&}
\DoxyCodeLine{151                  units=\textcolor{stringliteral}{"{}m s-\/2"{}}, fail\_if\_missing=.true., scale=us\%m\_s\_to\_L\_T**2*us\%Z\_to\_m)}
\DoxyCodeLine{152 }
\DoxyCodeLine{153   g\_prime(1) = g\_fs}
\DoxyCodeLine{154   \textcolor{keywordflow}{do} k=2,nz ; g\_prime(k) = g\_int ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{155   rlay(1) = gv\%Rho0}
\DoxyCodeLine{156   \textcolor{keywordflow}{do} k=2,nz ; rlay(k) = rlay(k-\/1) + g\_prime(k)*(gv\%Rho0/gv\%g\_Earth) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{157 }
\DoxyCodeLine{158   \textcolor{keyword}{call }calltree\_leave(trim(mdl)//\textcolor{stringliteral}{'()'})}
\DoxyCodeLine{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}}
\doxysubsubsection{\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(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV,  }\item[{type(\mbox{\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\+\_\+scale\+\_\+type}}), intent(in)}]{US,  }\item[{type(\mbox{\hyperlink{structmom__file__parser_1_1param__file__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{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ out}}  & {\em rlay} & The layers\textquotesingle{} target coordinate values (potential density) \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em g\+\_\+prime} & The reduced gravity across the interfaces \mbox{[}L2 Z-\/1 T-\/2 $\sim$$>$ m s-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{164   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{         !< The ocean's vertical grid structure.}}
\DoxyCodeLine{165 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(GV\%ke)},   \textcolor{keywordtype}{intent(out)} :: Rlay\textcolor{comment}{       !< The layers' target coordinate values}}
\DoxyCodeLine{166 \textcolor{comment}{                                                      !! (potential density) [R \string~> kg m-\/3].}}
\DoxyCodeLine{167 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(GV\%ke+1)}, \textcolor{keywordtype}{intent(out)} :: g\_prime\textcolor{comment}{    !< The reduced gravity across the interfaces}}
\DoxyCodeLine{168 \textcolor{comment}{                                                      !! [L2 Z-\/1 T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{169   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{         !< A dimensional unit scaling type}}
\DoxyCodeLine{170   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure to parse for run-\/time parameters}}
\DoxyCodeLine{171 }
\DoxyCodeLine{172   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{173 \textcolor{keywordtype}{  real} :: g\_fs    \textcolor{comment}{! Reduced gravity across the free surface [L2 Z-\/1 T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{174 \textcolor{keywordtype}{  real} :: Rlay\_Ref\textcolor{comment}{! The surface layer's target density [R \string~> kg m-\/3].}}
\DoxyCodeLine{175 \textcolor{keywordtype}{  real} :: RLay\_range \textcolor{comment}{! The range of densities [R \string~> kg m-\/3].}}
\DoxyCodeLine{176   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"{}set\_coord\_from\_layer\_density"{}} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{177   \textcolor{keywordtype}{integer} :: k, nz}
\DoxyCodeLine{178   nz = gv\%ke}
\DoxyCodeLine{179 }
\DoxyCodeLine{180   \textcolor{keyword}{call }calltree\_enter(trim(mdl)//\textcolor{stringliteral}{"{}(), MOM\_coord\_initialization.F90"{}})}
\DoxyCodeLine{181 }
\DoxyCodeLine{182   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}GFS"{}}, g\_fs, \&}
\DoxyCodeLine{183                  \textcolor{stringliteral}{"{}The reduced gravity at the free surface."{}}, units=\textcolor{stringliteral}{"{}m s-\/2"{}}, \&}
\DoxyCodeLine{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)}
\DoxyCodeLine{185   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}LIGHTEST\_DENSITY"{}}, rlay\_ref, \&}
\DoxyCodeLine{186                  \textcolor{stringliteral}{"{}The reference potential density used for layer 1."{}}, \&}
\DoxyCodeLine{187                  units=\textcolor{stringliteral}{"{}kg m-\/3"{}}, default=us\%R\_to\_kg\_m3*gv\%Rho0, scale=us\%kg\_m3\_to\_R)}
\DoxyCodeLine{188   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}DENSITY\_RANGE"{}}, rlay\_range, \&}
\DoxyCodeLine{189                  \textcolor{stringliteral}{"{}The range of reference potential densities in the layers."{}}, \&}
\DoxyCodeLine{190                  units=\textcolor{stringliteral}{"{}kg m-\/3"{}}, default=2.0, scale=us\%kg\_m3\_to\_R)}
\DoxyCodeLine{191 }
\DoxyCodeLine{192   rlay(1) = rlay\_ref}
\DoxyCodeLine{193   \textcolor{keywordflow}{do} k=2,nz}
\DoxyCodeLine{194     rlay(k) = rlay(k-\/1) + rlay\_range/(real(nz-\/1))}
\DoxyCodeLine{195 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{196 \textcolor{comment}{!    These statements set the interface reduced gravities.           !}}
\DoxyCodeLine{197   g\_prime(1) = g\_fs}
\DoxyCodeLine{198   \textcolor{keywordflow}{do} k=2,nz}
\DoxyCodeLine{199     g\_prime(k) = (gv\%g\_Earth/(gv\%Rho0)) * (rlay(k) -\/ rlay(k-\/1))}
\DoxyCodeLine{200 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{201 }
\DoxyCodeLine{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}}
\doxysubsubsection{\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(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV,  }\item[{type(\mbox{\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\+\_\+scale\+\_\+type}}), intent(in)}]{US,  }\item[{type(\mbox{\hyperlink{structmom__file__parser_1_1param__file__type}{param\+\_\+file\+\_\+type}}), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__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{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure \\
\hline
\mbox{\texttt{ out}}  & {\em rlay} & Layer potential density \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em g\+\_\+prime} & The reduced gravity at each interface \mbox{[}L2 Z-\/1 T-\/2 $\sim$$>$ m s-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
 & {\em eqn\+\_\+of\+\_\+state} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em p\+\_\+ref} & The coordinate-\/density reference pressure \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]}. \\
\hline
\end{DoxyParams}


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


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


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


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


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


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


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


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


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


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


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


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

\end{DoxyCode}
