Index: LMDZ.3.3/trunk/libf/dyn3d/startvar.F
===================================================================
--- LMDZ.3.3/trunk/libf/dyn3d/startvar.F	(revision 24)
+++ LMDZ.3.3/trunk/libf/dyn3d/startvar.F	(revision 259)
@@ -1,2 +1,5 @@
+C
+C $Header$
+C
       MODULE startvar
     !
@@ -10,13 +13,12 @@
     !
     !        - A 2D variable on the dynamical grid :
-    !           CALL startget(varname, iml, jml, lon_in, lat_in, champ, val_ex)
-    !            
+    !           CALL startget(varname, iml, jml, lon_in, lat_in, champ, val_ex, jml2, lon_in2, lat_in2, interbar )             
     !
     !        - A 1D variable on the physical grid :
-    !            CALL startget(varname, iml, jml, lon_in, lat_in, nbindex, champ, val_exp)
+    !            CALL startget(varname, iml, jml, lon_in, lat_in, nbindex, champ, val_exp, jml2, lon_in2, lat_in2, interbar )
     !
     !
     !         - A 3D variable on the dynamical grid :
-    !            CALL startget(varname, iml, jml, lon_in, lat_in, lml, pls, workvar, champ, val_exp)
+    !            CALL startget(varname, iml, jml, lon_in, lat_in, lml, pls, workvar, champ, val_exp, jml2, lon_in2, lat_in2, interbar )
     !
     !
@@ -57,5 +59,5 @@
       REAL, ALLOCATABLE, SAVE, DIMENSION (:,:)  :: lat_phys, lat_rug,
      . lat_alb, lat_rel, lat_dyn
-      REAL, ALLOCATABLE, SAVE, DIMENSION (:)  :: lev_dyn
+      REAL, ALLOCATABLE, SAVE, DIMENSION (:)  :: levdyn_ini
       REAL, ALLOCATABLE, SAVE, DIMENSION (:,:)  :: relief, zstd, zsig,
      . zgam, zthe, zpic, zval
@@ -70,5 +72,5 @@
     !
       SUBROUTINE startget_phys2d(varname, iml, jml, lon_in, lat_in,
-     . champ, val_exp)
+     . champ, val_exp, jml2, lon_in2, lat_in2 , interbar )
     !
     !    There is a big mess with the size in logitude, should it be iml or iml+1.
@@ -79,8 +81,10 @@
     !
       CHARACTER*(*), INTENT(in) :: varname
-      INTEGER, INTENT(in) :: iml, jml
+      INTEGER, INTENT(in) :: iml, jml ,jml2
       REAL, INTENT(in) :: lon_in(iml), lat_in(jml)
+      REAL, INTENT(in) :: lon_in2(iml), lat_in2(jml2)
       REAL, INTENT(inout) :: champ(iml,jml)
       REAL, INTENT(in) :: val_exp
+      LOGICAL interbar
     !
     !   This routine only works if the variable does not exist or is constant
@@ -97,5 +101,6 @@
                   IF ( .NOT.ALLOCATED(relief)) THEN
                       !
-                      CALL start_init_orog( iml, jml, lon_in, lat_in)
+                      CALL start_init_orog( iml, jml, lon_in, lat_in,
+     .                    jml2,lon_in2,lat_in2, interbar )
                       !
                   ENDIF
@@ -117,5 +122,6 @@
                   IF ( .NOT.ALLOCATED(rugo)) THEN
                       !
-                      CALL start_init_orog( iml, jml, lon_in, lat_in)
+                      CALL start_init_orog( iml, jml, lon_in, lat_in,
+     .                    jml2,lon_in2,lat_in2 , interbar )
                       !
                   ENDIF
@@ -137,5 +143,6 @@
                   IF ( .NOT.ALLOCATED(masque)) THEN
                       !
-                      CALL start_init_orog( iml, jml, lon_in, lat_in)
+                      CALL start_init_orog( iml, jml, lon_in, lat_in,
+     .                     jml2,lon_in2,lat_in2 , interbar )
                       !
                   ENDIF
@@ -157,5 +164,6 @@
                   IF ( .NOT.ALLOCATED(phis)) THEN
                       !
-                      CALL start_init_orog( iml, jml, lon_in, lat_in)
+                      CALL start_init_orog( iml, jml, lon_in, lat_in,
+     .                   jml2,lon_in2, lat_in2 , interbar )
                       !
                   ENDIF
@@ -177,5 +185,6 @@
                   IF ( .NOT.ALLOCATED(psol_dyn)) THEN
                       !
-                      CALL start_init_dyn( iml, jml, lon_in, lat_in)
+                      CALL start_init_dyn( iml, jml, lon_in, lat_in,
+     .                   jml2,lon_in2, lat_in2 , interbar )
                       !
                   ENDIF
@@ -231,18 +240,24 @@
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     !
-      SUBROUTINE start_init_orog( iml, jml, lon_in, lat_in)
-    !
-      INTEGER, INTENT(in) :: iml, jml
+      SUBROUTINE start_init_orog ( iml,jml,lon_in, lat_in,jml2,lon_in2 ,
+     ,   lat_in2 , interbar )
+    !
+      INTEGER, INTENT(in) :: iml, jml, jml2
       REAL, INTENT(in) :: lon_in(iml), lat_in(jml)
+      REAL, INTENT(in) :: lon_in2(iml), lat_in2(jml2)
+      LOGICAL interbar
     !
     !  LOCAL
     !
-      REAL :: lev(1), date, dt
+      LOGICAL interbar2
+      REAL :: lev(1), date, dt,chmin,chmax
       INTEGER :: itau(1), fid
       INTEGER ::  llm_tmp, ttm_tmp
       INTEGER :: i, j
       INTEGER :: iret
+      CHARACTER*25 title
       REAL, ALLOCATABLE :: relief_hi(:,:)
       REAL, ALLOCATABLE :: lon_rad(:), lat_rad(:)
+      REAL, ALLOCATABLE :: lon_ini(:), lat_ini(:)
       REAL, ALLOCATABLE :: tmp_var(:,:)
       INTEGER, ALLOCATABLE :: tmp_int(:,:)
@@ -274,17 +289,29 @@
     !
       ALLOCATE(lon_rad(iml_rel))
+      ALLOCATE(lon_ini(iml_rel))
+
       IF ( MAXVAL(lon_rel(:,:)) .GT. 2.0 * ASIN(1.0) ) THEN
-          lon_rad(:) = lon_rel(:,1) * 2.0 * ASIN(1.0) / 180.0
-      ELSE
-          lon_rad(:) = lon_rel(:,1) 
-      ENDIF
+          lon_ini(:) = lon_rel(:,1) * 2.0 * ASIN(1.0) / 180.0
+      ELSE
+          lon_ini(:) = lon_rel(:,1) 
+      ENDIF
+
       ALLOCATE(lat_rad(jml_rel))
+      ALLOCATE(lat_ini(jml_rel))
+
       IF ( MAXVAL(lat_rel(:,:)) .GT. 2.0 * ASIN(1.0) ) THEN
-          lat_rad(:) = lat_rel(1,:) * 2.0 * ASIN(1.0) / 180.0
-      ELSE
-          lat_rad(:) = lat_rel(1,:) 
-      ENDIF
-    !
-    !
+          lat_ini(:) = lat_rel(1,:) * 2.0 * ASIN(1.0) / 180.0
+      ELSE
+          lat_ini(:) = lat_rel(1,:) 
+      ENDIF
+    !
+    !
+
+      title='RELIEF'
+
+      interbar2 = .FALSE.
+      CALL conf_dat2d(title,iml_rel, jml_rel, lon_ini, lat_ini,
+     . lon_rad, lat_rad, relief_hi , interbar2  )
+
       IF ( check ) WRITE(*,*) 'Computes all the parameters needed',
      .' for the gravity wave drag code'
@@ -337,4 +364,6 @@
         rugo(iml,j) = tmp_var(1,j)
       ENDDO
+c
+cc   ***   rugo  n'est pas utilise pour l'instant  ******
     !
     !   Build land-sea mask
@@ -348,11 +377,13 @@
     !
       SUBROUTINE startget_phys1d(varname, iml, jml, lon_in, 
-     .lat_in, nbindex, champ, val_exp)
+     .lat_in, nbindex, champ, val_exp ,jml2, lon_in2, lat_in2,interbar)
     !
       CHARACTER*(*), INTENT(in) :: varname
-      INTEGER, INTENT(in) :: iml, jml, nbindex
+      INTEGER, INTENT(in) :: iml, jml, nbindex, jml2
       REAL, INTENT(in) :: lon_in(iml), lat_in(jml)
+      REAL, INTENT(in) :: lon_in2(iml), lat_in2(jml2)
       REAL, INTENT(inout) :: champ(nbindex)
       REAL, INTENT(in) :: val_exp
+      LOGICAL interbar
     !
     !
@@ -364,5 +395,6 @@
             CASE ('tsol')
               IF ( .NOT.ALLOCATED(tsol)) THEN
-                CALL start_init_phys( iml, jml, lon_in, lat_in)
+                CALL start_init_phys( iml, jml, lon_in, lat_in,
+     .              jml2, lon_in2, lat_in2, interbar )
               ENDIF
               IF ( SIZE(tsol) .NE. SIZE(lon_in)*SIZE(lat_in) ) THEN
@@ -374,5 +406,6 @@
             CASE ('qsol')
               IF ( .NOT.ALLOCATED(qsol)) THEN
-                CALL start_init_phys( iml, jml, lon_in, lat_in)
+                CALL start_init_phys( iml, jml, lon_in, lat_in,
+     .              jml2, lon_in2,lat_in2 , interbar )
               ENDIF
               IF ( SIZE(qsol) .NE. SIZE(lon_in)*SIZE(lat_in) ) THEN
@@ -384,5 +417,6 @@
             CASE ('psol')
               IF ( .NOT.ALLOCATED(psol_dyn)) THEN
-                CALL start_init_dyn( iml, jml, lon_in, lat_in)
+                CALL start_init_dyn( iml, jml, lon_in, lat_in,
+     .              jml2, lon_in2,lat_in2 , interbar )
               ENDIF
               IF (SIZE(psol_dyn) .NE. SIZE(lon_in)*SIZE(lat_in)) THEN
@@ -394,5 +428,6 @@
             CASE ('zmea')
               IF ( .NOT.ALLOCATED(relief)) THEN
-                CALL start_init_orog( iml, jml, lon_in, lat_in)
+                CALL start_init_orog( iml, jml, lon_in, lat_in,
+     .            jml2, lon_in2,lat_in2 , interbar )
               ENDIF
               IF ( SIZE(relief) .NE. SIZE(lon_in)*SIZE(lat_in) ) THEN
@@ -404,5 +439,6 @@
             CASE ('zstd')
               IF ( .NOT.ALLOCATED(zstd)) THEN
-                CALL start_init_orog( iml, jml, lon_in, lat_in)
+                CALL start_init_orog( iml, jml, lon_in, lat_in,
+     .              jml2, lon_in2,lat_in2 , interbar )
               ENDIF
               IF ( SIZE(zstd) .NE. SIZE(lon_in)*SIZE(lat_in) ) THEN
@@ -414,5 +450,6 @@
             CASE ('zsig')
               IF ( .NOT.ALLOCATED(zsig)) THEN
-                CALL start_init_orog( iml, jml, lon_in, lat_in)
+                CALL start_init_orog( iml, jml, lon_in, lat_in,
+     .               jml2, lon_in2,lat_in2 , interbar )
               ENDIF
               IF ( SIZE(zsig) .NE. SIZE(lon_in)*SIZE(lat_in) ) THEN
@@ -424,5 +461,6 @@
             CASE ('zgam')
               IF ( .NOT.ALLOCATED(zgam)) THEN
-                CALL start_init_orog( iml, jml, lon_in, lat_in)
+                CALL start_init_orog( iml, jml, lon_in, lat_in,
+     .            jml2, lon_in2,lat_in2 , interbar )
               ENDIF
               IF ( SIZE(zgam) .NE. SIZE(lon_in)*SIZE(lat_in) ) THEN
@@ -434,5 +472,6 @@
             CASE ('zthe')
               IF ( .NOT.ALLOCATED(zthe)) THEN
-                CALL start_init_orog( iml, jml, lon_in, lat_in)
+                CALL start_init_orog( iml, jml, lon_in, lat_in,
+     .            jml2, lon_in2,lat_in2 , interbar )
               ENDIF
               IF ( SIZE(zthe) .NE. SIZE(lon_in)*SIZE(lat_in) ) THEN
@@ -444,5 +483,6 @@
             CASE ('zpic')
               IF ( .NOT.ALLOCATED(zpic)) THEN
-                CALL start_init_orog( iml, jml, lon_in, lat_in)
+                CALL start_init_orog( iml, jml, lon_in, lat_in,
+     .            jml2, lon_in2,lat_in2 , interbar )
               ENDIF
               IF ( SIZE(zpic) .NE. SIZE(lon_in)*SIZE(lat_in) ) THEN
@@ -454,5 +494,6 @@
             CASE ('zval')
               IF ( .NOT.ALLOCATED(zval)) THEN
-                CALL start_init_orog( iml, jml, lon_in, lat_in)
+                CALL start_init_orog( iml, jml, lon_in, lat_in,
+     .            jml2, lon_in2,lat_in2 , interbar )
               ENDIF
               IF ( SIZE(zval) .NE. SIZE(lon_in)*SIZE(lat_in) ) THEN
@@ -462,5 +503,5 @@
               ENDIF
               CALL gr_dyn_fi(1, iml, jml, nbindex,zval, champ)
-             CASE ('rads')
+            CASE ('rads')
                   champ(:) = 0.0
             CASE ('snow')
@@ -493,8 +534,11 @@
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     !
-      SUBROUTINE start_init_phys( iml, jml, lon_in, lat_in)
-    !
-      INTEGER, INTENT(in) :: iml, jml
+      SUBROUTINE start_init_phys( iml, jml, lon_in, lat_in, jml2,
+     .                 lon_in2, lat_in2 , interbar )
+    !
+      INTEGER, INTENT(in) :: iml, jml ,jml2
       REAL, INTENT(in) :: lon_in(iml), lat_in(jml)
+      REAL, INTENT(in) :: lon_in2(iml), lat_in2(jml2)
+      LOGICAL interbar
     !
     !  LOCAL
@@ -505,8 +549,10 @@
       INTEGER :: i, j
     !
+      CHARACTER*25 title
       CHARACTER*120 :: physfname
       LOGICAL :: check=.TRUE.
     !
       REAL, ALLOCATABLE :: lon_rad(:), lat_rad(:)
+      REAL, ALLOCATABLE :: lon_ini(:), lat_ini(:)
       REAL, ALLOCATABLE :: var_ana(:,:), tmp_var(:,:)
     !
@@ -533,15 +579,22 @@
     !
       ALLOCATE(lon_rad(iml_phys))
+      ALLOCATE(lon_ini(iml_phys))
+
       IF ( MAXVAL(lon_phys(:,:)) .GT. 2.0 * ASIN(1.0) ) THEN
-          lon_rad(:) = lon_phys(:,1) * 2.0 * ASIN(1.0) / 180.0
-      ELSE
-          lon_rad(:) = lon_phys(:,1) 
-      ENDIF
+          lon_ini(:) = lon_phys(:,1) * 2.0 * ASIN(1.0) / 180.0
+      ELSE
+          lon_ini(:) = lon_phys(:,1) 
+      ENDIF
+
       ALLOCATE(lat_rad(jml_phys))
+      ALLOCATE(lat_ini(jml_phys))
+
       IF ( MAXVAL(lat_phys(:,:)) .GT. 2.0 * ASIN(1.0) ) THEN
-          lat_rad(:) = lat_phys(1,:) * 2.0 * ASIN(1.0) / 180.0
-      ELSE
-          lat_rad(:) = lat_phys(1,:) 
-      ENDIF
+          lat_ini(:) = lat_phys(1,:) * 2.0 * ASIN(1.0) / 180.0
+      ELSE
+          lat_ini(:) = lat_phys(1,:) 
+      ENDIF
+
+
     !
     !   We get the two standard varibales
@@ -552,8 +605,26 @@
     !
     !
+
       CALL flinget(fid_phys, 'ST', iml_phys, jml_phys, 
      .llm_tmp, ttm_tmp, 1, 1, var_ana)
-      CALL grille_m(iml_phys, jml_phys, lon_rad, lat_rad,
-     . var_ana, iml-1, jml, lon_in, lat_in, tmp_var)
+
+      title='ST'
+      CALL conf_dat2d(title,iml_phys, jml_phys, lon_ini, lat_ini,
+     . lon_rad, lat_rad, var_ana , interbar  )
+
+      IF ( interbar )   THEN
+        WRITE(6,*) '-------------------------------------------------',
+     ,'--------------'
+        WRITE(6,*) '$$$ Utilisation de l interpolation barycentrique ',
+     , ' pour  ST $$$ '
+        WRITE(6,*) '-------------------------------------------------',
+     ,'--------------'
+        CALL inter_barxy ( iml_phys,jml_phys -1,lon_rad,lat_rad ,
+     ,   var_ana, iml-1, jml-1, lon_in2, lat_in2, jml, tmp_var   ) 
+      ELSE
+        CALL grille_m(iml_phys, jml_phys, lon_rad, lat_rad,
+     .    var_ana, iml-1, jml, lon_in, lat_in, tmp_var     )
+      ENDIF
+
       CALL gr_int_dyn(tmp_var, tsol, iml-1, jml)
     !
@@ -563,9 +634,26 @@
       CALL flinget(fid_phys, 'CDSW', iml_phys, jml_phys,
      . llm_tmp, ttm_tmp, 1, 1, var_ana)
-      CALL grille_m(iml_phys, jml_phys, lon_rad, lat_rad,
-     . var_ana, iml-1, jml, lon_in, lat_in, tmp_var)
-      CALL gr_int_dyn(tmp_var, qsol, iml-1, jml)
-    !
-      CALL flinclo(fid_phys)
+
+      title='CDSW'
+      CALL conf_dat2d(title,iml_phys, jml_phys, lon_ini, lat_ini,
+     . lon_rad, lat_rad, var_ana, interbar  )
+
+      IF ( interbar )   THEN
+        WRITE(6,*) '-------------------------------------------------',
+     ,'--------------'
+        WRITE(6,*) '$$$ Utilisation de l interpolation barycentrique ',
+     , ' pour  CDSW $$$ '
+        WRITE(6,*) '-------------------------------------------------',
+     ,'--------------'
+        CALL inter_barxy ( iml_phys,jml_phys -1,lon_rad,lat_rad ,
+     ,   var_ana, iml-1, jml-1, lon_in2, lat_in2, jml, tmp_var  )
+      ELSE
+        CALL grille_m(iml_phys, jml_phys, lon_rad, lat_rad,
+     .    var_ana, iml-1, jml, lon_in, lat_in, tmp_var     )
+      ENDIF
+c
+        CALL gr_int_dyn(tmp_var, qsol, iml-1, jml)
+    !
+       CALL flinclo(fid_phys)
     !
       END SUBROUTINE start_init_phys
@@ -576,15 +664,18 @@
     !
       SUBROUTINE startget_dyn(varname, iml, jml, lon_in, lat_in,
-     . lml, pls, workvar, champ, val_exp)
+     . lml, pls, workvar, champ, val_exp,jml2, lon_in2, lat_in2 ,
+     ,  interbar )
     !
     !   ARGUMENTS
     !
       CHARACTER*(*), INTENT(in) :: varname
-      INTEGER, INTENT(in) :: iml, jml, lml
+      INTEGER, INTENT(in) :: iml, jml, lml, jml2
       REAL, INTENT(in) :: lon_in(iml), lat_in(jml)
+      REAL, INTENT(in) :: lon_in2(iml), lat_in2(jml2)
       REAL, INTENT(in) :: pls(iml, jml, lml)
       REAL, INTENT(in) :: workvar(iml, jml, lml)
       REAL, INTENT(inout) :: champ(iml, jml, lml)
       REAL, INTENT(in) :: val_exp
+      LOGICAL interbar
     !
     !    LOCAL
@@ -592,7 +683,4 @@
       INTEGER :: il, ij, ii
       REAL :: xppn, xpps
-    !
-    !   C'est vraiment une galere de devoir rajouter tant de commons just pour avoir les aires.
-    !   Il faudrait mettre une structure plus flexible et moins dangereuse.
     !
 #include "dimensions.h"
@@ -609,8 +697,9 @@
           CASE ('u')
             IF ( .NOT.ALLOCATED(psol_dyn)) THEN
-              CALL start_init_dyn( iml, jml, lon_in, lat_in)
+              CALL start_init_dyn( iml, jml, lon_in, lat_in, jml2 ,
+     .          lon_in2,lat_in2 , interbar )
             ENDIF
             CALL start_inter_3d('U', iml, jml, lml, lon_in,
-     .                           lat_in, pls, champ)
+     .       lat_in, jml2, lon_in2, lat_in2,  pls, champ,interbar )
             DO il=1,lml
               DO ij=1,jml
@@ -623,8 +712,9 @@
           CASE ('v')
             IF ( .NOT.ALLOCATED(psol_dyn)) THEN
-              CALL start_init_dyn( iml, jml, lon_in, lat_in)
+              CALL start_init_dyn( iml, jml, lon_in, lat_in , jml2, 
+     .           lon_in2, lat_in2 , interbar )
             ENDIF
-            CALL start_inter_3d('V', iml, jml, lml, lon_in,
-     .                          lat_in, pls, champ)
+            CALL start_inter_3d('V', iml, jml, lml, lon_in, 
+     .       lat_in, jml2, lon_in2, lat_in2,  pls, champ, interbar )
             DO il=1,lml
               DO ij=1,jml
@@ -637,15 +727,17 @@
           CASE ('t')
             IF ( .NOT.ALLOCATED(psol_dyn)) THEN
-              CALL start_init_dyn( iml, jml, lon_in, lat_in)
+              CALL start_init_dyn( iml, jml, lon_in, lat_in, jml2 ,
+     .           lon_in2, lat_in2 ,interbar )
             ENDIF
             CALL start_inter_3d('TEMP', iml, jml, lml, lon_in,
-     .                           lat_in, pls, champ)
+     .       lat_in, jml2, lon_in2, lat_in2,  pls, champ, interbar )
  
           CASE ('tpot')
             IF ( .NOT.ALLOCATED(psol_dyn)) THEN
-              CALL start_init_dyn( iml, jml, lon_in, lat_in)
+              CALL start_init_dyn( iml, jml, lon_in, lat_in , jml2 ,
+     .            lon_in2, lat_in2 , interbar )
             ENDIF
             CALL start_inter_3d('TEMP', iml, jml, lml, lon_in,
-     .                           lat_in, pls, champ)
+     .       lat_in, jml2, lon_in2, lat_in2,  pls, champ, interbar )
             IF ( MINVAL(workvar(:,:,:)) .NE. MAXVAL(workvar(:,:,:)) )
      .                                    THEN
@@ -672,8 +764,9 @@
           CASE ('q')
             IF ( .NOT.ALLOCATED(psol_dyn)) THEN
-              CALL start_init_dyn( iml, jml, lon_in, lat_in)
+              CALL start_init_dyn( iml, jml, lon_in, lat_in, jml2 ,
+     .           lon_in2, lat_in2 , interbar )
             ENDIF
             CALL start_inter_3d('R', iml, jml, lml, lon_in, lat_in,
-     .                           pls, champ)
+     .        jml2, lon_in2, lat_in2,  pls, champ, interbar )
             IF ( MINVAL(workvar(:,:,:)) .NE. MAXVAL(workvar(:,:,:)) ) 
      .                                     THEN
@@ -710,8 +803,11 @@
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     !
-      SUBROUTINE start_init_dyn( iml, jml, lon_in, lat_in)
-    !
-      INTEGER, INTENT(in) :: iml, jml
+      SUBROUTINE start_init_dyn( iml, jml, lon_in, lat_in,jml2,lon_in2 ,
+     ,             lat_in2 , interbar )
+    !
+      INTEGER, INTENT(in) :: iml, jml, jml2
       REAL, INTENT(in) :: lon_in(iml), lat_in(jml)
+      REAL, INTENT(in) :: lon_in2(iml), lat_in2(jml2)
+      LOGICAL interbar
     !
     !  LOCAL
@@ -726,13 +822,16 @@
     !
       REAL, ALLOCATABLE :: lon_rad(:), lat_rad(:)
+      REAL, ALLOCATABLE :: lon_ini(:), lat_ini(:)
       REAL, ALLOCATABLE :: var_ana(:,:), tmp_var(:,:), z(:,:)
       REAL, ALLOCATABLE :: xppn(:), xpps(:)
       LOGICAL :: allo
     !
-    !   Ce n'est pas tres pratique d'avoir a charger 3 include pour avoir la grille du modele
     !
 #include "dimensions.h"
 #include "paramet.h"
 #include "comgeom2.h"
+
+      CHARACTER*25 title
+
     !
       physfname = 'ECDYN.nc'
@@ -747,8 +846,8 @@
       ALLOCATE (lat_dyn(iml_dyn,jml_dyn), stat=iret)
       ALLOCATE (lon_dyn(iml_dyn,jml_dyn), stat=iret)
-      ALLOCATE (lev_dyn(llm_dyn), stat=iret)
+      ALLOCATE (levdyn_ini(llm_dyn), stat=iret)
     !
       CALL flinopen(physfname, .FALSE., iml_dyn, jml_dyn, llm_dyn,
-     . lon_dyn, lat_dyn, lev_dyn, ttm_dyn, 
+     . lon_dyn, lat_dyn, levdyn_ini, ttm_dyn, 
      . itau, date, dt, fid_dyn)
     !
@@ -764,18 +863,25 @@
         DEALLOCATE(lon_rad, stat=iret)
       endif
-        ALLOCATE(lon_rad(iml_dyn), stat=iret)
+
+      ALLOCATE(lon_rad(iml_dyn), stat=iret)
+      ALLOCATE(lon_ini(iml_dyn))
        
       IF ( MAXVAL(lon_dyn(:,:)) .GT. 2.0 * ASIN(1.0) ) THEN
-          lon_rad(:) = lon_dyn(:,1) * 2.0 * ASIN(1.0) / 180.0
-      ELSE
-          lon_rad(:) = lon_dyn(:,1) 
-      ENDIF
+          lon_ini(:) = lon_dyn(:,1) * 2.0 * ASIN(1.0) / 180.0
+      ELSE
+          lon_ini(:) = lon_dyn(:,1) 
+      ENDIF
+
       ALLOCATE(lat_rad(jml_dyn))
+      ALLOCATE(lat_ini(jml_dyn))
+
       IF ( MAXVAL(lat_dyn(:,:)) .GT. 2.0 * ASIN(1.0) ) THEN
-          lat_rad(:) = lat_dyn(1,:) * 2.0 * ASIN(1.0) / 180.0
-      ELSE
-          lat_rad(:) = lat_dyn(1,:) 
-      ENDIF
-    !
+          lat_ini(:) = lat_dyn(1,:) * 2.0 * ASIN(1.0) / 180.0
+      ELSE
+          lat_ini(:) = lat_dyn(1,:) 
+      ENDIF
+    !
+
+
       ALLOCATE(z(iml, jml))
       ALLOCATE(tmp_var(iml-1,jml))
@@ -783,6 +889,23 @@
       CALL flinget(fid_dyn, 'Z', iml_dyn, jml_dyn, 0, ttm_dyn,
      .              1, 1, var_ana)
-      CALL grille_m(iml_dyn, jml_dyn , lon_rad, lat_rad, var_ana,
+c
+      title='Z'
+      CALL conf_dat2d( title,iml_dyn, jml_dyn,lon_ini, lat_ini,
+     . lon_rad, lat_rad, var_ana, interbar  )
+c
+      IF ( interbar )   THEN
+        WRITE(6,*) '-------------------------------------------------',
+     ,'--------------'
+        WRITE(6,*) '$$$ Utilisation de l interpolation barycentrique ',
+     , ' pour  Z  $$$ '
+        WRITE(6,*) '-------------------------------------------------',
+     ,'--------------'
+        CALL inter_barxy ( iml_dyn,jml_dyn -1,lon_rad,lat_rad ,
+     ,    var_ana, iml-1, jml-1, lon_in2, lat_in2, jml, tmp_var) 
+      ELSE
+        CALL grille_m(iml_dyn, jml_dyn , lon_rad, lat_rad, var_ana,
      .               iml-1, jml, lon_in, lat_in, tmp_var)
+      ENDIF
+
       CALL gr_int_dyn(tmp_var, z, iml-1, jml)
     !
@@ -791,6 +914,23 @@
       CALL flinget(fid_dyn, 'SP', iml_dyn, jml_dyn, 0, ttm_dyn,
      .              1, 1, var_ana)
-      CALL grille_m(iml_dyn, jml_dyn , lon_rad, lat_rad, var_ana,
-     .               iml-1, jml, lon_in, lat_in, tmp_var)
+
+       title='SP'
+      CALL conf_dat2d( title,iml_dyn, jml_dyn,lon_ini, lat_ini,
+     . lon_rad, lat_rad, var_ana, interbar  )
+
+      IF ( interbar )   THEN
+        WRITE(6,*) '-------------------------------------------------',
+     ,'--------------'
+        WRITE(6,*) '$$$ Utilisation de l interpolation barycentrique ',
+     , ' pour  SP  $$$ '
+        WRITE(6,*) '-------------------------------------------------',
+     ,'--------------'
+        CALL inter_barxy ( iml_dyn,jml_dyn -1,lon_rad,lat_rad ,
+     ,    var_ana, iml-1, jml-1, lon_in2, lat_in2, jml, tmp_var) 
+      ELSE
+        CALL grille_m(iml_dyn, jml_dyn , lon_rad, lat_rad, var_ana,
+     .             iml-1, jml, lon_in, lat_in, tmp_var  )
+      ENDIF
+
       CALL gr_int_dyn(tmp_var, psol_dyn, iml-1, jml)
     !
@@ -800,5 +940,6 @@
     !   coming out of the restart file. In case we dor have it we will initialize it.
     !
-        CALL start_init_phys( iml, jml, lon_in, lat_in)
+        CALL start_init_phys( iml, jml, lon_in, lat_in,jml2,lon_in2,
+     .                 lat_in2 , interbar )
       ELSE
         IF ( SIZE(tsol) .NE. SIZE(psol_dyn) ) THEN
@@ -814,5 +955,6 @@
             !     coming out of the restart file. In case we dor have it we will initialize it.
             !
-          CALL start_init_orog( iml, jml, lon_in, lat_in)
+        CALL start_init_orog( iml, jml, lon_in, lat_in, jml2, lon_in2 ,
+     .      lat_in2 , interbar )
             !
       ELSE
@@ -860,5 +1002,5 @@
     !
       SUBROUTINE start_inter_3d(varname, iml, jml, lml, lon_in,
-     .                           lat_in, pls_in, var3d)
+     .      lat_in, jml2, lon_in2, lat_in2, pls_in, var3d, interbar )
     !
     !    This subroutine gets a variables from a 3D file and does the interpolations needed
@@ -868,15 +1010,21 @@
     !
       CHARACTER*(*) :: varname
-      INTEGER :: iml, jml, lml
+      INTEGER :: iml, jml, lml, jml2
       REAL :: lon_in(iml), lat_in(jml), pls_in(iml, jml, lml)
+      REAL :: lon_in2(iml) , lat_in2(jml2)
       REAL :: var3d(iml, jml, lml)
+      LOGICAL interbar
+      real chmin,chmax
     !
     !  LOCAL
     !
-      INTEGER :: ii, ij, il
+      CHARACTER*25 title
+      INTEGER :: ii, ij, il, jsort,i,j,l
       REAL :: bx, by
       REAL, ALLOCATABLE :: lon_rad(:), lat_rad(:)
+      REAL, ALLOCATABLE :: lon_ini(:), lat_ini(:) , lev_dyn(:)
       REAL, ALLOCATABLE :: var_tmp2d(:,:), var_tmp3d(:,:,:)
       REAL, ALLOCATABLE :: ax(:), ay(:), yder(:)
+       REAL, ALLOCATABLE :: varrr(:,:,:)
       INTEGER, ALLOCATABLE :: lind(:)
     !
@@ -886,4 +1034,5 @@
           ALLOCATE(var_ana3d(iml_dyn, jml_dyn, llm_dyn))
       ENDIF
+          ALLOCATE(varrr(iml_dyn, jml_dyn, llm_dyn))
     !
     !
@@ -900,16 +1049,28 @@
     !
       ALLOCATE(lon_rad(iml_dyn))
+      ALLOCATE(lon_ini(iml_dyn))
+
       IF ( MAXVAL(lon_dyn(:,:)) .GT. 2.0 * ASIN(1.0) ) THEN
-          lon_rad(:) = lon_dyn(:,1) * 2.0 * ASIN(1.0) / 180.0
-      ELSE
-          lon_rad(:) = lon_dyn(:,1) 
-      ENDIF
+          lon_ini(:) = lon_dyn(:,1) * 2.0 * ASIN(1.0) / 180.0
+      ELSE
+          lon_ini(:) = lon_dyn(:,1) 
+      ENDIF
+
       ALLOCATE(lat_rad(jml_dyn))
+      ALLOCATE(lat_ini(jml_dyn))
+
+      ALLOCATE(lev_dyn(llm_dyn))
+
       IF ( MAXVAL(lat_dyn(:,:)) .GT. 2.0 * ASIN(1.0) ) THEN
-          lat_rad(:) = lat_dyn(1,:) * 2.0 * ASIN(1.0) / 180.0
-      ELSE
-          lat_rad(:) = lat_dyn(1,:) 
-      ENDIF
-    !
+          lat_ini(:) = lat_dyn(1,:) * 2.0 * ASIN(1.0) / 180.0
+      ELSE
+          lat_ini(:) = lat_dyn(1,:) 
+      ENDIF
+    !
+
+      CALL conf_dat3d ( varname,iml_dyn, jml_dyn, llm_dyn, lon_ini, 
+     . lat_ini, levdyn_ini, lon_rad, lat_rad, lev_dyn, var_ana3d  ,
+     ,  interbar                                                   )
+
       ALLOCATE(var_tmp2d(iml-1, jml))
       ALLOCATE(var_tmp3d(iml, jml, llm_dyn))
@@ -919,8 +1080,22 @@
       ALLOCATE(lind(llm_dyn))
     !
+ 
       DO il=1,llm_dyn
         !
-        CALL grille_m(iml_dyn, jml_dyn, lon_rad, lat_rad, 
-     .var_ana3d(:,:,il), iml-1, jml, lon_in, lat_in, var_tmp2d)
+      IF( interbar )  THEN
+       IF( il.EQ.1 )  THEN
+        WRITE(6,*) '-------------------------------------------------',
+     ,'--------------'
+        WRITE(6,*) '$$$ Utilisation de l interpolation barycentrique ',
+     , ' pour ', varname
+        WRITE(6,*) '-------------------------------------------------',
+     ,'--------------'
+       ENDIF
+       CALL inter_barxy ( iml_dyn, jml_dyn -1,lon_rad, lat_rad, 
+     , var_ana3d(:,:,il),iml-1, jml2, lon_in2, lat_in2,jml,var_tmp2d ) 
+      ELSE
+       CALL grille_m(iml_dyn, jml_dyn, lon_rad, lat_rad, 
+     .  var_ana3d(:,:,il), iml-1, jml, lon_in, lat_in, var_tmp2d )
+      ENDIF
         !
         CALL gr_int_dyn(var_tmp2d, var_tmp3d(:,:,il), iml-1, jml)
@@ -928,23 +1103,19 @@
        ENDDO
        !
-       !  IF needed we return the vertical axis. The spline interpolation
-       !  Requires the coordinate to be in increasing order.
-    !
-      IF ( lev_dyn(1) .LT. lev_dyn(llm_dyn)) THEN
-          DO il=1,llm_dyn
-            lind(il) = il
-          ENDDO        
-      ELSE
           DO il=1,llm_dyn
             lind(il) = llm_dyn-il+1
           ENDDO
-      ENDIF
-    !
+    !
+c
+c  ... Pour l'interpolation verticale ,on interpole du haut de l'atmosphere
+c                    vers  le  sol  ...
+c
       DO ij=1,jml
         DO ii=1,iml-1
           !
-          ax(:) = lev_dyn(lind(:)) * 100
+          ax(:) = lev_dyn(lind(:)) 
           ay(:) = var_tmp3d(ii, ij, lind(:))
           !
+         
           CALL SPLINE(ax, ay, llm_dyn, 1.e30, 1.e30, yder)
           !
@@ -959,4 +1130,18 @@
       ENDDO
 
+      do il=1,lml
+        call minmax(iml*jml,var3d(1,1,il),chmin,chmax)
+      SELECTCASE(varname)
+       CASE('U')
+          WRITE(*,*) ' U  min max l ',il,chmin,chmax
+       CASE('V')
+          WRITE(*,*) ' V  min max l ',il,chmin,chmax
+       CASE('TEMP')
+          WRITE(*,*) ' TEMP  min max l ',il,chmin,chmax
+       CASE('R')
+          WRITE(*,*) ' R  min max l ',il,chmin,chmax
+      END SELECT
+           enddo
+
       DEALLOCATE(lon_rad)
       DEALLOCATE(lat_rad)
