\hypertarget{namespaceexternal__gwave__initialization}{}\section{external\+\_\+gwave\+\_\+initialization Module Reference}
\label{namespaceexternal__gwave__initialization}\index{external\+\_\+gwave\+\_\+initialization@{external\+\_\+gwave\+\_\+initialization}}


\subsection{Detailed Description}
Initialization for the \char`\"{}external gravity wave wave\char`\"{} configuration. \subsection*{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}


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