      SUBROUTINE gradiv2_p(klevel, xcov, ycov, ld, gdx, gdy )
c
c     P. Le Van
c
c   **********************************************************
c                                ld
c       calcul  de  (grad (div) )   du vect. v ....
c
c     xcov et ycov etant les composant.covariantes de v
c   **********************************************************
c     xcont , ycont et ld  sont des arguments  d'entree pour le s-prog
c      gdx   et  gdy       sont des arguments de sortie pour le s-prog
c
c
      USE parallel
      USE times
      USE Write_field_p
      IMPLICIT NONE
c
#include "dimensions.h"
#include "paramet.h"
#include "comgeom.h"
#include "comdissipn.h"
c
c     ........    variables en arguments      ........

      INTEGER klevel
      REAL  xcov( ip1jmp1,klevel ), ycov( ip1jm,klevel )
      REAL   gdx( ip1jmp1,klevel ),  gdy( ip1jm,klevel )
c
c     ........       variables locales       .........
c
      REAL div(ip1jmp1,llm)
      REAL signe, nugrads
      INTEGER l,ij,iter,ld
      INTEGER :: ijb,ije,jjb,jje
      
c    ........................................................
c
      EXTERNAL   SCOPY, divergf, grad, laplacien_gam, filtreg
c
c      CALL SCOPY( ip1jmp1 * klevel, xcov, 1, gdx, 1 )
c      CALL SCOPY(   ip1jm * klevel, ycov, 1, gdy, 1 )
      
      ijb=ij_begin
      ije=ij_end
      gdx(ijb:ije,1:klevel)=xcov(ijb:ije,1:klevel)

      
      ijb=ij_begin
      ije=ij_end
      if(pole_sud) ije=ij_end-iip1
      gdy(ijb:ije,1:klevel)=ycov(ijb:ije,1:klevel)
      
      call suspend_timer(timer_dissip)
      call exchange_Hallo(gdy,ip1jm,llm,1,0)
      call resume_timer(timer_dissip)
c
c
      signe   = (-1.)**ld
      nugrads = signe * cdivu
c


      CALL    divergf_p( klevel, gdx,   gdy , div )
c      call write_field3d_p('div1',reshape(div,(/iip1,jjp1,llm/)))

      IF( ld.GT.1 )   THEN
        
	call suspend_timer(timer_dissip)
        call exchange_Hallo(div,ip1jmp1,llm,1,1)
        call resume_timer(timer_dissip)
        
	CALL laplacien_p ( klevel, div,  div     )

c    ......  Iteration de l'operateur laplacien_gam   .......
c         call write_field3d_p('div2',reshape(div,(/iip1,jjp1,llm/)))

        DO iter = 1, ld -2
	 call suspend_timer(timer_dissip)
         call exchange_Hallo(div,ip1jmp1,llm,1,1)
	 call resume_timer(timer_dissip)
         CALL laplacien_gam ( klevel,cuvscvgam1,cvuscugam1,unsair_gam1,
     *                       unsapolnga1, unsapolsga1,  div, div       )
        ENDDO
c        call write_field3d_p('div3',reshape(div,(/iip1,jjp1,llm/)))
      ENDIF

       jjb=jj_begin
       jje=jj_end
       
       CALL filtreg_p( div   ,jjb,jje, jjp1, klevel, 2, 1, .TRUE., 1 )
c       call exchange_Hallo(div,ip1jmp1,llm,0,1)
        
	call suspend_timer(timer_dissip)
	call exchange_Hallo(div,ip1jmp1,llm,1,1)
        call resume_timer(timer_dissip)

c       call write_field3d_p('div4',reshape(div,(/iip1,jjp1,llm/)))
       CALL  grad_p  ( klevel,  div,   gdx,  gdy             )

c
      ijb=ij_begin
      ije=ij_end
         
      
       DO   l = 1, klevel
         
         if (pole_sud) ije=ij_end
         DO  ij = ijb, ije
          gdx( ij,l ) = gdx( ij,l ) * nugrads
         ENDDO
         
         if (pole_sud) ije=ij_end-iip1
         DO  ij = ijb, ije
          gdy( ij,l ) = gdy( ij,l ) * nugrads
         ENDDO
       
       ENDDO
c
       RETURN
       END
