\hypertarget{namespacecircle__obcs__initialization}{}\doxysection{circle\+\_\+obcs\+\_\+initialization Module Reference}
\label{namespacecircle__obcs__initialization}\index{circle\_obcs\_initialization@{circle\_obcs\_initialization}}


\doxysubsection{Detailed Description}
Configures the model for the \char`\"{}circle\+\_\+obcs\char`\"{} experiment which tests Open Boundary Conditions radiating an S\+SH anomaly. \doxysubsection*{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}


\doxysubsection{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}}
\doxysubsubsection{\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{\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{ 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 32 of file circle\+\_\+obcs\+\_\+initialization.\+F90.


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

\end{DoxyCode}
