Index: trunk/NEMO/OPA_SRC/SOL/solsor.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SOL/solsor.F90	(revision 3)
+++ trunk/NEMO/OPA_SRC/SOL/solsor.F90	(revision 16)
@@ -22,4 +22,5 @@
    !! * Routine accessibility
    PUBLIC sol_sor              ! ???
+
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LODYC-IPSL  (2003)
@@ -28,11 +29,11 @@
 CONTAINS
       
-   SUBROUTINE sol_sor( kt, kindic )
+   SUBROUTINE sol_sor( kindic )
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE sol_sor  ***
       !!                 
       !! ** Purpose :   Solve the ellipic equation for the barotropic stream 
-      !!      function system (default option) or the transport divergence 
-      !!      system (key_dynspg_fsc = T) using a successive-over-relaxation
+      !!      function system (lk_dynspg_rl=T) or the transport divergence 
+      !!      system (lk_dynspg_fsc=T) using a successive-over-relaxation
       !!      method.
       !!       In the former case, the barotropic stream function trend has a
@@ -59,5 +60,4 @@
       !!----------------------------------------------------------------------
       !! * Arguments
-      INTEGER, INTENT(  in   ) ::   kt       ! ocean time-step
       INTEGER, INTENT( inout ) ::   kindic   ! solver indicator, < 0 if the conver-
       !                                      ! gence is not reached: the model is
@@ -67,137 +67,46 @@
       !! * Local declarations
       INTEGER  ::   ji, jj, jn               ! dummy loop indices
-      REAL(wp) ::   zgwgt                    ! temporary scalar
       !!----------------------------------------------------------------------
       
-      
-      ! Iterative loop 
-      ! ==============
-      
-      IF( kt == nit000 )  gccd(:,:) = sor * gcp(:,:,2)
+      !                                                       ! ==============
+      DO jn = 1, nmax                                         ! Iterative loop 
+         !                                                    ! ==============
 
-
-      DO jn = 1, nmax
-
-         !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+         CALL lbc_lnk( gcx, c_solver_pt, 1. )   ! applied the lateral boubary conditions
          
-         ! boundary conditions (at each sor iteration) only cyclic b. c. are required
-#if defined key_dynspg_fsc
-# if defined key_mpp
-            ! Mpp: export boundary values to neighbouring processors
-            CALL lbc_lnk( gcx, 'S', 1. )   ! S=T with special staff ???
-# else
-            CALL lbc_lnk( gcx, 'T', 1. )
-# endif
-#else
-# if defined key_mpp
-            ! Mpp: export boundary values to neighbouring processors
-            CALL lbc_lnk( gcx, 'G', 1. )   ! G= F with special staff ???
-# else
-            CALL lbc_lnk( gcx, 'F', 1. )
-# endif
-#endif
-         
-         !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-         
-         ! 1. Residus
-         ! ----------
- 
+         ! Residus
+         ! -------
          DO jj = 2, jpjm1
             DO ji = 2, jpim1
-               gcr(ji,jj) =  gcb(ji,jj  ) -             gcx(ji  ,jj  )   &
-                                          -gcp(ji,jj,1)*gcx(ji  ,jj-1)   &
-                                          -gcp(ji,jj,2)*gcx(ji-1,jj  )   &
-                                          -gcp(ji,jj,3)*gcx(ji+1,jj  )   &
-                                          -gcp(ji,jj,4)*gcx(ji  ,jj+1)
+               gcr(ji,jj) =  gcb(ji,jj  ) -                gcx(ji  ,jj  )   &
+                                          - gcp(ji,jj,1) * gcx(ji  ,jj-1)   &
+                                          - gcp(ji,jj,2) * gcx(ji-1,jj  )   &
+                                          - gcp(ji,jj,3) * gcx(ji+1,jj  )   &
+                                          - gcp(ji,jj,4) * gcx(ji  ,jj+1)
             END DO
          END DO
+         CALL lbc_lnk( gcr, c_solver_pt, 1. )   ! applied the lateral boubary conditions
 
-         !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-         
-         ! 1.1 Boundary conditions (at each sor iteration) only cyclic b. c. are required
-#if defined key_dynspg_fsc
-#   if defined key_mpp
-            ! Mpp: export boundary values to neighbouring processors
-            CALL lbc_lnk( gcr, 'S', 1. )
-#   else
-            ! mono- or macro-tasking: W-point, >0, 2D array, no slab
-            CALL lbc_lnk( gcr, 'T', 1. )
-#   endif
-#else
-#   if defined key_mpp
-            ! Mpp: export boundary values to neighbouring processors
-            CALL lbc_lnk( gcr, 'G', 1. )
-#   else
-            ! mono- or macro-tasking: W-point, >0, 2D array, no slab
-            CALL lbc_lnk( gcr, 'F', 1. )
-#   endif
-#endif
-
-         ! 1.2 Successive over relaxation
-         
+         ! Successive over relaxation
          DO jj = 2, jpj
             DO ji = 1, jpi
-               gcr(ji,jj) = gcr(ji,jj) - sor*gcp(ji,jj,1)*gcr(ji,jj-1)
+               gcr(ji,jj) = gcr(ji,jj) - sor * gcp(ji,jj,1) * gcr(ji,jj-1)
             END DO
             DO ji = 2, jpi
-               gcr(ji,jj) = gcr(ji,jj) - sor*gcp(ji,jj,2)*gcr(ji-1,jj)
+               gcr(ji,jj) = gcr(ji,jj) - sor * gcp(ji,jj,2) * gcr(ji-1,jj)
             END DO
          END DO
          
-         !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-         
          ! gcx guess
-         
          DO jj = 2, jpjm1
             DO ji = 1, jpi
-               gcx(ji,jj)  = (gcx(ji,jj)+sor*gcr(ji,jj))*bmask(ji,jj)
+               gcx(ji,jj)  = ( gcx(ji,jj) + sor * gcr(ji,jj) ) * bmask(ji,jj)
             END DO
          END DO
-         
-         !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-         
-         ! boundary conditions (at each sor iteration) only cyclic b. c. are required
-#if defined key_dynspg_fsc
-#   if defined key_mpp
-         ! Mpp: export boundary values to neighbouring processors
-         CALL lbc_lnk( gcx, 'S', 1. )
-#   else
-         ! mono- or macro-tasking: W-point, >0, 2D array, no slab
-         CALL lbc_lnk( gcx, 'T', 1. )
-#   endif
-#else
-#   if defined key_mpp
-         ! Mpp: export boundary values to neighbouring processors
-         CALL lbc_lnk( gcx, 'G', 1. )
-#   else
-         ! mono- or macro-tasking: W-point, >0, 2D array, no slab
-         CALL lbc_lnk( gcx, 'F', 1. )
-#   endif
-#endif
-         
-         ! maximal residu (old exit test on the maximum value of residus)
-         ! 
-         ! imax = isamax( jpi*jpj, gcr, 1 )
-         
-         ! avoid an out of bound in no bounds compilation
-         
-         ! iimax1 = mod( imax, jpi )
-         ! ijmax1 = int( float(imax) / float(jpi)) + 1
-         ! resmax = abs( gcr(iimax1,ijmax1) )
+         CALL lbc_lnk( gcx, c_solver_pt, 1. )
          
          ! relative precision
-         
-         rnorme = 0.
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zgwgt = gcdmat(ji,jj) * gcr(ji,jj)
-               rnorme= rnorme + gcr(ji,jj)*zgwgt
-            END DO
-         END DO
-         
-#if defined key_mpp
-         ! mpp sum over all the global domain
-         CALL  mpp_sum( rnorme )
-#endif
+         rnorme = SUM( gcr(:,:) * gcdmat(:,:) * gcr(:,:) )
+         IF( lk_mpp )   CALL mpp_sum( rnorme )   ! sum over the global domain
          
          ! test of convergence
@@ -216,45 +125,19 @@
          !****
          
-         !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,synchro,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-         
          ! indicator of non-convergence or explosion
-         
          IF( jn == nmax .OR. SQRT(epsr)/eps > 1.e+20 ) kindic = -2
          IF( ncut == 999 ) GOTO 999
          
-         
-         ! END of iterative loop
-         ! =====================
-         
-      END DO
-      
+         !                                                 ! =====================
+      END DO                                               ! END of iterative loop
+      !                                                    ! =====================
       
 999   CONTINUE
       
       
-      !  2. Output in gcx
-      !  -----------------
+      !  Output in gcx
+      !  -------------
       
-      ! boundary conditions (est-ce necessaire? je ne crois pas!!!!)
-      
-#if defined key_dynspg_fsc
-# if defined key_mpp
-      ! Mpp: export boundary values to neighbouring processors
-      CALL lbc_lnk( gcx, 'S', 1. )
-# else
-      IF( nperio /= 0 ) THEN
-         CALL lbc_lnk( gcx, 'T', 1. )
-      ENDIF
-# endif
-#else
-# if defined key_mpp
-      ! Mpp: export boundary values to neighbouring processors
-      CALL lbc_lnk( gcx, 'G', 1. )
-# else
-      IF( nperio /= 0 ) THEN
-         CALL lbc_lnk( gcx, 'F', 1. )
-      ENDIF
-# endif
-#endif
+      CALL lbc_lnk( gcx, c_solver_pt, 1. )    ! boundary conditions (est-ce necessaire? je ne crois pas!!!!)
       
    END SUBROUTINE sol_sor
