      subroutine wallstress2(txz,tyz,u,v,zo,u_avg,psi_m)

      include 'dimen.h'
      integer jx,jy
      real*8 txz(ld,ny,nz),tyz(ld,ny,nz),u(ld,ny,nz),v(ld,ny,nz),
     &  zo(nx,ny),u_avg(nx,ny),denom(nx,ny),ustar(nx,ny),psi_m(nx,ny),
     &  u_aver(nx,ny),u1(ld,ny),v1(ld,ny)
     

       double precision, dimension(lh,ny) :: G_test, G_test_test
       common /test_filters/ G_test, G_test_test

       real*8 const
 
        u1=u(:,:,1)
        v1=v(:,:,1)

        call test_filter(u1,G_test)
        call test_filter(v1,G_test)

        denom=dlog(0.5*dz/zo)-psi_m
	do jx=1,nx
	do jy=1,ny
 	u_avg(jx,jy)=sqrt(u1(jx,jy)**2+v1(jx,jy)**2)
	end do
	end do
	


        ustar=u_avg*vonK/denom

        do jy=1,ny
         do jx=1,nx
          const=-(ustar(jx,jy)**2)/u_avg(jx,jy)
          txz(jx,jy,1)=const*u1(jx,jy)
          tyz(jx,jy,1)=const*v1(jx,jy)
         end do
        end do
     
      return    
      end
