Index: trunk/NEMO/OPA_SRC/DYN/dynspg.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DYN/dynspg.F90	(revision 1528)
+++ trunk/NEMO/OPA_SRC/DYN/dynspg.F90	(revision 1566)
@@ -4,6 +4,6 @@
    !! Ocean dynamics:  surface pressure gradient control
    !!======================================================================
-   !! History :  9.0  !  05-12  (C. Talandier, G. Madec)  Original code
-   !!            9.0  !  05-12  (V. Garnier)  dyn_spg_ctl: Original code
+   !! History :  1.0  ! 2005-12  (C. Talandier, G. Madec, V. Garnier)  Original code
+   !!            3.2  ! 2009-07  (R. Benshila)  Suppression of rigid-lid option
    !!----------------------------------------------------------------------
 
@@ -27,7 +27,6 @@
    PRIVATE
 
-   PUBLIC dyn_spg         ! routine called by step module
+   PUBLIC   dyn_spg   ! routine called by step module
 
-   !! * module variables
    INTEGER ::   nspg = 0   ! type of surface pressure gradient scheme defined from lk_dynspg_... 
 
@@ -36,7 +35,7 @@
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
+   !! NEMO/OPA 3.2 , LODYC-IPSL  (2009)
    !! $Id$ 
-   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    !!----------------------------------------------------------------------
 
@@ -47,12 +46,31 @@
       !!                  ***  ROUTINE dyn_spg  ***
       !!
-      !! ** Purpose :   compute the lateral ocean dynamics physics.
+      !! ** Purpose :   achieve the momentum time stepping by computing the
+      !!              last trend, the surface pressure gradient, and performing
+      !!              the Leap-Frog integration.
+      !!gm              In the current version only the filtered solution provide
+      !!gm            the after velocity, in the 2 other (ua,va) are still the trends
+      !!
+      !! ** Method  :   Three schemes:
+      !!              - explicit computation      : the spg is evaluated at now
+      !!              - filtered computation      : the Roulet & madec (2000) technique is used
+      !!              - split-explicit computation: a time splitting technique is used
+      !!
+      !! N.B. : When key_esopa is used all the scheme are tested, regardless 
+      !!        of the physical meaning of the results. 
       !!----------------------------------------------------------------------
-      INTEGER, INTENT( in  ) ::   kt     ! ocean time-step index
-      INTEGER, INTENT( out ) ::   kindic ! solver flag
+      INTEGER, INTENT(in   ) ::   kt       ! ocean time-step index
+      INTEGER, INTENT(  out) ::   kindic   ! solver flag
       !!
-      REAL(wp) ::   z2dt                      ! temporary scalar
+      REAL(wp) ::   z2dt   ! temporary scalar
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ztrdu, ztrdv   ! 3D workspace
       !!----------------------------------------------------------------------
+
+
+!!gm NOTA BENE : the dynspg_exp and dynspg_ts should be modified so that 
+!!gm             they return the after velocity, not the trends (as in trazdf_imp...)
+!!gm             In this case, change/simplify dynnxt
+
+
 
       IF( kt == nit000 )   CALL dyn_spg_ctl      ! initialisation & control of options
@@ -65,21 +83,21 @@
       SELECT CASE ( nspg )                       ! compute surf. pressure gradient trend and add it to the general trend
       !                                                     
-      CASE (  0 )   ;   CALL dyn_spg_exp    ( kt )              ! explicit
-      CASE (  1 )   ;   CALL dyn_spg_ts     ( kt )              ! time-splitting
-      CASE (  2 )   ;   CALL dyn_spg_flt    ( kt, kindic )      ! filtered
+      CASE (  0 )   ;   CALL dyn_spg_exp( kt )              ! explicit
+      CASE (  1 )   ;   CALL dyn_spg_ts ( kt )              ! time-splitting
+      CASE (  2 )   ;   CALL dyn_spg_flt( kt, kindic )      ! filtered
       !                                                    
-      CASE ( -1 )                                       ! esopa: test all possibility with control print
-                       CALL dyn_spg_exp    ( kt )
-                       CALL prt_ctl( tab3d_1=ua, clinfo1=' spg0 - Ua: ', mask1=umask, &
-            &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
-                       CALL dyn_spg_ts     ( kt )
-                       CALL prt_ctl( tab3d_1=ua, clinfo1=' spg1 - Ua: ', mask1=umask, &
-            &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
-                       CALL dyn_spg_flt  ( kt, kindic )
-                       CALL prt_ctl( tab3d_1=ua, clinfo1=' spg2 - Ua: ', mask1=umask, &
-            &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+      CASE ( -1 )                                ! esopa: test all possibility with control print
+                        CALL dyn_spg_exp( kt )
+                        CALL prt_ctl( tab3d_1=ua, clinfo1=' spg0 - Ua: ', mask1=umask, &
+         &                            tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+                        CALL dyn_spg_ts ( kt )
+                        CALL prt_ctl( tab3d_1=ua, clinfo1=' spg1 - Ua: ', mask1=umask, &
+         &                           tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+                        CALL dyn_spg_flt( kt, kindic )
+                        CALL prt_ctl( tab3d_1=ua, clinfo1=' spg2 - Ua: ', mask1=umask, &
+         &                            tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       END SELECT
       !                    
-      IF( l_trddyn )   THEN                      ! save the horizontal diffusive trends for further diagnostics
+      IF( l_trddyn )   THEN                      ! save the surface pressure gradient trends for further diagnostics
          SELECT CASE ( nspg )
          CASE ( 0, 1 )
@@ -106,14 +124,10 @@
       !!                
       !! ** Purpose :   Control the consistency between cpp options for 
-      !!      surface pressure gradient schemes
+      !!              surface pressure gradient schemes
       !!----------------------------------------------------------------------
-      !! * Local declarations
       INTEGER ::   ioptio
       !!----------------------------------------------------------------------
 
-      ! Parameter control and print
-      ! ---------------------------
-      ! Control print
-      IF(lwp) THEN
+      IF(lwp) THEN             ! Control print
          WRITE(numout,*)
          WRITE(numout,*) 'dyn_spg_ctl : choice of the surface pressure gradient scheme'
@@ -124,22 +138,21 @@
       ENDIF
 
-      ! Control of surface pressure gradient scheme options
-      ! ---------------------------------------------------
+      !                        ! Control of surface pressure gradient scheme options
       ioptio = 0
       IF(lk_dynspg_exp)   ioptio = ioptio + 1
       IF(lk_dynspg_ts )   ioptio = ioptio + 1
       IF(lk_dynspg_flt)   ioptio = ioptio + 1
-
+      !
       IF( ( ioptio > 1 .AND. .NOT. lk_esopa ) .OR. ioptio == 0 )   &
            &   CALL ctl_stop( ' Choose only one surface pressure gradient scheme with a key cpp' )
-
+      !
       IF( lk_esopa     )   nspg = -1
       IF( lk_dynspg_exp)   nspg =  0
       IF( lk_dynspg_ts )   nspg =  1
       IF( lk_dynspg_flt)   nspg =  2
-
+      !
       IF( lk_esopa     )   nspg = -1
-
-     IF(lwp) THEN
+      !
+      IF(lwp) THEN
          WRITE(numout,*)
          IF( nspg == -1 )   WRITE(numout,*) '     ESOPA test All scheme used'
@@ -149,6 +162,5 @@
       ENDIF
 
-      ! Control of timestep choice
-      ! --------------------------
+      !                        ! Control of timestep choice
       IF( lk_dynspg_ts .OR. lk_dynspg_exp ) THEN
          IF( n_cla == 1 )   &
@@ -157,15 +169,13 @@
 
 #if defined key_obc
-      ! Conservation of ocean volume (key_dynspg_flt)
-      ! ---------------------------------------------
-      IF( lk_dynspg_flt ) ln_vol_cst = .true.
+      !                        ! Conservation of ocean volume (key_dynspg_flt)
+      IF( lk_dynspg_flt )   ln_vol_cst = .true.
 
-      ! Application of Flather's algorithm at open boundaries
-      ! -----------------------------------------------------
-      IF( lk_dynspg_flt ) ln_obc_fla = .false.
-      IF( lk_dynspg_exp ) ln_obc_fla = .true.
-      IF( lk_dynspg_ts  ) ln_obc_fla = .true.
+      !                        ! Application of Flather's algorithm at open boundaries
+      IF( lk_dynspg_flt )   ln_obc_fla = .false.
+      IF( lk_dynspg_exp )   ln_obc_fla = .true.
+      IF( lk_dynspg_ts  )   ln_obc_fla = .true.
 #endif
-
+      !
    END SUBROUTINE dyn_spg_ctl
 
