subroutine ddz_uv(dfdz, f)
! first derivative in z direction for boundary layer (2nd order numerics)
use types,only:rprec
use param,only:ld,nx,ny,nz,dz
implicit none
real(kind=rprec),dimension(ld,ny,nz),intent(in)::f
real(kind=rprec),dimension(ld,ny,nz),intent(inout)::dfdz
real(kind=rprec)::const
integer::jx,jy,jz


! see derivwall
const=1._rprec/dz
do jz=2,nz-1
do jy=1,ny
do jx=1,nx    
   dfdz(jx,jy,jz)=const*(f(jx,jy,jz)-f(jx,jy,jz-1))
end do
end do
end do
dfdz(:,:,nz)=0._rprec
end subroutine ddz_uv
