Index: NEMO/branches/2020/dev_r13333_KERNEL-08_techene_gm_HPG_SPG/src/OCE/DYN/dynspg.F90
===================================================================
--- NEMO/branches/2020/dev_r13333_KERNEL-08_techene_gm_HPG_SPG/src/OCE/DYN/dynspg.F90	(revision 13360)
+++ NEMO/branches/2020/dev_r13333_KERNEL-08_techene_gm_HPG_SPG/src/OCE/DYN/dynspg.F90	(revision 13361)
@@ -79,6 +79,7 @@
       INTEGER  ::   ji, jj, jk                   ! dummy loop indices
       REAL(wp) ::   z2dt, zg_2, zintp, zgrho0r, zld   ! local scalars
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   zpice
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdu, ztrdv
+      REAL(wp)             , DIMENSION(jpi,jpj) ::   zpgu, zpgv   ! 2D workspace
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:)     ::   zpice
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::   ztrdu, ztrdv
       !!----------------------------------------------------------------------
       !
@@ -96,6 +97,6 @@
          !
          DO_2D( 0, 0, 0, 0 )
-            spgu(ji,jj) = 0._wp
-            spgv(ji,jj) = 0._wp
+            zpgu(ji,jj) = 0._wp
+            zpgv(ji,jj) = 0._wp
          END_2D
          !
@@ -103,7 +104,7 @@
             zg_2 = grav * 0.5
             DO_2D( 0, 0, 0, 0 )
-               spgu(ji,jj) = spgu(ji,jj) + zg_2 * (  ssh_ib (ji+1,jj) - ssh_ib (ji,jj)    &
+               zpgu(ji,jj) = zpgu(ji,jj) + zg_2 * (  ssh_ib (ji+1,jj) - ssh_ib (ji,jj)    &
                   &                                + ssh_ibb(ji+1,jj) - ssh_ibb(ji,jj)  ) * r1_e1u(ji,jj)
-               spgv(ji,jj) = spgv(ji,jj) + zg_2 * (  ssh_ib (ji,jj+1) - ssh_ib (ji,jj)    &
+               zpgv(ji,jj) = zpgv(ji,jj) + zg_2 * (  ssh_ib (ji,jj+1) - ssh_ib (ji,jj)    &
                   &                                + ssh_ibb(ji,jj+1) - ssh_ibb(ji,jj)  ) * r1_e2v(ji,jj)
             END_2D
@@ -118,6 +119,6 @@
             !
             DO_2D( 0, 0, 0, 0 )
-               spgu(ji,jj) = spgu(ji,jj) + grav * ( pot_astro(ji+1,jj) - pot_astro(ji,jj) ) * r1_e1u(ji,jj)
-               spgv(ji,jj) = spgv(ji,jj) + grav * ( pot_astro(ji,jj+1) - pot_astro(ji,jj) ) * r1_e2v(ji,jj)
+               zpgu(ji,jj) = zpgu(ji,jj) + grav * ( pot_astro(ji+1,jj) - pot_astro(ji,jj) ) * r1_e1u(ji,jj)
+               zpgv(ji,jj) = zpgv(ji,jj) + grav * ( pot_astro(ji,jj+1) - pot_astro(ji,jj) ) * r1_e2v(ji,jj)
             END_2D
             !
@@ -125,6 +126,6 @@
                zld = rn_scal_load * grav
                DO_2D( 0, 0, 0, 0 )
-                  spgu(ji,jj) = spgu(ji,jj) + zld * ( pssh(ji+1,jj,Kmm) - pssh(ji,jj,Kmm) ) * r1_e1u(ji,jj)
-                  spgv(ji,jj) = spgv(ji,jj) + zld * ( pssh(ji,jj+1,Kmm) - pssh(ji,jj,Kmm) ) * r1_e2v(ji,jj)
+                  zpgu(ji,jj) = zpgu(ji,jj) + zld * ( pssh(ji+1,jj,Kmm) - pssh(ji,jj,Kmm) ) * r1_e1u(ji,jj)
+                  zpgv(ji,jj) = zpgv(ji,jj) + zld * ( pssh(ji,jj+1,Kmm) - pssh(ji,jj,Kmm) ) * r1_e2v(ji,jj)
                END_2D
             ENDIF
@@ -137,6 +138,6 @@
             zpice(:,:) = (  zintp * snwice_mass(:,:) + ( 1.- zintp ) * snwice_mass_b(:,:)  ) * zgrho0r
             DO_2D( 0, 0, 0, 0 )
-               spgu(ji,jj) = spgu(ji,jj) + ( zpice(ji+1,jj) - zpice(ji,jj) ) * r1_e1u(ji,jj)
-               spgv(ji,jj) = spgv(ji,jj) + ( zpice(ji,jj+1) - zpice(ji,jj) ) * r1_e2v(ji,jj)
+               zpgu(ji,jj) = zpgu(ji,jj) + ( zpice(ji+1,jj) - zpice(ji,jj) ) * r1_e1u(ji,jj)
+               zpgv(ji,jj) = zpgv(ji,jj) + ( zpice(ji,jj+1) - zpice(ji,jj) ) * r1_e2v(ji,jj)
             END_2D
             DEALLOCATE( zpice )         
@@ -144,6 +145,6 @@
          !
          DO_3D( 0, 0, 0, 0, 1, jpkm1 )
-            puu(ji,jj,jk,Krhs) = puu(ji,jj,jk,Krhs) + spgu(ji,jj)
-            pvv(ji,jj,jk,Krhs) = pvv(ji,jj,jk,Krhs) + spgv(ji,jj)
+            puu(ji,jj,jk,Krhs) = puu(ji,jj,jk,Krhs) + zpgu(ji,jj)
+            pvv(ji,jj,jk,Krhs) = pvv(ji,jj,jk,Krhs) + zpgv(ji,jj)
          END_3D
          !
Index: NEMO/branches/2020/dev_r13333_KERNEL-08_techene_gm_HPG_SPG/src/OCE/oce.F90
===================================================================
--- NEMO/branches/2020/dev_r13333_KERNEL-08_techene_gm_HPG_SPG/src/OCE/oce.F90	(revision 13360)
+++ NEMO/branches/2020/dev_r13333_KERNEL-08_techene_gm_HPG_SPG/src/OCE/oce.F90	(revision 13361)
@@ -49,6 +49,4 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ub2_i_b, vb2_i_b         !: Half step time integrated fluxes 
 #endif
-   !
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   spgu, spgv               !: horizontal surface pressure gradient
 
    !! interpolated gradient (only used in zps case)
@@ -83,18 +81,17 @@
       !
       ierr(:) = 0 
-      ALLOCATE( uu   (jpi,jpj,jpk,jpt)  , vv   (jpi,jpj,jpk,jpt) ,                              &          
-         &      ww   (jpi,jpj,jpk)      , hdiv(jpi,jpj,jpk)      ,                              &
-         &      ts   (jpi,jpj,jpk,jpts,jpt),                                                    &
-         &      rab_b(jpi,jpj,jpk,jpts) , rab_n(jpi,jpj,jpk,jpts) ,                             &
-         &      rn2b (jpi,jpj,jpk)      , rn2  (jpi,jpj,jpk)      ,                             &
-         &      rhd  (jpi,jpj,jpk)      , rhop (jpi,jpj,jpk)                              , STAT=ierr(1) )
+      ALLOCATE( uu   (jpi,jpj,jpk,jpt)  , vv   (jpi,jpj,jpk,jpt)           ,     &          
+         &      ww   (jpi,jpj,jpk)      , hdiv(jpi,jpj,jpk)                ,     &
+         &      ts   (jpi,jpj,jpk,jpts,jpt)                                ,     &
+         &      rab_b(jpi,jpj,jpk,jpts) , rab_n(jpi,jpj,jpk,jpts)          ,     &
+         &      rn2b (jpi,jpj,jpk)      , rn2  (jpi,jpj,jpk)               ,     &
+         &      rhd  (jpi,jpj,jpk)      , rhop (jpi,jpj,jpk)               , STAT=ierr(1) )
          !
-      ALLOCATE( ssh(jpi,jpj,jpt)  , uu_b(jpi,jpj,jpt) , vv_b(jpi,jpj,jpt) , &
-         &      spgu  (jpi,jpj)   , spgv(jpi,jpj)                     ,     &
-         &      gtsu(jpi,jpj,jpts), gtsv(jpi,jpj,jpts)                ,     &
-         &      gru(jpi,jpj)      , grv(jpi,jpj)                      ,     &
-         &      gtui(jpi,jpj,jpts), gtvi(jpi,jpj,jpts)                ,     &
-         &      grui(jpi,jpj)     , grvi(jpi,jpj)                     ,     &
-         &      riceload(jpi,jpj)                                     , STAT=ierr(2) )
+      ALLOCATE( ssh (jpi,jpj,jpt)  , uu_b(jpi,jpj,jpt) , vv_b(jpi,jpj,jpt) ,     &
+         &      gtsu(jpi,jpj,jpts) , gtsv(jpi,jpj,jpts)                    ,     &
+         &      gru (jpi,jpj)      , grv (jpi,jpj)                         ,     &
+         &      gtui(jpi,jpj,jpts) , gtvi(jpi,jpj,jpts)                    ,     &
+         &      grui(jpi,jpj)      , grvi(jpi,jpj)                         ,     &
+         &      riceload(jpi,jpj)                                          , STAT=ierr(2) )
          !
       ALLOCATE( fraqsr_1lev(jpi,jpj) , STAT=ierr(3) )
