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).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | s | |||
| real(kind=wp), | intent(in) | :: | smax |
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