hvisc_nu4_cfl_bound Function

private pure function hvisc_nu4_cfl_bound(idx, idy, bound_coef, idt) result(nu4_max_cfl)

Per-face explicit-biharmonic CFL ceiling on the biharmonic viscosity ν₄ (m⁴/s). Forward-Euler stability for −ν₄·∇⁴u on a local cell of spacing (dx, dy) requires (established project constant) ν₄ · dt · ((π/dx)² + (π/dy)²)² ≤ 2, so the per-face bound is ν₄_max = bound_coef · 2 / (dt · ((π·idx)² + (π·idy)²)²) where idx = 1/dx, idy = 1/dy are the metric inverses at the face (idxCu/idyCu at u-faces, idxCv/idyCv at v-faces). bound_coef (MOM6 HORVISC_BOUND_COEF, default 0.8) is the CFL safety margin shared with the harmonic hvisc_clamp_A. Returns a huge value (no clamp) when the metric inverses are both zero (a fully-masked land face) so the caller’s min leaves the coefficient untouched there. !$acc routine seq — called from the biharmonic 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_nu4_cfl_bound~~CalledByGraph proc~hvisc_nu4_cfl_bound hvisc_nu4_cfl_bound proc~hvisc_compute_biharmonic_face_impl hvisc_compute_biharmonic_face_impl proc~hvisc_compute_biharmonic_face_impl->proc~hvisc_nu4_cfl_bound proc~hvisc_compute_biharmonic_impl hvisc_compute_biharmonic_impl proc~hvisc_compute_biharmonic_impl->proc~hvisc_nu4_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_biharmonic_face_impl proc~ocean_horizontal_viscosity_compute_tendencies_on->proc~hvisc_compute_biharmonic_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_nu4_cfl_bound(idx, idy, bound_coef, idt) result(nu4_max_cfl)
      !! Per-face explicit-biharmonic CFL ceiling on the biharmonic
      !! viscosity `ν₄` (m⁴/s).  Forward-Euler stability for `−ν₄·∇⁴u`
      !! on a local cell of spacing `(dx, dy)` requires (established
      !! project constant)
      !!     `ν₄ · dt · ((π/dx)² + (π/dy)²)² ≤ 2`,
      !! so the per-face bound is
      !!     `ν₄_max = bound_coef · 2 / (dt · ((π·idx)² + (π·idy)²)²)`
      !! where `idx = 1/dx`, `idy = 1/dy` are the metric inverses at the
      !! face (`idxCu`/`idyCu` at u-faces, `idxCv`/`idyCv` at v-faces).
      !! `bound_coef` (MOM6 `HORVISC_BOUND_COEF`, default 0.8) is the
      !! CFL safety margin shared with the harmonic `hvisc_clamp_A`.
      !! Returns a huge value (no clamp) when the metric inverses are
      !! both zero (a fully-masked land face) so the caller's `min`
      !! leaves the coefficient untouched there.
      !! `!$acc routine seq` — called from the biharmonic `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) :: nu4_max_cfl
      real(wp) :: k2
      !$acc routine seq
      k2 = (PI*idx)*(PI*idx) + (PI*idy)*(PI*idy)
      if (k2 > 0.0_wp) then
         nu4_max_cfl = bound_coef*2.0_wp*idt/(k2*k2)
      else
         nu4_max_cfl = huge(1.0_wp)
      end if
   end function hvisc_nu4_cfl_bound