Index: /utils/tools/NESTING/namelist_nordic1
===================================================================
--- /utils/tools/NESTING/namelist_nordic1	(revision 10397)
+++ /utils/tools/NESTING/namelist_nordic1	(revision 10398)
@@ -98,4 +98,5 @@
 &restart_trc
     restart_trc_file = 'restart_trc.nc'   
+    interp_type = 'bilinear'
 / 
 
Index: /utils/tools/NESTING/namelist_nordic1_update
===================================================================
--- /utils/tools/NESTING/namelist_nordic1_update	(revision 10397)
+++ /utils/tools/NESTING/namelist_nordic1_update	(revision 10398)
@@ -99,4 +99,5 @@
 &restart_trc
     restart_trc_file = 'restart_trc.nc'   
+    interp_type = 'bilinear'
 / 
 
Index: /utils/tools/NESTING/namelist_nordic2
===================================================================
--- /utils/tools/NESTING/namelist_nordic2	(revision 10397)
+++ /utils/tools/NESTING/namelist_nordic2	(revision 10398)
@@ -99,4 +99,5 @@
 &restart_trc
     restart_trc_file = 'restart_trc.nc'   
+    interp_type = 'bilinear'
 / 
 
Index: /utils/tools/NESTING/src/agrif_create_restart.f90
===================================================================
--- /utils/tools/NESTING/src/agrif_create_restart.f90	(revision 10397)
+++ /utils/tools/NESTING/src/agrif_create_restart.f90	(revision 10398)
@@ -40,47 +40,27 @@
   CHARACTER*1 :: posvar
   CHARACTER*100 :: Child_file,Childcoordinates,varname,Child_Bathy_Level,Child_Bathy_Meter   
-  REAL*8, POINTER, DIMENSION(:,:) :: lonChild,latChild => NULL()
-  REAL*8, POINTER, DIMENSION(:,:) :: lonParent,latParent => NULL()
-  REAL*8, POINTER, DIMENSION(:,:,:) :: tabvar3d,tabinterp3d,mask => NULL()
-  REAL*8, POINTER, DIMENSION(:,:,:) :: fmask,fse3u,fse3v,fse3t => NULL()
+  REAL*8, POINTER, DIMENSION(:,:,:) :: tabvar3d => NULL()
   REAL*8, POINTER, DIMENSION(:,:,:,:) :: un,ub,vn,vb,tn,tb,sn,sb,e3t_n,e3t_b => NULL()
   REAL*8, POINTER, DIMENSION(:,:,:) :: sshn,sshb => NULL()      
   REAL*8, POINTER, DIMENSION(:,:,:,:) :: tabinterp4d,tabvar1,tabvar2,tabvar3 => NULL()
-  REAL*8, POINTER, DIMENSION(:) :: timedepth_temp => NULL()
   REAL*8, POINTER, DIMENSION(:) :: tabtemp1D,nav_lev => NULL()
-  INTEGER, POINTER, DIMENSION(:) :: tabtemp1DInt => NULL()
-  REAL*8, POINTER, DIMENSION(:,:) :: tabtemp2D,zwf => NULL()
-  REAL*8, POINTER, DIMENSION(:,:) :: e1f,e2f,e1v,e2v,e1u,e2u,e1t,e2t => NULL()
+  REAL*8, POINTER, DIMENSION(:,:) :: tabtemp2D => NULL()
   REAL*8, POINTER, DIMENSION(:,:,:,:) :: tabtemp4D => NULL()
   INTEGER,DIMENSION(:),POINTER :: src_add,dst_add  => NULL()
-  REAL*8,DIMENSION(:,:),POINTER :: matrix,bathy_G0 => NULL()
-  LOGICAL,DIMENSION(:,:,:),POINTER :: Tmask => NULL()
+  REAL*8,DIMENSION(:,:),POINTER :: matrix => NULL()
   LOGICAL,DIMENSION(:,:),POINTER :: masksrc => NULL()
   LOGICAL, DIMENSION(:,:,:), POINTER :: detected_pts
-  LOGICAL :: Interpolation,Extrapolation,Pacifique,op
-  REAL*8 :: za1,za0,zsur,zacr,zkth,zdepth,zdepwp,zmin,zmax,zdiff,ze3tp,ze3wp       
-  INTEGER :: narg,iargc,ncid,x,y,z,z_a,x_a,y_a,z_b,nbvert_lev,m
+  LOGICAL :: Interpolation,Extrapolation,Pacifique
+  INTEGER :: narg,iargc,ncid,x,y,z,z_a,x_a,y_a,z_b,nbvert_lev
   REAL*8 :: now_wght,before_wght
-  INTEGER :: i,j,k,status,ji,jj
+  INTEGER :: status,ii,jk
   CHARACTER(len=20),DIMENSION(4) :: dimnames
   CHARACTER(len=80) :: namelistname
   TYPE(Coordinates) :: G0,G1
-  INTEGER :: jpi,jpj,jpk,jpni,jpnj,jpnij,jpiglo,jpjglo,nlcit,nlcjt,nldit
-  INTEGER :: nldjt,nleit,nlejt,nimppt,njmppt
   REAL*8 :: tabtemp0dreal
-  INTEGER :: tabtemp0dint
   CHARACTER(len=20) :: timedimname
 
   LOGICAL, PARAMETER :: conservation = .FALSE.
   !      
-  ! Variables for dimg
-  ! 
-!  INTEGER :: ino0, it0, ipcg0, isor0, itke0,nfice,nfbulk
-!  INTEGER :: irecl8, irec,ndastp,narea,nsolv
-!  INTEGER :: jk,kt            ! dummy loop indices
-!  INTEGER :: inum             ! temporary logical unit
-!  INTEGER :: ios1 , ios2      ! flag for ice and bulk in the current run
-!  INTEGER :: ios3             ! flag for free surface.  0 = none 1 = yes.  0 = none 1 = yes
-!  INTEGER :: ios4             ! flag for coupled (1) or not (0)    
   !       
   narg = iargc()
@@ -182,9 +162,9 @@
   G0%tmask = 1.    
 
-  DO k=1,z
+  DO jk=1,z
      ALLOCATE(tabvar1(x,y,1,1))
-     CALL Read_Ncdf_var('sn',TRIM(restart_file),tabvar1,1,k)
+     CALL Read_Ncdf_var('sn',TRIM(restart_file),tabvar1,1,jk)
      WHERE( tabvar1(:,:,1,1) == 0. ) 
-        G0%tmask(:,:,k) = 0.
+        G0%tmask(:,:,jk) = 0.
      END WHERE
      DEALLOCATE(tabvar1)
@@ -219,8 +199,8 @@
   !
   !
-  DO ji = 1,SIZE(Ncdf_varname)      
+  DO ii = 1,SIZE(Ncdf_varname)      
      !      
      ! loop on variables names
-     varname = TRIM(Ncdf_varname(ji))
+     varname = TRIM(Ncdf_varname(ii))
      WRITE(*,*) 'var = ',TRIM(varname)     
      !      
Index: /utils/tools/NESTING/src/agrif_create_restart_ice.f90
===================================================================
--- /utils/tools/NESTING/src/agrif_create_restart_ice.f90	(revision 10397)
+++ /utils/tools/NESTING/src/agrif_create_restart_ice.f90	(revision 10398)
@@ -40,11 +40,8 @@
   CHARACTER*1 :: posvar
   CHARACTER*100 :: Child_file,Childcoordinates,varname,Child_Bathy_Level,Child_Bathy_Meter   
-  REAL*8, POINTER, DIMENSION(:,:,:) :: tabvar00, tabvar3d,tabinterp3d,mask => NULL()
+  REAL*8, POINTER, DIMENSION(:,:,:) :: tabvar00, tabvar3d,mask => NULL()
   REAL*8, POINTER, DIMENSION(:,:,:,:) :: tabinterp4d,tabvar0,tabvar1,tabvar2,tabvar3 => NULL()
   REAL*8, POINTER, DIMENSION(:) :: tabtemp1D,nav_lev => NULL()
-  INTEGER, POINTER, DIMENSION(:) :: tabtemp1DInt => NULL()
-  REAL*8, POINTER, DIMENSION(:,:) :: tabtemp2D,zwf => NULL()
-  REAL*8, POINTER, DIMENSION(:,:) :: e1f,e2f,e1v,e2v,e1u,e2u,e1t,e2t => NULL()
-  REAL*8, POINTER, DIMENSION(:,:,:,:) :: tabtemp4D => NULL()
+  REAL*8, POINTER, DIMENSION(:,:) :: tabtemp2D => NULL()
   INTEGER,DIMENSION(:),POINTER :: src_add,dst_add  => NULL()
   REAL*8,DIMENSION(:,:),POINTER :: matrix => NULL()
@@ -53,11 +50,10 @@
   LOGICAL :: Interpolation,Extrapolation,Pacifique
   INTEGER :: narg,iargc,ncid,x,y,z
-  INTEGER :: ji,jl,status,varid,numdims
+  INTEGER :: ii,jl,status,varid,numdims
   CHARACTER(len=20),DIMENSION(4) :: dimnames
   CHARACTER(len=80) :: namelistname
   TYPE(Coordinates) :: G0,G1
-  INTEGER :: jpl,jpiglo,jpjglo
+  INTEGER :: jpl 
   REAL*8 :: tabtemp0dreal
-  INTEGER :: tabtemp0dint
 
   LOGICAL, PARAMETER :: conservation = .FALSE.
@@ -147,8 +143,8 @@
   !
   !
-  DO ji = 1,SIZE(Ncdf_varname)      
+  DO ii = 1,SIZE(Ncdf_varname)      
      !      
      ! loop on variables names
-     varname = TRIM(Ncdf_varname(ji))
+     varname = TRIM(Ncdf_varname(ii))
      !      
      WRITE(*,*) 'var = ',TRIM(varname)     
Index: /utils/tools/NESTING/src/agrif_create_restart_trc.f90
===================================================================
--- /utils/tools/NESTING/src/agrif_create_restart_trc.f90	(revision 10397)
+++ /utils/tools/NESTING/src/agrif_create_restart_trc.f90	(revision 10398)
@@ -17,4 +17,5 @@
   USE agrif_interpolation
   USE agrif_partial_steps        
+  USE agrif_connect_topo
   !
   IMPLICIT NONE
@@ -40,37 +41,24 @@
   CHARACTER*3 :: prefix
   CHARACTER*20:: suffix 
-  CHARACTER*100 :: Child_file,Childcoordinates,varname,varname2,Childbathy,Childbathymeter   
-  REAL*8, POINTER, DIMENSION(:,:,:) :: fse3u, fse3v,fse3t => NULL()
-  REAL*8, POINTER, DIMENSION(:,:) :: lonChild,latChild => NULL()
-  REAL*8, POINTER, DIMENSION(:,:) :: lonParent,latParent => NULL()
-  REAL*8, POINTER, DIMENSION(:,:,:) :: cvol => NULL()
-  REAL*8, POINTER, DIMENSION(:,:,:) :: tabvar3d,tabinterp3d,mask => NULL()
+  CHARACTER*100 :: Child_file,Childcoordinates,varname,varname2,Child_Bathy_Level,Child_Bathy_Meter   
+  REAL*8, POINTER, DIMENSION(:,:,:) :: tabvar3d => NULL()
   REAL*8, POINTER, DIMENSION(:,:,:,:) :: trb,trn => NULL()
   REAL*8, POINTER, DIMENSION(:,:,:,:) :: tabinterp4d,tabvar1,tabvar2,tabvar3 => NULL()
-  REAL*8, POINTER, DIMENSION(:) :: timedepth_temp => NULL()
   REAL*8, POINTER, DIMENSION(:) :: tabtemp1D,nav_lev => NULL()
-  INTEGER, POINTER, DIMENSION(:) :: tabtemp1DInt => NULL()
-  REAL*8, POINTER, DIMENSION(:,:) :: tabtemp2D,zwf => NULL()
-  REAL*8, POINTER, DIMENSION(:,:) :: e1f,e2f,e1v,e2v,e1u,e2u,e1t,e2t => NULL()
-  REAL*8, POINTER, DIMENSION(:,:,:,:) :: tabtemp4D => NULL()
+  REAL*8, POINTER, DIMENSION(:,:) :: tabtemp2D => NULL()
   INTEGER,DIMENSION(:),POINTER :: src_add,dst_add  => NULL()
-  REAL*8,DIMENSION(:,:),POINTER :: matrix,bathy_G0 => NULL()
-  LOGICAL,DIMENSION(:,:,:),POINTER :: Tmask => NULL()
+  REAL*8,DIMENSION(:,:),POINTER :: matrix => NULL()
   LOGICAL,DIMENSION(:,:),POINTER :: masksrc => NULL()
   LOGICAL, DIMENSION(:,:,:), POINTER :: detected_pts
-  LOGICAL :: Interpolation,Extrapolation,Pacifique,op
-  REAL*8 :: za1,za0,zsur,zacr,zkth,zdepth,zdepwp,zmin,zmax,zdiff,ze3tp,ze3wp,ztrcor,zvolk
-  INTEGER :: narg,iargc,ncid,x,y,t,z,nbvert_lev,m
-  REAL*8 :: now_wght,before_wght, ztrmas,zcoef
-  INTEGER :: i,j,k,ji,jj,jk,status,varid,numdims
+  LOGICAL :: Interpolation,Extrapolation,Pacifique
+  INTEGER :: narg,iargc,ncid,x,y,z,nbvert_lev
+  REAL*8 :: now_wght,before_wght
+  INTEGER :: ii,ji,jj,jk,status,varid,numdims
   CHARACTER(len=20),DIMENSION(4) :: dimnames
   CHARACTER(len=80) :: namelistname
   TYPE(Coordinates) :: G0,G1
-  INTEGER :: jpi,jpj,jpk,jpni,jpnj,jpnij,jpiglo,jpjglo,nlcit,nlcjt,nldit
-  INTEGER :: nldjt,nleit,nlejt,nimppt,njmppt
   REAL*8 :: tabtemp0dreal
-  INTEGER :: tabtemp0dint
-  CHARACTER(len=20) :: timedimname
-
+
+  LOGICAL, PARAMETER :: conservation = .FALSE.
   !       
   narg = iargc()
@@ -90,6 +78,4 @@
   ENDIF
 
-  timedimname = 't'
-
   !
   WRITE(*,*) ''
@@ -100,6 +86,6 @@
   !       
   CALL set_child_name(parent_coordinate_file,Childcoordinates)   
-  CALL set_child_name(parent_bathy_level,Childbathy) 
-  CALL set_child_name(parent_bathy_meter,Childbathymeter)   
+  IF( TRIM(parent_bathy_level) /= '' )   CALL set_child_name(parent_bathy_level,Child_Bathy_Level) 
+  IF( TRIM(parent_bathy_meter) /= '' )   CALL set_child_name(parent_bathy_meter,Child_Bathy_Meter)   
   !
   ! create this file
@@ -115,5 +101,5 @@
   CALL Read_Ncdf_dim('x',restart_trc_file,x)
   CALL Read_Ncdf_dim('y',restart_trc_file,y) 
-  CALL Read_Ncdf_dim('z',restart_trc_file,z)
+  CALL Read_Ncdf_dim('nav_lev',restart_trc_file,z)
 
   IF( z .NE. N ) THEN
@@ -142,39 +128,40 @@
   ENDIF
   !
+  ! one needs bathy_level
+  IF( TRIM(parent_bathy_level) /= '' ) THEN
+     status = Read_bathy_level(TRIM(parent_bathy_level),G0)
+     status = Read_bathy_level(TRIM(child_bathy_level),G1)
+  ELSE
+     status = read_bathy_meter(TRIM(parent_bathy_meter),G0)
+     status = read_bathy_meter(TRIM(child_bathy_meter),G1)
+     CALL meter_to_levels(G0)
+     CALL meter_to_levels(G1)
+  ENDIF
+  ! get masks
   CALL Init_tmask(parent_bathy_level,G0,x,y)
-  CALL Init_tmask(childbathy,G1,nxfin,nyfin)
+  CALL Init_tmask(child_bathy_level,G1,nxfin,nyfin)
   
-  ALLOCATE(fse3u(nxfin,nyfin,z),fse3v(nxfin,nyfin,z),fse3t(nxfin,nyfin,z),cvol(nxfin,nyfin,z))
-    !      
-    status = Read_Bathy_Meter(TRIM(Childbathymeter),G1)
-    CALL get_scale_factors( G1,fse3t,fse3u,fse3v )
-                          
-  DO jk =1,z
-  cvol(:,:,jk) = G1%e1t(:,:)*G1%e2t(:,:)*fse3t(:,:,jk)*G1%tmask(:,:,jk)
-  END DO 
-!  CALL Init_mask(childbathy,G1,1,1)
-
-  G0%tmask = 1.    
-
-
+!!clem  G0%tmask = 1.    
+
+  ! which dataset
   status = nf90_open(TRIM(restart_trc_file), NF90_NOWRITE, ncid) ! Open dataset
-  DO k=1,z
+  DO jk = 1, z
      ALLOCATE(tabvar1(x,y,1,1))
      !
      status = nf90_inq_varid(ncid, "TRNDIC", VarId) !PISCES
      IF (status == nf90_noerr) THEN
-        CALL Read_Ncdf_var('TRNDIC',TRIM(restart_trc_file),tabvar1,1,k)
+        CALL Read_Ncdf_var('TRNDIC',TRIM(restart_trc_file),tabvar1,1,jk)
      ELSE
         status = nf90_inq_varid(ncid, "TRNNO3"  , VarId) ! LOBSTER
         IF (status == nf90_noerr) THEN
-           CALL Read_Ncdf_var('TRNNO3',TRIM(restart_trc_file),tabvar1,1,k)
+           CALL Read_Ncdf_var('TRNNO3',TRIM(restart_trc_file),tabvar1,1,jk)
         ELSE
            status = nf90_inq_varid(ncid, "TRNCFC11", VarId) ! CFC
            IF (status == nf90_noerr) THEN
-              CALL Read_Ncdf_var('TRNCFC11',TRIM(restart_trc_file),tabvar1,1,k)
+              CALL Read_Ncdf_var('TRNCFC11',TRIM(restart_trc_file),tabvar1,1,jk)
            ELSE
               status = nf90_inq_varid(ncid, "TRNCLR  ", VarId) ! My TRC
               IF (status == nf90_noerr) THEN
-                 CALL Read_Ncdf_var('TRNCLR',TRIM(restart_trc_file),tabvar1,1,k)
+                 CALL Read_Ncdf_var('TRNCLR',TRIM(restart_trc_file),tabvar1,1,jk)
               ELSE
                  WRITE(*,*) 'No suitable tracer found to build the mask '
@@ -184,5 +171,5 @@
      ENDIF
      WHERE( tabvar1(:,:,1,1) == 0. ) 
-        G0%tmask(:,:,k) = 0.
+        G0%tmask(:,:,jk) = 0.
      END WHERE
      DEALLOCATE(tabvar1)
@@ -191,44 +178,35 @@
   !
   ! write dimensions in output file
+  WRITE(*,*) 'write dimensions'
   !          
   CALL Write_Ncdf_dim('x',Child_file,nxfin)
   CALL Write_Ncdf_dim('y',Child_file,nyfin)
-  CALL Write_Ncdf_dim('z',Child_file,z)
-  CALL Write_Ncdf_dim(TRIM(timedimname),Child_file,0) 
-  !
-  !
-  VARIABLE :  DO i = 1,SIZE(Ncdf_varname)      
+  CALL Write_Ncdf_dim('nav_lev',Child_file,z)
+  CALL Write_Ncdf_dim('time_counter',Child_file,0) 
+  !
+  !
+  DO ii = 1,SIZE(Ncdf_varname)      
      !      
      ! loop on variables names
+     varname = TRIM(Ncdf_varname(ii))
+     WRITE(*,*) 'var = ',TRIM(varname)     
      !      
-     SELECT CASE (TRIM(Ncdf_varname(i)))
-        !
-        !copy nav_lon from child coordinates to output file      
+     SELECT CASE (TRIM(varname))
         !
      CASE('nav_lon')
-        WRITE(*,*) 'copy nav_lon'
         CALL Read_Ncdf_var('nav_lon',TRIM(Childcoordinates),tabtemp2D) 
         CALL Write_Ncdf_var('nav_lon',(/'x','y'/),Child_file,tabtemp2D,'float')
-        CALL Copy_Ncdf_att('nav_lon',TRIM(restart_trc_file),Child_file, &
-             MINVAL(tabtemp2D),MAXVAL(tabtemp2D))
+        CALL Copy_Ncdf_att('nav_lon',TRIM(restart_trc_file),Child_file,MINVAL(tabtemp2D),MAXVAL(tabtemp2D))
         DEALLOCATE(tabtemp2D)
         Interpolation = .FALSE.
         !	     
-        !copy nav_lat from child coordinates to output file
-        !
      CASE('nav_lat')             
-        WRITE(*,*) 'copy nav_lat'
         CALL Read_Ncdf_var('nav_lat',TRIM(Childcoordinates),tabtemp2D) 
         CALL Write_Ncdf_var('nav_lat',(/'x','y'/),Child_file,tabtemp2D,'float')
-        CALL Copy_Ncdf_att('nav_lat',TRIM(restart_trc_file),Child_file, &
-             MINVAL(tabtemp2D),MAXVAL(tabtemp2D)) 
+        CALL Copy_Ncdf_att('nav_lat',TRIM(restart_trc_file),Child_file,MINVAL(tabtemp2D),MAXVAL(tabtemp2D)) 
         DEALLOCATE(tabtemp2D)
         Interpolation = .FALSE.
         !
-        !copy nav_lev from restart_file to output file
-        !
      CASE('nav_lev')
-
-        WRITE(*,*) 'copy nav_lev'
         CALL Read_Ncdf_var('nav_lev',TRIM(restart_trc_file),nav_lev) 
         CALL Write_Ncdf_var('nav_lev','z',Child_file,nav_lev,'float')
@@ -236,45 +214,43 @@
         Interpolation = .FALSE.
         !
-        !copy time from restart_file to output file                       
-        !
      CASE('time_counter')
-        WRITE(*,*) 'copy time_counter'
         CALL Read_Ncdf_var('time_counter',TRIM(restart_trc_file),tabtemp1D) 
         tabtemp1D = tabtemp1D * rhot
-        CALL Write_Ncdf_var('time_counter',TRIM(timedimname),Child_file,tabtemp1D,'double')
+        CALL Write_Ncdf_var('time_counter','time_counter',Child_file,tabtemp1D,'double')
         CALL Copy_Ncdf_att('time_counter',TRIM(restart_trc_file),Child_file) 
         DEALLOCATE(tabtemp1D)
         Interpolation = .FALSE.
         !
-        !copy info from restart_file to output file
-        !
-     CASE('arak0') 
-        WRITE(*,*) 'copy trp info'        
-        CALL Read_Ncdf_var('arak0',TRIM(restart_trc_file),tabtemp0dreal) 
-        CALL Write_Ncdf_var('arak0',Child_file,tabtemp0dreal,'double')
-        CALL Copy_Ncdf_att('arak0',TRIM(restart_trc_file),Child_file) 
-        Interpolation = .FALSE. 
-        !
-     CASE('kt') 
-        WRITE(*,*) 'copy kt'
-        CALL Read_Ncdf_var('kt',TRIM(restart_trc_file),tabtemp0dreal)  
-        tabtemp0dreal = tabtemp0dreal * rhot
-        CALL Write_Ncdf_var('kt',Child_file,tabtemp0dreal,'double')
-        CALL Copy_Ncdf_att('kt',TRIM(restart_trc_file),Child_file) 
+     CASE('kt','ndastp','adatrj','ntime','rdttrc1') 
+        CALL Read_Ncdf_var(TRIM(varname),TRIM(restart_trc_file),tabtemp0dreal)  
+        SELECT CASE (TRIM(varname))
+        CASE('rdttrc1')
+           tabtemp0dreal = tabtemp0dreal / rhot
+        CASE('kt')
+           tabtemp0dreal = tabtemp0dreal * rhot
+        END SELECT
+        CALL Write_Ncdf_var(TRIM(varname),Child_file,tabtemp0dreal,'double')
+        CALL Copy_Ncdf_att(varname,TRIM(restart_trc_file),Child_file) 
         Interpolation = .FALSE.
         !
      CASE DEFAULT
-        varname = Ncdf_varname(i) 
-        WRITE(*,*) TRIM(varname),' interpolation ...'     
-        vert_coord_name = 'z'
+        IF( Get_NbDims(TRIM(varname),TRIM(restart_trc_file)) == 4 ) THEN
+           vert_coord_name = 'nav_lev'
+        ELSEIF( Get_NbDims(TRIM(varname),TRIM(restart_trc_file)) == 3 ) THEN
+           vert_coord_name = '1'
+        ENDIF
         posvar='T'
         Interpolation = .TRUE.            
         !      
      END SELECT
+     !      
+     ! --- start interpolation --- !
      IF( Interpolation ) THEN
         !		  
-        nbvert_lev = z 
-        !                  
-        t = 1
+        IF( vert_coord_name == '1' ) THEN
+           nbvert_lev = 1
+        ELSE
+           nbvert_lev = z
+        ENDIF
 
         ALLOCATE(detected_pts(SIZE(G0%tmask,1),SIZE(G0%tmask,2),nbvert_lev))                             
@@ -288,8 +264,7 @@
         DO n = 1,nbvert_lev
            !
-           WRITE(*,*) 'interpolate/extrapolate ', &
-                TRIM(varname),' for vertical level = ',n   
-           !
-           CALL Read_Ncdf_var(varname,TRIM(restart_trc_file),tabvar1,t,n)
+           WRITE(*,*) 'interpolate/extrapolate for vertical level = ',n   
+           !
+           CALL Read_Ncdf_var(varname,TRIM(restart_trc_file),tabvar1,1,n)
            IF(n==1) THEN
               !                            
@@ -308,7 +283,11 @@
               CALL extrap_detect(G0,G1,detected_pts(:,:,n),n)                                            
 
-              CALL correct_field(detected_pts(:,:,n),tabvar1,tabvar2,&
-                   tabvar3,G0,nav_lev,masksrc,n)                                 
-
+              CALL correct_field(detected_pts(:,:,n),tabvar1,tabvar2,tabvar3,G0,nav_lev,masksrc,n)                                 
+              
+              ! for the following variables, you do not want to mask the values
+              IF(  TRIM(varname) == 'Silicalim' .OR. TRIM(varname) == 'Silicamax' ) THEN
+                 masksrc(:,:) = .TRUE.
+              ENDIF
+              
               SELECT CASE(TRIM(interp_type))
               CASE('bilinear')                                                       
@@ -324,53 +303,39 @@
               END SELECT
               !                      
-              CALL Correctforconservation(tabvar1(:,:,1,1),tabinterp4d(:,:,1,1), &
-                   G0%e1t,G0%e2t,G1%e1t,G1%e2t,nxfin,nyfin,posvar,imin-jpizoom+1,jmin-jpjzoom+1)
-           ENDIF
-
-           tabinterp4d(:,:,1,1) =  tabinterp4d(:,:,1,1) * G1%tmask(:,:,n)
-           ztrmas = 0.0
-           ztrcor = 0.0
-           DO jj=1, nyfin
-           DO ji=1, nxfin
-              zvolk = cvol(ji,jj,n)
-              ztrcor = ztrcor + MIN( 0., tabinterp4d(ji,jj,1,1) ) * zvolk
-              tabinterp4d(ji,jj,1,1) = MAX( 0., tabinterp4d(ji,jj,1,1)) 
-              ztrmas  = ztrmas + tabinterp4d(ji,jj,1,1)  * zvolk
-           END DO
-           END DO
-           IF( ztrcor .LT. 0. ) THEN
-               WRITE(*,*) 'Correcting negative concentration'    
-               zcoef = 1. + ztrcor / ztrmas
-               tabinterp4d(:,:,1,1) =  tabinterp4d(:,:,1,1) *zcoef * G1%tmask(:,:,n)               
-           ENDIF        
-           IF(MINVAL(tabinterp4d(:,:,1,1)) .LT.0. ) STOP
-
-           !
-
-           status = nf90_inq_varid(ncid,TRIM(varname) , VarId)
-           status = nf90_inquire_variable(ncid, VarId, ndims=numdims)
-           IF( numdims == 3) THEN
-              dimnames(1)='x'
-              dimnames(2)='y'
-              dimnames(3)=TRIM(timedimname)
+              IF( conservation ) THEN ! clem: it currently does not work
+                 CALL Correctforconservation(tabvar1(:,:,1,1),tabinterp4d(:,:,1,1), &
+                    G0%e1t,G0%e2t,G1%e1t,G1%e2t,nxfin,nyfin,posvar,imin-jpizoom+1,jmin-jpjzoom+1)
+              ENDIF
+           ENDIF
+
+           IF( ALL(masksrc) ) THEN
+              tabinterp4d(:,:,1,1) =  tabinterp4d(:,:,1,1)
+           ELSE
+              tabinterp4d(:,:,1,1) =  tabinterp4d(:,:,1,1) * G1%tmask(:,:,n)
+           ENDIF
+
+           !
+           dimnames(1)='x'
+           dimnames(2)='y'
+           IF( vert_coord_name == '1' ) THEN
+              dimnames(3)='time_counter'
+              
               ALLOCATE(tabvar3d(SIZE(tabinterp4d,1),SIZE(tabinterp4d,2),SIZE(tabinterp4d,3)))
               tabvar3d=tabinterp4d(:,:,:,1)
-              CALL Write_Ncdf_var(TRIM(varname),dimnames, &
-                   Child_file,tabvar3d,t,'double')
+              CALL Write_Ncdf_var(TRIM(varname),dimnames,Child_file,tabvar3d,1,'double')
               DEALLOCATE(tabvar3d)
-           ELSE       
-              dimnames(1)='x'
-              dimnames(2)='y'
+           ELSE
               dimnames(3)=vert_coord_name
-              dimnames(4)=TRIM(timedimname)
-              CALL Write_Ncdf_var(TRIM(varname),dimnames, &
-                   Child_file,tabinterp4d,t,n,'double')
-           ENDIF
+              dimnames(4)='time_counter'
+              
+              CALL Write_Ncdf_var(TRIM(varname),dimnames,Child_file,tabinterp4d,1,n,'double')
+           ENDIF
+           !             
            !
            CALL Copy_Ncdf_att(TRIM(varname),TRIM(restart_trc_file),Child_file)
            !
+           !
            IF(ASSOCIATED(matrix)) DEALLOCATE(matrix,src_add,dst_add)   
            !
-           IF( numdims == 3) CYCLE VARIABLE
            !
         END DO
@@ -383,4 +348,5 @@
      ENDIF
 
+     ! change the before fields
      prefix = varname(1:3)
      suffix = varname(4:LEN_TRIM(varname))   
@@ -388,8 +354,6 @@
      IF(rhot == 1 .OR. prefix/= 'TRB') THEN
         WRITE(*,*) ''	 
-        WRITE(*,*) 'no time interpolation for', varname
+        WRITE(*,*) 'no time interpolation for ',TRIM(varname)
      ELSE   
-        WRITE(*,*) ''
-        WRITE(*,*) 'time interpolation for', varname
         ALLOCATE(trn(nxfin,nyfin,z,1),trb(nxfin,nyfin,z,1))
         varname2 = 'TRN'//TRIM(suffix)
@@ -403,12 +367,16 @@
         dimnames(1)='x'
         dimnames(2)='y'
-        dimnames(3)='z'
-        dimnames(4)=TRIM(timedimname)
+        dimnames(3)='nav_lev'
+        dimnames(4)='time_counter'
         CALL Write_Ncdf_var(TRIM(varname),dimnames,Child_file,trb,'double')
+        DEALLOCATE(trn,trb)
         !    
      ENDIF
 
-  END DO VARIABLE
-  !
+  END DO
+  !
+  WRITE(*,*) ' '
+  WRITE(*,*) ' --- list of all the variables that have been interpolated --- '
+  WRITE(*,*) Ncdf_varname
   WRITE(*,*) ' '
   WRITE(*,*) '******* restart file successfully created *******' 
