Index: trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diafwb.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diafwb.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diafwb.F90	(revision 5385)
@@ -51,11 +51,12 @@
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
       !!
-      INTEGER :: inum             ! temporary logical unit
-      INTEGER :: ji, jj, jk, jt   ! dummy loop indices
-      INTEGER :: ii0, ii1, ij0, ij1
-      REAL(wp) ::   zarea, zvol, zwei
-      REAL(wp) ::  ztemi(4), ztemo(4), zsali(4), zsalo(4), zflxi(4), zflxo(4)
-      REAL(wp) ::  zt, zs, zu  
-      REAL(wp) ::  zsm0, zfwfnew
+      INTEGER  :: inum             ! temporary logical unit
+      INTEGER  :: ji, jj, jk, jt   ! dummy loop indices
+      INTEGER  :: ii0, ii1, ij0, ij1
+      INTEGER  :: isrow         ! index for ORCA1 starting row
+      REAL(wp) :: zarea, zvol, zwei
+      REAL(wp) :: ztemi(4), ztemo(4), zsali(4), zsalo(4), zflxi(4), zflxo(4)
+      REAL(wp) :: zt, zs, zu  
+      REAL(wp) :: zsm0, zfwfnew
       IF( cp_cfg == "orca" .AND. jp_cfg == 1 .OR. jp_cfg == 2 .OR. jp_cfg == 4 ) THEN
       !!----------------------------------------------------------------------
@@ -165,6 +166,16 @@
          CASE ( 1 )                                  !  ORCA_R1 configurations
             !                                        ! =======================
-            ii0 = 283   ;   ii1 = 283
-            ij0 = 200   ;   ij1 = 200
+            ! This dirty section will be suppressed by simplification process: all this will come back in input files
+            ! Currently these hard-wired indices relate to the original (pre-v3.6) configuration 
+            ! which had a grid-size of 362x292.
+            ! This grid has been extended southwards for use with the under ice-shelf options (isf) introduced in v3.6. 
+            ! The original domain can still be used optionally if the isf code is not activated. 
+            ! An adjustment (isrow) is made to the hard-wired indices if the extended domain (362x332) is being used.
+            ! 
+            IF    ( jpjglo == 292 ) THEN  ;  isrow = 0  ! Using pre-v3.6 files or adjusted start row from isf-extended grid
+            ELSEIF( jpjglo == 332 ) THEN  ;  isrow = 40 ! Using full isf­extended domain. 
+            ENDIF                                       ! Adjust j­indices to account for more southerly starting latitude
+            ii0 = 283           ;   ii1 = 283
+            ij0 = 201 + isrow   ;   ij1 = 201 + isrow
             !                                        ! =======================
          CASE DEFAULT                                !    ORCA R05 or R025
@@ -212,6 +223,11 @@
          CASE ( 1 )                                  !  ORCA_R1 configurations
             !                                        ! =======================
-            ii0 = 282   ;   ii1 = 282
-            ij0 = 200   ;   ij1 = 200
+            !  This dirty section will be suppressed by simplification process:
+            !  all this will come back in input files
+            IF    ( jpjglo == 292 ) THEN  ;  isrow = 0  
+            ELSEIF( jpjglo == 332 ) THEN  ;  isrow = 39
+            ENDIF                                      
+            ii0 = 282           ;   ii1 = 282
+            ij0 = 201 + isrow   ;   ij1 = 201 + isrow
             !                                        ! =======================
          CASE DEFAULT                                !    ORCA R05 or R025
@@ -259,6 +275,11 @@
          CASE ( 1 )                                  !  ORCA_R1 configurations
             !                                        ! =======================
-            ii0 = 331   ;   ii1 = 331
-            ij0 = 176   ;   ij1 = 176
+            !  This dirty section will be suppressed by simplification process:
+            !  all this will come back in input files
+            IF    ( jpjglo == 292 ) THEN  ;  isrow = 0  
+            ELSEIF( jpjglo == 332 ) THEN  ;  isrow = 39
+            ENDIF                                      
+            ii0 = 331           ;   ii1 = 331
+            ij0 = 176 + isrow   ;   ij1 = 176 + isrow
             !                                        ! =======================
          CASE DEFAULT                                !    ORCA R05 or R025
@@ -306,6 +327,11 @@
          CASE ( 1 )                                  !  ORCA_R1 configurations
             !                                        ! =======================
-            ii0 = 297   ;   ii1 = 297 
-            ij0 = 230   ;   ij1 = 230
+            !  This dirty section will be suppressed by simplification process:
+            !  all this will come back in input files
+            IF    ( jpjglo == 292 ) THEN  ;  isrow = 0  
+            ELSEIF( jpjglo == 332 ) THEN  ;  isrow = 39
+            ENDIF                                      
+            ii0 = 297           ;   ii1 = 297
+            ij0 = 230 + isrow   ;   ij1 = 230 + isrow
             !                                        ! =======================
          CASE DEFAULT                                !    ORCA R05 or R025
Index: trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domhgr.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domhgr.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domhgr.F90	(revision 5385)
@@ -105,4 +105,6 @@
       REAL(wp) ::   zlam1, zcos_alpha, zim1 , zjm1 , ze1, ze1deg
       REAL(wp) ::   zphi1, zsin_alpha, zim05, zjm05
+      INTEGER  ::   isrow                ! index for ORCA1 starting row
+
       !!----------------------------------------------------------------------
       !
@@ -159,49 +161,54 @@
          IF( cp_cfg == "orca" .AND. jp_cfg == 1 ) THEN    ! ORCA R1 configuration
             !                                             ! =====================
-
-            ii0 = 281   ;   ii1 = 282        ! Gibraltar Strait (e2u = 20 km)
-            ij0 = 200   ;   ij1 = 200   ;   e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  20.e3
+            ! This dirty section will be suppressed by simplification process: all this will come back in input files
+            ! Currently these hard-wired indices relate to the original (pre-v3.6) configuration 
+            ! which had a grid-size of 362x292.
+            ! This grid has been extended southwards for use with the under ice-shelf options (isf) introduced in v3.6. 
+            ! The original domain can still be used optionally if the isf code is not activated. 
+            ! An adjustment (isrow) is made to the hard-wired indices if the extended domain (362x332) is being used.
+            ! 
+            IF    ( jpjglo == 292 ) THEN  ;  isrow = 0  ! Using pre-v3.6 files or adjusted start row from isf-extended grid
+            ELSEIF( jpjglo == 332 ) THEN  ;  isrow = 40 ! Using full isf­extended domain. 
+            ENDIF     
+            !
+            ii0 = 282           ;   ii1 = 283        ! Gibraltar Strait (e2u = 20 km)
+            ij0 = 201 + isrow   ;   ij1 = 201 + isrow   ;   e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  20.e3
             IF(lwp) WRITE(numout,*)
             IF(lwp) WRITE(numout,*) '             orca_r1: Gibraltar : e2u reduced to 20 km'
 
-            ii0 = 314   ;   ii1 = 315        ! Bhosporus Strait (e2u = 10 km)
-            ij0 = 208   ;   ij1 = 208   ;   e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  10.e3
+            ii0 = 314           ;   ii1 = 315        ! Bhosporus Strait (e2u = 10 km)
+            ij0 = 208 + isrow   ;   ij1 = 208 + isrow   ;   e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  10.e3
             IF(lwp) WRITE(numout,*)
             IF(lwp) WRITE(numout,*) '             orca_r1: Bhosporus : e2u reduced to 10 km'
 
-            ii0 =  44   ;   ii1 =  44        ! Lombok Strait (e1v = 13 km)
-            ij0 = 124   ;   ij1 = 125   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  13.e3
+            ii0 =  44           ;   ii1 =  44        ! Lombok Strait (e1v = 13 km)
+            ij0 = 124 + isrow   ;   ij1 = 125 + isrow   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  13.e3
             IF(lwp) WRITE(numout,*)
             IF(lwp) WRITE(numout,*) '             orca_r1: Lombok : e1v reduced to 10 km'
 
-            ii0 =  48   ;   ii1 =  48        ! Sumba Strait (e1v = 8 km) [closed from bathy_11 on]
-            ij0 = 124   ;   ij1 = 125   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  8.e3
+            ii0 =  48           ;   ii1 =  48        ! Sumba Strait (e1v = 8 km) [closed from bathy_11 on]
+            ij0 = 124 + isrow   ;   ij1 = 125 + isrow   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  8.e3
             IF(lwp) WRITE(numout,*)
             IF(lwp) WRITE(numout,*) '             orca_r1: Sumba : e1v reduced to 8 km'
 
-            ii0 =  53   ;   ii1 =  53        ! Ombai Strait (e1v = 13 km)
-            ij0 = 124   ;   ij1 = 125   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 13.e3
+            ii0 =  53           ;   ii1 =  53        ! Ombai Strait (e1v = 13 km)
+            ij0 = 124 + isrow   ;   ij1 = 125 + isrow   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 13.e3
             IF(lwp) WRITE(numout,*)
             IF(lwp) WRITE(numout,*) '             orca_r1: Ombai : e1v reduced to 13 km'
 
-            ii0 =  56   ;   ii1 =  56        ! Timor Passage (e1v = 20 km)
-            ij0 = 124   ;   ij1 = 125   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 20.e3
+            ii0 =  56           ;   ii1 =  56        ! Timor Passage (e1v = 20 km)
+            ij0 = 124 + isrow   ;   ij1 = 125 + isrow   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 20.e3
             IF(lwp) WRITE(numout,*)
             IF(lwp) WRITE(numout,*) '             orca_r1: Timor Passage : e1v reduced to 20 km'
 
-            ii0 =  55   ;   ii1 =  55        ! West Halmahera Strait (e1v = 30 km)
-            ij0 = 141   ;   ij1 = 142   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 30.e3
+            ii0 =  55           ;   ii1 =  55        ! West Halmahera Strait (e1v = 30 km)
+            ij0 = 141 + isrow   ;   ij1 = 142 + isrow   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 30.e3
             IF(lwp) WRITE(numout,*)
             IF(lwp) WRITE(numout,*) '             orca_r1: W Halmahera : e1v reduced to 30 km'
 
-            ii0 =  58   ;   ii1 =  58        ! East Halmahera Strait (e1v = 50 km)
-            ij0 = 141   ;   ij1 = 142   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 50.e3
+            ii0 =  58           ;   ii1 =  58        ! East Halmahera Strait (e1v = 50 km)
+            ij0 = 141 + isrow   ;   ij1 = 142 + isrow   ;   e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 50.e3
             IF(lwp) WRITE(numout,*)
             IF(lwp) WRITE(numout,*) '             orca_r1: E Halmahera : e1v reduced to 50 km'
-
-            !
-
-            !
-            !
             !
             !
Index: trunk/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 5385)
@@ -134,4 +134,5 @@
       INTEGER  ::   ijf, ijl, ij0, ij1       !   -       -
       INTEGER  ::   ios
+      INTEGER  ::   isrow                    ! index for ORCA1 starting row
       INTEGER , POINTER, DIMENSION(:,:) ::  imsk
       REAL(wp), POINTER, DIMENSION(:,:) ::  zwf
@@ -401,37 +402,48 @@
       IF( cp_cfg == "orca" .AND. jp_cfg == 1 ) THEN   ! ORCA R1 configuration
          !                                                 ! Increased lateral friction near of some straits
+         ! This dirty section will be suppressed by simplification process: all this will come back in input files
+         ! Currently these hard-wired indices relate to the original (pre-v3.6) configuration 
+         ! which had a grid-size of 362x292.
+         ! This grid has been extended southwards for use with the under ice-shelf options (isf) introduced in v3.6. 
+         ! The original domain can still be used optionally if the isf code is not activated. 
+         ! An adjustment (isrow) is made to the hard-wired indices if the extended domain (362x332) is being used.
+         ! 
+         IF    ( jpjglo == 292 ) THEN  ;  isrow = 0  ! Using pre-v3.6 files or adjusted start row from isf-extended grid
+         ELSEIF( jpjglo == 332 ) THEN  ;  isrow = 40 ! Using full isf­extended domain. 
+         ENDIF     
+
          IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) '   orca_r1: increase friction near the following straits : '
          IF(lwp) WRITE(numout,*) '      Gibraltar '
-         ii0 = 283   ;   ii1 = 284        ! Gibraltar Strait 
-         ij0 = 200   ;   ij1 = 200   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  2._wp  
+         ii0 = 282           ;   ii1 = 283        ! Gibraltar Strait 
+         ij0 = 201 + isrow   ;   ij1 = 201 + isrow   ;   fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp  
 
          IF(lwp) WRITE(numout,*) '      Bhosporus '
-         ii0 = 314   ;   ii1 = 315        ! Bhosporus Strait 
-         ij0 = 208   ;   ij1 = 208   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  2._wp  
+         ii0 = 314           ;   ii1 = 315        ! Bhosporus Strait 
+         ij0 = 208 + isrow   ;   ij1 = 208 + isrow   ;   fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp  
 
          IF(lwp) WRITE(numout,*) '      Makassar (Top) '
-         ii0 =  48   ;   ii1 =  48        ! Makassar Strait (Top) 
-         ij0 = 149   ;   ij1 = 150   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  3._wp  
+         ii0 =  48           ;   ii1 =  48        ! Makassar Strait (Top) 
+         ij0 = 149 + isrow   ;   ij1 = 150 + isrow   ;   fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 3._wp  
 
          IF(lwp) WRITE(numout,*) '      Lombok '
-         ii0 =  44   ;   ii1 =  44        ! Lombok Strait 
-         ij0 = 124   ;   ij1 = 125   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) =  2._wp  
+         ii0 =  44           ;   ii1 =  44        ! Lombok Strait 
+         ij0 = 124 + isrow   ;   ij1 = 125 + isrow   ;   fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp  
 
          IF(lwp) WRITE(numout,*) '      Ombai '
-         ii0 =  53   ;   ii1 =  53        ! Ombai Strait 
-         ij0 = 124   ;   ij1 = 125   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) = 2._wp  
+         ii0 =  53           ;   ii1 =  53        ! Ombai Strait 
+         ij0 = 124 + isrow   ;   ij1 = 125 + isrow   ;   fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp  
 
          IF(lwp) WRITE(numout,*) '      Timor Passage '
-         ii0 =  56   ;   ii1 =  56        ! Timor Passage 
-         ij0 = 124   ;   ij1 = 125   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) = 2._wp  
+         ii0 =  56           ;   ii1 =  56        ! Timor Passage 
+         ij0 = 124 + isrow   ;   ij1 = 125 + isrow   ;   fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp  
 
          IF(lwp) WRITE(numout,*) '      West Halmahera '
-         ii0 =  58   ;   ii1 =  58        ! West Halmahera Strait 
-         ij0 = 141   ;   ij1 = 142   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) = 3._wp  
+         ii0 =  58           ;   ii1 =  58        ! West Halmahera Strait 
+         ij0 = 141 + isrow   ;   ij1 = 142 + isrow   ;   fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 3._wp  
 
          IF(lwp) WRITE(numout,*) '      East Halmahera '
-         ii0 =  55   ;   ii1 =  55        ! East Halmahera Strait 
-         ij0 = 141   ;   ij1 = 142   ;   fmask( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1), 1:jpk ) = 3._wp  
+         ii0 =  55           ;   ii1 =  55        ! East Halmahera Strait 
+         ij0 = 141 + isrow   ;   ij1 = 142 + isrow   ;   fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 3._wp  
          !
       ENDIF
Index: trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 5385)
@@ -1039,4 +1039,5 @@
       INTEGER ::   ji, jj, jk                                          ! dummy loop indices
       INTEGER ::   ij0, ij1, ii0, ii1                                  ! dummy loop indices
+      INTEGER ::   isrow                                               ! index for ORCA1 starting row
       !! acc
       !! Hmm with the time splitting these "fixes" seem to do more harm than good. Temporarily disabled for
@@ -1122,7 +1123,17 @@
       IF( cp_cfg == "orca" .AND. jp_cfg == 1 ) THEN    ! ORCA R1 configuration
          !                                             ! =====================
-         !
-         ii0 = 281   ;   ii1 = 282        ! Gibraltar Strait (e2u was modified)
-         ij0 = 200   ;   ij1 = 200
+         ! This dirty section will be suppressed by simplification process: all this will come back in input files
+         ! Currently these hard-wired indices relate to the original (pre-v3.6) configuration 
+         ! which had a grid-size of 362x292.
+         ! This grid has been extended southwards for use with the under ice-shelf options (isf) introduced in v3.6. 
+         ! The original domain can still be used optionally if the isf code is not activated. 
+         ! An adjustment (isrow) is made to the hard-wired indices if the extended domain (362x332) is being used.
+         ! 
+         IF    ( jpjglo == 292 ) THEN  ;  isrow = 0  ! Using pre-v3.6 files or adjusted start row from isf-extended grid
+         ELSEIF( jpjglo == 332 ) THEN  ;  isrow = 40 ! Using full isf­extended domain. 
+         ENDIF     
+         !
+         ii0 = 282           ;   ii1 = 283        ! Gibraltar Strait (e2u was modified)
+         ij0 = 201 + isrow   ;   ij1 = 201 + isrow
          DO jk = 1, jpkm1
             DO jj = mj0(ij0), mj1(ij1)
@@ -1144,6 +1155,6 @@
          END DO
          !
-         ii0 = 314   ;   ii1 = 315        ! Bhosporus Strait (e2u was modified)
-         ij0 = 208   ;   ij1 = 208
+         ii0 = 314           ;   ii1 = 315        ! Bhosporus Strait (e2u was modified)
+         ij0 = 208 + isrow   ;   ij1 = 208 + isrow
          DO jk = 1, jpkm1
             DO jj = mj0(ij0), mj1(ij1)
@@ -1165,6 +1176,6 @@
          END DO
          !
-         ii0 =  44   ;   ii1 =  44        ! Lombok Strait (e1v was modified)
-         ij0 = 124   ;   ij1 = 125
+         ii0 =  44           ;   ii1 =  44        ! Lombok Strait (e1v was modified)
+         ij0 = 124 + isrow   ;   ij1 = 125 + isrow
          DO jk = 1, jpkm1
             DO jj = mj0(ij0), mj1(ij1)
@@ -1181,6 +1192,6 @@
          END DO
          !
-         ii0 =  48   ;   ii1 =  48        ! Sumba Strait (e1v was modified) [closed from bathy_11 on]
-         ij0 = 124   ;   ij1 = 125
+         ii0 =  48           ;   ii1 =  48        ! Sumba Strait (e1v was modified) [closed from bathy_11 on]
+         ij0 = 124 + isrow   ;   ij1 = 125 + isrow
          DO jk = 1, jpkm1
             DO jj = mj0(ij0), mj1(ij1)
@@ -1197,6 +1208,6 @@
          END DO
          !
-         ii0 =  53   ;   ii1 =  53        ! Ombai Strait (e1v was modified)
-         ij0 = 124   ;   ij1 = 125
+         ii0 =  53          ;   ii1 =  53        ! Ombai Strait (e1v was modified)
+         ij0 = 124 + isrow  ;   ij1 = 125  + isrow  
          DO jk = 1, jpkm1
             DO jj = mj0(ij0), mj1(ij1)
@@ -1213,6 +1224,6 @@
          END DO
          !
-         ii0 =  56   ;   ii1 =  56        ! Timor Passage (e1v was modified)
-         ij0 = 124   ;   ij1 = 125
+         ii0 =  56             ;   ii1 =  56        ! Timor Passage (e1v was modified)
+         ij0 = 124  + isrow    ;   ij1 = 125  + isrow  
          DO jk = 1, jpkm1
             DO jj = mj0(ij0), mj1(ij1)
@@ -1229,6 +1240,6 @@
          END DO
          !
-         ii0 =  55   ;   ii1 =  55        ! West Halmahera Strait (e1v was modified)
-         ij0 = 141   ;   ij1 = 142
+         ii0 =  55             ;   ii1 =  55        ! West Halmahera Strait (e1v was modified)
+         ij0 = 141  + isrow    ;   ij1 = 142  + isrow  
          DO jk = 1, jpkm1
             DO jj = mj0(ij0), mj1(ij1)
@@ -1245,6 +1256,6 @@
          END DO
          !
-         ii0 =  58   ;   ii1 =  58        ! East Halmahera Strait (e1v was modified)
-         ij0 = 141   ;   ij1 = 142
+         ii0 =  58             ;   ii1 =  58        ! East Halmahera Strait (e1v was modified)
+         ij0 = 141  + isrow    ;   ij1 = 142  + isrow  
          DO jk = 1, jpkm1
             DO jj = mj0(ij0), mj1(ij1)
Index: trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 5385)
@@ -484,4 +484,19 @@
             CALL iom_close( inum )
             mbathy(:,:) = INT( bathy(:,:) )
+            !
+            ! CL :  add Amazon deeper
+            IF( cp_cfg == "orca" .AND. jp_cfg == 1 ) THEN    ! ORCA R1 configuration 
+                 ii0 = 230   ;   ii1 = 245                   ! Amazon area 
+                 ij0 = 140   ;   ij1 = 155                   ! no ocean shallower than 30 meters
+                 DO ji = mi0(ii0), mi1(ii1)
+                    DO jj = mj0(ij0), mj1(ij1)
+                       IF( bathy(ji,jj) .LE. 30. .AND. bathy(ji,jj) .GT. 0.0 ) bathy(ji,jj) = 30._wp
+                    END DO
+                 END DO
+                 IF(lwp) WRITE(numout,*)
+                 IF(lwp) WRITE(numout,*) '             orca_r1: Amazon area not shallower than 30 meters for: '
+                 IF(lwp) WRITE(numout,*) '                    Longitude index ',ii0, ii0
+                 IF(lwp) WRITE(numout,*) '                    Latitude index  ',ij0, ij0
+            ENDIF
             !                                                ! =====================
             IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN    ! ORCA R2 configuration
Index: trunk/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 5385)
@@ -126,4 +126,5 @@
          CALL set_grid( "V", glamv, gphiv )
          CALL set_grid( "W", glamt, gphit )
+         CALL set_grid_znl( gphit )
       ENDIF
 
@@ -135,4 +136,5 @@
          CALL set_grid( "V", glamv_crs, gphiv_crs ) 
          CALL set_grid( "W", glamt_crs, gphit_crs ) 
+         CALL set_grid_znl( gphit_crs )
           !
          CALL dom_grid_glo   ! Return to parent grid domain
@@ -1384,4 +1386,31 @@
 
 
+   SUBROUTINE set_grid_znl( plat )
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE set_grid_znl  ***
+      !!
+      !! ** Purpose :   define grids for zonal mean
+      !!
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   plat
+      !
+      REAL(wp), DIMENSION(:), ALLOCATABLE  ::   zlon
+      INTEGER  :: ni,nj, ix, iy
+
+      
+      ni=nlei-nldi+1 ; nj=nlej-nldj+1            ! define zonal mean domain (jpj*jpk)
+      ALLOCATE( zlon(ni*nj) )       ;       zlon(:) = 0.
+
+      CALL iom_set_domain_attr("gznl", ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-1, jbegin=njmpp+nldj-1, ni=ni, nj=nj)
+      CALL iom_set_domain_attr("gznl", data_dim=2, data_ibegin = 1-nldi, data_ni = jpi, data_jbegin = 1-nldj, data_nj = jpj)
+      CALL iom_set_domain_attr("gznl", lonvalue = zlon,   &
+         &                             latvalue = RESHAPE(plat(nldi:nlei, nldj:nlej),(/ ni*nj /)))  
+      !
+      CALL dom_ngb( 180., 90., ix, iy, 'T' ) !  i-line that passes near the North Pole : Reference latitude (used in plots)
+      CALL iom_set_domain_attr ('ptr', zoom_ibegin=ix, zoom_nj=jpjglo)
+      CALL iom_update_file_name('ptr')
+      !
+   END SUBROUTINE set_grid_znl
+
    SUBROUTINE set_scalar
       !!----------------------------------------------------------------------
@@ -1468,9 +1497,4 @@
       CALL set_mooring( zlonpira, zlatpira )
 
-      ! diaptr : zonal mean 
-      CALL dom_ngb( 180., 90., ix, iy, 'T' ) !  i-line that passes near the North Pole : Reference latitude (used in plots)
-      CALL iom_set_domain_attr ('ptr', zoom_ibegin=ix, zoom_nj=jpjglo)
-      CALL iom_update_file_name('ptr')
-      !
       
    END SUBROUTINE set_xmlatt
Index: trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90	(revision 5385)
@@ -58,5 +58,4 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qns_ice        !: non solar heat flux over ice                  [W/m2]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qsr_ice        !: solar heat flux over ice                      [W/m2]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qsr_ice_mean   !: daily mean solar heat flux over ice           [W/m2]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qla_ice        !: latent flux over ice                          [W/m2]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   dqla_ice       !: latent sensibility over ice                 [W/m2/K]
@@ -152,8 +151,4 @@
 #endif
          !
-#if defined key_lim2
-      IF( ltrcdm2dc_ice )   ALLOCATE( qsr_ice_mean (jpi,jpj,jpl), STAT=ierr(3) )
-#endif
-         !
 #if defined key_cice || defined key_lim2
       IF( lk_cpl )   ALLOCATE( ht_i(jpi,jpj,jpl) , ht_s(jpi,jpj,jpl) , STAT=ierr(5) )
Index: trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 5385)
@@ -81,6 +81,7 @@
    !!              Ocean Surface Boundary Condition fields
    !!----------------------------------------------------------------------
+   INTEGER , PUBLIC ::  ncpl_qsr_freq            !: qsr coupling frequency per days from atmosphere
+   !
    LOGICAL , PUBLIC ::   lhftau = .FALSE.        !: HF tau used in TKE: mean(stress module) - module(mean stress)
-   LOGICAL , PUBLIC ::   ltrcdm2dc               !: In case of Diurnal Cycle short wave, compute a Daily Mean short waves flux
    !!                                   !!   now    ! before   !!
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   utau   , utau_b   !: sea surface i-stress (ocean referential)     [N/m2]
@@ -90,5 +91,4 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wndm              !: wind speed module at T-point (=|U10m-Uoce|)  [m/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qsr               !: sea heat flux:     solar                     [W/m2]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qsr_mean          !: daily mean sea heat flux: solar              [W/m2]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qns    , qns_b    !: sea heat flux: non solar                     [W/m2]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qsr_tot           !: total     solar heat flux (over sea and ice) [W/m2]
@@ -162,6 +162,4 @@
 #endif
          !
-      IF( ltrcdm2dc ) ALLOCATE( qsr_mean(jpi,jpj) , STAT=ierr(5) )
-         !
       sbc_oce_alloc = MAXVAL( ierr )
       IF( lk_mpp            )   CALL mpp_sum ( sbc_oce_alloc )
Index: trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 5385)
@@ -22,6 +22,4 @@
    !!   blk_oce_core    : computes momentum, heat and freshwater fluxes over ocean
    !!   blk_ice_core    : computes momentum, heat and freshwater fluxes over ice
-   !!   blk_bio_meanqsr : compute daily mean short wave radiation over the ocean
-   !!   blk_ice_meanqsr : compute daily mean short wave radiation over the ice
    !!   turb_core_2z    : Computes turbulent transfert coefficients
    !!   cd_neutral_10m  : Estimate of the neutral drag coefficient at 10m
@@ -52,5 +50,4 @@
    PUBLIC   sbc_blk_core         ! routine called in sbcmod module
    PUBLIC   blk_ice_core         ! routine called in sbc_ice_lim module
-   PUBLIC   blk_ice_meanqsr      ! routine called in sbc_ice_lim module
    PUBLIC   turb_core_2z         ! routine calles in sbcblk_mfs module
 
@@ -195,7 +192,4 @@
       !                                            ! compute the surface ocean fluxes using CORE bulk formulea
       IF( MOD( kt - 1, nn_fsbc ) == 0 )   CALL blk_oce_core( kt, sf, sst_m, ssu_m, ssv_m )
-
-      ! If diurnal cycle is activated, compute a daily mean short waves flux for biogeochemistery
-      IF( ltrcdm2dc )   CALL blk_bio_meanqsr
 
 #if defined key_cice
@@ -302,4 +296,5 @@
       ELSE                  ;   qsr(:,:) = zztmp *          sf(jp_qsr)%fnow(:,:,1)   * tmask(:,:,1)
       ENDIF
+
       zqlw(:,:) = (  sf(jp_qlw)%fnow(:,:,1) - Stef * zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:)  ) * tmask(:,:,1)   ! Long  Wave
       ! ----------------------------------------------------------------------------- !
@@ -611,60 +606,4 @@
       !
    END SUBROUTINE blk_ice_core
-
-
-   SUBROUTINE blk_bio_meanqsr
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE blk_bio_meanqsr
-      !!                     
-      !! ** Purpose :   provide daily qsr_mean for PISCES when
-      !!                analytic diurnal cycle is applied in physic
-      !!                
-      !! ** Method  :   add part where there is no ice
-      !! 
-      !!---------------------------------------------------------------------
-      IF( nn_timing == 1 )  CALL timing_start('blk_bio_meanqsr')
-      !
-      qsr_mean(:,:) = (1. - albo ) *  sf(jp_qsr)%fnow(:,:,1)
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('blk_bio_meanqsr')
-      !
-   END SUBROUTINE blk_bio_meanqsr
- 
- 
-   SUBROUTINE blk_ice_meanqsr( palb, p_qsr_mean, pdim )
-      !!---------------------------------------------------------------------
-      !!
-      !! ** Purpose :   provide the daily qsr_mean over sea_ice for PISCES when
-      !!                analytic diurnal cycle is applied in physic
-      !!
-      !! ** Method  :   compute qsr
-      !! 
-      !!---------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   palb       ! ice albedo (clear sky) (alb_ice_cs)               [%]
-      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_qsr_mean !     solar heat flux over ice (T-point)         [W/m2]
-      INTEGER                   , INTENT(in   ) ::   pdim       ! number of ice categories
-      !
-      INTEGER  ::   ijpl          ! number of ice categories (size of 3rd dim of input arrays)
-      INTEGER  ::   ji, jj, jl    ! dummy loop indices
-      REAL(wp) ::   zztmp         ! temporary variable
-      !!---------------------------------------------------------------------
-      IF( nn_timing == 1 )  CALL timing_start('blk_ice_meanqsr')
-      !
-      ijpl  = pdim                            ! number of ice categories
-      zztmp = 1. / ( 1. - albo )
-      !                                     ! ========================== !
-      DO jl = 1, ijpl                       !  Loop over ice categories  !
-         !                                  ! ========================== !
-         DO jj = 1 , jpj
-            DO ji = 1, jpi
-                  p_qsr_mean(ji,jj,jl) = zztmp * ( 1. - palb(ji,jj,jl) ) * qsr_mean(ji,jj)
-            END DO
-         END DO
-      END DO
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_meanqsr')
-      !
-   END SUBROUTINE blk_ice_meanqsr  
-
 
    SUBROUTINE turb_core_2z( zt, zu, sst, T_zt, q_sat, q_zt, dU,    &
Index: trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 5385)
@@ -194,5 +194,4 @@
                &                      tprecip    , sprecip    ,                         &
                &                      fr1_i0     , fr2_i0     , cp_ice_msh , jpl  )
-            IF( ltrcdm2dc_ice )   CALL blk_ice_meanqsr( zalb_ice, qsr_ice_mean, jpl )
 
          CASE( jp_cpl )            ! Coupled formulation : atmosphere-ice stress only (fluxes provided after ice dynamics)
@@ -232,12 +231,9 @@
             CALL sbc_cpl_ice_flx( frld,                                              &
             !                                optional arguments, used only in 'mixed oce-ice' case
-            &                                             palbi = zalb_ice, psst = sst_m, pist = zsist )
+            &                                             palbi=zalb_ice, psst=sst_m, pist=zsist )
             sprecip(:,:) = - emp_ice(:,:)   ! Ugly patch, WARNING, in coupled mode, sublimation included in snow (parsub = 0.)
          ENDIF
                            CALL lim_thd_2      ( kt )      ! Ice thermodynamics 
                            CALL lim_sbc_flx_2  ( kt )      ! update surface ocean mass, heat & salt fluxes 
-#if defined key_top
-        IF( ltrcdm2dc_ice )CALL lim_bio_meanqsr_2
-#endif
 
          IF(  .NOT. lk_mpp )THEN
Index: trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 5385)
@@ -24,4 +24,5 @@
    USE phycst           ! physical constants
    USE sbc_oce          ! Surface boundary condition: ocean fields
+   USE trc_oce          ! shared ocean-passive tracers variables
    USE sbc_ice          ! Surface boundary condition: ice fields
    USE sbcdcy           ! surface boundary condition: diurnal cycle
@@ -151,17 +152,4 @@
       END SELECT
       !
-#if defined key_top && ! defined key_offline
-      ltrcdm2dc = (ln_dm2dc .AND. ln_blk_core .AND. nn_ice==2)
-      IF( ltrcdm2dc )THEN
-         IF(lwp)THEN
-            WRITE(numout,*)"analytical diurnal cycle, core bulk formulation and LIM2 use: "
-            WRITE(numout,*)"Diurnal cycle on physics but not in passive tracers"
-         ENDIF
-      ENDIF
-#else 
-      ltrcdm2dc =  .FALSE.
-#endif
-
-      !
       !                              ! allocate sbc arrays
       IF( sbc_oce_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_oce arrays' )
@@ -238,5 +226,4 @@
          & asked coupling with drag coefficient (ln_cdgw =T) or Stokes drift (ln_sdw=T) ')
       ENDIF 
-      
       !                          ! Choice of the Surface Boudary Condition (set nsbc)
       icpt = 0
@@ -273,4 +260,6 @@
       IF( ln_ssr           )   CALL sbc_ssr_init               ! Sea-Surface Restoring initialisation
       !
+      IF( ln_rnf           )   CALL sbc_rnf_init               ! Runof initialisation
+      !
       IF( nn_ice == 3      )   CALL sbc_lim_init               ! LIM3 initialisation
 
@@ -278,5 +267,5 @@
       !
       IF( nsbc   == jp_cpl )   CALL sbc_cpl_init (nn_ice)      ! OASIS initialisation. must be done before first time step
-
+      
    END SUBROUTINE sbc_init
 
Index: trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 5385)
@@ -37,5 +37,9 @@
    !                                                     !!* namsbc_rnf namelist *
    CHARACTER(len=100), PUBLIC ::   cn_dir          !: Root directory for location of ssr files
-   LOGICAL           , PUBLIC ::   ln_rnf_depth    !: depth       river runoffs attribute specified in a file
+   LOGICAL           , PUBLIC ::   ln_rnf_depth      !: depth       river runoffs attribute specified in a file
+   LOGICAL                    ::   ln_rnf_depth_ini  !: depth       river runoffs  computed at the initialisation
+   REAL(wp)                   ::   rn_rnf_max        !: maximum value of the runoff climatologie ( ln_rnf_depth_ini = .true )
+   REAL(wp)                   ::   rn_dep_max        !: depth over which runoffs is spread ( ln_rnf_depth_ini = .true )
+   INTEGER                    ::   nn_rnf_depth_file !: create (=1) a runoff depth file or not (=0)
    LOGICAL           , PUBLIC ::   ln_rnf_tem      !: temperature river runoffs attribute specified in a file
    LOGICAL           , PUBLIC ::   ln_rnf_sal      !: salinity    river runoffs attribute specified in a file
@@ -104,7 +108,4 @@
       !
       CALL wrk_alloc( jpi,jpj, ztfrz)
-
-      !
-      IF( kt == nit000 )   CALL sbc_rnf_init                           ! Read namelist and allocate structures
 
       !                                            ! ---------------------------------------- !
@@ -255,11 +256,17 @@
       !!----------------------------------------------------------------------
       CHARACTER(len=32) ::   rn_dep_file   ! runoff file name
-      INTEGER           ::   ji, jj, jk    ! dummy loop indices
+      INTEGER           ::   ji, jj, jk, jm    ! dummy loop indices
       INTEGER           ::   ierror, inum  ! temporary integer
       INTEGER           ::   ios           ! Local integer output status for namelist read
+      INTEGER           ::   nbrec         ! temporary integer
+      REAL(wp)          ::   zacoef  
+      REAL(wp), DIMENSION(12)                 :: zrec             ! times records
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zrnfcl    
+      REAL(wp), DIMENSION(:,:  ), ALLOCATABLE :: zrnf
       !
       NAMELIST/namsbc_rnf/ cn_dir, ln_rnf_emp, ln_rnf_depth, ln_rnf_tem, ln_rnf_sal,   &
          &                 sn_rnf, sn_cnf    , sn_s_rnf    , sn_t_rnf  , sn_dep_rnf,   &
-         &                 ln_rnf_mouth      , rn_hrnf     , rn_avt_rnf, rn_rfact
+         &                 ln_rnf_mouth      , rn_hrnf     , rn_avt_rnf, rn_rfact,     &
+         &                 ln_rnf_depth_ini  , rn_dep_max  , rn_rnf_max, nn_rnf_depth_file
       !!----------------------------------------------------------------------
       !
@@ -299,7 +306,7 @@
          IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) '          runoffs directly provided in the precipitations'
-         IF( ln_rnf_depth .OR. ln_rnf_tem .OR. ln_rnf_sal ) THEN
+         IF( ln_rnf_depth .OR. ln_rnf_tem .OR. ln_rnf_sal .OR. ln_rnf_depth_ini ) THEN
            CALL ctl_warn( 'runoffs already included in precipitations, so runoff (T,S, depth) attributes will not be used' )
-           ln_rnf_depth = .FALSE.   ;   ln_rnf_tem = .FALSE.   ;   ln_rnf_sal = .FALSE.
+           ln_rnf_depth = .FALSE.   ;   ln_rnf_tem = .FALSE.   ;   ln_rnf_sal = .FALSE.  ;   ln_rnf_depth_ini = .FALSE.
          ENDIF
          !
@@ -375,4 +382,68 @@
                END DO
             END DO
+            !
+         ELSE IF( ln_rnf_depth_ini ) THEN           ! runoffs applied at the surface
+            !
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) '    depth of runoff computed once from max value of runoff'
+            IF(lwp) WRITE(numout,*) '    max value of the runoff climatologie (over global domain) rn_rnf_max = ', rn_rnf_max
+            IF(lwp) WRITE(numout,*) '    depth over which runoffs is spread                        rn_dep_max = ', rn_dep_max
+            IF(lwp) WRITE(numout,*) '     create (=1) a runoff depth file or not (=0)      nn_rnf_depth_file  = ', nn_rnf_depth_file
+
+            CALL iom_open( TRIM( sn_rnf%clname ), inum )    !  open runoff file
+            CALL iom_gettime( inum, zrec, kntime=nbrec)
+            ALLOCATE( zrnfcl(jpi,jpj,nbrec) )     ;      ALLOCATE( zrnf(jpi,jpj) )
+            DO jm = 1, nbrec
+               CALL iom_get( inum, jpdom_data, TRIM( sn_rnf%clvar ), zrnfcl(:,:,jm), jm )
+            END DO
+            CALL iom_close( inum )
+            zrnf(:,:) = MAXVAL( zrnfcl(:,:,:), DIM=3 )   !  maximum value in time
+            DEALLOCATE( zrnfcl )
+            !
+            h_rnf(:,:) = 1.
+            !
+            zacoef = rn_dep_max / rn_rnf_max            ! coef of linear relation between runoff and its depth (150m for max of runoff)
+            !
+            WHERE( zrnf(:,:) > 0._wp )  h_rnf(:,:) = zacoef * zrnf(:,:)   ! compute depth for all runoffs
+            !
+            DO jj = 1, jpj                     ! take in account min depth of ocean rn_hmin
+               DO ji = 1, jpi
+                  IF( zrnf(ji,jj) > 0._wp ) THEN
+                     jk = mbkt(ji,jj)
+                     h_rnf(ji,jj) = MIN( h_rnf(ji,jj), gdept_0(ji,jj,jk ) )
+                  ENDIF
+               END DO
+            END DO
+            !
+            nk_rnf(:,:) = 0                       ! number of levels on which runoffs are distributed
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                   IF( zrnf(ji,jj) > 0._wp ) THEN
+                     jk = 2
+                     DO WHILE ( jk /= mbkt(ji,jj) .AND. gdept_0(ji,jj,jk) < h_rnf(ji,jj) ) ;  jk = jk + 1 ;  END DO
+                     nk_rnf(ji,jj) = jk
+                   ELSE
+                     nk_rnf(ji,jj) = 1
+                   ENDIF
+                END DO
+            END DO
+            !
+            DEALLOCATE( zrnf )
+            !
+            DO jj = 1, jpj                                ! set the associated depth
+               DO ji = 1, jpi
+                  h_rnf(ji,jj) = 0._wp
+                  DO jk = 1, nk_rnf(ji,jj)
+                     h_rnf(ji,jj) = h_rnf(ji,jj) + fse3t(ji,jj,jk)
+                  END DO
+               END DO
+            END DO
+            !
+            IF( nn_rnf_depth_file == 1 ) THEN      !  save  output nb levels for runoff
+               IF(lwp) WRITE(numout,*) '              create runoff depht file'
+               CALL iom_open  ( TRIM( sn_dep_rnf%clname ), inum, ldwrt = .TRUE., kiolib = jprstlib )
+               CALL iom_rstput( 0, 0, inum, 'rodepth', h_rnf )
+               CALL iom_close ( inum )
+            ENDIF
          ELSE                                       ! runoffs applied at the surface
             nk_rnf(:,:) = 1
Index: trunk/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 5385)
@@ -143,6 +143,7 @@
       ELSE                                            ! Leap-Frog + Asselin filter time stepping
          !
-         IF( lk_vvl )  THEN   ;   CALL tra_nxt_vvl( kt, nit000, 'TRA', tsb, tsn, tsa, jpts )  ! variable volume level (vvl)     
-         ELSE                 ;   CALL tra_nxt_fix( kt, nit000, 'TRA', tsb, tsn, tsa, jpts )  ! fixed    volume level 
+         IF( lk_vvl )  THEN   ;   CALL tra_nxt_vvl( kt, nit000, rdttra, 'TRA', tsb, tsn, tsa,   &
+           &                                                              sbc_tsc, sbc_tsc_b, jpts )  ! variable volume level (vvl) 
+         ELSE                 ;   CALL tra_nxt_fix( kt, nit000,         'TRA', tsb, tsn, tsa, jpts )  ! fixed    volume level 
          ENDIF
       ENDIF 
@@ -241,5 +242,5 @@
 
 
-   SUBROUTINE tra_nxt_vvl( kt, kit000, cdtype, ptb, ptn, pta, kjpt )
+   SUBROUTINE tra_nxt_vvl( kt, kit000, p2dt, cdtype, ptb, ptn, pta, psbc_tc, psbc_tc_b, kjpt )
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE tra_nxt_vvl  ***
@@ -265,13 +266,17 @@
       !!              - (ta,sa) time averaged (t,s)   (ln_dynhpg_imp = T)
       !!----------------------------------------------------------------------
-      INTEGER         , INTENT(in   )                               ::   kt       ! ocean time-step index
-      INTEGER         , INTENT(in   )                               ::   kit000   ! first time step index
-      CHARACTER(len=3), INTENT(in   )                               ::   cdtype   ! =TRA or TRC (tracer indicator)
-      INTEGER         , INTENT(in   )                               ::   kjpt     ! number of tracers
-      REAL(wp)        , INTENT(inout), DIMENSION(jpi,jpj,jpk,kjpt)  ::   ptb      ! before tracer fields
-      REAL(wp)        , INTENT(inout), DIMENSION(jpi,jpj,jpk,kjpt)  ::   ptn      ! now tracer fields
-      REAL(wp)        , INTENT(inout), DIMENSION(jpi,jpj,jpk,kjpt)  ::   pta      ! tracer trend
+      INTEGER         , INTENT(in   )                               ::  kt       ! ocean time-step index
+      INTEGER         , INTENT(in   )                               ::  kit000   ! first time step index
+      REAL(wp)        , INTENT(in   ), DIMENSION(jpk)               ::  p2dt     ! time-step
+      CHARACTER(len=3), INTENT(in   )                               ::  cdtype   ! =TRA or TRC (tracer indicator)
+      INTEGER         , INTENT(in   )                               ::  kjpt     ! number of tracers
+      REAL(wp)        , INTENT(inout), DIMENSION(jpi,jpj,jpk,kjpt)  ::  ptb      ! before tracer fields
+      REAL(wp)        , INTENT(inout), DIMENSION(jpi,jpj,jpk,kjpt)  ::  ptn      ! now tracer fields
+      REAL(wp)        , INTENT(inout), DIMENSION(jpi,jpj,jpk,kjpt)  ::  pta      ! tracer trend
+      REAL(wp)        , INTENT(in   ), DIMENSION(jpi,jpj,kjpt)      ::  psbc_tc   ! surface tracer content
+      REAL(wp)        , INTENT(in   ), DIMENSION(jpi,jpj,kjpt)      ::  psbc_tc_b ! before surface tracer content
+
       !!     
-      LOGICAL  ::   ll_tra, ll_tra_hpg, ll_traqsr   ! local logical
+      LOGICAL  ::   ll_tra_hpg, ll_traqsr   ! local logical
       INTEGER  ::   ji, jj, jk, jn              ! dummy loop indices
       REAL(wp) ::   zfact1, ztc_a , ztc_n , ztc_b , ztc_f , ztc_d    ! local scalar
@@ -286,9 +291,7 @@
       !
       IF( cdtype == 'TRA' )  THEN   
-         ll_tra     = .TRUE.           ! active tracers case  
          ll_tra_hpg = ln_dynhpg_imp    ! active  tracers case  and  semi-implicit hpg
          ll_traqsr  = ln_traqsr        ! active  tracers case  and  solar penetration
       ELSE                          
-         ll_tra     = .FALSE.          ! passive tracers case
          ll_tra_hpg = .FALSE.          ! passive tracers case or NO semi-implicit hpg
          ll_traqsr  = .FALSE.          ! active  tracers case and NO solar penetration
@@ -297,5 +300,5 @@
       DO jn = 1, kjpt      
          DO jk = 1, jpkm1
-            zfact1 = atfp * rdttra(jk)
+            zfact1 = atfp * p2dt(jk)
             zfact2 = zfact1 / rau0
             DO jj = 1, jpj
@@ -315,7 +318,7 @@
                   ztc_f  = ztc_n  + atfp * ztc_d
                   !
-                  IF( ll_tra .AND. jk == 1 ) THEN           ! first level only for T & S
-                      ze3t_f = ze3t_f - zfact2 * ( emp_b(ji,jj) - emp(ji,jj) )
-                      ztc_f  = ztc_f  - zfact1 * ( sbc_tsc(ji,jj,jn) - sbc_tsc_b(ji,jj,jn) )
+                  IF( jk == 1 ) THEN           ! first level 
+                     ze3t_f = ze3t_f - zfact2 * ( emp_b(ji,jj) - emp(ji,jj) )
+                     ztc_f  = ztc_f  - zfact1 * ( psbc_tc(ji,jj,jn) - psbc_tc_b(ji,jj,jn) )
                   ENDIF
                   IF( ll_traqsr .AND. jn == jp_tem .AND. jk <= nksr )   &     ! solar penetration (temperature only)
Index: trunk/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90	(revision 5385)
@@ -88,4 +88,8 @@
          &             tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
       END SELECT
+      ! DRAKKAR SSS control {
+      ! JMM avoid negative salinities near river outlet ! Ugly fix
+      ! JMM : restore negative salinities to small salinities:
+      WHERE ( tsa(:,:,:,jp_sal) < 0._wp )   tsa(:,:,:,jp_sal) = 0.1_wp
 
       IF( l_trdtra )   THEN                      ! save the vertical diffusive trends for further diagnostics
Index: trunk/NEMOGCM/NEMO/OPA_SRC/trc_oce.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/trc_oce.F90	(revision 5366)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/trc_oce.F90	(revision 5385)
@@ -32,4 +32,5 @@
    !!   'key_top'                                                 bio-model          
    !!----------------------------------------------------------------------
+   LOGICAL, PUBLIC, PARAMETER ::   lk_top     = .TRUE.   !: TOP model
    LOGICAL, PUBLIC, PARAMETER ::   lk_qsr_bio = .TRUE.   !: bio-model light absorption flag
 #else
@@ -37,4 +38,5 @@
    !! Default option                          No bio-model light absorption      
    !!----------------------------------------------------------------------
+   LOGICAL, PUBLIC, PARAMETER ::   lk_top     = .FALSE.   !: TOP model
    LOGICAL, PUBLIC, PARAMETER ::   lk_qsr_bio = .FALSE.   !: bio-model light absorption flag
 #endif
