| 1 | 
\subsection{OBCS: Open boundary conditions for regional modeling} | 
| 2 | 
 | 
| 3 | 
\label{sec:pkg:obcs} | 
| 4 | 
\begin{rawhtml} | 
| 5 | 
<!-- CMIREDIR:package_obcs: --> | 
| 6 | 
\end{rawhtml} | 
| 7 | 
 | 
| 8 | 
Authors:  | 
| 9 | 
Alistair Adcroft, Patrick Heimbach, Samar Katiwala, Martin Losch | 
| 10 | 
 | 
| 11 | 
\subsubsection{Introduction | 
| 12 | 
\label{sec:pkg:obcs:intro}} | 
| 13 | 
 | 
| 14 | 
 | 
| 15 | 
 | 
| 16 | 
%---------------------------------------------------------------------- | 
| 17 | 
 | 
| 18 | 
\subsubsection{OBCS configuration and compiling | 
| 19 | 
\label{sec:pkg:kpp:comp}} | 
| 20 | 
 | 
| 21 | 
As with all MITgcm packages, OBCS can be turned on or off  | 
| 22 | 
at compile time | 
| 23 | 
% | 
| 24 | 
\begin{itemize} | 
| 25 | 
% | 
| 26 | 
\item | 
| 27 | 
using the \texttt{packages.conf} file by adding \texttt{obcs} to it, | 
| 28 | 
% | 
| 29 | 
\item | 
| 30 | 
or using \texttt{genmake2} adding | 
| 31 | 
\texttt{-enable=obcs} or \texttt{-disable=obcs} switches | 
| 32 | 
% | 
| 33 | 
\item | 
| 34 | 
\textit{Required packages and CPP options:} \\ | 
| 35 | 
% | 
| 36 | 
To alternatives are available for prescribing open boundary values, | 
| 37 | 
which differ in the way how OB's are treated in time: | 
| 38 | 
A simple time-management (e.g. constant in time, or cyclic with | 
| 39 | 
fixed fequency) is provided through  | 
| 40 | 
S/R \texttt{obcs\_external\_fields\_load}. | 
| 41 | 
More sophisticated ``real-time'' (i.e. calendar time) management is | 
| 42 | 
available through \texttt{obcs\_prescribe\_read}.  | 
| 43 | 
The latter case requires | 
| 44 | 
packages \texttt{cal} and \texttt{exf} to be enabled. | 
| 45 | 
% | 
| 46 | 
\end{itemize} | 
| 47 | 
(see also Section \ref{sect:buildingCode}). | 
| 48 | 
 | 
| 49 | 
Parts of the OBCS code can be enabled or disabled at compile time | 
| 50 | 
via CPP preprocessor flags. These options are set in | 
| 51 | 
\texttt{OBCS\_OPTIONS.h}. Table \ref{tab:pkg:obcs:cpp} summarizes them. | 
| 52 | 
 | 
| 53 | 
\begin{table}[h!] | 
| 54 | 
\centering | 
| 55 | 
  \label{tab:pkg:obcs:cpp} | 
| 56 | 
  {\footnotesize | 
| 57 | 
    \begin{tabular}{|l|l|} | 
| 58 | 
      \hline  | 
| 59 | 
      \textbf{CPP option}  &  \textbf{Description}  \\ | 
| 60 | 
      \hline \hline | 
| 61 | 
        \texttt{ALLOW\_OBCS\_NORTH} &  | 
| 62 | 
          enable Northern OB \\ | 
| 63 | 
        \texttt{ALLOW\_OBCS\_SOUTH} &  | 
| 64 | 
          enable Southern OB \\ | 
| 65 | 
        \texttt{ALLOW\_OBCS\_EAST} &  | 
| 66 | 
          enable Eastern OB \\ | 
| 67 | 
        \texttt{ALLOW\_OBCS\_WEST} &  | 
| 68 | 
          enable Western OB \\ | 
| 69 | 
      \hline | 
| 70 | 
        \texttt{ALLOW\_OBCS\_PRESCRIBE} &  | 
| 71 | 
          enable code for prescribing OB's \\ | 
| 72 | 
        \texttt{ALLOW\_OBCS\_SPONGE} &  | 
| 73 | 
          enable sponge layer code \\ | 
| 74 | 
        \texttt{ALLOW\_OBCS\_BALANCE} &  | 
| 75 | 
          enable code for balancing transports through OB's \\ | 
| 76 | 
        \texttt{ALLOW\_ORLANSKI} &  | 
| 77 | 
          enable Orlanski radiation conditions at OB's \\ | 
| 78 | 
      \hline | 
| 79 | 
    \end{tabular} | 
| 80 | 
  } | 
| 81 | 
  \caption{~} | 
| 82 | 
\end{table} | 
| 83 | 
 | 
| 84 | 
 | 
| 85 | 
%---------------------------------------------------------------------- | 
| 86 | 
 | 
| 87 | 
\subsubsection{Run-time parameters | 
| 88 | 
\label{sec:pkg:obcs:runtime}} | 
| 89 | 
 | 
| 90 | 
Run-time parameters are set in files  | 
| 91 | 
\texttt{data.pkg}, \texttt{data.obcs}, and \texttt{data.exf}  | 
| 92 | 
if ``real-time'' prescription is requested  | 
| 93 | 
(i.e. package \texttt{exf} enabled). | 
| 94 | 
These parameter files are read in S/R | 
| 95 | 
\texttt{packages\_readparms.F}, \texttt{obcs\_readparms.F}, and | 
| 96 | 
\texttt{exf\_readparms.F}, respectively. | 
| 97 | 
Run-time parameters may be broken into 3 categories: | 
| 98 | 
(i) switching on/off the package at runtime, | 
| 99 | 
(ii) OBCS package flags and parameters, | 
| 100 | 
(iii) additional timing flags in \texttt{data.exf}, if selected. | 
| 101 | 
 | 
| 102 | 
\paragraph{Enabling the package} | 
| 103 | 
~ \\ | 
| 104 | 
% | 
| 105 | 
The OBCS package is switched on at runtime by setting | 
| 106 | 
\texttt{useOBCS = .TRUE.} in \texttt{data.pkg}. | 
| 107 | 
 | 
| 108 | 
\paragraph{Package flags and parameters} | 
| 109 | 
~ \\ | 
| 110 | 
% | 
| 111 | 
Table \ref{tab:pkg:obcs:runtime_flags} summarizes the | 
| 112 | 
runtime flags that are set in \texttt{data.obcs}, and | 
| 113 | 
their default values. | 
| 114 | 
 | 
| 115 | 
\begin{table}[h!] | 
| 116 | 
\centering | 
| 117 | 
  \label{tab:pkg:obcs:runtime_flags} | 
| 118 | 
  {\footnotesize | 
| 119 | 
    \begin{tabular}{|l|c|l|} | 
| 120 | 
      \hline  | 
| 121 | 
      \textbf{Flag/parameter} & \textbf{default} &  \textbf{Description}  \\ | 
| 122 | 
      \hline \hline | 
| 123 | 
         \multicolumn{3}{|c|}{\textit{basic flags \& parameters} } \\ | 
| 124 | 
         \hline | 
| 125 | 
        OB\_Jnorth & 0 &  | 
| 126 | 
           Nx-vector of J-indices (w.r.t. Ny) of Northern OB | 
| 127 | 
           at each I-position (w.r.t. Nx) \\ | 
| 128 | 
        OB\_Jsouth & 0 &  | 
| 129 | 
           Nx-vector of J-indices (w.r.t. Ny) of Southern OB | 
| 130 | 
           at each I-position (w.r.t. Nx) \\ | 
| 131 | 
        OB\_Ieast & 0 &  | 
| 132 | 
           Ny-vector of I-indices (w.r.t. Nx) of Eastern OB | 
| 133 | 
           at each J-position (w.r.t. Ny) \\ | 
| 134 | 
        OB\_Iwest & 0 &  | 
| 135 | 
           Ny-vector of I-indices (w.r.t. Nx) of Western OB | 
| 136 | 
           at each J-position (w.r.t. Ny) \\ | 
| 137 | 
        useOBCSprescribe & \texttt{.FALSE.} &  | 
| 138 | 
           ~ \\ | 
| 139 | 
        useOBCSsponge & \texttt{.FALSE.} &  | 
| 140 | 
           ~ \\ | 
| 141 | 
        useOBCSbalance & \texttt{.FALSE.} &  | 
| 142 | 
           ~ \\ | 
| 143 | 
        OB\textbf{X}\textbf{y}File & ~ &  | 
| 144 | 
           file name of OB field \\ | 
| 145 | 
        ~ & ~ &  | 
| 146 | 
           \textbf{X}: \textbf{N}(orth), \textbf{S}(outh),  | 
| 147 | 
                       \textbf{E}(ast), \textbf{W}(est) \\ | 
| 148 | 
        ~ & ~ &  | 
| 149 | 
           \textbf{y}: \textbf{t}(emperature), \textbf{s}(salinity),  | 
| 150 | 
           \textbf{u}(-velocity), \textbf{v}(-velocity) \\ | 
| 151 | 
      \hline | 
| 152 | 
      \multicolumn{3}{|c|}{\textit{Orlanski parameters} } \\ | 
| 153 | 
      \hline | 
| 154 | 
        cvelTimeScale & 2000 sec &  | 
| 155 | 
           averaging period for phase speed \\ | 
| 156 | 
        CMAX & 0.45 m/s &  | 
| 157 | 
           maximum allowable phase speed-CFL for AB-II \\ | 
| 158 | 
        CFIX & 0.8 m/s &  | 
| 159 | 
           fixed boundary phase speed \\ | 
| 160 | 
        useFixedCEast & .FALSE. &  | 
| 161 | 
           ~ \\ | 
| 162 | 
        useFixedCWest & .FALSE. &  | 
| 163 | 
           ~ \\ | 
| 164 | 
      \hline | 
| 165 | 
      \multicolumn{3}{|c|}{\textit{Sponge-layer parameters} } \\ | 
| 166 | 
      \hline | 
| 167 | 
        spongeThickness & 0 &  | 
| 168 | 
           sponge layer thickness (in \# grid points) \\ | 
| 169 | 
        Urelaxobcsinner & 0 sec &  | 
| 170 | 
           relaxation time scale at the  | 
| 171 | 
           innermost sponge layer point of a meridional OB \\ | 
| 172 | 
        Vrelaxobcsinner & 0 sec &  | 
| 173 | 
           relaxation time scale at the  | 
| 174 | 
           innermost sponge layer point of a zonal OB \\ | 
| 175 | 
        Urelaxobcsbound & 0 sec &  | 
| 176 | 
           relaxation time scale at the  | 
| 177 | 
           outermost sponge layer point of a meridional OB \\ | 
| 178 | 
        Vrelaxobcsbound & 0 sec &  | 
| 179 | 
           relaxation time scale at the  | 
| 180 | 
           outermost sponge layer point of a zonal OB \\ | 
| 181 | 
         \hline | 
| 182 | 
      \hline | 
| 183 | 
    \end{tabular} | 
| 184 | 
  } | 
| 185 | 
  \caption{~} | 
| 186 | 
\end{table} | 
| 187 | 
 | 
| 188 | 
 | 
| 189 | 
 | 
| 190 | 
%---------------------------------------------------------------------- | 
| 191 | 
 | 
| 192 | 
\subsubsection{Defining open boundary positions | 
| 193 | 
\label{sec:pkg:obcs:defining}} | 
| 194 | 
 | 
| 195 | 
There are four open boundaries (OBs), a  | 
| 196 | 
Northern, Southern, Eastern, and Western. | 
| 197 | 
All OB locations are specified by their absolute | 
| 198 | 
meridional (Northern/Southern) or zonal (Eastern/Western) indices. | 
| 199 | 
Thus, for each zonal position $i=1,\ldots,Nx$ a meridional index | 
| 200 | 
$j$ specifies the Northern/Southern OB position, | 
| 201 | 
and for each meridional position $j=1,\ldots,Ny$, a zonal index | 
| 202 | 
$i$ specifies the Eastern/Western OB position. | 
| 203 | 
For Northern/Southern OB this defines an $Nx$-dimensional | 
| 204 | 
``row'' array $\tt OB\_Jnorth(Ny)$ / $\tt OB\_Jsouth(Ny)$, | 
| 205 | 
and an $Ny$-dimenisonal  | 
| 206 | 
``column'' array $\tt OB\_Ieast(Nx)$ / $\tt OB\_Iwest(Nx)$ | 
| 207 | 
Positions determined in this way allows Northern/Southern | 
| 208 | 
OBs to be at variable $j$ (or $y$) positions, and Eastern/Western | 
| 209 | 
OBs at variable $i$ (or $x$) positions. | 
| 210 | 
Here, indices refer to tracer points on the C-grid. | 
| 211 | 
A zero (0) element in $\tt OB\_I\ldots$, $\tt OB\_J\ldots$ | 
| 212 | 
means there is no corresponding OB in that column/row. | 
| 213 | 
For a Northern/Southern OB, the OB V point is to the South/North. | 
| 214 | 
For an Eastern/Western OB, the OB U point is to the West/East. | 
| 215 | 
 | 
| 216 | 
\begin{verbatim} | 
| 217 | 
 For example | 
| 218 | 
     OB_Jnorth(3)=34  means that: | 
| 219 | 
          T( 3 ,34) is a an OB point | 
| 220 | 
          U(3:4,34) is a an OB point | 
| 221 | 
          V( 4 ,34) is a an OB point | 
| 222 | 
 while | 
| 223 | 
     OB_Jsouth(3)=1  means that: | 
| 224 | 
          T( 3 ,1) is a an OB point | 
| 225 | 
          U(3:4,1) is a an OB point | 
| 226 | 
          V( 4 ,2) is a an OB point | 
| 227 | 
\end{verbatim} | 
| 228 | 
 | 
| 229 | 
For convenience, negative values for Jnorth/Ieast refer to | 
| 230 | 
points relative to the Northern/Eastern edges of the model | 
| 231 | 
eg. $\tt OB\_Jnorth(3)=-1$  means that the point $\tt (3,Ny)$  | 
| 232 | 
is a northern OB. | 
| 233 | 
 | 
| 234 | 
\noindent | 
| 235 | 
\textsf{Add special comments for case \#define NONLIN\_FRSURF, | 
| 236 | 
see obcs\_ini\_fixed.F} | 
| 237 | 
 | 
| 238 | 
%---------------------------------------------------------------------- | 
| 239 | 
 | 
| 240 | 
\subsubsection{Equations and key routines | 
| 241 | 
\label{sec:pkg:obcs:equations}} | 
| 242 | 
 | 
| 243 | 
\paragraph{OBCS\_READPARMS:} ~ \\ | 
| 244 | 
Set OB positions through arrays | 
| 245 | 
{\tt OB\_Jnorth(Ny), OB\_Jsouth(Ny), OB\_Ieast(Nx), OB\_Iwest(Nx)}, | 
| 246 | 
and runtime flags see Table \ref{tab:???}. | 
| 247 | 
 | 
| 248 | 
\paragraph{OBCS\_CALC:} ~ \\ | 
| 249 | 
% | 
| 250 | 
Top-level routine for filling values to be applied at OB for  | 
| 251 | 
$T,S,U,V,\eta$ into corresponding  | 
| 252 | 
``slice'' arrays $(x,z)$, $(y,z)$ for each OB: | 
| 253 | 
$\tt OB[N/S/E/W][t/s/u/v]$; e.g. for salinity array at | 
| 254 | 
Southern OB, array name is $\tt OBSt$. | 
| 255 | 
Values filled are either | 
| 256 | 
% | 
| 257 | 
\begin{itemize} | 
| 258 | 
% | 
| 259 | 
\item | 
| 260 | 
constant vertical $T,S$ profiles as specified in file | 
| 261 | 
{\tt data} ({\tt tRef(Nr), sRef(Nr)}) with zero velocities $U,V$, | 
| 262 | 
% | 
| 263 | 
\item | 
| 264 | 
$T,S,U,V$ values determined via Orlanski radiation conditions | 
| 265 | 
(see below), | 
| 266 | 
% | 
| 267 | 
\item | 
| 268 | 
prescribed time-constant or time-varying fields (see below). | 
| 269 | 
% | 
| 270 | 
\end{itemize} | 
| 271 | 
 | 
| 272 | 
 | 
| 273 | 
\paragraph{ORLANSKI} ~ \\ | 
| 274 | 
% | 
| 275 | 
Orlanski radiation conditions | 
| 276 | 
 | 
| 277 | 
\paragraph{OBCS\_PRESCRIBE\_READ} Setting OB fields and updates \\ | 
| 278 | 
% | 
| 279 | 
~ | 
| 280 | 
 | 
| 281 | 
\paragraph{OBCS\_BALANCE} ~ \\ | 
| 282 | 
% | 
| 283 | 
~ | 
| 284 | 
 | 
| 285 | 
\paragraph{OBCS\_APPLY\_*:} ~ \\ | 
| 286 | 
~ | 
| 287 | 
 | 
| 288 | 
\paragraph{OBCS\_SPONGE} Setting sponge layer characteristics \\ | 
| 289 | 
% | 
| 290 | 
~ | 
| 291 | 
 | 
| 292 | 
\paragraph{OB's with nonlinear free surface} ~ \\ | 
| 293 | 
% | 
| 294 | 
~ | 
| 295 | 
 | 
| 296 | 
 | 
| 297 | 
%---------------------------------------------------------------------- | 
| 298 | 
 | 
| 299 | 
\subsubsection{Flow chart | 
| 300 | 
\label{sec:pkg:obcs:flowchart}} | 
| 301 | 
 | 
| 302 | 
 | 
| 303 | 
{\footnotesize | 
| 304 | 
\begin{verbatim} | 
| 305 | 
 | 
| 306 | 
C     !CALLING SEQUENCE: | 
| 307 | 
c ... | 
| 308 | 
 | 
| 309 | 
\end{verbatim} | 
| 310 | 
} | 
| 311 | 
 | 
| 312 | 
%---------------------------------------------------------------------- | 
| 313 | 
 | 
| 314 | 
\subsubsection{OBCS diagnostics | 
| 315 | 
\label{sec:pkg:obcs:diagnostics}} | 
| 316 | 
 | 
| 317 | 
Diagnostics output is available via the diagnostics package | 
| 318 | 
(see Section \ref{sec:pkg:diagnostics}). | 
| 319 | 
Available output fields are summarized in  | 
| 320 | 
Table \ref{tab:pkg:obcs:diagnostics}. | 
| 321 | 
 | 
| 322 | 
\begin{table}[h!] | 
| 323 | 
\centering | 
| 324 | 
\label{tab:pkg:obcs:diagnostics} | 
| 325 | 
{\footnotesize | 
| 326 | 
\begin{verbatim} | 
| 327 | 
------------------------------------------------------ | 
| 328 | 
 <-Name->|Levs|grid|<--  Units   -->|<- Tile (max=80c) | 
| 329 | 
------------------------------------------------------ | 
| 330 | 
 | 
| 331 | 
\end{verbatim} | 
| 332 | 
} | 
| 333 | 
\caption{~} | 
| 334 | 
\end{table} | 
| 335 | 
 | 
| 336 | 
%---------------------------------------------------------------------- | 
| 337 | 
 | 
| 338 | 
\subsubsection{Reference experiments} | 
| 339 | 
 | 
| 340 | 
 | 
| 341 | 
 | 
| 342 | 
%---------------------------------------------------------------------- | 
| 343 | 
 | 
| 344 | 
\subsubsection{References} | 
| 345 | 
 |