\hypertarget{namespacemom__boundary__update}{}\section{mom\+\_\+boundary\+\_\+update Module Reference}
\label{namespacemom__boundary__update}\index{mom\+\_\+boundary\+\_\+update@{mom\+\_\+boundary\+\_\+update}}


\subsection{Detailed Description}
Controls where open boundary conditions are applied. 

This module updates the open boundary arrays when time-\/varying. It caused a circular dependency with the tidal\+\_\+bay setup when M\+O\+M\+\_\+open\+\_\+boundary.

A small fragment of the grid is shown below\+:

j+1 x $^\wedge$ x $^\wedge$ x At x\+: q, Coriolis\+Bu j+1 $>$ o $>$ o $>$ At $^\wedge$\+: v, tauy j x $^\wedge$ x $^\wedge$ x At $>$\+: u, taux j $>$ o $>$ o $>$ At o\+: h, bathyT, buoy, tr, T, S, Rml, ustar j-\/1 x $^\wedge$ x $^\wedge$ x i-\/1 i i+1 At x \& $^\wedge$\+: i i+1 At $>$ \& o\+:

The boundaries always run through q grid points (x). \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \hyperlink{structmom__boundary__update_1_1update__obc__cs}{update\+\_\+obc\+\_\+cs}
\begin{DoxyCompactList}\small\item\em The control structure for the M\+O\+M\+\_\+boundary\+\_\+update module. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \hyperlink{namespacemom__boundary__update_a455e3d4565a6023e3c144eefb9bafac5}{call\+\_\+obc\+\_\+register} (param\+\_\+file, CS, O\+BC)
\begin{DoxyCompactList}\small\item\em The following subroutines and associated definitions provide the machinery to register and call the subroutines that initialize open boundary conditions. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__boundary__update_a7c2a0d48706fa7b58ce1f584ff0c5d4f}{update\+\_\+obc\+\_\+data} (O\+BC, G, GV, US, tv, h, CS, Time)
\begin{DoxyCompactList}\small\item\em Calls appropriate routine to update the open boundary conditions. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__boundary__update_a32cfc645987cee827d4d193537b09c71}{obc\+\_\+register\+\_\+end} (CS)
\begin{DoxyCompactList}\small\item\em Clean up the O\+BC registry. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacemom__boundary__update_a795944da50c68e071b26daa8c59bb144}\label{namespacemom__boundary__update_a795944da50c68e071b26daa8c59bb144}} 
integer \hyperlink{namespacemom__boundary__update_a795944da50c68e071b26daa8c59bb144}{id\+\_\+clock\+\_\+pass}
\begin{DoxyCompactList}\small\item\em A C\+PU time clock ID. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__boundary__update_a455e3d4565a6023e3c144eefb9bafac5}\label{namespacemom__boundary__update_a455e3d4565a6023e3c144eefb9bafac5}} 
\index{mom\+\_\+boundary\+\_\+update@{mom\+\_\+boundary\+\_\+update}!call\+\_\+obc\+\_\+register@{call\+\_\+obc\+\_\+register}}
\index{call\+\_\+obc\+\_\+register@{call\+\_\+obc\+\_\+register}!mom\+\_\+boundary\+\_\+update@{mom\+\_\+boundary\+\_\+update}}
\subsubsection{\texorpdfstring{call\+\_\+obc\+\_\+register()}{call\_obc\_register()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+boundary\+\_\+update\+::call\+\_\+obc\+\_\+register (\begin{DoxyParamCaption}\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\hyperlink{structmom__boundary__update_1_1update__obc__cs}{update\+\_\+obc\+\_\+cs}), pointer}]{CS,  }\item[{type(ocean\+\_\+obc\+\_\+type), pointer}]{O\+BC }\end{DoxyParamCaption})}



The following subroutines and associated definitions provide the machinery to register and call the subroutines that initialize open boundary conditions. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em param\+\_\+file} & Parameter file to parse\\
\hline
 & {\em cs} & Control structure for O\+B\+Cs\\
\hline
 & {\em obc} & Open boundary structure \\
\hline
\end{DoxyParams}


Definition at line 62 of file M\+O\+M\+\_\+boundary\+\_\+update.\+F90.


\begin{DoxyCode}
62   \textcolor{keywordtype}{type}(param\_file\_type),     \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< Parameter file to parse}
63   \textcolor{keywordtype}{type}(update\_obc\_cs),       \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{         !< Control structure for OBCs}
64   \textcolor{keywordtype}{type}(ocean\_obc\_type),      \textcolor{keywordtype}{pointer}    :: obc\textcolor{comment}{        !< Open boundary structure}
65 
66   \textcolor{comment}{! Local variables}
67   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_boundary\_update"} \textcolor{comment}{! This module's name.}
68   \textcolor{comment}{! This include declares and sets the variable "version".}
69 \textcolor{preprocessor}{# include "version\_variable.h"}
70 \textcolor{preprocessor}{}  \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
71     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"call\_OBC\_register called with an associated "}// &
72                             \textcolor{stringliteral}{"control structure."})
73     \textcolor{keywordflow}{return}
74   \textcolor{keywordflow}{else} ; \textcolor{keyword}{allocate}(cs) ;\textcolor{keywordflow}{ endif}
75 
76   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})
77 
78   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"USE\_FILE\_OBC"}, cs%use\_files, &
79                  \textcolor{stringliteral}{"If true, use external files for the open boundary."}, &
80                  default=.false.)
81   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"USE\_TIDAL\_BAY\_OBC"}, cs%use\_tidal\_bay, &
82                  \textcolor{stringliteral}{"If true, use the tidal\_bay open boundary."}, &
83                  default=.false.)
84   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"USE\_KELVIN\_WAVE\_OBC"}, cs%use\_Kelvin, &
85                  \textcolor{stringliteral}{"If true, use the Kelvin wave open boundary."}, &
86                  default=.false.)
87   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"USE\_SHELFWAVE\_OBC"}, cs%use\_shelfwave, &
88                  \textcolor{stringliteral}{"If true, use the shelfwave open boundary."}, &
89                  default=.false.)
90   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"USE\_DYED\_CHANNEL\_OBC"}, cs%use\_dyed\_channel, &
91                  \textcolor{stringliteral}{"If true, use the dyed channel open boundary."}, &
92                  default=.false.)
93 
94   \textcolor{keywordflow}{if} (cs%use\_files) cs%use\_files = &
95     register\_file\_obc(param\_file, cs%file\_OBC\_CSp, &
96                obc%OBC\_Reg)
97   \textcolor{keywordflow}{if} (cs%use\_tidal\_bay) cs%use\_tidal\_bay = &
98     register\_tidal\_bay\_obc(param\_file, cs%tidal\_bay\_OBC\_CSp, &
99                obc%OBC\_Reg)
100   \textcolor{keywordflow}{if} (cs%use\_Kelvin) cs%use\_Kelvin = &
101     register\_kelvin\_obc(param\_file, cs%Kelvin\_OBC\_CSp, &
102                obc%OBC\_Reg)
103   \textcolor{keywordflow}{if} (cs%use\_shelfwave) cs%use\_shelfwave = &
104     register\_shelfwave\_obc(param\_file, cs%shelfwave\_OBC\_CSp, &
105                obc%OBC\_Reg)
106   \textcolor{keywordflow}{if} (cs%use\_dyed\_channel) cs%use\_dyed\_channel = &
107     register\_dyed\_channel\_obc(param\_file, cs%dyed\_channel\_OBC\_CSp, &
108                obc%OBC\_Reg)
109 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__boundary__update_a32cfc645987cee827d4d193537b09c71}\label{namespacemom__boundary__update_a32cfc645987cee827d4d193537b09c71}} 
\index{mom\+\_\+boundary\+\_\+update@{mom\+\_\+boundary\+\_\+update}!obc\+\_\+register\+\_\+end@{obc\+\_\+register\+\_\+end}}
\index{obc\+\_\+register\+\_\+end@{obc\+\_\+register\+\_\+end}!mom\+\_\+boundary\+\_\+update@{mom\+\_\+boundary\+\_\+update}}
\subsubsection{\texorpdfstring{obc\+\_\+register\+\_\+end()}{obc\_register\_end()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+boundary\+\_\+update\+::obc\+\_\+register\+\_\+end (\begin{DoxyParamCaption}\item[{type(\hyperlink{structmom__boundary__update_1_1update__obc__cs}{update\+\_\+obc\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Clean up the O\+BC registry. 


\begin{DoxyParams}{Parameters}
{\em cs} & Control structure for O\+B\+Cs \\
\hline
\end{DoxyParams}


Definition at line 155 of file M\+O\+M\+\_\+boundary\+\_\+update.\+F90.


\begin{DoxyCode}
155   \textcolor{keywordtype}{type}(update\_obc\_cs),       \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{ !< Control structure for OBCs}
156 
157   \textcolor{keywordflow}{if} (cs%use\_files) \textcolor{keyword}{call }file\_obc\_end(cs%file\_OBC\_CSp)
158   \textcolor{keywordflow}{if} (cs%use\_tidal\_bay) \textcolor{keyword}{call }tidal\_bay\_obc\_end(cs%tidal\_bay\_OBC\_CSp)
159   \textcolor{keywordflow}{if} (cs%use\_Kelvin) \textcolor{keyword}{call }kelvin\_obc\_end(cs%Kelvin\_OBC\_CSp)
160 
161   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{deallocate}(cs)
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__boundary__update_a7c2a0d48706fa7b58ce1f584ff0c5d4f}\label{namespacemom__boundary__update_a7c2a0d48706fa7b58ce1f584ff0c5d4f}} 
\index{mom\+\_\+boundary\+\_\+update@{mom\+\_\+boundary\+\_\+update}!update\+\_\+obc\+\_\+data@{update\+\_\+obc\+\_\+data}}
\index{update\+\_\+obc\+\_\+data@{update\+\_\+obc\+\_\+data}!mom\+\_\+boundary\+\_\+update@{mom\+\_\+boundary\+\_\+update}}
\subsubsection{\texorpdfstring{update\+\_\+obc\+\_\+data()}{update\_obc\_data()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+boundary\+\_\+update\+::update\+\_\+obc\+\_\+data (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+obc\+\_\+type), pointer}]{O\+BC,  }\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(thermo\+\_\+var\+\_\+ptrs), intent(in)}]{tv,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(inout)}]{h,  }\item[{type(\hyperlink{structmom__boundary__update_1_1update__obc__cs}{update\+\_\+obc\+\_\+cs}), pointer}]{CS,  }\item[{type(time\+\_\+type), intent(in)}]{Time }\end{DoxyParamCaption})}



Calls appropriate routine to update the open boundary conditions. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & Ocean grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & Ocean vertical grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em tv} & Thermodynamics structure\\
\hline
\mbox{\tt in,out}  & {\em h} & layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
 & {\em obc} & Open boundary structure\\
\hline
 & {\em cs} & Control structure for O\+B\+Cs\\
\hline
\mbox{\tt in}  & {\em time} & Model time \\
\hline
\end{DoxyParams}


Definition at line 114 of file M\+O\+M\+\_\+boundary\+\_\+update.\+F90.


\begin{DoxyCode}
114   \textcolor{keywordtype}{type}(ocean\_grid\_type),                    \textcolor{keywordtype}{intent(in)}    :: g\textcolor{comment}{    !< Ocean grid structure}
115   \textcolor{keywordtype}{type}(verticalgrid\_type),                  \textcolor{keywordtype}{intent(in)}    :: gv\textcolor{comment}{   !< Ocean vertical grid structure}
116   \textcolor{keywordtype}{type}(unit\_scale\_type),                    \textcolor{keywordtype}{intent(in)}    :: us\textcolor{comment}{   !< A dimensional unit scaling type}
117   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),                    \textcolor{keywordtype}{intent(in)}    :: tv\textcolor{comment}{   !< Thermodynamics structure}
118   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(inout)} :: h\textcolor{comment}{    !< layer thicknesses [H ~> m or kg m-2]}
119   \textcolor{keywordtype}{type}(ocean\_obc\_type),                     \textcolor{keywordtype}{pointer}       :: obc\textcolor{comment}{  !< Open boundary structure}
120   \textcolor{keywordtype}{type}(update\_obc\_cs),                      \textcolor{keywordtype}{pointer}       :: cs\textcolor{comment}{   !< Control structure for OBCs}
121   \textcolor{keywordtype}{type}(time\_type),                          \textcolor{keywordtype}{intent(in)}    :: time\textcolor{comment}{ !< Model time}
122 
123   \textcolor{comment}{! Local variables}
124   \textcolor{keywordtype}{logical} :: read\_obc\_eta = .false.
125   \textcolor{keywordtype}{logical} :: read\_obc\_uv = .false.
126   \textcolor{keywordtype}{logical} :: read\_obc\_ts = .false.
127   \textcolor{keywordtype}{integer} :: i, j, k, itt, is, ie, js, je, isd, ied, jsd, jed, nz
128   \textcolor{keywordtype}{integer} :: isd\_off, jsd\_off
129   \textcolor{keywordtype}{integer} :: isdb, iedb, jsdb, jedb
130   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"update\_OBC\_data"} \textcolor{comment}{! This subroutine's name.}
131   \textcolor{keywordtype}{character(len=200)} :: filename, obc\_file, inputdir \textcolor{comment}{! Strings for file/path}
132 
133   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
134   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
135   isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
136 
137 \textcolor{comment}{! Something here... with CS%file\_OBC\_CSp?}
138 \textcolor{comment}{! if (CS%use\_files) &}
139 \textcolor{comment}{!     call update\_OBC\_segment\_data(G, GV, OBC, tv, h, Time)}
140   \textcolor{keywordflow}{if} (cs%use\_tidal\_bay) &
141       \textcolor{keyword}{call }tidal\_bay\_set\_obc\_data(obc, cs%tidal\_bay\_OBC\_CSp, g, h, time)
142   \textcolor{keywordflow}{if} (cs%use\_Kelvin)  &
143       \textcolor{keyword}{call }kelvin\_set\_obc\_data(obc, cs%Kelvin\_OBC\_CSp, g, gv, us, h, time)
144   \textcolor{keywordflow}{if} (cs%use\_shelfwave) &
145       \textcolor{keyword}{call }shelfwave\_set\_obc\_data(obc, cs%shelfwave\_OBC\_CSp, g, h, time)
146   \textcolor{keywordflow}{if} (cs%use\_dyed\_channel) &
147       \textcolor{keyword}{call }dyed\_channel\_update\_flow(obc, cs%dyed\_channel\_OBC\_CSp, g, time)
148   \textcolor{keywordflow}{if} (obc%needs\_IO\_for\_data .or. obc%add\_tide\_constituents)  &
149       \textcolor{keyword}{call }update\_obc\_segment\_data(g, gv, us, obc, tv, h, time)
150 
\end{DoxyCode}
