hvisc_kh_cfl_bound Function

private pure function hvisc_kh_cfl_bound(idx, idy, bound_coef, idt) result(kh_max_cfl)

Per-face harmonic-viscosity ceiling for the velocity-Laplacian paths (MOM6 Kh_Max_xx analogue, uniform-grid reduction): ν_max = bound_coef · 0.125 / (dt · (idx² + idy²)) — one quarter of the forward-Euler stability limit ν·dt·4·(idx²+idy²) ≤ 2, the same margin MOM6’s harmonic bound uses (“avoid overshoots when bound_coef < 1”). Keeps the FROZEN depth-mean viscous forcing on the barotropic mode (F_bt) out of the phase-reversed anti-damping regime for grid-scale gravity modes (see the bound_kh docstring). Returns huge (no clamp) for a fully-masked face. !$acc routine seq — called from the Laplacian do concurrent.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: idx

Metric inverses 1/dx, 1/dy at the face.

real(kind=wp), intent(in) :: idy

Metric inverses 1/dx, 1/dy at the face.

real(kind=wp), intent(in) :: bound_coef

CFL safety coefficient (this%bound_coef).

real(kind=wp), intent(in) :: idt

Reciprocal time step 1/dt.

Return Value real(kind=wp)


Called by

proc~~hvisc_kh_cfl_bound~~CalledByGraph proc~hvisc_kh_cfl_bound hvisc_kh_cfl_bound proc~hvisc_compute_face_impl hvisc_compute_face_impl proc~hvisc_compute_face_impl->proc~hvisc_kh_cfl_bound proc~hvisc_compute_scalar_impl hvisc_compute_scalar_impl proc~hvisc_compute_scalar_impl->proc~hvisc_kh_cfl_bound proc~ocean_horizontal_viscosity_compute_tendencies_on ocean_horizontal_viscosity_compute_tendencies_on proc~ocean_horizontal_viscosity_compute_tendencies_on->proc~hvisc_compute_face_impl proc~ocean_horizontal_viscosity_compute_tendencies_on->proc~hvisc_compute_scalar_impl 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

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: k2

Source Code

   pure function hvisc_kh_cfl_bound(idx, idy, bound_coef, idt) result(kh_max_cfl)
      !! Per-face harmonic-viscosity ceiling for the velocity-Laplacian
      !! paths (MOM6 `Kh_Max_xx` analogue, uniform-grid reduction):
      !!     `ν_max = bound_coef · 0.125 / (dt · (idx² + idy²))`
      !! — one quarter of the forward-Euler stability limit
      !! `ν·dt·4·(idx²+idy²) ≤ 2`, the same margin MOM6's harmonic
      !! bound uses ("avoid overshoots when bound_coef < 1").  Keeps
      !! the FROZEN depth-mean viscous forcing on the barotropic mode
      !! (`F_bt`) out of the phase-reversed anti-damping regime for
      !! grid-scale gravity modes (see the `bound_kh` docstring).
      !! Returns huge (no clamp) for a fully-masked face.
      !! `!$acc routine seq` — called from the Laplacian `do concurrent`.
      real(wp), intent(in) :: idx, idy
         !! Metric inverses `1/dx`, `1/dy` at the face.
      real(wp), intent(in) :: bound_coef
         !! CFL safety coefficient (`this%bound_coef`).
      real(wp), intent(in) :: idt
         !! Reciprocal time step `1/dt`.
      real(wp) :: kh_max_cfl
      real(wp) :: k2
      !$acc routine seq
      k2 = idx*idx + idy*idy
      if (k2 > 0.0_wp) then
         kh_max_cfl = bound_coef*0.125_wp*idt/k2
      else
         kh_max_cfl = huge(1.0_wp)
      end if
   end function hvisc_kh_cfl_bound