Index: codes/icosagcm/trunk/src/advect_tracer.f90
===================================================================
--- codes/icosagcm/trunk/src/advect_tracer.f90	(revision 145)
+++ codes/icosagcm/trunk/src/advect_tracer.f90	(revision 146)
@@ -40,4 +40,5 @@
     USE mpipara
     USE trace
+    USE write_field
     IMPLICIT NONE
     
@@ -55,5 +56,5 @@
     CALL trace_start("advect_tracer") 
 
-    CALL transfert_request(f_u,req_e1)
+    CALL transfert_request(f_u,req_e1_vect)
 !    CALL transfert_request(f_hfluxt,req_e1)  ! BUG : This (unnecessary) transfer makes the computation go wrong
     CALL transfert_request(f_wfluxt,req_i1)
@@ -113,7 +114,4 @@
     CALL transfert_request(f_q,req_i1)      ! necessary ?
     CALL transfert_request(f_rhodz,req_i1)  ! necessary ?
-    
-    CALL trace_end("advect_tracer")
-     
 
     ! horizontal transport - split in two to place transfer of gradq3d
@@ -141,8 +139,8 @@
        END DO
     END DO 
-
+    
     CALL transfert_request(f_q,req_i1)      ! necessary ?
     CALL transfert_request(f_rhodz,req_i1)  ! necessary ?
-
+    
     ! 1/2 vertical transport
     DO ind=1,ndomain
@@ -156,4 +154,6 @@
        END DO
     END DO
+
+    CALL trace_end("advect_tracer")
 
   END SUBROUTINE advect_tracer
Index: codes/icosagcm/trunk/src/caldyn.f90
===================================================================
--- codes/icosagcm/trunk/src/caldyn.f90	(revision 145)
+++ codes/icosagcm/trunk/src/caldyn.f90	(revision 146)
@@ -11,4 +11,5 @@
   USE icosa
   USE caldyn_gcm_mod, ONLY : init_caldyn_gcm=>init_caldyn
+  USE caldyn_gcm_opt_mod, ONLY : init_caldyn_gcm_opt=>init_caldyn
   USE caldyn_adv_mod, ONLY : init_caldyn_adv=>init_caldyn
   IMPLICIT NONE
@@ -20,4 +21,6 @@
       CASE('gcm')
         CALL init_caldyn_gcm
+      CASE('gcm_opt')
+        CALL init_caldyn_gcm_opt
       CASE('adv')
         CALL init_caldyn_adv
@@ -34,4 +37,5 @@
   USE icosa
   USE caldyn_gcm_mod, ONLY : caldyn_gcm=>caldyn
+  USE caldyn_gcm_opt_mod, ONLY : caldyn_gcm_opt=>caldyn
   USE caldyn_adv_mod, ONLY : caldyn_adv=>caldyn
   IMPLICIT NONE
@@ -52,4 +56,7 @@
         CALL caldyn_gcm(write_out,f_phis, f_ps, f_theta_rhodz, f_u, f_q, &
              f_hflux, f_wflux, f_dps, f_dtheta_rhodz, f_du)
+      CASE('gcm_opt')
+        CALL caldyn_gcm_opt(write_out,f_phis, f_ps, f_theta_rhodz, f_u, f_q, &
+             f_hflux, f_wflux, f_dps, f_dtheta_rhodz, f_du)
       CASE('adv')
         CALL caldyn_adv(write_out,f_phis, f_ps, f_theta_rhodz, f_u, f_q, &
Index: codes/icosagcm/trunk/src/caldyn_adv.f90
===================================================================
--- codes/icosagcm/trunk/src/caldyn_adv.f90	(revision 145)
+++ codes/icosagcm/trunk/src/caldyn_adv.f90	(revision 146)
@@ -75,5 +75,5 @@
 
     CALL transfert_request(f_ps,req_i1) 
-    CALL transfert_request(f_u,req_e1)
+    CALL transfert_request(f_u,req_e1_vect)
 
     DO ind=1,ndomain
Index: codes/icosagcm/trunk/src/caldyn_gcm.f90
===================================================================
--- codes/icosagcm/trunk/src/caldyn_gcm.f90	(revision 145)
+++ codes/icosagcm/trunk/src/caldyn_gcm.f90	(revision 146)
@@ -114,5 +114,5 @@
     CALL transfert_request(f_ps,req_i1) 
     CALL transfert_request(f_theta_rhodz,req_i1) 
-    CALL transfert_request(f_u,req_e1)
+    CALL transfert_request(f_u,req_e1_vect)
 
     SELECT CASE(caldyn_conserv)
@@ -131,5 +131,5 @@
        ENDDO
 
-       CALL transfert_request(f_qu,req_e1)
+       CALL transfert_request(f_qu,req_e1_scal)
 
        DO ind=1,ndomain
@@ -419,4 +419,5 @@
       ij=(j-1)*iim+i
       wflux(ij,1)  = 0.
+      wflux(ij,llm+1)  = 0.
       ! dps/dt = -int(div flux)dz
       dps(ij)=-divm(ij,1) * g 
@@ -475,5 +476,5 @@
           ENDDO
        ENDDO
-
+       
     CASE(enstrophy) ! enstrophy-conserving TRiSK
   
Index: codes/icosagcm/trunk/src/caldyn_sw.f90
===================================================================
--- codes/icosagcm/trunk/src/caldyn_sw.f90	(revision 145)
+++ codes/icosagcm/trunk/src/caldyn_sw.f90	(revision 146)
@@ -79,5 +79,5 @@
   ENDDO
 
-  CALL create_request(field_u,req_u)
+  CALL create_request(field_u,req_u,.TRUE.)
   DO ind=1,ndomain
     DO i=ii_begin,ii_end
@@ -138,6 +138,6 @@
   
     CALL transfert_request(f_h,req_i1) 
-    CALL transfert_request(f_u,req_e1)
-    CALL transfert_request(f_u,req_e1) 
+    CALL transfert_request(f_u,req_e1_vect)
+    CALL transfert_request(f_u,req_e1_vect) 
    
 
Index: codes/icosagcm/trunk/src/caldyn_wave.f90
===================================================================
--- codes/icosagcm/trunk/src/caldyn_wave.f90	(revision 145)
+++ codes/icosagcm/trunk/src/caldyn_wave.f90	(revision 146)
@@ -58,5 +58,5 @@
   
     CALL transfert_request(f_h,req_i1) 
-    CALL transfert_request(f_u,req_e1)
+    CALL transfert_request(f_u,req_e1_vect)
     CALL transfert_request(f_u,req_e1) 
    
Index: codes/icosagcm/trunk/src/dissip_gcm.f90
===================================================================
--- codes/icosagcm/trunk/src/dissip_gcm.f90	(revision 145)
+++ codes/icosagcm/trunk/src/dissip_gcm.f90	(revision 146)
@@ -205,5 +205,5 @@
       dumax=0
       DO iter=1,nitergdiv
-        CALL transfert_request(f_u,req_e1)
+        CALL transfert_request(f_u,req_e1_vect)
         DO ind=1,ndomain
           CALL swap_dimensions(ind)
@@ -216,5 +216,5 @@
       ENDDO
 
-      CALL transfert_request(f_du,req_e1)
+      CALL transfert_request(f_du,req_e1_vect)
       
       DO ind=1,ndomain
@@ -282,5 +282,5 @@
       dumax=0
       DO iter=1,nitergrot
-        CALL transfert_request(f_u,req_e1)
+        CALL transfert_request(f_u,req_e1_vect)
         DO ind=1,ndomain
           CALL swap_dimensions(ind)
@@ -293,5 +293,5 @@
       ENDDO
 
-      CALL transfert_request(f_du,req_e1)
+      CALL transfert_request(f_du,req_e1_vect)
       
       DO ind=1,ndomain
@@ -557,5 +557,5 @@
     DO it=1,nitergdiv
         
-      CALL transfert_request(f_due,req_e1)
+      CALL transfert_request(f_due,req_e1_vect)
         
       DO ind=1,ndomain
@@ -595,5 +595,5 @@
     DO it=1,nitergrot
         
-      CALL transfert_request(f_due,req_e1)
+      CALL transfert_request(f_due,req_e1_vect)
         
       DO ind=1,ndomain
Index: codes/icosagcm/trunk/src/dissip_sw.f90
===================================================================
--- codes/icosagcm/trunk/src/dissip_sw.f90	(revision 145)
+++ codes/icosagcm/trunk/src/dissip_sw.f90	(revision 146)
@@ -48,5 +48,5 @@
     CALL allocate_field(f_u,field_u,type_real)
     CALL allocate_field(f_du,field_u,type_real)
-    CALL create_request(field_u,req_dissip)
+    CALL create_request(field_u,req_dissip,.TRUE.)
 
     DO ind=1,ndomain
Index: codes/icosagcm/trunk/src/domain.f90
===================================================================
--- codes/icosagcm/trunk/src/domain.f90	(revision 145)
+++ codes/icosagcm/trunk/src/domain.f90	(revision 146)
@@ -23,4 +23,5 @@
     INTEGER,POINTER  :: edge_assign_j(:,:,:)
     INTEGER,POINTER  :: edge_assign_pos(:,:,:)
+    INTEGER,POINTER  :: edge_assign_sign(:,:,:)
     REAL,POINTER     :: xyz(:,:,:)
     REAL,POINTER     :: neighbour(:,:,:,:)
@@ -134,4 +135,5 @@
           ALLOCATE(d%edge_assign_j(0:5,d%iim,d%jjm))
           ALLOCATE(d%edge_assign_pos(0:5,d%iim,d%jjm))
+          ALLOCATE(d%edge_assign_sign(0:5,d%iim,d%jjm))
           ALLOCATE(d%delta(d%iim,d%jjm))
           ALLOCATE(d%xyz(3,d%iim,d%jjm))
@@ -171,4 +173,5 @@
     d2%edge_assign_j => d1%edge_assign_j
     d2%edge_assign_pos => d1%edge_assign_pos
+    d2%edge_assign_sign => d1%edge_assign_sign
     d2%xyz => d1%xyz
     d2%neighbour => d1%neighbour
@@ -210,5 +213,5 @@
   IMPLICIT NONE
     INTEGER :: ind_d,ind,ind2,e
-    INTEGER :: nf
+    INTEGER :: nf,nf2
     INTEGER :: i,j,k,ii,jj
     TYPE(t_domain),POINTER :: d
@@ -257,5 +260,8 @@
             ind2=vertex_glo(ii,jj,nf)%neighbour(k)
             d%neighbour(:,k,i,j)=cell_glo(ind2)%xyz(:)
-            d%ne(k,i,j)=vertex_glo(ii,jj,nf)%ne(k)
+
+!            d%ne(k,i,j)=vertex_glo(ii,jj,nf)%ne(k)
+            d%ne(k,i,j)=1-2*MOD(k,2)
+
             e=cell_glo(ind)%edge(MOD(k+delta+6,6))
             d%edge_assign_domain(k,i,j)=edge_glo(e)%assign_domain
@@ -263,4 +269,10 @@
             d%edge_assign_j(k,i,j)=edge_glo(e)%assign_j
             d%edge_assign_pos(k,i,j)=edge_glo(e)%assign_pos
+            nf2=domain_glo(edge_glo(e)%assign_domain)%face
+            d%edge_assign_sign(k,i,j)=1-2*MOD(12+tab_index(nf,nf2,0),2)
+            IF (MOD(6+k+tab_index(nf,nf2,0),6)/=edge_glo(e)%assign_pos .AND. MOD(6+k+tab_index(nf,nf2,0),6) /= MOD(edge_glo(e)%assign_pos+3,6)) THEN
+              d%edge_assign_sign(k,i,j)=-d%edge_assign_sign(k,i,j)
+            ENDIF
+             
           ENDDO
           d%xyz(:,i,j)=cell_glo(ind)%xyz(:)
@@ -284,4 +296,5 @@
       edge_glo(e)%assign_j=j
       edge_glo(e)%assign_pos=k
+      edge_glo(e)%assign_delta=delta
 !      PRINT*,"Assign_edge",ind_d,ind,i,j,k,e
      END  SUBROUTINE assign_edge
Index: codes/icosagcm/trunk/src/geometry.f90
===================================================================
--- codes/icosagcm/trunk/src/geometry.f90	(revision 145)
+++ codes/icosagcm/trunk/src/geometry.f90	(revision 146)
@@ -49,5 +49,11 @@
      
 
-
+  INTEGER, PARAMETER :: ne_right=1
+  INTEGER, PARAMETER :: ne_rup=-1
+  INTEGER, PARAMETER :: ne_lup=1
+  INTEGER, PARAMETER :: ne_left=-1
+  INTEGER, PARAMETER :: ne_ldown=1
+  INTEGER, PARAMETER :: ne_rdown=-1
+  
 CONTAINS
 
Index: codes/icosagcm/trunk/src/kinetic.f90
===================================================================
--- codes/icosagcm/trunk/src/kinetic.f90	(revision 145)
+++ codes/icosagcm/trunk/src/kinetic.f90	(revision 146)
@@ -14,6 +14,6 @@
     INTEGER :: ind
   
-    CALL transfert_request(f_ue,req_e1)
-    CALL transfert_request(f_ue,req_e1)
+    CALL transfert_request(f_ue,req_e1_vect)
+    CALL transfert_request(f_ue,req_e1_vect)
 
     DO ind=1,ndomain
Index: codes/icosagcm/trunk/src/metric.f90
===================================================================
--- codes/icosagcm/trunk/src/metric.f90	(revision 145)
+++ codes/icosagcm/trunk/src/metric.f90	(revision 146)
@@ -29,4 +29,5 @@
    INTEGER :: assign_j
    INTEGER :: assign_pos
+   INTEGER :: assign_delta
   END TYPE t_edge_glo
     
Index: codes/icosagcm/trunk/src/physics_dcmip.f90
===================================================================
--- codes/icosagcm/trunk/src/physics_dcmip.f90	(revision 145)
+++ codes/icosagcm/trunk/src/physics_dcmip.f90	(revision 146)
@@ -40,5 +40,5 @@
     INTEGER :: ind
 
-    CALL transfert_request(f_ue,req_e1)
+    CALL transfert_request(f_ue,req_e1_vect)
     DO ind=1,ndomain
       CALL swap_dimensions(ind)
Index: codes/icosagcm/trunk/src/timeloop_gcm.f90
===================================================================
--- codes/icosagcm/trunk/src/timeloop_gcm.f90	(revision 145)
+++ codes/icosagcm/trunk/src/timeloop_gcm.f90	(revision 146)
@@ -408,5 +408,5 @@
     LOGICAL, INTENT(IN) :: comp ! .TRUE. to compute, .FALSE. to check
     REAL(rstd), INTENT(IN) :: ps(iim*jjm)
-    REAL(rstd), INTENT(OUT) :: rhodz(iim*jjm,llm)
+    REAL(rstd), INTENT(INOUT) :: rhodz(iim*jjm,llm)
     REAL(rstd) :: m, err
     INTEGER :: l,i,j,ij,dd
Index: codes/icosagcm/trunk/src/transfert.F90
===================================================================
--- codes/icosagcm/trunk/src/transfert.F90	(revision 145)
+++ codes/icosagcm/trunk/src/transfert.F90	(revision 146)
@@ -2,9 +2,9 @@
 
 #ifdef CPP_USING_MPI
-  USE transfert_mpi_mod, ONLY : init_transfert, transfert_request=>transfert_request_mpi, req_i1,req_e1, &
-                                request_add_point, create_request, gather_field
+  USE transfert_mpi_mod, ONLY : init_transfert, transfert_request=>transfert_request_mpi, req_i1,req_e1_vect, &
+                                req_e1_scal,request_add_point, create_request, gather_field
 #else 
-  USE transfert_mpi_mod, ONLY : init_transfert, transfert_request, req_i1,req_e1, &
-                                request_add_point, create_request, gather_field
+  USE transfert_mpi_mod, ONLY : init_transfert, transfert_request, req_i1,req_e1_vect, &
+                                req_e1_scal,request_add_point, create_request, gather_field
 #endif
   
Index: codes/icosagcm/trunk/src/transfert_mpi.f90
===================================================================
--- codes/icosagcm/trunk/src/transfert_mpi.f90	(revision 145)
+++ codes/icosagcm/trunk/src/transfert_mpi.f90	(revision 146)
@@ -4,4 +4,5 @@
   TYPE array
     INTEGER,POINTER :: value(:)
+    INTEGER,POINTER :: sign(:)
     INTEGER         :: domain
     INTEGER         :: rank
@@ -17,4 +18,5 @@
     INTEGER :: max_size
     INTEGER :: size
+    LOGICAL :: vector
     INTEGER,POINTER :: src_domain(:)
     INTEGER,POINTER :: src_i(:)
@@ -24,4 +26,5 @@
     INTEGER,POINTER :: target_i(:)
     INTEGER,POINTER :: target_j(:)
+    INTEGER,POINTER :: target_sign(:)
     INTEGER :: nrecv
     TYPE(ARRAY),POINTER :: recv(:)
@@ -31,5 +34,6 @@
   
   TYPE(t_request),POINTER :: req_i1(:)
-  TYPE(t_request),POINTER :: req_e1(:)
+  TYPE(t_request),POINTER :: req_e1_scal(:)
+  TYPE(t_request),POINTER :: req_e1_vect(:)
   
   
@@ -84,49 +88,92 @@
     CALL finalize_request(req_i1)
   
-    CALL create_request(field_u,req_e1)
+    CALL create_request(field_u,req_e1_scal)
     DO ind=1,ndomain
       CALL swap_dimensions(ind)
       DO i=ii_begin,ii_end
-        CALL request_add_point(ind,i,jj_begin-1,req_e1,rup)
-        CALL request_add_point(ind,i+1,jj_begin-1,req_e1,lup)
+        CALL request_add_point(ind,i,jj_begin-1,req_e1_scal,rup)
+        CALL request_add_point(ind,i+1,jj_begin-1,req_e1_scal,lup)
       ENDDO
 
       DO j=jj_begin,jj_end
-        CALL request_add_point(ind,ii_end+1,j,req_e1,left)
-        CALL request_add_point(ind,ii_end+1,j-1,req_e1,lup)
+        CALL request_add_point(ind,ii_end+1,j,req_e1_scal,left)
+        CALL request_add_point(ind,ii_end+1,j-1,req_e1_scal,lup)
       ENDDO    
     
       DO i=ii_begin,ii_end
-        CALL request_add_point(ind,i,jj_end+1,req_e1,ldown)
-        CALL request_add_point(ind,i-1,jj_end+1,req_e1,rdown)
+        CALL request_add_point(ind,i,jj_end+1,req_e1_scal,ldown)
+        CALL request_add_point(ind,i-1,jj_end+1,req_e1_scal,rdown)
       ENDDO    
 
       DO j=jj_begin,jj_end
-        CALL request_add_point(ind,ii_begin-1,j,req_e1,right)
-        CALL request_add_point(ind,ii_begin-1,j+1,req_e1,rdown)
+        CALL request_add_point(ind,ii_begin-1,j,req_e1_scal,right)
+        CALL request_add_point(ind,ii_begin-1,j+1,req_e1_scal,rdown)
       ENDDO   
 
       DO i=ii_begin+1,ii_end-1
-        CALL request_add_point(ind,i,jj_begin,req_e1,right)
-        CALL request_add_point(ind,i,jj_end,req_e1,right)
+        CALL request_add_point(ind,i,jj_begin,req_e1_scal,right)
+        CALL request_add_point(ind,i,jj_end,req_e1_scal,right)
       ENDDO
     
       DO j=jj_begin+1,jj_end-1
-        CALL request_add_point(ind,ii_begin,j,req_e1,rup)
-        CALL request_add_point(ind,ii_end,j,req_e1,rup)
+        CALL request_add_point(ind,ii_begin,j,req_e1_scal,rup)
+        CALL request_add_point(ind,ii_end,j,req_e1_scal,rup)
       ENDDO   
 
-      CALL request_add_point(ind,ii_begin+1,jj_begin,req_e1,left)
-      CALL request_add_point(ind,ii_begin,jj_begin+1,req_e1,ldown)
-      CALL request_add_point(ind,ii_begin+1,jj_end,req_e1,left)
-      CALL request_add_point(ind,ii_end,jj_begin+1,req_e1,ldown)
-
-      CALL finalize_request(req_e1)
-     
-    ENDDO
-  
+      CALL request_add_point(ind,ii_begin+1,jj_begin,req_e1_scal,left)
+      CALL request_add_point(ind,ii_begin,jj_begin+1,req_e1_scal,ldown)
+      CALL request_add_point(ind,ii_begin+1,jj_end,req_e1_scal,left)
+      CALL request_add_point(ind,ii_end,jj_begin+1,req_e1_scal,ldown)
+
+    ENDDO
+
+    CALL finalize_request(req_e1_scal)
+    
+    CALL create_request(field_u,req_e1_vect,.TRUE.)
+    DO ind=1,ndomain
+      CALL swap_dimensions(ind)
+      DO i=ii_begin,ii_end
+        CALL request_add_point(ind,i,jj_begin-1,req_e1_vect,rup)
+        CALL request_add_point(ind,i+1,jj_begin-1,req_e1_vect,lup)
+      ENDDO
+
+      DO j=jj_begin,jj_end
+        CALL request_add_point(ind,ii_end+1,j,req_e1_vect,left)
+        CALL request_add_point(ind,ii_end+1,j-1,req_e1_vect,lup)
+      ENDDO    
+    
+      DO i=ii_begin,ii_end
+        CALL request_add_point(ind,i,jj_end+1,req_e1_vect,ldown)
+        CALL request_add_point(ind,i-1,jj_end+1,req_e1_vect,rdown)
+      ENDDO    
+
+      DO j=jj_begin,jj_end
+        CALL request_add_point(ind,ii_begin-1,j,req_e1_vect,right)
+        CALL request_add_point(ind,ii_begin-1,j+1,req_e1_vect,rdown)
+      ENDDO   
+
+      DO i=ii_begin+1,ii_end-1
+        CALL request_add_point(ind,i,jj_begin,req_e1_vect,right)
+        CALL request_add_point(ind,i,jj_end,req_e1_vect,right)
+      ENDDO
+    
+      DO j=jj_begin+1,jj_end-1
+        CALL request_add_point(ind,ii_begin,j,req_e1_vect,rup)
+        CALL request_add_point(ind,ii_end,j,req_e1_vect,rup)
+      ENDDO   
+
+      CALL request_add_point(ind,ii_begin+1,jj_begin,req_e1_vect,left)
+      CALL request_add_point(ind,ii_begin,jj_begin+1,req_e1_vect,ldown)
+      CALL request_add_point(ind,ii_begin+1,jj_end,req_e1_vect,left)
+      CALL request_add_point(ind,ii_end,jj_begin+1,req_e1_vect,ldown)
+
+  
+    ENDDO  
+
+    CALL finalize_request(req_e1_vect)
+
   END SUBROUTINE init_transfert
   
-  SUBROUTINE create_request(type_field,request)
+  SUBROUTINE create_request(type_field,request,vector)
   USE domain_mod
   USE field_mod
@@ -134,9 +181,11 @@
     INTEGER :: type_field
     TYPE(t_request),POINTER :: request(:)
+    LOGICAL,OPTIONAL :: vector
+    
     TYPE(t_request),POINTER :: req
     TYPE(t_domain),POINTER :: d
     INTEGER :: ind
     INTEGER :: max_size
-        
+       
     ALLOCATE(request(ndomain))
 
@@ -155,4 +204,6 @@
       req%max_size=max_size*2
       req%size=0
+      req%vector=.FALSE.
+      IF (PRESENT(vector)) req%vector=vector
       ALLOCATE(req%src_domain(req%max_size))
       ALLOCATE(req%src_ind(req%max_size))
@@ -162,4 +213,5 @@
       ALLOCATE(req%target_i(req%max_size))
       ALLOCATE(req%target_j(req%max_size))
+      ALLOCATE(req%target_sign(req%max_size))
     ENDDO
   
@@ -177,4 +229,5 @@
     INTEGER,POINTER :: target_i(:)
     INTEGER,POINTER :: target_j(:)
+    INTEGER,POINTER :: target_sign(:)
 
     PRINT *,"REALLOCATE_REQUEST"
@@ -186,4 +239,5 @@
     target_i=>req%target_i
     target_j=>req%target_j
+    target_sign=>req%target_sign
 !    req%max_size=req%max_size*2
     ALLOCATE(req%src_domain(req%max_size*2))
@@ -194,4 +248,5 @@
     ALLOCATE(req%target_i(req%max_size*2))
     ALLOCATE(req%target_j(req%max_size*2))
+    ALLOCATE(req%target_sign(req%max_size*2))
     
     req%src_domain(1:req%max_size)=src_domain(:)
@@ -202,4 +257,5 @@
     req%target_i(1:req%max_size)=target_i(:)
     req%target_j(1:req%max_size)=target_j(:)
+    req%target_sign(1:req%max_size)=target_sign(:)
     
     req%max_size=req%max_size*2
@@ -212,4 +268,5 @@
     DEALLOCATE(target_i)
     DEALLOCATE(target_j)
+    DEALLOCATE(target_sign)
 
   END SUBROUTINE reallocate_request
@@ -243,4 +300,5 @@
 
         req%target_ind(req%size)=(j-1)*d%iim+i
+        req%target_sign(req%size)=1
         req%src_domain(req%size)=src_domain
         req%src_ind(req%size)=(src_j-1)*src_iim+src_i
@@ -254,19 +312,13 @@
         src_n=(src_j-1)*src_iim+src_i
         src_delta=domain(ind)%delta(i,j)
-        
-!        src_pos=MOD(pos-1+src_delta+6,6)+1
         src_pos=domain(ind)%edge_assign_pos(pos-1,i,j)+1
                 
         req%target_ind(req%size)=(j-1)*d%iim+i+d%u_pos(pos)
+
+        req%target_sign(req%size)= 1
+        IF (req%vector) req%target_sign(req%size)= domain(ind)%edge_assign_sign(pos-1,i,j)
+
         req%src_domain(req%size)=src_domain
         req%src_ind(req%size)=src_n+domain_glo(src_domain)%u_pos(src_pos)
-
-!        req%target_i(req%size)=i
-!        req%target_j(req%size)=j
-!        req%src_i(req%size)=domain(ind)%assign_i(i,j)
-!        req%src_j(req%size)=domain(ind)%assign_j(i,j)
-        
-!        PRINT *,"1--->",ind,i,j,pos
-!        PRINT *,"2--->",src_domain,src_i,src_j,src_pos
 
       ELSE IF (req%type_field==field_z) THEN
@@ -283,4 +335,5 @@
         
         req%target_ind(req%size)=(j-1)*d%iim+i+d%z_pos(pos)
+        req%target_sign(req%size)=1
         req%src_domain(req%size)=src_domain
         req%src_ind(req%size)=src_n+domain_glo(src_domain)%z_pos(src_pos)
@@ -338,4 +391,5 @@
           req%recv(irecv)%domain=domglo_loc_ind(ind_glo)
           ALLOCATE(req%recv(irecv)%value(req%recv(irecv)%size))
+          ALLOCATE(req%recv(irecv)%sign(req%recv(irecv)%size))
           ALLOCATE(req%recv(irecv)%buffer(req%recv(irecv)%size))
         ENDIF
@@ -350,4 +404,5 @@
         req%recv(irecv)%value(size)=req%src_ind(i)
         req%recv(irecv)%buffer(size)=req%target_ind(i)
+        req%recv(irecv)%sign(size)=req%target_sign(i)
       ENDDO
     ENDDO
@@ -362,5 +417,4 @@
       ENDDO
     ENDDO
-    
     
     CALL MPI_Alltoall(nb_domain_recv,1,MPI_INTEGER,nb_domain_send,1,MPI_INTEGER,comm_icosa,ierr)     
@@ -465,4 +519,5 @@
      DO irecv=1,req%nrecv
        req%recv(irecv)%value(:)=req%recv(irecv)%buffer(:)
+       req%recv(irecv)%sign(:) =req%recv(irecv)%sign(:)
        DEALLOCATE(req%recv(irecv)%buffer)
      ENDDO
@@ -470,88 +525,5 @@
    
     
-!   nb_domain_recv(:)=0
-!   nb_data_domain_recv(:)=0
-!   
-!   DO ind_loc=1,ndomain
-!   
-!     DO i=1,req%size
-!       ind_glo=req%src_domain(i)
-!       nb_data_domain_recv(ind_glo)=nb_data_domain_recv(ind_glo)+1
-!     ENDDO
-!   
-!     DO ind_glo=1,ndomain_glo
-!       IF ( nb_data_domain_recv(ind_glo) > 0 )  nb_domain_recv(domglo_rank(ind_glo))=nb_domain_recv(domglo_rank(ind_glo))+1
-!     ENDDO
-!       
-!     CALL MPI_Alltoall(nb_domain_recv,1,MPI_INTEGER,nb_domain_send,1,MPI_INTEGER,comm_icosa,ierr)
-!   ENDDO
-!   
-!   DO 
-!   recv=sum(nb_domain_recv(:))
-!   send=sum(nb_domain_send(:))
-
-!   ALLOCATE(req%recv(recv))
-!   ALLOCATE(req%send(send))
-
-!   ALLOCATE(mpi_req(2*(send+recv)))
-!   ALLOCATE(status(MPI_STATUS_SIZE,2*(send+recv)))
-!   
-!   recv=0
-!   ireq=0
-!   DO ind_glo=1,ndomain_glo
-!     IF (nb_data_domain_recv(ind_glo)>0) THEN
-!       recv=recv+1
-!       list_domain_recv(ind_glo)=recv
-!       req%recv(recv)%rank=domglo_rank(ind_glo)
-!       req%recv(recv)%size=nb_data_domain_recv(ind_glo)
-!       req%recv(recv)%domain=domglo_loc_ind(ind_glo)
-!       ALLOCATE(req%recv(recv)%value(req%recv(recv)%size))
-!       ireq=ireq+1
-!       CALL MPI_ISEND(req%recv(recv)%domain,1,MPI_INTEGER,req%recv(recv)%rank,0,comm_icosa, mpi_req(ireq),ierr)
-!       ireq=ireq+1
-!       CALL MPI_ISEND(req%recv(recv)%size,1,MPI_INTEGER,req%recv(recv)%rank,0,comm_icosa, mpi_req(ireq),ierr)
-!     ENDIF
-!   ENDDO
-!   
-!    
-!   send=0
-!   DO rank=0,mpi_size-1
-!     DO j=1,nb_domain_send(rank)
-!       send=send+1
-!       req%send(send)%rank=rank
-!       ireq=ireq+1
-!       CALL MPI_IRECV(req%send(send)%domain,1,MPI_INTEGER,rank,0,comm_icosa, mpi_req(ireq),ierr)
-!       ireq=ireq+1
-!       CALL MPI_IRECV(req%send(send)%size,1,MPI_INTEGER,rank,0,comm_icosa, mpi_req(ireq),ierr)
-!     ENDDO
-!   ENDDO
-!   
-!   CALL MPI_WAITALL(2*(send+recv),mpi_req,status,ierr) 
-
-!   req%recv(:)%size=0
-!   
-!   DO i=1,req%size
-!     j=list_domain_recv(req%src_domain(i))
-!     req%recv(j)%size=req%recv(j)%size+1
-!     size=req%recv(j)%size
-!     req%recv(j)%value(size)=req%src_ind(i)
-!   ENDDO
-!       
-!   ireq=0
-!   DO i=1,recv
-!     ireq=ireq+1
-!     CALL MPI_ISEND(req%recv(i)%value,req%recv(i)%size,MPI_INTEGER,req%recv(i)%rank,req%recv(i)%domain,comm_icosa, mpi_req(ireq),ierr)   
-!   ENDDO
-
-!   DO i=1,send
-!     ireq=ireq+1
-!     ALLOCATE(req%send(i)%value(req%send(i)%size))
-!     CALL MPI_IRECV(req%send(i)%value,req%send(i)%size,MPI_INTEGER,req%send(i)%rank,req%send(i)%domain,comm_icosa, mpi_req(ireq),ierr)   
-!   ENDDO
-!   
-!   CALL MPI_WAITALL(send+recv,mpi_req,status,ierr) 
-    
-
-   END SUBROUTINE Finalize_request 
+  END SUBROUTINE Finalize_request 
 
 
@@ -571,4 +543,5 @@
     REAL(rstd),POINTER :: buffer_r4(:,:,:) 
     INTEGER,POINTER :: value(:) 
+    INTEGER,POINTER :: sgn(:) 
     TYPE(ARRAY),POINTER :: recv,send 
     TYPE(t_request),POINTER :: req
@@ -634,6 +607,7 @@
             buffer_r2=>recv%buffer_r2
             value=>recv%value
+            sgn=>recv%sign
             DO n=1,recv%size
-              rval2d(value(n))=buffer_r2(n)  
+              rval2d(value(n))=buffer_r2(n)*sgn(n)  
             ENDDO        
             DEALLOCATE(recv%buffer_r2)
@@ -697,6 +671,7 @@
             buffer_r3=>recv%buffer_r3
             value=>recv%value
+            sgn=>recv%sign
             DO n=1,recv%size
-              rval3d(value(n),:)=buffer_r3(n,:)  
+              rval3d(value(n),:)=buffer_r3(n,:)*sgn(n)  
             ENDDO        
             DEALLOCATE(recv%buffer_r3)
@@ -760,6 +735,7 @@
             buffer_r4=>recv%buffer_r4
             value=>recv%value
+            sgn=>recv%sign
             DO n=1,recv%size
-              rval4d(value(n),:,:)=buffer_r4(n,:,:)  
+              rval4d(value(n),:,:)=buffer_r4(n,:,:)*sgn(n) 
             ENDDO        
             DEALLOCATE(recv%buffer_r4)
@@ -797,13 +773,13 @@
         IF (field(ind)%ndim==2) THEN
           DO n=1,req%size
-            rval2d(req%target_ind(n))=field(req%src_domain(n))%rval2d(req%src_ind(n))
+            rval2d(req%target_ind(n))=field(req%src_domain(n))%rval2d(req%src_ind(n))*req%target_sign(n)
           ENDDO
         ELSE IF (field(ind)%ndim==3) THEN
           DO n=1,req%size
-            rval3d(req%target_ind(n),:)=field(req%src_domain(n))%rval3d(req%src_ind(n),:)
+            rval3d(req%target_ind(n),:)=field(req%src_domain(n))%rval3d(req%src_ind(n),:)*req%target_sign(n)
           ENDDO
         ELSE IF (field(ind)%ndim==4) THEN
           DO n=1,req%size
-            rval4d(req%target_ind(n),:,:)=field(req%src_domain(n))%rval4d(req%src_ind(n),:,:)
+            rval4d(req%target_ind(n),:,:)=field(req%src_domain(n))%rval4d(req%src_ind(n),:,:)*req%target_sign(n)
           ENDDO
         ENDIF
Index: codes/icosagcm/trunk/src/vorticity.f90
===================================================================
--- codes/icosagcm/trunk/src/vorticity.f90	(revision 145)
+++ codes/icosagcm/trunk/src/vorticity.f90	(revision 146)
@@ -13,6 +13,5 @@
     INTEGER :: ind
 
-    CALL transfert_request(f_ue,req_e1)
-    CALL transfert_request(f_ue,req_e1)
+    CALL transfert_request(f_ue,req_e1_vect)
    
     DO ind=1,ndomain
