pure subroutine fill_transport_x_impl(h_layer, u_face, buf)
! assumed-shape-ok: diag fill — fires once per output frame (cadence-bounded).
real(wp), intent(in) :: h_layer(:, :, :), u_face(:, :, :)
real(wp), intent(inout) :: buf(:, :, :) ! assumed-shape-ok: diag fill — cadence-bounded
integer :: i, j, k, nx, ny, nz
real(wp) :: u_c, col
nx = min(size(buf, 1), size(u_face, 1) - 1)
ny = min(size(buf, 2), size(u_face, 2))
nz = min(size(u_face, 3), size(h_layer, 3))
do concurrent(j=1:ny, i=1:nx) &
local(u_c, col, k)
col = 0.0_wp
do k = 1, nz
u_c = 0.5_wp*(u_face(i, j, k) + u_face(i + 1, j, k))
col = col + h_layer(i, j, k)*u_c
end do
buf(i, j, 1) = col
end do
end subroutine fill_transport_x_impl