hvisc_add_aniso_coef Subroutine

private pure subroutine hvisc_add_aniso_coef(ah_t, ah_q, kh_aniso, n1n2, nx, ny, nz)

Add the Smith & McWilliams (2003) anisotropic direction-tensor coefficients onto the co-located isotropic viscosities. The tension (T-cell) coefficient gains kh_aniso·(1−n1n2²) and the shear (Bu-corner) coefficient gains kh_aniso·n1n2². For the default grid-i direction n1n2 = 0 ⇒ T gains kh_aniso, the corner gains nothing — stronger damping of along-i tension. The corner outer ring stays untouched (the divergence stencil never reads it; hvisc_avg_A_face already zeroed it).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: ah_t(nx,ny,nz)
real(kind=wp), intent(inout) :: ah_q(nx+1,ny+1,nz)
real(kind=wp), intent(in) :: kh_aniso
real(kind=wp), intent(in) :: n1n2
integer, intent(in) :: nx
integer, intent(in) :: ny
integer, intent(in) :: nz

Called by

proc~~hvisc_add_aniso_coef~~CalledByGraph proc~hvisc_add_aniso_coef hvisc_add_aniso_coef proc~ocean_horizontal_viscosity_compute_tendencies_on ocean_horizontal_viscosity_compute_tendencies_on proc~ocean_horizontal_viscosity_compute_tendencies_on->proc~hvisc_add_aniso_coef proc~ocean_horizontal_viscosity_compute_tendencies ocean_horizontal_viscosity_compute_tendencies proc~ocean_horizontal_viscosity_compute_tendencies->proc~ocean_horizontal_viscosity_compute_tendencies_on proc~run_stage run_stage proc~run_stage->proc~ocean_horizontal_viscosity_compute_tendencies proc~run_stage_split run_stage_split proc~run_stage_split->proc~ocean_horizontal_viscosity_compute_tendencies proc~ocean_dyn_step ocean_dyn_step proc~ocean_dyn_step->proc~run_stage proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_stage_split proc~engine_step engine_step proc~engine_step->proc~ocean_dyn_step proc~engine_step->proc~ocean_dyn_step_split

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: add_q
real(kind=wp), private :: add_t
integer, private :: i
integer, private :: j
integer, private :: k

Source Code

   pure subroutine hvisc_add_aniso_coef(ah_t, ah_q, kh_aniso, n1n2, nx, ny, nz)
      !! Add the Smith & McWilliams (2003) anisotropic direction-tensor
      !! coefficients onto the co-located isotropic viscosities.  The
      !! tension (T-cell) coefficient gains `kh_aniso·(1−n1n2²)` and the
      !! shear (Bu-corner) coefficient gains `kh_aniso·n1n2²`.  For the
      !! default grid-i direction `n1n2 = 0` ⇒ T gains `kh_aniso`, the
      !! corner gains nothing — stronger damping of along-i tension.
      !! The corner outer ring stays untouched (the divergence stencil
      !! never reads it; `hvisc_avg_A_face` already zeroed it).
      integer, intent(in)    :: nx, ny, nz
      real(wp), intent(inout) :: ah_t(nx, ny, nz), ah_q(nx + 1, ny + 1, nz)
      real(wp), intent(in)    :: kh_aniso, n1n2
      integer :: i, j, k
      real(wp) :: add_t, add_q
      add_t = kh_aniso*(1.0_wp - n1n2*n1n2)
      add_q = kh_aniso*(n1n2*n1n2)
      do concurrent(k=1:nz, j=1:ny, i=1:nx)
         ah_t(i, j, k) = ah_t(i, j, k) + add_t
      end do
      do concurrent(k=1:nz, j=2:ny, i=2:nx)
         ah_q(i, j, k) = ah_q(i, j, k) + add_q
      end do
   end subroutine hvisc_add_aniso_coef