| 1 | % $Header: /u/u0/gcmpack/manual/part3/case_studies/barotropic_gyre/baro.tex,v 1.7 2001/11/13 20:13:54 adcroft Exp $ | 
| 2 | % $Name:  $ | 
| 3 |  | 
| 4 | \bodytext{bgcolor="#FFFFFFFF"} | 
| 5 |  | 
| 6 | %\begin{center} | 
| 7 | %{\Large \bf Using MITgcm to Simulate a Barotropic Ocean Gyre In Cartesian | 
| 8 | %Coordinates} | 
| 9 | % | 
| 10 | %\vspace*{4mm} | 
| 11 | % | 
| 12 | %\vspace*{3mm} | 
| 13 | %{\large May 2001} | 
| 14 | %\end{center} | 
| 15 |  | 
| 16 | This is the first in a series of tutorials describing | 
| 17 | example MITgcm numerical experiments. The example experiments | 
| 18 | include both straightforward examples of idealized geophysical | 
| 19 | fluid simulations and more involved cases encompassing | 
| 20 | large scale modeling and | 
| 21 | automatic differentiation. Both hydrostatic and non-hydrostatic | 
| 22 | experiments are presented, as well as experiments employing | 
| 23 | Cartesian, spherical-polar and cube-sphere coordinate systems. | 
| 24 | These ``case study'' documents include information describing | 
| 25 | the experimental configuration and detailed information on how to | 
| 26 | configure the MITgcm code and input files for each experiment. | 
| 27 |  | 
| 28 | \section{Barotropic Ocean Gyre In Cartesian Coordinates} | 
| 29 | \label{sect:eg-baro} | 
| 30 |  | 
| 31 |  | 
| 32 | This example experiment demonstrates using the MITgcm to simulate | 
| 33 | a Barotropic, wind-forced, ocean gyre circulation. The experiment | 
| 34 | is a numerical rendition of the gyre circulation problem similar | 
| 35 | to the problems described analytically by Stommel in 1966 | 
| 36 | \cite{Stommel66} and numerically in Holland et. al \cite{Holland75}. | 
| 37 |  | 
| 38 | In this experiment the model | 
| 39 | is configured to represent a rectangular enclosed box of fluid, | 
| 40 | $1200 \times 1200 $~km in lateral extent. The fluid is $5$~km deep and is forced | 
| 41 | by a constant in time zonal wind stress, $\tau_x$, that varies sinusoidally | 
| 42 | in the ``north-south'' direction. Topologically the grid is Cartesian and | 
| 43 | the coriolis parameter $f$ is defined according to a mid-latitude beta-plane | 
| 44 | equation | 
| 45 |  | 
| 46 | \begin{equation} | 
| 47 | \label{EQ:eg-baro-fcori} | 
| 48 | f(y) = f_{0}+\beta y | 
| 49 | \end{equation} | 
| 50 |  | 
| 51 | \noindent where $y$ is the distance along the ``north-south'' axis of the | 
| 52 | simulated domain. For this experiment $f_{0}$ is set to $10^{-4}s^{-1}$ in | 
| 53 | (\ref{EQ:eg-baro-fcori}) and $\beta = 10^{-11}s^{-1}m^{-1}$. | 
| 54 | \\ | 
| 55 | \\ | 
| 56 | The sinusoidal wind-stress variations are defined according to | 
| 57 |  | 
| 58 | \begin{equation} | 
| 59 | \label{EQ:eg-baro-taux} | 
| 60 | \tau_x(y) = \tau_{0}\sin(\pi \frac{y}{L_y}) | 
| 61 | \end{equation} | 
| 62 |  | 
| 63 | \noindent where $L_{y}$ is the lateral domain extent ($1200$~km) and | 
| 64 | $\tau_0$ is set to $0.1N m^{-2}$. | 
| 65 | \\ | 
| 66 | \\ | 
| 67 | Figure \ref{FIG:eg-baro-simulation_config} | 
| 68 | summarizes the configuration simulated. | 
| 69 |  | 
| 70 | \begin{figure} | 
| 71 | \begin{center} | 
| 72 | \resizebox{7.5in}{5.5in}{ | 
| 73 | \includegraphics*[0.2in,0.7in][10.5in,10.5in] | 
| 74 | {part3/case_studies/barotropic_gyre/simulation_config.eps} } | 
| 75 | \end{center} | 
| 76 | \caption{Schematic of simulation domain and wind-stress forcing function | 
| 77 | for barotropic gyre numerical experiment. The domain is enclosed bu solid | 
| 78 | walls at $x=$~0,1200km and at $y=$~0,1200km.} | 
| 79 | \label{FIG:eg-baro-simulation_config} | 
| 80 | \end{figure} | 
| 81 |  | 
| 82 | \subsection{Equations Solved} | 
| 83 | The model is configured in hydrostatic form. The implicit free surface form of the | 
| 84 | pressure equation described in Marshall et. al \cite{marshall:97a} is | 
| 85 | employed. | 
| 86 | A horizontal Laplacian operator $\nabla_{h}^2$ provides viscous | 
| 87 | dissipation. The wind-stress momentum input is added to the momentum equation | 
| 88 | for the ``zonal flow'', $u$. Other terms in the model | 
| 89 | are explicitly switched off for this experiment configuration (see section | 
| 90 | \ref{SEC:code_config} ), yielding an active set of equations solved in this | 
| 91 | configuration as follows | 
| 92 |  | 
| 93 | \begin{eqnarray} | 
| 94 | \label{EQ:eg-baro-model_equations} | 
| 95 | \frac{Du}{Dt} - fv + | 
| 96 | g\frac{\partial \eta}{\partial x} - | 
| 97 | A_{h}\nabla_{h}^2u | 
| 98 | & = & | 
| 99 | \frac{\tau_{x}}{\rho_{0}\Delta z} | 
| 100 | \\ | 
| 101 | \frac{Dv}{Dt} + fu + g\frac{\partial \eta}{\partial y} - | 
| 102 | A_{h}\nabla_{h}^2v | 
| 103 | & = & | 
| 104 | 0 | 
| 105 | \\ | 
| 106 | \frac{\partial \eta}{\partial t} + \nabla_{h}\cdot \vec{u} | 
| 107 | &=& | 
| 108 | 0 | 
| 109 | \end{eqnarray} | 
| 110 |  | 
| 111 | \noindent where $u$ and $v$ and the $x$ and $y$ components of the | 
| 112 | flow vector $\vec{u}$. | 
| 113 | \\ | 
| 114 |  | 
| 115 |  | 
| 116 | \subsection{Discrete Numerical Configuration} | 
| 117 |  | 
| 118 | The domain is discretised with | 
| 119 | a uniform grid spacing in the horizontal set to | 
| 120 | $\Delta x=\Delta y=20$~km, so | 
| 121 | that there are sixty grid cells in the $x$ and $y$ directions. Vertically the | 
| 122 | model is configured with a single layer with depth, $\Delta z$, of $5000$~m. | 
| 123 |  | 
| 124 | \subsubsection{Numerical Stability Criteria} | 
| 125 |  | 
| 126 | The Laplacian dissipation coefficient, $A_{h}$, is set to $400 m s^{-1}$. | 
| 127 | This value is chosen to yield a Munk layer width \cite{adcroft:95}, | 
| 128 |  | 
| 129 | \begin{eqnarray} | 
| 130 | \label{EQ:eg-baro-munk_layer} | 
| 131 | M_{w} = \pi ( \frac { A_{h} }{ \beta } )^{\frac{1}{3}} | 
| 132 | \end{eqnarray} | 
| 133 |  | 
| 134 | \noindent  of $\approx 100$km. This is greater than the model | 
| 135 | resolution $\Delta x$, ensuring that the frictional boundary | 
| 136 | layer is well resolved. | 
| 137 | \\ | 
| 138 |  | 
| 139 | \noindent The model is stepped forward with a | 
| 140 | time step $\delta t=1200$secs. With this time step the stability | 
| 141 | parameter to the horizontal Laplacian friction \cite{adcroft:95} | 
| 142 |  | 
| 143 |  | 
| 144 |  | 
| 145 | \begin{eqnarray} | 
| 146 | \label{EQ:eg-baro-laplacian_stability} | 
| 147 | S_{l} = 4 \frac{A_{h} \delta t}{{\Delta x}^2} | 
| 148 | \end{eqnarray} | 
| 149 |  | 
| 150 | \noindent evaluates to 0.012, which is well below the 0.3 upper limit | 
| 151 | for stability. | 
| 152 | \\ | 
| 153 |  | 
| 154 | \noindent The numerical stability for inertial oscillations | 
| 155 | \cite{adcroft:95} | 
| 156 |  | 
| 157 | \begin{eqnarray} | 
| 158 | \label{EQ:eg-baro-inertial_stability} | 
| 159 | S_{i} = f^{2} {\delta t}^2 | 
| 160 | \end{eqnarray} | 
| 161 |  | 
| 162 | \noindent evaluates to $0.0144$, which is well below the $0.5$ upper | 
| 163 | limit for stability. | 
| 164 | \\ | 
| 165 |  | 
| 166 | \noindent The advective CFL \cite{adcroft:95} for an extreme maximum | 
| 167 | horizontal flow speed of $ | \vec{u} | = 2 ms^{-1}$ | 
| 168 |  | 
| 169 | \begin{eqnarray} | 
| 170 | \label{EQ:eg-baro-cfl_stability} | 
| 171 | S_{a} = \frac{| \vec{u} | \delta t}{ \Delta x} | 
| 172 | \end{eqnarray} | 
| 173 |  | 
| 174 | \noindent evaluates to 0.12. This is approaching the stability limit | 
| 175 | of 0.5 and limits $\delta t$ to $1200s$. | 
| 176 |  | 
| 177 | \subsection{Code Configuration} | 
| 178 | \label{SEC:eg-baro-code_config} | 
| 179 |  | 
| 180 | The model configuration for this experiment resides under the | 
| 181 | directory {\it verification/exp0/}.  The experiment files | 
| 182 | \begin{itemize} | 
| 183 | \item {\it input/data} | 
| 184 | \item {\it input/data.pkg} | 
| 185 | \item {\it input/eedata}, | 
| 186 | \item {\it input/windx.sin\_y}, | 
| 187 | \item {\it input/topog.box}, | 
| 188 | \item {\it code/CPP\_EEOPTIONS.h} | 
| 189 | \item {\it code/CPP\_OPTIONS.h}, | 
| 190 | \item {\it code/SIZE.h}. | 
| 191 | \end{itemize} | 
| 192 | contain the code customizations and parameter settings for this | 
| 193 | experiments. Below we describe the customizations | 
| 194 | to these files associated with this experiment. | 
| 195 |  | 
| 196 | \subsubsection{File {\it input/data}} | 
| 197 |  | 
| 198 | This file, reproduced completely below, specifies the main parameters | 
| 199 | for the experiment. The parameters that are significant for this configuration | 
| 200 | are | 
| 201 |  | 
| 202 | \begin{itemize} | 
| 203 |  | 
| 204 | \item Line 7, \begin{verbatim} viscAh=4.E2, \end{verbatim} this line sets | 
| 205 | the Laplacian friction coefficient to $400 m^2s^{-1}$ | 
| 206 | \item Line 10, \begin{verbatim} beta=1.E-11, \end{verbatim} this line sets | 
| 207 | $\beta$ (the gradient of the coriolis parameter, $f$) to $10^{-11} s^{-1}m^{-1}$ | 
| 208 |  | 
| 209 | \item Lines 15 and 16 | 
| 210 | \begin{verbatim} | 
| 211 | rigidLid=.FALSE., | 
| 212 | implicitFreeSurface=.TRUE., | 
| 213 | \end{verbatim} | 
| 214 | these lines suppress the rigid lid formulation of the surface | 
| 215 | pressure inverter and activate the implicit free surface form | 
| 216 | of the pressure inverter. | 
| 217 |  | 
| 218 | \item Line 27, | 
| 219 | \begin{verbatim} | 
| 220 | startTime=0, | 
| 221 | \end{verbatim} | 
| 222 | this line indicates that the experiment should start from $t=0$ | 
| 223 | and implicitly suppresses searching for checkpoint files associated | 
| 224 | with restarting an numerical integration from a previously saved state. | 
| 225 |  | 
| 226 | \item Line 29, | 
| 227 | \begin{verbatim} | 
| 228 | endTime=12000, | 
| 229 | \end{verbatim} | 
| 230 | this line indicates that the experiment should start finish at $t=12000s$. | 
| 231 | A restart file will be written at this time that will enable the | 
| 232 | simulation to be continued from this point. | 
| 233 |  | 
| 234 | \item Line 30, | 
| 235 | \begin{verbatim} | 
| 236 | deltaTmom=1200, | 
| 237 | \end{verbatim} | 
| 238 | This line sets the momentum equation timestep to $1200s$. | 
| 239 |  | 
| 240 | \item Line 39, | 
| 241 | \begin{verbatim} | 
| 242 | usingCartesianGrid=.TRUE., | 
| 243 | \end{verbatim} | 
| 244 | This line requests that the simulation be performed in a | 
| 245 | Cartesian coordinate system. | 
| 246 |  | 
| 247 | \item Line 41, | 
| 248 | \begin{verbatim} | 
| 249 | delX=60*20E3, | 
| 250 | \end{verbatim} | 
| 251 | This line sets the horizontal grid spacing between each x-coordinate line | 
| 252 | in the discrete grid. The syntax indicates that the discrete grid | 
| 253 | should be comprise of $60$ grid lines each separated by $20 \times 10^{3}m$ | 
| 254 | ($20$~km). | 
| 255 |  | 
| 256 | \item Line 42, | 
| 257 | \begin{verbatim} | 
| 258 | delY=60*20E3, | 
| 259 | \end{verbatim} | 
| 260 | This line sets the horizontal grid spacing between each y-coordinate line | 
| 261 | in the discrete grid to $20 \times 10^{3}m$ ($20$~km). | 
| 262 |  | 
| 263 | \item Line 43, | 
| 264 | \begin{verbatim} | 
| 265 | delZ=5000, | 
| 266 | \end{verbatim} | 
| 267 | This line sets the vertical grid spacing between each z-coordinate line | 
| 268 | in the discrete grid to $5000m$ ($5$~km). | 
| 269 |  | 
| 270 | \item Line 46, | 
| 271 | \begin{verbatim} | 
| 272 | bathyFile='topog.box' | 
| 273 | \end{verbatim} | 
| 274 | This line specifies the name of the file from which the domain | 
| 275 | bathymetry is read. This file is a two-dimensional ($x,y$) map of | 
| 276 | depths. This file is assumed to contain 64-bit binary numbers | 
| 277 | giving the depth of the model at each grid cell, ordered with the x | 
| 278 | coordinate varying fastest. The points are ordered from low coordinate | 
| 279 | to high coordinate for both axes. The units and orientation of the | 
| 280 | depths in this file are the same as used in the MITgcm code. In this | 
| 281 | experiment, a depth of $0m$ indicates a solid wall and a depth | 
| 282 | of $-5000m$ indicates open ocean. The matlab program | 
| 283 | {\it input/gendata.m} shows an example of how to generate a | 
| 284 | bathymetry file. | 
| 285 |  | 
| 286 |  | 
| 287 | \item Line 49, | 
| 288 | \begin{verbatim} | 
| 289 | zonalWindFile='windx.sin_y' | 
| 290 | \end{verbatim} | 
| 291 | This line specifies the name of the file from which the x-direction | 
| 292 | surface wind stress is read. This file is also a two-dimensional | 
| 293 | ($x,y$) map and is enumerated and formatted in the same manner as the | 
| 294 | bathymetry file. The matlab program {\it input/gendata.m} includes example | 
| 295 | code to generate a valid {\bf zonalWindFile} file. | 
| 296 |  | 
| 297 | \end{itemize} | 
| 298 |  | 
| 299 | \noindent other lines in the file {\it input/data} are standard values | 
| 300 | that are described in the MITgcm Getting Started and MITgcm Parameters | 
| 301 | notes. | 
| 302 |  | 
| 303 | \begin{small} | 
| 304 | \input{part3/case_studies/barotropic_gyre/input/data} | 
| 305 | \end{small} | 
| 306 |  | 
| 307 | \subsubsection{File {\it input/data.pkg}} | 
| 308 |  | 
| 309 | This file uses standard default values and does not contain | 
| 310 | customizations for this experiment. | 
| 311 |  | 
| 312 | \subsubsection{File {\it input/eedata}} | 
| 313 |  | 
| 314 | This file uses standard default values and does not contain | 
| 315 | customizations for this experiment. | 
| 316 |  | 
| 317 | \subsubsection{File {\it input/windx.sin\_y}} | 
| 318 |  | 
| 319 | The {\it input/windx.sin\_y} file specifies a two-dimensional ($x,y$) | 
| 320 | map of wind stress ,$\tau_{x}$, values. The units used are $Nm^{-2}$. | 
| 321 | Although $\tau_{x}$ is only a function of $y$n in this experiment | 
| 322 | this file must still define a complete two-dimensional map in order | 
| 323 | to be compatible with the standard code for loading forcing fields | 
| 324 | in MITgcm. The included matlab program {\it input/gendata.m} gives a complete | 
| 325 | code for creating the {\it input/windx.sin\_y} file. | 
| 326 |  | 
| 327 | \subsubsection{File {\it input/topog.box}} | 
| 328 |  | 
| 329 |  | 
| 330 | The {\it input/topog.box} file specifies a two-dimensional ($x,y$) | 
| 331 | map of depth values. For this experiment values are either | 
| 332 | $0m$ or {\bf -delZ}m, corresponding respectively to a wall or to deep | 
| 333 | ocean. The file contains a raw binary stream of data that is enumerated | 
| 334 | in the same way as standard MITgcm two-dimensional, horizontal arrays. | 
| 335 | The included matlab program {\it input/gendata.m} gives a complete | 
| 336 | code for creating the {\it input/topog.box} file. | 
| 337 |  | 
| 338 | \subsubsection{File {\it code/SIZE.h}} | 
| 339 |  | 
| 340 | Two lines are customized in this file for the current experiment | 
| 341 |  | 
| 342 | \begin{itemize} | 
| 343 |  | 
| 344 | \item Line 39, | 
| 345 | \begin{verbatim} sNx=60, \end{verbatim} this line sets | 
| 346 | the lateral domain extent in grid points for the | 
| 347 | axis aligned with the x-coordinate. | 
| 348 |  | 
| 349 | \item Line 40, | 
| 350 | \begin{verbatim} sNy=60, \end{verbatim} this line sets | 
| 351 | the lateral domain extent in grid points for the | 
| 352 | axis aligned with the y-coordinate. | 
| 353 |  | 
| 354 | \end{itemize} | 
| 355 |  | 
| 356 | \begin{small} | 
| 357 | \input{part3/case_studies/barotropic_gyre/code/SIZE.h} | 
| 358 | \end{small} | 
| 359 |  | 
| 360 | \subsubsection{File {\it code/CPP\_OPTIONS.h}} | 
| 361 |  | 
| 362 | This file uses standard default values and does not contain | 
| 363 | customizations for this experiment. | 
| 364 |  | 
| 365 |  | 
| 366 | \subsubsection{File {\it code/CPP\_EEOPTIONS.h}} | 
| 367 |  | 
| 368 | This file uses standard default values and does not contain | 
| 369 | customizations for this experiment. | 
| 370 |  |