\hypertarget{namespaceexternal__gwave__initialization}{}\doxysection{external\+\_\+gwave\+\_\+initialization Module Reference}
\label{namespaceexternal__gwave__initialization}\index{external\_gwave\_initialization@{external\_gwave\_initialization}}


\doxysubsection{Detailed Description}
Initialization for the \char`\"{}external gravity wave wave\char`\"{} configuration. \doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespaceexternal__gwave__initialization_aaa8bba3407dfd79a11a3b2454656be44}{external\+\_\+gwave\+\_\+initialize\+\_\+thickness}} (h, G, GV, US, param\+\_\+file, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em This subroutine initializes layer thicknesses for the external\+\_\+gwave experiment. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespaceexternal__gwave__initialization_aaa8bba3407dfd79a11a3b2454656be44}\label{namespaceexternal__gwave__initialization_aaa8bba3407dfd79a11a3b2454656be44}} 
\index{external\_gwave\_initialization@{external\_gwave\_initialization}!external\_gwave\_initialize\_thickness@{external\_gwave\_initialize\_thickness}}
\index{external\_gwave\_initialize\_thickness@{external\_gwave\_initialize\_thickness}!external\_gwave\_initialization@{external\_gwave\_initialization}}
\doxysubsubsection{\texorpdfstring{external\_gwave\_initialize\_thickness()}{external\_gwave\_initialize\_thickness()}}
{\footnotesize\ttfamily subroutine, public external\+\_\+gwave\+\_\+initialization\+::external\+\_\+gwave\+\_\+initialize\+\_\+thickness (\begin{DoxyParamCaption}\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, gv \%ke), intent(out)}]{h,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{logical, intent(in), optional}]{just\+\_\+read\+\_\+params }\end{DoxyParamCaption})}



This subroutine initializes layer thicknesses for the external\+\_\+gwave experiment. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\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{ out}}  & {\em h} & The thickness that is being initialized \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure indicating the open file to parse for model parameter values. \\
\hline
\mbox{\texttt{ in}}  & {\em just\+\_\+read\+\_\+params} & If present and true, this call will only read parameters without changing h. \\
\hline
\end{DoxyParams}


Definition at line 29 of file external\+\_\+gwave\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{29   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{           !< The ocean's grid structure.}}
\DoxyCodeLine{30   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{          !< The ocean's vertical grid structure.}}
\DoxyCodeLine{31   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{          !< A dimensional unit scaling type}}
\DoxyCodeLine{32 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \&}
\DoxyCodeLine{33                            \textcolor{keywordtype}{intent(out)} :: h\textcolor{comment}{           !< The thickness that is being initialized [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{34   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{  !< A structure indicating the open file}}
\DoxyCodeLine{35 \textcolor{comment}{                                                      !! to parse for model parameter values.}}
\DoxyCodeLine{36   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}}
\DoxyCodeLine{37 \textcolor{comment}{                                                      !! only read parameters without changing h.}}
\DoxyCodeLine{38   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{39 \textcolor{keywordtype}{  real} :: eta1D(SZK\_(G)+1)\textcolor{comment}{! Interface height relative to the sea surface}}
\DoxyCodeLine{40                           \textcolor{comment}{! positive upward [Z \string~> m].}}
\DoxyCodeLine{41 \textcolor{keywordtype}{  real} :: ssh\_anomaly\_height \textcolor{comment}{! Vertical height of ssh anomaly}}
\DoxyCodeLine{42 \textcolor{keywordtype}{  real} :: ssh\_anomaly\_width \textcolor{comment}{! Lateral width of anomaly}}
\DoxyCodeLine{43   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}}
\DoxyCodeLine{44   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"external\_gwave\_initialize\_thickness"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{45 \textcolor{comment}{! This include declares and sets the variable "version".}}
\DoxyCodeLine{46 \textcolor{preprocessor}{\#include "version\_variable.h"}}
\DoxyCodeLine{47 \textcolor{preprocessor}{}  \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz}
\DoxyCodeLine{48 \textcolor{keywordtype}{  real} :: PI, Xnondim}
\DoxyCodeLine{49 }
\DoxyCodeLine{50   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{51 }
\DoxyCodeLine{52   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params}
\DoxyCodeLine{53 }
\DoxyCodeLine{54   \textcolor{keywordflow}{if} (.not.just\_read) \&}
\DoxyCodeLine{55     \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"  external\_gwave\_initialization.F90, external\_gwave\_initialize\_thickness: setting thickness"}, 5)}
\DoxyCodeLine{56 }
\DoxyCodeLine{57   \textcolor{keywordflow}{if} (.not.just\_read) \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})}
\DoxyCodeLine{58   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SSH\_ANOMALY\_HEIGHT"}, ssh\_anomaly\_height, \&}
\DoxyCodeLine{59                  \textcolor{stringliteral}{"The vertical displacement of the SSH anomaly. "}, units=\textcolor{stringliteral}{"m"}, \&}
\DoxyCodeLine{60                  fail\_if\_missing=.not.just\_read, do\_not\_log=just\_read, scale=us\%m\_to\_Z)}
\DoxyCodeLine{61   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SSH\_ANOMALY\_WIDTH"}, ssh\_anomaly\_width, \&}
\DoxyCodeLine{62                  \textcolor{stringliteral}{"The lateral width of the SSH anomaly. "}, units=\textcolor{stringliteral}{"coordinate"}, \&}
\DoxyCodeLine{63                  fail\_if\_missing=.not.just\_read, do\_not\_log=just\_read)}
\DoxyCodeLine{64 }
\DoxyCodeLine{65   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-\/time parameters have been read, so return.}}
\DoxyCodeLine{66 }
\DoxyCodeLine{67   pi = 4.0*atan(1.0)}
\DoxyCodeLine{68   \textcolor{keywordflow}{do} j=g\%jsc,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc,g\%iec}
\DoxyCodeLine{69     xnondim = (g\%geoLonT(i,j)-\/g\%west\_lon-\/0.5*g\%len\_lon) / ssh\_anomaly\_width}
\DoxyCodeLine{70     xnondim = min(1., abs(xnondim))}
\DoxyCodeLine{71     eta1d(1) = ssh\_anomaly\_height * 0.5 * ( 1. + cos(pi*xnondim) ) \textcolor{comment}{! Cosine bell}}
\DoxyCodeLine{72     \textcolor{keywordflow}{do} k=2,nz}
\DoxyCodeLine{73       eta1d(k) = -\/g\%max\_depth \& \textcolor{comment}{! Stretch interior interfaces with SSH}}
\DoxyCodeLine{74               + (eta1d(1)+g\%max\_depth) * ( real(nz+1-\/k)/real(nz) ) \textcolor{comment}{! Stratification}}
\DoxyCodeLine{75 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{76     eta1d(nz+1) = -\/g\%max\_depth \textcolor{comment}{! Force bottom interface to bottom}}
\DoxyCodeLine{77     \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{78       h(i,j,k) = gv\%Z\_to\_H * (eta1d(k) -\/ eta1d(k+1))}
\DoxyCodeLine{79 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{80 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{81 }

\end{DoxyCode}
