hk_corner_h Function

private pure function hk_corner_h(ic, jc, k, nx, ny, nz, h, wet_T, areaT) result(hc)

Corner thickness of the HK PV, recomputed with EXACTLY the Pass 2 formula of coriolis_adv_compute_tendencies_hk (wet-area-weighted 4-cell mean, array-edge clamps, CORIOLIS_H_MIN_PV floor), so the closed-face branch knows the h_corner each stored q was divided by without a persistent buffer.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: ic
integer, intent(in) :: jc
integer, intent(in) :: k
integer, intent(in) :: nx
integer, intent(in) :: ny
integer, intent(in) :: nz
real(kind=wp), intent(in) :: h(nx,ny,nz)
real(kind=wp), intent(in) :: wet_T(nx,ny)
real(kind=wp), intent(in) :: areaT(nx,ny)

Return Value real(kind=wp)


Called by

proc~~hk_corner_h~~CalledByGraph proc~hk_corner_h hk_corner_h proc~coriolis_adv_compute_tendencies_hk coriolis_adv_compute_tendencies_hk proc~coriolis_adv_compute_tendencies_hk->proc~hk_corner_h proc~coriolis_adv_compute_tendencies coriolis_adv_compute_tendencies proc~coriolis_adv_compute_tendencies->proc~coriolis_adv_compute_tendencies_hk proc~run_stage run_stage proc~run_stage->proc~coriolis_adv_compute_tendencies proc~run_stage_split run_stage_split proc~run_stage_split->proc~coriolis_adv_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 :: aNE
real(kind=wp), private :: aNW
real(kind=wp), private :: aSE
real(kind=wp), private :: aSW
real(kind=wp), private :: hm_den
real(kind=wp), private :: hm_num
integer, private :: ie
integer, private :: iw
integer, private :: jn
integer, private :: js

Source Code

   pure function hk_corner_h(ic, jc, k, nx, ny, nz, h, wet_T, areaT) result(hc)
      !$acc routine seq
      !! Corner thickness of the HK PV, recomputed with EXACTLY the Pass 2
      !! formula of `coriolis_adv_compute_tendencies_hk` (wet-area-weighted
      !! 4-cell mean, array-edge clamps, `CORIOLIS_H_MIN_PV` floor), so the
      !! closed-face branch knows the `h_corner` each stored `q` was divided
      !! by without a persistent buffer.
      integer, intent(in) :: ic, jc, k, nx, ny, nz
      real(wp), intent(in) :: h(nx, ny, nz)
      real(wp), intent(in) :: wet_T(nx, ny), areaT(nx, ny)
      real(wp) :: hc
      integer :: iw, ie, js, jn
      real(wp) :: aSW, aSE, aNW, aNE, hm_num, hm_den
      iw = max(1, ic - 1)
      ie = min(nx, ic)
      js = max(1, jc - 1)
      jn = min(ny, jc)
      aSW = wet_T(iw, js)*areaT(iw, js)
      aSE = wet_T(ie, js)*areaT(ie, js)
      aNW = wet_T(iw, jn)*areaT(iw, jn)
      aNE = wet_T(ie, jn)*areaT(ie, jn)
      hm_num = aSW*h(iw, js, k) + aSE*h(ie, js, k) + &
               aNW*h(iw, jn, k) + aNE*h(ie, jn, k)
      hm_den = aSW + aSE + aNW + aNE
      hc = hm_num/max(hm_den, H_DIV_EPS)
      hc = max(hc, CORIOLIS_H_MIN_PV)
   end function hk_corner_h