Index: trunk/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 7646)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 7698)
@@ -115,14 +115,31 @@
          ! Ensure below that barotropic velocities match time splitting estimate
          ! Compute actual transport and replace it with ts estimate at "after" time step
-         zue(:,:) = e3u_a(:,:,1) * ua(:,:,1) * umask(:,:,1)
-         zve(:,:) = e3v_a(:,:,1) * va(:,:,1) * vmask(:,:,1)
+!$OMP PARALLEL
+!$OMP DO schedule(static) private(jj, ji)
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zue(ji,jj) = e3u_a(ji,jj,1) * ua(ji,jj,1) * umask(ji,jj,1)
+               zve(ji,jj) = e3v_a(ji,jj,1) * va(ji,jj,1) * vmask(ji,jj,1)
+            END DO
+         END DO
          DO jk = 2, jpkm1
-            zue(:,:) = zue(:,:) + e3u_a(:,:,jk) * ua(:,:,jk) * umask(:,:,jk)
-            zve(:,:) = zve(:,:) + e3v_a(:,:,jk) * va(:,:,jk) * vmask(:,:,jk)
-         END DO
+!$OMP DO schedule(static) private(jj,ji)
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  zue(ji,jj) = zue(ji,jj) + e3u_a(ji,jj,jk) * ua(ji,jj,jk) * umask(ji,jj,jk)
+                  zve(ji,jj) = zve(ji,jj) + e3v_a(ji,jj,jk) * va(ji,jj,jk) * vmask(ji,jj,jk)
+               END DO
+            END DO
+         END DO
+!$OMP DO schedule(static) private(jk,jj,ji)
          DO jk = 1, jpkm1
-            ua(:,:,jk) = ( ua(:,:,jk) - zue(:,:) * r1_hu_a(:,:) + ua_b(:,:) ) * umask(:,:,jk)
-            va(:,:,jk) = ( va(:,:,jk) - zve(:,:) * r1_hv_a(:,:) + va_b(:,:) ) * vmask(:,:,jk)
-         END DO
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  ua(ji,jj,jk) = ( ua(ji,jj,jk) - zue(ji,jj) * r1_hu_a(ji,jj) + ua_b(ji,jj) ) * umask(ji,jj,jk)
+                  va(ji,jj,jk) = ( va(ji,jj,jk) - zve(ji,jj) * r1_hv_a(ji,jj) + va_b(ji,jj) ) * vmask(ji,jj,jk)
+               END DO
+            END DO
+         END DO
+!$OMP END PARALLEL
          !
          IF( .NOT.ln_bt_fw ) THEN
@@ -131,8 +148,14 @@
             ! In the forward case, this is done below after asselin filtering   
             ! so that asselin contribution is removed at the same time 
+!$OMP PARALLEL DO schedule(static) private(jk,jj,ji)
             DO jk = 1, jpkm1
-               un(:,:,jk) = ( un(:,:,jk) - un_adv(:,:) + un_b(:,:) )*umask(:,:,jk)
-               vn(:,:,jk) = ( vn(:,:,jk) - vn_adv(:,:) + vn_b(:,:) )*vmask(:,:,jk)
-            END DO  
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     un(ji,jj,jk) = ( un(ji,jj,jk) - un_adv(ji,jj) + un_b(ji,jj) )*umask(ji,jj,jk)
+                     vn(ji,jj,jk) = ( vn(ji,jj,jk) - vn_adv(ji,jj) + vn_b(ji,jj) )*vmask(ji,jj,jk)
+                  END DO
+               END DO
+            END DO
+
          ENDIF
       ENDIF
@@ -161,13 +184,27 @@
          !
          IF( ln_dyn_trd ) THEN              ! 3D output: total momentum trends
-            zua(:,:,:) = ( ua(:,:,:) - ub(:,:,:) ) * z1_2dt
-            zva(:,:,:) = ( va(:,:,:) - vb(:,:,:) ) * z1_2dt
+!$OMP PARALLEL DO schedule(static) private(jk, jj, ji)
+            DO jk = 1, jpk
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     zua(ji,jj,jk) = ( ua(ji,jj,jk) - ub(ji,jj,jk) ) * z1_2dt
+                     zva(ji,jj,jk) = ( va(ji,jj,jk) - vb(ji,jj,jk) ) * z1_2dt
+                  END DO
+               END DO
+            END DO
             CALL iom_put( "utrd_tot", zua )        ! total momentum trends, except the asselin time filter
             CALL iom_put( "vtrd_tot", zva )
          ENDIF
          !
-         zua(:,:,:) = un(:,:,:)             ! save the now velocity before the asselin filter
-         zva(:,:,:) = vn(:,:,:)             ! (caution: there will be a shift by 1 timestep in the
-         !                                  !  computation of the asselin filter trends)
+!$OMP PARALLEL DO schedule(static) private(jk, jj, ji)
+         DO jk = 1, jpk
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  zua(ji,jj,jk) = un(ji,jj,jk)             ! save the now velocity before the asselin filter
+                  zva(ji,jj,jk) = vn(ji,jj,jk)             ! (caution: there will be a shift by 1 timestep in the
+                        !                                  !  computation of the asselin filter trends)
+               END DO
+            END DO
+         END DO
       ENDIF
 
@@ -175,19 +212,33 @@
       ! ------------------------------------------
       IF( neuler == 0 .AND. kt == nit000 ) THEN        !* Euler at first time-step: only swap
+!$OMP PARALLEL
+!$OMP DO schedule(static) private(jk,jj,ji)
          DO jk = 1, jpkm1
-            un(:,:,jk) = ua(:,:,jk)                          ! un <-- ua
-            vn(:,:,jk) = va(:,:,jk)
-         END DO
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  un(ji,jj,jk) = ua(ji,jj,jk)                          ! un <-- ua
+                  vn(ji,jj,jk) = va(ji,jj,jk)
+               END DO
+            END DO
+         END DO
+!$OMP END DO NOWAIT
          IF(.NOT.ln_linssh ) THEN
+!$OMP DO schedule(static) private(jk,jj,ji)
             DO jk = 1, jpkm1
-               e3t_b(:,:,jk) = e3t_n(:,:,jk)
-               e3u_b(:,:,jk) = e3u_n(:,:,jk)
-               e3v_b(:,:,jk) = e3v_n(:,:,jk)
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     e3t_b(ji,jj,jk) = e3t_n(ji,jj,jk)
+                     e3u_b(ji,jj,jk) = e3u_n(ji,jj,jk)
+                     e3v_b(ji,jj,jk) = e3v_n(ji,jj,jk)
+                  END DO
+               END DO
             END DO
          ENDIF
+!$OMP END PARALLEL
       ELSE                                             !* Leap-Frog : Asselin filter and swap
          !                                ! =============!
          IF( ln_linssh ) THEN             ! Fixed volume !
             !                             ! =============!
+!$OMP PARALLEL DO schedule(static) private(jk, jj, ji, zuf, zvf)
             DO jk = 1, jpkm1                              
                DO jj = 1, jpj
@@ -210,8 +261,18 @@
             ! ----------------------------------------------------
             IF( ln_dynspg_ts .AND. ln_bt_fw ) THEN    ! No asselin filtering on thicknesses if forward time splitting
-               e3t_b(:,:,1:jpkm1) = e3t_n(:,:,1:jpkm1)
+!$OMP PARALLEL DO schedule(static) private(jj,ji)
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     e3t_b(ji,jj,1:jpkm1) = e3t_n(ji,jj,1:jpkm1)
+                  END DO
+               END DO
             ELSE
+!$OMP PARALLEL DO schedule(static) private(jk,jj,ji)
                DO jk = 1, jpkm1
-                  e3t_b(:,:,jk) = e3t_n(:,:,jk) + atfp * ( e3t_b(:,:,jk) - 2._wp * e3t_n(:,:,jk) + e3t_a(:,:,jk) )
+                  DO jj = 1, jpj
+                     DO ji = 1, jpi
+                        e3t_b(ji,jj,jk) = e3t_n(ji,jj,jk) + atfp * ( e3t_b(ji,jj,jk) - 2._wp * e3t_n(ji,jj,jk) + e3t_a(ji,jj,jk) )
+                     END DO
+                  END DO
                END DO
                ! Add volume filter correction: compatibility with tracer advection scheme
@@ -219,7 +280,13 @@
                zcoef = atfp * rdt * r1_rau0
                IF ( .NOT. ln_isf ) THEN   ! if no ice shelf melting
-                  e3t_b(:,:,1) = e3t_b(:,:,1) - zcoef * ( emp_b(:,:) - emp(:,:) &
-                                 &                      - rnf_b(:,:) + rnf(:,:) ) * tmask(:,:,1)
+!$OMP PARALLEL DO schedule(static) private(jj,ji)
+                  DO jj = 1, jpj
+                     DO ji = 1, jpi
+                        e3t_b(ji,jj,1) = e3t_b(ji,jj,1) - zcoef * ( emp_b(ji,jj) - emp(ji,jj) &
+                                 &                      - rnf_b(ji,jj) + rnf(ji,jj) ) * tmask(ji,jj,1)
+                     END DO
+                  END DO
                ELSE                     ! if ice shelf melting
+!$OMP PARALLEL DO schedule(static) private(jj,ji,ikt)
                   DO jj = 1, jpj
                      DO ji = 1, jpi
@@ -237,4 +304,5 @@
                CALL dom_vvl_interpol( e3t_b(:,:,:), e3u_b(:,:,:), 'U' )
                CALL dom_vvl_interpol( e3t_b(:,:,:), e3v_b(:,:,:), 'V' )
+!$OMP PARALLEL DO schedule(static) private(jk, jj, ji, zuf, zvf)
                DO jk = 1, jpkm1
                   DO jj = 1, jpj
@@ -257,4 +325,6 @@
                CALL dom_vvl_interpol( e3t_b(:,:,:), ze3u_f, 'U' )
                CALL dom_vvl_interpol( e3t_b(:,:,:), ze3v_f, 'V' )
+!$OMP PARALLEL 
+!$OMP DO schedule(static) private(jk, jj, ji, zue3a, zve3a, zue3n, zve3n, zue3b, zve3b, zuf, zvf)
                DO jk = 1, jpkm1
                   DO jj = 1, jpj
@@ -277,6 +347,12 @@
                   END DO
                END DO
-               e3u_b(:,:,1:jpkm1) = ze3u_f(:,:,1:jpkm1)        ! e3u_b <-- filtered scale factor
-               e3v_b(:,:,1:jpkm1) = ze3v_f(:,:,1:jpkm1)
+!$OMP DO schedule(static) private(jj, ji)
+                  DO jj = 1, jpj
+                     DO ji = 1, jpi
+                        e3u_b(ji,jj,1:jpkm1) = ze3u_f(ji,jj,1:jpkm1)        ! e3u_b <-- filtered scale factor
+                        e3v_b(ji,jj,1:jpkm1) = ze3v_f(ji,jj,1:jpkm1)
+                     END DO
+                  END DO
+!$OMP END PARALLEL
                !
                CALL wrk_dealloc( jpi,jpj,jpk,   ze3u_f, ze3v_f )
@@ -288,14 +364,31 @@
             ! Revert "before" velocities to time split estimate
             ! Doing it here also means that asselin filter contribution is removed  
-            zue(:,:) = e3u_b(:,:,1) * ub(:,:,1) * umask(:,:,1)
-            zve(:,:) = e3v_b(:,:,1) * vb(:,:,1) * vmask(:,:,1)    
+!$OMP PARALLEL 
+!$OMP DO schedule(static) private(jj, ji)
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  zue(ji,jj) = e3u_b(ji,jj,1) * ub(ji,jj,1) * umask(ji,jj,1)
+                  zve(ji,jj) = e3v_b(ji,jj,1) * vb(ji,jj,1) * vmask(ji,jj,1)
+               END DO
+            END DO
             DO jk = 2, jpkm1
-               zue(:,:) = zue(:,:) + e3u_b(:,:,jk) * ub(:,:,jk) * umask(:,:,jk)
-               zve(:,:) = zve(:,:) + e3v_b(:,:,jk) * vb(:,:,jk) * vmask(:,:,jk)    
-            END DO
+!$OMP DO schedule(static) private(jj, ji)
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     zue(ji,jj) = zue(ji,jj) + e3u_b(ji,jj,jk) * ub(ji,jj,jk) * umask(ji,jj,jk)
+                     zve(ji,jj) = zve(ji,jj) + e3v_b(ji,jj,jk) * vb(ji,jj,jk) * vmask(ji,jj,jk)
+                  END DO
+               END DO
+            END DO
+!$OMP DO schedule(static) private(jk,jj,ji)
             DO jk = 1, jpkm1
-               ub(:,:,jk) = ub(:,:,jk) - (zue(:,:) * r1_hu_n(:,:) - un_b(:,:)) * umask(:,:,jk)
-               vb(:,:,jk) = vb(:,:,jk) - (zve(:,:) * r1_hv_n(:,:) - vn_b(:,:)) * vmask(:,:,jk)
-            END DO
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     ub(ji,jj,jk) = ub(ji,jj,jk) - (zue(ji,jj) * r1_hu_n(ji,jj) - un_b(ji,jj)) * umask(ji,jj,jk)
+                     vb(ji,jj,jk) = vb(ji,jj,jk) - (zve(ji,jj) * r1_hv_n(ji,jj) - vn_b(ji,jj)) * vmask(ji,jj,jk)
+                  END DO
+               END DO
+            END DO
+!$OMP END PARALLEL
          ENDIF
          !
@@ -308,28 +401,62 @@
       !
       IF(.NOT.ln_linssh ) THEN
-         hu_b(:,:) = e3u_b(:,:,1) * umask(:,:,1)
-         hv_b(:,:) = e3v_b(:,:,1) * vmask(:,:,1)
+!$OMP PARALLEL 
+!$OMP DO schedule(static) private(jj, ji)
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               hu_b(ji,jj) = e3u_b(ji,jj,1) * umask(ji,jj,1)
+               hv_b(ji,jj) = e3v_b(ji,jj,1) * vmask(ji,jj,1)
+            END DO
+         END DO
          DO jk = 2, jpkm1
-            hu_b(:,:) = hu_b(:,:) + e3u_b(:,:,jk) * umask(:,:,jk)
-            hv_b(:,:) = hv_b(:,:) + e3v_b(:,:,jk) * vmask(:,:,jk)
-         END DO
-         r1_hu_b(:,:) = ssumask(:,:) / ( hu_b(:,:) + 1._wp - ssumask(:,:) )
-         r1_hv_b(:,:) = ssvmask(:,:) / ( hv_b(:,:) + 1._wp - ssvmask(:,:) )
-      ENDIF
-      !
-      un_b(:,:) = e3u_a(:,:,1) * un(:,:,1) * umask(:,:,1)
-      ub_b(:,:) = e3u_b(:,:,1) * ub(:,:,1) * umask(:,:,1)
-      vn_b(:,:) = e3v_a(:,:,1) * vn(:,:,1) * vmask(:,:,1)
-      vb_b(:,:) = e3v_b(:,:,1) * vb(:,:,1) * vmask(:,:,1)
+!$OMP DO schedule(static) private(jj, ji)
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  hu_b(ji,jj) = hu_b(ji,jj) + e3u_b(ji,jj,jk) * umask(ji,jj,jk)
+                  hv_b(ji,jj) = hv_b(ji,jj) + e3v_b(ji,jj,jk) * vmask(ji,jj,jk)
+               END DO
+            END DO
+         END DO
+!$OMP DO schedule(static) private(jj, ji)
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               r1_hu_b(ji,jj) = ssumask(ji,jj) / ( hu_b(ji,jj) + 1._wp - ssumask(ji,jj) )
+               r1_hv_b(ji,jj) = ssvmask(ji,jj) / ( hv_b(ji,jj) + 1._wp - ssvmask(ji,jj) )
+            END DO
+         END DO
+!$OMP END PARALLEL
+      ENDIF
+      !
+!$OMP PARALLEL
+!$OMP DO schedule(static) private(jj, ji)
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            un_b(ji,jj) = e3u_a(ji,jj,1) * un(ji,jj,1) * umask(ji,jj,1)
+            ub_b(ji,jj) = e3u_b(ji,jj,1) * ub(ji,jj,1) * umask(ji,jj,1)
+            vn_b(ji,jj) = e3v_a(ji,jj,1) * vn(ji,jj,1) * vmask(ji,jj,1)
+            vb_b(ji,jj) = e3v_b(ji,jj,1) * vb(ji,jj,1) * vmask(ji,jj,1)
+         END DO
+      END DO
       DO jk = 2, jpkm1
-         un_b(:,:) = un_b(:,:) + e3u_a(:,:,jk) * un(:,:,jk) * umask(:,:,jk)
-         ub_b(:,:) = ub_b(:,:) + e3u_b(:,:,jk) * ub(:,:,jk) * umask(:,:,jk)
-         vn_b(:,:) = vn_b(:,:) + e3v_a(:,:,jk) * vn(:,:,jk) * vmask(:,:,jk)
-         vb_b(:,:) = vb_b(:,:) + e3v_b(:,:,jk) * vb(:,:,jk) * vmask(:,:,jk)
+!$OMP DO schedule(static) private(jj, ji)
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               un_b(ji,jj) = un_b(ji,jj) + e3u_a(ji,jj,jk) * un(ji,jj,jk) * umask(ji,jj,jk)
+               ub_b(ji,jj) = ub_b(ji,jj) + e3u_b(ji,jj,jk) * ub(ji,jj,jk) * umask(ji,jj,jk)
+               vn_b(ji,jj) = vn_b(ji,jj) + e3v_a(ji,jj,jk) * vn(ji,jj,jk) * vmask(ji,jj,jk)
+               vb_b(ji,jj) = vb_b(ji,jj) + e3v_b(ji,jj,jk) * vb(ji,jj,jk) * vmask(ji,jj,jk)
+            END DO
+         END DO
       END DO
-      un_b(:,:) = un_b(:,:) * r1_hu_a(:,:)
-      vn_b(:,:) = vn_b(:,:) * r1_hv_a(:,:)
-      ub_b(:,:) = ub_b(:,:) * r1_hu_b(:,:)
-      vb_b(:,:) = vb_b(:,:) * r1_hv_b(:,:)
+!$OMP DO schedule(static) private(jj, ji)
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            un_b(ji,jj) = un_b(ji,jj) * r1_hu_a(ji,jj)
+            vn_b(ji,jj) = vn_b(ji,jj) * r1_hv_a(ji,jj)
+            ub_b(ji,jj) = ub_b(ji,jj) * r1_hu_b(ji,jj)
+            vb_b(ji,jj) = vb_b(ji,jj) * r1_hv_b(ji,jj)
+         END DO
+      END DO
+!$OMP END PARALLEL
       !
       IF( .NOT.ln_dynspg_ts ) THEN        ! output the barotropic currents
@@ -338,6 +465,13 @@
       ENDIF
       IF( l_trddyn ) THEN                ! 3D output: asselin filter trends on momentum
-         zua(:,:,:) = ( ub(:,:,:) - zua(:,:,:) ) * z1_2dt
-         zva(:,:,:) = ( vb(:,:,:) - zva(:,:,:) ) * z1_2dt
+!$OMP PARALLEL DO schedule(static) private(jk, jj, ji)
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  zua(ji,jj,jk) = ( ub(ji,jj,jk) - zua(ji,jj,jk) ) * z1_2dt
+                  zva(ji,jj,jk) = ( vb(ji,jj,jk) - zva(ji,jj,jk) ) * z1_2dt
+               END DO
+            END DO
+         END DO
          CALL trd_dyn( zua, zva, jpdyn_atf, kt )
       ENDIF
