Index: NEMO/branches/2020/dev_r13333_KERNEL-08_techene_gm_HPG_SPG/src/OCE/DOM/istate.F90
===================================================================
--- NEMO/branches/2020/dev_r13333_KERNEL-08_techene_gm_HPG_SPG/src/OCE/DOM/istate.F90	(revision 13360)
+++ NEMO/branches/2020/dev_r13333_KERNEL-08_techene_gm_HPG_SPG/src/OCE/DOM/istate.F90	(revision 14062)
@@ -42,5 +42,5 @@
    PRIVATE
 
-   PUBLIC   istate_init   ! routine called by step.F90
+   PUBLIC   istate_init   ! routine called by nemogcm.F90
 
    !! * Substitutions
@@ -59,9 +59,11 @@
       !! 
       !! ** Purpose :   Initialization of the dynamics and tracer fields.
+      !!
+      !! ** Method  :   
       !!----------------------------------------------------------------------
       INTEGER, INTENT( in )  ::  Kbb, Kmm, Kaa   ! ocean time level indices
       !
       INTEGER ::   ji, jj, jk   ! dummy loop indices
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zgdept     ! 3D table  !!st patch to use gdept subtitute
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zgdept     ! 3D table for qco substitute
 !!gm see comment further down
       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::   zuvd    ! U & V data workspace
@@ -73,15 +75,12 @@
       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
 
-!!gm  Why not include in the first call of dta_tsd ?  
-!!gm  probably associated with the use of internal damping...
        CALL dta_tsd_init        ! Initialisation of T & S input data
-!!gm to be moved in usrdef of C1D case
+
 !      IF( lk_c1d )   CALL dta_uvd_init        ! Initialization of U & V input data
-!!gm
 
-      rhd  (:,:,:  ) = 0._wp   ;   rhop (:,:,:  ) = 0._wp      ! set one for all to 0 at level jpk
-      rn2b (:,:,:  ) = 0._wp   ;   rn2  (:,:,:  ) = 0._wp      ! set one for all to 0 at levels 1 and jpk
-      ts  (:,:,:,:,Kaa) = 0._wp                                   ! set one for all to 0 at level jpk
-      rab_b(:,:,:,:) = 0._wp   ;   rab_n(:,:,:,:) = 0._wp      ! set one for all to 0 at level jpk
+      rhd  (:,:,:      ) = 0._wp   ;   rhop (:,:,:  ) = 0._wp      ! set one for all to 0 at level jpk
+      rn2b (:,:,:      ) = 0._wp   ;   rn2  (:,:,:  ) = 0._wp      ! set one for all to 0 at levels 1 and jpk
+      ts   (:,:,:,:,Kaa) = 0._wp                                   ! set one for all to 0 at level jpk
+      rab_b(:,:,:,:    ) = 0._wp   ;   rab_n(:,:,:,:) = 0._wp      ! set one for all to 0 at level jpk
 #if defined key_agrif
       uu   (:,:,:  ,Kaa) = 0._wp   ! used in agrif_oce_sponge at initialization
@@ -96,8 +95,11 @@
          CALL agrif_istate( Kbb, Kmm, Kaa )   ! Interp from parent
          !
-         ts  (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb) 
-         ssh (:,:,Kmm)     = ssh(:,:,Kbb)
-         uu   (:,:,:,Kmm)   = uu  (:,:,:,Kbb)
-         vv   (:,:,:,Kmm)   = vv  (:,:,:,Kbb)
+         ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)
+!!st
+!!st need for a recent agrif version to be displaced toward ssh_init_rst with agrif_istate_ssh
+         ssh(:,:,    Kmm) = ssh(:,:    ,Kbb)
+!!st end
+         uu (:,:,:  ,Kmm) = uu (:,:,:  ,Kbb)
+         vv (:,:,:  ,Kmm) = vv (:,:,:  ,Kbb)
       ELSE
 #endif
@@ -117,55 +119,27 @@
             CALL dta_tsd( nit000, ts(:,:,:,:,Kbb) )       ! read 3D T and S data at nit000
             !
-            ssh(:,:,Kbb)   = 0._wp               ! set the ocean at rest
-            uu  (:,:,:,Kbb) = 0._wp
-            vv  (:,:,:,Kbb) = 0._wp  
+            uu (:,:,:,Kbb) = 0._wp
+            vv (:,:,:,Kbb) = 0._wp  
             !
-            IF( ll_wd ) THEN
-               ssh(:,:,Kbb) =  -ssh_ref  ! Added in 30 here for bathy that adds 30 as Iterative test CEOD 
-               !
-               ! Apply minimum wetdepth criterion
-               !
-               DO_2D( 1, 1, 1, 1 )
-                  IF( ht_0(ji,jj) + ssh(ji,jj,Kbb)  < rn_wdmin1 ) THEN
-                     ssh(ji,jj,Kbb) = tmask(ji,jj,1)*( rn_wdmin1 - (ht_0(ji,jj)) )
-                  ENDIF
-               END_2D
-            ENDIF 
-             !
          ELSE                                 ! user defined initial T and S
             DO jk = 1, jpk
                zgdept(:,:,jk) = gdept(:,:,jk,Kbb)
             END DO
-            CALL usr_def_istate( zgdept, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )         
+            CALL usr_def_istate( zgdept, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb) )
          ENDIF
-         ts  (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones
-         ssh (:,:,Kmm)     = ssh(:,:,Kbb)   
-         uu   (:,:,:,Kmm)   = uu  (:,:,:,Kbb)
-         vv   (:,:,:,Kmm)   = vv  (:,:,:,Kbb)
-
-!!gm POTENTIAL BUG :
-!!gm  ISSUE :  if ssh(:,:,Kbb) /= 0  then, in non linear free surface, the e3._n, e3._b should be recomputed
-!!             as well as gdept_ and gdepw_....   !!!!! 
-!!      ===>>>>   probably a call to domvvl initialisation here....
-
+         ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones
+         uu (:,:,:  ,Kmm) = uu (:,:,:  ,Kbb)
+         vv (:,:,:  ,Kmm) = vv (:,:,:  ,Kbb)
 
          !
-!!gm to be moved in usrdef of C1D case
-!         IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000
-!            ALLOCATE( zuvd(jpi,jpj,jpk,2) )
-!            CALL dta_uvd( nit000, zuvd )
-!            uu(:,:,:,Kbb) = zuvd(:,:,:,1) ;  uu(:,:,:,Kmm) = uu(:,:,:,Kbb)
-!            vv(:,:,:,Kbb) = zuvd(:,:,:,2) ;  vv(:,:,:,Kmm) = vv(:,:,:,Kbb)
-!            DEALLOCATE( zuvd )
-!         ENDIF
+!!gm ==>>>  to be moved in usrdef_istate of C1D case 
+         IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000
+            ALLOCATE( zuvd(jpi,jpj,jpk,2) )
+            CALL dta_uvd( nit000, Kbb, zuvd )
+            uu(:,:,:,Kbb) = zuvd(:,:,:,1)  ;  uu(:,:,:,Kmm) = uu(:,:,:,Kbb)
+            vv(:,:,:,Kbb) = zuvd(:,:,:,2)  ;  vv(:,:,:,Kmm) = vv(:,:,:,Kbb)
+            DEALLOCATE( zuvd )
+         ENDIF
          !
-!!gm This is to be changed !!!!
-!         ! - ML - ssh(:,:,Kmm) could be modified by istate_eel, so that initialization of e3t(:,:,:,Kbb) is done here
-!         IF( .NOT.ln_linssh ) THEN
-!            DO jk = 1, jpk
-!               e3t(:,:,jk,Kbb) = e3t(:,:,jk,Kmm)
-!            END DO
-!         ENDIF
-!!gm 
          ! 
       ENDIF 
