Index: LMDZ6/branches/Amaury_dev/libf/dyn3dmem/conf_gcm.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3dmem/conf_gcm.F90	(revision 5119)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3dmem/conf_gcm.F90	(revision 5120)
@@ -7,6 +7,6 @@
   USE IOIPSL
   USE misc_mod
-  USE mod_filtre_fft, ONLY: use_filtre_fft
-  USE mod_filtre_fft_loc, ONLY: use_filtre_fft_loc=>use_filtre_fft
+  USE lmdz_filtre_fft, ONLY: use_filtre_fft
+  USE lmdz_filtre_fft_loc, ONLY: use_filtre_fft_loc=>use_filtre_fft
   USE mod_hallo, ONLY: use_mpi_alloc
   USE infotrac, ONLY: type_trac
Index: LMDZ6/branches/Amaury_dev/libf/dyn3dmem/filtreg_p.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3dmem/filtreg_p.F90	(revision 5119)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3dmem/filtreg_p.F90	(revision 5120)
@@ -5,6 +5,6 @@
         ifiltre, iaire, griscal ,iter)
   USE parallel_lmdz, ONLY: OMP_CHUNK
-  USE mod_filtre_fft
-  USE lmdz_timer_filtre
+  USE lmdz_filtre_fft, ONLY: use_filtre_fft, filtre_u_fft, filtre_v_fft, filtre_inv_fft
+  USE lmdz_timer_filtre, ONLY: init_timer, start_timer, stop_timer
   USE lmdz_coefils, ONLY: jfiltnu, jfiltnv, jfiltsu, jfiltsv, sddu, sddv, unsddu, unsddv, modfrstv, modfrstu
   USE lmdz_filtreg, ONLY: matrinvn, matrinvs, matriceun, matriceus, matricevn, matricevs
Index: LMDZ6/branches/Amaury_dev/libf/dyn3dmem/lmdz_filtreg_p.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3dmem/lmdz_filtreg_p.F90	(revision 5119)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3dmem/lmdz_filtreg_p.F90	(revision 5120)
@@ -10,5 +10,5 @@
           ifiltre, iaire, griscal, iter)
     USE parallel_lmdz, ONLY: OMP_CHUNK
-    USE mod_filtre_fft_loc, ONLY: use_filtre_fft, filtre_u_fft, &
+    USE lmdz_filtre_fft_loc, ONLY: use_filtre_fft, filtre_u_fft, &
             filtre_v_fft, filtre_inv_fft
     USE lmdz_timer_filtre, ONLY: init_timer, start_timer, stop_timer
Index: LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_fft_wrapper.f90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_fft_wrapper.f90	(revision 5119)
+++ LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_fft_wrapper.f90	(revision 5120)
@@ -1,3 +1,5 @@
 MODULE lmdz_fft_wrapper
+  IMPLICIT NONE; PRIVATE
+  PUBLIC vsize, inc, init_fft, fft_forward, fft_backward
 
   INTEGER,SAVE             :: vsize
@@ -6,5 +8,5 @@
 CONTAINS
   
-  SUBROUTINE Init_fft(iim,nb)
+  SUBROUTINE init_fft(iim,nb)
   IMPLICIT NONE
     INTEGER :: iim
@@ -13,5 +15,5 @@
     print *, "wrapper fft : une FFT doit etre specifiee a l'aide d'une clee CPP, sinon utiliser le filtre classique"
     stop 1
-  END SUBROUTINE Init_fft
+  END SUBROUTINE init_fft
   
   
Index: LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtre_fft.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtre_fft.F90	(revision 5120)
+++ LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtre_fft.F90	(revision 5120)
@@ -0,0 +1,300 @@
+
+! $Id$
+
+MODULE lmdz_filtre_fft
+  IMPLICIT NONE; PRIVATE
+  PUBLIC use_filtre_fft, filtre_u, filtre_v, filtre_inv, init_filtre_fft, filtre_u_fft, &
+          filtre_v_fft, filtre_inv_fft
+
+  LOGICAL :: use_filtre_fft
+  REAL,ALLOCATABLE :: filtre_u(:,:)
+  REAL,ALLOCATABLE :: filtre_v(:,:)
+  REAL,ALLOCATABLE :: filtre_inv(:,:)
+
+CONTAINS
+  
+  SUBROUTINE init_filtre_fft(coeffu,modfrstu,jfiltnu,jfiltsu,coeffv,modfrstv,jfiltnv,jfiltsv)
+    USE lmdz_fft
+    IMPLICIT NONE
+    include 'dimensions.h'
+    REAL,   INTENT(IN) :: coeffu(iim,jjm)
+    INTEGER,INTENT(IN) :: modfrstu(jjm)
+    INTEGER,INTENT(IN) :: jfiltnu
+    INTEGER,INTENT(IN) :: jfiltsu
+    REAL,   INTENT(IN) :: coeffv(iim,jjm)
+    INTEGER,INTENT(IN) :: modfrstv(jjm)
+    INTEGER,INTENT(IN) :: jfiltnv
+    INTEGER,INTENT(IN) :: jfiltsv
+    
+    INTEGER            :: index_vp(iim)
+    INTEGER            :: i,j
+    INTEGER            :: l,ll_nb
+
+    index_vp(1)=1
+    DO i=1,iim/2
+      index_vp(i+1)=i*2
+    ENDDO
+    
+    DO i=1,iim/2-1
+      index_vp(iim/2+i+1)=iim-2*i+1
+    ENDDO
+    
+    ALLOCATE(filtre_u(iim,jjm))
+    ALLOCATE(filtre_v(iim,jjm))
+    ALLOCATE(filtre_inv(iim,jjm))
+  
+    
+    DO j=2,jfiltnu
+      DO i=1,iim
+        IF (index_vp(i) < modfrstu(j)) THEN
+          filtre_u(i,j)=0
+        ELSE
+          filtre_u(i,j)=coeffu(index_vp(i),j)
+        ENDIF
+      ENDDO
+    ENDDO
+    
+    DO j=jfiltsu,jjm
+      DO i=1,iim
+        IF (index_vp(i) < modfrstu(j)) THEN
+          filtre_u(i,j)=0
+        ELSE
+          filtre_u(i,j)=coeffu(index_vp(i),j)
+        ENDIF
+      ENDDO
+    ENDDO
+ 
+    DO j=1,jfiltnv
+      DO i=1,iim
+        IF (index_vp(i) < modfrstv(j)) THEN
+          filtre_v(i,j)=0
+        ELSE
+          filtre_v(i,j)=coeffv(index_vp(i),j)
+        ENDIF
+      ENDDO
+    ENDDO
+   
+    DO j=jfiltsv,jjm
+      DO i=1,iim
+        IF (index_vp(i) < modfrstv(j)) THEN
+          filtre_v(i,j)=0
+        ELSE
+          filtre_v(i,j)=coeffv(index_vp(i),j)
+        ENDIF
+      ENDDO
+    ENDDO
+         
+    DO j=2,jfiltnu
+      DO i=1,iim
+        IF (index_vp(i) < modfrstu(j)) THEN
+          filtre_inv(i,j)=0
+        ELSE
+          filtre_inv(i,j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j))
+        ENDIF
+      ENDDO
+    ENDDO
+
+    DO j=jfiltsu,jjm
+      DO i=1,iim
+        IF (index_vp(i) < modfrstu(j)) THEN
+          filtre_inv(i,j)=0
+        ELSE
+          filtre_inv(i,j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j))
+        ENDIF
+      ENDDO
+    ENDDO
+    
+#ifdef FFT_FFTW
+
+    WRITE (*,*)"COTH jfiltnu,jfiltsu,jfiltnv,jjm-jfiltsv"
+    WRITE (*,*)jfiltnu,jfiltsu,jfiltnv,jjm-jfiltsv
+    WRITE (*,*)MAX(jfiltnu-2,jjm-jfiltsu,jfiltnv-2,jjm-jfiltsv)+1
+    CALL init_FFT(iim,(llm+1)*(MAX(jfiltnu-2,jjm-jfiltsu,jfiltnv-2,jjm-jfiltsv)+1))
+#else    
+    CALL init_FFT(iim,(jjm+1)*(llm+1))
+#endif        
+    
+  END SUBROUTINE init_filtre_fft
+  
+  SUBROUTINE filtre_u_fft(vect_inout,nlat,jj_begin,jj_end,nbniv)
+    USE lmdz_fft
+#ifdef CPP_PARA
+    USE parallel_lmdz,ONLY: OMP_CHUNK
+#endif
+    IMPLICIT NONE
+    include 'dimensions.h'
+    INTEGER,INTENT(IN) :: nlat
+    INTEGER,INTENT(IN) :: jj_begin
+    INTEGER,INTENT(IN) :: jj_end
+    INTEGER,INTENT(IN) :: nbniv
+    REAL,INTENT(INOUT) :: vect_inout(iim+1,nlat,nbniv)
+
+    REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
+    COMPLEX         :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
+    INTEGER            :: nb_vect
+    INTEGER :: i,j,l
+    INTEGER :: ll_nb
+    
+    ll_nb=0
+!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l=1,nbniv
+      ll_nb=ll_nb+1
+      DO j=1,jj_end-jj_begin+1
+        DO i=1,iim+1
+          vect(i,j,ll_nb)=vect_inout(i,j+jj_begin-1,l)
+        ENDDO
+      ENDDO
+    ENDDO
+!$OMP END DO NOWAIT
+
+    nb_vect=(jj_end-jj_begin+1)*ll_nb
+
+    CALL FFT_forward(vect,TF_vect,nb_vect)
+
+    DO l=1,ll_nb
+      DO j=1,jj_end-jj_begin+1
+        DO i=1,iim/2+1
+          TF_vect(i,j,l)=TF_vect(i,j,l)*filtre_u(i,jj_begin+j-1)
+        ENDDO
+      ENDDO
+    ENDDO
+  
+    CALL FFT_backward(TF_vect,vect,nb_vect)
+      
+      
+    ll_nb=0
+!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l=1,nbniv
+      ll_nb=ll_nb+1
+      DO j=1,jj_end-jj_begin+1
+        DO i=1,iim+1
+          vect_inout(i,j+jj_begin-1,l)=vect(i,j,ll_nb)
+        ENDDO
+      ENDDO
+    ENDDO
+!$OMP END DO NOWAIT
+
+  END SUBROUTINE filtre_u_fft
+
+  SUBROUTINE filtre_v_fft(vect_inout,nlat,jj_begin,jj_end,nbniv)
+    USE lmdz_fft
+#ifdef CPP_PARA
+    USE parallel_lmdz,ONLY: OMP_CHUNK
+#endif
+    IMPLICIT NONE
+    INCLUDE 'dimensions.h'
+    INTEGER,INTENT(IN) :: nlat
+    INTEGER,INTENT(IN) :: jj_begin
+    INTEGER,INTENT(IN) :: jj_end
+    INTEGER,INTENT(IN) :: nbniv
+    REAL,INTENT(INOUT) :: vect_inout(iim+1,nlat,nbniv)
+
+    REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
+    COMPLEX            :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
+    INTEGER            :: nb_vect
+    INTEGER :: i,j,l
+    INTEGER :: ll_nb
+    
+    ll_nb=0
+!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l=1,nbniv
+      ll_nb=ll_nb+1
+      DO j=1,jj_end-jj_begin+1
+        DO i=1,iim+1
+          vect(i,j,ll_nb)=vect_inout(i,j+jj_begin-1,l)
+        ENDDO
+      ENDDO
+    ENDDO
+!$OMP END DO NOWAIT
+
+    
+    nb_vect=(jj_end-jj_begin+1)*ll_nb
+
+    CALL FFT_forward(vect,TF_vect,nb_vect)
+  
+    DO l=1,ll_nb
+      DO j=1,jj_end-jj_begin+1
+        DO i=1,iim/2+1
+          TF_vect(i,j,l)=TF_vect(i,j,l)*filtre_v(i,jj_begin+j-1)
+        ENDDO
+      ENDDO
+    ENDDO
+  
+    CALL FFT_backward(TF_vect,vect,nb_vect)
+    
+    
+    ll_nb=0
+!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l=1,nbniv
+      ll_nb=ll_nb+1
+      DO j=1,jj_end-jj_begin+1
+        DO i=1,iim+1
+          vect_inout(i,j+jj_begin-1,l)=vect(i,j,ll_nb)
+        ENDDO
+      ENDDO
+    ENDDO
+!$OMP END DO NOWAIT
+  
+  END SUBROUTINE filtre_v_fft
+
+  SUBROUTINE filtre_inv_fft(vect_inout,nlat,jj_begin,jj_end,nbniv)
+    USE lmdz_fft
+#ifdef CPP_PARA
+    USE parallel_lmdz,ONLY: OMP_CHUNK
+#endif
+    IMPLICIT NONE
+    INCLUDE 'dimensions.h'
+    INTEGER,INTENT(IN) :: nlat
+    INTEGER,INTENT(IN) :: jj_begin
+    INTEGER,INTENT(IN) :: jj_end
+    INTEGER,INTENT(IN) :: nbniv
+    REAL,INTENT(INOUT) :: vect_inout(iim+1,nlat,nbniv)
+
+     REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
+    COMPLEX            :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
+    INTEGER            :: nb_vect
+    INTEGER :: i,j,l
+    INTEGER :: ll_nb
+    
+    ll_nb=0
+!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l=1,nbniv
+      ll_nb=ll_nb+1
+      DO j=1,jj_end-jj_begin+1
+        DO i=1,iim+1
+          vect(i,j,ll_nb)=vect_inout(i,j+jj_begin-1,l)
+        ENDDO
+      ENDDO
+    ENDDO
+!$OMP END DO NOWAIT
+
+    nb_vect=(jj_end-jj_begin+1)*ll_nb
+
+    CALL FFT_forward(vect,TF_vect,nb_vect)
+  
+    DO l=1,ll_nb
+      DO j=1,jj_end-jj_begin+1
+        DO i=1,iim/2+1
+          TF_vect(i,j,l)=TF_vect(i,j,l)*filtre_inv(i,jj_begin+j-1)
+        ENDDO
+      ENDDO
+    ENDDO
+  
+    CALL FFT_backward(TF_vect,vect,nb_vect)
+
+    ll_nb=0
+!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l=1,nbniv
+      ll_nb=ll_nb+1
+      DO j=1,jj_end-jj_begin+1
+        DO i=1,iim+1
+          vect_inout(i,j+jj_begin-1,l)=vect(i,j,ll_nb)
+        ENDDO
+      ENDDO
+    ENDDO
+!$OMP END DO NOWAIT
+
+  END SUBROUTINE filtre_inv_fft  
+   
+END MODULE lmdz_filtre_fft
+ 
Index: LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtre_fft_loc.f90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtre_fft_loc.f90	(revision 5120)
+++ LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtre_fft_loc.f90	(revision 5120)
@@ -0,0 +1,342 @@
+MODULE lmdz_filtre_fft_loc
+  IMPLICIT NONE; PRIVATE
+  PUBLIC use_filtre_fft, filtre_u, filtre_v, filtre_inv, init_filtre_fft, filtre_u_fft, &
+          filtre_v_fft, filtre_inv_fft
+
+  LOGICAL, SAVE :: use_filtre_fft
+  REAL, SAVE, ALLOCATABLE :: Filtre_u(:, :)
+  REAL, SAVE, ALLOCATABLE :: Filtre_v(:, :)
+  REAL, SAVE, ALLOCATABLE :: Filtre_inv(:, :)
+
+CONTAINS
+
+  SUBROUTINE Init_filtre_fft(coeffu, modfrstu, jfiltnu, jfiltsu, coeffv, modfrstv, jfiltnv, jfiltsv)
+    USE lmdz_fft
+    IMPLICIT NONE
+    include 'dimensions.h'
+    REAL, INTENT(IN) :: coeffu(iim, jjm)
+    INTEGER, INTENT(IN) :: modfrstu(jjm)
+    INTEGER, INTENT(IN) :: jfiltnu
+    INTEGER, INTENT(IN) :: jfiltsu
+    REAL, INTENT(IN) :: coeffv(iim, jjm)
+    INTEGER, INTENT(IN) :: modfrstv(jjm)
+    INTEGER, INTENT(IN) :: jfiltnv
+    INTEGER, INTENT(IN) :: jfiltsv
+
+    INTEGER :: index_vp(iim)
+    INTEGER :: i, j
+
+    index_vp(1) = 1
+    DO i = 1, iim / 2
+      index_vp(i + 1) = i * 2
+    ENDDO
+
+    DO i = 1, iim / 2 - 1
+      index_vp(iim / 2 + i + 1) = iim - 2 * i + 1
+    ENDDO
+
+    ALLOCATE(Filtre_u(iim, jjm))
+    ALLOCATE(Filtre_v(iim, jjm))
+    ALLOCATE(Filtre_inv(iim, jjm))
+
+    DO j = 2, jfiltnu
+      DO i = 1, iim
+        IF (index_vp(i) < modfrstu(j)) THEN
+          Filtre_u(i, j) = 0
+        ELSE
+          Filtre_u(i, j) = coeffu(index_vp(i), j)
+        ENDIF
+      ENDDO
+    ENDDO
+
+    DO j = jfiltsu, jjm
+      DO i = 1, iim
+        IF (index_vp(i) < modfrstu(j)) THEN
+          Filtre_u(i, j) = 0
+        ELSE
+          Filtre_u(i, j) = coeffu(index_vp(i), j)
+        ENDIF
+      ENDDO
+    ENDDO
+
+    DO j = 1, jfiltnv
+      DO i = 1, iim
+        IF (index_vp(i) < modfrstv(j)) THEN
+          Filtre_v(i, j) = 0
+        ELSE
+          Filtre_v(i, j) = coeffv(index_vp(i), j)
+        ENDIF
+      ENDDO
+    ENDDO
+
+    DO j = jfiltsv, jjm
+      DO i = 1, iim
+        IF (index_vp(i) < modfrstv(j)) THEN
+          Filtre_v(i, j) = 0
+        ELSE
+          Filtre_v(i, j) = coeffv(index_vp(i), j)
+        ENDIF
+      ENDDO
+    ENDDO
+
+    DO j = 2, jfiltnu
+      DO i = 1, iim
+        IF (index_vp(i) < modfrstu(j)) THEN
+          Filtre_inv(i, j) = 0
+        ELSE
+          Filtre_inv(i, j) = coeffu(index_vp(i), j) / (1. + coeffu(index_vp(i), j))
+        ENDIF
+      ENDDO
+    ENDDO
+
+    DO j = jfiltsu, jjm
+      DO i = 1, iim
+        IF (index_vp(i) < modfrstu(j)) THEN
+          Filtre_inv(i, j) = 0
+        ELSE
+          Filtre_inv(i, j) = coeffu(index_vp(i), j) / (1. + coeffu(index_vp(i), j))
+        ENDIF
+      ENDDO
+    ENDDO
+
+
+    !    CALL Init_FFT(iim,(jjm+1)*(llm+1))
+
+  END SUBROUTINE Init_filtre_fft
+
+  SUBROUTINE Filtre_u_fft(vect_inout, jjb, jje, jj_begin, jj_end, nbniv)
+    USE lmdz_fft
+#ifdef CPP_PARA
+    USE parallel_lmdz,ONLY: OMP_CHUNK
+#endif
+    IMPLICIT NONE
+    include 'dimensions.h'
+    INTEGER, INTENT(IN) :: jjb
+    INTEGER, INTENT(IN) :: jje
+    INTEGER, INTENT(IN) :: jj_begin
+    INTEGER, INTENT(IN) :: jj_end
+    INTEGER, INTENT(IN) :: nbniv
+    REAL, INTENT(INOUT) :: vect_inout(iim + 1, jjb:jje, nbniv)
+
+    REAL :: vect(iim + inc, jj_end - jj_begin + 1, nbniv)
+    COMPLEX :: TF_vect(iim / 2 + 1, jj_end - jj_begin + 1, nbniv)
+    INTEGER :: nb_vect
+    INTEGER :: i, j, l
+    INTEGER :: ll_nb
+    !    REAL               :: vect_tmp(iim+inc,jj_end-jj_begin+1,nbniv)
+
+    ll_nb = 0
+    !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l = 1, nbniv
+      ll_nb = ll_nb + 1
+      DO j = 1, jj_end - jj_begin + 1
+        DO i = 1, iim + 1
+          vect(i, j, ll_nb) = vect_inout(i, j + jj_begin - 1, l)
+        ENDDO
+      ENDDO
+    ENDDO
+    !$OMP END DO NOWAIT
+
+    nb_vect = (jj_end - jj_begin + 1) * ll_nb
+
+    !    vect_tmp=vect
+
+    CALL FFT_forward(vect, TF_vect, nb_vect)
+
+    !    CALL FFT_forward(vect,TF_vect_test,nb_vect)
+    !      PRINT *,"XXXXXXXXXXXXX Filtre_u_FFT xxxxxxxxxxxx"
+    !      DO j=1,jj_end-jj_begin+1
+    !      DO i=1,iim/2+1
+    !         PRINT *,"====",i,j,"----->",TF_vect_test(i,j,1)
+    !       ENDDO
+    !      ENDDO
+
+    DO l = 1, ll_nb
+      DO j = 1, jj_end - jj_begin + 1
+        DO i = 1, iim / 2 + 1
+          TF_vect(i, j, l) = TF_vect(i, j, l) * Filtre_u(i, jj_begin + j - 1)
+        ENDDO
+      ENDDO
+    ENDDO
+
+    CALL FFT_backward(TF_vect, vect, nb_vect)
+    !    CALL FFT_backward(TF_vect_test,vect_test,nb_vect)
+
+    !      PRINT *,"XXXXXXXXXXXXX Filtre_u_FFT xxxxxxxxxxxx"
+    !      DO j=1,jj_end-jj_begin+1
+    !         DO i=1,iim
+    !           PRINT *,"====",i,j,"----->",vect_test(i,j,1)
+    !         ENDDO
+    !      ENDDO
+
+    ll_nb = 0
+    !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l = 1, nbniv
+      ll_nb = ll_nb + 1
+      DO j = 1, jj_end - jj_begin + 1
+        DO i = 1, iim + 1
+          vect_inout(i, j + jj_begin - 1, l) = vect(i, j, ll_nb)
+        ENDDO
+      ENDDO
+    ENDDO
+    !$OMP END DO NOWAIT
+
+  END SUBROUTINE Filtre_u_fft
+
+
+  SUBROUTINE Filtre_v_fft(vect_inout, jjb, jje, jj_begin, jj_end, nbniv)
+    USE lmdz_fft
+#ifdef CPP_PARA
+    USE parallel_lmdz,ONLY: OMP_CHUNK
+#endif
+    IMPLICIT NONE
+    INCLUDE 'dimensions.h'
+    INTEGER, INTENT(IN) :: jjb
+    INTEGER, INTENT(IN) :: jje
+    INTEGER, INTENT(IN) :: jj_begin
+    INTEGER, INTENT(IN) :: jj_end
+    INTEGER, INTENT(IN) :: nbniv
+    REAL, INTENT(INOUT) :: vect_inout(iim + 1, jjb:jje, nbniv)
+
+    REAL :: vect(iim + inc, jj_end - jj_begin + 1, nbniv)
+    COMPLEX :: TF_vect(iim / 2 + 1, jj_end - jj_begin + 1, nbniv)
+    INTEGER :: nb_vect
+    INTEGER :: i, j, l
+    INTEGER :: ll_nb
+
+    ll_nb = 0
+    !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l = 1, nbniv
+      ll_nb = ll_nb + 1
+      DO j = 1, jj_end - jj_begin + 1
+        DO i = 1, iim + 1
+          vect(i, j, ll_nb) = vect_inout(i, j + jj_begin - 1, l)
+        ENDDO
+      ENDDO
+    ENDDO
+    !$OMP END DO NOWAIT
+
+    nb_vect = (jj_end - jj_begin + 1) * ll_nb
+
+    CALL FFT_forward(vect, TF_vect, nb_vect)
+
+    DO l = 1, ll_nb
+      DO j = 1, jj_end - jj_begin + 1
+        DO i = 1, iim / 2 + 1
+          TF_vect(i, j, l) = TF_vect(i, j, l) * Filtre_v(i, jj_begin + j - 1)
+        ENDDO
+      ENDDO
+    ENDDO
+
+    CALL FFT_backward(TF_vect, vect, nb_vect)
+
+    ll_nb = 0
+    !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l = 1, nbniv
+      ll_nb = ll_nb + 1
+      DO j = 1, jj_end - jj_begin + 1
+        DO i = 1, iim + 1
+          vect_inout(i, j + jj_begin - 1, l) = vect(i, j, ll_nb)
+        ENDDO
+      ENDDO
+    ENDDO
+    !$OMP END DO NOWAIT
+
+  END SUBROUTINE Filtre_v_fft
+
+
+  SUBROUTINE Filtre_inv_fft(vect_inout, jjb, jje, jj_begin, jj_end, nbniv)
+    USE lmdz_fft
+#ifdef CPP_PARA
+    USE parallel_lmdz,ONLY: OMP_CHUNK
+#endif
+    IMPLICIT NONE
+    INCLUDE 'dimensions.h'
+    INTEGER, INTENT(IN) :: jjb
+    INTEGER, INTENT(IN) :: jje
+    INTEGER, INTENT(IN) :: jj_begin
+    INTEGER, INTENT(IN) :: jj_end
+    INTEGER, INTENT(IN) :: nbniv
+    REAL, INTENT(INOUT) :: vect_inout(iim + 1, jjb:jje, nbniv)
+
+    REAL :: vect(iim + inc, jj_end - jj_begin + 1, nbniv)
+    COMPLEX :: TF_vect(iim / 2 + 1, jj_end - jj_begin + 1, nbniv)
+    INTEGER :: nb_vect
+    INTEGER :: i, j, l
+    INTEGER :: ll_nb
+
+    ll_nb = 0
+    !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l = 1, nbniv
+      ll_nb = ll_nb + 1
+      DO j = 1, jj_end - jj_begin + 1
+        DO i = 1, iim + 1
+          vect(i, j, ll_nb) = vect_inout(i, j + jj_begin - 1, l)
+        ENDDO
+      ENDDO
+    ENDDO
+    !$OMP END DO NOWAIT
+
+    nb_vect = (jj_end - jj_begin + 1) * ll_nb
+
+    CALL FFT_forward(vect, TF_vect, nb_vect)
+
+    DO l = 1, ll_nb
+      DO j = 1, jj_end - jj_begin + 1
+        DO i = 1, iim / 2 + 1
+          TF_vect(i, j, l) = TF_vect(i, j, l) * Filtre_inv(i, jj_begin + j - 1)
+        ENDDO
+      ENDDO
+    ENDDO
+
+    CALL FFT_backward(TF_vect, vect, nb_vect)
+
+    ll_nb = 0
+    !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
+    DO l = 1, nbniv
+      ll_nb = ll_nb + 1
+      DO j = 1, jj_end - jj_begin + 1
+        DO i = 1, iim + 1
+          vect_inout(i, j + jj_begin - 1, l) = vect(i, j, ll_nb)
+        ENDDO
+      ENDDO
+    ENDDO
+    !$OMP END DO NOWAIT
+
+  END SUBROUTINE Filtre_inv_fft
+
+
+  !  SUBROUTINE get_ll_index(nbniv,ll_index,ll_nb)
+  !  IMPLICIT NONE
+  !    INTEGER,INTENT(IN)  :: nbniv
+  !    INTEGER,INTENT(OUT) :: ll_index(nbniv)
+  !    INTEGER,INTENT(OUT) :: ll_nb
+
+  !    INTEGER :: l,ll_begin, ll_end
+  !   INTEGER :: omp_rank,omp_size
+  !   INTEGER :: OMP_GET_NUM_THREADS
+  !   INTEGER :: omp_chunk
+  !   EXTERNAL OMP_GET_NUM_THREADS
+  !   INTEGER :: OMP_GET_THREAD_NUM
+  !   EXTERNAL OMP_GET_THREAD_NUM
+
+
+  !   omp_size=OMP_GET_NUM_THREADS()
+  !   omp_rank=OMP_GET_THREAD_NUM()
+  !   omp_chunk=nbniv/omp_size+min(1,MOD(nbniv,omp_size))
+
+  !   ll_begin=omp_rank*OMP_CHUNK+1
+  !   ll_nb=0
+  !   DO WHILE (ll_begin<=nbniv)
+  !     ll_end=min(ll_begin+OMP_CHUNK-1,nbniv)
+  !     DO l=ll_begin,ll_end
+  !       ll_nb=ll_nb+1
+  !       ll_index(ll_nb)=l
+  !     ENDDO
+  !     ll_begin=ll_begin+omp_size*OMP_CHUNK
+  !   ENDDO
+
+  !  END SUBROUTINE get_ll_index
+
+END MODULE lmdz_filtre_fft_loc
+ 
Index: LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtreg.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtreg.F90	(revision 5119)
+++ LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtreg.F90	(revision 5120)
@@ -579,6 +579,6 @@
   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    !
+  USE lmdz_filtre_fft, ONLY: use_filtre_fft,Init_filtre_fft
+  USE lmdz_filtre_fft_loc, ONLY: Init_filtre_fft_loc=>Init_filtre_fft    !
 #endif
     USE serre_mod, ONLY: alphax
Index: LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_timer_filtre.f90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_timer_filtre.f90	(revision 5119)
+++ LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_timer_filtre.f90	(revision 5120)
@@ -2,15 +2,15 @@
   IMPLICIT NONE
   PRIVATE
-  REAL :: time
-  REAL :: Last_time
-  PUBLIC :: Init_timer, start_timer, stop_timer, Print_filtre_timer
+  PUBLIC :: init_timer, start_timer, stop_timer, print_filtre_timer
+
+  REAL :: time, last_time
 CONTAINS
 
-  SUBROUTINE Init_timer
+  SUBROUTINE init_timer
     time = 0
     Last_time = 0
-  END SUBROUTINE Init_timer
+  END SUBROUTINE init_timer
 
-  SUBROUTINE Start_timer
+  SUBROUTINE start_timer
 
     CALL cpu_time(last_time)
@@ -23,11 +23,11 @@
 
     CALL cpu_time(t)
-    Time = Time + t - last_time
+    time = time + t - last_time
 
   END SUBROUTINE stop_timer
 
-  SUBROUTINE Print_filtre_timer
-    PRINT *, "Temps CPU passe dans le filtre :", Time
-  END SUBROUTINE  Print_filtre_timer
+  SUBROUTINE print_filtre_timer
+    PRINT *, "Temps CPU passe dans le filtre :", time
+  END SUBROUTINE  print_filtre_timer
 
 END MODULE lmdz_timer_filtre
Index: LMDZ6/branches/Amaury_dev/libf/filtrez/mod_filtre_fft.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/filtrez/mod_filtre_fft.F90	(revision 5119)
+++ 	(revision )
@@ -1,299 +1,0 @@
-
-! $Id$
-
-MODULE mod_filtre_fft
-
-  LOGICAL,SAVE :: use_filtre_fft
-  REAL,SAVE,ALLOCATABLE :: Filtre_u(:,:)
-  REAL,SAVE,ALLOCATABLE :: Filtre_v(:,:)
-  REAL,SAVE,ALLOCATABLE :: Filtre_inv(:,:)
-
-CONTAINS
-  
-  SUBROUTINE Init_filtre_fft(coeffu,modfrstu,jfiltnu,jfiltsu,coeffv,modfrstv,jfiltnv,jfiltsv)
-    USE lmdz_fft
-    IMPLICIT NONE
-    include 'dimensions.h'
-    REAL,   INTENT(IN) :: coeffu(iim,jjm)
-    INTEGER,INTENT(IN) :: modfrstu(jjm)
-    INTEGER,INTENT(IN) :: jfiltnu
-    INTEGER,INTENT(IN) :: jfiltsu
-    REAL,   INTENT(IN) :: coeffv(iim,jjm)
-    INTEGER,INTENT(IN) :: modfrstv(jjm)
-    INTEGER,INTENT(IN) :: jfiltnv
-    INTEGER,INTENT(IN) :: jfiltsv
-    
-    INTEGER            :: index_vp(iim)
-    INTEGER            :: i,j
-    INTEGER            :: l,ll_nb
-
-    index_vp(1)=1
-    DO i=1,iim/2
-      index_vp(i+1)=i*2
-    ENDDO
-    
-    DO i=1,iim/2-1
-      index_vp(iim/2+i+1)=iim-2*i+1
-    ENDDO
-    
-    ALLOCATE(Filtre_u(iim,jjm))
-    ALLOCATE(Filtre_v(iim,jjm))
-    ALLOCATE(Filtre_inv(iim,jjm))
-  
-    
-    DO j=2,jfiltnu
-      DO i=1,iim
-        IF (index_vp(i) < modfrstu(j)) THEN
-          Filtre_u(i,j)=0
-        ELSE
-          Filtre_u(i,j)=coeffu(index_vp(i),j)
-        ENDIF
-      ENDDO
-    ENDDO
-    
-    DO j=jfiltsu,jjm
-      DO i=1,iim
-        IF (index_vp(i) < modfrstu(j)) THEN
-          Filtre_u(i,j)=0
-        ELSE
-          Filtre_u(i,j)=coeffu(index_vp(i),j)
-        ENDIF
-      ENDDO
-    ENDDO
- 
-    DO j=1,jfiltnv
-      DO i=1,iim
-        IF (index_vp(i) < modfrstv(j)) THEN
-          Filtre_v(i,j)=0
-        ELSE
-          Filtre_v(i,j)=coeffv(index_vp(i),j)
-        ENDIF
-      ENDDO
-    ENDDO
-   
-    DO j=jfiltsv,jjm
-      DO i=1,iim
-        IF (index_vp(i) < modfrstv(j)) THEN
-          Filtre_v(i,j)=0
-        ELSE
-          Filtre_v(i,j)=coeffv(index_vp(i),j)
-        ENDIF
-      ENDDO
-    ENDDO
-         
-    DO j=2,jfiltnu
-      DO i=1,iim
-        IF (index_vp(i) < modfrstu(j)) THEN
-          Filtre_inv(i,j)=0
-        ELSE
-          Filtre_inv(i,j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j))
-        ENDIF
-      ENDDO
-    ENDDO
-
-    DO j=jfiltsu,jjm
-      DO i=1,iim
-        IF (index_vp(i) < modfrstu(j)) THEN
-          Filtre_inv(i,j)=0
-        ELSE
-          Filtre_inv(i,j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j))
-        ENDIF
-      ENDDO
-    ENDDO
-    
-#ifdef FFT_FFTW
-
-    WRITE (*,*)"COTH jfiltnu,jfiltsu,jfiltnv,jjm-jfiltsv"
-    WRITE (*,*)jfiltnu,jfiltsu,jfiltnv,jjm-jfiltsv
-    WRITE (*,*)MAX(jfiltnu-2,jjm-jfiltsu,jfiltnv-2,jjm-jfiltsv)+1
-    CALL Init_FFT(iim,(llm+1)*(MAX(jfiltnu-2,jjm-jfiltsu,jfiltnv-2,jjm-jfiltsv)+1))
-#else    
-    CALL Init_FFT(iim,(jjm+1)*(llm+1))
-#endif        
-    
-  END SUBROUTINE Init_filtre_fft
-  
-  SUBROUTINE Filtre_u_fft(vect_inout,nlat,jj_begin,jj_end,nbniv)
-    USE lmdz_fft
-#ifdef CPP_PARA
-    USE parallel_lmdz,ONLY: OMP_CHUNK
-#endif
-    IMPLICIT NONE
-    include 'dimensions.h'
-    INTEGER,INTENT(IN) :: nlat
-    INTEGER,INTENT(IN) :: jj_begin
-    INTEGER,INTENT(IN) :: jj_end
-    INTEGER,INTENT(IN) :: nbniv
-    REAL,INTENT(INOUT) :: vect_inout(iim+1,nlat,nbniv)
-
-    REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
-    COMPLEX         :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
-    INTEGER            :: nb_vect
-    INTEGER :: i,j,l
-    INTEGER :: ll_nb
-    
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect(i,j,ll_nb)=vect_inout(i,j+jj_begin-1,l)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-
-    nb_vect=(jj_end-jj_begin+1)*ll_nb
-
-    CALL FFT_forward(vect,TF_vect,nb_vect)
-
-    DO l=1,ll_nb
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim/2+1
-          TF_vect(i,j,l)=TF_vect(i,j,l)*Filtre_u(i,jj_begin+j-1)
-        ENDDO
-      ENDDO
-    ENDDO
-  
-    CALL FFT_backward(TF_vect,vect,nb_vect)
-      
-      
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect_inout(i,j+jj_begin-1,l)=vect(i,j,ll_nb)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-
-  END SUBROUTINE Filtre_u_fft
-  
-
-  SUBROUTINE Filtre_v_fft(vect_inout,nlat,jj_begin,jj_end,nbniv)
-    USE lmdz_fft
-#ifdef CPP_PARA
-    USE parallel_lmdz,ONLY: OMP_CHUNK
-#endif
-    IMPLICIT NONE
-    INCLUDE 'dimensions.h'
-    INTEGER,INTENT(IN) :: nlat
-    INTEGER,INTENT(IN) :: jj_begin
-    INTEGER,INTENT(IN) :: jj_end
-    INTEGER,INTENT(IN) :: nbniv
-    REAL,INTENT(INOUT) :: vect_inout(iim+1,nlat,nbniv)
-
-    REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
-    COMPLEX            :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
-    INTEGER            :: nb_vect
-    INTEGER :: i,j,l
-    INTEGER :: ll_nb
-    
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect(i,j,ll_nb)=vect_inout(i,j+jj_begin-1,l)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-
-    
-    nb_vect=(jj_end-jj_begin+1)*ll_nb
-
-    CALL FFT_forward(vect,TF_vect,nb_vect)
-  
-    DO l=1,ll_nb
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim/2+1
-          TF_vect(i,j,l)=TF_vect(i,j,l)*Filtre_v(i,jj_begin+j-1)
-        ENDDO
-      ENDDO
-    ENDDO
-  
-    CALL FFT_backward(TF_vect,vect,nb_vect)
-    
-    
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect_inout(i,j+jj_begin-1,l)=vect(i,j,ll_nb)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-  
-  END SUBROUTINE Filtre_v_fft
-
-
-  SUBROUTINE Filtre_inv_fft(vect_inout,nlat,jj_begin,jj_end,nbniv)
-    USE lmdz_fft
-#ifdef CPP_PARA
-    USE parallel_lmdz,ONLY: OMP_CHUNK
-#endif
-    IMPLICIT NONE
-    INCLUDE 'dimensions.h'
-    INTEGER,INTENT(IN) :: nlat
-    INTEGER,INTENT(IN) :: jj_begin
-    INTEGER,INTENT(IN) :: jj_end
-    INTEGER,INTENT(IN) :: nbniv
-    REAL,INTENT(INOUT) :: vect_inout(iim+1,nlat,nbniv)
-
-     REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
-    COMPLEX            :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
-    INTEGER            :: nb_vect
-    INTEGER :: i,j,l
-    INTEGER :: ll_nb
-    
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect(i,j,ll_nb)=vect_inout(i,j+jj_begin-1,l)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-
-    nb_vect=(jj_end-jj_begin+1)*ll_nb
-
-    CALL FFT_forward(vect,TF_vect,nb_vect)
-  
-    DO l=1,ll_nb
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim/2+1
-          TF_vect(i,j,l)=TF_vect(i,j,l)*Filtre_inv(i,jj_begin+j-1)
-        ENDDO
-      ENDDO
-    ENDDO
-  
-    CALL FFT_backward(TF_vect,vect,nb_vect)
-
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect_inout(i,j+jj_begin-1,l)=vect(i,j,ll_nb)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-
-  END SUBROUTINE Filtre_inv_fft  
-   
-END MODULE mod_filtre_fft
- 
Index: LMDZ6/branches/Amaury_dev/libf/filtrez/mod_filtre_fft_loc.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/filtrez/mod_filtre_fft_loc.F90	(revision 5119)
+++ 	(revision )
@@ -1,343 +1,0 @@
-MODULE mod_filtre_fft_loc
-
-  LOGICAL,SAVE :: use_filtre_fft
-  REAL,SAVE,ALLOCATABLE :: Filtre_u(:,:)
-  REAL,SAVE,ALLOCATABLE :: Filtre_v(:,:)
-  REAL,SAVE,ALLOCATABLE :: Filtre_inv(:,:)
-
-CONTAINS
-  
-  SUBROUTINE Init_filtre_fft(coeffu,modfrstu,jfiltnu,jfiltsu,coeffv,modfrstv,jfiltnv,jfiltsv)
-    USE lmdz_fft
-    IMPLICIT NONE
-    include 'dimensions.h'
-    REAL,   INTENT(IN) :: coeffu(iim,jjm)
-    INTEGER,INTENT(IN) :: modfrstu(jjm)
-    INTEGER,INTENT(IN) :: jfiltnu
-    INTEGER,INTENT(IN) :: jfiltsu
-    REAL,   INTENT(IN) :: coeffv(iim,jjm)
-    INTEGER,INTENT(IN) :: modfrstv(jjm)
-    INTEGER,INTENT(IN) :: jfiltnv
-    INTEGER,INTENT(IN) :: jfiltsv
-    
-    INTEGER            :: index_vp(iim)
-    INTEGER            :: i,j
-    
-    index_vp(1)=1
-    DO i=1,iim/2
-      index_vp(i+1)=i*2
-    ENDDO
-    
-    DO i=1,iim/2-1
-      index_vp(iim/2+i+1)=iim-2*i+1
-    ENDDO
-    
-    ALLOCATE(Filtre_u(iim,jjm))
-    ALLOCATE(Filtre_v(iim,jjm))
-    ALLOCATE(Filtre_inv(iim,jjm))
-  
-    
-    DO j=2,jfiltnu
-      DO i=1,iim
-        IF (index_vp(i) < modfrstu(j)) THEN
-          Filtre_u(i,j)=0
-        ELSE
-          Filtre_u(i,j)=coeffu(index_vp(i),j)
-        ENDIF
-      ENDDO
-    ENDDO
-    
-    DO j=jfiltsu,jjm
-      DO i=1,iim
-        IF (index_vp(i) < modfrstu(j)) THEN
-          Filtre_u(i,j)=0
-        ELSE
-          Filtre_u(i,j)=coeffu(index_vp(i),j)
-        ENDIF
-      ENDDO
-    ENDDO
- 
-    DO j=1,jfiltnv
-      DO i=1,iim
-        IF (index_vp(i) < modfrstv(j)) THEN
-          Filtre_v(i,j)=0
-        ELSE
-          Filtre_v(i,j)=coeffv(index_vp(i),j)
-        ENDIF
-      ENDDO
-    ENDDO
-   
-    DO j=jfiltsv,jjm
-      DO i=1,iim
-        IF (index_vp(i) < modfrstv(j)) THEN
-          Filtre_v(i,j)=0
-        ELSE
-          Filtre_v(i,j)=coeffv(index_vp(i),j)
-        ENDIF
-      ENDDO
-    ENDDO
-         
-    DO j=2,jfiltnu
-      DO i=1,iim
-        IF (index_vp(i) < modfrstu(j)) THEN
-          Filtre_inv(i,j)=0
-        ELSE
-          Filtre_inv(i,j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j))
-        ENDIF
-      ENDDO
-    ENDDO
-
-    DO j=jfiltsu,jjm
-      DO i=1,iim
-        IF (index_vp(i) < modfrstu(j)) THEN
-          Filtre_inv(i,j)=0
-        ELSE
-          Filtre_inv(i,j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j))
-        ENDIF
-      ENDDO
-    ENDDO
-    
-    
-!    CALL Init_FFT(iim,(jjm+1)*(llm+1))
-        
-    
-  END SUBROUTINE Init_filtre_fft
-  
-  SUBROUTINE Filtre_u_fft(vect_inout,jjb,jje,jj_begin,jj_end,nbniv)
-    USE lmdz_fft
-#ifdef CPP_PARA
-    USE parallel_lmdz,ONLY: OMP_CHUNK
-#endif
-    IMPLICIT NONE
-    include 'dimensions.h'
-    INTEGER,INTENT(IN) :: jjb
-    INTEGER,INTENT(IN) :: jje
-    INTEGER,INTENT(IN) :: jj_begin
-    INTEGER,INTENT(IN) :: jj_end
-    INTEGER,INTENT(IN) :: nbniv
-    REAL,INTENT(INOUT) :: vect_inout(iim+1,jjb:jje,nbniv)
-
-    REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
-    COMPLEX            :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
-    INTEGER            :: nb_vect
-    INTEGER :: i,j,l
-    INTEGER :: ll_nb
-!    REAL               :: vect_tmp(iim+inc,jj_end-jj_begin+1,nbniv)
-    
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect(i,j,ll_nb)=vect_inout(i,j+jj_begin-1,l)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-
-    nb_vect=(jj_end-jj_begin+1)*ll_nb
-
-!    vect_tmp=vect
-
-    CALL FFT_forward(vect,TF_vect,nb_vect)
-
-!    CALL FFT_forward(vect,TF_vect_test,nb_vect)
-!      PRINT *,"XXXXXXXXXXXXX Filtre_u_FFT xxxxxxxxxxxx"
-!      DO j=1,jj_end-jj_begin+1
-!      DO i=1,iim/2+1
-!         PRINT *,"====",i,j,"----->",TF_vect_test(i,j,1)
-!       ENDDO
-!      ENDDO
-
-    DO l=1,ll_nb
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim/2+1
-          TF_vect(i,j,l)=TF_vect(i,j,l)*Filtre_u(i,jj_begin+j-1)
-        ENDDO
-      ENDDO
-    ENDDO
-       
-    CALL FFT_backward(TF_vect,vect,nb_vect)
-!    CALL FFT_backward(TF_vect_test,vect_test,nb_vect)
-          
-!      PRINT *,"XXXXXXXXXXXXX Filtre_u_FFT xxxxxxxxxxxx"
-!      DO j=1,jj_end-jj_begin+1
-!         DO i=1,iim
-!           PRINT *,"====",i,j,"----->",vect_test(i,j,1)
-!         ENDDO
-!      ENDDO
-
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect_inout(i,j+jj_begin-1,l)=vect(i,j,ll_nb)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-
-  END SUBROUTINE Filtre_u_fft
-  
-
-  SUBROUTINE Filtre_v_fft(vect_inout,jjb,jje,jj_begin,jj_end,nbniv)
-    USE lmdz_fft
-#ifdef CPP_PARA
-    USE parallel_lmdz,ONLY: OMP_CHUNK
-#endif
-    IMPLICIT NONE
-    INCLUDE 'dimensions.h'
-    INTEGER,INTENT(IN) :: jjb
-    INTEGER,INTENT(IN) :: jje
-    INTEGER,INTENT(IN) :: jj_begin
-    INTEGER,INTENT(IN) :: jj_end
-    INTEGER,INTENT(IN) :: nbniv
-    REAL,INTENT(INOUT) :: vect_inout(iim+1,jjb:jje,nbniv)
-
-    REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
-    COMPLEX            :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
-    INTEGER            :: nb_vect
-    INTEGER :: i,j,l
-    INTEGER :: ll_nb
-    
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect(i,j,ll_nb)=vect_inout(i,j+jj_begin-1,l)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-
-    
-    nb_vect=(jj_end-jj_begin+1)*ll_nb
-
-    CALL FFT_forward(vect,TF_vect,nb_vect)
-  
-    DO l=1,ll_nb
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim/2+1
-          TF_vect(i,j,l)=TF_vect(i,j,l)*Filtre_v(i,jj_begin+j-1)
-        ENDDO
-      ENDDO
-    ENDDO
-  
-    CALL FFT_backward(TF_vect,vect,nb_vect)
-    
-    
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect_inout(i,j+jj_begin-1,l)=vect(i,j,ll_nb)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-  
-  END SUBROUTINE Filtre_v_fft
-
-
-  SUBROUTINE Filtre_inv_fft(vect_inout,jjb,jje,jj_begin,jj_end,nbniv)
-    USE lmdz_fft
-#ifdef CPP_PARA
-    USE parallel_lmdz,ONLY: OMP_CHUNK
-#endif
-    IMPLICIT NONE
-    INCLUDE 'dimensions.h'
-    INTEGER,INTENT(IN) :: jjb
-    INTEGER,INTENT(IN) :: jje
-    INTEGER,INTENT(IN) :: jj_begin
-    INTEGER,INTENT(IN) :: jj_end
-    INTEGER,INTENT(IN) :: nbniv
-    REAL,INTENT(INOUT) :: vect_inout(iim+1,jjb:jje,nbniv)
-
-    REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
-    COMPLEX            :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
-    INTEGER            :: nb_vect
-    INTEGER :: i,j,l
-    INTEGER :: ll_nb
-    
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect(i,j,ll_nb)=vect_inout(i,j+jj_begin-1,l)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-
-    nb_vect=(jj_end-jj_begin+1)*ll_nb
-
-    CALL FFT_forward(vect,TF_vect,nb_vect)
-  
-    DO l=1,ll_nb
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim/2+1
-          TF_vect(i,j,l)=TF_vect(i,j,l)*Filtre_inv(i,jj_begin+j-1)
-        ENDDO
-      ENDDO
-    ENDDO
-  
-    CALL FFT_backward(TF_vect,vect,nb_vect)
-
-    ll_nb=0
-!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
-    DO l=1,nbniv
-      ll_nb=ll_nb+1
-      DO j=1,jj_end-jj_begin+1
-        DO i=1,iim+1
-          vect_inout(i,j+jj_begin-1,l)=vect(i,j,ll_nb)
-        ENDDO
-      ENDDO
-    ENDDO
-!$OMP END DO NOWAIT
-
-  END SUBROUTINE Filtre_inv_fft  
-  
-  
-!  SUBROUTINE get_ll_index(nbniv,ll_index,ll_nb)
-!  IMPLICIT NONE
-!    INTEGER,INTENT(IN)  :: nbniv
-!    INTEGER,INTENT(OUT) :: ll_index(nbniv)
-!    INTEGER,INTENT(OUT) :: ll_nb
-
-!    INTEGER :: l,ll_begin, ll_end
-!   INTEGER :: omp_rank,omp_size
-!   INTEGER :: OMP_GET_NUM_THREADS
-!   INTEGER :: omp_chunk
-!   EXTERNAL OMP_GET_NUM_THREADS
-!   INTEGER :: OMP_GET_THREAD_NUM
-!   EXTERNAL OMP_GET_THREAD_NUM
-
-
-!   omp_size=OMP_GET_NUM_THREADS()
-!   omp_rank=OMP_GET_THREAD_NUM()    
-!   omp_chunk=nbniv/omp_size+min(1,MOD(nbniv,omp_size))
-
-!   ll_begin=omp_rank*OMP_CHUNK+1
-!   ll_nb=0
-!   DO WHILE (ll_begin<=nbniv)
-!     ll_end=min(ll_begin+OMP_CHUNK-1,nbniv)
-!     DO l=ll_begin,ll_end
-!       ll_nb=ll_nb+1
-!       ll_index(ll_nb)=l
-!     ENDDO
-!     ll_begin=ll_begin+omp_size*OMP_CHUNK
-!   ENDDO
-
-!  END SUBROUTINE get_ll_index
-   
-END MODULE mod_filtre_fft_loc
- 
Index: LMDZ6/branches/Amaury_dev/libf/misc/lmdz_TO_MOVE_ssum_scopy.f90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/misc/lmdz_TO_MOVE_ssum_scopy.f90	(revision 5119)
+++ 	(revision )
@@ -1,43 +1,0 @@
-! TO MOVE SOMEWHERE ELSE !! (Amaury - 07/2024)
-! Move with other vector/math functions
-! Those are old legacy CRAY replacement functions, that are now used in several parts of the code.
-
-MODULE lmdz_ssum_scopy
-  IMPLICIT NONE; PRIVATE
-  PUBLIC ssum, scopy
-CONTAINS
-
-  SUBROUTINE scopy(n, sx, incx, sy, incy)
-
-    IMPLICIT NONE
-
-    INTEGER n, incx, incy, ix, iy, i
-    REAL sx((n - 1) * incx + 1), sy((n - 1) * incy + 1)
-
-    iy = 1
-    ix = 1
-    DO i = 1, n
-      sy(iy) = sx(ix)
-      ix = ix + incx
-      iy = iy + incy
-    END DO
-
-  end
-
-  function ssum(n, sx, incx)
-
-    IMPLICIT NONE
-
-    INTEGER n, incx, i, ix
-    REAL ssum, sx((n - 1) * incx + 1)
-
-    ssum = 0.
-    ix = 1
-    do i = 1, n
-      ssum = ssum + sx(ix)
-      ix = ix + incx
-    END DO
-
-  end
-
-END MODULE lmdz_ssum_scopy
Index: LMDZ6/branches/Amaury_dev/libf/misc/lmdz_ssum_scopy.f90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/misc/lmdz_ssum_scopy.f90	(revision 5120)
+++ LMDZ6/branches/Amaury_dev/libf/misc/lmdz_ssum_scopy.f90	(revision 5120)
@@ -0,0 +1,41 @@
+! Those are old legacy CRAY replacement functions, that are now used in several parts of the code.
+
+MODULE lmdz_ssum_scopy
+  IMPLICIT NONE; PRIVATE
+  PUBLIC ssum, scopy
+CONTAINS
+
+  SUBROUTINE scopy(n, sx, incx, sy, incy)
+
+    IMPLICIT NONE
+
+    INTEGER n, incx, incy, ix, iy, i
+    REAL sx((n - 1) * incx + 1), sy((n - 1) * incy + 1)
+
+    iy = 1
+    ix = 1
+    DO i = 1, n
+      sy(iy) = sx(ix)
+      ix = ix + incx
+      iy = iy + incy
+    END DO
+
+  end
+
+  function ssum(n, sx, incx)
+
+    IMPLICIT NONE
+
+    INTEGER n, incx, i, ix
+    REAL ssum, sx((n - 1) * incx + 1)
+
+    ssum = 0.
+    ix = 1
+    do i = 1, n
+      ssum = ssum + sx(ix)
+      ix = ix + incx
+    END DO
+
+  end
+
+END MODULE lmdz_ssum_scopy
