face_thick Function

public pure function face_thick(h_a, h_b, use_harmonic) result(dz)

Public only for the unit-test suite (no production module imports it); ignore when developing production code in other modules. Face-thickness for the vdiff implicit operator.

When use_harmonic = .false. (default): arithmetic mean 0.5 · (h_a + h_b). Standard MOM6 / ROMS behaviour.

When use_harmonic = .true.: harmonic mean 2 · h_a · h_b / max(h_a + h_b, eps). Better-conditioned when one of h_a, h_b is small — arithmetic mean is dominated by the thicker neighbour, generating stiff tridiagonal coefficients at thin/vanishing layers. Equivalent to arithmetic when h_a = h_b.

Marked pure + !$acc routine seq so NVHPC can inline the body into the do concurrent callers without descriptor marshalling.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: h_a
real(kind=wp), intent(in) :: h_b
logical, intent(in) :: use_harmonic

Return Value real(kind=wp)


Called by

proc~~face_thick~~CalledByGraph proc~face_thick face_thick proc~build_factorize_tracer_matrix build_factorize_tracer_matrix proc~build_factorize_tracer_matrix->proc~face_thick proc~diffuse_velocity_columns_impl diffuse_velocity_columns_impl proc~diffuse_velocity_columns_impl->proc~face_thick proc~vdiff_apply_momentum vdiff_apply_momentum proc~vdiff_apply_momentum->proc~diffuse_velocity_columns_impl proc~vdiff_apply_tracers vdiff_apply_tracers proc~vdiff_apply_tracers->proc~build_factorize_tracer_matrix proc~visc_rem_precompute visc_rem_precompute proc~visc_rem_precompute->proc~vdiff_apply_momentum proc~vmix_apply_in_stage vmix_apply_in_stage proc~vmix_apply_in_stage->proc~vdiff_apply_momentum proc~vmix_apply_in_stage->proc~vdiff_apply_tracers proc~vmix_apply_in_stage->proc~visc_rem_precompute proc~run_stage run_stage proc~run_stage->proc~vmix_apply_in_stage proc~run_stage_split run_stage_split proc~run_stage_split->proc~visc_rem_precompute proc~run_stage_split->proc~vmix_apply_in_stage 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, parameter :: EPS = 1.0e-30_wp
real(kind=wp), private :: sum_h

Source Code

   pure function face_thick(h_a, h_b, use_harmonic) result(dz)
      !! Public only for the unit-test suite (no production module imports it);
      !! ignore when developing production code in other modules.
      !! Face-thickness for the vdiff implicit operator.
      !!
      !! When `use_harmonic = .false.` (default): arithmetic mean
      !! `0.5 · (h_a + h_b)`.  Standard MOM6 / ROMS behaviour.
      !!
      !! When `use_harmonic = .true.`: harmonic mean
      !! `2 · h_a · h_b / max(h_a + h_b, eps)`.  Better-conditioned
      !! when one of `h_a`, `h_b` is small — arithmetic mean is
      !! dominated by the thicker neighbour, generating stiff
      !! tridiagonal coefficients at thin/vanishing layers.
      !! Equivalent to arithmetic when `h_a = h_b`.
      !!
      !! Marked `pure` + `!$acc routine seq` so NVHPC can inline the
      !! body into the `do concurrent` callers without descriptor
      !! marshalling.
      !$acc routine seq
      real(wp), intent(in) :: h_a, h_b
      logical, intent(in) :: use_harmonic
      real(wp) :: dz
      real(wp), parameter :: EPS = 1.0e-30_wp
      real(wp) :: sum_h
      if (use_harmonic) then
         sum_h = h_a + h_b
         if (sum_h > EPS) then
            dz = 2.0_wp*h_a*h_b/sum_h
         else
            dz = 0.5_wp*sum_h
         end if
      else
         dz = 0.5_wp*(h_a + h_b)
      end if
   end function face_thick