Index: trunk/NEMO/OPA_SRC/DYN/dynspg_fsc.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DYN/dynspg_fsc.F90	(revision 3)
+++ trunk/NEMO/OPA_SRC/DYN/dynspg_fsc.F90	(revision 31)
@@ -41,5 +41,5 @@
 
    !! * Shared module variables
-   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_fsc = .TRUE.    ! free surface constant volume flag
+   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_fsc = .TRUE.    !: free surface constant volume flag
 
    !! * Substitutions
@@ -80,7 +80,7 @@
       !!         where (spgu,spgv) are given by:
       !!            spgu = vertical sum[ e3u (ub+ 2 rdt ua ) ]
-      !!                 - g 2 rdt hu /e1u di[sshn + emp]
+      !!                 - grav 2 rdt hu /e1u di[sshn + emp]
       !!            spgv = vertical sum[ e3v (vb+ 2 rdt va) ]
-      !!                 - g 2 rdt hv /e2v dj[sshn + emp]
+      !!                 - grav 2 rdt hv /e2v dj[sshn + emp]
       !!         and define the first guess from previous computation :
       !!            zbtd = btda
@@ -127,8 +127,4 @@
          spgu(:,:) = 0.e0                     ! surface pressur gradient (i-direction)
          spgv(:,:) = 0.e0                     ! surface pressur gradient (j-direction)
-         IF( .NOT.ln_rstart ) THEN 
-            sshb(:,:) = 0.e0                     ! before sea-surface height
-            sshn(:,:) = 0.e0                     ! now    sea-surface height
-         ENDIF
       ENDIF
 
@@ -140,14 +136,14 @@
       IF( neuler == 0 .AND. kt == nit000 ) z2dt = rdt
       ! coefficients
-      z2dtg  = g * z2dt
+      z2dtg  = grav * z2dt
       zraur  = 1. / rauw
-      znugdt =  rnu * g * z2dt
+      znugdt =  rnu * grav * z2dt
       znurau =  znugdt * zraur
-#if defined key_mpp
-      ! Mpp : export boundary values of to neighboring processors
-      !!bug :  I don t understand why this only in mpp????
-      CALL lbc_lnk( ua, 'U', -1. )
-      CALL lbc_lnk( va, 'V', -1. )
-#endif
+      IF( lk_mpp ) THEN
+         ! Mpp : export boundary values of to neighboring processors
+         !!bug :  I don t understand why this only in mpp???? ==> Can be suppressed, no?
+         CALL lbc_lnk( ua, 'U', -1. )
+         CALL lbc_lnk( va, 'V', -1. )
+      ENDIF
 
       ! 1. Surface pressure gradient (now)
@@ -155,6 +151,6 @@
       DO jj = 2, jpjm1
          DO ji = fs_2, fs_jpim1   ! vector opt.
-            zspgu =      - g * ( sshn(ji+1,jj) - sshn(ji,jj) ) / e1u(ji,jj)
-            zspgv =      - g * ( sshn(ji,jj+1) - sshn(ji,jj) ) / e2v(ji,jj)
+            zspgu =      - grav * ( sshn(ji+1,jj) - sshn(ji,jj) ) / e1u(ji,jj)
+            zspgv =      - grav * ( sshn(ji,jj+1) - sshn(ji,jj) ) / e2v(ji,jj)
             zegu  = + znurau * ( emp (ji+1,jj) - emp (ji,jj) ) / e1u(ji,jj)
             zegv  = + znurau * ( emp (ji,jj+1) - emp (ji,jj) ) / e2v(ji,jj)
@@ -222,19 +218,21 @@
       ! vertical sum
 !CDIR NOLOOPCHG
-      DO jk = 1, jpkm1
-#if defined key_vectopt_loop
-         DO ji = 1, jpij                 ! vector opt.
-            spgu(ji,1) = spgu(ji,1) + fse3u(ji,1,jk) * ua(ji,1,jk)
-            spgv(ji,1) = spgv(ji,1) + fse3v(ji,1,jk) * va(ji,1,jk)
-         END DO
-#else
-         DO jj = 2, jpjm1
-            DO ji = 2, jpim1             ! NO vector opt.
-               spgu(ji,jj) = spgu(ji,jj) + fse3u(ji,jj,jk) * ua(ji,jj,jk)
-               spgv(ji,jj) = spgv(ji,jj) + fse3v(ji,jj,jk) * va(ji,jj,jk)
-            END DO
-         END DO
-#endif
-      END DO
+      IF( lk_vopt_loop ) THEN          ! vector opt., forced unroll
+         DO jk = 1, jpkm1
+            DO ji = 1, jpij
+               spgu(ji,1) = spgu(ji,1) + fse3u(ji,1,jk) * ua(ji,1,jk)
+               spgv(ji,1) = spgv(ji,1) + fse3v(ji,1,jk) * va(ji,1,jk)
+            END DO
+         END DO
+      ELSE                        ! No  vector opt.
+         DO jk = 1, jpkm1
+            DO jj = 2, jpjm1
+               DO ji = 2, jpim1
+                  spgu(ji,jj) = spgu(ji,jj) + fse3u(ji,jj,jk) * ua(ji,jj,jk)
+                  spgv(ji,jj) = spgv(ji,jj) + fse3v(ji,jj,jk) * va(ji,jj,jk)
+               END DO
+            END DO
+         END DO
+      ENDIF
 
       ! transport: multiplied by the horizontal scale factor
@@ -274,7 +272,6 @@
          END DO
       END DO
-#if defined key_mpp
-      CALL mpp_sum( rnorme )
-#endif
+      IF( lk_mpp )   CALL mpp_sum( rnorme )   ! sum over the global domain
+
       epsr = eps * eps * rnorme
       ncut = 0
@@ -296,5 +293,5 @@
             CALL sol_pcg( kindic )
          ELSEIF( nsolv == 2 ) THEN     ! successive-over-relaxation
-            CALL sol_sor( kt, kindic )
+            CALL sol_sor( kindic )
          ELSEIF( nsolv == 3 ) THEN     ! FETI solver
             CALL sol_fet( kindic )
@@ -391,8 +388,8 @@
    !!   Default case :   Empty module   No standart free surface cst volume
    !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_fsc = .FALSE.   ! free surface constant volume flag
+   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_fsc = .FALSE.   !: free surface constant volume flag
 CONTAINS
    SUBROUTINE dyn_spg_fsc( kt, kindic )       ! Empty routine
-      WRITE(*,*) kt, kindic
+      WRITE(*,*) 'dyn_spg_fsc: You should not have seen this print! error?', kt, kindic
    END SUBROUTINE dyn_spg_fsc
 #endif
Index: trunk/NEMO/OPA_SRC/DYN/dynspg_fsc_atsk.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DYN/dynspg_fsc_atsk.F90	(revision 3)
+++ trunk/NEMO/OPA_SRC/DYN/dynspg_fsc_atsk.F90	(revision 31)
@@ -43,5 +43,5 @@
 
    !! * Shares module variables
-   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_fsc_tsk = .TRUE.    ! free surf. cst vol. flag
+   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_fsc_tsk = .TRUE.    !: free surf. cst vol. flag
 
    !! * Substitutions
@@ -81,7 +81,7 @@
       !!         where (spgu,spgv) are given by:
       !!            spgu = vertical sum[ e3u (ub+ 2 rdt ua ) ]
-      !!                 - g 2 rdt hu /e1u di[sshn + emp]
+      !!                 - grav 2 rdt hu /e1u di[sshn + emp]
       !!            spgv = vertical sum[ e3v (vb+ 2 rdt va) ]
-      !!                 - g 2 rdt hv /e2v dj[sshn + emp]
+      !!                 - grav 2 rdt hv /e2v dj[sshn + emp]
       !!         and define the first guess from previous computation :
       !!            zbtd = btda
@@ -128,8 +128,4 @@
          spgu(:,:) = 0.e0      ! surface pressure gradient (i-direction)
          spgv(:,:) = 0.e0      ! surface pressure gradient (j-direction)
-         IF( .NOT.ln_rstart ) THEN 
-            sshb(:,:) = 0.e0      ! before sea-surface height 
-            sshn(:,:) = 0.e0      ! now    sea-surface height 
-         ENDIF
       ENDIF
 
@@ -141,14 +137,15 @@
       IF( neuler == 0 .AND. kt == nit000 ) z2dt = rdt
       ! coefficients
-      z2dtg  = g * z2dt
+      z2dtg  = grav * z2dt
       zraur  = 1. / rauw
-      znugdt =  rnu * g * z2dt
+      znugdt =  rnu * grav * z2dt
       znurau =  znugdt * zraur
-#if defined key_mpp
-      ! Mpp : export boundary values of to neighboring processors
-      !!bug ???  why only in mpp?  is it really needed???
-      CALL lbc_lnk( ua, 'U' , -1. )
-      CALL lbc_lnk( va, 'V' , -1. )
-#endif
+      IF( lk_mpp ) THEN
+         ! Mpp : export boundary values of to neighboring processors
+         !!bug ???  why only in mpp?  is it really needed???
+         CALL lbc_lnk( ua, 'U' , -1. )
+         CALL lbc_lnk( va, 'V' , -1. )
+      ENDIF
+
       !                                                ! ===============
       DO jj = 2, jpjm1                                 !  Vertical slab
@@ -157,6 +154,6 @@
          ! ----------------------------
          DO ji = 2, jpim1
-            zspgu =      - g * ( sshn(ji+1,jj) - sshn(ji,jj) ) / e1u(ji,jj)
-            zspgv =      - g * ( sshn(ji,jj+1) - sshn(ji,jj) ) / e2v(ji,jj)
+            zspgu =   - grav * ( sshn(ji+1,jj) - sshn(ji,jj) ) / e1u(ji,jj)
+            zspgv =   - grav * ( sshn(ji,jj+1) - sshn(ji,jj) ) / e2v(ji,jj)
             zegu  = + znurau * ( emp (ji+1,jj) - emp (ji,jj) ) / e1u(ji,jj)
             zegv  = + znurau * ( emp (ji,jj+1) - emp (ji,jj) ) / e2v(ji,jj)
@@ -286,7 +283,6 @@
          END DO
       END DO
-#if defined key_mpp
-      CALL mpp_sum( rnorme )
-#endif
+      IF( lk_mpp )   CALL mpp_sum( rnorme )   ! sum over the global domain
+
       epsr = eps * eps * rnorme
       ncut = 0
@@ -310,5 +306,5 @@
             CALL sol_pcg( kindic )
          ELSEIF( nsolv == 2 ) THEN     ! successive-over-relaxation
-            CALL sol_sor( kt, kindic )
+            CALL sol_sor( kindic )
          ELSEIF( nsolv == 3 ) THEN     ! FETI solver
             CALL sol_fet( kindic )
@@ -400,8 +396,8 @@
    !!   Default case :                                         Empty module
    !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_fsc_tsk = .FALSE.   ! free surf. cst vol. flag
+   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_fsc_tsk = .FALSE.   !: free surf. cst vol. flag
 CONTAINS
    SUBROUTINE dyn_spg_fsc_atsk( kt, kindic )      ! Empty module
-      WRITE(*,*) kt, kindic
+      WRITE(*,*) 'dyn_spg_fsc_atsk: You should not have seen this print! error?', kt, kindic
    END SUBROUTINE dyn_spg_fsc_atsk
 #endif
Index: trunk/NEMO/OPA_SRC/DYN/dynspg_rl.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DYN/dynspg_rl.F90	(revision 3)
+++ trunk/NEMO/OPA_SRC/DYN/dynspg_rl.F90	(revision 31)
@@ -36,9 +36,10 @@
 
    !! * Shared module variables
-   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_rl = .TRUE.   ! rigid-lid flag
+   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_rl = .TRUE.    !: rigid-lid flag
 
    !! * Substitutions
 #  include "domzgr_substitute.h90"
 #  include "vectopt_loop_substitute.h90"
+#  include "obc_vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LODYC-IPSL  (2003)
@@ -115,7 +116,4 @@
          spgu(:,:) = 0.e0      ! surface pressure gradient (i-direction) 
          spgv(:,:) = 0.e0      ! surface pressure gradient (j-direction)
-         bsfb(:,:) = 0.e0      ! before barotropic stream-function
-         bsfn(:,:) = 0.e0      ! now    barotropic stream-function
-         bsfd(:,:) = 0.e0      ! barotropic stream-function trend
       ENDIF
 
@@ -209,7 +207,6 @@
          END DO
       END DO
-# if defined key_mpp
-      CALL mpp_sum( rnorme )
-# endif
+      IF( lk_mpp )   CALL mpp_sum( rnorme )   ! sum over the global domain
+
       epsr = eps*eps*rnorme
       ncut = 0
@@ -229,5 +226,5 @@
             CALL sol_pcg( kindic )
          CASE( 2 )                     ! successive-over-relaxation
-            CALL sol_sor( kt, kindic )
+            CALL sol_sor( kindic )
          CASE( 3 )                     ! FETI solver
             CALL sol_fet( kindic )
@@ -400,7 +397,5 @@
          END DO
       END DO
-#   if defined key_mpp
-      CALL mppobc( bebnd, jpjed, jpjef, jpieob, 3*3, 2, jpj )
-#   endif
+      IF( lk_mpp )   CALL mppobc( bebnd, jpjed, jpjef, jpieob, 3*3, 2, jpj )
       ENDIF
 
@@ -436,7 +431,5 @@
          END DO
       END DO
-#   if defined key_mpp
-      CALL mppobc( bwbnd, jpjwd, jpjwf, jpiwob, 3*3, 2, jpj )
-#   endif
+      IF( lk_mpp )   CALL mppobc( bwbnd, jpjwd, jpjwf, jpiwob, 3*3, 2, jpj )
       ENDIF
 
@@ -472,43 +465,39 @@
          END DO
       END DO
-#   if defined key_mpp
-      CALL mppobc( bnbnd, jpind, jpinf, jpjnob, 3*3, 1, jpi )
-#   endif
+      IF( lk_mpp )   CALL mppobc( bnbnd, jpind, jpinf, jpjnob, 3*3, 1, jpi )
       ENDIF
 
       IF( lpsouthobc ) THEN
-      ! njsob,(jpsd,jpsf)
-      IF( kt < nit000+3 .AND. .NOT.ln_rstart ) THEN
-         DO ji = nis0m1, nis1
-            ! fields itm2 <== itm
-            bsbnd(ji,ib  ,itm2) = bsbnd(ji,ib  ,itm)
-            bsbnd(ji,ibm ,itm2) = bsbnd(ji,ibm ,itm)
-            bsbnd(ji,ibm2,itm2) = bsbnd(ji,ibm2,itm)
-            bsbnd(ji,ib  ,itm ) = bsbnd(ji,ib  ,it )
-         END DO
-      ELSE
-         DO jj = fs_njs0, fs_njs1   ! vector opt.
+         ! njsob,(jpsd,jpsf)
+         IF( kt < nit000+3 .AND. .NOT.ln_rstart ) THEN
             DO ji = nis0m1, nis1
+               ! fields itm2 <== itm
                bsbnd(ji,ib  ,itm2) = bsbnd(ji,ib  ,itm)
                bsbnd(ji,ibm ,itm2) = bsbnd(ji,ibm ,itm)
                bsbnd(ji,ibm2,itm2) = bsbnd(ji,ibm2,itm)
-               ! fields itm <== it  plus time filter at the boundary
-               bsbnd(jj,ib  ,itm ) = atfp * ( bsbnd(jj,ib,itm) + bsfn(ji,jj) ) + atfp1 * bsbnd(jj,ib,it)
-               bsbnd(ji,ibm ,itm ) = bsbnd(ji,ibm ,it )
-               bsbnd(ji,ibm2,itm ) = bsbnd(ji,ibm2,it )
-            END DO
-         END DO
-      ENDIF
-      DO jj = fs_njs0, fs_njs1   ! vector opt.
-         DO ji = nis0m1, nis1 
-            ! fields it <== now (kt+1)
-            bsbnd(ji,ib  ,it  ) = bsfn (ji,jj  )
-            bsbnd(ji,ibm ,it  ) = bsfn (ji,jj+1)
-            bsbnd(ji,ibm2,it  ) = bsfn (ji,jj+2)
-         END DO
-      END DO
-#   if defined key_mpp
-      CALL mppobc( bsbnd, jpisd, jpisf, jpjsob, 3*3, 1, jpi )
-#   endif
+               bsbnd(ji,ib  ,itm ) = bsbnd(ji,ib  ,it )
+            END DO
+         ELSE
+            DO jj = fs_njs0, fs_njs1   ! vector opt.
+               DO ji = nis0m1, nis1
+                  bsbnd(ji,ib  ,itm2) = bsbnd(ji,ib  ,itm)
+                  bsbnd(ji,ibm ,itm2) = bsbnd(ji,ibm ,itm)
+                  bsbnd(ji,ibm2,itm2) = bsbnd(ji,ibm2,itm)
+                  ! fields itm <== it  plus time filter at the boundary
+                  bsbnd(jj,ib  ,itm ) = atfp * ( bsbnd(jj,ib,itm) + bsfn(ji,jj) ) + atfp1 * bsbnd(jj,ib,it)
+                  bsbnd(ji,ibm ,itm ) = bsbnd(ji,ibm ,it )
+                  bsbnd(ji,ibm2,itm ) = bsbnd(ji,ibm2,it )
+               END DO
+            END DO
+         ENDIF
+         DO jj = fs_njs0, fs_njs1   ! vector opt.
+            DO ji = nis0m1, nis1 
+               ! fields it <== now (kt+1)
+               bsbnd(ji,ib  ,it  ) = bsfn (ji,jj  )
+               bsbnd(ji,ibm ,it  ) = bsfn (ji,jj+1)
+               bsbnd(ji,ibm2,it  ) = bsfn (ji,jj+2)
+            END DO
+         END DO
+         IF( lk_mpp )   CALL mppobc( bsbnd, jpisd, jpisf, jpjsob, 3*3, 1, jpi )
       ENDIF
 # endif
@@ -547,8 +536,8 @@
    !!   'key_dynspg_rl'                                        NO rigid lid
    !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_rl = .FALSE.   ! rigid-lid flag
+   LOGICAL, PUBLIC, PARAMETER ::   lk_dynspg_rl = .FALSE.   !: rigid-lid flag
 CONTAINS
    SUBROUTINE dyn_spg_rl( kt, kindic )       ! Empty routine
-      WRITE(*,*) kt, kindic
+      WRITE(*,*) 'dyn_spg_rl: You should not have seen this print! error?', kt, kindic
    END SUBROUTINE dyn_spg_rl
 #endif
