mom_hor_visc module reference
Calculates horizontal viscosity and viscous stresses.
Data Types
Control structure for horizontal viscosity. |
Functions/Subroutines
Calculates the acceleration due to the horizontal viscosity. |
|
Calculates the acceleration due to the horizontal viscosity using an explicit k-block size. |
|
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. |
|
Adds the MEKE-based (EY24_EBT_BS) backscatter contribution to the diagonal term of the stress tensor at h-points. |
|
Adds the MEKE-based (EY24_EBT_BS) backscatter contribution to the cross term of the stress tensor at q-points. |
|
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. |
|
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 (CSuse_GME) is active. |
|
Allocates space for and calculates static variables used by horizontal_viscosity. |
|
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 returns the horizontal viscosity input velocity stencil size |
|
Calculates factors in the anisotropic orientation tensor to be align with the grid. |
|
Apply a 1-1-4-1-1 Laplacian filter one time on GME diffusive flux to reduce any horizontal two-grid-point noise. |
|
Apply a 5x5 weighted sum. |
|
Apply a 9-point smoothing filter twice to a field staggered at a thickness point to reduce horizontal two-grid-point noise. |
|
Apply a 9-point smoothing filter twice to a pair of velocity components to reduce horizontal two-grid-point noise. |
|
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 [77]. 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 [78] with the exception that the isotropic viscosity is \(\kappa_h\).
In general, the horizontal stress tensor can be written as
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
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
The stresses above are linearly related to the strain through a viscosity coefficient, \(\kappa_h\):
The viscosity \(\kappa_h\) may either be a constant or variable. For example, \(\kappa_h\) may vary with the shear, as proposed by [77].
The accelerations resulting form the divergence of the stress tensor are
The form of the Laplacian viscosity in general coordinates is:
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:
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:
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:
while for a Laplacian operator, they are simply
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 [78]. 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
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
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
The horizontal divergent strain, \(\dot{e}_D\), is stored in variable div_xx and discretized as
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
where
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
The tendency for the y-component of the divergence of stress is stored in variable diffv and discretized as
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 mom_hor_visc/hor_visc_cs
Control structure for horizontal viscosity.
- Type fields:
% id_grid_re_ah ::
integerDiagnostic id.% id_grid_re_kh ::
integerDiagnostic id.% id_diffu ::
integerDiagnostic id.% id_diffv ::
integerDiagnostic id.% id_h_diffu ::
integerDiagnostic id.% id_h_diffv ::
integerDiagnostic id.% id_hf_diffu_2d ::
integerDiagnostic id.% id_hf_diffv_2d ::
integerDiagnostic id.% id_intz_diffu_2d ::
integerDiagnostic id.% id_intz_diffv_2d ::
integerDiagnostic id.% id_diffu_visc_rem ::
integerDiagnostic id.% id_diffv_visc_rem ::
integerDiagnostic id.% id_ah_h ::
integerDiagnostic id.% id_ah_q ::
integerDiagnostic id.% id_kh_h ::
integerDiagnostic id.% id_kh_q ::
integerDiagnostic id.% id_gme_coeff_h ::
integerDiagnostic id.% id_gme_coeff_q ::
integerDiagnostic id.% id_dudx_bt ::
integerDiagnostic id.% id_dvdy_bt ::
integerDiagnostic id.% id_dudy_bt ::
integerDiagnostic id.% id_dvdx_bt ::
integerDiagnostic id.% id_vort_xy_q ::
integerDiagnostic id.% id_div_xx_h ::
integerDiagnostic id.% id_sh_xy_q ::
integerDiagnostic id.% id_sh_xx_h ::
integerDiagnostic id.% id_frictwork ::
integerDiagnostic id.% id_frictworkintz ::
integerDiagnostic id.% id_frictwork_bh ::
integerDiagnostic id.% id_frictworkintz_bh ::
integerDiagnostic id.% id_frictwork_gme ::
integerDiagnostic id.% id_normstress ::
integerDiagnostic id.% id_shearstress ::
integerDiagnostic id.% id_visc_limit_h ::
integerDiagnostic id.% id_visc_limit_q ::
integerDiagnostic id.% id_visc_limit_h_flag ::
integerDiagnostic id.% id_visc_limit_q_flag ::
integerDiagnostic id.% id_visc_limit_h_frac ::
integerDiagnostic id.% id_visc_limit_q_frac ::
integerDiagnostic id.% id_bs_coeff_h ::
integerDiagnostic id.% id_bs_coeff_q ::
integerDiagnostic id.% initialized ::
logicalTrue if this control structure has been initialized.% laplacian ::
logicalUse a Laplacian horizontal viscosity if true.% biharmonic ::
logicalUse a biharmonic horizontal viscosity if true.% debug ::
logicalIf true, write verbose checksums for debugging purposes.% no_slip ::
logicalIf 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 ::
logicalIf true, the Laplacian coefficient is locally limited to guarantee stability.% ey24_ebt_bs ::
logicaldeveloped by Yankovsky et al. 2024% bound_ah ::
logicalIf true, the biharmonic coefficient is locally limited to guarantee stability.% re_ah ::
realso that the biharmonic Reynolds number is equal to this [nondim].% bound_coef ::
realThe 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 ::
realA nondimensional coefficient on the biharmonic viscosity that sets the kill switch for backscatter. Default is 1.0 [nondim].% ks_timescale ::
realA timescale for computing CFL limit for turning off backscatter [T ~> s].% backscatter_underbound ::
logicalIf 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 ::
logicalIf true, use Smagorinsky nonlinear eddy viscosity. KH is the background value.% smagorinsky_ah ::
logicalIf true, use a biharmonic form of Smagorinsky nonlinear eddy viscosity. AH is the background.% leith_kh ::
logicalIf true, use 2D Leith nonlinear eddy viscosity. KH is the background value.% modified_leith ::
logicalIf true, use extra component of Leith viscosity to damp divergent flow. To use, still set Leith_Kh=.TRUE.% use_beta_in_leith ::
logicalIf true, includes the beta term in the Leith viscosity.% leith_ah ::
logicalIf true, use a biharmonic form of 2D Leith nonlinear eddy viscosity. AH is the background.% use_leithy ::
logicalIf true, use a biharmonic form of 2D Leith nonlinear eddy viscosity with harmonic backscatter. Ah is the background. Leithy = Leith+E.% c_k ::
realFraction of energy dissipated by the biharmonic term that gets backscattered in the Leith+E scheme. [nondim].% smooth_ah ::
logicalIf true (default), then Ah and m_leithy are smoothed. This smoothing requires a lot of blocking communication.% taper_leithy ::
logicalIf true, backscatter coeff is tapered to zero with depth.% leithy_depth ::
realIf tapering leith+E, taper is applied below this depth [Z ~> m].% leithy_width ::
realIf tapering leith+E, backscatter is zero below leithy_depth+leithy_width [Z ~> m].% use_qg_leith_visc ::
logicalIf true, use QG Leith nonlinear eddy viscosity. KH is the background value.% bound_coriolis ::
logicalIf 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 ::
logicalRead 2d background viscosity from a file.% kh_bg_2d_bug ::
logicalIf true, retain an answer-changing horizontal indexing bug in setting the corner-point viscosities when USE_KH_BG_2D=True.% kh_bg_min ::
realThe minimum value allowed for Laplacian horizontal viscosity [L2 T-1 ~> m2 s-1]. The default is 0.0.% frictwork_bug ::
logicalIf 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 ::
logicalIf true, recover a bug that specified shear strain option at open boundaries cannot be applied.% use_land_mask ::
logicalUse 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 ::
logicalIf true, allow anisotropic component to the viscosity.% add_les_viscosity ::
logicalIf true, adds the viscosity from Smagorinsky and Leith to the background viscosity instead of taking the maximum.% kh_aniso ::
realThe anisotropic viscosity [L2 T-1 ~> m2 s-1].% dynamic_aniso ::
logicalIf true, the anisotropic viscosity is recomputed as a function of state. This is set depending on ANISOTROPIC_MODE.% res_scale_meke ::
logicalIf true, the viscosity contribution from MEKE is scaled by the resolution function.% use_gme ::
logicalIf true, use GME backscatter scheme.% nkblock ::
integerThe k block size used in horizontal viscosity calculations.% answer_date ::
integerThe 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 ::
realThe 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 ::
realThe nondimensional prefactor multiplying the GME coefficient [nondim].% gme_limiter ::
realThe absolute maximum value the GME coefficient is allowed to take [L2 T-1 ~> m2 s-1].% min_grid_kh ::
realMinimum horizontal Laplacian viscosity used to limit the grid Reynolds number [L2 T-1 ~> m2 s-1].% min_grid_ah ::
realMinimun horizontal biharmonic viscosity used to limit grid Reynolds number [L4 T-1 ~> m4 s-1].% use_cont_thick ::
logicalIf true, thickness at velocity points adopts h[uv] in BT_cont from continuity solver.% use_cont_thick_bug ::
logicalIf true, retain an answer-changing bug for thickness at velocity points.% zb2020 ::
type(zb2020_cs)Zanna-Bolton 2020 control structure.% use_zb2020 ::
logicalIf true, use Zanna-Bolton 2020 parameterization.% use_circulation ::
logicalIf true, use circulation theorem to compute vorticity (for ZB20 or Leith)% kh_bg_xx ::
real, dimension(:, :), allocatableThe 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 ::
real, dimension(:,:), allocatableThe 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 ::
real, dimension(:, :), allocatableThe 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 ::
real, dimension(:, :), allocatableThe amount by which stresses through h points are reduced due to partial barriers [nondim].% kh_max_xx ::
real, dimension(:,:), allocatableThe maximum permitted Laplacian viscosity [L2 T-1 ~> m2 s-1].% ah_max_xx ::
real, dimension(:,:), allocatableThe maximum permitted biharmonic viscosity [L4 T-1 ~> m4 s-1].% ah_max_xx_ks ::
real, dimension(:,:), allocatableThe maximum permitted biharmonic viscosity for the kill switch [L4 T-1 ~> m4 s-1].% n1n2_h ::
real, dimension(:,:), allocatableFactor n1*n2 in the anisotropic direction tensor at h-points [nondim].% n1n1_m_n2n2_h ::
real, dimension(:,:), allocatableFactor n1**2-n2**2 in the anisotropic direction tensor at h-points [nondim].% grid_sp_h2 ::
real, dimension(:, :), allocatableHarmonic mean of the squares of the grid [L2 ~> m2].% grid_sp_h3 ::
real, dimension(:, :), allocatableHarmonic mean of the squares of the grid^(3/2) [L3 ~> m3].% kh_bg_xy ::
real, dimension(:, :), allocatableThe 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 ::
real, dimension(:, :), allocatableThe 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 ::
real, dimension(:, :), allocatableThe amount by which stresses through q points are reduced due to partial barriers [nondim].% kh_max_xy ::
real, dimension(:,:), allocatableThe maximum permitted Laplacian viscosity [L2 T-1 ~> m2 s-1].% ah_max_xy ::
real, dimension(:,:), allocatableThe maximum permitted biharmonic viscosity [L4 T-1 ~> m4 s-1].% ah_max_xy_ks ::
real, dimension(:,:), allocatableThe maximum permitted biharmonic viscosity for the kill switch [L4 T-1 ~> m4 s-1].% n1n2_q ::
real, dimension(:,:), allocatableFactor n1*n2 in the anisotropic direction tensor at q-points [nondim].% n1n1_m_n2n2_q ::
real, dimension(:,:), allocatableFactor n1**2-n2**2 in the anisotropic direction tensor at q-points [nondim].% dx2h ::
real, dimension(:, :), allocatablePre-calculated dx^2 at h points [L2 ~> m2].% dy2h ::
real, dimension(:, :), allocatablePre-calculated dy^2 at h points [L2 ~> m2].% dx_dyt ::
real, dimension(:, :), allocatablePre-calculated dx/dy at h points [nondim].% dy_dxt ::
real, dimension(:, :), allocatablePre-calculated dy/dx at h points [nondim].% iwts ::
real, dimension(:,:), allocatablePre-calculated 1./sum_5x5(Gmask2dT) [nondim].% iwts_u ::
real, dimension(:,:), allocatable1/sum_5x5(Gmask2Cu) [nondim]% iwts_v ::
real, dimension(:,:), allocatable1/sum_5x5(Gmask2Cv) [nondim]% m_const_leithy ::
real, dimension(:,:), allocatablePre-calculated .5*sqrt(c_K)*max{dx,dy} [L ~> m].% m_leithy_max ::
real, dimension(:,:), allocatablePre-calculated 4./max(dx,dy)^2 at h points [L-2 ~> m-2].% dx2q ::
real, dimension(:, :), allocatablePre-calculated dx^2 at q points [L2 ~> m2].% dy2q ::
real, dimension(:, :), allocatablePre-calculated dy^2 at q points [L2 ~> m2].% dx_dybu ::
real, dimension(:, :), allocatablePre-calculated dx/dy at q points [nondim].% dy_dxbu ::
real, dimension(:, :), allocatablePre-calculated dy/dx at q points [nondim].% idx2dycu ::
real, dimension(:, :), allocatable1/(dx^2 dy) at u points [L-3 ~> m-3]% idxdy2u ::
real, dimension(:, :), allocatable1/(dx dy^2) at u points [L-3 ~> m-3]% idx2dycv ::
real, dimension(:, :), allocatable1/(dx^2 dy) at v points [L-3 ~> m-3]% idxdy2v ::
real, dimension(:, :), allocatable1/(dx dy^2) at v points [L-3 ~> m-3]% laplac2_const_xx ::
real, dimension(:,:), allocatableLaplacian metric-dependent constants [L2 ~> m2].% biharm6_const_xx ::
real, dimension(:,:), allocatableBiharmonic metric-dependent constants [L6 ~> m6].% laplac3_const_xx ::
real, dimension(:,:), allocatableLaplacian metric-dependent constants [L3 ~> m3].% biharm_const_xx ::
real, dimension(:,:), allocatableBiharmonic metric-dependent constants [L4 ~> m4].% biharm_const2_xx ::
real, dimension(:,:), allocatableBiharmonic metric-dependent constants [T L4 ~> s m4].% re_ah_const_xx ::
real, dimension(:,:), allocatableBiharmonic metric-dependent constants [L3 ~> m3].% laplac2_const_xy ::
real, dimension(:,:), allocatableLaplacian metric-dependent constants [L2 ~> m2].% biharm6_const_xy ::
real, dimension(:,:), allocatableBiharmonic metric-dependent constants [L6 ~> m6].% laplac3_const_xy ::
real, dimension(:,:), allocatableLaplacian metric-dependent constants [L3 ~> m3].% biharm_const_xy ::
real, dimension(:,:), allocatableBiharmonic metric-dependent constants [L4 ~> m4].% biharm_const2_xy ::
real, dimension(:,:), allocatableBiharmonic metric-dependent constants [T L4 ~> s m4].% re_ah_const_xy ::
real, dimension(:,:), allocatableBiharmonic metric-dependent constants [L3 ~> m3].% diag ::
type(diag_ctrl), pointerstructure to regulate diagnostics% num_smooth_gme ::
integernumber of smoothing passes for the GME fluxes.
Function/Subroutine Documentation
- subroutine mom_hor_visc/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 ::
u[in] The zonal velocity [L T-1 ~> m s-1]v ::
v[in] The meridional velocity [L T-1 ~> m s-1]h ::
h[inout] Layer thicknesses [H ~> m or kg m-2]uh ::
uh[in] The zonal volume transport [H L2 T-1 ~> m3 s-1]vh ::
vh[in] The meridional volume transport [H L2 T-1 ~> m3 s-1]diffu ::
diffu[out] Zonal acceleration due to horizontal viscosity [L T-2 ~> m s-2]diffv ::
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 ::
tv[in] A structure pointing to various thermodynamic variablesdt ::
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 ::
hu_cont[inout] Layer thickness at u-points [H ~> m or kg m-2]hv_cont ::
hv_cont[inout] Layer thickness at v-points [H ~> m or kg m-2]stoch :: [inout] Stochastic control structure
- Call to:
- Called from:
mom_dynamics_unsplit::step_mom_dyn_unsplitmom_dynamics_unsplit_rk2::step_mom_dyn_unsplit_rk2
- subroutine mom_hor_visc/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 ::
u[in] The zonal velocity [L T-1 ~> m s-1].v ::
v[in] The meridional velocity [L T-1 ~> m s-1].h ::
h[inout] Layer thicknesses [H ~> m or kg m-2].uh ::
uh[in] The zonal volume transport [H L2 T-1 ~> m3 s-1].vh ::
vh[in] The meridional volume transport [H L2 T-1 ~> m3 s-1].diffu ::
diffu[out] Zonal acceleration due to convergence ofdiffv ::
diffv[out] Meridional acceleration due to convergencemeke :: [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 ::
nkk[in] The effective k-block size [nondim]tv ::
tv[in] A structure pointing to various thermodynamic variablesdt ::
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 ::
hu_cont[inout] Layer thickness at u-points [H ~> m or kg m-2].hv_cont ::
hv_cont[inout] Layer thickness at v-points [H ~> m or kg m-2].stoch :: [inout] Stochastic control structure
- Call to:
mom_lateral_mixing_coeffs::calc_qg_slopeshor_visc_backscatter_hhor_visc_backscatter_qhor_visc_gme_setuphor_visc_leith_gradhor_visc_leithy_ahmom_error_handler::mom_errormom_open_boundary::obc_strain_computedmom_open_boundary::obc_strain_specifiedsmooth_gmesmooth_x9_uvmom_zanna_bolton::zb2020_copy_gradient_and_thickness- Called from:
- subroutine mom_hor_visc/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 CSLeith_Kh, CSLeith_Ah, or CSuse_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 ::
nkk[in] The k-block size used to size the following arrays [nondim]ksb ::
ksb[in] The first domain k-index of the current k-blockkke ::
kke[in] The in-block k-index upper bound of the current k-blockis ::
is[in] Start i-loop index for the h-point viscositiesie ::
ie[in] End i-loop index for the h-point viscositiesjs ::
js[in] Start j-loop index for the h-point viscositiesje ::
je[in] End j-loop index for the h-point viscositiesis_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 ::
h[in] Layer thicknesses [H ~> m or kg m-2].dz ::
dz[in] Height change across layers [Z ~> m]slope_x ::
slope_x[inout] Isopycnal slope in i-direction [Z L-1 ~> nondim]slope_y ::
slope_y[inout] Isopycnal slope in j-direction [Z L-1 ~> nondim]dudx ::
dudx[in] x-derivative of the horizontal tension [T-1 ~> s-1]dvdy ::
dvdy[in] y-derivative of the horizontal tension [T-1 ~> s-1]vort_xy ::
vort_xy[in] Vertical vorticity (dv/dx - du/dy) includingvort_xy_smooth ::
vort_xy_smooth[in] Vertical vorticity including metricgrad_vort_mag_h ::
grad_vort_mag_h[out] Magnitude of vorticity gradient atgrad_vort_mag_h_2d ::
grad_vort_mag_h_2d[out] Magnitude of 2d vorticity gradientgrad_div_mag_h ::
grad_div_mag_h[out] Magnitude of divergence gradient atgrad_vort_mag_q ::
grad_vort_mag_q[out] Magnitude of vorticity gradient atgrad_vort_mag_q_2d ::
grad_vort_mag_q_2d[out] Magnitude of 2d vorticity gradientgrad_div_mag_q ::
grad_div_mag_q[out] Magnitude of divergence gradient atvert_vort_mag_smooth ::
vert_vort_mag_smooth[out] Magnitude of gradient of smootheddel2vort_q :: [out] Laplacian of vorticity at q-points
- Call to:
- Called from:
- subroutine mom_hor_visc/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 CSEY24_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 ::
use_kh_struct[in] If true, shape the backscatter coefficient with VarMixBS_structnkk ::
nkk[in] The k-block size used to size the following arrays [nondim]ksb ::
ksb[in] The first domain k-index of the current k-blockkke ::
kke[in] The in-block k-index upper bound of the current k-blockisq :: [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 ::
visc_limit_h_flag[in] determines whether backscatter is shut off [nondim]sh_xx ::
sh_xx[in] horizontal tension (du/dx - dv/dy) includingstr_xx ::
str_xx[inout] The diagonal term in the stress tensorbs_coeff_h :: [inout] A diagnostic array of the backscatter
- Called from:
- subroutine mom_hor_visc/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 CSEY24_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 ::
use_kh_struct[in] If true, shape the backscatter coefficient with VarMixBS_structnkk ::
nkk[in] The k-block size used to size the following arrays [nondim]ksb ::
ksb[in] The first domain k-index of the current k-blockkke ::
kke[in] The in-block k-index upper bound of the current k-blockis ::
is[in] Start i-loop index for the q-point stress tensorjs ::
js[in] Start j-loop index for the q-point stress tensorieq :: [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 ::
visc_limit_q_flag[in] determines whether backscatter is shut off [nondim]sh_xy ::
sh_xy[in] horizontal shearing strain (du/dy + dv/dx) includingstr_xy ::
str_xy[inout] The cross term in the stress tensorbs_coeff_q :: [inout] A diagnostic array of the backscatter
- Called from:
- subroutine mom_hor_visc/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 CSuse_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 ::
nkk[in] The k-block size used to size the following arrays [nondim]ksb ::
ksb[in] The first domain k-index of the current k-blockkke ::
kke[in] The in-block k-index upper bound of the current k-blockis_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 ::
vert_vort_mag[in] Magnitude of the vertical vorticityvert_vort_mag_smooth ::
vert_vort_mag_smooth[in] Magnitude of gradient of smoothedvort_xy_smooth ::
vort_xy_smooth[in] Vertical vorticity including metricah :: [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 ::
m_leithy[out] Kh=m_leithy*Ah in Leith+E parameterization [L-2 ~> m-2]zc ::
zc[in] Depth at center of h cell [Z ~> m]
- Call to:
- Called from:
- subroutine mom_hor_visc/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 (CSuse_GME) is active. The caller must only invoke this routine when CSuse_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 ::
h[inout] Layer thicknesses [H ~> m or kg m-2].bt :: [in] Barotropic control structure
td :: [in] Thickness diffusion control structure
nkk ::
nkk[in] The k-block size used to size the following arrays [nondim]dudx_bt ::
dudx_bt[out] x-component in the barotropicdvdy_bt ::
dvdy_bt[out] y-component in the barotropicdvdx_bt ::
dvdx_bt[out] x-component in the barotropicdudy_bt ::
dudy_bt[out] y-component in the barotropicsh_xx_bt ::
sh_xx_bt[out] Barotropic horizontal tensionsh_xy_bt ::
sh_xy_bt[out] Barotropic horizontal shearing straingme_effic_h :: [out] The filtered efficiency of the
gme_effic_q :: [out] The filtered efficiency of the
kh_u_gme :: [out] Isopycnal height diffusivities in
kh_v_gme :: [out] Isopycnal height diffusivities in
gme_coeff_h :: [out] GME coefficient at h-points
gme_coeff_q :: [out] GME coeff. at q-points [L2 T-1 ~> m2 s-1]
str_xx_gme :: [out] Smoothed diagonal term in the
str_xy_gme :: [out] Smoothed cross term in the
- Call to:
mom_barotropic::barotropic_get_tavmom_thickness_diffuse::thickness_diffuse_get_kh- Called from:
- subroutine mom_hor_visc/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 ::
param_file[in] A structure to parse for run-time parameters.diag ::
diag[inout] Structure to regulate diagnostic output.cs :: [inout] Horizontal viscosity control structure
adp :: [in] Acceleration diagnostics
- Call to:
align_aniso_tensor_to_gridmom_error_handler::mom_errorsum_5x5- Called from:
mom_dynamics_split_rk2::initialize_dyn_split_rk2mom_dynamics_split_rk2b::initialize_dyn_split_rk2bmom_dynamics_unsplit::initialize_dyn_unsplitmom_dynamics_unsplit_rk2::initialize_dyn_unsplit_rk2
- function mom_hor_visc/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 ::
zc[in] depth of h-cell centers [Z ~> m]
- Called from:
- function mom_hor_visc/hor_visc_vel_stencil(CS)
hor_visc_vel_stencil returns the horizontal viscosity input velocity stencil size
- Parameters:
cs :: [in] Control structure for horizontal viscosity
- Return:
undefined :: The horizontal viscosity velocity stencil size with the current settings.
- subroutine mom_hor_visc/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 ::
n1[in] i-component of direction vector [nondim]n2 ::
n2[in] j-component of direction vector [nondim]
- Called from:
- subroutine mom_hor_visc/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]
- Called from:
- function mom_hor_visc/sum_5x5(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 ::
x[in] 5x5 array to be summed. Assumed-shape to avoid copies. [arbitrary]- Return:
undefined :: output [same as x]
- Called from:
- subroutine mom_hor_visc/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 ::
field_h[inout] h-point field to be smoothed [arbitrary]zero_land ::
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.
- Call to:
- Called from:
- subroutine mom_hor_visc/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 ::
field_u[inout] u-point field to be smoothed [arbitrary]field_v ::
field_v[inout] v-point field to be smoothed [arbitrary]zero_land ::
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.
- Call to:
- Called from:
- subroutine mom_hor_visc/hor_visc_end(CS)
Deallocates any variables allocated in hor_visc_init.
- Parameters:
cs :: [inout] Horizontal viscosity control structure
- Called from:
mom_dynamics_split_rk2::end_dyn_split_rk2mom_dynamics_split_rk2b::end_dyn_split_rk2b