Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icecor.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icecor.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icecor.F90	(revision 11467)
@@ -50,4 +50,5 @@
       !!              the end of the dynamics (kn=1) and thermodynamics (kn=2)
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zafx => scr2D1
       INTEGER, INTENT(in) ::   kt    ! number of iteration
       INTEGER, INTENT(in) ::   kn    ! 1 = after dyn ; 2 = after thermo
@@ -55,5 +56,4 @@
       INTEGER  ::   ji, jj, jk, jl   ! dummy loop indices
       REAL(wp) ::   zsal, zzc
-      REAL(wp), DIMENSION(jpi,jpj) ::   zafx   ! concentration trends diag
       !!----------------------------------------------------------------------
       ! controls
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_adv.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_adv.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_adv.F90	(revision 11467)
@@ -65,8 +65,8 @@
       !! ** action :
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zmask => scr2D1        ! fraction of time step with v_i < 0
       INTEGER, INTENT(in) ::   kt   ! number of iteration
       !
       INTEGER ::   jl   ! dummy loop indice
-      REAL(wp), DIMENSION(jpi,jpj) ::   zmask  ! fraction of time step with v_i < 0
       !!---------------------------------------------------------------------
       !
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_adv_umx.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_adv_umx.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_adv_umx.F90	(revision 11467)
@@ -54,4 +54,5 @@
       !! Reference : Leonard, B.P., 1991, Comput. Methods Appl. Mech. Eng., 88, 17-74. 
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zudy => scr2D1, zvdx => scr2D2, zcu_box => scr2D3, zcv_box => scr2D4
       INTEGER                     , INTENT(in   ) ::   k_order    ! order of the scheme (1-5 or 20)
       INTEGER                     , INTENT(in   ) ::   kt         ! time step
@@ -72,10 +73,8 @@
       INTEGER  ::   initad                  ! number of sub-timestep for the advection
       REAL(wp) ::   zcfl , zusnit, zdt      !   -      -
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   zudy, zvdx, zcu_box, zcv_box
       !!----------------------------------------------------------------------
       !
       IF( kt == nit000 .AND. 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) )
       !
       ! --- If ice drift field is too fast, use an appropriate time step for advection (CFL test for stability) --- !        
@@ -133,6 +132,4 @@
       END DO
       !
-      DEALLOCATE( zudy, zvdx, zcu_box, zcv_box )
-      !
    END SUBROUTINE ice_dyn_adv_umx
 
@@ -151,4 +148,6 @@
       !! ** Action : - pt  the after advective tracer
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zfu_ups => scr2D5, zfu_ho => scr2D6, zt_u => scr2D7, zt_ups => scr2D8, &
+                        zfv_ups => scr2D9, zfv_ho => scr2D10, zt_v => scr2D11, ztrd => scr2D12
       INTEGER                     , INTENT(in   ) ::   k_order        ! order of the ULTIMATE scheme
       INTEGER                     , INTENT(in   ) ::   kt             ! number of iteration
@@ -160,6 +159,4 @@
       INTEGER  ::   ji, jj           ! dummy loop indices  
       REAL(wp) ::   ztra             ! local scalar
-      REAL(wp), DIMENSION(jpi,jpj) ::   zfu_ups, zfu_ho, zt_u, zt_ups
-      REAL(wp), DIMENSION(jpi,jpj) ::   zfv_ups, zfv_ho, zt_v, ztrd
       !!----------------------------------------------------------------------
       !
@@ -245,4 +242,5 @@
       !! Reference : Leonard, B.P., 1991, Comput. Methods Appl. Mech. Eng., 88, 17-74. 
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zzt => scr2D13
       INTEGER                     , INTENT(in   ) ::   k_order    ! order of the ULTIMATE scheme
       INTEGER                     , INTENT(in   ) ::   kt         ! number of iteration
@@ -255,5 +253,4 @@
       INTEGER  ::   ji, jj    ! dummy loop indices
       REAL(wp) ::   zc_box    !   -      -
-      REAL(wp), DIMENSION(jpi,jpj) :: zzt
       !!----------------------------------------------------------------------
       !
@@ -310,4 +307,5 @@
       !! Reference : Leonard, B.P., 1991, Comput. Methods Appl. Mech. Eng., 88, 17-74. 
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : ztu1 => scr2D14, ztu2 => scr2D15, ztu3 => scr2D16, ztu4 => scr2D17
       INTEGER                     , INTENT(in   ) ::   k_order   ! ocean time-step index
       REAL(wp)                    , INTENT(in   ) ::   pdt       ! tracer time-step
@@ -318,5 +316,4 @@
       INTEGER  ::   ji, jj       ! dummy loop indices
       REAL(wp) ::   zcu, zdx2, zdx4    !   -      -
-      REAL(wp), DIMENSION(jpi,jpj) :: ztu1, ztu2, ztu3, ztu4
       !!----------------------------------------------------------------------
       !
@@ -428,4 +425,5 @@
       !! Reference : Leonard, B.P., 1991, Comput. Methods Appl. Mech. Eng., 88, 17-74. 
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : ztv1 => scr2D14, ztv2 => scr2D15, ztv3 => scr2D16, ztv4 => scr2D17
       INTEGER                     , INTENT(in   ) ::   k_order   ! ocean time-step index
       REAL(wp)                    , INTENT(in   ) ::   pdt       ! tracer time-step
@@ -436,5 +434,4 @@
       INTEGER  ::   ji, jj       ! dummy loop indices
       REAL(wp) ::   zcv, zdy2, zdy4    !   -      -
-      REAL(wp), DIMENSION(jpi,jpj) :: ztv1, ztv2, ztv3, ztv4
       !!----------------------------------------------------------------------
       !
@@ -546,4 +543,6 @@
       !!       in-space based differencing for fluid
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zbetup => scr2D14, zbetdo => scr2D15, zbup => scr2D16, &
+                       zbdo => scr2D17, zmsk => scr2D18, zdiv => scr2D19
       REAL(wp)                     , INTENT(in   ) ::   pdt          ! tracer time-step
       REAL(wp), DIMENSION (jpi,jpj), INTENT(in   ) ::   pbef, paft   ! before & after field
@@ -554,5 +553,4 @@
       REAL(wp) ::   zpos, zneg, zbt, za, zb, zc, zbig, zsml, z1_dt   ! local scalars
       REAL(wp) ::   zau, zbu, zcu, zav, zbv, zcv, zup, zdo            !   -      -
-      REAL(wp), DIMENSION(jpi,jpj) :: zbetup, zbetdo, zbup, zbdo, zmsk, zdiv
       !!----------------------------------------------------------------------
       !
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_rdgrft.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_rdgrft.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_rdgrft.F90	(revision 11467)
@@ -131,4 +131,6 @@
       !!     and Elizabeth C. Hunke, LANL are gratefully acknowledged
       !!-------------------------------------------------------------------
+      USE scice, ONLY :  zdivu_adv => scr1D1i, &    ! divu as implied by transport scheme  (1/s)
+                        zdivu => scr1D2i, zdelt => scr1D3i  ! 1D divu_i & delta_i
       INTEGER, INTENT(in) ::   kt     ! number of iteration
       !!
@@ -138,6 +140,4 @@
       REAL(wp) ::   zfac                       ! local scalar
       INTEGER , DIMENSION(jpij) ::   iptidx        ! compute ridge/raft or not
-      REAL(wp), DIMENSION(jpij) ::   zdivu_adv     ! divu as implied by transport scheme  (1/s)
-      REAL(wp), DIMENSION(jpij) ::   zdivu, zdelt  ! 1D divu_i & delta_i
       !
       INTEGER, PARAMETER ::   jp_itermax = 20    
@@ -293,4 +293,6 @@
       !!                participating in ridging and of the resulting ridges.
       !!-------------------------------------------------------------------
+      USE scice, ONLY : zasum => scr1D1i, z1_asum => scr1D2i, zaksum => scr1D3i, &   ! sum of a_i+ato_i and reverse
+                       zhi => scr1ai                ! ice thickness
       REAL(wp), DIMENSION(:)  , INTENT(in) ::   pato_i, pclosing_net 
       REAL(wp), DIMENSION(:,:), INTENT(in) ::   pa_i, pv_i 
@@ -298,6 +300,4 @@
       INTEGER  ::   ji, jl                     ! dummy loop indices
       REAL(wp) ::   z1_gstar, z1_astar, zhmean, zfac   ! local scalar
-      REAL(wp), DIMENSION(jpij)        ::   zasum, z1_asum, zaksum   ! sum of a_i+ato_i and reverse 
-      REAL(wp), DIMENSION(jpij,jpl)    ::   zhi                      ! ice thickness
       REAL(wp), DIMENSION(jpij,-1:jpl) ::   zGsum                    ! zGsum(n) = sum of areas in categories 0 to n
       !--------------------------------------------------------------------
@@ -495,4 +495,11 @@
       !!-------------------------------------------------------------------
       !
+      USE scice, ONLY : airdg2 => scr1D1i, oirdg2 => scr1D2i, aprdg2 => scr1D3i, & ! area etc of new ridges
+                       virdg2 => scr1D4i, sirdg2 => scr1D5i, vsrdg => scr1D6i,  &
+                       vprdg => scr1D7i,                                        & 
+                       ersw => scr1D8i,                                         & ! enth of water trapped into ridges
+                       zswitch => scr1D9i, fvol => scr1D10i,                     & ! new ridge volume going to jl2
+                       z1_ai => scr1D11i                                         ! 1 / a
+
       INTEGER  ::   ji, jj, jl, jl1, jl2, jk   ! dummy loop indices
       REAL(wp) ::   hL, hR, farea              ! left and right limits of integration and new area going to jl2
@@ -501,10 +508,5 @@
       REAL(wp)                  ::   airdg1, oirdg1, aprdg1, virdg1, sirdg1
       REAL(wp)                  ::   airft1, oirft1, aprft1
-      REAL(wp), DIMENSION(jpij) ::   airdg2, oirdg2, aprdg2, virdg2, sirdg2, vsrdg, vprdg  ! area etc of new ridges
       REAL(wp), DIMENSION(jpij) ::   airft2, oirft2, aprft2, virft , sirft , vsrft, vprft  ! area etc of rafted ice
-      !
-      REAL(wp), DIMENSION(jpij) ::   ersw             ! enth of water trapped into ridges
-      REAL(wp), DIMENSION(jpij) ::   zswitch, fvol    ! new ridge volume going to jl2
-      REAL(wp), DIMENSION(jpij) ::   z1_ai            ! 1 / a
       !
       REAL(wp), DIMENSION(jpij,nlay_s) ::   esrft     ! snow energy of rafting ice
@@ -750,10 +752,10 @@
       !!              ice strength has to be smoothed
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zworka => scr2D1, &                 ! temporary array used here
+                       zstrp1 => scr2D2, zstrp2 => scr2D3  ! strength at previous time steps
       INTEGER             ::   ji, jj, jl  ! dummy loop indices
       INTEGER             ::   ismooth     ! smoothing the resistance to deformation
       INTEGER             ::   itframe     ! number of time steps for the P smoothing
       REAL(wp)            ::   zp, z1_3    ! local scalars
-      REAL(wp), DIMENSION(jpi,jpj) ::   zworka           ! temporary array used here
-      REAL(wp), DIMENSION(jpi,jpj) ::   zstrp1, zstrp2   ! strength at previous time steps
       !!----------------------------------------------------------------------
       !                              !--------------------------------------------------!
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_rhg_evp.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_rhg_evp.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icedyn_rhg_evp.F90	(revision 11467)
@@ -107,4 +107,32 @@
       !!              Kimmritz et al., Ocean Modelling 2016 & 2017
       !!-------------------------------------------------------------------
+      USE scoce, ONLY : z1_e1t0 => scr2D1, z1_e2t0 => scr2D2, &                                       ! scale factors
+                        zp_delt => scr2D3, &                                                          ! P/delta at T points
+                        zbeta => scr2D4, &                                                            ! beta coef from Kimmritz 2017
+      !
+                        zdt_m => scr2D5, &                                                            ! (dt / ice-snow_mass) on T points
+                        zaU => scr2D6  , zaV => scr2D7, &                                             ! ice fraction on U/V points
+                        zmU_t => scr2D8, zmV_t => scr2D9, &                                           ! (ice-snow_mass / dt) on U/V points
+                        zmf => scr2D10, &                                                             ! coriolis parameter at T points
+                        zTauU_ia => scr2D11, ztauV_ia => scr2D12, &                                   ! ice-atm. stress at U-V points
+                        zspgU => scr2D13, zspgV => scr2D14, &                                         ! surface pressure gradient at U/V points
+                        v_oceU => scr2D15, u_oceV => scr2D16, v_iceU => scr2D17, u_iceV => scr2D18, & ! ocean/ice u/v component on V/U points                           
+                        zfU => scr2D19  , zfV => scr2D20, &                                           ! internal stresses
+      !
+                        zds => scr2D21, &                                                             ! shear
+                        zs1 => scr2D22, zs2 => scr2D23, zs12 => scr2D38, &                            ! stress tensor components
+                        zu_ice => scr2D24, zv_ice => scr2D25, zresr => scr2D26, &                     ! check convergence
+                        zpice  => scr2D27, &                                                          ! array used for the calculation of ice surface slope:
+      !                                                                                               !    ocean surface (ssh_m) if ice is not embedded
+      !                                                                                               !    ice top surface if ice is embedded   
+                        zCorx => scr2D28, zCory => scr2D29, &                                         ! Coriolis stress array
+                        ztaux_oi => scr2D30, ztauy_oi => scr2D31, &                                   ! Ocean-to-ice stress array
+      !
+                        zswitchU => scr2D32, zswitchV => scr2D33, &                                   ! dummy arrays
+                        zmaskU => scr2D34, zmaskV => scr2D35, &                                       ! mask for ice presence
+                        zfmask => scr2D36, zwf => scr2D37                                             ! mask at F points for the ice
+
+                        
+
       INTEGER                 , INTENT(in   ) ::   kt                                    ! time step
       REAL(wp), DIMENSION(:,:), INTENT(inout) ::   pstress1_i, pstress2_i, pstress12_i   !
@@ -127,30 +155,4 @@
       REAL(wp) ::   zshear, zdum1, zdum2
       !
-      REAL(wp), DIMENSION(jpi,jpj) ::   z1_e1t0, z1_e2t0                ! scale factors
-      REAL(wp), DIMENSION(jpi,jpj) ::   zp_delt                         ! P/delta at T points
-      REAL(wp), DIMENSION(jpi,jpj) ::   zbeta                           ! beta coef from Kimmritz 2017
-      !
-      REAL(wp), DIMENSION(jpi,jpj) ::   zdt_m                           ! (dt / ice-snow_mass) on T points
-      REAL(wp), DIMENSION(jpi,jpj) ::   zaU   , zaV                     ! ice fraction on U/V points
-      REAL(wp), DIMENSION(jpi,jpj) ::   zmU_t, zmV_t                    ! (ice-snow_mass / dt) on U/V points
-      REAL(wp), DIMENSION(jpi,jpj) ::   zmf                             ! coriolis parameter at T points
-      REAL(wp), DIMENSION(jpi,jpj) ::   zTauU_ia , ztauV_ia             ! ice-atm. stress at U-V points
-      REAL(wp), DIMENSION(jpi,jpj) ::   zspgU , zspgV                   ! surface pressure gradient at U/V points
-      REAL(wp), DIMENSION(jpi,jpj) ::   v_oceU, u_oceV, v_iceU, u_iceV  ! ocean/ice u/v component on V/U points                           
-      REAL(wp), DIMENSION(jpi,jpj) ::   zfU   , zfV                     ! internal stresses
-      !
-      REAL(wp), DIMENSION(jpi,jpj) ::   zds                             ! shear
-      REAL(wp), DIMENSION(jpi,jpj) ::   zs1, zs2, zs12                  ! stress tensor components
-      REAL(wp), DIMENSION(jpi,jpj) ::   zu_ice, zv_ice, zresr           ! check convergence
-      REAL(wp), DIMENSION(jpi,jpj) ::   zpice                           ! array used for the calculation of ice surface slope:
-      !                                                                 !    ocean surface (ssh_m) if ice is not embedded
-      !                                                                 !    ice top surface if ice is embedded   
-      REAL(wp), DIMENSION(jpi,jpj) ::   zCorx, zCory                    ! Coriolis stress array
-      REAL(wp), DIMENSION(jpi,jpj) ::   ztaux_oi, ztauy_oi              ! Ocean-to-ice stress array
-      !
-      REAL(wp), DIMENSION(jpi,jpj) ::   zswitchU, zswitchV              ! dummy arrays
-      REAL(wp), DIMENSION(jpi,jpj) ::   zmaskU, zmaskV                  ! mask for ice presence
-      REAL(wp), DIMENSION(jpi,jpj) ::   zfmask, zwf                     ! mask at F points for the ice
-
       REAL(wp), PARAMETER          ::   zepsi  = 1.0e-20_wp             ! tolerance parameter
       REAL(wp), PARAMETER          ::   zmmin  = 1._wp                  ! ice mass (kg/m2) below which ice velocity equals ocean velocity
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/iceforcing.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/iceforcing.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/iceforcing.F90	(revision 11467)
@@ -53,4 +53,5 @@
       !!              utau_ice, vtau_ice : surface ice stress (U- & V-points) [N/m2]
       !!-------------------------------------------------------------------
+      USE scoce, ONLY : zutau_ice => scr2D1, zvtau_ice => scr2D2
       INTEGER                     , INTENT(in   ) ::   kt                   ! ocean time step
       INTEGER                     , INTENT(in   ) ::   ksbc                 ! type of sbc flux
@@ -58,5 +59,4 @@
       !!
       INTEGER  ::   ji, jj                 ! dummy loop index
-      REAL(wp), DIMENSION(jpi,jpj) ::   zutau_ice, zvtau_ice 
       !!-------------------------------------------------------------------
       !
@@ -111,10 +111,10 @@
       !!                alb_ice                                  = albedo above sea ice
       !!-------------------------------------------------------------------
+      USE scice, ONLY : zalb_os => scr1i, zalb_cs => scr2i     ! ice albedo under overcast/clear sky
+      USE scoce, ONLY : zalb => scr2D1                         ! 2D workspace
       INTEGER, INTENT(in) ::   kt     ! ocean time step
       INTEGER, INTENT(in) ::   ksbc   ! flux formulation (user defined, bulk or Pure Coupled)
       !
       INTEGER  ::   ji, jj, jl                                ! dummy loop index
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zalb_os, zalb_cs  ! ice albedo under overcast/clear sky
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zalb              ! 2D workspace
       !!--------------------------------------------------------------------
       !
@@ -185,4 +185,13 @@
       !!                =  2  Redistribute a single flux over categories
       !!-------------------------------------------------------------------
+      USE scoce, ONLY : z1_at_i  => scr2D1, &  ! inverse of concentration
+                       z_qsr_m  => scr2D2, &  ! Mean solar heat flux over all categories
+                       z_qns_m  => scr2D3, &  ! Mean non solar heat flux over all categories
+                       z_evap_m => scr2D4, &  ! Mean sublimation over all categories
+                       z_dqn_m  => scr2D5, &  ! Mean d(qns)/dT over all categories
+                       z_devap_m=> scr2D6, &  ! Mean d(evap)/dT over all categories
+                       zalb_m   => scr2D7, &  ! Mean albedo over all categories
+                       ztem_m   => scr2D8     ! Mean temperature over all categories
+
       INTEGER                   , INTENT(in   ) ::   k_iceflx   ! redistributor
       REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   ptn_ice    ! ice surface temperature
@@ -196,13 +205,4 @@
       INTEGER  ::   jl      ! dummy loop index
       !
-      REAL(wp), DIMENSION(jpi,jpj) ::   z1_at_i   ! inverse of concentration
-      !
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z_qsr_m   ! Mean solar heat flux over all categories
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z_qns_m   ! Mean non solar heat flux over all categories
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z_evap_m  ! Mean sublimation over all categories
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z_dqn_m   ! Mean d(qns)/dT over all categories
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z_devap_m ! Mean d(evap)/dT over all categories
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   zalb_m    ! Mean albedo over all categories
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   ztem_m    ! Mean temperature over all categories
       !!----------------------------------------------------------------------
       !
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/iceistate.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/iceistate.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/iceistate.F90	(revision 11467)
@@ -89,4 +89,10 @@
       !!              where there is no ice (clem: I do not know why, is it mandatory?) 
       !!--------------------------------------------------------------------
+      USE scoce, ONLY : zht_i_ini => scr2D1, zat_i_ini => scr2D2, zvt_i_ini => scr2D3, & !data from namelist or nc file
+                       zts_u_ini => scr2D4, zht_s_ini => scr2D5, zsm_i_ini => scr2D6, &  
+                       ztm_i_ini => scr2D7,                                           &
+                       zswitch => scr2D8,                                             & ! ice indicator
+                       z2d => scr2D9
+      USE scice, ONLY : zh_i_ini => scr1i, za_i_ini => scr2i                             !data by cattegories to fill
       INTEGER  ::   ji, jj, jk, jl         ! dummy loop indices
       INTEGER  ::   i_hemis, i_fill, jl0   ! local integers
@@ -94,9 +100,4 @@
       REAL(wp) ::   zarg, zV, zconv, zdv, zfac
       INTEGER , DIMENSION(4)           ::   itest
-      REAL(wp), DIMENSION(jpi,jpj)     ::   z2d
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zswitch    ! ice indicator
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zht_i_ini, zat_i_ini, zvt_i_ini            !data from namelist or nc file
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zts_u_ini, zht_s_ini, zsm_i_ini, ztm_i_ini !data from namelist or nc file
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zh_i_ini , za_i_ini                        !data by cattegories to fill
       !--------------------------------------------------------------------
 
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icestp.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icestp.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icestp.F90	(revision 11467)
@@ -79,4 +79,5 @@
    USE timing         ! Timing
    USE prtctl         ! Print control
+   USE scice, ONLY : scice_alloc
 
    IMPLICIT NONE
@@ -247,4 +248,5 @@
       ierr = ierr + sbc_ice_alloc    ()      ! surface forcing 
       ierr = ierr + ice1D_alloc      ()      ! thermodynamics
+      ierr = ierr + scice_alloc      () 
       !
       IF( lk_mpp    )   CALL mpp_sum( ierr )
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd.F90	(revision 11467)
@@ -83,4 +83,5 @@
       !!                - call ice_thd_do   for ice growth in leads
       !!-------------------------------------------------------------------
+      USE scoce, ONLY : zu_io => scr2D1, zv_io => scr2D2, zfric => scr2D3
       INTEGER, INTENT(in) :: kt    ! number of iteration
       !
@@ -89,5 +90,4 @@
       REAL(wp), PARAMETER :: zfric_umin = 0._wp           ! lower bound for the friction velocity (cice value=5.e-04)
       REAL(wp), PARAMETER :: zch        = 0.0057_wp       ! heat transfer coefficient
-      REAL(wp), DIMENSION(jpi,jpj) ::   zu_io, zv_io, zfric   ! ice-ocean velocity (m/s) and frictional velocity (m2/s2)
       !
       !!-------------------------------------------------------------------
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_dh.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_dh.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_dh.F90	(revision 11467)
@@ -65,4 +65,16 @@
       !!              Vancoppenolle et al.,2009, Ocean Modelling
       !!------------------------------------------------------------------
+      USE scice, ONLY : zqprec     => scr1D1i,  & ! energy of fallen snow                       (J.m-3)
+                       zq_top     => scr1D2i,  & ! heat for surface ablation                   (J.m-2)
+                       zq_bot     => scr1D3i,  & ! heat for bottom ablation                    (J.m-2)
+                       zq_rema    => scr1D4i,  & ! remaining heat at the end of the routine    (J.m-2)
+                       zf_tt      => scr1D5i,  & ! Heat budget to determine melting or freezing(W.m-2)
+                       zevap_rema => scr1D6i,  & ! remaining mass flux from sublimation        (kg.m-2)
+                       zdh_s_mel  => scr1D7i,  & ! snow melt 
+                       zdh_s_pre  => scr1D8i,  & ! snow precipitation 
+                       zdh_s_sub  => scr1D9i,  & ! snow sublimation
+                       zsnw       => scr1D10i     ! distribution of snow after wind blowing
+ 
+
       INTEGER  ::   ji, jk       ! dummy loop indices
       INTEGER  ::   iter         ! local integer
@@ -84,21 +96,8 @@
       REAL(wp) ::   zfmdt        ! exchange mass flux x time step (J/m2), >0 towards the ocean
 
-      REAL(wp), DIMENSION(jpij) ::   zqprec      ! energy of fallen snow                       (J.m-3)
-      REAL(wp), DIMENSION(jpij) ::   zq_top      ! heat for surface ablation                   (J.m-2)
-      REAL(wp), DIMENSION(jpij) ::   zq_bot      ! heat for bottom ablation                    (J.m-2)
-      REAL(wp), DIMENSION(jpij) ::   zq_rema     ! remaining heat at the end of the routine    (J.m-2)
-      REAL(wp), DIMENSION(jpij) ::   zf_tt       ! Heat budget to determine melting or freezing(W.m-2)
-      REAL(wp), DIMENSION(jpij) ::   zevap_rema  ! remaining mass flux from sublimation        (kg.m-2)
-
-      REAL(wp), DIMENSION(jpij) ::   zdh_s_mel   ! snow melt 
-      REAL(wp), DIMENSION(jpij) ::   zdh_s_pre   ! snow precipitation 
-      REAL(wp), DIMENSION(jpij) ::   zdh_s_sub   ! snow sublimation
-
       REAL(wp), DIMENSION(jpij,nlay_s) ::   zh_s      ! snw layer thickness
       REAL(wp), DIMENSION(jpij,nlay_i) ::   zh_i      ! ice layer thickness
       REAL(wp), DIMENSION(jpij,nlay_i) ::   zdeltah
       INTEGER , DIMENSION(jpij,nlay_i) ::   icount    ! number of layers vanished by melting 
-
-      REAL(wp), DIMENSION(jpij) ::   zsnw        ! distribution of snow after wind blowing
 
       REAL(wp) ::   zswitch_sal
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_do.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_do.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_do.F90	(revision 11467)
@@ -75,4 +75,20 @@
       !!               update h_s_1d, h_i_1d      
       !!------------------------------------------------------------------------
+      USE scice, ONLY : jcat => iscr1D1i,     & ! indexes of categories where new ice grows
+                       zswinew => scr1D1i,   & ! switch for new ice or not
+                       zv_newice => scr1D2i, & ! volume of accreted ice
+                       za_newice => scr1D3i, & ! fractional area of accreted ice
+                       zh_newice => scr1D4i, & ! thickness of accreted ice
+                       ze_newice => scr1D5i, & ! heat content of accreted ice
+                       zs_newice => scr1D6i, & ! salinity of accreted ice
+                       zo_newice => scr1D7i, & ! age of accreted ice
+                       zdv_res   => scr1D8i, & ! residual volume in case of excessive heat budget
+                       zda_res   => scr1D9i, & ! residual area in case of excessive heat budget
+                       zv_frazb  => scr1D10i, & ! accretion of frazil ice at the ice bottom
+                       zvrel_1d  => scr1D11i, & ! relative ice / frazil velocity (1D vector)
+                       zv_b      => scr1ai,  & ! old volume of ice in category jl
+                       za_b      => scr2ai     ! old area of ice in category jl 
+      USE scoce, ONLY : zvrel     => scr2D1     ! relative ice / frazil velocity
+
       INTEGER  ::   ji, jj, jk, jl   ! dummy loop indices
       INTEGER  ::   iter             !   -       -
@@ -88,24 +104,5 @@
       REAL(wp) ::   zv_newfra
       !
-      INTEGER , DIMENSION(jpij) ::   jcat        ! indexes of categories where new ice grows
-      REAL(wp), DIMENSION(jpij) ::   zswinew     ! switch for new ice or not
-      !
-      REAL(wp), DIMENSION(jpij) ::   zv_newice   ! volume of accreted ice
-      REAL(wp), DIMENSION(jpij) ::   za_newice   ! fractional area of accreted ice
-      REAL(wp), DIMENSION(jpij) ::   zh_newice   ! thickness of accreted ice
-      REAL(wp), DIMENSION(jpij) ::   ze_newice   ! heat content of accreted ice
-      REAL(wp), DIMENSION(jpij) ::   zs_newice   ! salinity of accreted ice
-      REAL(wp), DIMENSION(jpij) ::   zo_newice   ! age of accreted ice
-      REAL(wp), DIMENSION(jpij) ::   zdv_res     ! residual volume in case of excessive heat budget
-      REAL(wp), DIMENSION(jpij) ::   zda_res     ! residual area in case of excessive heat budget
-      REAL(wp), DIMENSION(jpij) ::   zv_frazb    ! accretion of frazil ice at the ice bottom
-      REAL(wp), DIMENSION(jpij) ::   zvrel_1d    ! relative ice / frazil velocity (1D vector)
-      !
-      REAL(wp), DIMENSION(jpij,jpl) ::   zv_b    ! old volume of ice in category jl
-      REAL(wp), DIMENSION(jpij,jpl) ::   za_b    ! old area of ice in category jl
-      !
       REAL(wp), DIMENSION(jpij,nlay_i,jpl) ::   ze_i_2d !: 1-D version of e_i
-      !
-      REAL(wp), DIMENSION(jpi,jpj) ::   zvrel    ! relative ice / frazil velocity
       !
       REAL(wp) :: zcai = 1.4e-3_wp               ! ice-air drag (clem: should be dependent on coupling/forcing used)
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_ent.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_ent.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_ent.F90	(revision 11467)
@@ -63,4 +63,5 @@
       !! References : Bitz & Lipscomb, JGR 99; Vancoppenolle et al., GRL, 2005
       !!-------------------------------------------------------------------
+      USE scice, ONLY : zhnew => scr1D1i
       REAL(wp), DIMENSION(:,:), INTENT(inout) ::   qnew             ! new enthlapies (J.m-3, remapped)
       !
@@ -70,5 +71,4 @@
       REAL(wp), DIMENSION(jpij,0:nlay_i+2) ::   zeh_cum0, zh_cum0   ! old cumulative enthlapies and layers interfaces
       REAL(wp), DIMENSION(jpij,0:nlay_i)   ::   zeh_cum1, zh_cum1   ! new cumulative enthlapies and layers interfaces
-      REAL(wp), DIMENSION(jpij)            ::   zhnew               ! new layers thicknesses
       !!-------------------------------------------------------------------
 
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_zdf_bl99.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_zdf_bl99.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icethd_zdf_bl99.F90	(revision 11467)
@@ -73,4 +73,32 @@
       !!           total ice/snow thickness         : h_i_1d, h_s_1d
       !!-------------------------------------------------------------------
+      USE scice, ONLY : isnow => scr1D1i, &                  ! switch for presence (1) or absence (0) of snow
+                       ztsub => scr1D2i, &                   ! surface temperature at previous iteration
+                       zh_i => scr1D3i, z1_h_i => scr1D4i, & ! ice layer thickness
+                       zh_s => scr1D5i, z1_h_s => scr1D6i, & ! snow layer thickness
+                       zqns_ice_b => scr1D7i, &              ! solar radiation absorbed at the surface
+                       zfnet => scr1D8i, &                   ! surface flux function
+                       zdqns_ice_b => scr1D9i, &             ! derivative of the surface flux function
+                       ztsuold => scr1D10i, &                ! Old surface temperature in the ice
+                       zq_ini => scr1D11i, &                 ! diag errors on heat
+                       zghe => scr1D12i, &                      ! G(he), th. conduct enhancement factor, mono-cat
+                       ztiold,                        &      ! Old temperature in the ice
+                       ztsold,                        &      ! Old temperature in the snow
+                       ztib,                          &      ! Temporary temperature in the ice to check the convergence
+                       ztsb,                          &      ! Temporary temperature in the snow to check the convergence
+                       ztcond_i,                      &      ! Ice thermal conductivity
+                       zradtr_i,                      &      ! Radiation transmitted through the ice
+                       zradab_i,                      &      ! Radiation absorbed in the ice
+                       zkappa_i,                      &      ! Kappa factor in the ice
+                       zeta_i,                        &      ! Eta factor in the ice
+                       zradtr_s,                      &      ! Radiation transmited through the snow
+                       zradab_s,                      &      ! Radiation absorbed in the snow
+                       zkappa_s,                      &      ! Kappa factor in the snow
+                       zeta_s,                        &      ! Eta factor in the snow
+                       zindterm,                      &      ! 'Ind'ependent term
+                       zindtbis,                      &      ! Temporary 'ind'ependent term
+                       zdiagbis,                      &      ! Temporary 'dia'gonal term
+                       ztrid                                 ! Tridiagonal system terms
+
       INTEGER, INTENT(in) ::   k_jules     ! Jules coupling (0=OFF, 1=EMULATED, 2=ACTIVE)
       !
@@ -98,33 +126,4 @@
       REAL(wp) ::   zhfx_err, zdq             ! diag errors on heat
       REAL(wp) ::   zfac                      ! dummy factor
-      !
-      REAL(wp), DIMENSION(jpij) ::   isnow        ! switch for presence (1) or absence (0) of snow
-      REAL(wp), DIMENSION(jpij) ::   ztsub        ! surface temperature at previous iteration
-      REAL(wp), DIMENSION(jpij) ::   zh_i, z1_h_i ! ice layer thickness
-      REAL(wp), DIMENSION(jpij) ::   zh_s, z1_h_s ! snow layer thickness
-      REAL(wp), DIMENSION(jpij) ::   zqns_ice_b   ! solar radiation absorbed at the surface
-      REAL(wp), DIMENSION(jpij) ::   zfnet        ! surface flux function
-      REAL(wp), DIMENSION(jpij) ::   zdqns_ice_b  ! derivative of the surface flux function
-      !
-      REAL(wp), DIMENSION(jpij       )     ::   ztsuold     ! Old surface temperature in the ice
-      REAL(wp), DIMENSION(jpij,nlay_i)     ::   ztiold      ! Old temperature in the ice
-      REAL(wp), DIMENSION(jpij,nlay_s)     ::   ztsold      ! Old temperature in the snow
-      REAL(wp), DIMENSION(jpij,nlay_i)     ::   ztib        ! Temporary temperature in the ice to check the convergence
-      REAL(wp), DIMENSION(jpij,nlay_s)     ::   ztsb        ! Temporary temperature in the snow to check the convergence
-      REAL(wp), DIMENSION(jpij,0:nlay_i)   ::   ztcond_i    ! Ice thermal conductivity
-      REAL(wp), DIMENSION(jpij,0:nlay_i)   ::   zradtr_i    ! Radiation transmitted through the ice
-      REAL(wp), DIMENSION(jpij,0:nlay_i)   ::   zradab_i    ! Radiation absorbed in the ice
-      REAL(wp), DIMENSION(jpij,0:nlay_i)   ::   zkappa_i    ! Kappa factor in the ice
-      REAL(wp), DIMENSION(jpij,0:nlay_i)   ::   zeta_i      ! Eta factor in the ice
-      REAL(wp), DIMENSION(jpij,0:nlay_s)   ::   zradtr_s    ! Radiation transmited through the snow
-      REAL(wp), DIMENSION(jpij,0:nlay_s)   ::   zradab_s    ! Radiation absorbed in the snow
-      REAL(wp), DIMENSION(jpij,0:nlay_s)   ::   zkappa_s    ! Kappa factor in the snow
-      REAL(wp), DIMENSION(jpij,0:nlay_s)   ::   zeta_s      ! Eta factor in the snow
-      REAL(wp), DIMENSION(jpij,nlay_i+3)   ::   zindterm    ! 'Ind'ependent term
-      REAL(wp), DIMENSION(jpij,nlay_i+3)   ::   zindtbis    ! Temporary 'ind'ependent term
-      REAL(wp), DIMENSION(jpij,nlay_i+3)   ::   zdiagbis    ! Temporary 'dia'gonal term
-      REAL(wp), DIMENSION(jpij,nlay_i+3,3) ::   ztrid       ! Tridiagonal system terms
-      REAL(wp), DIMENSION(jpij)            ::   zq_ini      ! diag errors on heat
-      REAL(wp), DIMENSION(jpij)            ::   zghe        ! G(he), th. conduct enhancement factor, mono-cat
       !
       ! Mono-category
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/iceupdate.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/iceupdate.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/iceupdate.F90	(revision 11467)
@@ -89,4 +89,6 @@
       !!              The ref should be Rousset et al., 2015
       !!---------------------------------------------------------------------
+      USE scoce, ONLY : z2d => scr2D1
+      USE scice, ONLY : zalb_cs => scr1i, zalb_os => scr2i
       INTEGER, INTENT(in) ::   kt   ! number of iteration
       !
@@ -94,6 +96,4 @@
       REAL(wp) ::   zqmass           ! Heat flux associated with mass exchange ice->ocean (W.m-2)
       REAL(wp) ::   zqsr             ! New solar flux received by the ocean
-      REAL(wp), DIMENSION(jpi,jpj)     ::   z2d                  ! 2D workspace
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zalb_cs, zalb_os     ! 3D workspace
       !!---------------------------------------------------------------------
       IF( ln_timing )   CALL timing_start('ice_update')
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icevar.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icevar.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/icevar.F90	(revision 11467)
@@ -89,9 +89,9 @@
       !!              all-ice variables, i.e. it turns VGLO into VAGG
       !!-------------------------------------------------------------------
+      USE scoce, ONLY : z1_at_i => scr2D4, z1_vt_i => scr2D2, z1_vt_s => scr2D3
       INTEGER, INTENT( in ) ::   kn     ! =1 state variables only
       !                                 ! >1 state variables + others
       !
       INTEGER ::   ji, jj, jk, jl   ! dummy loop indices
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z1_at_i, z1_vt_i, z1_vt_s
       !!-------------------------------------------------------------------
       !
@@ -112,5 +112,4 @@
       IF( kn > 1 ) THEN
          !
-         ALLOCATE( z1_at_i(jpi,jpj) , z1_vt_i(jpi,jpj) , z1_vt_s(jpi,jpj) )
          WHERE( at_i(:,:) > epsi20 )   ;   z1_at_i(:,:) = 1._wp / at_i(:,:)
          ELSEWHERE                     ;   z1_at_i(:,:) = 0._wp
@@ -152,5 +151,4 @@
          END WHERE
 
-         DEALLOCATE( z1_at_i , z1_vt_i , z1_vt_s )
       ENDIF
       !
@@ -165,4 +163,5 @@
       !!              global variables, i.e. it turns VGLO into VEQV
       !!-------------------------------------------------------------------
+      USE scice, ONLY : z1_a_i => scr3i, z1_v_i => scr4i
       INTEGER  ::   ji, jj, jk, jl   ! dummy loop indices
       REAL(wp) ::   ze_i             ! local scalars
@@ -170,5 +169,4 @@
       REAL(wp) ::   zhmax, z1_zhmax                 !   -      -
       REAL(wp) ::   zlay_i, zlay_s                  !   -      -
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   z1_a_i, z1_v_i
       !!-------------------------------------------------------------------
 
@@ -294,8 +292,8 @@
       !! ** References : Vancoppenolle et al., 2007
       !!-------------------------------------------------------------------
+      USE scice , ONLY : z_slope_s => scr5i, zalpha =>scr6i
       INTEGER  ::   ji, jj, jk, jl   ! dummy loop index
       REAL(wp) ::   zsal, z1_dS
       REAL(wp) ::   zargtemp , zs0, zs
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   z_slope_s, zalpha    ! case 2 only
       REAL(wp), PARAMETER :: zsi0 = 3.5_wp
       REAL(wp), PARAMETER :: zsi1 = 4.5_wp
@@ -315,6 +313,4 @@
       CASE( 2 )       !  time varying salinity with linear profile  !
          !            !---------------------------------------------!
-         !
-         ALLOCATE( z_slope_s(jpi,jpj,jpl) , zalpha(jpi,jpj,jpl) )
          !
          DO jl = 1, jpl
@@ -353,6 +349,4 @@
          END DO
          !
-         DEALLOCATE( z_slope_s , zalpha )
-         !
          !            !-------------------------------------------!
       CASE( 3 )       ! constant salinity with a fix profile      ! (Schwarzacher (1959) multiyear salinity profile
@@ -386,9 +380,9 @@
       !!                Works with 1d vectors and is used by thermodynamic modules
       !!-------------------------------------------------------------------
+      USE scice, ONLY : z_slope_s => scr1D1i, zalpha => scr1D2i
       INTEGER  ::   ji, jk    ! dummy loop indices
       REAL(wp) ::   zargtemp, zsal, z1_dS   ! local scalars
       REAL(wp) ::   zs, zs0              !   -      -
       !
-      REAL(wp), ALLOCATABLE, DIMENSION(:) ::   z_slope_s, zalpha   !
       REAL(wp), PARAMETER :: zsi0 = 3.5_wp
       REAL(wp), PARAMETER :: zsi1 = 4.5_wp
@@ -405,6 +399,4 @@
       CASE( 2 )       !  time varying salinity with linear profile  !
          !            !---------------------------------------------!
-         !
-         ALLOCATE( z_slope_s(jpij), zalpha(jpij) )
          !
          !                                      ! Slope of the linear profile 
@@ -430,6 +422,4 @@
          END DO
          !
-         DEALLOCATE( z_slope_s, zalpha )
-
          !            !-------------------------------------------!
       CASE( 3 )       ! constant salinity with a fix profile      ! (Schwarzacher (1959) multiyear salinity profile
@@ -458,6 +448,6 @@
       !! ** Purpose :   Remove too small sea ice areas and correct fluxes
       !!-------------------------------------------------------------------
+      USE scoce, ONLY : zswitch => scr2D2
       INTEGER  ::   ji, jj, jl, jk   ! dummy loop indices
-      REAL(wp), DIMENSION(jpi,jpj) ::   zswitch
       !!-------------------------------------------------------------------
       !
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/scice.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/scice.F90	(revision 11467)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/ICE/scice.F90	(revision 11467)
@@ -0,0 +1,106 @@
+MODULE scice
+   !!======================================================================
+   !!                      ***  MODULE  oce  ***
+   !! Ocean        :  dynamics and active tracers defined in memory 
+   !!======================================================================
+   !! History :  1.0  !  2002-11  (G. Madec)  F90: Free form and module
+   !!            3.1  !  2009-02  (G. Madec, M. Leclair)  pure z*
+   !coordinate
+   !!            3.3  !  2010-09  (C. Ethe) TRA-TRC merge: add ts, gtsu,
+   !gtsv 4D arrays
+   !!            3.7  !  2014-01  (G. Madec) suppression of curl and
+   !before hdiv from in-core memory
+   !!----------------------------------------------------------------------
+   USE par_oce        ! ocean parameters
+   USE lib_mpp        ! MPP library
+#if defined key_si3
+   USE ice, ONLY : jpl, nlay_i, nlay_s
+#endif
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC scice_alloc ! routine called by nemo_init in nemogcm.F90
+
+#if defined key_si3
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:,:,:) :: scr1i, scr2i, scr3i, scr4i, scr5i, scr6i  ! scratch arrays SI3
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:,:)   :: scr1ai, scr2ai
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:)     :: scr1D1i, scr1D2i, scr1D3i, scr1D4i, &
+                                                            scr1D5i, scr1D6i, scr1D7i, scr1D8i, &
+                                                            scr1D9i, scr1D10i, scr1D11i, scr1D12i, &
+                                                            scr1D13i
+   INTEGER,  PUBLIC, ALLOCATABLE,       DIMENSION(:)     :: iscr1D1i
+
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   ztiold      ! Old temperature in the ice
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   ztsold      ! Old temperature in the snow
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   ztib        ! Temporary temperature in the ice to check the convergence
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   ztsb        ! Temporary temperature in the snow to check the convergence
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   ztcond_i    ! Ice thermal conductivity
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   zradtr_i    ! Radiation transmitted through the ice
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   zradab_i    ! Radiation absorbed in the ice
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   zkappa_i    ! Kappa factor in the ice
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   zeta_i      ! Eta factor in the ice
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   zradtr_s    ! Radiation transmited through the snow
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   zradab_s    ! Radiation absorbed in the snow
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   zkappa_s    ! Kappa factor in the snow
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   zeta_s      ! Eta factor in the snow
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   zindterm    ! 'Ind'ependent term
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   zindtbis    ! Temporary 'ind'ependent term
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :)     ::   zdiagbis    ! Temporary 'dia'gonal term
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:, :, :)  ::   ztrid       ! Tridiagonal system terms
+#endif
+
+CONTAINS
+
+   INTEGER FUNCTION scice_alloc()
+      !!----------------------------------------------------------------------
+      !!                   ***  FUNCTION oce_alloc  ***
+      !!----------------------------------------------------------------------
+      INTEGER :: ierr(2)
+      !!----------------------------------------------------------------------
+      !
+      ierr(:) = 0
+#if defined key_si3
+      ALLOCATE(scr1i(jpi,jpj, jpl), scr2i(jpi,jpj, jpl), scr1D1i(jpij), scr1D2i(jpij), &
+               scr1D3i(jpij), scr1D4i(jpij),  scr1D5i(jpij), scr1D6i(jpij),            &
+               scr1D7i(jpij), scr1D8i(jpij),  scr1D9i(jpij), scr1D10i(jpij),           &
+               scr1D11i(jpij), scr1D12i(jpij), scr1D13i(jpij), iscr1D1i(jpij),         &
+               scr1ai(jpij,jpl), scr2ai(jpij,jpl), scr3i(jpi,jpj, jpl),                &
+               scr4i(jpi,jpj, jpl), scr5i(jpi,jpj, jpl), scr6i(jpi,jpj, jpl), STAT=ierr(1))
+      ALLOCATE(ztiold(jpij,nlay_i), ztsold(jpij,nlay_s), ztib(jpij,nlay_i), ztsb(jpij,nlay_s), &
+               ztcond_i(jpij,0:nlay_i), zradtr_i(jpij,0:nlay_i), zradab_i(jpij,0:nlay_i), &
+               zkappa_i(jpij,0:nlay_i), zeta_i(jpij,0:nlay_i), zradtr_s(jpij,0:nlay_s),   &
+               zradab_s(jpij,0:nlay_s), zkappa_s(jpij,0:nlay_s), zeta_s(jpij,0:nlay_s),   &
+               zindterm(jpij,nlay_i+3), zindtbis(jpij,nlay_i+3), zdiagbis(jpij,nlay_i+3), &
+               ztrid(jpij,nlay_i+3,3),  STAT=ierr(2))
+#endif
+      ! 
+      scice_alloc = MAXVAL( ierr )
+      IF( lk_mpp    )   CALL mpp_sum( scice_alloc )
+      IF( scice_alloc /= 0 )   CALL ctl_stop( 'STOP', 'sice_alloc: unable to allocate scratch ice arrays' )
+#if defined key_si3
+      scr1i(:, :, :) = 0.
+      scr2i(:,:, :)  = 0.
+      scr3i(:, :, :) = 0.
+      scr4i(:,:, :)  = 0.
+      scr1D1i(:)     = 0.
+      scr1D2i(:)     = 0.
+      scr1D3i(:)     = 0.
+      scr1D4i(:)     = 0.
+      scr1D5i(:)     = 0.
+      scr1D6i(:)     = 0.
+      scr1D7i(:)     = 0.
+      scr1D8i(:)     = 0.
+      scr1D9i(:)     = 0.
+      scr1D10i(:)    = 0.
+      scr1D11i(:)    = 0.
+      scr1D12i(:)    = 0.
+      scr1D13i(:)    = 0.
+      iscr1D1i(:)    = 0
+      scr1ai(:, :)   = 0.
+      scr2ai(:, :)   = 0.
+#endif 
+      !
+   END FUNCTION scice_alloc
+
+   !!======================================================================
+END MODULE scice 
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DIA/diahsb.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DIA/diahsb.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DIA/diahsb.F90	(revision 11467)
@@ -69,4 +69,5 @@
       !!
       !!---------------------------------------------------------------------------
+      USE scoce, ONLY : z2d0 => scr2D1, z2d1 => scr2D2, zwrk => scr1
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
       !
@@ -81,6 +82,4 @@
       REAL(wp)   ::   z_wn_trd_t , z_wn_trd_s     !    -     -
       REAL(wp)   ::   z_ssh_hc , z_ssh_sc         !    -     -
-      REAL(wp), DIMENSION(jpi,jpj)       ::   z2d0, z2d1   ! 2D workspace
-      REAL(wp), DIMENSION(jpi,jpj,jpkm1) ::   zwrk         ! 3D workspace
       !!---------------------------------------------------------------------------
       IF( ln_timing )   CALL timing_start('dia_hsb')      
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DOM/dommsk.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DOM/dommsk.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DOM/dommsk.F90	(revision 11467)
@@ -93,5 +93,5 @@
       INTEGER  ::   ijf, ijl       !   -       -
       INTEGER  ::   iktop, ikbot   !   -       -
-      INTEGER  ::   ios, inum
+      INTEGER  ::   ios
       !!
       INTEGER  :: inum             !  logical unit for shlat2d
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DOM/domvvl.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DOM/domvvl.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DOM/domvvl.F90	(revision 11467)
@@ -288,4 +288,7 @@
       !! Reference  : Leclair, M., and Madec, G. 2011, Ocean Modelling.
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zht => scr2D1, z_scale => scr2D2, &
+                       zwu => scr2D3, zwv=> scr2D4,      &
+                       zhdiv => scr2D5, ze3t => scr1
       INTEGER, INTENT( in )           ::   kt      ! time step
       INTEGER, INTENT( in ), OPTIONAL ::   kcall   ! optional argument indicating call sequence
@@ -295,6 +298,4 @@
       REAL(wp)               ::   z2dt, z_tmin, z_tmax  ! local scalars
       LOGICAL                ::   ll_do_bclinic         ! local logical
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zht, z_scale, zwu, zwv, zhdiv
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ze3t
       !!----------------------------------------------------------------------
       !
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynhpg.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynhpg.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynhpg.F90	(revision 11467)
@@ -272,9 +272,9 @@
       !! ** Action : - Update (ua,va) with the now hydrastatic pressure trend
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zhpi => scr1, zhpj => scr2
       INTEGER, INTENT(in) ::   kt    ! ocean time-step index
       !
       INTEGER  ::   ji, jj, jk       ! dummy loop indices
       REAL(wp) ::   zcoef0, zcoef1   ! temporary scalars
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  zhpi, zhpj
       !!----------------------------------------------------------------------
       !
@@ -332,4 +332,5 @@
       !! ** Action  : - Update (ua,va) with the now hydrastatic pressure trend
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zhpi => scr1, zhpj => scr2
       INTEGER, INTENT(in) ::   kt    ! ocean time-step index
       !!
@@ -337,5 +338,4 @@
       INTEGER  ::   iku, ikv                         ! temporary integers
       REAL(wp) ::   zcoef0, zcoef1, zcoef2, zcoef3   ! temporary scalars
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  zhpi, zhpj
       !!----------------------------------------------------------------------
       !
@@ -428,4 +428,6 @@
       !! ** Action : - Update (ua,va) with the now hydrastatic pressure trend
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zhpi => scr1, zhpj => scr2, &
+                       zcpx => scr2D1, zcpy => scr2D2   ! W/D pressure filter
       INTEGER, INTENT(in) ::   kt    ! ocean time-step index
       !!
@@ -433,9 +435,5 @@
       REAL(wp) ::   zcoef0, zuap, zvap, znad, ztmp       ! temporary scalars
       LOGICAL  ::   ll_tmp1, ll_tmp2                     ! local logical variables
-      REAL(wp), DIMENSION(jpi,jpj,jpk)      ::   zhpi, zhpj
-      REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   zcpx, zcpy   !W/D pressure filter
-      !!----------------------------------------------------------------------
-      !
-      IF( ln_wd_il ) ALLOCATE(zcpx(jpi,jpj), zcpy(jpi,jpj))
+      !!----------------------------------------------------------------------
       !
       IF( kt == nit000 ) THEN
@@ -551,6 +549,4 @@
       END DO
       !
-      IF( ln_wd_il )  DEALLOCATE( zcpx , zcpy )
-      !
    END SUBROUTINE hpg_sco
 
@@ -575,11 +571,12 @@
       !! ** Action : - Update (ua,va) with the now hydrastatic pressure trend
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zhpi => scr1, zhpj => scr2, &
+                       zrhdtop_oce => scr2D1,      &
+                       zts_top => scr3D1
       INTEGER, INTENT(in) ::   kt    ! ocean time-step index
       !!
       INTEGER  ::   ji, jj, jk, ikt, iktp1i, iktp1j   ! dummy loop indices
       REAL(wp) ::   zcoef0, zuap, zvap, znad          ! temporary scalars
-      REAL(wp), DIMENSION(jpi,jpj,jpk ) ::  zhpi, zhpj
-      REAL(wp), DIMENSION(jpi,jpj,jpts) ::  zts_top
-      REAL(wp), DIMENSION(jpi,jpj)      ::  zrhdtop_oce
+!     REAL(wp), DIMENSION(jpi,jpj,jpts) ::  zts_top
       !!----------------------------------------------------------------------
       !
@@ -669,4 +666,5 @@
       !! Reference: Shchepetkin and McWilliams, J. Geophys. Res., 108(C3), 3090, 2003
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zcpx => scr2D1, zcpy => scr2D2
       INTEGER, INTENT(in) ::   kt    ! ocean time-step index
       !!
@@ -680,9 +678,7 @@
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   drhox, drhoy, drhoz, drhou, drhov, drhow
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   rho_i, rho_j, rho_k
-      REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   zcpx, zcpy   !W/D pressure filter
       !!----------------------------------------------------------------------
       !
       IF( ln_wd_il ) THEN
-         ALLOCATE( zcpx(jpi,jpj) , zcpy(jpi,jpj) )
         DO jj = 2, jpjm1
            DO ji = 2, jpim1 
@@ -926,6 +922,4 @@
       END DO
       !
-      IF( ln_wd_il )   DEALLOCATE( zcpx, zcpy )
-      !
    END SUBROUTINE hpg_djc
 
@@ -942,4 +936,10 @@
       !! ** Action : - Update (ua,va) with the now hydrastatic pressure trend
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zdept => scr1, zrhh => scr2,                          &
+                       zhpi => scr3, zu => scr4, zv => scr5, fsp => scr6,    &
+                       xsp => scr7, asp => scr8, bsp => scr9,                &
+                       csp => scr10, dsp => scr11,                           &
+                       zsshu_n => scr2D1, zsshv_n => scr2D2, &
+                       zcpx => scr2D3, zcpy => scr2D4
       INTEGER, PARAMETER  :: polynomial_type = 1    ! 1: cubic spline, 2: linear
       INTEGER, INTENT(in) ::   kt                   ! ocean time-step index
@@ -954,8 +954,4 @@
       REAL(wp) :: zrhdt1
       REAL(wp) :: zdpdx1, zdpdx2, zdpdy1, zdpdy2
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdept, zrhh
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zhpi, zu, zv, fsp, xsp, asp, bsp, csp, dsp
-      REAL(wp), DIMENSION(jpi,jpj)   ::   zsshu_n, zsshv_n
-      REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   zcpx, zcpy   !W/D pressure filter
       !!----------------------------------------------------------------------
       !
@@ -972,5 +968,4 @@
 
       IF( ln_wd_il ) THEN
-         ALLOCATE( zcpx(jpi,jpj) , zcpy(jpi,jpj) )
          DO jj = 2, jpjm1
            DO ji = 2, jpim1 
@@ -1271,6 +1266,4 @@
       END DO
       !
-      IF( ln_wd_il )   DEALLOCATE( zcpx, zcpy )
-      !
    END SUBROUTINE hpg_prj
 
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynnxt.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynnxt.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynnxt.F90	(revision 11467)
@@ -92,4 +92,6 @@
       !!               un,vn   now horizontal velocity of next time-step
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zue => scr2D1, zve => scr2D2, &
+                       ze3u_f => scr1, ze3v_f => scr2, zua => scr3, zva => scr4
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
       !
@@ -98,11 +100,7 @@
       REAL(wp) ::   zue3a, zue3n, zue3b, zuf, zcoef    ! local scalars
       REAL(wp) ::   zve3a, zve3n, zve3b, zvf, z1_2dt   !   -      -
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   zue, zve
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ze3u_f, ze3v_f, zua, zva 
       !!----------------------------------------------------------------------
       !
       IF( ln_timing    )   CALL timing_start('dyn_nxt')
-      IF( ln_dynspg_ts )   ALLOCATE( zue(jpi,jpj)     , zve(jpi,jpj)     )
-      IF( l_trddyn     )   ALLOCATE( zua(jpi,jpj,jpk) , zva(jpi,jpj,jpk) )
       !
       IF( kt == nit000 ) THEN
@@ -275,5 +273,4 @@
             ELSE                          ! Asselin filter applied on thickness weighted velocity
                !
-               ALLOCATE( ze3u_f(jpi,jpj,jpk) , ze3v_f(jpi,jpj,jpk) )
                ! Before filtered scale factor at (u/v)-points stored in ze3u_f, ze3v_f
                CALL dom_vvl_interpol( e3t_b(:,:,:), ze3u_f, 'U' )
@@ -302,5 +299,4 @@
                e3v_b(:,:,1:jpkm1) = ze3v_f(:,:,1:jpkm1)
                !
-               DEALLOCATE( ze3u_f , ze3v_f )
             ENDIF
             !
@@ -368,6 +364,4 @@
          &                       tab3d_2=vn, clinfo2=' Vn: '       , mask2=vmask )
       ! 
-      IF( ln_dynspg_ts )   DEALLOCATE( zue, zve )
-      IF( l_trddyn     )   DEALLOCATE( zua, zva )
       IF( ln_timing    )   CALL timing_stop('dyn_nxt')
       !
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynspg.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynspg.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynspg.F90	(revision 11467)
@@ -71,10 +71,9 @@
       !!             period is used to prevent the divergence of odd and even time step.
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zpice => scr2D1, ztrdu => scr1, ztrdv => scr2
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
       !
       INTEGER  ::   ji, jj, jk                   ! dummy loop indices
       REAL(wp) ::   z2dt, zg_2, zintp, zgrau0r, zld   ! local scalars
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   zpice
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdu, ztrdv
       !!----------------------------------------------------------------------
       !
@@ -82,5 +81,4 @@
       !
       IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends
-         ALLOCATE( ztrdu(jpi,jpj,jpk) , ztrdv(jpi,jpj,jpk) ) 
          ztrdu(:,:,:) = ua(:,:,:)
          ztrdv(:,:,:) = va(:,:,:)
@@ -134,5 +132,4 @@
          !
          IF( ln_ice_embd ) THEN              !== embedded sea ice: Pressure gradient due to snow-ice mass ==!
-            ALLOCATE( zpice(jpi,jpj) )
             zintp = REAL( MOD( kt-1, nn_fsbc ) ) / REAL( nn_fsbc )
             zgrau0r     = - grav * r1_rau0
@@ -144,5 +141,4 @@
                END DO
             END DO
-            DEALLOCATE( zpice )         
          ENDIF
          !
@@ -169,5 +165,4 @@
          ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
          CALL trd_dyn( ztrdu, ztrdv, jpdyn_spg, kt )
-         DEALLOCATE( ztrdu , ztrdv ) 
       ENDIF
       !                                      ! print mean trends (used for debugging)
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynvor.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynvor.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynvor.F90	(revision 11467)
@@ -205,4 +205,5 @@
       !! ** Action : - Update (ua,va) with the now vorticity term trend
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zwx => scr2D1, zwy => scr2D2, zwz  => scr2D3, zwt => scr2D4
       INTEGER                         , INTENT(in   ) ::   kt               ! ocean time-step index
       INTEGER                         , INTENT(in   ) ::   kvor             ! total, planetary, relative, or metric
@@ -212,5 +213,4 @@
       INTEGER  ::   ji, jj, jk           ! dummy loop indices
       REAL(wp) ::   zx1, zy1, zx2, zy2   ! local scalars
-      REAL(wp), DIMENSION(jpi,jpj) ::   zwx, zwy, zwz, zwt   ! 2D workspace
       !!----------------------------------------------------------------------
       !
@@ -327,4 +327,5 @@
       !! References : Sadourny, r., 1975, j. atmos. sciences, 32, 680-689.
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zwx => scr2D1, zwy => scr2D2, zwz => scr2D3
       INTEGER                         , INTENT(in   ) ::   kt          ! ocean time-step index
       INTEGER                         , INTENT(in   ) ::   kvor        ! total, planetary, relative, or metric
@@ -334,5 +335,4 @@
       INTEGER  ::   ji, jj, jk           ! dummy loop indices
       REAL(wp) ::   zx1, zy1, zx2, zy2   ! local scalars
-      REAL(wp), DIMENSION(jpi,jpj) ::   zwx, zwy, zwz   ! 2D workspace
       !!----------------------------------------------------------------------
       !
@@ -435,4 +435,6 @@
       !! References : Sadourny, r., 1975, j. atmos. sciences, 32, 680-689.
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zwx => scr2D1, zwy => scr2D2, &
+                       zwz => scr2D3, zww => scr2D4    ! 2D workspace
       INTEGER                         , INTENT(in   ) ::   kt          ! ocean time-step index
       INTEGER                         , INTENT(in   ) ::   kvor        ! total, planetary, relative, or metric
@@ -442,5 +444,4 @@
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
       REAL(wp) ::   zuav, zvau   ! local scalars
-      REAL(wp), DIMENSION(jpi,jpj) ::   zwx, zwy, zwz, zww   ! 2D workspace
       !!----------------------------------------------------------------------
       !
@@ -539,4 +540,6 @@
       !! References : Arakawa and Lamb 1980, Mon. Wea. Rev., 109, 18-36
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zwx => scr2D1, zwy => scr2D2, zwz => scr2D3, z1_e3f => scr2D4, &
+                       ztnw => scr2D5, ztne => scr2D6, ztsw => scr2D7, ztse => scr2D8
       INTEGER                         , INTENT(in   ) ::   kt          ! ocean time-step index
       INTEGER                         , INTENT(in   ) ::   kvor        ! total, planetary, relative, or metric
@@ -548,6 +551,4 @@
       REAL(wp) ::   zua, zva     ! local scalars
       REAL(wp) ::   zmsk, ze3f   ! local scalars
-      REAL(wp), DIMENSION(jpi,jpj) ::   zwx , zwy , zwz , z1_e3f
-      REAL(wp), DIMENSION(jpi,jpj) ::   ztnw, ztne, ztsw, ztse
       !!----------------------------------------------------------------------
       !
@@ -692,4 +693,6 @@
       !! References : Arakawa and Lamb 1980, Mon. Wea. Rev., 109, 18-36
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zwx => scr2D1, zwy => scr2D2, zwz => scr2D3, z1_e3f => scr2D4, &
+                       ztnw => scr2D1, ztne => scr2D2, ztsw => scr2D3, ztse => scr2D4
       INTEGER                         , INTENT(in   ) ::   kt          ! ocean time-step index
       INTEGER                         , INTENT(in   ) ::   kvor        ! total, planetary, relative, or metric
@@ -701,6 +704,4 @@
       REAL(wp) ::   zua, zva       ! local scalars
       REAL(wp) ::   zmsk, z1_e3t   ! local scalars
-      REAL(wp), DIMENSION(jpi,jpj) ::   zwx , zwy , zwz
-      REAL(wp), DIMENSION(jpi,jpj) ::   ztnw, ztne, ztsw, ztse
       !!----------------------------------------------------------------------
       !
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynzdf.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynzdf.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/dynzdf.F90	(revision 11467)
@@ -65,4 +65,6 @@
       !! ** Action :   (ua,va)   after velocity 
       !!---------------------------------------------------------------------
+      USE scoce, ONLY : zwi => scr1, zwd => scr2, zws => scr3, &    ! 3D workspace
+                       ztrdu => scr3 , ztrdv => scr4
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
       !
@@ -71,6 +73,4 @@
       REAL(wp) ::   zzwi, ze3ua, zdt   ! local scalars
       REAL(wp) ::   zzws, ze3va        !   -      -
-      REAL(wp), DIMENSION(jpi,jpj,jpk)        ::  zwi, zwd, zws   ! 3D workspace 
-      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdu, ztrdv   !  -      -
       !!---------------------------------------------------------------------
       !
@@ -96,5 +96,4 @@
       !
       IF( l_trddyn )   THEN         !* temporary save of ta and sa trends
-         ALLOCATE( ztrdu(jpi,jpj,jpk), ztrdv(jpi,jpj,jpk) ) 
          ztrdu(:,:,:) = ua(:,:,:)
          ztrdv(:,:,:) = va(:,:,:)
@@ -391,5 +390,4 @@
          ztrdv(:,:,:) = ( va(:,:,:) - vb(:,:,:) ) / r2dt - ztrdv(:,:,:)
          CALL trd_dyn( ztrdu, ztrdv, jpdyn_zdf, kt )
-         DEALLOCATE( ztrdu, ztrdv ) 
       ENDIF
       !                                          ! print mean trends (used for debugging)
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/sshwzv.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/sshwzv.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/DYN/sshwzv.F90	(revision 11467)
@@ -66,9 +66,9 @@
       !! Reference  : Leclair, M., and G. Madec, 2009, Ocean Modelling.
       !!----------------------------------------------------------------------
+      use scoce, ONLY : zhdiv => scr2D1
       INTEGER, INTENT(in) ::   kt   ! time step
       ! 
       INTEGER  ::   jk            ! dummy loop indice
       REAL(wp) ::   z2dt, zcoef   ! local scalars
-      REAL(wp), DIMENSION(jpi,jpj) ::   zhdiv   ! 2D workspace
       !!----------------------------------------------------------------------
       !
@@ -140,9 +140,9 @@
       !! Reference  : Leclair, M., and G. Madec, 2009, Ocean Modelling.
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zhdiv => scr1
       INTEGER, INTENT(in) ::   kt   ! time step
       !
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
       REAL(wp) ::   z1_2dt       ! local scalars
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zhdiv
       !!----------------------------------------------------------------------
       !
@@ -163,5 +163,4 @@
       !
       IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN      ! z_tilde and layer cases
-         ALLOCATE( zhdiv(jpi,jpj,jpk) ) 
          !
          DO jk = 1, jpkm1
@@ -183,5 +182,4 @@
          END DO
          !          IF( ln_vvl_layer ) wn(:,:,:) = 0.e0
-         DEALLOCATE( zhdiv ) 
       ELSE   ! z_star and linear free surface cases
          DO jk = jpkm1, 1, -1                       ! integrate from the bottom the hor. divergence
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/LDF/ldfslp.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/LDF/ldfslp.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/LDF/ldfslp.F90	(revision 11467)
@@ -106,4 +106,7 @@
       !!               of now neutral surfaces at u-, w- and v- w-points, resp.
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zslpml_hmlpu => scr2D1, zslpml_hmlpv => scr2D2, &
+                       zgru => scr1, zwz => scr2, zdzr => scr3, &
+                       zgrv => scr4, zww => scr5
       INTEGER , INTENT(in)                   ::   kt    ! ocean time-step index
       REAL(wp), INTENT(in), DIMENSION(:,:,:) ::   prd   ! in situ density
@@ -118,7 +121,4 @@
       REAL(wp) ::   zck, zfk,      zbw             !   -      -
       REAL(wp) ::   zdepu, zdepv                   !   -      -
-      REAL(wp), DIMENSION(jpi,jpj)     ::  zslpml_hmlpu, zslpml_hmlpv
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  zgru, zwz, zdzr
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  zgrv, zww
       !!----------------------------------------------------------------------
       !
@@ -389,4 +389,5 @@
       !!             - wslp2              squared slope of neutral surfaces at w-points.
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : z1_mlbw => scr2D1, zalbet => scr1
       INTEGER, INTENT( in ) ::   kt             ! ocean time-step index
       !!
@@ -401,6 +402,4 @@
       REAL(wp) ::   zdzrho_raw
       REAL(wp) ::   zbeta0, ze3_e1, ze3_e2
-      REAL(wp), DIMENSION(jpi,jpj)     ::   z1_mlbw
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zalbet
       REAL(wp), DIMENSION(jpi,jpj,jpk,0:1) ::   zdxrho , zdyrho, zdzrho     ! Horizontal and vertical density gradients
       REAL(wp), DIMENSION(jpi,jpj,0:1,0:1) ::   zti_mlb, ztj_mlb            ! for Griffies operator only
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/traadv.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/traadv.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/traadv.F90	(revision 11467)
@@ -83,9 +83,9 @@
       !! ** Method  : - Update (ua,va) with the advection term following nadv
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zun => scr1, zvn => scr2, zwn => scr3, &  ! 3D workspace
+                       ztrdt => scr4, ztrds => scr5
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
       !
       INTEGER ::   jk   ! dummy loop index
-      REAL(wp), DIMENSION(jpi,jpj,jpk)        :: zun, zvn, zwn   ! 3D workspace
-      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdt, ztrds
       !!----------------------------------------------------------------------
       !
@@ -138,5 +138,4 @@
       !
       IF( l_trdtra )   THEN                    !* Save ta and sa trends
-         ALLOCATE( ztrdt(jpi,jpj,jpk), ztrds(jpi,jpj,jpk) )
          ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
          ztrds(:,:,:) = tsa(:,:,:,jp_sal)
@@ -165,5 +164,4 @@
          CALL trd_tra( kt, 'TRA', jp_tem, jptra_totad, ztrdt )
          CALL trd_tra( kt, 'TRA', jp_sal, jptra_totad, ztrds )
-         DEALLOCATE( ztrdt, ztrds )
       ENDIF
       !                                              ! print mean trends (used for debugging)
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/tranxt.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/tranxt.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/tranxt.F90	(revision 11467)
@@ -86,9 +86,9 @@
       !! ** Action  : - tsb & tsn ready for the next time step
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : ztrdt => scr1, ztrds => scr2 
       INTEGER, INTENT(in) ::   kt    ! ocean time-step index
       !!
       INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
       REAL(wp) ::   zfact            ! local scalars
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdt, ztrds
       !!----------------------------------------------------------------------
       !
@@ -118,5 +118,4 @@
       ! trends computation initialisation
       IF( l_trdtra )   THEN                    
-         ALLOCATE( ztrdt(jpi,jpj,jpk) , ztrds(jpi,jpj,jpk) )
          ztrdt(:,:,jpk) = 0._wp
          ztrds(:,:,jpk) = 0._wp
@@ -178,5 +177,4 @@
          CALL trd_tra( kt, 'TRA', jp_sal, jptra_atf, ztrds )
       END IF
-      IF( l_trdtra )   DEALLOCATE( ztrdt , ztrds )
       !
       !                        ! control print
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/traqsr.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/traqsr.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/traqsr.F90	(revision 11467)
@@ -101,4 +101,7 @@
       !!              Morel, A. et Berthon, JF, 1989, Limnol Oceanogr 34(8), 1545-1562
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zekb => scr2D1, zekg => scr2D2, zekr => scr2D3, &
+                       ze0 => scr1, ze1 => scr2, ze2 => scr3, ze3 => scr4, zea => scr5, ztrdt => scr6, &
+                       zetot => scr7, zchl3d => scr8 
       INTEGER, INTENT(in) ::   kt     ! ocean time-step
       !
@@ -111,7 +114,4 @@
       REAL(wp) ::   zCb, zCmax, zze, zpsi, zpsimax, zdelpsi, zCtot, zCze
       REAL(wp) ::   zlogc, zlogc2, zlogc3 
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   :: zekb, zekg, zekr
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ze0, ze1, ze2, ze3, zea, ztrdt
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zetot, zchl3d
       !!----------------------------------------------------------------------
       !
@@ -125,5 +125,4 @@
       !
       IF( l_trdtra ) THEN      ! trends diagnostic: save the input temperature trend
-         ALLOCATE( ztrdt(jpi,jpj,jpk) ) 
          ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
       ENDIF
@@ -158,8 +157,4 @@
          !
       CASE( np_RGB , np_RGBc )         !==  R-G-B fluxes  ==!
-         !
-         ALLOCATE( zekb(jpi,jpj)     , zekg(jpi,jpj)     , zekr  (jpi,jpj)     , &
-            &      ze0 (jpi,jpj,jpk) , ze1 (jpi,jpj,jpk) , ze2   (jpi,jpj,jpk) , &
-            &      ze3 (jpi,jpj,jpk) , zea (jpi,jpj,jpk) , zchl3d(jpi,jpj,jpk)   ) 
          !
          IF( nqsr == np_RGBc ) THEN          !*  Variable Chlorophyll
@@ -239,6 +234,4 @@
          END DO
          !
-         DEALLOCATE( zekb , zekg , zekr , ze0 , ze1 , ze2 , ze3 , zea , zchl3d ) 
-         !
       CASE( np_2BD  )            !==  2-bands fluxes  ==!
          !
@@ -278,5 +271,4 @@
       !
       IF( iom_use('qsr3d') ) THEN      ! output the shortwave Radiation distribution
-         ALLOCATE( zetot(jpi,jpj,jpk) )
          zetot(:,:,nksr+1:jpk) = 0._wp     ! below ~400m set to zero
          DO jk = nksr, 1, -1
@@ -284,5 +276,4 @@
          END DO         
          CALL iom_put( 'qsr3d', zetot )   ! 3D distribution of shortwave Radiation
-         DEALLOCATE( zetot ) 
       ENDIF
       !
@@ -297,5 +288,4 @@
          ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:)
          CALL trd_tra( kt, 'TRA', jp_tem, jptra_qsr, ztrdt )
-         DEALLOCATE( ztrdt ) 
       ENDIF
       !                       ! print mean trends (used for debugging)
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/trasbc.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/trasbc.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/TRA/trasbc.F90	(revision 11467)
@@ -73,4 +73,5 @@
       !!              - send trends to trdtra module for further diagnostics(l_trdtra=T)
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : ztrdt => scr1, ztrds => scr2
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
       !
@@ -78,5 +79,4 @@
       INTEGER  ::   ikt, ikb                    ! local integers
       REAL(wp) ::   zfact, z1_e3t, zdep, ztim   ! local scalar
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::  ztrdt, ztrds
       !!----------------------------------------------------------------------
       !
@@ -90,5 +90,4 @@
       !
       IF( l_trdtra ) THEN                    !* Save ta and sa trends
-         ALLOCATE( ztrdt(jpi,jpj,jpk) , ztrds(jpi,jpj,jpk) ) 
          ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
          ztrds(:,:,:) = tsa(:,:,:,jp_sal)
@@ -276,5 +275,4 @@
          CALL trd_tra( kt, 'TRA', jp_tem, jptra_nsr, ztrdt )
          CALL trd_tra( kt, 'TRA', jp_sal, jptra_nsr, ztrds )
-         DEALLOCATE( ztrdt , ztrds ) 
       ENDIF
       !
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/ZDF/zdfmxl.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/ZDF/zdfmxl.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/ZDF/zdfmxl.F90	(revision 11467)
@@ -86,4 +86,5 @@
       !! ** Action  :   nmln, hmld, hmlp, hmlpt
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : imld => iscr2D1
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
       !
@@ -91,5 +92,4 @@
       INTEGER  ::   iikn, iiki, ikt ! local integer
       REAL(wp) ::   zN2_c           ! local scalar
-      INTEGER, DIMENSION(jpi,jpj) ::   imld   ! 2D workspace
       !!----------------------------------------------------------------------
       !
@@ -177,5 +177,15 @@
       ! 
       !!----------------------------------------------------------------------------------- 
-
+      USE scoce, ONLY : ikmt => iscr2D1,   &    ! number of active tracer levels
+                       ik_ref => iscr2D2, &    ! index of reference level
+                       ik_iso => iscr2D3, &    ! index of last uniform temp level
+                       zT => scr1,        &    ! Temperature or density      
+                       ppzdep => scr2D1,  &    ! depth for use in calculating d(rho)
+                       zT_ref => scr2D2,  &    ! reference temperature
+                       zdTdz => scr2,     &    ! gradient of zT
+                       zmoddT => scr3,    &    ! Absolute temperature difference
+                       zdelta_T => scr2D3,&    ! difference critereon
+                       zRHO1 => scr2D4,   &    ! Densities
+                       zRHO2 => scr2D5         ! Densities
       TYPE(MXL_ZINT), INTENT(in)  :: sf
 
@@ -188,17 +198,7 @@
       ! Local variables
       REAL(wp), PARAMETER :: zepsilon = 1.e-30          ! local small value
-      INTEGER, DIMENSION(jpi,jpj) :: ikmt          ! number of active tracer levels 
-      INTEGER, DIMENSION(jpi,jpj) :: ik_ref        ! index of reference level 
-      INTEGER, DIMENSION(jpi,jpj) :: ik_iso        ! index of last uniform temp level 
-      REAL, DIMENSION(jpi,jpj,jpk)  :: zT            ! Temperature or density 
-      REAL, DIMENSION(jpi,jpj)    :: ppzdep        ! depth for use in calculating d(rho) 
-      REAL, DIMENSION(jpi,jpj)    :: zT_ref        ! reference temperature 
       REAL    :: zT_b                                   ! base temperature 
-      REAL, DIMENSION(jpi,jpj,jpk)  :: zdTdz         ! gradient of zT 
-      REAL, DIMENSION(jpi,jpj,jpk)  :: zmoddT        ! Absolute temperature difference 
       REAL    :: zdz                                    ! depth difference 
       REAL    :: zdT                                    ! temperature difference 
-      REAL, DIMENSION(jpi,jpj)    :: zdelta_T      ! difference critereon 
-      REAL, DIMENSION(jpi,jpj)    :: zRHO1, zRHO2  ! Densities 
       INTEGER :: ji, jj, jk                             ! loop counter 
 
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/ZDF/zdfphy.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/ZDF/zdfphy.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/ZDF/zdfphy.F90	(revision 11467)
@@ -225,8 +225,8 @@
       !!                bottom stress.....                               <<<<====verifier !
       !!----------------------------------------------------------------------
+      USE scoce, ONLY : zsh2 => scr1   ! shear production
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
       !
       INTEGER ::   ji, jj, jk   ! dummy loop indice
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zsh2   ! shear production
       !! ---------------------------------------------------------------------
       !
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/nemogcm.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/nemogcm.F90	(revision 11069)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/nemogcm.F90	(revision 11467)
@@ -92,4 +92,5 @@
    USE agrif_all_update   ! Master Agrif update
 #endif
+   USE scoce, ONLY : scoce_alloc ! scratch arrays
 
    IMPLICIT NONE
@@ -607,4 +608,5 @@
       ierr = ierr + trc_oce_alloc()    ! shared TRC / TRA arrays
       ierr = ierr + bdy_oce_alloc()    ! bdy masks (incl. initialization)
+      ierr = ierr + scoce_alloc()       ! scratch arrays
       !
 #if defined key_diadct 
Index: NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/scoce.F90
===================================================================
--- NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/scoce.F90	(revision 11467)
+++ NEMO/branches/UKMO/dev_r10037_GPU/src/OCE/scoce.F90	(revision 11467)
@@ -0,0 +1,100 @@
+MODULE scoce
+   !!======================================================================
+   !!                      ***  MODULE  oce  ***
+   !! Ocean        :  dynamics and active tracers defined in memory 
+   !!======================================================================
+   !! History :  1.0  !  2002-11  (G. Madec)  F90: Free form and module
+   !!            3.1  !  2009-02  (G. Madec, M. Leclair)  pure z*
+   !coordinate
+   !!            3.3  !  2010-09  (C. Ethe) TRA-TRC merge: add ts, gtsu,
+   !gtsv 4D arrays
+   !!            3.7  !  2014-01  (G. Madec) suppression of curl and
+   !before hdiv from in-core memory
+   !!----------------------------------------------------------------------
+   USE par_oce        ! ocean parameters
+   USE lib_mpp        ! MPP library
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC scoce_alloc ! routine called by nemo_init in nemogcm.F90
+
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:,:,:) :: scr1, scr2, scr3, &      !: scratch 3D arrays
+                                                            scr4, scr5, scr6, &
+                                                            scr7, scr8, scr9, &
+                                                            scr10, scr11
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:,:,:) :: scr3D1                     !: scratch 3D arrays
+   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:,:) ::   scr2D1, scr2D2, scr2D3, scr2D4, scr2D5, & !: scratch 2D arrays
+                                                            scr2D6, scr2D7, scr2D8, scr2D9, scr2D10, scr2D11, &
+                                                            scr2D12, scr2D13, scr2D14, scr2D15, scr2D16, scr2D17, &
+                                                            scr2D18, scr2D19, scr2D20, scr2D21, scr2D22, scr2D23, &
+                                                            scr2D24, scr2D25, scr2D26, scr2D27, scr2D28, scr2D29, &
+                                                            scr2D30, scr2D31, scr2D32, scr2D33, scr2D34, scr2D35, &
+                                                            scr2D36, scr2D37, scr2D38
+   INTEGER,  PUBLIC, ALLOCATABLE,       DIMENSION(:,:) ::   iscr2D1, iscr2D2, iscr2D3  !: integer scratch 2D arrays
+
+CONTAINS
+
+   INTEGER FUNCTION scoce_alloc()
+      !!----------------------------------------------------------------------
+      !!                   ***  FUNCTION oce_alloc  ***
+      !!----------------------------------------------------------------------
+      INTEGER :: ierr(3)
+      !!----------------------------------------------------------------------
+      !
+      ierr(:) = 0
+      ALLOCATE(scr1(jpi,jpj,jpk), scr2(jpi,jpj,jpk), scr3(jpi,jpj,jpk), scr4(jpi,jpj,jpk), scr5(jpi,jpj,jpk), &
+               scr6(jpi,jpj,jpk), scr7(jpi,jpj,jpk), scr8(jpi,jpj,jpk), scr9(jpi,jpj,jpk), scr10(jpi,jpj,jpk), &
+               scr11(jpi,jpj,jpk), STAT=ierr(1))
+      ALLOCATE(scr2D1(jpi,jpj), scr2D2(jpi,jpj), scr2D3(jpi,jpj), scr2D4(jpi,jpj), scr2D5(jpi,jpj), &
+               scr2D6(jpi,jpj), scr2D7(jpi,jpj), scr2D8(jpi,jpj), scr2D9(jpi,jpj), scr2D10(jpi,jpj),&
+               scr2D11(jpi,jpj), scr2D12(jpi,jpj), scr2D13(jpi,jpj), scr2D14(jpi,jpj), scr2D15(jpi,jpj),&
+               scr2D16(jpi,jpj), scr2D17(jpi,jpj), scr2D18(jpi,jpj), scr2D19(jpi,jpj), scr2D20(jpi,jpj),&
+               scr2D21(jpi,jpj), scr2D22(jpi,jpj), scr2D23(jpi,jpj), scr2D24(jpi,jpj), scr2D25(jpi,jpj),&
+               scr2D26(jpi,jpj), scr2D27(jpi,jpj), scr2D28(jpi,jpj), scr2D29(jpi,jpj), scr2D30(jpi,jpj),&
+               scr2D31(jpi,jpj), scr2D32(jpi,jpj), scr2D33(jpi,jpj), scr2D34(jpi,jpj), scr2D35(jpi,jpj),&
+               scr2D36(jpi,jpj), scr2D37(jpi,jpj), scr2D38(jpi,jpj),                                    &
+               scr3D1(jpi,jpj, jpts), STAT=ierr(2))
+      ALLOCATE(iscr2D1(jpi,jpj), iscr2D2(jpi,jpj), iscr2D3(jpi,jpj), STAT=ierr(3))
+      ! 
+      scoce_alloc = MAXVAL( ierr )
+      IF( lk_mpp    )   CALL mpp_sum( scoce_alloc )
+      IF( scoce_alloc /= 0 )   CALL ctl_stop( 'STOP', 'nemo_alloc: unable to allocate scratch ocean arrays' )
+      scr1(:, :, :)  = 0.
+      scr2(:, :, :)  = 0.
+      scr3(:, :, :)  = 0.
+      scr4(:, :, :)  = 0.
+      scr5(:, :, :)  = 0.
+      scr6(:, :, :)  = 0.
+      scr7(:, :, :)  = 0.
+      scr8(:, :, :)  = 0.
+      scr9(:, :, :)  = 0.
+      scr10(:, :, :) = 0.
+      scr11(:, :, :) = 0.
+      scr3D1(:, :, :)= 0.
+      scr2D1(:, :)   = 0.
+      scr2D2(:, :)   = 0.
+      scr2D3(:, :)   = 0.
+      scr2D4(:, :)   = 0.
+      scr2D5(:, :)   = 0.
+      scr2D6(:, :)   = 0.
+      scr2D7(:, :)   = 0.
+      scr2D8(:, :)   = 0.
+      scr2D9(:, :)   = 0.
+      scr2D10(:, :)  = 0.
+      scr2D11(:, :)   = 0.
+      scr2D12(:, :)   = 0.
+      scr2D13(:, :)   = 0.
+      scr2D14(:, :)   = 0.
+      scr2D15(:, :)   = 0.
+      scr2D16(:, :)   = 0.
+      scr2D17(:, :)   = 0.
+      scr2D18(:, :)   = 0.
+      scr2D19(:, :)  = 0.
+      iscr2D1(:, :)  = 0
+      iscr2D2(:, :)  = 0
+      iscr2D3(:, :)  = 0
+      !
+   END FUNCTION scoce_alloc
+
+   !!======================================================================
+END MODULE scoce 
