\hypertarget{namespacecircle__obcs__initialization}{}\section{circle\+\_\+obcs\+\_\+initialization Module Reference}
\label{namespacecircle__obcs__initialization}\index{circle\+\_\+obcs\+\_\+initialization@{circle\+\_\+obcs\+\_\+initialization}}


\subsection{Detailed Description}
Configures the model for the \char`\"{}circle\+\_\+obcs\char`\"{} experiment which tests Open Boundary Conditions radiating an S\+SH anomaly. \subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacecircle__obcs__initialization_a2951fe882c40d4cfa45b299b10919101}{circle\+\_\+obcs\+\_\+initialize\+\_\+thickness}} (h, G, GV, param\+\_\+file, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em This subroutine initializes layer thicknesses for the circle\+\_\+obcs experiment. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacecircle__obcs__initialization_a2951fe882c40d4cfa45b299b10919101}\label{namespacecircle__obcs__initialization_a2951fe882c40d4cfa45b299b10919101}} 
\index{circle\+\_\+obcs\+\_\+initialization@{circle\+\_\+obcs\+\_\+initialization}!circle\+\_\+obcs\+\_\+initialize\+\_\+thickness@{circle\+\_\+obcs\+\_\+initialize\+\_\+thickness}}
\index{circle\+\_\+obcs\+\_\+initialize\+\_\+thickness@{circle\+\_\+obcs\+\_\+initialize\+\_\+thickness}!circle\+\_\+obcs\+\_\+initialization@{circle\+\_\+obcs\+\_\+initialization}}
\subsubsection{\texorpdfstring{circle\+\_\+obcs\+\_\+initialize\+\_\+thickness()}{circle\_obcs\_initialize\_thickness()}}
{\footnotesize\ttfamily subroutine, public circle\+\_\+obcs\+\_\+initialization\+::circle\+\_\+obcs\+\_\+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(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{logical, intent(in), optional}]{just\+\_\+read\+\_\+params }\end{DoxyParamCaption})}



This subroutine initializes layer thicknesses for the circle\+\_\+obcs 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 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 32 of file circle\+\_\+obcs\+\_\+initialization.\+F90.


\begin{DoxyCode}
32   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{   !< The ocean's grid structure.}
33   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{  !< The ocean's vertical grid structure.}
34   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(GV))}, &
35                            \textcolor{keywordtype}{intent(out)} :: h\textcolor{comment}{           !< The thickness that is being initialized [H ~> m or
       kg m-2].}
36   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{  !< A structure indicating the open file}
37 \textcolor{comment}{                                                      !! to parse for model parameter values.}
38   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}
39 \textcolor{comment}{                                                      !! only read parameters without changing h.}
40 
41   \textcolor{keywordtype}{real} :: e0(SZK\_(GV)+1)   \textcolor{comment}{! The resting interface heights, in depth units [Z ~> m], usually}
42                            \textcolor{comment}{! negative because it is positive upward.}
43   \textcolor{keywordtype}{real} :: eta1D(SZK\_(GV)+1)\textcolor{comment}{! Interface height relative to the sea surface}
44                            \textcolor{comment}{! positive upward, in depth units [Z ~> m].}
45   \textcolor{keywordtype}{real} :: IC\_amp           \textcolor{comment}{! The amplitude of the initial height displacement [H ~> m or kg m-2].}
46   \textcolor{keywordtype}{real} :: diskrad, rad, xCenter, xRadius, lonC, latC, xOffset
47   \textcolor{keywordtype}{logical} :: just\_read
48   \textcolor{comment}{! This include declares and sets the variable "version".}
49 \textcolor{preprocessor}{# include "version\_variable.h"}
50 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"circle\_obcs\_initialization"}   \textcolor{comment}{! This module's name.}
51   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz
52 
53   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
54 
55   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params
56 
57   \textcolor{keywordflow}{if} (.not.just\_read) &
58     \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"  circle\_obcs\_initialization.F90, circle\_obcs\_initialize\_thickness: setting thickness"}, 
      5)
59 
60   \textcolor{keywordflow}{if} (.not.just\_read) \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})
61   \textcolor{comment}{! Parameters read by cartesian grid initialization}
62   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DISK\_RADIUS"}, diskrad, &
63                  \textcolor{stringliteral}{"The radius of the initially elevated disk in the "}//&
64                  \textcolor{stringliteral}{"circle\_obcs test case."}, units=g%x\_axis\_units, &
65                  fail\_if\_missing=.not.just\_read, do\_not\_log=just\_read)
66   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DISK\_X\_OFFSET"}, xoffset, &
67                  \textcolor{stringliteral}{"The x-offset of the initially elevated disk in the "}//&
68                  \textcolor{stringliteral}{"circle\_obcs test case."}, units=g%x\_axis\_units, &
69                  default = 0.0, do\_not\_log=just\_read)
70   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DISK\_IC\_AMPLITUDE"}, ic\_amp, &
71                  \textcolor{stringliteral}{"Initial amplitude of interface height displacements "}//&
72                  \textcolor{stringliteral}{"in the circle\_obcs test case."}, &
73                  units=\textcolor{stringliteral}{'m'}, default=5.0, scale=gv%m\_to\_H, do\_not\_log=just\_read)
74 
75   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-time parameters have been read, so return.}
76 
77   \textcolor{keywordflow}{do} k=1,nz
78     e0(k) = -g%max\_depth * \textcolor{keywordtype}{real(k-1)} / \textcolor{keywordtype}{real}(nz)
79 \textcolor{keywordflow}{  enddo}
80 
81   \textcolor{comment}{! Uniform thicknesses for base state}
82   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie                        \textcolor{comment}{!}
83     eta1d(nz+1) = -g%bathyT(i,j)
84     \textcolor{keywordflow}{do} k=nz,1,-1
85       eta1d(k) = e0(k)
86       \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + gv%Angstrom\_Z)) \textcolor{keywordflow}{then}
87         eta1d(k) = eta1d(k+1) + gv%Angstrom\_Z
88         h(i,j,k) = gv%Angstrom\_H
89       \textcolor{keywordflow}{else}
90         h(i,j,k) = gv%Z\_to\_H * (eta1d(k) - eta1d(k+1))
91 \textcolor{keywordflow}{      endif}
92 \textcolor{keywordflow}{    enddo}
93 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
94 
95   \textcolor{comment}{! Perturb base state by circular anomaly in center}
96   k=nz
97   latc = g%south\_lat + 0.5*g%len\_lat
98   lonc = g%west\_lon + 0.5*g%len\_lon + xoffset
99   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
100     rad = sqrt((g%geoLonT(i,j)-lonc)**2+(g%geoLatT(i,j)-latc)**2)/(diskrad)
101     \textcolor{comment}{! if (rad <= 6.*diskrad) h(i,j,k) = h(i,j,k)+10.0*exp( -0.5*( rad**2 ) )}
102     rad = min( rad, 1. ) \textcolor{comment}{! Flatten outside radius of diskrad}
103     rad = rad*(2.*asin(1.)) \textcolor{comment}{! Map 0-1 to 0-pi}
104     \textcolor{keywordflow}{if} (nz==1) \textcolor{keywordflow}{then}
105       \textcolor{comment}{! The model is barotropic}
106       h(i,j,k) = h(i,j,k) + ic\_amp * 0.5*(1.+cos(rad)) \textcolor{comment}{! cosine bell}
107     \textcolor{keywordflow}{else}
108       \textcolor{comment}{! The model is baroclinic}
109       \textcolor{keywordflow}{do} k = 1, nz
110         h(i,j,k) = h(i,j,k) - 0.5*(1.+cos(rad)) * ic\_amp * \textcolor{keywordtype}{real}( 2*k-nz )
111 \textcolor{keywordflow}{      enddo}
112 \textcolor{keywordflow}{    endif}
113 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
114 
\end{DoxyCode}
