pure subroutine relax_map_u_impl(u, u_ref, idamp_u, nxu, ny, nz, dt)
!! Relax `u_face_x_layer` toward `u_ref` at rate `idamp_u`. Explicit-
!! shape dummies, dims declared first (decl-order hook). `idamp_u(i,j)
!! <= 0` is a bit-exact no-op (Idamp = 0 IS the sponge mask; also
!! guarantees `sponge_idamp_zero_is_exact_identity`, since `decay =
!! exp(-0*dt) = 1.0` exactly would already be a no-op algebraically —
!! the early `if` skips the arithmetic entirely instead of relying on
!! that).
integer, intent(in) :: nxu, ny, nz
real(wp), intent(inout) :: u(nxu, ny, nz)
real(wp), intent(in) :: u_ref(nxu, ny, nz)
real(wp), intent(in) :: idamp_u(nxu, ny)
real(wp), intent(in) :: dt
integer :: i, j, k
real(wp) :: decay
do concurrent(k=1:nz, j=1:ny, i=1:nxu) local(decay)
if (idamp_u(i, j) > 0.0_wp) then
decay = exp(-idamp_u(i, j)*dt)
u(i, j, k) = relax_toward(u(i, j, k), u_ref(i, j, k), decay)
end if
end do
end subroutine relax_map_u_impl