Index: NEMO/branches/2020/r12377_ticket2386/src/OCE/ASM/asminc.F90
===================================================================
--- NEMO/branches/2020/r12377_ticket2386/src/OCE/ASM/asminc.F90	(revision 12511)
+++ NEMO/branches/2020/r12377_ticket2386/src/OCE/ASM/asminc.F90	(revision 13540)
@@ -95,4 +95,5 @@
    !! * Substitutions
 #  include "do_loop_substitute.h90"
+#  include "domzgr_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OCE 4.0 , NEMO Consortium (2018)
@@ -359,6 +360,6 @@
 
          IF ( ln_trainc ) THEN   
-            CALL iom_get( inum, jpdom_autoglo, 'bckint', t_bkginc, 1 )
-            CALL iom_get( inum, jpdom_autoglo, 'bckins', s_bkginc, 1 )
+            CALL iom_get( inum, jpdom_auto, 'bckint', t_bkginc, 1 )
+            CALL iom_get( inum, jpdom_auto, 'bckins', s_bkginc, 1 )
             ! Apply the masks
             t_bkginc(:,:,:) = t_bkginc(:,:,:) * tmask(:,:,:)
@@ -371,6 +372,6 @@
 
          IF ( ln_dyninc ) THEN   
-            CALL iom_get( inum, jpdom_autoglo, 'bckinu', u_bkginc, 1 )              
-            CALL iom_get( inum, jpdom_autoglo, 'bckinv', v_bkginc, 1 )              
+            CALL iom_get( inum, jpdom_auto, 'bckinu', u_bkginc, 1 )              
+            CALL iom_get( inum, jpdom_auto, 'bckinv', v_bkginc, 1 )              
             ! Apply the masks
             u_bkginc(:,:,:) = u_bkginc(:,:,:) * umask(:,:,:)
@@ -383,5 +384,5 @@
         
          IF ( ln_sshinc ) THEN
-            CALL iom_get( inum, jpdom_autoglo, 'bckineta', ssh_bkginc, 1 )
+            CALL iom_get( inum, jpdom_auto, 'bckineta', ssh_bkginc, 1 )
             ! Apply the masks
             ssh_bkginc(:,:) = ssh_bkginc(:,:) * tmask(:,:,1)
@@ -392,5 +393,5 @@
 
          IF ( ln_seaiceinc ) THEN
-            CALL iom_get( inum, jpdom_autoglo, 'bckinseaice', seaice_bkginc, 1 )
+            CALL iom_get( inum, jpdom_auto, 'bckinseaice', seaice_bkginc, 1 )
             ! Apply the masks
             seaice_bkginc(:,:) = seaice_bkginc(:,:) * tmask(:,:,1)
@@ -413,13 +414,14 @@
             DO jk = 1, jpkm1           ! zhdiv = e1e1 * div
                zhdiv(:,:) = 0._wp
-               DO_2D_00_00
+               DO_2D( 0, 0, 0, 0 )
                   zhdiv(ji,jj) = (  e2u(ji  ,jj) * e3u(ji  ,jj,jk,Kmm) * u_bkginc(ji  ,jj,jk)    &
                      &            - e2u(ji-1,jj) * e3u(ji-1,jj,jk,Kmm) * u_bkginc(ji-1,jj,jk)    &
                      &            + e1v(ji,jj  ) * e3v(ji,jj  ,jk,Kmm) * v_bkginc(ji,jj  ,jk)    &
-                     &            - e1v(ji,jj-1) * e3v(ji,jj-1,jk,Kmm) * v_bkginc(ji,jj-1,jk)  ) / e3t(ji,jj,jk,Kmm)
+                     &            - e1v(ji,jj-1) * e3v(ji,jj-1,jk,Kmm) * v_bkginc(ji,jj-1,jk)  ) &
+                     &            / e3t(ji,jj,jk,Kmm)
                END_2D
-               CALL lbc_lnk( 'asminc', zhdiv, 'T', 1. )   ! lateral boundary cond. (no sign change)
+               CALL lbc_lnk( 'asminc', zhdiv, 'T', 1.0_wp )   ! lateral boundary cond. (no sign change)
                !
-               DO_2D_00_00
+               DO_2D( 0, 0, 0, 0 )
                   u_bkginc(ji,jj,jk) = u_bkginc(ji,jj,jk)                         &
                      &               + 0.2_wp * ( zhdiv(ji+1,jj) - zhdiv(ji  ,jj) ) * r1_e1u(ji,jj) * umask(ji,jj,jk)
@@ -465,6 +467,6 @@
          !
          IF ( ln_trainc ) THEN   
-            CALL iom_get( inum, jpdom_autoglo, 'tn', t_bkg )
-            CALL iom_get( inum, jpdom_autoglo, 'sn', s_bkg )
+            CALL iom_get( inum, jpdom_auto, 'tn', t_bkg )
+            CALL iom_get( inum, jpdom_auto, 'sn', s_bkg )
             t_bkg(:,:,:) = t_bkg(:,:,:) * tmask(:,:,:)
             s_bkg(:,:,:) = s_bkg(:,:,:) * tmask(:,:,:)
@@ -472,6 +474,6 @@
          !
          IF ( ln_dyninc ) THEN   
-            CALL iom_get( inum, jpdom_autoglo, 'un', u_bkg )
-            CALL iom_get( inum, jpdom_autoglo, 'vn', v_bkg )
+            CALL iom_get( inum, jpdom_auto, 'un', u_bkg, cd_type = 'U', psgn = 1._wp )
+            CALL iom_get( inum, jpdom_auto, 'vn', v_bkg, cd_type = 'V', psgn = 1._wp )
             u_bkg(:,:,:) = u_bkg(:,:,:) * umask(:,:,:)
             v_bkg(:,:,:) = v_bkg(:,:,:) * vmask(:,:,:)
@@ -479,5 +481,5 @@
          !
          IF ( ln_sshinc ) THEN
-            CALL iom_get( inum, jpdom_autoglo, 'sshn', ssh_bkg )
+            CALL iom_get( inum, jpdom_auto, 'sshn', ssh_bkg )
             ssh_bkg(:,:) = ssh_bkg(:,:) * tmask(:,:,1)
          ENDIF
@@ -758,5 +760,7 @@
             !
             ssh(:,:,Kbb) = ssh(:,:,Kmm)                        ! Update before fields
+#if ! defined key_qco
             e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm)
+#endif
 !!gm why not e3u(:,:,:,Kbb), e3v(:,:,:,Kbb), gdept(:,:,:,Kbb) ????
             !
@@ -896,5 +900,5 @@
          IF ( kt == nitdin_r ) THEN
             !
-            l_1st_euler = 0              ! Force Euler forward step
+            l_1st_euler = .TRUE.              ! Force Euler forward step
             !
             ! Sea-ice : SI3 case
@@ -970,6 +974,6 @@
 !           ! set to bottom of a level 
 !                 DO jk = jpk-1, 2, -1
-!                   IF ((mld > gdepw(ji,jj,jk)) .and. (mld < gdepw(ji,jj,jk+1))) THEN 
-!                     mld=gdepw(ji,jj,jk+1)
+!                   IF ((mld > gdepw(ji,jj,jk,Kmm)) .and. (mld < gdepw(ji,jj,jk+1,Kmm))) THEN
+!                     mld=gdepw(ji,jj,jk+1,Kmm)
 !                     jkmax=jk
 !                   ENDIF
