\hypertarget{namespacemom__boundary__update}{}\doxysection{mom\+\_\+boundary\+\_\+update Module Reference}
\label{namespacemom__boundary__update}\index{mom\_boundary\_update@{mom\_boundary\_update}}


\doxysubsection{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). \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\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}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\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 \mbox{\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 \mbox{\hyperlink{namespacemom__boundary__update_a32cfc645987cee827d4d193537b09c71}{obc\+\_\+register\+\_\+end}} (CS)
\begin{DoxyCompactList}\small\item\em Clean up the O\+BC registry. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacemom__boundary__update_a795944da50c68e071b26daa8c59bb144}\label{namespacemom__boundary__update_a795944da50c68e071b26daa8c59bb144}} 
integer \mbox{\hyperlink{namespacemom__boundary__update_a795944da50c68e071b26daa8c59bb144}{id\+\_\+clock\+\_\+pass}}
\begin{DoxyCompactList}\small\item\em A C\+PU time clock ID. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{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}}
\doxysubsubsection{\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(\mbox{\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{\texttt{ 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 61 of file M\+O\+M\+\_\+boundary\+\_\+update.\+F90.


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


\begin{DoxyCode}{0}
\DoxyCodeLine{155   \textcolor{keywordtype}{type}(update\_OBC\_CS),       \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< Control structure for OBCs}}
\DoxyCodeLine{156 }
\DoxyCodeLine{157   \textcolor{keywordflow}{if} (cs\%use\_files) \textcolor{keyword}{call }file\_obc\_end(cs\%file\_OBC\_CSp)}
\DoxyCodeLine{158   \textcolor{keywordflow}{if} (cs\%use\_tidal\_bay) \textcolor{keyword}{call }tidal\_bay\_obc\_end(cs\%tidal\_bay\_OBC\_CSp)}
\DoxyCodeLine{159   \textcolor{keywordflow}{if} (cs\%use\_Kelvin) \textcolor{keyword}{call }kelvin\_obc\_end(cs\%Kelvin\_OBC\_CSp)}
\DoxyCodeLine{160 }
\DoxyCodeLine{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}}
\doxysubsubsection{\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(\mbox{\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{\texttt{ in}}  & {\em g} & Ocean grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & Ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em tv} & Thermodynamics structure \\
\hline
\mbox{\texttt{ 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{\texttt{ in}}  & {\em time} & Model time \\
\hline
\end{DoxyParams}


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


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

\end{DoxyCode}
