hk_pair_coef Function

private pure function hk_pair_coef(q1, h1, q2, h2, q3, h3, h_ref) result(coef)

One Arakawa-Hsu pair coefficient (q1 + q2 + q3)/12 with each PV re-evaluated at a corner thickness of at least h_ref/2: q → q·h_X/(h_ref/2) where h_X < h_ref/2, q unchanged otherwise (so an inactive floor returns the unfloored sum bit for bit). h_ref is the larger thickness of the pair’s u- and v-face.

The bound is the one sadourny_energy satisfies by construction: there each corner PV multiplies only transports through faces whose two cells both sit inside that corner’s 4-cell mean, so h_corner >= h_face/2 (equal areas) and q·vh <= 2·|f+ζ|·|v|·dx. The HK stencil also pairs a corner with a transport whose far cell lies OUTSIDE it, and there h_face/h_corner is unbounded. Because h_ref belongs to the PAIR, the u-tendency’s coefficient on vh_V and the v-tendency’s on uh_U stay equal (energy antisymmetry).

Arguments

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

The three corner PVs and the corner thicknesses they carry.

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

The three corner PVs and the corner thicknesses they carry.

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

The three corner PVs and the corner thicknesses they carry.

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

The three corner PVs and the corner thicknesses they carry.

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

The three corner PVs and the corner thicknesses they carry.

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

The three corner PVs and the corner thicknesses they carry.

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

max(h_U, h_V) of the pair’s two faces (m).

Return Value real(kind=wp)


Called by

proc~~hk_pair_coef~~CalledByGraph proc~hk_pair_coef hk_pair_coef proc~coriolis_adv_compute_tendencies_hk coriolis_adv_compute_tendencies_hk proc~coriolis_adv_compute_tendencies_hk->proc~hk_pair_coef 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, parameter :: C1_12 = 1.0_wp/12.0_wp
real(kind=wp), private :: hh
real(kind=wp), private :: p1
real(kind=wp), private :: p2
real(kind=wp), private :: p3

Source Code

   pure function hk_pair_coef(q1, h1, q2, h2, q3, h3, h_ref) result(coef)
      !$acc routine seq
      !! One Arakawa-Hsu pair coefficient `(q1 + q2 + q3)/12` with each PV
      !! re-evaluated at a corner thickness of at least `h_ref/2`:
      !! `q → q·h_X/(h_ref/2)` where `h_X < h_ref/2`, `q` unchanged
      !! otherwise (so an inactive floor returns the unfloored sum bit for
      !! bit).  `h_ref` is the larger thickness of the pair's u- and v-face.
      !!
      !! The bound is the one `sadourny_energy` satisfies by construction:
      !! there each corner PV multiplies only transports through faces whose
      !! two cells both sit inside that corner's 4-cell mean, so
      !! `h_corner >= h_face/2` (equal areas) and `q·vh <= 2·|f+ζ|·|v|·dx`.
      !! The HK stencil also pairs a corner with a transport whose far cell
      !! lies OUTSIDE it, and there `h_face/h_corner` is unbounded.  Because
      !! `h_ref` belongs to the PAIR, the u-tendency's coefficient on `vh_V`
      !! and the v-tendency's on `uh_U` stay equal (energy antisymmetry).
      real(wp), intent(in) :: q1, h1, q2, h2, q3, h3
         !! The three corner PVs and the corner thicknesses they carry.
      real(wp), intent(in) :: h_ref
         !! `max(h_U, h_V)` of the pair's two faces (m).
      real(wp) :: coef
      real(wp), parameter :: C1_12 = 1.0_wp/12.0_wp
      real(wp) :: hh, p1, p2, p3
      hh = 0.5_wp*h_ref
      p1 = q1
      p2 = q2
      p3 = q3
      if (h1 < hh) p1 = q1*(h1/hh)
      if (h2 < hh) p2 = q2*(h2/hh)
      if (h3 < hh) p3 = q3*(h3/hh)
      coef = (p1 + p2 + p3)*C1_12
   end function hk_pair_coef