subroutine p_surf_update_seam_impl(nx, ny, i_rho0_g, p_surf, &
eta_ib, eta_seam, use_tide, eta_tide)
!! Flat-impl device fill (explicit-shape dummies — no descriptor walk).
!! `eta_ib(i,j) = -p_surf(i,j)*i_rho0_g` and
!! `eta_seam(i,j) = eta_ib(i,j) [+ eta_tide(i,j)]`. Loop-invariant
!! `use_tide` branch kept INSIDE the single `do concurrent` (one
!! launch, uniform branch is ~free). Contiguous index (i) innermost.
integer, intent(in) :: nx, ny
real(wp), intent(in) :: i_rho0_g
real(wp), intent(in) :: p_surf(nx, ny)
real(wp), intent(out) :: eta_ib(nx, ny)
real(wp), intent(out) :: eta_seam(nx, ny)
logical, intent(in) :: use_tide
real(wp), intent(in), optional :: eta_tide(nx, ny)
integer :: i, j
do concurrent(j=1:ny, i=1:nx)
eta_ib(i, j) = -p_surf(i, j)*i_rho0_g
if (use_tide) then
eta_seam(i, j) = eta_ib(i, j) + eta_tide(i, j)
else
eta_seam(i, j) = eta_ib(i, j)
end if
end do
end subroutine p_surf_update_seam_impl