Index: trunk/LMDZ.COMMON/libf/bibio/wxios.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/bibio/wxios.F90	(revision 1019)
+++ trunk/LMDZ.COMMON/libf/bibio/wxios.F90	(revision 1019)
@@ -0,0 +1,425 @@
+! $Id: wxios.F90 $
+#ifdef CPP_XIOS
+MODULE wxios
+    USE xios
+    USE iaxis
+    USE iaxis_attr
+    USE icontext_attr
+    USE idate
+    USE idomain_attr
+    USE ifield_attr
+    USE ifile_attr
+    USE ixml_tree
+
+    !Variables disponibles pendant toute l'execution du programme:
+    
+    INTEGER, SAVE :: g_comm
+    CHARACTER(len=100), SAVE :: g_ctx_name
+    TYPE(xios_context), SAVE :: g_ctx
+!$OMP THREADPRIVATE(g_comm,g_cts_name,g_ctx)
+
+    CONTAINS
+    
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    !   str + i   =>   str_i   !!!!!!!!!!!!!!!!!!!!
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    
+    SUBROUTINE concat(str, i, str_i) !MAX i = 99
+        CHARACTER(len=*), INTENT(IN) :: str
+        INTEGER, INTENT(IN) :: i
+        CHARACTER(len=100), INTENT(OUT) :: str_i
+        
+        
+        !INT -> CHAR:
+        CHARACTER(len=10) :: num
+        WRITE(num, "(I5)") i
+        str_i = TRIM(ADJUSTL(str//"_"//TRIM(ADJUSTL(num))))
+        
+    END SUBROUTINE concat
+    
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    !   36day => 36d etc     !!!!!!!!!!!!!!!!!!!!
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    
+    SUBROUTINE reformadate(odate, ndate)
+        CHARACTER(len=*), INTENT(IN) :: odate
+        CHARACTER(len=100), INTENT(OUT) :: ndate
+        
+        INTEGER :: i = 0
+        
+        i = INDEX(odate, "day")
+        IF (i > 0) THEN
+            ndate = odate(1:i-1)//"d"
+        ELSE
+            i = INDEX(odate, "hr")
+            IF (i > 0) THEN
+                ndate = odate(1:i-1)//"h"
+            ELSE
+                ndate = odate
+            END IF
+        END IF
+        
+        !WRITE(*,*) "Xios. ", odate, " => ", ndate
+    END SUBROUTINE reformadate
+    
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    !   ave(X) => average etc     !!!!!!!!!!!!!!!
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    
+    CHARACTER(len=7) FUNCTION reformaop(op)
+        CHARACTER(len=*), INTENT(IN) :: op
+        
+        INTEGER :: i = 0
+        reformaop = "average"
+        
+        IF (op.EQ."inst(X)") THEN
+            reformaop = "instant"
+        END IF
+        
+        IF (op.EQ."once") THEN
+            reformaop = "once"
+        END IF
+        
+        IF (op.EQ."t_max(X)") THEN
+            reformaop = "maximum"
+        END IF
+        
+        IF (op.EQ."t_min(X)") THEN
+            reformaop = "minimum"
+        END IF
+        
+        !WRITE(*,*) "Xios. ", op, " => ", reformaop
+    END FUNCTION reformaop
+
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    ! Routine d'initialisation      !!!!!!!!!!!!!
+    !     A lancer juste aprÃ¨s mpi_init !!!!!!!!!!!!!
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+    SUBROUTINE wxios_init(xios_ctx_name)
+      CHARACTER(len=*), INTENT(IN) :: xios_ctx_name
+        
+      INTEGER :: xios_comm
+        TYPE(xios_context) :: xios_ctx
+      
+        WRITE(*,*) "Xios. Initialization"
+
+        !Lancement de xios:
+        CALL xios_initialize(xios_ctx_name, return_comm = xios_comm )
+        
+        !Initialisation du contexte:
+        CALL xios_context_initialize(xios_ctx_name, xios_comm)
+        CALL xios_get_handle(xios_ctx_name, xios_ctx)    !RÃ©cupÃ©ration
+        CALL xios_set_current_context(xios_ctx)            !Activation
+        
+        !Enregistrement des variables globales:
+        g_comm = xios_comm
+        g_ctx_name = xios_ctx_name
+        g_ctx = xios_ctx
+        
+        WRITE(*,*) "Xios. Current context is ", xios_ctx_name
+    END SUBROUTINE wxios_init
+
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    ! Routine de paramÃ©trisation !!!!!!!!!!!!!!!!!!
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+    SUBROUTINE wxios_set_cal(pasdetemps, calendrier, annee, mois, jour, heure)
+     !ParamÃ¨tres:
+     CHARACTER(len=*), INTENT(IN) :: calendrier
+     INTEGER, INTENT(IN) :: annee, mois, jour
+     REAL, INTENT(IN) :: pasdetemps, heure
+     
+     !Variables:
+     CHARACTER(len=80) :: abort_message
+     CHARACTER(len=19) :: date
+     INTEGER :: njour = 1
+     
+     !Variables pour xios:
+     TYPE(xios_time) :: mdtime
+     !REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=0
+     
+        mdtime = xios_time(0, 0, 0, 0, 0, pasdetemps)
+
+        !RÃ©glage du calendrier:
+        SELECT CASE (calendrier)
+            CASE('earth_360d')
+                CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "D360")
+                WRITE(*,*) 'Xios. Calendrier terrestre a 360 jours/an'
+            CASE('earth_365d')
+                CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "NoLeap")
+                WRITE(*,*) 'Xios. Calendrier terrestre a 365 jours/an'
+            CASE('earth_366d')
+                CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "Gregorian")
+                WRITE(*,*) 'Xios. Calendrier gregorien'
+            CASE DEFAULT
+                abort_message = 'Xios. Mauvais choix de calendrier'
+                CALL abort_gcm('Gcm:Xios',abort_message,1)
+        END SELECT
+        
+        !Formatage de la date de dÃ©part:
+        WRITE(date, "(i4.4,'-',i2.2,'-',i2.2,' 00:00:00')") annee, mois, jour
+        
+        WRITE(*,*) "Xios. Initial time: ", date
+        
+        CALL xios_set_context_attr_hdl(g_ctx, start_date= date)
+        
+        !Et enfin,le pas de temps:
+        CALL xios_set_timestep(mdtime)
+        WRITE(*,*) "Xios. ts=",mdtime
+    END SUBROUTINE wxios_set_cal
+
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    ! Pour initialiser un domaine !!!!!!!!!!!!!!!!!!!!
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    SUBROUTINE wxios_domain_param(dom_id, is_sequential, iim, jjm, io_lat, io_lon)
+         
+        CHARACTER (len=*), INTENT(IN) :: dom_id
+        LOGICAL, INTENT(IN) :: is_sequential
+        INTEGER, INTENT(IN) :: iim, jjm
+        REAL, DIMENSION(:) :: io_lat, io_lon
+        
+        
+        TYPE(xios_domain) :: dom
+        INTEGER :: ni, nj, ni_glo, nj_glo, ibegin, iend, jbegin, jend
+        LOGICAl :: boool
+        
+        ni_glo = iim
+        nj_glo = jjm
+        ni = iim
+        nj = jjm
+        ibegin = 1
+        jbegin = 1
+        iend = ibegin + ni - 1
+        jend = jbegin + nj - 1
+        
+        !On rÃ©cupÃ¨re le handle:
+        CALL xios_get_domain_handle(dom_id, dom)
+        
+        WRITE(*,*) "Xios. ni:",iim," ni_glo:", iim, " nj:", jjm, " nj_glo:", jjm
+        WRITE(*,*) "Xios. Size lon:", SIZE(io_lon), " lat:", SIZE(io_lat)
+        
+        !On parametrise le domaine:
+        !IF (is_sequential) THEN
+            CALL xios_set_domain_attr_hdl(dom, ni_glo=iim, ibegin=1, ni=iim,&
+            & nj_glo=jjm, jbegin=1,nj=jjm,&
+            & lonvalue=io_lon(ibegin:iend), latvalue=io_lat(jbegin:jend))
+        !END IF
+         CALL xios_is_defined_domain_attr_hdl(dom,ni_glo=boool)
+        !VÃ©rification:
+        IF (xios_is_valid_domain(dom_id)) THEN
+            WRITE(*,*) "Xios. Domain initialized: ", dom_id, boool
+        ELSE
+            WRITE(*,*) "Xios. Invalid domain: ", dom_id
+        END IF
+    END SUBROUTINE wxios_domain_param
+    
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    ! Pour dÃ©clarer un axe vertical !!!!!!!!!!!!!!!
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    SUBROUTINE wxios_add_vaxis(axisgroup_id, axis_file_id, axis_size, axis_value)
+        CHARACTER (len=*), INTENT(IN) :: axisgroup_id
+        INTEGER, INTENT(IN) :: axis_file_id, axis_size
+        REAL, DIMENSION(axis_size), INTENT(IN) :: axis_value
+        
+        TYPE(xios_axisgroup) :: axgroup
+        TYPE(xios_axis) :: ax
+        CHARACTER(len=100) :: axis_id
+        
+        
+        !PrÃ©paration du nom de l'axe:
+        CALL concat(axisgroup_id, axis_file_id, axis_id)
+        
+        !On rÃ©cupÃ¨re le groupe d'axes qui va bien:
+        CALL xios_get_axisgroup_handle(axisgroup_id, axgroup)
+        
+        !On ajoute l'axe correspondant Ã  ce fichier:
+        CALL xios_add_axis(axgroup, ax, axis_id)
+        
+        !Et on le parametrise:
+        CALL xios_set_axis_attr_hdl(ax, size=axis_size, value=axis_value)
+        
+        !VÃ©rification:
+        IF (xios_is_valid_axis(axis_id)) THEN
+            WRITE(*,*) "Xios. Axis created: ", axis_id
+        ELSE
+            WRITE(*,*) "Xios. Invalid axis: ", axis_id
+        END IF
+
+    END SUBROUTINE wxios_add_vaxis
+    
+    
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    ! Pour dÃ©clarer un fichier  !!!!!!!!!!!!!!!!!!!
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    SUBROUTINE wxios_add_file(fname, ffreq, flvl)
+        CHARACTER(len=*), INTENT(IN) :: fname
+        CHARACTER(len=*), INTENT(IN) :: ffreq
+        INTEGER, INTENT(IN) :: flvl
+        
+        TYPE(xios_file) :: x_file
+        TYPE(xios_filegroup) :: x_fg
+        CHARACTER(len=100) :: nffreq
+        
+        !On crÃ©Ã© le noeud:
+        CALL xios_get_filegroup_handle("defile", x_fg)
+        CALL xios_add_file(x_fg, x_file, "X"//fname)
+        
+        !On reformate la frÃ©quence:
+        CALL reformadate(ffreq, nffreq)
+        
+        !On configure:
+        CALL xios_set_file_attr_hdl(x_file, name="X"//fname,&
+                output_freq=TRIM(ADJUSTL(nffreq)), output_level=flvl, enabled=.TRUE.)
+        
+        IF (xios_is_valid_file("X"//fname)) THEN
+            WRITE(*,*) "Xios. New file: ", "X"//fname
+            WRITE(*,*) "Xios. output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
+        ELSE
+            WRITE(*,*) "Xios. Error, invalid file: ", "X"//fname
+            WRITE(*,*) "Xios. output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
+        END IF
+    END SUBROUTINE wxios_add_file
+    
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    ! Pour crÃ©er un champ      !!!!!!!!!!!!!!!
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    SUBROUTINE wxios_add_field(fieldname, fieldgroup, fieldlongname, fieldunit)
+        USE netcdf
+        
+        CHARACTER(len=*), INTENT(IN) :: fieldname
+        TYPE(xios_fieldgroup), INTENT(IN) :: fieldgroup
+        CHARACTER(len=*), INTENT(IN) :: fieldlongname
+        CHARACTER(len=*), INTENT(IN) :: fieldunit
+        
+        TYPE(xios_field) :: field
+        CHARACTER(len=10) :: newunit
+        REAL(KIND=8) :: def
+        
+        !La valeur par dÃ©faut des champs non dÃ©finis:
+        def = nf90_fill_real
+        
+        IF (fieldunit .EQ. " ") THEN
+            newunit = "-"
+        ELSE
+            newunit = fieldunit
+        ENDIF
+        
+        !On ajoute le champ:
+        CALL xios_add_field(fieldgroup, field, fieldname)
+        !WRITE(*,*) "Xios. ",fieldname,fieldgroup, fieldlongname, fieldunit
+        
+        !On rentre ses paramÃ¨tres:
+        CALL xios_set_field_attr_hdl(field, standard_name=fieldlongname, unit=newunit, default_value=def)
+        WRITE(*,*) "Xios. Champ ", fieldname, "cree:"
+        WRITE(*,*) "Xios. long_name=",fieldlongname,"; unit=",newunit,";  default_value=",nf90_fill_real
+
+    END SUBROUTINE wxios_add_field
+    
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    ! Pour dÃ©clarer un champ      !!!!!!!!!!!!!!!
+    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    SUBROUTINE wxios_add_field_to_file(fieldname, fdim, fid, fname, fieldlongname, fieldunit, field_level, op)
+        CHARACTER(len=*), INTENT(IN) :: fieldname
+        INTEGER, INTENT(IN)          :: fdim, fid
+        CHARACTER(len=*), INTENT(IN) :: fname
+        CHARACTER(len=*), INTENT(IN) :: fieldlongname
+        CHARACTER(len=*), INTENT(IN) :: fieldunit
+        INTEGER, INTENT(IN)          :: field_level
+        CHARACTER(len=*), INTENT(IN) :: op
+        
+        CHARACTER(len=100) :: axis_id
+        CHARACTER(len=100) :: operation
+        TYPE(xios_file) :: f
+        TYPE(xios_field) :: field
+        TYPE(xios_fieldgroup) :: fieldgroup
+        
+        
+        !PrÃ©paration du nom de l'axe:
+        CALL concat("presnivs", fid, axis_id)
+        
+        !on prÃ©pare le nom de l'opÃ©ration:
+        operation = reformaop(op)
+        
+        
+        
+        !On selectionne le bon groupe de champs:
+        IF (fdim.EQ.2) THEN
+            CALL xios_get_fieldgroup_handle("fields_2D", fieldgroup)
+        ELSE
+          CALL xios_get_fieldgroup_handle("fields_3D", fieldgroup)
+        ENDIF
+        
+        !On regarde si le champ Ã  dÃ©jÃ  Ã©tÃ© crÃ©Ã© ou non:
+        IF (xios_is_valid_field(fieldname)) THEN
+            WRITE(*,*) "Xios. Champ ", fieldname, "existe"
+        ELSE
+            WRITE(*,*) "Xios. Champ ", fieldname, "nexiste pas"
+            
+            !On le crÃ©Ã©:
+            CALL wxios_add_field(fieldname,  fieldgroup, fieldlongname, fieldunit)
+            IF (xios_is_valid_field(fieldname)) THEN
+                WRITE(*,*) "Xios. Champ ", fieldname, "cree"
+            ENDIF
+        ENDIF
+        
+        !On ajoute le champ:
+        CALL xios_get_file_handle("X"//fname, f)
+        CALL xios_add_fieldtofile(f, field)
+        
+        
+        !L'operation, sa frequence:
+        CALL xios_set_field_attr_hdl(field, field_ref=fieldname, operation=TRIM(ADJUSTL(operation)), freq_op="1ts", prec=4)
+
+        
+        !On rentre ses paramÃ¨tres:
+        CALL xios_set_field_attr_hdl(field, level=field_level, enabled=.TRUE.)
+        
+        IF (fdim.EQ.2) THEN
+            !Si c'est un champ 2D:
+            WRITE(*,*) "Xios. Champ 2D ", fieldname, " de ", "X"//fname ," configure:"
+            WRITE (*,*) "Xios. op=", TRIM(ADJUSTL(operation))
+            WRITE(*,*) "Xios. freq_op=1ts","; lvl=",field_level
+        ELSE
+            !Si 3D :
+            !On ajoute l'axe vertical qui va bien:
+            CALL xios_set_field_attr_hdl(field, axis_ref=axis_id)
+            
+            WRITE(*,*) "Xios. Champ 3D ", fieldname, " de ", "X"//fname, "configure:"
+            WRITE(*,*) "Xios. freq_op=1ts","; lvl=",field_level
+            WRITE(*,*) "Xios. axe=",axis_id
+        END IF
+        
+    END SUBROUTINE wxios_add_field_to_file
+    
+    SUBROUTINE wxios_update_calendar(ito)
+        INTEGER, INTENT(IN) :: ito
+        CALL xios_update_calendar(ito)
+    END SUBROUTINE wxios_update_calendar
+    
+    SUBROUTINE wxios_write_2D(fieldname, fdata)
+        CHARACTER(len=*), INTENT(IN) :: fieldname
+        REAL, DIMENSION(:,:), INTENT(IN) :: fdata
+        
+        CALL xios_send_field(fieldname, fdata)
+    END SUBROUTINE wxios_write_2D
+    
+    SUBROUTINE wxios_write_3D(fieldname, fdata)
+        CHARACTER(len=*), INTENT(IN) :: fieldname
+        REAL, DIMENSION(:,:,:), INTENT(IN) :: fdata
+        
+        CALL xios_send_field(fieldname, fdata)
+    END SUBROUTINE wxios_write_3D
+    
+    SUBROUTINE wxios_closedef()
+        CALL xios_close_context_definition()
+        CALL xios_update_calendar(0)
+    END SUBROUTINE wxios_closedef
+    
+    SUBROUTINE wxios_close()
+        CALL xios_context_finalize()
+         CALL xios_finalize()
+     END SUBROUTINE wxios_close
+END MODULE wxios
+#endif
+
Index: trunk/LMDZ.COMMON/libf/dyn3d/advtrac.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/advtrac.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3d/advtrac.F90	(revision 1019)
@@ -203,6 +203,6 @@
      if (countcfl==day_step) then
         do l=1,llm
-           write(lunout,*) 'L, CFLmax ' &
-                ,l,maxval(cflx(:,l)),maxval(cfly(:,l)),maxval(cflz(:,l))
+           write(lunout,*) 'L, CFL[xyz]max:', l, cflxmax(l), cflymax(l), &
+                cflzmax(l)
         enddo
         countcfl=0
Index: trunk/LMDZ.COMMON/libf/dyn3d/ce0l.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/ce0l.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3d/ce0l.F90	(revision 1019)
@@ -20,4 +20,5 @@
   USE comgeomphy
   USE infotrac
+  USE indice_sol_mod
 
 #ifdef CPP_IOIPSL
@@ -36,5 +37,5 @@
 #include "dimensions.h"
 #include "paramet.h"
-#include "indicesol.h"
+!#include "indicesol.h"
 #include "iniprint.h"
 #include "temps.h"
Index: trunk/LMDZ.COMMON/libf/dyn3d/comvert.h
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/comvert.h	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3d/comvert.h	(revision 1019)
@@ -23,5 +23,6 @@
       real bps    ! hybrid sigma contribution at mid-layers
       real scaleheight ! atmospheric (reference) scale height (km)
-      real pseudoalt ! for planets
+      real pseudoalt ! pseudo-altitude of model levels (km), based on presnivs(),
+                     ! preff and scaleheight
 
       integer disvert_type ! type of vertical discretization:
Index: trunk/LMDZ.COMMON/libf/dyn3d/gcm.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/gcm.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3d/gcm.F	(revision 1019)
@@ -13,8 +13,19 @@
 #endif
 
+
+#ifdef CPP_XIOS
+    ! ug Pour les sorties XIOS
+	USE wxios
+#endif
+
       USE filtreg_mod
       USE infotrac
       USE control_mod
       use cpdet_mod, only: ini_cpdet
+
+#ifdef INCA
+! Only INCA needs these informations (from the Earth's physics)
+      USE indice_sol_mod
+#endif
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -81,5 +92,5 @@
 #ifdef INCA
 ! Only INCA needs these informations (from the Earth's physics)
-#include "indicesol.h"
+!#include "indicesol.h"
 #endif
 
@@ -173,4 +184,13 @@
 !      CALL defrun( 99, .TRUE. , clesphy0 )
 !#endif
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Initialisation de XIOS
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+#ifdef CPP_XIOS
+	CALL wxios_init("LMDZ")
+#endif
+
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Index: trunk/LMDZ.COMMON/libf/dyn3d/inigeom.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3d/inigeom.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3d/inigeom.F	(revision 1019)
@@ -426,10 +426,10 @@
          radclatm = 0.5* rad * coslatm
 c
+         ai14            = un4rad2 * coslatp * yprp
+         ai23            = un4rad2 * coslatm * yprm
          DO 32 i = 1,iim
          xprp            = xprimp025( i )
          xprm            = xprimm025( i )
       
-         ai14            = un4rad2 * coslatp * yprp
-         ai23            = un4rad2 * coslatm * yprm
          aireij1 ( i,j ) = ai14 * xprp
          aireij2 ( i,j ) = ai23 * xprp
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/abort_gcm.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/abort_gcm.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/abort_gcm.F	(revision 1019)
@@ -12,5 +12,5 @@
       USE ioipsl_getincom
 #endif
-      USE parallel
+      USE parallel_lmdz
 #include "iniprint.h"
  
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/addfi_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/addfi_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/addfi_p.F	(revision 1019)
@@ -5,5 +5,5 @@
      S          pucov, pvcov, pteta, pq   , pps ,
      S          pdufi, pdvfi, pdhfi,pdqfi, pdpfi  )
-      USE parallel
+      USE parallel_lmdz
       USE infotrac, ONLY : nqtot
       USE control_mod, ONLY : planet_type
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/advect_new_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/advect_new_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/advect_new_p.F	(revision 1019)
@@ -4,5 +4,5 @@
       SUBROUTINE advect_new_p(ucov,vcov,teta,w,massebx,masseby,
      &                        du,dv,dteta)
-      USE parallel
+      USE parallel_lmdz
       USE write_field_p
       IMPLICIT NONE
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/advect_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/advect_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/advect_p.F	(revision 1019)
@@ -3,5 +3,5 @@
 !
       SUBROUTINE advect_p(ucov,vcov,teta,w,massebx,masseby,du,dv,dteta)
-      USE parallel
+      USE parallel_lmdz
       USE write_field_p
       IMPLICIT NONE
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/advtrac_p.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/advtrac_p.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/advtrac_p.F90	(revision 1019)
@@ -10,5 +10,5 @@
   !            M.A Filiberti (04/2002)
   !
-  USE parallel
+  USE parallel_lmdz
   USE Write_Field_p
   USE Bands
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/bands.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/bands.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/bands.F90	(revision 1019)
@@ -19,5 +19,5 @@
   
   subroutine AllocateBands
-    use parallel
+    use parallel_lmdz
     implicit none
     
@@ -33,5 +33,5 @@
   
   subroutine Read_distrib
-    use parallel
+    use parallel_lmdz
     implicit none
 
@@ -92,5 +92,5 @@
    
    SUBROUTINE  Set_Bands 
-     USE parallel
+     USE parallel_lmdz
 #ifdef CPP_PHYS
 ! Ehouarn: what follows is only related to // physics
@@ -134,5 +134,5 @@
     subroutine AdjustBands_caldyn
       use times
-      use parallel
+      use parallel_lmdz
       implicit none
 
@@ -199,5 +199,5 @@
     subroutine AdjustBands_vanleer
       use times
-      use parallel
+      use parallel_lmdz
       implicit none
 
@@ -265,5 +265,5 @@
     subroutine AdjustBands_dissip
       use times
-      use parallel
+      use parallel_lmdz
       implicit none
 
@@ -335,5 +335,5 @@
       USE mod_phys_lmdz_para, only : klon_mpi_para_nb
 #endif
-      USE parallel
+      USE parallel_lmdz
       implicit none
 
@@ -385,5 +385,5 @@
 
     subroutine WriteBands
-    USE parallel
+    USE parallel_lmdz
     implicit none
     include "dimensions.h"
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/bernoui_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/bernoui_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/bernoui_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE bernoui_p (ngrid,nlay,pphi,pecin,pbern)
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/bilan_dyn_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/bilan_dyn_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/bilan_dyn_p.F	(revision 1019)
@@ -13,5 +13,5 @@
       USE IOIPSL
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       use misc_mod
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/caldyn_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/caldyn_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/caldyn_p.F	(revision 1019)
@@ -10,5 +10,5 @@
      $ (itau,ucov,vcov,teta,ps,masse,pk,pkf,tsurpk,phis ,
      $  phi,conser,du,dv,dteta,dp,w,pbaru,pbarv,time )
-      USE parallel
+      USE parallel_lmdz
       USE Write_Field_p
       
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/calfis_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/calfis_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/calfis_p.F	(revision 1019)
@@ -33,5 +33,5 @@
       USE IOPHY
 #endif
-      USE parallel, ONLY : omp_chunk, using_mpi
+      USE parallel_lmdz, ONLY : omp_chunk, using_mpi
       USE Write_Field
       Use Write_field_p
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/ce0l.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/ce0l.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/ce0l.F90	(revision 1019)
@@ -22,5 +22,6 @@
   USE mod_const_mpi
   USE infotrac
-  USE parallel, ONLY: finalize_parallel
+  USE parallel_lmdz, ONLY: finalize_parallel
+  USE indice_sol_mod
 
 #ifdef CPP_IOIPSL
@@ -39,5 +40,5 @@
 #include "dimensions.h"
 #include "paramet.h"
-#include "indicesol.h"
+!#include "indicesol.h"
 #include "iniprint.h"
 #include "temps.h"
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/comvert.h
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/comvert.h	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/comvert.h	(revision 1019)
@@ -23,5 +23,6 @@
       real bps    ! hybrid sigma contribution at mid-layers
       real scaleheight ! atmospheric (reference) scale height (km)
-      real pseudoalt ! for planets
+      real pseudoalt ! pseudo-altitude of model levels (km), based on presnivs(),
+                     ! preff and scaleheight
 
       integer disvert_type ! type of vertical discretization:
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/conf_gcm.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/conf_gcm.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/conf_gcm.F	(revision 1019)
@@ -15,5 +15,5 @@
       use mod_filtre_fft, ONLY : use_filtre_fft
       use mod_hallo, ONLY : use_mpi_alloc
-      use parallel, ONLY : omp_chunk
+      use parallel_lmdz, ONLY : omp_chunk
       USE control_mod
       USE infotrac, ONLY : type_trac
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/convflu_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/convflu_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/convflu_p.F	(revision 1019)
@@ -15,5 +15,5 @@
 c     nbniv   est le nombre de niveaux vert. de  xflu et de yflu .
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/convmas1_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/convmas1_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/convmas1_p.F	(revision 1019)
@@ -1,5 +1,5 @@
       SUBROUTINE convmas1_p (pbaru, pbarv, convm )
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/convmas2_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/convmas2_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/convmas2_p.F	(revision 1019)
@@ -1,5 +1,5 @@
       SUBROUTINE convmas2_p ( convm )
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/convmas_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/convmas_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/convmas_p.F	(revision 1019)
@@ -1,5 +1,5 @@
       SUBROUTINE convmas_p (pbaru, pbarv, convm )
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/covcont_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/covcont_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/covcont_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE covcont_p (klevel,ucov, vcov, ucont, vcont )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/covnat_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/covnat_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/covnat_p.F	(revision 1019)
@@ -3,5 +3,5 @@
 !
       SUBROUTINE covnat_p(klevel,ucov, vcov, unat, vnat )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/cpdet_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/cpdet_mod.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/cpdet_mod.F90	(revision 1019)
@@ -141,5 +141,5 @@
 ! Parallel version of t2tpot, over the full dynamics (scalar) grid
 ! (more efficient than multiple calls to t2tpot_p() with slices of data)
-      USE parallel, only : jj_begin,jj_end
+      USE parallel_lmdz, only : jj_begin,jj_end
       USE control_mod, only : planet_type
       IMPLICIT none
@@ -254,5 +254,5 @@
 ! Parallel version of tpot2t, over the full dynamics (scalar) grid
 ! (more efficient than multiple calls to tpot2t_p() with slices of data)
-      USE parallel, only : jj_begin,jj_end
+      USE parallel_lmdz, only : jj_begin,jj_end
       USE control_mod, only : planet_type
       IMPLICIT none
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/dissip_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/dissip_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/dissip_p.F	(revision 1019)
@@ -1,5 +1,5 @@
       SUBROUTINE dissip_p( vcov,ucov,teta,p, dv,du,dh )
 c
-      USE parallel
+      USE parallel_lmdz
       USE write_field_p
       IMPLICIT NONE
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/diverg_gam_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/diverg_gam_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/diverg_gam_p.F	(revision 1019)
@@ -9,5 +9,5 @@
 c              x et y  etant des composantes covariantes   ...
 c  *********************************************************************
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/diverg_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/diverg_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/diverg_p.F	(revision 1019)
@@ -8,5 +8,5 @@
 c              x et y  etant des composantes covariantes   ...
 c  *********************************************************************
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/divergf_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/divergf_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/divergf_p.F	(revision 1019)
@@ -8,5 +8,5 @@
 c              x et y  etant des composantes covariantes   ...
 c  *********************************************************************
-      USE PARALLEL
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/divgrad2_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/divgrad2_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/divgrad2_p.F	(revision 1019)
@@ -10,5 +10,5 @@
 c         divgra     est  un argument  de sortie pour le s-prg
 c
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE mod_hallo
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/divgrad_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/divgrad_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/divgrad_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE divgrad_p (klevel,h, lh, divgra_out )
-      USE parallel
+      USE parallel_lmdz
       USE times
       IMPLICIT NONE
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/dteta1_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/dteta1_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/dteta1_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE dteta1_p ( teta, pbaru, pbarv, dteta)
-      USE parallel
+      USE parallel_lmdz
       USE write_field_p
       IMPLICIT NONE
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/dudv1_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/dudv1_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/dudv1_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE dudv1_p ( vorpot, pbaru, pbarv, du, dv )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/dudv2_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/dudv2_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/dudv2_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE dudv2_p ( teta, pkf, bern, du, dv  )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/dynredem_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/dynredem_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/dynredem_p.F	(revision 1019)
@@ -7,5 +7,5 @@
       USE IOIPSL
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE infotrac
       use netcdf95, only: NF95_PUT_VAR
@@ -580,5 +580,5 @@
       SUBROUTINE dynredem1_p(fichnom,time,
      .                     vcov,ucov,teta,q,masse,ps)
-      USE parallel
+      USE parallel_lmdz
       USE infotrac
       USE control_mod, only : planet_type
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/enercin_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/enercin_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/enercin_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE enercin_p ( vcov, ucov, vcont, ucont, ecin )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/exner_hyb_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/exner_hyb_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/exner_hyb_p.F	(revision 1019)
@@ -29,5 +29,5 @@
 c
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/exner_milieu_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/exner_milieu_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/exner_milieu_p.F	(revision 1019)
@@ -26,5 +26,5 @@
 c    ( voir note de Fr.Hourdin )  ,
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/filtreg_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/filtreg_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/filtreg_p.F	(revision 1019)
@@ -3,5 +3,5 @@
       SUBROUTINE filtreg_p ( champ, ibeg, iend, nlat, nbniv, 
      &     ifiltre, iaire, griscal ,iter)
-      USE Parallel, only : OMP_CHUNK
+      USE parallel_lmdz, only : OMP_CHUNK
       USE mod_filtre_fft
       USE timer_filtre
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/flumass_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/flumass_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/flumass_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE flumass_p(massebx,masseby, vcont, ucont, pbaru, pbarv)
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/fluxstokenc_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/fluxstokenc_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/fluxstokenc_p.F	(revision 1019)
@@ -8,5 +8,5 @@
 
        USE IOIPSL
-       USE parallel
+       USE parallel_lmdz
        USE misc_mod
        USE mod_hallo
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/friction_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/friction_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/friction_p.F	(revision 1019)
@@ -4,5 +4,5 @@
 c=======================================================================
       SUBROUTINE friction_p(ucov,vcov,pdt)
-      USE parallel
+      USE parallel_lmdz
       USE control_mod
 #ifdef CPP_IOIPSL
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F	(revision 1019)
@@ -10,6 +10,12 @@
 #endif
 
+
+#ifdef CPP_XIOS
+    ! ug Pour les sorties XIOS
+	USE wxios
+#endif
+
       USE mod_const_mpi, ONLY: init_const_mpi
-      USE parallel
+      USE parallel_lmdz
       USE infotrac
       USE mod_interface_dyn_phys
@@ -20,4 +26,10 @@
       USE control_mod
       use cpdet_mod, only: ini_cpdet
+
+
+#ifdef INCA
+! Only INCA needs these informations (from the Earth's physics)
+      USE indice_sol_mod
+#endif
 
 ! Ehouarn: the following are needed with (parallel) physics:
@@ -207,4 +219,11 @@
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Initialisation de XIOS
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+#ifdef CPP_XIOS
+	CALL wxios_init("LMDZ")
+#endif
+
 c
 c Initialisations pour Cp(T) Venus
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/geopot_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/geopot_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/geopot_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE geopot_p ( ngrid, teta, pk, pks, phis, phi )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
       
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/getparam.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/getparam.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/getparam.F90	(revision 1019)
@@ -18,5 +18,5 @@
 CONTAINS
   SUBROUTINE ini_getparam(fichier)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -28,5 +28,5 @@
 
   SUBROUTINE fin_getparam
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -37,5 +37,5 @@
 
   SUBROUTINE getparamr(TARGET,def_val,ret_val,comment)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -63,5 +63,5 @@
 
   SUBROUTINE getparami(TARGET,def_val,ret_val,comment)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
@@ -90,5 +90,5 @@
 
   SUBROUTINE getparaml(TARGET,def_val,ret_val,comment)
-  USE parallel
+  USE parallel_lmdz
     !
     IMPLICIT NONE
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/gr_dyn_fi_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/gr_dyn_fi_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/gr_dyn_fi_p.F	(revision 1019)
@@ -7,5 +7,5 @@
       USE mod_interface_dyn_phys
       USE dimphy
-      USE PARALLEL
+      USE parallel_lmdz
       IMPLICIT NONE
 c=======================================================================
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/gr_fi_dyn_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/gr_fi_dyn_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/gr_fi_dyn_p.F	(revision 1019)
@@ -7,5 +7,5 @@
       USE mod_interface_dyn_phys
       USE dimphy
-      use parallel
+      use parallel_lmdz
       IMPLICIT NONE
 c=======================================================================
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/gr_u_scal_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/gr_u_scal_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/gr_u_scal_p.F	(revision 1019)
@@ -25,5 +25,5 @@
 c
 c=======================================================================
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c-----------------------------------------------------------------------
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/gr_v_scal_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/gr_v_scal_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/gr_v_scal_p.F	(revision 1019)
@@ -25,5 +25,5 @@
 c
 c=======================================================================
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c-----------------------------------------------------------------------
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/grad_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/grad_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/grad_p.F	(revision 1019)
@@ -10,5 +10,5 @@
 c       pgx  et  pgy    sont des arguments de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/gradiv2_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/gradiv2_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/gradiv2_p.F	(revision 1019)
@@ -13,5 +13,5 @@
 c
 c
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE Write_field_p
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/gradiv_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/gradiv_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/gradiv_p.F	(revision 1019)
@@ -14,5 +14,5 @@
 c
 c     
-      USE parallel
+      USE parallel_lmdz
       USE times
       IMPLICIT NONE
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/groupe_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/groupe_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/groupe_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       subroutine groupe_p(pext,pbaru,pbarv,pbarum,pbarvm,wm)
-      USE parallel
+      USE parallel_lmdz
       implicit none
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/groupeun_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/groupeun_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/groupeun_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE groupeun_p(jjmax,llmax,jjb,jje,q)
-      USE parallel
+      USE parallel_lmdz
       USE Write_Field_p
       IMPLICIT NONE
@@ -135,5 +135,5 @@
       SUBROUTINE INIT_GROUPEUN_P(airen_tab, aires_tab)
 
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/guide_p_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/guide_p_mod.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/guide_p_mod.F90	(revision 1019)
@@ -292,5 +292,5 @@
 !=======================================================================
   SUBROUTINE guide_main(itau,ucov,vcov,teta,q,masse,ps)
-    use parallel
+    use parallel_lmdz
     USE control_mod
     
@@ -653,5 +653,5 @@
 !=======================================================================
   SUBROUTINE guide_interp(psi,teta)
-  USE parallel
+  USE parallel_lmdz
   USE mod_hallo
   USE Bands
@@ -1636,5 +1636,5 @@
 !=======================================================================
   SUBROUTINE guide_out(varname,hsize,vsize,field,factt)
-    USE parallel
+    USE parallel_lmdz
     IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/inigeom.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/inigeom.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/inigeom.F	(revision 1019)
@@ -426,10 +426,10 @@
          radclatm = 0.5* rad * coslatm
 c
+         ai14            = un4rad2 * coslatp * yprp
+         ai23            = un4rad2 * coslatm * yprm
          DO 32 i = 1,iim
          xprp            = xprimp025( i )
          xprm            = xprimm025( i )
       
-         ai14            = un4rad2 * coslatp * yprp
-         ai23            = un4rad2 * coslatm * yprm
          aireij1 ( i,j ) = ai14 * xprp
          aireij2 ( i,j ) = ai23 * xprp
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/initdynav_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/initdynav_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/initdynav_p.F	(revision 1019)
@@ -8,5 +8,5 @@
        USE IOIPSL
 #endif
-       use parallel
+       use parallel_lmdz
        use Write_field
        use misc_mod
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/initfluxsto_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/initfluxsto_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/initfluxsto_p.F	(revision 1019)
@@ -10,5 +10,5 @@
        USE IOIPSL
 #endif
-       use parallel
+       use parallel_lmdz
        use Write_field
        use misc_mod
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/inithist_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/inithist_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/inithist_p.F	(revision 1019)
@@ -9,5 +9,5 @@
        USE IOIPSL
 #endif
-       use parallel
+       use parallel_lmdz
        use Write_field
        use misc_mod
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/integrd_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/integrd_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/integrd_p.F	(revision 1019)
@@ -5,5 +5,5 @@
      $  (  nq,vcovm1,ucovm1,tetam1,psm1,massem1,
      $     dv,du,dteta,dq,dp,vcov,ucov,teta,q,ps0,masse,phis) !,finvmaold)
-      USE parallel
+      USE parallel_lmdz
       USE control_mod, only : planet_type
       IMPLICIT NONE
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_gam_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_gam_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_gam_p.F	(revision 1019)
@@ -11,5 +11,5 @@
 c      divgra     est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_p.F	(revision 1019)
@@ -9,5 +9,5 @@
 c      divgra     est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_rot_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_rot_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_rot_p.F	(revision 1019)
@@ -10,5 +10,5 @@
 c      rotout           est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_rotgam_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_rotgam_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/laplacien_rotgam_p.F	(revision 1019)
@@ -9,5 +9,5 @@
 c      divgra     est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/leapfrog_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/leapfrog_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/leapfrog_p.F	(revision 1019)
@@ -9,5 +9,5 @@
 
        USE misc_mod
-       USE parallel
+       USE parallel_lmdz
        USE times
        USE mod_hallo
@@ -24,4 +24,8 @@
        use sponge_mod_p, only: callsponge,mode_sponge,sponge_p
 
+#ifdef CPP_XIOS
+    ! ug Pour les sorties XIOS
+	USE wxios
+#endif
       IMPLICIT NONE
 
@@ -1097,4 +1101,11 @@
 !   Academic case : Simple friction and Newtonan relaxation 
 !   -------------------------------------------------------
+c$OMP MASTER
+         if (FirstPhysic) then
+           ok_start_timer=.TRUE.
+           FirstPhysic=.false.
+         endif
+c$OMP END MASTER
+
        ijb=ij_begin
        ije=ij_end
@@ -1517,4 +1528,9 @@
 
 c$OMP MASTER
+
+#ifdef CPP_XIOS
+    !Fermeture propre de XIOS
+      CALL wxios_close()
+#endif
               call fin_getparam
               call finalize_parallel
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/massbar_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/massbar_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/massbar_p.F	(revision 1019)
@@ -13,5 +13,5 @@
 c     
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/massbarxy_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/massbarxy_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/massbarxy_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE massbarxy_p(  masse, massebxy )
-      USE parallel
+      USE parallel_lmdz
       implicit none
 c **********************************************************************
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/massdair_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/massdair_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/massdair_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE massdair_p( p, masse )
-      USE parallel
+      USE parallel_lmdz
 c
 c *********************************************************************
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/mod_hallo.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/mod_hallo.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/mod_hallo.F90	(revision 1019)
@@ -1,4 +1,4 @@
 module mod_Hallo
-USE parallel
+USE parallel_lmdz
 implicit none
   logical,save :: use_mpi_alloc
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/nxgrad_gam_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/nxgrad_gam_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/nxgrad_gam_p.F	(revision 1019)
@@ -9,5 +9,5 @@
 c       x  et y    sont des arguments de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/nxgrad_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/nxgrad_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/nxgrad_p.F	(revision 1019)
@@ -9,5 +9,5 @@
 c       x  et y    sont des arguments de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/nxgraro2_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/nxgraro2_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/nxgraro2_p.F	(revision 1019)
@@ -13,5 +13,5 @@
 c
       USE write_Field_p
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE mod_hallo
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/nxgrarot_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/nxgrarot_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/nxgrarot_p.F	(revision 1019)
@@ -13,5 +13,5 @@
 c
 c
-      USE parallel
+      USE parallel_lmdz
       USE times
       USE write_field_p
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/parallel.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/parallel.F90	(revision 1018)
+++ 	(revision )
@@ -1,589 +1,0 @@
-! 
-! $Id: parallel.F90 1575 2011-09-21 13:57:48Z jghattas $
-!
-  module parallel
-  USE mod_const_mpi
-    
-    LOGICAL,SAVE :: using_mpi=.TRUE.
-    LOGICAL,SAVE :: using_omp
-    
-    integer, save :: mpi_size
-    integer, save :: mpi_rank
-    integer, save :: jj_begin
-    integer, save :: jj_end
-    integer, save :: jj_nb
-    integer, save :: ij_begin
-    integer, save :: ij_end
-    logical, save :: pole_nord
-    logical, save :: pole_sud
-    
-    integer, allocatable, save, dimension(:) :: jj_begin_para
-    integer, allocatable, save, dimension(:) :: jj_end_para
-    integer, allocatable, save, dimension(:) :: jj_nb_para
-    integer, save :: OMP_CHUNK
-    integer, save :: omp_rank
-    integer, save :: omp_size  
-!$OMP THREADPRIVATE(omp_rank)
-
- contains
- 
-    subroutine init_parallel
-    USE vampir
-    implicit none
-#ifdef CPP_MPI
-      include 'mpif.h'
-#endif
-#include "dimensions.h"
-#include "paramet.h"
-#include "iniprint.h"
-
-      integer :: ierr
-      integer :: i,j
-      integer :: type_size
-      integer, dimension(3) :: blocklen,type
-      integer :: comp_id
-      character(len=4)  :: num
-      character(len=20) :: filename
- 
-#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_MPI
-       using_mpi=.TRUE.
-#else
-       using_mpi=.FALSE.
-#endif
-      
-
-#ifdef CPP_OMP
-       using_OMP=.TRUE.
-#else
-       using_OMP=.FALSE.
-#endif
-      
-      call InitVampir
-      
-      IF (using_mpi) THEN
-#ifdef CPP_MPI
-        call MPI_COMM_SIZE(COMM_LMDZ,mpi_size,ierr)
-        call MPI_COMM_RANK(COMM_LMDZ,mpi_rank,ierr)
-#endif
-      ELSE
-        mpi_size=1
-        mpi_rank=0
-      ENDIF
-
-
-! Open text output file with mpi_rank in suffix of file name 
-      IF (lunout /= 5 .and. lunout /= 6) THEN
-         WRITE(num,'(I4.4)') mpi_rank
-         filename='lmdz.out_'//num
-         IF (mpi_rank .NE. 0) THEN
-            OPEN(UNIT=lunout,FILE=TRIM(filename),ACTION='write', &
-               STATUS='unknown',FORM='formatted',IOSTAT=ierr) 
-         ENDIF
-      ENDIF
-
-      
-      allocate(jj_begin_para(0:mpi_size-1))
-      allocate(jj_end_para(0:mpi_size-1))
-      allocate(jj_nb_para(0:mpi_size-1))
-      
-      do i=0,mpi_size-1
-        jj_nb_para(i)=(jjm+1)/mpi_size
-        if ( i < MOD((jjm+1),mpi_size) ) jj_nb_para(i)=jj_nb_para(i)+1
-        
-        if (jj_nb_para(i) <= 2 ) then
-          
-         write(lunout,*)"Arret : le nombre de bande de lattitude par process est trop faible (<2)."
-         write(lunout,*)" ---> diminuez le nombre de CPU ou augmentez la taille en lattitude"
-          
-#ifdef CPP_MPI
-          IF (using_mpi) call MPI_ABORT(COMM_LMDZ,-1, ierr)
-#endif          
-        endif
-        
-      enddo
-      
-!      jj_nb_para(0)=11
-!      jj_nb_para(1)=25
-!      jj_nb_para(2)=25
-!      jj_nb_para(3)=12      
-
-      j=1
-      
-      do i=0,mpi_size-1 
-        
-        jj_begin_para(i)=j
-        jj_end_para(i)=j+jj_Nb_para(i)-1
-        j=j+jj_Nb_para(i)
-      
-      enddo
-      
-      jj_begin = jj_begin_para(mpi_rank)
-      jj_end   = jj_end_para(mpi_rank)
-      jj_nb    = jj_nb_para(mpi_rank)
-      
-      ij_begin=(jj_begin-1)*iip1+1
-      ij_end=jj_end*iip1
-      
-      if (mpi_rank.eq.0) then
-        pole_nord=.TRUE.
-      else 
-        pole_nord=.FALSE.
-      endif
-      
-      if (mpi_rank.eq.mpi_size-1) then
-        pole_sud=.TRUE.
-      else 
-        pole_sud=.FALSE.
-      endif
-        
-      write(lunout,*)"init_parallel: jj_begin",jj_begin
-      write(lunout,*)"init_parallel: jj_end",jj_end
-      write(lunout,*)"init_parallel: ij_begin",ij_begin
-      write(lunout,*)"init_parallel: ij_end",ij_end
-
-!$OMP PARALLEL
-
-#ifdef CPP_OMP
-!$OMP MASTER
-        omp_size=OMP_GET_NUM_THREADS()
-!$OMP END MASTER
-        omp_rank=OMP_GET_THREAD_NUM()    
-#else    
-        omp_size=1
-        omp_rank=0
-#endif
-!$OMP END PARALLEL         
-    
-    end subroutine init_parallel
-
-    
-    subroutine SetDistrib(jj_Nb_New)
-    implicit none
-
-#include "dimensions.h"
-#include "paramet.h"
-
-      INTEGER,dimension(0:MPI_Size-1) :: jj_Nb_New
-      INTEGER :: i  
-  
-      jj_Nb_Para=jj_Nb_New
-      
-      jj_begin_para(0)=1
-      jj_end_para(0)=jj_Nb_Para(0)
-      
-      do i=1,mpi_size-1 
-        
-        jj_begin_para(i)=jj_end_para(i-1)+1
-        jj_end_para(i)=jj_begin_para(i)+jj_Nb_para(i)-1
-      
-      enddo
-      
-      jj_begin = jj_begin_para(mpi_rank)
-      jj_end   = jj_end_para(mpi_rank)
-      jj_nb    = jj_nb_para(mpi_rank)
-      
-      ij_begin=(jj_begin-1)*iip1+1
-      ij_end=jj_end*iip1
-
-    end subroutine SetDistrib
-
-
-
-    
-    subroutine Finalize_parallel
-#ifdef CPP_COUPLE
-    use mod_prism_proto
-#endif
-#ifdef CPP_EARTH
-! Ehouarn: surface_data module is in 'phylmd' ...
-      use surface_data, only : type_ocean
-      implicit none
-#else
-      implicit none
-! without the surface_data module, we declare (and set) a dummy 'type_ocean'
-      character(len=6),parameter :: type_ocean="dummy"
-#endif
-! #endif of #ifdef CPP_EARTH
-
-      include "dimensions.h"
-      include "paramet.h"
-#ifdef CPP_MPI
-      include 'mpif.h'
-#endif      
-
-      integer :: ierr
-      integer :: i
-
-      if (allocated(jj_begin_para)) deallocate(jj_begin_para)
-      if (allocated(jj_end_para))   deallocate(jj_end_para)
-      if (allocated(jj_nb_para))    deallocate(jj_nb_para)
-
-      if (type_ocean == 'couple') then
-#ifdef CPP_COUPLE
-         call prism_terminate_proto(ierr)
-         IF (ierr .ne. PRISM_Ok) THEN
-            call abort_gcm('Finalize_parallel',' Probleme dans prism_terminate_proto ',1)
-         endif
-#endif 
-      else
-#ifdef CPP_MPI
-         IF (using_mpi) call MPI_FINALIZE(ierr)
-#endif
-      end if
-      
-    end subroutine Finalize_parallel
-        
-    subroutine Pack_Data(Field,ij,ll,row,Buffer)
-    implicit none
-
-#include "dimensions.h"
-#include "paramet.h"
-
-      integer, intent(in) :: ij,ll,row
-      real,dimension(ij,ll),intent(in) ::Field
-      real,dimension(ll*iip1*row), intent(out) :: Buffer 
-            
-      integer :: Pos
-      integer :: i,l
-      
-      Pos=0
-      do l=1,ll
-        do i=1,row*iip1
-          Pos=Pos+1
-          Buffer(Pos)=Field(i,l)
-        enddo
-      enddo
-      
-    end subroutine Pack_data 
-     
-    subroutine Unpack_Data(Field,ij,ll,row,Buffer)
-    implicit none
-
-#include "dimensions.h"
-#include "paramet.h"
-
-      integer, intent(in) :: ij,ll,row
-      real,dimension(ij,ll),intent(out) ::Field
-      real,dimension(ll*iip1*row), intent(in) :: Buffer 
-            
-      integer :: Pos
-      integer :: i,l
-      
-      Pos=0
-      
-      do l=1,ll
-        do i=1,row*iip1
-          Pos=Pos+1
-          Field(i,l)=Buffer(Pos)
-        enddo
-      enddo
-      
-    end subroutine UnPack_data
-
-    
-    SUBROUTINE barrier
-    IMPLICIT NONE
-#ifdef CPP_MPI
-    INCLUDE 'mpif.h'
-#endif
-    INTEGER :: ierr
-    
-!$OMP CRITICAL (MPI)      
-#ifdef CPP_MPI
-      IF (using_mpi) CALL MPI_Barrier(COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-    
-    END SUBROUTINE barrier
-       
-      
-    subroutine exchange_hallo(Field,ij,ll,up,down)
-    USE Vampir
-    implicit none
-#include "dimensions.h"
-#include "paramet.h"    
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll
-      REAL, dimension(ij,ll) :: Field
-      INTEGER :: up,down
-      
-      INTEGER :: ierr
-      LOGICAL :: SendUp,SendDown
-      LOGICAL :: RecvUp,RecvDown
-      INTEGER, DIMENSION(4) :: Request
-#ifdef CPP_MPI
-      INTEGER, DIMENSION(MPI_STATUS_SIZE,4) :: Status
-#else
-      INTEGER, DIMENSION(1,4) :: Status
-#endif
-      INTEGER :: NbRequest
-      REAL, dimension(:),allocatable :: Buffer_Send_up,Buffer_Send_down
-      REAL, dimension(:),allocatable :: Buffer_Recv_up,Buffer_Recv_down
-      INTEGER :: Buffer_size      
-
-      IF (using_mpi) THEN
-
-        CALL barrier
-      
-        call VTb(VThallo)
-      
-        SendUp=.TRUE.
-        SendDown=.TRUE.
-        RecvUp=.TRUE.
-        RecvDown=.TRUE.
-          
-        IF (pole_nord) THEN
-          SendUp=.FALSE.
-          RecvUp=.FALSE.
-        ENDIF
-    
-        IF (pole_sud) THEN
-          SendDown=.FALSE.
-          RecvDown=.FALSE.
-        ENDIF
-        
-        if (up.eq.0) then
-          SendDown=.FALSE.
-          RecvUp=.FALSE.
-        endif
-      
-        if (down.eq.0) then
-          SendUp=.FALSE.
-          RecvDown=.FALSE.
-        endif
-      
-        NbRequest=0
-  
-        IF (SendUp) THEN
-          NbRequest=NbRequest+1
-          buffer_size=down*iip1*ll
-          allocate(Buffer_Send_up(Buffer_size))
-          call PACK_Data(Field(ij_begin,1),ij,ll,down,Buffer_Send_up)
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_ISSEND(Buffer_send_up,Buffer_Size,MPI_REAL8,MPI_Rank-1,1,     &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-        ENDIF
-  
-        IF (SendDown) THEN
-          NbRequest=NbRequest+1
-           
-          buffer_size=up*iip1*ll
-          allocate(Buffer_Send_down(Buffer_size))
-          call PACK_Data(Field(ij_end+1-up*iip1,1),ij,ll,up,Buffer_send_down)
-        
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_ISSEND(Buffer_send_down,Buffer_Size,MPI_REAL8,MPI_Rank+1,1,     &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-        ENDIF
-    
-  
-        IF (RecvUp) THEN
-          NbRequest=NbRequest+1
-          buffer_size=up*iip1*ll
-          allocate(Buffer_recv_up(Buffer_size))
-              
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_IRECV(Buffer_recv_up,Buffer_size,MPI_REAL8,MPI_Rank-1,1,  &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-     
-       
-        ENDIF
-  
-        IF (RecvDown) THEN
-          NbRequest=NbRequest+1
-          buffer_size=down*iip1*ll
-          allocate(Buffer_recv_down(Buffer_size))
-        
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-          call MPI_IRECV(Buffer_recv_down,Buffer_size,MPI_REAL8,MPI_Rank+1,1,     &
-                          COMM_LMDZ,Request(NbRequest),ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-        
-        ENDIF
-  
-#ifdef CPP_MPI
-        if (NbRequest > 0) call MPI_WAITALL(NbRequest,Request,Status,ierr)
-#endif
-        IF (RecvUp)  call Unpack_Data(Field(ij_begin-up*iip1,1),ij,ll,up,Buffer_Recv_up)
-        IF (RecvDown) call Unpack_Data(Field(ij_end+1,1),ij,ll,down,Buffer_Recv_down)  
-
-        call VTe(VThallo)
-        call barrier
-      
-      ENDIF  ! using_mpi
-      
-      RETURN
-      
-    end subroutine exchange_Hallo
-    
-
-    subroutine Gather_Field(Field,ij,ll,rank)
-    implicit none
-#include "dimensions.h"
-#include "paramet.h" 
-#include "iniprint.h"
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll,rank
-      REAL, dimension(ij,ll) :: Field
-      REAL, dimension(:),allocatable :: Buffer_send   
-      REAL, dimension(:),allocatable :: Buffer_Recv
-      INTEGER, dimension(0:MPI_Size-1) :: Recv_count, displ
-      INTEGER :: ierr
-      INTEGER ::i
-      
-      IF (using_mpi) THEN
-
-        if (ij==ip1jmp1) then 
-           allocate(Buffer_send(iip1*ll*(jj_end-jj_begin+1)))
-           call Pack_Data(Field(ij_begin,1),ij,ll,jj_end-jj_begin+1,Buffer_send)
-        else if (ij==ip1jm) then
-           allocate(Buffer_send(iip1*ll*(min(jj_end,jjm)-jj_begin+1)))
-           call Pack_Data(Field(ij_begin,1),ij,ll,min(jj_end,jjm)-jj_begin+1,Buffer_send)
-        else
-           write(lunout,*)ij  
-        stop 'erreur dans Gather_Field'
-        endif
-        
-        if (MPI_Rank==rank) then
-          allocate(Buffer_Recv(ij*ll))
-
-!CDIR NOVECTOR
-          do i=0,MPI_Size-1
-             
-            if (ij==ip1jmp1) then 
-              Recv_count(i)=(jj_end_para(i)-jj_begin_para(i)+1)*ll*iip1
-            else if (ij==ip1jm) then
-              Recv_count(i)=(min(jj_end_para(i),jjm)-jj_begin_para(i)+1)*ll*iip1
-            else
-              stop 'erreur dans Gather_Field'
-            endif
-                   
-            if (i==0) then 
-              displ(i)=0 
-            else
-              displ(i)=displ(i-1)+Recv_count(i-1)
-            endif
-            
-          enddo
-          
-        else
-          ! Ehouarn: When in debug mode, ifort complains (for call MPI_GATHERV
-          !          below) about Buffer_Recv() being not allocated.
-          !          So make a dummy allocation.
-          allocate(Buffer_Recv(1))
-        endif ! of if (MPI_Rank==rank)
-  
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-        call MPI_GATHERV(Buffer_send,(min(ij_end,ij)-ij_begin+1)*ll,MPI_REAL8,   &
-                          Buffer_Recv,Recv_count,displ,MPI_REAL8,rank,COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-      
-        if (MPI_Rank==rank) then                  
-      
-          if (ij==ip1jmp1) then 
-            do i=0,MPI_Size-1
-              call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                 &
-                               jj_end_para(i)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
-            enddo
-          else if (ij==ip1jm) then
-            do i=0,MPI_Size-1
-               call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                       &
-                               min(jj_end_para(i),jjm)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
-            enddo
-          endif
-        endif 
-      ENDIF ! using_mpi
-      
-    end subroutine Gather_Field
-
-
-    subroutine AllGather_Field(Field,ij,ll)
-    implicit none
-#include "dimensions.h"
-#include "paramet.h"    
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll
-      REAL, dimension(ij,ll) :: Field
-      INTEGER :: ierr
-      
-      IF (using_mpi) THEN
-        call Gather_Field(Field,ij,ll,0)
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-      call MPI_BCAST(Field,ij*ll,MPI_REAL8,0,COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-      ENDIF
-      
-    end subroutine AllGather_Field
-    
-   subroutine Broadcast_Field(Field,ij,ll,rank)
-    implicit none
-#include "dimensions.h"
-#include "paramet.h"    
-#ifdef CPP_MPI
-    include 'mpif.h'
-#endif    
-      INTEGER :: ij,ll
-      REAL, dimension(ij,ll) :: Field
-      INTEGER :: rank
-      INTEGER :: ierr
-      
-      IF (using_mpi) THEN
-      
-!$OMP CRITICAL (MPI)
-#ifdef CPP_MPI
-      call MPI_BCAST(Field,ij*ll,MPI_REAL8,rank,COMM_LMDZ,ierr)
-#endif
-!$OMP END CRITICAL (MPI)
-      
-      ENDIF
-    end subroutine Broadcast_Field
-        
-   
-!  Subroutine verif_hallo(Field,ij,ll,up,down)
-!    implicit none
-!#include "dimensions.h"
-!#include "paramet.h"    
-!    include 'mpif.h'
-!    
-!      INTEGER :: ij,ll
-!      REAL, dimension(ij,ll) :: Field
-!      INTEGER :: up,down 
-!      
-!      REAL,dimension(ij,ll): NewField
-!      
-!      NewField=0
-!      
-!      ijb=ij_begin
-!      ije=ij_end
-!      if (pole_nord) 
-!      NewField(ij_be       
-
-  end module parallel
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/parallel_lmdz.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/parallel_lmdz.F90	(revision 1019)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/parallel_lmdz.F90	(revision 1019)
@@ -0,0 +1,589 @@
+! 
+! $Id: parallel.F90 1575 2011-09-21 13:57:48Z jghattas $
+!
+  module parallel_lmdz
+  USE mod_const_mpi
+    
+    LOGICAL,SAVE :: using_mpi=.TRUE.
+    LOGICAL,SAVE :: using_omp
+    
+    integer, save :: mpi_size
+    integer, save :: mpi_rank
+    integer, save :: jj_begin
+    integer, save :: jj_end
+    integer, save :: jj_nb
+    integer, save :: ij_begin
+    integer, save :: ij_end
+    logical, save :: pole_nord
+    logical, save :: pole_sud
+    
+    integer, allocatable, save, dimension(:) :: jj_begin_para
+    integer, allocatable, save, dimension(:) :: jj_end_para
+    integer, allocatable, save, dimension(:) :: jj_nb_para
+    integer, save :: OMP_CHUNK
+    integer, save :: omp_rank
+    integer, save :: omp_size  
+!$OMP THREADPRIVATE(omp_rank)
+
+ contains
+ 
+    subroutine init_parallel
+    USE vampir
+    implicit none
+#ifdef CPP_MPI
+      include 'mpif.h'
+#endif
+#include "dimensions.h"
+#include "paramet.h"
+#include "iniprint.h"
+
+      integer :: ierr
+      integer :: i,j
+      integer :: type_size
+      integer, dimension(3) :: blocklen,type
+      integer :: comp_id
+      character(len=4)  :: num
+      character(len=20) :: filename
+ 
+#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_MPI
+       using_mpi=.TRUE.
+#else
+       using_mpi=.FALSE.
+#endif
+      
+
+#ifdef CPP_OMP
+       using_OMP=.TRUE.
+#else
+       using_OMP=.FALSE.
+#endif
+      
+      call InitVampir
+      
+      IF (using_mpi) THEN
+#ifdef CPP_MPI
+        call MPI_COMM_SIZE(COMM_LMDZ,mpi_size,ierr)
+        call MPI_COMM_RANK(COMM_LMDZ,mpi_rank,ierr)
+#endif
+      ELSE
+        mpi_size=1
+        mpi_rank=0
+      ENDIF
+
+
+! Open text output file with mpi_rank in suffix of file name 
+      IF (lunout /= 5 .and. lunout /= 6) THEN
+         WRITE(num,'(I4.4)') mpi_rank
+         filename='lmdz.out_'//num
+         IF (mpi_rank .NE. 0) THEN
+            OPEN(UNIT=lunout,FILE=TRIM(filename),ACTION='write', &
+               STATUS='unknown',FORM='formatted',IOSTAT=ierr) 
+         ENDIF
+      ENDIF
+
+      
+      allocate(jj_begin_para(0:mpi_size-1))
+      allocate(jj_end_para(0:mpi_size-1))
+      allocate(jj_nb_para(0:mpi_size-1))
+      
+      do i=0,mpi_size-1
+        jj_nb_para(i)=(jjm+1)/mpi_size
+        if ( i < MOD((jjm+1),mpi_size) ) jj_nb_para(i)=jj_nb_para(i)+1
+        
+        if (jj_nb_para(i) <= 2 ) then
+          
+         write(lunout,*)"Arret : le nombre de bande de lattitude par process est trop faible (<2)."
+         write(lunout,*)" ---> diminuez le nombre de CPU ou augmentez la taille en lattitude"
+          
+#ifdef CPP_MPI
+          IF (using_mpi) call MPI_ABORT(COMM_LMDZ,-1, ierr)
+#endif          
+        endif
+        
+      enddo
+      
+!      jj_nb_para(0)=11
+!      jj_nb_para(1)=25
+!      jj_nb_para(2)=25
+!      jj_nb_para(3)=12      
+
+      j=1
+      
+      do i=0,mpi_size-1 
+        
+        jj_begin_para(i)=j
+        jj_end_para(i)=j+jj_Nb_para(i)-1
+        j=j+jj_Nb_para(i)
+      
+      enddo
+      
+      jj_begin = jj_begin_para(mpi_rank)
+      jj_end   = jj_end_para(mpi_rank)
+      jj_nb    = jj_nb_para(mpi_rank)
+      
+      ij_begin=(jj_begin-1)*iip1+1
+      ij_end=jj_end*iip1
+      
+      if (mpi_rank.eq.0) then
+        pole_nord=.TRUE.
+      else 
+        pole_nord=.FALSE.
+      endif
+      
+      if (mpi_rank.eq.mpi_size-1) then
+        pole_sud=.TRUE.
+      else 
+        pole_sud=.FALSE.
+      endif
+        
+      write(lunout,*)"init_parallel: jj_begin",jj_begin
+      write(lunout,*)"init_parallel: jj_end",jj_end
+      write(lunout,*)"init_parallel: ij_begin",ij_begin
+      write(lunout,*)"init_parallel: ij_end",ij_end
+
+!$OMP PARALLEL
+
+#ifdef CPP_OMP
+!$OMP MASTER
+        omp_size=OMP_GET_NUM_THREADS()
+!$OMP END MASTER
+        omp_rank=OMP_GET_THREAD_NUM()    
+#else    
+        omp_size=1
+        omp_rank=0
+#endif
+!$OMP END PARALLEL         
+    
+    end subroutine init_parallel
+
+    
+    subroutine SetDistrib(jj_Nb_New)
+    implicit none
+
+#include "dimensions.h"
+#include "paramet.h"
+
+      INTEGER,dimension(0:MPI_Size-1) :: jj_Nb_New
+      INTEGER :: i  
+  
+      jj_Nb_Para=jj_Nb_New
+      
+      jj_begin_para(0)=1
+      jj_end_para(0)=jj_Nb_Para(0)
+      
+      do i=1,mpi_size-1 
+        
+        jj_begin_para(i)=jj_end_para(i-1)+1
+        jj_end_para(i)=jj_begin_para(i)+jj_Nb_para(i)-1
+      
+      enddo
+      
+      jj_begin = jj_begin_para(mpi_rank)
+      jj_end   = jj_end_para(mpi_rank)
+      jj_nb    = jj_nb_para(mpi_rank)
+      
+      ij_begin=(jj_begin-1)*iip1+1
+      ij_end=jj_end*iip1
+
+    end subroutine SetDistrib
+
+
+
+    
+    subroutine Finalize_parallel
+#ifdef CPP_COUPLE
+    use mod_prism_proto
+#endif
+#ifdef CPP_EARTH
+! Ehouarn: surface_data module is in 'phylmd' ...
+      use surface_data, only : type_ocean
+      implicit none
+#else
+      implicit none
+! without the surface_data module, we declare (and set) a dummy 'type_ocean'
+      character(len=6),parameter :: type_ocean="dummy"
+#endif
+! #endif of #ifdef CPP_EARTH
+
+      include "dimensions.h"
+      include "paramet.h"
+#ifdef CPP_MPI
+      include 'mpif.h'
+#endif      
+
+      integer :: ierr
+      integer :: i
+
+      if (allocated(jj_begin_para)) deallocate(jj_begin_para)
+      if (allocated(jj_end_para))   deallocate(jj_end_para)
+      if (allocated(jj_nb_para))    deallocate(jj_nb_para)
+
+      if (type_ocean == 'couple') then
+#ifdef CPP_COUPLE
+         call prism_terminate_proto(ierr)
+         IF (ierr .ne. PRISM_Ok) THEN
+            call abort_gcm('Finalize_parallel',' Probleme dans prism_terminate_proto ',1)
+         endif
+#endif 
+      else
+#ifdef CPP_MPI
+         IF (using_mpi) call MPI_FINALIZE(ierr)
+#endif
+      end if
+      
+    end subroutine Finalize_parallel
+        
+    subroutine Pack_Data(Field,ij,ll,row,Buffer)
+    implicit none
+
+#include "dimensions.h"
+#include "paramet.h"
+
+      integer, intent(in) :: ij,ll,row
+      real,dimension(ij,ll),intent(in) ::Field
+      real,dimension(ll*iip1*row), intent(out) :: Buffer 
+            
+      integer :: Pos
+      integer :: i,l
+      
+      Pos=0
+      do l=1,ll
+        do i=1,row*iip1
+          Pos=Pos+1
+          Buffer(Pos)=Field(i,l)
+        enddo
+      enddo
+      
+    end subroutine Pack_data 
+     
+    subroutine Unpack_Data(Field,ij,ll,row,Buffer)
+    implicit none
+
+#include "dimensions.h"
+#include "paramet.h"
+
+      integer, intent(in) :: ij,ll,row
+      real,dimension(ij,ll),intent(out) ::Field
+      real,dimension(ll*iip1*row), intent(in) :: Buffer 
+            
+      integer :: Pos
+      integer :: i,l
+      
+      Pos=0
+      
+      do l=1,ll
+        do i=1,row*iip1
+          Pos=Pos+1
+          Field(i,l)=Buffer(Pos)
+        enddo
+      enddo
+      
+    end subroutine UnPack_data
+
+    
+    SUBROUTINE barrier
+    IMPLICIT NONE
+#ifdef CPP_MPI
+    INCLUDE 'mpif.h'
+#endif
+    INTEGER :: ierr
+    
+!$OMP CRITICAL (MPI)      
+#ifdef CPP_MPI
+      IF (using_mpi) CALL MPI_Barrier(COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+    
+    END SUBROUTINE barrier
+       
+      
+    subroutine exchange_hallo(Field,ij,ll,up,down)
+    USE Vampir
+    implicit none
+#include "dimensions.h"
+#include "paramet.h"    
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll
+      REAL, dimension(ij,ll) :: Field
+      INTEGER :: up,down
+      
+      INTEGER :: ierr
+      LOGICAL :: SendUp,SendDown
+      LOGICAL :: RecvUp,RecvDown
+      INTEGER, DIMENSION(4) :: Request
+#ifdef CPP_MPI
+      INTEGER, DIMENSION(MPI_STATUS_SIZE,4) :: Status
+#else
+      INTEGER, DIMENSION(1,4) :: Status
+#endif
+      INTEGER :: NbRequest
+      REAL, dimension(:),allocatable :: Buffer_Send_up,Buffer_Send_down
+      REAL, dimension(:),allocatable :: Buffer_Recv_up,Buffer_Recv_down
+      INTEGER :: Buffer_size      
+
+      IF (using_mpi) THEN
+
+        CALL barrier
+      
+        call VTb(VThallo)
+      
+        SendUp=.TRUE.
+        SendDown=.TRUE.
+        RecvUp=.TRUE.
+        RecvDown=.TRUE.
+          
+        IF (pole_nord) THEN
+          SendUp=.FALSE.
+          RecvUp=.FALSE.
+        ENDIF
+    
+        IF (pole_sud) THEN
+          SendDown=.FALSE.
+          RecvDown=.FALSE.
+        ENDIF
+        
+        if (up.eq.0) then
+          SendDown=.FALSE.
+          RecvUp=.FALSE.
+        endif
+      
+        if (down.eq.0) then
+          SendUp=.FALSE.
+          RecvDown=.FALSE.
+        endif
+      
+        NbRequest=0
+  
+        IF (SendUp) THEN
+          NbRequest=NbRequest+1
+          buffer_size=down*iip1*ll
+          allocate(Buffer_Send_up(Buffer_size))
+          call PACK_Data(Field(ij_begin,1),ij,ll,down,Buffer_Send_up)
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_ISSEND(Buffer_send_up,Buffer_Size,MPI_REAL8,MPI_Rank-1,1,     &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+        ENDIF
+  
+        IF (SendDown) THEN
+          NbRequest=NbRequest+1
+           
+          buffer_size=up*iip1*ll
+          allocate(Buffer_Send_down(Buffer_size))
+          call PACK_Data(Field(ij_end+1-up*iip1,1),ij,ll,up,Buffer_send_down)
+        
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_ISSEND(Buffer_send_down,Buffer_Size,MPI_REAL8,MPI_Rank+1,1,     &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+        ENDIF
+    
+  
+        IF (RecvUp) THEN
+          NbRequest=NbRequest+1
+          buffer_size=up*iip1*ll
+          allocate(Buffer_recv_up(Buffer_size))
+              
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_IRECV(Buffer_recv_up,Buffer_size,MPI_REAL8,MPI_Rank-1,1,  &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+     
+       
+        ENDIF
+  
+        IF (RecvDown) THEN
+          NbRequest=NbRequest+1
+          buffer_size=down*iip1*ll
+          allocate(Buffer_recv_down(Buffer_size))
+        
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+          call MPI_IRECV(Buffer_recv_down,Buffer_size,MPI_REAL8,MPI_Rank+1,1,     &
+                          COMM_LMDZ,Request(NbRequest),ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+        
+        ENDIF
+  
+#ifdef CPP_MPI
+        if (NbRequest > 0) call MPI_WAITALL(NbRequest,Request,Status,ierr)
+#endif
+        IF (RecvUp)  call Unpack_Data(Field(ij_begin-up*iip1,1),ij,ll,up,Buffer_Recv_up)
+        IF (RecvDown) call Unpack_Data(Field(ij_end+1,1),ij,ll,down,Buffer_Recv_down)  
+
+        call VTe(VThallo)
+        call barrier
+      
+      ENDIF  ! using_mpi
+      
+      RETURN
+      
+    end subroutine exchange_Hallo
+    
+
+    subroutine Gather_Field(Field,ij,ll,rank)
+    implicit none
+#include "dimensions.h"
+#include "paramet.h" 
+#include "iniprint.h"
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll,rank
+      REAL, dimension(ij,ll) :: Field
+      REAL, dimension(:),allocatable :: Buffer_send   
+      REAL, dimension(:),allocatable :: Buffer_Recv
+      INTEGER, dimension(0:MPI_Size-1) :: Recv_count, displ
+      INTEGER :: ierr
+      INTEGER ::i
+      
+      IF (using_mpi) THEN
+
+        if (ij==ip1jmp1) then 
+           allocate(Buffer_send(iip1*ll*(jj_end-jj_begin+1)))
+           call Pack_Data(Field(ij_begin,1),ij,ll,jj_end-jj_begin+1,Buffer_send)
+        else if (ij==ip1jm) then
+           allocate(Buffer_send(iip1*ll*(min(jj_end,jjm)-jj_begin+1)))
+           call Pack_Data(Field(ij_begin,1),ij,ll,min(jj_end,jjm)-jj_begin+1,Buffer_send)
+        else
+           write(lunout,*)ij  
+        stop 'erreur dans Gather_Field'
+        endif
+        
+        if (MPI_Rank==rank) then
+          allocate(Buffer_Recv(ij*ll))
+
+!CDIR NOVECTOR
+          do i=0,MPI_Size-1
+             
+            if (ij==ip1jmp1) then 
+              Recv_count(i)=(jj_end_para(i)-jj_begin_para(i)+1)*ll*iip1
+            else if (ij==ip1jm) then
+              Recv_count(i)=(min(jj_end_para(i),jjm)-jj_begin_para(i)+1)*ll*iip1
+            else
+              stop 'erreur dans Gather_Field'
+            endif
+                   
+            if (i==0) then 
+              displ(i)=0 
+            else
+              displ(i)=displ(i-1)+Recv_count(i-1)
+            endif
+            
+          enddo
+          
+        else
+          ! Ehouarn: When in debug mode, ifort complains (for call MPI_GATHERV
+          !          below) about Buffer_Recv() being not allocated.
+          !          So make a dummy allocation.
+          allocate(Buffer_Recv(1))
+        endif ! of if (MPI_Rank==rank)
+  
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+        call MPI_GATHERV(Buffer_send,(min(ij_end,ij)-ij_begin+1)*ll,MPI_REAL8,   &
+                          Buffer_Recv,Recv_count,displ,MPI_REAL8,rank,COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+      
+        if (MPI_Rank==rank) then                  
+      
+          if (ij==ip1jmp1) then 
+            do i=0,MPI_Size-1
+              call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                 &
+                               jj_end_para(i)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
+            enddo
+          else if (ij==ip1jm) then
+            do i=0,MPI_Size-1
+               call Unpack_Data(Field((jj_begin_para(i)-1)*iip1+1,1),ij,ll,                       &
+                               min(jj_end_para(i),jjm)-jj_begin_para(i)+1,Buffer_Recv(displ(i)+1))
+            enddo
+          endif
+        endif 
+      ENDIF ! using_mpi
+      
+    end subroutine Gather_Field
+
+
+    subroutine AllGather_Field(Field,ij,ll)
+    implicit none
+#include "dimensions.h"
+#include "paramet.h"    
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll
+      REAL, dimension(ij,ll) :: Field
+      INTEGER :: ierr
+      
+      IF (using_mpi) THEN
+        call Gather_Field(Field,ij,ll,0)
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+      call MPI_BCAST(Field,ij*ll,MPI_REAL8,0,COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+      ENDIF
+      
+    end subroutine AllGather_Field
+    
+   subroutine Broadcast_Field(Field,ij,ll,rank)
+    implicit none
+#include "dimensions.h"
+#include "paramet.h"    
+#ifdef CPP_MPI
+    include 'mpif.h'
+#endif    
+      INTEGER :: ij,ll
+      REAL, dimension(ij,ll) :: Field
+      INTEGER :: rank
+      INTEGER :: ierr
+      
+      IF (using_mpi) THEN
+      
+!$OMP CRITICAL (MPI)
+#ifdef CPP_MPI
+      call MPI_BCAST(Field,ij*ll,MPI_REAL8,rank,COMM_LMDZ,ierr)
+#endif
+!$OMP END CRITICAL (MPI)
+      
+      ENDIF
+    end subroutine Broadcast_Field
+        
+   
+!  Subroutine verif_hallo(Field,ij,ll,up,down)
+!    implicit none
+!#include "dimensions.h"
+!#include "paramet.h"    
+!    include 'mpif.h'
+!    
+!      INTEGER :: ij,ll
+!      REAL, dimension(ij,ll) :: Field
+!      INTEGER :: up,down 
+!      
+!      REAL,dimension(ij,ll): NewField
+!      
+!      NewField=0
+!      
+!      ijb=ij_begin
+!      ije=ij_end
+!      if (pole_nord) 
+!      NewField(ij_be       
+
+  end module parallel_lmdz
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/pression_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/pression_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/pression_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE pression_p( ngrid, ap, bp, ps, p )
-      USE parallel
+      USE parallel_lmdz
 c
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/qminimum_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/qminimum_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/qminimum_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE qminimum_p( q,nq,deltap )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT none
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/rotat_nfil_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/rotat_nfil_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/rotat_nfil_p.F	(revision 1019)
@@ -10,5 +10,5 @@
 c        rot          est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/rotat_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/rotat_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/rotat_p.F	(revision 1019)
@@ -10,5 +10,5 @@
 c        rot          est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/rotatf_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/rotatf_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/rotatf_p.F	(revision 1019)
@@ -10,5 +10,5 @@
 c        rot          est  un argument  de sortie pour le s-prog
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/sponge_mod_p.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/sponge_mod_p.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/sponge_mod_p.F90	(revision 1019)
@@ -31,5 +31,5 @@
 
       USE Write_Field_p
-      use parallel, only: pole_sud,pole_nord,jj_begin,jj_end
+      use parallel_lmdz, only: pole_sud,pole_nord,jj_begin,jj_end
       implicit none
 #include "dimensions.h"
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/times.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/times.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/times.F90	(revision 1019)
@@ -25,5 +25,5 @@
   
   subroutine init_timer
-    use parallel
+    use parallel_lmdz
     implicit none
 #include "dimensions.h"
@@ -101,5 +101,5 @@
 
   subroutine stop_timer(no_timer)
-    use parallel
+    use parallel_lmdz
     implicit none
     integer :: no_timer
@@ -136,5 +136,5 @@
    
   subroutine allgather_timer
-    use parallel
+    use parallel_lmdz
     implicit none
 #ifdef CPP_MPI    
@@ -171,5 +171,5 @@
   
   subroutine allgather_timer_average
-    use parallel
+    use parallel_lmdz
     implicit none
 #ifdef CPP_MPI
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/top_bound_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/top_bound_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/top_bound_p.F	(revision 1019)
@@ -3,5 +3,5 @@
 !
       SUBROUTINE top_bound_p(vcov,ucov,teta,masse,dt,ducov)
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/tourpot_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/tourpot_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/tourpot_p.F	(revision 1019)
@@ -1,4 +1,4 @@
       SUBROUTINE tourpot_p ( vcov, ucov, massebxy, vorpot )
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/vitvert_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/vitvert_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/vitvert_p.F	(revision 1019)
@@ -1,5 +1,5 @@
       SUBROUTINE vitvert_p ( convm , w )
 c
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/vlsplt_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/vlsplt_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/vlsplt_p.F	(revision 1019)
@@ -14,5 +14,5 @@
 c
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       USE Vampir
@@ -199,5 +199,5 @@
 c
 c   --------------------------------------------------------------------
-      USE Parallel
+      USE Parallel_lmdz
       IMPLICIT NONE
 c
@@ -534,5 +534,5 @@
 c
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
@@ -923,5 +923,5 @@
 c
 c   --------------------------------------------------------------------
-      USE Parallel
+      USE Parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/vlspltgen_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/vlspltgen_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/vlspltgen_p.F	(revision 1019)
@@ -22,5 +22,5 @@
 c     pk exner au milieu des couches necessaire pour calculer Qsat
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       USE Write_Field_p
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/vlspltqs_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/vlspltqs_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/vlspltqs_p.F	(revision 1019)
@@ -22,5 +22,5 @@
 c     pk exner au milieu des couches necessaire pour calculer Qsat
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       USE mod_hallo
       USE VAMPIR
@@ -240,5 +240,5 @@
 c
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
@@ -592,5 +592,5 @@
 c
 c   --------------------------------------------------------------------
-      USE parallel
+      USE parallel_lmdz
       IMPLICIT NONE
 c
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/write_field_p.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/write_field_p.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/write_field_p.F90	(revision 1019)
@@ -9,5 +9,5 @@
   
   subroutine write_field1D_p(name,Field)
-    USE parallel
+    USE parallel_lmdz
     USE write_field
     implicit none
@@ -30,5 +30,5 @@
 
   subroutine write_field2D_p(name,Field)
-    USE parallel
+    USE parallel_lmdz
     USE write_field
     implicit none
@@ -51,5 +51,5 @@
   
   subroutine write_field3D_p(name,Field)
-    USE parallel
+    USE parallel_lmdz
     USE write_field
     implicit none
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/writedynav_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/writedynav_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/writedynav_p.F	(revision 1019)
@@ -9,5 +9,5 @@
       USE ioipsl
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE misc_mod
       USE infotrac
Index: trunk/LMDZ.COMMON/libf/dyn3dpar/writehist_p.F
===================================================================
--- trunk/LMDZ.COMMON/libf/dyn3dpar/writehist_p.F	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/dyn3dpar/writehist_p.F	(revision 1019)
@@ -9,5 +9,5 @@
       USE ioipsl
 #endif
-      USE parallel
+      USE parallel_lmdz
       USE misc_mod
       USE infotrac
Index: trunk/LMDZ.COMMON/libf/filtrez/filtreg_mod.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/filtrez/filtreg_mod.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/filtrez/filtreg_mod.F90	(revision 1019)
@@ -10,6 +10,8 @@
 
   SUBROUTINE inifilr
+#ifdef CPP_PARA
   USE mod_filtre_fft, ONLY : use_filtre_fft,Init_filtre_fft
   USE mod_filtre_fft_loc, ONLY : Init_filtre_fft_loc=>Init_filtre_fft    !
+#endif
     !    ... H. Upadhyaya, O.Sharma   ...
     !
@@ -538,4 +540,5 @@
     ENDDO ! of DO j = jfiltsu, jjm
 
+#ifdef CPP_PARA
     IF (use_filtre_fft) THEN
        CALL Init_filtre_fft(coefilu,modfrstu,jfiltnu,jfiltsu,  &
@@ -544,5 +547,5 @@
                            coefilv,modfrstv,jfiltnv,jfiltsv)
     ENDIF
-
+#endif
     !   ...................................................................
 
Index: trunk/LMDZ.COMMON/libf/filtrez/mkl_dft_type.f90
===================================================================
--- trunk/LMDZ.COMMON/libf/filtrez/mkl_dft_type.f90	(revision 1019)
+++ trunk/LMDZ.COMMON/libf/filtrez/mkl_dft_type.f90	(revision 1019)
@@ -0,0 +1,228 @@
+!*****************************************************************************
+! Copyright(C) 2002-2011 Intel Corporation. All Rights Reserved.
+!
+! The source code, information  and  material ("Material") contained herein is
+! owned  by Intel Corporation or its suppliers or licensors, and title to such
+! Material remains  with Intel Corporation  or its suppliers or licensors. The
+! Material  contains proprietary information  of  Intel or  its  suppliers and
+! licensors. The  Material is protected by worldwide copyright laws and treaty
+! provisions. No  part  of  the  Material  may  be  used,  copied, reproduced,
+! modified, published, uploaded, posted, transmitted, distributed or disclosed
+! in any way  without Intel's  prior  express written  permission. No  license
+! under  any patent, copyright  or  other intellectual property rights  in the
+! Material  is  granted  to  or  conferred  upon  you,  either  expressly,  by
+! implication, inducement,  estoppel or  otherwise.  Any  license  under  such
+! intellectual  property  rights must  be express  and  approved  by  Intel in
+! writing.
+!
+! *Third Party trademarks are the property of their respective owners.
+!
+! Unless otherwise  agreed  by Intel  in writing, you may not remove  or alter
+! this  notice or  any other notice embedded  in Materials by Intel or Intel's
+! suppliers or licensors in any way.
+!
+!*****************************************************************************
+! Content:
+!    Intel(R) Math Kernel Library (MKL)
+!    Discrete Fourier Transform Interface (DFTI)
+!*****************************************************************************
+
+MODULE MKL_DFT_TYPE
+
+  TYPE, PUBLIC :: DFTI_DESCRIPTOR
+     PRIVATE
+     INTEGER :: dontuse
+     ! Structure of this type is not used in Fortran code
+     ! the pointer to this type is used only
+  END TYPE DFTI_DESCRIPTOR
+
+  !======================================================================
+  ! These real type kind parameters are not for direct use
+  !======================================================================
+
+  INTEGER, PARAMETER :: DFTI_SPKP = SELECTED_REAL_KIND(6,37)
+  INTEGER, PARAMETER :: DFTI_DPKP = SELECTED_REAL_KIND(15,307)
+
+  !======================================================================
+  ! Descriptor configuration parameters [default values in brackets]
+  !======================================================================
+
+  ! Domain for forward transform. No default value
+  INTEGER, PARAMETER :: DFTI_FORWARD_DOMAIN = 0
+
+  ! Dimensionality, or rank. No default value
+  INTEGER, PARAMETER :: DFTI_DIMENSION = 1
+
+  ! Length(s) of transform. No default value
+  INTEGER, PARAMETER :: DFTI_LENGTHS = 2
+
+  ! Floating point precision. No default value
+  INTEGER, PARAMETER :: DFTI_PRECISION = 3
+
+  ! Scale factor for forward transform [1.0]
+  INTEGER, PARAMETER :: DFTI_FORWARD_SCALE = 4
+
+  ! Scale factor for backward transform [1.0]
+  INTEGER, PARAMETER :: DFTI_BACKWARD_SCALE = 5
+
+  ! Exponent sign for forward transform [DFTI_NEGATIVE]
+  ! INTEGER, PARAMETER :: DFTI_FORWARD_SIGN = 6 ! NOT IMPLEMENTED
+
+  ! Number of data sets to be transformed [1]
+  INTEGER, PARAMETER :: DFTI_NUMBER_OF_TRANSFORMS = 7
+
+  ! Storage of finite complex-valued sequences in complex domain
+  ! [DFTI_COMPLEX_COMPLEX]
+  INTEGER, PARAMETER :: DFTI_COMPLEX_STORAGE = 8
+
+  ! Storage of finite real-valued sequences in real domain
+  ! [DFTI_REAL_REAL]
+  INTEGER, PARAMETER :: DFTI_REAL_STORAGE = 9
+
+  ! Storage of finite complex-valued sequences in conjugate-even
+  ! domain [DFTI_COMPLEX_REAL]
+  INTEGER, PARAMETER :: DFTI_CONJUGATE_EVEN_STORAGE = 10
+
+  ! Placement of result [DFTI_INPLACE]
+  INTEGER, PARAMETER :: DFTI_PLACEMENT = 11
+
+  ! Generalized strides for input data layout
+  ! [tigth, col-major for Fortran]
+  INTEGER, PARAMETER :: DFTI_INPUT_STRIDES = 12
+
+  ! Generalized strides for output data layout
+  ! [tigth, col-major for Fortran]
+  INTEGER, PARAMETER :: DFTI_OUTPUT_STRIDES = 13
+
+  ! Distance between first input elements for multiple transforms [0]
+  INTEGER, PARAMETER :: DFTI_INPUT_DISTANCE = 14
+
+  ! Distance between first output elements for multiple transforms [0]
+  INTEGER, PARAMETER :: DFTI_OUTPUT_DISTANCE = 15
+
+  ! Effort spent in initialization [DFTI_MEDIUM]
+  ! INTEGER, PARAMETER :: DFTI_INITIALIZATION_EFFORT = 16 ! NOT IMPLEMENTED
+
+  ! Use of workspace during computation [DFTI_ALLOW]
+  INTEGER, PARAMETER :: DFTI_WORKSPACE = 17
+
+  ! Ordering of the result [DFTI_ORDERED]
+  INTEGER, PARAMETER :: DFTI_ORDERING = 18
+
+  ! Possible transposition of result [DFTI_NONE]
+  INTEGER, PARAMETER :: DFTI_TRANSPOSE = 19
+
+  ! User-settable descriptor name [""]
+  INTEGER, PARAMETER :: DFTI_DESCRIPTOR_NAME = 20
+
+  ! Packing format for DFTI_COMPLEX_REAL storage of finite
+  ! conjugate-even sequences [DFTI_CCS_FORMAT]
+  INTEGER, PARAMETER :: DFTI_PACKED_FORMAT = 21
+
+  ! Commit status of the descriptor. Read-only parameter
+  INTEGER, PARAMETER :: DFTI_COMMIT_STATUS = 22
+
+  ! Version string for this DFTI implementation. Read-only parameter
+  INTEGER, PARAMETER :: DFTI_VERSION = 23
+
+  ! Ordering of the forward transform. Read-only parameter
+  ! INTEGER, PARAMETER :: DFTI_FORWARD_ORDERING = 24 ! NOT IMPLEMENTED
+
+  ! Ordering of the backward transform. Read-only parameter
+  ! INTEGER, PARAMETER :: DFTI_BACKWARD_ORDERING = 25 ! NOT IMPLEMENTED
+
+  ! Number of user threads that share the descriptor [1]
+  INTEGER, PARAMETER :: DFTI_NUMBER_OF_USER_THREADS = 26
+
+  !======================================================================
+  ! Values of the descriptor configuration parameters
+  !======================================================================
+
+  ! DFTI_COMMIT_STATUS
+  INTEGER, PARAMETER :: DFTI_COMMITTED = 30
+  INTEGER, PARAMETER :: DFTI_UNCOMMITTED = 31
+
+  ! DFTI_FORWARD_DOMAIN
+  INTEGER, PARAMETER :: DFTI_COMPLEX = 32
+  INTEGER, PARAMETER :: DFTI_REAL = 33
+  ! INTEGER, PARAMETER :: DFTI_CONJUGATE_EVEN = 34 ! NOT IMPLEMENTED
+
+  ! DFTI_PRECISION
+  INTEGER, PARAMETER :: DFTI_SINGLE = 35
+  INTEGER, PARAMETER :: DFTI_DOUBLE = 36
+
+  ! DFTI_PRECISION for reduced size of statically linked application.
+  ! Recommended use: modify statement 'USE MKL_DFTI' in your program,
+  ! so that it reads as either of:
+  ! USE MKL_DFTI, FORGET=>DFTI_SINGLE, DFTI_SINGLE=>DFTI_SINGLE_R
+  ! USE MKL_DFTI, FORGET=>DFTI_DOUBLE, DFTI_DOUBLE=>DFTI_DOUBLE_R
+  ! where word 'FORGET' can be any name not used in the program.
+  REAL(DFTI_SPKP), PARAMETER :: DFTI_SINGLE_R = 35
+  REAL(DFTI_DPKP), PARAMETER :: DFTI_DOUBLE_R = 36
+
+  ! DFTI_FORWARD_SIGN
+  ! INTEGER, PARAMETER :: DFTI_NEGATIVE = 37 ! NOT IMPLEMENTED
+  ! INTEGER, PARAMETER :: DFTI_POSITIVE = 38 ! NOT IMPLEMENTED
+
+  ! DFTI_COMPLEX_STORAGE and DFTI_CONJUGATE_EVEN_STORAGE
+  INTEGER, PARAMETER :: DFTI_COMPLEX_COMPLEX = 39
+  INTEGER, PARAMETER :: DFTI_COMPLEX_REAL = 40
+
+  ! DFTI_REAL_STORAGE
+  INTEGER, PARAMETER :: DFTI_REAL_COMPLEX = 41
+  INTEGER, PARAMETER :: DFTI_REAL_REAL = 42
+
+  ! DFTI_PLACEMENT
+  INTEGER, PARAMETER :: DFTI_INPLACE = 43 ! Result overwrites input
+  INTEGER, PARAMETER :: DFTI_NOT_INPLACE  = 44 ! Have another place for result
+
+  ! DFTI_INITIALIZATION_EFFORT
+  ! INTEGER, PARAMETER :: DFTI_LOW = 45 ! NOT IMPLEMENTED
+  ! INTEGER, PARAMETER :: DFTI_MEDIUM = 46 ! NOT IMPLEMENTED
+  ! INTEGER, PARAMETER :: DFTI_HIGH = 47 ! NOT IMPLEMENTED
+
+  ! DFTI_ORDERING
+  INTEGER, PARAMETER :: DFTI_ORDERED = 48
+  INTEGER, PARAMETER :: DFTI_BACKWARD_SCRAMBLED = 49
+  ! INTEGER, PARAMETER :: DFTI_FORWARD_SCRAMBLED  = 50 ! NOT IMPLEMENTED
+
+  ! Allow/avoid certain usages
+  INTEGER, PARAMETER :: DFTI_ALLOW = 51 ! Allow transposition or workspace
+  INTEGER, PARAMETER :: DFTI_AVOID = 52 ! Avoid auxiliary storage
+  INTEGER, PARAMETER :: DFTI_NONE = 53
+
+  ! DFTI_PACKED_FORMAT
+  ! (for storing congugate-even finite sequence in real array)
+  INTEGER, PARAMETER :: DFTI_CCS_FORMAT = 54  ! Complex conjugate-symmetric
+  INTEGER, PARAMETER :: DFTI_PACK_FORMAT = 55 ! Pack format for real DFT
+  INTEGER, PARAMETER :: DFTI_PERM_FORMAT = 56 ! Perm format for real DFT
+  INTEGER, PARAMETER :: DFTI_CCE_FORMAT = 57  ! Complex conjugate-even
+
+  !======================================================================
+  ! Error classes
+  !======================================================================
+  INTEGER, PARAMETER :: DFTI_NO_ERROR = 0
+  INTEGER, PARAMETER :: DFTI_MEMORY_ERROR = 1
+  INTEGER, PARAMETER :: DFTI_INVALID_CONFIGURATION = 2
+  INTEGER, PARAMETER :: DFTI_INCONSISTENT_CONFIGURATION = 3
+  INTEGER, PARAMETER :: DFTI_MULTITHREADED_ERROR = 4
+  INTEGER, PARAMETER :: DFTI_BAD_DESCRIPTOR = 5
+  INTEGER, PARAMETER :: DFTI_UNIMPLEMENTED = 6
+  INTEGER, PARAMETER :: DFTI_MKL_INTERNAL_ERROR = 7
+  INTEGER, PARAMETER :: DFTI_NUMBER_OF_THREADS_ERROR = 8
+  INTEGER, PARAMETER :: DFTI_1D_LENGTH_EXCEEDS_INT32 = 9
+
+  ! Maximum length of error string
+  INTEGER, PARAMETER :: DFTI_MAX_MESSAGE_LENGTH = 80
+
+  ! Maximum length of user-settable descriptor name
+  INTEGER, PARAMETER :: DFTI_MAX_NAME_LENGTH = 10
+
+  ! Maximum length of MKL version string
+  INTEGER, PARAMETER :: DFTI_VERSION_LENGTH = 198
+
+  ! (deprecated parameter)
+  INTEGER, PARAMETER :: DFTI_ERROR_CLASS = 60
+
+END MODULE MKL_DFT_TYPE
+
Index: trunk/LMDZ.COMMON/libf/filtrez/mkl_dfti.f90
===================================================================
--- trunk/LMDZ.COMMON/libf/filtrez/mkl_dfti.f90	(revision 1019)
+++ trunk/LMDZ.COMMON/libf/filtrez/mkl_dfti.f90	(revision 1019)
@@ -0,0 +1,529 @@
+!*****************************************************************************
+! Copyright(C) 2002-2011 Intel Corporation. All Rights Reserved.
+!
+! The source code, information  and  material ("Material") contained herein is
+! owned  by Intel Corporation or its suppliers or licensors, and title to such
+! Material remains  with Intel Corporation  or its suppliers or licensors. The
+! Material  contains proprietary information  of  Intel or  its  suppliers and
+! licensors. The  Material is protected by worldwide copyright laws and treaty
+! provisions. No  part  of  the  Material  may  be  used,  copied, reproduced,
+! modified, published, uploaded, posted, transmitted, distributed or disclosed
+! in any way  without Intel's  prior  express written  permission. No  license
+! under  any patent, copyright  or  other intellectual property rights  in the
+! Material  is  granted  to  or  conferred  upon  you,  either  expressly,  by
+! implication, inducement,  estoppel or  otherwise.  Any  license  under  such
+! intellectual  property  rights must  be express  and  approved  by  Intel in
+! writing.
+!
+! *Third Party trademarks are the property of their respective owners.
+!
+! Unless otherwise  agreed  by Intel  in writing, you may not remove  or alter
+! this  notice or  any other notice embedded  in Materials by Intel or Intel's
+! suppliers or licensors in any way.
+!
+!*****************************************************************************
+! Content:
+!    Intel(R) Math Kernel Library (MKL)
+!    Discrete Fourier Transform Interface (DFTI)
+!*****************************************************************************
+
+
+MODULE MKL_DFTI
+
+  USE MKL_DFT_TYPE
+
+  INTERFACE DftiCreateDescriptor
+
+     FUNCTION dfti_create_descriptor_1d(desc, precision, domain, dim, length)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_create_descriptor_1d
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_create_descriptor_1d
+       INTEGER dfti_create_descriptor_1d
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       INTEGER, INTENT(IN) :: precision
+       INTEGER, INTENT(IN) :: domain
+       INTEGER, INTENT(IN) :: dim, length
+     END FUNCTION dfti_create_descriptor_1d
+
+     FUNCTION dfti_create_descriptor_highd(desc, precision, domain, dim,length)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_create_descriptor_highd
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_create_descriptor_highd
+       INTEGER dfti_create_descriptor_highd
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       INTEGER, INTENT(IN) :: precision
+       INTEGER, INTENT(IN) :: domain
+       INTEGER, INTENT(IN) :: dim
+       INTEGER, INTENT(IN), DIMENSION(*) :: length
+     END FUNCTION dfti_create_descriptor_highd
+
+     FUNCTION dfti_create_descriptor_s_1d(desc, s, dom, one, dim)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_create_descriptor_s_1d
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_create_descriptor_s_1d
+       INTEGER dfti_create_descriptor_s_1d
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_SPKP), INTENT(IN) :: s
+       INTEGER, INTENT(IN) :: dom
+       INTEGER, INTENT(IN) :: one
+       INTEGER, INTENT(IN) :: dim
+     END FUNCTION dfti_create_descriptor_s_1d
+
+     FUNCTION dfti_create_descriptor_s_md(desc, s, dom, many, dims)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_create_descriptor_s_md
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_create_descriptor_s_md
+       INTEGER dfti_create_descriptor_s_md
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_SPKP), INTENT(IN) :: s
+       INTEGER, INTENT(IN) :: dom
+       INTEGER, INTENT(IN) :: many
+       INTEGER, INTENT(IN), DIMENSION(*) :: dims
+     END FUNCTION dfti_create_descriptor_s_md
+
+     FUNCTION dfti_create_descriptor_d_1d(desc, d, dom, one, dim)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_create_descriptor_d_1d
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_create_descriptor_d_1d
+       INTEGER dfti_create_descriptor_d_1d
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_DPKP), INTENT(IN) :: d
+       INTEGER, INTENT(IN) :: dom
+       INTEGER, INTENT(IN) :: one
+       INTEGER, INTENT(IN) :: dim
+     END FUNCTION dfti_create_descriptor_d_1d
+
+     FUNCTION dfti_create_descriptor_d_md(desc, d, dom, many, dims)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_create_descriptor_d_md
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_create_descriptor_d_md
+       INTEGER dfti_create_descriptor_d_md
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_DPKP), INTENT(IN) :: d
+       INTEGER, INTENT(IN) :: dom
+       INTEGER, INTENT(IN) :: many
+       INTEGER, INTENT(IN), DIMENSION(*) :: dims
+     END FUNCTION dfti_create_descriptor_d_md
+
+  END INTERFACE
+
+  INTERFACE DftiCopyDescriptor
+
+     FUNCTION dfti_copy_descriptor_external(desc, new_desc)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_copy_descriptor_external
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_copy_descriptor_external
+       INTEGER dfti_copy_descriptor_external
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       TYPE(DFTI_DESCRIPTOR), POINTER :: new_desc
+     END FUNCTION dfti_copy_descriptor_external
+
+  END INTERFACE
+
+  INTERFACE DftiCommitDescriptor
+
+     FUNCTION dfti_commit_descriptor_external(desc)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_commit_descriptor_external
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_commit_descriptor_external
+       INTEGER dfti_commit_descriptor_external
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_commit_descriptor_external
+
+  END INTERFACE
+
+  INTERFACE DftiSetValue
+
+     FUNCTION dfti_set_value_intval(desc, OptName, IntVal)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_set_value_intval
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_set_value_intval
+       INTEGER dfti_set_value_intval
+       INTEGER, INTENT(IN) :: OptName
+       INTEGER, INTENT(IN) :: IntVal
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_set_value_intval
+
+     FUNCTION dfti_set_value_sglval(desc, OptName, sglval)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_set_value_sglval
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_set_value_sglval
+       INTEGER dfti_set_value_sglval
+       INTEGER, INTENT(IN) :: OptName
+       REAL(DFTI_SPKP), INTENT(IN) :: sglval
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_set_value_sglval
+
+     FUNCTION dfti_set_value_dblval(desc, OptName, DblVal)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_set_value_dblval
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_set_value_dblval
+       INTEGER dfti_set_value_dblval
+       INTEGER, INTENT(IN) :: OptName
+       REAL(DFTI_DPKP), INTENT(IN) :: DblVal
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_set_value_dblval
+
+     FUNCTION dfti_set_value_intvec(desc, OptName, IntVec)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_set_value_intvec
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_set_value_intvec
+       INTEGER dfti_set_value_intvec
+       INTEGER, INTENT(IN) :: OptName
+       INTEGER, INTENT(IN), DIMENSION(*) :: IntVec
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_set_value_intvec
+
+     FUNCTION dfti_set_value_chars(desc, OptName, Chars)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_set_value_chars
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_set_value_chars
+       INTEGER dfti_set_value_chars
+       INTEGER, INTENT(IN) :: OptName
+       CHARACTER(*), INTENT(IN) :: Chars
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_set_value_chars
+
+  END INTERFACE
+
+  INTERFACE DftiGetValue
+
+     FUNCTION dfti_get_value_intval(desc, OptName, IntVal)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_get_value_intval
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_get_value_intval
+       INTEGER dfti_get_value_intval
+       INTEGER, INTENT(IN) :: OptName
+       INTEGER, INTENT(OUT) :: IntVal
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_get_value_intval
+
+     FUNCTION dfti_get_value_sglval(desc, OptName, sglval)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_get_value_sglval
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_get_value_sglval
+       INTEGER dfti_get_value_sglval
+       INTEGER, INTENT(IN) :: OptName
+       REAL(DFTI_SPKP), INTENT(OUT) :: sglval
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_get_value_sglval
+
+     FUNCTION dfti_get_value_dblval(desc, OptName, DblVal)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_get_value_dblval
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_get_value_dblval
+       INTEGER dfti_get_value_dblval
+       INTEGER, INTENT(IN) :: OptName
+       REAL(DFTI_DPKP), INTENT(OUT) :: DblVal
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_get_value_dblval
+
+     FUNCTION dfti_get_value_intvec(desc, OptName, IntVec)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_get_value_intvec
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_get_value_intvec
+       INTEGER dfti_get_value_intvec
+       INTEGER, INTENT(IN) :: OptName
+       INTEGER, INTENT(OUT), DIMENSION(*) :: IntVec
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_get_value_intvec
+
+     FUNCTION dfti_get_value_chars(desc, OptName, Chars)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_get_value_chars
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_get_value_chars
+       INTEGER dfti_get_value_chars
+       INTEGER, INTENT(IN) :: OptName
+       CHARACTER(*), INTENT(OUT) :: Chars
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_get_value_chars
+
+  END INTERFACE
+
+  INTERFACE DftiComputeForward
+
+     FUNCTION dfti_compute_forward_s(desc,sSrcDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_s
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_s
+       INTEGER dfti_compute_forward_s
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_SPKP), INTENT(INOUT), DIMENSION(*) :: sSrcDst
+     END FUNCTION dfti_compute_forward_s
+
+     FUNCTION dfti_compute_forward_c(desc,cSrcDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_c
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_c
+       INTEGER dfti_compute_forward_c
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       COMPLEX(DFTI_SPKP), INTENT(INOUT), DIMENSION(*) :: cSrcDst
+     END FUNCTION dfti_compute_forward_c
+
+     FUNCTION dfti_compute_forward_ss(desc,sSrcDstRe,sSrcDstIm)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_ss
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_ss
+       INTEGER dfti_compute_forward_ss
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_SPKP), DIMENSION(*) :: sSrcDstRe
+       REAL(DFTI_SPKP), DIMENSION(*) :: sSrcDstIm
+     END FUNCTION dfti_compute_forward_ss
+
+     FUNCTION dfti_compute_forward_sc(desc,sSrc,cDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_sc
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_sc
+       INTEGER dfti_compute_forward_sc
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_SPKP), INTENT(IN), DIMENSION(*) :: sSrc
+       COMPLEX(DFTI_SPKP), INTENT(OUT), DIMENSION(*) :: cDst
+     END FUNCTION dfti_compute_forward_sc
+
+     FUNCTION dfti_compute_forward_cc(desc,cSrc,cDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_cc
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_cc
+       INTEGER dfti_compute_forward_cc
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       COMPLEX(DFTI_SPKP), INTENT(IN), DIMENSION(*) :: cSrc
+       COMPLEX(DFTI_SPKP), INTENT(OUT), DIMENSION(*) :: cDst
+     END FUNCTION dfti_compute_forward_cc
+
+     FUNCTION dfti_compute_forward_ssss(desc,sSrcRe,sSrcIm,sDstRe,sDstIm)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_ssss
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_ssss
+       INTEGER dfti_compute_forward_ssss
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_SPKP), INTENT(IN), DIMENSION(*) :: sSrcRe
+       REAL(DFTI_SPKP), INTENT(IN), DIMENSION(*) :: sSrcIm
+       REAL(DFTI_SPKP), INTENT(OUT), DIMENSION(*) :: sDstRe
+       REAL(DFTI_SPKP), INTENT(OUT), DIMENSION(*) :: sDstIm
+     END FUNCTION dfti_compute_forward_ssss
+
+     FUNCTION dfti_compute_forward_d(desc,dSrcDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_d
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_d
+       INTEGER dfti_compute_forward_d
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_DPKP), INTENT(INOUT), DIMENSION(*) :: dSrcDst
+     END FUNCTION dfti_compute_forward_d
+
+     FUNCTION dfti_compute_forward_z(desc,zSrcDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_z
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_z
+       INTEGER dfti_compute_forward_z
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       COMPLEX(DFTI_DPKP), INTENT(INOUT), DIMENSION(*) :: zSrcDst
+     END FUNCTION dfti_compute_forward_z
+
+     FUNCTION dfti_compute_forward_dd(desc,dSrcDstRe,dSrcDstIm)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_dd
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_dd
+       INTEGER dfti_compute_forward_dd
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_DPKP), DIMENSION(*) :: dSrcDstRe
+       REAL(DFTI_DPKP), DIMENSION(*) :: dSrcDstIm
+     END FUNCTION dfti_compute_forward_dd
+
+     FUNCTION dfti_compute_forward_dz(desc,dSrc,zDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_dz
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_dz
+       INTEGER dfti_compute_forward_dz
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_DPKP), INTENT(IN), DIMENSION(*) :: dSrc
+       COMPLEX(DFTI_DPKP), INTENT(OUT), DIMENSION(*) :: zDst
+     END FUNCTION dfti_compute_forward_dz
+
+     FUNCTION dfti_compute_forward_zz(desc,zSrc,zDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_zz
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_zz
+       INTEGER dfti_compute_forward_zz
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       COMPLEX(DFTI_DPKP), INTENT(IN), DIMENSION(*) :: zSrc
+       COMPLEX(DFTI_DPKP), INTENT(OUT), DIMENSION(*) :: zDst
+     END FUNCTION dfti_compute_forward_zz
+
+     FUNCTION dfti_compute_forward_dddd(desc,dSrcRe,dSrcIm,dDstRe,dDstIm)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_forward_dddd
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_forward_dddd
+       INTEGER dfti_compute_forward_dddd
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_DPKP), INTENT(IN), DIMENSION(*) :: dSrcRe
+       REAL(DFTI_DPKP), INTENT(IN), DIMENSION(*) :: dSrcIm
+       REAL(DFTI_DPKP), INTENT(OUT), DIMENSION(*) :: dDstRe
+       REAL(DFTI_DPKP), INTENT(OUT), DIMENSION(*) :: dDstIm
+     END FUNCTION dfti_compute_forward_dddd
+
+  END INTERFACE DftiComputeForward
+
+  INTERFACE DftiComputeBackward
+
+     FUNCTION dfti_compute_backward_s(desc,sSrcDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_s
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_s
+       INTEGER dfti_compute_backward_s
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_SPKP), INTENT(INOUT), DIMENSION(*) :: sSrcDst
+     END FUNCTION dfti_compute_backward_s
+
+     FUNCTION dfti_compute_backward_c(desc,cSrcDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_c
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_c
+       INTEGER dfti_compute_backward_c
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       COMPLEX(DFTI_SPKP), INTENT(INOUT), DIMENSION(*) :: cSrcDst
+     END FUNCTION dfti_compute_backward_c
+
+     FUNCTION dfti_compute_backward_ss(desc,sSrcDstRe,sSrcDstIm)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_ss
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_ss
+       INTEGER dfti_compute_backward_ss
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_SPKP), DIMENSION(*) :: sSrcDstRe
+       REAL(DFTI_SPKP), DIMENSION(*) :: sSrcDstIm
+     END FUNCTION dfti_compute_backward_ss
+
+     FUNCTION dfti_compute_backward_cs(desc,cSrc,sDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_cs
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_cs
+       INTEGER dfti_compute_backward_cs
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       COMPLEX(DFTI_SPKP), INTENT(IN), DIMENSION(*) :: cSrc
+       REAL(DFTI_SPKP), INTENT(OUT), DIMENSION(*) :: sDst
+     END FUNCTION dfti_compute_backward_cs
+
+     FUNCTION dfti_compute_backward_cc(desc,cSrc,cDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_cc
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_cc
+       INTEGER dfti_compute_backward_cc
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       COMPLEX(DFTI_SPKP), INTENT(IN), DIMENSION(*) :: cSrc
+       COMPLEX(DFTI_SPKP), INTENT(OUT), DIMENSION(*) :: cDst
+     END FUNCTION dfti_compute_backward_cc
+
+     FUNCTION dfti_compute_backward_ssss(desc,sSrcRe,sSrcIm,sDstRe,sDstIm)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_ssss
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_ssss
+       INTEGER dfti_compute_backward_ssss
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_SPKP), INTENT(IN), DIMENSION(*) :: sSrcRe
+       REAL(DFTI_SPKP), INTENT(IN), DIMENSION(*) :: sSrcIm
+       REAL(DFTI_SPKP), INTENT(OUT), DIMENSION(*) :: sDstRe
+       REAL(DFTI_SPKP), INTENT(OUT), DIMENSION(*) :: sDstIm
+     END FUNCTION dfti_compute_backward_ssss
+
+     FUNCTION dfti_compute_backward_d(desc,dSrcDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_d
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_d
+       INTEGER dfti_compute_backward_d
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_DPKP), INTENT(INOUT), DIMENSION(*) :: dSrcDst
+     END FUNCTION dfti_compute_backward_d
+
+     FUNCTION dfti_compute_backward_z(desc,zSrcDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_z
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_z
+       INTEGER dfti_compute_backward_z
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       COMPLEX(DFTI_DPKP), INTENT(INOUT), DIMENSION(*) :: zSrcDst
+     END FUNCTION dfti_compute_backward_z
+
+     FUNCTION dfti_compute_backward_dd(desc,dSrcDstRe,dSrcDstIm)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_dd
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_dd
+       INTEGER dfti_compute_backward_dd
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_DPKP), DIMENSION(*) :: dSrcDstRe
+       REAL(DFTI_DPKP), DIMENSION(*) :: dSrcDstIm
+     END FUNCTION dfti_compute_backward_dd
+
+     FUNCTION dfti_compute_backward_zd(desc,zSrc,dDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_zd
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_zd
+       INTEGER dfti_compute_backward_zd
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       COMPLEX(DFTI_DPKP), INTENT(IN), DIMENSION(*) :: zSrc
+       REAL(DFTI_DPKP), INTENT(OUT), DIMENSION(*) :: dDst
+     END FUNCTION dfti_compute_backward_zd
+
+     FUNCTION dfti_compute_backward_zz(desc,zSrc,zDst)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_zz
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_zz
+       INTEGER dfti_compute_backward_zz
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       COMPLEX(DFTI_DPKP), INTENT(IN), DIMENSION(*) :: zSrc
+       COMPLEX(DFTI_DPKP), INTENT(OUT), DIMENSION(*) :: zDst
+     END FUNCTION dfti_compute_backward_zz
+
+     FUNCTION dfti_compute_backward_dddd(desc,dSrcRe,dSrcIm,dDstRe,dDstIm)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_compute_backward_dddd
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_compute_backward_dddd
+       INTEGER dfti_compute_backward_dddd
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+       REAL(DFTI_DPKP), INTENT(IN), DIMENSION(*) :: dSrcRe
+       REAL(DFTI_DPKP), INTENT(IN), DIMENSION(*) :: dSrcIm
+       REAL(DFTI_DPKP), INTENT(OUT), DIMENSION(*) :: dDstRe
+       REAL(DFTI_DPKP), INTENT(OUT), DIMENSION(*) :: dDstIm
+     END FUNCTION dfti_compute_backward_dddd
+
+  END INTERFACE DftiComputeBackward
+
+  INTERFACE DftiFreeDescriptor
+
+     FUNCTION dfti_free_descriptor_external(desc)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_free_descriptor_external
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_free_descriptor_external
+       INTEGER dfti_free_descriptor_external
+       TYPE(DFTI_DESCRIPTOR), POINTER :: desc
+     END FUNCTION dfti_free_descriptor_external
+
+  END INTERFACE
+
+  INTERFACE DftiErrorClass
+
+     FUNCTION dfti_error_class_external(Status, ErrorClass)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_error_class_external
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_error_class_external
+       LOGICAL dfti_error_class_external
+       INTEGER, INTENT(IN) :: Status
+       INTEGER, INTENT(IN) :: ErrorClass
+     END FUNCTION dfti_error_class_external
+
+  END INTERFACE
+
+  INTERFACE DftiErrorMessage
+
+     FUNCTION dfti_error_message_external(Status)
+       USE MKL_DFT_TYPE
+       !DEC$ ATTRIBUTES C :: dfti_error_message_external
+       !DEC$ ATTRIBUTES REFERENCE :: dfti_error_message_external
+       CHARACTER(LEN=DFTI_MAX_MESSAGE_LENGTH) :: dfti_error_message_external
+       INTEGER, INTENT(IN) :: Status
+     END FUNCTION dfti_error_message_external
+
+  END INTERFACE
+
+END MODULE MKL_DFTI
+
Index: trunk/LMDZ.COMMON/libf/filtrez/mod_filtre_fft.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/filtrez/mod_filtre_fft.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/filtrez/mod_filtre_fft.F90	(revision 1019)
@@ -118,5 +118,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
@@ -179,5 +179,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
@@ -241,5 +241,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
Index: trunk/LMDZ.COMMON/libf/filtrez/mod_filtre_fft_loc.F90
===================================================================
--- trunk/LMDZ.COMMON/libf/filtrez/mod_filtre_fft_loc.F90	(revision 1018)
+++ trunk/LMDZ.COMMON/libf/filtrez/mod_filtre_fft_loc.F90	(revision 1019)
@@ -107,5 +107,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
@@ -187,5 +187,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
@@ -250,5 +250,5 @@
     USE mod_fft
 #ifdef CPP_PARA
-    USE parallel,ONLY : OMP_CHUNK
+    USE parallel_lmdz,ONLY : OMP_CHUNK
 #endif
     IMPLICIT NONE
