Index: /dynamico_lmdz/aquaplanet/LMDZ5/bld.cfg
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/bld.cfg	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/bld.cfg	(revision 3814)
@@ -22,14 +22,14 @@
 %LD_FLAGS          %BASE_LD %PARA_LD
 
-src::dyn     %SRC_PATH/%DYN
+%src::dyn     %SRC_PATH/%DYN
 src::phys    %SRC_PATH/%PHYS
-src::dyn_phys %DYN_PHYS
-src::dyn_phys_sub %DYN_PHYS_SUB
+%src::dyn_phys %DYN_PHYS
+%src::dyn_phys_sub %DYN_PHYS_SUB
 src::sisvat  %SISVAT
 src::rrtm    %RRTM
 src::grid    %SRC_PATH/grid
-src::filtrez %FILTRE
+%src::filtrez %FILTRE
 src::misc    %SRC_PATH/misc
-src::dyn3d_common   %DYN_COMMON 
+%src::dyn3d_common   %DYN_COMMON 
 src::cosp    %COSP
 src::ext_src %EXT_SRC
@@ -39,5 +39,6 @@
 bld::outfile_ext::exe    %SUFF_NAME.e
 bld::target              liblmdz.a 
-bld::target              %EXEC%SUFF_NAME.e
+#bld::target              %EXEC%SUFF_NAME.e
+bld::target              main_calfis%SUFF_NAME.e
 bld::exe_dep             
 
Index: namico_lmdz/aquaplanet/LMDZ5/libf/dyn3d_common/write_field.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/dyn3d_common/write_field.F90	(revision 3813)
+++ 	(revision )
@@ -1,326 +1,0 @@
-!
-! $Id: write_field.F90 2239 2015-03-23 07:27:30Z emillour $
-!
-module write_field
-implicit none
-
-  integer, parameter :: MaxWriteField = 100
-  integer, dimension(MaxWriteField),save :: FieldId
-  integer, dimension(MaxWriteField),save :: FieldVarId
-  integer, dimension(MaxWriteField),save :: FieldIndex
-  character(len=255), dimension(MaxWriteField) ::  FieldName 
-   
-  integer,save :: NbField = 0
-  
-  interface WriteField
-    module procedure WriteField3d,WriteField2d,WriteField1d
-  end interface WriteField
-  contains
-  
-    function GetFieldIndex(name)
-    implicit none
-      integer          :: GetFieldindex
-      character(len=*) :: name
-    
-      character(len=255) :: TrueName
-      integer            :: i
-       
-      
-      TrueName=TRIM(ADJUSTL(name))
-    
-      GetFieldIndex=-1
-      do i=1,NbField
-        if (TrueName==FieldName(i)) then
-          GetFieldIndex=i
-          exit
-        endif
-      enddo
-    end function GetFieldIndex
- 
-    subroutine WriteField3d(name,Field)
-    implicit none
-      character(len=*) :: name
-      real, dimension(:,:,:) :: Field 
-      integer, dimension(3) :: Dim
-      
-      Dim=shape(Field)
-      call WriteField_gen(name,Field,Dim(1),Dim(2),Dim(3))  
-  
-    end subroutine WriteField3d
-    
-    subroutine WriteField2d(name,Field)
-    implicit none
-      character(len=*) :: name
-      real, dimension(:,:) :: Field 
-      integer, dimension(2) :: Dim
-      
-      Dim=shape(Field)
-      call WriteField_gen(name,Field,Dim(1),Dim(2),1)  
-  
-    end subroutine WriteField2d
-    
-    subroutine WriteField1d(name,Field)
-    implicit none
-      character(len=*) :: name
-      real, dimension(:) :: Field 
-      integer, dimension(1) :: Dim
-      
-      Dim=shape(Field)
-      call WriteField_gen(name,Field,Dim(1),1,1)  
-  
-    end subroutine WriteField1d
-        
-    subroutine WriteField_gen(name,Field,dimx,dimy,dimz)
-    implicit none
-    include 'netcdf.inc'
-      character(len=*) :: name
-      integer :: dimx,dimy,dimz
-      real,dimension(dimx,dimy,dimz) :: Field
-      integer,dimension(dimx*dimy*dimz) :: ndex
-      integer :: status
-      integer :: index
-      integer :: start(4)
-      integer :: count(4)
-      
-           
-      Index=GetFieldIndex(name)
-      if (Index==-1) then
-        call CreateNewField(name,dimx,dimy,dimz)
-	Index=GetFieldIndex(name)
-      else
-        FieldIndex(Index)=FieldIndex(Index)+1.
-      endif
-      
-      start(1)=1
-      start(2)=1
-      start(3)=1
-      start(4)=FieldIndex(Index)
-
-      count(1)=dimx
-      count(2)=dimy
-      count(3)=dimz
-      count(4)=1
-
-      status = NF_PUT_VARA_DOUBLE(FieldId(Index),FieldVarId(Index),start,count,Field)
-      status = NF_SYNC(FieldId(Index))
-      
-    end subroutine WriteField_gen
-       
-    subroutine CreateNewField(name,dimx,dimy,dimz)
-    implicit none
-    include 'netcdf.inc'  
-      character(len=*) :: name
-      integer :: dimx,dimy,dimz
-      integer :: TabDim(4)
-      integer :: status
-      
-      
-      NbField=NbField+1
-      FieldName(NbField)=TRIM(ADJUSTL(name))
-      FieldIndex(NbField)=1
-      
-      
-      status = NF_CREATE(TRIM(ADJUSTL(name))//'.nc', NF_CLOBBER, FieldId(NbField))
-      status = NF_DEF_DIM(FieldId(NbField),'X',dimx,TabDim(1))
-      status = NF_DEF_DIM(FieldId(NbField),'Y',dimy,TabDim(2))
-      status = NF_DEF_DIM(FieldId(NbField),'Z',dimz,TabDim(3))
-      status = NF_DEF_DIM(FieldId(NbField),'iter',NF_UNLIMITED,TabDim(4))
-      status = NF_DEF_VAR(FieldId(NbField),FieldName(NbField),NF_DOUBLE,4,TabDim,FieldVarId(NbField))
-      status = NF_ENDDEF(FieldId(NbField))
-
-    end subroutine CreateNewField
-    
-    
-    
-  subroutine write_field1D(name,Field)
-    implicit none
-  
-    integer, parameter :: MaxDim=1
-    character(len=*)   :: name
-    real, dimension(:) :: Field
-    real, dimension(:),allocatable :: New_Field
-    character(len=20) :: str
-    integer, dimension(MaxDim) :: Dim
-    integer :: i,nb
-    integer, parameter :: id=10
-    integer, parameter :: NbCol=4
-    integer :: ColumnSize 
-    integer :: pos
-    character(len=255) :: form
-    character(len=255) :: MaxLen
-    
-    
-    open(unit=id,file=name//'.field',form='formatted',status='replace')
-    write (id,'("----- Field '//name//'",//)')
-    Dim=shape(Field)
-    MaxLen=int2str(len(trim(int2str(Dim(1)))))
-    ColumnSize=20+6+3+len(trim(int2str(Dim(1))))
-    Nb=0
-    Pos=2
-    do i=1,Dim(1)
-      nb=nb+1
-      
-      if (MOD(nb,NbCol)==0) then
-        form='(t'//trim(int2str(pos))// ',i'//trim(MaxLen) //'," ---> ",g22.16,/)'
-        Pos=2
-      else
-        form='(t'//trim(int2str(pos))// ',i'//trim(MaxLen) //'," ---> ",g22.16," | ",)'
-        Pos=Pos+ColumnSize
-      endif
-      write (id,form,advance='no') i,Field(i)
-    enddo
-     
-    close(id)
-
-  end subroutine write_field1D
-
-  subroutine write_field2D(name,Field)
-    implicit none
-  
-    integer, parameter :: MaxDim=2
-    character(len=*)   :: name
-    real, dimension(:,:) :: Field
-    real, dimension(:,:),allocatable :: New_Field
-    character(len=20) :: str
-    integer, dimension(MaxDim) :: Dim
-    integer :: i,j,nb
-    integer, parameter :: id=10
-    integer, parameter :: NbCol=4
-    integer :: ColumnSize 
-    integer :: pos,offset
-    character(len=255) :: form
-    character(len=255) :: spacing
-    
-    open(unit=id,file=name//'.field',form='formatted',status='replace')
-    write (id,'("----- Field '//name//'",//)')
-    
-    Dim=shape(Field)
-    offset=len(trim(int2str(Dim(1))))+len(trim(int2str(Dim(2))))+3
-    ColumnSize=20+6+3+offset
-
-    spacing='(t2,"'//repeat('-',ColumnSize*NbCol)//'")'
-    
-    do i=1,Dim(2)
-      nb=0
-      Pos=2
-      do j=1,Dim(1)
-        nb=nb+1
-      
-        if (MOD(nb,NbCol)==0) then
-          form='(t'//trim(int2str(pos))//            &
-               ',"('//trim(int2str(j))//','          &
-                    //trim(int2str(i))//')",t'       & 
-                    //trim(int2str(pos+offset))     &    
-                    //'," ---> ",g22.16,/)'
-          Pos=2
-        else
-          form='(t'//trim(int2str(pos))//            &
-               ',"('//trim(int2str(j))//','          &
-                    //trim(int2str(i))//')",t'       & 
-                    //trim(int2str(pos+offset))     &    
-                    //'," ---> ",g22.16," | ")'
-          Pos=Pos+ColumnSize
-        endif
-        write (id,form,advance='no') Field(j,i)
-      enddo
-      if (MOD(nb,NbCol)==0) then
-        write (id,spacing)
-      else
-        write (id,'("")')
-        write (id,spacing)
-      endif
-    enddo
-     
-  end subroutine write_field2D
-  
-  subroutine write_field3D(name,Field)
-    implicit none
-  
-    integer, parameter :: MaxDim=3
-    character(len=*)   :: name
-    real, dimension(:,:,:) :: Field
-    real, dimension(:,:,:),allocatable :: New_Field
-    integer, dimension(MaxDim) :: Dim
-    integer :: i,j,k,nb
-    integer, parameter :: id=10
-    integer, parameter :: NbCol=4
-    integer :: ColumnSize 
-    integer :: pos,offset
-    character(len=255) :: form
-    character(len=255) :: spacing
-
-    open(unit=id,file=name//'.field',form='formatted',status='replace')
-    write (id,'("----- Field '//name//'"//)')
-    
-    Dim=shape(Field)
-    offset=len(trim(int2str(Dim(1))))+len(trim(int2str(Dim(2))))+len(trim(int2str(Dim(3))))+4
-    ColumnSize=22+6+3+offset
-
-!    open(unit=id,file=name,form=formatted
-   
-    spacing='(t2,"'//repeat('-',ColumnSize*NbCol)//'")'
-    
-    do i=1,Dim(3)
-    
-      do j=1,Dim(2)
-        nb=0
-        Pos=2
-        
-        do k=1,Dim(1)
-        nb=nb+1
-      
-          if (MOD(nb,NbCol)==0) then
-            form='(t'//trim(int2str(pos))//            &
-                 ',"('//trim(int2str(k))//','          &
-                      //trim(int2str(j))//','          &
-                      //trim(int2str(i))//')",t'       & 
-                      //trim(int2str(pos+offset))      &    
-                      //'," ---> ",g22.16,/)'
-           Pos=2
-          else
-            form='(t'//trim(int2str(pos))//            &
-                 ',"('//trim(int2str(k))//','          &
-                      //trim(int2str(j))//','          &
-                      //trim(int2str(i))//')",t'       & 
-                      //trim(int2str(pos+offset))      &    
-                      //'," ---> ",g22.16," | ")'
-! dépent de l'implémention, sur compaq, c'est necessaire
-!            Pos=Pos+ColumnSize
-          endif
-          write (id,form,advance='no') Field(k,j,i)
-        enddo
-        if (MOD(nb,NbCol)==0) then
-          write (id,spacing)
-        else
-          write (id,'("")')
-          write (id,spacing)
-        endif
-      enddo
-      write (id,spacing)
-    enddo
-    
-    close(id)
-  
-  end subroutine write_field3D  
-  
-  function int2str(int)
-    implicit none
-    integer, parameter :: MaxLen=10
-    integer,intent(in) :: int
-    character(len=MaxLen) :: int2str
-    logical :: flag
-    integer :: i
-    flag=.true.
-    
-    i=int
-    
-    int2str=''
-    do while (flag)
-      int2str=CHAR(MOD(i,10)+48)//int2str
-      i=i/10
-      if (i==0) flag=.false.
-    enddo
-  end function int2str
-
-end module write_field
-  
Index: namico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_grid_phy_lmdz.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_grid_phy_lmdz.F90	(revision 3813)
+++ 	(revision )
@@ -1,454 +1,0 @@
-!
-!$Id $
-!
-MODULE mod_grid_phy_lmdz
-
-  PUBLIC
-  PRIVATE :: grid1dTo2d_glo_igen, grid1dTo2d_glo_rgen, grid1dTo2d_glo_lgen, &
-             grid2dTo1d_glo_igen, grid2dTo1d_glo_rgen, grid2dTo1d_glo_lgen
-  
-  INTEGER,SAVE :: nbp_lon  ! == iim
-  INTEGER,SAVE :: nbp_lat  ! == jjmp1
-  INTEGER,SAVE :: nbp_lev  ! == llm
-  INTEGER,SAVE :: klon_glo
-
-  INTERFACE grid1dTo2d_glo
-    MODULE PROCEDURE grid1dTo2d_glo_i,grid1dTo2d_glo_i1,grid1dTo2d_glo_i2,grid1dTo2d_glo_i3, &
-                     grid1dTo2d_glo_r,grid1dTo2d_glo_r1,grid1dTo2d_glo_r2,grid1dTo2d_glo_r3, &
-		     grid1dTo2d_glo_l,grid1dTo2d_glo_l1,grid1dTo2d_glo_l2,grid1dTo2d_glo_l3
-   END INTERFACE 
-
-   INTERFACE grid2dTo1d_glo
-    MODULE PROCEDURE grid2dTo1d_glo_i,grid2dTo1d_glo_i1,grid2dTo1d_glo_i2,grid2dTo1d_glo_i3, &
-                     grid2dTo1d_glo_r,grid2dTo1d_glo_r1,grid2dTo1d_glo_r2,grid2dTo1d_glo_r3, &
-		     grid2dTo1d_glo_l,grid2dTo1d_glo_l1,grid2dTo1d_glo_l2,grid2dTo1d_glo_l3
-   END INTERFACE 
- 
-CONTAINS
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! SUBROUTINE grid1dTo2d  !!  
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-
-  SUBROUTINE Init_grid_phy_lmdz(iim,jjp1,llm)
-  IMPLICIT NONE
-  INTEGER, INTENT(in) :: iim
-  INTEGER, INTENT(in) :: jjp1
-  INTEGER, INTENT(in) :: llm
-  
-    nbp_lon=iim
-    nbp_lat=jjp1
-    nbp_lev=llm
-    klon_glo=(iim*jjp1)-2*(iim-1)
-  
-  END SUBROUTINE Init_grid_phy_lmdz
-  
-  
-  SUBROUTINE grid1dTo2d_glo_i(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:)     :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_igen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid1dTo2d_glo_i
-  
-
-  SUBROUTINE grid1dTo2d_glo_i1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:)     :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_igen(VarIn,VarOut,size(VarIn,2))
-  
-  END SUBROUTINE grid1dTo2d_glo_i1
-
-  SUBROUTINE grid1dTo2d_glo_i2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
-  
-  END SUBROUTINE grid1dTo2d_glo_i2
-  
-  SUBROUTINE grid1dTo2d_glo_i3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid1dTo2d_glo_i3
-
-
-  SUBROUTINE grid1dTo2d_glo_r(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:)     :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid1dTo2d_glo_r
-  
-
-  SUBROUTINE grid1dTo2d_glo_r1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,size(VarIn,2))
-  
-  END SUBROUTINE grid1dTo2d_glo_r1
-
-  SUBROUTINE grid1dTo2d_glo_r2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
-  
-  END SUBROUTINE grid1dTo2d_glo_r2
-  
-  SUBROUTINE grid1dTo2d_glo_r3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid1dTo2d_glo_r3
-  
-  
-  
-  SUBROUTINE grid1dTo2d_glo_l(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:)     :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid1dTo2d_glo_l
-  
-
-  SUBROUTINE grid1dTo2d_glo_l1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,size(VarIn,2))
-  
-  END SUBROUTINE grid1dTo2d_glo_l1
-
-  SUBROUTINE grid1dTo2d_glo_l2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
-  
-  END SUBROUTINE grid1dTo2d_glo_l2
-  
-  SUBROUTINE grid1dTo2d_glo_l3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid1dTo2d_glo_l3  
-  
-    SUBROUTINE grid2dTo1d_glo_i(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_igen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid2dTo1d_glo_i
-  
-
-  SUBROUTINE grid2dTo1d_glo_i1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_igen(VarIn,VarOut,size(VarIn,3))
-  
-  END SUBROUTINE grid2dTo1d_glo_i1
-
-  SUBROUTINE grid2dTo1d_glo_i2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid2dTo1d_glo_i2
-  
-  SUBROUTINE grid2dTo1d_glo_i3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
-  
-  END SUBROUTINE grid2dTo1d_glo_i3
- 
-
-
-
-  SUBROUTINE grid2dTo1d_glo_r(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid2dTo1d_glo_r
-  
-
-  SUBROUTINE grid2dTo1d_glo_r1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,size(VarIn,3))
-  
-  END SUBROUTINE grid2dTo1d_glo_r1
-
-  SUBROUTINE grid2dTo1d_glo_r2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid2dTo1d_glo_r2
-  
-  SUBROUTINE grid2dTo1d_glo_r3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
-  
-  END SUBROUTINE grid2dTo1d_glo_r3
-
-
-
-  SUBROUTINE grid2dTo1d_glo_l(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid2dTo1d_glo_l
-  
-
-  SUBROUTINE grid2dTo1d_glo_l1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,size(VarIn,3))
-  
-  END SUBROUTINE grid2dTo1d_glo_l1
-
-  SUBROUTINE grid2dTo1d_glo_l2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid2dTo1d_glo_l2
-  
-  SUBROUTINE grid2dTo1d_glo_l3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
-  
-  END SUBROUTINE grid2dTo1d_glo_l3
-
-!---------------------------------------------------------------- 
-!  Generic (private) fonctions
-!---------------------------------------------------------------- 
-  
-  SUBROUTINE grid1dTo2d_glo_igen(VarIn,VarOut,dimsize)
-
-    IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    INTEGER,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
-    INTEGER :: i,ij,Offset
-
-    
-    Offset=nbp_lon
-        
-    DO i=1,dimsize
-      DO ij=1,klon_glo
-        VarOut(ij+offset-1,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO
-    
-    
-    DO i=1,dimsize
-      DO ij=1,nbp_lon
-       VarOut(ij,i)=VarIn(1,i)
-      ENDDO
-    ENDDO
-    
-    
-    DO i=1,dimsize
-      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
-       VarOut(ij,i)=VarIn(klon_glo,i)
-      ENDDO
-    ENDDO
-
-  END SUBROUTINE grid1dTo2d_glo_igen   
-
-
-  SUBROUTINE grid1dTo2d_glo_rgen(VarIn,VarOut,dimsize)
-
-    IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    REAL,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
-    REAL,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
-    INTEGER :: i,ij,Offset
-
-   
-    Offset=nbp_lon
-        
-    DO i=1,dimsize
-      DO ij=1,klon_glo
-        VarOut(ij+offset-1,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO
-    
-    
-    DO i=1,dimsize
-      DO ij=1,nbp_lon
-       VarOut(ij,i)=VarIn(1,i)
-      ENDDO
-    ENDDO
-    
-    
-    DO i=1,dimsize
-      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
-       VarOut(ij,i)=VarIn(klon_glo,i)
-      ENDDO
-    ENDDO
-
-  END SUBROUTINE grid1dTo2d_glo_rgen   
-
-  SUBROUTINE grid1dTo2d_glo_lgen(VarIn,VarOut,dimsize)
-
-    IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: dimsize
-    LOGICAL,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
-    INTEGER :: i,ij,Offset
-
-    Offset=nbp_lon
-        
-    DO i=1,dimsize
-      DO ij=1,klon_glo
-        VarOut(ij+offset-1,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO
-    
-    
-    DO i=1,dimsize
-      DO ij=1,nbp_lon
-       VarOut(ij,i)=VarIn(1,i)
-      ENDDO
-    ENDDO
-    
-    
-    DO i=1,dimsize
-      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
-       VarOut(ij,i)=VarIn(klon_glo,i)
-      ENDDO
-    ENDDO
-
-  END SUBROUTINE grid1dTo2d_glo_lgen     
-  
-  
-  SUBROUTINE grid2dTo1d_glo_igen(VarIn,VarOut,dimsize)
-
-    IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    INTEGER,INTENT(IN) ,DIMENSION(nbp_lon*nbp_lat,dimsize) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(klon_glo,dimsize)      :: VarOut
-    INTEGER :: i,ij,offset
-
-    offset=nbp_lon
-
-    DO i=1,dimsize
-      DO ij=1,klon_glo
-        VarOut(ij,i)=VarIn(ij+offset-1,i)
-      ENDDO
-    ENDDO
-
-    DO i=1,dimsize
-      VarOut(1,i)=VarIn(1,i)
-    ENDDO
-    
-  END SUBROUTINE grid2dTo1d_glo_igen   
-  
-  SUBROUTINE grid2dTo1d_glo_rgen(VarIn,VarOut,dimsize)
-
-    IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    REAL,INTENT(IN) ,DIMENSION(nbp_lon*nbp_lat,dimsize) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(klon_glo,dimsize)      :: VarOut
-    INTEGER :: i,ij,offset
-
-    offset=nbp_lon
-
-    DO i=1,dimsize
-      DO ij=1,klon_glo
-        VarOut(ij,i)=VarIn(ij+offset-1,i)
-      ENDDO
-    ENDDO
-
-    DO i=1,dimsize
-      VarOut(1,i)=VarIn(1,i)
-    ENDDO
-    
-  END SUBROUTINE grid2dTo1d_glo_rgen 
-    
-  SUBROUTINE grid2dTo1d_glo_lgen(VarIn,VarOut,dimsize)
-
-    IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    LOGICAL,INTENT(IN) ,DIMENSION(nbp_lon*nbp_lat,dimsize) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(klon_glo,dimsize)      :: VarOut
-    INTEGER :: i,ij,offset
-
-    offset=nbp_lon
-
-    DO i=1,dimsize
-      DO ij=1,klon_glo
-        VarOut(ij,i)=VarIn(ij+offset-1,i)
-      ENDDO
-    ENDDO
-
-    DO i=1,dimsize
-      VarOut(1,i)=VarIn(1,i)
-    ENDDO
-    
-  END SUBROUTINE grid2dTo1d_glo_lgen   
-
-END MODULE mod_grid_phy_lmdz
Index: namico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_mpi_data.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_mpi_data.F90	(revision 3813)
+++ 	(revision )
@@ -1,203 +1,0 @@
-!
-!$Header$
-!
-MODULE mod_phys_lmdz_mpi_data
-  USE mod_const_mpi
-  
-  INTEGER,SAVE :: ii_begin
-  INTEGER,SAVE :: ii_end
-  INTEGER,SAVE :: jj_begin
-  INTEGER,SAVE :: jj_end
-  INTEGER,SAVE :: jj_nb
-  INTEGER,SAVE :: ij_begin
-  INTEGER,SAVE :: ij_end
-  INTEGER,SAVE :: ij_nb
-  INTEGER,SAVE :: klon_mpi_begin
-  INTEGER,SAVE :: klon_mpi_end
-  INTEGER,SAVE :: klon_mpi
-  
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_nb
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_begin
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_end
-
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ii_para_begin
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ii_para_end
-
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_nb
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_begin
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_end
-
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_nb
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_begin
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_end 
-
-  
-  INTEGER,SAVE :: mpi_rank
-  INTEGER,SAVE :: mpi_size
-  INTEGER,SAVE :: mpi_root
-  LOGICAL,SAVE :: is_mpi_root
-  LOGICAL,SAVE :: is_using_mpi
-  
-  
-  LOGICAL,SAVE :: is_north_pole
-  LOGICAL,SAVE :: is_south_pole
-  INTEGER,SAVE :: COMM_LMDZ_PHY
-
-CONTAINS
-  
-  SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
-  USE mod_const_mpi, ONLY : COMM_LMDZ
-  IMPLICIT NONE
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
-    
-    INTEGER :: ierr
-    INTEGER :: klon_glo
-    INTEGER :: i
-    
-#ifdef CPP_MPI
-    is_using_mpi=.TRUE.
-#else
-    is_using_mpi=.FALSE.
-#endif
-    
-    if (iim.eq.1) then
-       klon_glo=1
-    else
-       klon_glo=iim*(jjp1-2)+2
-    endif
-    
-    COMM_LMDZ_PHY=COMM_LMDZ
-
-    IF (is_using_mpi) THEN    
-#ifdef CPP_MPI
-      CALL MPI_COMM_SIZE(COMM_LMDZ_PHY,mpi_size,ierr)    
-      CALL MPI_COMM_RANK(COMM_LMDZ_PHY,mpi_rank,ierr)
-#endif
-    ELSE
-      mpi_size=1
-      mpi_rank=0
-    ENDIF
-    
-    IF (mpi_rank == 0) THEN
-      mpi_root = 0
-      is_mpi_root = .true.
-    ENDIF
-    
-    IF (mpi_rank == 0) THEN 
-      is_north_pole = .TRUE.
-    ELSE
-      is_north_pole = .FALSE.
-    ENDIF
-    
-    IF (mpi_rank == mpi_size-1) THEN
-      is_south_pole = .TRUE.
-    ELSE
-      is_south_pole = .FALSE.
-    ENDIF
-    
-    ALLOCATE(jj_para_nb(0:mpi_size-1))
-    ALLOCATE(jj_para_begin(0:mpi_size-1))
-    ALLOCATE(jj_para_end(0:mpi_size-1))
-    
-    ALLOCATE(ij_para_nb(0:mpi_size-1))
-    ALLOCATE(ij_para_begin(0:mpi_size-1))
-    ALLOCATE(ij_para_end(0:mpi_size-1))
-    
-    ALLOCATE(ii_para_begin(0:mpi_size-1))
-    ALLOCATE(ii_para_end(0:mpi_size-1))
-
-    ALLOCATE(klon_mpi_para_nb(0:mpi_size-1))
-    ALLOCATE(klon_mpi_para_begin(0:mpi_size-1))
-    ALLOCATE(klon_mpi_para_end(0:mpi_size-1))
-  
-      
-    klon_mpi_para_nb(0:mpi_size-1)=distrib(0:nb_proc-1)
-
-    DO i=0,mpi_size-1
-      IF (i==0) THEN 
-        klon_mpi_para_begin(i)=1
-      ELSE 
-        klon_mpi_para_begin(i)=klon_mpi_para_end(i-1)+1
-      ENDIF
-        klon_mpi_para_end(i)=klon_mpi_para_begin(i)+klon_mpi_para_nb(i)-1
-    ENDDO
-
-
-    DO i=0,mpi_size-1
-      
-      IF (i==0) THEN
-        ij_para_begin(i) = 1
-      ELSE
-        ij_para_begin(i) = klon_mpi_para_begin(i)+iim-1
-      ENDIF
-
-      jj_para_begin(i) = (ij_para_begin(i)-1)/iim + 1
-      ii_para_begin(i) = MOD(ij_para_begin(i)-1,iim) + 1
-
-      
-      ij_para_end(i) = klon_mpi_para_end(i)+iim-1
-      jj_para_end(i) = (ij_para_end(i)-1)/iim + 1
-      ii_para_end(i) = MOD(ij_para_end(i)-1,iim) + 1
-
-
-      ij_para_nb(i) = ij_para_end(i)-ij_para_begin(i)+1
-      jj_para_nb(i) = jj_para_end(i)-jj_para_begin(i)+1
-         
-    ENDDO
-  
-    ii_begin = ii_para_begin(mpi_rank)
-    ii_end   = ii_para_end(mpi_rank)
-    jj_begin = jj_para_begin(mpi_rank)
-    jj_end   = jj_para_end(mpi_rank)
-    jj_nb    = jj_para_nb(mpi_rank)
-    ij_begin = ij_para_begin(mpi_rank)
-    ij_end   = ij_para_end(mpi_rank)
-    ij_nb    = ij_para_nb(mpi_rank)
-    klon_mpi_begin = klon_mpi_para_begin(mpi_rank)
-    klon_mpi_end   = klon_mpi_para_end(mpi_rank)
-    klon_mpi       = klon_mpi_para_nb(mpi_rank)
-   
-    CALL Print_module_data
-    
-  END SUBROUTINE Init_phys_lmdz_mpi_data
-
-  SUBROUTINE print_module_data
-  IMPLICIT NONE
-  INCLUDE "iniprint.h" 
-  
-    WRITE(lunout,*) 'ii_begin =', ii_begin
-    WRITE(lunout,*) 'ii_end =', ii_end
-    WRITE(lunout,*) 'jj_begin =',jj_begin
-    WRITE(lunout,*) 'jj_end =', jj_end
-    WRITE(lunout,*) 'jj_nb =', jj_nb
-    WRITE(lunout,*) 'ij_begin =', ij_begin
-    WRITE(lunout,*) 'ij_end =', ij_end
-    WRITE(lunout,*) 'ij_nb =', ij_nb
-    WRITE(lunout,*) 'klon_mpi_begin =', klon_mpi_begin
-    WRITE(lunout,*) 'klon_mpi_end =', klon_mpi_end
-    WRITE(lunout,*) 'klon_mpi =', klon_mpi
-    WRITE(lunout,*) 'jj_para_nb =', jj_para_nb
-    WRITE(lunout,*) 'jj_para_begin =', jj_para_begin
-    WRITE(lunout,*) 'jj_para_end =', jj_para_end
-    WRITE(lunout,*) 'ii_para_begin =', ii_para_begin
-    WRITE(lunout,*) 'ii_para_end =', ii_para_end
-    WRITE(lunout,*) 'ij_para_nb =', ij_para_nb
-    WRITE(lunout,*) 'ij_para_begin =', ij_para_begin
-    WRITE(lunout,*) 'ij_para_end =', ij_para_end
-    WRITE(lunout,*) 'klon_mpi_para_nb =', klon_mpi_para_nb
-    WRITE(lunout,*) 'klon_mpi_para_begin =', klon_mpi_para_begin
-    WRITE(lunout,*) 'klon_mpi_para_end  =', klon_mpi_para_end 
-    WRITE(lunout,*) 'mpi_rank =', mpi_rank
-    WRITE(lunout,*) 'mpi_size =', mpi_size
-    WRITE(lunout,*) 'mpi_root =', mpi_root
-    WRITE(lunout,*) 'is_mpi_root =', is_mpi_root
-    WRITE(lunout,*) 'is_north_pole =', is_north_pole
-    WRITE(lunout,*) 'is_south_pole =', is_south_pole
-    WRITE(lunout,*) 'COMM_LMDZ_PHY =', COMM_LMDZ_PHY
-  
-  END SUBROUTINE print_module_data
-  
-END MODULE mod_phys_lmdz_mpi_data
Index: namico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_mpi_transfert.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_mpi_transfert.F90	(revision 3813)
+++ 	(revision )
@@ -1,1902 +1,0 @@
-!
-!$Header$
-!
-MODULE mod_phys_lmdz_mpi_transfert
-
-
-  INTERFACE bcast_mpi
-    MODULE PROCEDURE bcast_mpi_c,                                                     &
-                     bcast_mpi_i,bcast_mpi_i1,bcast_mpi_i2,bcast_mpi_i3,bcast_mpi_i4, &
-                     bcast_mpi_r,bcast_mpi_r1,bcast_mpi_r2,bcast_mpi_r3,bcast_mpi_r4, &
-                     bcast_mpi_l,bcast_mpi_l1,bcast_mpi_l2,bcast_mpi_l3,bcast_mpi_l4
-  END INTERFACE
-
-  INTERFACE scatter_mpi
-    MODULE PROCEDURE scatter_mpi_i,scatter_mpi_i1,scatter_mpi_i2,scatter_mpi_i3, &
-                     scatter_mpi_r,scatter_mpi_r1,scatter_mpi_r2,scatter_mpi_r3, &
-                     scatter_mpi_l,scatter_mpi_l1,scatter_mpi_l2,scatter_mpi_l3
-  END INTERFACE
-
-  
-  INTERFACE gather_mpi
-    MODULE PROCEDURE gather_mpi_i,gather_mpi_i1,gather_mpi_i2,gather_mpi_i3, &
-                     gather_mpi_r,gather_mpi_r1,gather_mpi_r2,gather_mpi_r3, &
-                     gather_mpi_l,gather_mpi_l1,gather_mpi_l2,gather_mpi_l3  
-  END INTERFACE
-  
-  INTERFACE scatter2D_mpi
-    MODULE PROCEDURE scatter2D_mpi_i,scatter2D_mpi_i1,scatter2D_mpi_i2,scatter2D_mpi_i3, &
-                     scatter2D_mpi_r,scatter2D_mpi_r1,scatter2D_mpi_r2,scatter2D_mpi_r3, &
-                     scatter2D_mpi_l,scatter2D_mpi_l1,scatter2D_mpi_l2,scatter2D_mpi_l3
-  END INTERFACE
-
-  INTERFACE gather2D_mpi
-    MODULE PROCEDURE gather2D_mpi_i,gather2D_mpi_i1,gather2D_mpi_i2,gather2D_mpi_i3, &
-                     gather2D_mpi_r,gather2D_mpi_r1,gather2D_mpi_r2,gather2D_mpi_r3, &
-                     gather2D_mpi_l,gather2D_mpi_l1,gather2D_mpi_l2,gather2D_mpi_l3
-  END INTERFACE 
-  
-  INTERFACE reduce_sum_mpi
-    MODULE PROCEDURE reduce_sum_mpi_i,reduce_sum_mpi_i1,reduce_sum_mpi_i2,reduce_sum_mpi_i3,reduce_sum_mpi_i4, &
-                     reduce_sum_mpi_r,reduce_sum_mpi_r1,reduce_sum_mpi_r2,reduce_sum_mpi_r3,reduce_sum_mpi_r4
-  END INTERFACE 
-
- INTERFACE grid1dTo2d_mpi
-    MODULE PROCEDURE grid1dTo2d_mpi_i,grid1dTo2d_mpi_i1,grid1dTo2d_mpi_i2,grid1dTo2d_mpi_i3, &
-                     grid1dTo2d_mpi_r,grid1dTo2d_mpi_r1,grid1dTo2d_mpi_r2,grid1dTo2d_mpi_r3, &
-                     grid1dTo2d_mpi_l,grid1dTo2d_mpi_l1,grid1dTo2d_mpi_l2,grid1dTo2d_mpi_l3
- END INTERFACE 
-
- INTERFACE grid2dTo1d_mpi
-    MODULE PROCEDURE grid2dTo1d_mpi_i,grid2dTo1d_mpi_i1,grid2dTo1d_mpi_i2,grid2dTo1d_mpi_i3, &
-                     grid2dTo1d_mpi_r,grid2dTo1d_mpi_r1,grid2dTo1d_mpi_r2,grid2dTo1d_mpi_r3, &
-                     grid2dTo1d_mpi_l,grid2dTo1d_mpi_l1,grid2dTo1d_mpi_l2,grid2dTo1d_mpi_l3
- END INTERFACE 
-    
-CONTAINS
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Broadcast --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-!! -- Les chaine de charactère -- !!
-
-  SUBROUTINE bcast_mpi_c(var1)
-  IMPLICIT NONE
-    CHARACTER(LEN=*),INTENT(INOUT) :: Var1
-   
-    CALL bcast_mpi_cgen(Var1,len(Var1))
-
-  END SUBROUTINE bcast_mpi_c
-
-!! -- Les entiers -- !!
-  
-  SUBROUTINE bcast_mpi_i(var)
-  USE mod_phys_lmdz_mpi_data, ONLY : is_mpi_root
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var
-    
-    INTEGER               :: var_tmp(1)
-    
-    IF (is_mpi_root) var_tmp(1)=var
-    CALL bcast_mpi_igen(Var_tmp,1)
-    var=var_tmp(1)
-    
-  END SUBROUTINE bcast_mpi_i
-
-  SUBROUTINE bcast_mpi_i1(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:)
-
-    CALL bcast_mpi_igen(Var,size(Var))
-    
-  END SUBROUTINE bcast_mpi_i1
-
-  SUBROUTINE bcast_mpi_i2(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:,:)
-   
-    CALL bcast_mpi_igen(Var,size(Var))
-  
-  END SUBROUTINE bcast_mpi_i2
-
-  SUBROUTINE bcast_mpi_i3(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:,:,:)
-   
-    CALL bcast_mpi_igen(Var,size(Var))
-
-  END SUBROUTINE bcast_mpi_i3
-
-  SUBROUTINE bcast_mpi_i4(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:,:,:,:)
-   
-    CALL bcast_mpi_igen(Var,size(Var))
-
-  END SUBROUTINE bcast_mpi_i4
-
-
-!! -- Les reels -- !!
-
-  SUBROUTINE bcast_mpi_r(var)
-  USE mod_phys_lmdz_mpi_data, ONLY : is_mpi_root
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var
-    REAL               :: var_tmp(1)
-    
-    IF (is_mpi_root) var_tmp(1)=var
-    CALL bcast_mpi_rgen(Var_tmp,1)
-    var=var_tmp(1)   
-
-  END SUBROUTINE bcast_mpi_r
-
-  SUBROUTINE bcast_mpi_r1(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:)
-   
-    CALL bcast_mpi_rgen(Var,size(Var))
-
-  END SUBROUTINE bcast_mpi_r1
-
-  SUBROUTINE bcast_mpi_r2(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:,:)
-   
-    CALL bcast_mpi_rgen(Var,size(Var))
-
-  END SUBROUTINE bcast_mpi_r2
-
-  SUBROUTINE bcast_mpi_r3(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:,:,:)
-   
-    CALL bcast_mpi_rgen(Var,size(Var))
-
-  END SUBROUTINE bcast_mpi_r3
-
-  SUBROUTINE bcast_mpi_r4(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:,:,:,:)
-   
-    CALL bcast_mpi_rgen(Var,size(Var))
-
-  END SUBROUTINE bcast_mpi_r4
-  
-!! -- Les booleans -- !!
-
-  SUBROUTINE bcast_mpi_l(var)
-  USE mod_phys_lmdz_mpi_data, ONLY : is_mpi_root
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var
-    LOGICAL               :: var_tmp(1)
-    
-    IF (is_mpi_root) var_tmp(1)=var
-    CALL bcast_mpi_lgen(Var_tmp,1)
-    var=var_tmp(1)   
-
-  END SUBROUTINE bcast_mpi_l
-
-  SUBROUTINE bcast_mpi_l1(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:)
-   
-    CALL bcast_mpi_lgen(Var,size(Var))
-
-  END SUBROUTINE bcast_mpi_l1
-
-  SUBROUTINE bcast_mpi_l2(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:,:)
-   
-    CALL bcast_mpi_lgen(Var,size(Var))
-
-  END SUBROUTINE bcast_mpi_l2
-
-  SUBROUTINE bcast_mpi_l3(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:,:,:)
-   
-    CALL bcast_mpi_lgen(Var,size(Var))
-
-  END SUBROUTINE bcast_mpi_l3
-
-  SUBROUTINE bcast_mpi_l4(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
-   
-    CALL bcast_mpi_lgen(Var,size(Var))
-
-  END SUBROUTINE bcast_mpi_l4
-  
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Scatter   --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-  SUBROUTINE scatter_mpi_i(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    CALL scatter_mpi_igen(VarIn,Varout,1)
-    
-  END SUBROUTINE scatter_mpi_i
-
-  SUBROUTINE scatter_mpi_i1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    CALL scatter_mpi_igen(VarIn,Varout,Size(VarOut,2))
-    
-  END SUBROUTINE scatter_mpi_i1
-  
-  SUBROUTINE scatter_mpi_i2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    CALL scatter_mpi_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3))
-
-  END SUBROUTINE scatter_mpi_i2
-
-  SUBROUTINE scatter_mpi_i3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    CALL scatter_mpi_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4))
-  
-  END SUBROUTINE scatter_mpi_i3
-
-
-  SUBROUTINE scatter_mpi_r(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-      CALL scatter_mpi_rgen(VarIn,Varout,1)
-  
-  END SUBROUTINE scatter_mpi_r
-
-  SUBROUTINE scatter_mpi_r1(VarIn, VarOut)
-  USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-  IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-      CALL scatter_mpi_rgen(VarIn,Varout,Size(VarOut,2))
-  
-  END SUBROUTINE scatter_mpi_r1
-  
-  SUBROUTINE scatter_mpi_r2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-      CALL scatter_mpi_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3))
-  
-  END SUBROUTINE scatter_mpi_r2
-
-  SUBROUTINE scatter_mpi_r3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-      CALL scatter_mpi_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4))
-  
-  END SUBROUTINE scatter_mpi_r3
-
-
-  SUBROUTINE scatter_mpi_l(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-      CALL scatter_mpi_lgen(VarIn,Varout,1)
-    
-  END SUBROUTINE scatter_mpi_l
-
-  SUBROUTINE scatter_mpi_l1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-      CALL scatter_mpi_lgen(VarIn,Varout,Size(VarOut,2))
-  
-  END SUBROUTINE scatter_mpi_l1
-  
-  SUBROUTINE scatter_mpi_l2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-      CALL scatter_mpi_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3))
-  
-  END SUBROUTINE scatter_mpi_l2
-
-  SUBROUTINE scatter_mpi_l3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-      CALL scatter_mpi_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4))
-  
-  END SUBROUTINE scatter_mpi_l3  
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Gather   --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 
-!!!!! --> Les entiers
-
-  SUBROUTINE gather_mpi_i(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-      CALL gather_mpi_igen(VarIn,VarOut,1)
-  
-  END SUBROUTINE gather_mpi_i
-  
-
-!!!!!
-
-  SUBROUTINE gather_mpi_i1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-      CALL gather_mpi_igen(VarIn,VarOut,Size(VarIn,2))
-  
-  END SUBROUTINE gather_mpi_i1
-
-!!!!!
-  
-  SUBROUTINE gather_mpi_i2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-      CALL gather_mpi_igen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3))
-  
-  END SUBROUTINE gather_mpi_i2
-
-!!!!!
-
-  SUBROUTINE gather_mpi_i3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-      CALL gather_mpi_igen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4))
-  
-  END SUBROUTINE gather_mpi_i3
-
-!!!!! --> Les reels
-
-  SUBROUTINE gather_mpi_r(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-      CALL gather_mpi_rgen(VarIn,VarOut,1)
-  
-  END SUBROUTINE gather_mpi_r
-
-!!!!!
-
-  SUBROUTINE gather_mpi_r1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-      CALL gather_mpi_rgen(VarIn,VarOut,Size(VarIn,2))
-  
-  END SUBROUTINE gather_mpi_r1
-
-!!!!!
-  
-  SUBROUTINE gather_mpi_r2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-      CALL gather_mpi_rgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3))
-  
-  END SUBROUTINE gather_mpi_r2
-
-!!!!!
-
-  SUBROUTINE gather_mpi_r3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-      CALL gather_mpi_rgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4))
-  
-  END SUBROUTINE gather_mpi_r3
-
-!!!!! --> Les booleen
-
-  SUBROUTINE gather_mpi_l(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-      CALL gather_mpi_lgen(VarIn,VarOut,1)
-  
-  END SUBROUTINE gather_mpi_l
-
-!!!!!
-
-  SUBROUTINE gather_mpi_l1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-      CALL gather_mpi_lgen(VarIn,VarOut,Size(VarIn,2))
-  
-  END SUBROUTINE gather_mpi_l1
-
-!!!!!
-  
-  SUBROUTINE gather_mpi_l2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-      CALL gather_mpi_lgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3))
-  
-  END SUBROUTINE gather_mpi_l2
-
-!!!!!
-
-  SUBROUTINE gather_mpi_l3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    CALL gather_mpi_lgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4))
-  
-  END SUBROUTINE gather_mpi_l3
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Scatter2D   --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-  SUBROUTINE scatter2D_mpi_i(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    INTEGER,DIMENSION(klon_glo) :: Var_tmp    
-    
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_mpi_i
-
-  SUBROUTINE scatter2D_mpi_i1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    INTEGER,DIMENSION(klon_glo,size(VarOut,2)) :: Var_tmp
-
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_mpi_i1
-
-  SUBROUTINE scatter2D_mpi_i2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-
-    INTEGER,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3)) :: Var_tmp
-
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_mpi_i2
-  
-  SUBROUTINE scatter2D_mpi_i3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    INTEGER,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3),size(VarOut,4)) :: Var_tmp
-
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
-    
-  END SUBROUTINE scatter2D_mpi_i3
-
-
-
-  SUBROUTINE scatter2D_mpi_r(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    REAL,DIMENSION(klon_glo) :: Var_tmp    
-    
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_mpi_R
-
-
-  SUBROUTINE scatter2D_mpi_r1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    REAL,DIMENSION(klon_glo,size(VarOut,2)) :: Var_tmp
-    
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_mpi_r1
-
-
-  SUBROUTINE scatter2D_mpi_r2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-
-    REAL,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3)) :: Var_tmp
-    
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_mpi_r2
-  
-  SUBROUTINE scatter2D_mpi_r3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    REAL,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3),size(VarOut,4)) :: Var_tmp
-
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
- 
-  END SUBROUTINE scatter2D_mpi_r3
-  
-  
-  SUBROUTINE scatter2D_mpi_l(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    LOGICAL,DIMENSION(klon_glo) :: Var_tmp    
-    
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_mpi_l
-
-
-  SUBROUTINE scatter2D_mpi_l1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    LOGICAL,DIMENSION(klon_glo,size(VarOut,2)) :: Var_tmp
-
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
-  
-  END SUBROUTINE scatter2D_mpi_l1
-
-
-  SUBROUTINE scatter2D_mpi_l2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    LOGICAL, DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3)) :: Var_tmp
-  
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_mpi_l2
-  
-  SUBROUTINE scatter2D_mpi_l3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    LOGICAL,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3),size(VarOut,4)) :: Var_tmp
-
-    CALL grid2dTo1d_glo(VarIn,Var_tmp)
-    CALL scatter_mpi(Var_tmp,VarOut)
- 
-  END SUBROUTINE scatter2D_mpi_l3
-  
-  
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Gather2D   --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-  SUBROUTINE gather2D_mpi_i(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    INTEGER,DIMENSION(klon_glo) :: Var_tmp
-    
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_i
-
-  SUBROUTINE gather2D_mpi_i1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-
-    INTEGER,DIMENSION(klon_glo,size(VarOut,3)) :: Var_tmp
-
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_i1
-
-  SUBROUTINE gather2D_mpi_i2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-
-    INTEGER,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4)) :: Var_tmp
-    
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_i2
-  
-  SUBROUTINE gather2D_mpi_i3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
- 
-    INTEGER,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4),SIZE(VarOut,5)) :: Var_tmp
-    
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_i3
-
-
-
-  SUBROUTINE gather2D_mpi_r(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    REAL,DIMENSION(klon_glo) :: Var_tmp
-    
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_r
-
-  SUBROUTINE gather2D_mpi_r1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    REAL,DIMENSION(klon_glo,size(VarOut,3)) :: Var_tmp
-
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_r1
-
-  SUBROUTINE gather2D_mpi_r2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    REAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4)) :: Var_tmp
-
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_r2
-  
-  SUBROUTINE gather2D_mpi_r3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
-    
-    REAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4),SIZE(VarOut,5)) :: Var_tmp
-    
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_r3
-
-  
-  
-  SUBROUTINE gather2D_mpi_l(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    LOGICAL,DIMENSION(klon_glo) :: Var_tmp
-    
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_l
-
-  SUBROUTINE gather2D_mpi_l1(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    LOGICAL,DIMENSION(klon_glo,size(VarOut,3)) :: Var_tmp
-
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_l1
-
-  SUBROUTINE gather2D_mpi_l2(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    LOGICAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4)) :: Var_tmp
-
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_l2
-  
-  SUBROUTINE gather2D_mpi_l3(VarIn, VarOut)
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
-    
-    LOGICAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4),SIZE(VarOut,5)) :: Var_tmp
-    
-    CALL gather_mpi(VarIn,Var_tmp)
-    CALL grid1dTo2d_glo(Var_tmp,VarOut)
-
-  END SUBROUTINE gather2D_mpi_l3
-  
-  
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des reduce_sum   --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-  SUBROUTINE reduce_sum_mpi_i(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN)  :: VarIn
-    INTEGER,INTENT(OUT) :: VarOut
-    INTEGER             :: VarIn_tmp(1)
-    INTEGER             :: VarOut_tmp(1)
-    
-    VarIn_tmp(1)=VarIn    
-    CALL reduce_sum_mpi_igen(VarIn_tmp,Varout_tmp,1)
-    VarOut=VarOut_tmp(1)
-    
-  END SUBROUTINE reduce_sum_mpi_i
-
-  SUBROUTINE reduce_sum_mpi_i1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
-  
-  END SUBROUTINE reduce_sum_mpi_i1
-
-  SUBROUTINE reduce_sum_mpi_i2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
-  
-  END SUBROUTINE reduce_sum_mpi_i2
-
-  SUBROUTINE reduce_sum_mpi_i3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
-  
-  END SUBROUTINE reduce_sum_mpi_i3
-
-  SUBROUTINE reduce_sum_mpi_i4(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
-  
-  END SUBROUTINE reduce_sum_mpi_i4                  
-  
-  
-  SUBROUTINE reduce_sum_mpi_r(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN)  :: VarIn
-    REAL,INTENT(OUT) :: VarOut
-    REAL             :: VarIn_tmp(1)
-    REAL             :: VarOut_tmp(1)
-    
-    VarIn_tmp(1)=VarIn    
-    CALL reduce_sum_mpi_rgen(VarIn_tmp,Varout_tmp,1)
-    VarOut=VarOut_tmp(1)
-  
-  END SUBROUTINE reduce_sum_mpi_r
-
-  SUBROUTINE reduce_sum_mpi_r1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
-     
-  END SUBROUTINE reduce_sum_mpi_r1
-
-  SUBROUTINE reduce_sum_mpi_r2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
-  
-  END SUBROUTINE reduce_sum_mpi_r2
-
-  SUBROUTINE reduce_sum_mpi_r3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
-  
-  END SUBROUTINE reduce_sum_mpi_r3
-
-  SUBROUTINE reduce_sum_mpi_r4(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
-  
-  END SUBROUTINE reduce_sum_mpi_r4 
-  
-
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! SUBROUTINE grid1dTo2d  !!  
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-
-  SUBROUTINE grid1dTo2d_mpi_i(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:)     :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid1dTo2d_mpi_i
-  
-
-  SUBROUTINE grid1dTo2d_mpi_i1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:)     :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,size(VarIn,2))
-  
-  END SUBROUTINE grid1dTo2d_mpi_i1
-
-  SUBROUTINE grid1dTo2d_mpi_i2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
-  
-  END SUBROUTINE grid1dTo2d_mpi_i2
-  
-  SUBROUTINE grid1dTo2d_mpi_i3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid1dTo2d_mpi_i3
-
-
-  SUBROUTINE grid1dTo2d_mpi_r(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:)     :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid1dTo2d_mpi_r
-  
-
-  SUBROUTINE grid1dTo2d_mpi_r1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,size(VarIn,2))
-  
-  END SUBROUTINE grid1dTo2d_mpi_r1
-
-  SUBROUTINE grid1dTo2d_mpi_r2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
-  
-  END SUBROUTINE grid1dTo2d_mpi_r2
-  
-  SUBROUTINE grid1dTo2d_mpi_r3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid1dTo2d_mpi_r3
-  
-  
-  
-  SUBROUTINE grid1dTo2d_mpi_l(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:)     :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid1dTo2d_mpi_l
-  
-
-  SUBROUTINE grid1dTo2d_mpi_l1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,size(VarIn,2))
-  
-  END SUBROUTINE grid1dTo2d_mpi_l1
-
-  SUBROUTINE grid1dTo2d_mpi_l2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
-  
-  END SUBROUTINE grid1dTo2d_mpi_l2
-  
-  SUBROUTINE grid1dTo2d_mpi_l3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
-    
-    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid1dTo2d_mpi_l3
-
-
-  SUBROUTINE grid2dTo1d_mpi_i(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid2dTo1d_mpi_i
-  
-
-  SUBROUTINE grid2dTo1d_mpi_i1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,size(VarIn,3))
-  
-  END SUBROUTINE grid2dTo1d_mpi_i1
-
-  SUBROUTINE grid2dTo1d_mpi_i2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid2dTo1d_mpi_i2
-  
-  SUBROUTINE grid2dTo1d_mpi_i3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
-  
-  END SUBROUTINE grid2dTo1d_mpi_i3
- 
-
-
-
-  SUBROUTINE grid2dTo1d_mpi_r(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid2dTo1d_mpi_r
-  
-
-  SUBROUTINE grid2dTo1d_mpi_r1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,size(VarIn,3))
-  
-  END SUBROUTINE grid2dTo1d_mpi_r1
-
-  SUBROUTINE grid2dTo1d_mpi_r2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid2dTo1d_mpi_r2
-  
-  SUBROUTINE grid2dTo1d_mpi_r3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
-  
-  END SUBROUTINE grid2dTo1d_mpi_r3
-
-
-
-  SUBROUTINE grid2dTo1d_mpi_l(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,1)
-  
-  END SUBROUTINE grid2dTo1d_mpi_l
-  
-
-  SUBROUTINE grid2dTo1d_mpi_l1(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,size(VarIn,3))
-  
-  END SUBROUTINE grid2dTo1d_mpi_l1
-
-
-
-  SUBROUTINE grid2dTo1d_mpi_l2(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
-  
-  END SUBROUTINE grid2dTo1d_mpi_l2
-
-  
-  SUBROUTINE grid2dTo1d_mpi_l3(VarIn,VarOut)  
-  IMPLICIT NONE  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
-    
-    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
-  
-  END SUBROUTINE grid2dTo1d_mpi_l3
-
-               
-
-
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! DEFINITION DES FONCTIONS DE TRANSFERT GENERIQUES !
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-  SUBROUTINE bcast_mpi_cgen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
-    CHARACTER(LEN=*),INTENT(INOUT) :: Var
-    INTEGER,INTENT(IN) :: nb
-    
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    INTEGER :: ierr
-
-    IF (.not.is_using_mpi) RETURN
-    
-#ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_CHARACTER,mpi_root_x,COMM_LMDZ_PHY,ierr)
-#endif
-        
-  END SUBROUTINE bcast_mpi_cgen
-
-
-      
-  SUBROUTINE bcast_mpi_igen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: nb
-    INTEGER,DIMENSION(nb),INTENT(INOUT) :: Var
-    
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    INTEGER :: ierr
-
-    IF (.not.is_using_mpi) RETURN
-
-#ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_INTEGER,mpi_root_x,COMM_LMDZ_PHY,ierr)
-#endif
-        
-  END SUBROUTINE bcast_mpi_igen
-
-
-
-  
-  SUBROUTINE bcast_mpi_rgen(var,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: nb
-    REAL,DIMENSION(nb),INTENT(INOUT) :: Var
-    
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    INTEGER :: ierr
-
-    IF (.not.is_using_mpi) RETURN
-
-#ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_root_x,COMM_LMDZ_PHY,ierr)
-#endif
-    
-  END SUBROUTINE bcast_mpi_rgen
-  
-
-
-
-  SUBROUTINE bcast_mpi_lgen(var,nb)
-    USE mod_phys_lmdz_mpi_data ,  mpi_root_x=>mpi_root
-    IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: nb
-    LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
-    
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    INTEGER :: ierr
-
-    IF (.not.is_using_mpi) RETURN
-
-#ifdef CPP_MPI
-    CALL MPI_BCAST(Var,nb,MPI_LOGICAL,mpi_root_x,COMM_LMDZ_PHY,ierr)
-#endif
-
-  END SUBROUTINE bcast_mpi_lgen
-
-  
-
-  SUBROUTINE scatter_mpi_igen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN) :: dimsize
-    INTEGER,INTENT(IN),DIMENSION(klon_glo,dimsize) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
-  
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    INTEGER,DIMENSION(0:mpi_size-1) :: displs
-    INTEGER,DIMENSION(0:mpi_size-1) :: counts
-    INTEGER,DIMENSION(dimsize*klon_glo) :: VarTmp
-    INTEGER :: nb,i,index,rank
-    INTEGER :: ierr
-
-
-    IF (.not.is_using_mpi) THEN
-      VarOut(:,:)=VarIn(:,:)
-      RETURN
-    ENDIF
-
-    
-    IF (is_mpi_root) THEN
-      Index=1
-      DO rank=0,mpi_size-1
-        nb=klon_mpi_para_nb(rank)
-        displs(rank)=Index-1
-        counts(rank)=nb*dimsize
-        DO i=1,dimsize
-          VarTmp(Index:Index+nb-1)=VarIn(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)
-          Index=Index+nb
-        ENDDO
-      ENDDO
-    ENDIF
-      
-#ifdef CPP_MPI 
-    CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_INTEGER,VarOut,klon_mpi*dimsize,   &
-                      MPI_INTEGER,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-
-  END SUBROUTINE scatter_mpi_igen
-
-  SUBROUTINE scatter_mpi_rgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN) :: dimsize
-    REAL,INTENT(IN),DIMENSION(klon_glo,dimsize) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
-  
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-
-    INTEGER,DIMENSION(0:mpi_size-1) :: displs
-    INTEGER,DIMENSION(0:mpi_size-1) :: counts
-    REAL,DIMENSION(dimsize*klon_glo) :: VarTmp
-    INTEGER :: nb,i,index,rank
-    INTEGER :: ierr
-
-    IF (.not.is_using_mpi) THEN
-      VarOut(:,:)=VarIn(:,:)
-      RETURN
-    ENDIF
-    
-    IF (is_mpi_root) THEN
-      Index=1
-      DO rank=0,mpi_size-1
-        nb=klon_mpi_para_nb(rank)
-        displs(rank)=Index-1
-        counts(rank)=nb*dimsize
-        DO i=1,dimsize
-          VarTmp(Index:Index+nb-1)=VarIn(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)
-          Index=Index+nb
-        ENDDO
-      ENDDO
-    ENDIF
-      
-#ifdef CPP_MPI 
-    CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_REAL_LMDZ,VarOut,klon_mpi*dimsize,   &
-                      MPI_REAL_LMDZ,mpi_root_x, COMM_LMDZ_PHY,ierr)
-
-#endif
-
-  END SUBROUTINE scatter_mpi_rgen
-
-  
-  SUBROUTINE scatter_mpi_lgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN) :: dimsize
-    LOGICAL,INTENT(IN),DIMENSION(klon_glo,dimsize) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
-  
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-
-    INTEGER,DIMENSION(0:mpi_size-1) :: displs
-    INTEGER,DIMENSION(0:mpi_size-1) :: counts
-    LOGICAL,DIMENSION(dimsize*klon_glo) :: VarTmp
-    INTEGER :: nb,i,index,rank
-    INTEGER :: ierr
-
-    IF (.not.is_using_mpi) THEN
-      VarOut(:,:)=VarIn(:,:)
-      RETURN
-    ENDIF
-    
-    IF (is_mpi_root) THEN
-      Index=1
-      DO rank=0,mpi_size-1
-        nb=klon_mpi_para_nb(rank)
-        displs(rank)=Index-1
-        counts(rank)=nb*dimsize
-        DO i=1,dimsize
-          VarTmp(Index:Index+nb-1)=VarIn(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)
-          Index=Index+nb
-        ENDDO
-      ENDDO
-    ENDIF
-      
-#ifdef CPP_MPI
-    CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_LOGICAL,VarOut,klon_mpi*dimsize,   &
-                      MPI_LOGICAL,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-
-  END SUBROUTINE scatter_mpi_lgen  
-
-
-
-
-  SUBROUTINE gather_mpi_igen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    
-    INTEGER,INTENT(IN) :: dimsize
-    INTEGER,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(klon_glo,dimsize) :: VarOut
-  
-    INTEGER,DIMENSION(0:mpi_size-1) :: displs
-    INTEGER,DIMENSION(0:mpi_size-1) :: counts
-    INTEGER,DIMENSION(dimsize*klon_glo) :: VarTmp
-    INTEGER :: nb,i,index,rank
-    INTEGER :: ierr
-
-    IF (.not.is_using_mpi) THEN
-      VarOut(:,:)=VarIn(:,:)
-      RETURN
-    ENDIF
-
-    IF (is_mpi_root) THEN
-      Index=1
-      DO rank=0,mpi_size-1
-        nb=klon_mpi_para_nb(rank)
-        displs(rank)=Index-1
-        counts(rank)=nb*dimsize
-        Index=Index+nb*dimsize
-      ENDDO
-     
-    ENDIF
-    
-#ifdef CPP_MPI
-    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_INTEGER,VarTmp,counts,displs,   &
-                     MPI_INTEGER,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-
-                          
-    IF (is_mpi_root) THEN
-      Index=1
-      DO rank=0,mpi_size-1
-        nb=klon_mpi_para_nb(rank)
-        DO i=1,dimsize
-          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-          Index=Index+nb
-        ENDDO
-      ENDDO
-    ENDIF
-
-  END SUBROUTINE gather_mpi_igen  
-
-  SUBROUTINE gather_mpi_rgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    
-    INTEGER,INTENT(IN) :: dimsize
-    REAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(klon_glo,dimsize) :: VarOut
-  
-    INTEGER,DIMENSION(0:mpi_size-1) :: displs
-    INTEGER,DIMENSION(0:mpi_size-1) :: counts
-    REAL,DIMENSION(dimsize*klon_glo) :: VarTmp
-    INTEGER :: nb,i,index,rank
-    INTEGER :: ierr
-
-    IF (is_mpi_root) THEN
-      Index=1
-      DO rank=0,mpi_size-1
-        nb=klon_mpi_para_nb(rank)
-        displs(rank)=Index-1
-        counts(rank)=nb*dimsize
-        Index=Index+nb*dimsize
-      ENDDO
-    ENDIF
-    
-    IF (.not.is_using_mpi) THEN
-      VarOut(:,:)=VarIn(:,:)
-      RETURN
-    ENDIF
-
-#ifdef CPP_MPI
-    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_REAL_LMDZ,VarTmp,counts,displs,   &
-                      MPI_REAL_LMDZ,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-                          
-    IF (is_mpi_root) THEN
-      Index=1
-      DO rank=0,mpi_size-1
-        nb=klon_mpi_para_nb(rank)
-        DO i=1,dimsize
-          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-          Index=Index+nb
-        ENDDO
-      ENDDO
-    ENDIF
-
-  END SUBROUTINE gather_mpi_rgen  
-
-  SUBROUTINE gather_mpi_lgen(VarIn, VarOut, dimsize)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN) :: dimsize
-    LOGICAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(klon_glo,dimsize) :: VarOut
-  
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-
-    INTEGER,DIMENSION(0:mpi_size-1) :: displs
-    INTEGER,DIMENSION(0:mpi_size-1) :: counts
-    LOGICAL,DIMENSION(dimsize*klon_glo) :: VarTmp
-    INTEGER :: nb,i,index,rank
-    INTEGER :: ierr
-    
-    IF (.not.is_using_mpi) THEN
-      VarOut(:,:)=VarIn(:,:)
-      RETURN
-    ENDIF
-
-    IF (is_mpi_root) THEN
-      Index=1
-      DO rank=0,mpi_size-1
-        nb=klon_mpi_para_nb(rank)
-        displs(rank)=Index-1
-        counts(rank)=nb*dimsize
-        Index=Index+nb*dimsize
-      ENDDO
-    ENDIF
-    
-
-#ifdef CPP_MPI
-    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_LOGICAL,VarTmp,counts,displs,   &
-                      MPI_LOGICAL,mpi_root_x, COMM_LMDZ_PHY,ierr)
-#endif
-                          
-    IF (is_mpi_root) THEN
-      Index=1
-      DO rank=0,mpi_size-1
-        nb=klon_mpi_para_nb(rank)
-        DO i=1,dimsize
-          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
-          Index=Index+nb
-        ENDDO
-      ENDDO
-    ENDIF
-
-  END SUBROUTINE gather_mpi_lgen
-  
-
-
-  SUBROUTINE reduce_sum_mpi_igen(VarIn,VarOut,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-    
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-   
-    INTEGER,INTENT(IN) :: nb
-    INTEGER,DIMENSION(nb),INTENT(IN) :: VarIn
-    INTEGER,DIMENSION(nb),INTENT(OUT) :: VarOut    
-    INTEGER :: ierr
-   
-    IF (.not.is_using_mpi) THEN
-      VarOut(:)=VarIn(:)
-      RETURN
-    ENDIF
-
-
-#ifdef CPP_MPI
-    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_INTEGER,MPI_SUM,mpi_root_x,COMM_LMDZ_PHY,ierr)
-#endif
-            
-  END SUBROUTINE reduce_sum_mpi_igen
-  
-  SUBROUTINE reduce_sum_mpi_rgen(VarIn,VarOut,nb)
-    USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
-    USE mod_grid_phy_lmdz
-
-    IMPLICIT NONE
-
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    
-    INTEGER,INTENT(IN) :: nb
-    REAL,DIMENSION(nb),INTENT(IN) :: VarIn
-    REAL,DIMENSION(nb),INTENT(OUT) :: VarOut    
-    INTEGER :: ierr
- 
-    IF (.not.is_using_mpi) THEN
-      VarOut(:)=VarIn(:)
-      RETURN
-    ENDIF
-   
-#ifdef CPP_MPI
-    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_REAL_LMDZ,MPI_SUM,mpi_root_x,COMM_LMDZ_PHY,ierr)
-#endif
-        
-  END SUBROUTINE reduce_sum_mpi_rgen
-
-
-
-  SUBROUTINE grid1dTo2d_mpi_igen(VarIn,VarOut,dimsize)
-    USE mod_phys_lmdz_mpi_data
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: dimsize
-    INTEGER,INTENT(IN) ,DIMENSION(klon_mpi,dimsize)       :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(nbp_lon*jj_nb,dimsize)  :: VarOut
-    INTEGER :: i,ij,Offset
-
-    
-    VarOut(1:nbp_lon,:)=0
-    VarOut(nbp_lon*(jj_nb-1)+1:nbp_lon*jj_nb,:)=0
-    
-    offset=ii_begin
-    IF (is_north_pole) Offset=nbp_lon
-    
-    
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        VarOut(ij+offset-1,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO
-    
-    
-    IF (is_north_pole) THEN 
-      DO i=1,dimsize
-        DO ij=1,nbp_lon
-         VarOut(ij,i)=VarIn(1,i)
-        ENDDO
-      ENDDO
-    ENDIF
-    
-    IF (is_south_pole) THEN 
-      DO i=1,dimsize
-        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
-         VarOut(ij,i)=VarIn(klon_mpi,i)
-        ENDDO
-      ENDDO
-    ENDIF
-
-  END SUBROUTINE grid1dTo2d_mpi_igen   
-
-
-  SUBROUTINE grid1dTo2d_mpi_rgen(VarIn,VarOut,dimsize)
-    USE mod_phys_lmdz_mpi_data
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: dimsize
-    REAL,INTENT(IN) ,DIMENSION(klon_mpi,dimsize)       :: VarIn
-    REAL,INTENT(OUT),DIMENSION(nbp_lon*jj_nb,dimsize)  :: VarOut
-    INTEGER :: i,ij,Offset
-
-    
-    VarOut(1:nbp_lon,:)=0
-    VarOut(nbp_lon*(jj_nb-1)+1:nbp_lon*jj_nb,:)=0
-    
-    offset=ii_begin
-    IF (is_north_pole) Offset=nbp_lon
-    
-    
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        VarOut(ij+offset-1,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO
-    
-    
-    IF (is_north_pole) THEN 
-      DO i=1,dimsize
-        DO ij=1,nbp_lon
-         VarOut(ij,i)=VarIn(1,i)
-        ENDDO
-      ENDDO
-    ENDIF
-    
-    IF (is_south_pole) THEN 
-      DO i=1,dimsize
-        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
-         VarOut(ij,i)=VarIn(klon_mpi,i)
-        ENDDO
-      ENDDO
-    ENDIF
-
-   END SUBROUTINE grid1dTo2d_mpi_rgen   
-
-
-
-  SUBROUTINE grid1dTo2d_mpi_lgen(VarIn,VarOut,dimsize)
-    USE mod_phys_lmdz_mpi_data
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: dimsize
-    LOGICAL,INTENT(IN) ,DIMENSION(klon_mpi,dimsize)       :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(nbp_lon*jj_nb,dimsize)  :: VarOut
-    INTEGER :: i,ij,Offset
-
-    
-    VarOut(1:nbp_lon,:)=.FALSE.
-    VarOut(nbp_lon*(jj_nb-1)+1:nbp_lon*jj_nb,:)=.FALSE.
-    
-    offset=ii_begin
-    IF (is_north_pole) Offset=nbp_lon
-    
-    
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        VarOut(ij+offset-1,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO
-    
-    
-    IF (is_north_pole) THEN 
-      DO i=1,dimsize
-        DO ij=1,nbp_lon
-         VarOut(ij,i)=VarIn(1,i)
-        ENDDO
-      ENDDO
-    ENDIF
-    
-    IF (is_south_pole) THEN 
-      DO i=1,dimsize
-        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
-         VarOut(ij,i)=VarIn(klon_mpi,i)
-        ENDDO
-      ENDDO
-    ENDIF
-
-   END SUBROUTINE grid1dTo2d_mpi_lgen   
-
-  
-
-
-  SUBROUTINE grid2dTo1d_mpi_igen(VarIn,VarOut,dimsize)
-    USE mod_phys_lmdz_mpi_data
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: dimsize
-    INTEGER,INTENT(IN) ,DIMENSION(nbp_lon*jj_nb,dimsize) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(klon_mpi,dimsize)      :: VarOut
-    INTEGER :: i,ij,offset
-
-    offset=ii_begin
-    IF (is_north_pole) offset=nbp_lon
-
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        VarOut(ij,i)=VarIn(ij+offset-1,i)
-      ENDDO
-    ENDDO
-
-    IF (is_north_pole) THEN 
-      DO i=1,dimsize
-        VarOut(1,i)=VarIn(1,i)
-      ENDDO
-    ENDIF
-    
-    
-  END SUBROUTINE grid2dTo1d_mpi_igen   
-
-
-
-  SUBROUTINE grid2dTo1d_mpi_rgen(VarIn,VarOut,dimsize)
-    USE mod_phys_lmdz_mpi_data
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: dimsize
-    REAL,INTENT(IN) ,DIMENSION(nbp_lon*jj_nb,dimsize) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize)      :: VarOut
-    INTEGER :: i,ij,offset
-
-    offset=ii_begin
-    IF (is_north_pole) offset=nbp_lon
-
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        VarOut(ij,i)=VarIn(ij+offset-1,i)
-      ENDDO
-    ENDDO
-
-    IF (is_north_pole) THEN 
-      DO i=1,dimsize
-         VarOut(1,i)=VarIn(1,i)
-      ENDDO
-    ENDIF
-    
-    
-  END SUBROUTINE grid2dTo1d_mpi_rgen   
-  
-
-  SUBROUTINE grid2dTo1d_mpi_lgen(VarIn,VarOut,dimsize)
-    USE mod_phys_lmdz_mpi_data
-    USE mod_grid_phy_lmdz
-    IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: dimsize
-    LOGICAL,INTENT(IN) ,DIMENSION(nbp_lon*jj_nb,dimsize) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize)      :: VarOut
-    INTEGER :: i,ij,offset
-
-    offset=ii_begin
-    IF (is_north_pole) offset=nbp_lon
-
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        VarOut(ij,i)=VarIn(ij+offset-1,i)
-      ENDDO
-    ENDDO
-
-    IF (is_north_pole) THEN 
-      DO i=1,dimsize
-        VarOut(1,i)=VarIn(1,i)
-      ENDDO
-    ENDIF
-    
-    
-  END SUBROUTINE grid2dTo1d_mpi_lgen   
-
-END MODULE mod_phys_lmdz_mpi_transfert
Index: namico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_omp_data.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_omp_data.F90	(revision 3813)
+++ 	(revision )
@@ -1,109 +1,0 @@
-!
-!$Id: mod_phys_lmdz_omp_data.F90 2239 2015-03-23 07:27:30Z emillour $
-!
-MODULE mod_phys_lmdz_omp_data
-
-  INTEGER,SAVE :: omp_size
-  INTEGER,SAVE :: omp_rank
-  LOGICAL,SAVE :: is_omp_root
-  LOGICAL,SAVE :: is_using_omp
-  
-  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_nb
-  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_begin
-  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_end    
-  
-  INTEGER,SAVE :: klon_omp
-  INTEGER,SAVE :: klon_omp_begin
-  INTEGER,SAVE :: klon_omp_end
-!$OMP  THREADPRIVATE(omp_rank,klon_omp,is_omp_root,klon_omp_begin,klon_omp_end)
-
-CONTAINS
-  
-  SUBROUTINE Init_phys_lmdz_omp_data(klon_mpi)
-    USE dimphy
-    IMPLICIT NONE
-    INTEGER, INTENT(in) :: klon_mpi
-
-    INTEGER :: i
-
-    CHARACTER (LEN=20) :: modname='Init_phys_lmdz_omp_data'
-    CHARACTER (LEN=80) :: abort_message
-
-
-#ifdef CPP_OMP    
-    INTEGER :: OMP_GET_NUM_THREADS
-    EXTERNAL OMP_GET_NUM_THREADS
-    INTEGER :: OMP_GET_THREAD_NUM
-    EXTERNAL OMP_GET_THREAD_NUM
-#endif  
-
-#ifdef CPP_OMP
-!$OMP MASTER
-        is_using_omp=.TRUE.
-        omp_size=OMP_GET_NUM_THREADS()
-!$OMP END MASTER
-        omp_rank=OMP_GET_THREAD_NUM()    
-#else    
-    is_using_omp=.FALSE.
-    omp_size=1
-    omp_rank=0
-#endif
-
-   is_omp_root=.FALSE.
-!$OMP MASTER
-   IF (omp_rank==0) THEN
-     is_omp_root=.TRUE.
-   ELSE
-     abort_message = 'ANORMAL : OMP_MASTER /= 0'
-     CALL abort_gcm (modname,abort_message,1)
-   ENDIF
-!$OMP END MASTER
-
-
-!$OMP MASTER 
-    ALLOCATE(klon_omp_para_nb(0:omp_size-1))
-    ALLOCATE(klon_omp_para_begin(0:omp_size-1))
-    ALLOCATE(klon_omp_para_end(0:omp_size-1))
-    
-    DO i=0,omp_size-1
-      klon_omp_para_nb(i)=klon_mpi/omp_size
-      IF (i<MOD(klon_mpi,omp_size)) klon_omp_para_nb(i)=klon_omp_para_nb(i)+1
-    ENDDO
-    
-    klon_omp_para_begin(0) = 1
-    klon_omp_para_end(0) = klon_omp_para_nb(0)
-    
-    DO i=1,omp_size-1
-      klon_omp_para_begin(i)=klon_omp_para_end(i-1)+1
-      klon_omp_para_end(i)=klon_omp_para_begin(i)+klon_omp_para_nb(i)-1
-    ENDDO
-!$OMP END MASTER
-!$OMP BARRIER
-   
-    klon_omp=klon_omp_para_nb(omp_rank)
-    klon_omp_begin=klon_omp_para_begin(omp_rank)
-    klon_omp_end=klon_omp_para_end(omp_rank)
-    
-    CALL Print_module_data
-    
-  END SUBROUTINE Init_phys_lmdz_omp_data
-
-  SUBROUTINE Print_module_data
-  IMPLICIT NONE
-  INCLUDE "iniprint.h"
-
-!$OMP CRITICAL  
-  WRITE(lunout,*)'--------> TASK ',omp_rank
-  WRITE(lunout,*)'omp_size =',omp_size
-  WRITE(lunout,*)'omp_rank =',omp_rank
-  WRITE(lunout,*)'is_omp_root =',is_omp_root
-  WRITE(lunout,*)'klon_omp_para_nb =',klon_omp_para_nb
-  WRITE(lunout,*)'klon_omp_para_begin =',klon_omp_para_begin
-  WRITE(lunout,*)'klon_omp_para_end =',klon_omp_para_end    
-  WRITE(lunout,*)'klon_omp =',klon_omp
-  WRITE(lunout,*)'klon_omp_begin =',klon_omp_begin
-  WRITE(lunout,*)'klon_omp_end =',klon_omp_end    
-!$OMP END CRITICAL
-
-  END SUBROUTINE Print_module_data
-END MODULE mod_phys_lmdz_omp_data
Index: namico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_omp_transfert.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_omp_transfert.F90	(revision 3813)
+++ 	(revision )
@@ -1,1064 +1,0 @@
-!
-!$Header$
-!
-MODULE mod_phys_lmdz_omp_transfert
-
-  PRIVATE
-  
-  INTEGER,PARAMETER :: grow_factor=1.5
-  INTEGER,PARAMETER :: size_min=1024
-  
-  CHARACTER(LEN=size_min),SAVE            :: buffer_c
-!  INTEGER,SAVE                            :: size_c=0
-  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:)   :: buffer_i
-  INTEGER,SAVE                            :: size_i=0
-  REAL,SAVE,ALLOCATABLE,DIMENSION(:)      :: buffer_r
-  INTEGER,SAVE                            :: size_r=0
-  LOGICAL,SAVE,ALLOCATABLE,DIMENSION(:)   :: buffer_l
-  INTEGER,SAVE                            :: size_l=0
-
-
-  
-  
-  INTERFACE bcast_omp
-    MODULE PROCEDURE bcast_omp_c,                                                     &
-                     bcast_omp_i,bcast_omp_i1,bcast_omp_i2,bcast_omp_i3,bcast_omp_i4, &
-                     bcast_omp_r,bcast_omp_r1,bcast_omp_r2,bcast_omp_r3,bcast_omp_r4, &
-                     bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4
-  END INTERFACE
-
-  INTERFACE scatter_omp
-    MODULE PROCEDURE scatter_omp_i,scatter_omp_i1,scatter_omp_i2,scatter_omp_i3, &
-                     scatter_omp_r,scatter_omp_r1,scatter_omp_r2,scatter_omp_r3, &
-                     scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3
-  END INTERFACE
-
-  
-  INTERFACE gather_omp
-    MODULE PROCEDURE gather_omp_i,gather_omp_i1,gather_omp_i2,gather_omp_i3, &
-                     gather_omp_r,gather_omp_r1,gather_omp_r2,gather_omp_r3, &
-                     gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3  
-  END INTERFACE
-  
-  
-  INTERFACE reduce_sum_omp
-    MODULE PROCEDURE reduce_sum_omp_i,reduce_sum_omp_i1,reduce_sum_omp_i2,reduce_sum_omp_i3,reduce_sum_omp_i4, &
-                     reduce_sum_omp_r,reduce_sum_omp_r1,reduce_sum_omp_r2,reduce_sum_omp_r3,reduce_sum_omp_r4
-  END INTERFACE 
-
-
-  PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp, omp_barrier
-
-CONTAINS
-
-  SUBROUTINE omp_barrier
-  IMPLICIT NONE
-
-!$OMP BARRIER
-
-  END SUBROUTINE omp_barrier
-  
-  SUBROUTINE check_buffer_i(buff_size)
-  IMPLICIT NONE
-  INTEGER :: buff_size
-
-!$OMP BARRIER
-!$OMP MASTER
-    IF (buff_size>size_i) THEN
-      IF (ALLOCATED(buffer_i)) DEALLOCATE(buffer_i)
-      size_i=MAX(size_min,INT(grow_factor*buff_size))
-      ALLOCATE(buffer_i(size_i))
-    ENDIF
-!$OMP END MASTER
-!$OMP BARRIER
-  
-  END SUBROUTINE check_buffer_i
-  
-  SUBROUTINE check_buffer_r(buff_size)
-  IMPLICIT NONE
-  INTEGER :: buff_size
-
-!$OMP BARRIER
-!$OMP MASTER
-    IF (buff_size>size_r) THEN
-      IF (ALLOCATED(buffer_r)) DEALLOCATE(buffer_r)
-      size_r=MAX(size_min,INT(grow_factor*buff_size))
-      ALLOCATE(buffer_r(size_r))
-    ENDIF
-!$OMP END MASTER
-!$OMP BARRIER
-  
-  END SUBROUTINE check_buffer_r
-  
-  SUBROUTINE check_buffer_l(buff_size)
-  IMPLICIT NONE
-  INTEGER :: buff_size
-
-!$OMP BARRIER
-!$OMP MASTER
-    IF (buff_size>size_l) THEN
-      IF (ALLOCATED(buffer_l)) DEALLOCATE(buffer_l)
-      size_l=MAX(size_min,INT(grow_factor*buff_size))
-      ALLOCATE(buffer_l(size_l))
-    ENDIF
-!$OMP END MASTER
-!$OMP BARRIER
-  
-  END SUBROUTINE check_buffer_l
-    
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Broadcast --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-!! -- Les chaine de charactère -- !!
-
-  SUBROUTINE bcast_omp_c(var)
-  IMPLICIT NONE
-    CHARACTER(LEN=*),INTENT(INOUT) :: Var
-    
-    CALL bcast_omp_cgen(Var,len(Var),buffer_c)
-    
-  END SUBROUTINE bcast_omp_c
-
-!! -- Les entiers -- !!
-  
-  SUBROUTINE bcast_omp_i(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var
-    INTEGER :: Var_tmp(1)
-    
-    Var_tmp(1)=Var
-    CALL check_buffer_i(1)
-    CALL bcast_omp_igen(Var_tmp,1,buffer_i)
-    Var=Var_tmp(1)
-
-  END SUBROUTINE bcast_omp_i
-
-
-  SUBROUTINE bcast_omp_i1(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:)
-   
-    CALL check_buffer_i(size(Var))
-    CALL bcast_omp_igen(Var,size(Var),buffer_i)
-
-  END SUBROUTINE bcast_omp_i1
-
-
-  SUBROUTINE bcast_omp_i2(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:,:)
-   
-    CALL check_buffer_i(size(Var))
-    CALL bcast_omp_igen(Var,size(Var),buffer_i)
-
-  END SUBROUTINE bcast_omp_i2
-
-
-  SUBROUTINE bcast_omp_i3(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:,:,:)
-
-    CALL check_buffer_i(size(Var))
-    CALL bcast_omp_igen(Var,size(Var),buffer_i)
-
-  END SUBROUTINE bcast_omp_i3
-
-
-  SUBROUTINE bcast_omp_i4(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:,:,:,:)
-   
-    CALL check_buffer_i(size(Var))
-    CALL bcast_omp_igen(Var,size(Var),buffer_i)
-
-  END SUBROUTINE bcast_omp_i4
-
-
-!! -- Les reels -- !!
-
-  SUBROUTINE bcast_omp_r(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var
-    REAL :: Var_tmp(1)
-    
-    Var_tmp(1)=Var
-    CALL check_buffer_r(1)
-    CALL bcast_omp_rgen(Var_tmp,1,buffer_r)
-    Var=Var_tmp(1)
-
-  END SUBROUTINE bcast_omp_r
-
-
-  SUBROUTINE bcast_omp_r1(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:)
-   
-    CALL check_buffer_r(size(Var))
-    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
-
-  END SUBROUTINE bcast_omp_r1
-
-
-  SUBROUTINE bcast_omp_r2(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:,:)
-   
-    CALL check_buffer_r(size(Var))
-    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
-
-  END SUBROUTINE bcast_omp_r2
-
-
-  SUBROUTINE bcast_omp_r3(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:,:,:)
-
-    CALL check_buffer_r(size(Var))
-    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
-
-  END SUBROUTINE bcast_omp_r3
-
-
-  SUBROUTINE bcast_omp_r4(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:,:,:,:)
-   
-    CALL check_buffer_r(size(Var))
-    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
-
-  END SUBROUTINE bcast_omp_r4
-
-  
-!! -- Les booleans -- !!
-
-  SUBROUTINE bcast_omp_l(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var
-    LOGICAL :: Var_tmp(1)
-    
-    Var_tmp(1)=Var
-    CALL check_buffer_l(1)
-    CALL bcast_omp_lgen(Var_tmp,1,buffer_l)
-    Var=Var_tmp(1)
-
-  END SUBROUTINE bcast_omp_l
-
-
-  SUBROUTINE bcast_omp_l1(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:)
-   
-    CALL check_buffer_l(size(Var))
-    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
-
-  END SUBROUTINE bcast_omp_l1
-
-
-  SUBROUTINE bcast_omp_l2(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:,:)
-   
-    CALL check_buffer_l(size(Var))
-    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
-
-  END SUBROUTINE bcast_omp_l2
-
-
-  SUBROUTINE bcast_omp_l3(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:,:,:)
-
-    CALL check_buffer_l(size(Var))
-    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
-
-  END SUBROUTINE bcast_omp_l3
-
-
-  SUBROUTINE bcast_omp_l4(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
-   
-    CALL check_buffer_l(size(Var))
-    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
-
-  END SUBROUTINE bcast_omp_l4
-
-
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Scatter   --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-  SUBROUTINE scatter_omp_i(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    CALL Check_buffer_i(size(VarIn))   
-    CALL scatter_omp_igen(VarIn,Varout,1,buffer_i)
-    
-  END SUBROUTINE scatter_omp_i
-
-
-  SUBROUTINE scatter_omp_i1(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-
-    CALL Check_buffer_i(size(VarIn))   
-    CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2),buffer_i)
-    
-  END SUBROUTINE scatter_omp_i1
-  
-  
-  SUBROUTINE scatter_omp_i2(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    CALL Check_buffer_i(size(VarIn))   
-    CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_i)
-
-  END SUBROUTINE scatter_omp_i2
-
-
-  SUBROUTINE scatter_omp_i3(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    CALL Check_buffer_i(size(VarIn))   
-    CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_i)
-  
-  END SUBROUTINE scatter_omp_i3
-
-
-
-
-  SUBROUTINE scatter_omp_r(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    CALL Check_buffer_r(size(VarIn))   
-    CALL scatter_omp_rgen(VarIn,Varout,1,buffer_r)
-    
-  END SUBROUTINE scatter_omp_r
-
-
-  SUBROUTINE scatter_omp_r1(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    CALL Check_buffer_r(size(VarIn))   
-    CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2),buffer_r)
-        
-  END SUBROUTINE scatter_omp_r1
-  
-  
-  SUBROUTINE scatter_omp_r2(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    CALL Check_buffer_r(size(VarIn))   
-    CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_r)
-
-  END SUBROUTINE scatter_omp_r2
-
-
-  SUBROUTINE scatter_omp_r3(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    CALL Check_buffer_r(size(VarIn))   
-    CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_r)
-  
-  END SUBROUTINE scatter_omp_r3
-  
-
-
-  SUBROUTINE scatter_omp_l(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    CALL Check_buffer_l(size(VarIn))   
-    CALL scatter_omp_lgen(VarIn,Varout,1,buffer_l)
-    
-  END SUBROUTINE scatter_omp_l
-
-
-  SUBROUTINE scatter_omp_l1(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    CALL Check_buffer_l(size(VarIn))   
-    CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2),buffer_l)
-    
-  END SUBROUTINE scatter_omp_l1
-  
-  
-  SUBROUTINE scatter_omp_l2(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    CALL Check_buffer_l(size(VarIn))   
-    CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_l)
-
-  END SUBROUTINE scatter_omp_l2
-
-
-  SUBROUTINE scatter_omp_l3(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    CALL Check_buffer_l(size(VarIn))   
-    CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_l)
-  
-  END SUBROUTINE scatter_omp_l3  
-  
-
-  SUBROUTINE gather_omp_i(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    CALL Check_buffer_i(size(VarOut))   
-    CALL gather_omp_igen(VarIn,Varout,1,buffer_i)
-    
-  END SUBROUTINE gather_omp_i
-
-
-  SUBROUTINE gather_omp_i1(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    CALL Check_buffer_i(size(VarOut))   
-    CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2),buffer_i)
-    
-  END SUBROUTINE gather_omp_i1
-
-
-  SUBROUTINE gather_omp_i2(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    CALL Check_buffer_i(size(VarOut))   
-    CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_i)
-          
-  END SUBROUTINE gather_omp_i2
-  
-
-  SUBROUTINE gather_omp_i3(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    CALL Check_buffer_i(size(VarOut))   
-    CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_i)
-    
-  END SUBROUTINE gather_omp_i3
-
-
-
-  SUBROUTINE gather_omp_r(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    CALL Check_buffer_r(size(VarOut))   
-    CALL gather_omp_rgen(VarIn,Varout,1,buffer_r)
-    
-  END SUBROUTINE gather_omp_r
-
-
-  SUBROUTINE gather_omp_r1(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-
-    CALL Check_buffer_r(size(VarOut))   
-    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2),buffer_r)
-        
-  END SUBROUTINE gather_omp_r1
-
-
-  SUBROUTINE gather_omp_r2(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    CALL Check_buffer_r(size(VarOut))   
-    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_r)
-    
-  END SUBROUTINE gather_omp_r2
-  
-
-  SUBROUTINE gather_omp_r3(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-
-    CALL Check_buffer_r(size(VarOut))       
-    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_r)
-    
-  END SUBROUTINE gather_omp_r3
-
-
-  SUBROUTINE gather_omp_l(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    CALL Check_buffer_l(size(VarOut))   
-    CALL gather_omp_lgen(VarIn,Varout,1,buffer_l)
-    
-  END SUBROUTINE gather_omp_l
-
-
-  SUBROUTINE gather_omp_l1(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    CALL Check_buffer_l(size(VarOut))   
-    CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2),buffer_l)
-    
-  END SUBROUTINE gather_omp_l1
-
-
-  SUBROUTINE gather_omp_l2(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    CALL Check_buffer_l(size(VarOut))   
-    CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_l)
-    
-  END SUBROUTINE gather_omp_l2
-  
-
-  SUBROUTINE gather_omp_l3(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    CALL Check_buffer_l(size(VarOut))   
-    CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_l)
-    
-  END SUBROUTINE gather_omp_l3
-
-
-
-
-  SUBROUTINE reduce_sum_omp_i(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN)  :: VarIn
-    INTEGER,INTENT(OUT) :: VarOut
-    INTEGER             :: VarIn_tmp(1)
-    INTEGER             :: VarOut_tmp(1)
-    
-    VarIn_tmp(1)=VarIn
-    CALL Check_buffer_i(1)   
-    CALL reduce_sum_omp_igen(VarIn_tmp,Varout_tmp,1,buffer_i)
-    VarOut=VarOut_tmp(1)
-    
-  END SUBROUTINE reduce_sum_omp_i
-
-  SUBROUTINE reduce_sum_omp_i1(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-    CALL Check_buffer_i(size(VarIn))   
-    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
-   
-  END SUBROUTINE reduce_sum_omp_i1
-  
-  
-  SUBROUTINE reduce_sum_omp_i2(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-
-    CALL Check_buffer_i(size(VarIn))   
-    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
-  
-  END SUBROUTINE reduce_sum_omp_i2
-
-
-  SUBROUTINE reduce_sum_omp_i3(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    CALL Check_buffer_i(size(VarIn))   
-    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
-  
-  END SUBROUTINE reduce_sum_omp_i3
-
-
-  SUBROUTINE reduce_sum_omp_i4(VarIn, VarOut)
-    IMPLICIT NONE
-
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-  
-    CALL Check_buffer_i(size(VarIn))   
-    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
-  
-  END SUBROUTINE reduce_sum_omp_i4
-
-
-  SUBROUTINE reduce_sum_omp_r(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN)  :: VarIn
-    REAL,INTENT(OUT) :: VarOut
-    REAL             :: VarIn_tmp(1)
-    REAL             :: VarOut_tmp(1)
-    
-    VarIn_tmp(1)=VarIn
-    CALL Check_buffer_r(1)   
-    CALL reduce_sum_omp_rgen(VarIn_tmp,Varout_tmp,1,buffer_r)
-    VarOut=VarOut_tmp(1)
-  
-  END SUBROUTINE reduce_sum_omp_r
-
-  SUBROUTINE reduce_sum_omp_r1(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-    CALL Check_buffer_r(size(VarIn))   
-    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
-   
-  END SUBROUTINE reduce_sum_omp_r1
-  
-  
-  SUBROUTINE reduce_sum_omp_r2(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    CALL Check_buffer_r(size(VarIn))   
-    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
-  
-  END SUBROUTINE reduce_sum_omp_r2
-
-
-  SUBROUTINE reduce_sum_omp_r3(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    CALL Check_buffer_r(size(VarIn))   
-    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
-  
-  END SUBROUTINE reduce_sum_omp_r3
-
-
-  SUBROUTINE reduce_sum_omp_r4(VarIn, VarOut)
-    IMPLICIT NONE
-
-    REAL,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-  
-    CALL Check_buffer_r(size(VarIn))   
-    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
-  
-  END SUBROUTINE reduce_sum_omp_r4
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!    LES ROUTINES GENERIQUES    !
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-  SUBROUTINE bcast_omp_cgen(Var,Nb,Buff)
-  IMPLICIT NONE
-    
-    CHARACTER(LEN=*),INTENT(INOUT) :: Var
-    CHARACTER(LEN=*),INTENT(INOUT) :: Buff
-    INTEGER,INTENT(IN) :: Nb
-    
-    INTEGER :: i
-  
-  !$OMP MASTER
-      Buff=Var
-  !$OMP END MASTER
-  !$OMP BARRIER
-
-    DO i=1,Nb
-      Var=Buff
-    ENDDO
-  !$OMP BARRIER      
-  
-  END SUBROUTINE bcast_omp_cgen
-
-
-      
-  SUBROUTINE bcast_omp_igen(Var,Nb,Buff)
-  IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: Nb
-    INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Var
-    INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Buff
-
-    INTEGER :: i
-    
-  !$OMP MASTER
-    DO i=1,Nb
-      Buff(i)=Var(i)
-    ENDDO
-  !$OMP END MASTER
-  !$OMP BARRIER
-
-    DO i=1,Nb
-      Var(i)=Buff(i)
-    ENDDO
-  !$OMP BARRIER        
-
-  END SUBROUTINE bcast_omp_igen
-
-
-  SUBROUTINE bcast_omp_rgen(Var,Nb,Buff)
-  IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: Nb
-    REAL,DIMENSION(Nb),INTENT(INOUT) :: Var
-    REAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
-
-    INTEGER :: i
-    
-  !$OMP MASTER
-    DO i=1,Nb
-      Buff(i)=Var(i)
-    ENDDO
-  !$OMP END MASTER
-  !$OMP BARRIER
-
-    DO i=1,Nb
-      Var(i)=Buff(i)
-    ENDDO
-  !$OMP BARRIER        
-
-  END SUBROUTINE bcast_omp_rgen
-
-  SUBROUTINE bcast_omp_lgen(Var,Nb,Buff)
-  IMPLICIT NONE
-    
-    INTEGER,INTENT(IN) :: Nb
-    LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Var
-    LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
-  
-    INTEGER :: i
-    
-  !$OMP MASTER
-    DO i=1,Nb
-      Buff(i)=Var(i)
-    ENDDO
-  !$OMP END MASTER
-  !$OMP BARRIER
-
-    DO i=1,Nb
-      Var(i)=Buff(i)
-    ENDDO
-  !$OMP BARRIER        
-
-  END SUBROUTINE bcast_omp_lgen
-
-
-  SUBROUTINE scatter_omp_igen(VarIn,VarOut,dimsize,Buff)
-    USE mod_phys_lmdz_omp_data
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
-    IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    INTEGER,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut
-    INTEGER,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
-
-    INTEGER :: i,ij
-    
-  !$OMP MASTER
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        Buff(ij,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO  
-  !$OMP END MASTER
-  !$OMP BARRIER
- 
-    DO i=1,dimsize
-      DO ij=1,klon_omp
-        VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i)
-      ENDDO
-    ENDDO
-  !$OMP BARRIER  
- 
-  END SUBROUTINE scatter_omp_igen
-
-
-  SUBROUTINE scatter_omp_rgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data
-  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
-  IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    REAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut
-    REAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
-
-    INTEGER :: i,ij
-    
-  !$OMP MASTER
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        Buff(ij,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO  
-  !$OMP END MASTER
-  !$OMP BARRIER
-
-    DO i=1,dimsize
-      DO ij=1,klon_omp
-        VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i)
-      ENDDO
-    ENDDO
-  !$OMP BARRIER  
-
-  END SUBROUTINE scatter_omp_rgen
-
-
-  SUBROUTINE scatter_omp_lgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data
-  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
-  IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    LOGICAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut
-    LOGICAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
-
-    INTEGER :: i,ij
-    
- !$OMP MASTER 
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        Buff(ij,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO  
-  !$OMP END MASTER
-  !$OMP BARRIER
-
-    DO i=1,dimsize
-      DO ij=1,klon_omp
-        VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i)
-      ENDDO
-    ENDDO
-  !$OMP BARRIER  
-
-  END SUBROUTINE scatter_omp_lgen
-
-
-
-
-
-  SUBROUTINE gather_omp_igen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data
-  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
-  IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    INTEGER,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
-    INTEGER,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
-
-    INTEGER :: i,ij
-    
-    DO i=1,dimsize
-      DO ij=1,klon_omp
-        Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO
-  !$OMP BARRIER  
-  
-  
-  !$OMP MASTER
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        VarOut(ij,i)=Buff(ij,i)
-      ENDDO
-    ENDDO  
-  !$OMP END MASTER
-  !$OMP BARRIER
-
-  END SUBROUTINE gather_omp_igen
-
-
-  SUBROUTINE gather_omp_rgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data
-  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
-  IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    REAL,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
-    REAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
-
-    INTEGER :: i,ij
-    
-    DO i=1,dimsize
-      DO ij=1,klon_omp
-        Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO
-  !$OMP BARRIER  
-
-
-  !$OMP MASTER
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        VarOut(ij,i)=Buff(ij,i)
-      ENDDO
-    ENDDO  
-  !$OMP END MASTER
-  !$OMP BARRIER
-
-  END SUBROUTINE gather_omp_rgen
-
-
-  SUBROUTINE gather_omp_lgen(VarIn,VarOut,dimsize,Buff)
-  USE mod_phys_lmdz_omp_data
-  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
-  IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    LOGICAL,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
-    LOGICAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
-
-    INTEGER :: i,ij
-    
-    DO i=1,dimsize
-      DO ij=1,klon_omp
-        Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i)
-      ENDDO
-    ENDDO
-  !$OMP BARRIER  
-
-
-  !$OMP MASTER
-    DO i=1,dimsize
-      DO ij=1,klon_mpi
-        VarOut(ij,i)=Buff(ij,i)
-      ENDDO
-    ENDDO  
-  !$OMP END MASTER
-  !$OMP BARRIER
-
-  END SUBROUTINE gather_omp_lgen
-
-
-  SUBROUTINE reduce_sum_omp_igen(VarIn,VarOut,dimsize,Buff)
-  IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    INTEGER,INTENT(IN),DIMENSION(dimsize) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(dimsize) :: VarOut
-    INTEGER,INTENT(INOUT),DIMENSION(dimsize) :: Buff
-
-    INTEGER :: i
-
-  !$OMP MASTER
-    Buff(:)=0
-  !$OMP END MASTER
-  !$OMP BARRIER
-  
-  !$OMP CRITICAL     
-    DO i=1,dimsize
-      Buff(i)=Buff(i)+VarIn(i)
-    ENDDO
-  !$OMP END CRITICAL
-  !$OMP BARRIER  
-  
-  !$OMP MASTER
-    DO i=1,dimsize
-      VarOut(i)=Buff(i)
-    ENDDO
-  !$OMP END MASTER
-  !$OMP BARRIER
-  
-  END SUBROUTINE reduce_sum_omp_igen
-
-  SUBROUTINE reduce_sum_omp_rgen(VarIn,VarOut,dimsize,Buff)
-  IMPLICIT NONE
-
-    INTEGER,INTENT(IN) :: dimsize
-    REAL,INTENT(IN),DIMENSION(dimsize) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(dimsize) :: VarOut
-    REAL,INTENT(INOUT),DIMENSION(dimsize) :: Buff
-
-    INTEGER :: i
-
-  !$OMP MASTER
-    Buff(:)=0
-  !$OMP END MASTER
-  !$OMP BARRIER
-  
-  !$OMP CRITICAL     
-    DO i=1,dimsize
-      Buff(i)=Buff(i)+VarIn(i)
-    ENDDO
-  !$OMP END CRITICAL
-  !$OMP BARRIER  
-  
-  !$OMP MASTER
-    DO i=1,dimsize
-      VarOut(i)=Buff(i)
-    ENDDO
-  !$OMP END MASTER
-  !$OMP BARRIER
-  
-  END SUBROUTINE reduce_sum_omp_rgen
-
-END MODULE mod_phys_lmdz_omp_transfert
Index: namico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_para.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_para.F90	(revision 3813)
+++ 	(revision )
@@ -1,113 +1,0 @@
-!
-!$Header$
-!
-MODULE mod_phys_lmdz_para
-  USE mod_phys_lmdz_transfert_para
-  USE mod_phys_lmdz_mpi_data
-  USE mod_phys_lmdz_omp_data
-    
-  INTEGER,SAVE :: klon_loc
-  LOGICAL,SAVE :: is_sequential
-  LOGICAL,SAVE :: is_parallel
-  LOGICAL,SAVE :: is_master
-  
-!$OMP THREADPRIVATE(klon_loc,is_master)
-  
-CONTAINS
-
-  SUBROUTINE Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
-  IMPLICIT NONE
-    INTEGER,INTENT(in) :: iim
-    INTEGER,INTENT(in) :: jjp1
-    INTEGER,INTENT(in) :: nb_proc
-    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
-
-    CALL Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
-!$OMP PARALLEL
-    CALL Init_phys_lmdz_omp_data(klon_mpi)
-    klon_loc=klon_omp
-    IF (is_mpi_root .AND. is_omp_root) THEN 
-       is_master=.TRUE.
-     ELSE
-       is_master=.FALSE.
-     ENDIF
-     CALL Test_transfert
-!$OMP END PARALLEL    
-     IF (is_using_mpi .OR. is_using_omp) THEN
-       is_sequential=.FALSE.
-       is_parallel=.TRUE.
-     ELSE
-       is_sequential=.TRUE.
-       is_parallel=.FALSE.
-     ENDIF
-      
-  END SUBROUTINE Init_phys_lmdz_para
-
-  SUBROUTINE Test_transfert
-  USE mod_grid_phy_lmdz
-  IMPLICIT NONE
-    INCLUDE "iniprint.h"
- 
-    REAL :: Test_Field1d_glo(klon_glo,nbp_lev)
-    REAL :: tmp1d_glo(klon_glo,nbp_lev)
-    REAL :: Test_Field2d_glo(nbp_lon,nbp_lat,nbp_lev)
-    REAL :: tmp2d_glo(nbp_lon,nbp_lat,nbp_lev)
-    REAL :: Test_Field1d_loc(klon_loc,nbp_lev)
-    REAL :: Test_Field2d_loc(nbp_lon,jj_nb,nbp_lev)
-    REAL :: CheckSum
-    
-    INTEGER :: i,l
-  
-    Test_Field1d_glo = 0.
-    Test_Field2d_glo = 0.
-    Test_Field1d_loc = 0.
-    Test_Field2d_loc = 0.
-  
-    IF (is_mpi_root) THEN
-!$OMP MASTER
-      DO l=1,nbp_lev
-        DO i=1,klon_glo
-!          Test_Field1d_glo(i,l)=MOD(i,10)+10*(l-1)
-           Test_Field1d_glo(i,l)=1
-        ENDDO
-      ENDDO
-!$OMP END MASTER  
-    ENDIF
-  
-    CALL Scatter(Test_Field1d_glo,Test_Field1d_loc)
-    CALL Gather(Test_Field1d_loc,tmp1d_glo)
-  
-    IF (is_mpi_root) THEN
-!$OMP MASTER  
-      Checksum=sum(Test_Field1d_glo-tmp1d_glo)
-      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
-!$OMP END MASTER
-    ENDIF
-    
-    CALL grid1dTo2d_glo(Test_Field1d_glo,Test_Field2d_glo)
-    CALL scatter2D(Test_Field2d_glo,Test_Field1d_loc)
-    CALL gather2d(Test_Field1d_loc,Test_Field2d_glo)
-    CALL grid2dTo1d_glo(Test_Field2d_glo,tmp1d_glo)
-
-    IF (is_mpi_root) THEN
-!$OMP MASTER  
-      Checksum=sum(Test_Field1d_glo-tmp1d_glo)
-      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
-!$OMP END MASTER
-    ENDIF
-
-    CALL bcast(Test_Field1d_glo)
-    CALL reduce_sum(Test_Field1d_glo,tmp1d_glo)
-
-    IF (is_mpi_root) THEN
-!$OMP MASTER  
-      Checksum=sum(Test_Field1d_glo*omp_size*mpi_size-tmp1d_glo)
-      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
-!$OMP END MASTER
-    ENDIF
-    
-     
-   END SUBROUTINE Test_transfert
-  
-END MODULE mod_phys_lmdz_para
-    
Index: namico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_transfert_para.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/mod_phys_lmdz_transfert_para.F90	(revision 3813)
+++ 	(revision )
@@ -1,1275 +1,0 @@
-!
-!$Header$
-!
-MODULE mod_phys_lmdz_transfert_para
-
-  USE mod_phys_lmdz_mpi_transfert
-  USE mod_phys_lmdz_omp_transfert 
-
-
-
-  INTERFACE bcast
-    MODULE PROCEDURE bcast_c,                                     &
-                     bcast_i,bcast_i1,bcast_i2,bcast_i3,bcast_i4, &
-                     bcast_r,bcast_r1,bcast_r2,bcast_r3,bcast_r4, &
-		     bcast_l,bcast_l1,bcast_l2,bcast_l3,bcast_l4
-  END INTERFACE
-
-  INTERFACE scatter
-    MODULE PROCEDURE scatter_i,scatter_i1,scatter_i2,scatter_i3, &
-                     scatter_r,scatter_r1,scatter_r2,scatter_r3, &
-		     scatter_l,scatter_l1,scatter_l2,scatter_l3
-  END INTERFACE
-
-  
-  INTERFACE gather
-    MODULE PROCEDURE gather_i,gather_i1,gather_i2,gather_i3, &
-                     gather_r,gather_r1,gather_r2,gather_r3, &
-		     gather_l,gather_l1,gather_l2,gather_l3  
-  END INTERFACE
-  
-  INTERFACE scatter2D
-    MODULE PROCEDURE scatter2D_i,scatter2D_i1,scatter2D_i2,scatter2D_i3, &
-                     scatter2D_r,scatter2D_r1,scatter2D_r2,scatter2D_r3, &
-		     scatter2D_l,scatter2D_l1,scatter2D_l2,scatter2D_l3
-  END INTERFACE
-
-  INTERFACE gather2D
-    MODULE PROCEDURE gather2D_i,gather2D_i1,gather2D_i2,gather2D_i3, &
-                     gather2D_r,gather2D_r1,gather2D_r2,gather2D_r3, &
-		     gather2D_l,gather2D_l1,gather2D_l2,gather2D_l3
-  END INTERFACE 
-  
-  INTERFACE reduce_sum
-    MODULE PROCEDURE reduce_sum_i,reduce_sum_i1,reduce_sum_i2,reduce_sum_i3,reduce_sum_i4, &
-                     reduce_sum_r,reduce_sum_r1,reduce_sum_r2,reduce_sum_r3,reduce_sum_r4
-  END INTERFACE 
-
-   
-CONTAINS
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Broadcast --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-!! -- Les chaine de charactère -- !!
-
-  SUBROUTINE bcast_c(var)
-  IMPLICIT NONE
-    CHARACTER(LEN=*),INTENT(INOUT) :: Var
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_c
-
-!! -- Les entiers -- !!
-  
-  SUBROUTINE bcast_i(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_i
-
-  SUBROUTINE bcast_i1(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_i1
-
-
-  SUBROUTINE bcast_i2(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:,:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_i2
-
-
-  SUBROUTINE bcast_i3(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:,:,:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_i3
-
-
-  SUBROUTINE bcast_i4(var)
-  IMPLICIT NONE
-    INTEGER,INTENT(INOUT) :: Var(:,:,:,:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_i4
-
- 
-!! -- Les reels -- !!
-  
-  SUBROUTINE bcast_r(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var
-
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_r
-
-  SUBROUTINE bcast_r1(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_r1
-
-
-  SUBROUTINE bcast_r2(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:,:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_r2
-
-
-  SUBROUTINE bcast_r3(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:,:,:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_r3
-
-
-  SUBROUTINE bcast_r4(var)
-  IMPLICIT NONE
-    REAL,INTENT(INOUT) :: Var(:,:,:,:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_r4 
-
-
-!! -- Les booleens -- !!
-  
-  SUBROUTINE bcast_l(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_l
-
-  SUBROUTINE bcast_l1(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_l1
-
-
-  SUBROUTINE bcast_l2(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:,:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_l2
-
-
-  SUBROUTINE bcast_l3(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:,:,:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_l3
-
-
-  SUBROUTINE bcast_l4(var)
-  IMPLICIT NONE
-    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
-   
-!$OMP MASTER
-    CALL bcast_mpi(Var)
-!$OMP END MASTER
-    CALL bcast_omp(Var)
-    
-  END SUBROUTINE bcast_l4
-
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Scatter   --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-  SUBROUTINE scatter_i(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    INTEGER,DIMENSION(klon_mpi) :: Var_tmp
-    
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-
-      CALL scatter_omp(Var_tmp,Varout)
-    
-  END SUBROUTINE scatter_i
-
-
-  SUBROUTINE scatter_i1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-
-    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
-
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-      CALL scatter_omp(Var_tmp,Varout)
-    
-  END SUBROUTINE scatter_i1
-
-
-  SUBROUTINE scatter_i2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
-
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-      CALL scatter_omp(Var_tmp,Varout)
-    
-  END SUBROUTINE scatter_i2
-
-
-  SUBROUTINE scatter_i3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-
-    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
-
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-      CALL scatter_omp(Var_tmp,VarOut)
-    
-  END SUBROUTINE scatter_i3
-
-
-  SUBROUTINE scatter_r(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    REAL,DIMENSION(klon_mpi) :: Var_tmp
-    
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-
-      CALL scatter_omp(Var_tmp,Varout)
-    
-  END SUBROUTINE scatter_r
-
-
-  SUBROUTINE scatter_r1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-
-    REAL,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
-
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-      CALL scatter_omp(Var_tmp,Varout)
-    
-  END SUBROUTINE scatter_r1
-
-
-  SUBROUTINE scatter_r2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    REAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
-
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-      CALL scatter_omp(Var_tmp,Varout)
-    
-  END SUBROUTINE scatter_r2
-
-
-  SUBROUTINE scatter_r3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-
-    REAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
-
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-      CALL scatter_omp(Var_tmp,VarOut)
-    
-  END SUBROUTINE scatter_r3
-  
-  
-
-  SUBROUTINE scatter_l(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp
-    
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-
-      CALL scatter_omp(Var_tmp,Varout)
-    
-  END SUBROUTINE scatter_l
-
-
-  SUBROUTINE scatter_l1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-
-    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
-
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-      CALL scatter_omp(Var_tmp,Varout)
-    
-  END SUBROUTINE scatter_l1
-
-
-  SUBROUTINE scatter_l2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
-
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-      CALL scatter_omp(Var_tmp,Varout)
-    
-  END SUBROUTINE scatter_l2
-
-
-  SUBROUTINE scatter_l3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-
-    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
-
-!$OMP MASTER
-      CALL scatter_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-      CALL scatter_omp(Var_tmp,VarOut)
-    
-  END SUBROUTINE scatter_l3
-
-
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Gather   --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 
-!!!!! --> Les entiers
-
-  SUBROUTINE gather_i(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-    INTEGER, DIMENSION(klon_mpi) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,Varout)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_i
-
-
-  SUBROUTINE gather_i1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,Varout)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_i1
-
-
-  SUBROUTINE gather_i2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_i2
-
-
-  SUBROUTINE gather_i3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_i3
-
-
-!!!!! --> Les reels
-
-  SUBROUTINE gather_r(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-    REAL, DIMENSION(klon_mpi) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_r
-
-
-  SUBROUTINE gather_r1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_r1
-
-
-  SUBROUTINE gather_r2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_r2
-
-
-  SUBROUTINE gather_r3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_r3
-
-
-!!!!! --> Les booleens
-
-  SUBROUTINE gather_l(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-    LOGICAL, DIMENSION(klon_mpi) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_l
-
-
-  SUBROUTINE gather_l1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_l1
-
-
-  SUBROUTINE gather_l2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_l2
-
-
-  SUBROUTINE gather_l3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
-    
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE gather_l3
-
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Scatter2D   --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-
-!!!!! --> Les entiers
-
-  SUBROUTINE scatter2D_i(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    INTEGER,DIMENSION(klon_mpi) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_i
-
-
-  SUBROUTINE scatter2D_i1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-
-    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_i1
-  
-
-  SUBROUTINE scatter2D_i2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-
-    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_i2  
-
-
-  SUBROUTINE scatter2D_i3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-
-    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_i3
-  
-
-!!!!! --> Les reels
-
-  SUBROUTINE scatter2D_r(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    REAL,DIMENSION(klon_mpi) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_r
-
-
-  SUBROUTINE scatter2D_r1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-
-    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_r1
-  
-
-  SUBROUTINE scatter2D_r2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-
-    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_r2  
-
-
-  SUBROUTINE scatter2D_r3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-
-    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_r3
-    
-    
-!!!!! --> Les booleens
-
-
-  SUBROUTINE scatter2D_l(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
-
-    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_l
-
-
-  SUBROUTINE scatter2D_l1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-
-    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_l1
-  
-
-  SUBROUTINE scatter2D_l2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-
-    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_l2  
-
-
-  SUBROUTINE scatter2D_l3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-
-    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp    
-
-!$OMP MASTER    
-    CALL scatter2D_mpi(VarIn,Var_tmp)
-!$OMP END MASTER
-    CALL scatter_omp(Var_tmp,VarOut)
-
-  END SUBROUTINE scatter2D_l3
-
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des Gather2D   --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-!!!!! --> Les entiers
-
-  SUBROUTINE gather2D_i(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    INTEGER,DIMENSION(klon_mpi) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_i
-  
-
-  SUBROUTINE gather2D_i1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_i1
-
-  
-  SUBROUTINE gather2D_i2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_i2
-
-
-  SUBROUTINE gather2D_i3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
-    
-    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_i3
-
-
-!!!!! --> Les reels
-
-  SUBROUTINE gather2D_r(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    REAL,DIMENSION(klon_mpi) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_r
-  
-
-  SUBROUTINE gather2D_r1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_r1
-
-  
-  SUBROUTINE gather2D_r2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_r2
-
-
-  SUBROUTINE gather2D_r3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
-    
-    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_r3
-  
-
-!!!!! --> Les booleens
-
-  SUBROUTINE gather2D_l(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_l
-  
-
-  SUBROUTINE gather2D_l1(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_l1
-
-  
-  SUBROUTINE gather2D_l2(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_l2
-
-
-  SUBROUTINE gather2D_l3(VarIn, VarOut)
-    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
-    IMPLICIT NONE
-  
-    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
-    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
-    
-    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
-
-    CALL gather_omp(VarIn,Var_tmp)
-!$OMP MASTER
-    CALL gather2D_mpi(Var_tmp,VarOut)
-!$OMP END MASTER    
-
-  END SUBROUTINE gather2D_l3
-  
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! Definition des reduce_sum   --> 4D   !!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! Les entiers
-
-  SUBROUTINE reduce_sum_i(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN)  :: VarIn
-    INTEGER,INTENT(OUT) :: VarOut
-    
-    INTEGER             :: Var_tmp
-           
-    CALL reduce_sum_omp(VarIn,Var_tmp)
-!$OMP MASTER      
-    CALL reduce_sum_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE reduce_sum_i  
-
-
-  SUBROUTINE reduce_sum_i1(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-    INTEGER,DIMENSION(SIZE(VarIn))   :: Var_tmp
-           
-    CALL reduce_sum_omp(VarIn,Var_tmp)
-!$OMP MASTER      
-    CALL reduce_sum_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE reduce_sum_i1  
-
-
-  SUBROUTINE reduce_sum_i2(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2)) :: Var_tmp
-           
-    CALL reduce_sum_omp(VarIn,Var_tmp)
-!$OMP MASTER      
-    CALL reduce_sum_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE reduce_sum_i2  
-  
-
-  SUBROUTINE reduce_sum_i3(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3))  :: Var_tmp
-           
-    CALL reduce_sum_omp(VarIn,Var_tmp)
-!$OMP MASTER      
-    CALL reduce_sum_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE reduce_sum_i3  
-
-
-  SUBROUTINE reduce_sum_i4(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
-    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))  :: Var_tmp
-           
-    CALL reduce_sum_omp(VarIn,Var_tmp)
-!$OMP MASTER      
-    CALL reduce_sum_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE reduce_sum_i4  
-
-
-! Les reels
-
-  SUBROUTINE reduce_sum_r(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN)  :: VarIn
-    REAL,INTENT(OUT) :: VarOut
-    
-    REAL             :: Var_tmp
-           
-    CALL reduce_sum_omp(VarIn,Var_tmp)
-!$OMP MASTER      
-    CALL reduce_sum_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE reduce_sum_r  
-
-
-  SUBROUTINE reduce_sum_r1(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
-    
-    REAL,DIMENSION(SIZE(VarIn))   :: Var_tmp
-           
-    CALL reduce_sum_omp(VarIn,Var_tmp)
-!$OMP MASTER      
-    CALL reduce_sum_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE reduce_sum_r1  
-
-
-  SUBROUTINE reduce_sum_r2(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
-    
-    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2)) :: Var_tmp
-           
-    CALL reduce_sum_omp(VarIn,Var_tmp)
-!$OMP MASTER      
-    CALL reduce_sum_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE reduce_sum_r2  
-  
-
-  SUBROUTINE reduce_sum_r3(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
-    
-    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3))  :: Var_tmp
-           
-    CALL reduce_sum_omp(VarIn,Var_tmp)
-!$OMP MASTER      
-    CALL reduce_sum_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE reduce_sum_r3  
-
-
-  SUBROUTINE reduce_sum_r4(VarIn, VarOut)
-    IMPLICIT NONE
-  
-    REAL,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
-    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
-    
-    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))  :: Var_tmp
-           
-    CALL reduce_sum_omp(VarIn,Var_tmp)
-!$OMP MASTER      
-    CALL reduce_sum_mpi(Var_tmp,VarOut)
-!$OMP END MASTER
-  
-  END SUBROUTINE reduce_sum_r4  
-
-   
-END MODULE mod_phys_lmdz_transfert_para
-
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/grid/dimension/dimensions.96.95.39
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/grid/dimension/dimensions.96.95.39	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/grid/dimension/dimensions.96.95.39	(revision 3814)
@@ -0,0 +1,12 @@
+!-----------------------------------------------------------------------
+!   INCLUDE 'dimensions.h'
+!
+!   dimensions.h contient les dimensions du modele
+!   ndm est tel que iim=2**ndm
+!-----------------------------------------------------------------------
+
+      INTEGER iim,jjm,llm,ndm
+
+      PARAMETER (iim= 96,jjm=95,llm=39,ndm=1)
+
+!-----------------------------------------------------------------------
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/misc/handle_err_m.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/misc/handle_err_m.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/misc/handle_err_m.F90	(revision 3814)
@@ -39,5 +39,5 @@
           end if
        end if
-       call abort_gcm("NetCDF95 handle_err", "", 1)
+       call abort_physic("NetCDF95 handle_err", "", 1)
     end if
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/misc/write_field.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/misc/write_field.F90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/misc/write_field.F90	(revision 3814)
@@ -0,0 +1,326 @@
+!
+! $Id: write_field.F90 2239 2015-03-23 07:27:30Z emillour $
+!
+module write_field
+implicit none
+
+  integer, parameter :: MaxWriteField = 100
+  integer, dimension(MaxWriteField),save :: FieldId
+  integer, dimension(MaxWriteField),save :: FieldVarId
+  integer, dimension(MaxWriteField),save :: FieldIndex
+  character(len=255), dimension(MaxWriteField) ::  FieldName 
+   
+  integer,save :: NbField = 0
+  
+  interface WriteField
+    module procedure WriteField3d,WriteField2d,WriteField1d
+  end interface WriteField
+  contains
+  
+    function GetFieldIndex(name)
+    implicit none
+      integer          :: GetFieldindex
+      character(len=*) :: name
+    
+      character(len=255) :: TrueName
+      integer            :: i
+       
+      
+      TrueName=TRIM(ADJUSTL(name))
+    
+      GetFieldIndex=-1
+      do i=1,NbField
+        if (TrueName==FieldName(i)) then
+          GetFieldIndex=i
+          exit
+        endif
+      enddo
+    end function GetFieldIndex
+ 
+    subroutine WriteField3d(name,Field)
+    implicit none
+      character(len=*) :: name
+      real, dimension(:,:,:) :: Field 
+      integer, dimension(3) :: Dim
+      
+      Dim=shape(Field)
+      call WriteField_gen(name,Field,Dim(1),Dim(2),Dim(3))  
+  
+    end subroutine WriteField3d
+    
+    subroutine WriteField2d(name,Field)
+    implicit none
+      character(len=*) :: name
+      real, dimension(:,:) :: Field 
+      integer, dimension(2) :: Dim
+      
+      Dim=shape(Field)
+      call WriteField_gen(name,Field,Dim(1),Dim(2),1)  
+  
+    end subroutine WriteField2d
+    
+    subroutine WriteField1d(name,Field)
+    implicit none
+      character(len=*) :: name
+      real, dimension(:) :: Field 
+      integer, dimension(1) :: Dim
+      
+      Dim=shape(Field)
+      call WriteField_gen(name,Field,Dim(1),1,1)  
+  
+    end subroutine WriteField1d
+        
+    subroutine WriteField_gen(name,Field,dimx,dimy,dimz)
+    implicit none
+    include 'netcdf.inc'
+      character(len=*) :: name
+      integer :: dimx,dimy,dimz
+      real,dimension(dimx,dimy,dimz) :: Field
+      integer,dimension(dimx*dimy*dimz) :: ndex
+      integer :: status
+      integer :: index
+      integer :: start(4)
+      integer :: count(4)
+      
+           
+      Index=GetFieldIndex(name)
+      if (Index==-1) then
+        call CreateNewField(name,dimx,dimy,dimz)
+	Index=GetFieldIndex(name)
+      else
+        FieldIndex(Index)=FieldIndex(Index)+1.
+      endif
+      
+      start(1)=1
+      start(2)=1
+      start(3)=1
+      start(4)=FieldIndex(Index)
+
+      count(1)=dimx
+      count(2)=dimy
+      count(3)=dimz
+      count(4)=1
+
+      status = NF_PUT_VARA_DOUBLE(FieldId(Index),FieldVarId(Index),start,count,Field)
+      status = NF_SYNC(FieldId(Index))
+      
+    end subroutine WriteField_gen
+       
+    subroutine CreateNewField(name,dimx,dimy,dimz)
+    implicit none
+    include 'netcdf.inc'  
+      character(len=*) :: name
+      integer :: dimx,dimy,dimz
+      integer :: TabDim(4)
+      integer :: status
+      
+      
+      NbField=NbField+1
+      FieldName(NbField)=TRIM(ADJUSTL(name))
+      FieldIndex(NbField)=1
+      
+      
+      status = NF_CREATE(TRIM(ADJUSTL(name))//'.nc', NF_CLOBBER, FieldId(NbField))
+      status = NF_DEF_DIM(FieldId(NbField),'X',dimx,TabDim(1))
+      status = NF_DEF_DIM(FieldId(NbField),'Y',dimy,TabDim(2))
+      status = NF_DEF_DIM(FieldId(NbField),'Z',dimz,TabDim(3))
+      status = NF_DEF_DIM(FieldId(NbField),'iter',NF_UNLIMITED,TabDim(4))
+      status = NF_DEF_VAR(FieldId(NbField),FieldName(NbField),NF_DOUBLE,4,TabDim,FieldVarId(NbField))
+      status = NF_ENDDEF(FieldId(NbField))
+
+    end subroutine CreateNewField
+    
+    
+    
+  subroutine write_field1D(name,Field)
+    implicit none
+  
+    integer, parameter :: MaxDim=1
+    character(len=*)   :: name
+    real, dimension(:) :: Field
+    real, dimension(:),allocatable :: New_Field
+    character(len=20) :: str
+    integer, dimension(MaxDim) :: Dim
+    integer :: i,nb
+    integer, parameter :: id=10
+    integer, parameter :: NbCol=4
+    integer :: ColumnSize 
+    integer :: pos
+    character(len=255) :: form
+    character(len=255) :: MaxLen
+    
+    
+    open(unit=id,file=name//'.field',form='formatted',status='replace')
+    write (id,'("----- Field '//name//'",//)')
+    Dim=shape(Field)
+    MaxLen=int2str(len(trim(int2str(Dim(1)))))
+    ColumnSize=20+6+3+len(trim(int2str(Dim(1))))
+    Nb=0
+    Pos=2
+    do i=1,Dim(1)
+      nb=nb+1
+      
+      if (MOD(nb,NbCol)==0) then
+        form='(t'//trim(int2str(pos))// ',i'//trim(MaxLen) //'," ---> ",g22.16,/)'
+        Pos=2
+      else
+        form='(t'//trim(int2str(pos))// ',i'//trim(MaxLen) //'," ---> ",g22.16," | ",)'
+        Pos=Pos+ColumnSize
+      endif
+      write (id,form,advance='no') i,Field(i)
+    enddo
+     
+    close(id)
+
+  end subroutine write_field1D
+
+  subroutine write_field2D(name,Field)
+    implicit none
+  
+    integer, parameter :: MaxDim=2
+    character(len=*)   :: name
+    real, dimension(:,:) :: Field
+    real, dimension(:,:),allocatable :: New_Field
+    character(len=20) :: str
+    integer, dimension(MaxDim) :: Dim
+    integer :: i,j,nb
+    integer, parameter :: id=10
+    integer, parameter :: NbCol=4
+    integer :: ColumnSize 
+    integer :: pos,offset
+    character(len=255) :: form
+    character(len=255) :: spacing
+    
+    open(unit=id,file=name//'.field',form='formatted',status='replace')
+    write (id,'("----- Field '//name//'",//)')
+    
+    Dim=shape(Field)
+    offset=len(trim(int2str(Dim(1))))+len(trim(int2str(Dim(2))))+3
+    ColumnSize=20+6+3+offset
+
+    spacing='(t2,"'//repeat('-',ColumnSize*NbCol)//'")'
+    
+    do i=1,Dim(2)
+      nb=0
+      Pos=2
+      do j=1,Dim(1)
+        nb=nb+1
+      
+        if (MOD(nb,NbCol)==0) then
+          form='(t'//trim(int2str(pos))//            &
+               ',"('//trim(int2str(j))//','          &
+                    //trim(int2str(i))//')",t'       & 
+                    //trim(int2str(pos+offset))     &    
+                    //'," ---> ",g22.16,/)'
+          Pos=2
+        else
+          form='(t'//trim(int2str(pos))//            &
+               ',"('//trim(int2str(j))//','          &
+                    //trim(int2str(i))//')",t'       & 
+                    //trim(int2str(pos+offset))     &    
+                    //'," ---> ",g22.16," | ")'
+          Pos=Pos+ColumnSize
+        endif
+        write (id,form,advance='no') Field(j,i)
+      enddo
+      if (MOD(nb,NbCol)==0) then
+        write (id,spacing)
+      else
+        write (id,'("")')
+        write (id,spacing)
+      endif
+    enddo
+     
+  end subroutine write_field2D
+  
+  subroutine write_field3D(name,Field)
+    implicit none
+  
+    integer, parameter :: MaxDim=3
+    character(len=*)   :: name
+    real, dimension(:,:,:) :: Field
+    real, dimension(:,:,:),allocatable :: New_Field
+    integer, dimension(MaxDim) :: Dim
+    integer :: i,j,k,nb
+    integer, parameter :: id=10
+    integer, parameter :: NbCol=4
+    integer :: ColumnSize 
+    integer :: pos,offset
+    character(len=255) :: form
+    character(len=255) :: spacing
+
+    open(unit=id,file=name//'.field',form='formatted',status='replace')
+    write (id,'("----- Field '//name//'"//)')
+    
+    Dim=shape(Field)
+    offset=len(trim(int2str(Dim(1))))+len(trim(int2str(Dim(2))))+len(trim(int2str(Dim(3))))+4
+    ColumnSize=22+6+3+offset
+
+!    open(unit=id,file=name,form=formatted
+   
+    spacing='(t2,"'//repeat('-',ColumnSize*NbCol)//'")'
+    
+    do i=1,Dim(3)
+    
+      do j=1,Dim(2)
+        nb=0
+        Pos=2
+        
+        do k=1,Dim(1)
+        nb=nb+1
+      
+          if (MOD(nb,NbCol)==0) then
+            form='(t'//trim(int2str(pos))//            &
+                 ',"('//trim(int2str(k))//','          &
+                      //trim(int2str(j))//','          &
+                      //trim(int2str(i))//')",t'       & 
+                      //trim(int2str(pos+offset))      &    
+                      //'," ---> ",g22.16,/)'
+           Pos=2
+          else
+            form='(t'//trim(int2str(pos))//            &
+                 ',"('//trim(int2str(k))//','          &
+                      //trim(int2str(j))//','          &
+                      //trim(int2str(i))//')",t'       & 
+                      //trim(int2str(pos+offset))      &    
+                      //'," ---> ",g22.16," | ")'
+! dépent de l'implémention, sur compaq, c'est necessaire
+!            Pos=Pos+ColumnSize
+          endif
+          write (id,form,advance='no') Field(k,j,i)
+        enddo
+        if (MOD(nb,NbCol)==0) then
+          write (id,spacing)
+        else
+          write (id,'("")')
+          write (id,spacing)
+        endif
+      enddo
+      write (id,spacing)
+    enddo
+    
+    close(id)
+  
+  end subroutine write_field3D  
+  
+  function int2str(int)
+    implicit none
+    integer, parameter :: MaxLen=10
+    integer,intent(in) :: int
+    character(len=MaxLen) :: int2str
+    logical :: flag
+    integer :: i
+    flag=.true.
+    
+    i=int
+    
+    int2str=''
+    do while (flag)
+      int2str=CHAR(MOD(i,10)+48)//int2str
+      i=i/10
+      if (i==0) flag=.false.
+    enddo
+  end function int2str
+
+end module write_field
+  
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aaam_bud.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aaam_bud.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aaam_bud.F90	(revision 3814)
@@ -123,5 +123,5 @@
   IF (iim+1>801 .OR. jjm+1>401) THEN
     abort_message = 'Pb de dimension dans aaam_bud'
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/abort_physic.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/abort_physic.F90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/abort_physic.F90	(revision 3814)
@@ -0,0 +1,49 @@
+      SUBROUTINE abort_physic(modname, message, ierr)
+     
+#ifdef CPP_IOIPSL
+      USE IOIPSL
+#else
+! if not using IOIPSL, we still need to use (a local version of) getin_dump
+      USE ioipsl_getincom
+#endif
+      USE mod_phys_lmdz_para
+#include "iniprint.h"
+ 
+!
+! Stops the simulation cleanly, closing files and printing various
+! comments
+!
+!  Input: modname = name of calling program
+!         message = stuff to print
+!         ierr    = severity of situation ( = 0 normal )
+
+      character(len=*), intent(in):: modname
+      integer ierr, ierror_mpi
+      character(len=*), intent(in):: message
+
+      write(lunout,*) 'in abort_gcm'
+#ifdef CPP_IOIPSL
+!$OMP MASTER
+      call histclo
+      call restclo
+      if (mpi_rank .eq. 0) then
+         call getin_dump
+      endif
+!$OMP END MASTER
+#endif
+
+      write(lunout,*) 'Stopping in ', modname
+      write(lunout,*) 'Reason = ',message
+      if (ierr .eq. 0) then
+        write(lunout,*) 'Everything is cool'
+      else
+        write(lunout,*) 'Houston, we have a problem, ierr = ', ierr
+#ifdef CPP_MPI
+!$OMP CRITICAL (MPI_ABORT_PHYSIC)
+        call MPI_ABORT(COMM_LMDZ_PHY, 1, ierror_mpi)
+!$OMP END CRITICAL (MPI_ABORT_PHYSIC)
+#else
+        stop 1
+#endif          
+      endif
+      END
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aeropt.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aeropt.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aeropt.F90	(revision 3814)
@@ -81,5 +81,5 @@
       IF (rh<0.) THEN
         abort_message = 'aeropt: RH < 0 not possible'
-        CALL abort_gcm(modname, abort_message, 1)
+        CALL abort_physic(modname, abort_message, 1)
       END IF
       IF (rh>85.) rh_num = 10
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aeropt_2bands.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aeropt_2bands.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aeropt_2bands.F90	(revision 3814)
@@ -536,5 +536,5 @@
           A1_SSSSM_b2(klev), A2_SSSSM_b2(klev), A3_SSSSM_b2(klev),&
           B1_SSSSM_b2(klev), B2_SSSSM_b2(klev), C1_SSSSM_b2(klev), C2_SSSSM_b2(klev), stat=ierr)
-        IF (ierr /= 0) CALL abort_gcm('aeropt_2bands', 'pb in allocation 1',1)
+        IF (ierr /= 0) CALL abort_physic('aeropt_2bands', 'pb in allocation 1',1)
      END IF
      
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aeropt_5wv.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aeropt_5wv.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/aeropt_5wv.F90	(revision 3814)
@@ -588,5 +588,5 @@
           A1_SSSSM(klev), A2_SSSSM(klev), A3_SSSSM(klev),&
           B1_SSSSM(klev), B2_SSSSM(klev), C1_SSSSM(klev), C2_SSSSM(klev), stat=ierr)
-        IF (ierr /= 0) CALL abort_gcm('aeropt_5mw', 'pb in allocation 1',1)
+        IF (ierr /= 0) CALL abort_physic('aeropt_5mw', 'pb in allocation 1',1)
      END IF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/calltherm.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/calltherm.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/calltherm.F90	(revision 3814)
@@ -208,5 +208,5 @@
           else if (iflag_thermals.eq.11) then
               abort_message = 'cas non prevu dans calltherm'
-              CALL abort_gcm (modname,abort_message,1)
+              CALL abort_physic (modname,abort_message,1)
 
 !           CALL thermcell_pluie(klon,klev,zdt  &
@@ -260,5 +260,5 @@
          else
            abort_message = 'Cas des thermiques non prevu'
-           CALL abort_gcm (modname,abort_message,1)
+           CALL abort_physic (modname,abort_message,1)
          endif
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/carbon_cycle_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/carbon_cycle_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/carbon_cycle_mod.F90	(revision 3814)
@@ -88,5 +88,5 @@
     USE comgeomphy
     USE mod_phys_lmdz_transfert_para
-    USE infotrac
+    USE infotrac_phy
     USE IOIPSL
     USE surface_data, ONLY : ok_veget, type_ocean
@@ -135,5 +135,5 @@
        WRITE(lunout,*) 'carbon_cycle_emis_comp = ',carbon_cycle_emis_comp
        IF (carbon_cycle_emis_comp) THEN
-          CALL abort_gcm('carbon_cycle_init', 'carbon_cycle_emis_comp option not yet implemented!!',1)
+          CALL abort_physic('carbon_cycle_init', 'carbon_cycle_emis_comp option not yet implemented!!',1)
        END IF
     END IF
@@ -225,5 +225,5 @@
           co2trac(itc)%updatefreq = 86400
           ! DOES THIS WORK ???? Problematic due to implementation of the coupled fluxes...
-          CALL abort_gcm('carbon_cycle_init','transport of total CO2 has to be implemented and tested',1)
+          CALL abort_physic('carbon_cycle_init','transport of total CO2 has to be implemented and tested',1)
        END SELECT
     END DO
@@ -247,5 +247,5 @@
     ! Allocate vector for storing fluxes to inject
     ALLOCATE(dtr_add(klon,maxco2trac), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('carbon_cycle_init', 'pb in allocation 11',1)       
+    IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation 11',1)       
     
     ! Allocate variables for cumulating fluxes from ORCHIDEE
@@ -253,9 +253,9 @@
        IF (.NOT. carbon_cycle_tr .AND. carbon_cycle_cpl) THEN
           ALLOCATE(fco2_land_day(klon), stat=ierr)
-          IF (ierr /= 0) CALL abort_gcm('carbon_cycle_init', 'pb in allocation 2',1)
+          IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation 2',1)
           fco2_land_day(1:klon) = 0.
           
           ALLOCATE(fco2_lu_day(klon), stat=ierr)
-          IF (ierr /= 0) CALL abort_gcm('carbon_cycle_init', 'pb in allocation 3',1)
+          IF (ierr /= 0) CALL abort_physic('carbon_cycle_init', 'pb in allocation 3',1)
           fco2_lu_day(1:klon)   = 0.
        END IF
@@ -267,10 +267,10 @@
 !    IF (carbon_cycle_cpl .AND. type_ocean/='couple') THEN
 !       WRITE(lunout,*) 'Coupling with ocean model is needed for carbon_cycle_cpl'
-!       CALL abort_gcm('carbon_cycle_init', 'coupled ocean is needed for carbon_cycle_cpl',1)
+!       CALL abort_physic('carbon_cycle_init', 'coupled ocean is needed for carbon_cycle_cpl',1)
 !    END IF
 !
 !    IF (carbon_cycle_cpl .AND..NOT. ok_veget) THEN
 !       WRITE(lunout,*) 'Coupling with surface land model ORCHDIEE is needed for carbon_cycle_cpl'
-!       CALL abort_gcm('carbon_cycle_init', 'ok_veget is needed for carbon_cycle_cpl',1)
+!       CALL abort_physic('carbon_cycle_init', 'ok_veget is needed for carbon_cycle_cpl',1)
 !    END IF
 
@@ -278,5 +278,5 @@
     teststop=0
     DO it=1,teststop
-       CALL abort_gcm('carbon_cycle_init', 'Entering loop from 1 to 0',1)
+       CALL abort_physic('carbon_cycle_init', 'Entering loop from 1 to 0',1)
     END DO
 
@@ -284,5 +284,5 @@
        ! No carbon tracers found in tracer.def. It is not possible to do carbon cycle 
        WRITE(lunout,*) 'No carbon tracers found in tracer.def. Not ok with carbon_cycle_tr and/or carbon_cycle_cp'
-       CALL abort_gcm('carbon_cycle_init', 'No carbon tracers found in tracer.def',1)
+       CALL abort_physic('carbon_cycle_init', 'No carbon tracers found in tracer.def',1)
     END IF
     
@@ -303,5 +303,5 @@
 ! - Calculate CO2 flux to send to ocean and land models (PISCES and ORCHIDEE)
 
-    USE infotrac
+    USE infotrac_phy
     USE dimphy
     USE mod_phys_lmdz_transfert_para
@@ -370,5 +370,5 @@
              CASE DEFAULT
                 WRITE(lunout,*) 'Error with tracer ',co2trac(it)%name
-                CALL abort_gcm('carbon_cycle', 'No coupling implemented for this tracer',1)
+                CALL abort_physic('carbon_cycle', 'No coupling implemented for this tracer',1)
              END SELECT
           ELSE
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cdrag.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cdrag.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cdrag.F90	(revision 3814)
@@ -143,5 +143,5 @@
       WRITE(lunout,*)" The negative q1 is set to zero "
 !      abort_message="voir ci-dessus"
-!      CALL abort_gcm(modname,abort_message,1)
+!      CALL abort_physic(modname,abort_message,1)
   ENDIF
   IF (ng_qsurf.GT.0) THEN
@@ -150,5 +150,5 @@
       WRITE(lunout,*)" The negative qsurf is set to zero "
 !      abort_message="voir ci-dessus"
-!      CALL abort_gcm(modname,abort_message,1)
+!      CALL abort_physic(modname,abort_message,1)
   ENDIF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/change_srf_frac_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/change_srf_frac_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/change_srf_frac_mod.F90	(revision 3814)
@@ -109,5 +109,5 @@
           WRITE(lunout,*)'at point = ',MINLOC(pctsrf(:,:))
           WRITE(lunout,*)'value = ',MINVAL(pctsrf(:,:)) 
-          CALL abort_gcm('change_srf_frac','Negative fraction',1)
+          CALL abort_physic('change_srf_frac','Negative fraction',1)
        END IF
 
@@ -116,5 +116,5 @@
           DO i= 1, klon
              tmpsum = SUM(pctsrf(i,:))
-             IF (ABS(1. - tmpsum) > 0.05) CALL abort_gcm('change_srf_frac','Total fraction not equal 1.',1)
+             IF (ABS(1. - tmpsum) > 0.05) CALL abort_physic('change_srf_frac','Total fraction not equal 1.',1)
           END DO
        END IF
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/clcdrag.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/clcdrag.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/clcdrag.F90	(revision 3814)
@@ -73,5 +73,5 @@
 
   abort_message='obsolete, remplace par cdrag, use at you own risk'
-  CALL abort_gcm(modname,abort_message,1)
+  CALL abort_physic(modname,abort_message,1)
 
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/climb_wind_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/climb_wind_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/climb_wind_mod.F90	(revision 3814)
@@ -44,23 +44,23 @@
 
     ALLOCATE(alf1(klon), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm(modname,'Pb in allocate alf1',1)
+    IF (ierr /= 0) CALL abort_physic(modname,'Pb in allocate alf1',1)
 
     ALLOCATE(alf2(klon), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm(modname,'Pb in allocate alf2',1)
+    IF (ierr /= 0) CALL abort_physic(modname,'Pb in allocate alf2',1)
 
     ALLOCATE(Kcoefm(klon,klev), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm(modname,'Pb in allocate Kcoefm',1)
+    IF (ierr /= 0) CALL abort_physic(modname,'Pb in allocate Kcoefm',1)
 
     ALLOCATE(Ccoef_U(klon,klev), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm(modname,'Pb in allocate Ccoef_U',1)
+    IF (ierr /= 0) CALL abort_physic(modname,'Pb in allocate Ccoef_U',1)
 
     ALLOCATE(Dcoef_U(klon,klev), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm(modname,'Pb in allocation Dcoef_U',1)
+    IF (ierr /= 0) CALL abort_physic(modname,'Pb in allocation Dcoef_U',1)
 
     ALLOCATE(Ccoef_V(klon,klev), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm(modname,'Pb in allocation Ccoef_V',1)
+    IF (ierr /= 0) CALL abort_physic(modname,'Pb in allocation Ccoef_V',1)
 
     ALLOCATE(Dcoef_V(klon,klev), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm(modname,'Pb in allocation Dcoef_V',1)
+    IF (ierr /= 0) CALL abort_physic(modname,'Pb in allocation Dcoef_V',1)
 
     ALLOCATE(Acoef_U(klon), Bcoef_U(klon), Acoef_V(klon), Bcoef_V(klon), STAT=ierr)
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/coefcdrag.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/coefcdrag.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/coefcdrag.F90	(revision 3814)
@@ -78,5 +78,5 @@
 
   abort_message='obsolete, remplace par cdrag, use at you own risk'
-  CALL abort_gcm(modname,abort_message,1)
+  CALL abort_physic(modname,abort_message,1)
 
 !
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/comconst_phy_mod.f90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/comconst_phy_mod.f90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/comconst_phy_mod.f90	(revision 3814)
@@ -0,0 +1,12 @@
+MODULE comconst_phy_mod
+
+      REAL,PARAMETER :: pi=3.1415926535897932384626433832795    ! something like 3.14159....
+
+      REAL, SAVE ::  daysec !length (in s) of a standard day
+!$OMP THREADPRIVATE(daysec)
+
+      REAL, SAVE :: dtvr ! dynamical time step (in s)
+!$OMP THREADPRIVATE(dtvr)
+
+
+END MODULE comconst_phy_mod
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/comgeom2_phy_mod.f90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/comgeom2_phy_mod.f90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/comgeom2_phy_mod.f90	(revision 3814)
@@ -0,0 +1,10 @@
+MODULE comgeom2_phy_mod
+
+  REAL,ALLOCATABLE,SAVE :: rlatu(:)
+!$OMP THREADPRIVATE(rlatu)
+
+  REAL,ALLOCATABLE,SAVE :: rlatv(:)
+!$OMP THREADPRIVATE(rlatv)
+
+
+END MODULE comgeom2_phy_mod
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/comvert_phy_mod.f90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/comvert_phy_mod.f90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/comvert_phy_mod.f90	(revision 3814)
@@ -0,0 +1,14 @@
+MODULE comvert_phy_mod
+
+  REAL,ALLOCATABLE,SAVE :: ap(:)     ! hybrid pressure contribution at interlayers
+!$OMP THREADPRIVATE(ap)
+  REAL,ALLOCATABLE,SAVE :: bp(:)     ! hybrid sigma contribution at interlayer
+!$OMP THREADPRIVATE(bp)
+  REAL,ALLOCATABLE,SAVE :: presnivs(:) ! (reference) pressure at mid-layers
+!$OMP THREADPRIVATE(presnivs)
+  REAL,SAVE :: preff  ! reference surface pressure (Pa)
+!$OMP THREADPRIVATE(preff)
+ 
+
+
+END MODULE comvert_phy_mod
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/concvl.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/concvl.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/concvl.F90	(revision 3814)
@@ -29,5 +29,5 @@
 
   USE dimphy
-  USE infotrac, ONLY: nbtr
+  USE infotrac_phy, ONLY: nbtr
   USE phys_local_var_mod, ONLY: omega
   IMPLICIT NONE
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/condsurf.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/condsurf.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/condsurf.F90	(revision 3814)
@@ -6,4 +6,5 @@
   USE mod_phys_lmdz_para
   USE indice_sol_mod
+  USE temps_phy_mod
   IMPLICIT NONE
 
@@ -26,5 +27,4 @@
   ! ym#include "dimensions.h"
   ! ym#include "dimphy.h"
-  include "temps.h"
   include "clesphys.h"
 
@@ -56,5 +56,5 @@
   IF (jour<0 .OR. jour>(360-1)) THEN
     PRINT *, 'Le jour demande n est pas correct: ', jour
-    CALL abort_gcm('condsurf', '', 1)
+    CALL abort_physic('condsurf', '', 1)
   END IF
 
@@ -76,5 +76,5 @@
     PRINT *, ' trouve pas sur les ', nannemax, ' annees a partir de '
     PRINT *, ' l annee de debut', annee_ref
-    CALL abort_gcm('condsurf', '', 1)
+    CALL abort_physic('condsurf', '', 1)
 
 100 CONTINUE
@@ -96,5 +96,5 @@
       WRITE (6, *) '       l an 2000 )  ,  n existe  pas !  '
       WRITE (6, *) ' ierr = ', ierr
-      CALL abort_gcm('condsurf', '', 1)
+      CALL abort_physic('condsurf', '', 1)
     END IF
     ! DO k = 1, jour
@@ -109,5 +109,5 @@
     ierr = nf_inq_varid(nid, 'BILS', nvarid)
     IF (ierr/=nf_noerr) THEN
-      CALL abort_gcm('cond_surf', 'Le champ <BILS> est absent', 1)
+      CALL abort_physic('cond_surf', 'Le champ <BILS> est absent', 1)
     END IF
     PRINT *, 'debut,epais', debut, epais, 'jour,jourvrai', jour, jourvrai
@@ -118,5 +118,5 @@
 #endif
     IF (ierr/=nf_noerr) THEN
-      CALL abort_gcm('condsurf', 'Lecture echouee pour <BILS>', 1)
+      CALL abort_physic('condsurf', 'Lecture echouee pour <BILS>', 1)
     END IF
     ! ENDDO !k = 1, jour
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/conema3.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/conema3.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/conema3.F90	(revision 3814)
@@ -8,5 +8,5 @@
 
   USE dimphy
-  USE infotrac, ONLY: nbtr
+  USE infotrac_phy, ONLY: nbtr
   IMPLICIT NONE
   ! ======================================================================
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/conemav.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/conemav.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/conemav.F90	(revision 3814)
@@ -8,5 +8,5 @@
 
   USE dimphy
-  USE infotrac, ONLY: nbtr
+  USE infotrac_phy, ONLY: nbtr
   IMPLICIT NONE
   ! ======================================================================
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/conf_phys_m.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/conf_phys_m.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/conf_phys_m.F90	(revision 3814)
@@ -27,5 +27,5 @@
     USE phys_cal_mod
     USE carbon_cycle_mod, ONLY : carbon_cycle_tr, carbon_cycle_cpl
-    USE control_mod
+    USE control_phy_mod
     USE mod_grid_phy_lmdz, only: klon_glo
 
@@ -245,5 +245,5 @@
        WRITE(lunout,*)'Variable OCEAN has been replaced by the variable type_ocean.'
        WRITE(lunout,*)'You have to update your parameter file physiq.def to succed running'
-       CALL abort_gcm('conf_phys','Variable OCEAN no longer existing, use variable name type_ocean',1)
+       CALL abort_physic('conf_phys','Variable OCEAN no longer existing, use variable name type_ocean',1)
     END IF
 
@@ -258,5 +258,5 @@
        WRITE(lunout,*)'ERROR! Timestep of coupling between atmosphere and ocean'
        WRITE(lunout,*)'cannot be zero.'
-       CALL abort_gcm('conf_phys','t_coupl = 0.',1)
+       CALL abort_physic('conf_phys','t_coupl = 0.',1)
     END IF
 
@@ -2077,5 +2077,5 @@
     IF (type_ocean=='couple' .AND. (version_ocean/='opa8' .AND. version_ocean/='nemo') ) THEN
        WRITE(lunout,*)' ERROR version_ocean=',version_ocean,' not valid in coupled configuration'
-       CALL abort_gcm('conf_phys','version_ocean not valid',1)
+       CALL abort_physic('conf_phys','version_ocean not valid',1)
     END IF
 
@@ -2085,5 +2085,5 @@
              .AND. version_ocean/='sicINT' .AND. version_ocean/='sicNO') THEN
        WRITE(lunout,*)' ERROR version_ocean=',version_ocean,' not valid with slab ocean'
-       CALL abort_gcm('conf_phys','version_ocean not valid',1)
+       CALL abort_physic('conf_phys','version_ocean not valid',1)
     END IF
 
@@ -2092,8 +2092,8 @@
     IF (ok_ade .OR. ok_aie) THEN 
        IF ( flag_aerosol .EQ. 0 ) THEN
-          CALL abort_gcm('conf_phys','flag_aerosol=0 not compatible avec ok_ade ou ok_aie=.TRUE.',1)
+          CALL abort_physic('conf_phys','flag_aerosol=0 not compatible avec ok_ade ou ok_aie=.TRUE.',1)
        END IF
        IF ( .NOT. new_aod .AND.  flag_aerosol .NE. 1) THEN
-          CALL abort_gcm('conf_phys','new_aod=.FALSE. not compatible avec flag_aerosol=1',1)
+          CALL abort_physic('conf_phys','new_aod=.FALSE. not compatible avec flag_aerosol=1',1)
        END IF
     END IF
@@ -2101,5 +2101,5 @@
     ! ok_cdnc must be set to y if ok_aie is activated
     IF (ok_aie .AND. .NOT. ok_cdnc) THEN
-       CALL abort_gcm('conf_phys', 'ok_cdnc must be set to y if ok_aie is activated',1)
+       CALL abort_physic('conf_phys', 'ok_cdnc must be set to y if ok_aie is activated',1)
     ENDIF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/control_phy_mod.f90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/control_phy_mod.f90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/control_phy_mod.f90	(revision 3814)
@@ -0,0 +1,24 @@
+MODULE control_phy_mod
+
+  INTEGER,SAVE :: iphysiq ! call physics every iphysiq dynamical steps
+  !$OMP THREADPRIVATE(iphysiq)
+
+  INTEGER,SAVE :: day_step ! # of dynamical time steps per day
+  !$OMP THREADPRIVATE(day_step)
+
+  INTEGER,SAVE :: nday ! # of days to run
+  !$OMP THREADPRIVATE(nday)
+
+  INTEGER,SAVE :: dayref
+  !$OMP THREADPRIVATE(dayref)
+
+  CHARACTER(len=4),SAVE :: config_inca
+  !$OMP THREADPRIVATE(config_inca)
+
+  INTEGER,SAVE :: raz_date
+  !$OMP THREADPRIVATE(raz_date)
+
+  LOGICAL,SAVE :: offline
+  !$OMP THREADPRIVATE(offline)
+
+END MODULE control_phy_mod
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/convect3.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/convect3.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/convect3.F90	(revision 3814)
@@ -16,5 +16,5 @@
   ! #################################################################
   USE dimphy
-  USE infotrac, ONLY: nbtr
+  USE infotrac_phy, ONLY: nbtr
   IMPLICIT NONE
   include "dimensions.h"
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cpl_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cpl_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cpl_mod.F90	(revision 3814)
@@ -24,5 +24,5 @@
   USE oasis
   USE write_field_phy
-  USE control_mod
+  USE control_phy_mod
 
   
@@ -102,7 +102,6 @@
     USE surface_data
     USE indice_sol_mod
-
+    USE temps_phy_mod
     INCLUDE "dimensions.h"
-    INCLUDE "temps.h"
     INCLUDE "iniprint.h"
 
@@ -204,5 +203,5 @@
     IF (sum_error /= 0) THEN
        abort_message='Pb allocation variables couplees'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
 !*************************************************************************************
@@ -279,5 +278,5 @@
     IF (carbon_cycle_cpl .AND. version_ocean=='opa8') THEN
        abort_message='carbon_cycle_cpl does not work with opa8'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     END IF
 
@@ -297,6 +296,6 @@
     USE carbon_cycle_mod, ONLY : carbon_cycle_cpl
     USE indice_sol_mod
-
-    INCLUDE "temps.h"
+    USE temps_phy_mod
+    
     INCLUDE "iniprint.h"
     INCLUDE "YOMCST.h"
@@ -668,5 +667,5 @@
           IF (sum_error /= 0) THEN
              abort_message='Pb allocation variables couplees pour l''ecriture'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -853,5 +852,5 @@
           IF (sum_error /= 0) THEN
              abort_message='Pb allocation variables couplees pour l''ecriture'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -1028,7 +1027,8 @@
     USE carbon_cycle_mod, ONLY : carbon_cycle_cpl
     USE indice_sol_mod
+    USE temps_phy_mod
+
 ! Some includes
 !*************************************************************************************
-    INCLUDE "temps.h"
     INCLUDE "dimensions.h"
     
@@ -1291,5 +1291,5 @@
     IF (sum_error /= 0) THEN
        abort_message='Pb in deallocation of cpl_xxxx2D coupling variables'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
     
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv30_routines.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv30_routines.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv30_routines.F90	(revision 3814)
@@ -813,5 +813,5 @@
     WRITE (lunout, *) 'strange! nn not equal to ncum: ', nn, ncum
     abort_message = ''
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3_inicp.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3_inicp.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3_inicp.F90	(revision 3814)
@@ -109,5 +109,5 @@
       PRINT *, 'WARNING:: AREA OF MIXING PDF IS::', aire
       abort_message = ''
-      CALL abort_gcm(modname, abort_message, 1)
+      CALL abort_physic(modname, abort_message, 1)
     ELSE
       PRINT *, 'Area, mean & std deviation are ::', aire, mu, sigma
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3_inip.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3_inip.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3_inip.F90	(revision 3814)
@@ -138,5 +138,5 @@
       WRITE (lunout, *) 'WARNING:: AREA OF MIXING PDF IS::', aire
       abort_message = ''
-      CALL abort_gcm(modname, abort_message, 1)
+      CALL abort_physic(modname, abort_message, 1)
     ELSE
       PRINT *, 'Area, mean & std deviation are ::', aire, mu, sigma
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3_routines.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3_routines.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3_routines.F90	(revision 3814)
@@ -965,5 +965,5 @@
     WRITE (lunout, *) 'strange! nn not equal to ncum: ', nn, ncum
     abort_message = ''
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3a_compress.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3a_compress.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3a_compress.F90	(revision 3814)
@@ -125,5 +125,5 @@
     PRINT *, 'WARNING nn not equal to ncum: ', nn, ncum
     abort_message = ''
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
 
@@ -155,5 +155,5 @@
     PRINT *, 'WARNING nn not equal to ncum: ', nn, ncum
     abort_message = ''
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3p1_closure.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3p1_closure.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv3p1_closure.F90	(revision 3814)
@@ -551,5 +551,5 @@
         , il, alp2(il), alp(il), cin(il)
       abort_message = ''
-      CALL abort_gcm(modname, abort_message, 1)
+      CALL abort_physic(modname, abort_message, 1)
     END IF
     cbmfmax(il) = sigmax*wb2(il)*100.*p(il, icb(il))/(rrd*tv(il,icb(il)))
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv_routines.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv_routines.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cv_routines.F90	(revision 3814)
@@ -453,5 +453,5 @@
     WRITE (lunout, *) 'strange! nn not equal to ncum: ', nn, ncum
     abort_message = ''
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cva_driver.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cva_driver.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cva_driver.F90	(revision 3814)
@@ -671,5 +671,5 @@
     WRITE (lunout, *) 'changer la valeur de sig2feed dans physiq.def'
     abort_message = ''
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr.F90	(revision 3814)
@@ -12,5 +12,5 @@
   USE IOIPSL 
   USE dimphy
-  USE infotrac, ONLY : nbtr,tname
+  USE infotrac_phy, ONLY : nbtr,tname
   IMPLICIT NONE 
 !=====================================================================
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr_noscav.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr_noscav.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr_noscav.F90	(revision 3814)
@@ -4,5 +4,5 @@
 SUBROUTINE cvltr_noscav(it,pdtime,da, phi, mp,wght_cvfd,paprs,pplay,x,upd,dnd,dx)
   USE dimphy
-  USE infotrac, ONLY : nbtr
+  USE infotrac_phy, ONLY : nbtr
   IMPLICIT NONE 
 !=====================================================================
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr_scav.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr_scav.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr_scav.F90	(revision 3814)
@@ -13,5 +13,5 @@
   USE IOIPSL 
   USE dimphy
-  USE infotrac, ONLY : nbtr,tname
+  USE infotrac_phy, ONLY : nbtr,tname
   IMPLICIT NONE 
   !=====================================================================
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr_spl.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr_spl.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltr_spl.F90	(revision 3814)
@@ -13,5 +13,5 @@
   USE IOIPSL 
   USE dimphy
-  USE infotrac, ONLY : nbtr,tname
+  USE infotrac_phy, ONLY : nbtr,tname
   IMPLICIT NONE 
 !=====================================================================
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltrorig.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltrorig.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/cvltrorig.F90	(revision 3814)
@@ -4,5 +4,5 @@
 SUBROUTINE cvltrorig(it,pdtime,da, phi, mp,paprs,pplay,x,upd,dnd,dx)
   USE dimphy
-  USE infotrac, ONLY : nbtr
+  USE infotrac_phy, ONLY : nbtr
   IMPLICIT NONE 
 !=====================================================================
Index: namico_lmdz/aquaplanet/LMDZ5/libf/phylmd/ecribin.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/ecribin.F90	(revision 3813)
+++ 	(revision )
@@ -1,105 +1,0 @@
-
-! $Header$
-
-SUBROUTINE ecribins(unit, pz)
-  USE dimphy
-  IMPLICIT NONE
-  ! -----------------------------------------------------------------------
-  include "dimensions.h"
-  ! ccc#include "dimphy.h"
-  include "paramet.h"
-  include "comgeom.h"
-  include "comvert.h"
-
-  ! arguments:
-  ! ----------
-  INTEGER unit
-  REAL pz(klon)
-
-  ! local:
-  ! ------
-  INTEGER i, j, ig
-  REAL zz(iim+1, jjm+1)
-  ! -----------------------------------------------------------------------
-  ! passage a la grille dynamique:
-  ! ------------------------------
-  DO i = 1, iim + 1
-    zz(i, 1) = pz(1)
-    zz(i, jjm+1) = pz(klon)
-  END DO
-  ! traitement des point normaux
-  DO j = 2, jjm
-    ig = 2 + (j-2)*iim
-    CALL scopy(iim, pz(ig), 1, zz(1,j), 1)
-    zz(iim+1, j) = zz(1, j)
-  END DO
-  ! -----------------------------------------------------------------------
-#ifdef VPP
-  CALL ecriture(unit, zz, (iim+1)*(jjm+1))
-#else
-  WRITE (unit) zz
-#endif
-
-
-  RETURN
-END SUBROUTINE ecribins
-SUBROUTINE ecribina(unit, pz)
-  USE dimphy
-  IMPLICIT NONE
-  ! -----------------------------------------------------------------------
-  include "dimensions.h"
-  ! ccc#include "dimphy.h"
-  include "paramet.h"
-  include "comgeom.h"
-  include "comvert.h"
-
-  ! arguments:
-  ! ----------
-  INTEGER unit
-  REAL pz(klon, klev)
-
-  ! local:
-  ! ------
-  INTEGER i, j, ilay, ig
-  REAL zz(iim+1, jjm+1, llm)
-  ! -----------------------------------------------------------------------
-  ! passage a la grille dynamique:
-  ! ------------------------------
-  DO ilay = 1, llm
-    ! traitement des poles
-    DO i = 1, iim + 1
-      zz(i, 1, ilay) = pz(1, ilay)
-      zz(i, jjm+1, ilay) = pz(klon, ilay)
-    END DO
-    ! traitement des point normaux
-    DO j = 2, jjm
-      ig = 2 + (j-2)*iim
-      CALL scopy(iim, pz(ig,ilay), 1, zz(1,j,ilay), 1)
-      zz(iim+1, j, ilay) = zz(1, j, ilay)
-    END DO
-  END DO
-  ! -----------------------------------------------------------------------
-  DO ilay = 1, llm
-#ifdef VPP
-    CALL ecriture(unit, zz(1,1,ilay), (iim+1)*(jjm+1))
-#else
-    WRITE (unit)((zz(i,j,ilay),i=1,iim+1), j=1, jjm+1)
-#endif
-  END DO
-
-  RETURN
-END SUBROUTINE ecribina
-#ifdef VPP
-@OPTIONS NODOUBLE
-SUBROUTINE ecriture(nunit, r8, n)
-  INTEGER nunit, n, i
-  REAL (KIND=8) r8(n)
-  REAL r4(n)
-
-  DO i = 1, n
-    r4(i) = r8(i)
-  END DO
-  WRITE (nunit) r4
-  RETURN
-END SUBROUTINE ecriture
-#endif
Index: namico_lmdz/aquaplanet/LMDZ5/libf/phylmd/ecrireg.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/ecrireg.F90	(revision 3813)
+++ 	(revision )
@@ -1,119 +1,0 @@
-
-! $Header$
-
-SUBROUTINE ecriregs(unit, pz)
-  USE dimphy
-  IMPLICIT NONE
-  ! -----------------------------------------------------------------------
-  include "dimensions.h"
-  ! ccc#include "dimphy.h"
-  include "paramet.h"
-  include "comgeom.h"
-  include "comvert.h"
-  include "regdim.h"
-
-  ! arguments:
-  ! ----------
-  INTEGER unit
-  REAL pz(klon)
-
-  ! local:
-  ! ------
-  INTEGER i, j, ig
-  REAL zz(iim, jjm+1)
-  INTEGER nleng
-  PARAMETER (nleng=(i2_fin-i2_deb+1+i1_fin-i1_deb+1)*(j_fin-j_deb+1))
-  REAL zzz(nleng)
-
-  ! -----------------------------------------------------------------------
-  ! passage a la grille dynamique:
-  ! ------------------------------
-  DO i = 1, iim
-    zz(i, 1) = pz(1)
-    zz(i, jjm+1) = pz(klon)
-  END DO
-
-  ! traitement des point normaux
-  DO j = 2, jjm
-    ig = 2 + (j-2)*iim
-    CALL scopy(iim, pz(ig), 1, zz(1,j), 1)
-  END DO
-  ! -----------------------------------------------------------------------
-  ig = 0
-  DO j = j_deb, j_fin
-    DO i = i1_deb, i1_fin
-      ig = ig + 1
-      zzz(ig) = zz(i, j)
-    END DO
-    DO i = i2_deb, i2_fin
-      ig = ig + 1
-      zzz(ig) = zz(i, j)
-    END DO
-  END DO
-#ifdef VPP
-  CALL ecriture(unit, zzz, nleng)
-#else
-  WRITE (unit) zzz
-#endif
-  RETURN
-END SUBROUTINE ecriregs
-SUBROUTINE ecrirega(unit, pz)
-  USE dimphy
-  IMPLICIT NONE
-  ! -----------------------------------------------------------------------
-  include "dimensions.h"
-  ! ccc#include "dimphy.h"
-  include "paramet.h"
-  include "comgeom.h"
-  include "comvert.h"
-  include "regdim.h"
-
-  ! arguments:
-  ! ----------
-  INTEGER unit
-  REAL pz(klon, klev)
-
-  ! local:
-  ! ------
-  INTEGER i, j, ilay, ig
-  REAL zz(iim, jjm+1, llm)
-  INTEGER nleng
-  PARAMETER (nleng=(i2_fin-i2_deb+1+i1_fin-i1_deb+1)*(j_fin-j_deb+1))
-  REAL zzz(nleng)
-  ! -----------------------------------------------------------------------
-  ! passage a la grille dynamique:
-  ! ------------------------------
-  DO ilay = 1, llm
-    ! traitement des poles
-    DO i = 1, iim
-      zz(i, 1, ilay) = pz(1, ilay)
-      zz(i, jjm+1, ilay) = pz(klon, ilay)
-    END DO
-    ! traitement des point normaux
-    DO j = 2, jjm
-      ig = 2 + (j-2)*iim
-      CALL scopy(iim, pz(ig,ilay), 1, zz(1,j,ilay), 1)
-    END DO
-  END DO
-  ! -----------------------------------------------------------------------
-  DO ilay = 1, llm
-    ig = 0
-    DO j = j_deb, j_fin
-      DO i = i1_deb, i1_fin
-        ig = ig + 1
-        zzz(ig) = zz(i, j, ilay)
-      END DO
-      DO i = i2_deb, i2_fin
-        ig = ig + 1
-        zzz(ig) = zz(i, j, ilay)
-      END DO
-    END DO
-#ifdef VPP
-    CALL ecriture(unit, zzz, nleng)
-#else
-    WRITE (unit) zzz
-#endif
-  END DO
-
-  RETURN
-END SUBROUTINE ecrirega
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/ener_conserv.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/ener_conserv.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/ener_conserv.F90	(revision 3814)
@@ -88,5 +88,5 @@
    ELSE
       abort_message = 'iflag_ener_conserv non prevu'
-      CALL abort_gcm (modname,abort_message,1)
+      CALL abort_physic (modname,abort_message,1)
    ENDIF
 
Index: namico_lmdz/aquaplanet/LMDZ5/libf/phylmd/etat0_netcdf.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/etat0_netcdf.F90	(revision 3813)
+++ 	(revision )
@@ -1,541 +1,0 @@
-!
-! $Id: etat0_netcdf.F90 1625 2012-05-09 13:14:48Z lguez $
-!
-!-------------------------------------------------------------------------------
-!
-SUBROUTINE etat0_netcdf(ib, masque, phis, letat0)
-#ifndef CPP_1D
-!
-!-------------------------------------------------------------------------------
-! Purpose: Creates initial states
-!-------------------------------------------------------------------------------
-! Note: This routine is designed to work for Earth
-!-------------------------------------------------------------------------------
-  USE control_mod
-#ifdef CPP_EARTH
-  USE startvar
-  USE ioipsl
-  USE dimphy
-  USE infotrac
-  USE fonte_neige_mod
-  USE pbl_surface_mod
-  USE phys_state_var_mod
-  USE filtreg_mod
-  USE regr_lat_time_climoz_m, ONLY: regr_lat_time_climoz
-  USE conf_phys_m,            ONLY: conf_phys
-! For parameterization of ozone chemistry:
-  USE regr_lat_time_coefoz_m, only: regr_lat_time_coefoz
-  USE press_coefoz_m, only: press_coefoz
-  USE regr_pr_o3_m, only: regr_pr_o3
-  USE netcdf, ONLY : NF90_OPEN, NF90_NOWRITE, NF90_CLOSE, NF90_NOERR
-  USE indice_sol_mod
-  use exner_hyb_m, only: exner_hyb
-  use exner_milieu_m, only: exner_milieu
-  use test_disvert_m, only: test_disvert
-#endif
-  IMPLICIT NONE
-!-------------------------------------------------------------------------------
-! Arguments:
-#include "dimensions.h"
-#include "paramet.h"
-#include "iniprint.h"
-  LOGICAL,                    INTENT(IN)    :: ib     ! barycentric interpolat.
-  REAL, DIMENSION(iip1,jjp1), INTENT(INOUT) :: masque ! land mask
-  REAL, DIMENSION(iip1,jjp1), INTENT(OUT)   :: phis   ! geopotentiel au sol
-  LOGICAL,                    INTENT(IN)    :: letat0 ! F: masque only required
-#ifndef CPP_EARTH
-  WRITE(lunout,*)'limit_netcdf: Earth-specific routine, needs Earth physics'
-#else
-!-------------------------------------------------------------------------------
-! Local variables:
-#include "comgeom2.h"
-#include "comvert.h"
-#include "comconst.h"
-#include "dimsoil.h"
-#include "temps.h"
-  REAL,    DIMENSION(klon)                 :: tsol
-  REAL,    DIMENSION(klon)                 :: sn, rugmer, run_off_lic_0
-  REAL,    DIMENSION(iip1,jjp1)            :: orog, rugo, psol
-  REAL,    DIMENSION(iip1,jjp1,llm+1)      :: p3d
-  REAL,    DIMENSION(iip1,jjp1,llm)        :: uvent, t3d, tpot, qsat, qd
-  REAL,    DIMENSION(iip1,jjm ,llm)        :: vvent
-  REAL,    DIMENSION(:,:,:,:), ALLOCATABLE :: q3d
-  REAL,    DIMENSION(klon,nbsrf)           :: qsolsrf, snsrf
-  REAL,    DIMENSION(klon,nsoilmx,nbsrf)   :: tsoil
-
-!--- Local variables for sea-ice reading:
-  INTEGER                                  :: iml_lic, jml_lic, llm_tmp
-  INTEGER                                  :: ttm_tmp, iret, fid
-  INTEGER, DIMENSION(1)                    :: itaul
-  REAL,    DIMENSION(1)                    :: lev
-  REAL                                     :: date
-  REAL,    DIMENSION(:,:),   ALLOCATABLE   ::  lon_lic,  lat_lic, fraclic
-  REAL,    DIMENSION(:),     ALLOCATABLE   :: dlon_lic, dlat_lic
-  REAL,    DIMENSION(iip1,jjp1)            :: flic_tmp
-
-!--- Misc
-  CHARACTER(LEN=80)                        :: x, fmt
-  INTEGER                                  :: i, j, l, ji
-  REAL,    DIMENSION(iip1,jjp1,llm)        :: pk, pls, y
-  REAL,    DIMENSION(ip1jmp1)              :: pks
-
-#include "comdissnew.h"
-#include "serre.h"
-#include "clesphys.h"
-
-  REAL,    DIMENSION(iip1,jjp1,llm)        :: masse
-  INTEGER :: itau, iday
-  REAL    :: xpn, xps, time, phystep
-  REAL,    DIMENSION(iim)                  :: xppn, xpps
-  REAL,    DIMENSION(ip1jmp1,llm)          :: pbaru, phi, w
-  REAL,    DIMENSION(ip1jm  ,llm)          :: pbarv
-  REAL,    DIMENSION(klon)                 :: fder
-
-!--- Local variables for ocean mask reading:
-  INTEGER :: nid_o2a, iml_omask, jml_omask
-  LOGICAL :: couple=.FALSE.
-  REAL,    DIMENSION(:,:), ALLOCATABLE ::  lon_omask, lat_omask, ocemask, ocetmp
-  REAL,    DIMENSION(:),   ALLOCATABLE :: dlon_omask,dlat_omask
-  REAL,    DIMENSION(klon)             :: ocemask_fi
-  INTEGER, DIMENSION(klon-2)           :: isst
-  REAL,    DIMENSION(iim,jjp1)         :: zx_tmp_2d
-  REAL    :: dummy
-  LOGICAL :: ok_newmicro, ok_journe, ok_mensuel, ok_instan, ok_hf
-  LOGICAL :: ok_LES, ok_ade, ok_aie, ok_cdnc, aerosol_couple, new_aod, callstats
-  INTEGER :: iflag_radia, flag_aerosol
-  LOGICAL :: flag_aerosol_strat
-  REAL    :: bl95_b0, bl95_b1, fact_cldcon, facttemps, ratqsbas, ratqshaut
-  REAL    :: tau_ratqs
-  INTEGER :: iflag_cldcon, iflag_ratqs, iflag_coupl, iflag_clos, iflag_wake
-  INTEGER :: iflag_thermals, nsplit_thermals
-  INTEGER :: iflag_thermals_ed, iflag_thermals_optflux
-  REAL    :: tau_thermals, solarlong0,  seuil_inversion
-  INTEGER :: read_climoz ! read ozone climatology
-!  Allowed values are 0, 1 and 2
-!     0: do not read an ozone climatology
-!     1: read a single ozone climatology that will be used day and night
-!     2: read two ozone climatologies, the average day and night
-!     climatology and the daylight climatology
-!-------------------------------------------------------------------------------
-  REAL    :: alp_offset
-  logical found
-
-!--- Constants
-  pi     = 4. * ATAN(1.)
-  rad    = 6371229.
-  daysec = 86400.
-  omeg   = 2.*pi/daysec
-  g      = 9.8
-  kappa  = 0.2857143
-  cpp    = 1004.70885
-  preff  = 101325.
-  pa     = 50000.
-  jmp1   = jjm + 1
-
-!--- CONSTRUCT A GRID
-  CALL conf_phys(  ok_journe, ok_mensuel, ok_instan, ok_hf, ok_LES,     &
-                   callstats,                                           &
-                   solarlong0,seuil_inversion,                          &
-                   fact_cldcon, facttemps,ok_newmicro,iflag_radia,      &
-                   iflag_cldcon,                                        &
-                   iflag_ratqs,ratqsbas,ratqshaut,tau_ratqs,            &
-                   ok_ade, ok_aie, ok_cdnc, aerosol_couple,             &
-                   flag_aerosol, flag_aerosol_strat, new_aod,           &
-                   bl95_b0, bl95_b1,                                    &
-                   read_climoz,                                         &
-                   alp_offset)
-
-! co2_ppm0 : initial value of atmospheric CO2 from .def file (co2_ppm value)
-  co2_ppm0 = co2_ppm
-
-  dtvr   = daysec/FLOAT(day_step)
-  WRITE(lunout,*)'dtvr',dtvr
-
-  CALL iniconst()
-  if (pressure_exner) call test_disvert
-  CALL inigeom()
-
-!--- Initializations for tracers
-  CALL infotrac_init
-  ALLOCATE(q3d(iip1,jjp1,llm,nqtot))
-
-  CALL inifilr()
-  CALL phys_state_var_init(read_climoz)
-
-  rlat(1) = ASIN(1.0)
-  DO j=2,jjm; rlat((j-2)*iim+2:(j-1)*iim+1)=rlatu(j);     END DO
-  rlat(klon) = - ASIN(1.0)
-  rlat(:)=rlat(:)*(180.0/pi)
-
-  rlon(1) = 0.0
-  DO j=2,jjm; rlon((j-2)*iim+2:(j-1)*iim+1)=rlonv(1:iim); END DO
-  rlon(klon) = 0.0
-  rlon(:)=rlon(:)*(180.0/pi)
-
-! For a coupled simulation, the ocean mask from ocean model is used to compute
-! the weights an to insure ocean fractions are the same for atmosphere and ocean
-! Otherwise, mask is created using Relief file.
-
-  WRITE(lunout,*)'Essai de lecture masque ocean'
-  iret = NF90_OPEN("o2a.nc", NF90_NOWRITE, nid_o2a)
-  IF(iret/=NF90_NOERR) THEN
-    WRITE(lunout,*)'ATTENTION!! pas de fichier o2a.nc trouve'
-    WRITE(lunout,*)'Run force'
-    x='masque'
-    masque(:,:)=0.0
-    CALL startget_phys2d(x, iip1, jjp1, rlonv, rlatu, masque, 0.0, jjm, &
-   &              rlonu, rlatv, ib)
-    WRITE(lunout,*)'MASQUE construit : Masque'
-    if (prt_level >= 1) WRITE(lunout,'(97I1)') nINT(masque)
-    CALL gr_dyn_fi(1, iip1, jjp1, klon, masque, zmasq)
-    WHERE(   zmasq(:)<EPSFRA) zmasq(:)=0.
-    WHERE(1.-zmasq(:)<EPSFRA) zmasq(:)=1.
-  ELSE
-    WRITE(lunout,*)'ATTENTION!! fichier o2a.nc trouve'
-    WRITE(lunout,*)'Run couple'
-    couple=.true.
-    iret=NF90_CLOSE(nid_o2a)
-    CALL flininfo("o2a.nc", iml_omask, jml_omask, llm_tmp, ttm_tmp, nid_o2a)
-    IF(iml_omask/=iim .OR.jml_omask/=jjp1) THEN
-      WRITE(lunout,*)'Dimensions non compatibles pour masque ocean'
-      WRITE(lunout,*)'iim = ',iim,' iml_omask = ',iml_omask
-      WRITE(lunout,*)'jjp1 = ',jjp1,' jml_omask = ',jml_omask
-      CALL abort_gcm('etat0_netcdf','Dimensions non compatibles pour masque oc&
-     &ean',1)
-    END IF
-    ALLOCATE(   ocemask(iml_omask,jml_omask),   ocetmp(iml_omask,jml_omask))
-    ALLOCATE( lon_omask(iml_omask,jml_omask),lat_omask(iml_omask,jml_omask))
-    ALLOCATE(dlon_omask(iml_omask),         dlat_omask(jml_omask))
-    CALL flinopen("o2a.nc", .FALSE., iml_omask, jml_omask, llm_tmp, lon_omask,&
-   &              lat_omask, lev, ttm_tmp, itaul, date, dt, fid)
-    CALL flinget(fid, 'OceMask', iml_omask, jml_omask, llm_tmp, ttm_tmp, &
-   &              1, 1, ocetmp)
-    CALL flinclo(fid)
-    dlon_omask(1:iml_omask) = lon_omask(1:iml_omask,1)
-    dlat_omask(1:jml_omask) = lat_omask(1,1:jml_omask)
-    ocemask = ocetmp
-    IF(dlat_omask(1)<dlat_omask(jml_omask)) THEN
-      DO j=1,jml_omask
-        ocemask(:,j) = ocetmp(:,jml_omask-j+1)
-      END DO
-    END IF
-!
-! Ocean mask to physical grid
-!*******************************************************************************
-    WRITE(lunout,*)'ocemask '
-    WRITE(fmt,"(i4,'i1)')")iml_omask ; fmt='('//ADJUSTL(fmt)
-    WRITE(lunout,fmt)int(ocemask)
-    ocemask_fi(1)=ocemask(1,1)
-    DO j=2,jjm; ocemask_fi((j-2)*iim+2:(j-1)*iim+1)=ocemask(1:iim,j); END DO
-    ocemask_fi(klon)=ocemask(1,jjp1)
-    zmasq=1.-ocemask_fi
-  END IF
-
-  CALL gr_fi_dyn(1,klon,iip1,jjp1,zmasq,masque)
-
-  ! The startget calls need to be replaced by a call to restget to get the
-  ! values in the restart file
-  x = 'relief'; orog(:,:) = 0.0
-  CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu, orog, 0.0,jjm,rlonu,rlatv,ib,&
- &               masque)
-
-  x = 'rugosite'; rugo(:,:) = 0.0
-  CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu, rugo, 0.0,jjm, rlonu,rlatv,ib)
-!  WRITE(lunout,'(49I1)') INT(orog(:,:)*10)
-!  WRITE(lunout,'(49I1)') INT(rugo(:,:)*10)
-
-! Sub-surfaces initialization
-!*******************************************************************************
-  pctsrf=0.
-  x = 'psol'; psol(:,:) = 0.0
-  CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu,psol,0.0,jjm,rlonu,rlatv,ib)
-!  WRITE(lunout,*) 'PSOL :', psol(10,20)
-!  WRITE(lunout,*) ap(:), bp(:)
-
-! Mid-levels pressure computation
-!*******************************************************************************
-  CALL pression(ip1jmp1, ap, bp, psol, p3d)
-  if (pressure_exner) then
-    CALL exner_hyb(ip1jmp1, psol, p3d, pks, pk)
-  else
-    CALL exner_milieu(ip1jmp1,psol,p3d, pks,pk)
-  endif
-  pls(:,:,:)=preff*(pk(:,:,:)/cpp)**(1./kappa)
-!  WRITE(lunout,*) 'P3D :', p3d(10,20,:)
-!  WRITE(lunout,*) 'PK:',    pk(10,20,:)
-!  WRITE(lunout,*) 'PLS :', pls(10,20,:)
-
-  x = 'surfgeo'; phis(:,:) = 0.0
-  CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu,phis, 0.0,jjm, rlonu,rlatv,ib)
-
-  x = 'u';    uvent(:,:,:) = 0.0
-  CALL startget_dyn(x,rlonu,rlatu,pls,y,uvent,0.0,  &
- &                  rlonv,rlatv,ib)
-
-  x = 'v';    vvent(:,:,:) = 0.0
-  CALL startget_dyn(x, rlonv,rlatv,pls(:, :jjm, :),y(:, :jjm, :),vvent,0.0, &
- &                  rlonu,rlatu(:jjm),ib)
-
-  x = 't';    t3d(:,:,:) = 0.0
-  CALL startget_dyn(x,rlonv,rlatu,pls,y,t3d,0.0,    &
- &                  rlonu,rlatv,ib)
-
-  x = 'tpot'; tpot(:,:,:) = 0.0
-  CALL startget_dyn(x,rlonv,rlatu,pls,pk,tpot,0.0,  &
- &                  rlonu,rlatv,ib)
-
-  WRITE(lunout,*) 'T3D min,max:',minval(t3d(:,:,:)),maxval(t3d(:,:,:))
-  WRITE(lunout,*) 'PLS min,max:',minval(pls(:,:,:)),maxval(pls(:,:,:))
-
-! Humidity at saturation computation
-!*******************************************************************************
-  WRITE(lunout,*) 'avant q_sat'
-  CALL q_sat(llm*jjp1*iip1, t3d, pls, qsat)
-  WRITE(lunout,*) 'apres q_sat'
-  WRITE(lunout,*) 'QSAT min,max:',minval(qsat(:,:,:)),maxval(qsat(:,:,:))
-!  WRITE(lunout,*) 'QSAT :',qsat(10,20,:)
-
-  x = 'q';    qd (:,:,:) = 0.0
-  CALL startget_dyn(x,rlonv,rlatu,pls,qsat,qd,0.0, rlonu,rlatv,ib)
-  q3d(:,:,:,:) = 0.0 ; q3d(:,:,:,1) = qd(:,:,:)
-
-! Parameterization of ozone chemistry:
-! Look for ozone tracer:
-  i = 1
-  DO
-    found = tname(i)=="O3" .OR. tname(i)=="o3"
-    if (found .or. i == nqtot) exit
-    i = i + 1
-  end do
-  if (found) then
-    call regr_lat_time_coefoz
-    call press_coefoz
-    call regr_pr_o3(p3d, q3d(:, :, :, i))
-!   Convert from mole fraction to mass fraction:
-    q3d(:, :, :, i) = q3d(:, :, :, i)  * 48. / 29.
-  end if
-
-!--- OZONE CLIMATOLOGY
-  IF(read_climoz>=1) CALL regr_lat_time_climoz(read_climoz)
-
-  x = 'tsol'; tsol(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,tsol,0.0,jjm,rlonu,rlatv,ib)
-
-  x = 'qsol';  qsol(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,qsol,0.0,jjm,rlonu,rlatv,ib)
-
-  x = 'snow';  sn(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,sn,0.0,jjm,rlonu,rlatv,ib)
-
-  x = 'rads';  radsol(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,radsol,0.0,jjm,rlonu,rlatv,ib)
-
-  x = 'rugmer'; rugmer(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,rugmer,0.0,jjm,rlonu,rlatv,ib)
-
-  x = 'zmea';  zmea(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zmea,0.0,jjm,rlonu,rlatv,ib)
-
-  x = 'zstd';  zstd(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zstd,0.0,jjm,rlonu,rlatv,ib)
-
-  x = 'zsig';  zsig(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zsig,0.0,jjm,rlonu,rlatv,ib)
-
-  x = 'zgam';  zgam(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zgam,0.0,jjm,rlonu,rlatv,ib)
-
-  x = 'zthe';  zthe(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zthe,0.0,jjm,rlonu,rlatv,ib)
-
-  x = 'zpic';  zpic(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zpic,0.0,jjm,rlonu,rlatv,ib)
-
-  x = 'zval';  zval(:) = 0.0
-  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zval,0.0,jjm,rlonu,rlatv,ib)
-
-!  WRITE(lunout,'(48I3)') 'TSOL :', INT(tsol(2:klon)-273)
-
-! Soil ice file reading for soil fraction and soil ice fraction
-!*******************************************************************************
-  CALL flininfo("landiceref.nc", iml_lic, jml_lic, llm_tmp, ttm_tmp, fid)
-  ALLOCATE( lat_lic(iml_lic,jml_lic),lon_lic(iml_lic, jml_lic))
-  ALLOCATE(dlat_lic(jml_lic),       dlon_lic(iml_lic))
-  ALLOCATE( fraclic(iml_lic,jml_lic))
-  CALL flinopen("landiceref.nc", .FALSE., iml_lic, jml_lic, llm_tmp,  &
- &               lon_lic, lat_lic, lev, ttm_tmp, itaul, date, dt, fid)
-  CALL flinget(fid, 'landice', iml_lic, jml_lic, llm_tmp, ttm_tmp, 1,1, fraclic)
-  CALL flinclo(fid)
-
-! Interpolation on model T-grid
-!*******************************************************************************
-  WRITE(lunout,*)'dimensions de landice iml_lic, jml_lic : ',iml_lic,jml_lic
-! conversion if coordinates are in degrees
-  IF(MAXVAL(lon_lic)>pi) lon_lic=lon_lic*pi/180.
-  IF(MAXVAL(lat_lic)>pi) lat_lic=lat_lic*pi/180.
-  dlon_lic(:)=lon_lic(:,1)
-  dlat_lic(:)=lat_lic(1,:)
-  CALL grille_m( iml_lic, jml_lic, dlon_lic, dlat_lic, fraclic, iim,jjp1,   &
- &               rlonv, rlatu, flic_tmp(1:iim,:) )
-  flic_tmp(iip1,:)=flic_tmp(1,:)
-
-!--- To the physical grid
-  CALL gr_dyn_fi(1, iip1, jjp1, klon, flic_tmp, pctsrf(:,is_lic))
-
-!--- Adequation with soil/sea mask
-  WHERE(pctsrf(:,is_lic)<EPSFRA) pctsrf(:,is_lic)=0. 
-  WHERE(zmasq(:)<EPSFRA)         pctsrf(:,is_lic)=0.
-  pctsrf(:,is_ter)=zmasq(:)
-  DO ji=1,klon
-    IF(zmasq(ji)>EPSFRA) THEN 
-      IF(pctsrf(ji,is_lic)>=zmasq(ji)) THEN
-        pctsrf(ji,is_lic)=zmasq(ji)
-        pctsrf(ji,is_ter)=0.
-      ELSE
-        pctsrf(ji,is_ter)=zmasq(ji)-pctsrf(ji,is_lic)
-        IF(pctsrf(ji,is_ter)<EPSFRA) THEN
-          pctsrf(ji,is_ter)=0.
-          pctsrf(ji,is_lic)=zmasq(ji)
-        END IF 
-      END IF 
-    END IF 
-  END DO 
-
-! sub-surface ocean and sea ice (sea ice set to zero for start)
-!*******************************************************************************
-  pctsrf(:,is_oce)=(1.-zmasq(:))
-  WHERE(pctsrf(:,is_oce)<EPSFRA) pctsrf(:,is_oce)=0.
-  IF(couple) pctsrf(:,is_oce)=ocemask_fi(:)
-  isst=0
-  WHERE(pctsrf(2:klon-1,is_oce)>0.) isst=1
-
-! It is checked that the sub-surfaces sum is equal to 1
-!*******************************************************************************
-  ji=COUNT((ABS(SUM(pctsrf(:,:),dim=2))-1.0)>EPSFRA)
-  IF(ji/=0) WRITE(lunout,*) 'pb repartition sous maille pour ',ji,' points'
-  CALL gr_fi_ecrit(1, klon, iim, jjp1, zmasq, zx_tmp_2d)
-!  WRITE(fmt,"(i3,')')")iim; fmt='(i'//ADJUSTL(fmt)
-!  WRITE(lunout,*)'zmasq = '
-!  WRITE(lunout,TRIM(fmt))NINT(zx_tmp_2d)
-  CALL gr_fi_dyn(1, klon, iip1, jjp1, zmasq, masque)
-  WRITE(fmt,"(i4,'i1)')")iip1 ; fmt='('//ADJUSTL(fmt)
-  WRITE(lunout,*) 'MASQUE construit : Masque'
-  if (prt_level >= 1) WRITE(lunout,TRIM(fmt))NINT(masque(:,:))
-
-! Intermediate computation
-!*******************************************************************************
-  CALL massdair(p3d,masse)
-  WRITE(lunout,*)' ALPHAX ',alphax
-  DO l=1,llm
-    xppn(:)=aire(1:iim,1   )*masse(1:iim,1   ,l)
-    xpps(:)=aire(1:iim,jjp1)*masse(1:iim,jjp1,l)
-    xpn=SUM(xppn)/apoln
-    xps=SUM(xpps)/apols
-    masse(:,1   ,l)=xpn
-    masse(:,jjp1,l)=xps
-  END DO
-  q3d(iip1,:,:,:)=q3d(1,:,:,:)
-  phis(iip1,:) = phis(1,:)
-
-  IF(.NOT.letat0) RETURN
-
-! Writing
-!*******************************************************************************
-  CALL inidissip(lstardis, nitergdiv, nitergrot, niterh, tetagdiv, tetagrot, &
-       tetatemp, vert_prof_dissip)
-  WRITE(lunout,*)'sortie inidissip'
-  itau=0
-  itau_dyn=0
-  itau_phy=0
-  iday=dayref+itau/day_step
-  time=FLOAT(itau-(iday-dayref)*day_step)/day_step
-  IF(time>1.) THEN
-   time=time-1
-   iday=iday+1
-  END IF
-  day_ref=dayref
-  annee_ref=anneeref
-
-  CALL geopot( ip1jmp1, tpot, pk, pks, phis, phi )
-  WRITE(lunout,*)'sortie geopot'
-
-  CALL caldyn0( itau, uvent, vvent, tpot, psol, masse, pk, phis,               &
-                phi,  w, pbaru, pbarv, time+iday-dayref)
-  WRITE(lunout,*)'sortie caldyn0'     
-  CALL dynredem0( "start.nc", dayref, phis)
-  WRITE(lunout,*)'sortie dynredem0'
-  CALL dynredem1( "start.nc", 0.0, vvent, uvent, tpot, q3d, masse, psol)
-  WRITE(lunout,*)'sortie dynredem1' 
-
-! Physical initial state writting
-!*******************************************************************************
-  WRITE(lunout,*)'phystep ',dtvr,iphysiq,nbapp_rad
-  phystep   = dtvr * FLOAT(iphysiq)
-  radpas    = NINT (86400./phystep/ FLOAT(nbapp_rad) )
-  WRITE(lunout,*)'phystep =', phystep, radpas
-
-! Init: tsol, qsol, sn, evap, tsoil, rain_fall, snow_fall, solsw, sollw, frugs
-!*******************************************************************************
-  DO i=1,nbsrf; ftsol(:,i) = tsol; END DO
-  DO i=1,nbsrf; snsrf(:,i) = sn;   END DO
-!albedo SB >>>
-  falb_dir(:,is_ter,:)=0.08; falb_dir(:,is_lic,:)=0.6
-  falb_dir(:,is_oce,:)=0.5;  falb_dir(:,is_sic,:)=0.6
-!albedo SB <<<
-  fevap(:,:) = 0.
-  DO i=1,nbsrf; qsolsrf(:,i)=150.; END DO
-  DO i=1,nbsrf; DO j=1,nsoilmx; tsoil(:,j,i) = tsol; END DO; END DO
-  rain_fall = 0.; snow_fall = 0.
-  solsw = 165.;   sollw = -53.
-  t_ancien = 273.15
-  q_ancien = 0.
-  agesno = 0.
-
-  z0m(:,is_oce) = rugmer(:)
-  z0m(:,is_ter) = MAX(1.0e-05,zstd(:)*zsig(:)/2.0)
-  z0m(:,is_lic) = MAX(1.0e-05,zstd(:)*zsig(:)/2.0)
-  z0m(:,is_sic) = 0.001
-  z0h(:,:)=z0m(:,:)
-
-  fder = 0.0
-  clwcon = 0.0
-  rnebcon = 0.0
-  ratqs = 0.0
-  run_off_lic_0 = 0.0 
-  rugoro = 0.0
-
-! Before phyredem calling, surface modules and values to be saved in startphy.nc
-! are initialized
-!*******************************************************************************
-  dummy = 1.0
-  pbl_tke(:,:,:) = 1.e-8 
-  zmax0(:) = 40.
-  f0(:) = 1.e-5
-  sig1(:,:) = 0.
-  w01(:,:) = 0.
-  wake_deltat(:,:) = 0.
-  wake_deltaq(:,:) = 0.
-  wake_s(:) = 0.
-  wake_cstar(:) = 0.
-  wake_fip(:) = 0.
-  wake_pe = 0.
-  fm_therm = 0.
-  entr_therm = 0.
-  detr_therm = 0.
-
-  CALL fonte_neige_init(run_off_lic_0)
-  CALL pbl_surface_init( fder, snsrf, qsolsrf, tsoil )
-  CALL phyredem( "startphy.nc" )
-
-!  WRITE(lunout,*)'CCCCCCCCCCCCCCCCCC REACTIVER SORTIE VISU DANS ETAT0'
-!  WRITE(lunout,*)'entree histclo'
-  CALL histclo()
-
-#endif 
-!#endif of #ifdef CPP_EARTH
-  RETURN
-#endif
-!#endif of ifndef CPP_1D
-END SUBROUTINE etat0_netcdf
-!
-!-------------------------------------------------------------------------------
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/fisrtilp.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/fisrtilp.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/fisrtilp.F90	(revision 3814)
@@ -25,5 +25,4 @@
   !ym include "dimphy.h"
   include "YOMCST.h"
-  include "tracstoke.h"
   include "fisrtilp.h"
   include "nuage.h" ! JBM (3/14)
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/fisrtilp_tr.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/fisrtilp_tr.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/fisrtilp_tr.F90	(revision 3814)
@@ -21,5 +21,4 @@
   ! ym#include "dimphy.h"
   include "YOMCST.h"
-  include "tracstoke.h"
   include "iniprint.h"
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/fonte_neige_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/fonte_neige_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/fonte_neige_mod.F90	(revision 3814)
@@ -63,5 +63,5 @@
     IF (error /= 0) THEN
        abort_message='Pb allocation run_off_lic'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
     run_off_lic_0(:) = restart_runoff(:) 
@@ -74,5 +74,5 @@
     IF (error /= 0) THEN
        abort_message='Pb allocation run_off_ter'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
     run_off_ter(:) = 0.
@@ -81,5 +81,5 @@
     IF (error /= 0) THEN
        abort_message='Pb allocation run_off_lic'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
     run_off_lic(:) = 0.
@@ -88,5 +88,5 @@
     IF (error /= 0) THEN
        abort_message='Pb allocation ffonte_global'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
     ffonte_global(:,:) = 0.0
@@ -95,5 +95,5 @@
     IF (error /= 0) THEN
        abort_message='Pb allocation fqfonte_global'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
     fqfonte_global(:,:) = 0.0
@@ -102,5 +102,5 @@
     IF (error /= 0) THEN
        abort_message='Pb allocation fqcalving_global'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
     fqcalving_global(:,:) = 0.0
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/hgardfou.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/hgardfou.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/hgardfou.F90	(revision 3814)
@@ -129,5 +129,5 @@
   END DO
 
-!  IF (.NOT. ok) CALL abort_gcm(modname, text, 1)
+!  IF (.NOT. ok) CALL abort_physic(modname, text, 1)
   IF (.NOT. ok) abortphy=1
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/infotrac_phy.f90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/infotrac_phy.f90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/infotrac_phy.f90	(revision 3814)
@@ -0,0 +1,62 @@
+MODULE infotrac_phy
+
+
+! nqtot : total number of tracers and higher order of moment, water vapor and liquid included
+  INTEGER, SAVE :: nqtot
+!$OMP THREADPRIVATE(nqtot)
+
+!CR: on ajoute le nombre de traceurs de l eau
+  INTEGER, SAVE :: nqo
+!$OMP THREADPRIVATE(nqo)
+
+! nbtr : number of tracers not including higher order of moment or water vapor or liquid
+!        number of tracers used in the physics
+  INTEGER, SAVE :: nbtr
+!$OMP THREADPRIVATE(nbtr)
+
+! Name variables
+  CHARACTER(len=20), ALLOCATABLE, DIMENSION(:), SAVE :: tname ! tracer short name for restart and diagnostics
+!$OMP THREADPRIVATE(tname)
+
+  CHARACTER(len=23), ALLOCATABLE, DIMENSION(:), SAVE :: ttext ! tracer long name for diagnostics
+!$OMP THREADPRIVATE(ttext)
+! niadv : vector keeping the coorspondance between all tracers(nqtot) treated in the 
+!         dynamic part of the code and the tracers (nbtr+2) used in the physics part of the code. 
+  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE    :: niadv ! equivalent dyn / physique
+!$OMP THREADPRIVATE(niadv)
+
+! pbl_flg(it)=0  : boundary layer diffusion desactivaded for tracer number it 
+  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE  :: pbl_flg
+!$OMP THREADPRIVATE(pbl_flg)
+
+! conv_flg(it)=0 : convection desactivated for tracer number it 
+  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE  :: conv_flg
+!$OMP THREADPRIVATE(conv_flg)
+
+  CHARACTER(len=8),DIMENSION(:),ALLOCATABLE, SAVE :: solsym
+!$OMP THREADPRIVATE(solsym)
+
+  CHARACTER(len=4),SAVE :: type_trac
+!$OMP THREADPRIVATE(type_trac)
+
+CONTAINS
+
+  SUBROUTINE init_infotrac_phy(nbtr_,tname_,ttext_,niadv_)
+  IMPLICIT NONE
+    INTEGER :: nbtr_
+    CHARACTER(len=20), DIMENSION(:) :: tname_ ! tracer short name for restart and diagnostics
+    CHARACTER(len=23), DIMENSION(:) :: ttext_ ! tracer long name for diagnostics
+    INTEGER,  DIMENSION(:)          :: niadv_ ! equivalent dyn / physique
+    
+    nbtr=nbtr_
+    ALLOCATE(tname(size(tname_)))
+    ALLOCATE(ttext(size(ttext_)))
+    ALLOCATE(niadv(size(niadv_)))
+    tname(:) = tname_(:)
+    ttext(:) = ttext_(:)
+    niadv(:) = niadv_(:)
+  
+  END SUBROUTINE init_infotrac_phy
+  
+  
+END MODULE infotrac_phy
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/inifis.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/inifis.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/inifis.F90	(revision 3814)
@@ -60,5 +60,5 @@
     PRINT *, 'klev   = ', klev
     abort_message = ''
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
 
@@ -69,5 +69,5 @@
     PRINT *, 'klon   = ', klon
     abort_message = ''
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
 
@@ -76,5 +76,5 @@
     &                                                         &
     &        et surf.def'
-  CALL abort_gcm(modname, abort_message, 1)
+  CALL abort_physic(modname, abort_message, 1)
 
 END SUBROUTINE inifis
Index: namico_lmdz/aquaplanet/LMDZ5/libf/phylmd/inistats.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/inistats.F90	(revision 3813)
+++ 	(revision )
@@ -1,128 +1,0 @@
-SUBROUTINE inistats(ierr)
-
-  IMPLICIT NONE
-
-  include "dimensions.h"
-  include "paramet.h"
-  include "comgeom.h"
-  include "comvert.h"
-  include "comconst.h"
-  include "statto.h"
-  include "netcdf.inc"
-
-  INTEGER, INTENT (OUT) :: ierr
-  INTEGER :: nid
-  INTEGER :: l, nsteppd
-  REAL, DIMENSION (llm) :: sig_s
-  INTEGER :: idim_lat, idim_lon, idim_llm, idim_llmp1, idim_time
-  REAL, DIMENSION (istime) :: lt
-  INTEGER :: nvarid
-
-  WRITE (*, *)
-  WRITE (*, *) '                        || STATS ||'
-  WRITE (*, *)
-  WRITE (*, *) 'daysec', daysec
-  WRITE (*, *) 'dtphys', dtphys
-  nsteppd = nint(daysec/dtphys)
-  WRITE (*, *) 'nsteppd=', nsteppd
-  IF (abs(float(nsteppd)-daysec/dtphys)>1.E-8*daysec) &
-    STOP 'Dans Instat:  1jour .ne. n pas physiques'
-
-  IF (mod(nsteppd,istime)/=0) STOP &
-    'Dans Instat:  1jour .ne. n*istime pas physiques'
-
-  istats = nsteppd/istime
-  WRITE (*, *) 'istats=', istats
-  WRITE (*, *) 'Storing ', istime, 'times per day'
-  WRITE (*, *) 'thus every ', istats, 'physical timestep '
-  WRITE (*, *)
-
-  DO l = 1, llm
-    sig_s(l) = ((ap(l)+ap(l+1))/preff+bp(l)+bp(l+1))/2.
-    pseudoalt(l) = log(preff/presnivs(l))*8.
-  END DO
-
-  ierr = nf_create('stats.nc', nf_clobber, nid)
-  IF (ierr/=nf_noerr) THEN
-    WRITE (*, *) nf_strerror(ierr)
-    STOP ''
-  END IF
-
-  ierr = nf_def_dim(nid, 'latitude', jjp1, idim_lat)
-  ierr = nf_def_dim(nid, 'longitude', iip1, idim_lon)
-  ierr = nf_def_dim(nid, 'altitude', llm, idim_llm)
-  ierr = nf_def_dim(nid, 'llmp1', llm+1, idim_llmp1)
-  ierr = nf_def_dim(nid, 'Time', nf_unlimited, idim_time)
-
-  ierr = nf_enddef(nid)
-  CALL def_var_stats(nid, 'Time', 'Time', 'hours since 0000-00-0 00:00:00', &
-    1, idim_time, nvarid, ierr)
-  ! Time is initialised later by mkstats subroutine
-
-  CALL def_var_stats(nid, 'latitude', 'latitude', 'degrees_north', 1, &
-    idim_lat, nvarid, ierr)
-#ifdef NC_DOUBLE
-  ierr = nf_put_var_double(nid, nvarid, rlatu/pi*180)
-#else
-  ierr = nf_put_var_real(nid, nvarid, rlatu/pi*180)
-#endif
-  CALL def_var_stats(nid, 'longitude', 'East longitude', 'degrees_east', 1, &
-    idim_lon, nvarid, ierr)
-#ifdef NC_DOUBLE
-  ierr = nf_put_var_double(nid, nvarid, rlonv/pi*180)
-#else
-  ierr = nf_put_var_real(nid, nvarid, rlonv/pi*180)
-#endif
-
-  ! Niveaux verticaux, aps et bps
-  ierr = nf_redef(nid)
-  ! presnivs
-#ifdef NC_DOUBLE
-  ierr = nf_def_var(nid, 'presnivs', nf_double, 1, idim_llm, nvarid)
-#else
-  ierr = nf_def_var(nid, 'presnivs', nf_float, 1, idim_llm, nvarid)
-#endif
-  ierr = nf_put_att_text(nid, nvarid, 'long_name', 15, 'Vertical levels')
-  ierr = nf_put_att_text(nid, nvarid, 'units', 2, 'Pa')
-  ierr = nf_put_att_text(nid, nvarid, 'positive', 4, 'down')
-  ierr = nf_enddef(nid)
-#ifdef NC_DOUBLE
-  ierr = nf_put_var_double(nid, nvarid, presnivs(1:llm))
-#else
-  ierr = nf_put_var_real(nid, nvarid, presnivs(1:llm))
-#endif
-  ! Pseudo alts
-#ifdef NC_DOUBLE
-  ierr = nf_def_var(nid, 'altitude', nf_double, 1, idim_llm, nvarid)
-#else
-  ierr = nf_def_var(nid, 'altitude', nf_float, 1, idim_llm, nvarid)
-#endif
-  ierr = nf_put_att_text(nid, nvarid, 'long_name', 8, 'altitude')
-  ierr = nf_put_att_text(nid, nvarid, 'units', 2, 'km')
-  ierr = nf_put_att_text(nid, nvarid, 'positive', 2, 'up')
-  ierr = nf_enddef(nid)
-#ifdef NC_DOUBLE
-  ierr = nf_put_var_double(nid, nvarid, pseudoalt)
-#else
-  ierr = nf_put_var_real(nid, nvarid, pseudoalt)
-#endif
-  ! call def_var_stats(nid,"aps","hybrid pressure at midlayers"," ",
-  ! &            1,idim_llm,nvarid,ierr)
-  ! #ifdef NC_DOUBLE
-  ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aps)
-  ! #else
-  ! ierr = NF_PUT_VAR_REAL (nid,nvarid,aps)
-  ! #endif
-
-  ! call def_var_stats(nid,"bps","hybrid sigma at midlayers"," ",
-  ! &            1,idim_llm,nvarid,ierr)
-  ! #ifdef NC_DOUBLE
-  ! ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,bps)
-  ! #else
-  ! ierr = NF_PUT_VAR_REAL (nid,nvarid,bps)
-  ! #endif
-
-  ierr = nf_close(nid)
-
-END SUBROUTINE inistats
-
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/init_be.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/init_be.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/init_be.F90	(revision 3814)
@@ -6,5 +6,5 @@
   USE dimphy
   USE comgeomphy
-  USE infotrac, ONLY : nbtr
+  USE infotrac_phy, ONLY : nbtr
   USE indice_sol_mod
     
@@ -65,5 +65,5 @@
 ! la source est maintenant définie independemment de la valeur de klev.
 !!! Source actuellement definie pour klev = 19 et klev >= 39
-!!  IF (klev /= 19 .AND. klev<39) CALL abort_gcm("init_be","Source du be7 necessite klev=19 ou klev>=39",1)
+!!  IF (klev /= 19 .AND. klev<39) CALL abort_physic("init_be","Source du be7 necessite klev=19 ou klev>=39",1)
 !!!
 ! Definition des constantes
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/init_phys_lmdz.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/init_phys_lmdz.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/init_phys_lmdz.F90	(revision 3814)
@@ -2,9 +2,9 @@
 !$Header$
 !
-SUBROUTINE Init_Phys_lmdz(iim,jjp1,llm,nb_proc,distrib)
+SUBROUTINE Init_Phys_lmdz(iim,jjp1,llm,nb_proc,distrib,communicator)
   USE mod_phys_lmdz_para, ONLY: Init_phys_lmdz_para, klon_omp
   USE mod_grid_phy_lmdz, ONLY: Init_grid_phy_lmdz, nbp_lev
   USE dimphy, ONLY : Init_dimphy
-  USE infotrac, ONLY : type_trac
+  USE infotrac_phy, ONLY : type_trac
 #ifdef REPROBUS
   USE CHEM_REP, ONLY : Init_chem_rep_phys
@@ -18,8 +18,9 @@
     INTEGER,INTENT(in) :: nb_proc
     INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+    INTEGER,INTENT(in) :: communicator
 
 
     CALL Init_grid_phy_lmdz(iim,jjp1,llm)
-    CALL Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
+    CALL Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib,communicator)
 !$OMP PARALLEL
     CALL Init_dimphy(klon_omp,nbp_lev)
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/initphysto.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/initphysto.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/initphysto.F90	(revision 3814)
@@ -8,7 +8,8 @@
   USE IOIPSL
   USE iophy
-  USE control_mod
+  USE control_phy_mod
   USE indice_sol_mod
-  
+  USE comconst_phy_mod
+  USE temps_phy_mod
   IMPLICIT NONE
 
@@ -40,11 +41,5 @@
 !   Declarations
   INCLUDE "dimensions.h"
-  INCLUDE "paramet.h"
-  INCLUDE "comconst.h"
-  INCLUDE "comgeom.h"
-  INCLUDE "temps.h"
-  INCLUDE "logic.h"
   INCLUDE "description.h"
-  INCLUDE "serre.h"
 
 !   Arguments
@@ -71,5 +66,4 @@
 !  Initialisations
 !
-  pi = 4. * ATAN (1.)
   ok_sync= .TRUE.
 !
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/initrrnpb.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/initrrnpb.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/initrrnpb.F90	(revision 3814)
@@ -4,5 +4,5 @@
 SUBROUTINE  initrrnpb(ftsol,pctsrf,masktr,fshtr,hsoltr,tautr,vdeptr,scavtr)
   USE dimphy
-  USE infotrac, ONLY : nbtr
+  USE infotrac_phy, ONLY : nbtr
   USE traclmdz_mod, ONLY : id_rn, id_pb
   USE indice_sol_mod
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/interfoce_lim.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/interfoce_lim.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/interfoce_lim.F90	(revision 3814)
@@ -118,5 +118,5 @@
         IF (ierr.NE.NF_NOERR) THEN
            abort_message = 'Pb d''ouverture du fichier de conditions aux limites'
-           CALL abort_gcm(modname,abort_message,1)
+           CALL abort_physic(modname,abort_message,1)
         ENDIF
 
@@ -135,5 +135,5 @@
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Le champ <FOCE> est absent'
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
            ENDIF
 #ifdef NC_DOUBLE
@@ -144,5 +144,5 @@
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Lecture echouee pour <FOCE>'
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
            ENDIF
            !
@@ -152,5 +152,5 @@
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Le champ <FSIC> est absent'
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
            ENDIF
 #ifdef NC_DOUBLE
@@ -161,5 +161,5 @@
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Lecture echouee pour <FSIC>'
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
            ENDIF
            !
@@ -169,5 +169,5 @@
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Le champ <FTER> est absent'
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
            ENDIF
 #ifdef NC_DOUBLE
@@ -178,5 +178,5 @@
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Lecture echouee pour <FTER>'
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
            ENDIF
            !
@@ -186,5 +186,5 @@
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Le champ <FLIC> est absent'
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
            ENDIF
 #ifdef NC_DOUBLE
@@ -195,5 +195,5 @@
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Lecture echouee pour <FLIC>'
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
            ENDIF
            !
@@ -203,5 +203,5 @@
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Le champ <NAT> est absent'
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
            ENDIF
 #ifdef NC_DOUBLE
@@ -212,5 +212,5 @@
            IF (ierr /= NF_NOERR) THEN
               abort_message = 'Lecture echouee pour <NAT>'
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
            ENDIF
 !
@@ -237,5 +237,5 @@
         IF (ierr /= NF_NOERR) THEN
            abort_message = 'Le champ <SST> est absent'
-           CALL abort_gcm(modname,abort_message,1)
+           CALL abort_physic(modname,abort_message,1)
         ENDIF
 #ifdef NC_DOUBLE
@@ -246,5 +246,5 @@
         IF (ierr /= NF_NOERR) THEN
            abort_message = 'Lecture echouee pour <SST>'
-           CALL abort_gcm(modname,abort_message,1)
+           CALL abort_physic(modname,abort_message,1)
         ENDIF
           
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/iophy.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/iophy.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/iophy.F90	(revision 3814)
@@ -451,8 +451,7 @@
     use phys_output_var_mod, only: type_ecri, zoutm, zdtime_moy, lev_files, &
                                    nid_files, nhorim, swaero_diag, nfiles
+    USE temps_phy_mod
     IMPLICIT NONE
-
     INCLUDE "dimensions.h"
-    INCLUDE "temps.h"
     INCLUDE "clesphys.h"
 
@@ -507,8 +506,8 @@
                                    nhorim, zdtime_moy, levmin, levmax, &
                                    nvertm, nfiles
+    USE temps_phy_mod
     IMPLICIT NONE
 
     INCLUDE "dimensions.h"
-    INCLUDE "temps.h"
 !    INCLUDE "indicesol.h"
     INCLUDE "clesphys.h"
@@ -566,8 +565,8 @@
     use wxios, only: wxios_add_field_to_file
 #endif
+    USE temps_phy_mod
     IMPLICIT NONE
 
     INCLUDE "dimensions.h"
-    INCLUDE "temps.h"
     INCLUDE "clesphys.h"
     INCLUDE "iniprint.h"
@@ -653,8 +652,8 @@
     use wxios, only: wxios_add_field_to_file
 #endif
+    USE temps_phy_mod
     IMPLICIT NONE
 
     INCLUDE "dimensions.h"
-    INCLUDE "temps.h"
     INCLUDE "clesphys.h"
     INCLUDE "iniprint.h"
@@ -767,5 +766,5 @@
 
 
-    IF (size(field)/=klon) CALL abort_gcm('iophy::histwrite2d','Field first DIMENSION not equal to klon',1)
+    IF (size(field)/=klon) CALL abort_physic('iophy::histwrite2d','Field first DIMENSION not equal to klon',1)
     
     CALL Gather_omp(field,buffer_omp)    
@@ -831,5 +830,5 @@
 
 
-    IF (size(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
+    IF (size(field,1)/=klon) CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
     nlev=size(field,2)
 
@@ -945,5 +944,5 @@
 
     !Et sinon on.... écrit
-    IF (SIZE(field)/=klon) CALL abort_gcm('iophy::histwrite2d_phy','Field first DIMENSION not equal to klon',1)
+    IF (SIZE(field)/=klon) CALL abort_physic('iophy::histwrite2d_phy','Field first DIMENSION not equal to klon',1)
     
     if (prt_level >= 10) then
@@ -971,5 +970,5 @@
           endif
 #else
-        CALL abort_gcm ('iophy','cannot have ok_all_xml = .T. without CPP_XIOS defined' ,1)
+        CALL abort_physic ('iophy','cannot have ok_all_xml = .T. without CPP_XIOS defined' ,1)
 #endif
       ELSE  
@@ -1095,5 +1094,5 @@
   ELSE
     !Et sinon on.... écrit
-    IF (SIZE(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
+    IF (SIZE(field,1)/=klon) CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
     nlev=SIZE(field,2)
     if (nlev.eq.klev+1) then
@@ -1119,5 +1118,5 @@
           CALL xios_send_field(var%name, Field3d(:,:,1:nlevx))
 #else
-        CALL abort_gcm ('iophy','cannot have ok_all_xml = .T. without CPP_XIOS defined' ,1)
+        CALL abort_physic ('iophy','cannot have ok_all_xml = .T. without CPP_XIOS defined' ,1)
 #endif
       ELSE  
@@ -1216,5 +1215,5 @@
 
     !Et sinon on.... écrit
-    IF (SIZE(field)/=klon) CALL abort_gcm('iophy::histwrite2d_xios','Field first DIMENSION not equal to klon',1)
+    IF (SIZE(field)/=klon) CALL abort_physic('iophy::histwrite2d_xios','Field first DIMENSION not equal to klon',1)
     
     CALL Gather_omp(field,buffer_omp)    
@@ -1286,5 +1285,5 @@
 
     !Et on.... écrit
-    IF (SIZE(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
+    IF (SIZE(field,1)/=klon) CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
     nlev=SIZE(field,2)
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/iostart.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/iostart.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/iostart.F90	(revision 3814)
@@ -41,5 +41,5 @@
         write(6,*)' Pb d''ouverture du fichier '//filename
         write(6,*)' ierr = ', ierr
-        CALL ABORT_GCM("", "", 1)
+        CALL abort_physic("", "", 1)
       ENDIF
     ENDIF
@@ -166,5 +166,5 @@
       IF (.NOT. tmp_found) THEN
         PRINT*, 'phyetat0: Le champ <'//field_name//'> est absent'
-        call abort_gcm("", "", 1)
+        call abort_physic("", "", 1)
       ENDIF
     ENDIF
@@ -186,10 +186,10 @@
               IF (ierr/=NF90_NOERR) THEN
                  PRINT*, 'phyetat0: Lecture echouee aussi en 2D pour <'//field_name//'>'
-                 call abort_gcm("", "", 1)
+                 call abort_physic("", "", 1)
               ELSE
                  PRINT*, 'phyetat0: La variable <'//field_name//'> lu sur surface seulement'!, selon ancien format, le reste mis a zero'
               END IF
            ELSE
-              call abort_gcm("", "", 1)
+              call abort_physic("", "", 1)
            ENDIF
          ENDIF
@@ -282,5 +282,5 @@
         IF (ierr/=NF90_NOERR) THEN
           PRINT*, 'phyetat0: Lecture echouee pour <'//var_name//'>'
-          call abort_gcm("", "", 1)
+          call abort_physic("", "", 1)
         ENDIF
         tmp_found=.TRUE.
@@ -302,5 +302,5 @@
       IF (.NOT. tmp_found) THEN
         PRINT*, 'phyetat0: La variable champ <'//var_name//'> est absente'
-        call abort_gcm("", "", 1)
+        call abort_physic("", "", 1)
       ENDIF
     ENDIF
@@ -323,5 +323,5 @@
         write(6,*)' Pb d''ouverture du fichier '//filename
         write(6,*)' ierr = ', ierr
-        CALL ABORT_GCM("", "", 1)
+        CALL abort_physic("", "", 1)
       ENDIF
 
@@ -410,5 +410,5 @@
       ELSE
         PRINT *, "erreur phyredem : probleme de dimension"
-        CALL ABORT_GCM("", "", 1)
+        CALL abort_physic("", "", 1)
       ENDIF
          
@@ -487,5 +487,5 @@
       IF (var_size/=length) THEN
         PRINT *, "erreur phyredem : probleme de dimension"
-        call abort_gcm("", "", 1)
+        call abort_physic("", "", 1)
       ENDIF
       
Index: namico_lmdz/aquaplanet/LMDZ5/libf/phylmd/limit_netcdf.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/limit_netcdf.F90	(revision 3813)
+++ 	(revision )
@@ -1,665 +1,0 @@
-!
-! $Id: limit_netcdf.F90 1508 2011-04-15 13:05:34Z jghattas $
-!-------------------------------------------------------------------------------
-!
-SUBROUTINE limit_netcdf(interbar, extrap, oldice, masque)
-#ifndef CPP_1D
-!
-!-------------------------------------------------------------------------------
-! Author : L. Fairhead, 27/01/94
-!-------------------------------------------------------------------------------
-! Purpose: Boundary conditions files building for new model using climatologies.
-!          Both grids have to be regular.
-!-------------------------------------------------------------------------------
-! Note: This routine is designed to work for Earth
-!-------------------------------------------------------------------------------
-! Modification history:
-!  * 23/03/1994: Z. X. Li
-!  *    09/1999: L. Fairhead (netcdf reading in LMDZ.3.3)
-!  *    07/2001: P. Le Van
-!  *    11/2009: L. Guez     (ozone day & night climatos, see etat0_netcdf.F90)
-!  *    12/2009: D. Cugnet   (f77->f90, calendars, files from coupled runs)
-!-------------------------------------------------------------------------------
-  USE control_mod
-  USE indice_sol_mod
-#ifdef CPP_EARTH
-  USE dimphy
-  USE ioipsl,             ONLY : ioget_year_len
-  USE phys_state_var_mod, ONLY : pctsrf, rlon, rlat
-  USE netcdf,             ONLY : NF90_OPEN,    NF90_CREATE,  NF90_CLOSE,       &
-                   NF90_DEF_DIM, NF90_DEF_VAR, NF90_PUT_VAR, NF90_PUT_ATT,     &
-                   NF90_NOERR,   NF90_NOWRITE, NF90_DOUBLE,  NF90_GLOBAL,      &
-		   NF90_CLOBBER, NF90_ENDDEF,  NF90_UNLIMITED, NF90_FLOAT
-  USE inter_barxy_m, only: inter_barxy
-  use netcdf95, only: nf95_def_var, nf95_put_att, nf95_put_var
-#endif
-  IMPLICIT NONE
-!-------------------------------------------------------------------------------
-! Arguments:
-#include "dimensions.h"
-#include "paramet.h"
-#include "iniprint.h"
-  LOGICAL,                    INTENT(IN) :: interbar ! barycentric interpolation
-  LOGICAL,                    INTENT(IN) :: extrap   ! SST extrapolation flag
-  LOGICAL,                    INTENT(IN) :: oldice   ! old way ice computation
-  REAL, DIMENSION(iip1,jjp1), INTENT(IN) :: masque   ! land mask
-#ifndef CPP_EARTH
-  CALL abort_gcm('limit_netcdf','Earth-specific routine, needs Earth physics',1)
-#else
-!-------------------------------------------------------------------------------
-! Local variables:
-#include "logic.h"
-#include "comvert.h"
-#include "comgeom2.h"
-#include "comconst.h"
-
-!--- INPUT NETCDF FILES NAMES --------------------------------------------------
-  CHARACTER(LEN=25) :: icefile, sstfile, dumstr
-  CHARACTER(LEN=25), PARAMETER :: famipsst ='amipbc_sst_1x1.nc        ',        &
-                                  famipsic ='amipbc_sic_1x1.nc        ',        &
-                                  fcpldsst ='cpl_atm_sst.nc           ',        &
-                                  fcpldsic ='cpl_atm_sic.nc           ',        &
-                                  fhistsst ='histmth_sst.nc           ',        &
-                                  fhistsic ='histmth_sic.nc           ',        &
-                                  frugo    ='Rugos.nc                 ',        &
-                                  falbe    ='Albedo.nc                ',        &
-                                  feraisstk='sstk.nc                  ',        &
-                                  feraici  ='ci.nc                    '
-  CHARACTER(LEN=10) :: varname
-!--- OUTPUT VARIABLES FOR NETCDF FILE ------------------------------------------
-  REAL,   DIMENSION(klon)                :: fi_ice, verif
-  REAL,   DIMENSION(:,:),   POINTER      :: phy_rug=>NULL(), phy_ice=>NULL()
-  REAL,   DIMENSION(:,:),   POINTER      :: phy_sst=>NULL(), phy_alb=>NULL()
-  REAL,   DIMENSION(:,:),   ALLOCATABLE  :: phy_bil
-  REAL,   DIMENSION(:,:,:), ALLOCATABLE  :: pctsrf_t
-  INTEGER                                :: nbad
-
-!--- VARIABLES FOR OUTPUT FILE WRITING -----------------------------------------
-  INTEGER :: ierr, nid, ndim, ntim, k
-  INTEGER, DIMENSION(2) :: dims
-  INTEGER :: id_tim,  id_SST,  id_BILS, id_RUG, id_ALB
-  INTEGER :: id_FOCE, id_FSIC, id_FTER, id_FLIC, varid_longitude, varid_latitude
-  INTEGER :: NF90_FORMAT
-  INTEGER :: ndays                   !--- Depending on the output calendar
-
-!--- INITIALIZATIONS -----------------------------------------------------------
-#ifdef NC_DOUBLE
-  NF90_FORMAT=NF90_DOUBLE
-#else
-  NF90_FORMAT=NF90_FLOAT
-#endif
-
-  pi    = 4.*ATAN(1.)
-  rad   = 6371229.
-  daysec= 86400.
-  omeg  = 2.*pi/daysec
-  g     = 9.8
-  kappa = 0.2857143
-  cpp   = 1004.70885
-  dtvr  = daysec/REAL(day_step)
-  CALL inigeom
-
-!--- Beware: anneeref (from gcm.def) is used to determine output time sampling
-  ndays=ioget_year_len(anneeref)
-
-!--- RUGOSITY TREATMENT --------------------------------------------------------
-  IF (prt_level>1) WRITE(lunout,*) 'Traitement de la rugosite'
-  varname='RUGOS'
-  CALL get_2Dfield(frugo,varname,'RUG',interbar,ndays,phy_rug,mask=masque(1:iim,:))
-
-!--- OCEAN TREATMENT -----------------------------------------------------------
-  IF (prt_level>1) WRITE(lunout,*) 'Traitement de la glace oceanique'
-
-! Input SIC file selection
-! Open file only to test if available
-  IF ( NF90_OPEN(TRIM(famipsic),NF90_NOWRITE,nid)==NF90_NOERR ) THEN
-     icefile=TRIM(famipsic)
-     varname='sicbcs'
-  ELSE IF( NF90_OPEN(TRIM(fcpldsic),NF90_NOWRITE,nid)==NF90_NOERR ) THEN
-     icefile=TRIM(fcpldsic)
-     varname='SIICECOV'
-  ELSE IF ( NF90_OPEN(TRIM(fhistsic),NF90_NOWRITE,nid)==NF90_NOERR ) THEN
-     icefile=TRIM(fhistsic)
-     varname='pourc_sic'
-  ELSE IF ( NF90_OPEN(TRIM(feraici),NF90_NOWRITE,nid)==NF90_NOERR ) THEN
-     icefile=TRIM(feraici)
-     varname='ci'
-  ELSE
-     WRITE(lunout,*) 'ERROR! No sea-ice input file was found.'
-     WRITE(lunout,*) 'One of following files must be availible : ',trim(famipsic),', ',trim(fcpldsic),', ', &
-                      trim(fhistsic), trim(feraici)
-     CALL abort_gcm('limit_netcdf','No sea-ice file was found',1)
-  END IF
-  ierr=NF90_CLOSE(nid)
-  IF (prt_level>=0) WRITE(lunout,*)'Pour la glace de mer a ete choisi le fichier '//TRIM(icefile)
-
-  CALL get_2Dfield(icefile,varname, 'SIC',interbar,ndays,phy_ice,flag=oldice)
-
-  ALLOCATE(pctsrf_t(klon,nbsrf,ndays))
-  DO k=1,ndays
-     fi_ice=phy_ice(:,k)
-     WHERE(fi_ice>=1.0  ) fi_ice=1.0
-     WHERE(fi_ice<EPSFRA) fi_ice=0.0
-     pctsrf_t(:,is_ter,k)=pctsrf(:,is_ter)       ! land soil
-     pctsrf_t(:,is_lic,k)=pctsrf(:,is_lic)       ! land ice
-     IF (icefile==trim(fcpldsic)) THEN           ! SIC=pICE*(1-LIC-TER)
-        pctsrf_t(:,is_sic,k)=fi_ice(:)*(1.-pctsrf(:,is_lic)-pctsrf(:,is_ter))
-     ELSE IF (icefile==trim(fhistsic)) THEN      ! SIC=pICE
-        pctsrf_t(:,is_sic,k)=fi_ice(:)
-     ELSE ! icefile==famipsic                    ! SIC=pICE-LIC
-        pctsrf_t(:,is_sic,k)=fi_ice-pctsrf_t(:,is_lic,k)
-     END IF
-     WHERE(pctsrf_t(:,is_sic,k)<=0) pctsrf_t(:,is_sic,k)=0.
-     WHERE(1.0-zmasq<EPSFRA)
-        pctsrf_t(:,is_sic,k)=0.0
-        pctsrf_t(:,is_oce,k)=0.0
-     ELSEWHERE
-        WHERE(pctsrf_t(:,is_sic,k)>=1.0-zmasq)
-           pctsrf_t(:,is_sic,k)=1.0-zmasq
-           pctsrf_t(:,is_oce,k)=0.0
-        ELSEWHERE
-           pctsrf_t(:,is_oce,k)=1.0-zmasq-pctsrf_t(:,is_sic,k)
-           WHERE(pctsrf_t(:,is_oce,k)<EPSFRA)
-              pctsrf_t(:,is_oce,k)=0.0
-              pctsrf_t(:,is_sic,k)=1.0-zmasq
-           END WHERE
-        END WHERE
-     END WHERE
-     nbad=COUNT(pctsrf_t(:,is_oce,k)<0.0)
-     IF(nbad>0) WRITE(lunout,*) 'pb sous maille pour nb point = ',nbad
-     nbad=COUNT(abs(sum(pctsrf_t(:,:,k),dim=2)-1.0)>EPSFRA)
-     IF(nbad>0) WRITE(lunout,*) 'pb sous surface pour nb points = ',nbad
-  END DO
-  DEALLOCATE(phy_ice)
-
-!--- SST TREATMENT -------------------------------------------------------------
-  IF (prt_level>1) WRITE(lunout,*) 'Traitement de la sst'
-
-! Input SST file selection
-! Open file only to test if available
-  IF ( NF90_OPEN(TRIM(famipsst),NF90_NOWRITE,nid)==NF90_NOERR ) THEN
-     sstfile=TRIM(famipsst)
-     varname='tosbcs'
-  ELSE IF ( NF90_OPEN(TRIM(fcpldsst),NF90_NOWRITE,nid)==NF90_NOERR ) THEN
-     sstfile=TRIM(fcpldsst)
-     varname='SISUTESW'
-  ELSE IF ( NF90_OPEN(TRIM(fhistsst),NF90_NOWRITE,nid)==NF90_NOERR ) THEN
-     sstfile=TRIM(fhistsst)
-     varname='tsol_oce'
-  ELSE IF ( NF90_OPEN(TRIM(feraisstk),NF90_NOWRITE,nid)==NF90_NOERR ) THEN
-     sstfile=TRIM(feraisstk)
-     varname='sstk'
-  ELSE
-     WRITE(lunout,*) 'ERROR! No sst input file was found.'
-     WRITE(lunout,*) 'One of following files must be availible : ',trim(famipsst),trim(fcpldsst),trim(fhistsst),trim(feraisstk)
-     CALL abort_gcm('limit_netcdf','No sst file was found',1)
-  END IF
-  ierr=NF90_CLOSE(nid)
-  IF (prt_level>=0) WRITE(lunout,*)'Pour la temperature de mer a ete choisi un fichier '//TRIM(sstfile)
-
-  CALL get_2Dfield(sstfile,varname,'SST',interbar,ndays,phy_sst,flag=extrap)
-
-!--- ALBEDO TREATMENT ----------------------------------------------------------
-  IF (prt_level>1) WRITE(lunout,*) 'Traitement de l albedo'
-  varname='ALBEDO'
-  CALL get_2Dfield(falbe,varname,'ALB',interbar,ndays,phy_alb)
-
-!--- REFERENCE GROUND HEAT FLUX TREATMENT --------------------------------------
-  ALLOCATE(phy_bil(klon,ndays)); phy_bil=0.0
-
-!--- OUTPUT FILE WRITING -------------------------------------------------------
-  IF (prt_level>5) WRITE(lunout,*) 'Ecriture du fichier limit : debut'
-
-  !--- File creation
-  ierr=NF90_CREATE("limit.nc",NF90_CLOBBER,nid)
-  ierr=NF90_PUT_ATT(nid,NF90_GLOBAL,"title","Fichier conditions aux limites")
-
-  !--- Dimensions creation
-  ierr=NF90_DEF_DIM(nid,"points_physiques",klon,ndim)
-  ierr=NF90_DEF_DIM(nid,"time",NF90_UNLIMITED,ntim)
-
-  dims=(/ndim,ntim/)
-
-  !--- Variables creation
-  ierr=NF90_DEF_VAR(nid,"TEMPS",NF90_FORMAT,(/ntim/),id_tim)
-  ierr=NF90_DEF_VAR(nid,"FOCE", NF90_FORMAT,dims,id_FOCE)
-  ierr=NF90_DEF_VAR(nid,"FSIC", NF90_FORMAT,dims,id_FSIC)
-  ierr=NF90_DEF_VAR(nid,"FTER", NF90_FORMAT,dims,id_FTER)
-  ierr=NF90_DEF_VAR(nid,"FLIC", NF90_FORMAT,dims,id_FLIC)
-  ierr=NF90_DEF_VAR(nid,"SST",  NF90_FORMAT,dims,id_SST)
-  ierr=NF90_DEF_VAR(nid,"BILS", NF90_FORMAT,dims,id_BILS)
-  ierr=NF90_DEF_VAR(nid,"ALB",  NF90_FORMAT,dims,id_ALB)
-  ierr=NF90_DEF_VAR(nid,"RUG",  NF90_FORMAT,dims,id_RUG)
-  call nf95_def_var(nid, "longitude", NF90_FLOAT, ndim, varid_longitude)
-  call nf95_def_var(nid, "latitude", NF90_FLOAT, ndim, varid_latitude)
-
-  !--- Attributes creation
-  ierr=NF90_PUT_ATT(nid,id_tim, "title","Jour dans l annee")
-  ierr=NF90_PUT_ATT(nid,id_FOCE,"title","Fraction ocean")
-  ierr=NF90_PUT_ATT(nid,id_FSIC,"title","Fraction glace de mer")
-  ierr=NF90_PUT_ATT(nid,id_FTER,"title","Fraction terre")
-  ierr=NF90_PUT_ATT(nid,id_FLIC,"title","Fraction land ice")
-  ierr=NF90_PUT_ATT(nid,id_SST ,"title","Temperature superficielle de la mer")
-  ierr=NF90_PUT_ATT(nid,id_BILS,"title","Reference flux de chaleur au sol")
-  ierr=NF90_PUT_ATT(nid,id_ALB, "title","Albedo a la surface")
-  ierr=NF90_PUT_ATT(nid,id_RUG, "title","Rugosite")
-
-  call nf95_put_att(nid, varid_longitude, "standard_name", "longitude")
-  call nf95_put_att(nid, varid_longitude, "units", "degrees_east")
-
-  call nf95_put_att(nid, varid_latitude, "standard_name", "latitude")
-  call nf95_put_att(nid, varid_latitude, "units", "degrees_north")
-
-  ierr=NF90_ENDDEF(nid)
-
-  !--- Variables saving
-  ierr=NF90_PUT_VAR(nid,id_tim,(/(REAL(k),k=1,ndays)/))
-  ierr=NF90_PUT_VAR(nid,id_FOCE,pctsrf_t(:,is_oce,:),(/1,1/),(/klon,ndays/))
-  ierr=NF90_PUT_VAR(nid,id_FSIC,pctsrf_t(:,is_sic,:),(/1,1/),(/klon,ndays/))
-  ierr=NF90_PUT_VAR(nid,id_FTER,pctsrf_t(:,is_ter,:),(/1,1/),(/klon,ndays/))
-  ierr=NF90_PUT_VAR(nid,id_FLIC,pctsrf_t(:,is_lic,:),(/1,1/),(/klon,ndays/))
-  ierr=NF90_PUT_VAR(nid,id_SST ,phy_sst(:,:),(/1,1/),(/klon,ndays/))
-  ierr=NF90_PUT_VAR(nid,id_BILS,phy_bil(:,:),(/1,1/),(/klon,ndays/))
-  ierr=NF90_PUT_VAR(nid,id_ALB ,phy_alb(:,:),(/1,1/),(/klon,ndays/))
-  ierr=NF90_PUT_VAR(nid,id_RUG ,phy_rug(:,:),(/1,1/),(/klon,ndays/))
-  call nf95_put_var(nid, varid_longitude, rlon)
-  call nf95_put_var(nid, varid_latitude, rlat)
-
-  ierr=NF90_CLOSE(nid)
-
-  IF (prt_level>5) WRITE(lunout,*) 'Ecriture du fichier limit : fin'
-
-  DEALLOCATE(pctsrf_t,phy_sst,phy_bil,phy_alb,phy_rug)
-
-
-!===============================================================================
-!
-  CONTAINS
-!
-!===============================================================================
-
-
-!-------------------------------------------------------------------------------
-!
-SUBROUTINE get_2Dfield(fnam, varname, mode, ibar, ndays, champo, flag, mask)
-!
-!-----------------------------------------------------------------------------
-! Comments:
-!   There are two assumptions concerning the NetCDF files, that are satisfied
-!   with files that are conforming NC convention:
-!     1) The last dimension of the variables used is the time record.
-!     2) Dimensional variables have the same names as corresponding dimensions.
-!-----------------------------------------------------------------------------
-  USE netcdf, ONLY: NF90_OPEN, NF90_INQ_VARID, NF90_INQUIRE_VARIABLE, &
-       NF90_CLOSE, NF90_INQ_DIMID, NF90_INQUIRE_DIMENSION, NF90_GET_VAR, &
-       NF90_GET_ATT
-  USE dimphy, ONLY : klon
-  USE phys_state_var_mod, ONLY : pctsrf
-  USE control_mod
-  USE pchsp_95_m, only: pchsp_95
-  USE pchfe_95_m, only: pchfe_95
-  USE arth_m, only: arth
-  USE indice_sol_mod
-
-  IMPLICIT NONE
-#include "dimensions.h"
-#include "paramet.h"
-#include "comgeom2.h"
-#include "iniprint.h"
-!-----------------------------------------------------------------------------
-! Arguments:
-  CHARACTER(LEN=*),  INTENT(IN)     :: fnam     ! NetCDF file name
-  CHARACTER(LEN=10), INTENT(IN)     :: varname  ! NetCDF variable name
-  CHARACTER(LEN=3),  INTENT(IN)     :: mode     ! RUG, SIC, SST or ALB
-  LOGICAL,           INTENT(IN)     :: ibar     ! interp on pressure levels
-  INTEGER,           INTENT(IN)     :: ndays    ! current year number of days
-  REAL,    POINTER,  DIMENSION(:, :) :: champo  ! output field = f(t)
-  LOGICAL, OPTIONAL, INTENT(IN)     :: flag     ! extrapol. (SST) old ice (SIC)
-  REAL,    OPTIONAL, DIMENSION(iim, jjp1), INTENT(IN) :: mask
-!------------------------------------------------------------------------------
-! Local variables:
-!--- NetCDF
-  INTEGER :: ncid, varid                  ! NetCDF identifiers
-  CHARACTER(LEN=30)               :: dnam       ! dimension name
-!--- dimensions
-  INTEGER,           DIMENSION(4) :: dids       ! NetCDF dimensions identifiers
-  REAL, ALLOCATABLE, DIMENSION(:) :: dlon_ini   ! initial longitudes vector
-  REAL, ALLOCATABLE, DIMENSION(:) :: dlat_ini   ! initial latitudes  vector
-  REAL, POINTER,     DIMENSION(:) :: dlon, dlat ! reordered lon/lat  vectors
-!--- fields
-  INTEGER :: imdep, jmdep, lmdep                ! dimensions of 'champ'
-  REAL, ALLOCATABLE, DIMENSION(:, :) :: champ   ! wanted field on initial grid
-  REAL, ALLOCATABLE, DIMENSION(:) :: yder, timeyear
-  REAL,              DIMENSION(iim, jjp1) :: champint   ! interpolated field
-  REAL, ALLOCATABLE, DIMENSION(:, :, :)    :: champtime
-  REAL, ALLOCATABLE, DIMENSION(:, :, :)    :: champan
-!--- input files
-  CHARACTER(LEN=20)                 :: cal_in   ! calendar
-  CHARACTER(LEN=20)                 :: unit_sic ! attribute unit in sea-ice file
-  INTEGER                           :: ndays_in ! number of days
-!--- misc
-  INTEGER :: i, j, k, l                         ! loop counters
-  REAL, ALLOCATABLE, DIMENSION(:, :) :: work     ! used for extrapolation
-  CHARACTER(LEN=25)                 :: title    ! for messages
-  LOGICAL                           :: extrp    ! flag for extrapolation
-  LOGICAL                           :: oldice   ! flag for old way ice computation 
-  REAL                              :: chmin, chmax
-  INTEGER ierr
-  integer n_extrap ! number of extrapolated points
-  logical skip
-
-!------------------------------------------------------------------------------
-!---Variables depending on keyword 'mode' -------------------------------------
-  NULLIFY(champo)
-
-  SELECT CASE(mode)
-  CASE('RUG'); title='Rugosite'
-  CASE('SIC'); title='Sea-ice'
-  CASE('SST'); title='SST'
-  CASE('ALB'); title='Albedo'
-  END SELECT
-  
-
-  extrp=.FALSE. 
-  oldice=.FALSE.
-  IF ( PRESENT(flag) ) THEN 
-    IF ( flag .AND. mode=='SST' ) extrp=.TRUE. 
-    IF ( flag .AND. mode=='SIC' ) oldice=.TRUE. 
-  END IF
-
-!--- GETTING SOME DIMENSIONAL VARIABLES FROM FILE -----------------------------
-  IF (prt_level>5) WRITE(lunout,*) ' Now reading file : ',fnam
-  ierr=NF90_OPEN(fnam, NF90_NOWRITE, ncid);             CALL ncerr(ierr, fnam)
-  ierr=NF90_INQ_VARID(ncid, trim(varname), varid);            CALL ncerr(ierr, fnam)
-  ierr=NF90_INQUIRE_VARIABLE(ncid, varid, dimids=dids); CALL ncerr(ierr, fnam)
-
-!--- Read unit for sea-ice variable only
-  IF (mode=='SIC') THEN
-     ierr=NF90_GET_ATT(ncid, varid, 'units', unit_sic)
-     IF(ierr/=NF90_NOERR) THEN
-        IF (prt_level>5) WRITE(lunout,*) 'No unit was given in sea-ice file. Take percentage as default value'
-        unit_sic='X'
-     ELSE
-        IF (prt_level>5) WRITE(lunout,*) ' Sea-ice cover has unit=',unit_sic
-     END IF
-  END IF
-
-!--- Longitude
-  ierr=NF90_INQUIRE_DIMENSION(ncid, dids(1), name=dnam, len=imdep)
-  CALL ncerr(ierr, fnam); ALLOCATE(dlon_ini(imdep), dlon(imdep))
-  ierr=NF90_INQ_VARID(ncid, dnam, varid);                CALL ncerr(ierr, fnam)
-  ierr=NF90_GET_VAR(ncid, varid, dlon_ini);              CALL ncerr(ierr, fnam)
-  IF (prt_level>5) WRITE(lunout, *) 'variable ', dnam, 'dimension ', imdep
-
-!--- Latitude
-  ierr=NF90_INQUIRE_DIMENSION(ncid, dids(2), name=dnam, len=jmdep)
-  CALL ncerr(ierr, fnam); ALLOCATE(dlat_ini(jmdep), dlat(jmdep))
-  ierr=NF90_INQ_VARID(ncid, dnam, varid);                CALL ncerr(ierr, fnam)
-  ierr=NF90_GET_VAR(ncid, varid, dlat_ini);              CALL ncerr(ierr, fnam)
-  IF (prt_level>5) WRITE(lunout, *) 'variable ', dnam, 'dimension ', jmdep
-
-!--- Time (variable is not needed - it is rebuilt - but calendar is)
-  ierr=NF90_INQUIRE_DIMENSION(ncid, dids(3), name=dnam, len=lmdep)
-  CALL ncerr(ierr, fnam); ALLOCATE(timeyear(lmdep))
-  ierr=NF90_INQ_VARID(ncid, dnam, varid);                CALL ncerr(ierr, fnam)
-  cal_in=' '
-  ierr=NF90_GET_ATT(ncid, varid, 'calendar', cal_in)
-  IF(ierr/=NF90_NOERR) THEN
-    SELECT CASE(mode)
-      CASE('RUG', 'ALB'); cal_in='360d'
-      CASE('SIC', 'SST'); cal_in='gregorian'
-    END SELECT
-    IF (prt_level>5) WRITE(lunout, *)'ATTENTION: variable "time" sans attribut "calendrier" ' &
-         // 'dans '//TRIM(fnam)//'. On choisit la valeur par defaut.'
-  END IF
-  IF (prt_level>5) WRITE(lunout, *) 'variable ', dnam, 'dimension ', lmdep, 'calendrier ', &
-       cal_in
-
-  
-!--- CONSTRUCTING THE INPUT TIME VECTOR FOR INTERPOLATION --------------------
-  !--- Determining input file number of days, depending on calendar
-  ndays_in=year_len(anneeref, cal_in)
-
-!--- Time vector reconstruction (time vector from file is not trusted)
-!--- If input records are not monthly, time sampling has to be constant !
-  timeyear=mid_months(anneeref, cal_in, lmdep)
-  IF (lmdep /= 12) WRITE(lunout,*) 'Note : les fichiers de ', TRIM(mode), &
-       ' ne comportent pas 12, mais ', lmdep, ' enregistrements.'
-
-!--- GETTING THE FIELD AND INTERPOLATING IT ----------------------------------
-  ALLOCATE(champ(imdep, jmdep), champtime(iim, jjp1, lmdep))
-  IF(extrp) ALLOCATE(work(imdep, jmdep))
-
-  IF (prt_level>5) WRITE(lunout, *)
-  IF (prt_level>5) WRITE(lunout,*)'LECTURE ET INTERPOLATION HORIZ. DE ', lmdep, ' CHAMPS.'
-  ierr=NF90_INQ_VARID(ncid, varname, varid);             CALL ncerr(ierr, fnam)
-  DO l=1, lmdep
-    ierr=NF90_GET_VAR(ncid, varid, champ, (/1, 1, l/), (/imdep, jmdep, 1/))
-    CALL ncerr(ierr, fnam)
-    CALL conf_dat2d(title, imdep, jmdep, dlon_ini, dlat_ini, dlon, dlat, &
-         champ, ibar)
-
-    IF (extrp) CALL extrapol(champ, imdep, jmdep, 999999., .TRUE., .TRUE., 2, &
-         work)
-
-    IF(ibar .AND. .NOT.oldice) THEN
-      IF(l==1 .AND. prt_level>5) THEN
-        WRITE(lunout, *) '-------------------------------------------------------------------------'
-        WRITE(lunout, *) 'Utilisation de l''interpolation barycentrique pour ',TRIM(title),' $$$'
-        WRITE(lunout, *) '-------------------------------------------------------------------------'
-      END IF
-      IF(mode=='RUG') champ=LOG(champ)
-      CALL inter_barxy(dlon, dlat(:jmdep-1), champ, rlonu(:iim),     &
-                         rlatv, champint)
-      IF(mode=='RUG') THEN
-        champint=EXP(champint)
-        WHERE(NINT(mask)/=1) champint=0.001
-      END IF
-    ELSE
-      SELECT CASE(mode)
-        CASE('RUG');       CALL rugosite(imdep, jmdep, dlon, dlat, champ,    &
-                                    iim, jjp1, rlonv, rlatu, champint, mask)
-        CASE('SIC');       CALL sea_ice (imdep, jmdep, dlon, dlat, champ,    &
-                                    iim, jjp1, rlonv, rlatu, champint)
-        CASE('SST', 'ALB'); CALL grille_m(imdep, jmdep, dlon, dlat, champ,    &
-                                    iim, jjp1, rlonv, rlatu, champint)
-      END SELECT
-    END IF
-    champtime(:, :, l)=champint
-  END DO
-  ierr=NF90_CLOSE(ncid);                                 CALL ncerr(ierr, fnam)
-
-  DEALLOCATE(dlon_ini, dlat_ini, dlon, dlat, champ)
-  IF(extrp) DEALLOCATE(work)
-
-!--- TIME INTERPOLATION ------------------------------------------------------
-  IF (prt_level>5) THEN
-     WRITE(lunout, *)
-     WRITE(lunout, *)'INTERPOLATION TEMPORELLE.'
-     WRITE(lunout, *)' Vecteur temps en entree: ', timeyear
-     WRITE(lunout, *)' Vecteur temps en sortie de 0 a ', ndays
-  END IF
-
-  ALLOCATE(yder(lmdep), champan(iip1, jjp1, ndays))
-  skip = .false.
-  n_extrap = 0
-  DO j=1, jjp1
-    DO i=1, iim
-      yder = pchsp_95(timeyear, champtime(i, j, :), ibeg=2, iend=2, &
-           vc_beg=0., vc_end=0.)
-      CALL pchfe_95(timeyear, champtime(i, j, :), yder, skip, &
-           arth(0., real(ndays_in) / ndays, ndays), champan(i, j, :), ierr)
-      if (ierr < 0) stop 1
-      n_extrap = n_extrap + ierr
-    END DO
-  END DO
-  if (n_extrap /= 0) then
-     WRITE(lunout,*) "get_2Dfield pchfe_95: n_extrap = ", n_extrap
-  end if
-  champan(iip1, :, :)=champan(1, :, :)
-  DEALLOCATE(yder, champtime, timeyear)
-
-!--- Checking the result
-  DO j=1, jjp1
-    CALL minmax(iip1, champan(1, j, 10), chmin, chmax)
-    IF (prt_level>5) WRITE(lunout, *)' ',TRIM(title),' au temps 10 ', chmin, chmax, j
-  END DO
-
-!--- SPECIAL FILTER FOR SST: SST>271.38 --------------------------------------
-  IF(mode=='SST') THEN
-    IF (prt_level>5) WRITE(lunout, *) 'Filtrage de la SST: SST >= 271.38'
-    WHERE(champan<271.38) champan=271.38
-  END IF
-
-!--- SPECIAL FILTER FOR SIC: 0.0<SIC<1.0 -------------------------------------
-  IF(mode=='SIC') THEN
-    IF (prt_level>5) WRITE(lunout, *) 'Filtrage de la SIC: 0.0 < Sea-ice < 1.0'
-
-    IF (unit_sic=='1') THEN
-       ! Nothing to be done for sea-ice field is already in fraction of 1
-       ! This is the case for sea-ice in file cpl_atm_sic.nc
-       IF (prt_level>5) WRITE(lunout,*) 'Sea-ice field already in fraction of 1'
-    ELSE
-       ! Convert sea ice from percentage to fraction of 1
-       IF (prt_level>5) WRITE(lunout,*) 'Transformt sea-ice field from percentage to fraction of 1.' 
-       champan(:, :, :)=champan(:, :, :)/100.
-    END IF
-
-    champan(iip1, :, :)=champan(1, :, :)
-    WHERE(champan>1.0) champan=1.0
-    WHERE(champan<0.0) champan=0.0
- END IF
-
-!--- DYNAMICAL TO PHYSICAL GRID ----------------------------------------------
-  ALLOCATE(champo(klon, ndays))
-  DO k=1, ndays
-    CALL gr_dyn_fi(1, iip1, jjp1, klon, champan(1, 1, k), champo(1, k))
-  END DO
-  DEALLOCATE(champan)
-
-END SUBROUTINE get_2Dfield
-!
-!-------------------------------------------------------------------------------
-
-
-
-!-------------------------------------------------------------------------------
-!
-FUNCTION year_len(y,cal_in)
-!
-!-------------------------------------------------------------------------------
-  USE ioipsl, ONLY : ioget_calendar,ioconf_calendar,lock_calendar,ioget_year_len
-  IMPLICIT NONE
-!-------------------------------------------------------------------------------
-! Arguments:
-  INTEGER                       :: year_len
-  INTEGER,           INTENT(IN) :: y
-  CHARACTER(LEN=*),  INTENT(IN) :: cal_in
-!-------------------------------------------------------------------------------
-! Local variables:
-  CHARACTER(LEN=20)             :: cal_out              ! calendar (for outputs)
-!-------------------------------------------------------------------------------
-!--- Getting the input calendar to reset at the end of the function
-  CALL ioget_calendar(cal_out)
-
-!--- Unlocking calendar and setting it to wanted one
-  CALL lock_calendar(.FALSE.); CALL ioconf_calendar(TRIM(cal_in))
-
-!--- Getting the number of days in this year
-  year_len=ioget_year_len(y)
-
-!--- Back to original calendar
-  CALL lock_calendar(.FALSE.); CALL ioconf_calendar(TRIM(cal_out))
-
-END FUNCTION year_len
-!
-!-------------------------------------------------------------------------------
-
-
-!-------------------------------------------------------------------------------
-!
-FUNCTION mid_months(y,cal_in,nm)
-!
-!-------------------------------------------------------------------------------
-  USE ioipsl, ONLY : ioget_calendar,ioconf_calendar,lock_calendar,ioget_mon_len
-  IMPLICIT NONE
-!-------------------------------------------------------------------------------
-! Arguments:
-  INTEGER,                INTENT(IN) :: y               ! year
-  CHARACTER(LEN=*),       INTENT(IN) :: cal_in          ! calendar
-  INTEGER,                INTENT(IN) :: nm              ! months/year number
-  REAL,    DIMENSION(nm)             :: mid_months      ! mid-month times
-!-------------------------------------------------------------------------------
-! Local variables:
-  CHARACTER(LEN=99)                  :: mess            ! error message
-  CHARACTER(LEN=20)                  :: cal_out         ! calendar (for outputs)
-  INTEGER, DIMENSION(nm)             :: mnth            ! months lengths (days)
-  INTEGER                            :: m               ! months counter
-  INTEGER                            :: nd              ! number of days
-!-------------------------------------------------------------------------------
-  nd=year_len(y,cal_in)
-
-  IF(nm==12) THEN
-
-  !--- Getting the input calendar to reset at the end of the function
-    CALL ioget_calendar(cal_out)
-
-  !--- Unlocking calendar and setting it to wanted one
-    CALL lock_calendar(.FALSE.); CALL ioconf_calendar(TRIM(cal_in))
-
-  !--- Getting the length of each month
-    DO m=1,nm; mnth(m)=ioget_mon_len(y,m); END DO
-
-  !--- Back to original calendar
-    CALL lock_calendar(.FALSE.); CALL ioconf_calendar(TRIM(cal_out))
-
-  ELSE IF(MODULO(nd,nm)/=0) THEN
-    WRITE(mess,'(a,i3,a,i3,a)')'Unconsistent calendar: ',nd,' days/year, but ',&
-      nm,' months/year. Months number should divide days number.'
-    CALL abort_gcm('mid_months',TRIM(mess),1)
-
-  ELSE
-    mnth=(/(m,m=1,nm,nd/nm)/)
-  END IF
-
-!--- Mid-months times
-  mid_months(1)=0.5*REAL(mnth(1))
-  DO k=2,nm
-    mid_months(k)=mid_months(k-1)+0.5*REAL(mnth(k-1)+mnth(k))
-  END DO
-
-END FUNCTION mid_months
-!
-!-------------------------------------------------------------------------------
-
-
-!-------------------------------------------------------------------------------
-!
-SUBROUTINE ncerr(ncres,fnam)
-!
-!-------------------------------------------------------------------------------
-! Purpose: NetCDF errors handling.
-!-------------------------------------------------------------------------------
-  USE netcdf, ONLY : NF90_NOERR, NF90_STRERROR
-  IMPLICIT NONE
-!-------------------------------------------------------------------------------
-! Arguments:
-  INTEGER,          INTENT(IN) :: ncres
-  CHARACTER(LEN=*), INTENT(IN) :: fnam
-!-------------------------------------------------------------------------------
-#include "iniprint.h"
-  IF(ncres/=NF90_NOERR) THEN
-    WRITE(lunout,*)'Problem with file '//TRIM(fnam)//' in routine limit_netcdf.'
-    CALL abort_gcm('limit_netcdf',NF90_STRERROR(ncres),1)
-  END IF
-
-END SUBROUTINE ncerr
-!
-!-------------------------------------------------------------------------------
-
-#endif
-! of #ifdef CPP_EARTH
-
-#endif
-! of #ifndef CPP_1D
-END SUBROUTINE limit_netcdf
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/limit_read_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/limit_read_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/limit_read_mod.F90	(revision 3814)
@@ -195,10 +195,10 @@
        IF ( type_ocean /= 'couple' ) THEN
           ALLOCATE(pctsrf(klon,nbsrf), sst(klon), stat=ierr)
-          IF (ierr /= 0) CALL abort_gcm(modname, 'PB in allocating pctsrf and sst',1)
+          IF (ierr /= 0) CALL abort_physic(modname, 'PB in allocating pctsrf and sst',1)
        END IF
 
        IF ( .NOT. ok_veget ) THEN
           ALLOCATE(rugos(klon), albedo(klon), stat=ierr)
-          IF (ierr /= 0) CALL abort_gcm(modname, 'PB in allocating rugos and albedo',1)
+          IF (ierr /= 0) CALL abort_physic(modname, 'PB in allocating rugos and albedo',1)
        END IF
 
@@ -220,5 +220,5 @@
 
           ierr = NF90_OPEN ('limit.nc', NF90_NOWRITE, nid)
-          IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,&
+          IF (ierr /= NF90_NOERR) CALL abort_physic(modname,&
                'Pb d''ouverture du fichier de conditions aux limites',1)
           
@@ -239,15 +239,15 @@
 ! Ocean fraction
              ierr = NF90_INQ_VARID(nid, 'FOCE', nvarid)
-             IF (ierr /= NF90_NOERR) CALL abort_gcm(modname, 'Le champ <FOCE> est absent',1)
+             IF (ierr /= NF90_NOERR) CALL abort_physic(modname, 'Le champ <FOCE> est absent',1)
              
              ierr = NF90_GET_VAR(nid,nvarid,pct_glo(:,is_oce),start,epais)
-             IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Lecture echouee pour <FOCE>' ,1)
+             IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <FOCE>' ,1)
 !
 ! Sea-ice fraction
              ierr = NF90_INQ_VARID(nid, 'FSIC', nvarid)
-             IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Le champ <FSIC> est absent',1)
+             IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <FSIC> est absent',1)
 
              ierr = NF90_GET_VAR(nid,nvarid,pct_glo(:,is_sic),start,epais)
-             IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Lecture echouee pour <FSIC>' ,1)
+             IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <FSIC>' ,1)
 
 
@@ -257,15 +257,15 @@
 ! Land fraction
                 ierr = NF90_INQ_VARID(nid, 'FTER', nvarid)
-                IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Le champ <FTER> est absent',1)
+                IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <FTER> est absent',1)
                 
                 ierr = NF90_GET_VAR(nid,nvarid,pct_glo(:,is_ter),start,epais)
-                IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Lecture echouee pour <FTER>',1)
+                IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <FTER>',1)
 !
 ! Continentale ice fraction
                 ierr = NF90_INQ_VARID(nid, 'FLIC', nvarid)
-                IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Le champ <FLIC> est absent',1)
+                IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <FLIC> est absent',1)
 
                 ierr = NF90_GET_VAR(nid,nvarid,pct_glo(:,is_lic),start,epais)
-                IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Lecture echouee pour <FLIC>',1)
+                IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <FLIC>',1)
              END IF
 
@@ -279,8 +279,8 @@
 
              ierr = NF90_INQ_VARID(nid, 'SST', nvarid)
-             IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Le champ <SST> est absent',1)
+             IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <SST> est absent',1)
 
              ierr = NF90_GET_VAR(nid,nvarid,sst_glo,start,epais)
-             IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Lecture echouee pour <SST>',1)
+             IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <SST>',1)
           
           END IF
@@ -295,15 +295,15 @@
 ! Read albedo
              ierr = NF90_INQ_VARID(nid, 'ALB', nvarid)
-             IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Le champ <ALB> est absent',1)
+             IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <ALB> est absent',1)
 
              ierr = NF90_GET_VAR(nid,nvarid,alb_glo,start,epais)
-             IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Lecture echouee pour <ALB>',1)
+             IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <ALB>',1)
 !
 ! Read rugosity
              ierr = NF90_INQ_VARID(nid, 'RUG', nvarid)
-             IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Le champ <RUG> est absent',1)
+             IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <RUG> est absent',1)
 
              ierr = NF90_GET_VAR(nid,nvarid,rug_glo,start,epais)
-             IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Lecture echouee pour <RUG>',1)
+             IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <RUG>',1)
 
           END IF
@@ -314,5 +314,5 @@
 !****************************************************************************************
           ierr = NF90_CLOSE(nid)
-          IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Pb when closing file', 1)
+          IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Pb when closing file', 1)
        ENDIF ! is_mpi_root
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/limit_slab.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/limit_slab.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/limit_slab.F90	(revision 3814)
@@ -11,5 +11,4 @@
   IMPLICIT NONE
 
-  INCLUDE "temps.h"
   INCLUDE "clesphys.h"
   INCLUDE "dimensions.h"
@@ -113,5 +112,5 @@
 !****************************************************************************************
         ierr = NF90_CLOSE(nid)
-        IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Pb when closing file', 1)
+        IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Pb when closing file', 1)
         END IF ! Read File
         IF (read_sst) THEN
@@ -133,5 +132,5 @@
      IF (.NOT. ALLOCATED(bils_save)) THEN
         ALLOCATE(bils_save(klon), diff_sst_save(klon), diff_siv_save(klon), stat=ierr)
-        IF (ierr /= 0) CALL abort_gcm('limit_slab', 'pb in allocation',1)
+        IF (ierr /= 0) CALL abort_physic('limit_slab', 'pb in allocation',1)
      END IF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/lsc_scav.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/lsc_scav.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/lsc_scav.F90	(revision 3814)
@@ -9,5 +9,5 @@
   USE mod_phys_lmdz_para
   USE traclmdz_mod
-  USE infotrac,ONLY : nbtr
+  USE infotrac_phy,ONLY : nbtr
   USE comgeomphy
   USE iophy
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/main_calfis.f90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/main_calfis.f90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/main_calfis.f90	(revision 3814)
@@ -0,0 +1,8 @@
+! fake exec to test unresolved symbol in physics. To be suppress..
+PROGRAM main_calfis
+IMPLICIT NONE
+
+
+  CALL physiq
+  
+END PROGRAM main_calfis
Index: namico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mkstat.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mkstat.F90	(revision 3813)
+++ 	(revision )
@@ -1,164 +1,0 @@
-subroutine mkstats(ierr)
-
- 
-!
-!  This program writes a stats.nc file from sums and sums of squares
-!  to means and standard deviations and also writes netcdf style
-!  file so that the data can be viewed easily.  The data file is
-!  overwritten in place.  
-!  SRL  21 May 1996
-!  Yann W. july 2003
-
-
-implicit none
-
-#include "dimensions.h"
-#include "statto.h"
-#include "netcdf.inc"
-
-integer,parameter :: iip1=iim+1
-integer,parameter :: jjp1=jjm+1
-integer :: ierr,nid,nbvar,i,ndims,lt,nvarid
-integer, dimension(4) :: id,varid,start,size
-integer, dimension(5) :: dimids
-character (len=50) :: name,nameout,units,title
-real, dimension(iip1,jjp1,llm) :: sum3d,square3d,mean3d,sd3d
-real, dimension(iip1,jjp1) :: sum2d,square2d,mean2d,sd2d
-real, dimension(istime) :: time
-real, dimension(jjp1) :: lat
-real, dimension(iip1) :: lon
-real, dimension(llm) :: alt
-logical :: lcopy=.true.
-!integer :: latid,lonid,altid,timeid
-integer :: meanid,sdid
-!integer, dimension(4) :: dimout
-
-! Incrementation of count for the last step, which is not done in wstats
-count(istime)=count(istime)+1
-
-ierr = NF_OPEN("stats.nc",NF_WRITE,nid)
-
-! We catch the id of dimensions of the stats file
-
-ierr= NF_INQ_DIMID(nid,"latitude",id(1))
-ierr= NF_INQ_DIMID(nid,"longitude",id(2))
-ierr= NF_INQ_DIMID(nid,"altitude",id(3))
-ierr= NF_INQ_DIMID(nid,"Time",id(4))
-
-ierr= NF_INQ_VARID(nid,"latitude",varid(1))
-ierr= NF_INQ_VARID(nid,"longitude",varid(2))
-ierr= NF_INQ_VARID(nid,"altitude",varid(3))
-ierr= NF_INQ_VARID(nid,"Time",varid(4))
-
-! Time initialisation
-
-do i=1,istime
-   time(i)=i*24./istime
-#ifdef NC_DOUBLE
-   ierr= NF_PUT_VARA_DOUBLE(nid,varid(4),i,1,time(i))
-#else
-   ierr= NF_PUT_VARA_REAL(nid,varid(4),i,1,time(i))
-#endif
-enddo
-
-! We catche the values of the variables
-
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VAR_DOUBLE(nid,varid(1),lat)
-         ierr = NF_GET_VAR_DOUBLE(nid,varid(2),lon)
-         ierr = NF_GET_VAR_DOUBLE(nid,varid(3),alt)
-#else
-         ierr = NF_GET_VAR_REAL(nid,varid(1),lat)
-         ierr = NF_GET_VAR_REAL(nid,varid(2),lon)
-         ierr = NF_GET_VAR_REAL(nid,varid(3),alt)
-#endif
-
-! We catch the number of variables in the stats file
-ierr = NF_INQ_NVARS(nid,nbvar)
-
-! to catche the "real" number of variables (without the "additionnal variables")
-nbvar=(nbvar-4)/2 
-
-do i=1,nbvar
-   varid=(i-1)*2+5
-
-   ! What's the variable's name?
-   ierr=NF_INQ_VARNAME(nid,varid,name)
-   write(*,*) "OK variable ",name
-   ! Its units?
-   units=" "
-   ierr=NF_GET_ATT_TEXT(nid,varid,"units",units)
-   ! Its title?
-   title=" "
-   ierr=NF_GET_ATT_TEXT(nid,varid,"title",title)
-   ! Its number of dimensions?   
-   ierr=NF_INQ_VARNDIMS(nid,varid,ndims)
-   ! Its values?
-
-   if(ndims==4) then ! lat, lon, alt & time
-
-!      dimout(1)=lonid
-!      dimout(2)=latid
-!      dimout(3)=altid
-!      dimout(4)=timeid
-
-      size=(/iip1,jjp1,llm,1/)
-      do lt=1,istime
-         start=(/1,1,1,lt/)
-         ! Extraction of the "source" variables
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VARA_DOUBLE(nid,varid,start,size,sum3d)
-         ierr = NF_GET_VARA_DOUBLE(nid,varid+1,start,size,square3d)
-#else
-         ierr = NF_GET_VARA_REAL(nid,varid,start,size,sum3d)
-         ierr = NF_GET_VARA_REAL(nid,varid+1,start,size,square3d)
-#endif
-         ! Calculation of these variables
-         mean3d=sum3d/count(lt)
-         sd3d=sqrt(max(0.,square3d/count(lt)-mean3d**2))
-         ! Writing of the variables
-#ifdef NC_DOUBLE
-         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,size,mean3d)
-         ierr = NF_PUT_VARA_DOUBLE(nid,varid+1,start,size,sd3d)
-#else
-         ierr = NF_PUT_VARA_REAL(nid,varid,start,size,mean3d)
-         ierr = NF_PUT_VARA_REAL(nid,varid+1,start,size,sd3d)
-#endif
-      enddo
-
-    else if (ndims.eq.3) then
-
-!      dimout(1)=lonid
-!      dimout(2)=latid
-!      dimout(3)=timeid
-
-      size=(/iip1,jjp1,1,0/)
-      do lt=1,istime
-         start=(/1,1,lt,0/)
-         ! Extraction of the "source" variables
-#ifdef NC_DOUBLE
-         ierr = NF_GET_VARA_DOUBLE(nid,varid,start,size,sum2d)
-         ierr = NF_GET_VARA_DOUBLE(nid,varid+1,start,size,square2d)
-#else
-         ierr = NF_GET_VARA_REAL(nid,varid,start,size,sum2d)
-         ierr = NF_GET_VARA_REAL(nid,varid+1,start,size,square2d)
-#endif
-         ! Calculation of these variables
-         mean2d=sum2d/count(lt)
-         sd2d=sqrt(max(0.,square2d/count(lt)-mean2d**2))
-         ! Writing of the variables
-#ifdef NC_DOUBLE
-         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,size,mean2d)
-         ierr = NF_PUT_VARA_DOUBLE(nid,varid+1,start,size,sd2d)
-#else
-         ierr = NF_PUT_VARA_REAL(nid,varid,start,size,mean2d)
-         ierr = NF_PUT_VARA_REAL(nid,varid+1,start,size,sd2d)
-#endif
-      enddo
-
-    endif 
-enddo
-
-ierr= NF_CLOSE(nid)
-
-end
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_grid_phy_lmdz.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_grid_phy_lmdz.F90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_grid_phy_lmdz.F90	(revision 3814)
@@ -0,0 +1,454 @@
+!
+!$Id $
+!
+MODULE mod_grid_phy_lmdz
+
+  PUBLIC
+  PRIVATE :: grid1dTo2d_glo_igen, grid1dTo2d_glo_rgen, grid1dTo2d_glo_lgen, &
+             grid2dTo1d_glo_igen, grid2dTo1d_glo_rgen, grid2dTo1d_glo_lgen
+  
+  INTEGER,SAVE :: nbp_lon  ! == iim
+  INTEGER,SAVE :: nbp_lat  ! == jjmp1
+  INTEGER,SAVE :: nbp_lev  ! == llm
+  INTEGER,SAVE :: klon_glo
+
+  INTERFACE grid1dTo2d_glo
+    MODULE PROCEDURE grid1dTo2d_glo_i,grid1dTo2d_glo_i1,grid1dTo2d_glo_i2,grid1dTo2d_glo_i3, &
+                     grid1dTo2d_glo_r,grid1dTo2d_glo_r1,grid1dTo2d_glo_r2,grid1dTo2d_glo_r3, &
+		     grid1dTo2d_glo_l,grid1dTo2d_glo_l1,grid1dTo2d_glo_l2,grid1dTo2d_glo_l3
+   END INTERFACE 
+
+   INTERFACE grid2dTo1d_glo
+    MODULE PROCEDURE grid2dTo1d_glo_i,grid2dTo1d_glo_i1,grid2dTo1d_glo_i2,grid2dTo1d_glo_i3, &
+                     grid2dTo1d_glo_r,grid2dTo1d_glo_r1,grid2dTo1d_glo_r2,grid2dTo1d_glo_r3, &
+		     grid2dTo1d_glo_l,grid2dTo1d_glo_l1,grid2dTo1d_glo_l2,grid2dTo1d_glo_l3
+   END INTERFACE 
+ 
+CONTAINS
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! SUBROUTINE grid1dTo2d  !!  
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+  SUBROUTINE Init_grid_phy_lmdz(iim,jjp1,llm)
+  IMPLICIT NONE
+  INTEGER, INTENT(in) :: iim
+  INTEGER, INTENT(in) :: jjp1
+  INTEGER, INTENT(in) :: llm
+  
+    nbp_lon=iim
+    nbp_lat=jjp1
+    nbp_lev=llm
+    klon_glo=(iim*jjp1)-2*(iim-1)
+  
+  END SUBROUTINE Init_grid_phy_lmdz
+  
+  
+  SUBROUTINE grid1dTo2d_glo_i(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_igen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid1dTo2d_glo_i
+  
+
+  SUBROUTINE grid1dTo2d_glo_i1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_igen(VarIn,VarOut,size(VarIn,2))
+  
+  END SUBROUTINE grid1dTo2d_glo_i1
+
+  SUBROUTINE grid1dTo2d_glo_i2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
+  
+  END SUBROUTINE grid1dTo2d_glo_i2
+  
+  SUBROUTINE grid1dTo2d_glo_i3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid1dTo2d_glo_i3
+
+
+  SUBROUTINE grid1dTo2d_glo_r(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid1dTo2d_glo_r
+  
+
+  SUBROUTINE grid1dTo2d_glo_r1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,size(VarIn,2))
+  
+  END SUBROUTINE grid1dTo2d_glo_r1
+
+  SUBROUTINE grid1dTo2d_glo_r2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
+  
+  END SUBROUTINE grid1dTo2d_glo_r2
+  
+  SUBROUTINE grid1dTo2d_glo_r3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid1dTo2d_glo_r3
+  
+  
+  
+  SUBROUTINE grid1dTo2d_glo_l(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid1dTo2d_glo_l
+  
+
+  SUBROUTINE grid1dTo2d_glo_l1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,size(VarIn,2))
+  
+  END SUBROUTINE grid1dTo2d_glo_l1
+
+  SUBROUTINE grid1dTo2d_glo_l2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
+  
+  END SUBROUTINE grid1dTo2d_glo_l2
+  
+  SUBROUTINE grid1dTo2d_glo_l3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_glo_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid1dTo2d_glo_l3  
+  
+    SUBROUTINE grid2dTo1d_glo_i(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_igen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid2dTo1d_glo_i
+  
+
+  SUBROUTINE grid2dTo1d_glo_i1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_igen(VarIn,VarOut,size(VarIn,3))
+  
+  END SUBROUTINE grid2dTo1d_glo_i1
+
+  SUBROUTINE grid2dTo1d_glo_i2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid2dTo1d_glo_i2
+  
+  SUBROUTINE grid2dTo1d_glo_i3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
+  
+  END SUBROUTINE grid2dTo1d_glo_i3
+ 
+
+
+
+  SUBROUTINE grid2dTo1d_glo_r(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid2dTo1d_glo_r
+  
+
+  SUBROUTINE grid2dTo1d_glo_r1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,size(VarIn,3))
+  
+  END SUBROUTINE grid2dTo1d_glo_r1
+
+  SUBROUTINE grid2dTo1d_glo_r2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid2dTo1d_glo_r2
+  
+  SUBROUTINE grid2dTo1d_glo_r3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
+  
+  END SUBROUTINE grid2dTo1d_glo_r3
+
+
+
+  SUBROUTINE grid2dTo1d_glo_l(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid2dTo1d_glo_l
+  
+
+  SUBROUTINE grid2dTo1d_glo_l1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,size(VarIn,3))
+  
+  END SUBROUTINE grid2dTo1d_glo_l1
+
+  SUBROUTINE grid2dTo1d_glo_l2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid2dTo1d_glo_l2
+  
+  SUBROUTINE grid2dTo1d_glo_l3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_glo_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
+  
+  END SUBROUTINE grid2dTo1d_glo_l3
+
+!---------------------------------------------------------------- 
+!  Generic (private) fonctions
+!---------------------------------------------------------------- 
+  
+  SUBROUTINE grid1dTo2d_glo_igen(VarIn,VarOut,dimsize)
+
+    IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
+    INTEGER :: i,ij,Offset
+
+    
+    Offset=nbp_lon
+        
+    DO i=1,dimsize
+      DO ij=1,klon_glo
+        VarOut(ij+offset-1,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+    
+    
+    DO i=1,dimsize
+      DO ij=1,nbp_lon
+       VarOut(ij,i)=VarIn(1,i)
+      ENDDO
+    ENDDO
+    
+    
+    DO i=1,dimsize
+      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
+       VarOut(ij,i)=VarIn(klon_glo,i)
+      ENDDO
+    ENDDO
+
+  END SUBROUTINE grid1dTo2d_glo_igen   
+
+
+  SUBROUTINE grid1dTo2d_glo_rgen(VarIn,VarOut,dimsize)
+
+    IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
+    REAL,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
+    INTEGER :: i,ij,Offset
+
+   
+    Offset=nbp_lon
+        
+    DO i=1,dimsize
+      DO ij=1,klon_glo
+        VarOut(ij+offset-1,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+    
+    
+    DO i=1,dimsize
+      DO ij=1,nbp_lon
+       VarOut(ij,i)=VarIn(1,i)
+      ENDDO
+    ENDDO
+    
+    
+    DO i=1,dimsize
+      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
+       VarOut(ij,i)=VarIn(klon_glo,i)
+      ENDDO
+    ENDDO
+
+  END SUBROUTINE grid1dTo2d_glo_rgen   
+
+  SUBROUTINE grid1dTo2d_glo_lgen(VarIn,VarOut,dimsize)
+
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN) ,DIMENSION(klon_glo,dimsize)       :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(nbp_lon*nbp_lat,dimsize)  :: VarOut
+    INTEGER :: i,ij,Offset
+
+    Offset=nbp_lon
+        
+    DO i=1,dimsize
+      DO ij=1,klon_glo
+        VarOut(ij+offset-1,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+    
+    
+    DO i=1,dimsize
+      DO ij=1,nbp_lon
+       VarOut(ij,i)=VarIn(1,i)
+      ENDDO
+    ENDDO
+    
+    
+    DO i=1,dimsize
+      DO ij=nbp_lon*(nbp_lat-1)+1,nbp_lat*nbp_lon
+       VarOut(ij,i)=VarIn(klon_glo,i)
+      ENDDO
+    ENDDO
+
+  END SUBROUTINE grid1dTo2d_glo_lgen     
+  
+  
+  SUBROUTINE grid2dTo1d_glo_igen(VarIn,VarOut,dimsize)
+
+    IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN) ,DIMENSION(nbp_lon*nbp_lat,dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(klon_glo,dimsize)      :: VarOut
+    INTEGER :: i,ij,offset
+
+    offset=nbp_lon
+
+    DO i=1,dimsize
+      DO ij=1,klon_glo
+        VarOut(ij,i)=VarIn(ij+offset-1,i)
+      ENDDO
+    ENDDO
+
+    DO i=1,dimsize
+      VarOut(1,i)=VarIn(1,i)
+    ENDDO
+    
+  END SUBROUTINE grid2dTo1d_glo_igen   
+  
+  SUBROUTINE grid2dTo1d_glo_rgen(VarIn,VarOut,dimsize)
+
+    IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN) ,DIMENSION(nbp_lon*nbp_lat,dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(klon_glo,dimsize)      :: VarOut
+    INTEGER :: i,ij,offset
+
+    offset=nbp_lon
+
+    DO i=1,dimsize
+      DO ij=1,klon_glo
+        VarOut(ij,i)=VarIn(ij+offset-1,i)
+      ENDDO
+    ENDDO
+
+    DO i=1,dimsize
+      VarOut(1,i)=VarIn(1,i)
+    ENDDO
+    
+  END SUBROUTINE grid2dTo1d_glo_rgen 
+    
+  SUBROUTINE grid2dTo1d_glo_lgen(VarIn,VarOut,dimsize)
+
+    IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN) ,DIMENSION(nbp_lon*nbp_lat,dimsize) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(klon_glo,dimsize)      :: VarOut
+    INTEGER :: i,ij,offset
+
+    offset=nbp_lon
+
+    DO i=1,dimsize
+      DO ij=1,klon_glo
+        VarOut(ij,i)=VarIn(ij+offset-1,i)
+      ENDDO
+    ENDDO
+
+    DO i=1,dimsize
+      VarOut(1,i)=VarIn(1,i)
+    ENDDO
+    
+  END SUBROUTINE grid2dTo1d_glo_lgen   
+
+END MODULE mod_grid_phy_lmdz
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_mpi_data.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_mpi_data.F90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_mpi_data.F90	(revision 3814)
@@ -0,0 +1,207 @@
+!
+!$Header$
+!
+MODULE mod_phys_lmdz_mpi_data
+  
+  INTEGER,SAVE :: ii_begin
+  INTEGER,SAVE :: ii_end
+  INTEGER,SAVE :: jj_begin
+  INTEGER,SAVE :: jj_end
+  INTEGER,SAVE :: jj_nb
+  INTEGER,SAVE :: ij_begin
+  INTEGER,SAVE :: ij_end
+  INTEGER,SAVE :: ij_nb
+  INTEGER,SAVE :: klon_mpi_begin
+  INTEGER,SAVE :: klon_mpi_end
+  INTEGER,SAVE :: klon_mpi
+  
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_nb
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_begin
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_end
+
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ii_para_begin
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ii_para_end
+
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_nb
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_begin
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: ij_para_end
+
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_nb
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_begin
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_end 
+
+  
+  INTEGER,SAVE :: mpi_rank
+  INTEGER,SAVE :: mpi_size
+  INTEGER,SAVE :: mpi_master
+  LOGICAL,SAVE :: is_mpi_root
+  LOGICAL,SAVE :: is_using_mpi
+  
+  
+  LOGICAL,SAVE :: is_north_pole
+  LOGICAL,SAVE :: is_south_pole
+  INTEGER,SAVE :: COMM_LMDZ_PHY
+  INTEGER,SAVE :: MPI_REAL_LMDZ   ! MPI_REAL8
+
+CONTAINS
+  
+  SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib,communicator)
+  IMPLICIT NONE
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER,INTENT(in) :: iim
+    INTEGER,INTENT(in) :: jjp1
+    INTEGER,INTENT(in) :: nb_proc
+    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+    INTEGER,INTENT(in) :: communicator
+    
+    INTEGER :: ierr
+    INTEGER :: klon_glo
+    INTEGER :: i
+    
+#ifdef CPP_MPI
+    is_using_mpi=.TRUE.
+#else
+    is_using_mpi=.FALSE.
+#endif
+    
+    if (iim.eq.1) then
+       klon_glo=1
+    else
+       klon_glo=iim*(jjp1-2)+2
+    endif
+    
+    COMM_LMDZ_PHY=communicator
+
+    IF (is_using_mpi) THEN    
+#ifdef CPP_MPI
+      MPI_REAL_LMDZ=MPI_REAL8
+      CALL MPI_COMM_SIZE(COMM_LMDZ_PHY,mpi_size,ierr)    
+      CALL MPI_COMM_RANK(COMM_LMDZ_PHY,mpi_rank,ierr)
+#endif
+    ELSE
+      mpi_size=1
+      mpi_rank=0
+    ENDIF
+    
+    IF (mpi_rank == 0) THEN
+      mpi_master = 0
+      is_mpi_root = .true.
+    ENDIF
+    
+    IF (mpi_rank == 0) THEN 
+      is_north_pole = .TRUE.
+    ELSE
+      is_north_pole = .FALSE.
+    ENDIF
+    
+    IF (mpi_rank == mpi_size-1) THEN
+      is_south_pole = .TRUE.
+    ELSE
+      is_south_pole = .FALSE.
+    ENDIF
+    
+    ALLOCATE(jj_para_nb(0:mpi_size-1))
+    ALLOCATE(jj_para_begin(0:mpi_size-1))
+    ALLOCATE(jj_para_end(0:mpi_size-1))
+    
+    ALLOCATE(ij_para_nb(0:mpi_size-1))
+    ALLOCATE(ij_para_begin(0:mpi_size-1))
+    ALLOCATE(ij_para_end(0:mpi_size-1))
+    
+    ALLOCATE(ii_para_begin(0:mpi_size-1))
+    ALLOCATE(ii_para_end(0:mpi_size-1))
+
+    ALLOCATE(klon_mpi_para_nb(0:mpi_size-1))
+    ALLOCATE(klon_mpi_para_begin(0:mpi_size-1))
+    ALLOCATE(klon_mpi_para_end(0:mpi_size-1))
+  
+      
+    klon_mpi_para_nb(0:mpi_size-1)=distrib(0:nb_proc-1)
+
+    DO i=0,mpi_size-1
+      IF (i==0) THEN 
+        klon_mpi_para_begin(i)=1
+      ELSE 
+        klon_mpi_para_begin(i)=klon_mpi_para_end(i-1)+1
+      ENDIF
+        klon_mpi_para_end(i)=klon_mpi_para_begin(i)+klon_mpi_para_nb(i)-1
+    ENDDO
+
+
+    DO i=0,mpi_size-1
+      
+      IF (i==0) THEN
+        ij_para_begin(i) = 1
+      ELSE
+        ij_para_begin(i) = klon_mpi_para_begin(i)+iim-1
+      ENDIF
+
+      jj_para_begin(i) = (ij_para_begin(i)-1)/iim + 1
+      ii_para_begin(i) = MOD(ij_para_begin(i)-1,iim) + 1
+
+      
+      ij_para_end(i) = klon_mpi_para_end(i)+iim-1
+      jj_para_end(i) = (ij_para_end(i)-1)/iim + 1
+      ii_para_end(i) = MOD(ij_para_end(i)-1,iim) + 1
+
+
+      ij_para_nb(i) = ij_para_end(i)-ij_para_begin(i)+1
+      jj_para_nb(i) = jj_para_end(i)-jj_para_begin(i)+1
+         
+    ENDDO
+  
+    ii_begin = ii_para_begin(mpi_rank)
+    ii_end   = ii_para_end(mpi_rank)
+    jj_begin = jj_para_begin(mpi_rank)
+    jj_end   = jj_para_end(mpi_rank)
+    jj_nb    = jj_para_nb(mpi_rank)
+    ij_begin = ij_para_begin(mpi_rank)
+    ij_end   = ij_para_end(mpi_rank)
+    ij_nb    = ij_para_nb(mpi_rank)
+    klon_mpi_begin = klon_mpi_para_begin(mpi_rank)
+    klon_mpi_end   = klon_mpi_para_end(mpi_rank)
+    klon_mpi       = klon_mpi_para_nb(mpi_rank)
+   
+    CALL Print_module_data
+    
+  END SUBROUTINE Init_phys_lmdz_mpi_data
+
+  SUBROUTINE print_module_data
+  IMPLICIT NONE
+  INCLUDE "iniprint.h" 
+  
+    WRITE(lunout,*) 'ii_begin =', ii_begin
+    WRITE(lunout,*) 'ii_end =', ii_end
+    WRITE(lunout,*) 'jj_begin =',jj_begin
+    WRITE(lunout,*) 'jj_end =', jj_end
+    WRITE(lunout,*) 'jj_nb =', jj_nb
+    WRITE(lunout,*) 'ij_begin =', ij_begin
+    WRITE(lunout,*) 'ij_end =', ij_end
+    WRITE(lunout,*) 'ij_nb =', ij_nb
+    WRITE(lunout,*) 'klon_mpi_begin =', klon_mpi_begin
+    WRITE(lunout,*) 'klon_mpi_end =', klon_mpi_end
+    WRITE(lunout,*) 'klon_mpi =', klon_mpi
+    WRITE(lunout,*) 'jj_para_nb =', jj_para_nb
+    WRITE(lunout,*) 'jj_para_begin =', jj_para_begin
+    WRITE(lunout,*) 'jj_para_end =', jj_para_end
+    WRITE(lunout,*) 'ii_para_begin =', ii_para_begin
+    WRITE(lunout,*) 'ii_para_end =', ii_para_end
+    WRITE(lunout,*) 'ij_para_nb =', ij_para_nb
+    WRITE(lunout,*) 'ij_para_begin =', ij_para_begin
+    WRITE(lunout,*) 'ij_para_end =', ij_para_end
+    WRITE(lunout,*) 'klon_mpi_para_nb =', klon_mpi_para_nb
+    WRITE(lunout,*) 'klon_mpi_para_begin =', klon_mpi_para_begin
+    WRITE(lunout,*) 'klon_mpi_para_end  =', klon_mpi_para_end 
+    WRITE(lunout,*) 'mpi_rank =', mpi_rank
+    WRITE(lunout,*) 'mpi_size =', mpi_size
+    WRITE(lunout,*) 'mpi_master =', mpi_master
+    WRITE(lunout,*) 'is_mpi_root =', is_mpi_root
+    WRITE(lunout,*) 'is_north_pole =', is_north_pole
+    WRITE(lunout,*) 'is_south_pole =', is_south_pole
+    WRITE(lunout,*) 'COMM_LMDZ_PHY =', COMM_LMDZ_PHY
+  
+  END SUBROUTINE print_module_data
+  
+END MODULE mod_phys_lmdz_mpi_data
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_mpi_transfert.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_mpi_transfert.F90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_mpi_transfert.F90	(revision 3814)
@@ -0,0 +1,1902 @@
+!
+!$Header$
+!
+MODULE mod_phys_lmdz_mpi_transfert
+
+
+  INTERFACE bcast_mpi
+    MODULE PROCEDURE bcast_mpi_c,                                                     &
+                     bcast_mpi_i,bcast_mpi_i1,bcast_mpi_i2,bcast_mpi_i3,bcast_mpi_i4, &
+                     bcast_mpi_r,bcast_mpi_r1,bcast_mpi_r2,bcast_mpi_r3,bcast_mpi_r4, &
+                     bcast_mpi_l,bcast_mpi_l1,bcast_mpi_l2,bcast_mpi_l3,bcast_mpi_l4
+  END INTERFACE
+
+  INTERFACE scatter_mpi
+    MODULE PROCEDURE scatter_mpi_i,scatter_mpi_i1,scatter_mpi_i2,scatter_mpi_i3, &
+                     scatter_mpi_r,scatter_mpi_r1,scatter_mpi_r2,scatter_mpi_r3, &
+                     scatter_mpi_l,scatter_mpi_l1,scatter_mpi_l2,scatter_mpi_l3
+  END INTERFACE
+
+  
+  INTERFACE gather_mpi
+    MODULE PROCEDURE gather_mpi_i,gather_mpi_i1,gather_mpi_i2,gather_mpi_i3, &
+                     gather_mpi_r,gather_mpi_r1,gather_mpi_r2,gather_mpi_r3, &
+                     gather_mpi_l,gather_mpi_l1,gather_mpi_l2,gather_mpi_l3  
+  END INTERFACE
+  
+  INTERFACE scatter2D_mpi
+    MODULE PROCEDURE scatter2D_mpi_i,scatter2D_mpi_i1,scatter2D_mpi_i2,scatter2D_mpi_i3, &
+                     scatter2D_mpi_r,scatter2D_mpi_r1,scatter2D_mpi_r2,scatter2D_mpi_r3, &
+                     scatter2D_mpi_l,scatter2D_mpi_l1,scatter2D_mpi_l2,scatter2D_mpi_l3
+  END INTERFACE
+
+  INTERFACE gather2D_mpi
+    MODULE PROCEDURE gather2D_mpi_i,gather2D_mpi_i1,gather2D_mpi_i2,gather2D_mpi_i3, &
+                     gather2D_mpi_r,gather2D_mpi_r1,gather2D_mpi_r2,gather2D_mpi_r3, &
+                     gather2D_mpi_l,gather2D_mpi_l1,gather2D_mpi_l2,gather2D_mpi_l3
+  END INTERFACE 
+  
+  INTERFACE reduce_sum_mpi
+    MODULE PROCEDURE reduce_sum_mpi_i,reduce_sum_mpi_i1,reduce_sum_mpi_i2,reduce_sum_mpi_i3,reduce_sum_mpi_i4, &
+                     reduce_sum_mpi_r,reduce_sum_mpi_r1,reduce_sum_mpi_r2,reduce_sum_mpi_r3,reduce_sum_mpi_r4
+  END INTERFACE 
+
+ INTERFACE grid1dTo2d_mpi
+    MODULE PROCEDURE grid1dTo2d_mpi_i,grid1dTo2d_mpi_i1,grid1dTo2d_mpi_i2,grid1dTo2d_mpi_i3, &
+                     grid1dTo2d_mpi_r,grid1dTo2d_mpi_r1,grid1dTo2d_mpi_r2,grid1dTo2d_mpi_r3, &
+                     grid1dTo2d_mpi_l,grid1dTo2d_mpi_l1,grid1dTo2d_mpi_l2,grid1dTo2d_mpi_l3
+ END INTERFACE 
+
+ INTERFACE grid2dTo1d_mpi
+    MODULE PROCEDURE grid2dTo1d_mpi_i,grid2dTo1d_mpi_i1,grid2dTo1d_mpi_i2,grid2dTo1d_mpi_i3, &
+                     grid2dTo1d_mpi_r,grid2dTo1d_mpi_r1,grid2dTo1d_mpi_r2,grid2dTo1d_mpi_r3, &
+                     grid2dTo1d_mpi_l,grid2dTo1d_mpi_l1,grid2dTo1d_mpi_l2,grid2dTo1d_mpi_l3
+ END INTERFACE 
+    
+CONTAINS
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Broadcast --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+!! -- Les chaine de charactère -- !!
+
+  SUBROUTINE bcast_mpi_c(var1)
+  IMPLICIT NONE
+    CHARACTER(LEN=*),INTENT(INOUT) :: Var1
+   
+    CALL bcast_mpi_cgen(Var1,len(Var1))
+
+  END SUBROUTINE bcast_mpi_c
+
+!! -- Les entiers -- !!
+  
+  SUBROUTINE bcast_mpi_i(var)
+  USE mod_phys_lmdz_mpi_data, ONLY : is_mpi_root
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var
+    
+    INTEGER               :: var_tmp(1)
+    
+    IF (is_mpi_root) var_tmp(1)=var
+    CALL bcast_mpi_igen(Var_tmp,1)
+    var=var_tmp(1)
+    
+  END SUBROUTINE bcast_mpi_i
+
+  SUBROUTINE bcast_mpi_i1(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:)
+
+    CALL bcast_mpi_igen(Var,size(Var))
+    
+  END SUBROUTINE bcast_mpi_i1
+
+  SUBROUTINE bcast_mpi_i2(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:)
+   
+    CALL bcast_mpi_igen(Var,size(Var))
+  
+  END SUBROUTINE bcast_mpi_i2
+
+  SUBROUTINE bcast_mpi_i3(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:)
+   
+    CALL bcast_mpi_igen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_i3
+
+  SUBROUTINE bcast_mpi_i4(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL bcast_mpi_igen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_i4
+
+
+!! -- Les reels -- !!
+
+  SUBROUTINE bcast_mpi_r(var)
+  USE mod_phys_lmdz_mpi_data, ONLY : is_mpi_root
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var
+    REAL               :: var_tmp(1)
+    
+    IF (is_mpi_root) var_tmp(1)=var
+    CALL bcast_mpi_rgen(Var_tmp,1)
+    var=var_tmp(1)   
+
+  END SUBROUTINE bcast_mpi_r
+
+  SUBROUTINE bcast_mpi_r1(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:)
+   
+    CALL bcast_mpi_rgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_r1
+
+  SUBROUTINE bcast_mpi_r2(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:)
+   
+    CALL bcast_mpi_rgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_r2
+
+  SUBROUTINE bcast_mpi_r3(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:)
+   
+    CALL bcast_mpi_rgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_r3
+
+  SUBROUTINE bcast_mpi_r4(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL bcast_mpi_rgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_r4
+  
+!! -- Les booleans -- !!
+
+  SUBROUTINE bcast_mpi_l(var)
+  USE mod_phys_lmdz_mpi_data, ONLY : is_mpi_root
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var
+    LOGICAL               :: var_tmp(1)
+    
+    IF (is_mpi_root) var_tmp(1)=var
+    CALL bcast_mpi_lgen(Var_tmp,1)
+    var=var_tmp(1)   
+
+  END SUBROUTINE bcast_mpi_l
+
+  SUBROUTINE bcast_mpi_l1(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:)
+   
+    CALL bcast_mpi_lgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_l1
+
+  SUBROUTINE bcast_mpi_l2(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:)
+   
+    CALL bcast_mpi_lgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_l2
+
+  SUBROUTINE bcast_mpi_l3(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:)
+   
+    CALL bcast_mpi_lgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_l3
+
+  SUBROUTINE bcast_mpi_l4(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL bcast_mpi_lgen(Var,size(Var))
+
+  END SUBROUTINE bcast_mpi_l4
+  
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Scatter   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE scatter_mpi_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL scatter_mpi_igen(VarIn,Varout,1)
+    
+  END SUBROUTINE scatter_mpi_i
+
+  SUBROUTINE scatter_mpi_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL scatter_mpi_igen(VarIn,Varout,Size(VarOut,2))
+    
+  END SUBROUTINE scatter_mpi_i1
+  
+  SUBROUTINE scatter_mpi_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL scatter_mpi_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3))
+
+  END SUBROUTINE scatter_mpi_i2
+
+  SUBROUTINE scatter_mpi_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL scatter_mpi_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4))
+  
+  END SUBROUTINE scatter_mpi_i3
+
+
+  SUBROUTINE scatter_mpi_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+      CALL scatter_mpi_rgen(VarIn,Varout,1)
+  
+  END SUBROUTINE scatter_mpi_r
+
+  SUBROUTINE scatter_mpi_r1(VarIn, VarOut)
+  USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+  IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+      CALL scatter_mpi_rgen(VarIn,Varout,Size(VarOut,2))
+  
+  END SUBROUTINE scatter_mpi_r1
+  
+  SUBROUTINE scatter_mpi_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+      CALL scatter_mpi_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3))
+  
+  END SUBROUTINE scatter_mpi_r2
+
+  SUBROUTINE scatter_mpi_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+      CALL scatter_mpi_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4))
+  
+  END SUBROUTINE scatter_mpi_r3
+
+
+  SUBROUTINE scatter_mpi_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+      CALL scatter_mpi_lgen(VarIn,Varout,1)
+    
+  END SUBROUTINE scatter_mpi_l
+
+  SUBROUTINE scatter_mpi_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+      CALL scatter_mpi_lgen(VarIn,Varout,Size(VarOut,2))
+  
+  END SUBROUTINE scatter_mpi_l1
+  
+  SUBROUTINE scatter_mpi_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+      CALL scatter_mpi_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3))
+  
+  END SUBROUTINE scatter_mpi_l2
+
+  SUBROUTINE scatter_mpi_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+      CALL scatter_mpi_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4))
+  
+  END SUBROUTINE scatter_mpi_l3  
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Gather   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ 
+!!!!! --> Les entiers
+
+  SUBROUTINE gather_mpi_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+      CALL gather_mpi_igen(VarIn,VarOut,1)
+  
+  END SUBROUTINE gather_mpi_i
+  
+
+!!!!!
+
+  SUBROUTINE gather_mpi_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+      CALL gather_mpi_igen(VarIn,VarOut,Size(VarIn,2))
+  
+  END SUBROUTINE gather_mpi_i1
+
+!!!!!
+  
+  SUBROUTINE gather_mpi_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+      CALL gather_mpi_igen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3))
+  
+  END SUBROUTINE gather_mpi_i2
+
+!!!!!
+
+  SUBROUTINE gather_mpi_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+      CALL gather_mpi_igen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4))
+  
+  END SUBROUTINE gather_mpi_i3
+
+!!!!! --> Les reels
+
+  SUBROUTINE gather_mpi_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+      CALL gather_mpi_rgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE gather_mpi_r
+
+!!!!!
+
+  SUBROUTINE gather_mpi_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+      CALL gather_mpi_rgen(VarIn,VarOut,Size(VarIn,2))
+  
+  END SUBROUTINE gather_mpi_r1
+
+!!!!!
+  
+  SUBROUTINE gather_mpi_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+      CALL gather_mpi_rgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3))
+  
+  END SUBROUTINE gather_mpi_r2
+
+!!!!!
+
+  SUBROUTINE gather_mpi_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+      CALL gather_mpi_rgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4))
+  
+  END SUBROUTINE gather_mpi_r3
+
+!!!!! --> Les booleen
+
+  SUBROUTINE gather_mpi_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+      CALL gather_mpi_lgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE gather_mpi_l
+
+!!!!!
+
+  SUBROUTINE gather_mpi_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+      CALL gather_mpi_lgen(VarIn,VarOut,Size(VarIn,2))
+  
+  END SUBROUTINE gather_mpi_l1
+
+!!!!!
+  
+  SUBROUTINE gather_mpi_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+      CALL gather_mpi_lgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3))
+  
+  END SUBROUTINE gather_mpi_l2
+
+!!!!!
+
+  SUBROUTINE gather_mpi_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL gather_mpi_lgen(VarIn,VarOut,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4))
+  
+  END SUBROUTINE gather_mpi_l3
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Scatter2D   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE scatter2D_mpi_i(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    INTEGER,DIMENSION(klon_glo) :: Var_tmp    
+    
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_i
+
+  SUBROUTINE scatter2D_mpi_i1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    INTEGER,DIMENSION(klon_glo,size(VarOut,2)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_i1
+
+  SUBROUTINE scatter2D_mpi_i2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_i2
+  
+  SUBROUTINE scatter2D_mpi_i3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    INTEGER,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3),size(VarOut,4)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+    
+  END SUBROUTINE scatter2D_mpi_i3
+
+
+
+  SUBROUTINE scatter2D_mpi_r(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    REAL,DIMENSION(klon_glo) :: Var_tmp    
+    
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_R
+
+
+  SUBROUTINE scatter2D_mpi_r1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo,size(VarOut,2)) :: Var_tmp
+    
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_r1
+
+
+  SUBROUTINE scatter2D_mpi_r2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    REAL,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3)) :: Var_tmp
+    
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_r2
+  
+  SUBROUTINE scatter2D_mpi_r3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3),size(VarOut,4)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+ 
+  END SUBROUTINE scatter2D_mpi_r3
+  
+  
+  SUBROUTINE scatter2D_mpi_l(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_glo) :: Var_tmp    
+    
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_l
+
+
+  SUBROUTINE scatter2D_mpi_l1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo,size(VarOut,2)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+  
+  END SUBROUTINE scatter2D_mpi_l1
+
+
+  SUBROUTINE scatter2D_mpi_l2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    LOGICAL, DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3)) :: Var_tmp
+  
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_mpi_l2
+  
+  SUBROUTINE scatter2D_mpi_l3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo,size(VarOut,2),size(VarOut,3),size(VarOut,4)) :: Var_tmp
+
+    CALL grid2dTo1d_glo(VarIn,Var_tmp)
+    CALL scatter_mpi(Var_tmp,VarOut)
+ 
+  END SUBROUTINE scatter2D_mpi_l3
+  
+  
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Gather2D   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE gather2D_mpi_i(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_glo) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_i
+
+  SUBROUTINE gather2D_mpi_i1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_glo,size(VarOut,3)) :: Var_tmp
+
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_i1
+
+  SUBROUTINE gather2D_mpi_i2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4)) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_i2
+  
+  SUBROUTINE gather2D_mpi_i3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+ 
+    INTEGER,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4),SIZE(VarOut,5)) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_i3
+
+
+
+  SUBROUTINE gather2D_mpi_r(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_r
+
+  SUBROUTINE gather2D_mpi_r1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo,size(VarOut,3)) :: Var_tmp
+
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_r1
+
+  SUBROUTINE gather2D_mpi_r2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4)) :: Var_tmp
+
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_r2
+  
+  SUBROUTINE gather2D_mpi_r3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4),SIZE(VarOut,5)) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_r3
+
+  
+  
+  SUBROUTINE gather2D_mpi_l(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_l
+
+  SUBROUTINE gather2D_mpi_l1(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo,size(VarOut,3)) :: Var_tmp
+
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_l1
+
+  SUBROUTINE gather2D_mpi_l2(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4)) :: Var_tmp
+
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_l2
+  
+  SUBROUTINE gather2D_mpi_l3(VarIn, VarOut)
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_glo,size(VarOut,3),SIZE(VarOut,4),SIZE(VarOut,5)) :: Var_tmp
+    
+    CALL gather_mpi(VarIn,Var_tmp)
+    CALL grid1dTo2d_glo(Var_tmp,VarOut)
+
+  END SUBROUTINE gather2D_mpi_l3
+  
+  
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des reduce_sum   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE reduce_sum_mpi_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN)  :: VarIn
+    INTEGER,INTENT(OUT) :: VarOut
+    INTEGER             :: VarIn_tmp(1)
+    INTEGER             :: VarOut_tmp(1)
+    
+    VarIn_tmp(1)=VarIn    
+    CALL reduce_sum_mpi_igen(VarIn_tmp,Varout_tmp,1)
+    VarOut=VarOut_tmp(1)
+    
+  END SUBROUTINE reduce_sum_mpi_i
+
+  SUBROUTINE reduce_sum_mpi_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_i1
+
+  SUBROUTINE reduce_sum_mpi_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_i2
+
+  SUBROUTINE reduce_sum_mpi_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_i3
+
+  SUBROUTINE reduce_sum_mpi_i4(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_igen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_i4                  
+  
+  
+  SUBROUTINE reduce_sum_mpi_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN)  :: VarIn
+    REAL,INTENT(OUT) :: VarOut
+    REAL             :: VarIn_tmp(1)
+    REAL             :: VarOut_tmp(1)
+    
+    VarIn_tmp(1)=VarIn    
+    CALL reduce_sum_mpi_rgen(VarIn_tmp,Varout_tmp,1)
+    VarOut=VarOut_tmp(1)
+  
+  END SUBROUTINE reduce_sum_mpi_r
+
+  SUBROUTINE reduce_sum_mpi_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
+     
+  END SUBROUTINE reduce_sum_mpi_r1
+
+  SUBROUTINE reduce_sum_mpi_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_r2
+
+  SUBROUTINE reduce_sum_mpi_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_r3
+
+  SUBROUTINE reduce_sum_mpi_r4(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL reduce_sum_mpi_rgen(VarIn,Varout,SIZE(VarIn))
+  
+  END SUBROUTINE reduce_sum_mpi_r4 
+  
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! SUBROUTINE grid1dTo2d  !!  
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+  SUBROUTINE grid1dTo2d_mpi_i(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid1dTo2d_mpi_i
+  
+
+  SUBROUTINE grid1dTo2d_mpi_i1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,size(VarIn,2))
+  
+  END SUBROUTINE grid1dTo2d_mpi_i1
+
+  SUBROUTINE grid1dTo2d_mpi_i2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
+  
+  END SUBROUTINE grid1dTo2d_mpi_i2
+  
+  SUBROUTINE grid1dTo2d_mpi_i3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_igen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid1dTo2d_mpi_i3
+
+
+  SUBROUTINE grid1dTo2d_mpi_r(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid1dTo2d_mpi_r
+  
+
+  SUBROUTINE grid1dTo2d_mpi_r1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,size(VarIn,2))
+  
+  END SUBROUTINE grid1dTo2d_mpi_r1
+
+  SUBROUTINE grid1dTo2d_mpi_r2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
+  
+  END SUBROUTINE grid1dTo2d_mpi_r2
+  
+  SUBROUTINE grid1dTo2d_mpi_r3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_rgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid1dTo2d_mpi_r3
+  
+  
+  
+  SUBROUTINE grid1dTo2d_mpi_l(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid1dTo2d_mpi_l
+  
+
+  SUBROUTINE grid1dTo2d_mpi_l1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,size(VarIn,2))
+  
+  END SUBROUTINE grid1dTo2d_mpi_l1
+
+  SUBROUTINE grid1dTo2d_mpi_l2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3))
+  
+  END SUBROUTINE grid1dTo2d_mpi_l2
+  
+  SUBROUTINE grid1dTo2d_mpi_l3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:)     :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:)  :: VarOut
+    
+    CALL grid1dTo2d_mpi_lgen(VarIn,VarOut,size(VarIn,2)*size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid1dTo2d_mpi_l3
+
+
+  SUBROUTINE grid2dTo1d_mpi_i(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid2dTo1d_mpi_i
+  
+
+  SUBROUTINE grid2dTo1d_mpi_i1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,size(VarIn,3))
+  
+  END SUBROUTINE grid2dTo1d_mpi_i1
+
+  SUBROUTINE grid2dTo1d_mpi_i2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid2dTo1d_mpi_i2
+  
+  SUBROUTINE grid2dTo1d_mpi_i3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_igen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
+  
+  END SUBROUTINE grid2dTo1d_mpi_i3
+ 
+
+
+
+  SUBROUTINE grid2dTo1d_mpi_r(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid2dTo1d_mpi_r
+  
+
+  SUBROUTINE grid2dTo1d_mpi_r1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,size(VarIn,3))
+  
+  END SUBROUTINE grid2dTo1d_mpi_r1
+
+  SUBROUTINE grid2dTo1d_mpi_r2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid2dTo1d_mpi_r2
+  
+  SUBROUTINE grid2dTo1d_mpi_r3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_rgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
+  
+  END SUBROUTINE grid2dTo1d_mpi_r3
+
+
+
+  SUBROUTINE grid2dTo1d_mpi_l(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,1)
+  
+  END SUBROUTINE grid2dTo1d_mpi_l
+  
+
+  SUBROUTINE grid2dTo1d_mpi_l1(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,size(VarIn,3))
+  
+  END SUBROUTINE grid2dTo1d_mpi_l1
+
+
+
+  SUBROUTINE grid2dTo1d_mpi_l2(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4))
+  
+  END SUBROUTINE grid2dTo1d_mpi_l2
+
+  
+  SUBROUTINE grid2dTo1d_mpi_l3(VarIn,VarOut)  
+  IMPLICIT NONE  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:)  :: VarOut
+    
+    CALL grid2dTo1d_mpi_lgen(VarIn,VarOut,size(VarIn,3)*size(VarIn,4)*size(VarIn,5))
+  
+  END SUBROUTINE grid2dTo1d_mpi_l3
+
+               
+
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! DEFINITION DES FONCTIONS DE TRANSFERT GENERIQUES !
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE bcast_mpi_cgen(var,nb)
+    USE mod_phys_lmdz_mpi_data 
+    IMPLICIT NONE
+    
+    CHARACTER(LEN=*),INTENT(INOUT) :: Var
+    INTEGER,INTENT(IN) :: nb
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) RETURN
+    
+#ifdef CPP_MPI
+    CALL MPI_BCAST(Var,nb,MPI_CHARACTER,mpi_master,COMM_LMDZ_PHY,ierr)
+#endif
+        
+  END SUBROUTINE bcast_mpi_cgen
+
+
+      
+  SUBROUTINE bcast_mpi_igen(var,nb)
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: nb
+    INTEGER,DIMENSION(nb),INTENT(INOUT) :: Var
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) RETURN
+
+#ifdef CPP_MPI
+    CALL MPI_BCAST(Var,nb,MPI_INTEGER,mpi_master,COMM_LMDZ_PHY,ierr)
+#endif
+        
+  END SUBROUTINE bcast_mpi_igen
+
+
+
+  
+  SUBROUTINE bcast_mpi_rgen(var,nb)
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: nb
+    REAL,DIMENSION(nb),INTENT(INOUT) :: Var
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) RETURN
+
+#ifdef CPP_MPI
+    CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_master,COMM_LMDZ_PHY,ierr)
+#endif
+    
+  END SUBROUTINE bcast_mpi_rgen
+  
+
+
+
+  SUBROUTINE bcast_mpi_lgen(var,nb)
+    USE mod_phys_lmdz_mpi_data
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: nb
+    LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) RETURN
+
+#ifdef CPP_MPI
+    CALL MPI_BCAST(Var,nb,MPI_LOGICAL,mpi_master,COMM_LMDZ_PHY,ierr)
+#endif
+
+  END SUBROUTINE bcast_mpi_lgen
+
+  
+
+  SUBROUTINE scatter_mpi_igen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data 
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN),DIMENSION(klon_glo,dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    INTEGER,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+
+
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+
+    
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+        DO i=1,dimsize
+          VarTmp(Index:Index+nb-1)=VarIn(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)
+          Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+      
+#ifdef CPP_MPI 
+    CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_INTEGER,VarOut,klon_mpi*dimsize,   &
+                      MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+
+  END SUBROUTINE scatter_mpi_igen
+
+  SUBROUTINE scatter_mpi_rgen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data 
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN),DIMENSION(klon_glo,dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    REAL,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+    
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+        DO i=1,dimsize
+          VarTmp(Index:Index+nb-1)=VarIn(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)
+          Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+      
+#ifdef CPP_MPI 
+    CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_REAL_LMDZ,VarOut,klon_mpi*dimsize,   &
+                      MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr)
+
+#endif
+
+  END SUBROUTINE scatter_mpi_rgen
+
+  
+  SUBROUTINE scatter_mpi_lgen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data 
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN),DIMENSION(klon_glo,dimsize) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    LOGICAL,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+    
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+        DO i=1,dimsize
+          VarTmp(Index:Index+nb-1)=VarIn(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)
+          Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+      
+#ifdef CPP_MPI
+    CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_LOGICAL,VarOut,klon_mpi*dimsize,   &
+                      MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+
+  END SUBROUTINE scatter_mpi_lgen  
+
+
+
+
+  SUBROUTINE gather_mpi_igen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(klon_glo,dimsize) :: VarOut
+  
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    INTEGER,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+        Index=Index+nb*dimsize
+      ENDDO
+     
+    ENDIF
+    
+#ifdef CPP_MPI
+    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_INTEGER,VarTmp,counts,displs,   &
+                     MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+
+                          
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        DO i=1,dimsize
+          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
+          Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+
+  END SUBROUTINE gather_mpi_igen  
+
+  SUBROUTINE gather_mpi_rgen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data 
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(klon_glo,dimsize) :: VarOut
+  
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    REAL,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+        Index=Index+nb*dimsize
+      ENDDO
+    ENDIF
+    
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+
+#ifdef CPP_MPI
+    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_REAL_LMDZ,VarTmp,counts,displs,   &
+                      MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+                          
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        DO i=1,dimsize
+          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
+          Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+
+  END SUBROUTINE gather_mpi_rgen  
+
+  SUBROUTINE gather_mpi_lgen(VarIn, VarOut, dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(klon_glo,dimsize) :: VarOut
+  
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+
+    INTEGER,DIMENSION(0:mpi_size-1) :: displs
+    INTEGER,DIMENSION(0:mpi_size-1) :: counts
+    LOGICAL,DIMENSION(dimsize*klon_glo) :: VarTmp
+    INTEGER :: nb,i,index,rank
+    INTEGER :: ierr
+    
+    IF (.not.is_using_mpi) THEN
+      VarOut(:,:)=VarIn(:,:)
+      RETURN
+    ENDIF
+
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        displs(rank)=Index-1
+        counts(rank)=nb*dimsize
+        Index=Index+nb*dimsize
+      ENDDO
+    ENDIF
+    
+
+#ifdef CPP_MPI
+    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_LOGICAL,VarTmp,counts,displs,   &
+                      MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr)
+#endif
+                          
+    IF (is_mpi_root) THEN
+      Index=1
+      DO rank=0,mpi_size-1
+        nb=klon_mpi_para_nb(rank)
+        DO i=1,dimsize
+          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
+          Index=Index+nb
+        ENDDO
+      ENDDO
+    ENDIF
+
+  END SUBROUTINE gather_mpi_lgen
+  
+
+
+  SUBROUTINE reduce_sum_mpi_igen(VarIn,VarOut,nb)
+    USE mod_phys_lmdz_mpi_data 
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+   
+    INTEGER,INTENT(IN) :: nb
+    INTEGER,DIMENSION(nb),INTENT(IN) :: VarIn
+    INTEGER,DIMENSION(nb),INTENT(OUT) :: VarOut    
+    INTEGER :: ierr
+   
+    IF (.not.is_using_mpi) THEN
+      VarOut(:)=VarIn(:)
+      RETURN
+    ENDIF
+
+
+#ifdef CPP_MPI
+    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_INTEGER,MPI_SUM,mpi_master,COMM_LMDZ_PHY,ierr)
+#endif
+            
+  END SUBROUTINE reduce_sum_mpi_igen
+  
+  SUBROUTINE reduce_sum_mpi_rgen(VarIn,VarOut,nb)
+    USE mod_phys_lmdz_mpi_data 
+    USE mod_grid_phy_lmdz
+
+    IMPLICIT NONE
+
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    
+    INTEGER,INTENT(IN) :: nb
+    REAL,DIMENSION(nb),INTENT(IN) :: VarIn
+    REAL,DIMENSION(nb),INTENT(OUT) :: VarOut    
+    INTEGER :: ierr
+ 
+    IF (.not.is_using_mpi) THEN
+      VarOut(:)=VarIn(:)
+      RETURN
+    ENDIF
+   
+#ifdef CPP_MPI
+    CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_REAL_LMDZ,MPI_SUM,mpi_master,COMM_LMDZ_PHY,ierr)
+#endif
+        
+  END SUBROUTINE reduce_sum_mpi_rgen
+
+
+
+  SUBROUTINE grid1dTo2d_mpi_igen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN) ,DIMENSION(klon_mpi,dimsize)       :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(nbp_lon*jj_nb,dimsize)  :: VarOut
+    INTEGER :: i,ij,Offset
+
+    
+    VarOut(1:nbp_lon,:)=0
+    VarOut(nbp_lon*(jj_nb-1)+1:nbp_lon*jj_nb,:)=0
+    
+    offset=ii_begin
+    IF (is_north_pole) Offset=nbp_lon
+    
+    
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij+offset-1,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+    
+    
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+        DO ij=1,nbp_lon
+         VarOut(ij,i)=VarIn(1,i)
+        ENDDO
+      ENDDO
+    ENDIF
+    
+    IF (is_south_pole) THEN 
+      DO i=1,dimsize
+        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
+         VarOut(ij,i)=VarIn(klon_mpi,i)
+        ENDDO
+      ENDDO
+    ENDIF
+
+  END SUBROUTINE grid1dTo2d_mpi_igen   
+
+
+  SUBROUTINE grid1dTo2d_mpi_rgen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN) ,DIMENSION(klon_mpi,dimsize)       :: VarIn
+    REAL,INTENT(OUT),DIMENSION(nbp_lon*jj_nb,dimsize)  :: VarOut
+    INTEGER :: i,ij,Offset
+
+    
+    VarOut(1:nbp_lon,:)=0
+    VarOut(nbp_lon*(jj_nb-1)+1:nbp_lon*jj_nb,:)=0
+    
+    offset=ii_begin
+    IF (is_north_pole) Offset=nbp_lon
+    
+    
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij+offset-1,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+    
+    
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+        DO ij=1,nbp_lon
+         VarOut(ij,i)=VarIn(1,i)
+        ENDDO
+      ENDDO
+    ENDIF
+    
+    IF (is_south_pole) THEN 
+      DO i=1,dimsize
+        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
+         VarOut(ij,i)=VarIn(klon_mpi,i)
+        ENDDO
+      ENDDO
+    ENDIF
+
+   END SUBROUTINE grid1dTo2d_mpi_rgen   
+
+
+
+  SUBROUTINE grid1dTo2d_mpi_lgen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN) ,DIMENSION(klon_mpi,dimsize)       :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(nbp_lon*jj_nb,dimsize)  :: VarOut
+    INTEGER :: i,ij,Offset
+
+    
+    VarOut(1:nbp_lon,:)=.FALSE.
+    VarOut(nbp_lon*(jj_nb-1)+1:nbp_lon*jj_nb,:)=.FALSE.
+    
+    offset=ii_begin
+    IF (is_north_pole) Offset=nbp_lon
+    
+    
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij+offset-1,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+    
+    
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+        DO ij=1,nbp_lon
+         VarOut(ij,i)=VarIn(1,i)
+        ENDDO
+      ENDDO
+    ENDIF
+    
+    IF (is_south_pole) THEN 
+      DO i=1,dimsize
+        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
+         VarOut(ij,i)=VarIn(klon_mpi,i)
+        ENDDO
+      ENDDO
+    ENDIF
+
+   END SUBROUTINE grid1dTo2d_mpi_lgen   
+
+  
+
+
+  SUBROUTINE grid2dTo1d_mpi_igen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN) ,DIMENSION(nbp_lon*jj_nb,dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(klon_mpi,dimsize)      :: VarOut
+    INTEGER :: i,ij,offset
+
+    offset=ii_begin
+    IF (is_north_pole) offset=nbp_lon
+
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=VarIn(ij+offset-1,i)
+      ENDDO
+    ENDDO
+
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+        VarOut(1,i)=VarIn(1,i)
+      ENDDO
+    ENDIF
+    
+    
+  END SUBROUTINE grid2dTo1d_mpi_igen   
+
+
+
+  SUBROUTINE grid2dTo1d_mpi_rgen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN) ,DIMENSION(nbp_lon*jj_nb,dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize)      :: VarOut
+    INTEGER :: i,ij,offset
+
+    offset=ii_begin
+    IF (is_north_pole) offset=nbp_lon
+
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=VarIn(ij+offset-1,i)
+      ENDDO
+    ENDDO
+
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+         VarOut(1,i)=VarIn(1,i)
+      ENDDO
+    ENDIF
+    
+    
+  END SUBROUTINE grid2dTo1d_mpi_rgen   
+  
+
+  SUBROUTINE grid2dTo1d_mpi_lgen(VarIn,VarOut,dimsize)
+    USE mod_phys_lmdz_mpi_data
+    USE mod_grid_phy_lmdz
+    IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN) ,DIMENSION(nbp_lon*jj_nb,dimsize) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize)      :: VarOut
+    INTEGER :: i,ij,offset
+
+    offset=ii_begin
+    IF (is_north_pole) offset=nbp_lon
+
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=VarIn(ij+offset-1,i)
+      ENDDO
+    ENDDO
+
+    IF (is_north_pole) THEN 
+      DO i=1,dimsize
+        VarOut(1,i)=VarIn(1,i)
+      ENDDO
+    ENDIF
+    
+    
+  END SUBROUTINE grid2dTo1d_mpi_lgen   
+
+END MODULE mod_phys_lmdz_mpi_transfert
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_omp_data.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_omp_data.F90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_omp_data.F90	(revision 3814)
@@ -0,0 +1,109 @@
+!
+!$Id: mod_phys_lmdz_omp_data.F90 2239 2015-03-23 07:27:30Z emillour $
+!
+MODULE mod_phys_lmdz_omp_data
+
+  INTEGER,SAVE :: omp_size
+  INTEGER,SAVE :: omp_rank
+  LOGICAL,SAVE :: is_omp_root
+  LOGICAL,SAVE :: is_using_omp
+  
+  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_nb
+  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_begin
+  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_end    
+  
+  INTEGER,SAVE :: klon_omp
+  INTEGER,SAVE :: klon_omp_begin
+  INTEGER,SAVE :: klon_omp_end
+!$OMP  THREADPRIVATE(omp_rank,klon_omp,is_omp_root,klon_omp_begin,klon_omp_end)
+
+CONTAINS
+  
+  SUBROUTINE Init_phys_lmdz_omp_data(klon_mpi)
+    USE dimphy
+    IMPLICIT NONE
+    INTEGER, INTENT(in) :: klon_mpi
+
+    INTEGER :: i
+
+    CHARACTER (LEN=20) :: modname='Init_phys_lmdz_omp_data'
+    CHARACTER (LEN=80) :: abort_message
+
+
+#ifdef CPP_OMP    
+    INTEGER :: OMP_GET_NUM_THREADS
+    EXTERNAL OMP_GET_NUM_THREADS
+    INTEGER :: OMP_GET_THREAD_NUM
+    EXTERNAL OMP_GET_THREAD_NUM
+#endif  
+
+#ifdef CPP_OMP
+!$OMP MASTER
+        is_using_omp=.TRUE.
+        omp_size=OMP_GET_NUM_THREADS()
+!$OMP END MASTER
+        omp_rank=OMP_GET_THREAD_NUM()    
+#else    
+    is_using_omp=.FALSE.
+    omp_size=1
+    omp_rank=0
+#endif
+
+   is_omp_root=.FALSE.
+!$OMP MASTER
+   IF (omp_rank==0) THEN
+     is_omp_root=.TRUE.
+   ELSE
+     abort_message = 'ANORMAL : OMP_MASTER /= 0'
+     CALL abort_physic (modname,abort_message,1)
+   ENDIF
+!$OMP END MASTER
+
+
+!$OMP MASTER 
+    ALLOCATE(klon_omp_para_nb(0:omp_size-1))
+    ALLOCATE(klon_omp_para_begin(0:omp_size-1))
+    ALLOCATE(klon_omp_para_end(0:omp_size-1))
+    
+    DO i=0,omp_size-1
+      klon_omp_para_nb(i)=klon_mpi/omp_size
+      IF (i<MOD(klon_mpi,omp_size)) klon_omp_para_nb(i)=klon_omp_para_nb(i)+1
+    ENDDO
+    
+    klon_omp_para_begin(0) = 1
+    klon_omp_para_end(0) = klon_omp_para_nb(0)
+    
+    DO i=1,omp_size-1
+      klon_omp_para_begin(i)=klon_omp_para_end(i-1)+1
+      klon_omp_para_end(i)=klon_omp_para_begin(i)+klon_omp_para_nb(i)-1
+    ENDDO
+!$OMP END MASTER
+!$OMP BARRIER
+   
+    klon_omp=klon_omp_para_nb(omp_rank)
+    klon_omp_begin=klon_omp_para_begin(omp_rank)
+    klon_omp_end=klon_omp_para_end(omp_rank)
+    
+    CALL Print_module_data
+    
+  END SUBROUTINE Init_phys_lmdz_omp_data
+
+  SUBROUTINE Print_module_data
+  IMPLICIT NONE
+  INCLUDE "iniprint.h"
+
+!$OMP CRITICAL  
+  WRITE(lunout,*)'--------> TASK ',omp_rank
+  WRITE(lunout,*)'omp_size =',omp_size
+  WRITE(lunout,*)'omp_rank =',omp_rank
+  WRITE(lunout,*)'is_omp_root =',is_omp_root
+  WRITE(lunout,*)'klon_omp_para_nb =',klon_omp_para_nb
+  WRITE(lunout,*)'klon_omp_para_begin =',klon_omp_para_begin
+  WRITE(lunout,*)'klon_omp_para_end =',klon_omp_para_end    
+  WRITE(lunout,*)'klon_omp =',klon_omp
+  WRITE(lunout,*)'klon_omp_begin =',klon_omp_begin
+  WRITE(lunout,*)'klon_omp_end =',klon_omp_end    
+!$OMP END CRITICAL
+
+  END SUBROUTINE Print_module_data
+END MODULE mod_phys_lmdz_omp_data
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_omp_transfert.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_omp_transfert.F90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_omp_transfert.F90	(revision 3814)
@@ -0,0 +1,1064 @@
+!
+!$Header$
+!
+MODULE mod_phys_lmdz_omp_transfert
+
+  PRIVATE
+  
+  INTEGER,PARAMETER :: grow_factor=1.5
+  INTEGER,PARAMETER :: size_min=1024
+  
+  CHARACTER(LEN=size_min),SAVE            :: buffer_c
+!  INTEGER,SAVE                            :: size_c=0
+  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:)   :: buffer_i
+  INTEGER,SAVE                            :: size_i=0
+  REAL,SAVE,ALLOCATABLE,DIMENSION(:)      :: buffer_r
+  INTEGER,SAVE                            :: size_r=0
+  LOGICAL,SAVE,ALLOCATABLE,DIMENSION(:)   :: buffer_l
+  INTEGER,SAVE                            :: size_l=0
+
+
+  
+  
+  INTERFACE bcast_omp
+    MODULE PROCEDURE bcast_omp_c,                                                     &
+                     bcast_omp_i,bcast_omp_i1,bcast_omp_i2,bcast_omp_i3,bcast_omp_i4, &
+                     bcast_omp_r,bcast_omp_r1,bcast_omp_r2,bcast_omp_r3,bcast_omp_r4, &
+                     bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4
+  END INTERFACE
+
+  INTERFACE scatter_omp
+    MODULE PROCEDURE scatter_omp_i,scatter_omp_i1,scatter_omp_i2,scatter_omp_i3, &
+                     scatter_omp_r,scatter_omp_r1,scatter_omp_r2,scatter_omp_r3, &
+                     scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3
+  END INTERFACE
+
+  
+  INTERFACE gather_omp
+    MODULE PROCEDURE gather_omp_i,gather_omp_i1,gather_omp_i2,gather_omp_i3, &
+                     gather_omp_r,gather_omp_r1,gather_omp_r2,gather_omp_r3, &
+                     gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3  
+  END INTERFACE
+  
+  
+  INTERFACE reduce_sum_omp
+    MODULE PROCEDURE reduce_sum_omp_i,reduce_sum_omp_i1,reduce_sum_omp_i2,reduce_sum_omp_i3,reduce_sum_omp_i4, &
+                     reduce_sum_omp_r,reduce_sum_omp_r1,reduce_sum_omp_r2,reduce_sum_omp_r3,reduce_sum_omp_r4
+  END INTERFACE 
+
+
+  PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp, omp_barrier
+
+CONTAINS
+
+  SUBROUTINE omp_barrier
+  IMPLICIT NONE
+
+!$OMP BARRIER
+
+  END SUBROUTINE omp_barrier
+  
+  SUBROUTINE check_buffer_i(buff_size)
+  IMPLICIT NONE
+  INTEGER :: buff_size
+
+!$OMP BARRIER
+!$OMP MASTER
+    IF (buff_size>size_i) THEN
+      IF (ALLOCATED(buffer_i)) DEALLOCATE(buffer_i)
+      size_i=MAX(size_min,INT(grow_factor*buff_size))
+      ALLOCATE(buffer_i(size_i))
+    ENDIF
+!$OMP END MASTER
+!$OMP BARRIER
+  
+  END SUBROUTINE check_buffer_i
+  
+  SUBROUTINE check_buffer_r(buff_size)
+  IMPLICIT NONE
+  INTEGER :: buff_size
+
+!$OMP BARRIER
+!$OMP MASTER
+    IF (buff_size>size_r) THEN
+      IF (ALLOCATED(buffer_r)) DEALLOCATE(buffer_r)
+      size_r=MAX(size_min,INT(grow_factor*buff_size))
+      ALLOCATE(buffer_r(size_r))
+    ENDIF
+!$OMP END MASTER
+!$OMP BARRIER
+  
+  END SUBROUTINE check_buffer_r
+  
+  SUBROUTINE check_buffer_l(buff_size)
+  IMPLICIT NONE
+  INTEGER :: buff_size
+
+!$OMP BARRIER
+!$OMP MASTER
+    IF (buff_size>size_l) THEN
+      IF (ALLOCATED(buffer_l)) DEALLOCATE(buffer_l)
+      size_l=MAX(size_min,INT(grow_factor*buff_size))
+      ALLOCATE(buffer_l(size_l))
+    ENDIF
+!$OMP END MASTER
+!$OMP BARRIER
+  
+  END SUBROUTINE check_buffer_l
+    
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Broadcast --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+!! -- Les chaine de charactère -- !!
+
+  SUBROUTINE bcast_omp_c(var)
+  IMPLICIT NONE
+    CHARACTER(LEN=*),INTENT(INOUT) :: Var
+    
+    CALL bcast_omp_cgen(Var,len(Var),buffer_c)
+    
+  END SUBROUTINE bcast_omp_c
+
+!! -- Les entiers -- !!
+  
+  SUBROUTINE bcast_omp_i(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var
+    INTEGER :: Var_tmp(1)
+    
+    Var_tmp(1)=Var
+    CALL check_buffer_i(1)
+    CALL bcast_omp_igen(Var_tmp,1,buffer_i)
+    Var=Var_tmp(1)
+
+  END SUBROUTINE bcast_omp_i
+
+
+  SUBROUTINE bcast_omp_i1(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:)
+   
+    CALL check_buffer_i(size(Var))
+    CALL bcast_omp_igen(Var,size(Var),buffer_i)
+
+  END SUBROUTINE bcast_omp_i1
+
+
+  SUBROUTINE bcast_omp_i2(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:)
+   
+    CALL check_buffer_i(size(Var))
+    CALL bcast_omp_igen(Var,size(Var),buffer_i)
+
+  END SUBROUTINE bcast_omp_i2
+
+
+  SUBROUTINE bcast_omp_i3(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:)
+
+    CALL check_buffer_i(size(Var))
+    CALL bcast_omp_igen(Var,size(Var),buffer_i)
+
+  END SUBROUTINE bcast_omp_i3
+
+
+  SUBROUTINE bcast_omp_i4(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL check_buffer_i(size(Var))
+    CALL bcast_omp_igen(Var,size(Var),buffer_i)
+
+  END SUBROUTINE bcast_omp_i4
+
+
+!! -- Les reels -- !!
+
+  SUBROUTINE bcast_omp_r(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var
+    REAL :: Var_tmp(1)
+    
+    Var_tmp(1)=Var
+    CALL check_buffer_r(1)
+    CALL bcast_omp_rgen(Var_tmp,1,buffer_r)
+    Var=Var_tmp(1)
+
+  END SUBROUTINE bcast_omp_r
+
+
+  SUBROUTINE bcast_omp_r1(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:)
+   
+    CALL check_buffer_r(size(Var))
+    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
+
+  END SUBROUTINE bcast_omp_r1
+
+
+  SUBROUTINE bcast_omp_r2(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:)
+   
+    CALL check_buffer_r(size(Var))
+    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
+
+  END SUBROUTINE bcast_omp_r2
+
+
+  SUBROUTINE bcast_omp_r3(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:)
+
+    CALL check_buffer_r(size(Var))
+    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
+
+  END SUBROUTINE bcast_omp_r3
+
+
+  SUBROUTINE bcast_omp_r4(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL check_buffer_r(size(Var))
+    CALL bcast_omp_rgen(Var,size(Var),buffer_r)
+
+  END SUBROUTINE bcast_omp_r4
+
+  
+!! -- Les booleans -- !!
+
+  SUBROUTINE bcast_omp_l(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var
+    LOGICAL :: Var_tmp(1)
+    
+    Var_tmp(1)=Var
+    CALL check_buffer_l(1)
+    CALL bcast_omp_lgen(Var_tmp,1,buffer_l)
+    Var=Var_tmp(1)
+
+  END SUBROUTINE bcast_omp_l
+
+
+  SUBROUTINE bcast_omp_l1(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:)
+   
+    CALL check_buffer_l(size(Var))
+    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
+
+  END SUBROUTINE bcast_omp_l1
+
+
+  SUBROUTINE bcast_omp_l2(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:)
+   
+    CALL check_buffer_l(size(Var))
+    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
+
+  END SUBROUTINE bcast_omp_l2
+
+
+  SUBROUTINE bcast_omp_l3(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:)
+
+    CALL check_buffer_l(size(Var))
+    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
+
+  END SUBROUTINE bcast_omp_l3
+
+
+  SUBROUTINE bcast_omp_l4(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+    CALL check_buffer_l(size(Var))
+    CALL bcast_omp_lgen(Var,size(Var),buffer_l)
+
+  END SUBROUTINE bcast_omp_l4
+
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Scatter   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE scatter_omp_i(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_i(size(VarIn))   
+    CALL scatter_omp_igen(VarIn,Varout,1,buffer_i)
+    
+  END SUBROUTINE scatter_omp_i
+
+
+  SUBROUTINE scatter_omp_i1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    CALL Check_buffer_i(size(VarIn))   
+    CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2),buffer_i)
+    
+  END SUBROUTINE scatter_omp_i1
+  
+  
+  SUBROUTINE scatter_omp_i2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarIn))   
+    CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_i)
+
+  END SUBROUTINE scatter_omp_i2
+
+
+  SUBROUTINE scatter_omp_i3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarIn))   
+    CALL scatter_omp_igen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_i)
+  
+  END SUBROUTINE scatter_omp_i3
+
+
+
+
+  SUBROUTINE scatter_omp_r(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_r(size(VarIn))   
+    CALL scatter_omp_rgen(VarIn,Varout,1,buffer_r)
+    
+  END SUBROUTINE scatter_omp_r
+
+
+  SUBROUTINE scatter_omp_r1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2),buffer_r)
+        
+  END SUBROUTINE scatter_omp_r1
+  
+  
+  SUBROUTINE scatter_omp_r2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_r)
+
+  END SUBROUTINE scatter_omp_r2
+
+
+  SUBROUTINE scatter_omp_r3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL scatter_omp_rgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_r)
+  
+  END SUBROUTINE scatter_omp_r3
+  
+
+
+  SUBROUTINE scatter_omp_l(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_l(size(VarIn))   
+    CALL scatter_omp_lgen(VarIn,Varout,1,buffer_l)
+    
+  END SUBROUTINE scatter_omp_l
+
+
+  SUBROUTINE scatter_omp_l1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarIn))   
+    CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2),buffer_l)
+    
+  END SUBROUTINE scatter_omp_l1
+  
+  
+  SUBROUTINE scatter_omp_l2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarIn))   
+    CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3),buffer_l)
+
+  END SUBROUTINE scatter_omp_l2
+
+
+  SUBROUTINE scatter_omp_l3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarIn))   
+    CALL scatter_omp_lgen(VarIn,Varout,Size(VarOut,2)*Size(VarOut,3)*Size(VarOut,4),buffer_l)
+  
+  END SUBROUTINE scatter_omp_l3  
+  
+
+  SUBROUTINE gather_omp_i(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_i(size(VarOut))   
+    CALL gather_omp_igen(VarIn,Varout,1,buffer_i)
+    
+  END SUBROUTINE gather_omp_i
+
+
+  SUBROUTINE gather_omp_i1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarOut))   
+    CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2),buffer_i)
+    
+  END SUBROUTINE gather_omp_i1
+
+
+  SUBROUTINE gather_omp_i2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarOut))   
+    CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_i)
+          
+  END SUBROUTINE gather_omp_i2
+  
+
+  SUBROUTINE gather_omp_i3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarOut))   
+    CALL gather_omp_igen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_i)
+    
+  END SUBROUTINE gather_omp_i3
+
+
+
+  SUBROUTINE gather_omp_r(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_r(size(VarOut))   
+    CALL gather_omp_rgen(VarIn,Varout,1,buffer_r)
+    
+  END SUBROUTINE gather_omp_r
+
+
+  SUBROUTINE gather_omp_r1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    CALL Check_buffer_r(size(VarOut))   
+    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2),buffer_r)
+        
+  END SUBROUTINE gather_omp_r1
+
+
+  SUBROUTINE gather_omp_r2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarOut))   
+    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_r)
+    
+  END SUBROUTINE gather_omp_r2
+  
+
+  SUBROUTINE gather_omp_r3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    CALL Check_buffer_r(size(VarOut))       
+    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_r)
+    
+  END SUBROUTINE gather_omp_r3
+
+
+  SUBROUTINE gather_omp_l(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    CALL Check_buffer_l(size(VarOut))   
+    CALL gather_omp_lgen(VarIn,Varout,1,buffer_l)
+    
+  END SUBROUTINE gather_omp_l
+
+
+  SUBROUTINE gather_omp_l1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarOut))   
+    CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2),buffer_l)
+    
+  END SUBROUTINE gather_omp_l1
+
+
+  SUBROUTINE gather_omp_l2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarOut))   
+    CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_l)
+    
+  END SUBROUTINE gather_omp_l2
+  
+
+  SUBROUTINE gather_omp_l3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    CALL Check_buffer_l(size(VarOut))   
+    CALL gather_omp_lgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_l)
+    
+  END SUBROUTINE gather_omp_l3
+
+
+
+
+  SUBROUTINE reduce_sum_omp_i(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN)  :: VarIn
+    INTEGER,INTENT(OUT) :: VarOut
+    INTEGER             :: VarIn_tmp(1)
+    INTEGER             :: VarOut_tmp(1)
+    
+    VarIn_tmp(1)=VarIn
+    CALL Check_buffer_i(1)   
+    CALL reduce_sum_omp_igen(VarIn_tmp,Varout_tmp,1,buffer_i)
+    VarOut=VarOut_tmp(1)
+    
+  END SUBROUTINE reduce_sum_omp_i
+
+  SUBROUTINE reduce_sum_omp_i1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarIn))   
+    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
+   
+  END SUBROUTINE reduce_sum_omp_i1
+  
+  
+  SUBROUTINE reduce_sum_omp_i2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    CALL Check_buffer_i(size(VarIn))   
+    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
+  
+  END SUBROUTINE reduce_sum_omp_i2
+
+
+  SUBROUTINE reduce_sum_omp_i3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_i(size(VarIn))   
+    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
+  
+  END SUBROUTINE reduce_sum_omp_i3
+
+
+  SUBROUTINE reduce_sum_omp_i4(VarIn, VarOut)
+    IMPLICIT NONE
+
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+  
+    CALL Check_buffer_i(size(VarIn))   
+    CALL reduce_sum_omp_igen(VarIn,Varout,Size(VarIn),buffer_i)
+  
+  END SUBROUTINE reduce_sum_omp_i4
+
+
+  SUBROUTINE reduce_sum_omp_r(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN)  :: VarIn
+    REAL,INTENT(OUT) :: VarOut
+    REAL             :: VarIn_tmp(1)
+    REAL             :: VarOut_tmp(1)
+    
+    VarIn_tmp(1)=VarIn
+    CALL Check_buffer_r(1)   
+    CALL reduce_sum_omp_rgen(VarIn_tmp,Varout_tmp,1,buffer_r)
+    VarOut=VarOut_tmp(1)
+  
+  END SUBROUTINE reduce_sum_omp_r
+
+  SUBROUTINE reduce_sum_omp_r1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
+   
+  END SUBROUTINE reduce_sum_omp_r1
+  
+  
+  SUBROUTINE reduce_sum_omp_r2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
+  
+  END SUBROUTINE reduce_sum_omp_r2
+
+
+  SUBROUTINE reduce_sum_omp_r3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    CALL Check_buffer_r(size(VarIn))   
+    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
+  
+  END SUBROUTINE reduce_sum_omp_r3
+
+
+  SUBROUTINE reduce_sum_omp_r4(VarIn, VarOut)
+    IMPLICIT NONE
+
+    REAL,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+  
+    CALL Check_buffer_r(size(VarIn))   
+    CALL reduce_sum_omp_rgen(VarIn,Varout,Size(VarIn),buffer_r)
+  
+  END SUBROUTINE reduce_sum_omp_r4
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!    LES ROUTINES GENERIQUES    !
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE bcast_omp_cgen(Var,Nb,Buff)
+  IMPLICIT NONE
+    
+    CHARACTER(LEN=*),INTENT(INOUT) :: Var
+    CHARACTER(LEN=*),INTENT(INOUT) :: Buff
+    INTEGER,INTENT(IN) :: Nb
+    
+    INTEGER :: i
+  
+  !$OMP MASTER
+      Buff=Var
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,Nb
+      Var=Buff
+    ENDDO
+  !$OMP BARRIER      
+  
+  END SUBROUTINE bcast_omp_cgen
+
+
+      
+  SUBROUTINE bcast_omp_igen(Var,Nb,Buff)
+  IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: Nb
+    INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Var
+    INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Buff
+
+    INTEGER :: i
+    
+  !$OMP MASTER
+    DO i=1,Nb
+      Buff(i)=Var(i)
+    ENDDO
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,Nb
+      Var(i)=Buff(i)
+    ENDDO
+  !$OMP BARRIER        
+
+  END SUBROUTINE bcast_omp_igen
+
+
+  SUBROUTINE bcast_omp_rgen(Var,Nb,Buff)
+  IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: Nb
+    REAL,DIMENSION(Nb),INTENT(INOUT) :: Var
+    REAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
+
+    INTEGER :: i
+    
+  !$OMP MASTER
+    DO i=1,Nb
+      Buff(i)=Var(i)
+    ENDDO
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,Nb
+      Var(i)=Buff(i)
+    ENDDO
+  !$OMP BARRIER        
+
+  END SUBROUTINE bcast_omp_rgen
+
+  SUBROUTINE bcast_omp_lgen(Var,Nb,Buff)
+  IMPLICIT NONE
+    
+    INTEGER,INTENT(IN) :: Nb
+    LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Var
+    LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
+  
+    INTEGER :: i
+    
+  !$OMP MASTER
+    DO i=1,Nb
+      Buff(i)=Var(i)
+    ENDDO
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,Nb
+      Var(i)=Buff(i)
+    ENDDO
+  !$OMP BARRIER        
+
+  END SUBROUTINE bcast_omp_lgen
+
+
+  SUBROUTINE scatter_omp_igen(VarIn,VarOut,dimsize,Buff)
+    USE mod_phys_lmdz_omp_data
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+    IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut
+    INTEGER,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+  !$OMP MASTER
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        Buff(ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+ 
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+ 
+  END SUBROUTINE scatter_omp_igen
+
+
+  SUBROUTINE scatter_omp_rgen(VarIn,VarOut,dimsize,Buff)
+  USE mod_phys_lmdz_omp_data
+  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut
+    REAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+  !$OMP MASTER
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        Buff(ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+
+  END SUBROUTINE scatter_omp_rgen
+
+
+  SUBROUTINE scatter_omp_lgen(VarIn,VarOut,dimsize,Buff)
+  USE mod_phys_lmdz_omp_data
+  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN),DIMENSION(klon_mpi,dimsize) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(klon_omp,dimsize) :: VarOut
+    LOGICAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+ !$OMP MASTER 
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        Buff(ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        VarOut(ij,i)=Buff(klon_omp_begin-1+ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+
+  END SUBROUTINE scatter_omp_lgen
+
+
+
+
+
+  SUBROUTINE gather_omp_igen(VarIn,VarOut,dimsize,Buff)
+  USE mod_phys_lmdz_omp_data
+  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+    INTEGER,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+  
+  
+  !$OMP MASTER
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=Buff(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+  END SUBROUTINE gather_omp_igen
+
+
+  SUBROUTINE gather_omp_rgen(VarIn,VarOut,dimsize,Buff)
+  USE mod_phys_lmdz_omp_data
+  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+    REAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+
+
+  !$OMP MASTER
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=Buff(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+  END SUBROUTINE gather_omp_rgen
+
+
+  SUBROUTINE gather_omp_lgen(VarIn,VarOut,dimsize,Buff)
+  USE mod_phys_lmdz_omp_data
+  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi 
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    LOGICAL,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
+    LOGICAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
+
+    INTEGER :: i,ij
+    
+    DO i=1,dimsize
+      DO ij=1,klon_omp
+        Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i)
+      ENDDO
+    ENDDO
+  !$OMP BARRIER  
+
+
+  !$OMP MASTER
+    DO i=1,dimsize
+      DO ij=1,klon_mpi
+        VarOut(ij,i)=Buff(ij,i)
+      ENDDO
+    ENDDO  
+  !$OMP END MASTER
+  !$OMP BARRIER
+
+  END SUBROUTINE gather_omp_lgen
+
+
+  SUBROUTINE reduce_sum_omp_igen(VarIn,VarOut,dimsize,Buff)
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    INTEGER,INTENT(IN),DIMENSION(dimsize) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(dimsize) :: VarOut
+    INTEGER,INTENT(INOUT),DIMENSION(dimsize) :: Buff
+
+    INTEGER :: i
+
+  !$OMP MASTER
+    Buff(:)=0
+  !$OMP END MASTER
+  !$OMP BARRIER
+  
+  !$OMP CRITICAL     
+    DO i=1,dimsize
+      Buff(i)=Buff(i)+VarIn(i)
+    ENDDO
+  !$OMP END CRITICAL
+  !$OMP BARRIER  
+  
+  !$OMP MASTER
+    DO i=1,dimsize
+      VarOut(i)=Buff(i)
+    ENDDO
+  !$OMP END MASTER
+  !$OMP BARRIER
+  
+  END SUBROUTINE reduce_sum_omp_igen
+
+  SUBROUTINE reduce_sum_omp_rgen(VarIn,VarOut,dimsize,Buff)
+  IMPLICIT NONE
+
+    INTEGER,INTENT(IN) :: dimsize
+    REAL,INTENT(IN),DIMENSION(dimsize) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(dimsize) :: VarOut
+    REAL,INTENT(INOUT),DIMENSION(dimsize) :: Buff
+
+    INTEGER :: i
+
+  !$OMP MASTER
+    Buff(:)=0
+  !$OMP END MASTER
+  !$OMP BARRIER
+  
+  !$OMP CRITICAL     
+    DO i=1,dimsize
+      Buff(i)=Buff(i)+VarIn(i)
+    ENDDO
+  !$OMP END CRITICAL
+  !$OMP BARRIER  
+  
+  !$OMP MASTER
+    DO i=1,dimsize
+      VarOut(i)=Buff(i)
+    ENDDO
+  !$OMP END MASTER
+  !$OMP BARRIER
+  
+  END SUBROUTINE reduce_sum_omp_rgen
+
+END MODULE mod_phys_lmdz_omp_transfert
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_para.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_para.F90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_para.F90	(revision 3814)
@@ -0,0 +1,114 @@
+!
+!$Header$
+!
+MODULE mod_phys_lmdz_para
+  USE mod_phys_lmdz_transfert_para
+  USE mod_phys_lmdz_mpi_data
+  USE mod_phys_lmdz_omp_data
+    
+  INTEGER,SAVE :: klon_loc
+  LOGICAL,SAVE :: is_sequential
+  LOGICAL,SAVE :: is_parallel
+  LOGICAL,SAVE :: is_master
+  
+!$OMP THREADPRIVATE(klon_loc,is_master)
+  
+CONTAINS
+
+  SUBROUTINE Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib,communicator)
+  IMPLICIT NONE
+    INTEGER,INTENT(in) :: iim
+    INTEGER,INTENT(in) :: jjp1
+    INTEGER,INTENT(in) :: nb_proc
+    INTEGER,INTENT(in) :: distrib(0:nb_proc-1)
+    INTEGER,INTENT(in) :: communicator
+
+    CALL Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib,communicator)
+!$OMP PARALLEL
+    CALL Init_phys_lmdz_omp_data(klon_mpi)
+    klon_loc=klon_omp
+    IF (is_mpi_root .AND. is_omp_root) THEN 
+       is_master=.TRUE.
+     ELSE
+       is_master=.FALSE.
+     ENDIF
+     CALL Test_transfert
+!$OMP END PARALLEL    
+     IF (is_using_mpi .OR. is_using_omp) THEN
+       is_sequential=.FALSE.
+       is_parallel=.TRUE.
+     ELSE
+       is_sequential=.TRUE.
+       is_parallel=.FALSE.
+     ENDIF
+      
+  END SUBROUTINE Init_phys_lmdz_para
+
+  SUBROUTINE Test_transfert
+  USE mod_grid_phy_lmdz
+  IMPLICIT NONE
+    INCLUDE "iniprint.h"
+ 
+    REAL :: Test_Field1d_glo(klon_glo,nbp_lev)
+    REAL :: tmp1d_glo(klon_glo,nbp_lev)
+    REAL :: Test_Field2d_glo(nbp_lon,nbp_lat,nbp_lev)
+    REAL :: tmp2d_glo(nbp_lon,nbp_lat,nbp_lev)
+    REAL :: Test_Field1d_loc(klon_loc,nbp_lev)
+    REAL :: Test_Field2d_loc(nbp_lon,jj_nb,nbp_lev)
+    REAL :: CheckSum
+    
+    INTEGER :: i,l
+  
+    Test_Field1d_glo = 0.
+    Test_Field2d_glo = 0.
+    Test_Field1d_loc = 0.
+    Test_Field2d_loc = 0.
+  
+    IF (is_mpi_root) THEN
+!$OMP MASTER
+      DO l=1,nbp_lev
+        DO i=1,klon_glo
+!          Test_Field1d_glo(i,l)=MOD(i,10)+10*(l-1)
+           Test_Field1d_glo(i,l)=1
+        ENDDO
+      ENDDO
+!$OMP END MASTER  
+    ENDIF
+  
+    CALL Scatter(Test_Field1d_glo,Test_Field1d_loc)
+    CALL Gather(Test_Field1d_loc,tmp1d_glo)
+  
+    IF (is_mpi_root) THEN
+!$OMP MASTER  
+      Checksum=sum(Test_Field1d_glo-tmp1d_glo)
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
+!$OMP END MASTER
+    ENDIF
+    
+    CALL grid1dTo2d_glo(Test_Field1d_glo,Test_Field2d_glo)
+    CALL scatter2D(Test_Field2d_glo,Test_Field1d_loc)
+    CALL gather2d(Test_Field1d_loc,Test_Field2d_glo)
+    CALL grid2dTo1d_glo(Test_Field2d_glo,tmp1d_glo)
+
+    IF (is_mpi_root) THEN
+!$OMP MASTER  
+      Checksum=sum(Test_Field1d_glo-tmp1d_glo)
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
+!$OMP END MASTER
+    ENDIF
+
+    CALL bcast(Test_Field1d_glo)
+    CALL reduce_sum(Test_Field1d_glo,tmp1d_glo)
+
+    IF (is_mpi_root) THEN
+!$OMP MASTER  
+      Checksum=sum(Test_Field1d_glo*omp_size*mpi_size-tmp1d_glo)
+      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
+!$OMP END MASTER
+    ENDIF
+    
+     
+   END SUBROUTINE Test_transfert
+  
+END MODULE mod_phys_lmdz_para
+    
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_transfert_para.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_transfert_para.F90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_phys_lmdz_transfert_para.F90	(revision 3814)
@@ -0,0 +1,1275 @@
+!
+!$Header$
+!
+MODULE mod_phys_lmdz_transfert_para
+
+  USE mod_phys_lmdz_mpi_transfert
+  USE mod_phys_lmdz_omp_transfert 
+
+
+
+  INTERFACE bcast
+    MODULE PROCEDURE bcast_c,                                     &
+                     bcast_i,bcast_i1,bcast_i2,bcast_i3,bcast_i4, &
+                     bcast_r,bcast_r1,bcast_r2,bcast_r3,bcast_r4, &
+		     bcast_l,bcast_l1,bcast_l2,bcast_l3,bcast_l4
+  END INTERFACE
+
+  INTERFACE scatter
+    MODULE PROCEDURE scatter_i,scatter_i1,scatter_i2,scatter_i3, &
+                     scatter_r,scatter_r1,scatter_r2,scatter_r3, &
+		     scatter_l,scatter_l1,scatter_l2,scatter_l3
+  END INTERFACE
+
+  
+  INTERFACE gather
+    MODULE PROCEDURE gather_i,gather_i1,gather_i2,gather_i3, &
+                     gather_r,gather_r1,gather_r2,gather_r3, &
+		     gather_l,gather_l1,gather_l2,gather_l3  
+  END INTERFACE
+  
+  INTERFACE scatter2D
+    MODULE PROCEDURE scatter2D_i,scatter2D_i1,scatter2D_i2,scatter2D_i3, &
+                     scatter2D_r,scatter2D_r1,scatter2D_r2,scatter2D_r3, &
+		     scatter2D_l,scatter2D_l1,scatter2D_l2,scatter2D_l3
+  END INTERFACE
+
+  INTERFACE gather2D
+    MODULE PROCEDURE gather2D_i,gather2D_i1,gather2D_i2,gather2D_i3, &
+                     gather2D_r,gather2D_r1,gather2D_r2,gather2D_r3, &
+		     gather2D_l,gather2D_l1,gather2D_l2,gather2D_l3
+  END INTERFACE 
+  
+  INTERFACE reduce_sum
+    MODULE PROCEDURE reduce_sum_i,reduce_sum_i1,reduce_sum_i2,reduce_sum_i3,reduce_sum_i4, &
+                     reduce_sum_r,reduce_sum_r1,reduce_sum_r2,reduce_sum_r3,reduce_sum_r4
+  END INTERFACE 
+
+   
+CONTAINS
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Broadcast --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+!! -- Les chaine de charactère -- !!
+
+  SUBROUTINE bcast_c(var)
+  IMPLICIT NONE
+    CHARACTER(LEN=*),INTENT(INOUT) :: Var
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_c
+
+!! -- Les entiers -- !!
+  
+  SUBROUTINE bcast_i(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_i
+
+  SUBROUTINE bcast_i1(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_i1
+
+
+  SUBROUTINE bcast_i2(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_i2
+
+
+  SUBROUTINE bcast_i3(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_i3
+
+
+  SUBROUTINE bcast_i4(var)
+  IMPLICIT NONE
+    INTEGER,INTENT(INOUT) :: Var(:,:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_i4
+
+ 
+!! -- Les reels -- !!
+  
+  SUBROUTINE bcast_r(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var
+
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_r
+
+  SUBROUTINE bcast_r1(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_r1
+
+
+  SUBROUTINE bcast_r2(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_r2
+
+
+  SUBROUTINE bcast_r3(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_r3
+
+
+  SUBROUTINE bcast_r4(var)
+  IMPLICIT NONE
+    REAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_r4 
+
+
+!! -- Les booleens -- !!
+  
+  SUBROUTINE bcast_l(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_l
+
+  SUBROUTINE bcast_l1(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_l1
+
+
+  SUBROUTINE bcast_l2(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_l2
+
+
+  SUBROUTINE bcast_l3(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_l3
+
+
+  SUBROUTINE bcast_l4(var)
+  IMPLICIT NONE
+    LOGICAL,INTENT(INOUT) :: Var(:,:,:,:)
+   
+!$OMP MASTER
+    CALL bcast_mpi(Var)
+!$OMP END MASTER
+    CALL bcast_omp(Var)
+    
+  END SUBROUTINE bcast_l4
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Scatter   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+  SUBROUTINE scatter_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi) :: Var_tmp
+    
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_i
+
+
+  SUBROUTINE scatter_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_i1
+
+
+  SUBROUTINE scatter_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_i2
+
+
+  SUBROUTINE scatter_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,VarOut)
+    
+  END SUBROUTINE scatter_i3
+
+
+  SUBROUTINE scatter_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi) :: Var_tmp
+    
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_r
+
+
+  SUBROUTINE scatter_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_r1
+
+
+  SUBROUTINE scatter_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_r2
+
+
+  SUBROUTINE scatter_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,VarOut)
+    
+  END SUBROUTINE scatter_r3
+  
+  
+
+  SUBROUTINE scatter_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp
+    
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_l
+
+
+  SUBROUTINE scatter_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_l1
+
+
+  SUBROUTINE scatter_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,Varout)
+    
+  END SUBROUTINE scatter_l2
+
+
+  SUBROUTINE scatter_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi,SIZE(Varout,2),SIZE(Varout,3),SIZE(Varout,4)) :: Var_tmp
+
+!$OMP MASTER
+      CALL scatter_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+      CALL scatter_omp(Var_tmp,VarOut)
+    
+  END SUBROUTINE scatter_l3
+
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Gather   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ 
+!!!!! --> Les entiers
+
+  SUBROUTINE gather_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    INTEGER, DIMENSION(klon_mpi) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,Varout)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_i
+
+
+  SUBROUTINE gather_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,Varout)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_i1
+
+
+  SUBROUTINE gather_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_i2
+
+
+  SUBROUTINE gather_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    INTEGER, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_i3
+
+
+!!!!! --> Les reels
+
+  SUBROUTINE gather_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    REAL, DIMENSION(klon_mpi) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_r
+
+
+  SUBROUTINE gather_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_r1
+
+
+  SUBROUTINE gather_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_r2
+
+
+  SUBROUTINE gather_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    REAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_r3
+
+
+!!!!! --> Les booleens
+
+  SUBROUTINE gather_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    LOGICAL, DIMENSION(klon_mpi) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_l
+
+
+  SUBROUTINE gather_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_l1
+
+
+  SUBROUTINE gather_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_l2
+
+
+  SUBROUTINE gather_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    LOGICAL, DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+    
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE gather_l3
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Scatter2D   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+!!!!! --> Les entiers
+
+  SUBROUTINE scatter2D_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_i
+
+
+  SUBROUTINE scatter2D_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_i1
+  
+
+  SUBROUTINE scatter2D_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_i2  
+
+
+  SUBROUTINE scatter2D_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_i3
+  
+
+!!!!! --> Les reels
+
+  SUBROUTINE scatter2D_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_r
+
+
+  SUBROUTINE scatter2D_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_r1
+  
+
+  SUBROUTINE scatter2D_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_r2  
+
+
+  SUBROUTINE scatter2D_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    REAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_r3
+    
+    
+!!!!! --> Les booleens
+
+
+  SUBROUTINE scatter2D_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_l
+
+
+  SUBROUTINE scatter2D_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_l1
+  
+
+  SUBROUTINE scatter2D_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_l2  
+
+
+  SUBROUTINE scatter2D_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarOut,2),SIZE(VarOut,3),SIZE(VarOut,4)) :: Var_tmp    
+
+!$OMP MASTER    
+    CALL scatter2D_mpi(VarIn,Var_tmp)
+!$OMP END MASTER
+    CALL scatter_omp(Var_tmp,VarOut)
+
+  END SUBROUTINE scatter2D_l3
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des Gather2D   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+!!!!! --> Les entiers
+
+  SUBROUTINE gather2D_i(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_mpi) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_i
+  
+
+  SUBROUTINE gather2D_i1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_i1
+
+  
+  SUBROUTINE gather2D_i2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_i2
+
+
+  SUBROUTINE gather2D_i3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_i3
+
+
+!!!!! --> Les reels
+
+  SUBROUTINE gather2D_r(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_mpi) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_r
+  
+
+  SUBROUTINE gather2D_r1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_r1
+
+  
+  SUBROUTINE gather2D_r2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_r2
+
+
+  SUBROUTINE gather2D_r3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_r3
+  
+
+!!!!! --> Les booleens
+
+  SUBROUTINE gather2D_l(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_mpi) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_l
+  
+
+  SUBROUTINE gather2D_l1(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_l1
+
+  
+  SUBROUTINE gather2D_l2(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_l2
+
+
+  SUBROUTINE gather2D_l3(VarIn, VarOut)
+    USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
+    IMPLICIT NONE
+  
+    LOGICAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
+    LOGICAL,INTENT(OUT),DIMENSION(:,:,:,:,:) :: VarOut
+    
+    LOGICAL,DIMENSION(klon_mpi,SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4)) :: Var_tmp
+
+    CALL gather_omp(VarIn,Var_tmp)
+!$OMP MASTER
+    CALL gather2D_mpi(Var_tmp,VarOut)
+!$OMP END MASTER    
+
+  END SUBROUTINE gather2D_l3
+  
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Definition des reduce_sum   --> 4D   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! Les entiers
+
+  SUBROUTINE reduce_sum_i(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN)  :: VarIn
+    INTEGER,INTENT(OUT) :: VarOut
+    
+    INTEGER             :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_i  
+
+
+  SUBROUTINE reduce_sum_i1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    INTEGER,DIMENSION(SIZE(VarIn))   :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_i1  
+
+
+  SUBROUTINE reduce_sum_i2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2)) :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_i2  
+  
+
+  SUBROUTINE reduce_sum_i3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3))  :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_i3  
+
+
+  SUBROUTINE reduce_sum_i4(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    INTEGER,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    INTEGER,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    INTEGER,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))  :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_i4  
+
+
+! Les reels
+
+  SUBROUTINE reduce_sum_r(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN)  :: VarIn
+    REAL,INTENT(OUT) :: VarOut
+    
+    REAL             :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_r  
+
+
+  SUBROUTINE reduce_sum_r1(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
+    
+    REAL,DIMENSION(SIZE(VarIn))   :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_r1  
+
+
+  SUBROUTINE reduce_sum_r2(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
+    
+    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2)) :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_r2  
+  
+
+  SUBROUTINE reduce_sum_r3(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
+    
+    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3))  :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_r3  
+
+
+  SUBROUTINE reduce_sum_r4(VarIn, VarOut)
+    IMPLICIT NONE
+  
+    REAL,INTENT(IN),DIMENSION(:,:,:,:)  :: VarIn
+    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
+    
+    REAL,DIMENSION(SIZE(VarIn,1),SIZE(VarIn,2),SIZE(VarIn,3),SIZE(VarIn,4))  :: Var_tmp
+           
+    CALL reduce_sum_omp(VarIn,Var_tmp)
+!$OMP MASTER      
+    CALL reduce_sum_mpi(Var_tmp,VarOut)
+!$OMP END MASTER
+  
+  END SUBROUTINE reduce_sum_r4  
+
+   
+END MODULE mod_phys_lmdz_transfert_para
+
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_surf_para.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_surf_para.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/mod_surf_para.F90	(revision 3814)
@@ -49,5 +49,5 @@
 
   SUBROUTINE Init_surf_para(knon)
-  USE mod_phys_lmdz_para, mpi_rank_root=>mpi_root
+  USE mod_phys_lmdz_para
 #ifdef CPP_MPI
   INCLUDE 'mpif.h'
@@ -168,5 +168,5 @@
      
   SUBROUTINE gather_surf_mpi_i(FieldIn,FieldOut)
-  USE mod_phys_lmdz_para, mpi_rank_root => mpi_root
+  USE mod_phys_lmdz_para
 #ifdef CPP_MPI
   INCLUDE 'mpif.h'
@@ -180,5 +180,5 @@
       CALL MPI_Gatherv(FieldIn,knon_mpi,MPI_INTEGER,                                &
                        FieldOut,knon_mpi_para,knon_mpi_begin_para(:)-1,MPI_INTEGER, &
-                       mpi_rank_root,COMM_LMDZ_PHY,ierr)
+                       mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
     ELSE
@@ -223,5 +223,5 @@
      
   SUBROUTINE gather_surf_mpi_r(FieldIn,FieldOut)
-  USE mod_phys_lmdz_para, mpi_rank_root => mpi_root
+  USE mod_phys_lmdz_para
 #ifdef CPP_MPI
   INCLUDE 'mpif.h'
@@ -235,5 +235,5 @@
       CALL MPI_Gatherv(FieldIn,knon_mpi,MPI_REAL_LMDZ,                                 &
                        FieldOut,knon_mpi_para,knon_mpi_begin_para(:)-1,MPI_REAL_LMDZ,  &
-                       mpi_rank_root,COMM_LMDZ_PHY,ierr)            
+                       mpi_master,COMM_LMDZ_PHY,ierr)            
 #endif
     ELSE
@@ -276,5 +276,5 @@
      
   SUBROUTINE scatter_surf_mpi_i(FieldIn,FieldOut)
-  USE mod_phys_lmdz_para, mpi_rank_root => mpi_root
+  USE mod_phys_lmdz_para
 #ifdef CPP_MPI
   INCLUDE 'mpif.h'
@@ -288,5 +288,5 @@
       CALL MPI_Scatterv(FieldIn,knon_mpi_para,knon_mpi_begin_para(:)-1,MPI_INTEGER,   &
                         FieldOut,knon_mpi,MPI_INTEGER,                                &
-                        mpi_rank_root,COMM_LMDZ_PHY,ierr)
+                        mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
     ELSE
@@ -328,5 +328,5 @@
      
   SUBROUTINE scatter_surf_mpi_r(FieldIn,FieldOut)
-  USE mod_phys_lmdz_para, mpi_rank_root => mpi_root
+  USE mod_phys_lmdz_para
 #ifdef CPP_MPI
   INCLUDE 'mpif.h'
@@ -340,5 +340,5 @@
       CALL MPI_Scatterv(FieldIn,knon_mpi_para,knon_mpi_begin_para(:)-1,MPI_INTEGER,   &
                         FieldOut,knon_mpi,MPI_INTEGER,                                &
-                        mpi_rank_root,COMM_LMDZ_PHY,ierr)
+                        mpi_master,COMM_LMDZ_PHY,ierr)
 #endif
     ELSE
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/o3_chem_m.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/o3_chem_m.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/o3_chem_m.F90	(revision 3814)
@@ -20,5 +20,6 @@
     use dimphy, only: klon
     use regr_pr_comb_coefoz_m, only: c_Mob, a4_mass, a2, r_het_interm
-
+    use comconst_phy_mod
+    
     integer, intent(in):: julien ! jour julien, 1 <= julien <= 360
     real, intent(in):: gmtime ! heure de la journée en fraction de jour
@@ -39,5 +40,4 @@
     ! Variables local to the procedure:
     include "dimensions.h"
-    include "comconst.h"
     ! (for "pi")
     integer k
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/o3cm.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/o3cm.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/o3cm.F90	(revision 3814)
@@ -32,5 +32,5 @@
   IF (ntab>499) THEN
     abort_message = 'BIG ntab'
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
   xincr = (bmb-amb)/real(ntab)
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/oasis.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/oasis.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/oasis.F90	(revision 3814)
@@ -218,5 +218,5 @@
        IF (ierror .NE. PRISM_Ok) THEN
           abort_message=' Probleme init dans prism_init_comp '
-          CALL abort_gcm(modname,abort_message,1)
+          CALL abort_physic(modname,abort_message,1)
        ELSE
           WRITE(lunout,*) 'inicma : init psmile ok '
@@ -240,5 +240,5 @@
     IF (ierror .NE. PRISM_Ok) THEN
        abort_message=' Probleme dans prism_def_partition '
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ELSE
        WRITE(lunout,*) 'inicma : decomposition domaine psmile ok '
@@ -268,5 +268,5 @@
                   inforecv(jf)%name
              abort_message=' Problem in call to prism_def_var_proto for fields to receive'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -286,5 +286,5 @@
                   infosend(jf)%name
              abort_message=' Problem in call to prism_def_var_proto for fields to send'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -297,5 +297,5 @@
     IF (ierror .NE. PRISM_Ok) THEN
        abort_message=' Problem in call to prism_endef_proto'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ELSE
        WRITE(lunout,*) 'inicma : endef psmile ok '
@@ -362,5 +362,5 @@
               WRITE (lunout,*)  'Error with receiving filed : ', inforecv(i)%name, ktime   
               abort_message=' Problem in prism_get_proto '
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
           ENDIF
       ENDIF
@@ -444,5 +444,5 @@
               WRITE (lunout,*) 'Error with sending field :', infosend(i)%name, ktime   
               abort_message=' Problem in prism_put_proto '
-              CALL abort_gcm(modname,abort_message,1)
+              CALL abort_physic(modname,abort_message,1)
           ENDIF
       ENDIF
@@ -459,5 +459,5 @@
           IF (ierror .NE. PRISM_Ok) THEN
              abort_message=' Problem in prism_terminate_proto '
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/ocean_slab_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/ocean_slab_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/ocean_slab_mod.F90	(revision 3814)
@@ -110,5 +110,5 @@
     IF (error /= 0) THEN
        abort_message='Pb allocation tmp_pctsrf_slab'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
     fsic(:)=0.
@@ -121,5 +121,5 @@
 !****************************************************************************************
     ALLOCATE(tslab(klon,nslay), stat=error)
-       IF (error /= 0) CALL abort_gcm &
+       IF (error /= 0) CALL abort_physic &
          (modname,'pb allocation tslab', 1)
 
@@ -127,5 +127,5 @@
     IF (error /= 0) THEN
        abort_message='Pb allocation slab_bils'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
     slab_bils(:) = 0.0   
@@ -133,5 +133,5 @@
     IF (error /= 0) THEN
        abort_message='Pb allocation slab_bils_cum'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
     bils_cum(:) = 0.0   
@@ -141,5 +141,5 @@
         IF (error /= 0) THEN
            abort_message='Pb allocation slab_bilg'
-           CALL abort_gcm(modname,abort_message,1)
+           CALL abort_physic(modname,abort_message,1)
         ENDIF
         slab_bilg(:) = 0.0   
@@ -147,5 +147,5 @@
         IF (error /= 0) THEN
            abort_message='Pb allocation slab_bilg_cum'
-           CALL abort_gcm(modname,abort_message,1)
+           CALL abort_physic(modname,abort_message,1)
         ENDIF
         bilg_cum(:) = 0.0   
@@ -153,10 +153,10 @@
         IF (error /= 0) THEN
            abort_message='Pb allocation slab_tice'
-           CALL abort_gcm(modname,abort_message,1)
+           CALL abort_physic(modname,abort_message,1)
         ENDIF
         ALLOCATE(seaice(klon), stat = error)
         IF (error /= 0) THEN
            abort_message='Pb allocation slab_seaice'
-           CALL abort_gcm(modname,abort_message,1)
+           CALL abort_physic(modname,abort_message,1)
         ENDIF
     END IF
@@ -169,5 +169,5 @@
     IF (error /= 0) THEN
        abort_message='Pb allocation slabh'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
     slabh(1)=50.
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/orografi.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/orografi.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/orografi.F90	(revision 3814)
@@ -1369,5 +1369,5 @@
   IF (nlon/=klon .OR. nlev/=klev) THEN
     abort_message = 'pb dimension'
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
   zcons1 = 1./rd
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/orografi_strato.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/orografi_strato.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/orografi_strato.F90	(revision 3814)
@@ -1558,5 +1558,5 @@
   IF (nlon/=klon .OR. nlev/=klev) THEN
     abort_message = 'pb dimension'
-    CALL abort_gcm(modname, abort_message, 1)
+    CALL abort_physic(modname, abort_message, 1)
   END IF
   zcons1 = 1./rd
@@ -1873,5 +1873,5 @@
   PRINT *, ' DANS SUGWD nktopg=', nktopg
   PRINT *, ' DANS SUGWD nstra=', nstra
-  if (nstra == 0) call abort_gcm("sugwd_strato", "no level in stratosphere", 1)
+  if (nstra == 0) call abort_physic("sugwd_strato", "no level in stratosphere", 1)
 
   gsigcr = 0.80
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/pbl_surface_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/pbl_surface_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/pbl_surface_mod.F90	(revision 3814)
@@ -23,5 +23,5 @@
   USE climb_wind_mod,      ONLY : climb_wind_down, climb_wind_up
   USE coef_diff_turb_mod,  ONLY : coef_diff_turb
-  USE control_mod
+  USE control_phy_mod
 
 
@@ -73,14 +73,14 @@
 !****************************************************************************************    
     ALLOCATE(fder(klon), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('pbl_surface_init', 'pb in allocation',1)
+    IF (ierr /= 0) CALL abort_physic('pbl_surface_init', 'pb in allocation',1)
 
     ALLOCATE(snow(klon,nbsrf), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('pbl_surface_init', 'pb in allocation',1)
+    IF (ierr /= 0) CALL abort_physic('pbl_surface_init', 'pb in allocation',1)
 
     ALLOCATE(qsurf(klon,nbsrf), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('pbl_surface_init', 'pb in allocation',1)
+    IF (ierr /= 0) CALL abort_physic('pbl_surface_init', 'pb in allocation',1)
 
     ALLOCATE(ftsoil(klon,nsoilmx,nbsrf), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('pbl_surface_init', 'pb in allocation',1)
+    IF (ierr /= 0) CALL abort_physic('pbl_surface_init', 'pb in allocation',1)
 
 
@@ -100,5 +100,5 @@
       WRITE(lunout,*)"or on doit commencer par les surfaces continentales"
       abort_message="voir ci-dessus"
-      CALL abort_gcm(modname,abort_message,1)
+      CALL abort_physic(modname,abort_message,1)
     ENDIF
 
@@ -109,5 +109,5 @@
       WRITE(lunout,*)' or is_oce = ',is_oce, '> is_sic = ',is_sic
       abort_message='voir ci-dessus'
-      CALL abort_gcm(modname,abort_message,1)
+      CALL abort_physic(modname,abort_message,1)
     ENDIF
 
@@ -118,5 +118,5 @@
       WRITE(lunout,*)' or is_lic = ',is_lic, '> is_sic = ',is_sic
       abort_message='voir ci-dessus'
-      CALL abort_gcm(modname,abort_message,1)
+      CALL abort_physic(modname,abort_message,1)
     ENDIF
 
@@ -130,5 +130,5 @@
        WRITE(lunout,*)'Option couplage pour l''ocean = ', type_ocean
        abort_message='option pour l''ocean non valable'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
     ENDIF
 
@@ -261,5 +261,5 @@
     USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send
     USE indice_sol_mod
-
+    USE temps_phy_mod
     IMPLICIT NONE
 
@@ -272,5 +272,4 @@
     INCLUDE "compbl.h"
     INCLUDE "dimensions.h"
-    INCLUDE "temps.h"
     INCLUDE "flux_arp.h"
 !****************************************************************************************
@@ -1837,5 +1836,5 @@
           WRITE(lunout,*) 'Surface index = ', nsrf
           abort_message = 'Surface index not valid'
-          CALL abort_gcm(modname,abort_message,1)
+          CALL abort_physic(modname,abort_message,1)
        END SELECT
 
@@ -3049,5 +3048,5 @@
                 ! Security abort. This option has never been tested. To test, comment the following line.
 !                abort_message='The fraction of the continents have changed!'
-!                CALL abort_gcm(modname,abort_message,1)
+!                CALL abort_physic(modname,abort_message,1)
                 nfois(nsrf) = nfois(nsrf) + 1
              END IF
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phyaqua_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phyaqua_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phyaqua_mod.F90	(revision 3814)
@@ -25,7 +25,8 @@
     USE fonte_neige_mod, ONLY: fonte_neige_init
     USE phys_state_var_mod
-    USE control_mod, ONLY: dayref, nday, iphysiq
+    USE control_phy_mod, ONLY: dayref, nday, iphysiq
     USE indice_sol_mod
-
+    USE temps_phy_mod
+    USE comconst_phy_mod
     USE ioipsl
     IMPLICIT NONE
@@ -34,8 +35,8 @@
     ! #include "dimphy.h"
     ! #include "YOMCST.h"
-    include "comconst.h"
+!    include "comconst.h"
     include "clesphys.h"
     include "dimsoil.h"
-    include "temps.h"
+!    include "temps.h"
 
     INTEGER, INTENT (IN) :: nlon, iflag_phys
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phyetat0.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phyetat0.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phyetat0.F90	(revision 3814)
@@ -21,9 +21,10 @@
        zstd, zthe, zval, ale_bl, ale_bl_trig, alp_bl
   USE iostart, ONLY : close_startphy, get_field, get_var, open_startphy
-  USE infotrac, only: nbtr, type_trac, tname, niadv
+  USE infotrac_phy, only: nbtr, type_trac, tname, niadv
   USE traclmdz_mod,    ONLY : traclmdz_from_restart
   USE carbon_cycle_mod, ONLY : carbon_cycle_tr, carbon_cycle_cpl, co2_send
   USE indice_sol_mod, only: nbsrf, is_ter, epsfra, is_lic, is_oce, is_sic
   USE ocean_slab_mod, ONLY: tslab, seaice, tice, ocean_slab_init
+  USE temps_phy_mod
 
   IMPLICIT none
@@ -36,5 +37,4 @@
   include "dimsoil.h"
   include "clesphys.h"
-  include "temps.h"
   include "thermcell.h"
   include "compbl.h"
@@ -211,5 +211,5 @@
         IF (nsrf.GT.99) THEN
            PRINT*, "Trop de sous-mailles"
-           call abort_gcm("phyetat0", "", 1)
+           call abort_physic("phyetat0", "", 1)
         ENDIF
         WRITE(str2, '(i2.2)') nsrf
@@ -248,5 +248,5 @@
         IF (isw.GT.99 .AND. nsrf.GT.99) THEN
            PRINT*, "Trop de bandes SW ou sous-mailles"
-           call abort_gcm("phyetat0", "", 1)
+           call abort_physic("phyetat0", "", 1)
         ENDIF
         WRITE(str7, '(i2.2, "srf", i2.2)') isw, nsrf
@@ -278,5 +278,5 @@
         IF (isoil.GT.99 .AND. nsrf.GT.99) THEN
            PRINT*, "Trop de couches ou sous-mailles"
-           call abort_gcm("phyetat0", "", 1)
+           call abort_physic("phyetat0", "", 1)
         ENDIF
         WRITE(str7, '(i2.2, "srf", i2.2)') isoil, nsrf
@@ -303,5 +303,5 @@
         IF (nsrf.GT.99) THEN
            PRINT*, "Trop de sous-mailles"
-           call abort_gcm("phyetat0", "", 1)
+           call abort_physic("phyetat0", "", 1)
         ENDIF
         WRITE(str2, '(i2.2)') nsrf
@@ -358,5 +358,5 @@
         IF (nsrf.GT.99) THEN
            PRINT*, "Trop de sous-mailles"
-           call abort_gcm("phyetat0", "", 1)
+           call abort_physic("phyetat0", "", 1)
         ENDIF
         WRITE(str2, '(i2.2)') nsrf
@@ -396,5 +396,5 @@
         IF (nsrf.GT.99) THEN
            PRINT*, "Trop de sous-mailles"
-           call abort_gcm("phyetat0", "", 1)
+           call abort_physic("phyetat0", "", 1)
         ENDIF
         WRITE(str2, '(i2.2)') nsrf
@@ -533,5 +533,5 @@
         IF (nsrf.GT.99) THEN
            PRINT*, "Trop de sous-mailles"
-           call abort_gcm("phyetat0", "", 1)
+           call abort_physic("phyetat0", "", 1)
         ENDIF
         WRITE(str2, '(i2.2)') nsrf
@@ -570,5 +570,5 @@
         IF (nsrf.GT.99) THEN
            PRINT*, "Trop de sous-mailles"
-           call abort_gcm("phyetat0", "", 1)
+           call abort_physic("phyetat0", "", 1)
         ENDIF
         WRITE(str2, '(i2.2)') nsrf
@@ -695,5 +695,5 @@
         IF (nsrf.GT.99) THEN
            PRINT*, "Trop de sous-mailles"
-           call abort_gcm("phyetat0", "", 1)
+           call abort_physic("phyetat0", "", 1)
         ENDIF
         WRITE(str2, '(i2.2)') nsrf
@@ -715,5 +715,5 @@
       IF (nsrf.GT.99) THEN
         PRINT*, "Trop de sous-mailles"
-        call abort_gcm("phyetat0", "", 1)
+        call abort_physic("phyetat0", "", 1)
       ENDIF
       WRITE(str2,'(i2.2)') nsrf
@@ -734,5 +734,5 @@
        IF (nsrf.GT.99) THEN
          PRINT*, "Trop de sous-mailles"
-         call abort_gcm("phyetat0", "", 1)
+         call abort_physic("phyetat0", "", 1)
        ENDIF
        WRITE(str2,'(i2.2)') nsrf
@@ -923,5 +923,5 @@
      IF (nbsrf.GT.99) THEN
         WRITE(lunout,*) "Trop de sous-mailles"
-        call abort_gcm("phyetat0", "", 1)
+        call abort_physic("phyetat0", "", 1)
      ENDIF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phyredem.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phyredem.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phyredem.F90	(revision 3814)
@@ -11,10 +11,11 @@
   USE iostart
   USE traclmdz_mod, ONLY : traclmdz_to_restart
-  USE infotrac
-  USE control_mod
+  USE infotrac_phy
+  USE control_phy_mod
   USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send
   USE indice_sol_mod
   USE surface_data
   USE ocean_slab_mod, ONLY : tslab, seaice, tice, fsic
+  USE temps_phy_mod
 
   IMPLICIT none
@@ -26,5 +27,4 @@
   include "dimsoil.h"
   include "clesphys.h"
-  include "temps.h"
   include "thermcell.h"
   include "compbl.h"
@@ -133,5 +133,5 @@
      ELSE
         PRINT*, "Trop de sous-mailles"
-        call abort_gcm("phyredem", "", 1)
+        call abort_physic("phyredem", "", 1)
      ENDIF
   ENDDO
@@ -150,5 +150,5 @@
         ELSE
            PRINT*, "Trop de couches"
-           call abort_gcm("phyredem", "", 1)
+           call abort_physic("phyredem", "", 1)
         ENDIF
      ENDDO
@@ -164,5 +164,5 @@
         ELSE
            PRINT*, "Trop de couches"
-           call abort_gcm("phyredem", "", 1)
+           call abort_physic("phyredem", "", 1)
         ENDIF
      ENDDO
@@ -176,5 +176,5 @@
      ELSE
         PRINT*, "Trop de sous-mailles"
-        call abort_gcm("phyredem", "", 1)
+        call abort_physic("phyredem", "", 1)
      ENDIF
   END DO
@@ -189,5 +189,5 @@
      ELSE
         PRINT*, "Trop de sous-mailles"
-        call abort_gcm("phyredem", "", 1)
+        call abort_physic("phyredem", "", 1)
      ENDIF
   ENDDO
@@ -200,5 +200,5 @@
      ELSE
         PRINT*, "Trop de sous-mailles"
-        call abort_gcm("phyredem", "", 1)
+        call abort_physic("phyredem", "", 1)
      ENDIF
   ENDDO
@@ -227,5 +227,5 @@
      ELSE
         PRINT*, "Trop de sous-mailles"
-        call abort_gcm("phyredem", "", 1)
+        call abort_physic("phyredem", "", 1)
      ENDIF
   ENDDO
@@ -239,5 +239,5 @@
      ELSE
         PRINT*, "Trop de sous-mailles"
-        call abort_gcm("phyredem", "", 1)
+        call abort_physic("phyredem", "", 1)
      ENDIF
   ENDDO
@@ -287,5 +287,5 @@
         ELSE
            PRINT*, "Trop de sous-mailles"
-           call abort_gcm("phyredem", "", 1)
+           call abort_physic("phyredem", "", 1)
         ENDIF
      ENDDO
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_local_var_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_local_var_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_local_var_mod.F90	(revision 3814)
@@ -375,5 +375,5 @@
 SUBROUTINE phys_local_var_init
 USE dimphy
-USE infotrac, ONLY : nbtr
+USE infotrac_phy, ONLY : nbtr
 USE aero_mod
 USE indice_sol_mod
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_output_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_output_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_output_mod.F90	(revision 3814)
@@ -36,5 +36,5 @@
     USE iophy 
     USE dimphy
-    USE infotrac
+    USE infotrac_phy
     USE ioipsl
     USE phys_cal_mod, only : hour
@@ -45,5 +45,6 @@
     USE phys_output_ctrlout_mod
     USE mod_grid_phy_lmdz, only: klon_glo
-
+    USE temps_phy_mod
+    Use comvert_phy_mod
 #ifdef CPP_XIOS
     ! ug Pour les sorties XIOS
@@ -53,8 +54,6 @@
     IMPLICIT NONE
     include "dimensions.h"
-    include "temps.h"
     include "clesphys.h"
     include "thermcell.h"
-    include "comvert.h"
     include "iniprint.h"
 
@@ -523,5 +522,6 @@
     use ioipsl
     USE phys_cal_mod
-
+    USE comconst_phy_mod
+    USE temps_phy_mod
     IMPLICIT NONE
 
@@ -531,6 +531,4 @@
     real                :: ttt,xxx,timestep,dayseconde,dtime
     parameter (dayseconde=86400.)
-    include "temps.h"
-    include "comconst.h"
     include "iniprint.h"
 
@@ -540,5 +538,5 @@
     WRITE(lunout,*) "ipos = ", ipos
     WRITE(lunout,*) "il = ", il
-    if (ipos == 0) call abort_gcm("convers_timesteps", "bad str", 1)
+    if (ipos == 0) call abort_physic("convers_timesteps", "bad str", 1)
     read(str(1:ipos),*) ttt
     WRITE(lunout,*)ttt
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_output_write_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_output_write_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_output_write_mod.F90	(revision 3814)
@@ -25,5 +25,5 @@
 
     USE dimphy, only: klon, klev, klevp1, nslay
-    USE control_mod, only: day_step, iphysiq
+    USE control_phy_mod, only: day_step, iphysiq
     USE phys_output_ctrlout_mod, only: o_phis, o_aire, is_ter, is_lic, is_oce, &
          is_ave, is_sic, o_contfracATM, o_contfracOR, &
@@ -232,5 +232,5 @@
     USE pbl_surface_mod, only: snow
     USE indice_sol_mod, only: nbsrf
-    USE infotrac, only: nqtot, nqo, type_trac
+    USE infotrac_phy, only: nqtot, nqo, type_trac
     USE comgeomphy, only: airephy
     USE surface_data, only: type_ocean, version_ocean, ok_veget, ok_snow
@@ -247,10 +247,9 @@
 #endif
     USE phys_cal_mod, only : mth_len
-
+    USE temps_phy_mod
 
     IMPLICIT NONE
 
 
-    INCLUDE "temps.h"
     INCLUDE "clesphys.h"
     INCLUDE "thermcell.h"
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_state_var_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_state_var_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phys_state_var_mod.F90	(revision 3814)
@@ -402,7 +402,7 @@
 SUBROUTINE phys_state_var_init(read_climoz)
 USE dimphy
-USE control_mod
+!USE control_mod
 USE aero_mod
-USE infotrac, ONLY : nbtr
+USE infotrac_phy, ONLY : nbtr
 USE indice_sol_mod
 IMPLICIT NONE
@@ -587,5 +587,5 @@
 SUBROUTINE phys_state_var_end
 USE dimphy
-USE control_mod
+!USE control_mod
 USE indice_sol_mod
 IMPLICIT NONE
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/physiq.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/physiq.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/physiq.F90	(revision 3814)
@@ -17,5 +17,5 @@
   USE write_field_phy
   USE dimphy
-  USE infotrac
+  USE infotrac_phy
   USE mod_grid_phy_lmdz
   USE mod_phys_lmdz_para
@@ -46,5 +46,6 @@
   use radlwsw_m, only: radlwsw
   use phyaqua_mod, only: zenang_an
-  USE control_mod
+  USE control_phy_mod
+  USE temps_phy_mod
 #ifdef REPROBUS
   USE CHEM_REP, ONLY : Init_chem_rep_xjour
@@ -114,5 +115,5 @@
   include "dimsoil.h"
   include "clesphys.h"
-  include "temps.h"
+!  include "temps.h"
   include "iniprint.h"
   include "thermcell.h"
@@ -516,8 +517,4 @@
   EXTERNAL suphel    ! initialiser certaines constantes
   EXTERNAL transp    ! transport total de l'eau et de l'energie
-  EXTERNAL ecribina  ! ecrire le fichier binaire global
-  EXTERNAL ecribins  ! ecrire le fichier binaire global
-  EXTERNAL ecrirega  ! ecrire le fichier binaire regional
-  EXTERNAL ecriregs  ! ecrire le fichier binaire regional
   !IM
   EXTERNAL haut2bas  !variables de haut en bas
@@ -1031,5 +1028,5 @@
      IF (iflag_con.EQ.2.AND.iflag_cld_th.GT.-1) THEN
         abort_message = 'Tiedtke needs iflag_cld_th=-2 or -1'
-        CALL abort_gcm (modname,abort_message,1)
+        CALL abort_physic (modname,abort_message,1)
      ENDIF
      !
@@ -1090,5 +1087,5 @@
              pdtphys
         abort_message='Pas physique n est pas correct '
-        !           call abort_gcm(modname,abort_message,1)
+
         dtime=pdtphys
      ENDIF
@@ -1097,5 +1094,5 @@
              klon
         abort_message='nlon et klon ne sont pas coherents'
-        call abort_gcm(modname,abort_message,1)
+        call abort_physic(modname,abort_message,1)
      ENDIF
      IF (nlev .NE. klev) THEN
@@ -1103,5 +1100,5 @@
              klev
         abort_message='nlev et klev ne sont pas coherents'
-        call abort_gcm(modname,abort_message,1)
+        call abort_physic(modname,abort_message,1)
      ENDIF
      !
@@ -1110,5 +1107,5 @@
         WRITE(lunout,*)"Au minimum 4 appels par jour si cycle diurne"
         abort_message='Nbre d appels au rayonnement insuffisant'
-        call abort_gcm(modname,abort_message,1)
+        call abort_physic(modname,abort_message,1)
      ENDIF
      WRITE(lunout,*)"Clef pour la convection, iflag_con=", iflag_con
@@ -1165,5 +1162,5 @@
            IF(nCFMIP.GT.npCFMIP) THEN
               print*,'nCFMIP > npCFMIP : augmenter npCFMIP et recompiler'
-              call abort_gcm("physiq", "", 1)
+              call abort_physic("physiq", "", 1)
            else
               print*,'physiq npCFMIP=',npCFMIP,'nCFMIP=',nCFMIP
@@ -1664,5 +1661,5 @@
         IF (read_climoz/=-1) THEN
            abort_message ='read_climoz=-1 is recommended when solarlong0=1000.'
-           CALL abort_gcm (modname,abort_message,1)
+           CALL abort_physic (modname,abort_message,1)
         ENDIF
      ELSE
@@ -2047,5 +2044,5 @@
   IF (iflag_con.EQ.1) THEN
      abort_message ='reactiver le call conlmd dans physiq.F'
-     CALL abort_gcm (modname,abort_message,1)
+     CALL abort_physic (modname,abort_message,1)
      !     CALL conlmd (dtime, paprs, pplay, t_seri, q_seri, conv_q,
      !    .             d_t_con, d_q_con,
@@ -2185,5 +2182,5 @@
            else
        abort_message ='Ne pas passer la car www non calcule'
-       CALL abort_gcm (modname,abort_message,1)
+       CALL abort_physic (modname,abort_message,1)
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -2351,5 +2348,5 @@
   ELSE
      WRITE(lunout,*) "iflag_con non-prevu", iflag_con
-     call abort_gcm("physiq", "", 1)
+     call abort_physic("physiq", "", 1)
   ENDIF
 
@@ -3017,5 +3014,5 @@
            IF (aerosol_couple .AND. config_inca == 'aero' ) THEN
             abort_message='config_inca=aero et rrtm=1 impossible'
-            call abort_gcm(modname,abort_message,1)
+            call abort_physic(modname,abort_message,1)
            ELSE
 !
@@ -3032,5 +3029,5 @@
 
               abort_message='You should compile with -rrtm if running with iflag_rrtm=1'
-              call abort_gcm(modname,abort_message,1)
+              call abort_physic(modname,abort_message,1)
 #endif
               !
@@ -3065,5 +3062,5 @@
 
            abort_message='You should compile with -rrtm if running with iflag_rrtm=1'
-           call abort_gcm(modname,abort_message,1)
+           call abort_physic(modname,abort_message,1)
 #endif
         ENDIF
@@ -3294,10 +3291,10 @@
         IF (ok_cdnc.AND.NRADLP.NE.3) THEN
            abort_message='RRTM choix incoherent NRADLP doit etre egal a 3 pour ok_cdnc' 
-           call abort_gcm(modname,abort_message,1)
+           call abort_physic(modname,abort_message,1)
         endif
 #else
 
         abort_message='You should compile with -rrtm if running with iflag_rrtm=1'
-        call abort_gcm(modname,abort_message,1)
+        call abort_physic(modname,abort_message,1)
 #endif
      ENDIF
@@ -4174,5 +4171,5 @@
     IF (abortphy==1) THEN
        abort_message ='Plantage hgardfou'
-       CALL abort_gcm (modname,abort_message,1)
+       CALL abort_physic (modname,abort_message,1)
     ENDIF
 
@@ -4192,5 +4189,5 @@
   !        "stats")          only possible in 3D runs !
 
-
+#ifdef YM_TO_DO_LATER
   IF (callstats) THEN
 
@@ -4237,4 +4234,5 @@
 
   ENDIF !if callstats
+#endif
 
   IF (lafin) THEN
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phystokenc.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phystokenc.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phystokenc.F90	(revision 3814)
@@ -9,8 +9,9 @@
   USE ioipsl
   USE dimphy
-  USE infotrac, ONLY : nqtot
+  USE infotrac_phy, ONLY : nqtot
   USE iophy
-  USE control_mod
+  USE control_phy_mod
   USE indice_sol_mod
+  USE tracstoke_phy_mod
   
   IMPLICIT NONE
@@ -22,5 +23,5 @@
 !======================================================================
   INCLUDE "dimensions.h"
-  INCLUDE "tracstoke.h"
+!  INCLUDE "tracstoke.h"
   INCLUDE "iniprint.h"
 !======================================================================
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phytrac_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phytrac_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/phytrac_mod.F90	(revision 3814)
@@ -89,5 +89,5 @@
     USE phys_cal_mod, only : hour
     USE dimphy
-    USE infotrac
+    USE infotrac_phy
     USE mod_grid_phy_lmdz
     USE mod_phys_lmdz_para
@@ -97,5 +97,5 @@
     USE tracinca_mod
     USE tracreprobus_mod
-    USE control_mod
+    USE control_phy_mod
     USE indice_sol_mod
 
@@ -107,6 +107,4 @@
     INCLUDE "dimensions.h"
     INCLUDE "clesphys.h"
-    INCLUDE "temps.h"
-    INCLUDE "paramet.h"
     INCLUDE "thermcell.h"
     INCLUDE "iniprint.h"
@@ -445,8 +443,8 @@
        WRITE(*,*) 'FIRST TIME IN PHYTRAC : pdtphys(sec) = ',pdtphys,'ecrit_tra (sec) = ',ecrit_tra
        ALLOCATE( source(klon,nbtr), stat=ierr)
-       IF (ierr /= 0) CALL abort_gcm('phytrac', 'pb in allocation 1',1)
+       IF (ierr /= 0) CALL abort_physic('phytrac', 'pb in allocation 1',1)
 
        ALLOCATE( aerosol(nbtr), stat=ierr)
-       IF (ierr /= 0) CALL abort_gcm('phytrac', 'pb in allocation 2',1)
+       IF (ierr /= 0) CALL abort_physic('phytrac', 'pb in allocation 2',1)
 
 
@@ -503,5 +501,5 @@
 !                ELSE 
 !                   WRITE(lunout,*) 'pb it=', it
-!                   CALL abort_gcm('phytrac','pb it scavenging',1)
+!                   CALL abort_physic('phytrac','pb it scavenging',1)
 !                ENDIF
                 !--test OB 
@@ -539,5 +537,5 @@
 
        IF (lessivage.AND.config_inca.EQ.'inca') THEN
-          CALL abort_gcm('phytrac', 'lessivage=T config_inca=inca impossible',1)
+          CALL abort_physic('phytrac', 'lessivage=T config_inca=inca impossible',1)
           STOP
        ENDIF
@@ -740,5 +738,5 @@
     ELSE
        !
-       CALL abort_gcm('iflag_vdf_trac', 'cas non prevu',1)
+       CALL abort_physic('iflag_vdf_trac', 'cas non prevu',1)
        !
     END IF ! couche limite
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/q_sat_phy.F
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/q_sat_phy.F	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/q_sat_phy.F	(revision 3814)
@@ -0,0 +1,72 @@
+!
+! $Header$
+!
+!
+!
+
+      subroutine q_sat_phy(np,temp,pres,qsat)
+!
+      IMPLICIT none
+!======================================================================
+! Autheur(s): Z.X. Li (LMD/CNRS)
+!  reecriture vectorisee par F. Hourdin.
+! Objet: calculer la vapeur d'eau saturante (formule Centre Euro.)
+!======================================================================
+! Arguments:
+! kelvin---input-R: temperature en Kelvin
+! millibar--input-R: pression en mb
+!
+! q_sat----output-R: vapeur d'eau saturante en kg/kg
+!======================================================================
+!
+      integer np
+      REAL temp(np),pres(np),qsat(np)
+!
+      REAL r2es
+      PARAMETER (r2es=611.14 *18.0153/28.9644)
+!
+      REAL r3les, r3ies, r3es
+      PARAMETER (R3LES=17.269)
+      PARAMETER (R3IES=21.875)
+!
+      REAL r4les, r4ies, r4es
+      PARAMETER (R4LES=35.86)
+      PARAMETER (R4IES=7.66)
+!
+      REAL rtt
+      PARAMETER (rtt=273.16)
+!
+      REAL retv
+      PARAMETER (retv=28.9644/18.0153 - 1.0)
+
+      real zqsat
+      integer ip
+!
+!     ------------------------------------------------------------------
+!
+!
+
+      do ip=1,np
+
+!      write(*,*)'kelvin,millibar=',kelvin,millibar
+!       write(*,*)'temp,pres=',temp(ip),pres(ip)
+!
+         IF (temp(ip) .LE. rtt) THEN
+            r3es = r3ies
+            r4es = r4ies
+         ELSE
+            r3es = r3les
+            r4es = r4les
+         ENDIF
+!
+         zqsat=r2es/pres(ip)*EXP(r3es*(temp(ip)-rtt)/(temp(ip)-r4es))
+         zqsat=MIN(0.5,ZQSAT)
+         zqsat=zqsat/(1.-retv *zqsat)
+!
+         qsat(ip)= zqsat
+!      write(*,*)'qsat=',qsat(ip)
+
+      enddo
+!
+      RETURN
+      END
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/radiation_AR4.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/radiation_AR4.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/radiation_AR4.F90	(revision 3814)
@@ -485,5 +485,5 @@
   USE dimphy
   USE radiation_ar4_param, ONLY: rsun, rray
-  USE infotrac, ONLY: type_trac
+  USE infotrac_phy, ONLY: type_trac
 #ifdef REPROBUS
   USE chem_rep, ONLY: rsuntime, ok_suntime
@@ -710,5 +710,5 @@
   USE dimphy
   USE radiation_ar4_param, ONLY: rsun, rray
-  USE infotrac, ONLY: type_trac
+  USE infotrac_phy, ONLY: type_trac
 #ifdef REPROBUS
   USE chem_rep, ONLY: rsuntime, ok_suntime
@@ -2343,5 +2343,5 @@
   USE dimphy
   USE radiation_ar4_param, ONLY: tref, rt1, raer, at, bt, oct
-  USE infotrac, ONLY: type_trac
+  USE infotrac_phy, ONLY: type_trac
 #ifdef REPROBUS
   USE chem_rep, ONLY: rch42d, rn2o2d, rcfc112d, rcfc122d, ok_rtime2d
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/radio_decay.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/radio_decay.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/radio_decay.F90	(revision 3814)
@@ -7,5 +7,5 @@
 !
   USE dimphy
-  USE infotrac, ONLY : nbtr
+  USE infotrac_phy, ONLY : nbtr
   USE traclmdz_mod, ONLY : id_rn, id_pb
   IMPLICIT NONE
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/radlwsw_m.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/radlwsw_m.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/radlwsw_m.F90	(revision 3814)
@@ -48,5 +48,5 @@
   USE DIMPHY
   USE assert_m, ONLY : assert
-  USE infotrac, ONLY : type_trac
+  USE infotrac_phy, ONLY : type_trac
   USE write_field_phy
 #ifdef REPROBUS
@@ -393,9 +393,9 @@
   IF (nb_gr*kdlon .NE. KLON) THEN
       PRINT*, "kdlon mauvais:", KLON, kdlon, nb_gr
-      call abort_gcm("radlwsw", "", 1)
+      call abort_physic("radlwsw", "", 1)
   ENDIF
   IF (kflev .NE. KLEV) THEN
       PRINT*, "kflev differe de KLEV, kflev, KLEV"
-      call abort_gcm("radlwsw", "", 1)
+      call abort_physic("radlwsw", "", 1)
   ENDIF
   !-------------------------------------------
@@ -1025,5 +1025,5 @@
 #else
     abort_message="You should compile with -rrtm if running with iflag_rrtm=1"
-    call abort_gcm(modname, abort_message, 1)
+    call abort_physic(modname, abort_message, 1)
 #endif
     ENDIF ! iflag_rrtm
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/read_map2D.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/read_map2D.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/read_map2D.F90	(revision 3814)
@@ -74,5 +74,5 @@
       WRITE(lunout,*) 'Error in read_map2D, timestep = ', timestep
 
-      CALL abort_gcm(modname, err_mess, 1)
+      CALL abort_physic(modname, err_mess, 1)
 
     END SUBROUTINE write_err_mess
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/read_pstoke.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/read_pstoke.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/read_pstoke.F90	(revision 3814)
@@ -19,5 +19,5 @@
   USE netcdf
   USE dimphy
-  USE control_mod
+  USE control_phy_mod
   USE indice_sol_mod
 
@@ -26,13 +26,5 @@
   include "netcdf.inc"
   include "dimensions.h"
-  include "paramet.h"
-  include "comconst.h"
-  include "comgeom.h"
-  include "temps.h"
-  include "ener.h"
-  include "logic.h"
   include "description.h"
-  include "serre.h"
-  ! ccc#include "dimphy.h"
 
   INTEGER klono, klevo, imo, jmo
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/read_pstoke0.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/read_pstoke0.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/read_pstoke0.F90	(revision 3814)
@@ -18,5 +18,5 @@
   USE netcdf
   USE dimphy
-  USE control_mod
+  USE control_phy_mod
   USE indice_sol_mod
 
@@ -25,13 +25,5 @@
   include "netcdf.inc"
   include "dimensions.h"
-  include "paramet.h"
-  include "comconst.h"
-  include "comgeom.h"
-  include "temps.h"
-  include "ener.h"
-  include "logic.h"
   include "description.h"
-  include "serre.h"
-  ! ccc#include "dimphy.h"
 
   INTEGER kon, kev, zkon, zkev
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/readaerosol.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/readaerosol.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/readaerosol.F90	(revision 3814)
@@ -130,5 +130,5 @@
            IF (klev_src /= klev_src2) THEN
               WRITE(lunout,*) 'Two aerosols files with different number of vertical levels is not allowded'
-              CALL abort_gcm('readaersosol','Error in number of vertical levels',1)
+              CALL abort_physic('readaersosol','Error in number of vertical levels',1)
            END IF
            
@@ -162,5 +162,5 @@
   ELSE
      WRITE(lunout,*)'This option is not implemented : aer_type = ', type,' name_aero=',name_aero
-     CALL abort_gcm('readaerosol','Error : aer_type parameter not accepted',1)
+     CALL abort_physic('readaerosol','Error : aer_type parameter not accepted',1)
   END IF ! type
 
@@ -260,5 +260,5 @@
           WRITE(lunout,*) 'longitudes in model :', io_lon
           
-          CALL abort_gcm('get_aero_fromfile', 'longitudes are not the same in file and model',1)
+          CALL abort_physic('get_aero_fromfile', 'longitudes are not the same in file and model',1)
        END IF
 
@@ -283,5 +283,5 @@
           WRITE(lunout,*) 'latitudes in file ', TRIM(fname),' : ', lat_src      
           WRITE(lunout,*) 'latitudes in model :', io_lat
-          CALL abort_gcm('get_aero_fromfile', 'latitudes do not correspond between file and model',1)
+          CALL abort_physic('get_aero_fromfile', 'latitudes do not correspond between file and model',1)
        END IF
 
@@ -297,5 +297,5 @@
           IF (ierr /= NF90_NOERR) THEN
              ! Dimension PRESNIVS not found either
-             CALL abort_gcm('get_aero_fromfile', 'dimension lev or presnivs not in file',1)
+             CALL abort_physic('get_aero_fromfile', 'dimension lev or presnivs not in file',1)
           ELSE 
              ! Old file found
@@ -315,8 +315,8 @@
      ! Allocate variables depending on the number of vertical levels
        ALLOCATE(varmth(iim, jjm+1, klev_src), varyear(iim, jjm+1, klev_src, 12), stat=ierr)
-       IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 1',1)
+       IF (ierr /= 0) CALL abort_physic('get_aero_fromfile', 'pb in allocation 1',1)
 
        ALLOCATE(pt_ap(klev_src), pt_b(klev_src), varktmp(klev_src), stat=ierr)
-       IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 2',1)
+       IF (ierr /= 0) CALL abort_physic('get_aero_fromfile', 'pb in allocation 2',1)
 
 ! 3) Read all variables from file
@@ -333,5 +333,5 @@
 !       IF (nbr_tsteps /= 12 .AND. nbr_tsteps /= 14) THEN
        IF (nbr_tsteps /= 12 ) THEN
-         CALL abort_gcm('get_aero_fromfile', 'not the right number of months in aerosol file read (should be 12 for the moment)',1)
+         CALL abort_physic('get_aero_fromfile', 'not the right number of months in aerosol file read (should be 12 for the moment)',1)
        ENDIF
 
@@ -522,5 +522,5 @@
        
        ALLOCATE(varyear_glo1D(klon_glo, klev_src, 12), stat=ierr)
-       IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 3',1)
+       IF (ierr /= 0) CALL abort_physic('get_aero_fromfile', 'pb in allocation 3',1)
        
        ! Transform from 2D to 1D field
@@ -546,5 +546,5 @@
     IF (.NOT. ASSOCIATED(pt_ap)) THEN  ! if pt_ap is allocated also pt_b is allocated
        ALLOCATE(pt_ap(klev_src), pt_b(klev_src), stat=ierr)
-       IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 4',1)
+       IF (ierr /= 0) CALL abort_physic('get_aero_fromfile', 'pb in allocation 4',1)
     END IF
     CALL bcast(pt_ap)
@@ -554,5 +554,5 @@
     IF (ASSOCIATED(pt_year)) DEALLOCATE(pt_year)
     ALLOCATE(pt_year(klon, klev_src, 12), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 5',1)
+    IF (ierr /= 0) CALL abort_physic('get_aero_fromfile', 'pb in allocation 5',1)
 
     ! Scatter global field to local domain at local process
@@ -583,5 +583,5 @@
           WRITE(lunout,*) 'Error in get_aero_fromfile : ',text
        END IF
-       CALL abort_gcm('get_aero_fromfile',trim(nf90_strerror(status)),1)
+       CALL abort_physic('get_aero_fromfile',trim(nf90_strerror(status)),1)
     END IF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/readaerosol_interp.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/readaerosol_interp.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/readaerosol_interp.F90	(revision 3814)
@@ -26,9 +26,7 @@
   INCLUDE "YOMCST.h"
   INCLUDE "chem.h"      
-  INCLUDE "temps.h"      
   INCLUDE "clesphys.h"
   INCLUDE "iniprint.h"
   INCLUDE "dimensions.h"
-  INCLUDE "comvert.h"
 !
 ! Input:
@@ -150,13 +148,13 @@
   IF (.NOT. ALLOCATED(var_day)) THEN
      ALLOCATE( var_day(klon, klev, naero_spc), stat=ierr)
-     IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 1',1)
+     IF (ierr /= 0) CALL abort_physic('readaerosol_interp', 'pb in allocation 1',1)
      ALLOCATE( pi_var_day(klon, klev, naero_spc), stat=ierr)
-     IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 2',1)
+     IF (ierr /= 0) CALL abort_physic('readaerosol_interp', 'pb in allocation 2',1)
 
      ALLOCATE( psurf_year(klon, 12, naero_spc), pi_psurf_year(klon, 12, naero_spc), stat=ierr)
-     IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 3',1)
+     IF (ierr /= 0) CALL abort_physic('readaerosol_interp', 'pb in allocation 3',1)
 
      ALLOCATE( load_year(klon, 12, naero_spc), pi_load_year(klon, 12, naero_spc), stat=ierr)
-     IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 4',1)
+     IF (ierr /= 0) CALL abort_physic('readaerosol_interp', 'pb in allocation 4',1)
 
      lnewday=.TRUE.
@@ -209,5 +207,5 @@
         END IF
      ELSE
-        CALL abort_gcm('readaerosol_interp', 'this aer_type not supported',1)
+        CALL abort_physic('readaerosol_interp', 'this aer_type not supported',1)
      END IF
 
@@ -216,5 +214,5 @@
      IF (.NOT. ALLOCATED(var_year)) THEN
         ALLOCATE(var_year(klon, klev_src, 12, naero_spc), stat=ierr)
-        IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 5',1)
+        IF (ierr /= 0) CALL abort_physic('readaerosol_interp', 'pb in allocation 5',1)
      END IF
      var_year(:,:,:,id_aero) = pt_tmp(:,:,:)
@@ -230,10 +228,10 @@
         WRITE(lunout,*) 'Error! All forcing files for the same aerosol must have the same vertical dimension'
         WRITE(lunout,*) 'Aerosol : ', name_aero(id_aero)
-        CALL abort_gcm('readaerosol_interp','Differnt vertical axes in aerosol forcing files',1)
+        CALL abort_physic('readaerosol_interp','Differnt vertical axes in aerosol forcing files',1)
      END IF
 
      IF (.NOT. ALLOCATED(pi_var_year)) THEN
         ALLOCATE(pi_var_year(klon, klev_src, 12, naero_spc), stat=ierr)
-        IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 6',1)
+        IF (ierr /= 0) CALL abort_physic('readaerosol_interp', 'pb in allocation 6',1)
      END IF
      pi_var_year(:,:,:,id_aero) = pt_tmp(:,:,:)
@@ -259,10 +257,10 @@
         IF (  psurf_year(1,1,id_aero) /= pi_psurf_year(1,1,id_aero) ) THEN
            WRITE(lunout,*) 'Warning! All forcing files for the same aerosol must have the same structure'
-           CALL abort_gcm('readaerosol_interp', 'The aerosol files have not the same format',1)
+           CALL abort_physic('readaerosol_interp', 'The aerosol files have not the same format',1)
         END IF
         
         IF (klev /= klev_src) THEN
            WRITE(lunout,*) 'Old format of aerosol file do not allowed vertical interpolation'
-           CALL abort_gcm('readaerosol_interp', 'Old aerosol file not possible',1)
+           CALL abort_physic('readaerosol_interp', 'Old aerosol file not possible',1)
         END IF
 
@@ -336,5 +334,5 @@
        END IF
      ELSE
-       CALL abort_gcm('readaerosol_interp', 'number of months undefined',1)
+       CALL abort_physic('readaerosol_interp', 'number of months undefined',1)
      ENDIF
      if (debug) then
@@ -345,8 +343,8 @@
      ! Time interpolation, still on vertical source grid
      ALLOCATE(tmp1(klon,klev_src), tmp2(klon,klev_src),stat=ierr)
-     IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 7',1)
+     IF (ierr /= 0) CALL abort_physic('readaerosol_interp', 'pb in allocation 7',1)
 
      ALLOCATE(pplay_src(klon,klev_src), stat=ierr)
-     IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 8',1)
+     IF (ierr /= 0) CALL abort_physic('readaerosol_interp', 'pb in allocation 8',1)
      
 
@@ -544,5 +542,5 @@
                  WRITE(lunout,*) 'stop for aerosol : ',name_aero(id_aero)
                  WRITE(lunout,*) 'day1, day2, jDay = ', day1, day2, jDay 
-                 CALL abort_gcm('readaerosol_interp','Error in interpolation 1',1)
+                 CALL abort_physic('readaerosol_interp','Error in interpolation 1',1)
               END IF
            END DO 
@@ -563,5 +561,5 @@
                  
                  WRITE(lunout,*) 'stop for aerosol : ',name_aero(id_aero)
-                 CALL abort_gcm('readaerosol_interp','Error in interpolation 2',1)
+                 CALL abort_physic('readaerosol_interp','Error in interpolation 2',1)
               END IF
            END DO
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/regr_lat_time_climoz_m.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/regr_lat_time_climoz_m.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/regr_lat_time_climoz_m.F90	(revision 3814)
@@ -73,5 +73,6 @@
     use netcdf, only: nf90_get_att, nf90_get_var, nf90_noerr, nf90_nowrite
     use assert_m, only: assert
-
+    use comconst_phy_mod, only : pi
+    use comgeom2_phy_mod, only : rlatv
     integer, intent(in):: read_climoz ! read ozone climatology
     ! Allowed values are 1 and 2
@@ -84,10 +85,4 @@
     include "dimensions.h"
     ! (for "jjm")
-    include "paramet.h"
-    ! (for the other included files)
-    include "comgeom2.h"
-    ! (for "rlatv")
-    include "comconst.h"
-    ! (for "pi")
 
     integer n_plev ! number of pressure levels in the input data
@@ -339,5 +334,6 @@
          nf95_put_att, nf95_enddef, nf95_copy_att, nf95_put_var
     use netcdf, only: nf90_clobber, nf90_float, nf90_global
-
+    use comconst_phy_mod, only : pi
+    use comgeom2_phy_mod, only : rlatu
     integer, intent(in):: ncid_in, n_plev
     integer, intent(out):: ncid_out, varid_plev, varid_time
@@ -350,11 +346,4 @@
 
     include "dimensions.h"
-    ! (for "jjm")
-    include "paramet.h"
-    ! (for the other included files)
-    include "comgeom2.h"
-    ! (for "rlatu")
-    include "comconst.h"
-    ! (for "pi")
 
     integer ncerr
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/regr_lat_time_coefoz_m.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/regr_lat_time_coefoz_m.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/regr_lat_time_coefoz_m.F90	(revision 3814)
@@ -45,14 +45,10 @@
          nf95_put_var, nf95_gw_var
     use netcdf, only: nf90_nowrite, nf90_get_var
-
+    use comgeom2_phy_mod, only : rlatv
+    use comconst_phy_mod, only : pi
     ! Variables local to the procedure:
 
     include "dimensions.h"
     ! (for "jjm")
-    include "paramet.h"
-    include "comgeom2.h"
-    ! (for "rlatv")
-    include "comconst.h"
-    ! (for "pi")
 
     integer ncid_in, ncid_out ! NetCDF IDs for input and output files
@@ -251,4 +247,6 @@
          nf95_put_att, nf95_enddef, nf95_copy_att, nf95_put_var
     use netcdf, only: nf90_clobber, nf90_float, nf90_copy_att, nf90_global
+    use comgeom2_phy_mod, only : rlatu
+    use comconst_phy_mod, only : pi
 
     integer, intent(in):: ncid_in, varid_in(:), n_plev
@@ -260,9 +258,4 @@
     include "dimensions.h"
     ! (for "jjm")
-    include "paramet.h"
-    include "comgeom2.h"
-    ! (for "rlatu")
-    include "comconst.h"
-    ! (for "pi")
 
     integer ncerr
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/regr_pr_o3_m.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/regr_pr_o3_m.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/regr_pr_o3_m.F90	(revision 3814)
@@ -30,5 +30,5 @@
     use regr1_step_av_m, only: regr1_step_av
     use press_coefoz_m, only: press_in_edg
-    use control_mod, only: dayref
+    use control_phy_mod, only: dayref
 
     REAL, intent(in):: p3d(:, :, :) ! pressure at layer interfaces, in Pa
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/soil.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/soil.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/soil.F90	(revision 3814)
@@ -178,5 +178,5 @@
   ELSE
      WRITE(lunout,*) "valeur d indice non prevue", indice
-     call abort_gcm("soil", "", 1)
+     call abort_physic("soil", "", 1)
   ENDIF
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_land_orchidee_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_land_orchidee_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_land_orchidee_mod.F90	(revision 3814)
@@ -18,5 +18,5 @@
   USE comgeomphy,   ONLY : cuphy, cvphy
   USE mod_grid_phy_lmdz
-  USE mod_phys_lmdz_para, mpi_root_rank=>mpi_root
+  USE mod_phys_lmdz_para
 
   IMPLICIT NONE
@@ -45,5 +45,5 @@
     USE carbon_cycle_mod, ONLY : carbon_cycle_cpl
     USE indice_sol_mod
-
+    USE temps_phy_mod
 !    
 ! Cette routine sert d'interface entre le modele atmospherique et le 
@@ -98,5 +98,4 @@
 !   qsurf        air moisture at surface
 !
-    INCLUDE "temps.h"
     INCLUDE "YOMCST.h"
     INCLUDE "iniprint.h"
@@ -210,5 +209,5 @@
 #ifndef CPP_VEGET
        abort_message='Pb de coherence: ok_veget = .true. mais CPP_VEGET = .false.'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
 #endif
 
@@ -244,5 +243,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation lalo'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -251,5 +250,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation lon_scat'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -258,5 +257,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation lat_scat'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -298,5 +297,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation neighbours'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -306,5 +305,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation contfrac'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -324,5 +323,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation resolution'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -336,5 +335,5 @@
        IF (error /= 0) THEN
           abort_message='Pb allocation coastalflow'
-          CALL abort_gcm(modname,abort_message,1)
+          CALL abort_physic(modname,abort_message,1)
        ENDIF
        
@@ -342,5 +341,5 @@
        IF (error /= 0) THEN
           abort_message='Pb allocation riverflow'
-          CALL abort_gcm(modname,abort_message,1)
+          CALL abort_physic(modname,abort_message,1)
        ENDIF
 !
@@ -349,5 +348,5 @@
        IF (carbon_cycle_cpl) THEN
           abort_message='carbon_cycle_cpl not yet possible with this interface of ORCHIDEE'
-          CALL abort_gcm(modname,abort_message,1)
+          CALL abort_physic(modname,abort_message,1)
        END IF
        
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_land_orchidee_noopenmp_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_land_orchidee_noopenmp_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_land_orchidee_noopenmp_mod.F90	(revision 3814)
@@ -215,5 +215,5 @@
        IF (carbon_cycle_cpl) THEN
           abort_message='You must define preprossing key ORCH_NEW when running carbon_cycle_cpl=y'
-          CALL abort_gcm(modname,abort_message,1)
+          CALL abort_physic(modname,abort_message,1)
        END IF
 #endif
@@ -246,5 +246,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation lalo'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -253,5 +253,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation lon_scat'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -260,5 +260,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation lat_scat'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -301,5 +301,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation neighbours'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -309,5 +309,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation contfrac'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -327,5 +327,5 @@
           IF (error /= 0) THEN
              abort_message='Pb allocation resolution'
-             CALL abort_gcm(modname,abort_message,1)
+             CALL abort_physic(modname,abort_message,1)
           ENDIF
        ENDIF
@@ -339,5 +339,5 @@
        IF (error /= 0) THEN
           abort_message='Pb allocation coastalflow'
-          CALL abort_gcm(modname,abort_message,1)
+          CALL abort_physic(modname,abort_message,1)
        ENDIF
        
@@ -345,5 +345,5 @@
        IF (error /= 0) THEN
           abort_message='Pb allocation riverflow'
-          CALL abort_gcm(modname,abort_message,1)
+          CALL abort_physic(modname,abort_message,1)
        ENDIF
 
@@ -359,12 +359,12 @@
        IF (carbon_cycle_cpl) THEN
           ALLOCATE(fco2_land_inst(klon),stat=error)
-          IF (error /= 0)  CALL abort_gcm(modname,'Pb in allocation fco2_land_inst',1)
+          IF (error /= 0)  CALL abort_physic(modname,'Pb in allocation fco2_land_inst',1)
           
           ALLOCATE(fco2_lu_inst(klon),stat=error)
-          IF(error /=0) CALL abort_gcm(modname,'Pb in allocation fco2_lu_inst',1)
+          IF(error /=0) CALL abort_physic(modname,'Pb in allocation fco2_lu_inst',1)
        END IF
 
        ALLOCATE(fields_cpl(klon,nb_fields_cpl), stat = error)
-       IF (error /= 0) CALL abort_gcm(modname,'Pb in allocation fields_cpl',1)
+       IF (error /= 0) CALL abort_physic(modname,'Pb in allocation fields_cpl',1)
 
     ENDIF                          ! (fin debut) 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_landice_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_landice_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/surf_landice_mod.F90	(revision 3814)
@@ -209,5 +209,5 @@
 #else
        abort_message='Pb de coherence: ok_snow = .true. mais CPP_SISVAT = .false.'
-       CALL abort_gcm(modname,abort_message,1)
+       CALL abort_physic(modname,abort_message,1)
 #endif
     ELSE ! ok_snow=FALSE
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/temps_phy_mod.f90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/temps_phy_mod.f90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/temps_phy_mod.f90	(revision 3814)
@@ -0,0 +1,28 @@
+MODULE temps_phy_mod
+
+  INTEGER,SAVE :: itaufin
+  !$OMP THREADPRIVATE(itaufin)
+
+  INTEGER,SAVE :: day_ini 
+  !$OMP THREADPRIVATE(day_ini)
+
+  INTEGER,SAVE :: day_end 
+  !$OMP THREADPRIVATE(day_end)
+
+  INTEGER,SAVE :: itau_phy 
+  !$OMP THREADPRIVATE(itau_phy)
+
+  INTEGER,SAVE :: annee_ref
+  !$OMP THREADPRIVATE(annee_ref)
+
+  INTEGER,SAVE :: day_ref
+  !$OMP THREADPRIVATE(day_ref)
+
+  REAL,SAVE :: start_time
+  !$OMP THREADPRIVATE(start_time)
+
+  REAL,SAVE :: jD_ref
+  !$OMP THREADPRIVATE(jD_ref)
+
+
+END MODULE temps_phy_mod
Index: namico_lmdz/aquaplanet/LMDZ5/libf/phylmd/test_disvert_m.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/test_disvert_m.F90	(revision 3813)
+++ 	(revision )
@@ -1,70 +1,0 @@
-module test_disvert_m
-
-  implicit none
-
-contains
-
-  subroutine test_disvert
-
-    ! Author: Lionel GUEZ
-
-    ! This procedure tests the order of pressure values at half-levels
-    ! and full levels. We arbitrarily choose to test ngrid values of
-    ! the surface pressure, which sample possible values on Earth.
-
-    use exner_hyb_m, only: exner_hyb
-
-    ! For llm:
-    include "dimensions.h"
-
-    ! For ap, bp, preff:
-    include "comvert.h"
-
-    ! For kappa, cpp:
-    include "comconst.h"
-
-    ! Local:
-    integer l, i
-    integer, parameter:: ngrid = 7
-    real p(ngrid, llm + 1) ! pressure at half-level, in Pa
-    real pks(ngrid) ! exner function at the surface, in J K-1 kg-1 
-    real pk(ngrid, llm) ! exner function at full level, in J K-1 kg-1 
-    real ps(ngrid) ! surface pressure, in Pa
-    real p_lay(ngrid, llm) ! pressure at full level, in Pa
-    real delta_ps ! in Pa
-
-    !---------------------
-
-    print *, "Call sequence information: test_disvert"
-
-    delta_ps = 6e4 / (ngrid - 1)
-    ps = (/(5e4 + delta_ps * i, i = 0, ngrid - 1)/)
-    forall (l = 1: llm + 1) p(:, l) = ap(l) + bp(l) * ps
-    call exner_hyb(ngrid, ps, p, pks, pk)
-    p_lay = preff * (pk / cpp)**(1. / kappa)
-
-    ! Are pressure values in the right order?
-    if (any(p(:, :llm) <= p_lay .or. p_lay <= p(:, 2:))) then
-       ! List details and stop:
-       do l = 1, llm
-          do i = 1, ngrid
-             if (p(i, l) <= p_lay(i, l)) then
-                print 1000, "ps = ", ps(i) / 100., "hPa, p(level ",  l, &
-                     ") = ", p(i, l) / 100., " hPa <= p(layer ", l, ") = ", &
-                     p_lay(i, l) / 100., " hPa"
-             end if
-             if (p_lay(i, l) <= p(i, l + 1)) then
-                print 1000, "ps = ", ps(i) / 100., "hPa, p(layer ", l, ") = ", &
-                     p_lay(i, l) / 100., " hPa <= p(level ", l + 1, ") = ", &
-                     p(i, l + 1) / 100., " hPa"
-             end if
-          end do
-       end do
-       call abort_gcm("test_disvert", "bad order of pressure values", 1)
-    end if
-
-1000 format (3(a, g10.4, a, i0))
-
-  end subroutine test_disvert
-
-end module test_disvert_m
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell.F90	(revision 3814)
@@ -766,5 +766,5 @@
       IF (fracd(ig,l)<0.1) THEN
         abort_message = 'fracd trop petit'
-        CALL abort_gcm(modname, abort_message, 1)
+        CALL abort_physic(modname, abort_message, 1)
 
       ELSE
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcellV0_main.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcellV0_main.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcellV0_main.F90	(revision 3814)
@@ -465,5 +465,5 @@
       if (.not. (f0(1).ge.0.) ) then
         abort_message = 'Dans thermcell_main f0(1).lt.0 '
-        CALL abort_gcm (modname,abort_message,1)
+        CALL abort_physic (modname,abort_message,1)
       endif
 
@@ -591,5 +591,5 @@
            zcon2(ig)=zlay(ig,nlay)-(pcon(ig)-pplay(ig,nlay))/(RG*rho(ig,nlay))/100.
            abort_message = 'thermcellV0_main: les thermiques vont trop haut '
-           CALL abort_gcm (modname,abort_message,1)
+           CALL abort_physic (modname,abort_message,1)
         endif
       enddo
@@ -880,5 +880,5 @@
                 print*,'wmax_sec',wmax_sec(ig)
                 abort_message = 'zdenom<1.e-14'
-                CALL abort_gcm (modname,abort_message,1)
+                CALL abort_physic (modname,abort_message,1)
              endif
              if ((zmax_sec(ig).gt.1.e-10).and.(iflag_thermals_ed.eq.0)) then 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_dq.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_dq.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_dq.F90	(revision 3814)
@@ -55,5 +55,5 @@
                print*,'entr*dt>m,1',k,entr(ig,k)*ptimestep,masse(ig,k)
                abort_message = 'entr dt > m, 1st'
-               CALL abort_gcm (modname,abort_message,1)
+               CALL abort_physic (modname,abort_message,1)
             endif
          enddo
@@ -196,5 +196,5 @@
                print*,'entr*dt>m,2',k,entr(ig,k)*ptimestep,masse(ig,k)
                abort_message = 'entr dt > m, 2nd'
-               CALL abort_gcm (modname,abort_message,1)
+               CALL abort_physic (modname,abort_message,1)
             endif
          enddo
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_flux.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_flux.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_flux.F90	(revision 3814)
@@ -103,5 +103,5 @@
                     print*,'detr_star(ig,l)',detr_star(ig,l)
                     abort_message = ''
-                    CALL abort_gcm (modname,abort_message,1)
+                    CALL abort_physic (modname,abort_message,1)
                endif
             endif
@@ -268,5 +268,5 @@
                print*,'N1 ig,l,entr',ig,l,entr(ig,l)
                abort_message = 'entr negatif'
-               CALL abort_gcm (modname,abort_message,1)
+               CALL abort_physic (modname,abort_message,1)
             endif
             if (detr(ig,l).gt.fm(ig,l)) then
@@ -297,5 +297,5 @@
                print*,'fm(ig,l)',fm(ig,l)
                abort_message = 'probleme dans thermcell flux'
-               CALL abort_gcm (modname,abort_message,1)
+               CALL abort_physic (modname,abort_message,1)
             endif
          enddo
@@ -325,5 +325,5 @@
                print*,'fm(ig,l)',fm(ig,l)
                abort_message = 'probleme dans thermcell flux'
-               CALL abort_gcm (modname,abort_message,1)
+               CALL abort_physic (modname,abort_message,1)
             endif
         enddo
@@ -427,5 +427,5 @@
                          print*,'fm(ig,l)',fm(ig,l)
                          abort_message = 'probleme dans thermcell_flux'
-                         CALL abort_gcm (modname,abort_message,1)
+                         CALL abort_physic (modname,abort_message,1)
                       endif
                       entr(ig,l+1)=entr(ig,l+1)-ddd
@@ -511,5 +511,5 @@
           print*,'fm(igout,l)',fm(igout,l)
           abort_message = ''
-          CALL abort_gcm (modname,abort_message,1)
+          CALL abort_physic (modname,abort_message,1)
           endif
       enddo
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_flux2.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_flux2.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_flux2.F90	(revision 3814)
@@ -109,5 +109,5 @@
                     abort_message = ''
                     labort_gcm=.true.
-                    CALL abort_gcm (modname,abort_message,1)
+                    CALL abort_physic (modname,abort_message,1)
                endif
             endif
@@ -282,5 +282,5 @@
             print*,'N1 ig,l,entr',igout,lout,entr(igout,lout)
             abort_message = 'entr negatif'
-            CALL abort_gcm (modname,abort_message,1)
+            CALL abort_physic (modname,abort_message,1)
          endif
 
@@ -323,5 +323,5 @@
             print*,'fm(ig,l)',fm(ig,l)
             abort_message = 'probleme dans thermcell flux'
-            CALL abort_gcm (modname,abort_message,1)
+            CALL abort_physic (modname,abort_message,1)
          endif
 
@@ -361,5 +361,5 @@
                print*,'fm(ig,l)',fm(ig,l)
                abort_message = 'probleme dans thermcell flux'
-               CALL abort_gcm (modname,abort_message,1)
+               CALL abort_physic (modname,abort_message,1)
         endif
 !    enddo
@@ -479,5 +479,5 @@
                          print*,'fm(ig,l)',fm(ig,l)
                          abort_message = 'probleme dans thermcell_flux'
-                         CALL abort_gcm (modname,abort_message,1)
+                         CALL abort_physic (modname,abort_message,1)
       endif
       endif
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_main.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_main.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_main.F90	(revision 3814)
@@ -565,5 +565,5 @@
       if (.not. (f0(1).ge.0.) ) then
               abort_message = '.not. (f0(1).ge.0.)'
-              CALL abort_gcm (modname,abort_message,1)
+              CALL abort_physic (modname,abort_message,1)
       endif
 
@@ -695,5 +695,5 @@
       if (ierr==1) then
            abort_message = 'thermcellV0_main: les thermiques vont trop haut '
-           CALL abort_gcm (modname,abort_message,1)
+           CALL abort_physic (modname,abort_message,1)
       endif
 
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_old.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_old.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/thermcell_old.F90	(revision 3814)
@@ -520,5 +520,5 @@
       IF (fracd(ig,l)<0.1) THEN
         abort_message = 'fracd trop petit'
-        CALL abort_gcm(modname, abort_message, 1)
+        CALL abort_physic(modname, abort_message, 1)
       ELSE
         ! vitesse descendante "diagnostique"
@@ -1747,5 +1747,5 @@
         PRINT *, 'THERMCELL PB ig=', ig, '   l=', l
         abort_message = 'THERMCELL PB'
-        CALL abort_gcm(modname, abort_message, 1)
+        CALL abort_physic(modname, abort_message, 1)
       END IF
       ! if ((zw2(ig,l+1).gt.1.e-10).and.(zw2(ig,l).gt.1.e-10).and.
@@ -2051,5 +2051,5 @@
       IF (fracd(ig,l)<0.1 .AND. (test(ig)==1)) THEN
         abort_message = 'fracd trop petit'
-        CALL abort_gcm(modname, abort_message, 1)
+        CALL abort_physic(modname, abort_message, 1)
       ELSE
         ! vitesse descendante "diagnostique"
@@ -3101,5 +3101,5 @@
       IF (fracd(ig,l)<0.1) THEN
         abort_message = 'fracd trop petit'
-        CALL abort_gcm(modname, abort_message, 1)
+        CALL abort_physic(modname, abort_message, 1)
       ELSE
         ! vitesse descendante "diagnostique"
@@ -3906,5 +3906,5 @@
       IF (fracd(ig,l)<0.1) THEN
         abort_message = 'fracd trop petit'
-        CALL abort_gcm(modname, abort_message, 1)
+        CALL abort_physic(modname, abort_message, 1)
       ELSE
         ! vitesse descendante "diagnostique"
@@ -5209,5 +5209,5 @@
       IF (fracd(ig,l)<0.1) THEN
         abort_message = 'fracd trop petit'
-        CALL abort_gcm(modname, abort_message, 1)
+        CALL abort_physic(modname, abort_message, 1)
       ELSE
         ! vitesse descendante "diagnostique"
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/tracinca_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/tracinca_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/tracinca_mod.F90	(revision 3814)
@@ -11,5 +11,5 @@
     ! This subroutine initialize some control varaibles. 
 
-    USE infotrac
+    USE infotrac_phy
     IMPLICIT NONE
     
@@ -42,8 +42,8 @@
 
     USE dimphy
-    USE infotrac
+    USE infotrac_phy
     USE vampir
     USE comgeomphy
-    USE control_mod
+    USE control_phy_mod
     USE indice_sol_mod
 
@@ -52,5 +52,5 @@
     
     INCLUDE "dimensions.h"
-    INCLUDE "paramet.h"
+!    INCLUDE "paramet.h"
 
 !==========================================================================
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/traclmdz_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/traclmdz_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/traclmdz_mod.F90	(revision 3814)
@@ -67,5 +67,5 @@
     
     USE dimphy
-    USE infotrac
+    USE infotrac_phy
     
     ! Input argument
@@ -77,5 +77,5 @@
     ! Allocate restart variables trs
     ALLOCATE( trs(klon,nbtr), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('traclmdz_from_restart', 'pb in allocation 1',1)
+    IF (ierr /= 0) CALL abort_physic('traclmdz_from_restart', 'pb in allocation 1',1)
     
     ! Initialize trs with values read from restart file 
@@ -89,5 +89,5 @@
     ! Initialization of the tracers should be done here only for those not found in the restart file.
     USE dimphy
-    USE infotrac
+    USE infotrac_phy
     USE regr_pr_comb_coefoz_m, ONLY: alloc_coefoz
     USE press_coefoz_m, ONLY: press_coefoz
@@ -133,26 +133,26 @@
 ! --------------------------------------------
     ALLOCATE( scavtr(nbtr), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('traclmdz_init', 'pb in allocation 9',1)
+    IF (ierr /= 0) CALL abort_physic('traclmdz_init', 'pb in allocation 9',1)
     scavtr(:)=1.
     
     ALLOCATE( radio(nbtr), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('traclmdz_init', 'pb in allocation 11',1)
+    IF (ierr /= 0) CALL abort_physic('traclmdz_init', 'pb in allocation 11',1)
     radio(:) = .false.    ! Par defaut pas decroissance radioactive
     
     ALLOCATE( masktr(klon,nbtr), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('traclmdz_init', 'pb in allocation 2',1)
+    IF (ierr /= 0) CALL abort_physic('traclmdz_init', 'pb in allocation 2',1)
     
     ALLOCATE( fshtr(klon,nbtr), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('traclmdz_init', 'pb in allocation 3',1)
+    IF (ierr /= 0) CALL abort_physic('traclmdz_init', 'pb in allocation 3',1)
     
     ALLOCATE( hsoltr(nbtr), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('traclmdz_init', 'pb in allocation 4',1)
+    IF (ierr /= 0) CALL abort_physic('traclmdz_init', 'pb in allocation 4',1)
     
     ALLOCATE( tautr(nbtr), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('traclmdz_init', 'pb in allocation 5',1)
+    IF (ierr /= 0) CALL abort_physic('traclmdz_init', 'pb in allocation 5',1)
     tautr(:)  = 0.
     
     ALLOCATE( vdeptr(nbtr), stat=ierr)
-    IF (ierr /= 0) CALL abort_gcm('traclmdz_init', 'pb in allocation 6',1)
+    IF (ierr /= 0) CALL abort_physic('traclmdz_init', 'pb in allocation 6',1)
     vdeptr(:) = 0.
 
@@ -341,5 +341,5 @@
     
     USE dimphy
-    USE infotrac
+    USE infotrac_phy
     USE regr_pr_comb_coefoz_m, ONLY: regr_pr_comb_coefoz
     USE o3_chem_m, ONLY: o3_chem
@@ -430,5 +430,5 @@
 !=================================================================
 
-    CALL q_sat(klon*klev,t_seri,pplay,qsat)
+    CALL q_sat_phy(klon*klev,t_seri,pplay,qsat)
 
     IF ( id_pcsat /= 0 ) THEN
@@ -624,5 +624,5 @@
     ! variable trs is written to restart file (restartphy.nc)
     USE dimphy
-    USE infotrac
+    USE infotrac_phy
     
     REAL,DIMENSION(klon,nbtr), INTENT(OUT) :: trs_out
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/tracreprobus_mod.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/tracreprobus_mod.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/tracreprobus_mod.F90	(revision 3814)
@@ -12,5 +12,5 @@
 
     USE dimphy
-    USE infotrac
+    USE infotrac_phy
 #ifdef REPROBUS 
     USE CHEM_REP, ONLY : pdt_rep, &  ! pas de temps reprobus
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/tracstoke_phy_mod.f90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/tracstoke_phy_mod.f90	(revision 3814)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/tracstoke_phy_mod.f90	(revision 3814)
@@ -0,0 +1,6 @@
+MODULE tracstoke_phy_mod
+
+  INTEGER,SAVE :: istphy
+!$OMP THREADPRIVATE(istphy)
+
+END MODULE tracstoke_phy_mod
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/write_field_phy.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/write_field_phy.F90	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/write_field_phy.F90	(revision 3814)
@@ -13,6 +13,4 @@
     
     IMPLICIT NONE
-    include 'dimensions.h'
-    include 'paramet.h'
 
     character(len=*)   :: name
@@ -21,5 +19,5 @@
     real,save,allocatable :: Field_tmp(:,:)
     real, dimension(klon_glo,ll):: New_Field
-    real, dimension(iim,jjp1,ll):: Field_2d
+    real, dimension(nbp_lon,nbp_lat,ll):: Field_2d
 
     CALL Gather(Field,New_Field)
Index: /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/write_histday_seri.h
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/write_histday_seri.h	(revision 3813)
+++ /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/write_histday_seri.h	(revision 3814)
@@ -51,74 +51,82 @@
       CALL histwrite(nid_day_seri,"ecin",itau_w, &
                      zx_tmp_2d,iim*jjmp1,ndex2d) 
-!
-!IM 151004 BEG
-      IF(1.EQ.0) THEN
-!
-      DO k=1, klev
-      DO i=1, klon
-       zx_tmp_fi3d(i,k)=u_seri(i,k)*RA*cos(pir* rlat(i))
-      ENDDO
-      ENDDO
-!
-      CALL moyglo_pondaima(klon, klev, zx_tmp_fi3d,  &
-           airephy, paprs, moyglo)
-      zx_tmp_fi2d(1:klon)=moyglo
-!
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_day_seri,"momang",itau_w,zx_tmp_2d, &
-                     iim*jjmp1,ndex2d)
-!
-! friction torque
-!
-      DO i=1, klon
-       zx_tmp_fi2d(i)=zxfluxu(i,1)*RA* cos(pir* rlat(i))
-      ENDDO
-!
-      ok_msk=.FALSE.
-      CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy,  &
-           ok_msk, msk, moyglo)
-      zx_tmp_fi2d(1:klon)=moyglo
-!
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_day_seri,"frictor",itau_w,zx_tmp_2d, &
-                     iim*jjmp1,ndex2d)
-!
-! mountain torque
-!
-!IM 190504 BEG
-      CALL gr_fi_dyn(1,klon,iim+1,jjm+1,airephy,airedyn)
-      CALL gr_fi_dyn(klev+1,klon,iim+1,jjm+1,paprs,padyn)
-      CALL gr_fi_dyn(1,klon,iim+1,jjm+1,rlat,rlatdyn)
-      mountor=0.
-      airetot=0.
-      DO j = 1, jjmp1
-       DO i = 1, iim+1
-        ij=i+(iim+1)*(j-1)
-        zx_tmp(ij)=0.
-        DO k = 1, klev
-         zx_tmp(ij)=zx_tmp(ij)+dudyn(i,j,k)*airedyn(i,j)* &
-                    (padyn(i,j,k+1)-padyn(i,j,k))/RG
-         airetot=airetot+airedyn(i,j)
-        ENDDO
-!IM 190504 mountor=mountor+zx_tmp(ij)*airedyn(i,j)*RA*
-        mountor=mountor+zx_tmp(ij)*RA* &
-                 cos(pir* rlatdyn(i,j))
-       ENDDO
-      ENDDO
-!IM 151004 BEG
-      IF(itap.EQ.1) PRINT*,'airetot=',airetot,airetot/klev
-!IM 151004 END
-!IM 190504      mountor=mountor/(airetot*airetot)
-      mountor=mountor/airetot
-!
-!IM 190504 END
-      zx_tmp_2d(1:iim,1:jjmp1)=mountor
-      CALL histwrite(nid_day_seri,"mountor",itau_w,zx_tmp_2d, &
-                     iim*jjmp1,ndex2d)
-!
-      ENDIF !(1.EQ.0) THEN
-!
-!
-      CALL gr_fi_dyn(1,klon,iim+1,jjm+1,airephy,airedyn)
+
+
+!#ifdef _YM_UNUSED_TO_SUPRESS_
+!ym !
+!ym!IM 151004 BEG
+!ym      IF(1.EQ.0) THEN
+!ym!
+!ym      DO k=1, klev
+!ym      DO i=1, klon
+!ym       zx_tmp_fi3d(i,k)=u_seri(i,k)*RA*cos(pir* rlat(i))
+!ym      ENDDO
+!ym      ENDDO
+!ym!
+!ym      CALL moyglo_pondaima(klon, klev, zx_tmp_fi3d,  &
+!ym           airephy, paprs, moyglo)
+!ym      zx_tmp_fi2d(1:klon)=moyglo
+!ym!
+!ym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+!ym      CALL histwrite(nid_day_seri,"momang",itau_w,zx_tmp_2d, &
+!ym                     iim*jjmp1,ndex2d)
+!ym!
+!ym! friction torque
+!ym!
+!ym      DO i=1, klon
+!ym       zx_tmp_fi2d(i)=zxfluxu(i,1)*RA* cos(pir* rlat(i))
+!ym      ENDDO
+!ym!
+!ym      ok_msk=.FALSE.
+!ym      CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy,  &
+!ym           ok_msk, msk, moyglo)
+!ym      zx_tmp_fi2d(1:klon)=moyglo
+!ym!
+!ym      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+!ym      CALL histwrite(nid_day_seri,"frictor",itau_w,zx_tmp_2d, &
+!ym                     iim*jjmp1,ndex2d)
+!ym!
+!ym! mountain torque
+!ym!
+!ym!IM 190504 BEG
+!ym      CALL gr_fi_dyn(1,klon,iim+1,jjm+1,airephy,airedyn)
+!ym      CALL gr_fi_dyn(klev+1,klon,iim+1,jjm+1,paprs,padyn)
+!ym      CALL gr_fi_dyn(1,klon,iim+1,jjm+1,rlat,rlatdyn)
+!ym      
+!ym
+!ym      mountor=0.
+!ym      airetot=0.
+!ym      DO j = 1, jjmp1
+!ym       DO i = 1, iim+1
+!ym        ij=i+(iim+1)*(j-1)
+!ym        zx_tmp(ij)=0.
+!ym        DO k = 1, klev
+!ym         zx_tmp(ij)=zx_tmp(ij)+dudyn(i,j,k)*airedyn(i,j)* &
+!ym                    (padyn(i,j,k+1)-padyn(i,j,k))/RG
+!ym         airetot=airetot+airedyn(i,j)
+!ym        ENDDO
+!ym!IM 190504 mountor=mountor+zx_tmp(ij)*airedyn(i,j)*RA*
+!ym        mountor=mountor+zx_tmp(ij)*RA* &
+!ym                 cos(pir* rlatdyn(i,j))
+!ym       ENDDO
+!ym      ENDDO
+!ym!IM 151004 BEG
+!ym      IF(itap.EQ.1) PRINT*,'airetot=',airetot,airetot/klev
+!ym!IM 151004 END
+!ym!IM 190504      mountor=mountor/(airetot*airetot)
+!ym      mountor=mountor/airetot
+!ym!
+!ym!IM 190504 END
+!ym      zx_tmp_2d(1:iim,1:jjmp1)=mountor
+!ym      CALL histwrite(nid_day_seri,"mountor",itau_w,zx_tmp_2d, &
+!ym                     iim*jjmp1,ndex2d)
+!ym!
+!ym      ENDIF !(1.EQ.0) THEN
+!ym!
+!ym!
+!ym
+!ym      CALL gr_fi_dyn(1,klon,iim+1,jjm+1,airephy,airedyn)
+!#endif      
+      
       CALL gr_fi_ecrit(1,klon,iim,jjmp1,airephy,zx_tmp_2d)
       airetot=0.
@@ -133,4 +141,7 @@
 !     ENDDO !j
 !
+
+
+      airetot=0.
       DO i=1, klon
        airetot=airetot+airephy(i)
Index: namico_lmdz/aquaplanet/LMDZ5/libf/phylmd/wstats.F90
===================================================================
--- /dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/wstats.F90	(revision 3813)
+++ 	(revision )
@@ -1,351 +1,0 @@
-subroutine wstats(ngrid,nom,titre,unite,dim,px)
-
-implicit none
-
-#include "dimensions.h"
-#include "statto.h"
-#include "netcdf.inc"
-
-integer,intent(in) :: ngrid
-character (len=*),intent(in) :: nom,titre,unite
-integer,intent(in) :: dim
-real, dimension(ngrid,llm),intent(in) :: px
-integer,parameter :: iip1=iim+1
-integer,parameter :: jjp1=jjm+1
-real, dimension(iip1,jjp1,llm) :: mean3d,sd3d,dx3
-real, dimension(iip1,jjp1) :: mean2d,sd2d,dx2
-character (len=50) :: namebis
-character (len=50), save :: firstvar
-integer :: ierr,varid,nbdim,nid
-integer :: meanid,sdid
-integer, dimension(4)  :: id,start,size
-logical, save :: firstcall=.TRUE.
-integer :: l,i,j,ig0
-integer,save :: index
-
-integer, save :: step=0
-
-
-if (firstcall) then
-   firstcall=.false.
-   firstvar=trim((nom))
-   call inistats(ierr)
-endif
-
-if (firstvar==nom) then ! If we're back to the first variable
-      step = step + 1
-endif
-
-if (mod(step,istats).ne.0) then
-   RETURN
-endif
-
-ierr = NF_OPEN("stats.nc",NF_WRITE,nid)
-
-namebis=trim(nom)
-ierr= NF_INQ_VARID(nid,namebis,meanid)
-
-if (ierr.ne.NF_NOERR) then
-
-   if (firstvar==nom) then 
-      index=1
-      count=0
-   endif
-
-
-!declaration de la variable
-
-! choix du nom des coordonnees
-   ierr= NF_INQ_DIMID(nid,"longitude",id(1))
-   ierr= NF_INQ_DIMID(nid,"latitude",id(2))
-   if (dim.eq.3) then
-      ierr= NF_INQ_DIMID(nid,"altitude",id(3))
-      ierr= NF_INQ_DIMID(nid,"Time",id(4))
-      nbdim=4
-   else if (dim==2) then
-      ierr= NF_INQ_DIMID(nid,"Time",id(3))
-      nbdim=3
-   endif
-
-   write (*,*) "====================="
-   write (*,*) "STATS: creation de ",nom
-   namebis=trim(nom)
-   call def_var_stats(nid,namebis,titre,unite,nbdim,id,meanid,ierr)
-   call inivar(nid,meanid,ngrid,dim,index,px,ierr)
-   namebis=trim(nom)//"_sd"
-   call def_var_stats(nid,namebis,trim(titre)//" total standard deviation over the season",unite,nbdim,id,sdid,ierr)
-   call inivar(nid,sdid,ngrid,dim,index,px,ierr)
-
-   ierr= NF_CLOSE(nid)
-   return
-
-else
-   namebis=trim(nom)//"_sd"
-   ierr= NF_INQ_VARID(nid,namebis,sdid)
-
-endif
-
-if (firstvar==nom) then 
-   count(index)=count(int(index))+1
-   index=index+1
-   if (index>istime) then
-      index=1
-   endif
-endif
-
-if (count(index)==0) then
-   if (dim.eq.3) then
-      start=(/1,1,1,index/)
-      size=(/iip1,jjp1,llm,1/)
-      mean3d=0
-      sd3d=0
-   else if (dim.eq.2) then
-      start=(/1,1,index,0/)
-      size=(/iip1,jjp1,1,0/)
-      mean2d=0
-      sd2d=0
-   endif
-else
-   if (dim.eq.3) then
-      start=(/1,1,1,index/)
-      size=(/iip1,jjp1,llm,1/)
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE(nid,meanid,start,size,mean3d)
-      ierr = NF_GET_VARA_DOUBLE(nid,sdid,start,size,sd3d)
-#else
-      ierr = NF_GET_VARA_REAL(nid,meanid,start,size,mean3d)
-      ierr = NF_GET_VARA_REAL(nid,sdid,start,size,sd3d)
-#endif
-      if (ierr.ne.NF_NOERR) then
-         write (*,*) NF_STRERROR(ierr)
-         stop ""
-      endif
-
-   else if (dim.eq.2) then
-      start=(/1,1,index,0/)
-      size=(/iip1,jjp1,1,0/)
-#ifdef NC_DOUBLE
-      ierr = NF_GET_VARA_DOUBLE(nid,meanid,start,size,mean2d)
-      ierr = NF_GET_VARA_DOUBLE(nid,sdid,start,size,sd2d)
-#else
-      ierr = NF_GET_VARA_REAL(nid,meanid,start,size,mean2d)
-      ierr = NF_GET_VARA_REAL(nid,sdid,start,size,sd2d)
-#endif
-      if (ierr.ne.NF_NOERR) then
-         write (*,*) NF_STRERROR(ierr)
-         stop ""
-      endif
-   endif
-endif
-
-if (dim.eq.3) then
-
-!  Passage variable physique -->  variable dynamique
-
-   DO l=1,llm
-      DO i=1,iip1
-         dx3(i,1,l)=px(1,l)
-         dx3(i,jjp1,l)=px(ngrid,l)
-      ENDDO
-      DO j=2,jjm
-         ig0= 1+(j-2)*iim
-         DO i=1,iim
-            dx3(i,j,l)=px(ig0+i,l)
-         ENDDO
-         dx3(iip1,j,l)=dx3(1,j,l)
-      ENDDO
-   ENDDO
-
-   mean3d(:,:,:)= mean3d(:,:,:)+dx3(:,:,:)
-   sd3d(:,:,:)= sd3d(:,:,:)+dx3(:,:,:)**2
-
-#ifdef NC_DOUBLE
-   ierr = NF_PUT_VARA_DOUBLE(nid,meanid,start,size,mean3d)
-   ierr = NF_PUT_VARA_DOUBLE(nid,sdid,start,size,sd3d)
-#else
-   ierr = NF_PUT_VARA_REAL(nid,meanid,start,size,mean3d)
-   ierr = NF_PUT_VARA_REAL(nid,sdid,start,size,sd3d)
-#endif
-   if (ierr.ne.NF_NOERR) then
-     write (*,*) NF_STRERROR(ierr)
-     stop ""
-   endif
-
-else if (dim.eq.2) then
-
-!    Passage variable physique -->  physique dynamique
-
-  DO i=1,iip1
-     dx2(i,1)=px(1,1)
-     dx2(i,jjp1)=px(ngrid,1)
-  ENDDO
-  DO j=2,jjm
-     ig0= 1+(j-2)*iim
-     DO i=1,iim
-        dx2(i,j)=px(ig0+i,1)
-     ENDDO
-     dx2(iip1,j)=dx2(1,j)
-  ENDDO
-
-   mean2d(:,:)= mean2d(:,:)+dx2(:,:)
-   sd2d(:,:)= sd2d(:,:)+dx2(:,:)**2
-
-#ifdef NC_DOUBLE
-   ierr = NF_PUT_VARA_DOUBLE(nid,meanid,start,size,mean2d)
-   ierr = NF_PUT_VARA_DOUBLE(nid,sdid,start,size,sd2d)
-#else
-   ierr = NF_PUT_VARA_REAL(nid,meanid,start,size,mean2d)
-   ierr = NF_PUT_VARA_REAL(nid,sdid,start,size,sd2d)
-#endif
-   if (ierr.ne.NF_NOERR) then
-     write (*,*) NF_STRERROR(ierr)
-     stop ""
-   endif
-
-endif
-
-ierr= NF_CLOSE(nid)
-
-end subroutine wstats
-
-!======================================================
-subroutine inivar(nid,varid,ngrid,dim,index,px,ierr)
-
-implicit none
-
-include "dimensions.h"
-!!!!!!include "dimphys.h"
-include "netcdf.inc"
-
-integer, intent(in) :: nid,varid,dim,index,ngrid
-real, dimension(ngrid,llm), intent(in) :: px
-integer, intent(out) :: ierr
-
-integer,parameter :: iip1=iim+1
-integer,parameter :: jjp1=jjm+1
-
-integer :: l,i,j,ig0
-integer, dimension(4) :: start,size
-real, dimension(iip1,jjp1,llm) :: dx3
-real, dimension(iip1,jjp1) :: dx2
-
-if (dim.eq.3) then
-
-   start=(/1,1,1,index/)
-   size=(/iip1,jjp1,llm,1/)
-
-!  Passage variable physique -->  variable dynamique
-
-   DO l=1,llm
-      DO i=1,iip1
-         dx3(i,1,l)=px(1,l)
-         dx3(i,jjp1,l)=px(ngrid,l)
-      ENDDO
-      DO j=2,jjm
-         ig0= 1+(j-2)*iim
-         DO i=1,iim
-            dx3(i,j,l)=px(ig0+i,l)
-         ENDDO
-         dx3(iip1,j,l)=dx3(1,j,l)
-      ENDDO
-   ENDDO
-
-#ifdef NC_DOUBLE
-   ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,size,dx3)
-#else
-   ierr = NF_PUT_VARA_REAL(nid,varid,start,size,dx3)
-#endif
-
-else if (dim.eq.2) then
-
-      start=(/1,1,index,0/)
-      size=(/iip1,jjp1,1,0/)
-
-!    Passage variable physique -->  physique dynamique
-
-  DO i=1,iip1
-     dx2(i,1)=px(1,1)
-     dx2(i,jjp1)=px(ngrid,1)
-  ENDDO
-  DO j=2,jjm
-     ig0= 1+(j-2)*iim
-     DO i=1,iim
-        dx2(i,j)=px(ig0+i,1)
-     ENDDO
-     dx2(iip1,j)=dx2(1,j)
-  ENDDO
-
-#ifdef NC_DOUBLE
-   ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,size,dx2)
-#else
-   ierr = NF_PUT_VARA_REAL(nid,varid,start,size,dx2)
-#endif
-
-endif
-
-end subroutine inivar
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-subroutine def_var_stats(nid,name,title,units,nbdim,dimids,nvarid,ierr)
-
-! This subroutine defines variable 'name' in a (pre-existing and opened)
-! NetCDF file (known from its NetCDF ID 'nid').
-! The number of dimensions 'nbdim' of the variable, as well as the IDs of
-! corresponding dimensions must be set (in array 'dimids').
-! Upon successfull definition of the variable, 'nvarid' contains the
-! NetCDF ID of the variable.
-! The variables' attributes 'title' (Note that 'long_name' would be more
-! appropriate) and 'units' are also set. 
-
-implicit none
-
-#include "netcdf.inc"
-
-integer,intent(in) :: nid ! NetCDF file ID
-character(len=*),intent(in) :: name ! the variable's name
-character(len=*),intent(in) :: title ! 'title' attribute of variable
-character(len=*),intent(in) :: units ! 'units' attribute of variable
-integer,intent(in) :: nbdim ! number of dimensions of the variable
-integer,dimension(nbdim),intent(in) :: dimids ! NetCDF IDs of the dimensions
-                                              ! the variable is defined along
-integer,intent(out) :: nvarid ! NetCDF ID of the variable
-integer,intent(out) :: ierr ! returned NetCDF staus code
-
-! 1. Switch to NetCDF define mode 
-ierr=NF_REDEF(nid)
-
-! 2. Define the variable
-#ifdef NC_DOUBLE
-ierr = NF_DEF_VAR (nid,adjustl(name),NF_DOUBLE,nbdim,dimids,nvarid)
-#else
-ierr = NF_DEF_VAR (nid,adjustl(name),NF_FLOAT,nbdim,dimids,nvarid)
-#endif
-if(ierr/=NF_NOERR) then
-   write(*,*) "def_var_stats: Failed defining variable "//trim(name)
-   write(*,*) NF_STRERROR(ierr)
-   stop ""
-endif
-
-! 3. Write attributes
-ierr=NF_PUT_ATT_TEXT(nid,nvarid,"title",&
-                     len_trim(adjustl(title)),adjustl(title))
-if(ierr/=NF_NOERR) then
-   write(*,*) "def_var_stats: Failed writing title attribute for "//trim(name)
-   write(*,*) NF_STRERROR(ierr)
-   stop ""
-endif
-
-ierr=NF_PUT_ATT_TEXT(nid,nvarid,"units",&
-                     len_trim(adjustl(units)),adjustl(units))
-if(ierr/=NF_NOERR) then
-   write(*,*) "def_var_stats: Failed writing units attribute for "//trim(name)
-   write(*,*) NF_STRERROR(ierr)
-   stop ""
-endif
-
-! 4. Switch out of NetCDF define mode
-ierr = NF_ENDDEF(nid)
-
-end subroutine def_var_stats
-
