Warning, /doc/examples/reentrant_channel/reentrant_channel.rst is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit 0bad585a on 2022-02-16 18:55:09 UTC
08815fc806 Jeff*0001 .. _sec_eg_reentrant_channel:
0002
0003 Southern Ocean Reentrant Channel Example
0004 ========================================
0005
0006 (in directory :filelink:`verification/tutorial_reentrant_channel/`)
0007
0008 This example experiment simulates flow through a reentrant channel,
0009 crudely mimicking the `Antartic Circumpolar Current <https://en.wikipedia.org/wiki/Antarctic_Circumpolar_Current>`_.
0010 The fluid is forced by a zonal wind stress, :math:`\tau_x`, that varies
0011 sinusoidally in the north-south direction and is constant in time,
0012 and by temperature relaxation at the surface and northern boundary.
0013 The grid is Cartesian and the Coriolis parameter :math:`f` is
0014 defined according to a mid-latitude beta-plane equation :math:`f(y) = f_{0}+\beta y` ;
0015 here we choose :math:`f_0 < 0` to place our domain in the Southern Hemisphere.
0016 A linear EOS is used with density only depending on T, and there is no sea ice.
0017
0018 Although important aspects of the of the Southern Ocean and Antarctic Circumpolar Current
0019 were realized in the early 20th Century (e.g., Sverdrup 1933 :cite:`sverdrup:33`),
0020 understanding this system has been a major research focus in recent decades. Many significant breakthroughs in understanding its
0021 dynamics, role in the global ocean circulation, and role in the climate system
0022 have been achieved (e.g., Marshall and Radko 2003 :cite:`marshall:03`;
0023 Olbers and Visbeck 2004 :cite:`olbers:04`; Marshall and Speer 2012 :cite:`marshall:12`;
0024 Nikurashin and Vallis 2012 :cite:`nikurashin:12`;
0025 Armour et al. 2016 :cite:`armour:16`;Sallée 2018 :cite:`sallee:18`).
0026 Much of this understanding came about using simple, idealized reentrant channel models
0027 in the spirit of the model described in this tutorial.
0028 The configuration here is fairly close to that employed in Abernathy et al. (2011) :cite:`abernathy:11`
0029 (using the MITgcm) with some important differences,
0030 such as our introduction of a deep north-south ridge.
0031
0032 We assume the reader is familiar with a basic MITgcm
0033 setup, as introduced in tutorial :ref:`Barotropic Ocean Gyre <sec_eg_baro>`
0034 and tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`.
0035 Although the setup here is again quite idealized, we introduce many new features and capabilities of MITgcm.
0036 Novel aspects include using MITgcm packages
0037 to augment the physical modeling capabilities, discussion of partial cells to represent topography, and an introduction to
0038 the layers diagnostics package (:filelink:`/pkg/layers`). Our initial focus is on running and comparing coarse-resolution
0039 solutions with and without activating the Gent-McWilliams ("GM") (1990)
0040 :cite:`gen-mcw:90` mesoscale eddy parameterization (:filelink:`/pkg/gmredi`).
0041 As first noted in Danabashoglu et al. (1994) :cite:`danabasoglu:94`,
0042 use of GM in coarse resolution models improves global temperature distribution, poleward and surface heat fluxes, and locations
0043 of deep-water formation (see also the Gent 2011 :cite:`gent:11` perspective on two decades GM usage in ocean models).
0044 At the end of this tutorial, we will describe how to increase resolution to an eddy-permitting regime, detailing the few
0045 necessary changes in code and parameters, and examine this high-resolution solution.
0046 In our discussion, our focus will be on highlighting how the representation of mesoscale eddies
0047 plays a significant role in governing the equilibrium state.
0048
62748458e3 Jeff*0049 Below we describe the idealized configuration in detail (see :numref:`channel_simulation_config`).
0050 The sinusoidal wind-stress variations are defined thus:
08815fc806 Jeff*0051
62748458e3 Jeff*0052 .. math::
08815fc806 Jeff*0053 \tau_x(y) = \tau_{0}\sin \left( \frac{y}{2 L_y} \pi \right),
0054
0055 where :math:`L_{y}` is the lateral domain extent and
0056 :math:`\tau_0` is set to :math:`0.2 \text{ N m}^{-2}`. Surface temperature restoring
0057 varies linearly from 10 :sup:`o`\ C at the northern boundary
0058 to -2 :sup:`o`\ C at the southern end. A wall is placed at the southern boundary of our domain,
0059 thus our setup is only reentrant in the east-west direction. Because MITgcm assumes a periodic
0060 domain in both the east-west and north-south directions, our southern wall effectively functions as a wall
0061 at the northern boundary as well.
62748458e3 Jeff*0062 The full water column in the northern boundary is a "sponge layer";
08815fc806 Jeff*0063 relaxing temperature though the full water column will partially constrain the stratification,
0064 and in the eddy-permitting solution will absorb any eddies reaching the northern boundary (truly acting as a "sponge").
0065 As shown in :numref:`channel_simulation_config`, a north-south ridge runs through the bottom topography,
0066 which is otherwise flat with a depth :math:`H` of 3980 m. A sloping notch cuts through the middle of the ridge;
0067 in the latitude band where the notch exists, potential vorticity :math:`f/H` contours are unblocked,
0068 which permits a vigorous zonal barotropic jet. Shaved cells are used to represent the topography.
0069
0070 .. figure:: figs/SO_config.png
0071 :width: 100%
0072 :align: center
0073 :alt: reentrant channel configuration
0074 :name: channel_simulation_config
0075
0076 Schematic of simulation domain, bottom topography, and wind-stress forcing function for the idealized reentrant channel numerical setup.
0077 A full-depth solid wall at :math:`y=` 0 is not shown; because MITgcm is also periodic in the north-south direction, this acts as a wall
0078 on the north boundary.
0079
0080 Similar to both tutorial :ref:`Barotropic Ocean Gyre <sec_eg_baro>` and tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`,
0081 we use a linear equation of state which is a function of temperature only
0082 (temperature is our only model tracer field). :numref:`channel_simulation_temp_ic` shows initial conditions in temperature at
0083 the northern and southern end of the domain. Initial temperature decreases exponentially from the relaxation SST profile
0084 to -2 :sup:`o`\ C at depth :math:`H`.
62748458e3 Jeff*0085 Note that this same northern boundary profile is used to restore temperature in the model's sponge layer, as discussed above.
08815fc806 Jeff*0086
0087 .. figure:: figs/temp_ic.png
0088 :width: 100%
0089 :align: center
0090 :alt: reentrant channel initial temp
0091 :name: channel_simulation_temp_ic
0092
0093 Initial conditions in temperature at the northern and southern boundaries.
0094 Note this same northern boundary profile is used as relaxation temperature in the model's sponge layer.
0095
0096 Equations Solved
0097 ----------------
0098
0099 The active set of equations solved is identical to those employed in tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`
0100 (i.e., hydrostatic with an implicit linearized free surface), except
0101 here we use standard Cartesian geometry rather than spherical polar coordinates:
0102
0103 .. math::
0104 :label: eg-channel-model_equations_uv
0105
0106 \frac{Du}{Dt} - fv +
0107 \frac{1}{\rho_c}\frac{\partial p'}{\partial x} +
0bad585a21 Navi*0108 \nabla _h \cdot ( -A_{h} \nabla _h u ) +
08815fc806 Jeff*0109 \frac{\partial}{\partial z} \left( -A_{z}\frac{\partial u}{\partial z} \right)
0110 &= \mathcal{F}_u
0111 \\
0112 \frac{Dv}{Dt} + fu +
0113 \frac{1}{\rho_c}\frac{\partial p'}{\partial y} +
0bad585a21 Navi*0114 \nabla _h \cdot ( -A_{h} \nabla _h v ) +
08815fc806 Jeff*0115 \frac{\partial}{\partial z} \left( -A_{z}\frac{\partial v}{\partial z} \right)
0116 &= \mathcal{F}_v
62748458e3 Jeff*0117
08815fc806 Jeff*0118 .. math::
0bad585a21 Navi*0119 \frac{\partial \eta}{\partial t} + \nabla _h \cdot \left( H \vec{\widehat{\bf u}} \right) = 0
08815fc806 Jeff*0120
0121 .. math::
0bad585a21 Navi*0122 \frac{D\theta}{Dt} + \nabla _h \cdot (-\kappa_{h} \nabla _h \theta)
08815fc806 Jeff*0123 + \frac{\partial}{\partial z} \left( -\kappa_{z}\frac{\partial \theta}{\partial z} \right)
0124 = \mathcal{F}_\theta
0125 :label: channel_model_theta
0126
0127 .. math::
0128 p^{\prime} = g\rho_{c} \eta + \int^{0}_{z} g \rho^{\prime} dz
0129 :label: channel_model_press
0130
0131 Forcing term :math:`\mathcal{F}_u` is applied as a source term in
0132 the model surface layer and zero in the interior, and source term :math:`\mathcal{F}_v`
0133 is zero everywhere. The forcing term :math:`\mathcal{F}_\theta` is applied as temperature relaxation in the surface
0134 layer and throughout the full depth in the two northern-most rows (in the coarse resolution setup) of the model domain.
0135
0136 .. _sec_SOch_num_config:
0137
0138 Discrete Numerical Configuration
0139 --------------------------------
0140
0141 The coarse-resolution domain is discretized with a uniform Cartesian grid spacing in the horizontal set to :math:`\Delta x=\Delta y=50` km,
0142 so that there are 20 grid cells in the :math:`x` direction and 40 in the :math:`y` direction.
0143 There are 49 levels in the vertical, ranging from 5.5 m depth at the surface to 149 m at depth.
0144 An "optimal grid" vertical spacing here was generated using the hyperbolic tangent method of Stewart et al. (2017) :cite:`stewart:17`,
0145 implemented in Python at https://github.com/kialstewart/vertical_grid_for_ocean_models,
0146 based on input parameters of ocean depth (4000 m), minimum (surface) depth (5 m),
0147 and maximum depth (150 m). In ocean modeling, it is generally advantageous to
0148 have finer resolution in the upper ocean (as was also done
0149 previously in tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`),
0150 but note that the transition to deeper layers should be done gradually, in the interests
0151 of solution fidelity and stability. Although our topography is idealized, the topography is
0152 not *a priori* discretized to levels matching the vertical grid, and we make
0153 use of MITgcm's ability to represent "partial cells" (see :numref:`sec_topo_partial_cells`).
0154
0155 Otherwise, the numerical configuration is similar to that of tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`),
0156 with an important difference: we use a high-order
0157 advection scheme ("7th order one-step method w/limiter", :varlink:`tempAdvScheme` parameter code 7) for potential temperature
0158 instead of :ref:`center second-ordered differences <adv_cent_2ord>`
0159 (which is used in tutorials :ref:`Barotropic Ocean Gyre <sec_eg_baro>`
0160 and :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>` and is the model default).
0161 This will enable us to use the same numerical scheme in both coarse-resolution and eddy-permitting simulations.
0162 Note that this advection scheme does NOT use :ref:`Adams-Bashforth <adams-bashforth>` time stepping for potential temperature, instead
0163 using its own time stepping scheme.
0164 The fixed flux form of the momentum equations are solved, as described in :numref:`flux-form_momentum_equations`,
0165 with an implicit linear free surface (:numref:`press_meth_linear`). Laplacian diffusion of tracers and momentum is employed.
0166 The pressure forces that drive
0bad585a21 Navi*0167 the fluid motions, :math:`\partial_x p^\prime`
0168 and :math:`\partial_y p^\prime`, are found by
08815fc806 Jeff*0169 summing pressure due to surface elevation :math:`\eta` and the
0170 hydrostatic pressure, as discussed in :numref:`baroc_eq_solved`.
0171 The sea-surface height is found by solving implicitly the 2-D (elliptic) surface pressure equation
0172 (see :numref:`press_meth_linear`).
0173
0174 Additional changes in the numerical configuration for the eddy-permitting simulation are discussed in :numref:`reentrant_channel_soln_eddy`.
0175
0176 .. _sec_tutSOch_num_stab:
0177
0178 Numerical Stability Criteria
0179 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0180
0181 The numerical considerations behind our setup are not trivial.
0182 We do not wish the thermocline to be diffused away by numerics.
0183 Accordingly, we employ a vertical diffusivity acting on temperature typical of background values
62748458e3 Jeff*0184 observed in the ocean, :math:`1 \times 10^{-5}` m\ :sup:`2` s\ :sup:`--1`).
08815fc806 Jeff*0185 We now examine numerical stability criteria to help choose and assess parameters for our coarse resolution study:
0186 parameters used in the eddy-permitting setup are discussed in :numref:`reentrant_channel_soln_eddy`.
0187
0188 We anticipate development of a large barotropic flow through the notch in the topographic ridge which will have
0189 implications for the length of the timestep we will be able to use. Let us consider the advective
0190 CFL condition :eq:`eq_SOch_cfl_stability` and the stability of inertial oscillations :eq:`eq_SOCh_inertial_stability`:
0191
0192 .. math::
0bad585a21 Navi*0193 S_{\rm adv} = 2 \left( \frac{ |c_{\rm max}| \Delta t}{ \Delta x} \right) < 0.5 \text{ for stability}
08815fc806 Jeff*0194 :label: eq_SOch_cfl_stability
0195
0196 .. math::
0bad585a21 Navi*0197 S_{\rm inert} = f {\Delta t} < 0.5 \text{ for stability}
08815fc806 Jeff*0198 :label: eq_SOCh_inertial_stability
0199
0bad585a21 Navi*0200 where :math:`|c_{\rm max}|` is the maximum horizontal velocity. We anticipate :math:`|c_{\rm max}|` of order ~ 1 ms\ :sup:`-1`.
08815fc806 Jeff*0201 Note that barotropic currents of this speed over a jet of order ~ 100 km in lateral scale will result in a
0202 barotropic flow of the order of hundreds of Sverdups. At a resolution of 50 km, :eq:`eq_SOch_cfl_stability` then
0203 implies that the timestep must be less than 12000 s and :eq:`eq_SOCh_inertial_stability` implies a timestep less than 3500 s.
0204 Here we make a conservative choice of :math:`\Delta t = 1000` s to keep :math:`f {\Delta t}` under 0.20.
0205
0206 How shall we set the horizontal viscosity? From the numerical stability criteria:
0207
0208 .. math::
0bad585a21 Navi*0209 S_{\ Lh} = 4 A_{h} \Delta t \left( \frac{1}{{\Delta x}^2} + \frac{1}{{\Delta y}^2} \right) < 1.0 \text{ for stability}
08815fc806 Jeff*0210 :label: eq_SOch__laplacian_stability
0211
0212 Note that the threshold in :eq:`eq_SOch__laplacian_stability` is < 1.0 instead of < 0.6 due to our
0213 specification (in :filelink:`input/data <verification/tutorial_reentrant_channel/input/data>`)
0214 that momentum dissipation NOT be solved using Adams-Bashforth, as
0215 discussed :ref:`below <momDissip_not_in_AB>`.
0216 With :math:`\Delta t = 1000` s, we can choose :math:`A_{h}` to be as large as order
0217 :math:`1 \times 10^{5}` m\ :sup:`2` s\ :sup:`--1`. However, such a value would result in a
0218 very viscous solution. We anticipate a boundary current along the deep ridge and sloping notch on a scale given by Munk scaling:
0219
0220 .. math::
0bad585a21 Navi*0221 M = \frac{2\pi}{\sqrt{3}} \left( \frac { A_{h} }{ \beta } \right)^{\frac{1}{3}}.
08815fc806 Jeff*0222 :label: eq_SOch__munk_layer
0223
0224 We can set :math:`A_{h}` to as low as 100 m\ :sup:`2` s\ :sup:`--1` and still comfortably resolve the
0225 Munk boundary layer on our grid. However, guided by an ensemble of runs exploring parameter space,
0226 we found the solution with :math:`A_{h} = 100 ` m\ :sup:`2` s\ :sup:`--1`, while stable, was rather noisy.
0227 As a compromise, a value of :math:`A_{h} = 2000` m\ :sup:`2` s\ :sup:`--1` reduced solution noise
62748458e3 Jeff*0228 whilst also controlling the strength of the barotropic current. This is the value used here.
08815fc806 Jeff*0229 Also note with this choice :math:`A_{h} / \Delta x` gives a velocity
0230 scaling of 4 cm/s, a reasonable value.
0231
0232 Regarding the vertical viscosity, we choose to solve this term implicitly (Euler backward
0233 time-stepping) by setting :varlink:`implicitViscosity` to ``.TRUE.`` in
0234 :filelink:`input/data <verification/tutorial_reentrant_channel/input/data>`, which results in no
0235 additional stability constraint on the model timestep (see :numref:`implicit-backward-stepping`).
0236 Otherwise, given that our vertical resolution is quite fine near the surface (approximately 5 m),
0237 the following stability criteria would have applied:
0238
0239 .. math::
0bad585a21 Navi*0240 S_{\rm Lv} = 4 \frac{A_{v} \Delta t}{{\Delta z}^2} < 1.0 \text{ for stability}
08815fc806 Jeff*0241 :label: eq_SOch__laplacian_v_stability
0242
0243 which effectively would limit our choice for :math:`A_{v}` to very small values.
62748458e3 Jeff*0244 For simplicity, and given that away from the equator coarse resolution models are typically not
08815fc806 Jeff*0245 very sensitive to the value of vertical viscosity, we pick a constant value of :math:`A_{v} = 3\times10^{-3}` m\ :sup:`2` s\ :sup:`--1`
0246 over the full domain, somewhere in between (in geometric mean sense) typical values
0247 found in the mixed layer (:math:`\sim 10^{-2}`) and in the deep ocean (:math:`\sim 10^{-4}`) (Roach et al. 2015 :cite:`roach:15`)
0248 Note this implicit scheme is also used for vertical diffusion of tracers, for which
0249 it can also be used to represent convective adjustment (again, because it is unconditionally stable regardless of diffusivity value).
0250
0251 .. _sec_eg_reentrant_channel_config:
0252
0253 Configuration
0254 -------------
0255
0256 The model configuration for this experiment resides under the directory :filelink:`verification/tutorial_reentrant_channel/`.
0257
0258 The experiment files
0259
0260 - :filelink:`verification/tutorial_reentrant_channel/code/SIZE.h`
0261 - :filelink:`verification/tutorial_reentrant_channel/code/LAYERS_SIZE.h`
0262 - :filelink:`verification/tutorial_reentrant_channel/code/DIAGNOSTICS_SIZE.h`
0263 - :filelink:`verification/tutorial_reentrant_channel/input/data`
0264 - :filelink:`verification/tutorial_reentrant_channel/input/data.pkg`
0265 - :filelink:`verification/tutorial_reentrant_channel/input/data.gmredi`
0266 - :filelink:`verification/tutorial_reentrant_channel/input/data.rbcs`
0267 - :filelink:`verification/tutorial_reentrant_channel/input/data.layers`
0268 - :filelink:`verification/tutorial_reentrant_channel/input/data.diagnostics`
0269 - :filelink:`verification/tutorial_reentrant_channel/input/eedata`
0270 - verification/tutorial_reentrant_channel/input/bathy.50km.bin
0271 - verification/tutorial_reentrant_channel/input/zonal_wind.50km.bin
0272 - verification/tutorial_reentrant_channel/input/T_surf.50km.bin
0273 - verification/tutorial_reentrant_channel/input/temperature.50km.bin
0274 - verification/tutorial_reentrant_channel/input/T_relax_mask.50km.bin
0275
62748458e3 Jeff*0276 contain the code customizations and parameter settings for this
08815fc806 Jeff*0277 experiment. Below we describe these customizations in detail.
62748458e3 Jeff*0278
08815fc806 Jeff*0279 Compile-time Configuration
0280 ~~~~~~~~~~~~~~~~~~~~~~~~~~
0281
0282 File :filelink:`code/packages.conf <verification/tutorial_reentrant_channel/code/packages.conf>`
0283 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0284
0285 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/code/packages.conf
0286 :linenos:
0287 :caption: verification/tutorial_reentrant_channel/code/packages.conf
0288
62748458e3 Jeff*0289 In addition to the pre-defined standard package group ``gfd``, we define four additional packages.
08815fc806 Jeff*0290
0291 - Package :filelink:`pkg/gmredi` (see :ref:`sub_phys_pkg_gmredi`):
0292 This implements the Gent and McWilliams parameterization (as first described in Gent and McWilliams 1990 :cite:`gen-mcw:90`)
0293 of geostrophic eddies. This mixes along sloping neutral surfaces (here, just :math:`T` surfaces).
0294 It is used instead of large prescribed diffusivities aligned in the horizontal plane (parameter :varlink:`diffKh`).
0295 In :numref:`reentrant_channel_solution` we will illustrate the marked improvement
0296 in the solution resulting from the use of this parameterization.
0297
0298 - Package :filelink:`pkg/rbcs` (see :ref:`sub_phys_pkg_rbcs`):
0299 The default MITgcm code library permits relaxation boundary conditions only at the ocean surface;
0300 in the setup here, we relax temperature over the full-depth :math:`xz` plane
0301 along our domain's northern border. By including the :filelink:`pkg/rbcs` code library in our model build,
0302 we can relax selected fields (tracers or
0303 horizontal velocities) in any 3-D location.
0304
0305 We also include two packages which augment MITgcm's diagnostic capabilities.
0306
0307 - Package :filelink:`pkg/layers`:
0308 This calculates the thickness and transport of layers of specified density (or temperature, or salinity;
0309 here, temperature and density are aligned because of our simple equation of state).
0310 Further explanation of :filelink:`pkg/layers` parameter options and output is given :ref:`below <tut_SO_layers>`.
0311
0312 - Package :filelink:`pkg/diagnostics`:
0313 This selects which fields to output, and at what frequencies. This was introduced in
0314 tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`.
0315
0316 File :filelink:`code/SIZE.h <verification/tutorial_reentrant_channel/code/SIZE.h>`
0317 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0318
0319 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/code/SIZE.h
0320 :linenos:
0321 :caption: verification/tutorial_reentrant_channel/code/SIZE.h
0322
0323 Our model tile size is defined above to be 20 :math:`\times` 10 gridpoints, so four tiles (i.e., :varlink:`nSy` =4)
0324 are required to span the full domain in :math:`y`.
0325 Note that our overlap sizes (:varlink:`OLx`, :varlink:`OLy`) are set to 4 in this tutorial,
0326 as required by our choice of advection scheme (see discussion in :numref:`sec_tutSOch_num_stab`
0327 and :numref:`adv_scheme_summary` from which this required overlap can be obtained);
0328 in tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>` this was set to 2,
0329 which is the mimimum required for the default :ref:`center second-ordered differences <adv_cent_2ord>` scheme.
0330 For this setup we will specify a reasonably high resolution
0331 in the vertical, using 49 levels.
0332
0333 File :filelink:`code/LAYERS_SIZE.h <verification/tutorial_reentrant_channel/code/LAYERS_SIZE.h>`
0334 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0335
0336 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/code/LAYERS_SIZE.h
0337 :linenos:
0338 :caption: verification/tutorial_reentrant_channel/code/LAYERS_SIZE.h
0339
0340 As noted above in this file's comments, we must set the discrete number of layers to use in our diagnostic calculations.
0341 The model default is 20 layers. Here we set ``PARAMETER(`` :varlink:`Nlayers` ``= 37 )`` and so choose 37 layers.
0342 In making this choice, one needs to ensure sufficiently fine layer bounds in the density (or temperature) range of interest,
0343 while also possible to specify fairly coarse bounds in other density ranges.
0344 The specific temperatures defining layer bounds will be prescribed in :filelink:`input/data.layers <verification/tutorial_reentrant_channel/input/data.layers>`
0345
0346 File :filelink:`code/DIAGNOSTICS_SIZE.h <verification/tutorial_reentrant_channel/code/DIAGNOSTICS_SIZE.h>`
0347 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0348
0349 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/code/DIAGNOSTICS_SIZE.h
0350 :linenos:
0351 :caption: verification/tutorial_reentrant_channel/code/DIAGNOSTICS_SIZE.h
0352
0353 Here the parameter :varlink:`numDiags` has been changed to allow a combination of up to 35 3-D diagnostic fields or 1715 (=35*49) 2-D fields.
0354
0355 Run-time Configuration
0356 ~~~~~~~~~~~~~~~~~~~~~~
0357
0358 .. _reentrant_channel_data:
0359
0360 File :filelink:`input/data <verification/tutorial_reentrant_channel/input/data>`
0361 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0362
0363 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0364 :linenos:
0365 :caption: verification/tutorial_reentrant_channel/input/data
0366
0367 This file, reproduced in its entirety above, specifies the main parameters for the experiment. Parameters for this configuration
0368 (shown with line numbers to left) are as follows.
0369
0370 PARM01 - Continuous equation parameters
62748458e3 Jeff*0371 #######################################
08815fc806 Jeff*0372
0373 - These lines set the horizontal and vertical Laplacian viscosities.
0374 As in earlier tutorials, we use a spatially uniform value for viscosity in both the horizontal and vertical. We set viscosity to be solved implicitly,
0375 using the :ref:`backward method <implicit-backward-stepping>`, as discussed in :numref:`sec_tutSOch_num_stab`.
0376
0377 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0378 :start-at: viscAh
0379 :end-at: implicitVisc
0380 :lineno-match:
0381
0382 - These lines set the horizontal and vertical diffusivities. In the standard (coarse resolution) configuration the
0383 Gent-McWilliams parameterization (:filelink:`pkg/gmredi`) is activated, and we set the horizontal diffusivity to zero
0384 (which is the default value).
0385 Similar to tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`, we set a large vertical diffusivity (:varlink:`ivdc_kappa`)
62748458e3 Jeff*0386 for mixing unstable water columns, which requires implicit numerical treatment of vertical diffusion.
0387
08815fc806 Jeff*0388 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0389 :start-at: diffKhT
0390 :end-at: implicitDiff
0391 :lineno-match:
0392
0393 - The first two lines below set the model's Coriolis parameters (:varlink:`f0` and :varlink:`beta`) to values representative
0394 of the latitude band encompassing the Antarctic Circumpolar Current. In the last line we set the model
0395 to use the Jamart and Ozer (1986) :cite:`jamart:86` wet-points averaging method, in lieu of the model
0396 default (see :numref:`fluxform_cor_terms`; parameter options here are given in :numref:`parms_mom`).
0397 The method affects the discretization of the Coriolis terms in the momentum equations.
0398 In this setup -- as we will show, the jet is dominated by barotropic potential vorticity
0399 conservation -- it turns out the solution is rather sensitive to this discretization (particularly
0400 adjacent to topography). We tested both the default and wet-points methods, and found the wet-points
0401 method closer to the eddy-permitting solution, where obviously the discretization of the Coriolis term is better resolved.
62748458e3 Jeff*0402
08815fc806 Jeff*0403 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0404 :start-at: f0
0405 :end-at: selectCoriScheme
0406 :lineno-match:
0407
0408 - These lines set parameters related to the density and equation of state. Here we choose the same value for the
0409 Boussinesq reference density :varlink:`rhoConst` as our value :varlink:`rhoNil`, for the linear equation of state.
0410 To keep things simple, as well as speed up model run-time, we limit ourselves to a single tracer, temperature,
0411 and tell the model not to step salinity forward in time or include salinity in the equation of state.
62748458e3 Jeff*0412 Also note we use a uniform reference temperature (:varlink:`tRef`) throughout the water column.
08815fc806 Jeff*0413 We will be specifying a file for initial conditions of temperature in our simulation, and so :varlink:`tRef` will
0414 not be used for this purpose (as it was in tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`).
0415 Thus, :varlink:`tRef` is only employed here as a reference to compute density anomalies. In principle, one could
0416 define :varlink:`tRef` to a more representative array of values at each level, but for most applications any
0417 gain in numerical accuracy is small, and a single representative value suffices.
0418
0419 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0420 :start-at: rhoConst
0421 :end-at: saltStep
0422 :lineno-match:
0423
0424 .. _tut_SO_partialcellparms:
0425
0426 - These lines activate the use of partial cells, as described in :numref:`sec_topo_partial_cells`. :varlink:`hFacMin`\ =0.1 permits
0427 partial cells that are as small as 10% of the full cell depth, but with :varlink:`hFacMinDr`\ =5.0 m this partial cell must also be
0428 at least 5 m in depth. Note that the model default of :varlink:`hFacMin`\ =1.0 disables partial cells, i.e., values from a specified bathymetry file are rounded
0429 up or down to match grid depth interface levels (model variable :varlink:`rF`). See also :numref:`parms_topo` for general information on using these parameters and
0430 :ref:`below <reentrant_channel_bathy_file>` for additional information about partial cells in this setup.
0431
0432 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0433 :start-at: hFacMinDr
0434 :end-at: hFacMin=
0435 :lineno-match:
0436
0437 - These lines activate the implicit free surface formulation (:numref:`press_meth_linear`) with the exact conservation option enabled, similar
0438 to tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`.
0439
0440 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0441 :start-at: rigidLid
0442 :end-at: exactConserv
0443 :lineno-match:
0444
0445 - This instructs the model to use a 7th order monotonicity-preserving advection scheme (code 7) -- basically, a higher-order,
0446 more accurate, less noisy advection scheme -- instead of the center-differences, 2nd order model default scheme (code 2).
0447 The downside here is additional computations, costly if running with many tracers, and a larger necessary overlap
0448 size in :filelink:`SIZE.h <verification/tutorial_reentrant_channel/code/SIZE.h>`, which may get costly if one parallelizes
0449 the model into many small tiles. We will use the same scheme for both coarse and eddy-permitting resolutions;
0450 using the higher-order scheme is particularly helpful in the high resolution setup. When using non-Adams-Bashforth
0451 advection schemes (see :numref:`adv_scheme_summary`), the flag :varlink:`staggerTimeStep` should be set to ``.TRUE.``.
0452
0453 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0454 :start-at: tempAdv
0455 :end-at: staggerTime
0456 :lineno-match:
0457
0458 PARM02 - Elliptic solver parameters
62748458e3 Jeff*0459 ###################################
08815fc806 Jeff*0460
0461 These parameters are unchanged from tutorials :ref:`Barotropic Ocean Gyre <sec_eg_baro>`
0462 and :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`.
0463
0464 PARM03 - Time stepping parameters
0465 #################################
0466
0467 - For testing purposes the tutorial is set to integrate 10 time steps,
0468 but uncomment the line futher down in the file setting :varlink:`nTimeSteps`
0469 to integrate the solution for 30 years.
0470
0471 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0472 :start-at: nIter0
0473 :end-at: nTimeSteps
0474 :lineno-match:
0475
0476 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0477 :start-at: nTimeSteps=933
0478 :end-at: nTimeSteps=933
0479 :lineno-match:
0480
0481 - Remaining time stepping parameters are as described in earlier tutorials. See :numref:`sec_tutSOch_num_stab`
0482 for a discussion on our choice of :varlink:`deltaT`.
0483
0484 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0485 :start-at: deltaT
0486 :end-at: monitorSelect
0487 :lineno-match:
0488
0489 - As in tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>` we set the timescale, in seconds,
0490 for relaxing potential temperature in the model's top layer (note: relaxation timescale for the northern boundary sidewalls
0491 is set in :filelink:`data.rbcs <verification/tutorial_reentrant_channel/input/data.rbcs>`, not here).
0492 Our choice of 864,000 seconds is equal to 10 days.
0493
0494 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0495 :start-at: tauTheta
0496 :end-at: tauTheta
0497 :lineno-match:
0498
0499 .. _momDissip_not_in_AB:
0500
0501 - This instructs the model to NOT apply Adams-Bashforth scheme to the viscosity tendency and other dissipation terms
0502 (such as side grad and bottom drag) in the momentum equations (the default is to use Adams-Bashforth for all terms);
0503 instead, dissipation is computed using a explicit, forward, first-order scheme.
62748458e3 Jeff*0504 For our coarse resolution setup with uniform harmonic viscosity, this setting is not strictly necessary
0505 (and does not noticeably change results). However, for our eddy-permitting run we will use a difference
08815fc806 Jeff*0506 scheme for setting viscosity, and for stability requires this setting.
0507
0508 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0509 :start-at: momDissip
0510 :end-at: momDissip
0511 :lineno-match:
0512
0513 PARM04 - Gridding parameters
62748458e3 Jeff*0514 ############################
08815fc806 Jeff*0515
0516 - We specify a Cartesian coordinate system with 20 gridpoints in :math:`x` and 40 gridpoints in :math:`y`,
0517 with (default) origin (0,0).
0518
0519 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0520 :start-at: usingCartesianGrid
0521 :end-at: delY
0522 :lineno-match:
0523
62748458e3 Jeff*0524 - We set the vertical grid spacing for 49 vertical levels, ranging from thickness of approximately 5.5 m at the
08815fc806 Jeff*0525 surface to 149 m at depth. When varying cell thickness in this manner, one must be careful that vertical grid
0526 spacing varies smoothly with depth; see :numref:`sec_SOch_num_config` for details on how this specific grid spacing was generated.
0527
0528 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0529 :start-at: delR
0530 :end-at: 149.35
0531 :lineno-match:
62748458e3 Jeff*0532
08815fc806 Jeff*0533 PARM05 - Input datasets
0534 #######################
0535
0536 - The following lines set file names for the bathymetry, zonal wind forcing, and climatological surface temperature relaxation files
0537 (these files are all 2-D fields, see :ref:`below <reentrant_channel_bathy_file>`)
0538
0539 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0540 :start-at: bathyFile
0541 :end-at: thetaClim
0542 :lineno-match:
62748458e3 Jeff*0543
0544 - This last line specifies the name of the 3-D file containing initial conditions for temperature (as noted above,
08815fc806 Jeff*0545 :varlink:`tRef` values specified in namelist ``PARM01`` are NOT used for the initial state).
0546
0547 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data
0548 :start-at: hydrogTheta
0549 :end-at: hydrogTheta
0550 :lineno-match:
0551
0552 File :filelink:`input/data.pkg <verification/tutorial_reentrant_channel/input/data.pkg>`
0553 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0554
0555 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.pkg
0556 :linenos:
0557 :caption: verification/tutorial_reentrant_channel/input/data.pkg
0558
0559 - These first two lines affect the model physics packages we've included in our build, :filelink:`pkg/gmredi`
0560 and :filelink:`pkg/rbcs`. In our standard configuration, we will activate both (but in an second run, we will opt to NOT
0561 activate :filelink:`pkg/gmredi`).
0562
0563 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.pkg
0564 :start-at: useGMRedi
0565 :end-at: useRBCS
0566 :lineno-match:
0567
0568 - These lines instruct the model to activate both diagnostics packages we've included in our build, :filelink:`pkg/layers`
0569 and :filelink:`pkg/diagnostics`.
0570
0571 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.pkg
0572 :start-at: useLay
0573 :end-at: useDiag
0574 :lineno-match:
0575
0576 File :filelink:`input/data.gmredi <verification/tutorial_reentrant_channel/input/data.gmredi>`
0577 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0578
0579 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.gmredi
0580 :linenos:
0581 :caption: verification/tutorial_reentrant_channel/input.GM/data.gmredi
0582
0583 Note that this file is ignored with :filelink:`pkg/gmredi` disabled (in :filelink:`input/data.pkg <verification/tutorial_reentrant_channel/input/data.pkg>`,
0584 ``useGMRedi=.FALSE.``), but must be present when enabled. Parameter choices are as follows.
0585
0586 - Parameter :varlink:`background_K` sets the Gent-McWilliams "thickness diffusivity", which determines the strength of the parameterized
0587 geostrophic eddies in flattening sloping isopycnal surfaces. By default, this parameter is also used as diffusivity for the Redi component
0588 of the parameterization, which diffuses tracers along isoneutral surfaces. It is possible to set the Redi diffusivity to a separate value
0589 from the thickness diffusivity by setting parameter :varlink:`GM_isopycK` in the above list.
0590 However, in this setup with a single tracer determining density, it would not serve any purpose because diffusion
0591 of temperature along surfaces of constant temperature has no impact.
0592
0593 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.gmredi
0594 :start-at: 1000.,
0595 :end-at: 1000.,
0596 :lineno-match:
0597
0598 - By default, :filelink:`pkg/gmredi` does not select a tapering scheme (see :numref:`sub_gmredi_tapering_stability`); however, for best results, one should be selected.
0599 Here we choose the tapering approach described in Danabasoglu and McWilliams (1995) :cite:`danabasoglu:95`. Additional choices for the
0600 tapering scheme (or alternatively, the more simple slope clipping approach), and why such a scheme is necessary, are described in the
0601 :ref:`GMRedi package documentation <sub_phys_pkg_gmredi>`.
0602
0603 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.gmredi
0604 :start-at: dm95
0605 :end-at: dm95
0606 :lineno-match:
0607
0608 - We select the advective or "bolus" form of the parameterization,
0609 which specifies that GM fluxes are parameterized into a :ref:`bolus advective transport <GM_bolus_desc>`, rather
0610 than implemented as a :ref:`"skewflux" transport <sub_gmredi_skewflux>` via added terms
0611 in the diffusion tensor (see Griffies 1998 :cite:`gr:98`). The skewflux form is the package default.
0612 Analytically, these forms are identical, but in practice are discretized differently.
0613 For instance, the bolus form will, by default, advect tracers with combined eulerian and bolus transport
0614 (i.e, residual transport) which then inherits the higher order precision of the selected advection scheme 7.
0615 This can lead to noticeably different solutions in some setups (anecdotally,
0616 particularly where you have steeply sloping isopycnals near boundaries). For diagnostic
0617 purposes, the bolus form permits a straightforward calculation of the actual advective transport (from the GM part),
0618 whereas obtaining this transport using the skewflux form is less straightforward due to discretization issues.
0619
0620 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.gmredi
0621 :start-at: TRUE
0622 :end-at: TRUE
0623 :lineno-match:
0624
0625 .. _tut_so_channel_rbcs:
0626
0627 File :filelink:`input/data.rbcs <verification/tutorial_reentrant_channel/input/data.rbcs>`
0628 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0629
0630 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.rbcs
0631 :linenos:
0632 :caption: verification/tutorial_reentrant_channel/input/data.rbcs
0633
0634 Setting parameter :varlink:`useRBCtemp` to ``.TRUE.`` instructs :filelink:`pkg/rbcs` that we will be restoring temperature
0635 (and by default, it will not restore salinity, nor velocity, nor any other passive tracers). :varlink:`tauRelaxT` sets the relaxation timescale for
0636 3-D temperature restoring to 864,000 s or 10 days.
0637 The remaining two parameters
0638 are a filename for a 3-D mask of gridpoint locations to restore (:varlink:`relaxMaskFile`),
0639 and a filename for a 3-D field of restoring temperature values (:varlink:`relaxTFile`). See :ref:`below <reentrant_channel_ rbcsfiles>` for further description
0640 of these fields.
0641
0642 File :filelink:`input/data.layers <verification/tutorial_reentrant_channel/input/data.layers>`
0643 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0644
0645 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.layers
0646 :linenos:
0647 :caption: verification/tutorial_reentrant_channel/input/data.layers
0648
0649 :varlink:`pkg/layers` consists of online calculations which separate water masses into
0650
0651 specified layers, either by temperature, salinity, or density.
0652 Note that parameters here include an array index of 1; it is possible to diagnose layers in both temperature and salinity simultaneously,
0653 for example, in which case one would add a second set of parameters with array index 2. Even though :varlink:`layers_maxNum` is set to 1
0654 (i.e, only allows a for single layers coordinate) in :filelink:`LAYERS_SIZE.h <verification/tutorial_reentrant_channel/code/LAYERS_SIZE.h>`,
0655 the index is still required.
0656
0657 - The parameter :varlink:`layers_name` is set to ``'TH'`` which specifies temperature as our layers coordinate.
0658
0659 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.layers
0660 :start-at: layers_name
0661 :end-at: layers_name
0662 :lineno-match:
0663
0664 - Parameter :varlink:`layers_bounds` specifies the discretization of the layers coordinate system;
0665 we span from the lowest possible model temperature (i.e., the coldest restoring temperature at the
0666 surface or northern boundary, -2 :sup:`o`\ C) to the warmest model temperature (i.e., the warmest
0667 restoring temperature, 10 :sup:`o`\ C). The number of values here must be :varlink:`Nlayers` +1, as specified
0668 in :filelink:`LAYERS_SIZE.h <verification/tutorial_reentrant_channel/code/LAYERS_SIZE.h>`.
0669 Here, :varlink:`Nlayers` is set to 37, so we have 38 discrete :varlink:`layers_bounds`).
0670 :filelink:`pkg/layers` will not complain if the discretization does not span the full range of
0671 existing water in the model ocean; it will simply ignore water masses (and their transport) that
0672 fall outside the specified range in :varlink:`layers_bounds`
0673 (this will make it impossible however to close the layer volume budget).
0674 Also note that the range must be monotonically *increasing*, even if this results in a layers
0675 coordinate k=1:\ :varlink:`Nlayers` that proceeds in the opposite sense as the depth coordinate
0676 (i.e., the k=1 layers coordinate is at the ocean bottom, whereas the k=1 depth coordinate refers to the ocean surface layer).
0677
0678 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.layers
0679 :start-at: layers_bound
0680 :end-at: 10.0,
0681 :lineno-match:
0682
0683 File :filelink:`input/data.diagnostics <verification/tutorial_reentrant_channel/input/data.diagnostics>`
0684 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0685
0686 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.diagnostics
0687 :linenos:
0688 :caption: verification/tutorial_reentrant_channel/input/data.diagnostics
0689
0690 DIAGNOSTICS_LIST - Diagnostic Package Choices
0691 #############################################
0692
0693 See tutorial :ref:`Baroclinic Ocean Gyre <baroc_diags_list>` for a detailed explanation of parameter settings
0694 to customize :filelink:`data.diagnostics <verification/tutorial_reentrant_channel/input/data.diagnostics>` to a desired set of output diagnostics.
0695
0696 We have divided the output diagnostics into several separate lists
0697 (recall, 2-D output fields cannot be mixed with 3-D fields!!!) The first
0698 two lists are quite similar to what used in tutorial :ref:`Baroclinic Ocean Gyre <baroc_diags_list>`: specifically,
0699 several key 2-D diagnostics are in one file (surface restoring heat flux, mixed layer depth, and free surface height),
0700 and several 3-D diagnostics and state variables in another (theta, velocity components, convective adjustment index).
0701
0702 In diagnostics list 3, we specify horizontal advective heat fluxes
0703 (``ADVx_TH`` and ``ADVy_TH`` in :math:`x` and :math:`y` directions, respectively), vertical advective heat flux (``ADVr_TH``),
0704 horizontal diffusive heat fluxes (``DFxE_TH`` and ``DFyE_TH``), and vertical diffusive heat flux (``DFrI_TH`` and ``DFrE_TH``). Note the latter is
0705 broken into separate implicit and explicit components, respectively, the latter of which will only be non-zero if :filelink:`pkg/gmredi` activated.
0706 Although we will not examine these 3-D diagnostics below when :ref:`describing the model solution <reentrant_channel_solution>`,
0707 the zonal terms are needed to compute zonally-averaged meridional heat transport, and all terms needed for a
0708 diagnostic attempt at reconciling a heat budget of the model solution.
0709
0710 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.diagnostics
0711 :start-at: fields(1:7,3
0712 :end-at: filename(3
0713 :lineno-match:
0714
0715 .. _tut_SO_layers:
0716
0717 In diagnostics list 4, we specify several :varlink:`pkg/layers` diagnostics. In our setup we use a linear equation of state based solely on temperature,
0718 so we will diagnose layers of temperature in the model solution, as shown in :numref:`layers_trans_schematic`.
0719
0720 .. figure:: figs/layers_trans.png
0721 :width: 60%
0722 :align: center
0723 :alt: layers schematic
0724 :name: layers_trans_schematic
0725
0726 Schematic of :filelink:`pkg/layers` diagnostics.
0727
0728 .. literalinclude:: ../../../verification/tutorial_reentrant_channel/input/data.diagnostics
0729 :start-at: fields(1:3,4
0730 :end-at: fileName(4
0731 :lineno-match:
0732
0733 Diagnostic ``LaVH1TH`` is the integrated meridional mass transport in the layer;
0734 here we request an annual mean time average (via the ``frequency`` parameter setting),
0735 which will effectively output the quantity :math:`\overline{vh}` (m\ :sup:`2` s\ :sup:`-1`).
0736 ``LaHs1TH`` is the layer thickness :math:`h` (m) calculated at "v" points (see :numref:`spatial_discrete_horizontal_grid`).
0737 ``LaVa1TH`` is the layer average meridional velocity :math:`v` (m/s).
0738 These diagnostics are all 3-D fields, albeit the vertical dimension here is the layer discretization
0739 in temperature space, which was defined in :filelink:`data.layers <verification/tutorial_reentrant_channel/input/data.layers>`.
0740 See :numref:`reentrant_channel_solution` for examples using these diagnostics to
0741 calculate the residual circulation and the meridional overturning circulation in density coordinates.
0742
0743 DIAG_STATIS_PARMS - Diagnostic Per Level Statistics
0744 ###################################################
0745
0746 Here we specify statistical diagnostics of potential temperature and surface relaxation heat flux, output every ten days,
0747 to assess how well the model has equilibrated. See tutorial :ref:`Baroclinic Ocean Gyre <baroc_diags_list>` for a more complete description of syntax
0748 and output produced by these diagnostics.
0749
0750 File :filelink:`input/eedata <verification/tutorial_reentrant_channel/input/eedata>`
0751 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0752
0753 This file uses standard default values (single-threaded) and does not contain
0754 customizations for this experiment.
0755
0756 .. _reentrant_channel_bathy_file:
0757
0758 File ``input/bathy.50km.bin``
0759 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0760
0761 This is a 2-D(:math:`x,y`) map of bottom bathymetry,
0762 as generated by the `MATLAB <https://www.mathworks.com/>`_ program :filelink:`verification/tutorial_reentrant_channel/input/gendata.50km.m`
62748458e3 Jeff*0763 or the `Python <https://www.python.org/>`_ script :filelink:`verification/tutorial_reentrant_channel/input/gendata.50km.py`.
0764 Input files are 32-bit single precision, by default. Our bathymetry file has active ocean grid cells
08815fc806 Jeff*0765 along both the eastern and western boundaries (i.e., no land points or walls are present along either boundary),
0766 and thus our model will be fully zonally reentrant.
0767 While our northern boundary also consists entirely of active ocean points, we prescribe a wall
0768 along the southern end of our model domain, therefore the model is NOT meridionally reentrant.
0769
0770 Unlike in previous examples, where the bathymetry was discretized
0771 to match depths of defined vertical grid faces (:varlink:`rF`, see :numref:`vgrid-accur-center`),
0772 we have a more complicated bottom bathymetry as defined using a sine function for our bottom ridge.
0773 The model default in such case is to round the bathymetry up or down to the nearest allowed vertical
0774 cell face level. However, the model permits the use of ":ref:`partial cells <sec_topo_partial_cells>`"
0775 (sometimes also referred to as "shaved" or "lopped" cells), which can provide dramatic improvements
0776 in model solution (see Adcroft et al. 1997 :cite:`adcroft:97`). Here, we activate partial cells though
0777 parameter choices :varlink:`hFacMin` and :varlink:`hFacMinDr` in :filelink:`input/data <verification/tutorial_reentrant_channel/input/data>`,
0778 as discussed :ref:`above <tut_SO_partialcellparms>`. The fraction of a vertical cell that
0779 contains fluid is represented in the 3-D output variable :varlink:`hFacC`, which will have a value of 0.0 beneath the ocean floor (and at land points),
0780 1.0 at an active full-depth ocean cell, and a number between :varlink:`hFacMin` and 1.0 for a partial ocean cell. As such, :varlink:`hFacC`
0781 is often quite useful as a "mask" when computing diagnostics using model output.
0782
0783 As an example, consider horizontal location (10,15) in out setup here, located in our bottom ridge along the sloping notch.
0784 In our bathymetry file, the vertical level is specified as -2382.3 m.
0785 This falls between vertical faces located at -2360.1 and -2504.0 [these are grid variable :varlink:`rF`\ (39:40)].
0786 Thus, this grid cell will be included in the active ocean domain as a thin, yet legal, partial cell: :varlink:`hFacC`\ (10,15,39)=0.154.
0787
0788 .. _reentrant_channel_windx:
0789
0790 File ``input/zonal_wind.50km.bin``, ``input/SST_relax.50km.bin``
0791 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0792
0793 These files are 2-D(:math:`x,y`)
0794 maps of zonal wind stress :math:`\tau_{x}` (Nm\ :sup:`--2`) and surface relaxation temperature (:sup:`o`\ C),
62748458e3 Jeff*0795 as generated by program :filelink:`verification/tutorial_reentrant_channel/input/gendata.50km.m` or
0796 :filelink:`verification/tutorial_reentrant_channel/input/gendata.50km.py`.
08815fc806 Jeff*0797 Note that a 2-D(:math:`x,y`) file is expected even though as specified, both :math:`\tau_{x}` and SST field are only :math:`f(y)`.
0798
0799 .. _reentrant_channel_ rbcsfiles:
0800
0801 File ``input/temperature.50km.bin``
0802 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0803
0804 This file specifies a 3-D(:math:`x,y,z`) map of temperature (:sup:`o`\ C),
62748458e3 Jeff*0805 as generated by :filelink:`verification/tutorial_reentrant_channel/input/gendata.50km.m` or
0806 :filelink:`verification/tutorial_reentrant_channel/input/gendata.50km.py`
0807 (see :numref:`channel_simulation_temp_ic`).
08815fc806 Jeff*0808 Note again a 3-D(:math:`x,y,z`) file is expected despite temperature begin only :math:`f(y,z)`.
0809 This file is used here for two purposes: first, as specified in
0810 :filelink:`input/data <verification/tutorial_reentrant_channel/input/data>`, these values are used for temperature initial conditions;
0811 secondly, this file was also specified in :filelink:`input/data.rbcs <verification/tutorial_reentrant_channel/input/data.rbcs>`
0812 as a 3-D field used for temperature relaxation purposes.
0813
0814 .. _reentrant_channel_ rbcsmaskfile:
0815
0816 File ``input/T_relax_mask.50km.bin``
0817 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0818
0819 This file specifies a 3-D(:math:`x,y,z`) mask, as required by :filelink:`/pkg/rbcs` to inform the model which gridpoints to relax.
0820 These values should be between 0.0 and 1.0, with 0.0 for no restoring, 1.0 for full restoring, with fractional values as a multiplicative factor
0821 to effectively weaken restoring at that location (see :numref:`sub_phys_pkg_rbcs`). Here, we select a value of 1.0 along the model northern wall
62748458e3 Jeff*0822 for all sub-surface depths (relaxation at the surface is specified using ``input/SST_relax.50km.bin``,
0823 otherwise you would be restoring the surface layer twice),
08815fc806 Jeff*0824 and use a fractional value for the :math:`xz` plane of grid cells just south of the northern border (see
62748458e3 Jeff*0825 :filelink:`verification/tutorial_reentrant_channel/input/gendata.50km.m` or
0826 :filelink:`verification/tutorial_reentrant_channel/input/gendata.50km.py`).
08815fc806 Jeff*0827
0828 .. _reentrant_channel_build_run:
0829
0830 Building and running the model
0831 ------------------------------
0832
0833 This model can be built and run using the standard procedure described in :numref:`building_code` and :numref:`run_the_model`.
0834 (see also :filelink:`README <verification/tutorial_reentrant_channel/README.md>`).
0835
0836 For testing purposes the model is set to run 10 time steps. For a reasonable solution, we suggest
0837 running for 30 years, which requires changing :varlink:`nTimeSteps` to 933120. When making this edit, also
0838 change :varlink:`monitorFreq` to something more reasonable, say 10 days (``=864000.``). Using a single processor core,
0839 it should take 12 hours or so to run 30 years; to speed this up using
0840 `MPI <https://en.wikipedia.org/wiki/Message_Passing_Interface>`_, re-compile using :varlink:`nPy`\ ``=4,`` and :varlink:`nSy`\ ``=1,`` in
0841 :filelink:`SIZE.h <verification/tutorial_reentrant_channel/code/SIZE.h>` and recompile with the ``-mpi`` flag
0842 (see :numref:`running_mpi` for instructions how to run using `MPI <https://en.wikipedia.org/wiki/Message_Passing_Interface>`_,
0843 here you will be using 4 cores).
0844 As an exercise, see if you can speed it up further using additional processor cores, e.g.,
62748458e3 Jeff*0845 by decreasing the tile size in :math:`x` and increasing :varlink:`nPx`.
08815fc806 Jeff*0846
0847 As configured, the model runs with :filelink:`pkg/gmredi` activated, i.e., :varlink:`useGMRedi`\ ``=.TRUE.``
0848 in :filelink:`data.pkg <verification/tutorial_reentrant_channel/input/data.pkg>`. In :numref:`reentrant_channel_solution`
0849 we will also examine a model solution using old-fashioned large horizontal diffusion with :filelink:`pkg/gmredi` deactivated.
0850 The same executable can be used for the non-GM run.
0851 Set :varlink:`useGMRedi`\ ``=.FALSE.`` in :filelink:`data.pkg <verification/tutorial_reentrant_channel/input/data.pkg>`,
0852 and also set :varlink:`diffKhT`\ ``=1000.`` in :filelink:`data <verification/tutorial_reentrant_channel/input/data>` namelist ``PARM01``.
0853 Also, comment out the lines for diagnostics list 5 in :filelink:`data.diagnostics <verification/tutorial_reentrant_channel/input/data.diagnostics>`
0854 or you will get (non-fatal) warning messages in ``STDERR``.
0855
0856 In :numref:`reentrant_channel_soln_eddy` we will present results with
0857 the resolution increased by an order of magnitude, eddy-permitting. Additional required changes to the code and parameters
0858 are discussed.
0859
0860 Model Solution
0861 --------------
0862
62748458e3 Jeff*0863 Our primary focus in this section is physical interpretation of the model solution,
0864 not how to generate plots from MITgcm output, and thus in parallel we strongly recommend carefully
0865 going through our `Python <https://www.python.org/>`_ analysis code, documented in
0866 `Jupyter Notebook <https://jupyter.org/>`_ format, see
0867 :filelink:`verification/tutorial_reentrant_channel/analysis/py_notebook.ipynb`.
0868 This notebook reads in grid data, discusses (and plots) the setup and forcing data
0869 files in additional detail, and generates figures shown in the tutorial.
0870 `MATLAB <https://www.mathworks.com/>`_ analysis code
0871 to generate tutorial output figures is available at
0872 :filelink:`verification/tutorial_reentrant_channel/analysis/matlab_plots.m`.
08815fc806 Jeff*0873
0874 .. _reentrant_channel_solution:
0875
0876 Coarse Resolution Solution
0877 ~~~~~~~~~~~~~~~~~~~~~~~~~~
0878
0879 Before examining the circulation and temperature structure of the solution, let's first assess
0880 whether the solution is approaching a quasi-equilibrium state after 30 years of integration.
0881 Typically, one might expect a solution given this setup to equilibrate over a timescale of
0882 a hundred years or more, given the depth of the domain and the prescribed weak vertical diffusivity.
0883 As in tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`,
0884 we will make use of the 'Diagnostic Per Level Statistics' to assess equilibrium; specifically,
0885 we will look at the change in surface (restoring) heat flux over time, as well as the potential temperature field.
0886 In this tutorial we use standard :ref:`native Fortan (binary) output <pkg_mdsio>` files (using :filelink:`pkg/mdsio`)
0887 rather than `netCDF <http://www.unidata.ucar.edu/software/netcdf>`_ output (as done in tutorial :ref:`Baroclinic Ocean Gyre <tutorial_baroclinic_gyre>`).
0888 Important note: when using :filelink:`pkg/mdsio`, the statistical diagnostics output is written in plain text,
0889 NOT binary format. An advantage is that this permits a simple unix ``cat`` or ``more`` command to display the file to the terminal window
62748458e3 Jeff*0890 as integration proceeds, i.e., for a quick check that results look reasonable. The disadvantage however
0891 is that some additional parsing is required (when using `MATLAB <https://www.mathworks.com/>`_)
0892 to generate some plots using these data. Making use of MITgcm shell script :filelink:`utils/scripts/extract_StD`,
08815fc806 Jeff*0893 in a terminal window (in the run directory) type
0894
0895 ::
62748458e3 Jeff*0896
08815fc806 Jeff*0897 % ../../../utils/scripts/extract_StD dynStDiag.0000000000.txt STATDIAGS dat
0898
0899 where ``dynStDiag.0000000000.txt`` is the name of our statistical diagnostics output file, ``STATDIAGS``
0900 is a name we chose for files generated by running the script, with extension ``dat``.
62748458e3 Jeff*0901 This shell script extracts data into the following (plain text) files:
08815fc806 Jeff*0902
0903 - STATDIAGS_head.dat - header file containing metadata
0904 - STATDIAGS_Iter.dat - list of iteration numbers for which statdiags dumped
0905 - STATDIAGS_THETA.dat - statdiags for field THETA (diagnostic field specified
0906 in :filelink:`input/data.diagnostics <verification/tutorial_reentrant_channel/input/data.diagnostics>`)
0907 - STATDIAGS_TRELAX.dat - statdiags for field TRELAX (diagnostic field specified
0908 in :filelink:`input/data.diagnostics <verification/tutorial_reentrant_channel/input/data.diagnostics>`)
0909
0910 The files ``STATDIAGS_Iter.dat`` and ``STATDIAGS_«DIAGNAME».dat`` are simple column(s) of data that can be loaded or
0911 read in as an array of numbers using any basic analysis tool. Here we will
0912 make use of another MITgcm utility, :filelink:`utils/matlab/Read_StD.m`,
0913 which uses `MATLAB <https://www.mathworks.com/>`_ to make life a bit more simple for reading in all statistical diagnostic data.
0914 In a `MATLAB <https://www.mathworks.com/>`_ session type
0915
0916 ::
0917
0918 >> [nIter,regList,time,stdiagout,listFlds,listK]=read_StD('STATDIAGS','dat','all_flds');
0919
0920 where
0921
0922 - nIter = number of iterations (i.e., time records) dumped
0923 - regList = list of region numbers (=0 here, as we did not define any regions, by default global output only)
0924 - time(:,1) = iteration numbers ; time(:,2) = time in simulation (seconds)
62748458e3 Jeff*0925 - listFlds = list of fields dumped
08815fc806 Jeff*0926 - listK = for each field, lists number of k levels dumped
62748458e3 Jeff*0927 - stdiagout = 5 dimensional output array
08815fc806 Jeff*0928 ( kLev, time_rec, region_rec, [ave,std,min,max,vol], fld_rec )
0929 where kLev=1 is depth-average, kLev=2:50 is for depths :varlink:`rC`\ (1:49)
0930
62748458e3 Jeff*0931 A function to parse statistical diagnostics MITgcm output is also available in the python package :ref:`MITgcmutils`.
0932 Executing the python command
0933
0934 ::
0935
0936 stdiags_bylev,stdiags_2D,iters = readstats('dynStDiag.0000000000.txt')
0937
0938 will load up the level-by-level statistical diagnostics into ``stdiags_bylev`` (e.g., ``stdiags_bylev['THETA'][:,0,0]``
0939 is the time series for top level average temperature),
0940 ``stdiags_2D`` given column-integrated or 2-D fields (e.g., ``stdiags_2D['TRELAX'][:,0]`` is the time series for surface heat flux),
0941 and ``iters`` is iteration number for the time series (e.g. ``iters['TRELAX']`` is a series of iteration numbers for the ``THETA`` diagnostic,
0942 the user is left to convert into time units). See the :ref:`MITgcmutils` documention for more information.
0943
08815fc806 Jeff*0944 On the left side of :numref:`channel_soln_stdiags` we show time series of global surface heat flux.
0945 In the first decade there is rapid adjustment, with a much slower trend in both mean and standard deviation
0946 in years 10-30. In the mean there remains a significant heat flux into the ocean in the run without GM (solid),
0947 whereas with GM (dashed) the net heat uptake is also positive, but smaller. The panels
0948 on the right show potential temperature at the surface, mid-level (270 m) and at depth. Note in particular the warming trend at depth
0949 in the run without GM. The SST series display a much less obvious trend (as might be expected given rapid restoring of SST).
0950 Examining these results, we see that after 30 years our run
0951 is not at full equilibrium, presumably due to the long timescale for vertical diffusion.
0952 And, we infer that less surface heating is penetrating to depth in the GM solution. This difference
0953 is also obvious in :numref:`channel_zm_temp_ml` where we plot zonal mean temperature: note the deeper thermocline in the left panel
0954 (without GM), in addition to the deeper mixed layer (and warmer surface) in the southern half of the model domain. The differences
0955 in convective adjustment are remarkable, as shown in :numref:`convadj_comparison`; here we plot a plan view of diagnostic
0956 ``CONVADJ``, which is the fraction of the time steps a grid cell is convectively unstable, at 92 m depth.
0957 Note that at this depth, convection is limited to grid cells near the southern boundary in the GM run, whereas a significant portion of the domain
0958 is convecting in the non-GM run: as discussed in Gent (2011) :cite:`gent:11`, the Deacon cell advects cold water northward
0959 at the surface, resulting in unstable water columns and excessively deep mixed layers. Clearly, the
0960 temperature structure of the model solution is sensitive to our mesoscale eddy parameterization (we will explore this further).
0961
0962 .. figure:: figs/STDIAGS_hf_temp.png
0963 :width: 100%
0964 :align: center
0965 :alt: HF and temperature Stat Diags
0966 :name: channel_soln_stdiags
0967
62748458e3 Jeff*0968 Left: time series of area-integrated heat flux into the surface ocean (blue) and its standard deviation (magenta).
08815fc806 Jeff*0969 Right: area-mean temperature at the surface (top, cyan), in the thermocline (middle, green), and at depth (bottom, red).
0970 In all panels, solid curves show non-GM run, dashed curves include GM.
0971
0972 .. figure:: figs/zonaltemp.png
0973 :width: 100%
0974 :align: center
0975 :alt: zonal mean temp and ML depth
0976 :name: channel_zm_temp_ml
0977
0978 Zonal-mean temperature (shaded) and zonal-mean mixed layer depth (black line) averaged over simulation year 30.
0979 Left plot is from non-GM run, right using GM.
0980
0981 .. figure:: figs/cvctadj.png
0982 :width: 100%
0983 :align: center
0984 :alt: convective adjustment index
0985 :name: convadj_comparison
0986
0987 Convective adjustment index: 0= never convectively unstable during year 30, 1= always convectively unstable.
0988 Left plot is from non-GM run, right using GM.
0989
0990 :numref:`channel_bt_psi` shows the barotropic streamfunction without GM (left) and with GM (right).
0991 The pattern is quite similar in both simulations,
0992 characterized by a jet centered in the latitude bands with the deep notch, with some deflection
0993 to the south after the jet squeezes through the notch. There is a balance between
0994 negative relative vorticity, as the jet curves northward through the notch and then southward again,
0995 and increasing :math:`f` to the north (from the beta-plane) such
0996 that barotropic potential vorticity is conserved. North of the notch, we see in :numref:`channel_zm_temp_ml`
0997 the ocean is much more stratified, with dynamics presumably more baroclinic.
0998
0999 .. figure:: figs/BTpsi.png
1000 :width: 100%
1001 :align: center
1002 :alt: BT streamfunction
1003 :name: channel_bt_psi
1004
1005 Barotropic streamfunction averaged over over simulation year 30. Left plot is from non-GM run, right using GM. Contour interval is 20 Sv.
1006
1007 :numref:`channel_MOC_eul` shows the Eulerian meridional overturning circulation for the non-GM run (left) and GM run (right).
1008 Again, they appear quite similar; what we are observing here is known as a "Deacon Cell" (Deacon 1937 :cite:`deacon:37`; Bryan 1991 :cite:`bryan:91`) forced by surface Ekman transport to the north
1009 (see also Döös and Webb 1994 :cite:`doos:94`, Speer et al. 2000 :cite:`speer:00`), with downwelling in the northern half of the basin and upwelling in the south. The magnitude of this cell,
1010 on the order of 1-2 Sverdrups, may not seem very impressive, but it is important to consider our zonal domain spans only about 1/20th of the
1011 60th parallel south; scaled up, the magnitude of this cell is quite large. Some local recirculation occurs in the latitude bands where the ridge slopes
1012 down to the center of the deep notch.
1013 The centers of these recirculations occur in the bottom 2000 m, where stratification is quite weak, so much of water recirculated here falls within a very narrow density class.
1014 The deep ridge effectively creates east-west sidewalls at depth, thus able to support an overturning in thermal wind balance, whereas no sidewalls exist in
1015 the upper portion of the water column. There is little overturning associated with the deep jet flowing through the flat bottom of the notch.
1016
1017 Also worth noting is that we see some evidence of noise (jaggedy contours) in :numref:`channel_MOC_eul`, despite our rather
1018 large choice of :math:`A_{h}`\ =2000 m\ :sup:`2` s\ :sup:`--1` for (uniform) horizontal viscosity and our higher-order advective scheme. These noise
1019 artifacts increase fairly dramatically for smaller choices of :math:`A_{h}`, although we tested the solution remains stable for :math:`A_{h}` decreased by an order of magnitude.
1020
1021 .. figure:: figs/MOC_EUL.png
1022 :width: 100%
1023 :align: center
1024 :alt: Eulerian MOC
1025 :name: channel_MOC_eul
1026
1027 Eulerian meridional overturning circulation (shaded) averaged over simulation year 30. Left plot is from non-GM run, right using GM. Contour interval is 0.5 Sv.
1028
1029 When using :filelink:`pkg/gmredi`, it is often desirable to diagnose an eddy bolus velocity,
1030 or a bolus transport, in order to compute the *residual circulation* (Ferrari 2003 :cite:`ferrari:03`),
1031 the Lagrangian transport in the ocean (i.e., which effects tracer transport; see, for example, Wolfe 2014 :cite:`wolfe:14`).
1032 Unfortunately the bolus velocity is not directly available from MITgcm,
1033 but must be computed from other GM diagnostics, which differ if the :ref:`skew flux <sub_gmredi_skewflux>`
1034 or :ref:`bolus/advective <GM_bolus_desc>` form of GM is selected.
1035 Here we choose the later form in :filelink:`data.gmredi <verification/tutorial_reentrant_channel/input.GM/data.gmredi>` (``GM_AdvForm =.TRUE.``),
1036 for which a bolus streamfunction diagnostic is available, thus the bolus velocity can be readily computed
1037 (see :filelink:`matlab_plots.m <verification/tutorial_reentrant_channel/analysis/matlab_plots.m>`;
1038 obtaining the bolus velocity, for reasons of gridding,
1039 is a bit more straightforward using the advective form). In :numref:`channel_MOC_EULpBOL` we've computed and added the
1040 bolus velocity to the Eulerian velocity. We see that the upper meridional overturning cell has weakened
1041 in magnitude, particularly in the northern half of the domain. The eddy parameterization will attempt to flatten sloping isopycnals
1042 seen in :numref:`channel_zm_temp_ml`, creating a bolus overturning circulation in the opposite
1043 sense to the Deacon Cell. The magnitude of the GM thickness diffusion effectively
1044 controls the strength of the eddy transport; here we observed only partial cancellation of the Deacon Cell
1045 shown in :numref:`channel_MOC_eul`. In global ocean general circulation models, an observation of near-cancellation
1046 in the Southern Ocean Deacon Cell when the GM parameterization was used
1047 was first reported in Danabasoglu et al. (1994) :cite:`danabasoglu:94`.
1048
1049 .. figure:: figs/MOC_EULpBOL.png
1050 :width: 50%
1051 :align: center
1052 :alt: Residual MOC in depth space
1053 :name: channel_MOC_EULpBOL
1054
1055 Meridional overturning circulation (shaded) from GM simulation including bolus advective transport, averaged over simulation year 30. Contour interval is 0.5 Sv.
1056
1057 Now let's use :filelink:`pkg/layers` output to examine the residual meridional overturning circulation, shown in :numref:`channel_bt_MOC_res_T`.
1058 We integrate the time- and zonal-mean transport in
62748458e3 Jeff*1059 isopycnal layers (see :numref:`layers_trans_schematic`) to obtain a streamfunction in density coordinates.
08815fc806 Jeff*1060 See Abernathy et al. (2011) :cite:`abernathy:11` for a more detailed explanation of this calculation;
1061 this approach is the tried-and-true method to diagnose the residual circulation in an eddy-permitting regime,
1062 as required when we run this setup at higher resolution (:numref:`reentrant_channel_soln_eddy`).
1063 Note that :filelink:`pkg/layers` automatically includes bolus transport from :filelink:`pkg/gmredi` in its
1064 calculations, assuming GM is used.
1065 With temperature as the ordinate in :numref:`channel_bt_MOC_res_T`, vertical flows reflect diabatic processes. The green dashed lines represent the maximum and minimum
1066 SST for a given latitude band, thus representing upper layer circulation within this band. On the left side, without GM, we again see a robust Deacon cell,
1067 with a strong diabatic component, presumably due to horizontal diffusion occurring across sloping isopycnals (i.e. the so-called "Veronis effect", see
1068 Veronis (1975) :cite:`veronis:75` as well as other numerous papers prior to the wide-spread adoption of the GM parameterization in ocean models). [As an aside, it is for lack of a better name
1069 that we label this left plot of :numref:`channel_bt_MOC_res_T`, lacking either eddies or GM, as the residual circulation,
1070 as indeed it is identical to the Eulerian circulation in density coordinates].
1071 On the right side, with GM, the Deacon cell is much weaker due to partial cancellation from the bolus circulation, as noted earlier, but also note
1072 that interior contours of streamfunction run roughly horizontal in the plot. We see some evidence of a deep cell in the lowest temperature classes, less obvious in the
1073 Eulerian MOC :numref:`channel_MOC_eul`. One might ask: what happened to the deep recirculating cells seen in :numref:`channel_MOC_EULpBOL`?
1074 Recall that our discretization of temperature layers is fairly
1075 crude, 0.25 K in the coldest temperatures, and presumably much of this recirculation is "lost" as recirculation within a single density class. If this deep circulation were of interest,
1076 one could simply re-run the model with finer resolution at depth (perhaps increasing the number of layers used,
1077 which requires changing :filelink:`LAYERS_SIZE.h <verification/tutorial_reentrant_channel/code/LAYERS_SIZE.h>` and recompiling).
1078
1079 .. figure:: figs/MOC_RES.png
1080 :width: 100%
1081 :align: center
1082 :alt: Residual MOC in temperature space
1083 :name: channel_bt_MOC_res_T
1084
1085 Residual meridional overturning circulation (shaded) as computed in density (i.e., temperature) coordinates, averaged over simulation year 30. Contour interval is 0.5 Sv.
62748458e3 Jeff*1086 Green dashed curves show maximum and minimum SST in each latitude band. Left plot is from non-GM run, right using GM.
08815fc806 Jeff*1087
1088 Finally, let's convert the residual circulatiom shown in :numref:`channel_bt_MOC_res_T` back into depth coordinates, see :numref:`channel_bt_MOC_res_Ttoz`.
1089 Solid lines now display contours of zonal mean temperature. On the left, consistent with previous analyses, we see a small, upper ocean counter-clockwise
1090 circulation in the southern sector, where deep mixed layers occur (:numref:`channel_zm_temp_ml`), with the dominant feature again
1091 being the (clockwise) Deacon cell. In contrast, using GM, we see a weak residual clockwise cell aligned along temperature surfaces in the thermocline, with a weak
1092 deep counter-clockwise cell aligned with the coldest temperature contour (i.e., the deep cell seen in :numref:`channel_bt_MOC_res_T`).
1093
1094 .. figure:: figs/MOC_RES_Z.png
1095 :width: 100%
1096 :align: center
1097 :alt: Residual MOC from layers converted to depth space
1098 :name: channel_bt_MOC_res_Ttoz
1099
1100 Residual meridional overturning circulation (shaded) as computed in density coordinates and
1101 converted back into (zonal mean) depth coordinates, averaged over simulation year 30.
1102 Black lines show zonal mean temperature, contour interval 1 :sup:`o`\C. Left plot is from non-GM run, right using GM.
1103
1104 .. _reentrant_channel_soln_eddy:
1105
1106 Eddy Permitting Solution
1107 ~~~~~~~~~~~~~~~~~~~~~~~~
1108
1109 .. raw:: html
1110
1111 <iframe width="700" height="350" src="https://www.youtube.com/embed/gO3fvRJ3FUE?rel=0&vq=hd720&autoplay=1&loop=1&playlist=gO3fvRJ3FUE"
1112 frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
1113
1114 .. only:: latex
1115
1116 .. image:: figs/eddymovie_still.png
1117
1118 In this section we discuss a model solution with the horizontal grid space reduced from 50 km to 5 km, which is sufficiently resolved to
1119 permit eddies to form (see above, which shows SST, surface relative vorticity, and surface current speed,
1120 left to right, toward the end of the 30-year simulation).
1121 Vertical resolution is unchanged.
1122 While we provide instructions on how to compile and run in this new configuration,
1123 it will require parallelizing (using `MPI <https://en.wikipedia.org/wiki/Message_Passing_Interface>`_)
1124 on at least a hundred processor cores or else a 30-year integration will take on the order of a month or longer
1125 -- in other words, this requires a large cluster or high-performance computing (HPC) facility to run efficiently.
1126
62748458e3 Jeff*1127 Running with higher resolution requires re-compiling the code after changing the tile size and number of processors, see
08815fc806 Jeff*1128 :filelink:`code/SIZE.h_eddy <verification/tutorial_reentrant_channel/code/SIZE.h_eddy>` (as configured here, for 100 processors;
1129 for faster results change the tile size and use 200 or even 400 processors).
1130 Note we will NOT enable :filelink:`pkg/gmredi` in our eddy run, so it can be eliminated from the list in
1131 :filelink:`packages.conf <verification/tutorial_reentrant_channe/code/packages.conf>` [#]_
1132 (make sure to set :varlink:`useGMRedi`\ ``=.FALSE.`` in :filelink:`data.pkg <verification/tutorial_reentrant_channel/input/data.pkg>`).
1133
1134 In conjunction with the change
1135 in :filelink:`code/SIZE.h_eddy <verification/tutorial_reentrant_channel/code/SIZE.h_eddy>`,
1136 uncomment these lines in ``PARM04`` in :filelink:`data <verification/tutorial_reentrant_channel/input/data>`:
1137
1138 ::
1139
1140 delX=200*5.E3,
1141 delY=400*5.E3,
1142
1143 to specify 5 km resolution in 200 :math:`\times` 400 grid cells in :math:`x` and :math:`y`.
1144 New files for bathymetry, forcing fields, and initial temperature
1145 can be generated using the `MATLAB <https://www.mathworks.com/>`_ program
1146 :filelink:`verification/tutorial_reentrant_channel/input/gendata_5km.m`
62748458e3 Jeff*1147 or `Python <https://www.python.org/>`_ script :filelink:`verification/tutorial_reentrant_channel/input/gendata.5km.py`
08815fc806 Jeff*1148 (don't forget to change the filenames in :filelink:`data.rbcs <verification/tutorial_reentrant_channel/input/data.rbcs>`
1149 and ``PARM05`` in :filelink:`data <verification/tutorial_reentrant_channel/input/data>`).
1150
1151 Running at higher resolution requires a smaller time step for stability. Revisiting :numref:`sec_tutSOch_num_stab`, to maintain advective stability
1152 (CFL condition, :eq:`eq_SOch_cfl_stability`) one could simply decrease the time step by the same factor of 10 decrease as :math:`\Delta x` -- stability
1153 of inertial oscillations is no longer a limiting factor, given a smaller :math:`\Delta t` in :eq:`eq_SOCh_inertial_stability` --
1154 but to speed things up we'd like to keep :math:`\Delta t` as large as possible. With a rich eddying solution, however, is it clear that horizontal velocity
0bad585a21 Navi*1155 will remain order ~1 ms\ :sup:`--1`? As a compromise, we suggest setting parameter :varlink:`DeltaT`\ ``=250.`` (seconds) in
08815fc806 Jeff*1156 :filelink:`data <verification/tutorial_reentrant_channel/input/data>`, which we found to be stable. For this choice, a 30-year integration
62748458e3 Jeff*1157 requires setting :varlink:`nTimeSteps`\ ``=3732480``.
08815fc806 Jeff*1158
1159 While it would be possible to decrease (spatially uniform) harmonic viscosity to
1160 a more appropriate value for this resolution, or perhaps use bi-harmonic viscosity
1161 (see :numref:`fluxform_lat_dissip`), we will make use of one of the nonlinear viscosity schemes described in :numref:`nonlinear_vis_schemes`, geared
1162 toward large eddy simulations, where viscosity is a function of the resolved motion. Here, we employ
1163 the :ref:`Leith viscosity <leith_viscosity>` (Leith 1968, Leith 1996 :cite:`leith:68` :cite:`leith:96`).
1164 Set the following parameters in ``PARM01`` of :filelink:`data <verification/tutorial_reentrant_channel/input/data>`:
1165
1166 ::
1167
1168 viscC2Leith = 1.,
1169 useFullLeith=.TRUE.,
1170 viscAhGridMax = 0.5,
1171
1172 (and comment out the line :varlink:`viscAh` ``=2000.`` ).
1173 :varlink:`viscC2Leith` is a scaling coefficient which we set to 1.0, :varlink:`useFullLeith` ``=.TRUE.`` uses unapproximated gradients in
1174 the Leith formulation (see :numref:`leith_viscosity`). Parameter :varlink:`viscAhGridMax` places a maximum limit on the Leith viscosity so that
1175 the CFL condition is obeyed (see :numref:`CFL_constraint_visc` and :eq:`eq_SOch__laplacian_stability` in discussion of :ref:`sec_tutSOch_num_stab`).
1176 The values of :varlink:`viscAh` that the Leith scheme generates in this solution generally range
1177 from order 1 m\ :sup:`2` s\ :sup:`--1` in regions of weak flow
1178 to over 100 m\ :sup:`2` s\ :sup:`--1` in jets. Note that while it would have been possible to
1179 use the Leith scheme in the 50 km resolution setup, the scheme was
1180 not really designed to be used at such a large :math:`\Delta x`, and the :math:`A_{h}` it generates
1181 about an order of magnitude below the constant :math:`A_{h} = 2000` m\ :sup:`2` s\ :sup:`--1` employed
1182 in the coarse model runs, resulting in a very noisy solution.
1183
1184 Finally, we suggest adding the parameter :varlink:`useSingleCpuIO` ``=.TRUE.`` in ``PARM01``
1185 of :filelink:`data <verification/tutorial_reentrant_channel/input/data>`.
1186 This will produce global output files generated by the master `MPI <https://en.wikipedia.org/wiki/Message_Passing_Interface>`_ processor,
1187 rather than a copious amount of single-tile files (each processor dumping output for its specific sub-domain).
1188
1189 To compare the eddying solution with the coarse-resolution simulations, we need to take a fairly long
1190 time average; even in annual means there is noticeably variability in
1191 the solution. :numref:`channel_zm_temp_MOC_eddy` through :numref:`channel_MOC_eddy_layers` plot similar
1192 figures as :numref:`channel_zm_temp_ml`-:numref:`channel_bt_MOC_res_Ttoz`,
1193 showing a time mean over the last five years of the simulation.
1194
1195 .. figure:: figs/MOC_EUL_ztemp_eddy.png
1196 :width: 100%
1197 :align: center
1198 :alt: zonal mean temp and ML depth eddying, EUL MOC
1199 :name: channel_zm_temp_MOC_eddy
1200
1201 Left: Zonal-mean temperature (shaded) and zonal-mean mixed layer depth (black line) from eddying simulation averaged over years 26-30.
1202 Right: Eulerian meridional overturning circulation (shaded) from eddying simulation averaged over years 26-30. Contour interval is 0.5 Sv.
1203
1204 .. figure:: figs/BTpsi_eddy.png
1205 :width: 55%
1206 :align: center
1207 :alt: BT streamfunction
1208 :name: channel_bt_psi_eddy
1209
1210 Barotropic streamfunction from eddying simulation averaged over years 26-30. Contour interval is 20 Sv.
1211
1212 .. figure:: figs/MOC_RES_EDDY.png
1213 :width: 100%
1214 :align: center
1215 :alt: Eddying MOC using Layers
1216 :name: channel_MOC_eddy_layers
1217
1218 Left: Residual meridional overturning circulation (shaded) as computed in density (i.e., temperature) coordinates,
62748458e3 Jeff*1219 from eddying simulation averaged over years 26-30. Contour interval is 0.5 Sv. Green dashed curve shows maximum and minimum (instantaneous) SST in each latitude band.
08815fc806 Jeff*1220 Right: Residual meridional overturning circulation (shaded) as computed in density coordinates and converted back into depth coordinates, from eddying simulation averaged over years 26-30.
62748458e3 Jeff*1221 Black lines show zonal mean temperature, contour interval 1 :sup:`o`\C.
08815fc806 Jeff*1222
1223 In general, our coarse resolution solutions are not a bad likeness of the (time mean)
1224 eddying solution, particularly when we use :filelink:`pkg/gmredi`
1225 to parameterize mesoscale eddies. More detailed comments comparing these solutions are as follows:
1226
1227 - The superiority of the GM solution is clear in the plot of zonal mean temperature
1228 (:numref:`channel_zm_temp_MOC_eddy` left panel vs. :numref:`channel_zm_temp_ml`)
1229 and the residual overturning circulation (:numref:`channel_MOC_eddy_layers` vs. :numref:`channel_bt_MOC_res_T` and :numref:`channel_bt_MOC_res_Ttoz`).
1230 Differences among the Eulerian MOC plots (:numref:`channel_zm_temp_MOC_eddy` right panel
1231 vs. :numref:`channel_MOC_eul`) are less obvious, but note that in the more stratified
1232 northern section of the domain, the eddying MOC looks more like the coarse "Eulerian + Bolus" GM solution (:numref:`channel_MOC_EULpBOL`).
1233 However, these two fields are not expected to be equal, since the eddying MOC calculated by layers also includes a stationary eddy component
1234 (Viebahn and Eden 2012 :cite:`viebahn:12`; Dufour et al. 2012 :cite:`dufour:12`).
1235
1236 - A large anticyclonic barotropic vortex is present away from the topographic ridge as shown in a plot
1237 of the barotropic streamfunction (:numref:`channel_bt_psi_eddy`; recall, our domain is
1238 located in the Southern Hemisphere, so anticyclonic is counter-clockwise). As such, the flow passing through the deep notch is somewhat
1239 less than obtained in the coarse solution (:numref:`channel_bt_psi`). Yet, similar
1240 constraints on barotropic potential vorticity conservation lead to a similar overall pattern.
1241
1242 - Examining the residual circulation generated from :filelink:`pkg/layers` diagnostics (see :numref:`channel_MOC_eddy_layers`
1243 vs. :numref:`channel_bt_MOC_res_T`, :numref:`channel_bt_MOC_res_Ttoz`),
1244 the non-GM solution seems quite poor, which would certainly have implications on tracer transport had any additional tracers been
1245 included in the simulation. In the GM solution, eddies seem to only partially
1246 cancel the cell forced by northward Ekman transport (Deacon Cell). In the eddying solution, the residual circulation
1247 is oriented in the opposite sense: eddy fluxes resulting from baroclinic instability due to
1248 the northern sponge layer (stratification) overwhelms the Deacon Cell.
1249 This would seem to suggest than our parameterization of eddies by GM, or more specifically,
1250 our choice for parameter :varlink:`GM_background_K` of 1000 m\ :sup:`2` s\ :sup:`--1`, may be too low, at least for this idealized setup!
1251 Parameterizing eddies in the Southern Ocean is a topical research question, but some studies suggest
1252 this value of GM thickness diffusivity may indeed be low for values in the Southern Ocean
1253 (e.g., Ferriera et al. 2005 :cite:`ferriera:05`). A weak residual deep cell, oriented with rising flow along the sponge layer, is also present.
1254 Note that the area enclosed by the dashed green lines in :numref:`channel_MOC_eddy_layers`
1255 is quite large, due to episodic large deviations in SST associated with eddies.
1256
1257 - As might be suggested by the orientation of the residual MOC, in the eddying solution temperature relaxation
1258 in the sponge layer is associated with heat gain in the thermocline.
1259 In the coarse runs, however, the sponge layer is effectively cooling, particularly in the non-GM run.
1260 Although at present there is no diagnostic available in :filelink:`pkg/rbcs` which directly tabulates these fluxes,
1261 computing them is quite simple: the heat flux (in watts) into a grid cell in the sponge layer is computed as
0bad585a21 Navi*1262 :math:`\rho \text{C}_p {\cal V}_\theta * \frac{\theta (i,j,k) - \theta_{\rm rbc} (i,j,k)}{\tau_T} * M_{\rm rbc}`
1263 where :math:`\text{C}_p` is :varlink:`HeatCapacity_Cp` (3994.0 J kg\ :sup:`--1` K\ :sup:`--1` by default), :math:`{\cal V}_\theta` is the grid cell volume
08815fc806 Jeff*1264 (:varlink:`rA`\ (i,j) * :varlink:`drF`\ (k) * :varlink:`hFacC`\ (i,j,k);
1265 see :numref:`reentrant_channel_bathy_file` for definition of :varlink:`hFacC`),
1266 :math:`\theta (i,j,k)` is gridpoint potential temperature (:sup:`o`\ C),
0bad585a21 Navi*1267 :math:`\theta (i,j,k)_{\rm rbc}` is gridpoint relaxation potential temperature (:sup:`o`\ C,
08815fc806 Jeff*1268 as prescribed in file ``input/temperature.5km.bin`` or ``input/temperature.50km.bin``),
1269 :math:`\tau_T` is the restoring timescale :varlink:`tauRelaxT` (as set in :ref:`data.rbcs <tut_so_channel_rbcs>` to 864,000 seconds or 10 days),
0bad585a21 Navi*1270 and :math:`M_{\rm rbc}` is a 3-D restoring mask (values between 0.0 and 1.0 as discussed
08815fc806 Jeff*1271 :ref:`above <reentrant_channel_ rbcsmaskfile>`) as specified in file ``T_relax_mask.5km.bin`` or ``T_relax_mask.50km.bin``.
1272
1273 .. [#] Note it is not stricly necessary to remove :filelink:`pkg/gmredi` from your high-resolution build -- however, if kept in the list of packages included in
1274 :filelink:`packages.conf <verification/tutorial_reentrant_channe/code/packages.conf>`, it then becomes necessary to deactivate
1275 in :filelink:`data.pkg <verification/tutorial_reentrant_channel/input/data.pkg>` for this run by setting
1276 :varlink:`useGMRedi`\ ``=.FALSE.``. If by chance you set a use«PKG» flag to ``.TRUE.`` in :filelink:`data.pkg <verification/tutorial_reentrant_channel/input/data.pkg>`
1277 but have not included the package in the build, the model will terminate with error on startup. But you can alway set a use«PKG» flag to ``.FALSE.`` whether or not the package
1278 is included in the build.