MOM_hor_visc module reference

Calculates horizontal viscosity and viscous stresses

Data Types

hor_visc_CS

Control structure for horizontal viscosity

Functions/Subroutines

horizontal_viscosity

Calculates the acceleration due to the horizontal viscosity.

horizontal_viscosity_block

Calculates the acceleration due to the horizontal viscosity using an explicit k-block size.

hor_visc_Leith_grad

Calculates the magnitude of the vorticity and divergence gradients, and the Laplacian of vorticity, that are used within horizontal_viscosity by the Leith, modified Leith, Leith+E, and QG Leith viscosity schemes. The caller must only invoke this routine when CS%Leith_Kh, CS%Leith_Ah, or CS%use_Leithy is true.

hor_visc_backscatter_h

Adds the MEKE-based (EY24_EBT_BS) backscatter contribution to the diagonal term of the stress tensor at h-points. The caller must only invoke this routine when CS%EY24_EBT_BS is true.

hor_visc_backscatter_q

Adds the MEKE-based (EY24_EBT_BS) backscatter contribution to the cross term of the stress tensor at q-points. The caller must only invoke this routine when CS%EY24_EBT_BS is true.

hor_visc_Leithy_Ah

Computes the Leith+E antisymmetric-viscosity ratio m_leithy, and updates the biharmonic viscosity Ah (and Ah_h) to include the Leith+E contribution, optionally smoothing m_leithy and Ah in the process. The caller must only invoke this routine when CS%use_Leithy is true.

hor_visc_GME_setup

Calculates the barotropic tension and shearing strain fields and the GME efficiency and isopycnal height diffusivity fields that are used within horizontal_viscosity when GME (CS%use_GME) is active. The caller must only invoke this routine when CS%use_GME is true.

hor_visc_init

Allocates space for and calculates static variables used by horizontal_viscosity. hor_visc_init calculates and stores the values of a number of metric functions that are used in horizontal_viscosity.

leithy_taper_function

leithy_taper_function returns 1 if zc is shallower than leithy_depth; 0 if deeper than leithy_depth+leithy_width; and an interpolating cubic spline in between.

hor_visc_vel_stencil

hor_visc_vel_stencil returns the horizontal viscosity input velocity stencil size

align_aniso_tensor_to_grid

Calculates factors in the anisotropic orientation tensor to be align with the grid. With n1=1 and n2=0, this recovers the approach of Large et al, 2001.

smooth_GME

Apply a 1-1-4-1-1 Laplacian filter one time on GME diffusive flux to reduce any horizontal two-grid-point noise

sum_5x5

Apply a 5x5 weighted sum. In exact arithmetic this is the same as applying a 1:2:1 smoother twice in each direction. The implementation here uses fewer arithmetic operations, and is rotationally symmetric. To obtain the weighted average, divide the result by 256.

smooth_x9_h

Apply a 9-point smoothing filter twice to a field staggered at a thickness point to reduce horizontal two-grid-point noise. Implemented using a single 5x5 pass rather than 3x3 twice. Note that this subroutine does not conserve mass, so don't use it in situations where you need conservation. Also note that it assumes that the input field has valid values in the first two halo points upon entry.

smooth_x9_uv

Apply a 9-point smoothing filter twice to a pair of velocity components to reduce horizontal two-grid-point noise. Implemented using a single 5x5 pass rather than 3x3 twice. Note that this subroutine does not conserve angular momentum, so don't use it in situations where you need conservation. Also note that it assumes that the input fields have valid values in the first two halo points upon entry.

hor_visc_end

Deallocates any variables allocated in hor_visc_init.

Detailed Description

Horizontal viscosity in MOM

This module contains the subroutine horizontal_viscosity that calculates the effects of horizontal viscosity, including parameterizations of the value of the viscosity itself. Subroutine horizontal_viscosity calculates the acceleration due to some combination of a biharmonic viscosity and a Laplacian viscosity. Either or both may use a coefficient that depends on the shear and strain of the flow. All metric terms are retained. The Laplacian is calculated as the divergence of a stress tensor, using the form suggested by [78]. The biharmonic is calculated by twice applying the divergence of the stress tensor that is used to calculate the Laplacian, but without the dependence on thickness in the first pass. This form permits a variable viscosity, and indicates no acceleration for either resting fluid or solid body rotation.

The form of the viscous accelerations is discussed extensively in [33], and the implementation here follows that discussion closely. We use the notation of [79] with the exception that the isotropic viscosity is \(\kappa_h\).

In general, the horizontal stress tensor can be written as

\begin{equation*} {\bf \sigma} = \begin{pmatrix} \frac{1}{2} \left( \sigma_D + \sigma_T \right) & \frac{1}{2} \sigma_S \\ \frac{1}{2} \sigma_S & \frac{1}{2} \left( \sigma_D - \sigma_T \right) \end{pmatrix} \end{equation*}

where \(\sigma_D\), \(\sigma_T\) and \(\sigma_S\) are stresses associated with invariant factors in the strain-rate tensor. For a Newtonian fluid, the stress tensor is usually linearly related to the strain-rate tensor. The horizontal strain-rate tensor is

\begin{equation*} \dot{\bf e} = \begin{pmatrix} \frac{1}{2} \left( \dot{e}_D + \dot{e}_T \right) & \frac{1}{2} \dot{e}_S \\ \frac{1}{2} \dot{e}_S & \frac{1}{2} \left( \dot{e}_D - \dot{e}_T \right) \end{pmatrix} \end{equation*}

where \(\dot{e}_D = \partial_x u + \partial_y v\) is the horizontal divergence, \(\dot{e}_T = \partial_x u - \partial_y v\) is the horizontal tension, and \(\dot{e}_S = \partial_y u + \partial_x v\) is the horizontal shear strain.

The trace of the stress tensor, \(tr(\bf \sigma) = \sigma_D\), is usually absorbed into the pressure and only the deviatoric stress tensor considered. From here on, we drop \(\sigma_D\). The trace of the strain tensor, \(tr(\bf e) = \dot{e}_D\) is non-zero for horizontally divergent flow but only enters the stress tensor through \(\sigma_D\) and so we will drop \(\sigma_D\) from calculations of the strain tensor in the code. Therefore the horizontal stress tensor can be considered to be

\begin{equation*} {\bf \sigma} = \begin{pmatrix} \frac{1}{2} \sigma_T & \frac{1}{2} \sigma_S \\ \frac{1}{2} \sigma_S & - \frac{1}{2} \sigma_T \end{pmatrix} . \end{equation*}

The stresses above are linearly related to the strain through a viscosity coefficient, \(\kappa_h\):

\begin{equation*} \begin{aligned} \sigma_T &= 2 \kappa_h \dot{e}_T \\ \sigma_S &= 2 \kappa_h \dot{e}_S . \end{aligned} \end{equation*}

The viscosity \(\kappa_h\) may either be a constant or variable. For example, \(\kappa_h\) may vary with the shear, as proposed by [78].

The accelerations resulting form the divergence of the stress tensor are

\begin{equation*} \begin{aligned} \hat{\bf x} \cdot \left( \nabla \cdot {\bf \sigma} \right) &= \partial_x \left( \frac{1}{2} \sigma_T \right) + \partial_y \left( \frac{1}{2} \sigma_S \right) \\ &= \partial_x \left( \kappa_h \dot{e}_T \right) + \partial_y \left( \kappa_h \dot{e}_S \right) \\ \hat{\bf y} \cdot \left( \nabla \cdot {\bf \sigma} \right) &= \partial_x \left( \frac{1}{2} \sigma_S \right) + \partial_y \left( - \frac{1}{2} \sigma_T \right) \\ &= \partial_x \left( \kappa_h \dot{e}_S \right) + \partial_y \left( - \kappa_h \dot{e}_T \right) . \end{aligned} \end{equation*}

The form of the Laplacian viscosity in general coordinates is:

\begin{equation*} \begin{aligned} \hat{\bf x} \cdot \left( \nabla \cdot \sigma \right) &= \frac{1}{h} \left[ \partial_x \left( \kappa_h h \dot{e}_T \right) + \partial_y \left( \kappa_h h \dot{e}_S \right) \right] \\ \hat{\bf y} \cdot \left( \nabla \cdot \sigma \right) &= \frac{1}{h} \left[ \partial_x \left( \kappa_h h \dot{e}_S \right) - \partial_y \left( \kappa_h h \dot{e}_T \right) \right] . \end{aligned} \end{equation*}

Laplacian viscosity coefficient

The horizontal viscosity coefficient, \(\kappa_h\), can have multiple components. The isotropic components are:

  • A uniform background component, \(\kappa_{bg}\).

  • A constant but spatially variable 2D map, \(\kappa_{2d}(x,y)\).

  • A ''MICOM'' viscosity, \(U_\nu \Delta(x,y)\), which uses a constant velocity scale, \(U_\nu\) and a measure of the grid-spacing \(\Delta(x,y)^2 = \frac{2 \Delta x^2 \Delta y^2}{\Delta x^2 + \Delta y^2}\).

  • A function of latitude, \(\kappa_{\phi}(x,y) = \kappa_{\pi/2} |\sin(\phi)|^n\).

  • A dynamic Smagorinsky viscosity, \(\kappa_{Sm}(x,y,t) = C_{Sm} \Delta^2 \sqrt{\dot{e}_T^2 + \dot{e}_S^2}\).

  • A dynamic Leith viscosity, \(\kappa_{Lth}(x,y,t) = C_{Lth} \Delta^3 \sqrt{|\nabla \zeta|^2 + |\nabla \dot{e}_D|^2}\).

A maximum stable viscosity, \(\kappa_{max}(x,y)\) is calculated based on the grid-spacing and time-step and used to clip calculated viscosities.

The static components of \(\kappa_h\) are first combined as follows:

\begin{equation*} \kappa_{static} = \min \left[ \max\left( \kappa_{bg}, U_\nu \Delta(x,y), \kappa_{2d}(x,y), \kappa_\phi(x,y) \right) , \kappa_{max}(x,y) \right] \end{equation*}

and stored in the module control structure as variables Kh_bg_xx and Kh_bg_xy for the tension (h-points) and shear (q-points) components respectively.

The full viscosity includes the dynamic components as follows:

\begin{equation*} \kappa_h(x,y,t) = r(\Delta,L_d) \max \left( \kappa_{static}, \kappa_{Sm}, \kappa_{Lth} \right) \end{equation*}

where \(r(\Delta,L_d)\) is a resolution function.

The dynamic Smagorinsky and Leith viscosity schemes are exclusive with each other.

Viscous boundary conditions

Free slip boundary conditions have been coded, although no slip boundary conditions can be used with the Laplacian viscosity based on the 2D land-sea mask. For a western boundary, for example, the boundary conditions with the biharmonic operator would be written as:

\begin{equation*} \partial_x v = 0 ; \partial_x^3 v = 0 ; u = 0 ; \partial_x^2 u = 0 , \end{equation*}

while for a Laplacian operator, they are simply

\begin{equation*} \partial_x v = 0 ; u = 0 . \end{equation*}

These boundary conditions are largely dictated by the use of an Arakawa C-grid and by the varying layer thickness.

Anisotropic viscosity

[52] proposed enhancing viscosity in a particular direction and the approach was generalized in [79]. We use the second form of their two coefficient anisotropic viscosity (section 4.3). We also replace their \(A^\prime\) and $D$ such that \(2A^\prime = 2 \kappa_h + D\) and \(\kappa_a = D\) so that \(\kappa_h\) can be considered the isotropic viscosity and \(\kappa_a=D\) can be consider the anisotropic viscosity. The direction of anisotropy is defined by a unit vector \(\hat{\bf n}=(n_1,n_2)\).

The contributions to the stress tensor are

\begin{equation*} \begin{pmatrix} \sigma_T \\ \sigma_S \end{pmatrix} = \left[ \begin{pmatrix} 2 \kappa_h + \kappa_a & 0 \\ 0 & 2 \kappa_h \end{pmatrix} + 2 \kappa_a n_1 n_2 \begin{pmatrix} - 2 n_1 n_2 & n_1^2 - n_2^2 \\ n_1^2 - n_2^2 & 2 n_1 n_2 \end{pmatrix} \right] \begin{pmatrix} \dot{e}_T \\ \dot{e}_S \end{pmatrix} \end{equation*}

Dissipation of kinetic energy requires \(\kappa_h \geq 0\) and \(2 \kappa_h + \kappa_a \geq 0\). Note that when anisotropy is aligned with the x-direction, \(n_1 = \pm 1\), then \(n_2 = 0\) and the cross terms vanish. The accelerations in this aligned limit with constant coefficients become

\begin{equation*} \begin{aligned} \hat{\bf x} \cdot \nabla \cdot {\bf \sigma} &= \partial_x \left( \left( \kappa_h + \frac{1}{2} \kappa_a \right) \dot{e}_T \right) + \partial_y \left( \kappa_h \dot{e}_S \right) \\ &= \left( \kappa_h + \kappa_a \right) \partial_{xx} u + \kappa_h \partial_{yy} u - \frac{1}{2} \kappa_a \partial_x \left( \partial_x u + \partial_y v \right) \\ \hat{\bf y} \cdot \nabla \cdot {\bf \sigma} &= \partial_x \left( \kappa_h \dot{e}_S \right) - \partial_y \left( \left( \kappa_h + \frac{1}{2} \kappa_a \right) \dot{e}_T \right) \\ &= \kappa_h \partial_{xx} v + \left( \kappa_h + \kappa_a \right) \partial_{yy} v - \frac{1}{2} \kappa_a \partial_y \left( \partial_x u + \partial_y v \right) \end{aligned} \end{equation*}

which has contributions akin to a negative divergence damping (a divergence enhancement?) but which is weaker than the enhanced tension terms by half.

Discretization

The horizontal tension, \(\dot{e}_T\), is stored in variable sh_xx and discretized as

\begin{equation*} \dot{e}_T = \frac{\Delta y}{\Delta x} \delta_i \left( \frac{1}{\Delta y} u \right) - \frac{\Delta x}{\Delta y} \delta_j \left( \frac{1}{\Delta x} v \right) . \end{equation*}

The horizontal divergent strain, \(\dot{e}_D\), is stored in variable div_xx and discretized as

\begin{equation*} \dot{e}_D = \frac{1}{h A} \left( \delta_i \left( \overline{h}^i \Delta y \, u \right) + \delta_j \left( \overline{h}^j\Delta x \, v \right) \right) . \end{equation*}

Note that for expediency this is the exact discretization used in the continuity equation.

The horizontal shear strain, \(\dot{e}_S\), is stored in variable sh_xy and discretized as

\begin{equation*} \dot{e}_S = v_x + u_y \end{equation*}

where

\begin{equation*} \begin{aligned} v_x &= \frac{\Delta y}{\Delta x} \delta_i \left( \frac{1}{\Delta y} v \right) \\ u_y &= \frac{\Delta x}{\Delta y} \delta_j \left( \frac{1}{\Delta x} u \right) \end{aligned} \end{equation*}

which are calculated separately so that no-slip or free-slip boundary conditions can be applied to \(v_x\) and \(u_y\) where appropriate.

The tendency for the x-component of the divergence of stress is stored in variable diffu and discretized as

\begin{equation*} \hat{\bf x} \cdot \left( \nabla \cdot {\bf \sigma} \right) = \frac{1}{A \overline{h}^i} \left( \frac{1}{\Delta y} \delta_i \left( h \Delta y^2 \kappa_h \dot{e}_T \right) + \frac{1}{\Delta x} \delta_j \left( \tilde{h}^{ij} \Delta x^2 \kappa_h \dot{e}_S \right) \right) . \end{equation*}

The tendency for the y-component of the divergence of stress is stored in variable diffv and discretized as

\begin{equation*} \hat{\bf y} \cdot \left( \nabla \cdot {\bf \sigma} \right) = \frac{1}{A \overline{h}^j} \left( \frac{1}{\Delta y} \delta_i \left( \tilde{h}^{ij} \Delta y^2 A_M \dot{e}_S \right) - \frac{1}{\Delta x} \delta_j \left( h \Delta x^2 A_M \dot{e}_T \right) \right) . \end{equation*}

References

Griffies, S.M., and Hallberg, R.W., 2000: Biharmonic friction with a Smagorinsky-like viscosity for use in large-scale eddy-permitting ocean models. Monthly Weather Review, 128(8), 2935-2946. https://doi.org/10.1175/1520-0493(2000)128%3C2935:BFWASL%3E2.0.CO;2

Large, W.G., Danabasoglu, G., McWilliams, J.C., Gent, P.R. and Bryan, F.O., 2001: Equatorial circulation of a global ocean climate model with anisotropic horizontal viscosity. Journal of Physical Oceanography, 31(2), pp.518-536. https://doi.org/10.1175/1520-0485(2001)031%3C0518:ECOAGO%3E2.0.CO;2

Smagorinsky, J., 1993: Some historical remarks on the use of nonlinear viscosities. Large eddy simulation of complex engineering and geophysical flows, 1, 69-106.

Smith, R.D., and McWilliams, J.C., 2003: Anisotropic horizontal viscosity for ocean models. Ocean Modelling, 5(2), 129-156. https://doi.org/10.1016/S1463-5003(02)00016-1

Type Documentation

type, public :: hor_visc_CS

Control structure for horizontal viscosity

Parameters
  • initialized

    True if this control structure has been initialized.

  • Laplacian

    Use a Laplacian horizontal viscosity if true.

  • biharmonic

    Use a biharmonic horizontal viscosity if true.

  • debug

    If true, write verbose checksums for debugging purposes.

  • no_slip

    If true, no slip boundary conditions are used. Otherwise free slip boundary conditions are assumed. The implementation of the free slip boundary conditions on a C-grid is much cleaner than the no slip boundary conditions. The use of free slip b.c.s is strongly encouraged. The no slip b.c.s are not implemented with the biharmonic viscosity.

  • bound_Kh

    If true, the Laplacian coefficient is locally limited to guarantee stability.

  • EY24_EBT_BS

    If true, use an equivalent barotropic backscatter with a stabilizing kill switch in MEKE, developed by Yankovsky et al. 2024

  • bound_Ah

    If true, the biharmonic coefficient is locally limited to guarantee stability.

  • Re_Ah

    If nonzero, the biharmonic coefficient is scaled so that the biharmonic Reynolds number is equal to this [nondim].

  • bound_coef

    The nondimensional coefficient of the ratio of the viscosity bounds to the theoretical maximum for stability without considering other terms [nondim]. The default is 0.8.

  • KS_coef

    A nondimensional coefficient on the biharmonic viscosity that sets the kill switch for backscatter. Default is 1.0 [nondim].

  • KS_timescale

    A timescale for computing CFL limit for turning off backscatter [T ~> s].

  • backscatter_underbound

    If true, the bounds on the biharmonic viscosity are allowed to increase where the Laplacian viscosity is negative (due to backscatter parameterizations) beyond the largest timestep-dependent stable values of biharmonic viscosity when no Laplacian viscosity is applied. The default is true for historical reasons, but this option probably should not be used as it can lead to numerical instabilities.

  • Smagorinsky_Kh

    If true, use Smagorinsky nonlinear eddy viscosity. KH is the background value.

  • Smagorinsky_Ah

    If true, use a biharmonic form of Smagorinsky nonlinear eddy viscosity. AH is the background.

  • Leith_Kh

    If true, use 2D Leith nonlinear eddy viscosity. KH is the background value.

  • Modified_Leith

    If true, use extra component of Leith viscosity to damp divergent flow. To use, still set Leith_Kh=.TRUE.

  • use_beta_in_Leith

    If true, includes the beta term in the Leith viscosity

  • Leith_Ah

    If true, use a biharmonic form of 2D Leith nonlinear eddy viscosity. AH is the background.

  • use_Leithy

    If true, use a biharmonic form of 2D Leith nonlinear eddy viscosity with harmonic backscatter. Ah is the background. Leithy = Leith+E

  • c_K

    Fraction of energy dissipated by the biharmonic term that gets backscattered in the Leith+E scheme. [nondim]

  • smooth_Ah

    If true (default), then Ah and m_leithy are smoothed. This smoothing requires a lot of blocking communication.

  • taper_leithy

    If true, backscatter coeff is tapered to zero with depth

  • leithy_depth

    If tapering leith+E, taper is applied below this depth [Z ~> m]

  • leithy_width

    If tapering leith+E, backscatter is zero below leithy_depth+leithy_width [Z ~> m]

  • use_QG_Leith_visc

    If true, use QG Leith nonlinear eddy viscosity. KH is the background value.

  • bound_Coriolis

    If true & SMAGORINSKY_AH is used, the biharmonic viscosity is modified to include a term that scales quadratically with the velocity shears.

  • use_Kh_bg_2d

    Read 2d background viscosity from a file.

  • Kh_bg_2d_bug

    If true, retain an answer-changing horizontal indexing bug in setting the corner-point viscosities when USE_KH_BG_2D=True.

  • Kh_bg_min

    The minimum value allowed for Laplacian horizontal viscosity [L2 T-1 ~> m2 s-1]. The default is 0.0.

  • FrictWork_bug

    If true, retain an answer-changing bug in calculating FrictWork, which cancels the h in thickness flux and the h at velocity point.

  • OBC_strain_bug

    If true, recover a bug that specified shear strain option at open boundaries cannot be applied.

  • use_land_mask

    Use the land mask for the computation of thicknesses at velocity locations. This eliminates the dependence on arbitrary values over land or outside of the domain. Default is False to maintain answers with legacy experiments but should be changed to True for new experiments.

  • anisotropic

    If true, allow anisotropic component to the viscosity.

  • add_LES_viscosity

    If true, adds the viscosity from Smagorinsky and Leith to the background viscosity instead of taking the maximum.

  • Kh_aniso

    The anisotropic viscosity [L2 T-1 ~> m2 s-1].

  • dynamic_aniso

    If true, the anisotropic viscosity is recomputed as a function of state. This is set depending on ANISOTROPIC_MODE.

  • res_scale_MEKE

    If true, the viscosity contribution from MEKE is scaled by the resolution function.

  • use_GME

    If true, use GME backscatter scheme.

  • nkblock

    The k block size used in horizontal viscosity calculations

  • answer_date

    The vintage of the order of arithmetic and expressions in the horizontal viscosity calculations. Values below 20190101 recover the answers from the end of 2018, while higher values use updated and more robust forms of the same expressions.

  • GME_h0

    The strength of GME tapers quadratically to zero when the bathymetric total water column thickness is less than GME_H0 [H ~> m or kg m-2]

  • GME_efficiency

    The nondimensional prefactor multiplying the GME coefficient [nondim]

  • GME_limiter

    The absolute maximum value the GME coefficient is allowed to take [L2 T-1 ~> m2 s-1].

  • min_grid_Kh

    Minimum horizontal Laplacian viscosity used to limit the grid Reynolds number [L2 T-1 ~> m2 s-1]

  • min_grid_Ah

    Minimun horizontal biharmonic viscosity used to limit grid Reynolds number [L4 T-1 ~> m4 s-1]

  • use_cont_thick

    If true, thickness at velocity points adopts h[uv] in BT_cont from continuity solver.

  • use_cont_thick_bug

    If true, retain an answer-changing bug for thickness at velocity points.

  • ZB2020

    Zanna-Bolton 2020 control structure.

  • use_ZB2020

    If true, use Zanna-Bolton 2020 parameterization.

  • use_circulation

    If true, use circulation theorem to compute vorticity (for ZB20 or Leith)

  • Kh_bg_xx

    The background Laplacian viscosity at h points [L2 T-1 ~> m2 s-1]. The actual viscosity may be the larger of this viscosity and the Smagorinsky and Leith viscosities.

  • Kh_bg_2d

    The background Laplacian viscosity at h points [L2 T-1 ~> m2 s-1]. The actual viscosity may be the larger of this viscosity and the Smagorinsky and Leith viscosities.

  • Ah_bg_xx

    The background biharmonic viscosity at h points [L4 T-1 ~> m4 s-1]. The actual viscosity may be the larger of this viscosity and the Smagorinsky and Leith viscosities.

  • reduction_xx

    The amount by which stresses through h points are reduced due to partial barriers [nondim].

  • Kh_Max_xx

    The maximum permitted Laplacian viscosity [L2 T-1 ~> m2 s-1].

  • Ah_Max_xx

    The maximum permitted biharmonic viscosity [L4 T-1 ~> m4 s-1].

  • Ah_Max_xx_KS

    The maximum permitted biharmonic viscosity for the kill switch [L4 T-1 ~> m4 s-1].

  • n1n2_h

    Factor n1*n2 in the anisotropic direction tensor at h-points [nondim]

  • n1n1_m_n2n2_h

    Factor n1**2-n2**2 in the anisotropic direction tensor at h-points [nondim]

  • grid_sp_h2

    Harmonic mean of the squares of the grid [L2 ~> m2]

  • grid_sp_h3

    Harmonic mean of the squares of the grid^(3/2) [L3 ~> m3]

  • Kh_bg_xy

    The background Laplacian viscosity at q points [L2 T-1 ~> m2 s-1]. The actual viscosity may be the larger of this viscosity and the Smagorinsky and Leith viscosities.

  • Ah_bg_xy

    The background biharmonic viscosity at q points [L4 T-1 ~> m4 s-1]. The actual viscosity may be the larger of this viscosity and the Smagorinsky and Leith viscosities.

  • reduction_xy

    The amount by which stresses through q points are reduced due to partial barriers [nondim].

  • Kh_Max_xy

    The maximum permitted Laplacian viscosity [L2 T-1 ~> m2 s-1].

  • Ah_Max_xy

    The maximum permitted biharmonic viscosity [L4 T-1 ~> m4 s-1].

  • Ah_Max_xy_KS

    The maximum permitted biharmonic viscosity for the kill switch [L4 T-1 ~> m4 s-1].

  • n1n2_q

    Factor n1*n2 in the anisotropic direction tensor at q-points [nondim]

  • n1n1_m_n2n2_q

    Factor n1**2-n2**2 in the anisotropic direction tensor at q-points [nondim]

  • dx2h

    Pre-calculated dx^2 at h points [L2 ~> m2]

  • dy2h

    Pre-calculated dy^2 at h points [L2 ~> m2]

  • dx_dyT

    Pre-calculated dx/dy at h points [nondim]

  • dy_dxT

    Pre-calculated dy/dx at h points [nondim]

  • Iwts

    Pre-calculated 1./sum_5x5(G%mask2dT) [nondim]

  • Iwts_u

    1/sum_5x5(G%mask2Cu) [nondim]

  • Iwts_v

    1/sum_5x5(G%mask2Cv) [nondim]

  • m_const_leithy

    Pre-calculated .5*sqrt(c_K)*max{dx,dy} [L ~> m]

  • m_leithy_max

    Pre-calculated 4./max(dx,dy)^2 at h points [L-2 ~> m-2]

  • dx2q

    Pre-calculated dx^2 at q points [L2 ~> m2]

  • dy2q

    Pre-calculated dy^2 at q points [L2 ~> m2]

  • dx_dyBu

    Pre-calculated dx/dy at q points [nondim]

  • dy_dxBu

    Pre-calculated dy/dx at q points [nondim]

  • Idx2dyCu

    1/(dx^2 dy) at u points [L-3 ~> m-3]

  • Idxdy2u

    1/(dx dy^2) at u points [L-3 ~> m-3]

  • Idx2dyCv

    1/(dx^2 dy) at v points [L-3 ~> m-3]

  • Idxdy2v

    1/(dx dy^2) at v points [L-3 ~> m-3]

  • Laplac2_const_xx

    Laplacian metric-dependent constants [L2 ~> m2]

  • Biharm6_const_xx

    Biharmonic metric-dependent constants [L6 ~> m6]

  • Laplac3_const_xx

    Laplacian metric-dependent constants [L3 ~> m3]

  • Biharm_const_xx

    Biharmonic metric-dependent constants [L4 ~> m4]

  • Biharm_const2_xx

    Biharmonic metric-dependent constants [T L4 ~> s m4]

  • Re_Ah_const_xx

    Biharmonic metric-dependent constants [L3 ~> m3]

  • Laplac2_const_xy

    Laplacian metric-dependent constants [L2 ~> m2]

  • Biharm6_const_xy

    Biharmonic metric-dependent constants [L6 ~> m6]

  • Laplac3_const_xy

    Laplacian metric-dependent constants [L3 ~> m3]

  • Biharm_const_xy

    Biharmonic metric-dependent constants [L4 ~> m4]

  • Biharm_const2_xy

    Biharmonic metric-dependent constants [T L4 ~> s m4]

  • Re_Ah_const_xy

    Biharmonic metric-dependent constants [L3 ~> m3]

  • diag

    structure to regulate diagnostics

  • id_grid_Re_Ah

    Diagnostic id

  • id_grid_Re_Kh

    Diagnostic id

  • id_diffu

    Diagnostic id

  • id_diffv

    Diagnostic id

  • id_h_diffu

    Diagnostic id

  • id_h_diffv

    Diagnostic id

  • id_hf_diffu_2d

    Diagnostic id

  • id_hf_diffv_2d

    Diagnostic id

  • id_intz_diffu_2d

    Diagnostic id

  • id_intz_diffv_2d

    Diagnostic id

  • id_diffu_visc_rem

    Diagnostic id

  • id_diffv_visc_rem

    Diagnostic id

  • id_Ah_h

    Diagnostic id

  • id_Ah_q

    Diagnostic id

  • id_Kh_h

    Diagnostic id

  • id_Kh_q

    Diagnostic id

  • id_GME_coeff_h

    Diagnostic id

  • id_GME_coeff_q

    Diagnostic id

  • id_dudx_bt

    Diagnostic id

  • id_dvdy_bt

    Diagnostic id

  • id_dudy_bt

    Diagnostic id

  • id_dvdx_bt

    Diagnostic id

  • id_vort_xy_q

    Diagnostic id

  • id_div_xx_h

    Diagnostic id

  • id_sh_xy_q

    Diagnostic id

  • id_sh_xx_h

    Diagnostic id

  • id_FrictWork

    Diagnostic id

  • id_FrictWorkIntz

    Diagnostic id

  • id_FrictWork_bh

    Diagnostic id

  • id_FrictWorkIntz_bh

    Diagnostic id

  • id_FrictWork_GME

    Diagnostic id

  • id_normstress

    Diagnostic id

  • id_shearstress

    Diagnostic id

  • id_visc_limit_h

    Diagnostic id

  • id_visc_limit_q

    Diagnostic id

  • id_visc_limit_h_flag

    Diagnostic id

  • id_visc_limit_q_flag

    Diagnostic id

  • id_visc_limit_h_frac

    Diagnostic id

  • id_visc_limit_q_frac

    Diagnostic id

  • id_BS_coeff_h

    Diagnostic id

  • id_BS_coeff_q

    Diagnostic id

Functions/Subroutine Documentation

subroutine horizontal_viscosity(u, v, h, uh, vh, diffu, diffv, MEKE, VarMix, G, GV, US, CS, tv, dt, OBC, BT, TD, ADp, hu_cont, hv_cont, STOCH)

Calculates the acceleration due to the horizontal viscosity.

A combination of biharmonic and Laplacian forms can be used. The coefficient may either be a constant or a shear-dependent form. The biharmonic is determined by twice taking the divergence of an appropriately defined stress tensor. The Laplacian is determined by doing so once.

To work, the following fields must be set outside of the usual is:ie range before this subroutine is called: u(is-2:ie+2,js-2:je+2) v(is-2:ie+2,js-2:je+2) h(is-1:ie+1,js-1:je+1) or up to h(is-2:ie+2,js-2:je+2) with some Leith options.

Parameters
  • G [in]

    The ocean's grid structure

  • GV [in]

    The ocean's vertical grid structure

  • u [in]

    The zonal velocity [L T-1 ~> m s-1]

  • v [in]

    The meridional velocity [L T-1 ~> m s-1]

  • h [inout]

    Layer thicknesses [H ~> m or kg m-2]

  • uh [in]

    The zonal volume transport [H L2 T-1 ~> m3 s-1]

  • vh [in]

    The meridional volume transport [H L2 T-1 ~> m3 s-1]

  • diffu [out]

    Zonal acceleration due to horizontal viscosity [L T-2 ~> m s-2]

  • diffv [out]

    Meridional acceleration due to horizontal viscosity [L T-2 ~> m s-2]

  • MEKE [inout]

    MEKE fields related to Mesoscale Eddy Kinetic Energy

  • VarMix [inout]

    Variable mixing control structure

  • US [in]

    A dimensional unit scaling type

  • CS [inout]

    Horizontal viscosity control structure

  • tv [in]

    A structure pointing to various thermodynamic variables

  • dt [in]

    Time increment [T ~> s]

  • OBC [in]

    Pointer to an open boundary condition type

  • BT [in]

    Barotropic control structure

  • TD [in]

    Thickness diffusion control structure

  • ADp [in]

    Acceleration diagnostics

  • hu_cont [inout]

    Layer thickness at u-points [H ~> m or kg m-2]

  • hv_cont [inout]

    Layer thickness at v-points [H ~> m or kg m-2]

  • STOCH [inout]

    Stochastic control structure

Callees call graph
Callees of mom_hor_visc::horizontal_viscosity calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::horizontal_viscosity horizontal_viscosity mom_hor_visc::horizontal_viscosity_block horizontal_viscosity_block [private/internal] mom_hor_visc::horizontal_viscosity->mom_hor_visc::horizontal_viscosity_block
Text view
Callers call graph
Callers of mom_hor_visc::horizontal_viscosity calls cluster_mom_dynamics_split_rk2 MOM_dynamics_split_RK2 cluster_mom_dynamics_split_rk2b MOM_dynamics_split_RK2b cluster_mom_dynamics_unsplit MOM_dynamics_unsplit cluster_mom_dynamics_unsplit_rk2 MOM_dynamics_unsplit_RK2 cluster_mom_hor_visc MOM_hor_visc mom_dynamics_split_rk2::initialize_dyn_split_rk2 initialize_dyn_split_RK2 mom_hor_visc::horizontal_viscosity horizontal_viscosity mom_dynamics_split_rk2::initialize_dyn_split_rk2->mom_hor_visc::horizontal_viscosity mom_dynamics_split_rk2::step_mom_dyn_split_rk2 step_MOM_dyn_split_RK2 mom_dynamics_split_rk2::step_mom_dyn_split_rk2->mom_hor_visc::horizontal_viscosity mom_dynamics_split_rk2b::step_mom_dyn_split_rk2b step_MOM_dyn_split_RK2b mom_dynamics_split_rk2b::step_mom_dyn_split_rk2b->mom_hor_visc::horizontal_viscosity mom_dynamics_unsplit::step_mom_dyn_unsplit step_MOM_dyn_unsplit mom_dynamics_unsplit::step_mom_dyn_unsplit->mom_hor_visc::horizontal_viscosity mom_dynamics_unsplit_rk2::step_mom_dyn_unsplit_rk2 step_MOM_dyn_unsplit_RK2 mom_dynamics_unsplit_rk2::step_mom_dyn_unsplit_rk2->mom_hor_visc::horizontal_viscosity
Text view
subroutine horizontal_viscosity_block(u, v, h, uh, vh, diffu, diffv, MEKE, VarMix, G, GV, US, CS, nkk, tv, dt, OBC, BT, TD, ADp, hu_cont, hv_cont, STOCH)

Calculates the acceleration due to the horizontal viscosity using an explicit k-block size.

Parameters
  • G [in]

    The ocean's grid structure.

  • GV [in]

    The ocean's vertical grid structure.

  • u [in]

    The zonal velocity [L T-1 ~> m s-1].

  • v [in]

    The meridional velocity [L T-1 ~> m s-1].

  • h [inout]

    Layer thicknesses [H ~> m or kg m-2].

  • uh [in]

    The zonal volume transport [H L2 T-1 ~> m3 s-1].

  • vh [in]

    The meridional volume transport [H L2 T-1 ~> m3 s-1].

  • diffu [out]

    Zonal acceleration due to convergence of along-coordinate stress tensor [L T-2 ~> m s-2]

  • diffv [out]

    Meridional acceleration due to convergence of along-coordinate stress tensor [L T-2 ~> m s-2].

  • MEKE [inout]

    MEKE fields related to Mesoscale Eddy Kinetic Energy.

  • VarMix [inout]

    Variable mixing control structure

  • US [in]

    A dimensional unit scaling type

  • CS [inout]

    Horizontal viscosity control structure

  • nkk [in]

    The effective k-block size [nondim]

  • tv [in]

    A structure pointing to various thermodynamic variables

  • dt [in]

    Time increment [T ~> s]

  • OBC

    Pointer to an open boundary condition type

  • BT [in]

    Barotropic control structure

  • TD [in]

    Thickness diffusion control structure

  • ADp [in]

    Acceleration diagnostics

  • hu_cont [inout]

    Layer thickness at u-points [H ~> m or kg m-2].

  • hv_cont [inout]

    Layer thickness at v-points [H ~> m or kg m-2].

  • STOCH [inout]

    Stochastic control structure

  • GME_coeff_q

    GME coeff. at q-points [L2 T-1 ~> m2 s-1]

  • KH_u_GME

    Isopycnal height diffusivities in u-columns [L2 T-1 ~> m2 s-1]

  • slope_x

    Isopycnal slope in i-direction [Z L-1 ~> nondim]

  • KH_v_GME

    Isopycnal height diffusivities in v-columns [L2 T-1 ~> m2 s-1]

  • slope_y

    Isopycnal slope in j-direction [Z L-1 ~> nondim]

Callees call graph
Callees of mom_hor_visc::horizontal_viscosity_block calls cluster_mom_checksums MOM_checksums cluster_mom_diag_mediator MOM_diag_mediator cluster_mom_domain_infra MOM_domain_infra cluster_mom_error_handler MOM_error_handler cluster_mom_hor_visc MOM_hor_visc cluster_mom_interface_heights MOM_interface_heights cluster_mom_lateral_mixing_coeffs MOM_lateral_mixing_coeffs cluster_mom_zanna_bolton MOM_Zanna_Bolton mom_checksums::interface::bchksum Bchksum (interface) mom_checksums::interface::hchksum hchksum (interface) mom_diag_mediator::interface::post_data post_data (interface) mom_diag_mediator::post_product_sum_u post_product_sum_u mom_diag_mediator::post_product_sum_v post_product_sum_v mom_diag_mediator::post_product_u post_product_u mom_diag_mediator::post_product_v post_product_v mom_domain_infra::interface::pass_vector pass_vector (interface) mom_error_handler::mom_error MOM_error mom_hor_visc::hor_visc_backscatter_h hor_visc_backscatter_h [private/internal] mom_hor_visc::hor_visc_backscatter_q hor_visc_backscatter_q [private/internal] mom_hor_visc::hor_visc_gme_setup hor_visc_GME_setup [private/internal] mom_hor_visc::hor_visc_leith_grad hor_visc_Leith_grad [private/internal] mom_hor_visc::hor_visc_leithy_ah hor_visc_Leithy_Ah [private/internal] mom_hor_visc::horizontal_viscosity_block horizontal_viscosity_block [private/internal] mom_hor_visc::horizontal_viscosity_block->mom_checksums::interface::bchksum mom_hor_visc::horizontal_viscosity_block->mom_checksums::interface::hchksum mom_hor_visc::horizontal_viscosity_block->mom_diag_mediator::interface::post_data mom_hor_visc::horizontal_viscosity_block->mom_diag_mediator::post_product_sum_u mom_hor_visc::horizontal_viscosity_block->mom_diag_mediator::post_product_sum_v mom_hor_visc::horizontal_viscosity_block->mom_diag_mediator::post_product_u mom_hor_visc::horizontal_viscosity_block->mom_diag_mediator::post_product_v mom_hor_visc::horizontal_viscosity_block->mom_domain_infra::interface::pass_vector mom_hor_visc::horizontal_viscosity_block->mom_error_handler::mom_error mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::hor_visc_backscatter_h mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::hor_visc_backscatter_q mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::hor_visc_gme_setup mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::hor_visc_leith_grad mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::hor_visc_leithy_ah mom_hor_visc::smooth_gme smooth_GME [private/internal] mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::smooth_gme mom_hor_visc::smooth_x9_uv smooth_x9_uv [private/internal] mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::smooth_x9_uv mom_interface_heights::interface::thickness_to_dz thickness_to_dz (interface) mom_hor_visc::horizontal_viscosity_block->mom_interface_heights::interface::thickness_to_dz mom_lateral_mixing_coeffs::calc_qg_slopes calc_QG_slopes mom_hor_visc::horizontal_viscosity_block->mom_lateral_mixing_coeffs::calc_qg_slopes mom_zanna_bolton::zb2020_copy_gradient_and_thickness ZB2020_copy_gradient_and_thickness mom_hor_visc::horizontal_viscosity_block->mom_zanna_bolton::zb2020_copy_gradient_and_thickness mom_zanna_bolton::zb2020_lateral_stress ZB2020_lateral_stress mom_hor_visc::horizontal_viscosity_block->mom_zanna_bolton::zb2020_lateral_stress
Text view
Callers call graph
Callers of mom_hor_visc::horizontal_viscosity_block calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::horizontal_viscosity horizontal_viscosity mom_hor_visc::horizontal_viscosity_block horizontal_viscosity_block [private/internal] mom_hor_visc::horizontal_viscosity->mom_hor_visc::horizontal_viscosity_block
Text view
subroutine hor_visc_Leith_grad(G, GV, US, CS, VarMix, nkk, ksb, kke, is, ie, js, je, is_Kh, ie_Kh, js_Kh, je_Kh, Ieq, Jeq, h, dz, slope_x, slope_y, dudx, dvdy, vort_xy, vort_xy_smooth, grad_vort_mag_h, grad_vort_mag_h_2d, grad_div_mag_h, grad_vort_mag_q, grad_vort_mag_q_2d, grad_div_mag_q, vert_vort_mag_smooth, Del2vort_q)

Calculates the magnitude of the vorticity and divergence gradients, and the Laplacian of vorticity, that are used within horizontal_viscosity by the Leith, modified Leith, Leith+E, and QG Leith viscosity schemes. The caller must only invoke this routine when CS%Leith_Kh, CS%Leith_Ah, or CS%use_Leithy is true.

Parameters
  • G [in]

    The ocean's grid structure.

  • GV [in]

    The ocean's vertical grid structure.

  • US [in]

    A dimensional unit scaling type

  • CS [in]

    Horizontal viscosity control structure

  • VarMix [inout]

    Variable mixing control structure

  • nkk [in]

    The k-block size used to size the following arrays [nondim]

  • ksb [in]

    The first domain k-index of the current k-block

  • kke [in]

    The in-block k-index upper bound of the current k-block

  • is [in]

    Start i-loop index for the h-point viscosities

  • ie [in]

    End i-loop index for the h-point viscosities

  • js [in]

    Start j-loop index for the h-point viscosities

  • je [in]

    End j-loop index for the h-point viscosities

  • is_Kh [in]

    Start i-loop index for the thickness point viscosities

  • ie_Kh [in]

    End i-loop index for the thickness point viscosities

  • js_Kh [in]

    Start j-loop index for the thickness point viscosities

  • je_Kh [in]

    End j-loop index for the thickness point viscosities

  • Ieq [in]

    The last i-index at q-points

  • Jeq [in]

    The last j-index at q-points

  • h [in]

    Layer thicknesses [H ~> m or kg m-2].

  • dz [in]

    Height change across layers [Z ~> m]

  • slope_x [inout]

    Isopycnal slope in i-direction [Z L-1 ~> nondim]

  • slope_y [inout]

    Isopycnal slope in j-direction [Z L-1 ~> nondim]

  • dudx [in]

    x-derivative of the horizontal tension [T-1 ~> s-1]

  • dvdy [in]

    y-derivative of the horizontal tension [T-1 ~> s-1]

  • vort_xy [in]

    Vertical vorticity (dv/dx - du/dy) including metric terms [T-1 ~> s-1]

  • vort_xy_smooth [in]

    Vertical vorticity including metric terms, smoothed [T-1 ~> s-1]

  • grad_vort_mag_h [out]

    Magnitude of vorticity gradient at h-points [L-1 T-1 ~> m-1 s-1]

  • grad_vort_mag_h_2d [out]

    Magnitude of 2d vorticity gradient at h-points [L-1 T-1 ~> m-1 s-1]

  • grad_div_mag_h [out]

    Magnitude of divergence gradient at h-points [L-1 T-1 ~> m-1 s-1]

  • grad_vort_mag_q [out]

    Magnitude of vorticity gradient at q-points [L-1 T-1 ~> m-1 s-1]

  • grad_vort_mag_q_2d [out]

    Magnitude of 2d vorticity gradient at q-points [L-1 T-1 ~> m-1 s-1]

  • grad_div_mag_q [out]

    Magnitude of divergence gradient at q-points [L-1 T-1 ~> m-1 s-1]

  • vert_vort_mag_smooth [out]

    Magnitude of gradient of smoothed vertical vorticity (h or q) [L-1 T-1 ~> m-1 s-1]

  • Del2vort_q [out]

    Laplacian of vorticity at q-points [L-2 T-1 ~> m-2 s-1]

Callees call graph
Callees of mom_hor_visc::hor_visc_leith_grad calls cluster_mom_hor_visc MOM_hor_visc cluster_mom_lateral_mixing_coeffs MOM_lateral_mixing_coeffs mom_hor_visc::hor_visc_leith_grad hor_visc_Leith_grad [private/internal] mom_lateral_mixing_coeffs::calc_qg_leith_viscosity calc_QG_Leith_viscosity mom_hor_visc::hor_visc_leith_grad->mom_lateral_mixing_coeffs::calc_qg_leith_viscosity
Text view
Callers call graph
Callers of mom_hor_visc::hor_visc_leith_grad calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::hor_visc_leith_grad hor_visc_Leith_grad [private/internal] mom_hor_visc::horizontal_viscosity_block horizontal_viscosity_block [private/internal] mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::hor_visc_leith_grad
Text view
subroutine hor_visc_backscatter_h(G, CS, MEKE, VarMix, use_kh_struct, nkk, ksb, kke, Isq, Ieq, Jsq, Jeq, visc_limit_h_flag, sh_xx, str_xx, BS_coeff_h)

Adds the MEKE-based (EY24_EBT_BS) backscatter contribution to the diagonal term of the stress tensor at h-points. The caller must only invoke this routine when CS%EY24_EBT_BS is true.

Parameters
  • G [in]

    The ocean's grid structure.

  • CS [in]

    Horizontal viscosity control structure

  • MEKE [in]

    MEKE fields related to Mesoscale Eddy Kinetic Energy.

  • VarMix [in]

    Variable mixing control structure

  • use_kh_struct [in]

    If true, shape the backscatter coefficient with VarMix%BS_struct

  • nkk [in]

    The k-block size used to size the following arrays [nondim]

  • ksb [in]

    The first domain k-index of the current k-block

  • kke [in]

    The in-block k-index upper bound of the current k-block

  • Isq [in]

    Start i-loop index for the stress tensor at h-points

  • Ieq [in]

    End i-loop index for the stress tensor at h-points

  • Jsq [in]

    Start j-loop index for the stress tensor at h-points

  • Jeq [in]

    End j-loop index for the stress tensor at h-points

  • visc_limit_h_flag [in]

    determines whether backscatter is shut off [nondim]

  • sh_xx [in]

    horizontal tension (du/dx - dv/dy) including metric terms [T-1 ~> s-1]

  • str_xx [inout]

    The diagonal term in the stress tensor [H L2 T-2 ~> m3 s-2 or kg s-2]

  • BS_coeff_h [inout]

    A diagnostic array of the backscatter coefficient [L2 T-1 ~> m2 s-1]

Callers call graph
Callers of mom_hor_visc::hor_visc_backscatter_h calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::hor_visc_backscatter_h hor_visc_backscatter_h [private/internal] mom_hor_visc::horizontal_viscosity_block horizontal_viscosity_block [private/internal] mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::hor_visc_backscatter_h
Text view
subroutine hor_visc_backscatter_q(G, GV, CS, MEKE, VarMix, use_kh_struct, nkk, ksb, kke, is, js, Ieq, Jeq, visc_limit_q_flag, sh_xy, str_xy, BS_coeff_q)

Adds the MEKE-based (EY24_EBT_BS) backscatter contribution to the cross term of the stress tensor at q-points. The caller must only invoke this routine when CS%EY24_EBT_BS is true.

Parameters
  • G [in]

    The ocean's grid structure.

  • GV [in]

    The ocean's vertical grid structure.

  • CS [in]

    Horizontal viscosity control structure

  • MEKE [in]

    MEKE fields related to Mesoscale Eddy Kinetic Energy.

  • VarMix [in]

    Variable mixing control structure

  • use_kh_struct [in]

    If true, shape the backscatter coefficient with VarMix%BS_struct

  • nkk [in]

    The k-block size used to size the following arrays [nondim]

  • ksb [in]

    The first domain k-index of the current k-block

  • kke [in]

    The in-block k-index upper bound of the current k-block

  • is [in]

    Start i-loop index for the q-point stress tensor

  • js [in]

    Start j-loop index for the q-point stress tensor

  • Ieq [in]

    End i-loop index for the q-point stress tensor

  • Jeq [in]

    End j-loop index for the q-point stress tensor

  • visc_limit_q_flag [in]

    determines whether backscatter is shut off [nondim]

  • sh_xy [in]

    horizontal shearing strain (du/dy + dv/dx) including metric terms [T-1 ~> s-1]

  • str_xy [inout]

    The cross term in the stress tensor [H L2 T-2 ~> m3 s-2 or kg s-2]

  • BS_coeff_q [inout]

    A diagnostic array of the backscatter coefficient [L2 T-1 ~> m2 s-1]

Callers call graph
Callers of mom_hor_visc::hor_visc_backscatter_q calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::hor_visc_backscatter_q hor_visc_backscatter_q [private/internal] mom_hor_visc::horizontal_viscosity_block horizontal_viscosity_block [private/internal] mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::hor_visc_backscatter_q
Text view
subroutine hor_visc_Leithy_Ah(G, GV, CS, nkk, ksb, kke, is_Kh, ie_Kh, js_Kh, je_Kh, inv_PI6, Del2vort_q, vert_vort_mag, vert_vort_mag_smooth, vort_xy_smooth, Ah, Ah_h, m_leithy, zc)

Computes the Leith+E antisymmetric-viscosity ratio m_leithy, and updates the biharmonic viscosity Ah (and Ah_h) to include the Leith+E contribution, optionally smoothing m_leithy and Ah in the process. The caller must only invoke this routine when CS%use_Leithy is true.

Parameters
  • G [in]

    The ocean's grid structure.

  • GV [in]

    The ocean's vertical grid structure.

  • CS [in]

    Horizontal viscosity control structure

  • nkk [in]

    The k-block size used to size the following arrays [nondim]

  • ksb [in]

    The first domain k-index of the current k-block

  • kke [in]

    The in-block k-index upper bound of the current k-block

  • is_Kh [in]

    Start i-loop index for the thickness point viscosities

  • ie_Kh [in]

    End i-loop index for the thickness point viscosities

  • js_Kh [in]

    Start j-loop index for the thickness point viscosities

  • je_Kh [in]

    End j-loop index for the thickness point viscosities

  • inv_PI6 [in]

    The inverse of pi to the sixth power [nondim]

  • Del2vort_q [in]

    Laplacian of vorticity at q-points [L-2 T-1 ~> m-2 s-1]

  • vert_vort_mag [in]

    Magnitude of the vertical vorticity gradient (h or q) [L-1 T-1 ~> m-1 s-1]

  • vert_vort_mag_smooth [in]

    Magnitude of gradient of smoothed vertical vorticity (h or q) [L-1 T-1 ~> m-1 s-1]

  • vort_xy_smooth [in]

    Vertical vorticity including metric terms, smoothed [T-1 ~> s-1]

  • Ah [inout]

    biharmonic viscosity (h or q) [L4 T-1 ~> m4 s-1]

  • Ah_h [inout]

    biharmonic viscosity at thickness points [L4 T-1 ~> m4 s-1]

  • m_leithy [out]

    Kh=m_leithy*Ah in Leith+E parameterization [L-2 ~> m-2]

  • zc [in]

    Depth at center of h cell [Z ~> m]

Callees call graph
Callees of mom_hor_visc::hor_visc_leithy_ah calls cluster_mom_domain_infra MOM_domain_infra cluster_mom_hor_visc MOM_hor_visc mom_domain_infra::interface::pass_var pass_var (interface) mom_hor_visc::hor_visc_leithy_ah hor_visc_Leithy_Ah [private/internal] mom_hor_visc::hor_visc_leithy_ah->mom_domain_infra::interface::pass_var mom_hor_visc::leithy_taper_function leithy_taper_function [private/internal] mom_hor_visc::hor_visc_leithy_ah->mom_hor_visc::leithy_taper_function mom_hor_visc::smooth_x9_h smooth_x9_h [private/internal] mom_hor_visc::hor_visc_leithy_ah->mom_hor_visc::smooth_x9_h
Text view
Callers call graph
Callers of mom_hor_visc::hor_visc_leithy_ah calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::hor_visc_leithy_ah hor_visc_Leithy_Ah [private/internal] mom_hor_visc::horizontal_viscosity_block horizontal_viscosity_block [private/internal] mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::hor_visc_leithy_ah
Text view
subroutine hor_visc_GME_setup(G, GV, US, CS, h, BT, TD, nkk, dudx_bt, dvdy_bt, dvdx_bt, dudy_bt, sh_xx_bt, sh_xy_bt, GME_effic_h, GME_effic_q, KH_u_GME, KH_v_GME, GME_coeff_h, GME_coeff_q, str_xx_GME, str_xy_GME)

Calculates the barotropic tension and shearing strain fields and the GME efficiency and isopycnal height diffusivity fields that are used within horizontal_viscosity when GME (CS%use_GME) is active. The caller must only invoke this routine when CS%use_GME is true.

Parameters
  • G [in]

    The ocean's grid structure.

  • GV [in]

    The ocean's vertical grid structure.

  • US [in]

    A dimensional unit scaling type

  • CS [inout]

    Horizontal viscosity control structure

  • h [inout]

    Layer thicknesses [H ~> m or kg m-2].

  • BT [in]

    Barotropic control structure

  • TD [in]

    Thickness diffusion control structure

  • nkk [in]

    The k-block size used to size the following arrays [nondim]

  • dudx_bt [out]

    x-component in the barotropic horizontal tension [T-1 ~> s-1]

  • dvdy_bt [out]

    y-component in the barotropic horizontal tension [T-1 ~> s-1]

  • dvdx_bt [out]

    x-component in the barotropic shearing strain [T-1 ~> s-1]

  • dudy_bt [out]

    y-component in the barotropic shearing strain [T-1 ~> s-1]

  • sh_xx_bt [out]

    Barotropic horizontal tension (du/dx - dv/dy) including metric terms [T-1 ~> s-1]

  • sh_xy_bt [out]

    Barotropic horizontal shearing strain (du/dy + dv/dx) including metric terms [T-1 ~> s-1]

  • GME_effic_h [out]

    The filtered efficiency of the GME terms at h points [nondim]

  • GME_effic_q [out]

    The filtered efficiency of the GME terms at q points [nondim]

  • KH_u_GME [out]

    Isopycnal height diffusivities in u-columns [L2 T-1 ~> m2 s-1]

  • KH_v_GME [out]

    Isopycnal height diffusivities in v-columns [L2 T-1 ~> m2 s-1]

  • GME_coeff_h [out]

    GME coefficient at h-points [L2 T-1 ~> m2 s-1]

  • GME_coeff_q [out]

    GME coeff. at q-points [L2 T-1 ~> m2 s-1]

  • str_xx_GME [out]

    Smoothed diagonal term in the stress tensor from GME [L2 T-2 ~> m2 s-2]

  • str_xy_GME [out]

    Smoothed cross term in the stress tensor from GME [L2 T-2 ~> m2 s-2]

Callees call graph
Callees of mom_hor_visc::hor_visc_gme_setup calls cluster_mom_barotropic MOM_barotropic cluster_mom_checksums MOM_checksums cluster_mom_domain_infra MOM_domain_infra cluster_mom_hor_visc MOM_hor_visc cluster_mom_thickness_diffuse MOM_thickness_diffuse mom_barotropic::barotropic_get_tav barotropic_get_tav mom_checksums::interface::uvchksum uvchksum (interface) mom_domain_infra::interface::pass_var pass_var (interface) mom_domain_infra::interface::pass_vector pass_vector (interface) mom_hor_visc::hor_visc_gme_setup hor_visc_GME_setup [private/internal] mom_hor_visc::hor_visc_gme_setup->mom_barotropic::barotropic_get_tav mom_hor_visc::hor_visc_gme_setup->mom_checksums::interface::uvchksum mom_hor_visc::hor_visc_gme_setup->mom_domain_infra::interface::pass_var mom_hor_visc::hor_visc_gme_setup->mom_domain_infra::interface::pass_vector mom_thickness_diffuse::thickness_diffuse_get_kh thickness_diffuse_get_KH mom_hor_visc::hor_visc_gme_setup->mom_thickness_diffuse::thickness_diffuse_get_kh
Text view
Callers call graph
Callers of mom_hor_visc::hor_visc_gme_setup calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::hor_visc_gme_setup hor_visc_GME_setup [private/internal] mom_hor_visc::horizontal_viscosity_block horizontal_viscosity_block [private/internal] mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::hor_visc_gme_setup
Text view
subroutine hor_visc_init(Time, G, GV, US, param_file, diag, CS, ADp)

Allocates space for and calculates static variables used by horizontal_viscosity. hor_visc_init calculates and stores the values of a number of metric functions that are used in horizontal_viscosity.

Parameters
  • Time [in]

    Current model time.

  • G [inout]

    The ocean's grid structure.

  • GV [in]

    The ocean's vertical grid structure

  • US [in]

    A dimensional unit scaling type

  • param_file [in]

    A structure to parse for run-time parameters.

  • diag [inout]

    Structure to regulate diagnostic output.

  • CS [inout]

    Horizontal viscosity control structure

  • ADp [in]

    Acceleration diagnostics

Callees call graph
Callees of mom_hor_visc::hor_visc_init calls cluster_mom_checksums MOM_checksums cluster_mom_coms_infra MOM_coms_infra cluster_mom_diag_mediator MOM_diag_mediator cluster_mom_domain_infra MOM_domain_infra cluster_mom_error_handler MOM_error_handler cluster_mom_file_parser MOM_file_parser cluster_mom_hor_visc MOM_hor_visc cluster_mom_io MOM_io cluster_mom_safe_alloc MOM_safe_alloc cluster_mom_string_functions MOM_string_functions cluster_mom_zanna_bolton MOM_Zanna_Bolton mom_checksums::interface::bchksum Bchksum (interface) mom_checksums::interface::hchksum hchksum (interface) mom_coms_infra::interface::min_across_pes min_across_PEs (interface) mom_diag_mediator::register_diag_field register_diag_field mom_domain_infra::interface::pass_var pass_var (interface) mom_error_handler::mom_error MOM_error mom_file_parser::interface::get_param get_param (interface) mom_file_parser::interface::log_version log_version (interface) mom_hor_visc::align_aniso_tensor_to_grid align_aniso_tensor_to_grid [private/internal] mom_hor_visc::hor_visc_init hor_visc_init mom_hor_visc::hor_visc_init->mom_checksums::interface::bchksum mom_hor_visc::hor_visc_init->mom_checksums::interface::hchksum mom_hor_visc::hor_visc_init->mom_coms_infra::interface::min_across_pes mom_hor_visc::hor_visc_init->mom_diag_mediator::register_diag_field mom_hor_visc::hor_visc_init->mom_domain_infra::interface::pass_var mom_hor_visc::hor_visc_init->mom_error_handler::mom_error mom_hor_visc::hor_visc_init->mom_file_parser::interface::get_param mom_hor_visc::hor_visc_init->mom_file_parser::interface::log_version mom_hor_visc::hor_visc_init->mom_hor_visc::align_aniso_tensor_to_grid mom_hor_visc::sum_5x5 sum_5x5 [private/internal] mom_hor_visc::hor_visc_init->mom_hor_visc::sum_5x5 mom_io::interface::mom_read_data MOM_read_data (interface) mom_hor_visc::hor_visc_init->mom_io::interface::mom_read_data mom_safe_alloc::interface::safe_alloc_ptr safe_alloc_ptr (interface) mom_hor_visc::hor_visc_init->mom_safe_alloc::interface::safe_alloc_ptr mom_string_functions::slasher slasher mom_hor_visc::hor_visc_init->mom_string_functions::slasher mom_zanna_bolton::zb2020_init ZB2020_init mom_hor_visc::hor_visc_init->mom_zanna_bolton::zb2020_init
Text view
Callers call graph
Callers of mom_hor_visc::hor_visc_init calls cluster_mom_dynamics_split_rk2 MOM_dynamics_split_RK2 cluster_mom_dynamics_split_rk2b MOM_dynamics_split_RK2b cluster_mom_dynamics_unsplit MOM_dynamics_unsplit cluster_mom_dynamics_unsplit_rk2 MOM_dynamics_unsplit_RK2 cluster_mom_hor_visc MOM_hor_visc mom_dynamics_split_rk2::initialize_dyn_split_rk2 initialize_dyn_split_RK2 mom_hor_visc::hor_visc_init hor_visc_init mom_dynamics_split_rk2::initialize_dyn_split_rk2->mom_hor_visc::hor_visc_init mom_dynamics_split_rk2b::initialize_dyn_split_rk2b initialize_dyn_split_RK2b mom_dynamics_split_rk2b::initialize_dyn_split_rk2b->mom_hor_visc::hor_visc_init mom_dynamics_unsplit::initialize_dyn_unsplit initialize_dyn_unsplit mom_dynamics_unsplit::initialize_dyn_unsplit->mom_hor_visc::hor_visc_init mom_dynamics_unsplit_rk2::initialize_dyn_unsplit_rk2 initialize_dyn_unsplit_RK2 mom_dynamics_unsplit_rk2::initialize_dyn_unsplit_rk2->mom_hor_visc::hor_visc_init
Text view
pure function leithy_taper_function(CS, zc)

leithy_taper_function returns 1 if zc is shallower than leithy_depth; 0 if deeper than leithy_depth+leithy_width; and an interpolating cubic spline in between.

Parameters
  • CS [in]

    Control structure for horizontal viscosity

  • zc [in]

    depth of h-cell centers [Z ~> m]

Callers call graph
Callers of mom_hor_visc::leithy_taper_function calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::hor_visc_leithy_ah hor_visc_Leithy_Ah [private/internal] mom_hor_visc::leithy_taper_function leithy_taper_function [private/internal] mom_hor_visc::hor_visc_leithy_ah->mom_hor_visc::leithy_taper_function
Text view
function hor_visc_vel_stencil(CS) result(stencil)

hor_visc_vel_stencil returns the horizontal viscosity input velocity stencil size

Parameters
  • CS [in]

    Control structure for horizontal viscosity

  • stencil

    The horizontal viscosity velocity stencil size with the current settings.

Callers call graph
Callers of mom_hor_visc::hor_visc_vel_stencil calls cluster_mom_dynamics_split_rk2 MOM_dynamics_split_RK2 cluster_mom_hor_visc MOM_hor_visc mom_dynamics_split_rk2::step_mom_dyn_split_rk2 step_MOM_dyn_split_RK2 mom_hor_visc::hor_visc_vel_stencil hor_visc_vel_stencil mom_dynamics_split_rk2::step_mom_dyn_split_rk2->mom_hor_visc::hor_visc_vel_stencil
Text view
subroutine align_aniso_tensor_to_grid(CS, n1, n2)

Calculates factors in the anisotropic orientation tensor to be align with the grid. With n1=1 and n2=0, this recovers the approach of Large et al, 2001.

Parameters
  • CS [inout]

    Control structure for horizontal viscosity

  • n1 [in]

    i-component of direction vector [nondim]

  • n2 [in]

    j-component of direction vector [nondim]

Callers call graph
Callers of mom_hor_visc::align_aniso_tensor_to_grid calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::align_aniso_tensor_to_grid align_aniso_tensor_to_grid [private/internal] mom_hor_visc::hor_visc_init hor_visc_init mom_hor_visc::hor_visc_init->mom_hor_visc::align_aniso_tensor_to_grid
Text view
subroutine smooth_GME(CS, G, GME_flux_h, GME_flux_q)

Apply a 1-1-4-1-1 Laplacian filter one time on GME diffusive flux to reduce any horizontal two-grid-point noise

Parameters
  • CS [in]

    Control structure

  • G [in]

    Ocean grid

  • GME_flux_h [inout]

    GME diffusive flux at h points [L2 T-2 ~> m2 s-2]

  • GME_flux_q [inout]

    GME diffusive flux at q points [L2 T-2 ~> m2 s-2]

Callees call graph
Callees of mom_hor_visc::smooth_gme calls cluster_mom_domain_infra MOM_domain_infra cluster_mom_hor_visc MOM_hor_visc mom_domain_infra::interface::pass_var pass_var (interface) mom_hor_visc::smooth_gme smooth_GME [private/internal] mom_hor_visc::smooth_gme->mom_domain_infra::interface::pass_var
Text view
Callers call graph
Callers of mom_hor_visc::smooth_gme calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::horizontal_viscosity_block horizontal_viscosity_block [private/internal] mom_hor_visc::smooth_gme smooth_GME [private/internal] mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::smooth_gme
Text view
function sum_5x5(x) result(sum_x)

Apply a 5x5 weighted sum. In exact arithmetic this is the same as applying a 1:2:1 smoother twice in each direction. The implementation here uses fewer arithmetic operations, and is rotationally symmetric. To obtain the weighted average, divide the result by 256.

Parameters
  • x [in]

    5x5 array to be summed. Assumed-shape to avoid copies. [arbitrary]

  • sum_x

    output [same as x]

  • sum_partial

    scalar holding a partial sum, for convenience

Callers call graph
Callers of mom_hor_visc::sum_5x5 calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::hor_visc_init hor_visc_init mom_hor_visc::sum_5x5 sum_5x5 [private/internal] mom_hor_visc::hor_visc_init->mom_hor_visc::sum_5x5 mom_hor_visc::smooth_x9_h smooth_x9_h [private/internal] mom_hor_visc::smooth_x9_h->mom_hor_visc::sum_5x5 mom_hor_visc::smooth_x9_uv smooth_x9_uv [private/internal] mom_hor_visc::smooth_x9_uv->mom_hor_visc::sum_5x5
Text view
subroutine smooth_x9_h(CS, G, field_h, zero_land)

Apply a 9-point smoothing filter twice to a field staggered at a thickness point to reduce horizontal two-grid-point noise. Implemented using a single 5x5 pass rather than 3x3 twice. Note that this subroutine does not conserve mass, so don't use it in situations where you need conservation. Also note that it assumes that the input field has valid values in the first two halo points upon entry.

Parameters
  • CS [in]

    Control structure

  • G [in]

    Ocean grid

  • field_h [inout]

    h-point field to be smoothed [arbitrary]

  • zero_land [in]

    If present and false, return the average of the surrounding ocean points when smoothing, otherwise use a value of 0 for land points and include them in the averages.

Callees call graph
Callees of mom_hor_visc::smooth_x9_h calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::smooth_x9_h smooth_x9_h [private/internal] mom_hor_visc::sum_5x5 sum_5x5 [private/internal] mom_hor_visc::smooth_x9_h->mom_hor_visc::sum_5x5
Text view
Callers call graph
Callers of mom_hor_visc::smooth_x9_h calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::hor_visc_leithy_ah hor_visc_Leithy_Ah [private/internal] mom_hor_visc::smooth_x9_h smooth_x9_h [private/internal] mom_hor_visc::hor_visc_leithy_ah->mom_hor_visc::smooth_x9_h
Text view
subroutine smooth_x9_uv(CS, G, field_u, field_v, zero_land)

Apply a 9-point smoothing filter twice to a pair of velocity components to reduce horizontal two-grid-point noise. Implemented using a single 5x5 pass rather than 3x3 twice. Note that this subroutine does not conserve angular momentum, so don't use it in situations where you need conservation. Also note that it assumes that the input fields have valid values in the first two halo points upon entry.

Parameters
  • CS [in]

    Control structure

  • G [in]

    Ocean grid

  • field_u [inout]

    u-point field to be smoothed [arbitrary]

  • field_v [inout]

    v-point field to be smoothed [arbitrary]

  • zero_land [in]

    If present and false, return the average of the surrounding ocean points when smoothing, otherwise use a value of 0 for land points and include them in the averages.

Callees call graph
Callees of mom_hor_visc::smooth_x9_uv calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::smooth_x9_uv smooth_x9_uv [private/internal] mom_hor_visc::sum_5x5 sum_5x5 [private/internal] mom_hor_visc::smooth_x9_uv->mom_hor_visc::sum_5x5
Text view
Callers call graph
Callers of mom_hor_visc::smooth_x9_uv calls cluster_mom_hor_visc MOM_hor_visc mom_hor_visc::horizontal_viscosity_block horizontal_viscosity_block [private/internal] mom_hor_visc::smooth_x9_uv smooth_x9_uv [private/internal] mom_hor_visc::horizontal_viscosity_block->mom_hor_visc::smooth_x9_uv
Text view
subroutine hor_visc_end(CS)

Deallocates any variables allocated in hor_visc_init.

Parameters
  • CS [inout]

    Horizontal viscosity control structure

Callees call graph
Callees of mom_hor_visc::hor_visc_end calls cluster_mom_hor_visc MOM_hor_visc cluster_mom_zanna_bolton MOM_Zanna_Bolton mom_hor_visc::hor_visc_end hor_visc_end mom_zanna_bolton::zb2020_end ZB2020_end mom_hor_visc::hor_visc_end->mom_zanna_bolton::zb2020_end
Text view
Callers call graph
Callers of mom_hor_visc::hor_visc_end calls cluster_mom_dynamics_split_rk2 MOM_dynamics_split_RK2 cluster_mom_dynamics_split_rk2b MOM_dynamics_split_RK2b cluster_mom_hor_visc MOM_hor_visc mom_dynamics_split_rk2::end_dyn_split_rk2 end_dyn_split_RK2 mom_hor_visc::hor_visc_end hor_visc_end mom_dynamics_split_rk2::end_dyn_split_rk2->mom_hor_visc::hor_visc_end mom_dynamics_split_rk2b::end_dyn_split_rk2b end_dyn_split_RK2b mom_dynamics_split_rk2b::end_dyn_split_rk2b->mom_hor_visc::hor_visc_end
Text view
API generated with Flint · Rendered from reStructuredText