Index: branches/branche-mb/scripts/sinobad.i
===================================================================
--- branches/branche-mb/scripts/sinobad.i	(revision 58)
+++ branches/branche-mb/scripts/sinobad.i	(revision 59)
@@ -48,4 +48,6 @@
 xistate_init 1 ../data_in/file_rest/GYRE_00000400_restart.nc
 load_eb ta_c  // charger l'ebauche '
+setstate nu 0
+outoebx nu 1 0
 set_modeltime 0
 print_time OFF
Index: branches/branche-mb/src/cost.dat
===================================================================
--- branches/branche-mb/src/cost.dat	(revision 58)
+++ branches/branche-mb/src/cost.dat	(revision 59)
@@ -2,53 +2,2 @@
  0.0000000000000000e+00
  0.0000000000000000e+00
- 2.9733593674719423e+03
- 5.4561410776679122e+02
- 2.4475352252509134e+02
- 2.6358555318068841e+02
- 2.1527711430855038e+02
- 2.0204126463990215e+02
- 2.1416662011590833e+02
- 2.0207208737645496e+02
- 2.0211049147089304e+02
- 2.0235703823123197e+02
- 2.0019969413511828e+02
- 2.2286623273509434e+02
- 1.9878349444274735e+02
- 2.0070292696001030e+02
- 2.0014258993979595e+02
- 1.9972801663599338e+02
- 1.9293537153893590e+02
- 2.0814944891652880e+02
- 1.8213155756443817e+02
- 1.7950672225933866e+02
- 1.8080233872884580e+02
- 1.7876027971923725e+02
- 2.0259497236690703e+02
- 1.7881103040469617e+02
- 1.7886996041817454e+02
- 1.7907554124113310e+02
- 1.8045371934564810e+02
- 1.7569372841627006e+02
- 1.9113648527038990e+02
- 1.7516955251891332e+02
- 1.9550146370923514e+02
- 1.7455342251319595e+02
- 2.1077987977826763e+02
- 1.7473743190883036e+02
- 1.7476659805882767e+02
- 1.7491607437730161e+02
- 1.7534570209262407e+02
- 1.7146968928574532e+02
- 1.7918664114219453e+02
- 1.7311809756377912e+02
- 1.7320818032615955e+02
- 1.7322190117805096e+02
- 1.7328346667692077e+02
- 1.7390681350015083e+02
- 1.7091883954920155e+02
- 1.7074257389516592e+02
- 1.7423942813610816e+02
- 1.7069031205380722e+02
- 1.7425456057653693e+02
- 1.7425631257707835e+02
- 1.7425753342598696e+02
Index: branches/branche-mb/src/dta_lfil.h
===================================================================
--- branches/branche-mb/src/dta_lfil.h	(revision 59)
+++ branches/branche-mb/src/dta_lfil.h	(revision 59)
@@ -0,0 +1,56 @@
+
+/***************************************************************************
+                 module classe dta_lfil.h  -  description
+***************************************************************************/
+// Mohamed Berrada
+// locean-ipsl.upmc, Paris, July 21, 2011
+//===========================================================================
+//                          methode forward
+forward (YREAL x1,YREAL x2,YREAL x3,YREAL x4,YREAL x5,YREAL x6)
+{ /*	1	from	nu      		1  i 	j    k
+	2	from	dta_lfil		1  i 	j    k     t-1 
+	3	from	ztuv_lfil		1  i-1 	j    k     t 
+ 	4	from	ztuv_lfil		1  i 	j    k     t
+	5	from	ztuv_lfil		2  i 	j-1  k     t 
+	6	from	ztuv_lfil		2  i 	j    k     t */
+  //  if (Yi==5 && Yj==5)
+  //printf("dta_lfil : %d\n",Yt);
+
+  if(Yt==1){
+    YS1=x1;
+  }
+  else{
+    if(Yi==0 || Yi==NX-1 || Yj==0 || Yj==NY-1 || Yk==NZ-1){
+      YS1=0.;
+    }
+    else{
+      double zbtr = zbtr2(Yi,Yj);
+      YS1 =x2+ pdth_fil*zbtr*(x4- x3 + x6 - x5);
+    }
+  }
+  //
+}
+
+//===========================================================================
+//                         methode  backward
+
+backward (YREAL x1,YREAL x2,YREAL x3,YREAL x4,YREAL x5,YREAL x6)
+{
+  YJ1I1=0.;     YJ1I2=0.;    YJ1I3=0.;    YJ1I4=0.;    YJ1I5=0.;    YJ1I6=0.;
+
+
+  if(Yt==1){
+    YJ1I1=1.;
+  }
+  else{
+    if(Yi==0 || Yi==NX-1 || Yj==0 || Yj==NY-1 || Yk==NZ-1){
+      YJ1I1=0.;     YJ1I2=0.;    YJ1I3=0.;    YJ1I4=0.;    YJ1I5=0.;    YJ1I6=0.;
+    }
+    else{
+      double zbtr = zbtr2(Yi,Yj);
+      YJ1I1=0.;     YJ1I2=1.;    YJ1I3=-pdth_fil*zbtr;    
+      YJ1I4=pdth_fil*zbtr;    YJ1I5=-pdth_fil*zbtr;    YJ1I6=pdth_fil*zbtr;
+    }
+  }
+  //
+}
Index: branches/branche-mb/src/dta_zfil.h
===================================================================
--- branches/branche-mb/src/dta_zfil.h	(revision 59)
+++ branches/branche-mb/src/dta_zfil.h	(revision 59)
@@ -0,0 +1,51 @@
+
+/***************************************************************************
+                 module classe dta_zfil.h  -  description
+***************************************************************************/
+// Mohamed Berrada
+// locean-ipsl.upmc, Paris, July 21, 2011
+//===========================================================================
+//                          methode forward
+forward (YREAL x1,YREAL x2,YREAL x3,YREAL x4)
+{ /*	1	from	dta_lfil      		1  i 	j    k     t
+	2	from	dta_zfil		1  i 	j    k     t-1 
+	3	from	zwy_zfil		1  i 	j    k+1   t 
+ 	4	from	zwy_zfil		1  i 	j    k     t*/
+  //if (Yi==5 && Yj==5)
+  //printf("dta_zfil : %d\n",Yt);
+  if(Yt==1){
+    YS1=x1;
+  }
+  else{
+    if(Yi==0 || Yi==NX-1 || Yj==0 || Yj==NY-1 || Yk==NZ-1){
+      YS1=0.;
+    }
+    else{
+      double ze3tr=1.e0 / fse3t(Yi,Yj,Yk);// ! 1 sur le pas veritcal au point t 
+      YS1 = x2+ pdtz_fil* ( x4 - x3) * ze3tr;
+    }
+  }
+  //
+}
+
+//===========================================================================
+//                         methode  backward
+
+backward (YREAL x1,YREAL x2,YREAL x3,YREAL x4)
+{
+  YJ1I1=0.;     YJ1I2=0.;    YJ1I3=0.;    YJ1I4=0.;
+  if(Yt==1){
+    YJ1I1=1.;
+  }
+  else{
+    if(Yi==0 || Yi==NX-1 || Yj==0 || Yj==NY-1 || Yk==NZ-1){
+      YJ1I1=0.;     YJ1I2=0.;    YJ1I3=0.;    YJ1I4=0.;
+    }
+    else{
+      double ze3tr=1.e0 / fse3t(Yi,Yj,Yk);// ! 1 sur le pas veritcal au point t 
+      YJ1I1=0.;     YJ1I2=1.;    YJ1I3=-pdtz_fil*ze3tr;    YJ1I4=pdtz_fil*ze3tr;
+    }
+  }
+  //
+
+}
Index: branches/branche-mb/src/sinobad.d
===================================================================
--- branches/branche-mb/src/sinobad.d	(revision 58)
+++ branches/branche-mb/src/sinobad.d	(revision 59)
@@ -18,5 +18,7 @@
 defval TU       2 | start time step
 #ifdef FILTER
-defval OFT      20
+defval OFTL      40
+defval OFTZ      40
+defval OFT      80
 #endif
 #ifndef FILTER
@@ -50,6 +52,7 @@
 //#TRAJECTOIRES (DIM) -----------------------------------TRAJ
 #ifdef FILTER
-traj  Tfilh      M   1  0   1  10
-traj  Tfilz      M   1  10   1  OFT
+traj  Tcstf      M   0  1
+traj  Tlfil      M   1  0    1  OFTL
+traj  Tzfil      M   1  OFTL 1  OFTZ
 #endif
 traj  Tcst       M   0   OFT  1 1
@@ -57,4 +60,9 @@
 exec disp_traj
 
+#ifdef FILTER
+space  S3df 	 M    NX NY NZ    Tcstf
+space  S3dtlf    M    NX NY NZ    Tlfil
+space  S3dtzf    M    NX NY NZ    Tzfil
+#endif
 
 space  S0d  	 M    1		  Tcst
@@ -78,5 +86,4 @@
 
 //#modul	 ta_c			space	S3d	input array NPCA     		  output 1	
-
 #ifndef FILTER
 modul	 ta_c			space	S3d			noward		  output 1	target
@@ -88,7 +95,10 @@
 
 #ifdef FILTER
-modul	 nu			space	S3d			noward		  output 1	target
-modul	 filtre			space	S0d			input 0		  output 1
-modul	 ta_c			space	S3d			input 0		  output 1
+modul	 nu			space	S3df			noward		  output 1	target
+modul	 dta_lfil		space	S3dtlf			input 6		  output 1	tempo
+modul	 ztuv_lfil		space	S3dtlf			input 3		  output 2	tempo
+modul	 dta_zfil		space	S3dtzf			input 4		  output 1	tempo
+modul	 zwy_zfil		space	S3dtzf			input 2		  output 1	tempo
+modul	 ta_c			space	S3d			input 1		  output 1	
 #endif
 
@@ -269,8 +279,39 @@
 #endif
 
-//exec disp_modul
+exec disp_modul
 //#############################################################################################
 
+#ifdef FILTER
+//#---------->dta_lfil
+ctin	 dta_lfil	1	from	nu      		1  i 	j    k	
+ctin	 dta_lfil	2	from	dta_lfil      		1  i 	j    k-1 t-1
+ctin	 dta_lfil	3	from	ztuv_lfil		1  i-1 	j    k	t 
+ctin	 dta_lfil 	4	from	ztuv_lfil		1  i 	j    k	t
+ctin	 dta_lfil	5	from	ztuv_lfil		2  i 	j-1  k	t 
+ctin	 dta_lfil	6	from	ztuv_lfil		2  i 	j    k	t 
+
+//#---------->ztuv_lfil
+ctin	 ztuv_lfil	1	from	dta_lfil		1  i+1 	j    k     t-1
+ctin	 ztuv_lfil	2	from	dta_lfil		1  i 	j    k     t-1 
+ctin	 ztuv_lfil	3	from	dta_lfil		1  i 	j+1  k     t-1 
+
+//#---------->dta_zfil
+ctin	 dta_zfil	1	from	dta_lfil      		1  i 	j    k     t
+ctin	 dta_zfil	2	from	dta_zfil		1  i 	j    k     t-1 
+ctin	 dta_zfil	3	from	zwy_zfil		1  i 	j    k+1   t 
+ctin	 dta_zfil 	4	from	zwy_zfil		1  i 	j    k     t
+
+//#---------->zwy_zfil
+ctin	 zwy_zfil	1	from	dta_zfil      		1  i 	j    k-1   t-1
+ctin	 zwy_zfil	2	from	dta_zfil		1  i 	j    k     t-1 
+
+//#---------->ta_c
+ctin	 ta_c   	1	from	dta_zfil      		1  i 	j    k-1   t
+#endif
 //#ctin	 ta_c			1..NPCA	from	pca_ta			1..NPCA  1
+
+//exec disp_ct_in
+exec disp_modul
+
 
 //#---------->sbcgyre
@@ -697,5 +738,4 @@
 ctin	 wa			1	from	wa			1  i 	j    k+1  t
 ctin	 wa			2	from	hdivn			1  i 	j    k    t
-
 //#---------->
 
@@ -836,8 +876,23 @@
 #ifdef FILTER
 // calcul du filtre
-order modinspace S0d
-       order YA1
-      	    filtre
-      forder
+
+order modinspace S3dtlf
+      order YA3  
+      	    order YA2 YA1
+      	    	  ztuv_lfil
+      	    forder
+      	    order YA2 YA1
+      	    	  dta_lfil
+      	    forder
+      forder
+forder
+
+order modinspace S3dtzf
+    order YA3 YA2 YA1
+    	  zwy_zfil
+    forder
+    order YA3 YA2 YA1
+       	  dta_zfil
+    forder
 forder
 order modinspace S3d
@@ -846,4 +901,5 @@
       forder
 forder
+
 #endif   
 
@@ -1044,10 +1100,19 @@
 #endif
 
+#ifdef FILTER
+
+order spaceintraj Tlfil
+	S3dtlf
+forder
+order spaceintraj Tzfil
+	S3dtzf
+forder
+order spaceintraj Tcst
+	S3d
+forder
+
+#endif
+
 #ifndef SOLSORYAO
-#ifdef FILTER
-order spaceintraj Tcst
-	S0d S3d
-forder
-#endif
 
 order spaceintraj Tsbd
Index: branches/branche-mb/src/sinobad.h
===================================================================
--- branches/branche-mb/src/sinobad.h	(revision 58)
+++ branches/branche-mb/src/sinobad.h	(revision 59)
@@ -76,4 +76,11 @@
   nday_year : current day of the year nyea
   ndastp    : = nyear*10000 + nmonth*100 + nday*/
+
+#ifdef K_FILTER
+double pdth_fil=7200.;
+double pdtz_fil=7200.;
+double fsaht_fil= 1.2e+2;//1000.;
+double avt_fil=1.2e-1;
+#endif
 
 void cal_ff();
Index: branches/branche-mb/src/ta_c.h
===================================================================
--- branches/branche-mb/src/ta_c.h	(revision 58)
+++ branches/branche-mb/src/ta_c.h	(revision 59)
@@ -6,7 +6,7 @@
 //===========================================================================
 //                          methode forward
-forward ()
+forward (YREAL x1)
 { 
-  YS1 = ta_eb(Yi,Yj,Yk) +dta_c(Yi,Yj,Yk);
+  YS1 = ta_eb(Yi,Yj,Yk) +x1;
 
 
@@ -20,8 +20,8 @@
 //                         methode  backward
 
-backward ()
+backward (YREAL x1)
 {
-  //gradient se calcule dans le module filtre
-  
+  YJ1I1=1.; 
+    
   //for(int n=0;n<NPCA;n++) 	
   //  Yjac[0][n]    = stdev_ta[n]*shfs_ta(Yi,Yj,Yk,n);
Index: branches/branche-mb/src/ztuv_lfil.h
===================================================================
--- branches/branche-mb/src/ztuv_lfil.h	(revision 59)
+++ branches/branche-mb/src/ztuv_lfil.h	(revision 59)
@@ -0,0 +1,58 @@
+
+/***************************************************************************
+                 module classe ztuv_lfil.h  -  description
+***************************************************************************/
+// Mohamed Berrada
+// locean-ipsl.upmc, Paris, July 20, 2011
+//===========================================================================
+//                          methode forward
+forward (YREAL x1,YREAL x2,YREAL x3)
+{ /*	1	from	dta_lfil		1  i+1 	j    k     t-1
+	2	from	dta_lfil		1  i 	j    k     t-1 
+	3	from	dta_lfil		1  i 	j+1  k     t-1 */
+  if(Yt==1){
+    YS1=0;
+    YS2=0;
+  }
+  else{
+    if(Yi==0 || Yi==NX-1 || Yj==0 || Yj==NY-1 || Yk==NZ-1){
+      YS1=0.;
+      YS2=0;
+    }
+    else{
+      double zabe1 = fsaht_fil * umask(Yi,Yj,Yk) * ze1ur(Yi,Yj);
+      double zabe2 = fsaht_fil * vmask(Yi,Yj,Yk) * ze2vr(Yi,Yj);
+      YS1=   zabe1 * ( x1 - x2);
+      YS2=   zabe2 * ( x3 - x2);
+    }
+  }
+  //
+}
+
+//===========================================================================
+//                         methode  backward
+
+backward (YREAL x1,YREAL x2,YREAL x3)
+{
+  YJ1I1=0.;     YJ1I2=0.;    YJ1I3=0.;   
+  YJ2I1=0.;     YJ2I2=0.;    YJ2I3=0.;  
+  
+  if(Yt==1){
+    YJ1I1=0.;     YJ1I2=0.;    YJ1I3=0.;   
+    YJ2I1=0.;     YJ2I2=0.;    YJ2I3=0.;  
+  }
+  else{
+    if(Yi==0 || Yi==NX-1 || Yj==0 || Yj==NY-1 || Yk==NZ-1){
+      YJ1I1=0.;     YJ1I2=0.;    YJ1I3=0.;   
+      YJ2I1=0.;     YJ2I2=0.;    YJ2I3=0.;  
+    }
+    else{
+      double zabe1 = fsaht_fil * umask(Yi,Yj,Yk) * ze1ur(Yi,Yj);
+      double zabe2 = fsaht_fil * vmask(Yi,Yj,Yk) * ze2vr(Yi,Yj);
+      YJ1I1=zabe1;     YJ1I2=-zabe1;    YJ1I3=0.;   
+      YJ2I1=0.;     YJ2I2=-zabe2;    YJ2I3=zabe2;  
+    }
+  }
+  //
+
+}
Index: branches/branche-mb/src/zwy_zfil.h
===================================================================
--- branches/branche-mb/src/zwy_zfil.h	(revision 59)
+++ branches/branche-mb/src/zwy_zfil.h	(revision 59)
@@ -0,0 +1,51 @@
+
+/***************************************************************************
+                 module classe zwy_zfil.h  -  description
+***************************************************************************/
+// Mohamed Berrada
+// locean-ipsl.upmc, Paris, July 21, 2011
+//===========================================================================
+//                          methode forward
+forward (YREAL x1,YREAL x2)
+{ /*	1	from	dta_zfil      		1  i 	j    k-1   t-1
+	2	from	dta_zfil		1  i 	j    k     t-1 */
+
+ //! first vertical derivative (gradient)
+
+  if(Yt==1){
+    YS1=0.;
+  }
+  else{
+    if(Yi==0 || Yi==NX-1 || Yj==0 || Yj==NY-1 || Yk==NZ-1){
+      YS1=0.;
+    }
+    else{
+      double zave3r = 1.e0 / fse3w(Yi,Yj,Yk); //! 1 sur le pas veritcal au point w (Arakawa mesh)
+      YS1 = avt_fil * ( x1 - x2) * zave3r;
+    }
+  }
+  //
+}
+
+//===========================================================================
+//                         methode  backward
+
+backward (YREAL x1,YREAL x2)
+{
+  YJ1I1=0.;     YJ1I2=0.;
+
+  if(Yt==1){
+    YJ1I1=0.;     YJ1I2=0.;
+  }
+  else{
+    if(Yi==0 || Yi==NX-1 || Yj==0 || Yj==NY-1 || Yk==NZ-1){
+      YJ1I1=0.;     YJ1I2=0.;
+    }
+    else{
+      double zave3r = 1.e0 / fse3w(Yi,Yj,Yk); //! 1 sur le pas veritcal au point w (Arakawa mesh)
+      YJ1I1=avt_fil*zave3r;     YJ1I2=-avt_fil*zave3r;
+    }
+  }
+  //
+
+}
