Index: branches/devmercator2010/NEMO/OPA_SRC/DIA/diaar5.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DIA/diaar5.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DIA/diaar5.F90	(revision 2071)
@@ -175,8 +175,7 @@
       thick0(:,:) = 0.e0
       DO jk = 1, jpkm1
-         vol0        = vol0        + SUM( area (:,:) * tmask(:,:,jk) * fse3t_0(:,:,jk) )
-         thick0(:,:) = thick0(:,:) +    tmask_i(:,:) * tmask(:,:,jk) * fse3t_0(:,:,jk)
-      END DO
-      IF( lk_mpp )   CALL mpp_sum( vol0 )
+         vol0        = vol0        + SUM( area (:,:) * tmask(:,:,jk) ) * e3t_0(jk) 
+         thick0(:,:) = thick0(:,:) +    tmask_i(:,:) * tmask(:,:,jk)   * e3t_0(jk)
+      END DO
       
       CALL iom_open ( 'data_1m_salinity_nomask', inum )
Index: branches/devmercator2010/NEMO/OPA_SRC/DIA/diadimg.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DIA/diadimg.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DIA/diadimg.F90	(revision 2071)
@@ -10,5 +10,4 @@
    USE dom_oce         ! ocean space and time domain
    USE in_out_manager  ! I/O manager
-   USE daymod          ! calendar
 
    IMPLICIT NONE
@@ -22,5 +21,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$ 
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
@@ -57,7 +56,6 @@
     INTEGER :: jk, jn           ! dummy loop indices
     INTEGER :: irecl4,             &    ! record length in bytes
-         &       inum,             &    ! logical unit (set to 14)
-         &       irec,             &    ! current record to be written
-         &       irecend                ! record number where nclit... are stored
+         &       inum,             &    ! logical unit
+         &       irec                   ! current record to be written
     REAL(sp)                    :: zdx,zdy,zspval,zwest,ztimm
     REAL(sp)                    :: zsouth
@@ -71,5 +69,5 @@
     !! * Initialisations
 
-    irecl4 = MAX(jpi*jpj*sp , 84+(18+1+jpk)*sp )
+    irecl4 = MAX(jpi*jpj*sp , 84+18*sp + (jpk+8)*jpnij*sp  )
 
     zspval=0.0_sp    ! special values on land
@@ -103,7 +101,6 @@
 
     IF ( ln_dimgnnn  ) THEN
-     irecl4 = MAX(jpi*jpj*sp , 84+(18+jpk)*sp + 8*jpnij*sp  )
        WRITE(clname,'(a,a,i3.3)') TRIM(cd_name),'.',narea
-       CALL ctl_opn(inum, clname,'UNKNOWN','UNFORMATTED','DIRECT',irecl4,numout,lwp)
+       CALL ctl_opn( inum, clname, 'REPLACE', 'UNFORMATTED', 'DIRECT', irecl4, numout, lwp )
        WRITE(inum,REC=1 ) clver, cd_text, irecl4, &
             &     jpi,jpj, klev, 1 , 1 ,            &
@@ -130,36 +127,16 @@
        ENDIF
     ELSE
-       clver='@!03'           ! dimg string identifier
-       ! note that version @!02 is optimized with respect to record length.
-       ! The vertical dep variable is reduced to klev instead of klev*jpnij :
-       !   this is OK for jpnij < 181 (jpk=46)
-       ! for more processors, irecl4 get huge and that's why we switch to '@!03':
-       !  In this case we just add an extra integer to the standard dimg structure,
-       !  which is a record number where the arrays nlci etc... starts (1 per record)
-       
        !! Standard dimgproc (1 file per variable, all procs. write to this file )
        !! * Open file
-       CALL ctl_opn(inum, cd_name,'UNKNOWN','UNFORMATTED','DIRECT',irecl4,numout,lwp)
+       CALL ctl_opn( inum, cd_name, 'REPLACE', 'UNFORMATTED', 'DIRECT', irecl4, numout, lwp )
 
        !! * Write header on record #1
-       irecend=1 + klev*jpnij 
        IF(lwp) WRITE(inum,REC=1 ) clver, cd_text, irecl4, &
-            &     jpi,jpj, klev, 1 , 1 ,            &
+            &     jpi,jpj, klev*jpnij, 1 , 1 ,            &
             &     zwest, zsouth, zdx, zdy, zspval,  &
-            &     z4dep(1:klev),       &
+            &     (z4dep(1:klev),jn=1,jpnij),       &
             &     ztimm,                            &
-            &     narea, jpnij,jpiglo,jpjglo,jpizoom, jpjzoom, irecend 
-       IF (lwp ) THEN
-         WRITE(inum,REC=irecend + 1 ) nlcit
-         WRITE(inum,REC=irecend + 2 ) nlcjt
-         WRITE(inum,REC=irecend + 3 ) nldit
-         WRITE(inum,REC=irecend + 4 ) nldjt
-         WRITE(inum,REC=irecend + 5 ) nleit
-         WRITE(inum,REC=irecend + 6 ) nlejt
-         WRITE(inum,REC=irecend + 7 ) nimppt
-         WRITE(inum,REC=irecend + 8 ) njmppt
-       ENDIF
-      !   &    ! extension to dimg for mpp output
-      !   &     nlcit,nlcjt, nldit, nldjt, nleit, nlejt, nimppt, njmppt  !
+            &     narea, jpnij,jpiglo,jpjglo,jpizoom, jpjzoom,    &    ! extension to dimg for mpp output
+            &     nlcit,nlcjt, nldit, nldjt, nleit, nlejt, nimppt, njmppt  !
 
        !! * Write klev levels
Index: branches/devmercator2010/NEMO/OPA_SRC/DIA/dianam.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DIA/dianam.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DIA/dianam.F90	(revision 2071)
@@ -129,5 +129,7 @@
  
       cdfnam = TRIM(cexper)//TRIM(clave)//"_"//TRIM(cldate1)//"_"//TRIM(cldate2)//"_"//TRIM(cdsuff)
-      IF( .NOT. Agrif_Root() ) cdfnam = TRIM(Agrif_CFixed())//'_'//TRIM(cdfnam)
+#if defined key_agrif
+      if ( .NOT. Agrif_Root() ) cdfnam = TRIM(Agrif_CFixed())//'_'//TRIM(cdfnam)
+#endif    
 
    END SUBROUTINE dia_nam
Index: branches/devmercator2010/NEMO/OPA_SRC/DIA/diaptr.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DIA/diaptr.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DIA/diaptr.F90	(revision 2071)
@@ -362,4 +362,38 @@
 #endif
 
+            ! "Meridional" Stream-Function
+            DO jk = 2,jpk 
+               v_msf_glo(:,jk) = v_msf_glo(:,jk-1) + v_msf_glo(:,jk)
+            END DO
+            v_msf_glo(:,:) = v_msf_glo(:,:) * zsverdrup
+#if defined key_diaeiv
+            ! Bolus "Meridional" Stream-Function
+            DO jk = 2,jpk
+               v_msf_eiv_glo(:,jk) = v_msf_eiv_glo(:,jk-1) + v_msf_eiv_glo(:,jk)
+            END DO
+            v_msf_eiv_glo(:,:) = v_msf_eiv_glo(:,:) * zsverdrup
+            IF ( ln_subbas ) THEN 
+               DO jk = 2,jpk
+                  v_msf_eiv_atl(:,jk) = v_msf_eiv_atl(:,jk-1) + v_msf_eiv_atl(:,jk)
+                  v_msf_eiv_pac(:,jk) = v_msf_eiv_pac(:,jk-1) + v_msf_eiv_pac(:,jk)
+                  v_msf_eiv_ind(:,jk) = v_msf_eiv_ind(:,jk-1) + v_msf_eiv_ind(:,jk)
+                  v_msf_eiv_ipc(:,jk) = v_msf_eiv_ipc(:,jk-1) + v_msf_eiv_ipc(:,jk)
+               END DO
+            ENDIF
+#endif
+            !
+            IF( ln_subbas .AND. ln_diaznl ) THEN
+               DO jk = 2,jpk 
+                  v_msf_atl(:,jk) = v_msf_atl(:,jk-1) + v_msf_atl(:,jk)
+                  v_msf_pac(:,jk) = v_msf_pac(:,jk-1) + v_msf_pac(:,jk)
+                  v_msf_ind(:,jk) = v_msf_ind(:,jk-1) + v_msf_ind(:,jk)
+                  v_msf_ipc(:,jk) = v_msf_ipc(:,jk-1) + v_msf_ipc(:,jk)
+               END DO
+               v_msf_atl(:,:) = v_msf_atl(:,:) * zsverdrup
+               v_msf_pac(:,:) = v_msf_pac(:,:) * zsverdrup
+               v_msf_ind(:,:) = v_msf_ind(:,:) * zsverdrup
+               v_msf_ipc(:,:) = v_msf_ipc(:,:) * zsverdrup
+            ENDIF
+
             ! Transports
             ! T times V on T points (include bolus velocities)
@@ -451,38 +485,4 @@
                st_ind(:) = st_ind(:) * zggram
                st_ipc(:) = st_ipc(:) * zggram
-            ENDIF
-
-            ! "Meridional" Stream-Function
-            DO jk = 2,jpk 
-               v_msf_glo(:,jk) = v_msf_glo(:,jk-1) + v_msf_glo(:,jk)
-            END DO
-            v_msf_glo(:,:) = v_msf_glo(:,:) * zsverdrup
-#if defined key_diaeiv
-            ! Bolus "Meridional" Stream-Function
-            DO jk = 2,jpk
-               v_msf_eiv_glo(:,jk) = v_msf_eiv_glo(:,jk-1) + v_msf_eiv_glo(:,jk)
-            END DO
-            v_msf_eiv_glo(:,:) = v_msf_eiv_glo(:,:) * zsverdrup
-            IF ( ln_subbas ) THEN 
-               DO jk = 2,jpk
-                  v_msf_eiv_atl(:,jk) = v_msf_eiv_atl(:,jk-1) + v_msf_eiv_atl(:,jk)
-                  v_msf_eiv_pac(:,jk) = v_msf_eiv_pac(:,jk-1) + v_msf_eiv_pac(:,jk)
-                  v_msf_eiv_ind(:,jk) = v_msf_eiv_ind(:,jk-1) + v_msf_eiv_ind(:,jk)
-                  v_msf_eiv_ipc(:,jk) = v_msf_eiv_ipc(:,jk-1) + v_msf_eiv_ipc(:,jk)
-               END DO
-            ENDIF
-#endif
-            !
-            IF( ln_subbas .AND. ln_diaznl ) THEN
-               DO jk = 2,jpk 
-                  v_msf_atl(:,jk) = v_msf_atl(:,jk-1) + v_msf_atl(:,jk)
-                  v_msf_pac(:,jk) = v_msf_pac(:,jk-1) + v_msf_pac(:,jk)
-                  v_msf_ind(:,jk) = v_msf_ind(:,jk-1) + v_msf_ind(:,jk)
-                  v_msf_ipc(:,jk) = v_msf_ipc(:,jk-1) + v_msf_ipc(:,jk)
-               END DO
-               v_msf_atl(:,:) = v_msf_atl(:,:) * zsverdrup
-               v_msf_pac(:,:) = v_msf_pac(:,:) * zsverdrup
-               v_msf_ind(:,:) = v_msf_ind(:,:) * zsverdrup
-               v_msf_ipc(:,:) = v_msf_ipc(:,:) * zsverdrup
             ENDIF
          ENDIF
Index: branches/devmercator2010/NEMO/OPA_SRC/DIA/diawri.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DIA/diawri.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DIA/diawri.F90	(revision 2071)
@@ -629,5 +629,7 @@
       ! Define name, frequency of output and means
       clname = cdfile_name
-      IF( .NOT. Agrif_Root() ) clname = TRIM(Agrif_CFixed())//'_'//TRIM(clname)
+#if defined key_agrif
+      if ( .NOT. Agrif_Root() ) clname = TRIM(Agrif_CFixed())//'_'//TRIM(clname)
+#endif
       zdt  = rdt
       zsto = rdt
Index: branches/devmercator2010/NEMO/OPA_SRC/DOM/dom_oce.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 2071)
@@ -219,13 +219,4 @@
 #else
    LOGICAL, PUBLIC, PARAMETER ::   lk_agrif = .FALSE.   !: agrif flag
-
-CONTAINS
-   LOGICAL FUNCTION Agrif_Root()
-      Agrif_Root = .TRUE.
-   END FUNCTION Agrif_Root
-
-   CHARACTER(len=3) FUNCTION Agrif_CFixed()
-     Agrif_CFixed = '0' 
-   END FUNCTION Agrif_CFixed
 #endif
 
Index: branches/devmercator2010/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DOM/domain.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DOM/domain.F90	(revision 2071)
@@ -166,17 +166,21 @@
       ENDIF
 
+#if defined key_agrif
       IF( Agrif_Root() ) THEN
-         SELECT CASE ( nleapy )        ! Choose calendar for IOIPSL
-         CASE (  1 ) 
-            CALL ioconf_calendar('gregorian')
-            IF(lwp) WRITE(numout,*) '   The IOIPSL calendar is "gregorian", i.e. leap year'
-         CASE (  0 )
-            CALL ioconf_calendar('noleap')
-            IF(lwp) WRITE(numout,*) '   The IOIPSL calendar is "noleap", i.e. no leap year'
-         CASE ( 30 )
-            CALL ioconf_calendar('360d')
-            IF(lwp) WRITE(numout,*) '   The IOIPSL calendar is "360d", i.e. 360 days in a year'
-         END SELECT
-      ENDIF
+#endif
+      SELECT CASE ( nleapy )        ! Choose calendar for IOIPSL
+      CASE (  1 ) 
+         CALL ioconf_calendar('gregorian')
+         IF(lwp) WRITE(numout,*) '   The IOIPSL calendar is "gregorian", i.e. leap year'
+      CASE (  0 )
+         CALL ioconf_calendar('noleap')
+         IF(lwp) WRITE(numout,*) '   The IOIPSL calendar is "noleap", i.e. no leap year'
+      CASE ( 30 )
+         CALL ioconf_calendar('360d')
+         IF(lwp) WRITE(numout,*) '   The IOIPSL calendar is "360d", i.e. 360 days in a year'
+      END SELECT
+#if defined key_agrif
+      ENDIF
+#endif
 
       REWIND( numnam )             ! Namelist namdom : space & time domain (bathymetry, mesh, timestep)
Index: branches/devmercator2010/NEMO/OPA_SRC/DOM/domhgr.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DOM/domhgr.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DOM/domhgr.F90	(revision 2071)
@@ -270,5 +270,5 @@
          
 #if defined key_agrif && defined key_eel_r6
-         IF( .NOT. Agrif_Root() ) THEN
+         IF (.Not.Agrif_Root()) THEN
            glam0  = Agrif_Parent(glam0) + (Agrif_ix())*Agrif_Parent(ppe1_m) * 1.e-3
            gphi0  = Agrif_Parent(gphi0) + (Agrif_iy())*Agrif_Parent(ppe2_m) * 1.e-3
@@ -465,5 +465,5 @@
          
 #if defined key_agrif && defined key_eel_r6
-         IF( .NOT. Agrif_Root() ) THEN
+         IF (.Not.Agrif_Root()) THEN
            zphi0 = ppgphi0 - FLOAT( Agrif_Parent(jpjglo)/2)*Agrif_Parent(ppe2_m) / (ra * rad)
          ENDIF
Index: branches/devmercator2010/NEMO/OPA_SRC/DOM/domvvl.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 2071)
@@ -62,29 +62,14 @@
       IF( lk_zco )   CALL ctl_stop( 'dom_vvl : key_zco is incompatible with variable volume option key_vvl')
 
-      IF( ln_zco) THEN
-         DO jk = 1, jpk
-            gdept(:,:,jk) = gdept_0(jk)
-            gdepw(:,:,jk) = gdepw_0(jk)
-            gdep3w(:,:,jk) = gdepw_0(jk)
-            e3t (:,:,jk) = e3t_0(jk)
-            e3u (:,:,jk) = e3t_0(jk)
-            e3v (:,:,jk) = e3t_0(jk)
-            e3f (:,:,jk) = e3t_0(jk)
-            e3w (:,:,jk) = e3w_0(jk)
-            e3uw(:,:,jk) = e3w_0(jk)
-            e3vw(:,:,jk) = e3w_0(jk)
-         END DO
-      ELSE
-         fsdept(:,:,:) = gdept (:,:,:)
-         fsdepw(:,:,:) = gdepw (:,:,:)
-         fsde3w(:,:,:) = gdep3w(:,:,:)
-         fse3t (:,:,:) = e3t   (:,:,:)
-         fse3u (:,:,:) = e3u   (:,:,:)
-         fse3v (:,:,:) = e3v   (:,:,:)
-         fse3f (:,:,:) = e3f   (:,:,:)
-         fse3w (:,:,:) = e3w   (:,:,:)
-         fse3uw(:,:,:) = e3uw  (:,:,:)
-         fse3vw(:,:,:) = e3vw  (:,:,:)
-      ENDIF
+      fsdept(:,:,:) = gdept (:,:,:)
+      fsdepw(:,:,:) = gdepw (:,:,:)
+      fsde3w(:,:,:) = gdep3w(:,:,:)
+      fse3t (:,:,:) = e3t   (:,:,:)
+      fse3u (:,:,:) = e3u   (:,:,:)
+      fse3v (:,:,:) = e3v   (:,:,:)
+      fse3f (:,:,:) = e3f   (:,:,:)
+      fse3w (:,:,:) = e3w   (:,:,:)
+      fse3uw(:,:,:) = e3uw  (:,:,:)
+      fse3vw(:,:,:) = e3vw  (:,:,:)
 
       !                                 !==  mu computation  ==!
@@ -154,20 +139,4 @@
       CALL lbc_lnk( sshf_b, 'F', 1. )   ;   CALL lbc_lnk( sshf_n, 'F', 1. )
       !
-         DO jk = 1, jpkm1
-            fsdept(:,:,jk) = fsdept_n(:,:,jk)          ! now local depths stored in fsdep. arrays
-            fsdepw(:,:,jk) = fsdepw_n(:,:,jk)
-            fsde3w(:,:,jk) = fsde3w_n(:,:,jk)
-            !
-            fse3t (:,:,jk) = fse3t_n (:,:,jk)          ! vertical scale factors stored in fse3. arrays
-            fse3u (:,:,jk) = fse3u_n (:,:,jk)
-            fse3v (:,:,jk) = fse3v_n (:,:,jk)
-            fse3f (:,:,jk) = fse3f_n (:,:,jk)
-            fse3w (:,:,jk) = fse3w_n (:,:,jk)
-            fse3uw(:,:,jk) = fse3uw_n(:,:,jk)
-            fse3vw(:,:,jk) = fse3vw_n(:,:,jk)
-         END DO
-
-
-
    END SUBROUTINE dom_vvl
 
Index: branches/devmercator2010/NEMO/OPA_SRC/DOM/domwri.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DOM/domwri.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DOM/domwri.F90	(revision 2071)
@@ -45,16 +45,10 @@
       !!      domhgr, domzgr, and dommsk. Note: the file contain depends on
       !!      the vertical coord. used (z-coord, partial steps, s-coord)
-      !!            MOD(nmsh, 3) = 1  :   'mesh_mask.nc' file
+      !!                    nmsh = 1  :   'mesh_mask.nc' file
       !!                         = 2  :   'mesh.nc' and mask.nc' files
-      !!                         = 0  :   'mesh_hgr.nc', 'mesh_zgr.nc' and
+      !!                         = 3  :   'mesh_hgr.nc', 'mesh_zgr.nc' and
       !!                                  'mask.nc' files
       !!      For huge size domain, use option 2 or 3 depending on your 
       !!      vertical coordinate.
-      !!
-      !!      if     nmsh <= 3: write full 3D arrays for e3[tuvw] and gdep[tuvw]
-      !!      if 3 < nmsh <= 6: write full 3D arrays for e3[tuvw] and 2D arrays 
-      !!                        corresponding to the depth of the bottom points hdep[tw]
-      !!      if 6 < nmsh <= 9: write 2D arrays corresponding to the depth and the
-      !!                        thickness of the bottom points hdep[tw] and e3[tw]_ps
       !!
       !! ** output file : 
@@ -247,5 +241,5 @@
       !                                     !        close the files 
       !                                     ! ============================
-      SELECT CASE ( MOD(nmsh, 3) )
+      SELECT CASE ( nmsh )
       CASE ( 1 )                
          CALL iom_close( inum0 )
@@ -253,5 +247,5 @@
          CALL iom_close( inum1 )
          CALL iom_close( inum2 )
-      CASE ( 0 )
+      CASE ( 3 )
          CALL iom_close( inum2 )
          CALL iom_close( inum3 )
Index: branches/devmercator2010/NEMO/OPA_SRC/DOM/phycst.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DOM/phycst.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DOM/phycst.F90	(revision 2071)
@@ -4,9 +4,9 @@
    !!     Definition of of both ocean and ice parameters used in the code
    !!=====================================================================
-   !! History :   OPA  !  1990-10  (C. Levy - G. Madec)  Original code
-   !!             8.1  !  1991-11  (G. Madec, M. Imbard)  cosmetic changes
-   !!   NEMO      1.0  !  2002-08  (G. Madec, C. Ethe)  F90, add ice constants
-   !!              -   !  2006-08  (G. Madec)  style 
-   !!             3.2  !  2006-08  (S. Masson, G. Madec)  suppress useless variables + style 
+   !! History :        !  90-10  (C. Levy - G. Madec)  Original code
+   !!                  !  91-11  (G. Madec)
+   !!                  !  91-12  (M. Imbard)
+   !!             8.5  !  02-08  (G. Madec, C. Ethe)  F90, add ice constants
+   !!             9.0  !  06-08  (G. Madec)  style 
    !!----------------------------------------------------------------------
 
@@ -24,65 +24,67 @@
    REAL(wp), PUBLIC ::   rpi = 3.141592653589793_wp             !: pi
    REAL(wp), PUBLIC ::   rad = 3.141592653589793_wp / 180._wp   !: conversion from degre into radian
-   REAL(wp), PUBLIC ::   rsmall = 0.5 * EPSILON( 1.e0 )         !: smallest real computer value
+   REAL(wp), PUBLIC ::   rsmall = 0.5 * EPSILON( 1. )           !: smallest real computer value
    
-   REAL(wp), PUBLIC ::   rday = 24.*60.*60.       !: day (s)
-   REAL(wp), PUBLIC ::   rsiyea                   !: sideral year (s)
-   REAL(wp), PUBLIC ::   rsiday                   !: sideral day (s)
-   REAL(wp), PUBLIC ::   raamo =  12._wp          !: number of months in one year
-   REAL(wp), PUBLIC ::   rjjhh =  24._wp          !: number of hours in one day
-   REAL(wp), PUBLIC ::   rhhmm =  60._wp          !: number of minutes in one hour
-   REAL(wp), PUBLIC ::   rmmss =  60._wp          !: number of seconds in one minute
-!! REAL(wp), PUBLIC ::   omega = 7.292115083046061e-5_wp ,  &  !: change the last digit!
-   REAL(wp), PUBLIC ::   omega                    !: earth rotation parameter
-   REAL(wp), PUBLIC ::   ra    = 6371229._wp      !: earth radius (meter)
-   REAL(wp), PUBLIC ::   grav  = 9.80665_wp       !: gravity (m/s2)
+   REAL(wp), PUBLIC ::          & !:
+      rday = 24.*60.*60.  ,     & !: day (s)
+      rsiyea              ,     & !: sideral year (s)
+      rsiday              ,     & !: sideral day (s)
+      raamo =  12._wp     ,     & !: number of months in one year
+      rjjhh =  24._wp     ,     & !: number of hours in one day
+      rhhmm =  60._wp     ,     & !: number of minutes in one hour
+      rmmss =  60._wp     ,     & !: number of seconds in one minute
+!!!   omega = 7.292115083046061e-5_wp ,  &  !: change the last digit!
+      omega               ,    &  !: earth rotation parameter
+      ra    = 6371229._wp ,    &  !: earth radius (meter)
+      grav  = 9.80665_wp          !: gravity (m/s2)
    
-   REAL(wp), PUBLIC ::   rtt      = 273.16_wp     !: triple point of temperature (Kelvin)
-   REAL(wp), PUBLIC ::   rt0      = 273.15_wp     !: freezing point of water (Kelvin)
+   REAL(wp), PUBLIC ::         &  !:
+      rtt      = 273.16_wp  ,  &  !: triple point of temperature (Kelvin)
+      rt0      = 273.15_wp  ,  &  !: freezing point of water (Kelvin)
 #if defined key_lim3
-   REAL(wp), PUBLIC ::   rt0_snow = 273.16_wp     !: melting point of snow  (Kelvin)
-   REAL(wp), PUBLIC ::   rt0_ice  = 273.16_wp     !: melting point of ice   (Kelvin)
+      rt0_snow = 273.16_wp  ,  &  !: melting point of snow  (Kelvin)
+      rt0_ice  = 273.16_wp  ,  &  !: melting point of ice   (Kelvin)
 #else
-   REAL(wp), PUBLIC ::   rt0_snow = 273.15_wp     !: melting point of snow  (Kelvin)
-   REAL(wp), PUBLIC ::   rt0_ice  = 273.05_wp     !: melting point of ice   (Kelvin)
+      rt0_snow = 273.15_wp  ,  &  !: melting point of snow  (Kelvin)
+      rt0_ice  = 273.05_wp  ,  &  !: melting point of ice   (Kelvin)
 #endif
+      rau0     = 1035._wp   ,  &  !: volumic mass of reference (kg/m3)
+      rauw     = 1000._wp   ,  &  !: volumic mass of pure water (kg/m3)
+      rcp      =    4.e+3_wp,  &  !: ocean specific heat
+      ro0cpr                      !: = 1. / ( rau0 * rcp )
 
-   REAL(wp), PUBLIC ::   rau0     = 1020._wp      !: reference volumic mass (density)  (kg/m3)
-   REAL(wp), PUBLIC ::   rau0r                    !: reference specific volume         (m3/kg)
-   REAL(wp), PUBLIC ::   rcp      =    4.e+3_wp   !: ocean specific heat
-   REAL(wp), PUBLIC ::   ro0cpr                   !: = 1. / ( rau0 * rcp )
-
+   REAL(wp), PUBLIC ::            &  !:
 #if defined key_lim3
-   REAL(wp), PUBLIC ::   rcdsn   =   0.31_wp      !: thermal conductivity of snow
-   REAL(wp), PUBLIC ::   rcdic   =   2.034396_wp  !: thermal conductivity of fresh ice
-   REAL(wp), PUBLIC ::   cpic    = 2067.0         !: specific heat of sea ice
-   REAL(wp), PUBLIC ::   lsub    = 2.834e+6       !: pure ice latent heat of sublimation (J.kg-1)
-   REAL(wp), PUBLIC ::   lfus    = 0.334e+6       !: latent heat of fusion of fresh ice   (J.kg-1)
-   REAL(wp), PUBLIC ::   rhoic   = 917._wp        !: volumic mass of sea ice (kg/m3)
-   REAL(wp), PUBLIC ::   tmut    =   0.054        !: decrease of seawater meltpoint with salinity
+      rcdsn   =   0.31_wp     ,   &  !: thermal conductivity of snow
+      rcdic   =   2.034396_wp ,   &  !: thermal conductivity of fresh ice
+      cpic    = 2067.0        ,   &
+      ! add the following lines
+      lsub    = 2.834e+6      ,   &  !: pure ice latent heat of sublimation (J.kg-1)
+      lfus    = 0.334e+6      ,   &  !: latent heat of fusion of fresh ice   (J.kg-1)
+      rhoic   = 917._wp       ,   &  !: volumic mass of sea ice (kg/m3)
+      tmut    =   0.054       ,   &  !: decrease of seawater meltpoint with salinity
 #else
-   REAL(wp), PUBLIC ::   rcdsn   =   0.22_wp      !: conductivity of the snow
-   REAL(wp), PUBLIC ::   rcdic   =   2.034396_wp  !: conductivity of the ice
-   REAL(wp), PUBLIC ::   rcpsn   =   6.9069e+5_wp !: density times specific heat for snow
-   REAL(wp), PUBLIC ::   rcpic   =   1.8837e+6_wp !: volumetric latent heat fusion of sea ice
-   REAL(wp), PUBLIC ::   lfus    =   0.3337e+6    !: latent heat of fusion of fresh ice   (J.kg-1) 	
-   REAL(wp), PUBLIC ::   xlsn    = 110.121e+6_wp  !: volumetric latent heat fusion of snow
-   REAL(wp), PUBLIC ::   xlic    = 300.33e+6_wp   !: volumetric latent heat fusion of ice
-   REAL(wp), PUBLIC ::   xsn     =   2.8e+6       !: latent heat of sublimation of snow
-   REAL(wp), PUBLIC ::   rhoic   = 900._wp        !: volumic mass of sea ice (kg/m3)
+      rcdsn   =   0.22_wp     ,   &  !: conductivity of the snow
+      rcdic   =   2.034396_wp ,   &  !: conductivity of the ice
+      rcpsn   =   6.9069e+5_wp,   &  !: density times specific heat for snow
+      rcpic   =   1.8837e+6_wp,   &  !: volumetric latent heat fusion of sea ice
+      xlsn    = 110.121e+6_wp ,   &  !: volumetric latent heat fusion of snow
+      xlic    = 300.33e+6_wp  ,   &  !: volumetric latent heat fusion of ice
+      xsn     =   2.8e+6      ,   &  !: latent heat of sublimation of snow
+      rhoic   = 900._wp       ,   &  !: volumic mass of sea ice (kg/m3)
 #endif
-   REAL(wp), PUBLIC ::   rhosn   = 330._wp        !: volumic mass of snow (kg/m3)
-   REAL(wp), PUBLIC ::   emic    =   0.97_wp      !: emissivity of snow or ice
-   REAL(wp), PUBLIC ::   sice    =   6.0_wp       !: reference salinity of ice (psu)
-   REAL(wp), PUBLIC ::   soce    =  34.7_wp       !: reference salinity of sea (psu)
-   REAL(wp), PUBLIC ::   cevap   =   2.5e+6_wp    !: latent heat of evaporation (water)
-   REAL(wp), PUBLIC ::   srgamma =   0.9_wp       !: correction factor for solar radiation (Oberhuber, 1974)
-   REAL(wp), PUBLIC ::   vkarmn  =   0.4_wp       !: von Karman constant
-   REAL(wp), PUBLIC ::   stefan  =   5.67e-8_wp   !: Stefan-Boltzmann constant 
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009) 
-   !! $Id$ 
-   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
+      rhosn   = 330._wp       ,   &  !: volumic mass of snow (kg/m3)
+      emic    =   0.97_wp     ,   &  !: emissivity of snow or ice
+      sice    =   6.0_wp      ,   &  !: salinity of ice (psu)
+      soce    =  34.7_wp      ,   &  !: salinity of sea (psu)
+      cevap   =   2.5e+6_wp   ,   &  !: latent heat of evaporation (water)
+      srgamma =   0.9_wp      ,   &  !: correction factor for solar radiation (Oberhuber, 1974)
+      vkarmn  =   0.4_wp      ,   &  !: von Karman constant
+      stefan  =   5.67e-8_wp         !: Stefan-Boltzmann constant 
+      !!----------------------------------------------------------------------
+      !!  OPA 9.0 , LOCEAN-IPSL (2005) 
+      !! $Id$ 
+      !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+      !!----------------------------------------------------------------------
    
 CONTAINS
@@ -97,17 +99,11 @@
       !!----------------------------------------------------------------------
 
-      !                                   ! Define additional parameters
-      rsiyea = 365.25 * rday * 2. * rpi / 6.283076
-      rsiday = rday / ( 1. + rday / rsiyea )
-      omega  = 2. * rpi / rsiday 
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) ' phy_cst : initialization of ocean parameters and constants'
+      IF(lwp) WRITE(numout,*) ' ~~~~~~~'
 
-      rau0r  = 1. /   rau0  
-      ro0cpr = 1. / ( rau0 * rcp )
-
-
-      IF(lwp) THEN                        ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) ' phy_cst : initialization of ocean parameters and constants'
-         WRITE(numout,*) ' ~~~~~~~'
+      ! Ocean Parameters
+      ! ----------------
+      IF(lwp) THEN
          WRITE(numout,*) '       Domain info'
          WRITE(numout,*) '          dimension of model'
@@ -122,30 +118,47 @@
          WRITE(numout,*) '             jpnij   : ', jpnij
          WRITE(numout,*) '          lateral domain boundary condition type : jperio  = ', jperio
-         WRITE(numout,*)
-         WRITE(numout,*) '       Constants'
-         WRITE(numout,*)
-         WRITE(numout,*) '          mathematical constant                 rpi = ', rpi
-         WRITE(numout,*) '          day                                rday   = ', rday,   ' s'
-         WRITE(numout,*) '          sideral year                       rsiyea = ', rsiyea, ' s'
-         WRITE(numout,*) '          sideral day                        rsiday = ', rsiday, ' s'
-         WRITE(numout,*) '          omega                              omega  = ', omega,  ' s-1'
-         WRITE(numout,*)
-         WRITE(numout,*) '          nb of months per year               raamo = ', raamo, ' months'
-         WRITE(numout,*) '          nb of hours per day                 rjjhh = ', rjjhh, ' hours'
-         WRITE(numout,*) '          nb of minutes per hour              rhhmm = ', rhhmm, ' mn'
-         WRITE(numout,*) '          nb of seconds per minute            rmmss = ', rmmss, ' s'
-         WRITE(numout,*)
-         WRITE(numout,*) '          earth radius                         ra   = ', ra, ' m'
-         WRITE(numout,*) '          gravity                              grav = ', grav , ' m/s^2'
-         WRITE(numout,*)
-         WRITE(numout,*) '          triple point of temperature      rtt      = ', rtt     , ' K'
-         WRITE(numout,*) '          freezing point of water          rt0      = ', rt0     , ' K'
-         WRITE(numout,*) '          melting point of snow            rt0_snow = ', rt0_snow, ' K'
-         WRITE(numout,*) '          melting point of ice             rt0_ice  = ', rt0_ice , ' K'
-         WRITE(numout,*)
-         WRITE(numout,*) '          ocean reference volumic mass       rau0   = ', rau0 , ' kg/m^3'
-         WRITE(numout,*) '          ocean reference specific volume    rau0r  = ', rau0r, ' m^3/Kg'
-         WRITE(numout,*) '          ocean specific heat                rcp    = ', rcp
-         WRITE(numout,*) '                       1. / ( rau0 * rcp ) = ro0cpr = ', ro0cpr
+      ENDIF
+
+      ! Define constants
+      ! ----------------
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '       Constants'
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          mathematical constant                 rpi = ', rpi
+
+      rsiyea = 365.25 * rday * 2. * rpi / 6.283076
+      rsiday = rday / ( 1. + rday / rsiyea )
+      omega  = 2. * rpi / rsiday 
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          day                                rday   = ', rday,   ' s'
+      IF(lwp) WRITE(numout,*) '          sideral year                       rsiyea = ', rsiyea, ' s'
+      IF(lwp) WRITE(numout,*) '          sideral day                        rsiday = ', rsiday, ' s'
+      IF(lwp) WRITE(numout,*) '          omega                              omega  = ', omega,  ' s-1'
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          nb of months per year               raamo = ', raamo, ' months'
+      IF(lwp) WRITE(numout,*) '          nb of hours per day                 rjjhh = ', rjjhh, ' hours'
+      IF(lwp) WRITE(numout,*) '          nb of minutes per hour              rhhmm = ', rhhmm, ' mn'
+      IF(lwp) WRITE(numout,*) '          nb of seconds per minute            rmmss = ', rmmss, ' s'
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          earth radius                         ra   = ', ra, ' m'
+      IF(lwp) WRITE(numout,*) '          gravity                              grav = ', grav , ' m/s^2'
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          triple point of temperature      rtt      = ', rtt     , ' K'
+      IF(lwp) WRITE(numout,*) '          freezing point of water          rt0      = ', rt0     , ' K'
+      IF(lwp) WRITE(numout,*) '          melting point of snow            rt0_snow = ', rt0_snow, ' K'
+      IF(lwp) WRITE(numout,*) '          melting point of ice             rt0_ice  = ', rt0_ice , ' K'
+
+      ro0cpr = 1. / ( rau0 * rcp )
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          volumic mass of pure water         rauw   = ', rauw, ' kg/m^3'
+      IF(lwp) WRITE(numout,*) '          volumic mass of reference          rau0   = ', rau0, ' kg/m^3'
+      IF(lwp) WRITE(numout,*) '          ocean specific heat                rcp    = ', rcp
+      IF(lwp) WRITE(numout,*) '                       1. / ( rau0 * rcp ) = ro0cpr = ', ro0cpr
+
+      IF(lwp) THEN
          WRITE(numout,*)
          WRITE(numout,*) '          thermal conductivity of the snow          = ', rcdsn   , ' J/s/m/K'
@@ -171,6 +184,8 @@
          WRITE(numout,*) '          von Karman constant                       = ', vkarmn 
          WRITE(numout,*) '          Stefan-Boltzmann constant                 = ', stefan  , ' J/s/m^2/K^4'
+
          WRITE(numout,*)
          WRITE(numout,*) '          conversion: degre ==> radian          rad = ', rad
+
          WRITE(numout,*)
          WRITE(numout,*) '          smallest real computer value       rsmall = ', rsmall
Index: branches/devmercator2010/NEMO/OPA_SRC/DTA/dtasal.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DTA/dtasal.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DTA/dtasal.F90	(revision 2071)
@@ -13,4 +13,5 @@
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE fldread         ! read input fields
    USE in_out_manager  ! I/O manager
    USE phycst          ! physical constants
@@ -27,13 +28,8 @@
    !! * Shared module variables
    LOGICAL , PUBLIC, PARAMETER ::   lk_dtasal = .TRUE.    !: salinity data flag
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   &  !:
-      s_dta       !: salinity data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   s_dta    !: salinity data at given time-step
 
    !! * Module variables
-   INTEGER ::   &
-      numsdt,           &  !: logical unit for data salinity
-      nsal1, nsal2         ! first and second record used
-   REAL(wp), DIMENSION(jpi,jpj,jpk,2) ::   &
-      saldta    ! salinity data at two consecutive times
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_sal       ! structure of input SST (file informations, fields read)
 
    !! * Substitutions
@@ -52,255 +48,213 @@
 
    SUBROUTINE dta_sal( kt )
-     !!----------------------------------------------------------------------
-     !!                   ***  ROUTINE dta_sal  ***
-     !!        
-     !! ** Purpose :   Reads monthly salinity data
-     !!             
-     !! ** Method  : - Read on unit numsdt the monthly salinity data interpo-
-     !!     lated onto the model grid.
-     !!              - At each time step, a linear interpolation is applied
-     !!     between two monthly values.
-     !!
-     !! History :
-     !!        !  91-03  ()  Original code
-     !!        !  92-07  (M. Imbard)
-     !!   9.0  !  02-06  (G. Madec)  F90: Free form and module 
-     !!----------------------------------------------------------------------
-     !! * Modules used
-     USE iom
-     
-     !! * Arguments
-     INTEGER, INTENT(in) ::   kt             ! ocean time step
-     
-     !! * Local declarations
-     
-     INTEGER ::   ji, jj, jk, jl, jkk   ! dummy loop indicies
-     INTEGER ::   &
-          imois, iman, i15, ik           ! temporary integers
-#  if defined key_tradmp
-     INTEGER ::   &
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE dta_sal  ***
+      !!        
+      !! ** Purpose :   Reads monthly salinity data
+      !!             
+      !! ** Method  : - Read on unit numsdt the monthly salinity data interpo-
+      !!     lated onto the model grid.
+      !!              - At each time step, a linear interpolation is applied
+      !!     between two monthly values.
+      !!
+      !! History :
+      !!        !  91-03  ()  Original code
+      !!        !  92-07  (M. Imbard)
+      !!   9.0  !  02-06  (G. Madec)  F90: Free form and module 
+      !!----------------------------------------------------------------------
+     
+      !! * Arguments
+      INTEGER, INTENT(in) ::   kt             ! ocean time step
+      
+      !! * Local declarations
+     
+      INTEGER ::   ji, jj, jk, jl, jkk   ! dummy loop indicies
+      INTEGER ::   &
+           imois, iman, i15, ik           ! temporary integers
+      INTEGER            :: ierror
+#if defined key_tradmp
+      INTEGER ::   &
           il0, il1, ii0, ii1, ij0, ij1   ! temporary integers         
-# endif
-     REAL(wp) ::   zxy, zl
+#endif
+      REAL(wp) ::   zxy, zl
 #if defined key_orca_lev10
-     REAL(wp), DIMENSION(jpi,jpj,jpkdta,2) :: zsal
-     INTEGER   :: ikr, ikw, ikt, jjk
-     REAL(wp)  :: zfac
-#endif
-     REAL(wp), DIMENSION(jpk,2) ::   &
+      INTEGER   :: ikr, ikw, ikt, jjk
+      REAL(wp)  :: zfac
+#endif
+      REAL(wp), DIMENSION(jpk) ::   &
           zsaldta            ! auxiliary array for interpolation
-     !!----------------------------------------------------------------------
-     
-     ! 0. Initialization
-     ! -----------------
-     
-     iman  = INT( raamo )
-!!! better but change the results     i15 = INT( 2*FLOAT( nday ) / ( FLOAT( nobis(nmonth) ) + 0.5 ) )
-     i15   = nday / 16
-     imois = nmonth + i15 - 1
-     IF( imois == 0 ) imois = iman
-     
-     ! 1. First call kt=nit000
-     ! -----------------------
-     
-     IF( kt == nit000 ) THEN
-        
-        nsal1 = 0   ! initializations
-        IF(lwp) WRITE(numout,*) ' dta_sal : monthly salinity data in NetCDF file'
-        CALL iom_open ( 'data_1m_salinity_nomask', numsdt ) 
-        
-     ENDIF
-     
-     
-     ! 2. Read monthly file
-     ! -------------------
-     
-     IF( kt == nit000 .OR. imois /= nsal1 ) THEN
-        
-        ! 2.1 Calendar computation
-        
-        nsal1 = imois        ! first file record used 
-        nsal2 = nsal1 + 1    ! last  file record used
-        nsal1 = MOD( nsal1, iman )
-        IF( nsal1 == 0 ) nsal1 = iman
-        nsal2 = MOD( nsal2, iman )
-        IF( nsal2 == 0 ) nsal2 = iman
-        IF(lwp) WRITE(numout,*) 'first record file used nsal1 ', nsal1
-        IF(lwp) WRITE(numout,*) 'last  record file used nsal2 ', nsal2
-        
-        ! 2.3 Read monthly salinity data Levitus 
+      CHARACTER(len=100) :: cn_dir          ! Root directory for location of ssr files
+      TYPE(FLD_N)        :: sn_sal
+      LOGICAL , SAVE     :: linit_sal = .FALSE.
+      !!----------------------------------------------------------------------
+      NAMELIST/namdta_sal/cn_dir,sn_sal
+     
+      ! 1. Initialization
+      ! -----------------------
+     
+      IF( kt == nit000 .AND. ( .NOT. linit_sal ) ) THEN
+        
+         !                         ! set file information
+         cn_dir = './'             ! directory in which the model is executed
+         ! ... default values (NB: frequency positive => hours, negative => months)
+         !            !   file    ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   !
+         !            !   name    !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      !
+         sn_sal = FLD_N( 'salinity',  -1.  ,  'vosaline',  .false.   , .true.  ,  'monthly'  , ''       , ''         )
+
+         REWIND ( numnam )         ! ... read in namlist namdta_sal 
+         READ( numnam, namdta_sal ) 
+
+         IF(lwp) THEN              ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) 'dta_sal : Salinity Climatology '
+            WRITE(numout,*) '~~~~~~~ '
+         ENDIF
+         ALLOCATE( sf_sal(1), STAT=ierror )
+         IF( ierror > 0 ) THEN
+             CALL ctl_stop( 'dta_sal: unable to allocate sf_sal structure' )   ;   RETURN
+         ENDIF
+         ALLOCATE( sf_sal(1)%fnow(jpi,jpj,jpk) )
+         ALLOCATE( sf_sal(1)%fdta(jpi,jpj,jpk,2) )
+
+         ! fill sf_sal with sn_sal and control print
+         CALL fld_fill( sf_sal, (/ sn_sal /), cn_dir, 'dta_sal', 'Salinity data', 'namdta_sal' )
+         linit_sal = .TRUE.        
+      ENDIF
+     
+     
+      ! 2. Read monthly file
+      ! -------------------
+     
+      CALL fld_read( kt, 1, sf_sal )
+
+      IF( lwp .AND. kt==nn_it000 ) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) ' read Levitus salinity ok'
+         WRITE(numout,*)
+      ENDIF
+
+#if defined key_tradmp
+      IF( cp_cfg == "orca"  .AND. jp_cfg == 2 ) THEN
+   
+         !                                        ! =======================
+         !                                        !  ORCA_R2 configuration
+         !                                        ! =======================
+         ij0 = 101   ;   ij1 = 109
+         ii0 = 141   ;   ii1 = 155   
+         DO jj = mj0(ij0), mj1(ij1)                  ! Reduced salinity in the Alboran Sea
+            DO ji = mi0(ii0), mi1(ii1)
+               sf_sal(1)%fnow(ji,jj,13:13) = sf_sal(1)%fnow(ji,jj,13:13) - 0.15
+               sf_sal(1)%fnow(ji,jj,14:15) = sf_sal(1)%fnow(ji,jj,14:15) - 0.25
+               sf_sal(1)%fnow(ji,jj,16:17) = sf_sal(1)%fnow(ji,jj,16:17) - 0.30
+               sf_sal(1)%fnow(ji,jj,18:25) = sf_sal(1)%fnow(ji,jj,18:25) - 0.35
+            END DO
+         END DO
+
+         IF( n_cla == 1 ) THEN 
+            !                                         ! New salinity profile at Gibraltar
+            il0 = 138   ;   il1 = 138   
+            ij0 = 101   ;   ij1 = 102
+            ii0 = 139   ;   ii1 = 139   
+            DO jl = mi0(il0), mi1(il1)
+               DO jj = mj0(ij0), mj1(ij1)
+                  DO ji = mi0(ii0), mi1(ii1)
+                        sf_sal(1)%fnow(ji,jj,:) = sf_sal(1)%fnow(jl,jj,:)
+                  END DO
+               END DO
+            END DO
+            !                                         ! New salinity profile at Bab el Mandeb
+            il0 = 164   ;   il1 = 164   
+            ij0 =  87   ;   ij1 =  88
+            ii0 = 161   ;   ii1 = 163   
+            DO jl = mi0(il0), mi1(il1)
+               DO jj = mj0(ij0), mj1(ij1)
+                  DO ji = mi0(ii0), mi1(ii1)
+                     sf_sal(1)%fnow(ji,jj,:) = sf_sal(1)%fnow(jl,jj,:)
+                  END DO
+               END DO
+            END DO
+            !
+         ENDIF
+            !
+      ENDIF
+#endif   
         
 #if defined key_orca_lev10
-        if (ln_zps) stop
-        zsal(:,:,:,:) = 0.
-        CALL iom_get (numsdt,jpdom_data,'vosaline',zsal(:,:,:,1),nsal1)
-        CALL iom_get (numsdt,jpdom_data,'vosaline',zsal(:,:,:,2),nsal2)
+      DO jjk = 1, 5
+         s_dta(:,:,jjk) = sf_sal(1)%fnow(:,:,1)
+      ENDDO
+      DO jk = 1, jpk-20,10
+         ikr =  INT(jk/10) + 1
+         ikw =  (ikr-1) *10 + 1
+         ikt =  ikw + 5
+         DO jjk=ikt,ikt+9
+            zfac = ( gdept_0(jjk   ) - gdepw_0(ikt) ) / ( gdepw_0(ikt+10) - gdepw_0(ikt) )
+            s_dta(:,:,jjk) = sf_sal(1)%fnow(:,:,ikr) + ( sf_sal(1)%fnow(:,:,ikr+1) - sf_sal(1)%fnow(:,:,ikr) ) * zfac
+         END DO
+      END DO
+      DO jjk = jpk-5, jpk
+         s_dta(:,:,jjk) = sf_sal(1)%fnow(:,:,jpkdta-1)
+      END DO
+      ! fill the overlap areas
+      CALL lbc_lnk (s_dta(:,:,:),'Z',-999.,'no0')        
 #else
-        CALL iom_get (numsdt,jpdom_data,'vosaline',saldta(:,:,:,1),nsal1)
-        CALL iom_get (numsdt,jpdom_data,'vosaline',saldta(:,:,:,2),nsal2)
-#endif
-        
-        IF(lwp) THEN
-           WRITE(numout,*)
-           WRITE(numout,*) ' read Levitus salinity ok'
-           WRITE(numout,*)
-        ENDIF
-        
-#if defined key_tradmp
-        IF( cp_cfg == "orca"  .AND. jp_cfg == 2 ) THEN
+      s_dta(:,:,:)=sf_sal(1)%fnow(:,:,:)
+#endif
+        
+      IF( ln_sco ) THEN
+         DO jj = 1, jpj                  ! interpolation of salinites
+            DO ji = 1, jpi
+               DO jk = 1, jpk
+                  zl=fsdept_0(ji,jj,jk)
+                  IF(zl < gdept_0(1)  ) zsaldta(jk) =  s_dta(ji,jj,1    ) 
+                  IF(zl > gdept_0(jpk)) zsaldta(jk) =  s_dta(ji,jj,jpkm1) 
+                  DO jkk = 1, jpkm1
+                     IF((zl-gdept_0(jkk))*(zl-gdept_0(jkk+1)).le.0.0) THEN
+                          zsaldta(jk) = s_dta(ji,jj,jkk)                                 &
+                                     &           + (zl-gdept_0(jkk))/(gdept_0(jkk+1)-gdept_0(jkk))      &
+                                     &                              *(s_dta(ji,jj,jkk+1) - s_dta(ji,jj,jkk))
+                     ENDIF
+                  END DO
+               END DO
+               DO jk = 1, jpkm1
+                  s_dta(ji,jj,jk) = zsaldta(jk) 
+               END DO
+               s_dta(ji,jj,jpk) = 0.0 
+            END DO
+         END DO
            
-           !                                        ! =======================
-           !                                        !  ORCA_R2 configuration
-           !                                        ! =======================
-           ij0 = 101   ;   ij1 = 109
-           ii0 = 141   ;   ii1 = 155   
-           DO jj = mj0(ij0), mj1(ij1)                  ! Reduced salinity in the Alboran Sea
-              DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                 zsal  (ji,jj,13:13,:) = zsal  (ji,jj,13:13,:) - 0.15
-                 zsal  (ji,jj,14:15,:) = zsal  (ji,jj,14:15,:) - 0.25
-                 zsal  (ji,jj,16:17,:) = zsal  (ji,jj,16:17,:) - 0.30
-                 zsal  (ji,jj,18:25,:) = zsal  (ji,jj,18:25,:) - 0.35
-#else
-                 saldta(ji,jj,13:13,:) = saldta(ji,jj,13:13,:) - 0.15
-                 saldta(ji,jj,14:15,:) = saldta(ji,jj,14:15,:) - 0.25
-                 saldta(ji,jj,16:17,:) = saldta(ji,jj,16:17,:) - 0.30
-                 saldta(ji,jj,18:25,:) = saldta(ji,jj,18:25,:) - 0.35
-#endif
-              END DO
-           END DO
-
-           IF( n_cla == 1 ) THEN 
-              !                                         ! New salinity profile at Gibraltar
-              il0 = 138   ;   il1 = 138   
-              ij0 = 101   ;   ij1 = 102
-              ii0 = 139   ;   ii1 = 139   
-              DO jl = mi0(il0), mi1(il1)
-                 DO jj = mj0(ij0), mj1(ij1)
-                    DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                       zsal  (ji,jj,:,:) = zsal  (jl,jj,:,:)
-#else
-                       saldta(ji,jj,:,:) = saldta(jl,jj,:,:)
-#endif
-                    END DO
-                 END DO
-              END DO
-              !                                         ! New salinity profile at Bab el Mandeb
-              il0 = 164   ;   il1 = 164   
-              ij0 =  87   ;   ij1 =  88
-              ii0 = 161   ;   ii1 = 163   
-              DO jl = mi0(il0), mi1(il1)
-                 DO jj = mj0(ij0), mj1(ij1)
-                    DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                       zsal  (ji,jj,:,:) = zsal  (jl,jj,:,:)
-#else
-                       saldta(ji,jj,:,:) = saldta(jl,jj,:,:)
-#endif
-                    END DO
-                 END DO
-              END DO
-              !
-           ENDIF
-           !
-        ENDIF
-#endif   
-        
-#if defined key_orca_lev10
-        !  interpolate from 31 to 301 level the zsal field result in saldta
-        DO jl = 1, 2
-           DO jjk = 1, 5
-              saldta(:,:,jjk,jl) = zsal(:,:,1,jl)
-           ENDDO
-           DO jk = 1, jpk - 20, 10
-              ikr = INT( jk / 10 ) + 1
-              ikw = (ikr-1) * 10 + 1
-              ikt = ikw + 5
-              DO jjk = ikt , ikt + 9
-                 zfac = ( gdept_0(jjk) - gdepw_0(ikt) ) / ( gdepw_0(ikt+10) - gdepw_0(ikt) )
-                 saldta(:,:,jjk,jl) = zsal(:,:,ikr,jl) + ( zsal(:,:,ikr+1,jl) - zsal(:,:,ikr,jl) ) * zfac
-              END DO
-           END DO
-           DO jjk = jpk-5, jpk
-              saldta(:,:,jjk,jl) = zsal(:,:,jpkdta-1,jl)
-           END DO
-           ! fill the overlap areas
-           CALL lbc_lnk (saldta(:,:,:,jl),'Z',-999.,'no0')
-        END DO
-        
-#endif
-        
-        IF( ln_sco ) THEN
-           DO jl = 1, 2
-              DO jj = 1, jpj                  ! interpolation of salinites
-                 DO ji = 1, jpi
-                    DO jk = 1, jpk
-                       zl=fsdept_0(ji,jj,jk)
-                       IF(zl <  gdept_0(1)) zsaldta(jk,jl) =  saldta(ji,jj,1,jl)
-                       IF(zl >  gdept_0(jpk)) zsaldta(jk,jl) =  saldta(ji,jj,jpkm1,jl)
-                       DO jkk = 1, jpkm1
-                          IF((zl-gdept_0(jkk))*(zl-gdept_0(jkk+1)).le.0.0) THEN
-                             zsaldta(jk,jl) = saldta(ji,jj,jkk,jl)                                  &
-                                  &           + (zl-gdept_0(jkk))/(gdept_0(jkk+1)-gdept_0(jkk))       &
-                                  &                              *(saldta(ji,jj,jkk+1,jl) - saldta(ji,jj,jkk,jl))
-                          ENDIF
-                       END DO
-                    END DO
-                    DO jk = 1, jpkm1
-                       saldta(ji,jj,jk,jl) = zsaldta(jk,jl)
-                    END DO
-                    saldta(ji,jj,jpk,jl) = 0.0
-                 END DO
-              END DO
-           END DO
-           
-           IF(lwp) WRITE(numout,*)
-           IF(lwp) WRITE(numout,*) ' Levitus salinity data interpolated to s-coordinate'
-           IF(lwp) WRITE(numout,*)
-           
-        ELSE
-           !                                  ! Mask
-           DO jl = 1, 2
-              saldta(:,:,:,jl) = saldta(:,:,:,jl)*tmask(:,:,:)
-              saldta(:,:,jpk,jl) = 0.
-              IF( ln_zps ) THEN               ! z-coord. partial steps
-                 DO jj = 1, jpj               ! interpolation of salinity at the last ocean level (i.e. the partial step)
-                    DO ji = 1, jpi
-                       ik = mbathy(ji,jj) - 1
-                       IF( ik > 2 ) THEN
-                          zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
-                          saldta(ji,jj,ik,jl) = (1.-zl) * saldta(ji,jj,ik,jl) +zl * saldta(ji,jj,ik-1,jl)
-                       ENDIF
-                    END DO
-                 END DO
-              ENDIF
-           END DO
-        ENDIF
-        
-        
-        IF(lwp) THEN
-           WRITE(numout,*)' salinity Levitus month ',nsal1,nsal2
-           WRITE(numout,*)
-           WRITE(numout,*) ' Levitus month = ',nsal1,'  level = 1'
-           CALL prihre(saldta(:,:,1,1),jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)
-           WRITE(numout,*) ' Levitus month = ',nsal1,'  level = ',jpk/2
-           CALL prihre(saldta(:,:,jpk/2,1),jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)
-           WRITE(numout,*) ' Levitus month = ',nsal1,'  level = ',jpkm1
-           CALL prihre(saldta(:,:,jpkm1,1),jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)
-        ENDIF
-     ENDIF
-     
-     
-     ! 3. At every time step compute salinity data
-     ! -------------------------------------------
-     
-     zxy = FLOAT(nday + 15 - 30*i15)/30.
-     s_dta(:,:,:) = ( 1.- zxy ) * saldta(:,:,:,1) + zxy * saldta(:,:,:,2)
-     
-     ! Close the file
-     ! --------------
-     
-     IF( kt == nitend )   CALL iom_close (numsdt)
+         IF( lwp .AND. kt==nn_it000 ) THEN
+            WRITE(numout,*)
+            WRITE(numout,*) ' Levitus salinity data interpolated to s-coordinate'
+            WRITE(numout,*)
+         ENDIF
+
+      ELSE
+         !                                  ! Mask
+         s_dta(:,:,:) = s_dta(:,:,:) * tmask(:,:,:)
+         s_dta(:,:,jpk) = 0. 
+         IF( ln_zps ) THEN               ! z-coord. partial steps
+            DO jj = 1, jpj               ! interpolation of salinity at the last ocean level (i.e. the partial step)
+               DO ji = 1, jpi
+                  ik = mbathy(ji,jj) - 1
+                  IF( ik > 2 ) THEN
+                     zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
+                     s_dta(ji,jj,ik) = (1.-zl) * s_dta(ji,jj,ik) + zl * s_dta(ji,jj,ik-1)
+                  ENDIF
+               END DO
+            END DO
+         ENDIF
+      ENDIF
+        
+      IF( lwp .AND. kt==nn_it000 ) THEN
+         WRITE(numout,*)' salinity Levitus '
+         WRITE(numout,*)
+         WRITE(numout,*)'  level = 1'
+         CALL prihre(s_dta(:,:,1),    jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)
+         WRITE(numout,*)'  level = ',jpk/2
+         CALL prihre(s_dta(:,:,jpk/2),jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)           
+         WRITE(numout,*) '  level = ',jpkm1
+         CALL prihre(s_dta(:,:,jpkm1),jpi,jpj,1,jpi,20,1,jpj,20,1.,numout)
+      ENDIF
 
    END SUBROUTINE dta_sal
Index: branches/devmercator2010/NEMO/OPA_SRC/DTA/dtatem.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DTA/dtatem.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DTA/dtatem.F90	(revision 2071)
@@ -13,4 +13,5 @@
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE fldread         ! read input fields
    USE in_out_manager  ! I/O manager
    USE phycst          ! physical constants
@@ -26,13 +27,8 @@
    !! * Shared module variables
    LOGICAL , PUBLIC, PARAMETER ::   lk_dtatem = .TRUE.   !: temperature data flag
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   &  !:
-      t_dta             !: temperature data at given time-step
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::  t_dta    !: temperature data at given time-step
 
    !! * Module variables
-   INTEGER ::   &
-      numtdt,        &  !: logical unit for data temperature
-      ntem1, ntem2  ! first and second record used
-   REAL(wp), DIMENSION(jpi,jpj,jpk,2) ::   &
-      temdta            ! temperature data at two consecutive times
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_tem      ! structure of input SST (file informations, fields read)
 
    !! * Substitutions
@@ -73,251 +69,212 @@
       !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
       !!----------------------------------------------------------------------
-      !! * Modules used
-      USE iom
-
       !! * Arguments
       INTEGER, INTENT( in ) ::   kt     ! ocean time-step
 
       !! * Local declarations
-      INTEGER ::   ji, jj, jl, jk, jkk       ! dummy loop indicies
+      INTEGER ::   ji, jj, jk, jl, jkk       ! dummy loop indicies
       INTEGER ::   &
-         imois, iman, i15 , ik      ! temporary integers
-#  if defined key_tradmp
+        imois, iman, i15 , ik      ! temporary integers
+      INTEGER            :: ierror
+#if defined key_tradmp
       INTEGER ::   &
          il0, il1, ii0, ii1, ij0, ij1   ! temporary integers
-# endif
+#endif
       REAL(wp) ::   zxy, zl
 #if defined key_orca_lev10
-      REAL(wp), DIMENSION(jpi,jpj,jpkdta,2) :: ztem
+      !!!REAL(wp), DIMENSION(jpi,jpj,jpkdta,2) :: ztem
       INTEGER   :: ikr, ikw, ikt, jjk 
       REAL(wp)  :: zfac
 #endif
-      REAL(wp), DIMENSION(jpk,2) ::   &
+      REAL(wp), DIMENSION(jpk) ::   &
          ztemdta            ! auxiliary array for interpolation
+      CHARACTER(len=100) :: cn_dir          ! Root directory for location of ssr files
+      TYPE(FLD_N)        :: sn_tem
+      LOGICAL , SAVE     :: linit_tem = .FALSE.
       !!----------------------------------------------------------------------
-      
-      ! 0. Initialization
-      ! -----------------
-      
-      iman  = INT( raamo )
-!!! better but change the results     i15 = INT( 2*FLOAT( nday ) / ( FLOAT( nobis(nmonth) ) + 0.5 ) )
-      i15   = nday / 16
-      imois = nmonth + i15 - 1
-      IF( imois == 0 ) imois = iman
-      
-      ! 1. First call kt=nit000
+      NAMELIST/namdta_tem/cn_dir,sn_tem
+ 
+      ! 1. Initialization 
       ! -----------------------
       
-      IF( kt == nit000 ) THEN
-         
-         ntem1= 0   ! initializations
-         IF(lwp) WRITE(numout,*) ' dta_tem : Levitus monthly fields'
-         CALL iom_open ( 'data_1m_potential_temperature_nomask', numtdt ) 
-         
-      ENDIF
-      
+      IF( kt == nit000 .AND. (.NOT. linit_tem ) ) THEN
+
+         !                   ! set file information
+         cn_dir = './'       ! directory in which the model is executed
+         ! ... default values (NB: frequency positive => hours, negative => months)
+         !            !   file    ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation   !
+         !            !   name    !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs      !
+         sn_tem = FLD_N( 'temperature',  -1.  ,  'votemper',  .false.   , .true.  ,  'yearly'  , ''       , ''         )
+
+         REWIND( numnam )         ! ... read in namlist namdta_tem 
+         READ( numnam, namdta_tem ) 
+
+         IF(lwp) THEN              ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) 'dta_tem : Temperature Climatology '
+            WRITE(numout,*) '~~~~~~~ '
+         ENDIF
+         ALLOCATE( sf_tem(1), STAT=ierror )
+         IF( ierror > 0 ) THEN
+             CALL ctl_stop( 'dta_tem: unable to allocate sf_tem structure' )   ;   RETURN
+         ENDIF
+
+#if defined key_orca_lev10
+         ALLOCATE( sf_tem(1)%fnow(jpi,jpj,jpkdta)   )
+         ALLOCATE( sf_tem(1)%fdta(jpi,jpj,jpkdta,2) )
+#else
+         ALLOCATE( sf_tem(1)%fnow(jpi,jpj,jpk)   )
+         ALLOCATE( sf_tem(1)%fdta(jpi,jpj,jpk,2) )
+#endif
+         ! fill sf_tem with sn_tem and control print
+         CALL fld_fill( sf_tem, (/ sn_tem /), cn_dir, 'dta_tem', 'Temperature data', 'namdta_tem' )
+         linit_tem = .TRUE.
+
+      ENDIF
       
       ! 2. Read monthly file
       ! -------------------
-      
-      IF( kt == nit000 .OR. imois /= ntem1 ) THEN
-         
-         ! Calendar computation
-         
-         ntem1 = imois        ! first file record used 
-         ntem2 = ntem1 + 1    ! last  file record used
-         ntem1 = MOD( ntem1, iman )
-         IF( ntem1 == 0 )   ntem1 = iman
-         ntem2 = MOD( ntem2, iman )
-         IF( ntem2 == 0 )   ntem2 = iman
-         IF(lwp) WRITE(numout,*) 'first record file used ntem1 ', ntem1
-         IF(lwp) WRITE(numout,*) 'last  record file used ntem2 ', ntem2
-         
-         ! Read monthly temperature data Levitus 
-         
-#if defined key_orca_lev10
-         if (ln_zps) stop
-         ztem(:,:,:,:) = 0.
-         CALL iom_get (numtdt,jpdom_data,'votemper',ztem(:,:,:,1),ntem1)
-         CALL iom_get (numtdt,jpdom_data,'votemper',ztem(:,:,:,2),ntem2)
-#else         
-         CALL iom_get (numtdt,jpdom_data,'votemper',temdta(:,:,:,1),ntem1)
-         CALL iom_get (numtdt,jpdom_data,'votemper',temdta(:,:,:,2),ntem2)
-#endif
-         
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) ' read Levitus temperature ok'
-         IF(lwp) WRITE(numout,*)
+         
+      CALL fld_read( kt, 1, sf_tem )
+       
+      IF( lwp .AND. kt==nn_it000 )THEN 
+         WRITE(numout,*)
+         WRITE(numout,*) ' read Levitus temperature ok'
+         WRITE(numout,*)
+      ENDIF
          
 #if defined key_tradmp
-         IF( cp_cfg == "orca"  .AND. jp_cfg == 2 ) THEN
-            
-            !                                        ! =======================
-            !                                        !  ORCA_R2 configuration
-            !                                        ! ======================= 
-            ij0 = 101   ;   ij1 = 109
-            ii0 = 141   ;   ii1 = 155
-            DO jj = mj0(ij0), mj1(ij1)                      ! Reduced temperature in the Alboran Sea
-               DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                  ztem(  ji,jj, 13:13 ,:) = ztem  (ji,jj, 13:13 ,:) - 0.20
-                  ztem  (ji,jj, 14:15 ,:) = ztem  (ji,jj, 14:15 ,:) - 0.35
-                  ztem  (ji,jj, 16:25 ,:) = ztem  (ji,jj, 16:25 ,:) - 0.40
+      IF( cp_cfg == "orca"  .AND. jp_cfg == 2 ) THEN
+            
+         !                                        ! =======================
+         !                                        !  ORCA_R2 configuration
+         !                                        ! ======================= 
+         ij0 = 101   ;   ij1 = 109
+         ii0 = 141   ;   ii1 = 155
+         DO jj = mj0(ij0), mj1(ij1)                      ! Reduced temperature in the Alboran Sea
+            DO ji = mi0(ii0), mi1(ii1)
+               sf_tem(1)%fnow(ji,jj, 13:13 ) = sf_tem(1)%fnow(ji,jj, 13:13 ) - 0.20
+               sf_tem(1)%fnow(ji,jj, 14:15 ) = sf_tem(1)%fnow(ji,jj, 14:15 ) - 0.35  
+               sf_tem(1)%fnow(ji,jj, 16:25 ) = sf_tem(1)%fnow(ji,jj, 16:25 ) - 0.40
+            END DO
+         END DO
+            
+         IF( n_cla == 1 ) THEN 
+            !                                         ! New temperature profile at Gibraltar
+            il0 = 138   ;   il1 = 138
+            ij0 = 101   ;   ij1 = 102
+            ii0 = 139   ;   ii1 = 139
+            DO jl = mi0(il0), mi1(il1)
+               DO jj = mj0(ij0), mj1(ij1)
+                  DO ji = mi0(ii0), mi1(ii1)
+                     sf_tem(1)%fnow(ji,jj,:) = sf_tem(1)%fnow(jl,jj,:)
+                  END DO
+               END DO
+            END DO
+            !                                         ! New temperature profile at Bab el Mandeb
+            il0 = 164   ;   il1 = 164
+            ij0 =  87   ;   ij1 =  88
+            ii0 = 161   ;   ii1 = 163
+            DO jl = mi0(il0), mi1(il1)
+               DO jj = mj0(ij0), mj1(ij1)
+                  DO ji = mi0(ii0), mi1(ii1)
+                     sf_tem(1)%fnow(ji,jj,:) = sf_tem(1)%fnow(jl,jj,:)
+                  END DO
+               END DO
+            END DO
+            !
+         ELSE
+            !                                         ! Reduced temperature at Red Sea
+            ij0 =  87   ;   ij1 =  96
+            ii0 = 148   ;   ii1 = 160
+            sf_tem(1)%fnow( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ,  4:10 ) = 7.0
+            sf_tem(1)%fnow( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 11:13 ) = 6.5
+            sf_tem(1)%fnow( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 14:20 ) = 6.0
+         ENDIF
+            !
+      ENDIF
+#endif
+         
+#if defined key_orca_lev10
+      DO jjk = 1, 5
+         t_dta(:,:,jjk) = sf_tem(1)%fnow(:,:,1)
+      END DO
+      DO jk = 1, jpk-20,10
+         ik = jk+5
+         ikr =  INT(jk/10) + 1
+         ikw =  (ikr-1) *10 + 1
+         ikt =  ikw + 5
+         DO jjk=ikt,ikt+9
+            zfac = ( gdept_0(jjk   ) - gdepw_0(ikt) ) / ( gdepw_0(ikt+10) - gdepw_0(ikt) )
+            t_dta(:,:,jjk) = sf_tem(1)%fnow(:,:,ikr) + ( sf_tem(1)%fnow(:,:,ikr+1) - sf_tem(1)%fnow(:,:,ikr) ) * zfac
+         END DO
+      END DO
+      DO jjk = jpk-5, jpk
+         t_dta(:,:,jjk) = sf_tem(1)%fnow(:,:,jpkdta-1)
+      END DO
+      ! fill the overlap areas
+      CALL lbc_lnk (t_dta(:,:,:),'Z',-999.,'no0')
 #else
-                  temdta(ji,jj, 13:13 ,:) = temdta(ji,jj, 13:13 ,:) - 0.20
-                  temdta(ji,jj, 14:15 ,:) = temdta(ji,jj, 14:15 ,:) - 0.35
-                  temdta(ji,jj, 16:25 ,:) = temdta(ji,jj, 16:25 ,:) - 0.40
-#endif
-               END DO
-            END DO
-            
-            IF( n_cla == 1 ) THEN 
-               !                                         ! New temperature profile at Gibraltar
-               il0 = 138   ;   il1 = 138
-               ij0 = 101   ;   ij1 = 102
-               ii0 = 139   ;   ii1 = 139
-               DO jl = mi0(il0), mi1(il1)
-                  DO jj = mj0(ij0), mj1(ij1)
-                     DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                        ztem  (ji,jj,:,:) = ztem  (jl,jj,:,:)
-#else
-                        temdta(ji,jj,:,:) = temdta(jl,jj,:,:)
-#endif
-                     END DO
+      t_dta(:,:,:) = sf_tem(1)%fnow(:,:,:) 
+#endif
+         
+      IF( ln_sco ) THEN
+         DO jj = 1, jpj                  ! interpolation of temperatures
+            DO ji = 1, jpi
+               DO jk = 1, jpk
+                  zl=fsdept_0(ji,jj,jk)
+                  IF(zl < gdept_0(1))   ztemdta(jk) =  t_dta(ji,jj,1)
+                  IF(zl > gdept_0(jpk)) ztemdta(jk) =  t_dta(ji,jj,jpkm1) 
+                  DO jkk = 1, jpkm1
+                     IF((zl-gdept_0(jkk))*(zl-gdept_0(jkk+1)).le.0.0) THEN
+                        ztemdta(jk) = t_dta(ji,jj,jkk)                                 &
+                                  &    + (zl-gdept_0(jkk))/(gdept_0(jkk+1)-gdept_0(jkk))  &
+                                  &    * (t_dta(ji,jj,jkk+1) - t_dta(ji,jj,jkk))
+                     ENDIF
                   END DO
                END DO
-               !                                         ! New temperature profile at Bab el Mandeb
-               il0 = 164   ;   il1 = 164
-               ij0 =  87   ;   ij1 =  88
-               ii0 = 161   ;   ii1 = 163
-               DO jl = mi0(il0), mi1(il1)
-                  DO jj = mj0(ij0), mj1(ij1)
-                     DO ji = mi0(ii0), mi1(ii1)
-#if defined key_orca_lev10
-                        ztem  (ji,jj,:,:) = ztem  (jl,jj,:,:)
-#else
-                        temdta(ji,jj,:,:) = temdta(jl,jj,:,:)
-#endif
-                     END DO
-                  END DO
-               END DO
-               !
-            ELSE
-               !                                         ! Reduced temperature at Red Sea
-               ij0 =  87   ;   ij1 =  96
-               ii0 = 148   ;   ii1 = 160
-#if defined key_orca_lev10
-               ztem  ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ,  4:10 , : ) = 7.0 
-               ztem  ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 11:13 , : ) = 6.5 
-               ztem  ( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 14:20 , : ) = 6.0
-#else
-               temdta( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ,  4:10 , : ) = 7.0 
-               temdta( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 11:13 , : ) = 6.5 
-               temdta( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) , 14:20 , : ) = 6.0
-#endif
-            ENDIF
-            !
-         ENDIF
-#endif
-         
-#if defined key_orca_lev10
-         ! interpolate from 31 to 301 level the ztem field result in temdta
-         DO jl = 1, 2
-            DO jjk = 1, 5
-               temdta(:,:,jjk,jl) = ztem(:,:,1,jl)
-            END DO
-            DO jk = 1, jpk-20,10
-               ik = jk+5
-               ikr =  INT(jk/10) + 1
-               ikw =  (ikr-1) *10 + 1
-               ikt =  ikw + 5
-               DO jjk=ikt,ikt+9
-                  zfac = ( gdept_0(jjk   ) - gdepw_0(ikt) ) / ( gdepw_0(ikt+10) - gdepw_0(ikt) )
-                  temdta(:,:,jjk,jl) = ztem(:,:,ikr,jl) + ( ztem(:,:,ikr+1,jl) - ztem(:,:,ikr,jl) ) * zfac
-               END DO
-            END DO
-            DO jjk = jpk-5, jpk
-               temdta(:,:,jjk,jl) = ztem(:,:,jpkdta-1,jl)
-            END DO
-            ! fill the overlap areas
-            CALL lbc_lnk (temdta(:,:,:,jl),'Z',-999.,'no0')
-         END DO
-#endif
-         
-         IF( ln_sco ) THEN
-            DO jl = 1, 2
-               DO jj = 1, jpj                  ! interpolation of temperatures
-                  DO ji = 1, jpi
-                     DO jk = 1, jpk
-                        zl=fsdept_0(ji,jj,jk)
-                        IF(zl < gdept_0(1)) ztemdta(jk,jl) =  temdta(ji,jj,1,jl)
-                        IF(zl > gdept_0(jpk)) ztemdta(jk,jl) =  temdta(ji,jj,jpkm1,jl)
-                        DO jkk = 1, jpkm1
-                           IF((zl-gdept_0(jkk))*(zl-gdept_0(jkk+1)).le.0.0) THEN
-                              ztemdta(jk,jl) = temdta(ji,jj,jkk,jl)                                 &
-                                   &           + (zl-gdept_0(jkk))/(gdept_0(jkk+1)-gdept_0(jkk))      &
-                                   &                              *(temdta(ji,jj,jkk+1,jl) - temdta(ji,jj,jkk,jl))
-                           ENDIF
-                        END DO
-                     END DO
-                     DO jk = 1, jpkm1
-                        temdta(ji,jj,jk,jl) = ztemdta(jk,jl)
-                     END DO
-                     temdta(ji,jj,jpk,jl) = 0.0
-                  END DO
-               END DO
-            END DO
-            
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) ' Levitus temperature data interpolated to s-coordinate'
-            IF(lwp) WRITE(numout,*)
-            
-         ELSE
-            
-            !                                  ! Mask
-            DO jl = 1, 2
-               temdta(:,:,:,jl) = temdta(:,:,:,jl) * tmask(:,:,:)
-               temdta(:,:,jpk,jl) = 0.
-               IF( ln_zps ) THEN                ! z-coord. with partial steps
-                  DO jj = 1, jpj                  ! interpolation of temperature at the last level
-                     DO ji = 1, jpi
-                        ik = mbathy(ji,jj) - 1
-                        IF( ik > 2 ) THEN
-                           zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
-                           temdta(ji,jj,ik,jl) = (1.-zl) * temdta(ji,jj,ik,jl) + zl * temdta(ji,jj,ik-1,jl)
-                        ENDIF
-                     END DO
-                  END DO
-               ENDIF
-            END DO
-            
-         ENDIF
-         
-         IF(lwp) THEN
-            WRITE(numout,*) ' temperature Levitus month ', ntem1, ntem2
+               DO jk = 1, jpkm1
+                  t_dta(ji,jj,jk) = ztemdta(jk)
+               END DO
+               t_dta(ji,jj,jpk) = 0.0
+            END DO
+         END DO
+            
+         IF( lwp .AND. kt==nn_it000 )THEN
             WRITE(numout,*)
-            WRITE(numout,*) ' Levitus month = ', ntem1, '  level = 1'
-            CALL prihre( temdta(:,:,1,1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
-            WRITE(numout,*) ' Levitus month = ', ntem1, '  level = ', jpk/2
-            CALL prihre( temdta(:,:,jpk/2,1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
-            WRITE(numout,*) ' Levitus month = ',ntem1,'  level = ', jpkm1
-            CALL prihre( temdta(:,:,jpkm1,1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
-         ENDIF
-      ENDIF
-      
-      
-      ! 2. At every time step compute temperature data
-      ! ----------------------------------------------
-      
-      zxy = FLOAT( nday + 15 - 30 * i15 ) / 30.
-      t_dta(:,:,:) = (1.-zxy) * temdta(:,:,:,1) + zxy * temdta(:,:,:,2)
-      
-      ! Close the file
-      ! --------------
-      
-      IF( kt == nitend )   CALL iom_close (numtdt)
-      
-    END SUBROUTINE dta_tem
+            WRITE(numout,*) ' Levitus temperature data interpolated to s-coordinate'
+            WRITE(numout,*)
+         ENDIF
+            
+      ELSE
+         !                                  ! Mask
+         t_dta(:,:,:  ) = t_dta(:,:,:) * tmask(:,:,:)
+         t_dta(:,:,jpk) = 0.
+         IF( ln_zps ) THEN                ! z-coord. with partial steps
+            DO jj = 1, jpj                ! interpolation of temperature at the last level
+               DO ji = 1, jpi
+                  ik = mbathy(ji,jj) - 1
+                  IF( ik > 2 ) THEN
+                     zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
+                     t_dta(ji,jj,ik) = (1.-zl) * t_dta(ji,jj,ik) + zl * t_dta(ji,jj,ik-1)
+                  ENDIF
+            END DO
+         END DO
+      ENDIF
+
+   ENDIF
+         
+   IF( lwp .AND. kt==nn_it000 ) THEN
+      WRITE(numout,*) ' temperature Levitus '
+      WRITE(numout,*)
+      WRITE(numout,*)'  level = 1'
+      CALL prihre( t_dta(:,:,1    ), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+      WRITE(numout,*)'  level = ', jpk/2
+      CALL prihre( t_dta(:,:,jpk/2), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+      WRITE(numout,*)'  level = ', jpkm1
+      CALL prihre( t_dta(:,:,jpkm1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+   ENDIF
+
+   END SUBROUTINE dta_tem
 
 #else
Index: branches/devmercator2010/NEMO/OPA_SRC/DYN/divcur.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DYN/divcur.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DYN/divcur.F90	(revision 2071)
@@ -123,27 +123,33 @@
 
 #if defined key_obc
-         IF( Agrif_Root() ) THEN
-            ! open boundaries (div must be zero behind the open boundary)
-            !  mpp remark: The zeroing of hdivn can probably be extended to 1->jpi/jpj for the correct row/column
-            IF( lp_obc_east  )   hdivn(nie0p1:nie1p1,nje0  :nje1  ,jk) = 0.e0      ! east
-            IF( lp_obc_west  )   hdivn(niw0  :niw1  ,njw0  :njw1  ,jk) = 0.e0      ! west
-            IF( lp_obc_north )   hdivn(nin0  :nin1  ,njn0p1:njn1p1,jk) = 0.e0      ! north
-            IF( lp_obc_south )   hdivn(nis0  :nis1  ,njs0  :njs1  ,jk) = 0.e0      ! south
+#if defined key_agrif
+         IF (Agrif_Root() ) THEN
+#endif
+         ! open boundaries (div must be zero behind the open boundary)
+         !  mpp remark: The zeroing of hdivn can probably be extended to 1->jpi/jpj for the correct row/column
+         IF( lp_obc_east  )   hdivn(nie0p1:nie1p1,nje0  :nje1  ,jk) = 0.e0      ! east
+         IF( lp_obc_west  )   hdivn(niw0  :niw1  ,njw0  :njw1  ,jk) = 0.e0      ! west
+         IF( lp_obc_north )   hdivn(nin0  :nin1  ,njn0p1:njn1p1,jk) = 0.e0      ! north
+         IF( lp_obc_south )   hdivn(nis0  :nis1  ,njs0  :njs1  ,jk) = 0.e0      ! south
+#if defined key_agrif
          ENDIF
+#endif
 #endif         
 #if defined key_bdy
          ! unstructured open boundaries (div must be zero behind the open boundary)
          DO jj = 1, jpj
-            DO ji = 1, jpi
-               hdivn(ji,jj,jk)=hdivn(ji,jj,jk)*bdytmask(ji,jj)
-            END DO
+           DO ji = 1, jpi
+             hdivn(ji,jj,jk)=hdivn(ji,jj,jk)*bdytmask(ji,jj)
+           END DO
          END DO
 #endif         
-         IF( .NOT. AGRIF_Root() ) THEN
-            IF ((nbondi ==  1).OR.(nbondi == 2)) hdivn(nlci-1 , :     ,jk) = 0.e0      ! east
-            IF ((nbondi == -1).OR.(nbondi == 2)) hdivn(2      , :     ,jk) = 0.e0      ! west
-            IF ((nbondj ==  1).OR.(nbondj == 2)) hdivn(:      ,nlcj-1 ,jk) = 0.e0      ! north
-            IF ((nbondj == -1).OR.(nbondj == 2)) hdivn(:      ,2      ,jk) = 0.e0      ! south
-         ENDIF
+#if defined key_agrif
+         if ( .NOT. AGRIF_Root() ) then
+           IF ((nbondi ==  1).OR.(nbondi == 2)) hdivn(nlci-1 , :     ,jk) = 0.e0      ! east
+           IF ((nbondi == -1).OR.(nbondi == 2)) hdivn(2      , :     ,jk) = 0.e0      ! west
+           IF ((nbondj ==  1).OR.(nbondj == 2)) hdivn(:      ,nlcj-1 ,jk) = 0.e0      ! north
+           IF ((nbondj == -1).OR.(nbondj == 2)) hdivn(:      ,2      ,jk) = 0.e0      ! south
+         endif
+#endif    
 
          !                                             ! --------
@@ -335,12 +341,16 @@
 
 #if defined key_obc
-         IF( Agrif_Root() ) THEN
-            ! open boundaries (div must be zero behind the open boundary)
-            !  mpp remark: The zeroing of hdivn can probably be extended to 1->jpi/jpj for the correct row/column
-            IF( lp_obc_east  )   hdivn(nie0p1:nie1p1,nje0  :nje1  ,jk) = 0.e0      ! east
-            IF( lp_obc_west  )   hdivn(niw0  :niw1  ,njw0  :njw1  ,jk) = 0.e0      ! west
-            IF( lp_obc_north )   hdivn(nin0  :nin1  ,njn0p1:njn1p1,jk) = 0.e0      ! north
-            IF( lp_obc_south )   hdivn(nis0  :nis1  ,njs0  :njs1  ,jk) = 0.e0      ! south
+#if defined key_agrif
+         IF ( Agrif_Root() ) THEN
+#endif
+         ! open boundaries (div must be zero behind the open boundary)
+         !  mpp remark: The zeroing of hdivn can probably be extended to 1->jpi/jpj for the correct row/column
+         IF( lp_obc_east  )   hdivn(nie0p1:nie1p1,nje0  :nje1  ,jk) = 0.e0      ! east
+         IF( lp_obc_west  )   hdivn(niw0  :niw1  ,njw0  :njw1  ,jk) = 0.e0      ! west
+         IF( lp_obc_north )   hdivn(nin0  :nin1  ,njn0p1:njn1p1,jk) = 0.e0      ! north
+         IF( lp_obc_south )   hdivn(nis0  :nis1  ,njs0  :njs1  ,jk) = 0.e0      ! south
+#if defined key_agrif
          ENDIF
+#endif
 #endif         
 #if defined key_bdy
@@ -352,10 +362,12 @@
          END DO
 #endif        
-         IF( .NOT. AGRIF_Root() ) THEN
+#if defined key_agrif
+         if ( .NOT. AGRIF_Root() ) then
             IF ((nbondi ==  1).OR.(nbondi == 2)) hdivn(nlci-1 , :     ,jk) = 0.e0      ! east
             IF ((nbondi == -1).OR.(nbondi == 2)) hdivn(2      , :     ,jk) = 0.e0      ! west
             IF ((nbondj ==  1).OR.(nbondj == 2)) hdivn(:      ,nlcj-1 ,jk) = 0.e0      ! north
             IF ((nbondj == -1).OR.(nbondj == 2)) hdivn(:      ,2      ,jk) = 0.e0      ! south
-         ENDIF
+         endif
+#endif    
 
          !                                             ! --------
Index: branches/devmercator2010/NEMO/OPA_SRC/DYN/dynnxt.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 2071)
@@ -146,5 +146,5 @@
 # if defined key_obc
       !                                !* OBC open boundaries
-      IF( lk_obc )   CALL obc_dyn( kt )
+      CALL obc_dyn( kt )
       !
       IF ( lk_dynspg_exp .OR. lk_dynspg_ts ) THEN
Index: branches/devmercator2010/NEMO/OPA_SRC/DYN/dynspg_flt.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 2071)
@@ -186,6 +186,6 @@
 
 #if defined key_obc
-      IF( lk_obc )   CALL obc_dyn( kt )   ! Update velocities on each open boundary with the radiation algorithm
-      IF( lk_obc )   CALL obc_vol( kt )   ! Correction of the barotropic componant velocity to control the volume of the system
+      CALL obc_dyn( kt )      ! Update velocities on each open boundary with the radiation algorithm
+      CALL obc_vol( kt )      ! Correction of the barotropic componant velocity to control the volume of the system
 #endif
 #if defined key_bdy
@@ -315,11 +315,6 @@
 #if defined key_obc
             ! caution : grad D = 0 along open boundaries
-            IF( Agrif_Root() ) THEN
-               spgu(ji,jj) = z2dt * ztdgu * obcumask(ji,jj)
-               spgv(ji,jj) = z2dt * ztdgv * obcvmask(ji,jj)
-            ELSE
-               spgu(ji,jj) = z2dt * ztdgu
-               spgv(ji,jj) = z2dt * ztdgv
-            ENDIF
+            spgu(ji,jj) = z2dt * ztdgu * obcumask(ji,jj)
+            spgv(ji,jj) = z2dt * ztdgv * obcvmask(ji,jj)
 #elif defined key_bdy
             ! caution : grad D = 0 along open boundaries
Index: branches/devmercator2010/NEMO/OPA_SRC/DYN/sshwzv.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/DYN/sshwzv.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/DYN/sshwzv.F90	(revision 2071)
@@ -157,8 +157,12 @@
 
 #if defined key_obc
+# if defined key_agrif
       IF ( Agrif_Root() ) THEN 
+# endif
          ssha(:,:) = ssha(:,:) * obctmsk(:,:)
          CALL lbc_lnk( ssha, 'T', 1. )  ! absolutly compulsory !! (jmm)
-      ENDIF
+# if defined key_agrif
+      ENDIF
+# endif
 #endif
 
Index: branches/devmercator2010/NEMO/OPA_SRC/IOM/iom.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/IOM/iom.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/IOM/iom.F90	(revision 2071)
@@ -43,5 +43,5 @@
    LOGICAL, PUBLIC, PARAMETER ::   lk_iomput = .FALSE.       !: iom_put flag
 #endif
-   PUBLIC iom_init, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_gettime, iom_rstput, iom_put
+   PUBLIC iom_init, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_gettime, iom_rstput, iom_put
 
    PRIVATE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d
@@ -86,6 +86,5 @@
       !!----------------------------------------------------------------------
       ! read the xml file
-      IF( Agrif_Root() ) CALL event__parse_xml_file( 'iodef.xml' )   ! <- to get from the nameliste (namrun)...
-      CALL iom_swap
+      CALL event__parse_xml_file( 'iodef.xml' )   ! <- to get from the nameliste (namrun)...
 
       ! calendar parameters
@@ -120,22 +119,4 @@
 
    END SUBROUTINE iom_init
-
-
-   SUBROUTINE iom_swap
-      !!---------------------------------------------------------------------
-      !!                   ***  SUBROUTINE  iom_swap  ***
-      !!
-      !! ** Purpose :  swap context between different agrif grid for xmlio_server
-      !!---------------------------------------------------------------------
-#if defined key_iomput
-
-     IF( TRIM(Agrif_CFixed()) == '0' ) THEN
-        CALL event__swap_context("nemo")
-     ELSE
-        CALL event__swap_context(TRIM(Agrif_CFixed())//"_nemo")
-     ENDIF
-
-#endif
-   END SUBROUTINE iom_swap
 
 
@@ -183,4 +164,10 @@
       ! if iom_open is called for the first time: initialize iom_file(:)%nfid to 0
       ! (could be done when defining iom_file in f95 but not in f90)
+#if ! defined key_agrif
+      IF( iom_open_init == 0 ) THEN
+         iom_file(:)%nfid = 0
+         iom_open_init = 1
+      ENDIF
+#else
       IF( Agrif_Root() ) THEN
          IF( iom_open_init == 0 ) THEN
@@ -189,4 +176,5 @@
          ENDIF
       ENDIF
+#endif
       ! do we read or write the file?
       IF( PRESENT(ldwrt) ) THEN   ;   llwrt = ldwrt
@@ -211,4 +199,5 @@
       ! =============
       clname   = trim(cdname)
+#if defined key_agrif
       IF ( .NOT. Agrif_Root() .AND. .NOT. lliof ) THEN
          iln    = INDEX(clname,'/') 
@@ -217,4 +206,5 @@
          clname=TRIM(cltmpn)//TRIM(Agrif_CFixed())//'_'//TRIM(clname)
       ENDIF
+#endif    
       ! which suffix should we use?
       SELECT CASE (iolib)
Index: branches/devmercator2010/NEMO/OPA_SRC/IOM/prtctl.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/IOM/prtctl.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/IOM/prtctl.F90	(revision 2071)
@@ -120,6 +120,6 @@
       IF( PRESENT(tab2d_1) )  ztab2d_1(:,:)  = tab2d_1(:,:)
       IF( PRESENT(tab2d_2) )  ztab2d_2(:,:)  = tab2d_2(:,:)
-      IF( PRESENT(tab3d_1) )  ztab3d_1(:,:,1:kdir)= tab3d_1(:,:,:)
-      IF( PRESENT(tab3d_2) )  ztab3d_2(:,:,1:kdir)= tab3d_2(:,:,:)
+      IF( PRESENT(tab3d_1) )  ztab3d_1(:,:,:)= tab3d_1(:,:,:)
+      IF( PRESENT(tab3d_2) )  ztab3d_2(:,:,:)= tab3d_2(:,:,:)
       IF( PRESENT(mask1)   )  zmask1  (:,:,:)= mask1  (:,:,:)
       IF( PRESENT(mask2)   )  zmask2  (:,:,:)= mask2  (:,:,:)
Index: branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_oce.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_oce.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_oce.F90	(revision 2071)
@@ -27,4 +27,5 @@
    !
    !                                  !!* Namelist namobc: open boundary condition *
+   INTEGER           ::   nn_nbobc    = 2        !: number of open boundaries ( 1=< nbobc =< 4 ) 
    INTEGER           ::   nn_obcdta   = 0        !:  = 0 use the initial state as obc data
    !                                             !   = 1 read obc data in obcxxx.dta files
Index: branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_par.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_par.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_par.F90	(revision 2071)
@@ -25,9 +25,5 @@
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
-#if ! defined key_agrif
-   LOGICAL, PUBLIC, PARAMETER ::   lk_obc = .TRUE.     !: Ocean Boundary Condition flag
-#else
-   LOGICAL, PUBLIC            ::   lk_obc = .TRUE.     !: Ocean Boundary Condition flag
-#endif
+   LOGICAL, PUBLIC, PARAMETER ::   lk_obc = .TRUE.   !: Ocean Boundary Condition flag
 
 # if defined key_eel_r5
@@ -52,9 +48,5 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_east = .FALSE.     !: to active or not the East open boundary
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   & 
-#endif
-    ::     & 
+   INTEGER, PARAMETER ::     &  !:
       jpieob  = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       jpjed   =        2,    &  !: j-starting indice of the East open boundary (must be land T-point)
@@ -66,9 +58,5 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_west = .FALSE.     !: to active or not the West open boundary
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   & 
-#endif
-    ::     & 
+   INTEGER, PARAMETER ::     &  !:
       jpiwob  =	       2,    &  !: i-localization of the West open boundary (must be ocean U-point)
       jpjwd   =	       2,    &  !: j-starting indice of the West open boundary (must be land T-point)
@@ -80,9 +68,5 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_north = .FALSE.    !: to active or not the North open boundary
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   & 
-#endif
-    ::     & 
+   INTEGER, PARAMETER ::     &  !:
       jpjnob  = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       jpind   =        2,    &  !: i-starting indice of the North open boundary (must be land T-point)
@@ -94,9 +78,5 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_south = .FALSE.    !: to active or not the South open boundary
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   & 
-#endif
-    ::     & 
+   INTEGER, PARAMETER ::     &  !:
       jpjsob  =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       jpisd   =        2,    &  !: i-starting indice of the South open boundary (must be land T-point)
Index: branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_par_EEL_R5.h90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_par_EEL_R5.h90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_par_EEL_R5.h90	(revision 2071)
@@ -15,10 +15,5 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_east = .TRUE.      !: to active or not the East open boundary
-
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   &
-#endif
-    ::     &
+   INTEGER, PARAMETER ::     &  !:
       jpieob  = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       jpjed   =        2,    &  !: j-starting indice of the East open boundary (must be land T-point)
@@ -30,10 +25,5 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_west = .TRUE.      !: to active or not the West open boundary
-
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   &
-#endif
-    ::     &
+   INTEGER, PARAMETER ::     &
       jpiwob  =	       2,    &  !: i-localization of the West open boundary (must be ocean U-point)
       jpjwd   =	       2,    &  !: j-starting indice of the West open boundary (must be land T-point)
@@ -45,10 +35,5 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_north = .FALSE.    !: to active or not the North open boundary
-
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   &
-#endif
-    ::     &
+   INTEGER, PARAMETER ::     &  !:
       jpjnob  = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       jpind   =        2,    &  !: i-starting indice of the North open boundary (must be land T-point)
@@ -60,10 +45,5 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_south = .FALSE.    !: to active or not the South open boundary
-
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   &
-#endif
-    ::     &
+   INTEGER, PARAMETER ::     &  !:
       jpjsob  =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       jpisd   =        2,    &  !: i-starting indice of the South open boundary (must be land T-point)
Index: branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_par_POMME_R025.h90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_par_POMME_R025.h90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/OBC/obc_par_POMME_R025.h90	(revision 2071)
@@ -4,23 +4,21 @@
    !! open boundary parameter : POMME configuration
    !!---------------------------------------------------------------------
-   INTEGER, PARAMETER ::  jptobc  =	      14   
-   !: time dimension of the BCS fields on input
+     INTEGER, PARAMETER ::     &  !: time dimension of the BCS fields on input
+      jptobc  =	      14
 
    !! * EAST open boundary
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_east = .TRUE.      !:
+   INTEGER, PARAMETER ::     &  !:
 
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   & 
-#endif
-    ::     & 
       ! * default values *
       !jpieob = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       !jpjed  =        2,    &  !: j-starting indice of the East open boundary (must be land T-point)
       !jpjef  = jpjglo-1,    &  !: j-ending   indice of the East open boundary (must be land T-point)
+
       jpieob = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       jpjed  =        1,    &  !: j-starting indice of the East open boundary (must be land T-point)
       jpjef  =   jpjglo,    &  !: j-ending   indice of the East open boundary (must be land T-point)
+
       jpjedp1 =  jpjed+1,    &  !: first ocean point         "                 "
       jpjefm1 =  jpjef-1        !: last  ocean point         "                 "
@@ -29,17 +27,15 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_west = .TRUE.     !: to active or not the West open boundary
+   INTEGER, PARAMETER ::     &  !:
 
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   & 
-#endif
-    ::     & 
       ! * default values *
       !jpiwob  =        2,   &  !: i-localization of the West open boundary (must be ocean U-point)
       !jpjwd   =        2,   &  !: j-starting indice of the West open boundary (must be land T-point)
       !jpjwf   = jpjglo-1,   &  !: j-ending   indice of the West open boundary (must be land T-point)
+
       jpiwob  =        2,   &  !: i-localization of the West open boundary (must be ocean U-point)
       jpjwd   =        1,   &  !: j-starting indice of the West open boundary (must be land T-point)
       jpjwf   =   jpjglo,   &  !: j-ending   indice of the West open boundary (must be land T-point)
+
       jpjwdp1 =  jpjwd+1,    &  !: first ocean point         "                 "
       jpjwfm1 =  jpjwf-1        !: last  ocean point         "                 "
@@ -48,17 +44,15 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_north = .TRUE.     !:
+   INTEGER, PARAMETER ::     &  !:
 
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   & 
-#endif
-    ::     & 
       ! * default values *
       !jpjnob = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       !jpind  =        2,    &  !: i-starting indice of the North open boundary (must be land T-point)
       !jpinf  = jpiglo-1,    &  !: i-ending   indice of the North open boundary (must be land T-point)
+
       jpjnob = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       jpind  =        1,    &  !: i-starting indice of the North open boundary (must be land T-point)
       jpinf  =   jpiglo,    &  !: i-ending   indice of the North open boundary (must be land T-point)
+
       jpindp1 =  jpind+1,    &  !: first ocean point         "                 "
       jpinfm1 =  jpinf-1        !: last  ocean point         "                 "
@@ -67,17 +61,15 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_south = .TRUE.     !: INDICE to active or not the South open boundary
+   INTEGER, PARAMETER ::     &  !:
 
-     INTEGER   &
-#if !defined key_agrif
-     , PARAMETER   & 
-#endif
-    ::     & 
       ! * default values *
       !jpjsob =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       !jpisd  =        2,    &  !: i-starting indice of the South open boundary (must be land T-point)
       !jpisf  = jpiglo-1,    &  !: i-ending   indice of the South open boundary (must be land T-point)
+
       jpjsob =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       jpisd  =        1,    &  !: i-starting indice of the South open boundary (must be land T-point)
       jpisf  =   jpiglo,    &  !: i-ending   indice of the South open boundary (must be land T-point)
+
       jpisdp1 =  jpisd+1,    &  !: first ocean point         "                 "
       jpisfm1 =  jpisf-1        !: last  ocean point         "                 "
Index: branches/devmercator2010/NEMO/OPA_SRC/OBC/obcdta.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/OBC/obcdta.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/OBC/obcdta.F90	(revision 2071)
@@ -30,8 +30,6 @@
 
   !! * Shared module variables
-!$AGRIF_DO_NOT_TREAT
   REAL(wp),  DIMENSION(2)              ::  zjcnes_obc   ! 
   REAL(wp),  DIMENSION(:), ALLOCATABLE :: ztcobc
-!$AGRIF_END_DO_NOT_TREAT
   REAL(wp) :: rdt_obc
   REAL(wp) :: zjcnes
Index: branches/devmercator2010/NEMO/OPA_SRC/OBC/obcfla.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/OBC/obcfla.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/OBC/obcfla.F90	(revision 2071)
@@ -78,12 +78,14 @@
       !!------------------------------------------------------------------------------
       !! * Local declaration
-      INTEGER ::   ji, jj ! dummy loop indices
+      INTEGER ::   ji, jj, jk ! dummy loop indices
       !!------------------------------------------------------------------------------
 
       DO ji = nie0, nie1
-         DO jj = 1, jpj
-            ua_e(ji,jj) = (  ubtfoe(jj) * hur(ji,jj) + sqrt( grav*hur(ji,jj) )   &
-               &            * ( ( sshn_e(ji,jj) + sshn_e(ji+1,jj) ) * 0.5        &
-               &            - sshfoe(jj) )  ) * uemsk(jj,1)
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               ua_e(ji,jj) = (  ubtfoe(jj) + sqrt( grav*hu(ji,jj) )           &
+                  &            * ( ( sshn_e(ji,jj) + sshn_e(ji+1,jj) ) * 0.5  &
+                  &            - sshfoe(jj) )  ) * uemsk(jj,jk)
+            END DO
          END DO
       END DO
@@ -95,5 +97,5 @@
             ssha_e(ji,jj) = ssha_e(ji,jj) * ( 1. - temsk(jj,1) ) &
                &            + temsk(jj,1) * sshfoe(jj)
-            va_e(ji,jj) = vbtfoe(jj) * hvr(ji,jj) * uemsk(jj,1)
+            va_e(ji,jj) = vbtfoe(jj) * uemsk(jj,jk)
          END DO
       END DO
@@ -114,13 +116,15 @@
       !!------------------------------------------------------------------------------
       !! * Local declaration
-      INTEGER ::   ji, jj ! dummy loop indices
+      INTEGER ::   ji, jj, jk ! dummy loop indices
       !!------------------------------------------------------------------------------
 
       DO ji = niw0, niw1
-         DO jj = 1, jpj
-            ua_e(ji,jj) = ( ubtfow(jj) * hur(ji,jj) - sqrt( grav * hur(ji,jj) )   &
-               &            * ( ( sshn_e(ji,jj) + sshn_e(ji+1,jj) ) * 0.5         &
-               &                - sshfow(jj) ) ) * uwmsk(jj,1)
-            va_e(ji,jj) = vbtfow(jj) * hvr(ji,jj) * uwmsk(jj,1)
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               ua_e(ji,jj) = ( ubtfow(jj) - sqrt( grav * hu(ji,jj) )          &
+                  &            * ( ( sshn_e(ji,jj) + sshn_e(ji+1,jj) ) * 0.5  &
+                  &                - sshfow(jj) ) ) * uwmsk(jj,jk)
+               va_e(ji,jj) = vbtfow(jj) * uwmsk(jj,jk)
+            END DO
          END DO
          DO jj = 1, jpj
@@ -147,12 +151,14 @@
       !!------------------------------------------------------------------------------
       !! * Local declaration
-      INTEGER ::   ji, jj ! dummy loop indices
+      INTEGER ::   ji, jj, jk ! dummy loop indices
       !!------------------------------------------------------------------------------
 
       DO jj = njn0, njn1
-         DO ji = 1, jpi
-            va_e(ji,jj) = ( vbtfon(ji) * hvr(ji,jj) + sqrt( grav * hvr(ji,jj) )   &
-               &            * ( ( sshn_e(ji,jj) + sshn_e(ji,jj+1) ) * 0.5         &
-               &                - sshfon(ji) ) ) * vnmsk(ji,1)
+         DO jk = 1, jpkm1
+            DO ji = 1, jpi
+               va_e(ji,jj) = ( vbtfon(ji) + sqrt( grav * hv(ji,jj) )           &
+                  &            * ( ( sshn_e(ji,jj) + sshn_e(ji,jj+1) ) * 0.5   &
+                  &                - sshfon(ji) ) ) * vnmsk(ji,jk)
+            END DO
          END DO
       END DO
@@ -164,5 +170,5 @@
             ssha_e(ji,jj) = ssha_e(ji,jj) * ( 1. - tnmsk(ji,1) ) &
                &            + sshfon(ji) * tnmsk(ji,1)
-            ua_e(ji,jj) = ubtfon(ji) * hur(ji,jj) * vnmsk(ji,1)
+            ua_e(ji,jj) = ubtfon(ji) * vnmsk(ji,jk)
          END DO
       END DO
@@ -182,14 +188,16 @@
       !!------------------------------------------------------------------------------
       !! * Local declaration
-      INTEGER ::   ji, jj ! dummy loop indices
+      INTEGER ::   ji, jj, jk ! dummy loop indices
 
       !!------------------------------------------------------------------------------
 
       DO jj = njs0, njs1
-         DO ji = 1, jpi
-            va_e(ji,jj) = ( vbtfos(ji) * hvr(ji,jj) - sqrt( grav * hvr(ji,jj) )   &
-               &            * ( ( sshn_e(ji,jj) + sshn_e(ji,jj+1) ) * 0.5         &
-               &                - sshfos(ji) ) ) * vsmsk(ji,1)
-            ua_e(ji,jj) = ubtfos(ji) * hur(ji,jj) * vsmsk(ji,1)
+         DO jk = 1, jpkm1
+            DO ji = 1, jpi
+               va_e(ji,jj) = ( vbtfos(ji) - sqrt( grav * hv(ji,jj) )            &
+                  &            * ( ( sshn_e(ji,jj) + sshn_e(ji,jj+1) ) * 0.5    &
+                  &                - sshfos(ji) ) ) * vsmsk(ji,jk)
+               ua_e(ji,jj) = ubtfos(ji) * vsmsk(ji,jk)
+            END DO
          END DO
          DO ji = 1, jpi
Index: branches/devmercator2010/NEMO/OPA_SRC/OBC/obcini.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/OBC/obcini.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/OBC/obcini.F90	(revision 2071)
@@ -62,5 +62,5 @@
       NAMELIST/namobc/ rn_dpein, rn_dpwin, rn_dpnin, rn_dpsin,       &
          &             rn_dpeob, rn_dpwob, rn_dpnob, rn_dpsob,       &
-         &             rn_volemp, nn_obcdta, cn_obcdta,    &
+         &             rn_volemp, nn_obcdta, cn_obcdta, rn_volemp,   &
          &             ln_obc_clim, ln_vol_cst, ln_obc_fla
       !!----------------------------------------------------------------------
@@ -70,4 +70,5 @@
 
       ! convert DOCTOR namelist name into the OLD names
+      nbobc    = nn_nbobc
       nobc_dta = nn_obcdta
       cffile   = cn_obcdta
@@ -100,5 +101,5 @@
       IF(lwp) WRITE(numout,*) 'obc_init : initialization of open boundaries'
       IF(lwp) WRITE(numout,*) '~~~~~~~~'
-      IF(lwp) WRITE(numout,*) '   Number of open boundaries    nbobc = ', nbobc
+      IF(lwp) WRITE(numout,*) '   Number of open boundaries    nn_nbobc = ', nn_nbobc
       IF(lwp) WRITE(numout,*)
 
@@ -149,5 +150,5 @@
       ENDIF
 
-      IF( nbobc >= 2 .AND. jperio /= 0 )   &
+      IF( nbobc /= 0 .AND. jperio /= 0 )   &
          &   CALL ctl_stop( ' Cyclic or symmetric, and open boundary condition are not compatible' )
 
@@ -305,5 +306,4 @@
       IF( lp_obc_east ) THEN
          !... (jpjed,jpjefm1),jpieob
-         bmask(nie0p1:nie1p1,nje0:nje1m1) = 0.e0
 
          ! ... initilization to zero
@@ -341,5 +341,4 @@
       IF( lp_obc_north ) THEN
          ! ... jpjnob,(jpind,jpisfm1)
-         bmask(nin0:nin1m1,njn0p1:njn1p1) = 0.e0
 
          ! ... initilization to zero
@@ -441,4 +440,5 @@
             END DO
          END IF
+  
          IF( lp_obc_north ) THEN ! ... North open boundary lateral surface
             DO jj = njn0, njn1
Index: branches/devmercator2010/NEMO/OPA_SRC/OBC/obcrst.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/OBC/obcrst.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/OBC/obcrst.F90	(revision 2071)
@@ -96,5 +96,5 @@
          ! -------------
 
-         CALL ctl_opn( inum, 'restart.obc.output', 'UNKNOWN', 'UNFORMATTED', 'DIRECT', nreclo, numout, lwp )
+         CALL ctl_opn( inum, 'restart.obc.output', 'REPLACE', 'UNFORMATTED', 'DIRECT', nreclo, numout, lwp )
  
          ! 1.2 Write header
@@ -322,5 +322,5 @@
       ! 0.1 Open files
       ! ---------------
-      CALL ctl_opn( inum, 'restart.obc', 'UNKNOWN', 'UNFORMATTED', 'DIRECT', nreclo, numout, lwp )
+      CALL ctl_opn( inum, 'restart.obc', 'REPLACE', 'UNFORMATTED', 'DIRECT', nreclo, numout, lwp )
 
       ! 1. Read
Index: branches/devmercator2010/NEMO/OPA_SRC/OBC/obctra.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/OBC/obctra.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/OBC/obctra.F90	(revision 2071)
@@ -490,7 +490,6 @@
                   zin = sign( 1., -1.* z05cx )
                   zin = 0.5*( zin + abs(zin) )
-                  ztau = (1.-zin ) * rtausin + zin * rtaus
+                  ztau = (1.-zin ) + zin * rtaus
                   z05cx = z05cx * zin
-
          !... update (ta,sa) with radiative or climatological (t, s)
                   ta(ji,jj,jk) = ta(ji,jj,jk) * (1.-tsmsk(ji,jk)) +             &
Index: branches/devmercator2010/NEMO/OPA_SRC/SBC/fldread.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SBC/fldread.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SBC/fldread.F90	(revision 2071)
@@ -48,6 +48,6 @@
       INTEGER , DIMENSION(2)          ::   nrec_b       ! before record (1: index, 2: second since Jan. 1st 00h of nit000 year)
       INTEGER , DIMENSION(2)          ::   nrec_a       ! after  record (1: index, 2: second since Jan. 1st 00h of nit000 year)
-      REAL(wp) , ALLOCATABLE, DIMENSION(:,:)   ::   fnow         ! input fields interpolated to now time step
-      REAL(wp) , ALLOCATABLE, DIMENSION(:,:,:) ::   fdta         ! 2 consecutive record of input fields
+      REAL(wp) , ALLOCATABLE, DIMENSION(:,:,:)   ::   fnow       ! input fields interpolated to now time step
+      REAL(wp) , ALLOCATABLE, DIMENSION(:,:,:,:) ::   fdta       ! 2 consecutive record of input fields
       CHARACTER(len = 256)            ::   wgtname      ! current name of the NetCDF weight file acting as a key
                                                         ! into the WGTLIST structure
@@ -78,6 +78,6 @@
       INTEGER, DIMENSION(:,:,:), POINTER      ::   data_jpj     ! array of source integers
       REAL(wp), DIMENSION(:,:,:), POINTER     ::   data_wgt     ! array of weights on model grid
-      REAL(wp), DIMENSION(:,:), POINTER       ::   fly_dta      ! array of values on input grid
-      REAL(wp), DIMENSION(:,:), POINTER       ::   col2         ! temporary array for reading in columns
+      REAL(wp), DIMENSION(:,:,:), POINTER     ::   fly_dta      ! array of values on input grid
+      REAL(wp), DIMENSION(:,:,:), POINTER     ::   col2         ! temporary array for reading in columns
    END TYPE WGT
 
@@ -120,4 +120,6 @@
 
       INTEGER  ::   jf         ! dummy indices
+      INTEGER  ::   jk         ! dummy indices
+      INTEGER  ::   ipk        ! number of vertical levels of sdjf%fdta ( 2D: ipk=1 ; 3D: ipk=jpk )
       INTEGER  ::   kw         ! index into wgts array
       INTEGER  ::   ireclast   ! last record to be read in the current year file
@@ -143,6 +145,6 @@
             IF( sd(jf)%ln_tint ) THEN         ! time interpolation: swap before record field
 !CDIR COLLAPSE
-               sd(jf)%fdta(:,:,1) = sd(jf)%fdta(:,:,2)
-               sd(jf)%rotn(1)     = sd(jf)%rotn(2)
+               sd(jf)%fdta(:,:,:,1) = sd(jf)%fdta(:,:,:,2)
+               sd(jf)%rotn(1)       = sd(jf)%rotn(2)
             ENDIF
 
@@ -157,5 +159,8 @@
 
                ! last record to be read in the current file
-               IF( sd(jf)%nfreqh == -1 ) THEN                  ;   ireclast = 12
+               IF( sd(jf)%nfreqh == -1 ) THEN
+                  IF(     sd(jf)%cltype == 'monthly'   ) THEN  ;   ireclast = 1
+                  ELSE                                         ;   ireclast = 12
+                  ENDIF
                ELSE                             
                   IF(     sd(jf)%cltype == 'monthly'   ) THEN  ;   ireclast = 24 * nmonth_len(nmonth) / sd(jf)%nfreqh 
@@ -184,5 +189,5 @@
                         &                    nday   + 1                   - nmonth_len(nmonth) * COUNT((/llnxtmth/)), llstop )
 
-                     IF( sd(jf)%num <= 0 .AND. .NOT. llstop ) THEN    ! next year file does not exist
+                     IF( sd(jf)%num == 0 .AND. .NOT. llstop ) THEN    ! next year file does not exist
                         CALL ctl_warn('next year/month/day file: '//TRIM(sd(jf)%clname)//     &
                                 &     ' not present -> back to current year/month/day')
@@ -204,7 +209,13 @@
             IF( LEN(TRIM(sd(jf)%wgtname)) > 0 ) THEN
                CALL wgt_list( sd(jf), kw )
-               CALL fld_interp( sd(jf)%num, sd(jf)%clvar, kw, sd(jf)%fdta(:,:,2), sd(jf)%nrec_a(1) )
+               ipk =  SIZE(sd(jf)%fdta,3)
+               CALL fld_interp( sd(jf)%num, sd(jf)%clvar , kw , ipk, sd(jf)%fdta(:,:,:,2) , sd(jf)%nrec_a(1) )
             ELSE
-               CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,2), sd(jf)%nrec_a(1) )
+               SELECT CASE( SIZE(sd(jf)%fdta,3) )
+               CASE(1)
+                  CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,1,2), sd(jf)%nrec_a(1) )
+               CASE(jpk)
+                  CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,:,2), sd(jf)%nrec_a(1) )
+               END SELECT
             ENDIF
             sd(jf)%rotn(2) = .FALSE.
@@ -245,8 +256,13 @@
                          utmp(:,:) = 0.0
                          vtmp(:,:) = 0.0
-                         CALL rot_rep( sd(jf)%fdta(:,:,nf), sd(kf)%fdta(:,:,nf), 'T', 'en->i', utmp(:,:) )
-                         CALL rot_rep( sd(jf)%fdta(:,:,nf), sd(kf)%fdta(:,:,nf), 'T', 'en->j', vtmp(:,:) )
-                         sd(jf)%fdta(:,:,nf) = utmp(:,:)
-                         sd(kf)%fdta(:,:,nf) = vtmp(:,:)
+                         !
+                         ipk = SIZE( sd(kf)%fdta(:,:,:,nf) ,3 )
+                         DO jk = 1,ipk
+                            CALL rot_rep( sd(jf)%fdta(:,:,jk,nf),sd(kf)%fdta(:,:,jk,nf),'T', 'en->i', utmp(:,:) )
+                            CALL rot_rep( sd(jf)%fdta(:,:,jk,nf),sd(kf)%fdta(:,:,jk,nf),'T', 'en->j', vtmp(:,:) )
+                            sd(jf)%fdta(:,:,jk,nf) = utmp(:,:)
+                            sd(kf)%fdta(:,:,jk,nf) = vtmp(:,:)
+                         END DO
+                         !
                          sd(jf)%rotn(nf) = .TRUE.
                          sd(kf)%rotn(nf) = .TRUE.
@@ -280,5 +296,5 @@
                ztintb =  1. - ztinta
 !CDIR COLLAPSE
-               sd(jf)%fnow(:,:) = ztintb * sd(jf)%fdta(:,:,1) + ztinta * sd(jf)%fdta(:,:,2)
+               sd(jf)%fnow(:,:,:) = ztintb * sd(jf)%fdta(:,:,:,1) + ztinta * sd(jf)%fdta(:,:,:,2)
             ELSE
                IF(lwp .AND. kt - nit000 <= 100 ) THEN
@@ -288,5 +304,5 @@
                ENDIF
 !CDIR COLLAPSE
-               sd(jf)%fnow(:,:) = sd(jf)%fdta(:,:,2)   ! piecewise constant field
+               sd(jf)%fnow(:,:,:) = sd(jf)%fdta(:,:,:,2)   ! piecewise constant field
  
             ENDIF
@@ -320,4 +336,6 @@
       INTEGER :: inrec          ! number of record existing for this variable
       INTEGER :: kwgt
+      INTEGER :: jk             !vertical loop variable
+      INTEGER :: ipk            !number of vertical levels of sdjf%fdta ( 2D: ipk=1 ; 3D: ipk=jpk )
       CHARACTER(LEN=1000) ::   clfmt   ! write format
       !!---------------------------------------------------------------------
@@ -339,5 +357,5 @@
                IF( sdjf%cltype == 'monthly' ) THEN   ! monthly file
                   sdjf%nrec_b(1) = 1                                                       ! force to read the unique record
-                  llprevmth = .NOT. sdjf%ln_clim                                           ! use previous month file?
+                  llprevmth = .TRUE.                                                       ! use previous month file?
                   llprevyr  = llprevmth .AND. nmonth == 1                                  ! use previous year  file?
                ELSE                                  ! yearly file
@@ -366,7 +384,7 @@
             &                  nmonth - COUNT((/llprevmth/)) + 12                   * COUNT((/llprevyr /)),               &
             &                  nday   - COUNT((/llprevday/)) + nmonth_len(nmonth-1) * COUNT((/llprevmth/)), .NOT. llprev )
-         
+
          ! if previous year/month/day file does not exist, we switch to the current year/month/day
-         IF( llprev .AND. sdjf%num <= 0 ) THEN
+         IF( llprev .AND. sdjf%num == 0 ) THEN
             CALL ctl_warn( 'previous year/month/day file: '//TRIM(sdjf%clname)//' not present -> back to current year/month/day')
             ! we force to read the first record of the current year/month/day instead of last record of previous year/month/day
@@ -384,9 +402,16 @@
 
          ! read before data into sdjf%fdta(:,:,2) because we will swap data in the following part of fld_read
+         
          IF( LEN(TRIM(sdjf%wgtname)) > 0 ) THEN
             CALL wgt_list( sdjf, kwgt )
-            CALL fld_interp( sdjf%num, sdjf%clvar, kwgt, sdjf%fdta(:,:,2), sdjf%nrec_b(1) )
+            ipk = SIZE(sdjf%fdta,3)
+            CALL fld_interp( sdjf%num, sdjf%clvar, kwgt, ipk, sdjf%fdta(:,:,:,2), sdjf%nrec_a(1) )
          ELSE
-            CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,2), sdjf%nrec_b(1) )
+            SELECT CASE ( SIZE(sdjf%fdta,3) )
+            CASE(1)
+                CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,1,2), sdjf%nrec_b(1) )
+            CASE(jpk)
+                CALL iom_get( sdjf%num, jpdom_data, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_b(1) )
+            END SELECT
          ENDIF
          sdjf%rotn(2) = .FALSE.
@@ -399,8 +424,9 @@
       ENDIF
 
-      IF( sdjf%num <= 0 )   CALL fld_clopn( sdjf, nyear, nmonth, nday )   ! make sure current year/month/day file is opened
+
+      IF( sdjf%num == 0 )   CALL fld_clopn( sdjf, nyear, nmonth, nday )   ! make sure current year/month/day file is opened
 
       sdjf%nswap_sec = nsec_year + nsec1jan000 - 1   ! force read/update the after data in the following part of fld_read 
-      
+     
    END SUBROUTINE fld_init
 
@@ -436,5 +462,6 @@
             !       forcing record :  nmonth 
             !                            
-            ztmp  = REAL( nday, wp ) / REAL( nmonth_len(nmonth), wp ) + 0.5
+            ztmp  = 0.e0
+            IF(  REAL( nday, wp ) / REAL( nmonth_len(nmonth), wp ) .GT. 0.5 ) ztmp  = 1.0
          ELSE
             ztmp  = 0.e0
@@ -446,7 +473,21 @@
          ENDIF
 
-         sdjf%nrec_a(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define after  record number and time
-         irec = irec - 1                                                ! move back to previous record
-         sdjf%nrec_b(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define before record number and time
+         IF( sdjf%cltype == 'monthly' ) THEN
+
+            sdjf%nrec_b(:) = (/ 0, nmonth_half(irec - 1 ) + nsec1jan000 /)
+            sdjf%nrec_a(:) = (/ 1, nmonth_half(irec     ) + nsec1jan000 /)
+
+            IF( ztmp  == 1. ) THEN
+              sdjf%nrec_b(1) = 1
+              sdjf%nrec_a(1) = 2
+            ENDIF
+
+         ELSE
+
+            sdjf%nrec_a(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define after  record number and time
+            irec = irec - 1                                                ! move back to previous record
+            sdjf%nrec_b(:) = (/ irec, nmonth_half(irec) + nsec1jan000 /)   ! define before record number and time
+
+         ENDIF
          !
       ELSE                              ! higher frequency mean (in hours)
@@ -534,4 +575,7 @@
          IF( sdjf%cltype /= 'yearly' )    WRITE(sdjf%clname, '(a,"m" ,i2.2)' ) TRIM( sdjf%clname     ), kmonth   ! add month
          IF( sdjf%cltype == 'daily'  )    WRITE(sdjf%clname, '(a,"d" ,i2.2)' ) TRIM( sdjf%clname     ), kday     ! add day
+      ELSE
+         ! build the new filename if climatological data
+         IF( sdjf%cltype == 'monthly' )   WRITE(sdjf%clname, '(a,"_m" ,i2.2)' ) TRIM( sdjf%clrootname ), kmonth   ! add month
       ENDIF
       CALL iom_open( sdjf%clname, sdjf%num, ldstop = ldstop, ldiof =  LEN(TRIM(sdjf%wgtname)) > 0 )
@@ -564,7 +608,5 @@
          sdf(jf)%ln_tint    = sdf_n(jf)%ln_tint
          sdf(jf)%ln_clim    = sdf_n(jf)%ln_clim
-         IF( sdf(jf)%nfreqh == -1. ) THEN   ;   sdf(jf)%cltype = 'yearly'
-         ELSE                               ;   sdf(jf)%cltype = sdf_n(jf)%cltype
-         ENDIF
+         sdf(jf)%cltype     = sdf_n(jf)%cltype
          sdf(jf)%wgtname = " "
          IF( LEN( TRIM(sdf_n(jf)%wname) ) > 0 )   sdf(jf)%wgtname = TRIM( cdir )//TRIM( sdf_n(jf)%wname )
@@ -684,4 +726,5 @@
       INTEGER                                 ::   inum          ! temporary logical unit
       INTEGER                                 ::   id            ! temporary variable id
+      INTEGER                                 ::   ipk           ! temporary vertical dimension
       CHARACTER (len=5)                       ::   aname
       INTEGER , DIMENSION(3)                  ::   ddims
@@ -815,5 +858,6 @@
             WRITE(aname,'(a3,i2.2)') 'src',jn
             data_tmp(:,:) = 0
-            CALL iom_get ( inum, jpdom_data, aname, data_tmp(:,:) )
+            CALL iom_get ( inum, jpdom_unknown, aname, data_tmp(1:nlci,1:nlcj), &
+                           kstart=(/nimpp,njmpp/), kcount=(/nlci,nlcj/) )
             data_src(:,:) = INT(data_tmp(:,:))
             ref_wgts(nxt_wgt)%data_jpj(:,:,jn) = 1 + (data_src(:,:)-1) / ref_wgts(nxt_wgt)%ddims(1)
@@ -824,14 +868,15 @@
             aname = ' '
             WRITE(aname,'(a3,i2.2)') 'wgt',jn
-            ref_wgts(nxt_wgt)%data_wgt(:,:,jn) = 0.0
-            CALL iom_get ( inum, jpdom_data, aname, ref_wgts(nxt_wgt)%data_wgt(:,:,jn) )
+            ref_wgts(nxt_wgt)%data_wgt(1:nlci,1:nlcj,jn) = 0.0
+            CALL iom_get ( inum, jpdom_unknown, aname, ref_wgts(nxt_wgt)%data_wgt(1:nlci,1:nlcj,jn), &
+                           kstart=(/nimpp,njmpp/), kcount=(/nlci,nlcj/) )
          END DO
          CALL iom_close (inum)
  
          ! find min and max indices in grid
-         ref_wgts(nxt_wgt)%botleft(1) = MINVAL(ref_wgts(nxt_wgt)%data_jpi(:,:,:))
-         ref_wgts(nxt_wgt)%botleft(2) = MINVAL(ref_wgts(nxt_wgt)%data_jpj(:,:,:))
-         ref_wgts(nxt_wgt)%topright(1) = MAXVAL(ref_wgts(nxt_wgt)%data_jpi(:,:,:))
-         ref_wgts(nxt_wgt)%topright(2) = MAXVAL(ref_wgts(nxt_wgt)%data_jpj(:,:,:))
+         ref_wgts(nxt_wgt)%botleft(1) = MINVAL(ref_wgts(nxt_wgt)%data_jpi(1:nlci,1:nlcj,:))
+         ref_wgts(nxt_wgt)%botleft(2) = MINVAL(ref_wgts(nxt_wgt)%data_jpj(1:nlci,1:nlcj,:))
+         ref_wgts(nxt_wgt)%topright(1) = MAXVAL(ref_wgts(nxt_wgt)%data_jpi(1:nlci,1:nlcj,:))
+         ref_wgts(nxt_wgt)%topright(2) = MAXVAL(ref_wgts(nxt_wgt)%data_jpj(1:nlci,1:nlcj,:))
 
          ! and therefore dimensions of the input box
@@ -846,6 +891,7 @@
          ! SA: +3 stencil is a patch to avoid out-of-bound computation in some configuration. 
          ! a more robust solution will be given in next release
-         ALLOCATE( ref_wgts(nxt_wgt)%fly_dta(ref_wgts(nxt_wgt)%jpiwgt+3, ref_wgts(nxt_wgt)%jpjwgt+3) )
-         IF( ref_wgts(nxt_wgt)%cyclic ) ALLOCATE( ref_wgts(nxt_wgt)%col2(2,ref_wgts(nxt_wgt)%jpjwgt+3) )
+         ipk =  SIZE(sd%fdta,3)
+         ALLOCATE( ref_wgts(nxt_wgt)%fly_dta(ref_wgts(nxt_wgt)%jpiwgt+3, ref_wgts(nxt_wgt)%jpjwgt+3 ,ipk) )
+         IF( ref_wgts(nxt_wgt)%cyclic ) ALLOCATE( ref_wgts(nxt_wgt)%col2(2,ref_wgts(nxt_wgt)%jpjwgt+3,ipk) )
 
          nxt_wgt = nxt_wgt + 1
@@ -857,5 +903,5 @@
    END SUBROUTINE fld_weight
 
-   SUBROUTINE fld_interp(num, clvar, kw, dta, nrec)
+   SUBROUTINE fld_interp(num, clvar, kw, kk, dta, nrec)
       !!---------------------------------------------------------------------
       !!                    ***  ROUTINE fld_interp  ***
@@ -866,16 +912,17 @@
       !! ** Method  :   
       !!----------------------------------------------------------------------
-      INTEGER,          INTENT(in)                        ::   num                 ! stream number
-      CHARACTER(LEN=*), INTENT(in)                        ::   clvar               ! variable name
-      INTEGER,          INTENT(in)                        ::   kw                  ! weights number
-      REAL(wp),         INTENT(inout), DIMENSION(jpi,jpj) ::   dta                 ! output field on model grid
-      INTEGER,          INTENT(in)                        ::   nrec                ! record number to read (ie time slice)
+      INTEGER,          INTENT(in)                           ::   num                 ! stream number
+      CHARACTER(LEN=*), INTENT(in)                           ::   clvar               ! variable name
+      INTEGER,          INTENT(in)                           ::   kw                  ! weights number
+      INTEGER,          INTENT(in)                           ::   kk                  ! vertical dimension of kk
+      REAL(wp),         INTENT(inout), DIMENSION(jpi,jpj,kk) ::   dta                 ! output field on model grid
+      INTEGER,          INTENT(in)                           ::   nrec                ! record number to read (ie time slice)
       !! 
-      INTEGER, DIMENSION(2)                               ::   rec1,recn           ! temporary arrays for start and length
-      INTEGER                                             ::  jk, jn, jm           ! loop counters
-      INTEGER                                             ::  ni, nj               ! lengths
-      INTEGER                                             ::  jpimin,jpiwid        ! temporary indices
-      INTEGER                                             ::  jpjmin,jpjwid        ! temporary indices
-      INTEGER                                             ::  jpi1,jpi2,jpj1,jpj2  ! temporary indices
+      INTEGER, DIMENSION(3)                                  ::   rec1,recn           ! temporary arrays for start and length
+      INTEGER                                                ::  jk, jn, jm           ! loop counters
+      INTEGER                                                ::  ni, nj               ! lengths
+      INTEGER                                                ::  jpimin,jpiwid        ! temporary indices
+      INTEGER                                                ::  jpjmin,jpjwid        ! temporary indices
+      INTEGER                                                ::  jpi1,jpi2,jpj1,jpj2  ! temporary indices
       !!----------------------------------------------------------------------
       !
@@ -895,6 +942,8 @@
       rec1(1) = MAX( jpimin-1, 1 )
       rec1(2) = MAX( jpjmin-1, 1 )
+      rec1(3) = 1
       recn(1) = MIN( jpiwid+2, ref_wgts(kw)%ddims(1)-rec1(1)+1 )
       recn(2) = MIN( jpjwid+2, ref_wgts(kw)%ddims(2)-rec1(2)+1 )
+      recn(3) = kk
 
       !! where we need to read it to
@@ -904,16 +953,21 @@
       jpj2 = jpj1 + recn(2) - 1
 
-      ref_wgts(kw)%fly_dta(:,:) = 0.0
-      CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2), nrec, rec1, recn)
+      ref_wgts(kw)%fly_dta(:,:,:) = 0.0
+      SELECT CASE( SIZE(ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:),3) )
+      CASE(1)
+           CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,1), nrec, rec1, recn)
+      CASE(jpk)  
+           CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%fly_dta(jpi1:jpi2,jpj1:jpj2,:), nrec, rec1, recn)
+      END SELECT 
 
       !! first four weights common to both bilinear and bicubic
       !! note that we have to offset by 1 into fly_dta array because of halo
-      dta(:,:) = 0.0
+      dta(:,:,:) = 0.0
       DO jk = 1,4
-        DO jn = 1, jpj
-          DO jm = 1,jpi
+        DO jn = 1, nlcj
+          DO jm = 1,nlci
             ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
             nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
-            dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk) * ref_wgts(kw)%fly_dta(ni+1,nj+1)
+            dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk) * ref_wgts(kw)%fly_dta(ni+1,nj+1,jk)
           END DO
         END DO
@@ -924,14 +978,14 @@
         !! fix up halo points that we couldnt read from file
         IF( jpi1 == 2 ) THEN
-           ref_wgts(kw)%fly_dta(jpi1-1,:) = ref_wgts(kw)%fly_dta(jpi1,:)
+           ref_wgts(kw)%fly_dta(jpi1-1,:,:) = ref_wgts(kw)%fly_dta(jpi1,:,:)
         ENDIF
         IF( jpi2 + jpimin - 1 == ref_wgts(kw)%ddims(1)+1 ) THEN
-           ref_wgts(kw)%fly_dta(jpi2+1,:) = ref_wgts(kw)%fly_dta(jpi2,:)
+           ref_wgts(kw)%fly_dta(jpi2+1,:,:) = ref_wgts(kw)%fly_dta(jpi2,:,:)
         ENDIF
         IF( jpj1 == 2 ) THEN
-           ref_wgts(kw)%fly_dta(:,jpj1-1) = ref_wgts(kw)%fly_dta(:,jpj1)
+           ref_wgts(kw)%fly_dta(:,jpj1-1,:) = ref_wgts(kw)%fly_dta(:,jpj1,:)
         ENDIF
         IF( jpj2 + jpjmin - 1 == ref_wgts(kw)%ddims(2)+1 .AND. jpj2 .lt. jpjwid+2 ) THEN
-           ref_wgts(kw)%fly_dta(:,jpj2+1) = 2.0*ref_wgts(kw)%fly_dta(:,jpj2) - ref_wgts(kw)%fly_dta(:,jpj2-1)
+           ref_wgts(kw)%fly_dta(:,jpj2+1,:) = 2.0*ref_wgts(kw)%fly_dta(:,jpj2,:) - ref_wgts(kw)%fly_dta(:,jpj2-1,:)
         ENDIF
 
@@ -946,11 +1000,21 @@
            IF( jpi1 == 2 ) THEN
               rec1(1) = ref_wgts(kw)%ddims(1) - 1
-              CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2), nrec, rec1, recn)
-              ref_wgts(kw)%fly_dta(jpi1-1,jpj1:jpj2) = ref_wgts(kw)%col2(ref_wgts(kw)%offset+1,jpj1:jpj2)
+              SELECT CASE( SIZE( ref_wgts(kw)%col2(:,jpj1:jpj2,:),3) )
+              CASE(1)
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,1), nrec, rec1, recn)
+              CASE(jpk)         
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,:), nrec, rec1, recn)
+              END SELECT      
+              ref_wgts(kw)%fly_dta(jpi1-1,jpj1:jpj2,:) = ref_wgts(kw)%col2(ref_wgts(kw)%offset+1,jpj1:jpj2,:)
            ENDIF
            IF( jpi2 + jpimin - 1 == ref_wgts(kw)%ddims(1)+1 ) THEN
               rec1(1) = 1
-              CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2), nrec, rec1, recn)
-              ref_wgts(kw)%fly_dta(jpi2+1,jpj1:jpj2) = ref_wgts(kw)%col2(2-ref_wgts(kw)%offset,jpj1:jpj2)
+              SELECT CASE( SIZE( ref_wgts(kw)%col2(:,jpj1:jpj2,:),3) )
+              CASE(1)
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,1), nrec, rec1, recn)
+              CASE(jpk)
+                   CALL iom_get( num, jpdom_unknown, clvar, ref_wgts(kw)%col2(:,jpj1:jpj2,:), nrec, rec1, recn)
+              END SELECT
+              ref_wgts(kw)%fly_dta(jpi2+1,jpj1:jpj2,:) = ref_wgts(kw)%col2(2-ref_wgts(kw)%offset,jpj1:jpj2,:)
            ENDIF
         ENDIF
@@ -958,10 +1022,10 @@
         ! gradient in the i direction
         DO jk = 1,4
-          DO jn = 1, jpj
-            DO jm = 1,jpi
+          DO jn = 1, nlcj
+            DO jm = 1,nlci
               ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
               nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
-              dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk+4) * 0.5 *         &
-                               (ref_wgts(kw)%fly_dta(ni+2,nj+1) - ref_wgts(kw)%fly_dta(ni,nj+1))
+              dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+4) * 0.5 *         &
+                               (ref_wgts(kw)%fly_dta(ni+2,nj+1,:) - ref_wgts(kw)%fly_dta(ni,nj+1,:))
             END DO
           END DO
@@ -970,10 +1034,10 @@
         ! gradient in the j direction
         DO jk = 1,4
-          DO jn = 1, jpj
-            DO jm = 1,jpi
+          DO jn = 1, nlcj
+            DO jm = 1,nlci
               ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
               nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
-              dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk+8) * 0.5 *         &
-                               (ref_wgts(kw)%fly_dta(ni+1,nj+2) - ref_wgts(kw)%fly_dta(ni+1,nj))
+              dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+8) * 0.5 *         &
+                               (ref_wgts(kw)%fly_dta(ni+1,nj+2,:) - ref_wgts(kw)%fly_dta(ni+1,nj,:))
             END DO
           END DO
@@ -986,7 +1050,7 @@
               ni = ref_wgts(kw)%data_jpi(jm,jn,jk)
               nj = ref_wgts(kw)%data_jpj(jm,jn,jk)
-              dta(jm,jn) = dta(jm,jn) + ref_wgts(kw)%data_wgt(jm,jn,jk+12) * 0.25 * ( &
-                               (ref_wgts(kw)%fly_dta(ni+2,nj+2) - ref_wgts(kw)%fly_dta(ni  ,nj+2)) -   &
-                               (ref_wgts(kw)%fly_dta(ni+2,nj  ) - ref_wgts(kw)%fly_dta(ni  ,nj  )))
+              dta(jm,jn,:) = dta(jm,jn,:) + ref_wgts(kw)%data_wgt(jm,jn,jk+12) * 0.25 * ( &
+                               (ref_wgts(kw)%fly_dta(ni+2,nj+2,:) - ref_wgts(kw)%fly_dta(ni  ,nj+2,:)) -   &
+                               (ref_wgts(kw)%fly_dta(ni+2,nj  ,:) - ref_wgts(kw)%fly_dta(ni  ,nj  ,:)))
             END DO
           END DO
Index: branches/devmercator2010/NEMO/OPA_SRC/SBC/geo2ocean.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SBC/geo2ocean.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SBC/geo2ocean.F90	(revision 2071)
@@ -311,8 +311,8 @@
 
       ! lateral boundary cond.: T-, U-, V-, F-pts, sgn
-      CALL lbc_lnk( gcost, 'T', -1. )   ;   CALL lbc_lnk( gsint, 'T', -1. )
-      CALL lbc_lnk( gcosu, 'U', -1. )   ;   CALL lbc_lnk( gsinu, 'U', -1. )
-      CALL lbc_lnk( gcosv, 'V', -1. )   ;   CALL lbc_lnk( gsinv, 'V', -1. )
-      CALL lbc_lnk( gcosf, 'F', -1. )   ;   CALL lbc_lnk( gsinf, 'F', -1. )
+      CALL lbc_lnk( gcost, 'T', 1. )   ;   CALL lbc_lnk( gsint, 'T', -1. )
+      CALL lbc_lnk( gcosu, 'U', 1. )   ;   CALL lbc_lnk( gsinu, 'U', -1. )
+      CALL lbc_lnk( gcosv, 'V', 1. )   ;   CALL lbc_lnk( gsinv, 'V', -1. )
+      CALL lbc_lnk( gcosf, 'F', 1. )   ;   CALL lbc_lnk( gsinf, 'F', -1. )
 
    END SUBROUTINE angle
Index: branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcblk_clio.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 2071)
@@ -162,6 +162,6 @@
 
          DO ifpr= 1, jpfld
-            ALLOCATE( sf(ifpr)%fnow(jpi,jpj) )
-            ALLOCATE( sf(ifpr)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) )
          END DO
 
@@ -178,5 +178,5 @@
       !
 #if defined key_lim3      
-      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:)     !RB ugly patch
+      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:,1)     !RB ugly patch
 #endif
       !
@@ -272,6 +272,6 @@
       DO jj = 1 , jpj
          DO ji = 1, jpi
-            utau(ji,jj) = sf(jp_utau)%fnow(ji,jj)
-            vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj)
+            utau(ji,jj) = sf(jp_utau)%fnow(ji,jj,1)
+            vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj,1)
          END DO
       END DO
@@ -297,5 +297,5 @@
       DO jj = 1 , jpj
          DO ji = 1, jpi
-            wndm(ji,jj) = sf(jp_wndm)%fnow(ji,jj)
+            wndm(ji,jj) = sf(jp_wndm)%fnow(ji,jj,1)
          END DO
       END DO
@@ -317,6 +317,6 @@
             !
             zsst  = pst(ji,jj)              + rt0           ! converte Celcius to Kelvin the SST
-            ztatm = sf(jp_tair)%fnow(ji,jj)                 ! and set minimum value far above 0 K (=rt0 over land)
-            zcco1 = 1.0 - sf(jp_ccov)%fnow(ji,jj)           ! fraction of clear sky ( 1 - cloud cover)
+            ztatm = sf(jp_tair)%fnow(ji,jj,1)               ! and set minimum value far above 0 K (=rt0 over land)
+            zcco1 = 1.0 - sf(jp_ccov)%fnow(ji,jj,1)         ! fraction of clear sky ( 1 - cloud cover)
             zrhoa = zpatm / ( 287.04 * ztatm )              ! air density (equation of state for dry air) 
             ztamr = ztatm - rtt                             ! Saturation water vapour
@@ -325,5 +325,5 @@
             zmt3  = SIGN( 28.200, -ztamr )                  !           \/
             zes   = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 ) / ( ztatm - 35.86  + MAX( 0.e0, zmt3 ) )  )
-            zev    = sf(jp_humi)%fnow(ji,jj) * zes          ! vapour pressure  
+            zev    = sf(jp_humi)%fnow(ji,jj,1) * zes        ! vapour pressure  
             zevsqr = SQRT( zev * 0.01 )                     ! square-root of vapour pressure
             zqatm = 0.622 * zev / ( zpatm - 0.378 * zev )   ! specific humidity 
@@ -333,5 +333,5 @@
             !--------------------------------------!
             ztatm3  = ztatm * ztatm * ztatm
-            zcldeff = 1.0 - sbudyko(ji,jj) * sf(jp_ccov)%fnow(ji,jj) * sf(jp_ccov)%fnow(ji,jj)    
+            zcldeff = 1.0 - sbudyko(ji,jj) * sf(jp_ccov)%fnow(ji,jj,1) * sf(jp_ccov)%fnow(ji,jj,1)    
             ztaevbk = ztatm * ztatm3 * zcldeff * ( 0.39 - 0.05 * zevsqr ) 
             !
@@ -351,5 +351,5 @@
             zdeltaq = zqatm - zqsato
             ztvmoy  = ztatm * ( 1. + 2.2e-3 * ztatm * zqatm )
-            zdenum  = MAX( sf(jp_wndm)%fnow(ji,jj) * sf(jp_wndm)%fnow(ji,jj) * ztvmoy, zeps )
+            zdenum  = MAX( sf(jp_wndm)%fnow(ji,jj,1) * sf(jp_wndm)%fnow(ji,jj,1) * ztvmoy, zeps )
             zdtetar = zdteta / zdenum
             ztvmoyr = ztvmoy * ztvmoy * zdeltaq / zdenum
@@ -373,5 +373,5 @@
             zpsil   = zpsih
             
-            zvatmg         = MAX( 0.032 * 1.5e-3 * sf(jp_wndm)%fnow(ji,jj) * sf(jp_wndm)%fnow(ji,jj) / grav, zeps )
+            zvatmg         = MAX( 0.032 * 1.5e-3 * sf(jp_wndm)%fnow(ji,jj,1) * sf(jp_wndm)%fnow(ji,jj,1) / grav, zeps )
             zcmn           = vkarmn / LOG ( 10. / zvatmg )
             zchn           = 0.0327 * zcmn
@@ -387,5 +387,5 @@
             zcleo          = zcln * zclcm 
 
-            zrhova         = zrhoa * sf(jp_wndm)%fnow(ji,jj)
+            zrhova         = zrhoa * sf(jp_wndm)%fnow(ji,jj,1)
 
             ! sensible heat flux
@@ -408,5 +408,5 @@
          DO ji = 1, jpi
             qns (ji,jj) = zqlw(ji,jj) - zqsb(ji,jj) - zqla(ji,jj)      ! Downward Non Solar flux
-            emp (ji,jj) = zqla(ji,jj) / cevap - sf(jp_prec)%fnow(ji,jj) / rday * tmask(ji,jj,1)
+            emp (ji,jj) = zqla(ji,jj) / cevap - sf(jp_prec)%fnow(ji,jj,1) / rday * tmask(ji,jj,1)
          END DO
       END DO
@@ -530,5 +530,5 @@
 !CDIR NOVERRCHK
          DO ji = 1, jpi
-            ztatm (ji,jj) = sf(jp_tair)%fnow(ji,jj)                  ! air temperature in Kelvins 
+            ztatm (ji,jj) = sf(jp_tair)%fnow(ji,jj,1)                ! air temperature in Kelvins 
       
             zrhoa(ji,jj) = zpatm / ( 287.04 * ztatm(ji,jj) )         ! air density (equation of state for dry air) 
@@ -541,5 +541,5 @@
                &                / ( ztatm(ji,jj) - 35.86  + MAX( 0.e0, zmt3 ) )  )
 
-            zev = sf(jp_humi)%fnow(ji,jj) * zes                      ! vapour pressure  
+            zev = sf(jp_humi)%fnow(ji,jj,1) * zes                      ! vapour pressure  
             zevsqr(ji,jj) = SQRT( zev * 0.01 )                       ! square-root of vapour pressure
             zqatm(ji,jj) = 0.622 * zev / ( zpatm - 0.378 * zev )     ! specific humidity 
@@ -551,5 +551,5 @@
             zmt2  = ( 272.0 - ztatm(ji,jj) ) / 38.0   ;   zind2 = MAX( 0.e0, SIGN( 1.e0, zmt2 ) )
             zmt3  = ( 281.0 - ztatm(ji,jj) ) / 18.0   ;   zind3 = MAX( 0.e0, SIGN( 1.e0, zmt3 ) )
-            p_spr(ji,jj) = sf(jp_prec)%fnow(ji,jj) / rday   &        ! rday = converte mm/day to kg/m2/s
+            p_spr(ji,jj) = sf(jp_prec)%fnow(ji,jj,1) / rday   &      ! rday = converte mm/day to kg/m2/s
                &         * (          zind1      &                   ! solid  (snow) precipitation [kg/m2/s]
                &            + ( 1.0 - zind1 ) * (          zind2   * ( 0.5 + zmt2 )   &
@@ -561,6 +561,6 @@
             ! fraction of qsr_ice which is NOT absorbed in the thin surface layer
             ! and thus which penetrates inside the ice cover ( Maykut and Untersteiner, 1971 ; Elbert anbd Curry, 1993 )
-            p_fr1(ji,jj) = 0.18  * ( 1.e0 - sf(jp_ccov)%fnow(ji,jj) ) + 0.35 * sf(jp_ccov)%fnow(ji,jj) 
-            p_fr2(ji,jj) = 0.82  * ( 1.e0 - sf(jp_ccov)%fnow(ji,jj) ) + 0.65 * sf(jp_ccov)%fnow(ji,jj)
+            p_fr1(ji,jj) = 0.18  * ( 1.e0 - sf(jp_ccov)%fnow(ji,jj,1) ) + 0.35 * sf(jp_ccov)%fnow(ji,jj,1) 
+            p_fr2(ji,jj) = 0.82  * ( 1.e0 - sf(jp_ccov)%fnow(ji,jj,1) ) + 0.65 * sf(jp_ccov)%fnow(ji,jj,1)
          END DO
       END DO
@@ -584,5 +584,5 @@
                !-------------------------------------------!
                ztatm3  = ztatm(ji,jj) * ztatm(ji,jj) * ztatm(ji,jj)
-               zcldeff = 1.0 - sbudyko(ji,jj) * sf(jp_ccov)%fnow(ji,jj) * sf(jp_ccov)%fnow(ji,jj)    
+               zcldeff = 1.0 - sbudyko(ji,jj) * sf(jp_ccov)%fnow(ji,jj,1) * sf(jp_ccov)%fnow(ji,jj,1)    
                ztaevbk = ztatm3 * ztatm(ji,jj) * zcldeff * ( 0.39 - 0.05 * zevsqr(ji,jj) ) 
                !
@@ -609,5 +609,5 @@
                
                !  sensible and latent fluxes over ice
-               zrhova     = zrhoa(ji,jj) * sf(jp_wndm)%fnow(ji,jj)      ! computation of intermediate values
+               zrhova     = zrhoa(ji,jj) * sf(jp_wndm)%fnow(ji,jj,1)      ! computation of intermediate values
                zrhovaclei = zrhova * zcshi * 2.834e+06
                zrhovacshi = zrhova * zclei * 1004.0
@@ -639,5 +639,5 @@
       p_qns(:,:,:) = z_qlw (:,:,:) - z_qsb (:,:,:) - p_qla (:,:,:)      ! Downward Non Solar flux
 !CDIR COLLAPSE
-      p_tpr(:,:)   = sf(jp_prec)%fnow(:,:) / rday                       ! total precipitation [kg/m2/s]
+      p_tpr(:,:)   = sf(jp_prec)%fnow(:,:,1) / rday                       ! total precipitation [kg/m2/s]
       !
 !!gm : not necessary as all input data are lbc_lnk...
@@ -735,11 +735,11 @@
 !CDIR NOVERRCHK
          DO ji = 1, jpi
-            ztamr = sf(jp_tair)%fnow(ji,jj) - rtt
+            ztamr = sf(jp_tair)%fnow(ji,jj,1) - rtt
             zmt1  = SIGN( 17.269,  ztamr )
             zmt2  = SIGN( 21.875,  ztamr )
             zmt3  = SIGN( 28.200, -ztamr )
             zes = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &              ! Saturation water vapour
-               &                     / ( sf(jp_tair)%fnow(ji,jj) - 35.86  + MAX( 0.e0, zmt3 ) )  )
-            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj) * zes * 1.0e-05                   ! vapour pressure  
+               &                     / ( sf(jp_tair)%fnow(ji,jj,1) - 35.86  + MAX( 0.e0, zmt3 ) )  )
+            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj,1) * zes * 1.0e-05                   ! vapour pressure  
          END DO
       END DO
@@ -798,6 +798,6 @@
 
                ! ocean albedo depending on the cloud cover (Payne, 1972)
-               za_oce     = ( 1.0 - sf(jp_ccov)%fnow(ji,jj) ) * 0.05 / ( 1.1 * zcmue**1.4 + 0.15 )   &   ! clear sky
-                  &       +         sf(jp_ccov)%fnow(ji,jj)   * 0.06                                     ! overcast
+               za_oce     = ( 1.0 - sf(jp_ccov)%fnow(ji,jj,1) ) * 0.05 / ( 1.1 * zcmue**1.4 + 0.15 )   &   ! clear sky
+                  &       +         sf(jp_ccov)%fnow(ji,jj,1)   * 0.06                                     ! overcast
 
                   ! solar heat flux absorbed by the ocean (Zillman, 1972)
@@ -814,5 +814,5 @@
          DO ji = 1, jpi
             zlmunoon = ASIN( zps(ji,jj) + zpc(ji,jj) ) / rad                         ! local noon solar altitude
-            zcldcor  = MIN(  1.e0, ( 1.e0 - 0.62 * sf(jp_ccov)%fnow(ji,jj)   &       ! cloud correction (Reed 1977)
+            zcldcor  = MIN(  1.e0, ( 1.e0 - 0.62 * sf(jp_ccov)%fnow(ji,jj,1)   &       ! cloud correction (Reed 1977)
                &                          + 0.0019 * zlmunoon )                 )
             pqsr_oce(ji,jj) = zcoef1 * zcldcor * pqsr_oce(ji,jj) * tmask(ji,jj,1)   ! and zcoef1: ellipsity
@@ -865,11 +865,11 @@
 !CDIR NOVERRCHK
          DO ji = 1, jpi           
-            ztamr = sf(jp_tair)%fnow(ji,jj) - rtt           
+            ztamr = sf(jp_tair)%fnow(ji,jj,1) - rtt           
             zmt1  = SIGN( 17.269,  ztamr )
             zmt2  = SIGN( 21.875,  ztamr )
             zmt3  = SIGN( 28.200, -ztamr )
             zes = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &              ! Saturation water vapour
-               &                     / ( sf(jp_tair)%fnow(ji,jj) - 35.86  + MAX( 0.e0, zmt3 ) )  )
-            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj) * zes * 1.0e-05                   ! vapour pressure  
+               &                     / ( sf(jp_tair)%fnow(ji,jj,1) - 35.86  + MAX( 0.e0, zmt3 ) )  )
+            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj,1) * zes * 1.0e-05                   ! vapour pressure  
          END DO
       END DO
@@ -938,6 +938,6 @@
                      &        / (  1.0 + 0.139  * stauc(ji,jj) * ( 1.0 - 0.9435 * pa_ice_os(ji,jj,jl) ) )       
              
-                  pqsr_ice(ji,jj,jl) = pqsr_ice(ji,jj,jl) + (  ( 1.0 - sf(jp_ccov)%fnow(ji,jj) ) * zqsr_ice_cs    &
-                     &                                       +         sf(jp_ccov)%fnow(ji,jj)   * zqsr_ice_os  )
+                  pqsr_ice(ji,jj,jl) = pqsr_ice(ji,jj,jl) + (  ( 1.0 - sf(jp_ccov)%fnow(ji,jj,1) ) * zqsr_ice_cs    &
+                     &                                       +         sf(jp_ccov)%fnow(ji,jj,1)   * zqsr_ice_os  )
                END DO
             END DO
Index: branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcblk_core.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 2071)
@@ -164,6 +164,6 @@
          ENDIF
          DO ifpr= 1, jfld
-            ALLOCATE( sf(ifpr)%fnow(jpi,jpj) )
-            ALLOCATE( sf(ifpr)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf(ifpr)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf(ifpr)%fdta(jpi,jpj,1,2) )
          END DO
          !
@@ -176,5 +176,5 @@
 
 #if defined key_lim3
-      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:)
+      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:,1)
 #endif
 
@@ -244,6 +244,6 @@
       DO jj = 2, jpjm1
          DO ji = fs_2, fs_jpim1   ! vect. opt.
-            zwnd_i(ji,jj) = (  sf(jp_wndi)%fnow(ji,jj) - 0.5 * ( pu(ji-1,jj  ) + pu(ji,jj) )  )
-            zwnd_j(ji,jj) = (  sf(jp_wndj)%fnow(ji,jj) - 0.5 * ( pv(ji  ,jj-1) + pv(ji,jj) )  )
+            zwnd_i(ji,jj) = (  sf(jp_wndi)%fnow(ji,jj,1) - 0.5 * ( pu(ji-1,jj  ) + pu(ji,jj) )  )
+            zwnd_j(ji,jj) = (  sf(jp_wndj)%fnow(ji,jj,1) - 0.5 * ( pv(ji  ,jj-1) + pv(ji,jj) )  )
          END DO
       END DO
@@ -262,7 +262,7 @@
       ! ocean albedo assumed to be 0.066
 !CDIR COLLAPSE
-      qsr (:,:) = ( 1. - 0.066 ) * sf(jp_qsr)%fnow(:,:) * tmask(:,:,1)                                 ! Short Wave
-!CDIR COLLAPSE
-      zqlw(:,:) = (  sf(jp_qlw)%fnow(:,:) - Stef * zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:)  ) * tmask(:,:,1)   ! Long  Wave
+      qsr (:,:) = ( 1. - 0.066 ) * sf(jp_qsr)%fnow(:,:,1) * tmask(:,:,1)                                 ! Short Wave
+!CDIR COLLAPSE
+      zqlw(:,:) = (  sf(jp_qlw)%fnow(:,:,1) - Stef * zst(:,:)*zst(:,:)*zst(:,:)*zst(:,:)  ) * tmask(:,:,1)   ! Long  Wave
                       
       ! ----------------------------------------------------------------------------- !
@@ -307,5 +307,5 @@
       IF( lhftau ) THEN 
 !CDIR COLLAPSE
-         taum(:,:) = taum(:,:) + sf(jp_tdif)%fnow(:,:)
+         taum(:,:) = taum(:,:) + sf(jp_tdif)%fnow(:,:,1)
       ENDIF
       CALL iom_put( "taum_oce", taum )   ! output wind stress module
@@ -330,7 +330,7 @@
       ELSE
 !CDIR COLLAPSE
-         zevap(:,:) = MAX( 0.e0, rhoa    *Ce(:,:)*( zqsatw(:,:) - sf(jp_humi)%fnow(:,:) ) * wndm(:,:) )   ! Evaporation
-!CDIR COLLAPSE
-         zqsb (:,:) =            rhoa*cpa*Ch(:,:)*( zst   (:,:) - sf(jp_tair)%fnow(:,:) ) * wndm(:,:)     ! Sensible Heat
+         zevap(:,:) = MAX( 0.e0, rhoa    *Ce(:,:)*( zqsatw(:,:) - sf(jp_humi)%fnow(:,:,1) ) * wndm(:,:) )   ! Evaporation
+!CDIR COLLAPSE
+         zqsb (:,:) =            rhoa*cpa*Ch(:,:)*( zst   (:,:) - sf(jp_tair)%fnow(:,:,1) ) * wndm(:,:)     ! Sensible Heat
       ENDIF
 !CDIR COLLAPSE
@@ -355,5 +355,5 @@
       qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)      ! Downward Non Solar flux
 !CDIR COLLAPSE
-      emp (:,:) = zevap(:,:) - sf(jp_prec)%fnow(:,:) * rn_pfac * tmask(:,:,1)
+      emp (:,:) = zevap(:,:) - sf(jp_prec)%fnow(:,:,1) * rn_pfac * tmask(:,:,1)
 !CDIR COLLAPSE
       emps(:,:) = emp(:,:)
@@ -453,8 +453,8 @@
             DO ji = 2, jpim1   ! B grid : no vector opt
                ! ... scalar wind at I-point (fld being at T-point)
-               zwndi_f = 0.25 * (  sf(jp_wndi)%fnow(ji-1,jj  ) + sf(jp_wndi)%fnow(ji  ,jj  )   &
-                  &              + sf(jp_wndi)%fnow(ji-1,jj-1) + sf(jp_wndi)%fnow(ji  ,jj-1)  ) - pui(ji,jj)
-               zwndj_f = 0.25 * (  sf(jp_wndj)%fnow(ji-1,jj  ) + sf(jp_wndj)%fnow(ji  ,jj  )   &
-                  &              + sf(jp_wndj)%fnow(ji-1,jj-1) + sf(jp_wndj)%fnow(ji  ,jj-1)  ) - pvi(ji,jj)
+               zwndi_f = 0.25 * (  sf(jp_wndi)%fnow(ji-1,jj  ,1) + sf(jp_wndi)%fnow(ji  ,jj  ,1)   &
+                  &              + sf(jp_wndi)%fnow(ji-1,jj-1,1) + sf(jp_wndi)%fnow(ji  ,jj-1,1)  ) - pui(ji,jj)
+               zwndj_f = 0.25 * (  sf(jp_wndj)%fnow(ji-1,jj  ,1) + sf(jp_wndj)%fnow(ji  ,jj  ,1)   &
+                  &              + sf(jp_wndj)%fnow(ji-1,jj-1,1) + sf(jp_wndj)%fnow(ji  ,jj-1,1)  ) - pvi(ji,jj)
                zwnorm_f = zcoef_wnorm * SQRT( zwndi_f * zwndi_f + zwndj_f * zwndj_f )
                ! ... ice stress at I-point
@@ -462,7 +462,7 @@
                p_tauj(ji,jj) = zwnorm_f * zwndj_f
                ! ... scalar wind at T-point (fld being at T-point)
-               zwndi_t = sf(jp_wndi)%fnow(ji,jj) - 0.25 * (  pui(ji,jj+1) + pui(ji+1,jj+1)   &
+               zwndi_t = sf(jp_wndi)%fnow(ji,jj,1) - 0.25 * (  pui(ji,jj+1) + pui(ji+1,jj+1)   &
                   &                                        + pui(ji,jj  ) + pui(ji+1,jj  )  )
-               zwndj_t = sf(jp_wndj)%fnow(ji,jj) - 0.25 * (  pvi(ji,jj+1) + pvi(ji+1,jj+1)   &
+               zwndj_t = sf(jp_wndj)%fnow(ji,jj,1) - 0.25 * (  pvi(ji,jj+1) + pvi(ji+1,jj+1)   &
                   &                                        + pvi(ji,jj  ) + pvi(ji+1,jj  )  )
                z_wnds_t(ji,jj)  = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
@@ -479,6 +479,6 @@
          DO jj = 2, jpj
             DO ji = fs_2, jpi   ! vect. opt.
-               zwndi_t = (  sf(jp_wndi)%fnow(ji,jj) - 0.5 * ( pui(ji-1,jj  ) + pui(ji,jj) )  )
-               zwndj_t = (  sf(jp_wndj)%fnow(ji,jj) - 0.5 * ( pvi(ji  ,jj-1) + pvi(ji,jj) )  )
+               zwndi_t = (  sf(jp_wndi)%fnow(ji,jj,1) - 0.5 * ( pui(ji-1,jj  ) + pui(ji,jj) )  )
+               zwndj_t = (  sf(jp_wndj)%fnow(ji,jj,1) - 0.5 * ( pvi(ji  ,jj-1) + pvi(ji,jj) )  )
                z_wnds_t(ji,jj)  = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
             END DO
@@ -490,7 +490,7 @@
             DO ji = fs_2, fs_jpim1   ! vect. opt.
                p_taui(ji,jj) = zcoef_wnorm2 * ( z_wnds_t(ji+1,jj) + z_wnds_t(ji,jj) )                          &
-                  &          * ( 0.5 * (sf(jp_wndi)%fnow(ji+1,jj) + sf(jp_wndi)%fnow(ji,jj) ) - pui(ji,jj) )
+                  &          * ( 0.5 * (sf(jp_wndi)%fnow(ji+1,jj,1) + sf(jp_wndi)%fnow(ji,jj,1) ) - pui(ji,jj) )
                p_tauj(ji,jj) = zcoef_wnorm2 * ( z_wnds_t(ji,jj+1) + z_wnds_t(ji,jj) )                          &
-                  &          * ( 0.5 * (sf(jp_wndj)%fnow(ji,jj+1) + sf(jp_wndj)%fnow(ji,jj) ) - pvi(ji,jj) )
+                  &          * ( 0.5 * (sf(jp_wndj)%fnow(ji,jj+1,1) + sf(jp_wndj)%fnow(ji,jj,1) ) - pvi(ji,jj) )
             END DO
          END DO
@@ -515,7 +515,7 @@
                zst3 = pst(ji,jj,jl) * zst2
                ! Short Wave (sw)
-               p_qsr(ji,jj,jl) = ( 1. - palb(ji,jj,jl) ) * sf(jp_qsr)%fnow(ji,jj) * tmask(ji,jj,1)
+               p_qsr(ji,jj,jl) = ( 1. - palb(ji,jj,jl) ) * sf(jp_qsr)%fnow(ji,jj,1) * tmask(ji,jj,1)
                ! Long  Wave (lw)
-               z_qlw(ji,jj,jl) = 0.95 * (  sf(jp_qlw)%fnow(ji,jj)       &                         
+               z_qlw(ji,jj,jl) = 0.95 * (  sf(jp_qlw)%fnow(ji,jj,1)       &                         
                   &                   - Stef * pst(ji,jj,jl) * zst3  ) * tmask(ji,jj,1)
                ! lw sensitivity
@@ -528,8 +528,8 @@
                ! ... turbulent heat fluxes
                ! Sensible Heat
-               z_qsb(ji,jj,jl) = rhoa * cpa * Cice * z_wnds_t(ji,jj) * ( pst(ji,jj,jl) - sf(jp_tair)%fnow(ji,jj) )
+               z_qsb(ji,jj,jl) = rhoa * cpa * Cice * z_wnds_t(ji,jj) * ( pst(ji,jj,jl) - sf(jp_tair)%fnow(ji,jj,1) )
                ! Latent Heat
                p_qla(ji,jj,jl) = MAX( 0.e0, rhoa * Ls  * Cice * z_wnds_t(ji,jj)   &                           
-                  &                    * (  11637800. * EXP( -5897.8 / pst(ji,jj,jl) ) / rhoa - sf(jp_humi)%fnow(ji,jj)  ) )
+                  &                    * (  11637800. * EXP( -5897.8 / pst(ji,jj,jl) ) / rhoa - sf(jp_humi)%fnow(ji,jj,1)  ) )
                ! Latent heat sensitivity for ice (Dqla/Dt)
                p_dqla(ji,jj,jl) = zcoef_dqla * z_wnds_t(ji,jj) / ( zst2 ) * EXP( -5897.8 / pst(ji,jj,jl) )
@@ -561,7 +561,7 @@
        
 !CDIR COLLAPSE
-      p_tpr(:,:) = sf(jp_prec)%fnow(:,:) * rn_pfac      ! total precipitation [kg/m2/s]
-!CDIR COLLAPSE
-      p_spr(:,:) = sf(jp_snow)%fnow(:,:) * rn_pfac      ! solid precipitation [kg/m2/s]
+      p_tpr(:,:) = sf(jp_prec)%fnow(:,:,1) * rn_pfac      ! total precipitation [kg/m2/s]
+!CDIR COLLAPSE
+      p_spr(:,:) = sf(jp_snow)%fnow(:,:,1) * rn_pfac      ! solid precipitation [kg/m2/s]
       CALL iom_put( 'snowpre', p_spr )                  ! Snow precipitation 
       !
Index: branches/devmercator2010/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 2071)
@@ -23,5 +23,4 @@
    USE sbc_oce         ! Surface boundary condition: ocean fields
    USE sbc_ice         ! Surface boundary condition: ice fields
-   USE phycst          ! physical constants
 #if defined key_lim3
    USE par_ice         ! ice parameters
@@ -40,4 +39,5 @@
    USE restart         !
    USE oce   , ONLY : tn, un, vn
+   USE phycst, ONLY : rt0, rcp
    USE albedo          !
    USE in_out_manager  ! I/O manager
@@ -45,4 +45,5 @@
    USE lib_mpp         ! distribued memory computing library
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+   USE phycst, ONLY : xlsn, rhosn, xlic, rhoic
 #if defined key_cpl_carbon_cycle
    USE p4zflx, ONLY : oce_co2
@@ -273,6 +274,5 @@
       srcv(jpr_itz2)%clname = 'O_ITauz2'      ! 3rd   -      -         -     - 
       ! 
-      ! Vectors: change of sign at north fold ONLY if on the local grid
-      IF( TRIM( cn_rcv_tau(3) ) == 'local grid' )   srcv(jpr_otx1:jpr_itz2)%nsgn = -1.
+      srcv(jpr_otx1:jpr_itz2)%nsgn = -1                           ! Vectors: change of sign at north fold
       
       !                                                           ! Set grid and action
@@ -714,6 +714,7 @@
          IF( srcv(jpr_qnsoce)%laction )   qns(:,:) = frcv(:,:,jpr_qnsoce)
          IF( srcv(jpr_qnsmix)%laction )   qns(:,:) = frcv(:,:,jpr_qnsmix)        
-         qns(:,:) = qns(:,:) - frcv(:,:,jpr_snow) * lfus              ! add the latent heat of solid precip. melting 
-
+         !   energy for melting solid precipitation over free ocean
+         zcoef = xlsn / rhosn
+         qns(:,:) = qns(:,:) - frcv(:,:,jpr_snow) * zcoef
          !                                                       ! solar flux over the ocean          (qsr)
          IF( srcv(jpr_qsroce)%laction )   qsr(:,:) = frcv(:,:,jpr_qsroce) 
@@ -1116,6 +1117,9 @@
             &                                                   +          pist(:,:,1)   * zicefr(:,:,1) ) )
       END SELECT
-      ztmp(:,:) = p_frld(:,:,1) * zsnow(:,:) * lfus               ! add the latent heat of solid precip. melting
-      pqns_tot(:,:) = pqns_tot(:,:) - ztmp(:,:)                   ! over free ocean 
+      !                                                           ! snow melting heat flux ....
+      !   energy for melting solid precipitation over ice-free ocean
+      zcoef = xlsn / rhosn
+      ztmp(:,:) = p_frld(:,:,1) * zsnow(:,:) * zcoef
+      pqns_tot(:,:) = pqns_tot(:,:) - ztmp(:,:)
       IF( lk_diaar5 )   CALL iom_put( 'hflx_snow_cea', ztmp + zsnow(:,:) * zcptn(:,:) )   ! heat flux from snow (cell average)
 !!gm
@@ -1126,7 +1130,9 @@
 !!
 !! similar job should be done for snow and precipitation temperature
-      !                                     
-      IF( srcv(jpr_cal)%laction ) THEN                            ! Iceberg melting 
-         ztmp(:,:) = frcv(:,:,jpr_cal) * lfus                     ! add the latent heat of iceberg melting 
+      !                                                           ! Iceberg melting heat flux ....
+      !   energy for iceberg melting 
+      IF( srcv(jpr_cal)%laction ) THEN 
+         zcoef = xlic / rhoic
+         ztmp(:,:) = frcv(:,:,jpr_cal) * zcoef
          pqns_tot(:,:) = pqns_tot(:,:) - ztmp(:,:)
          IF( lk_diaar5 )   CALL iom_put( 'hflx_cal_cea', ztmp + frcv(:,:,jpr_cal) * zcptn(:,:) )   ! heat flux from calving
Index: branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcflx.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 2071)
@@ -126,6 +126,6 @@
          ENDIF
          DO ji= 1, jpfld
-            ALLOCATE( sf(ji)%fnow(jpi,jpj) )
-            ALLOCATE( sf(ji)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf(ji)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf(ji)%fdta(jpi,jpj,1,2) )
          END DO
 
@@ -145,9 +145,9 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               utau(ji,jj) = sf(jp_utau)%fnow(ji,jj)
-               vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj)
-               qns (ji,jj) = sf(jp_qtot)%fnow(ji,jj) - sf(jp_qsr)%fnow(ji,jj)
-               qsr (ji,jj) = sf(jp_qsr )%fnow(ji,jj)
-               emp (ji,jj) = sf(jp_emp )%fnow(ji,jj)
+               utau(ji,jj) = sf(jp_utau)%fnow(ji,jj,1)
+               vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj,1)
+               qns (ji,jj) = sf(jp_qtot)%fnow(ji,jj,1) - sf(jp_qsr)%fnow(ji,jj,1)
+               qsr (ji,jj) = sf(jp_qsr )%fnow(ji,jj,1)
+               emp (ji,jj) = sf(jp_emp )%fnow(ji,jj,1)
             END DO
          END DO
Index: branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcfwb.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 2071)
@@ -65,5 +65,5 @@
       INTEGER  ::   inum                  ! temporary logical unit
       INTEGER  ::   ikty, iyear           ! 
-      REAL(wp) ::   z_emp, z_emp_nsrf, zsum_emp, zsum_erp       ! temporary scalars
+      REAL(wp) ::   z_emp, z_emp_nsrf       ! temporary scalars
       REAL(wp) ::   zsurf_neg, zsurf_pos, zsurf_tospread
       REAL(wp), DIMENSION(jpi,jpj) ::   ztmsk_neg, ztmsk_pos, ztmsk_tospread
@@ -165,6 +165,4 @@
             !
             IF( lk_mpp )   CALL  mpp_sum( z_emp )
-            IF( lk_mpp )   CALL  mpp_sum( zsurf_neg )
-            IF( lk_mpp )   CALL  mpp_sum( zsurf_pos )
             
             IF( z_emp < 0.e0 ) THEN
@@ -179,12 +177,7 @@
 
             ! emp global mean over <0 or >0 erp area
-            zsum_emp = SUM( e1e2_i(:,:) * z_emp )
-            IF( lk_mpp )   CALL  mpp_sum( zsum_emp )
-            z_emp_nsrf =  zsum_emp / ( zsurf_tospread + rsmall )
+            z_emp_nsrf = SUM( e1e2_i(:,:) * z_emp ) / ( zsurf_tospread + rsmall )
             ! weight to respect erp field 2D structure 
-            zsum_erp = SUM( ztmsk_tospread(:,:) * erp(:,:) * e1e2_i(:,:) )
-            IF( lk_mpp )   CALL  mpp_sum( zsum_erp )
-            z_wgt(:,:) = ztmsk_tospread(:,:) * erp(:,:) / ( zsum_erp + rsmall )
-
+            z_wgt(:,:) = ztmsk_tospread(:,:) * erp(:,:) / ( SUM( ztmsk_tospread(:,:) * erp(:,:) * e1e2_i(:,:) ) + rsmall )
             ! final correction term to apply
             zerp_cor(:,:) = -1. * z_emp_nsrf * zsurf_tospread * z_wgt(:,:)
Index: branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcice_if.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcice_if.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcice_if.F90	(revision 2071)
@@ -81,6 +81,6 @@
             CALL ctl_stop( 'sbc_ice_if: unable to allocate sf_ice structure' )   ;   RETURN
          ENDIF
-         ALLOCATE( sf_ice(1)%fnow(jpi,jpj) )
-         ALLOCATE( sf_ice(1)%fdta(jpi,jpj,2) )
+         ALLOCATE( sf_ice(1)%fnow(jpi,jpj,1) )
+         ALLOCATE( sf_ice(1)%fdta(jpi,jpj,1,2) )
 
 
@@ -107,5 +107,5 @@
                !
                zt_fzp  = fr_i(ji,jj)                        ! freezing point temperature
-               zfr_obs = sf_ice(1)%fnow(ji,jj)              ! observed ice cover
+               zfr_obs = sf_ice(1)%fnow(ji,jj,1)              ! observed ice cover
                !                                            ! ocean ice fraction (0/1) from the freezing point temperature
                IF( sst_m(ji,jj) <= zt_fzp ) THEN   ;   fr_i(ji,jj) = 1.e0
Index: branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 2071)
@@ -85,10 +85,12 @@
 !!gm here no overwrite, test all option via namelist change: require more incore memory
 !!gm  IF( lk_sbc_cpl       ) THEN   ;   ln_cpl      = .TRUE.   ;   ELSE   ;   ln_cpl      = .FALSE.   ;   ENDIF
-
+#if defined key_agrif
       IF ( Agrif_Root() ) THEN
+#endif
         IF( lk_lim2 )            nn_ice      = 2
         IF( lk_lim3 )            nn_ice      = 3
-      ENDIF
-      !
+#if defined key_agrif
+      ENDIF
+#endif
       IF( cp_cfg == 'gyre' ) THEN
           ln_ana      = .TRUE.   
Index: branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcrnf.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 2071)
@@ -75,6 +75,6 @@
                CALL ctl_stop( 'sbc_rnf: unable to allocate sf_rnf structure' )   ;   RETURN
             ENDIF
-            ALLOCATE( sf_rnf(1)%fnow(jpi,jpj) )
-            ALLOCATE( sf_rnf(1)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf_rnf(1)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf_rnf(1)%fdta(jpi,jpj,1,2) )
          ENDIF
          CALL sbc_rnf_init(sf_rnf)
@@ -93,5 +93,5 @@
             DO jj = 1, jpj
                DO ji = 1, jpi
-                  IF( gphit(ji,jj) > 40 .AND. gphit(ji,jj) < 65 )   sf_rnf(1)%fnow(ji,jj) = 0.85 * sf_rnf(1)%fnow(ji,jj)
+                  IF( gphit(ji,jj) > 40 .AND. gphit(ji,jj) < 65 )   sf_rnf(1)%fnow(ji,jj,1) = 0.85 * sf_rnf(1)%fnow(ji,jj,1)
                END DO
             END DO
@@ -101,6 +101,6 @@
 
          IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN
-            emp (:,:) = emp (:,:) - rn_rfact * ABS( sf_rnf(1)%fnow(:,:) )
-            emps(:,:) = emps(:,:) - rn_rfact * ABS( sf_rnf(1)%fnow(:,:) )
+            emp (:,:) = emp (:,:) - rn_rfact * ABS( sf_rnf(1)%fnow(:,:,1) )
+            emps(:,:) = emps(:,:) - rn_rfact * ABS( sf_rnf(1)%fnow(:,:,1) )
             CALL iom_put( "runoffs", sf_rnf(1)%fnow )         ! runoffs
          ENDIF
Index: branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcssr.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 2071)
@@ -115,6 +115,6 @@
                CALL ctl_stop( 'sbc_ssr: unable to allocate sf_sst structure' )   ;   RETURN
             ENDIF
-            ALLOCATE( sf_sst(1)%fnow(jpi,jpj) )
-            ALLOCATE( sf_sst(1)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf_sst(1)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf_sst(1)%fdta(jpi,jpj,1,2) )
             !
             ! fill sf_sst with sn_sst and control print
@@ -128,6 +128,6 @@
                CALL ctl_stop( 'sbc_ssr: unable to allocate sf_sss structure' )   ;   RETURN
             ENDIF
-            ALLOCATE( sf_sss(1)%fnow(jpi,jpj) )
-            ALLOCATE( sf_sss(1)%fdta(jpi,jpj,2) )
+            ALLOCATE( sf_sss(1)%fnow(jpi,jpj,1) )
+            ALLOCATE( sf_sss(1)%fdta(jpi,jpj,1,2) )
             !
             ! fill sf_sss with sn_sss and control print
@@ -153,5 +153,5 @@
                DO jj = 1, jpj
                   DO ji = 1, jpi
-                     zqrp = rn_dqdt * ( sst_m(ji,jj) - sf_sst(1)%fnow(ji,jj) )
+                     zqrp = rn_dqdt * ( sst_m(ji,jj) - sf_sst(1)%fnow(ji,jj,1) )
                      qns(ji,jj) = qns(ji,jj) + zqrp
                      qrp(ji,jj) = zqrp
@@ -167,5 +167,5 @@
                   DO ji = 1, jpi
                      zerp = zsrp * ( 1. - 2.*rnfmsk(ji,jj) )   &      ! No damping in vicinity of river mouths
-                        &        * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj) )   &
+                        &        * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj,1) )   &
                         &        / ( sss_m(ji,jj) + 1.e-20   )
                      emps(ji,jj) = emps(ji,jj) + zerp
@@ -182,5 +182,5 @@
                   DO ji = 1, jpi                            
                      zerp = zsrp * ( 1. - 2.*rnfmsk(ji,jj) )   &      ! No damping in vicinity of river mouths
-                        &        * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj) )   &
+                        &        * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj,1) )   &
                         &        / ( sss_m(ji,jj) + 1.e-20   )
                      IF( ln_sssr_bnd )   zerp = SIGN( 1., zerp ) * MIN( zerp_bnd, ABS(zerp) )
Index: branches/devmercator2010/NEMO/OPA_SRC/SOL/solmat.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/SOL/solmat.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/SOL/solmat.F90	(revision 2071)
@@ -80,6 +80,5 @@
       ENDIF
 
-#if defined key_dynspg_flt 
-#   if ! defined key_obc
+#if defined key_dynspg_flt && ! defined key_obc
 
       DO jj = 2, jpjm1                      ! matrix of free surface elliptic system
@@ -98,6 +97,7 @@
          END DO
       END DO
-#   else
-    IF ( Agrif_Root() ) THEN
+      
+#  elif defined key_dynspg_flt && defined key_obc
+
       DO jj = 2, jpjm1                      ! matrix of free surface elliptic system with open boundaries
          DO ji = 2, jpim1
@@ -140,25 +140,8 @@
          END DO
       END DO
-    ELSE
-      DO jj = 2, jpjm1                      ! matrix of free surface elliptic system
-         DO ji = 2, jpim1
-            zcoef = z2dt * z2dt * grav * bmask(ji,jj)
-            zcoefs = -zcoef * hv(ji  ,jj-1) * e1v(ji  ,jj-1) / e2v(ji  ,jj-1)    ! south coefficient
-            zcoefw = -zcoef * hu(ji-1,jj  ) * e2u(ji-1,jj  ) / e1u(ji-1,jj  )    ! west coefficient
-            zcoefe = -zcoef * hu(ji  ,jj  ) * e2u(ji  ,jj  ) / e1u(ji  ,jj  )    ! east coefficient
-            zcoefn = -zcoef * hv(ji  ,jj  ) * e1v(ji  ,jj  ) / e2v(ji  ,jj  )    ! north coefficient
-            gcp(ji,jj,1) = zcoefs
-            gcp(ji,jj,2) = zcoefw
-            gcp(ji,jj,3) = zcoefe
-            gcp(ji,jj,4) = zcoefn
-            gcdmat(ji,jj) = e1t(ji,jj) * e2t(ji,jj) * bmask(ji,jj)    &          ! diagonal coefficient
-               &          - zcoefs -zcoefw -zcoefe -zcoefn
-         END DO
-      END DO
-    ENDIF
-#   endif
 #endif
 
-      IF( .NOT. Agrif_Root() ) THEN
+#if defined key_agrif
+      IF( .NOT.AGRIF_ROOT() ) THEN
          !
          IF( nbondi == -1 .OR. nbondi == 2 )   bmask(2     ,:     ) = 0.e0
@@ -209,4 +192,5 @@
          ! 
       ENDIF
+#endif
 
       ! 2. Boundary conditions 
Index: branches/devmercator2010/NEMO/OPA_SRC/TRA/traadv_tvd.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/TRA/traadv_tvd.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/TRA/traadv_tvd.F90	(revision 2071)
@@ -179,9 +179,4 @@
       END DO
 
-      ! "zonal" mean advective heat and salt transport
-      IF( ln_diaptr .AND. ( MOD( kt, nf_ptr ) == 0 ) ) THEN
-         pht_adv(:) = ptr_vj( ztv(:,:,:) )
-         pst_adv(:) = ptr_vj( zsv(:,:,:) )
-      ENDIF
 
       ! Save the intermediate i / j / k advective trends for diagnostics
@@ -371,6 +366,6 @@
       ! "zonal" mean advective heat and salt transport
       IF( ln_diaptr .AND. ( MOD( kt, nf_ptr ) == 0 ) ) THEN
-         pht_adv(:) = ptr_vj( ztv(:,:,:) ) + pht_adv(:)
-         pst_adv(:) = ptr_vj( zsv(:,:,:) ) + pst_adv(:)
+         pht_adv(:) = ptr_vj( ztv(:,:,:) )
+         pst_adv(:) = ptr_vj( zsv(:,:,:) )
       ENDIF
       !
Index: branches/devmercator2010/NEMO/OPA_SRC/TRA/tranxt.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 2071)
@@ -38,5 +38,4 @@
    USE agrif_opa_update
    USE agrif_opa_interp
-   USE obc_oce 
 
    IMPLICIT NONE
@@ -102,5 +101,5 @@
       !
 #if defined key_obc
-      IF( lk_obc )   CALL obc_tra( kt )  ! OBC open boundaries
+      CALL obc_tra( kt )               ! OBC open boundaries
 #endif
 #if defined key_bdy
Index: branches/devmercator2010/NEMO/OPA_SRC/TRA/traqsr.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 2071)
@@ -45,9 +45,7 @@
    
    ! Module variables
-!$AGRIF_DO_NOT_TREAT
    TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_chl   ! structure of input Chl (file informations, fields read)
    INTEGER ::   nksr   ! levels below which the light cannot penetrate ( depth larger than 391 m)
    REAL(wp), DIMENSION(3,61) ::   rkrgb   !: tabulated attenuation coefficients for RGB absorption
-!$AGRIF_END_DO_NOT_TREAT
 
    !! * Substitutions
@@ -144,5 +142,5 @@
 !CDIR NOVERRCHK
                   DO ji = 1, jpi
-                     zchl = MIN( 10. , MAX( 0.03, sf_chl(1)%fnow(ji,jj) ) )
+                     zchl = MIN( 10. , MAX( 0.03, sf_chl(1)%fnow(ji,jj,1) ) )
                      irgb = NINT( 41 + 20.*LOG10(zchl) + 1.e-15 )
                      zekb(ji,jj) = rkrgb(1,irgb)
@@ -336,6 +334,6 @@
                   CALL ctl_stop( 'tra_qsr_init: unable to allocate sf_chl structure' )   ;   RETURN
                ENDIF
-               ALLOCATE( sf_chl(1)%fnow(jpi,jpj)   )
-               ALLOCATE( sf_chl(1)%fdta(jpi,jpj,2) )
+               ALLOCATE( sf_chl(1)%fnow(jpi,jpj,1)   )
+               ALLOCATE( sf_chl(1)%fdta(jpi,jpj,1,2) )
                !                                        ! fill sf_chl with sn_chl and control print
                CALL fld_fill( sf_chl, (/ sn_chl /), cn_dir, 'tra_qsr_init',   &
Index: branches/devmercator2010/NEMO/OPA_SRC/TRA/trasbc.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 2071)
@@ -134,7 +134,5 @@
                zta = ro0cpr * qns(ji,jj) * zse3t &                   ! temperature : heat flux
                 &    - emp(ji,jj) * zsrau * tn(ji,jj,1)  * zse3t     ! & cooling/heating effet of EMP flux
-               zsa = ( emps(ji,jj) - emp(ji,jj) ) &
-                &                 * zsrau * sn(ji,jj,1)  * zse3t     ! concent./dilut. effect due to sea-ice 
-                                                                     ! melt/formation and (possibly) SSS restoration
+               zsa = 0.e0                                            ! No salinity concent./dilut. effect
             ELSE
                zta = ro0cpr * qns(ji,jj) * zse3t     ! temperature : heat flux
Index: branches/devmercator2010/NEMO/OPA_SRC/lib_mpp.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/lib_mpp.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/lib_mpp.F90	(revision 2071)
@@ -103,5 +103,5 @@
    !! ========================= !!
 !$AGRIF_DO_NOT_TREAT
-   INCLUDE 'mpif.h'
+#  include <mpif.h>
 !$AGRIF_END_DO_NOT_TREAT
    
@@ -112,7 +112,5 @@
    INTEGER ::   mppsize        ! number of process
    INTEGER ::   mpprank        ! process number  [ 0 - size-1 ]
-!$AGRIF_DO_NOT_TREAT
-   INTEGER, PUBLIC ::   mpi_comm_opa   ! opa local communicator
-!$AGRIF_END_DO_NOT_TREAT
+   INTEGER ::   mpi_comm_opa   ! opa local communicator
 
    ! variables used in case of sea-ice
@@ -193,13 +191,67 @@
       WRITE(ldtxt(6),*) '      size in bytes of exported buffer   nn_buffer   = ', nn_buffer
 
-      CALL mpi_initialized ( mpi_was_called, code )
-      IF( code /= MPI_SUCCESS ) THEN
-         WRITE(*, cform_err)
-         WRITE(*, *) 'lib_mpp: Error in routine mpi_initialized'
-         CALL mpi_abort( mpi_comm_world, code, ierr )
-      ENDIF
-
-      IF( mpi_was_called ) THEN
-         !
+#if defined key_agrif
+      IF( Agrif_Root() ) THEN
+#endif
+         !!bug RB : should be clean to use Agrif in coupled mode
+#if ! defined key_agrif
+         CALL mpi_initialized ( mpi_was_called, code )
+         IF( code /= MPI_SUCCESS ) THEN
+            WRITE(*, cform_err)
+            WRITE(*, *) 'lib_mpp: Error in routine mpi_initialized'
+            CALL mpi_abort( mpi_comm_world, code, ierr )
+         ENDIF
+
+         IF( PRESENT(localComm) .and. mpi_was_called ) THEN
+            mpi_comm_opa = localComm
+            SELECT CASE ( cn_mpi_send )
+            CASE ( 'S' )                ! Standard mpi send (blocking)
+               WRITE(ldtxt(7),*) '           Standard blocking mpi send (send)'
+            CASE ( 'B' )                ! Buffer mpi send (blocking)
+               WRITE(ldtxt(7),*) '           Buffer blocking mpi send (bsend)'
+               CALL mpi_init_opa( ierr ) 
+            CASE ( 'I' )                ! Immediate mpi send (non-blocking send)
+               WRITE(ldtxt(7),*) '           Immediate non-blocking send (isend)'
+               l_isend = .TRUE.
+            CASE DEFAULT
+               WRITE(ldtxt(7),cform_err)
+               WRITE(ldtxt(8),*) '           bad value for cn_mpi_send = ', cn_mpi_send
+               nstop = nstop + 1
+            END SELECT
+         ELSE IF ( PRESENT(localComm) .and. .not. mpi_was_called ) THEN
+            WRITE(ldtxt(7),*) ' lib_mpp: You cannot provide a local communicator '
+            WRITE(ldtxt(8),*) '          without calling MPI_Init before ! '
+            nstop = nstop + 1
+         ELSE
+#endif
+            SELECT CASE ( cn_mpi_send )
+            CASE ( 'S' )                ! Standard mpi send (blocking)
+               WRITE(ldtxt(7),*) '           Standard blocking mpi send (send)'
+               CALL mpi_init( ierr )
+            CASE ( 'B' )                ! Buffer mpi send (blocking)
+               WRITE(ldtxt(7),*) '           Buffer blocking mpi send (bsend)'
+               CALL mpi_init_opa( ierr )
+            CASE ( 'I' )                ! Immediate mpi send (non-blocking send)
+               WRITE(ldtxt(7),*) '           Immediate non-blocking send (isend)'
+               l_isend = .TRUE.
+               CALL mpi_init( ierr )
+            CASE DEFAULT
+               WRITE(ldtxt(7),cform_err)
+               WRITE(ldtxt(8),*) '           bad value for cn_mpi_send = ', cn_mpi_send
+               nstop = nstop + 1
+            END SELECT
+
+#if ! defined key_agrif
+            CALL mpi_comm_dup( mpi_comm_world, mpi_comm_opa, code)
+            IF( code /= MPI_SUCCESS ) THEN
+               WRITE(*, cform_err)
+               WRITE(*, *) ' lib_mpp: Error in routine mpi_comm_dup'
+               CALL mpi_abort( mpi_comm_world, code, ierr )
+            ENDIF
+            !
+         ENDIF
+#endif
+#if defined key_agrif
+      ELSE
          SELECT CASE ( cn_mpi_send )
          CASE ( 'S' )                ! Standard mpi send (blocking)
@@ -207,5 +259,4 @@
          CASE ( 'B' )                ! Buffer mpi send (blocking)
             WRITE(ldtxt(7),*) '           Buffer blocking mpi send (bsend)'
-            CALL mpi_init_opa( ierr ) 
          CASE ( 'I' )                ! Immediate mpi send (non-blocking send)
             WRITE(ldtxt(7),*) '           Immediate non-blocking send (isend)'
@@ -216,41 +267,8 @@
             nstop = nstop + 1
          END SELECT
-      ELSE IF ( PRESENT(localComm) .and. .not. mpi_was_called ) THEN
-         WRITE(ldtxt(7),*) ' lib_mpp: You cannot provide a local communicator '
-         WRITE(ldtxt(8),*) '          without calling MPI_Init before ! '
-         nstop = nstop + 1
-      ELSE
-         SELECT CASE ( cn_mpi_send )
-         CASE ( 'S' )                ! Standard mpi send (blocking)
-            WRITE(ldtxt(7),*) '           Standard blocking mpi send (send)'
-            CALL mpi_init( ierr )
-         CASE ( 'B' )                ! Buffer mpi send (blocking)
-            WRITE(ldtxt(7),*) '           Buffer blocking mpi send (bsend)'
-            CALL mpi_init_opa( ierr )
-         CASE ( 'I' )                ! Immediate mpi send (non-blocking send)
-            WRITE(ldtxt(7),*) '           Immediate non-blocking send (isend)'
-            l_isend = .TRUE.
-            CALL mpi_init( ierr )
-         CASE DEFAULT
-            WRITE(ldtxt(7),cform_err)
-            WRITE(ldtxt(8),*) '           bad value for cn_mpi_send = ', cn_mpi_send
-            nstop = nstop + 1
-         END SELECT
-         !
       ENDIF
 
-      IF( PRESENT(localComm) ) THEN 
-         IF( Agrif_Root() ) THEN
-            mpi_comm_opa = localComm
-         ENDIF
-      ELSE
-         CALL mpi_comm_dup( mpi_comm_world, mpi_comm_opa, code)
-         IF( code /= MPI_SUCCESS ) THEN
-            WRITE(*, cform_err)
-            WRITE(*, *) ' lib_mpp: Error in routine mpi_comm_dup'
-            CALL mpi_abort( mpi_comm_world, code, ierr )
-         ENDIF
-      ENDIF 
-
+      mpi_comm_opa = mpi_comm_world
+#endif
       CALL mpi_comm_rank( mpi_comm_opa, mpprank, ierr )
       CALL mpi_comm_size( mpi_comm_opa, mppsize, ierr )
@@ -2049,5 +2067,4 @@
       ijpj   = 4
       ijpjm1 = 3
-      ztab(:,:,:) = 0.e0
       !
       DO jj = nlcj - ijpj +1, nlcj          ! put in znorthloc the last 4 jlines of pt3d
@@ -2115,5 +2132,4 @@
       ijpj   = 4
       ijpjm1 = 3
-      ztab(:,:) = 0.e0
       !
       DO jj = nlcj-ijpj+1, nlcj             ! put in znorthloc the last 4 jlines of pt2d
@@ -2181,5 +2197,4 @@
       !
       ijpj=4
-      ztab(:,:) = 0.e0
 
       ij=0
Index: branches/devmercator2010/NEMO/OPA_SRC/opa.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/opa.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/opa.F90	(revision 2071)
@@ -156,7 +156,5 @@
       CALL opa_closefile
 #if defined key_oasis3 || defined key_oasis4
-      IF( Agrif_Root() ) THEN
-         CALL cpl_prism_finalize           ! end coupling and mpp communications with OASIS
-     ENDIF 
+      CALL cpl_prism_finalize           ! end coupling and mpp communications with OASIS
 #else
       IF( lk_mpp )   CALL mppstop       ! end mpp communications
@@ -193,12 +191,8 @@
 #if defined key_iomput
 # if defined key_oasis3 || defined key_oasis4
-      IF( Agrif_Root() ) THEN
-         CALL cpl_prism_init( ilocal_comm )      ! nemo local communicator given by oasis
-         CALL init_ioclient()                    ! io_server will get its communicators (if needed) from oasis (we don't see it)
-      ENDIF
+      CALL cpl_prism_init( ilocal_comm )      ! nemo local communicator given by oasis
+      CALL init_ioclient()                    ! io_server will get its communicators (if needed) from oasis (we don't see it)
 # else
-      IF( Agrif_Root() ) THEN
-         CALL init_ioclient( ilocal_comm )       ! nemo local communicator (used or not) given by the io_server
-      ENDIF
+      CALL init_ioclient( ilocal_comm )       ! nemo local communicator (used or not) given by the io_server
 # endif
       narea = mynode( cltxt, ilocal_comm )    ! Nodes selection
@@ -206,7 +200,5 @@
 #else
 # if defined key_oasis3 || defined key_oasis4
-      IF( Agrif_Root() ) THEN
-         CALL cpl_prism_init( ilocal_comm )      ! nemo local communicator given by oasis
-      ENDIF
+      CALL cpl_prism_init( ilocal_comm )      ! nemo local communicator given by oasis
       narea = mynode( cltxt, ilocal_comm )    ! Nodes selection (control print return in cltxt)
 # else
Index: branches/devmercator2010/NEMO/OPA_SRC/par_POMME_R025.h90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/par_POMME_R025.h90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/par_POMME_R025.h90	(revision 2071)
@@ -22,7 +22,9 @@
       jp_cfg = 025  ,        &  !: resolution of the configuration (degrees)
       ! Original data size
+
       ! ORCA025 global grid size
       jpiglo_ORCA025 = 1442, &
       jpjglo_ORCA025 = 1021, &  ! not used currently
+
       ! POMME "global" domain localisation in the ORCA025 global grid
       jpi_iw    = 1059,      & 
@@ -30,7 +32,9 @@
       jpj_js    = 661,       &
       jpj_jn    = 700,       &
+
       jpidta  = ( jpi_ie - jpi_iw + 1 ), &   !: =30 first horizontal dimension > or = to jpi
       jpjdta  = ( jpj_jn - jpj_js + 1 ), &   !: =40 second                     > or = to jpj
       jpkdta  = 46 ,         &  !: number of levels           > or = to jpk
+
       ! total domain matrix size
       jpiglo  = jpidta,      &  !: first  dimension of global domain --> i
Index: branches/devmercator2010/NEMO/OPA_SRC/step.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/step.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/step.F90	(revision 2071)
@@ -166,9 +166,6 @@
 #if defined key_agrif
       kstp = nit000 + Agrif_Nb_Step()
-!      IF( Agrif_Root() .and. lwp) Write(*,*) '---'
-!      IF(lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp
-# if defined key_iomput
-      IF( Agrif_Nbstepint() == 0) CALL iom_swap
-# endif   
+!      IF ( Agrif_Root() .and. lwp) Write(*,*) '---'
+!      IF (lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp
 #endif   
       indic = 1                                       ! reset to no error condition
Index: branches/devmercator2010/NEMO/OPA_SRC/trc_oce.F90
===================================================================
--- branches/devmercator2010/NEMO/OPA_SRC/trc_oce.F90	(revision 2069)
+++ branches/devmercator2010/NEMO/OPA_SRC/trc_oce.F90	(revision 2071)
@@ -126,11 +126,11 @@
       zrgb(1,51) =  3.162   ;   zrgb(2,51) = 0.22703   ;   zrgb(3,51) = 0.16599   ;   zrgb(4,51) = 0.46601
       zrgb(1,52) =  3.548   ;   zrgb(2,52) = 0.24433   ;   zrgb(3,52) = 0.17334   ;   zrgb(4,52) = 0.47313
-      zrgb(1,53) =  3.981   ;   zrgb(2,53) = 0.26301   ;   zrgb(3,53) = 0.18126   ;   zrgb(4,53) = 0.48080
-      zrgb(1,54) =  4.467   ;   zrgb(2,54) = 0.28320   ;   zrgb(3,54) = 0.18981   ;   zrgb(4,54) = 0.48909
-      zrgb(1,55) =  5.012   ;   zrgb(2,55) = 0.30502   ;   zrgb(3,55) = 0.19903   ;   zrgb(4,55) = 0.49803
-      zrgb(1,56) =  5.623   ;   zrgb(2,56) = 0.32858   ;   zrgb(3,56) = 0.20898   ;   zrgb(4,56) = 0.50768
-      zrgb(1,57) =  6.310   ;   zrgb(2,57) = 0.35404   ;   zrgb(3,57) = 0.21971   ;   zrgb(4,57) = 0.51810
-      zrgb(1,58) =  7.079   ;   zrgb(2,58) = 0.38154   ;   zrgb(3,58) = 0.23129   ;   zrgb(4,58) = 0.52934
-      zrgb(1,59) =  7.943   ;   zrgb(2,59) = 0.41125   ;   zrgb(3,59) = 0.24378   ;   zrgb(4,59) = 0.54147
+      zrgb(1,53) =  3.981   ;   zrgb(2,53) = 0.26301   ;   zrgb(3,53) = 0.18126   ;   zrgb(4,54) = 0.48080
+      zrgb(1,54) =  4.467   ;   zrgb(2,54) = 0.28320   ;   zrgb(3,54) = 0.18981   ;   zrgb(4,55) = 0.48909
+      zrgb(1,55) =  5.012   ;   zrgb(2,55) = 0.30502   ;   zrgb(3,55) = 0.19903   ;   zrgb(4,56) = 0.49803
+      zrgb(1,56) =  5.623   ;   zrgb(2,56) = 0.32858   ;   zrgb(3,56) = 0.20898   ;   zrgb(4,57) = 0.50768
+      zrgb(1,57) =  6.310   ;   zrgb(2,57) = 0.35404   ;   zrgb(3,57) = 0.21971   ;   zrgb(4,58) = 0.51810
+      zrgb(1,58) =  7.079   ;   zrgb(2,58) = 0.38154   ;   zrgb(3,58) = 0.23129   ;   zrgb(4,59) = 0.52934
+      zrgb(1,59) =  7.943   ;   zrgb(2,59) = 0.41125   ;   zrgb(3,59) = 0.24378   ;   zrgb(4,50) = 0.54147
       zrgb(1,60) =  8.912   ;   zrgb(2,60) = 0.44336   ;   zrgb(3,60) = 0.25725   ;   zrgb(4,60) = 0.55457
       zrgb(1,61) = 10.000   ;   zrgb(2,61) = 0.47804   ;   zrgb(3,61) = 0.27178   ;   zrgb(4,61) = 0.56870
