Index: trunk/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90
===================================================================
--- trunk/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90	(revision 7698)
+++ trunk/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90	(revision 7753)
@@ -86,5 +86,5 @@
       REAL(wp), POINTER, DIMENSION(:,:)   :: zts_u_ini, zht_s_ini, zsm_i_ini, ztm_i_ini !data from namelist or nc file
       REAL(wp), POINTER, DIMENSION(:,:,:) :: zh_i_ini, za_i_ini                         !data by cattegories to fill
-      INTEGER , DIMENSION(4)     :: itest
+      INTEGER , POINTER, DIMENSION(:)     :: itest
       !--------------------------------------------------------------------
 
@@ -92,4 +92,5 @@
       CALL wrk_alloc( jpi, jpj,      zht_i_ini, zat_i_ini, zvt_i_ini, zts_u_ini, zht_s_ini, zsm_i_ini, ztm_i_ini )
       CALL wrk_alloc( jpi, jpj,      zswitch )
+      Call wrk_alloc( 4,             itest )
 
       IF(lwp) WRITE(numout,*)
@@ -105,21 +106,11 @@
       ! init surface temperature
       DO jl = 1, jpl
-!$OMP PARALLEL DO schedule(static) private(jj,ji)
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               t_su  (ji,jj,jl) = rt0 * tmask(ji,jj,1)
-               tn_ice(ji,jj,jl) = rt0 * tmask(ji,jj,1)
-            END DO
-         END DO
+         t_su  (:,:,jl) = rt0 * tmask(:,:,1)
+         tn_ice(:,:,jl) = rt0 * tmask(:,:,1)
       END DO
 
       ! init basal temperature (considered at freezing point)
       CALL eos_fzp( sss_m(:,:), t_bo(:,:) )
-!$OMP PARALLEL DO schedule(static) private(jj,ji)
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            t_bo(ji,jj) = ( t_bo(ji,jj) + rt0 ) * tmask(ji,jj,1) 
-         END DO
-      END DO
+      t_bo(:,:) = ( t_bo(:,:) + rt0 ) * tmask(:,:,1) 
 
 
@@ -131,20 +122,15 @@
          IF( ln_limini_file )THEN
          !
-!$OMP PARALLEL DO schedule(static) private(jj,ji)
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zht_i_ini(ji,jj)  = si(jp_hti)%fnow(ji,jj,1)
-                  zht_s_ini(ji,jj)  = si(jp_hts)%fnow(ji,jj,1)
-                  zat_i_ini(ji,jj)  = si(jp_ati)%fnow(ji,jj,1)
-                  zts_u_ini(ji,jj)  = si(jp_tsu)%fnow(ji,jj,1)
-                  ztm_i_ini(ji,jj)  = si(jp_tmi)%fnow(ji,jj,1)
-                  zsm_i_ini(ji,jj)  = si(jp_smi)%fnow(ji,jj,1)
-                  !
-                  IF  ( zat_i_ini(ji,jj) > 0._wp ) THEN ; zswitch(ji,jj) = tmask(ji,jj,1) 
-                  ELSE                                ; zswitch(ji,jj) = 0._wp
-                  END IF
-               END DO
-            END DO
-         !
+            zht_i_ini(:,:)  = si(jp_hti)%fnow(:,:,1)
+            zht_s_ini(:,:)  = si(jp_hts)%fnow(:,:,1)
+            zat_i_ini(:,:)  = si(jp_ati)%fnow(:,:,1)
+            zts_u_ini(:,:)  = si(jp_tsu)%fnow(:,:,1)
+            ztm_i_ini(:,:)  = si(jp_tmi)%fnow(:,:,1)
+            zsm_i_ini(:,:)  = si(jp_smi)%fnow(:,:,1)
+            !
+            WHERE( zat_i_ini(:,:) > 0._wp ) ; zswitch(:,:) = tmask(:,:,1) 
+            ELSEWHERE                       ; zswitch(:,:) = 0._wp
+            END WHERE
+            !
          ELSE ! ln_limini_file = F
 
@@ -153,15 +139,7 @@
             !--------------------------------------------------------------------
             ! no ice if sst <= t-freez + ttest
-!$OMP PARALLEL
-!$OMP DO schedule(static) private(jj,ji)
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  IF ( ( sst_m(ji,jj) - (t_bo(ji,jj) - rt0) ) * tmask(ji,jj,1) >= rn_thres_sst ) THEN
-                     zswitch(ji,jj) = 0._wp 
-                  ELSE
-                     zswitch(ji,jj) = tmask(ji,jj,1)
-                  END IF
-               END DO
-            END DO
+            WHERE( ( sst_m(:,:) - (t_bo(:,:) - rt0) ) * tmask(:,:,1) >= rn_thres_sst ) ; zswitch(:,:) = 0._wp 
+            ELSEWHERE                                                                  ; zswitch(:,:) = tmask(:,:,1)
+            END WHERE
 
             !-----------------------------
@@ -169,5 +147,4 @@
             !-----------------------------
             ! assign initial thickness, concentration, snow depth and salinity to an hemisphere-dependent array
-!$OMP DO schedule(static) private(jj,ji)
             DO jj = 1, jpj
                DO ji = 1, jpi
@@ -189,15 +166,8 @@
                END DO
             END DO
-!$OMP END PARALLEL
             !
          ENDIF ! ln_limini_file
          
-!$OMP PARALLEL
-!$OMP DO schedule(static) private(jj,ji)
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zvt_i_ini(ji,jj) = zht_i_ini(ji,jj) * zat_i_ini(ji,jj)   ! ice volume
-            END DO
-         END DO
+         zvt_i_ini(:,:) = zht_i_ini(:,:) * zat_i_ini(:,:)   ! ice volume
          !---------------------------------------------------------------------
          ! 3.2) Distribute ice concentration and thickness into the categories
@@ -206,15 +176,7 @@
          ! then we check whether the distribution fullfills
          ! volume and area conservation, positivity and ice categories bounds
-         DO jl = 1, jpl
-!$OMP DO schedule(static) private(jj,ji)
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zh_i_ini(ji,jj,jl) = 0._wp 
-                  za_i_ini(ji,jj,jl) = 0._wp
-               END DO
-            END DO
-         END DO
+         zh_i_ini(:,:,:) = 0._wp 
+         za_i_ini(:,:,:) = 0._wp
          !
-!$OMP DO schedule(static) private(jj,ji,jl0,jl,i_fill,zarg,zV,zdv,zconv,itest)
          DO jj = 1, jpj
             DO ji = 1, jpi
@@ -327,5 +289,4 @@
             END DO   
          END DO   
-!$OMP END PARALLEL
 
          !---------------------------------------------------------------------
@@ -335,5 +296,4 @@
          ! Ice concentration, thickness and volume, ice salinity, ice age, surface temperature
          DO jl = 1, jpl ! loop over categories
-!$OMP PARALLEL DO schedule(static) private(jj,ji)
             DO jj = 1, jpj
                DO ji = 1, jpi
@@ -373,9 +333,7 @@
          ENDIF
             
-!$OMP PARALLEL
          ! Snow temperature and heat content
          DO jk = 1, nlay_s
             DO jl = 1, jpl ! loop over categories
-!$OMP DO schedule(static) private(jj,ji)
                DO jj = 1, jpj
                   DO ji = 1, jpi
@@ -394,5 +352,4 @@
          DO jk = 1, nlay_i
             DO jl = 1, jpl ! loop over categories
-!$OMP DO schedule(static) private(jj,ji)
                DO jj = 1, jpj
                   DO ji = 1, jpi
@@ -413,163 +370,78 @@
          END DO
 
+         tn_ice (:,:,:) = t_su (:,:,:)
+
+      ELSE ! if ln_limini=false
+         a_i  (:,:,:) = 0._wp
+         v_i  (:,:,:) = 0._wp
+         v_s  (:,:,:) = 0._wp
+         smv_i(:,:,:) = 0._wp
+         oa_i (:,:,:) = 0._wp
+         ht_i (:,:,:) = 0._wp
+         ht_s (:,:,:) = 0._wp
+         sm_i (:,:,:) = 0._wp
+         o_i  (:,:,:) = 0._wp
+
+         e_i(:,:,:,:) = 0._wp
+         e_s(:,:,:,:) = 0._wp
+
          DO jl = 1, jpl
-!$OMP DO schedule(static) private(jj,ji)
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  tn_ice (ji,jj,jl) = t_su (ji,jj,jl)
-               END DO
+            DO jk = 1, nlay_i
+               t_i(:,:,jk,jl) = rt0 * tmask(:,:,1)
+            END DO
+            DO jk = 1, nlay_s
+               t_s(:,:,jk,jl) = rt0 * tmask(:,:,1)
             END DO
          END DO
-!$OMP END PARALLEL
-
-      ELSE ! if ln_limini=false
-!$OMP PARALLEL
-         DO jl = 1, jpl
-!$OMP DO schedule(static) private(jj,ji)
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  a_i  (ji,jj,jl) = 0._wp
-                  v_i  (ji,jj,jl) = 0._wp
-                  v_s  (ji,jj,jl) = 0._wp
-                  smv_i(ji,jj,jl) = 0._wp
-                  oa_i (ji,jj,jl) = 0._wp
-                  ht_i (ji,jj,jl) = 0._wp
-                  ht_s (ji,jj,jl) = 0._wp
-                  sm_i (ji,jj,jl) = 0._wp
-                  o_i  (ji,jj,jl) = 0._wp
-               END DO
-            END DO
-         END DO
-
-         DO jk = 1, nlay_i
-            DO jl = 1, jpl
-!$OMP DO schedule(static) private(jj,ji)
-               DO jj = 1, jpj
-                  DO ji = 1, jpi
-                     e_i(ji,jj,jl,jk) = 0._wp
-                  END DO
-               END DO
-            END DO
-         END DO
-         DO jk = 1, nlay_s
-            DO jl = 1, jpl
-!$OMP DO schedule(static) private(jj,ji)
-               DO jj = 1, jpj
-                  DO ji = 1, jpi
-                     e_s(ji,jj,jl,jk) = 0._wp
-                  END DO
-               END DO
-            END DO
-         END DO
-
-         DO jl = 1, jpl
-            DO jk = 1, nlay_i
-!$OMP DO schedule(static) private(jj,ji)
-               DO jj = 1, jpj
-                  DO ji = 1, jpi
-                     t_i(ji,jj,jk,jl) = rt0 * tmask(ji,jj,1)
-                  END DO
-               END DO
-            END DO
-            DO jk = 1, nlay_s
-!$OMP DO schedule(static) private(jj,ji)
-               DO jj = 1, jpj
-                  DO ji = 1, jpi
-                     t_s(ji,jj,jk,jl) = rt0 * tmask(ji,jj,1)
-                  END DO
-               END DO
-            END DO
-         END DO
-!$OMP END PARALLEL
 
       ENDIF ! ln_limini
       
-!$OMP PARALLEL
-!$OMP DO schedule(static) private(jj,ji)
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            at_i (ji,jj) = 0.0_wp
-         END DO
-      END DO
+      at_i (:,:) = 0.0_wp
       DO jl = 1, jpl
-!$OMP DO schedule(static) private(jj,ji)
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               at_i (ji,jj) = at_i (ji,jj) + a_i (ji,jj,jl)
-            END DO
-         END DO
+         at_i (:,:) = at_i (:,:) + a_i (:,:,jl)
       END DO
       !
-!$OMP DO schedule(static) private(jj,ji)
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            !--------------------------------------------------------------------
-            ! 4) Global ice variables for output diagnostics                    | 
-            !--------------------------------------------------------------------
-            u_ice (ji,jj)     = 0._wp
-            v_ice (ji,jj)     = 0._wp
-            stress1_i(ji,jj)  = 0._wp
-            stress2_i(ji,jj)  = 0._wp
-            stress12_i(ji,jj) = 0._wp
-
-            !--------------------------------------------------------------------
-            ! 5) Moments for advection
-            !--------------------------------------------------------------------
-
-            sxopw (ji,jj) = 0._wp 
-            syopw (ji,jj) = 0._wp 
-            sxxopw(ji,jj) = 0._wp 
-            syyopw(ji,jj) = 0._wp 
-            sxyopw(ji,jj) = 0._wp
-         END DO
-      END DO
-
-      DO jl = 1, jpl
-!$OMP DO schedule(static) private(jj,ji)
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               sxice (ji,jj,jl)  = 0._wp   ;   sxsn (ji,jj,jl)  = 0._wp   ;   sxa  (ji,jj,jl)  = 0._wp
-               syice (ji,jj,jl)  = 0._wp   ;   sysn (ji,jj,jl)  = 0._wp   ;   sya  (ji,jj,jl)  = 0._wp
-               sxxice(ji,jj,jl)  = 0._wp   ;   sxxsn(ji,jj,jl)  = 0._wp   ;   sxxa (ji,jj,jl)  = 0._wp
-               syyice(ji,jj,jl)  = 0._wp   ;   syysn(ji,jj,jl)  = 0._wp   ;   syya (ji,jj,jl)  = 0._wp
-               sxyice(ji,jj,jl)  = 0._wp   ;   sxysn(ji,jj,jl)  = 0._wp   ;   sxya (ji,jj,jl)  = 0._wp
-
-               sxc0  (ji,jj,jl)  = 0._wp   
-               syc0  (ji,jj,jl)  = 0._wp   
-               sxxc0 (ji,jj,jl)  = 0._wp   
-               syyc0 (ji,jj,jl)  = 0._wp   
-               sxyc0 (ji,jj,jl)  = 0._wp   
-
-               sxsal  (ji,jj,jl)  = 0._wp
-               sysal  (ji,jj,jl)  = 0._wp
-               sxxsal (ji,jj,jl)  = 0._wp
-               syysal (ji,jj,jl)  = 0._wp
-               sxysal (ji,jj,jl)  = 0._wp
-
-               sxage  (ji,jj,jl)  = 0._wp
-               syage  (ji,jj,jl)  = 0._wp
-               sxxage (ji,jj,jl)  = 0._wp
-               syyage (ji,jj,jl)  = 0._wp
-               sxyage (ji,jj,jl)  = 0._wp
-            END DO
-         END DO
-      END DO
-
-      DO jl = 1, jpl
-         DO jk = 1, nlay_i
-!$OMP DO schedule(static) private(jj,ji)
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  sxe  (ji,jj,jk,jl)= 0._wp
-                  sye  (ji,jj,jk,jl)= 0._wp
-                  sxxe (ji,jj,jk,jl)= 0._wp
-                  syye (ji,jj,jk,jl)= 0._wp
-                  sxye (ji,jj,jk,jl)= 0._wp
-               END DO
-            END DO
-         END DO
-      END DO
-!$OMP END PARALLEL
-
+      !--------------------------------------------------------------------
+      ! 4) Global ice variables for output diagnostics                    | 
+      !--------------------------------------------------------------------
+      u_ice (:,:)     = 0._wp
+      v_ice (:,:)     = 0._wp
+      stress1_i(:,:)  = 0._wp
+      stress2_i(:,:)  = 0._wp
+      stress12_i(:,:) = 0._wp
+
+      !--------------------------------------------------------------------
+      ! 5) Moments for advection
+      !--------------------------------------------------------------------
+
+      sxopw (:,:) = 0._wp 
+      syopw (:,:) = 0._wp 
+      sxxopw(:,:) = 0._wp 
+      syyopw(:,:) = 0._wp 
+      sxyopw(:,:) = 0._wp
+
+      sxice (:,:,:)  = 0._wp   ;   sxsn (:,:,:)  = 0._wp   ;   sxa  (:,:,:)  = 0._wp
+      syice (:,:,:)  = 0._wp   ;   sysn (:,:,:)  = 0._wp   ;   sya  (:,:,:)  = 0._wp
+      sxxice(:,:,:)  = 0._wp   ;   sxxsn(:,:,:)  = 0._wp   ;   sxxa (:,:,:)  = 0._wp
+      syyice(:,:,:)  = 0._wp   ;   syysn(:,:,:)  = 0._wp   ;   syya (:,:,:)  = 0._wp
+      sxyice(:,:,:)  = 0._wp   ;   sxysn(:,:,:)  = 0._wp   ;   sxya (:,:,:)  = 0._wp
+
+      sxc0  (:,:,:)  = 0._wp   ;   sxe  (:,:,:,:)= 0._wp   
+      syc0  (:,:,:)  = 0._wp   ;   sye  (:,:,:,:)= 0._wp   
+      sxxc0 (:,:,:)  = 0._wp   ;   sxxe (:,:,:,:)= 0._wp   
+      syyc0 (:,:,:)  = 0._wp   ;   syye (:,:,:,:)= 0._wp   
+      sxyc0 (:,:,:)  = 0._wp   ;   sxye (:,:,:,:)= 0._wp   
+
+      sxsal  (:,:,:)  = 0._wp
+      sysal  (:,:,:)  = 0._wp
+      sxxsal (:,:,:)  = 0._wp
+      syysal (:,:,:)  = 0._wp
+      sxysal (:,:,:)  = 0._wp
+
+      sxage  (:,:,:)  = 0._wp
+      syage  (:,:,:)  = 0._wp
+      sxxage (:,:,:)  = 0._wp
+      syyage (:,:,:)  = 0._wp
+      sxyage (:,:,:)  = 0._wp
 
 !!!clem
@@ -581,4 +453,5 @@
       CALL wrk_dealloc( jpi, jpj,      zht_i_ini, zat_i_ini, zvt_i_ini, zts_u_ini, zht_s_ini, zsm_i_ini, ztm_i_ini )
       CALL wrk_dealloc( jpi, jpj,      zswitch )
+      Call wrk_dealloc( 4,             itest )
 
    END SUBROUTINE lim_istate
