gm_clamp_slope Function

private pure function gm_clamp_slope(s, smax) result(sc)

Clamp a slope to +/- smax (bounded slope for the PE release). A non-finite slope reads as 0 (no release) rather than being laundered into ±smax by the NaN-blind clamp (CLAUDE.md).

Arguments

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

Return Value real(kind=wp)


Called by

proc~~gm_clamp_slope~~CalledByGraph proc~gm_clamp_slope gm_clamp_slope proc~gm_pe_release gm_pe_release proc~gm_pe_release->proc~gm_clamp_slope proc~gm_compute_impl gm_compute_impl proc~gm_compute_impl->proc~gm_pe_release proc~gm_compute_transports gm_compute_transports proc~gm_compute_transports->proc~gm_compute_impl proc~run_gm_step run_gm_step proc~run_gm_step->proc~gm_compute_transports proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_gm_step

Source Code

   pure function gm_clamp_slope(s, smax) result(sc)
      !$acc routine seq
      !! Clamp a slope to +/- smax (bounded slope for the PE release).
      !! A non-finite slope reads as 0 (no release) rather than being
      !! laundered into `±smax` by the NaN-blind clamp (CLAUDE.md).
      real(wp), intent(in) :: s, smax
      real(wp) :: sc
      sc = s
      if (.not. ieee_is_finite(sc)) sc = 0.0_wp
      if (sc > smax) sc = smax
      if (sc < -smax) sc = -smax
   end function gm_clamp_slope