   !!======================================================================
 
  SUBROUTINE init_uv(u,v,uz,vz)
 
   !&E---------------------------------------------------------------------
   !&E                 ***  ROUTINE init_uv  ***
   !&E
   !&E ** Purpose : initialize barotropic velocities :
   !&E              u : zonal component
   !&E              v : meridional component
   !&E
   !&E ** Description :
   !&E
   !&E ** Called by : main
   !&E
   !&E ** External calls : 
   !&E
   !&E ** Used ij-arrays : uz, vz
   !&E
   !&E ** Modified variables : u, v
   !&E
   !&E ** Reference :
   !&E
   !&E ** History :
   !&E       ! 2004-08-17  last modifications
   !&E
   !&E---------------------------------------------------------------------

#include "toolcpp.h"

   !! * Modules used
   USE parameters
   USE comvars2d, ONLY : hex,hey
   USE comvars3d
#if defined key_siggen || defined key_gencoord
   USE comsiggen,    ONLY : hzex,hzey
#endif
   USE_MPI toolmpi,       ONLY : ex_i_rsh,ex_j_rsh

   IMPLICIT NONE

   !! * Arguments
   REAL(kind=rsh),DIMENSION(kmax,liminm2:limaxp2,ljminm2:ljmaxp2),INTENT(in ) :: uz,vz
   REAL(kind=rsh),DIMENSION(     liminm2:limaxp2,ljminm2:ljmaxp2),INTENT(out) :: u,v

   !! * Local declarations
   INTEGER :: i,j
   !!----------------------------------------------------------------------
   !! * Executable part

!$OMP parallel do schedule(static) private(i,j)
   DO j=ljmin,ljmax
     DO i=limin,limax
#if defined key_siggen || defined key_gencoord
       IF (hex(i,j)/=0.0_rsh) u(i,j)=SUM(uz(:,i,j)*hzex(:,i,j)*dsigu(:))/hex(i,j)
       IF (hey(i,j)/=0.0_rsh) v(i,j)=SUM(vz(:,i,j)*hzey(:,i,j)*dsigu(:))/hey(i,j)
#else
       u(i,j)=SUM(dsigu(:)*uz(:,i,j))
       v(i,j)=SUM(dsigu(:)*vz(:,i,j))
#endif
     END DO
   END DO
!$OMP end parallel do

   CALL_MPI ex_i_rsh(-2,2,1,liminm2,limaxp2,ljminm2,ljmaxp2,u(liminm2:limaxp2,ljminm2:ljmaxp2))
   CALL_MPI ex_j_rsh(-2,2,1,liminm2,limaxp2,ljminm2,ljmaxp2,u(liminm2:limaxp2,ljminm2:ljmaxp2))
   CALL_MPI ex_i_rsh(-2,2,1,liminm2,limaxp2,ljminm2,ljmaxp2,v(liminm2:limaxp2,ljminm2:ljmaxp2))
   CALL_MPI ex_j_rsh(-2,2,1,liminm2,limaxp2,ljminm2,ljmaxp2,v(liminm2:limaxp2,ljminm2:ljmaxp2))

   END SUBROUTINE init_uv
