subroutine divstress_uv (divt, tx, ty, tz)
use types,only:rprec
use param,only:ld,ny,nz
implicit none
real(kind=rprec),dimension(ld,ny,nz),intent(out)::divt
real(kind=rprec),dimension(ld,ny,nz),intent(in)::tx,ty,tz
! sc: we should be able to save some memory here!
! do this by writing a divergence subroutine--then don't store deriv's 
real(kind=rprec),dimension(ld,ny,nz)::dtxdx,dtydy, dtzdz
! compute stress gradients      
call ddx(dtxdx, tx)
call ddy(dtydy, ty)
call ddz_w(dtzdz, tz)
! the following gives bas results...but it seems like i the
! issue should be taken care of somewhere
! need to correct wall level, since tz will be on uv-node there
!      dtzdz(:,:,1) = (tz(:,:,2)-tz(:,:,1))/(0.5*dz)
divt=dtxdx+dtydy+dtzdz
end subroutine divstress_uv
