\hypertarget{namespacetidal__bay__initialization}{}\doxysection{tidal\+\_\+bay\+\_\+initialization Module Reference}
\label{namespacetidal__bay__initialization}\index{tidal\_bay\_initialization@{tidal\_bay\_initialization}}


\doxysubsection{Detailed Description}
Configures the model for the \char`\"{}tidal\+\_\+bay\char`\"{} experiment. tidal\+\_\+bay = Tidally resonant bay from Zygmunt Kowalik\textquotesingle{}s class on tides. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structtidal__bay__initialization_1_1tidal__bay__obc__cs}{tidal\+\_\+bay\+\_\+obc\+\_\+cs}}
\begin{DoxyCompactList}\small\item\em Control structure for tidal bay open boundaries. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
logical function, public \mbox{\hyperlink{namespacetidal__bay__initialization_a6a382dc13d49aa2d37577b8fbf5f7de2}{register\+\_\+tidal\+\_\+bay\+\_\+obc}} (param\+\_\+file, CS, O\+B\+C\+\_\+\+Reg)
\begin{DoxyCompactList}\small\item\em Add tidal bay to O\+BC registry. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacetidal__bay__initialization_a0c8bd22e72376c9f9af5bc5f628393f9}{tidal\+\_\+bay\+\_\+obc\+\_\+end}} (CS)
\begin{DoxyCompactList}\small\item\em Clean up the tidal bay O\+BC from registry. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacetidal__bay__initialization_a874c04828e2652fbd356c8a89c8179da}{tidal\+\_\+bay\+\_\+set\+\_\+obc\+\_\+data}} (O\+BC, CS, G, h, Time)
\begin{DoxyCompactList}\small\item\em This subroutine sets the properties of flow at open boundary conditions. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacetidal__bay__initialization_a6a382dc13d49aa2d37577b8fbf5f7de2}\label{namespacetidal__bay__initialization_a6a382dc13d49aa2d37577b8fbf5f7de2}} 
\index{tidal\_bay\_initialization@{tidal\_bay\_initialization}!register\_tidal\_bay\_obc@{register\_tidal\_bay\_obc}}
\index{register\_tidal\_bay\_obc@{register\_tidal\_bay\_obc}!tidal\_bay\_initialization@{tidal\_bay\_initialization}}
\doxysubsubsection{\texorpdfstring{register\_tidal\_bay\_obc()}{register\_tidal\_bay\_obc()}}
{\footnotesize\ttfamily logical function, public tidal\+\_\+bay\+\_\+initialization\+::register\+\_\+tidal\+\_\+bay\+\_\+obc (\begin{DoxyParamCaption}\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structtidal__bay__initialization_1_1tidal__bay__obc__cs}{tidal\+\_\+bay\+\_\+obc\+\_\+cs}}), pointer}]{CS,  }\item[{type(obc\+\_\+registry\+\_\+type), pointer}]{O\+B\+C\+\_\+\+Reg }\end{DoxyParamCaption})}



Add tidal bay to O\+BC registry. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & parameter file. \\
\hline
 & {\em cs} & tidal bay control structure. \\
\hline
 & {\em obc\+\_\+reg} & O\+BC registry. \\
\hline
\end{DoxyParams}


Definition at line 34 of file tidal\+\_\+bay\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{34   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< parameter file.}}
\DoxyCodeLine{35   \textcolor{keywordtype}{type}(tidal\_bay\_OBC\_CS),   \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{         !< tidal bay control structure.}}
\DoxyCodeLine{36   \textcolor{keywordtype}{type}(OBC\_registry\_type),  \textcolor{keywordtype}{pointer}    :: OBC\_Reg\textcolor{comment}{    !< OBC registry.}}
\DoxyCodeLine{37   \textcolor{keywordtype}{logical}                              :: register\_tidal\_bay\_OBC}
\DoxyCodeLine{38   \textcolor{keywordtype}{character(len=32)}  :: casename = \textcolor{stringliteral}{"tidal bay"}\textcolor{comment}{       !< This case's name.}}
\DoxyCodeLine{39 }
\DoxyCodeLine{40   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{41     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"register\_tidal\_bay\_OBC called with an "}// \&}
\DoxyCodeLine{42                             \textcolor{stringliteral}{"associated control structure."})}
\DoxyCodeLine{43     \textcolor{keywordflow}{return}}
\DoxyCodeLine{44 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{45   \textcolor{keyword}{allocate}(cs)}
\DoxyCodeLine{46 }
\DoxyCodeLine{47   \textcolor{comment}{! Register the open boundaries.}}
\DoxyCodeLine{48   \textcolor{keyword}{call }register\_obc(casename, param\_file, obc\_reg)}
\DoxyCodeLine{49   register\_tidal\_bay\_obc = .true.}
\DoxyCodeLine{50 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacetidal__bay__initialization_a0c8bd22e72376c9f9af5bc5f628393f9}\label{namespacetidal__bay__initialization_a0c8bd22e72376c9f9af5bc5f628393f9}} 
\index{tidal\_bay\_initialization@{tidal\_bay\_initialization}!tidal\_bay\_obc\_end@{tidal\_bay\_obc\_end}}
\index{tidal\_bay\_obc\_end@{tidal\_bay\_obc\_end}!tidal\_bay\_initialization@{tidal\_bay\_initialization}}
\doxysubsubsection{\texorpdfstring{tidal\_bay\_obc\_end()}{tidal\_bay\_obc\_end()}}
{\footnotesize\ttfamily subroutine, public tidal\+\_\+bay\+\_\+initialization\+::tidal\+\_\+bay\+\_\+obc\+\_\+end (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structtidal__bay__initialization_1_1tidal__bay__obc__cs}{tidal\+\_\+bay\+\_\+obc\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Clean up the tidal bay O\+BC from registry. 


\begin{DoxyParams}{Parameters}
{\em cs} & tidal bay control structure. \\
\hline
\end{DoxyParams}


Definition at line 55 of file tidal\+\_\+bay\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{55   \textcolor{keywordtype}{type}(tidal\_bay\_OBC\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{         !< tidal bay control structure.}}
\DoxyCodeLine{56 }
\DoxyCodeLine{57   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{58     \textcolor{keyword}{deallocate}(cs)}
\DoxyCodeLine{59 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacetidal__bay__initialization_a874c04828e2652fbd356c8a89c8179da}\label{namespacetidal__bay__initialization_a874c04828e2652fbd356c8a89c8179da}} 
\index{tidal\_bay\_initialization@{tidal\_bay\_initialization}!tidal\_bay\_set\_obc\_data@{tidal\_bay\_set\_obc\_data}}
\index{tidal\_bay\_set\_obc\_data@{tidal\_bay\_set\_obc\_data}!tidal\_bay\_initialization@{tidal\_bay\_initialization}}
\doxysubsubsection{\texorpdfstring{tidal\_bay\_set\_obc\_data()}{tidal\_bay\_set\_obc\_data()}}
{\footnotesize\ttfamily subroutine, public tidal\+\_\+bay\+\_\+initialization\+::tidal\+\_\+bay\+\_\+set\+\_\+obc\+\_\+data (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+obc\+\_\+type), pointer}]{O\+BC,  }\item[{type(\mbox{\hyperlink{structtidal__bay__initialization_1_1tidal__bay__obc__cs}{tidal\+\_\+bay\+\_\+obc\+\_\+cs}}), pointer}]{CS,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h,  }\item[{type(time\+\_\+type), intent(in)}]{Time }\end{DoxyParamCaption})}



This subroutine sets the properties of flow at open boundary conditions. 


\begin{DoxyParams}[1]{Parameters}
 & {\em obc} & This open boundary condition type specifies whether, where, and what open boundary conditions are used. \\
\hline
 & {\em cs} & tidal bay control structure. \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em h} & layer thickness. \\
\hline
\mbox{\texttt{ in}}  & {\em time} & model time. \\
\hline
\end{DoxyParams}


Definition at line 64 of file tidal\+\_\+bay\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{64   \textcolor{keywordtype}{type}(ocean\_OBC\_type),   \textcolor{keywordtype}{pointer}    :: OBC\textcolor{comment}{  !< This open boundary condition type specifies}}
\DoxyCodeLine{65 \textcolor{comment}{                                             !! whether, where, and what open boundary}}
\DoxyCodeLine{66 \textcolor{comment}{                                             !! conditions are used.}}
\DoxyCodeLine{67   \textcolor{keywordtype}{type}(tidal\_bay\_OBC\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{   !< tidal bay control structure.}}
\DoxyCodeLine{68   \textcolor{keywordtype}{type}(ocean\_grid\_type),  \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure.}}
\DoxyCodeLine{69 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{ !< layer thickness.}}
\DoxyCodeLine{70   \textcolor{keywordtype}{type}(time\_type),        \textcolor{keywordtype}{intent(in)} :: Time\textcolor{comment}{ !< model time.}}
\DoxyCodeLine{71 }
\DoxyCodeLine{72   \textcolor{comment}{! The following variables are used to set up the transport in the tidal\_bay example.}}
\DoxyCodeLine{73 \textcolor{keywordtype}{  real} :: time\_sec, cff}
\DoxyCodeLine{74 \textcolor{keywordtype}{  real} :: my\_flux, total\_area}
\DoxyCodeLine{75 \textcolor{keywordtype}{  real} :: PI}
\DoxyCodeLine{76 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{allocatable} :: my\_area(:,:)}
\DoxyCodeLine{77   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"tidal\_bay\_set\_OBC\_data"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{78   \textcolor{keywordtype}{integer} :: i, j, k, itt, is, ie, js, je, isd, ied, jsd, jed, nz, n}
\DoxyCodeLine{79   \textcolor{keywordtype}{integer} :: IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{80   \textcolor{keywordtype}{type}(OBC\_segment\_type), \textcolor{keywordtype}{pointer} :: segment => null()}
\DoxyCodeLine{81 }
\DoxyCodeLine{82   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{83   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{84   isdb = g\%IsdB ; iedb = g\%IedB ; jsdb = g\%JsdB ; jedb = g\%JedB}
\DoxyCodeLine{85 }
\DoxyCodeLine{86   pi = 4.0*atan(1.0)}
\DoxyCodeLine{87 }
\DoxyCodeLine{88   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(obc)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{89 }
\DoxyCodeLine{90   \textcolor{keyword}{allocate}(my\_area(1:1,js:je))}
\DoxyCodeLine{91 }
\DoxyCodeLine{92   time\_sec = time\_type\_to\_real(time)}
\DoxyCodeLine{93   cff = 0.1*sin(2.0*pi*time\_sec/(12.0*3600.0))}
\DoxyCodeLine{94   my\_area=0.0}
\DoxyCodeLine{95   my\_flux=0.0}
\DoxyCodeLine{96   segment => obc\%segment(1)}
\DoxyCodeLine{97 }
\DoxyCodeLine{98   \textcolor{keywordflow}{do} j=segment\%HI\%jsc,segment\%HI\%jec ; \textcolor{keywordflow}{do} i=segment\%HI\%IscB,segment\%HI\%IecB}
\DoxyCodeLine{99     \textcolor{keywordflow}{if} (obc\%segnum\_u(i,j) /= obc\_none) \textcolor{keywordflow}{then}}
\DoxyCodeLine{100       \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{101         my\_area(1,j) = my\_area(1,j) + h(i,j,k)*g\%US\%L\_to\_m*g\%dyCu(i,j)}
\DoxyCodeLine{102 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{103 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{104 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{105   total\_area = \mbox{\hyperlink{interfacemom__coms_1_1reproducing__sum}{reproducing\_sum}}(my\_area)}
\DoxyCodeLine{106   my\_flux = -\/ cs\%tide\_flow*sin(2.0*pi*time\_sec/(12.0*3600.0))}
\DoxyCodeLine{107 }
\DoxyCodeLine{108   \textcolor{keywordflow}{do} n = 1, obc\%number\_of\_segments}
\DoxyCodeLine{109     segment => obc\%segment(n)}
\DoxyCodeLine{110 }
\DoxyCodeLine{111     \textcolor{keywordflow}{if} (.not. segment\%on\_pe) cycle}
\DoxyCodeLine{112 }
\DoxyCodeLine{113     segment\%normal\_vel\_bt(:,:) = g\%US\%m\_s\_to\_L\_T*my\_flux/total\_area}
\DoxyCodeLine{114     segment\%eta(:,:) = cff}
\DoxyCodeLine{115 }
\DoxyCodeLine{116 \textcolor{keywordflow}{  enddo} \textcolor{comment}{! end segment loop}}
\DoxyCodeLine{117 }

\end{DoxyCode}
