Index: NEMO/branches/UKMO/NEMO_4.0_mirror_SI3_GPU/src/ICE/icedyn_adv_umx.F90
===================================================================
--- NEMO/branches/UKMO/NEMO_4.0_mirror_SI3_GPU/src/ICE/icedyn_adv_umx.F90	(revision 13048)
+++ NEMO/branches/UKMO/NEMO_4.0_mirror_SI3_GPU/src/ICE/icedyn_adv_umx.F90	(revision 13149)
@@ -48,5 +48,16 @@
    REAL(wp)           ::   z1_120 = 1._wp / 120._wp   ! =1/120
    !
-   INTEGER, ALLOCATABLE, DIMENSION(:,:,:) ::   imsk_small, jmsk_small
+   INTEGER,  ALLOCATABLE, DIMENSION(:,:,:)   ::   imsk_small, jmsk_small
+   REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   zfu_ho , zfv_ho , zpt
+   REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   zfu_ups, zfv_ups, zt_ups
+   REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   ztu1, ztu2, ztu3, ztu4
+   REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   ztv1, ztv2, ztv3, ztv4 
+   REAL(wp), ALLOCATABLE, DIMENSION(:, :)    ::   zswitch
+   REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   zslpy       ! tracer slopes
+   REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   zslpx       ! tracer slopes
+   REAL(wp), ALLOCATABLE, DIMENSION(:, :   ) ::   zbup, zbdo
+   REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   zbetup, zbetdo, zti_ups, ztj_ups
+   REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   zt_u, zt_v
+
    !
    !! * Substitutions
@@ -93,15 +104,39 @@
       REAL(wp) ::   zdt, zvi_cen
       REAL(wp), DIMENSION(1)           ::   zcflprv, zcflnow   ! for global communication
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zudy, zvdx, zcu_box, zcv_box
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zati1, zati2
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zu_cat, zv_cat
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zua_ho, zva_ho, zua_ups, zva_ups
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   z1_ai , z1_aip, zhvar
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zhi_max, zhs_max, zhip_max
-      !
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zuv_ho, zvv_ho, zuv_ups, zvv_ups, z1_vi, z1_vs 
-      !!----------------------------------------------------------------------
-      !
-      IF( kt == nit000 .AND. lwp )   WRITE(numout,*) '-- ice_dyn_adv_umx: Ultimate-Macho advection scheme'
+!     REAL(wp), DIMENSION(jpi,jpj)     ::   zudy, zvdx, zcu_box, zcv_box
+!     REAL(wp), DIMENSION(jpi,jpj)     ::   zati1, zati2
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zu_cat, zv_cat
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zua_ho, zva_ho, zua_ups, zva_ups
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) ::   z1_ai , z1_aip, zhvar
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zhi_max, zhs_max, zhip_max
+      REAL(wp), ALLOCATABLE, DIMENSION(:, :)    ::   zudy, zvdx, zcu_box, zcv_box
+      REAL(wp), ALLOCATABLE, DIMENSION(:, :)    ::   zati1, zati2
+      REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   zu_cat, zv_cat
+      REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   zua_ho, zva_ho, zua_ups, zva_ups
+      REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   z1_ai , z1_aip, zhvar
+      REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) ::   zhi_max, zhs_max, zhip_max
+      !
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::   zuv_ho, zvv_ho, zuv_ups, zvv_ups, z1_vi, z1_vs 
+      !!----------------------------------------------------------------------
+      !
+      IF( kt == nit000) THEN
+         IF( lwp )   WRITE(numout,*) '-- ice_dyn_adv_umx: Ultimate-Macho advection scheme'
+         ALLOCATE( zudy(jpi,jpj), zvdx(jpi,jpj), zcu_box(jpi,jpj), zcv_box(jpi,jpj) )
+         ALLOCATE( zati1(jpi,jpj), zati2(jpi,jpj) )
+         ALLOCATE( zu_cat(jpi,jpj,jpl), zv_cat(jpi,jpj,jpl) )
+         ALLOCATE( zua_ho(jpi,jpj,jpl), zva_ho(jpi,jpj,jpl), zua_ups(jpi,jpj,jpl), zva_ups(jpi,jpj,jpl) )
+         ALLOCATE( z1_ai(jpi,jpj,jpl), z1_aip(jpi,jpj,jpl), zhvar(jpi,jpj,jpl) )
+         ALLOCATE( zhi_max(jpi,jpj,jpl), zhs_max(jpi,jpj,jpl), zhip_max(jpi,jpj,jpl) )
+         ALLOCATE( zfu_ho(jpi,jpj,jpl), zfv_ho(jpi,jpj,jpl), zpt(jpi,jpj,jpl))
+         ALLOCATE( zfu_ups(jpi,jpj,jpl), zfv_ups(jpi,jpj,jpl), zt_ups(jpi,jpj,jpl))
+         ALLOCATE( ztu1(jpi,jpj,jpl), ztu2(jpi,jpj,jpl), ztu3(jpi,jpj,jpl), ztu4(jpi,jpj,jpl))
+         ALLOCATE( ztv1(jpi,jpj,jpl), ztv2(jpi,jpj,jpl), ztv3(jpi,jpj,jpl), ztv4(jpi,jpj,jpl))
+         ALLOCATE( zswitch(jpi,jpj))
+         ALLOCATE( zslpy(jpi,jpj,jpl))
+         ALLOCATE( zslpx(jpi,jpj,jpl))
+         ALLOCATE( zbup(jpi,jpj), zbdo(jpi,jpj))
+         ALLOCATE( zbetup(jpi,jpj,jpl), zbetdo(jpi,jpj,jpl), zti_ups(jpi,jpj,jpl), ztj_ups(jpi,jpj,jpl))
+         ALLOCATE( zt_u(jpi,jpj,jpl), zt_v(jpi,jpj,jpl))
+      ENDIF
       !
       ! --- Record max of the surrounding 9-pts ice thick. (for call Hbig) --- !
@@ -421,6 +456,6 @@
       INTEGER  ::   ji, jj, jl       ! dummy loop indices  
       REAL(wp) ::   ztra             ! local scalar
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zfu_ho , zfv_ho , zpt
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zfu_ups, zfv_ups, zt_ups
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zfu_ho , zfv_ho , zpt
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zfu_ups, zfv_ups, zt_ups
       !!----------------------------------------------------------------------
       !
@@ -537,5 +572,5 @@
       INTEGER  ::   ji, jj, jl    ! dummy loop indices
       REAL(wp) ::   ztra          ! local scalar
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zpt
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zpt
       !!----------------------------------------------------------------------
 
@@ -653,5 +688,5 @@
       INTEGER  ::   ji, jj, jl    ! dummy loop indices
       REAL(wp) ::   ztra          ! local scalar
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zpt
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zpt
       !!----------------------------------------------------------------------
       !
@@ -771,5 +806,5 @@
       !
       INTEGER  ::   ji, jj, jl    ! dummy loop indices
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zt_u, zt_v, zpt
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zt_u, zt_v, zpt
       !!----------------------------------------------------------------------
       !
@@ -858,5 +893,5 @@
       INTEGER  ::   ji, jj, jl             ! dummy loop indices
       REAL(wp) ::   zcu, zdx2, zdx4        !   -      -
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   ztu1, ztu2, ztu3, ztu4
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) ::   ztu1, ztu2, ztu3, ztu4
       !!----------------------------------------------------------------------
       !
@@ -1015,5 +1050,5 @@
       INTEGER  ::   ji, jj, jl         ! dummy loop indices
       REAL(wp) ::   zcv, zdy2, zdy4    !   -      -
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   ztv1, ztv2, ztv3, ztv4
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) ::   ztv1, ztv2, ztv3, ztv4
       !!----------------------------------------------------------------------
       !
@@ -1169,6 +1204,6 @@
       REAL(wp) ::   zpos, zneg, zbig, zup, zdo, z1_dt              ! local scalars
       REAL(wp) ::   zau, zbu, zcu, zav, zbv, zcv, zcoef, zzt       !   -      -
-      REAL(wp), DIMENSION(jpi,jpj    ) :: zbup, zbdo
-      REAL(wp), DIMENSION(jpi,jpj,jpl) :: zbetup, zbetdo, zti_ups, ztj_ups
+!     REAL(wp), DIMENSION(jpi,jpj    ) :: zbup, zbdo
+!     REAL(wp), DIMENSION(jpi,jpj,jpl) :: zbetup, zbetdo, zti_ups, ztj_ups
       !!----------------------------------------------------------------------
       zbig = 1.e+40_wp
@@ -1339,5 +1374,5 @@
       REAL(wp) ::   Cr, Rjm, Rj, Rjp, uCFL, zpsi, zh3, zlimiter, Rr
       INTEGER  ::   ji, jj, jl    ! dummy loop indices
-      REAL(wp), DIMENSION (jpi,jpj,jpl) ::   zslpx       ! tracer slopes 
+!     REAL(wp), DIMENSION (jpi,jpj,jpl) ::   zslpx       ! tracer slopes 
       !!----------------------------------------------------------------------
       !
@@ -1434,5 +1469,4 @@
       REAL(wp) ::   Cr, Rjm, Rj, Rjp, vCFL, zpsi, zh3, zlimiter, Rr
       INTEGER  ::   ji, jj, jl    ! dummy loop indices
-      REAL(wp), DIMENSION (jpi,jpj,jpl) ::   zslpy       ! tracer slopes 
       !!----------------------------------------------------------------------
       !
@@ -1541,5 +1575,5 @@
       INTEGER  ::   ji, jj, jk, jl         ! dummy loop indices
       REAL(wp) ::   z1_dt, zhip, zhi, zhs, zvs_excess, zfra
-      REAL(wp), DIMENSION(jpi,jpj) ::   zswitch
+!     REAL(wp), DIMENSION(jpi,jpj) ::   zswitch
       !!-------------------------------------------------------------------
       !
