Index: trunk/NEMO/C1D_SRC/diawri1d.F90
===================================================================
--- trunk/NEMO/C1D_SRC/diawri1d.F90	(revision 873)
+++ trunk/NEMO/C1D_SRC/diawri1d.F90	(revision 888)
@@ -13,4 +13,6 @@
    USE dom_oce         ! ocean space and time domain
    USE zdf_oce         ! ocean vertical physics
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE sbc_ice         ! surface boundary condition: ice
    USE zdftke          ! TKE vertical mixing
    USE zdfkpp          ! KPP vertical mixing
@@ -19,7 +21,4 @@
    USE phycst          ! physical constants
    USE ocfzpt          ! ???
-   USE ocesbc          ! surface thermohaline fluxes
-   USE taumod          ! surface stress
-   USE flxrnf          ! ???
    USE zdfmxl          ! mixed layer
    USE daymod          ! calendar
@@ -49,5 +48,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL  (2005)
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
    !!----------------------------------------------------------------------
@@ -194,13 +193,13 @@
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
 
-#if ! defined key_dynspg_rl && defined key_lim3
-         ! sowaflup = sowaflep + sorunoff + sowafldp + a term associated to
-         !    internal damping to Levitus that can be diagnosed from others
-         ! sowaflcd = sowaflep + sorunoff + sowafldp + iowaflup
-         CALL histdef( nid_T, "iowaflup", "Ice=>ocean net freshwater"          , "kg/m2/s",   &  ! fsalt
-            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-         CALL histdef( nid_T, "sowaflep", "atmos=>ocean net freshwater"        , "kg/m2/s",   &  ! fmass
-            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-#endif
+!!$#if ! defined key_dynspg_rl && ( defined key_lim2 || defined key_lim2 )
+!!$         ! sowaflup = sowaflep + sorunoff + sowafldp + a term associated to
+!!$         !    internal damping to Levitus that can be diagnosed from others
+!!$         ! sowaflcd = sowaflep + sorunoff + sowafldp + iowaflup
+!!$         CALL histdef( nid_T, "iowaflup", "Ice=>ocean net freshwater"          , "kg/m2/s",   &  ! fsalt
+!!$            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
+!!$         CALL histdef( nid_T, "sowaflep", "atmos=>ocean net freshwater"        , "kg/m2/s",   &  ! fmass
+!!$            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
+!!$#endif
          CALL histdef( nid_T, "sowaflup", "Net Upward Water Flux"              , "Kg/m2/s",   &  ! emp
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
@@ -211,5 +210,5 @@
          CALL histdef( nid_T, "sosalflx", "Surface Salt Flux"                  , "Kg/m2/s",   &  ! emps * sn
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-         CALL histdef( nid_T, "sohefldo", "Net Downward Heat Flux"             , "W/m2"   ,   &  ! qt
+         CALL histdef( nid_T, "sohefldo", "Net Downward Heat Flux"             , "W/m2"   ,   &  ! qsr + qns
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
          CALL histdef( nid_T, "soshfldo", "Shortwave Radiation"                , "W/m2"   ,   &  ! qsr
@@ -238,5 +237,5 @@
 #endif
 
-#if ( defined key_coupled && ! defined key_lim3 ) 
+#if ( defined key_coupled && ! ( defined key_lim3 || defined key_lim2 ) ) 
          CALL histdef( nid_T, "sohefldp", "Surface Heat Flux: Damping"         , "W/m2"   ,   &  ! qrp
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
@@ -260,5 +259,5 @@
 #endif
 
-#if defined key_lim3 && defined key_coupled
+#if ( defined key_lim3 || defined key_lim2 ) && defined key_coupled
          CALL histdef( nid_T,"soicetem" , "Ice Surface Temperature"            , "K"      ,   &  ! tn_ice
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
@@ -275,5 +274,5 @@
 #endif
          !                                                                                      !!! nid_U : 2D
-         CALL histdef( nid_T, "sozotaux", "Wind Stress along i-axis"           , "N/m2"   ,   &  ! taux
+         CALL histdef( nid_T, "sozotaux", "Wind Stress along i-axis"           , "N/m2"   ,   &  ! utau
             &          jpi, jpj, nh_T, 1  , 1, 1  , - 99, 32, clop, zsto, zout )
 
@@ -286,5 +285,5 @@
 #endif
          !                                                                                      !!! nid_V : 2D
-         CALL histdef( nid_T, "sometauy", "Wind Stress along j-axis"           , "N/m2"   ,   &  ! tauy
+         CALL histdef( nid_T, "sometauy", "Wind Stress along j-axis"           , "N/m2"   ,   &  ! vtau
             &          jpi, jpj, nh_T, 1  , 1, 1  , - 99, 32, clop, zsto, zout )
 #if defined key_zdftke
@@ -365,5 +364,5 @@
       CALL histwrite( nid_T, "sosstsst", it, tn(:,:,1)     , ndim_hT, ndex_hT )   ! sea surface temperature
       CALL histwrite( nid_T, "sosaline", it, sn(:,:,1)     , ndim_hT, ndex_hT )   ! sea surface salinity
-#if ! defined key_dynspg_rl && defined key_lim3
+#if ! defined key_dynspg_rl && ( defined key_lim3 || defined key_lim2 )
       CALL histwrite( nid_T, "iowaflup", it, fsalt(:,:)    , ndim_hT, ndex_hT )   ! ice=>ocean water flux
       CALL histwrite( nid_T, "sowaflep", it, fmass(:,:)    , ndim_hT, ndex_hT )   ! atmos=>ocean water flux
@@ -374,5 +373,5 @@
       zw2d(:,:) = emps(:,:) * sn(:,:,1) * tmask(:,:,1)
       CALL histwrite( nid_T, "sosalflx", it, zw2d          , ndim_hT, ndex_hT )   ! c/d salt flux
-      CALL histwrite( nid_T, "sohefldo", it, qt            , ndim_hT, ndex_hT )   ! total heat flux
+      CALL histwrite( nid_T, "sohefldo", it, qsr + qns     , ndim_hT, ndex_hT )   ! total heat flux
       CALL histwrite( nid_T, "soshfldo", it, qsr           , ndim_hT, ndex_hT )   ! solar heat flux
       CALL histwrite( nid_T, "somxl010", it, hmlp          , ndim_hT, ndex_hT )   ! mixed layer depth
@@ -397,5 +396,5 @@
       CALL histwrite( nid_T, "sosafldp", it, zw2d          , ndim_hT, ndex_hT )   ! salt flux damping
 #endif
-#if ( defined key_coupled && ! defined key_lim3 ) 
+#if ( defined key_coupled && ! ( defined key_lim3 || defined key_lim2 ) ) 
       CALL histwrite( nid_T, "sohefldp", it, qrp           , ndim_hT, ndex_hT )   ! heat flux damping
       CALL histwrite( nid_T, "sowafldp", it, erp           , ndim_hT, ndex_hT )   ! freshwater flux damping
@@ -412,5 +411,5 @@
       CALL histwrite( nid_T, "sohtc300", it, htc3          , ndim_hT, ndex_hT )   ! first 300m heaat content
 #endif
-#if defined key_lim3 &&  defined key_coupled 
+#if ( defined key_lim3 || defined key_lim2 ) &&  defined key_coupled 
       CALL histwrite( nid_T, "soicetem", it, tn_ice        , ndim_hT, ndex_hT )   ! surf. ice temperature
       CALL histwrite( nid_T, "soicealb", it, alb_ice       , ndim_hT, ndex_hT )   ! ice albedo
@@ -418,7 +417,7 @@
 
       CALL histwrite( nid_T, "vozocrtx", it, un            , ndim_T , ndex_T )    ! i-current
-      CALL histwrite( nid_T, "sozotaux", it, taux          , ndim_hT, ndex_hT )   ! i-wind stress
+      CALL histwrite( nid_T, "sozotaux", it, utau          , ndim_hT, ndex_hT )   ! i-wind stress
       CALL histwrite( nid_T, "vomecrty", it, vn            , ndim_T , ndex_T  )   ! j-current
-      CALL histwrite( nid_T, "sometauy", it, tauy          , ndim_hT, ndex_hT )   ! j-wind stress
+      CALL histwrite( nid_T, "sometauy", it, vtau          , ndim_hT, ndex_hT )   ! j-wind stress
 #if defined key_zdftke
       CALL histwrite( nid_T, "votlsdis", it, e_dis         , ndim_T , ndex_T )    ! Diss. Turb. lenght scale
Index: trunk/NEMO/C1D_SRC/icestp1d.F90
===================================================================
--- trunk/NEMO/C1D_SRC/icestp1d.F90	(revision 873)
+++ trunk/NEMO/C1D_SRC/icestp1d.F90	(revision 888)
@@ -6,8 +6,8 @@
    !! History :   9.0  !  04-10  (C. Ethe)  from icestp, 1D configuration
    !!----------------------------------------------------------------------
-#if defined key_cfg_1d && defined key_lim3
+#if defined key_cfg_1d && ( defined key_lim3 || defined key_lim2 )
    !!----------------------------------------------------------------------
    !!   'key_cfg_1d'  .AND.                                1D Configuration
-   !!   'key_lim3'                                     Lim sea-ice model
+   !!   'key_lim2' OR 'key_lim3' :             LIM 2.0 or 3.0 sea-ice model
    !!----------------------------------------------------------------------
    !!----------------------------------------------------------------------
@@ -18,21 +18,15 @@
    USE in_out_manager  ! I/O manager
    USE ice_oce         ! ice variables
-   USE flx_oce         ! forcings variables
-   USE dom_ice         ! LIM sea-ice domain
-   USE cpl_oce         ! coupled ocean-atmosphere variables
-   USE blk_oce         ! bulk variables
+   USE dom_ice_2       ! LIM sea-ice domain
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE sbc_ice         ! surface boundary condition: ice
    USE daymod          ! calendar
    USE phycst          ! Define parameters for the routines
-   USE taumod          ! surface stress forcing
-   USE ice             ! ice variables
+   USE ice_2           ! ice variables
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE limthd
-   USE limflx
-   USE limwri
-   USE limrst
-
-   USE ocesbc          ! thermohaline fluxes
-   USE flxmod          ! thermohaline forcing
-   USE flxrnf          ! runoffs forcing
+   USE limthd_2
+   USE limwri_2
+   USE limrst_2
+
    USE tradmp          ! damping salinity trend
    USE dtatem          ! ocean temperature data
@@ -52,5 +46,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0 , UCL-LOCEAN-IPSL (2006) 
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -109,6 +103,6 @@
          u_io  (:,:) = u_io  (:,:) / FLOAT( nfice )
          v_io  (:,:) = v_io  (:,:) / FLOAT( nfice )
-         gtaux (:,:) = taux  (:,:)
-         gtauy (:,:) = tauy  (:,:)
+         gtaux (:,:) = utau  (:,:)
+         gtauy (:,:) = vtau  (:,:)
 
          zsss_io (:,:) = SQRT( sss_io(:,:) ) 
@@ -220,5 +214,5 @@
       IF( kt == nit000 ) THEN     
          qsr    (:,:) = 0.e0
-         qt     (:,:) = 0.e0
+         qns    (:,:) = 0.e0
          qrp    (:,:) = 0.e0
          emp    (:,:) = 0.e0
@@ -238,5 +232,5 @@
       ! -----------------
       
-      qt  (:,:) = fnsolar(:,:) + fsolar(:,:)     ! non solar heat flux + solar flux
+      qns (:,:) = fnsolar(:,:)                    ! non solar heat flux
       qsr (:,:) = fsolar(:,:)                     ! solar flux
       
@@ -261,12 +255,12 @@
          DO ji = 1, fs_jpim1   ! vertor opt.
             ztxy        = freezn(ji,jj)             ! ice/ocean indicator at T-points
-            taux(ji,jj) = (1.-ztxy) * taux(ji,jj) + ztxy * ftaux(ji,jj)    ! stress at the ocean surface
-            tauy(ji,jj) = (1.-ztxy) * tauy(ji,jj) + ztxy * ftauy(ji,jj)
-         END DO
-      END DO
-      
-      ! boundary condition on the stress (taux,tauy)
-      CALL lbc_lnk( taux, 'U', -1. )
-      CALL lbc_lnk( tauy, 'V', -1. )
+            utau(ji,jj) = (1.-ztxy) * utau(ji,jj) + ztxy * ftaux(ji,jj)    ! stress at the ocean surface
+            vtau(ji,jj) = (1.-ztxy) * vtau(ji,jj) + ztxy * ftauy(ji,jj)
+         END DO
+      END DO
+      
+      ! boundary condition on the stress (utau,vtau)
+      CALL lbc_lnk( utau, 'U', -1. )
+      CALL lbc_lnk( vtau, 'V', -1. )
       
       ! Re-initialization of fluxes
Index: trunk/NEMO/C1D_SRC/step1d.F90
===================================================================
--- trunk/NEMO/C1D_SRC/step1d.F90	(revision 873)
+++ trunk/NEMO/C1D_SRC/step1d.F90	(revision 888)
@@ -15,4 +15,5 @@
    USE dom_oce         ! ocean space and time domain variables 
    USE zdf_oce         ! ocean vertical physics variables
+   USE sbc_oce         ! surface boundary condition: ocean
    USE ldftra_oce
    USE ldfdyn_oce
@@ -24,10 +25,4 @@
    USE dtatem          ! ocean temperature data           (dta_tem routine)
    USE dtasal          ! ocean salinity    data           (dta_sal routine)
-   USE dtasst          ! ocean sea surface temerature     (dta_sst routine)
-   USE taumod          ! surface stress                   (tau     routine)
-   USE flxmod          ! thermohaline fluxes              (flx     routine)
-   USE ocesbc          ! thermohaline fluxes              (oce_sbc routine)
-   USE flxrnf          ! runoffs                          (flx_rnf routine)
-   USE flxfwb          ! freshwater budget correction     (flx_fwb routine)
    USE ocfzpt          ! surface ocean freezing point    (oc_fz_pt routine)
 
@@ -75,5 +70,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
@@ -157,12 +152,11 @@
          CALL prt_ctl(tab2d_1=emp    , clinfo1=' emp  -   : ', mask1=tmask, ovlap=1)
          CALL prt_ctl(tab2d_1=emps   , clinfo1=' emps -   : ', mask1=tmask, ovlap=1)
-         CALL prt_ctl(tab2d_1=qt     , clinfo1=' qt   -   : ', mask1=tmask, ovlap=1)
+         CALL prt_ctl(tab2d_1=qns    , clinfo1=' qns  -   : ', mask1=tmask, ovlap=1)
          CALL prt_ctl(tab2d_1=qsr    , clinfo1=' qsr  -   : ', mask1=tmask, ovlap=1)
-         CALL prt_ctl(tab2d_1=runoff , clinfo1=' runoff   : ', mask1=tmask, ovlap=1)
          CALL prt_ctl(tab3d_1=tmask  , clinfo1=' tmask    : ', mask1=tmask, ovlap=1, kdim=jpk)
          CALL prt_ctl(tab3d_1=tn     , clinfo1=' sst  -   : ', mask1=tmask, ovlap=1, kdim=1)
          CALL prt_ctl(tab3d_1=sn     , clinfo1=' sss  -   : ', mask1=tmask, ovlap=1, kdim=1)
-         CALL prt_ctl(tab2d_1=taux   , clinfo1=' tau  - x : ', mask1=umask, &
-            &         tab2d_2=tauy   , clinfo2='      - y : ', mask2=vmask, ovlap=1)
+         CALL prt_ctl(tab2d_1=utau   , clinfo1=' tau  - u : ', mask1=umask, &
+            &         tab2d_2=vtau   , clinfo2='      - v : ', mask2=vmask, ovlap=1)
       ENDIF
 
Index: trunk/NEMO/LIM_SRC_2/dom_ice_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/dom_ice_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/dom_ice_2.F90	(revision 888)
@@ -1,4 +1,3 @@
 MODULE dom_ice_2
-#if defined key_lim2
    !!======================================================================
    !!                   ***  MODULE  dom_ice  ***
@@ -7,8 +6,8 @@
    !! History :   2.0  !  03-08  (C. Ethe)  Free form and module
    !!----------------------------------------------------------------------
-
+#if defined key_lim2
    !!----------------------------------------------------------------------
    !!   LIM 2.0, UCL-LOCEAN-IPSL (2005)
-   !! $Header$
+   !! $ Id: $
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
Index: trunk/NEMO/LIM_SRC_2/ice_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/ice_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/ice_2.F90	(revision 888)
@@ -4,14 +4,13 @@
    !! Sea Ice physics:  diagnostics variables of ice defined in memory
    !!=====================================================================
+   !! History :  2.0  !  03-08  (C. Ethe)  F90: Free form and module
+   !!----------------------------------------------------------------------
 #if defined key_lim2
    !!----------------------------------------------------------------------
    !!   'key_lim2' :                                  LIM 2.0 sea-ice model
    !!----------------------------------------------------------------------
-   !! History :
-   !!   2.0  !  03-08  (C. Ethe)  F90: Free form and module
-   !!----------------------------------------------------------------------
-   !!  LIM 2.0, UCL-LOCEAN-IPSL (2005)
-   !! $Header$
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+   !!  LIM 2.0, UCL-LOCEAN-IPSL (2006)
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
    !! * Modules used
@@ -21,103 +20,85 @@
    PRIVATE
 
-   !! * Share Module variables
-   INTEGER , PUBLIC ::   & !!: ** ice-dynamic namelist (namicedyn) **
-      nbiter = 1      ,  &  !: number of sub-time steps for relaxation
-      nbitdr = 250          !: maximum number of iterations for relaxation
+   !!* ice-dynamic namelist (namicedyn) *
+   INTEGER , PUBLIC ::   nbiter = 1         !: number of sub-time steps for relaxation
+   INTEGER , PUBLIC ::   nbitdr = 250       !: maximum number of iterations for relaxation
+   REAL(wp), PUBLIC ::   epsd   = 1.0e-20   !: tolerance parameter for dynamic
+   REAL(wp), PUBLIC ::   alpha  = 0.5       !: coefficient for semi-implicit coriolis
+   REAL(wp), PUBLIC ::   dm     = 0.6e+03   !: diffusion constant for dynamics
+   REAL(wp), PUBLIC ::   om     = 0.5       !: relaxation constant
+   REAL(wp), PUBLIC ::   resl   = 5.0e-05   !: maximum value for the residual of relaxation
+   REAL(wp), PUBLIC ::   cw     = 5.0e-03   !: drag coefficient for oceanic stress
+   REAL(wp), PUBLIC ::   angvg  = 0.e0      !: turning angle for oceanic stress
+   REAL(wp), PUBLIC ::   pstar  = 1.0e+04   !: first bulk-rheology parameter
+   REAL(wp), PUBLIC ::   c_rhg  = 20.e0     !: second bulk-rhelogy parameter
+   REAL(wp), PUBLIC ::   etamn  = 0.e+07    !: minimun value for viscosity
+   REAL(wp), PUBLIC ::   creepl = 2.e-08    !: creep limit
+   REAL(wp), PUBLIC ::   ecc    = 2.e0      !: eccentricity of the elliptical yield curve
+   REAL(wp), PUBLIC ::   ahi0   = 350.e0    !: sea-ice hor. eddy diffusivity coeff. (m2/s)
 
-   REAL(wp), PUBLIC ::   & !!: ** ice-dynamic namelist (namicedyn) **
-      epsd   = 1.0e-20,  &  !: tolerance parameter for dynamic
-      alpha  = 0.5    ,  &  !: coefficient for semi-implicit coriolis
-      dm     = 0.6e+03,  &  !: diffusion constant for dynamics
-      om     = 0.5    ,  &  !: relaxation constant
-      resl   = 5.0e-05,  &  !: maximum value for the residual of relaxation
-      cw     = 5.0e-03,  &  !: drag coefficient for oceanic stress
-      angvg  = 0.e0   ,  &  !: turning angle for oceanic stress
-      pstar  = 1.0e+04,  &  !: first bulk-rheology parameter
-      c_rhg  = 20.e0  ,  &  !: second bulk-rhelogy parameter
-      etamn  = 0.e+07,   &  !: minimun value for viscosity
-      creepl = 2.e-08,   &  !: creep limit
-      ecc    = 2.e0   ,  &  !: eccentricity of the elliptical yield curve
-      ahi0   = 350.e0       !: sea-ice hor. eddy diffusivity coeff. (m2/s)
+   REAL(wp), PUBLIC ::   usecc2             !:  = 1.0 / ( ecc * ecc )
+   REAL(wp), PUBLIC ::   rhoco              !: = rau0 * cw
+   REAL(wp), PUBLIC ::   sangvg, cangvg     !: sin and cos of the turning angle for ocean stress
+   REAL(wp), PUBLIC ::   pstarh             !: pstar / 2.0
 
-   REAL(wp), PUBLIC ::   &  !:
-      usecc2          ,  &  !:  = 1.0 / ( ecc * ecc )
-      rhoco           ,  &  !: = rau0 * cw
-      sangvg, cangvg  ,  &  !: sin and cos of the turning angle for ocean stress
-      pstarh                !: pstar / 2.0
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ahiu , ahiv   !: hor. diffusivity coeff. at ocean U- and V-points (m2/s)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   pahu , pahv   !: ice hor. eddy diffusivity coef. at ocean U- and V-points
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hsnm , hicm   !: mean snow and ice thicknesses
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ust2s                 !: friction velocity
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::  &  !:
-      u_oce, v_oce,      &  !: surface ocean velocity used in ice dynamics
-      ahiu , ahiv ,      &  !: hor. diffusivity coeff. at ocean U- and V-points (m2/s)
-      pahu , pahv ,      &  !: ice hor. eddy diffusivity coef. at ocean U- and V-points
-      hsnm , hicm ,      &  !: mean snow and ice thicknesses
-      ust2s                 !: friction velocity
+   !!* diagnostic quantities
+!! REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   firic         !: IR flux over the ice (only used for outputs)
+!! REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fcsic         !: Sensible heat flux over the ice (only used for outputs)
+!! REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fleic         !: Latent heat flux over the ice (only used for outputs)
+!! REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qlatic        !: latent flux (only used for outputs)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rdvosif       !: Variation of volume at surface (only used for outputs)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rdvobif       !: Variation of ice volume at the bottom ice (only used for outputs)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fdvolif       !: Total variation of ice volume (only used for outputs)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rdvonif       !: Lateral Variation of ice volume (only used for outputs)
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::  &  !:
-        sst_ini,         &  !: sst read from a file for ice model initialization 
-        sss_ini             !: sss read from a file for ice model initialization 
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sist          !: Sea-Ice Surface Temperature (Kelvin ??? degree ??? I don't know)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   tfu           !: Freezing/Melting point temperature of sea water at SSS
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hicif         !: Ice thickness
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hsnif         !: Snow thickness
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   hicifp        !: Ice production/melting
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   frld          !: Leads fraction = 1-a/totalarea
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   phicif        !: ice thickness  at previous time 
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   pfrld         !: Leads fraction at previous time  
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qstoif        !: Energy stored in the brine pockets
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fbif          !: Heat flux at the ice base
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rdmsnif       !: Variation of snow mass
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rdmicif       !: Variation of ice mass
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qldif         !: heat balance of the lead (or of the open ocean)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qcmif         !: Energy needed to bring the ocean surface layer until its freezing 
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fdtcn         !: net downward heat flux from the ice to the ocean
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qdtcn         !: energy from the ice to the ocean point (at a factor 2)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   thcm          !: part of the solar energy used in the lead heat budget
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fstric        !: Solar flux transmitted trough the ice
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ffltbif       !: Array linked with the max heat contained in brine pockets (?)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fscmbq        !: Linked with the solar flux below the ice (?)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fsbbq         !: Also linked with the solar flux below the ice (?)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qfvbq         !: Array used to store energy in case of toral lateral ablation (?)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   dmgwi         !: Variation of the mass of snow ice
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-      firic  ,   &  !: IR flux over the ice (only used for outputs)
-      fcsic  ,   &  !: Sensible heat flux over the ice (only used for outputs)
-      fleic  ,   &  !: Latent heat flux over the ice (only used for outputs)
-      qlatic ,   &  !: latent flux
-      rdvosif,   &  !: Variation of volume at surface (only used for outputs)
-      rdvobif,   &  !: Variation of ice volume at the bottom ice (only used for outputs)
-      fdvolif,   &  !: Total variation of ice volume (only used for outputs)
-      rdvonif,   &  !: Lateral Variation of ice volume (only used for outputs)
-      sist   ,   &  !: Sea-Ice Surface Temperature (Kelvin ??? degree ??? I don't know)
-      tfu    ,   &  !: Melting point temperature of sea water
-      hsnif  ,   &  !: Snow thickness
-      hicif  ,   &  !: Ice thickness
-      hicifp ,   &  !: Ice production/melting
-      frld   ,   &  !: Leads fraction = 1-a/totalarea
-      phicif ,   &  !: ice thickness  at previous time 
-      pfrld  ,   &  !: Leads fraction at previous time  
-      qstoif ,   &  !: Energy stored in the brine pockets
-      fbif   ,   &  !: Heat flux at the ice base
-      rdmsnif,   &  !: Variation of snow mass
-      rdmicif,   &  !: Variation of ice mass
-      qldif  ,   &  !: heat balance of the lead (or of the open ocean)
-      qcmif  ,   &  !: Energy needed to bring the ocean surface layer until its freezing 
-      fdtcn  ,   &  !: net downward heat flux from the ice to the ocean
-      qdtcn  ,   &  !: energy from the ice to the ocean
-      !             !  point (at a factor 2)
-      thcm   ,   &  !: part of the solar energy used in the lead heat budget
-      fstric ,   &  !: Solar flux transmitted trough the ice
-      ffltbif,   &  !: Array linked with the max heat contained in brine pockets (?)
-      fscmbq ,   &  !: Linked with the solar flux below the ice (?)
-      fsbbq  ,   &  !: Also linked with the solar flux below the ice (?)
-      qfvbq  ,   &  !: Array used to store energy in case of toral lateral ablation (?)
-      dmgwi         !: Variation of the mass of snow ice
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   albege        !: Albedo of the snow or ice (only for outputs)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   albecn        !: Albedo of the ocean (only for outputs)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   tauc          !: Cloud optical depth
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-      albege ,   &  !: Albedo of the snow or ice (only for outputs)
-      albecn ,   &  !: Albedo of the ocean (only for outputs)
-      tauc   ,   &  !: Cloud optical depth
-      sdvt          !: u*^2/(Stress/density)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ui_ice, vi_ice   !: two components of the ice   velocity at I-point (m/s)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ui_oce, vi_oce   !: two components of the ocean velocity at I-point (m/s)
 
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpsmax)     ::   scal0   !: ???
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jplayersp1) ::   tbif  !: Temperature inside the ice/snow layer
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-      u_ice, v_ice,   &  !: two components of the ice velocity (m/s)
-      tio_u, tio_v       !: two components of the ice-ocean stress (N/m2)
+!! REAL(wp), DIMENSION(jpi,jpj,0:jpkmax+1) ::   reslum        !: Relative absorption of solar radiation in each ocean level
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpsmax) ::   &  !:
-      scal0              !: ???
-
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jplayersp1) ::   &  !:
-      tbif          !: Temperature inside the ice/snow layer
-
-   REAL(wp), DIMENSION(jpi,jpj,0:jpkmax+1) ::    &  !:
-      reslum        !: Relative absorption of solar radiation in each ocean level
-
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-         sxice, syice, sxxice, syyice, sxyice,      &  !: moments for advection
-         sxsn,  sysn,  sxxsn,  syysn,  sxysn,       &  !:
-         sxa,   sya,   sxxa,   syya,   sxya,        &  !:
-         sxc0,  syc0,  sxxc0,  syyc0,  sxyc0,       &  !:
-         sxc1,  syc1,  sxxc1,  syyc1,  sxyc1,       &  !:
-         sxc2,  syc2,  sxxc2,  syyc2,  sxyc2,       &  !:
-         sxst,  syst,  sxxst,  syyst,  sxyst           !:
+   !!* moment used in the advection scheme
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sxice, syice, sxxice, syyice, sxyice   !: for ice  volume
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sxsn,  sysn,  sxxsn,  syysn,  sxysn    !: for snow volume
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sxa,   sya,   sxxa,   syya,   sxya     !: for ice cover area
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sxc0,  syc0,  sxxc0,  syyc0,  sxyc0    !: for heat content of snow
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sxc1,  syc1,  sxxc1,  syyc1,  sxyc1    !: for heat content of 1st ice layer
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sxc2,  syc2,  sxxc2,  syyc2,  sxyc2    !: for heat content of 2nd ice layer
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sxst,  syst,  sxxst,  syyst,  sxyst    !: for heat content of brine pockets
 
 #else
Index: trunk/NEMO/LIM_SRC_2/iceini_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/iceini_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/iceini_2.F90	(revision 888)
@@ -17,7 +17,7 @@
    USE dom_oce
    USE dom_ice_2
-   USE in_out_manager
    USE ice_oce         ! ice variables
-   USE flx_oce
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE sbc_ice         ! surface boundary condition: ice
    USE phycst          ! Define parameters for the routines
    USE ocfzpt
@@ -27,4 +27,5 @@
    USE limrst_2   
    USE ini1d           ! initialization of the 1D configuration
+   USE in_out_manager
       
    IMPLICIT NONE
@@ -40,5 +41,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $ Id: $ 
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
@@ -62,11 +63,6 @@
                  
       ! Louvain la Neuve Ice model
-      IF( nacc == 1 ) THEN
-          dtsd2   = nfice * rdtmin * 0.5
-          rdt_ice = nfice * rdtmin
-      ELSE
-          dtsd2   = nfice * rdt * 0.5
-          rdt_ice = nfice * rdt
-      ENDIF
+      dtsd2   = nn_fsbc * rdttra(1) * 0.5
+      rdt_ice = nn_fsbc * rdttra(1)
 
       CALL lim_msh_2                  ! ice mesh initialization
Index: trunk/NEMO/LIM_SRC_2/icestp_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/icestp_2.F90	(revision 873)
+++ 	(revision )
@@ -1,286 +1,0 @@
-MODULE icestp_2
-   !!======================================================================
-   !!                       ***  MODULE icestp_2   ***
-   !!   Sea-Ice model : LIM Sea ice model time-stepping
-   !!======================================================================
-   !! History :   1.0  !  99-11  (M. Imbard)  Original code
-   !!        !  01-03  (D. Ludicone, E. Durand, G. Madec) free surf.
-   !!   2.0  !  02-09  (G. Madec, C. Ethe)  F90: Free form and module
-   !!----------------------------------------------------------------------
-#if defined key_lim2
-   !!----------------------------------------------------------------------
-   !!   'key_lim2' :                                  LIM 2.0 sea-ice model
-   !!----------------------------------------------------------------------
-   !!----------------------------------------------------------------------
-   !!   ice_stp_2       : sea-ice model time-stepping
-   !!----------------------------------------------------------------------
-   USE dom_oce
-   USE oce  ! dynamics and tracers variables
-   USE in_out_manager
-   USE ice_oce         ! ice variables
-   USE flx_oce         ! forcings variables
-   USE dom_ice_2
-   USE cpl_oce
-   USE daymod
-   USE phycst          ! Define parameters for the routines
-   USE taumod
-   USE ice_2
-   USE ocesbc
-   USE lbclnk
-   USE limdyn_2
-   USE limtrp_2
-   USE limthd_2
-   USE limflx_2
-   USE limdia_2
-   USE limwri_2
-   USE limrst_2
-   USE limdmp_2        ! Ice damping
-   USE prtctl          ! Print control
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   ice_stp_2  ! called by step.F90
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!-----------------------------------------------------
-   !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
-   !!-----------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE ice_stp_2 ( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE ice_stp_2  ***
-      !!                   
-      !! ** Purpose :   Louvain la Neuve Sea Ice Model time stepping 
-      !!
-      !! ** Action  : - call the ice dynamics routine 
-      !!              - call the ice advection/diffusion routine 
-      !!              - call the ice thermodynamics routine 
-      !!              - call the routine that computes mass and 
-      !!                heat fluxes at the ice/ocean interface
-      !!              - save the outputs 
-      !!              - save the outputs for restart when necessary
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in)          ::   kt       ! ocean time-step index
-
-      INTEGER                      ::   ji, jj   ! dummy loop indices
-      REAL(wp), DIMENSION(jpi,jpj) ::   zsss_io, zsss2_io, zsss3_io          ! tempory workspaces
-      !!----------------------------------------------------------------------
-
-      IF( kt == nit000 ) THEN
-         IF( lk_cpl ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'ice_stp : Louvain la Neuve Ice Model (LIM)'
-            IF(lwp) WRITE(numout,*) '~~~~~~~   coupled case'
-         ELSE
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'ice_stp : Louvain la Neuve Ice Model (LIM)' 
-            IF(lwp) WRITE(numout,*) '~~~~~~~   forced case using bulk formulea'
-         ENDIF
-         !  Initialize fluxes fields
-         gtaux(:,:) = 0.e0
-         gtauy(:,:) = 0.e0
-      ENDIF
-
-      ! Temperature , salinity and horizonta wind
-      ! sst_io  and sss_io, u_io and v_io  are initialized at nit000 in limistate.F90 (or limrst.F90) with :
-      !              sst_io = sst_io + (nfice - 1) * (tn(:,:,1)+rt0 )
-      !              sss_io = sss_io + (nfice - 1) * sn(:,:,1)
-      !              u_io  = u_io  + (nfice - 1) * 0.5 * ( un(ji-1,jj  ,1) + un(ji-1,jj-1,1) )
-      !              v_io  = v_io  + (nfice - 1) * 0.5 * ( vn(ji  ,jj-1,1) + vn(ji-1,jj-1,1) )
-      !    cumulate fields
-      !
-      sst_io(:,:) = sst_io(:,:) + tn(:,:,1) + rt0
-      sss_io(:,:) = sss_io(:,:) + sn(:,:,1)
-
- 
-      ! vectors at F-point
-      DO jj = 2, jpj
-         DO ji = fs_2, jpi   ! vector opt.
-            u_io(ji,jj) = u_io(ji,jj) + 0.5 * ( un(ji-1,jj  ,1) + un(ji-1,jj-1,1) )
-            v_io(ji,jj) = v_io(ji,jj) + 0.5 * ( vn(ji  ,jj-1,1) + vn(ji-1,jj-1,1) )
-         END DO
-      END DO
-      
-      
-      IF( MOD( kt-1, nfice ) == 0 ) THEN
-         
-         ! The LIM model is going to be call
-         sst_io(:,:) = sst_io(:,:) / FLOAT( nfice ) * tmask(:,:,1)
-         sss_io(:,:) = sss_io(:,:) / FLOAT( nfice )
-
-         ! stress from ocean U- and V-points to ice U,V point
-         DO jj = 2, jpj
-            DO ji = fs_2, jpi   ! vector opt.
-               gtaux(ji,jj) = 0.5 * ( taux(ji-1,jj  ) + taux(ji-1,jj-1) )
-               gtauy(ji,jj) = 0.5 * ( tauy(ji  ,jj-1) + tauy(ji-1,jj-1) )
-               u_io  (ji,jj) = u_io(ji,jj) / FLOAT( nfice )
-               v_io  (ji,jj) = v_io(ji,jj) / FLOAT( nfice )
-            END DO
-         END DO
-
-         ! lateral boundary condition
-         CALL lbc_lnk( gtaux(:,:), 'I', -1. )   ! I-point (i.e. ice U-V point)
-         CALL lbc_lnk( gtauy(:,:), 'I', -1. )   ! I-point (i.e. ice U-V point)
-         CALL lbc_lnk( u_io (:,:), 'I', -1. )   ! I-point (i.e. ice U-V point)
-         CALL lbc_lnk( v_io (:,:), 'I', -1. )   ! I-point (i.e. ice U-V point)
-
-!!gmbug  in the ocean freezing point computed as :
-!!gm           fzptn (ji,jj) = ( -0.0575 + 1.710523e-3 * SQRT( sn(ji,jj,1) )   &
-!!gm                                     - 2.154996e-4 *       sn(ji,jj,1)   ) * sn(ji,jj,1)   !!   &
-!!gm           !!                        - 7.53e-4 * pressure
-!!gm
-!!gm!bug this is much more accurate and efficient computation
-!!gm       **************************************************
-!!gm freezing point from unesco:
-!!gm     real function tf(s,p)
-!!gm   function to compute the freezing point of seawater
-!!gm
-!!gm   reference: unesco tech. papers in the marine science no. 28. 1978
-!!gm   eighth report jpots
-!!gm   annex 6 freezing point of seawater f.j. millero pp.29-35.
-!!gm
-!!gm  units:
-!!gm         pressure      p          decibars
-!!gm         salinity      s          pss-78
-!!gm         temperature   tf         degrees celsius
-!!gm         freezing pt.
-!!gm************************************************************
-!!gm  checkvalue: tf= -2.588567 deg. c for s=40.0, p=500. decibars
-!!gm     tf=(-.0575+1.710523e-3*sqrt(abs(s))-2.154996e-4*s)*s-7.53e-4*p
-!!gm     return
-!!gm     end
-!!gm!bug
-
-
-!!gm      DO jj = 1, jpj
-!!gm         DO ji = 1, jpi
-!!gm            tfu(ji,jj)  = (  rt0 + ( - 0.0575                              &
-!!gm               &                     + 1.710523e-3 * SQRT( sss_io(ji,jj) )   &
-!!gm               &                     - 2.154996e-4 *       sss_io(ji,jj)   ) * sss_io(ji,jj)  ) * tms(ji,jj)
-!!gm         END DO
-!!gm      END DO
-!!gm
-      zsss_io (:,:) = SQRT( sss_io(:,:) ) 
-      zsss2_io(:,:) =  sss_io(:,:) *  sss_io(:,:)
-      zsss3_io(:,:) = zsss_io(:,:) * zsss_io(:,:) * zsss_io(:,:)
-
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            tfu(ji,jj)  = ABS ( rt0 - 0.0575       *   sss_io(ji,jj)   &
-               &                    + 1.710523e-03 * zsss3_io(ji,jj)   &
-               &                    - 2.154996e-04 * zsss2_io(ji,jj) ) * tms(ji,jj)
-         END DO
-      END DO
-   
-         
-
-         IF(ln_ctl) THEN         ! print mean trends (used for debugging)
-            CALL prt_ctl_info('Ice Forcings ')
-            CALL prt_ctl(tab2d_1=qsr_oce ,clinfo1=' qsr_oce  : ', tab2d_2=qsr_ice , clinfo2=' qsr_ice   : ')
-            CALL prt_ctl(tab2d_1=qnsr_oce,clinfo1=' qnsr_oce : ', tab2d_2=qnsr_ice, clinfo2=' qnsr_ice  : ')
-            CALL prt_ctl(tab2d_1=evap    ,clinfo1=' evap     : ')
-            CALL prt_ctl(tab2d_1=tprecip ,clinfo1=' precip   : ', tab2d_2=sprecip , clinfo2=' Snow      : ')
-            CALL prt_ctl(tab2d_1=gtaux   ,clinfo1=' u-stress : ', tab2d_2=gtauy   , clinfo2=' v-stress  : ')
-            CALL prt_ctl(tab2d_1=sst_io  ,clinfo1=' sst      : ', tab2d_2=sss_io  , clinfo2=' sss       : ')
-            CALL prt_ctl(tab2d_1=u_io    ,clinfo1=' u_io     : ', tab2d_2=v_io    , clinfo2=' v_io      : ')
-            CALL prt_ctl(tab2d_1=hsnif   ,clinfo1=' hsnif  1 : ', tab2d_2=hicif   , clinfo2=' hicif     : ')
-            CALL prt_ctl(tab2d_1=frld    ,clinfo1=' frld   1 : ', tab2d_2=sist    , clinfo2=' sist      : ')
-         ENDIF
-
-         !                                                           !-----------------------!
-         CALL lim_rst_opn_2( kt )                                    ! Open Ice restart file !
-         !                                                           !-----------------------!
-
-         !                                                           !--------------!
-         CALL lim_dyn_2( kt )                                        ! Ice dynamics !   ( rheology/dynamics )
-         !                                                           !--------------!
-         IF(ln_ctl) THEN
-            CALL prt_ctl(tab2d_1=hsnif ,clinfo1=' hsnif  2 : ', tab2d_2=hicif , clinfo2=' hicif     : ')
-            CALL prt_ctl(tab2d_1=frld  ,clinfo1=' frld   2 : ', tab2d_2=sist  , clinfo2=' sist      : ')
-         ENDIF
-
-
-         !                                                           !---------------!
-         CALL lim_trp_2( kt )                                        ! Ice transport !  ( Advection/diffusion )
-         !                                                           !---------------!
-         IF(ln_ctl) THEN
-            CALL prt_ctl(tab2d_1=hsnif ,clinfo1=' hsnif  3 : ', tab2d_2=hicif , clinfo2=' hicif     : ')
-            CALL prt_ctl(tab2d_1=frld  ,clinfo1=' frld   3 : ', tab2d_2=sist  , clinfo2=' sist      : ')
-         ENDIF
-
-         !                                                           !-------------!
-         IF( ln_limdmp ) THEN                                        ! Ice damping !
-         !                                                           !-------------!
-#if defined key_agrif
-            IF( Agrif_Root() )   CALL lim_dmp_2(kt)
-#else
-            CALL lim_dmp_2(kt)                                         
-#endif
-         ENDIF
-         !                                                           !--------------------!
-         CALL lim_thd_2( kt )                                        ! Ice thermodynamics !
-         !                                                           !--------------------!
-         IF(ln_ctl) THEN
-            CALL prt_ctl(tab2d_1=hsnif ,clinfo1=' hsnif  4 : ', tab2d_2=hicif , clinfo2=' hicif     : ')
-            CALL prt_ctl(tab2d_1=frld  ,clinfo1=' frld   4 : ', tab2d_2=sist  , clinfo2=' sist      : ')
-         ENDIF
-
-
-         ! Mass and heat fluxes from ice to ocean
-         !                                                           !------------------------------!
-         CALL lim_flx_2                                              ! Ice/Ocean Mass & Heat fluxes !
-         !                                                           !------------------------------!
-
-         IF( MOD( kt + nfice -1, ninfo ) == 0 .OR. ntmoy == 1 )  THEN        !-----------------!
-            CALL lim_dia_2( kt )                                             ! Ice Diagnostics !
-         ENDIF                                                               !-----------------!
-
-         !                                                           !-------------!
-         CALL lim_wri_2( kt )                                        ! Ice outputs !
-         !                                                           !-------------!
-
-         !                                                           !------------------------!
-         IF( lrst_ice ) CALL lim_rst_write_2( kt )                   ! Write Ice restart file !
-         !                                                           !------------------------!
-
-         ! Re-initialization of forcings
-         qsr_oce (:,:) = 0.e0
-         qsr_ice (:,:) = 0.e0
-         qnsr_oce(:,:) = 0.e0
-         qnsr_ice(:,:) = 0.e0 
-         dqns_ice(:,:) = 0.e0 
-         tprecip (:,:) = 0.e0 
-         sprecip (:,:) = 0.e0
-         fr1_i0  (:,:) = 0.e0
-         fr2_i0  (:,:) = 0.e0
-         evap    (:,:) = 0.e0
-#if defined key_coupled 
-         rrunoff (:,:) = 0.e0
-         calving (:,:) = 0.e0
-#else
-         qla_ice (:,:) = 0.e0
-         dqla_ice(:,:) = 0.e0
-#endif
-      ENDIF
-      !
-   END SUBROUTINE ice_stp_2
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option           Dummy module      NO LIM 2.0 sea-ice model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE ice_stp_2 ( kt )     ! Dummy routine
-      WRITE(*,*) 'ice_stp_2: You should not have seen this print! error?', kt
-   END SUBROUTINE ice_stp_2
-#endif
-
-   !!======================================================================
-END MODULE icestp_2
Index: trunk/NEMO/LIM_SRC_2/limadv_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limadv_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limadv_2.F90	(revision 888)
@@ -33,5 +33,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $ Id: $ 
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/LIM_SRC_2/limdia_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limdia_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limdia_2.F90	(revision 888)
@@ -19,4 +19,5 @@
    USE par_ice_2       ! ice parameters
    USE ice_oce         ! ice variables
+   USE sbc_oce         ! surface boundary condition variables
    USE daymod          !
    USE dom_ice_2       !
@@ -28,5 +29,5 @@
    PRIVATE
 
-   PUBLIC               lim_dia_2          ! called by ice_step
+   PUBLIC               lim_dia_2          ! called by sbc_ice_lim_2
    INTEGER, PUBLIC ::   ntmoy   = 1 ,   &  !: instantaneous values of ice evolution or averaging ntmoy
       &                 ninfo   = 1        !: frequency of ouputs on file ice_evolu in case of averaging
@@ -58,5 +59,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limdia.F90,v 1.9 2007/06/29 17:03:12 opalod Exp $ 
+   !! $ Id: $
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -87,5 +88,5 @@
 
       nv = 1 
-      vinfor(nv) = REAL( kt + nfice - 1 )
+      vinfor(nv) = REAL( kt + nn_fsbc - 1 )
       nv = nv + 1
       vinfor(nv) = nyear
@@ -107,6 +108,6 @@
                zicevol = zarea   * hicif(ji,jj)
                zsnwvol = zarea   * hsnif(ji,jj)
-               zicespd = zicevol * ( u_ice(ji,jj) * u_ice(ji,jj)   &
-                  &                + v_ice(ji,jj) * v_ice(ji,jj) )
+               zicespd = zicevol * ( ui_ice(ji,jj) * ui_ice(ji,jj)   &
+                  &                + vi_ice(ji,jj) * vi_ice(ji,jj) )
                vinfor(nv+ 1) = vinfor(nv+ 1) + zarea
                vinfor(nv+ 3) = vinfor(nv+ 3) + zextent15
@@ -133,6 +134,6 @@
                 zicevol = zarea   * hicif(ji,jj)
                 zsnwvol = zarea   * hsnif(ji,jj)
-                zicespd = zicevol * ( u_ice(ji,jj) * u_ice(ji,jj)   &
-                   &                + v_ice(ji,jj) * v_ice(ji,jj) )
+                zicespd = zicevol * ( ui_ice(ji,jj) * ui_ice(ji,jj)   &
+                   &                + vi_ice(ji,jj) * vi_ice(ji,jj) )
                 vinfor(nv+ 1) = vinfor(nv+ 1) + zarea
                 vinfor(nv+ 3) = vinfor(nv+ 3) + zextent15
@@ -154,5 +155,5 @@
     
        ! oututs on file ice_evolu    
-       IF( MOD( kt + nfice - 1, ninfo ) == 0 ) THEN
+       IF( MOD( kt + nn_fsbc - 1, ninfo ) == 0 ) THEN
           WRITE(numevo_ice,fmtw) ( titvar(jv), vinfom(jv)/naveg, jv = 1, nvinfo )
           naveg = 0
@@ -227,8 +228,8 @@
 
        ! Definition et Ecriture de l'entete : nombre d'enregistrements 
-       ndeb   = ( nit000 - 1 + nfice - 1 ) / ninfo
-       IF( nit000 - 1 + nfice == 1 ) ndeb = -1
-
-       nferme = ( nitend + nfice - 1 ) / ninfo ! nit000 - 1 + nfice - 1 + nitend - nit000 + 1
+       ndeb   = ( nit000 - 1 + nn_fsbc - 1 ) / ninfo
+       IF( nit000 - 1 + nn_fsbc == 1 ) ndeb = -1
+
+       nferme = ( nitend + nn_fsbc - 1 ) / ninfo ! nit000 - 1 + nn_fsbc - 1 + nitend - nit000 + 1
        ntot   = nferme - ndeb
        ndeb   = ninfo * ( 1 + ndeb )
Index: trunk/NEMO/LIM_SRC_2/limdmp_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limdmp_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limdmp_2.F90	(revision 888)
@@ -40,5 +40,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0 , UCL-LOCEAN-IPSL  (2006)
-   !! $Header$
+   !! $ Id: $
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
Index: trunk/NEMO/LIM_SRC_2/limdyn_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limdyn_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limdyn_2.F90	(revision 888)
@@ -4,4 +4,9 @@
    !!   Sea-Ice dynamics :  
    !!======================================================================
+   !! History :   1.0  !  01-04  (LIM)  Original code
+   !!             2.0  !  02-08  (C. Ethe, G. Madec)  F90, mpp
+   !!             2.0  !  03-08  (C. Ethe) add lim_dyn_init
+   !!             2.0  !  06-07  (G. Madec)  Surface module
+   !!---------------------------------------------------------------------
 #if defined key_lim2
    !!----------------------------------------------------------------------
@@ -11,31 +16,32 @@
    !!    lim_dyn_init_2 : initialization and namelist read
    !!----------------------------------------------------------------------
-   !! * Modules used
-   USE phycst
-   USE in_out_manager  ! I/O manager
-   USE dom_ice_2
-   USE dom_oce         ! ocean space and time domain
-   USE ice_2
-   USE ice_oce
-   USE iceini_2
-   USE limistate_2
-   USE limrhg_2        ! ice rheology
-   USE lbclnk
-   USE lib_mpp
-   USE prtctl          ! Print control
+   USE dom_oce        ! ocean space and time domain
+   USE sbc_oce        !
+   USE phycst         !
+   USE ice_2          !
+   USE ice_oce        !
+   USE dom_ice_2      !
+   USE iceini_2       !
+   USE limistate_2    !
+   USE limrhg_2       ! ice rheology
+
+   USE lbclnk         !
+   USE lib_mpp        !
+   USE in_out_manager ! I/O manager
+   USE prtctl         ! Print control
 
    IMPLICIT NONE
    PRIVATE
 
-   !! * Accessibility
-   PUBLIC lim_dyn_2  ! routine called by ice_step
+   PUBLIC   lim_dyn_2 ! routine called by sbc_ice_lim
 
    !! * Module variables
    REAL(wp)  ::  rone    = 1.e0   ! constant value
 
-   !!----------------------------------------------------------------------
-   !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   LIM 2.0,  UCL-LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -46,5 +52,5 @@
       !!               ***  ROUTINE lim_dyn_2  ***
       !!               
-      !! ** Purpose :   compute ice velocity and ocean-ice stress
+      !! ** Purpose :   compute ice velocity and ocean-ice friction velocity
       !!                
       !! ** Method  : 
@@ -52,39 +58,27 @@
       !! ** Action  : - Initialisation
       !!              - Call of the dynamic routine for each hemisphere
-      !!              - computation of the stress at the ocean surface         
+      !!              - computation of the friction velocity at the sea-ice base
       !!              - treatment of the case if no ice dynamic
-      !! History :
-      !!   1.0  !  01-04  (LIM)  Original code
-      !!   2.0  !  02-08  (C. Ethe, G. Madec)  F90, mpp
       !!---------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt     ! number of iteration
-
-      INTEGER ::   ji, jj             ! dummy loop indices
-      INTEGER ::   i_j1, i_jpj        ! Starting/ending j-indices for rheology
-      REAL(wp) ::   &
-         ztairx, ztairy,           &  ! tempory scalars
-         zsang , zmod,             &
-         ztglx , ztgly ,           &
-         zt11, zt12, zt21, zt22 ,  &
-         zustm, zsfrld, zsfrldm4,  &
-         zu_ice, zv_ice, ztair2
-      REAL(wp),DIMENSION(jpj) ::   &
-         zind,                     &  ! i-averaged indicator of sea-ice
-         zmsk                         ! i-averaged of tmask
+      !!
+      INTEGER  ::   ji, jj             ! dummy loop indices
+      INTEGER  ::   i_j1, i_jpj        ! Starting/ending j-indices for rheology
+      REAL(wp) ::   zcoef              ! temporary scalar
+      REAL(wp), DIMENSION(jpj)     ::   zind           ! i-averaged indicator of sea-ice
+      REAL(wp), DIMENSION(jpj)     ::   zmsk           ! i-averaged of tmask
+      REAL(wp), DIMENSION(jpi,jpj) ::   zu_io, zv_io   ! ice-ocean velocity
       !!---------------------------------------------------------------------
 
-      IF( kt == nit000  )   CALL lim_dyn_init_2   ! Initialization (first time-step only)
+      IF( kt == nit000 )   CALL lim_dyn_init_2   ! Initialization (first time-step only)
       
-      IF ( ln_limdyn ) THEN
-
+      IF( ln_limdyn ) THEN
+         !
          ! Mean ice and snow thicknesses.          
          hsnm(:,:)  = ( 1.0 - frld(:,:) ) * hsnif(:,:)
          hicm(:,:)  = ( 1.0 - frld(:,:) ) * hicif(:,:)
-
-         u_oce(:,:)  = u_io(:,:) * tmu(:,:)
-         v_oce(:,:)  = v_io(:,:) * tmu(:,:)
-       
-         !                                         ! Rheology (ice dynamics)
-         !                                         ! ========
+         !
+         !                                     ! Rheology (ice dynamics)
+         !                                     ! ========
          
          !  Define the j-limits where ice rheology is computed
@@ -94,17 +88,14 @@
             i_j1 = 1   
             i_jpj = jpj
-            IF(ln_ctl)    THEN
-               CALL prt_ctl_info('lim_dyn  :    i_j1 = ', ivar1=i_j1, clinfo2=' ij_jpj = ', ivar2=i_jpj)
-            ENDIF
+            IF(ln_ctl)   CALL prt_ctl_info( 'lim_dyn  :    i_j1 = ', ivar1=i_j1, clinfo2=' ij_jpj = ', ivar2=i_jpj )
             CALL lim_rhg_2( i_j1, i_jpj )
-
+            !
          ELSE                                 ! optimization of the computational area
-
+            !
             DO jj = 1, jpj
                zind(jj) = SUM( frld (:,jj  ) )   ! = FLOAT(jpj) if ocean everywhere on a j-line
                zmsk(jj) = SUM( tmask(:,jj,1) )   ! = 0          if land  everywhere on a j-line
-   !!i         write(numout,*) narea, 'limdyn' , jj, zind(jj), zmsk(jj)
-            END DO
-
+            END DO
+            !
             IF( l_jeq ) THEN                     ! local domain include both hemisphere
                !                                 ! Rheology is computed in each hemisphere
@@ -118,7 +109,7 @@
                i_j1 = MAX( 1, i_j1-1 )
                IF(ln_ctl)   WRITE(numout,*) 'lim_dyn : NH i_j1 = ', i_j1, ' ij_jpj = ', i_jpj
-    
+               ! 
                CALL lim_rhg_2( i_j1, i_jpj )
-    
+               ! 
                ! Southern hemisphere
                i_j1  =  1 
@@ -129,7 +120,7 @@
                i_jpj = MIN( jpj, i_jpj+2 )
                IF(ln_ctl)   WRITE(numout,*) 'lim_dyn : SH i_j1 = ', i_j1, ' ij_jpj = ', i_jpj
-    
+               ! 
                CALL lim_rhg_2( i_j1, i_jpj )
-    
+               ! 
             ELSE                                 ! local domain extends over one hemisphere only
                !                                 ! Rheology is computed only over the ice cover
@@ -148,105 +139,47 @@
     
                IF(ln_ctl)   WRITE(numout,*) 'lim_dyn : one hemisphere: i_j1 = ', i_j1, ' ij_jpj = ', i_jpj
-    
+               ! 
                CALL lim_rhg_2( i_j1, i_jpj )
-
+               !
             ENDIF
-
+            !
          ENDIF
 
-         IF(ln_ctl)   THEN 
-            CALL prt_ctl(tab2d_1=u_oce , clinfo1=' lim_dyn  : u_oce :', tab2d_2=v_oce , clinfo2=' v_oce :')
-            CALL prt_ctl(tab2d_1=u_ice , clinfo1=' lim_dyn  : u_ice :', tab2d_2=v_ice , clinfo2=' v_ice :')
-         ENDIF
-         
-         !                                         ! Ice-Ocean stress
-         !                                         ! ================
+         IF(ln_ctl)   CALL prt_ctl(tab2d_1=ui_ice , clinfo1=' lim_dyn  : ui_ice :', tab2d_2=vi_ice , clinfo2=' vi_ice :')
+         
+         ! computation of friction velocity
+         ! --------------------------------
+         ! ice-ocean velocity at U & V-points (ui_ice vi_ice at I-point ; ssu_m, ssv_m at U- & V-points)
+         
+         DO jj = 1, jpjm1
+            DO ji = 1, fs_jpim1   ! vector opt.
+               zu_io(ji,jj) = 0.5 * ( ui_ice(ji+1,jj+1) + ui_ice(ji+1,jj  ) ) - ssu_m(ji,jj)
+               zv_io(ji,jj) = 0.5 * ( vi_ice(ji+1,jj+1) + vi_ice(ji  ,jj+1) ) - ssv_m(ji,jj)
+            END DO
+         END DO
+         ! frictional velocity at T-point
          DO jj = 2, jpjm1
-            zsang  = SIGN(1.e0, gphif(1,jj-1) ) * sangvg
-            DO ji = 2, jpim1
-               ! computation of wind stress over ocean in X and Y direction
-#if defined key_coupled && defined key_lim_cp1
-               ztairx =  frld(ji-1,jj  ) * gtaux(ji-1,jj  ) + frld(ji,jj  ) * gtaux(ji,jj  )      &
-                  &    + frld(ji-1,jj-1) * gtaux(ji-1,jj-1) + frld(ji,jj-1) * gtaux(ji,jj-1)
-
-               ztairy =  frld(ji-1,jj  ) * gtauy(ji-1,jj  ) + frld(ji,jj  ) * gtauy(ji,jj  )      &
-                  &    + frld(ji-1,jj-1) * gtauy(ji-1,jj-1) + frld(ji,jj-1) * gtauy(ji,jj-1)
-#else
-               zsfrld  = frld(ji,jj) + frld(ji-1,jj) + frld(ji-1,jj-1) + frld(ji,jj-1)
-               ztairx  = zsfrld * gtaux(ji,jj)
-               ztairy  = zsfrld * gtauy(ji,jj)
-#endif
-               zsfrldm4 = 4 - frld(ji,jj) - frld(ji-1,jj) - frld(ji-1,jj-1) - frld(ji,jj-1)
-               zu_ice   = u_ice(ji,jj) - u_oce(ji,jj)
-               zv_ice   = v_ice(ji,jj) - v_oce(ji,jj)
-               zmod     = SQRT( zu_ice * zu_ice + zv_ice * zv_ice ) 
-               ztglx   = zsfrldm4 * rhoco * zmod * ( cangvg * zu_ice - zsang * zv_ice ) 
-               ztgly   = zsfrldm4 * rhoco * zmod * ( cangvg * zv_ice + zsang * zu_ice ) 
-
-               tio_u(ji,jj) = - ( ztairx + 1.0 * ztglx ) / ( 4 * rau0 )
-               tio_v(ji,jj) = - ( ztairy + 1.0 * ztgly ) / ( 4 * rau0 )
+            DO ji = fs_2, fs_jpim1   ! vector opt.
+               ust2s(ji,jj) = 0.5 * cw                                                          &
+                  &         * (  zu_io(ji,jj) * zu_io(ji,jj) + zu_io(ji-1,jj) * zu_io(ji-1,jj)   &
+                  &            + zv_io(ji,jj) * zv_io(ji,jj) + zv_io(ji,jj-1) * zv_io(ji,jj-1)   ) * tms(ji,jj)
             END DO
          END DO
-         
-         ! computation of friction velocity
+         !
+      ELSE      ! no ice dynamics : transmit directly the atmospheric stress to the ocean
+         !
+         zcoef = SQRT( 0.5 ) / rau0
          DO jj = 2, jpjm1
-            DO ji = 2, jpim1
-
-               zu_ice   = u_ice(ji-1,jj-1) - u_oce(ji-1,jj-1)
-               zv_ice   = v_ice(ji-1,jj-1) - v_oce(ji-1,jj-1)
-               zt11  = rhoco * ( zu_ice * zu_ice + zv_ice * zv_ice )
-
-               zu_ice   = u_ice(ji-1,jj) - u_oce(ji-1,jj)
-               zv_ice   = v_ice(ji-1,jj) - v_oce(ji-1,jj)
-               zt12  = rhoco * ( zu_ice * zu_ice + zv_ice * zv_ice ) 
-
-               zu_ice   = u_ice(ji,jj-1) - u_oce(ji,jj-1)
-               zv_ice   = v_ice(ji,jj-1) - v_oce(ji,jj-1)
-               zt21  = rhoco * ( zu_ice * zu_ice + zv_ice * zv_ice ) 
-
-               zu_ice   = u_ice(ji,jj) - u_oce(ji,jj)
-               zv_ice   = v_ice(ji,jj) - v_oce(ji,jj)
-               zt22  = rhoco * ( zu_ice * zu_ice + zv_ice * zv_ice ) 
-
-               ztair2 = gtaux(ji,jj) * gtaux(ji,jj) + gtauy(ji,jj) * gtauy(ji,jj)
-
-               zustm =  ( 1 - frld(ji,jj) ) * 0.25 * ( zt11 + zt12 + zt21 + zt22 )        &
-                  &  +        frld(ji,jj)   * SQRT( ztair2 )
-
-               ust2s(ji,jj) = ( zustm / rau0 ) * ( rone + sdvt(ji,jj) ) * tms(ji,jj)
+            DO ji = fs_2, fs_jpim1   ! vector opt.
+               ust2s(ji,jj) = zcoef * tms(ji,jj) * SQRT(  utau(ji,jj) * utau(ji,jj) + utau(ji-1,jj) * utau(ji-1,jj)   &
+                  &                                     + vtau(ji,jj) * vtau(ji,jj) + vtau(ji,jj-1) * vtau(ji,jj-1) )
             END DO
          END DO
-
-       ELSE      ! no ice dynamics : transmit directly the atmospheric stress to the ocean
-                    
-          DO jj = 2, jpjm1
-             DO ji = 2, jpim1
-#if defined key_coupled && defined key_lim_cp1
-                tio_u(ji,jj) = - (  gtaux(ji  ,jj  ) + gtaux(ji-1,jj  )       &
-                   &              + gtaux(ji-1,jj-1) + gtaux(ji  ,jj-1) ) / ( 4 * rau0 )
-
-                tio_v(ji,jj) = - (  gtauy(ji  ,jj )  + gtauy(ji-1,jj  )       &
-                   &              + gtauy(ji-1,jj-1) + gtauy(ji  ,jj-1) ) / ( 4 * rau0 )
-#else
-                tio_u(ji,jj) = - gtaux(ji,jj) / rau0
-                tio_v(ji,jj) = - gtauy(ji,jj) / rau0 
-#endif
-                ztair2       = gtaux(ji,jj) * gtaux(ji,jj) + gtauy(ji,jj) * gtauy(ji,jj)
-                zustm        = SQRT( ztair2  )
-
-                ust2s(ji,jj) = ( zustm / rau0 ) * ( rone + sdvt(ji,jj) ) * tms(ji,jj)
-            END DO
-         END DO
-
+         !
       ENDIF
-
+      !
       CALL lbc_lnk( ust2s, 'T',  1. )   ! T-point
-      CALL lbc_lnk( tio_u, 'I', -1. )   ! I-point (i.e. ice U-V point)
-      CALL lbc_lnk( tio_v, 'I', -1. )   ! I-point (i.e. ice U-V point)
-
-      IF(ln_ctl) THEN 
-            CALL prt_ctl(tab2d_1=tio_u , clinfo1=' lim_dyn  : tio_u :', tab2d_2=tio_v , clinfo2=' tio_v :')
-            CALL prt_ctl(tab2d_1=ust2s , clinfo1=' lim_dyn  : ust2s :')
-      ENDIF
+      !
+      IF(ln_ctl)   CALL prt_ctl(tab2d_1=ust2s , clinfo1=' lim_dyn  : ust2s :')
 
    END SUBROUTINE lim_dyn_2
@@ -257,14 +190,11 @@
       !!                  ***  ROUTINE lim_dyn_init_2  ***
       !!
-      !! ** Purpose : Physical constants and parameters linked to the ice
-      !!      dynamics
-      !!
-      !! ** Method  :  Read the namicedyn namelist and check the ice-dynamic
-      !!       parameter values called at the first timestep (nit000)
+      !! ** Purpose :   Physical constants and parameters linked to the ice
+      !!              dynamics
+      !!
+      !! ** Method  :   Read the namicedyn namelist and check the ice-dynamic
+      !!              parameter values
       !!
       !! ** input   :   Namelist namicedyn
-      !!
-      !! history :
-      !!  8.5  ! 03-08 (C. Ethe) original code
       !!-------------------------------------------------------------------
       NAMELIST/namicedyn/ epsd, alpha,     &
@@ -273,11 +203,8 @@
       !!-------------------------------------------------------------------
 
-      ! Define the initial parameters
-      ! -------------------------
-
-      ! Read Namelist namicedyn
-      REWIND ( numnam_ice )
+      REWIND ( numnam_ice )                       ! Read Namelist namicedyn
       READ   ( numnam_ice  , namicedyn )
-      IF(lwp) THEN
+
+      IF(lwp) THEN                                ! Control print
          WRITE(numout,*)
          WRITE(numout,*) 'lim_dyn_init_2: ice parameters for ice dynamics '
@@ -291,5 +218,5 @@
          WRITE(numout,*) '       maximum value for the residual of relaxation     resl   = ', resl
          WRITE(numout,*) '       drag coefficient for oceanic stress              cw     = ', cw
-         WRITE(numout,*) '       turning angle for oceanic stress                 angvg  = ', angvg
+         WRITE(numout,*) '       turning angle for oceanic stress                 angvg  = ', angvg, ' degrees'
          WRITE(numout,*) '       first bulk-rheology parameter                    pstar  = ', pstar
          WRITE(numout,*) '       second bulk-rhelogy parameter                    c_rhg  = ', c_rhg
@@ -303,14 +230,12 @@
       usecc2 = 1.0 / ( ecc * ecc )
       rhoco  = rau0 * cw
-      angvg  = angvg * rad
+      angvg  = angvg * rad      ! convert angvg from degree to radian
       sangvg = SIN( angvg )
       cangvg = COS( angvg )
       pstarh = pstar / 2.0
-      sdvt(:,:) = 0.e0
-
-      !  Diffusion coefficients.
-      ahiu(:,:) = ahi0 * umask(:,:,1)
+      !
+      ahiu(:,:) = ahi0 * umask(:,:,1)            ! Ice eddy Diffusivity coefficients.
       ahiv(:,:) = ahi0 * vmask(:,:,1)
-
+      !
    END SUBROUTINE lim_dyn_init_2
 
Index: trunk/NEMO/LIM_SRC_2/limflx_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limflx_2.F90	(revision 873)
+++ 	(revision )
@@ -1,219 +1,0 @@
-MODULE limflx_2
-   !!======================================================================
-   !!                       ***  MODULE limflx_2   ***
-   !!           computation of the flux at the sea ice/ocean interface
-   !!======================================================================
-#if defined key_lim2
-   !!----------------------------------------------------------------------
-   !!   'key_lim2'                                    LIM 2.0 sea-ice model
-   !!----------------------------------------------------------------------
-   !!   lim_flx_2  : flux at the ice / ocean interface
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE par_oce          ! ocean parameters
-   USE phycst           ! physical constants
-   USE ocfzpt           ! surface ocean freezing point
-   USE ice_oce          ! sea-ice variable
-   USE flx_oce          ! sea-ice/ocean forcings variables
-   USE ice_2             ! LIM sea-ice variables
-   USE flxblk             ! bulk formulea
-   USE lbclnk           ! ocean lateral boundary condition
-   USE in_out_manager   ! I/O manager
-   USE albedo           ! albedo parameters
-   USE prtctl           ! Print control
-
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Routine accessibility
-   PUBLIC lim_flx_2     ! called by lim_step_2
-
-   !! * Module variables
-   REAL(wp)  ::           &  ! constant values
-      epsi16 = 1.e-16  ,  &
-      rzero  = 0.e0    ,  &
-      rone   = 1.e0
-
-   !! * Substitutions
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE lim_flx_2
-      !!-------------------------------------------------------------------
-      !!                ***  ROUTINE lim_flx_2 ***
-      !!  
-      !! ** Purpose : Computes the mass and heat fluxes to the ocean
-      !!         
-      !! ** Action  : - Initialisation of some variables
-      !!              - comput. of the fluxes at the sea ice/ocean interface
-      !!     
-      !! ** Outputs : - fsolar  : solar heat flux at sea ice/ocean interface
-      !!              - fnsolar : non solar heat flux 
-      !!              - fsalt   : salt flux at sea ice/ocean interface
-      !!              - fmass   : freshwater flux at sea ice/ocean interface
-      !!
-      !! ** References :
-      !!       H. Goosse et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90
-      !!         original    : 00-01 (LIM)
-      !!         addition    : 02-07 (C. Ethe, G. Madec)
-      !!---------------------------------------------------------------------
-      !! * Local variables
-      INTEGER ::   ji, jj         ! dummy loop indices
-
-      INTEGER ::   &
-         ifvt, i1mfr, idfr ,   &  ! some switches
-         iflt, ial, iadv, ifral, ifrdv
-      
-      REAL(wp) ::   &
-         zinda  ,              &  ! switch for testing the values of ice concentration
-         z1mthcm                  ! 1 - thcm
-!!         zfcm1  ,              &  ! solar  heat fluxes
-!!         zfcm2  ,              &  !  non solar heat fluxes
-#if defined key_lim_fdd   
-      REAL(wp) ::   &
-         zfons,                &  ! salt exchanges at the ice/ocean interface
-         zpme                     ! freshwater exchanges at the ice/ocean interface
-#else
-      REAL(wp) ::   &
-         zprs  , zfons,        &  ! salt exchanges at the ice/ocean interface
-         zpmess                   ! freshwater exchanges at the ice/ocean interface
-#endif
-      REAL(wp), DIMENSION(jpi,jpj) ::  &
-         zfcm1  ,              &  ! solar  heat fluxes
-         zfcm2                    !  non solar heat fluxes      
-#if defined key_coupled    
-      REAL(wp), DIMENSION(jpi,jpj) ::  &
-         zalb  ,               &  ! albedo of ice under overcast sky
-         zalcn ,               &  ! albedo of ocean under overcast sky
-         zalbp ,               &  ! albedo of ice under clear sky
-         zaldum                   ! albedo of ocean under clear sky
-#endif
-      !!---------------------------------------------------------------------
-     
-      !---------------------------------!
-      !      Sea ice/ocean interface    !
-      !---------------------------------!
-       
-       
-      !      heat flux at the ocean surface
-      !-------------------------------------------------------
-       
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            zinda   = 1.0 - MAX( rzero , SIGN( rone , - ( 1.0 - pfrld(ji,jj) ) ) )
-            ifvt    = zinda  *  MAX( rzero , SIGN( rone, -phicif(ji,jj) ) )
-            i1mfr   = 1.0 - MAX( rzero , SIGN( rone ,  - ( 1.0 - frld(ji,jj) ) ) )
-            idfr    = 1.0 - MAX( rzero , SIGN( rone , frld(ji,jj) - pfrld(ji,jj) ) )
-            iflt    = zinda  * (1 - i1mfr) * (1 - ifvt )
-            ial     = ifvt   * i1mfr + ( 1 - ifvt ) * idfr
-            iadv    = ( 1  - i1mfr ) * zinda
-            ifral   = ( 1  - i1mfr * ( 1 - ial ) )   
-            ifrdv   = ( 1  - ifral * ( 1 - ial ) ) * iadv 
-            z1mthcm =   1. - thcm(ji,jj)       
-            !   computation the solar flux at ocean surface
-            zfcm1(ji,jj)   = pfrld(ji,jj) * qsr_oce(ji,jj)  + ( 1. - pfrld(ji,jj) ) * fstric(ji,jj)
-            !  computation the non solar heat flux at ocean surface
-            zfcm2(ji,jj) =  - z1mthcm * zfcm1(ji,jj)   &
-               &           + iflt    * ( fscmbq(ji,jj) + ffltbif(ji,jj) )                            &
-               &           + ifral   * ( ial * qcmif(ji,jj) + (1 - ial) * qldif(ji,jj) ) / rdt_ice   &
-               &           + ifrdv   * ( qfvbq(ji,jj) + qdtcn(ji,jj) ) / rdt_ice
-
-            fsbbq(ji,jj) = ( 1.0 - ( ifvt + iflt ) ) * fscmbq(ji,jj)     ! ???
-            
-            fsolar (ji,jj) = zfcm1(ji,jj)                                       ! solar heat flux 
-
-            fnsolar(ji,jj) = zfcm2(ji,jj) - fdtcn(ji,jj)                        ! non solar heat flux
-         END DO
-      END DO
-  
-       
-      !      mass flux at the ocean surface
-      !-------------------------------------------------------
-       
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-#if defined key_lim_fdd
-            !  case of realistic freshwater flux (Tartinville et al., 2001)
-            
-            !  computing freshwater exchanges at the ice/ocean interface
-            zpme = - evap(ji,jj) * frld(ji,jj)            &   !  evaporation over oceanic fraction
-               &   + tprecip(ji,jj)                            &   !  total precipitation
-               &   - sprecip(ji,jj) * ( 1. - pfrld(ji,jj) )  &   !  remov. snow precip over ice
-               &   - rdmsnif(ji,jj) / rdt_ice                   !  freshwaterflux due to snow melting 
-            
-            !  computing salt exchanges at the ice/ocean interface
-            zfons =  ( soce - sice ) * ( rdmicif(ji,jj) / rdt_ice ) 
-            
-            !  converting the salt flux from ice to a freshwater flux from ocean
-            fsalt(ji,jj) = zfons / ( sss_io(ji,jj) + epsi16 )
-            
-            !  freshwater masses
-            fmass(ji,jj) = - zpme 
-#else
-            !  case of freshwater flux equivalent as salt flux
-            !  dilution effect due to evaporation and precipitation
-            zprs  = ( tprecip(ji,jj) - sprecip(ji,jj) * ( 1. - pfrld(ji,jj) ) ) * soce  
-            !  freshwater flux
-            zfons = rdmicif(ji,jj) * ( soce - sice )  &  !  fwf : ice formation and melting
-               &   -  dmgwi(ji,jj) * sice             &  !  fwf : salt flx needed to bring the fresh snow to sea/ice salinity
-               &   + rdmsnif(ji,jj) * soce               !  fwf to ocean due to snow melting 
-            !  salt exchanges at the ice/ocean interface
-            zpmess         =  zprs - zfons / rdt_ice - evap(ji,jj) * soce * frld(ji,jj)
-            fsalt(ji,jj) =  - zpmess
-#endif
-         END DO
-      END DO
-
-
-      !-------------------------------------------------------------------!
-      !  computation of others transmitting variables from ice to ocean   !
-      !------------------------------------------ ------------------------!
-
-      !-----------------------------------------------!
-      !   Storing the transmitted variables           !
-      !-----------------------------------------------!
-
-      ftaux (:,:) = - tio_u(:,:) * rau0   ! taux ( ice: N/m2/rau0, ocean: N/m2 )
-      ftauy (:,:) = - tio_v(:,:) * rau0   ! tauy ( ice: N/m2/rau0, ocean: N/m2 )                
-      freeze(:,:) = 1.0 - frld(:,:)       ! Sea ice cover            
-      tn_ice(:,:) = sist(:,:)             ! Ice surface temperature                      
-
-#if defined key_coupled            
-      zalb  (:,:) = 0.e0
-      zalcn (:,:) = 0.e0
-      zalbp (:,:) = 0.e0
-      zaldum(:,:) = 0.e0
-
-      !------------------------------------------------!
-      !  2) Computation of snow/ice and ocean albedo   !
-      !------------------------------------------------!
-      CALL flx_blk_albedo( zalb, zalcn, zalbp, zaldum )
-
-      alb_ice(:,:) =  0.5 * zalbp(:,:) + 0.5 * zalb (:,:)   ! Ice albedo                       
-#endif
-
-      IF(ln_ctl) THEN
-         CALL prt_ctl(tab2d_1=fsolar, clinfo1=' lim_flx: fsolar : ', tab2d_2=fnsolar, clinfo2=' fnsolar : ')
-         CALL prt_ctl(tab2d_1=fmass , clinfo1=' lim_flx: fmass  : ', tab2d_2=fsalt  , clinfo2=' fsalt   : ')
-         CALL prt_ctl(tab2d_1=ftaux , clinfo1=' lim_flx: ftaux  : ', tab2d_2=ftauy  , clinfo2=' ftauy   : ')
-         CALL prt_ctl(tab2d_1=freeze, clinfo1=' lim_flx: freeze : ', tab2d_2=tn_ice , clinfo2=' tn_ice  : ')
-      ENDIF 
-   
-    END SUBROUTINE lim_flx_2
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option :        Dummy module       NO LIM 2.0 sea-ice model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE lim_flx_2       ! Dummy routine
-   END SUBROUTINE lim_flx_2
-#endif 
-
-   !!======================================================================
-END MODULE limflx_2
Index: trunk/NEMO/LIM_SRC_2/limhdf_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limhdf_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limhdf_2.F90	(revision 888)
@@ -6,5 +6,5 @@
 #if defined key_lim2
    !!----------------------------------------------------------------------
-   !!   'key_lim2'  i                                 LIM 2.0 sea-ice model
+   !!   'key_lim2'                                    LIM 2.0 sea-ice model
    !!----------------------------------------------------------------------
    !!   lim_hdf_2  : diffusion trend on sea-ice variable
@@ -34,5 +34,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/LIM_SRC_2/limistate_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limistate_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limistate_2.F90	(revision 888)
@@ -4,7 +4,9 @@
    !!              Initialisation of diagnostics ice variables
    !!======================================================================
-   !! History :   2.0  !  01-04  (C. Ethe, G. Madec)  Original code
+   !! History :   1.0  !  01-04  (C. Ethe, G. Madec)  Original code
+   !!             2.0  !  03-08  (G. Madec)  add lim_istate_init
    !!                  !  04-04  (S. Theetten) initialization from a file
    !!                  !  06-07  (S. Masson)  IOM to read the restart
+   !!                  !  07-10  (G. Madec)  surface module
    !!--------------------------------------------------------------------
 #if defined key_lim2
@@ -18,10 +20,9 @@
    USE phycst
    USE ocfzpt
-   USE oce             ! dynamics and tracers variables      !!gm used???
-   USE dom_oce                                                     !!gm used???
    USE par_ice_2       ! ice parameters
    USE ice_oce         ! ice variables
    USE dom_ice_2
    USE lbclnk
+   USE oce
    USE ice_2
    USE iom
@@ -47,5 +48,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2006) 
-   !! $Header$ 
+   !! $ Id: $
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -66,46 +67,8 @@
       REAL(wp), DIMENSION(jpi,jpj) ::   ztn   ! workspace
       !--------------------------------------------------------------------
-
-       CALL lim_istate_init_2   !  reading the initials parameters of the ice
-
-      !-- Initialisation of sst,sss,u,v do i=1,jpi
-      u_io(:,:)  = 0.e0       ! ice velocity in x direction
-      v_io(:,:)  = 0.e0       ! ice velocity in y direction
-
-      IF( ln_limini ) THEN    ! 
-        
-         ! Initialisation at tn if no ice or sst_ini if ice
-         ! Idem for salinity
-
-      !--- Criterion for presence (zidto=1.) or absence (zidto=0.) of ice
-         DO jj = 1 , jpj
-            DO ji = 1 , jpi
-               
-               zidto = MAX(zzero, - SIGN(1.,frld(ji,jj) - 1.))
-               
-               sst_io(ji,jj) = ( nfice - 1 ) * (zidto * sst_ini(ji,jj)  + &   ! use the ocean initial values
-                    &          (1.0 - zidto ) * ( tn(ji,jj,1) + rt0 ))        ! tricky trick *(nfice-1) !
-               sss_io(ji,jj) = ( nfice - 1 ) * (zidto * sss_ini(ji,jj) + &
-                    &          (1.0 - zidto ) *  sn(ji,jj,1) )
-
-               ! to avoid the the melting of ice, several layers (mixed layer) should be
-               ! set to sst_ini (sss_ini) if there is ice
-               ! example for one layer 
-               ! tn(ji,jj,1) = zidto * ( sst_ini(ji,jj) - rt0 )  + (1.0 - zidto ) *  tn(ji,jj,1)
-               ! sn(ji,jj,1) = zidto * sss_ini(ji,jj)  + (1.0 - zidto ) *  sn(ji,jj,1)
-               ! tb(ji,jj,1) = tn(ji,jj,1)
-               ! sb(ji,jj,1) = sn(ji,jj,1)
-            END DO
-         END DO
-         
-         
-         !  tfu: Melting point of sea water
-         tfu(:,:)  = ztf   
-         
-         tfu(:,:)  = ABS ( rt0 - 0.0575       * sss_ini(:,:)                               &
-              &                    + 1.710523e-03 * sss_ini(:,:) * SQRT( sss_ini(:,:) )    &
-              &                    - 2.154996e-04 * sss_ini(:,:) * sss_ini(:,:) )
-      ELSE                     !
-
+ 
+      CALL lim_istate_init_2     !  reading the initials parameters of the ice
+
+      IF( .NOT. ln_limini ) THEN  
          
          ! Initialisation at tn or -2 if ice
@@ -116,18 +79,9 @@
             END DO
          END DO
-         
-         u_io  (:,:) = 0.e0
-         v_io  (:,:) = 0.e0
-         sst_io(:,:) = ( nfice - 1 ) * ( tn(:,:,1) + rt0 )   ! use the ocean initial values
-         sss_io(:,:) = ( nfice - 1 ) *   sn(:,:,1)           ! tricky trick *(nfice-1) !
-         
-         ! reference salinity 34psu
+                  
+         !  tfu: Melting point of sea water [Kelvin]
          zs0 = 34.e0
-         ztf = ABS ( rt0 - 0.0575       * zs0                           &
-              &                    + 1.710523e-03 * zs0 * SQRT( zs0 )   &
-              &                    - 2.154996e-04 * zs0 *zs0          )
-         
-         !  tfu: Melting point of sea water
-         tfu(:,:)  = ztf   
+         ztf = rt0 + ( - 0.0575 + 1.710523e-3 * SQRT( zs0 ) - 2.154996e-4 * zs0 ) * zs0
+         tfu(:,:) = ztf
          
          DO jj = 1, jpj
@@ -152,10 +106,11 @@
          tbif  (:,:,2) = tfu(:,:)
          tbif  (:,:,3) = tfu(:,:)
-      
+
       ENDIF
+     
       fsbbq (:,:)   = 0.e0
       qstoif(:,:)   = 0.e0
-      u_ice (:,:)   = 0.e0
-      v_ice (:,:)   = 0.e0
+      ui_ice(:,:)   = 0.e0
+      vi_ice(:,:)   = 0.e0
 # if defined key_coupled
       albege(:,:)   = 0.8 * tms(:,:)
@@ -191,5 +146,5 @@
 
       CALL lbc_lnk( hsnif, 'T', 1. )
-      CALL lbc_lnk( sist , 'T', 1. )
+      CALL lbc_lnk( sist , 'T', 1. , pval = rt0 )      ! set rt0 on closed boundary (required by bulk formulation)
       DO jk = 1, jplayersp1
          CALL lbc_lnk(tbif(:,:,jk), 'T', 1. )
@@ -197,6 +152,5 @@
       CALL lbc_lnk( fsbbq  , 'T', 1. )
       CALL lbc_lnk( qstoif , 'T', 1. )
-      CALL lbc_lnk( sss_io , 'T', 1. )
-      !
+
    END SUBROUTINE lim_istate_2
 
@@ -209,8 +163,5 @@
       !!
       !! ** Method  :   Read the namiceini namelist and check the parameter 
-      !!                values called at the first timestep (nit000)
-      !!                or
-      !!                Read 7 variables from a previous restart file
-      !!                sst, sst, hicif, hsnif, frld, ts & tbif
+      !!       values called at the first timestep (nit000)
       !!
       !! ** input   :   Namelist namiceini
@@ -222,43 +173,34 @@
          &                hnins, hgins, alins
       !!-------------------------------------------------------------------
-      
-      ! Read Namelist namiceini 
-      REWIND ( numnam_ice )
+      !
+      REWIND ( numnam_ice )               ! Read Namelist namiceini 
       READ   ( numnam_ice , namiceini )
-      
-      IF(.NOT. ln_limini) THEN 
-         IF(lwp) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) 'lim_istate_init : ice parameters inititialisation '
-            WRITE(numout,*) '~~~~~~~~~~~~~~~'
-            WRITE(numout,*) '         threshold water temp. for initial sea-ice    ttest      = ', ttest
-            WRITE(numout,*) '         initial snow thickness in the north          hninn      = ', hninn
-            WRITE(numout,*) '         initial ice thickness in the north           hginn      = ', hginn 
-            WRITE(numout,*) '         initial leads area in the north              alinn      = ', alinn            
-            WRITE(numout,*) '         initial snow thickness in the south          hnins      = ', hnins 
-            WRITE(numout,*) '         initial ice thickness in the south           hgins      = ', hgins
-            WRITE(numout,*) '         initial leads area in the south              alins      = ', alins
-         ENDIF
+      !
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) 'lim_istate_init_2 : ice parameters inititialisation '
+         WRITE(numout,*) '~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '         threshold water temp. for initial sea-ice    ttest      = ', ttest
+         WRITE(numout,*) '         initial snow thickness in the north          hninn      = ', hninn
+         WRITE(numout,*) '         initial ice thickness in the north           hginn      = ', hginn 
+         WRITE(numout,*) '         initial leads area in the north              alinn      = ', alinn            
+         WRITE(numout,*) '         initial snow thickness in the south          hnins      = ', hnins 
+         WRITE(numout,*) '         initial ice thickness in the south           hgins      = ', hgins
+         WRITE(numout,*) '         initial leads area in the south              alins      = ', alins
+         WRITE(numout,*) '         Ice state initialization using input file    ln_limini  = ', ln_limini
       ENDIF
 
       IF( ln_limini ) THEN                      ! Ice initialization using input file
-
+         !
          CALL iom_open( 'Ice_initialization.nc', inum_ice )
-
+         !
          IF( inum_ice > 0 ) THEN
-            IF(lwp) THEN
-               WRITE(numout,*) ' '
-               WRITE(numout,*) 'lim_istate_init : ice state initialization with : Ice_initialization.nc'
-               WRITE(numout,*) '~~~~~~~~~~~~~~~'
-               WRITE(numout,*) '         Ice state initialization using input file    ln_limini  = ', ln_limini
-               WRITE(numout,*) ' '
-            ENDIF
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) '                  ice state initialization with : Ice_initialization.nc'
             
-            CALL iom_get( inum_ice, jpdom_data, 'sst'  , sst_ini(:,:) )        
-            CALL iom_get( inum_ice, jpdom_data, 'sss'  , sss_ini(:,:) )       
-            CALL iom_get( inum_ice, jpdom_data, 'hicif', hicif  (:,:) )      
-            CALL iom_get( inum_ice, jpdom_data, 'hsnif', hsnif  (:,:) )      
-            CALL iom_get( inum_ice, jpdom_data, 'frld' , frld   (:,:) )     
-            CALL iom_get( inum_ice, jpdom_data, 'ts'   , sist   (:,:) )
+            CALL iom_get( inum_ice, jpdom_data, 'hicif', hicif )      
+            CALL iom_get( inum_ice, jpdom_data, 'hsnif', hsnif )      
+            CALL iom_get( inum_ice, jpdom_data, 'frld' , frld  )     
+            CALL iom_get( inum_ice, jpdom_data, 'ts'   , sist  )
             CALL iom_get( inum_ice, jpdom_unknown, 'tbif', tbif(1:nlci,1:nlcj,:),   &
                  &        kstart = (/ mig(1),mjg(1),1 /), kcount = (/ nlci,nlcj,jplayersp1 /) )
@@ -268,8 +210,8 @@
 
             CALL iom_close( inum_ice)
-            
+            !
          ENDIF
       ENDIF
-      !
+      !     
    END SUBROUTINE lim_istate_init_2
 
Index: trunk/NEMO/LIM_SRC_2/limmsh_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limmsh_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limmsh_2.F90	(revision 888)
@@ -25,5 +25,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/LIM_SRC_2/limrhg_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limrhg_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limrhg_2.F90	(revision 888)
@@ -4,35 +4,42 @@
    !!   Ice rheology :  performs sea ice rheology
    !!======================================================================
+   !! History :  0.0  !  93-12  (M.A. Morales Maqueda.)  Original code
+   !!            1.0  !  94-12  (H. Goosse) 
+   !!            2.0  !  03-12  (C. Ethe, G. Madec)  F90, mpp
+   !!            " "  !  06-08  (G. Madec)  surface module, ice-stress at I-point
+   !!            " "  !  09-09  (G. Madec)  Huge verctor optimisation
+   !!----------------------------------------------------------------------
 #if defined key_lim2
    !!----------------------------------------------------------------------
    !!   'key_lim2'                                    LIM 2.0 sea-ice model
    !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
    !!   lim_rhg_2   : computes ice velocities
    !!----------------------------------------------------------------------
-   !! * Modules used
-   USE phycst
-   USE par_oce
-   USE ice_oce         ! ice variables
-   USE dom_ice_2
-   USE ice_2
-   USE lbclnk
-   USE lib_mpp
-   USE in_out_manager  ! I/O manager
-   USE prtctl          ! Print control
+   USE par_oce        ! ocean parameter
+   USE ice_oce        ! ice variables
+   USE sbc_ice        ! surface boundary condition: ice variables
+   USE dom_ice_2      ! domaine: ice variables
+   USE phycst         ! physical constant
+   USE ice_2          ! ice variables
+   USE lbclnk         ! lateral boundary condition
+   USE lib_mpp        ! MPP library
+   USE in_out_manager ! I/O manager
+   USE prtctl         ! Print control
 
    IMPLICIT NONE
    PRIVATE
 
-   !! * Routine accessibility
-   PUBLIC lim_rhg_2  ! routine called by lim_dyn_2
-
-   !! * Module variables
-   REAL(wp)  ::           &  ! constant values
-      rzero   = 0.e0   ,  &
-      rone    = 1.e0
-   !!----------------------------------------------------------------------
-   !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   PUBLIC   lim_rhg_2 ! routine called by lim_dyn
+
+   REAL(wp) ::   rzero   = 0.e0   ! constant value: zero
+   REAL(wp) ::   rone    = 1.e0   !            and  one
+
+   !! * Substitutions
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   LIM 2.0,  UCL-LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -48,47 +55,79 @@
       !!  viscous-plastic law including shear strength and a bulk rheology.
       !!
-      !! ** Action  : - compute u_ice, v_ice the sea-ice velocity
+      !! ** Action  : - compute ui_ice, vi_ice the sea-ice velocity defined
+      !!              at I-point
+      !!-------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   k_j1    ! southern j-index for ice computation
+      INTEGER, INTENT(in) ::   k_jpj   ! northern j-index for ice computation
       !!
-      !! History :
-      !!   0.0  !  93-12  (M.A. Morales Maqueda.)  Original code
-      !!   1.0  !  94-12  (H. Goosse) 
-      !!   2.0  !  03-12  (C. Ethe, G. Madec)  F90, mpp
+      INTEGER ::   ji, jj              ! dummy loop indices
+      INTEGER ::   iter, jter          ! temporary integers
+      CHARACTER (len=50) ::   charout
+      REAL(wp) ::   ze11  , ze12  , ze22  , ze21       ! temporary scalars
+      REAL(wp) ::   zt11  , zt12  , zt21  , zt22       !    "         "
+      REAL(wp) ::   zvis11, zvis21, zvis12, zvis22     !    "         "
+      REAL(wp) ::   zgphsx, ztagnx, zunw, zur, zusw    !    "         "
+      REAL(wp) ::   zgphsy, ztagny, zvnw, zvr          !    "         "
+      REAL(wp) ::   zresm,  za, zac, zmod
+      REAL(wp) ::   zmpzas, zstms, zindu, zusdtp, zmassdt, zcorlal
+      REAL(wp) ::   ztrace2, zdeter, zdelta, zmask, zdgp, zdgi, zdiag
+      REAL(wp) ::   za1, zb1, zc1, zd1
+      REAL(wp) ::   za2, zb2, zc2, zd2, zden
+      REAL(wp) ::   zs11_11, zs11_12, zs11_21, zs11_22
+      REAL(wp) ::   zs12_11, zs12_12, zs12_21, zs12_22
+      REAL(wp) ::   zs21_11, zs21_12, zs21_21, zs21_22
+      REAL(wp) ::   zs22_11, zs22_12, zs22_21, zs22_22
+      REAL(wp), DIMENSION(jpi,  jpj  ) ::   zfrld, zmass, zcorl
+      REAL(wp), DIMENSION(jpi,  jpj  ) ::   za1ct, za2ct, zresr
+      REAL(wp), DIMENSION(jpi,  jpj  ) ::   zc1u, zc1v, zc2u, zc2v
+      REAL(wp), DIMENSION(jpi,  jpj  ) ::   zsang
+      REAL(wp), DIMENSION(jpi,0:jpj+1) ::   zu0, zv0
+      REAL(wp), DIMENSION(jpi,0:jpj+1) ::   zu_n, zv_n
+      REAL(wp), DIMENSION(jpi,0:jpj+1) ::   zu_a, zv_a
+      REAL(wp), DIMENSION(jpi,0:jpj+1) ::   zviszeta, zviseta
+      REAL(wp), DIMENSION(jpi,0:jpj+1) ::   zzfrld, zztms
+      REAL(wp), DIMENSION(jpi,0:jpj+1) ::   zi1, zi2, zmasst, zpresh
+
       !!-------------------------------------------------------------------
-      ! * Arguments
-      INTEGER, INTENT(in) ::   k_j1 ,  &  ! southern j-index for ice computation
-         &                     k_jpj      ! northern j-index for ice computation
-
-      ! * Local variables
-      INTEGER ::   ji, jj              ! dummy loop indices
-
-      INTEGER  :: &
-         iim1, ijm1, iip1 , ijp1   , & ! temporary integers
-         iter, jter                    !    "          "
-
-      CHARACTER (len=50) :: charout
-
-      REAL(wp) :: &
-         ze11  , ze12  , ze22  , ze21  ,   &  ! temporary scalars
-         zt11  , zt12  , zt21  , zt22  ,   &  !    "         "
-         zvis11, zvis21, zvis12, zvis22,   &  !    "         "
-         zgphsx, ztagnx, zusw  ,           &  !    "         "
-         zgphsy, ztagny                       !    "         "
-      REAL(wp) :: &
-         zresm, zunw, zvnw, zur, zvr, zmod, za, zac, &
-         zmpzas, zstms, zindu, zindu1, zusdtp, zmassdt, zcorlal,  &
-         ztrace2, zdeter, zdelta, zsang, zmask, zdgp, zdgi, zdiag
-      REAL(wp),DIMENSION(jpi,jpj) ::   &
-         zpresh, zfrld, zmass, zcorl,     &
-         zu0, zv0, zviszeta, zviseta,     &
-         zc1u, zc1v, zc2u, zc2v, za1ct, za2ct, za1, za2, zb1, zb2,  &
-         zc1, zc2, zd1, zd2, zden, zu_ice, zv_ice, zresr
-      REAL(wp),DIMENSION(jpi,jpj,2,2) :: &
-         zs11, zs12, zs22, zs21
-      !!-------------------------------------------------------------------
+
+!!bug
+!!    ui_oce(:,:) = 0.e0
+!!    vi_oce(:,:) = 0.e0
+!!    write(*,*) 'rhg min, max u & v', maxval(ui_oce), minval(ui_oce), maxval(vi_oce), minval(vi_oce)
+!!bug
       
       !  Store initial velocities
-      !  ------------------------
-      zu0(:,:) = u_ice(:,:)
-      zv0(:,:) = v_ice(:,:)
+      !  ----------------
+      zztms(:,0    ) = 0.e0       ;    zzfrld(:,0    ) = 0.e0
+      zztms(:,jpj+1) = 0.e0       ;    zzfrld(:,jpj+1) = 0.e0
+      zu0(:,0    ) = 0.e0         ;    zv0(:,0    ) = 0.e0
+      zu0(:,jpj+1) = 0.e0         ;    zv0(:,jpj+1) = 0.e0
+      zztms(:,1:jpj) = tms(:,:)   ;    zzfrld(:,1:jpj) = frld(:,:)
+      zu0(:,1:jpj) = ui_ice(:,:)   ;    zv0(:,1:jpj) = vi_ice(:,:)
+
+      zu_a(:,:)    = zu0(:,:)     ;   zv_a(:,:) = zv0(:,:)
+      zu_n(:,:)    = zu0(:,:)     ;   zv_n(:,:) = zv0(:,:)
+
+!i
+      zi1   (:,:) = 0.e0
+      zi2   (:,:) = 0.e0
+      zpresh(:,:) = 0.e0
+      zmasst(:,:) = 0.e0
+!i
+!!gm violant
+      zfrld(:,:) =0.e0
+      zcorl(:,:) =0.e0
+      zmass(:,:) =0.e0
+      za1ct(:,:) =0.e0
+      za2ct(:,:) =0.e0
+!!gm end
+
+      zviszeta(:,:) = 0.e0
+      zviseta (:,:) = 0.e0
+
+!i    zviszeta(:,0    ) = 0.e0    ;    zviseta(:,0    ) = 0.e0
+!i    zviszeta(:,jpj  ) = 0.e0    ;    zviseta(:,jpj  ) = 0.e0
+!i    zviszeta(:,jpj+1) = 0.e0    ;    zviseta(:,jpj+1) = 0.e0
+
 
       ! Ice mass, ice strength, and wind stress at the center            |
@@ -96,15 +135,16 @@
       !-------------------------------------------------------------------
 
+!CDIR NOVERRCHK
       DO jj = k_j1 , k_jpj-1
+!CDIR NOVERRCHK
          DO ji = 1 , jpi
-            za1(ji,jj)    = tms(ji,jj) * ( rhosn * hsnm(ji,jj) + rhoic * hicm(ji,jj) )
+            ! only the sinus changes its sign with the hemisphere
+            zsang(ji,jj)  = SIGN( 1.e0, fcor(ji,jj) ) * sangvg   ! only the sinus changes its sign with the hemisphere
+            !
+            zmasst(ji,jj) = tms(ji,jj) * ( rhosn * hsnm(ji,jj) + rhoic * hicm(ji,jj) )
             zpresh(ji,jj) = tms(ji,jj) *  pstarh * hicm(ji,jj) * EXP( -c_rhg * frld(ji,jj) )
-#if defined key_lim_cp1 && defined key_coupled
-            zb1(ji,jj)    = tms(ji,jj) * gtaux(ji,jj) * ( 1.0 - frld(ji,jj) )
-            zb2(ji,jj)    = tms(ji,jj) * gtauy(ji,jj) * ( 1.0 - frld(ji,jj) )
-#else
-            zb1(ji,jj)    = tms(ji,jj) * ( 1.0 - frld(ji,jj) )
-            zb2(ji,jj)    = tms(ji,jj) * ( 1.0 - frld(ji,jj) )
-#endif
+!!gm  :: stress given at I-point (F-point for the ocean) only compute the ponderation with the ice fraction (1-frld)
+            zi1(ji,jj)    = tms(ji,jj) * ( 1.0 - frld(ji,jj) )
+            zi2(ji,jj)    = tms(ji,jj) * ( 1.0 - frld(ji,jj) )
          END DO
       END DO
@@ -117,13 +157,13 @@
          
       DO jj = k_j1+1, k_jpj-1
-         DO ji = 2, jpi
-            zstms = tms(ji,jj  ) * wght(ji,jj,2,2) + tms(ji-1,jj  ) * wght(ji,jj,1,2)   &
-               &  + tms(ji,jj-1) * wght(ji,jj,2,1) + tms(ji-1,jj-1) * wght(ji,jj,1,1)
+         DO ji = fs_2, jpi
+            zstms = zztms(ji,jj  ) * wght(ji,jj,2,2) + zztms(ji-1,jj  ) * wght(ji,jj,1,2)   &
+               &  + zztms(ji,jj-1) * wght(ji,jj,2,1) + zztms(ji-1,jj-1) * wght(ji,jj,1,1)
             zusw  = 1.0 / MAX( zstms, epsd )
 
-            zt11 = tms(ji  ,jj  ) * frld(ji  ,jj  ) 
-            zt12 = tms(ji-1,jj  ) * frld(ji-1,jj  ) 
-            zt21 = tms(ji  ,jj-1) * frld(ji  ,jj-1) 
-            zt22 = tms(ji-1,jj-1) * frld(ji-1,jj-1)
+            zt11 = zztms(ji  ,jj  ) * zzfrld(ji  ,jj  ) 
+            zt12 = zztms(ji-1,jj  ) * zzfrld(ji-1,jj  ) 
+            zt21 = zztms(ji  ,jj-1) * zzfrld(ji  ,jj-1) 
+            zt22 = zztms(ji-1,jj-1) * zzfrld(ji-1,jj-1)
 
             ! Leads area.
@@ -131,21 +171,15 @@
                &             + zt21 * wght(ji,jj,2,1) + zt22 * wght(ji,jj,1,1) ) * zusw
 
-            ! Mass and coriolis coeff.
-            zmass(ji,jj) = ( za1(ji,jj  ) * wght(ji,jj,2,2) + za1(ji-1,jj  ) * wght(ji,jj,1,2)   &
-               &           + za1(ji,jj-1) * wght(ji,jj,2,1) + za1(ji-1,jj-1) * wght(ji,jj,1,1) ) * zusw
+            ! Mass and coriolis coeff. at I-point
+            zmass(ji,jj) = ( zmasst(ji,jj  ) * wght(ji,jj,2,2) + zmasst(ji-1,jj  ) * wght(ji,jj,1,2)   &
+               &           + zmasst(ji,jj-1) * wght(ji,jj,2,1) + zmasst(ji-1,jj-1) * wght(ji,jj,1,1) ) * zusw
             zcorl(ji,jj) = zmass(ji,jj) * fcor(ji,jj)
 
             ! Wind stress.
-#if defined key_lim_cp1 && defined key_coupled
-            ztagnx = ( zb1(ji,jj  ) * wght(ji,jj,2,2) + zb1(ji-1,jj  ) * wght(ji,jj,1,2)   &
-               &     + zb1(ji,jj-1) * wght(ji,jj,2,1) + zb1(ji-1,jj-1) * wght(ji,jj,1,1) ) * zusw
-            ztagny = ( zb2(ji,jj  ) * wght(ji,jj,2,2) + zb2(ji-1,jj  ) * wght(ji,jj,1,2)   &
-               &     + zb2(ji,jj-1) * wght(ji,jj,2,1) + zb2(ji-1,jj-1) * wght(ji,jj,1,1) ) * zusw
-#else
-            ztagnx = ( zb1(ji,jj  ) * wght(ji,jj,2,2) + zb1(ji-1,jj  ) * wght(ji,jj,1,2)   &
-               &     + zb1(ji,jj-1) * wght(ji,jj,2,1) + zb1(ji-1,jj-1) * wght(ji,jj,1,1) ) * zusw * gtaux(ji,jj)
-            ztagny = ( zb2(ji,jj  ) * wght(ji,jj,2,2) + zb2(ji-1,jj  ) * wght(ji,jj,1,2)   &
-               &     + zb2(ji,jj-1) * wght(ji,jj,2,1) + zb2(ji-1,jj-1) * wght(ji,jj,1,1) ) * zusw * gtauy(ji,jj)
-#endif
+            ! always provide stress at I-point (ocean F-point)
+            ztagnx = ( zi1(ji,jj  ) * wght(ji,jj,2,2) + zi1(ji-1,jj  ) * wght(ji,jj,1,2)   &
+               &     + zi1(ji,jj-1) * wght(ji,jj,2,1) + zi1(ji-1,jj-1) * wght(ji,jj,1,1) ) * zusw * utaui_ice(ji,jj)
+            ztagny = ( zi2(ji,jj  ) * wght(ji,jj,2,2) + zi2(ji-1,jj  ) * wght(ji,jj,1,2)   &
+               &     + zi2(ji,jj-1) * wght(ji,jj,2,1) + zi2(ji-1,jj-1) * wght(ji,jj,1,1) ) * zusw * vtaui_ice(ji,jj)
 
             ! Gradient of ice strength
@@ -161,13 +195,9 @@
 
             ! Computation of the velocity field taking into account the ice-ice interaction.                                 
-            ! Terms that are independent of the velocity field.
-            za1ct(ji,jj) = ztagnx - zcorl(ji,jj) * v_oce(ji,jj) - zgphsx
-            za2ct(ji,jj) = ztagny + zcorl(ji,jj) * u_oce(ji,jj) - zgphsy
+            ! Terms that are independent of the ice velocity field.
+            za1ct(ji,jj) = ztagnx - zcorl(ji,jj) * vi_oce(ji,jj) - zgphsx
+            za2ct(ji,jj) = ztagny + zcorl(ji,jj) * ui_oce(ji,jj) - zgphsy
          END DO
       END DO
-
-!! inutile!!
-!!??    CALL lbc_lnk( za1ct, 'I', -1. )
-!!??    CALL lbc_lnk( za2ct, 'I', -1. )
 
 
@@ -182,470 +212,357 @@
          ! Computation of free drift field for free slip boundary conditions.
 
-           DO jj = k_j1, k_jpj-1
-              DO ji = 1, jpim1
-                 !- Rate of strain tensor.
-                 zt11 =   akappa(ji,jj,1,1) * ( u_ice(ji+1,jj) + u_ice(ji+1,jj+1) - u_ice(ji,jj  ) - u_ice(ji  ,jj+1) )  &
-                    &   + akappa(ji,jj,1,2) * ( v_ice(ji+1,jj) + v_ice(ji+1,jj+1) + v_ice(ji,jj  ) + v_ice(ji  ,jj+1) )
-                 zt12 = - akappa(ji,jj,2,2) * ( u_ice(ji  ,jj) + u_ice(ji+1,jj  ) - u_ice(ji,jj+1) - u_ice(ji+1,jj+1) )  &
-                    &   - akappa(ji,jj,2,1) * ( v_ice(ji  ,jj) + v_ice(ji+1,jj  ) + v_ice(ji,jj+1) + v_ice(ji+1,jj+1) )
-                 zt22 = - akappa(ji,jj,2,2) * ( v_ice(ji  ,jj) + v_ice(ji+1,jj  ) - v_ice(ji,jj+1) - v_ice(ji+1,jj+1) )  &
-                    &   + akappa(ji,jj,2,1) * ( u_ice(ji  ,jj) + u_ice(ji+1,jj  ) + u_ice(ji,jj+1) + u_ice(ji+1,jj+1) )
-                 zt21 =   akappa(ji,jj,1,1) * ( v_ice(ji+1,jj) + v_ice(ji+1,jj+1) - v_ice(ji,jj  ) - v_ice(ji  ,jj+1) )  &
-                    &   - akappa(ji,jj,1,2) * ( u_ice(ji+1,jj) + u_ice(ji+1,jj+1) + u_ice(ji,jj  ) + u_ice(ji  ,jj+1) )
-
-                 !- Rate of strain tensor. 
-                 zdgp = zt11 + zt22
-                 zdgi = zt12 + zt21
-                 ztrace2 = zdgp * zdgp 
-                 zdeter  = zt11 * zt22 - 0.25 * zdgi * zdgi
-
-                 !  Creep limit depends on the size of the grid.
-                 zdelta = MAX( SQRT( ztrace2 + ( ztrace2 - 4.0 * zdeter ) * usecc2),  creepl)
-
-                 !-  Computation of viscosities.
-                 zviszeta(ji,jj) = MAX( zpresh(ji,jj) / zdelta, etamn )
-                 zviseta (ji,jj) = zviszeta(ji,jj) * usecc2
-              END DO
-           END DO
-!!??       CALL lbc_lnk( zviszeta, 'I', -1. )  ! or T point???   semble reellement inutile
-!!??       CALL lbc_lnk( zviseta , 'I', -1. )
-
-
-           !-  Determination of zc1u, zc2u, zc1v and zc2v.
-           DO jj = k_j1+1, k_jpj-1
-              DO ji = 2, jpim1
-                 ze11   =  akappa(ji-1,jj-1,1,1)
-                 ze12   = +akappa(ji-1,jj-1,2,2)
-                 ze22   =  akappa(ji-1,jj-1,2,1)
-                 ze21   = -akappa(ji-1,jj-1,1,2)
-                 zvis11 = 2.0 * zviseta (ji-1,jj-1) + dm
-                 zvis22 =       zviszeta(ji-1,jj-1) - zviseta(ji-1,jj-1)
-                 zvis12 =       zviseta (ji-1,jj-1) + dm
-                 zvis21 =       zviseta (ji-1,jj-1)
-
-                 zdiag = zvis22 * ( ze11 + ze22 )
-                 zs11(ji,jj,1,1) =  zvis11 * ze11 + zdiag
-                 zs12(ji,jj,1,1) =  zvis12 * ze12 + zvis21 * ze21
-                 zs22(ji,jj,1,1) =  zvis11 * ze22 + zdiag
-                 zs21(ji,jj,1,1) =  zvis12 * ze21 + zvis21 * ze12
-
-                 ze11   = -akappa(ji,jj-1,1,1)
-                 ze12   = +akappa(ji,jj-1,2,2)
-                 ze22   =  akappa(ji,jj-1,2,1)
-                 ze21   = -akappa(ji,jj-1,1,2)
-                 zvis11 = 2.0 * zviseta (ji,jj-1) + dm
-                 zvis22 =       zviszeta(ji,jj-1) - zviseta(ji,jj-1)
-                 zvis12 =       zviseta (ji,jj-1) + dm
-                 zvis21 =       zviseta (ji,jj-1)
-
-                 zdiag = zvis22 * ( ze11 + ze22 )
-                 zs11(ji,jj,2,1) =  zvis11 * ze11 + zdiag
-                 zs12(ji,jj,2,1) =  zvis12 * ze12 + zvis21 * ze21
-                 zs22(ji,jj,2,1) =  zvis11 * ze22 + zdiag
-                 zs21(ji,jj,2,1) =  zvis12 * ze21 + zvis21 * ze12
-
-                 ze11   =  akappa(ji-1,jj,1,1)
-                 ze12   = -akappa(ji-1,jj,2,2)
-                 ze22   =  akappa(ji-1,jj,2,1)
-                 ze21   = -akappa(ji-1,jj,1,2)
-                 zvis11 = 2.0 * zviseta (ji-1,jj) + dm
-                 zvis22 =       zviszeta(ji-1,jj) - zviseta(ji-1,jj)
-                 zvis12 =       zviseta (ji-1,jj) + dm
-                 zvis21 =       zviseta (ji-1,jj)
-
-                 zdiag = zvis22 * ( ze11 + ze22 ) 
-                 zs11(ji,jj,1,2) =  zvis11 * ze11 + zdiag
-                 zs12(ji,jj,1,2) =  zvis12 * ze12 + zvis21 * ze21
-                 zs22(ji,jj,1,2) =  zvis11 * ze22 + zdiag
-                 zs21(ji,jj,1,2) =  zvis12 * ze21 + zvis21 * ze12
-
-                 ze11   = -akappa(ji,jj,1,1)
-                 ze12   = -akappa(ji,jj,2,2)
-                 ze22   =  akappa(ji,jj,2,1)
-                 ze21   = -akappa(ji,jj,1,2)
-                 zvis11 = 2.0 * zviseta (ji,jj) + dm
-                 zvis22 =       zviszeta(ji,jj) - zviseta(ji,jj)
-                 zvis12 =       zviseta (ji,jj) + dm
-                 zvis21 =       zviseta (ji,jj)
-
-                 zdiag = zvis22 * ( ze11 + ze22 )
-                 zs11(ji,jj,2,2) =  zvis11 * ze11 + zdiag
-                 zs12(ji,jj,2,2) =  zvis12 * ze12 + zvis21 * ze21
-                 zs22(ji,jj,2,2) =  zvis11 * ze22 + zdiag 
-                 zs21(ji,jj,2,2) =  zvis12 * ze21 + zvis21 * ze12
-              END DO
-           END DO
-
-           DO jj = k_j1+1, k_jpj-1
-              DO ji = 2, jpim1
-                 zc1u(ji,jj) =   &
-                    + alambd(ji,jj,2,2,2,1) * zs11(ji,jj,2,1) + alambd(ji,jj,2,2,2,2) * zs11(ji,jj,2,2)   &
-                    - alambd(ji,jj,2,2,1,1) * zs11(ji,jj,1,1) - alambd(ji,jj,2,2,1,2) * zs11(ji,jj,1,2)   &
-                    - alambd(ji,jj,1,1,2,1) * zs12(ji,jj,2,1) - alambd(ji,jj,1,1,1,1) * zs12(ji,jj,1,1)   &
-                    + alambd(ji,jj,1,1,2,2) * zs12(ji,jj,2,2) + alambd(ji,jj,1,1,1,2) * zs12(ji,jj,1,2)   &
-                    + alambd(ji,jj,1,2,1,1) * zs21(ji,jj,1,1) + alambd(ji,jj,1,2,2,1) * zs21(ji,jj,2,1)   &
-                    + alambd(ji,jj,1,2,1,2) * zs21(ji,jj,1,2) + alambd(ji,jj,1,2,2,2) * zs21(ji,jj,2,2)   &
-                    - alambd(ji,jj,2,1,1,1) * zs22(ji,jj,1,1) - alambd(ji,jj,2,1,2,1) * zs22(ji,jj,2,1)   &
-                    - alambd(ji,jj,2,1,1,2) * zs22(ji,jj,1,2) - alambd(ji,jj,2,1,2,2) * zs22(ji,jj,2,2)
-                 
-                 zc2u(ji,jj) =   &
-                    + alambd(ji,jj,2,2,2,1) * zs21(ji,jj,2,1) + alambd(ji,jj,2,2,2,2) * zs21(ji,jj,2,2)   &
-                    - alambd(ji,jj,2,2,1,1) * zs21(ji,jj,1,1) - alambd(ji,jj,2,2,1,2) * zs21(ji,jj,1,2)   &
-                    - alambd(ji,jj,1,1,2,1) * zs22(ji,jj,2,1) - alambd(ji,jj,1,1,1,1) * zs22(ji,jj,1,1)   &
-                    + alambd(ji,jj,1,1,2,2) * zs22(ji,jj,2,2) + alambd(ji,jj,1,1,1,2) * zs22(ji,jj,1,2)   &
-                    - alambd(ji,jj,1,2,1,1) * zs11(ji,jj,1,1) - alambd(ji,jj,1,2,2,1) * zs11(ji,jj,2,1)   &
-                    - alambd(ji,jj,1,2,1,2) * zs11(ji,jj,1,2) - alambd(ji,jj,1,2,2,2) * zs11(ji,jj,2,2)   &
-                    + alambd(ji,jj,2,1,1,1) * zs12(ji,jj,1,1) + alambd(ji,jj,2,1,2,1) * zs12(ji,jj,2,1)   &
-                    + alambd(ji,jj,2,1,1,2) * zs12(ji,jj,1,2) + alambd(ji,jj,2,1,2,2) * zs12(ji,jj,2,2)
-             END DO
-           END DO
-
-           DO jj = k_j1+1, k_jpj-1
-              DO ji = 2, jpim1
-                 !  zc1v , zc2v.
-                 ze11   =  akappa(ji-1,jj-1,1,2)
-                 ze12   = -akappa(ji-1,jj-1,2,1)
-                 ze22   = +akappa(ji-1,jj-1,2,2)
-                 ze21   =  akappa(ji-1,jj-1,1,1)
-                 zvis11 = 2.0 * zviseta (ji-1,jj-1) + dm
-                 zvis22 =       zviszeta(ji-1,jj-1) - zviseta(ji-1,jj-1)
-                 zvis12 =       zviseta (ji-1,jj-1) + dm
-                 zvis21 =       zviseta (ji-1,jj-1)
-
-                 zdiag = zvis22 * ( ze11 + ze22 )
-                 zs11(ji,jj,1,1) =  zvis11 * ze11 + zdiag
-                 zs12(ji,jj,1,1) =  zvis12 * ze12 + zvis21 * ze21
-                 zs22(ji,jj,1,1) =  zvis11 * ze22 + zdiag
-                 zs21(ji,jj,1,1) =  zvis12 * ze21 + zvis21 * ze12
+!CDIR NOVERRCHK
+         DO jj = k_j1, k_jpj-1
+!CDIR NOVERRCHK
+            DO ji = 1, fs_jpim1
+               !- Rate of strain tensor.
+               zt11 =   akappa(ji,jj,1,1) * ( zu_a(ji+1,jj) + zu_a(ji+1,jj+1) - zu_a(ji,jj  ) - zu_a(ji  ,jj+1) )  &
+                  &   + akappa(ji,jj,1,2) * ( zv_a(ji+1,jj) + zv_a(ji+1,jj+1) + zv_a(ji,jj  ) + zv_a(ji  ,jj+1) )
+               zt12 = - akappa(ji,jj,2,2) * ( zu_a(ji  ,jj) + zu_a(ji+1,jj  ) - zu_a(ji,jj+1) - zu_a(ji+1,jj+1) )  &
+                  &   - akappa(ji,jj,2,1) * ( zv_a(ji  ,jj) + zv_a(ji+1,jj  ) + zv_a(ji,jj+1) + zv_a(ji+1,jj+1) )
+               zt22 = - akappa(ji,jj,2,2) * ( zv_a(ji  ,jj) + zv_a(ji+1,jj  ) - zv_a(ji,jj+1) - zv_a(ji+1,jj+1) )  &
+                  &   + akappa(ji,jj,2,1) * ( zu_a(ji  ,jj) + zu_a(ji+1,jj  ) + zu_a(ji,jj+1) + zu_a(ji+1,jj+1) )
+               zt21 =   akappa(ji,jj,1,1) * ( zv_a(ji+1,jj) + zv_a(ji+1,jj+1) - zv_a(ji,jj  ) - zv_a(ji  ,jj+1) )  &
+                  &   - akappa(ji,jj,1,2) * ( zu_a(ji+1,jj) + zu_a(ji+1,jj+1) + zu_a(ji,jj  ) + zu_a(ji  ,jj+1) )
+
+               !- Rate of strain tensor. 
+               zdgp = zt11 + zt22
+               zdgi = zt12 + zt21
+               ztrace2 = zdgp * zdgp 
+               zdeter  = zt11 * zt22 - 0.25 * zdgi * zdgi
+
+               !  Creep limit depends on the size of the grid.
+               zdelta = MAX( SQRT( ztrace2 + ( ztrace2 - 4.0 * zdeter ) * usecc2 ),  creepl)
+
+               !-  Computation of viscosities.
+               zviszeta(ji,jj) = MAX( zpresh(ji,jj) / zdelta, etamn )
+               zviseta (ji,jj) = zviszeta(ji,jj) * usecc2
+            END DO
+         END DO
+
+         !-  Determination of zc1u, zc2u, zc1v and zc2v.
+         DO jj = k_j1+1, k_jpj-1
+            DO ji = fs_2, fs_jpim1
+               !* zc1u , zc2v
+               zvis11 = 2.0 * zviseta (ji-1,jj-1) + dm
+               zvis12 =       zviseta (ji-1,jj-1) + dm
+               zvis21 =       zviseta (ji-1,jj-1)
+               zvis22 =       zviszeta(ji-1,jj-1) - zviseta(ji-1,jj-1)
+               zdiag  = zvis22 * ( akappa(ji-1,jj-1,1,1) + akappa(ji-1,jj-1,2,1) )
+               zs11_11 =  zvis11 * akappa(ji-1,jj-1,1,1) + zdiag
+               zs12_11 =  zvis12 * akappa(ji-1,jj-1,2,2) - zvis21 * akappa(ji-1,jj-1,1,2)
+               zs21_11 = -zvis12 * akappa(ji-1,jj-1,1,2) + zvis21 * akappa(ji-1,jj-1,2,2)
+               zs22_11 =  zvis11 * akappa(ji-1,jj-1,2,1) + zdiag
+
+               zvis11 = 2.0 * zviseta (ji,jj-1) + dm
+               zvis22 =       zviszeta(ji,jj-1) - zviseta(ji,jj-1)
+               zvis12 =       zviseta (ji,jj-1) + dm
+               zvis21 =       zviseta (ji,jj-1)
+               zdiag = zvis22 * ( -akappa(ji,jj-1,1,1) + akappa(ji,jj-1,2,1) )
+               zs11_21 = -zvis11 * akappa(ji,jj-1,1,1) + zdiag
+               zs12_21 =  zvis12 * akappa(ji,jj-1,2,2) - zvis21 * akappa(ji,jj-1,1,2)
+               zs22_21 =  zvis11 * akappa(ji,jj-1,2,1) + zdiag
+               zs21_21 = -zvis12 * akappa(ji,jj-1,1,2) + zvis21 * akappa(ji,jj-1,2,2)
+
+               zvis11 = 2.0 * zviseta (ji-1,jj) + dm
+               zvis22 =       zviszeta(ji-1,jj) - zviseta(ji-1,jj)
+               zvis12 =       zviseta (ji-1,jj) + dm
+               zvis21 =       zviseta (ji-1,jj)
+               zdiag = zvis22 * ( akappa(ji-1,jj,1,1) + akappa(ji-1,jj,2,1) )
+               zs11_12 =  zvis11 * akappa(ji-1,jj,1,1) + zdiag
+               zs12_12 = -zvis12 * akappa(ji-1,jj,2,2) - zvis21 * akappa(ji-1,jj,1,2)
+               zs22_12 =  zvis11 * akappa(ji-1,jj,2,1) + zdiag
+               zs21_12 = -zvis12 * akappa(ji-1,jj,1,2) - zvis21 * akappa(ji-1,jj,2,2)
+
+               zvis11 = 2.0 * zviseta (ji,jj) + dm
+               zvis22 =       zviszeta(ji,jj) - zviseta(ji,jj)
+               zvis12 =       zviseta (ji,jj) + dm
+               zvis21 =       zviseta (ji,jj)
+               zdiag = zvis22 * ( -akappa(ji,jj,1,1) + akappa(ji,jj,2,1) )
+               zs11_22 = -zvis11 * akappa(ji,jj,1,1) + zdiag
+               zs12_22 = -zvis12 * akappa(ji,jj,2,2) - zvis21 * akappa(ji,jj,1,2)
+               zs22_22 =  zvis11 * akappa(ji,jj,2,1) + zdiag
+               zs21_22 = -zvis12 * akappa(ji,jj,1,2) - zvis21 * akappa(ji,jj,2,2)
+
+               zc1u(ji,jj) = + alambd(ji,jj,2,2,2,1) * zs11_21 + alambd(ji,jj,2,2,2,2) * zs11_22   &
+                  &          - alambd(ji,jj,2,2,1,1) * zs11_11 - alambd(ji,jj,2,2,1,2) * zs11_12   &
+                  &          - alambd(ji,jj,1,1,2,1) * zs12_21 - alambd(ji,jj,1,1,1,1) * zs12_11   &
+                  &          + alambd(ji,jj,1,1,2,2) * zs12_22 + alambd(ji,jj,1,1,1,2) * zs12_12   &
+                  &          + alambd(ji,jj,1,2,1,1) * zs21_11 + alambd(ji,jj,1,2,2,1) * zs21_21   &
+                  &          + alambd(ji,jj,1,2,1,2) * zs21_12 + alambd(ji,jj,1,2,2,2) * zs21_22   &
+                  &          - alambd(ji,jj,2,1,1,1) * zs22_11 - alambd(ji,jj,2,1,2,1) * zs22_21   &
+                  &          - alambd(ji,jj,2,1,1,2) * zs22_12 - alambd(ji,jj,2,1,2,2) * zs22_22
+
+               zc2u(ji,jj) = + alambd(ji,jj,2,2,2,1) * zs21_21 + alambd(ji,jj,2,2,2,2) * zs21_22   &
+                  &          - alambd(ji,jj,2,2,1,1) * zs21_11 - alambd(ji,jj,2,2,1,2) * zs21_12   &
+                  &          - alambd(ji,jj,1,1,2,1) * zs22_21 - alambd(ji,jj,1,1,1,1) * zs22_11   &
+                  &          + alambd(ji,jj,1,1,2,2) * zs22_22 + alambd(ji,jj,1,1,1,2) * zs22_12   &
+                  &          - alambd(ji,jj,1,2,1,1) * zs11_11 - alambd(ji,jj,1,2,2,1) * zs11_21   &
+                  &          - alambd(ji,jj,1,2,1,2) * zs11_12 - alambd(ji,jj,1,2,2,2) * zs11_22   &
+                  &          + alambd(ji,jj,2,1,1,1) * zs12_11 + alambd(ji,jj,2,1,2,1) * zs12_21   &
+                  &          + alambd(ji,jj,2,1,1,2) * zs12_12 + alambd(ji,jj,2,1,2,2) * zs12_22
+
+               !* zc1v , zc2v.
+               zvis11 = 2.0 * zviseta (ji-1,jj-1) + dm
+               zvis22 =       zviszeta(ji-1,jj-1) - zviseta(ji-1,jj-1)
+               zvis12 =       zviseta (ji-1,jj-1) + dm
+               zvis21 =       zviseta (ji-1,jj-1)
+               zdiag = zvis22 * ( akappa(ji-1,jj-1,1,2) + akappa(ji-1,jj-1,2,2) )
+               zs11_11 =  zvis11 * akappa(ji-1,jj-1,1,2) + zdiag
+               zs12_11 = -zvis12 * akappa(ji-1,jj-1,2,1) + zvis21 * akappa(ji-1,jj-1,1,1)
+               zs22_11 =  zvis11 * akappa(ji-1,jj-1,2,2) + zdiag
+               zs21_11 =  zvis12 * akappa(ji-1,jj-1,1,1) - zvis21 * akappa(ji-1,jj-1,2,1)
  
-                 ze11   =  akappa(ji,jj-1,1,2)
-                 ze12   = -akappa(ji,jj-1,2,1)
-                 ze22   = +akappa(ji,jj-1,2,2)
-                 ze21   = -akappa(ji,jj-1,1,1)
-                 zvis11 = 2.0 * zviseta (ji,jj-1) + dm
-                 zvis22 =       zviszeta(ji,jj-1) - zviseta(ji,jj-1)
-                 zvis12 =       zviseta (ji,jj-1) + dm
-                 zvis21 =       zviseta (ji,jj-1)
-
-                 zdiag = zvis22 * ( ze11 + ze22 )
-                 zs11(ji,jj,2,1) =  zvis11 * ze11 + zdiag
-                 zs12(ji,jj,2,1) =  zvis12 * ze12 + zvis21 * ze21
-                 zs22(ji,jj,2,1) =  zvis11 * ze22 + zdiag
-                 zs21(ji,jj,2,1) =  zvis12 * ze21 + zvis21 * ze12
-
-                 ze11   =  akappa(ji-1,jj,1,2)
-                 ze12   = -akappa(ji-1,jj,2,1)
-                 ze22   = -akappa(ji-1,jj,2,2)
-                 ze21   =  akappa(ji-1,jj,1,1)
-                 zvis11 = 2.0 * zviseta (ji-1,jj) + dm
-                 zvis22 =       zviszeta(ji-1,jj) - zviseta(ji-1,jj)
-                 zvis12 =       zviseta (ji-1,jj) + dm
-                 zvis21 =       zviseta (ji-1,jj)
-
-                 zdiag = zvis22 * ( ze11 + ze22 )
-                 zs11(ji,jj,1,2) =  zvis11 * ze11 + zdiag
-                 zs12(ji,jj,1,2) =  zvis12 * ze12 + zvis21 * ze21
-                 zs22(ji,jj,1,2) =  zvis11 * ze22 + zdiag
-                 zs21(ji,jj,1,2) =  zvis12 * ze21 + zvis21 * ze12
-
-                 ze11   =  akappa(ji,jj,1,2)
-                 ze12   = -akappa(ji,jj,2,1)
-                 ze22   = -akappa(ji,jj,2,2)
-                 ze21   = -akappa(ji,jj,1,1)
-                 zvis11 = 2.0 * zviseta (ji,jj) + dm
-                 zvis22 =       zviszeta(ji,jj) - zviseta(ji,jj)
-                 zvis12 =       zviseta (ji,jj) + dm
-                 zvis21 =       zviseta (ji,jj)
-
-                 zdiag = zvis22 * ( ze11 + ze22 )
-                 zs11(ji,jj,2,2) =  zvis11 * ze11 + zdiag
-                 zs12(ji,jj,2,2) =  zvis12 * ze12 + zvis21 * ze21
-                 zs22(ji,jj,2,2) =  zvis11 * ze22 + zdiag
-                 zs21(ji,jj,2,2) =  zvis12 * ze21 + zvis21 * ze12
-
-              END DO
-           END DO
-
-           DO jj = k_j1+1, k_jpj-1
-              DO ji = 2, jpim1
-                 zc1v(ji,jj) =   &
-                    + alambd(ji,jj,2,2,2,1) * zs11(ji,jj,2,1) + alambd(ji,jj,2,2,2,2) * zs11(ji,jj,2,2)   &
-                    - alambd(ji,jj,2,2,1,1) * zs11(ji,jj,1,1) - alambd(ji,jj,2,2,1,2) * zs11(ji,jj,1,2)   &
-                    - alambd(ji,jj,1,1,2,1) * zs12(ji,jj,2,1) - alambd(ji,jj,1,1,1,1) * zs12(ji,jj,1,1)   &
-                    + alambd(ji,jj,1,1,2,2) * zs12(ji,jj,2,2) + alambd(ji,jj,1,1,1,2) * zs12(ji,jj,1,2)   &
-                    + alambd(ji,jj,1,2,1,1) * zs21(ji,jj,1,1) + alambd(ji,jj,1,2,2,1) * zs21(ji,jj,2,1)   &
-                    + alambd(ji,jj,1,2,1,2) * zs21(ji,jj,1,2) + alambd(ji,jj,1,2,2,2) * zs21(ji,jj,2,2)   &
-                    - alambd(ji,jj,2,1,1,1) * zs22(ji,jj,1,1) - alambd(ji,jj,2,1,2,1) * zs22(ji,jj,2,1)   &
-                    - alambd(ji,jj,2,1,1,2) * zs22(ji,jj,1,2) - alambd(ji,jj,2,1,2,2) * zs22(ji,jj,2,2)
-                 zc2v(ji,jj) =   &
-                    + alambd(ji,jj,2,2,2,1) * zs21(ji,jj,2,1) + alambd(ji,jj,2,2,2,2) * zs21(ji,jj,2,2)   &
-                    - alambd(ji,jj,2,2,1,1) * zs21(ji,jj,1,1) - alambd(ji,jj,2,2,1,2) * zs21(ji,jj,1,2)   &
-                    - alambd(ji,jj,1,1,2,1) * zs22(ji,jj,2,1) - alambd(ji,jj,1,1,1,1) * zs22(ji,jj,1,1)   &
-                    + alambd(ji,jj,1,1,2,2) * zs22(ji,jj,2,2) + alambd(ji,jj,1,1,1,2) * zs22(ji,jj,1,2)   &
-                    - alambd(ji,jj,1,2,1,1) * zs11(ji,jj,1,1) - alambd(ji,jj,1,2,2,1) * zs11(ji,jj,2,1)   &
-                    - alambd(ji,jj,1,2,1,2) * zs11(ji,jj,1,2) - alambd(ji,jj,1,2,2,2) * zs11(ji,jj,2,2)   &
-                    + alambd(ji,jj,2,1,1,1) * zs12(ji,jj,1,1) + alambd(ji,jj,2,1,2,1) * zs12(ji,jj,2,1)   &
-                    + alambd(ji,jj,2,1,1,2) * zs12(ji,jj,1,2) + alambd(ji,jj,2,1,2,2) * zs12(ji,jj,2,2)
-              END DO
-           END DO
-
-         ! Relaxation.
-           
-iflag:   DO jter = 1 , nbitdr
-
-            !  Store previous drift field.   
-            DO jj = k_j1, k_jpj-1
-               zu_ice(:,jj) = u_ice(:,jj)
-               zv_ice(:,jj) = v_ice(:,jj)
+               zvis11 = 2.0 * zviseta (ji,jj-1) + dm
+               zvis22 =       zviszeta(ji,jj-1) - zviseta(ji,jj-1)
+               zvis12 =       zviseta (ji,jj-1) + dm
+               zvis21 =       zviseta (ji,jj-1)
+               zdiag = zvis22 * ( akappa(ji,jj-1,1,2) + akappa(ji,jj-1,2,2) )
+               zs11_21 =  zvis11 * akappa(ji,jj-1,1,2) + zdiag
+               zs12_21 = -zvis12 * akappa(ji,jj-1,2,1) - zvis21 * akappa(ji,jj-1,1,1)
+               zs22_21 =  zvis11 * akappa(ji,jj-1,2,2) + zdiag
+               zs21_21 = -zvis12 * akappa(ji,jj-1,1,1) - zvis21 * akappa(ji,jj-1,2,1)
+
+               zvis11 = 2.0 * zviseta (ji-1,jj) + dm
+               zvis22 =       zviszeta(ji-1,jj) - zviseta(ji-1,jj)
+               zvis12 =       zviseta (ji-1,jj) + dm
+               zvis21 =       zviseta (ji-1,jj)
+               zdiag = zvis22 * ( akappa(ji-1,jj,1,2) - akappa(ji-1,jj,2,2) )
+               zs11_12 =  zvis11 * akappa(ji-1,jj,1,2) + zdiag
+               zs12_12 = -zvis12 * akappa(ji-1,jj,2,1) + zvis21 * akappa(ji-1,jj,1,1)
+               zs22_12 = -zvis11 * akappa(ji-1,jj,2,2) + zdiag
+               zs21_12 =  zvis12 * akappa(ji-1,jj,1,1) - zvis21 * akappa(ji-1,jj,2,1)
+
+               zvis11 = 2.0 * zviseta (ji,jj) + dm
+               zvis22 =       zviszeta(ji,jj) - zviseta(ji,jj)
+               zvis12 =       zviseta (ji,jj) + dm
+               zvis21 =       zviseta (ji,jj)
+               zdiag = zvis22 * ( akappa(ji,jj,1,2) - akappa(ji,jj,2,2) )
+               zs11_22 =  zvis11 * akappa(ji,jj,1,2) + zdiag
+               zs12_22 = -zvis12 * akappa(ji,jj,2,1) - zvis21 * akappa(ji,jj,1,1)
+               zs22_22 = -zvis11 * akappa(ji,jj,2,2) + zdiag
+               zs21_22 = -zvis12 * akappa(ji,jj,1,1) - zvis21 * akappa(ji,jj,2,1)
+
+               zc1v(ji,jj) = + alambd(ji,jj,2,2,2,1) * zs11_21 + alambd(ji,jj,2,2,2,2) * zs11_22   &
+                  &          - alambd(ji,jj,2,2,1,1) * zs11_11 - alambd(ji,jj,2,2,1,2) * zs11_12   &
+                  &          - alambd(ji,jj,1,1,2,1) * zs12_21 - alambd(ji,jj,1,1,1,1) * zs12_11   &
+                  &          + alambd(ji,jj,1,1,2,2) * zs12_22 + alambd(ji,jj,1,1,1,2) * zs12_12   &
+                  &          + alambd(ji,jj,1,2,1,1) * zs21_11 + alambd(ji,jj,1,2,2,1) * zs21_21   &
+                  &          + alambd(ji,jj,1,2,1,2) * zs21_12 + alambd(ji,jj,1,2,2,2) * zs21_22   &
+                  &          - alambd(ji,jj,2,1,1,1) * zs22_11 - alambd(ji,jj,2,1,2,1) * zs22_21   &
+                  &          - alambd(ji,jj,2,1,1,2) * zs22_12 - alambd(ji,jj,2,1,2,2) * zs22_22
+
+               zc2v(ji,jj) = + alambd(ji,jj,2,2,2,1) * zs21_21 + alambd(ji,jj,2,2,2,2) * zs21_22   &
+                  &          - alambd(ji,jj,2,2,1,1) * zs21_11 - alambd(ji,jj,2,2,1,2) * zs21_12   &
+                  &          - alambd(ji,jj,1,1,2,1) * zs22_21 - alambd(ji,jj,1,1,1,1) * zs22_11   &
+                  &          + alambd(ji,jj,1,1,2,2) * zs22_22 + alambd(ji,jj,1,1,1,2) * zs22_12   &
+                  &          - alambd(ji,jj,1,2,1,1) * zs11_11 - alambd(ji,jj,1,2,2,1) * zs11_21   &
+                  &          - alambd(ji,jj,1,2,1,2) * zs11_12 - alambd(ji,jj,1,2,2,2) * zs11_22   &
+                  &          + alambd(ji,jj,2,1,1,1) * zs12_11 + alambd(ji,jj,2,1,2,1) * zs12_21   &
+                  &          + alambd(ji,jj,2,1,1,2) * zs12_12 + alambd(ji,jj,2,1,2,2) * zs12_22
             END DO
-
+         END DO
+
+         ! GAUSS-SEIDEL method
+         !                                                      ! ================ !
+iflag:   DO jter = 1 , nbitdr                                   !    Relaxation    !
+            !                                                   ! ================ !
+!CDIR NOVERRCHK
             DO jj = k_j1+1, k_jpj-1
-               zsang  = SIGN( 1.e0, fcor(1,jj) ) * sangvg   ! only the sinus changes its sign with the hemisphere
-               DO ji = 2, jpim1
-                 zur     = u_ice(ji,jj) - u_oce(ji,jj)
-                 zvr     = v_ice(ji,jj) - v_oce(ji,jj)
-                 zmod    = SQRT( zur * zur + zvr * zvr) * ( 1.0 - zfrld(ji,jj) )
-                 za      = rhoco * zmod
-                 zac     = za * cangvg
-                  zmpzas  = alpha * zcorl(ji,jj) + za * zsang
+!CDIR NOVERRCHK
+               DO ji = fs_2, fs_jpim1
+                  !
+                  ze11 =   akappa(ji,jj-1,1,1) * zu_a(ji+1,jj) + akappa(ji,jj-1,1,2) * zv_a(ji+1,jj)
+                  ze12 = + akappa(ji,jj-1,2,2) * zu_a(ji+1,jj) - akappa(ji,jj-1,2,1) * zv_a(ji+1,jj)
+                  ze22 = + akappa(ji,jj-1,2,2) * zv_a(ji+1,jj) + akappa(ji,jj-1,2,1) * zu_a(ji+1,jj)
+                  ze21 =   akappa(ji,jj-1,1,1) * zv_a(ji+1,jj) - akappa(ji,jj-1,1,2) * zu_a(ji+1,jj)
+                  zvis11 = 2.0 * zviseta (ji,jj-1) + dm
+                  zvis22 =       zviszeta(ji,jj-1) - zviseta(ji,jj-1)
+                  zvis12 =       zviseta (ji,jj-1) + dm
+                  zvis21 =       zviseta (ji,jj-1)
+                  zdiag = zvis22 * ( ze11 + ze22 )
+                  zs11_21 =  zvis11 * ze11 + zdiag
+                  zs12_21 =  zvis12 * ze12 + zvis21 * ze21
+                  zs22_21 =  zvis11 * ze22 + zdiag
+                  zs21_21 =  zvis12 * ze21 + zvis21 * ze12
+
+                  ze11 =   akappa(ji-1,jj,1,1) * ( zu_a(ji  ,jj+1) - zu_a(ji-1,jj+1) )   &
+                     &   + akappa(ji-1,jj,1,2) * ( zv_a(ji  ,jj+1) + zv_a(ji-1,jj+1) )
+                  ze12 = + akappa(ji-1,jj,2,2) * ( zu_a(ji-1,jj+1) + zu_a(ji  ,jj+1) )   &
+                     &   - akappa(ji-1,jj,2,1) * ( zv_a(ji-1,jj+1) + zv_a(ji  ,jj+1) )
+                  ze22 = + akappa(ji-1,jj,2,2) * ( zv_a(ji-1,jj+1) + zv_a(ji  ,jj+1) )   &
+                     &   + akappa(ji-1,jj,2,1) * ( zu_a(ji-1,jj+1) + zu_a(ji  ,jj+1) )
+                  ze21 =   akappa(ji-1,jj,1,1) * ( zv_a(ji  ,jj+1) - zv_a(ji-1,jj+1) )   &
+                     &   - akappa(ji-1,jj,1,2) * ( zu_a(ji  ,jj+1) + zu_a(ji-1,jj+1) )
+                  zvis11 = 2.0 * zviseta (ji-1,jj) + dm
+                  zvis22 =       zviszeta(ji-1,jj) - zviseta(ji-1,jj)
+                  zvis12 =       zviseta (ji-1,jj) + dm
+                  zvis21 =       zviseta (ji-1,jj)
+                  zdiag = zvis22 * ( ze11 + ze22 )
+                  zs11_12 =  zvis11 * ze11 + zdiag
+                  zs12_12 =  zvis12 * ze12 + zvis21 * ze21
+                  zs22_12 =  zvis11 * ze22 + zdiag
+                  zs21_12 =  zvis12 * ze21 + zvis21 * ze12
+
+                  ze11 =   akappa(ji,jj,1,1) * ( zu_a(ji+1,jj) + zu_a(ji+1,jj+1) - zu_a(ji  ,jj+1) )   &
+                     &   + akappa(ji,jj,1,2) * ( zv_a(ji+1,jj) + zv_a(ji+1,jj+1) + zv_a(ji  ,jj+1) )
+                  ze12 = - akappa(ji,jj,2,2) * ( zu_a(ji+1,jj) - zu_a(ji  ,jj+1) - zu_a(ji+1,jj+1) )   &
+                     &   - akappa(ji,jj,2,1) * ( zv_a(ji+1,jj) + zv_a(ji  ,jj+1) + zv_a(ji+1,jj+1) )
+                  ze22 = - akappa(ji,jj,2,2) * ( zv_a(ji+1,jj) - zv_a(ji  ,jj+1) - zv_a(ji+1,jj+1) )   &
+                     &   + akappa(ji,jj,2,1) * ( zu_a(ji+1,jj) + zu_a(ji  ,jj+1) + zu_a(ji+1,jj+1) )
+                  ze21 =   akappa(ji,jj,1,1) * ( zv_a(ji+1,jj) + zv_a(ji+1,jj+1) - zv_a(ji  ,jj+1) )   &
+                     &   - akappa(ji,jj,1,2) * ( zu_a(ji+1,jj) + zu_a(ji+1,jj+1) + zu_a(ji  ,jj+1) )
+                  zvis11 = 2.0 * zviseta (ji,jj) + dm
+                  zvis22 =       zviszeta(ji,jj) - zviseta(ji,jj)
+                  zvis12 =       zviseta (ji,jj) + dm
+                  zvis21 =       zviseta (ji,jj)
+                  zdiag = zvis22 * ( ze11 + ze22 )
+                  zs11_22 =  zvis11 * ze11 + zdiag
+                  zs12_22 =  zvis12 * ze12 + zvis21 * ze21
+                  zs22_22 =  zvis11 * ze22 + zdiag
+                  zs21_22 =  zvis12 * ze21 + zvis21 * ze12
+
+            ! 2nd part
+                  ze11 =   akappa(ji-1,jj-1,1,1) * ( zu_a(ji  ,jj-1) - zu_a(ji-1,jj-1) - zu_a(ji-1,jj) )   &
+                     &   + akappa(ji-1,jj-1,1,2) * ( zv_a(ji  ,jj-1) + zv_a(ji-1,jj-1) + zv_a(ji-1,jj) )
+                  ze12 = - akappa(ji-1,jj-1,2,2) * ( zu_a(ji-1,jj-1) + zu_a(ji  ,jj-1) - zu_a(ji-1,jj) )   &
+                     &   - akappa(ji-1,jj-1,2,1) * ( zv_a(ji-1,jj-1) + zv_a(ji  ,jj-1) + zv_a(ji-1,jj) )
+                  ze22 = - akappa(ji-1,jj-1,2,2) * ( zv_a(ji-1,jj-1) + zv_a(ji  ,jj-1) - zv_a(ji-1,jj) )   &
+                     &   + akappa(ji-1,jj-1,2,1) * ( zu_a(ji-1,jj-1) + zu_a(ji  ,jj-1) + zu_a(ji-1,jj) )
+                  ze21 =   akappa(ji-1,jj-1,1,1) * ( zv_a(ji  ,jj-1) - zv_a(ji-1,jj-1) - zv_a(ji-1,jj) )   &
+                     &  -  akappa(ji-1,jj-1,1,2) * ( zu_a(ji  ,jj-1) + zu_a(ji-1,jj-1) + zu_a(ji-1,jj) )
+                  zvis11 = 2.0 * zviseta (ji-1,jj-1) + dm
+                  zvis22 =       zviszeta(ji-1,jj-1) - zviseta(ji-1,jj-1)
+                  zvis12 =       zviseta (ji-1,jj-1) + dm
+                  zvis21 =       zviseta (ji-1,jj-1)
+                  zdiag = zvis22 * ( ze11 + ze22 )
+                  zs11_11 =  zvis11 * ze11 + zdiag
+                  zs12_11 =  zvis12 * ze12 + zvis21 * ze21
+                  zs22_11 =  zvis11 * ze22 + zdiag
+                  zs21_11 =  zvis12 * ze21 + zvis21 * ze12
+
+                  ze11 =   akappa(ji,jj-1,1,1) * ( zu_a(ji+1,jj-1) - zu_a(ji  ,jj-1) )   &
+                     &   + akappa(ji,jj-1,1,2) * ( zv_a(ji+1,jj-1) + zv_a(ji  ,jj-1) )
+                  ze12 = - akappa(ji,jj-1,2,2) * ( zu_a(ji  ,jj-1) + zu_a(ji+1,jj-1) )   &
+                     &   - akappa(ji,jj-1,2,1) * ( zv_a(ji  ,jj-1) + zv_a(ji+1,jj-1) )
+                  ze22 = - akappa(ji,jj-1,2,2) * ( zv_a(ji  ,jj-1) + zv_a(ji+1,jj-1) )   &
+                     &   + akappa(ji,jj-1,2,1) * ( zu_a(ji  ,jj-1) + zu_a(ji+1,jj-1) )
+                  ze21 =   akappa(ji,jj-1,1,1) * ( zv_a(ji+1,jj-1) - zv_a(ji  ,jj-1) )   &
+                     &   - akappa(ji,jj-1,1,2) * ( zu_a(ji+1,jj-1) + zu_a(ji  ,jj-1) )
+                  zvis11 = 2.0 * zviseta (ji,jj-1) + dm
+                  zvis22 =       zviszeta(ji,jj-1) - zviseta(ji,jj-1)
+                  zvis12 =       zviseta (ji,jj-1) + dm
+                  zvis21 =       zviseta (ji,jj-1)
+                  zdiag = zvis22 * ( ze11 + ze22 )
+                  zs11_21 =  zs11_21 + zvis11 * ze11 + zdiag
+                  zs12_21 =  zs12_21 + zvis12 * ze12 + zvis21 * ze21
+                  zs22_21 =  zs22_21 + zvis11 * ze22 + zdiag
+                  zs21_21 =  zs21_21 + zvis12 * ze21 + zvis21 * ze12
+
+                  ze11 = - akappa(ji-1,jj,1,1) * zu_a(ji-1,jj) + akappa(ji-1,jj,1,2) * zv_a(ji-1,jj)
+                  ze12 = - akappa(ji-1,jj,2,2) * zu_a(ji-1,jj) - akappa(ji-1,jj,2,1) * zv_a(ji-1,jj)
+                  ze22 = - akappa(ji-1,jj,2,2) * zv_a(ji-1,jj) + akappa(ji-1,jj,2,1) * zu_a(ji-1,jj)
+                  ze21 = - akappa(ji-1,jj,1,1) * zv_a(ji-1,jj) - akappa(ji-1,jj,1,2) * zu_a(ji-1,jj)
+                  zvis11 = 2.0 * zviseta (ji-1,jj) + dm
+                  zvis22 =       zviszeta(ji-1,jj) - zviseta(ji-1,jj)
+                  zvis12 =       zviseta (ji-1,jj) + dm
+                  zvis21 =       zviseta (ji-1,jj)
+                  zdiag = zvis22 * ( ze11 + ze22 )
+                  zs11_12 =  zs11_12 + zvis11 * ze11 + zdiag
+                  zs12_12 =  zs12_12 + zvis12 * ze12 + zvis21 * ze21
+                  zs22_12 =  zs22_12 + zvis11 * ze22 + zdiag
+                  zs21_12 =  zs21_12 + zvis12 * ze21 + zvis21 * ze12
+
+                  zd1 = + alambd(ji,jj,2,2,2,1) * zs11_21 + alambd(ji,jj,2,2,2,2) * zs11_22  &
+                     &  - alambd(ji,jj,2,2,1,1) * zs11_11 - alambd(ji,jj,2,2,1,2) * zs11_12  &
+                     &  - alambd(ji,jj,1,1,2,1) * zs12_21 - alambd(ji,jj,1,1,1,1) * zs12_11  &
+                     &  + alambd(ji,jj,1,1,2,2) * zs12_22 + alambd(ji,jj,1,1,1,2) * zs12_12  &
+                     &  + alambd(ji,jj,1,2,1,1) * zs21_11 + alambd(ji,jj,1,2,2,1) * zs21_21  &
+                     &  + alambd(ji,jj,1,2,1,2) * zs21_12 + alambd(ji,jj,1,2,2,2) * zs21_22  &
+                     &  - alambd(ji,jj,2,1,1,1) * zs22_11 - alambd(ji,jj,2,1,2,1) * zs22_21  &
+                     &  - alambd(ji,jj,2,1,1,2) * zs22_12 - alambd(ji,jj,2,1,2,2) * zs22_22
+
+                  zd2 = + alambd(ji,jj,2,2,2,1) * zs21_21 + alambd(ji,jj,2,2,2,2) * zs21_22  &
+                     &  - alambd(ji,jj,2,2,1,1) * zs21_11 - alambd(ji,jj,2,2,1,2) * zs21_12  &
+                     &  - alambd(ji,jj,1,1,2,1) * zs22_21 - alambd(ji,jj,1,1,1,1) * zs22_11  &
+                     &  + alambd(ji,jj,1,1,2,2) * zs22_22 + alambd(ji,jj,1,1,1,2) * zs22_12  &
+                     &  - alambd(ji,jj,1,2,1,1) * zs11_11 - alambd(ji,jj,1,2,2,1) * zs11_21  &
+                     &  - alambd(ji,jj,1,2,1,2) * zs11_12 - alambd(ji,jj,1,2,2,2) * zs11_22  &
+                     &  + alambd(ji,jj,2,1,1,1) * zs12_11 + alambd(ji,jj,2,1,2,1) * zs12_21  &
+                     &  + alambd(ji,jj,2,1,1,2) * zs12_12 + alambd(ji,jj,2,1,2,2) * zs12_22
+
+                  zur     = zu_a(ji,jj) - ui_oce(ji,jj)
+                  zvr     = zv_a(ji,jj) - vi_oce(ji,jj)
+!!!!
+                  zmod    = SQRT( zur*zur + zvr*zvr ) * ( 1.0 - zfrld(ji,jj) )
+                  za      = rhoco * zmod
+!!!!
+!!gm chg resul    za      = rhoco * SQRT( zur*zur + zvr*zvr ) * ( 1.0 - zfrld(ji,jj) )
+                  zac     = za * cangvg
+                  zmpzas  = alpha * zcorl(ji,jj) + za * zsang(ji,jj)
                   zmassdt = zusdtp * zmass(ji,jj)
                   zcorlal = ( 1.0 - alpha ) * zcorl(ji,jj)
 
-                  za1(ji,jj) =  zmassdt * zu0(ji,jj) + zcorlal * zv0(ji,jj) + za1ct(ji,jj)   &
-                     &        + za * ( cangvg * u_oce(ji,jj) - zsang * v_oce(ji,jj) )
-
-                  za2(ji,jj) =  zmassdt * zv0(ji,jj) - zcorlal * zu0(ji,jj) + za2ct(ji,jj)   &
-                     &        + za * ( cangvg * v_oce(ji,jj) + zsang * u_oce(ji,jj) )
-
-                  zb1(ji,jj)  = zmassdt + zac - zc1u(ji,jj)
-                  zb2(ji,jj)  = zmpzas  - zc2u(ji,jj)
-                  zc1(ji,jj)  = zmpzas  + zc1v(ji,jj)
-                  zc2(ji,jj)  = zmassdt + zac  - zc2v(ji,jj) 
-                  zdeter      = zc1(ji,jj) * zb2(ji,jj) + zc2(ji,jj) * zb1(ji,jj)
-                  zden(ji,jj) = SIGN( rone, zdeter) / MAX( epsd , ABS( zdeter ) )
+                  za1 =  zmassdt * zu0(ji,jj) + zcorlal * zv0(ji,jj) + za1ct(ji,jj)   &
+                     &        + za * ( cangvg * ui_oce(ji,jj) - zsang(ji,jj) * vi_oce(ji,jj) )
+                  za2 =  zmassdt * zv0(ji,jj) - zcorlal * zu0(ji,jj) + za2ct(ji,jj)   &
+                     &        + za * ( cangvg * vi_oce(ji,jj) + zsang(ji,jj) * ui_oce(ji,jj) )
+                  zb1    = zmassdt + zac - zc1u(ji,jj)
+                  zb2    = zmpzas        - zc2u(ji,jj)
+                  zc1    = zmpzas        + zc1v(ji,jj)
+                  zc2    = zmassdt + zac - zc2v(ji,jj)
+                  zdeter = zc1 * zb2 + zc2 * zb1
+                  zden   = SIGN( rone, zdeter) / MAX( epsd , ABS( zdeter ) )
+                  zunw   = (  ( za1 + zd1 ) * zc2 + ( za2 + zd2 ) * zc1 ) * zden
+                  zvnw   = (  ( za2 + zd2 ) * zb1 - ( za1 + zd1 ) * zb2 ) * zden
+                  zmask  = ( 1.0 - MAX( rzero, SIGN( rone , 1.0 - zmass(ji,jj) ) ) ) * tmu(ji,jj)
+
+                  zu_n(ji,jj) = ( zu_a(ji,jj) + om * ( zunw - zu_a(ji,jj) ) * tmu(ji,jj) ) * zmask
+                  zv_n(ji,jj) = ( zv_a(ji,jj) + om * ( zvnw - zv_a(ji,jj) ) * tmu(ji,jj) ) * zmask
                END DO
             END DO
 
-            ! The computation of ice interaction term is splitted into two parts
-            !-------------------------------------------------------------------------
-
-            ! Terms that do not involve already up-dated velocities.
-         
-            DO jj = k_j1+1, k_jpj-1
-               DO ji = 2, jpim1
-                  iim1 = ji
-                  ijm1 = jj - 1
-                  iip1 = ji + 1
-                  ijp1 = jj
-                  ze11 =   akappa(iim1,ijm1,1,1) * u_ice(iip1,ijp1) + akappa(iim1,ijm1,1,2) * v_ice(iip1,ijp1)
-                  ze12 = + akappa(iim1,ijm1,2,2) * u_ice(iip1,ijp1) - akappa(iim1,ijm1,2,1) * v_ice(iip1,ijp1)
-                  ze22 = + akappa(iim1,ijm1,2,2) * v_ice(iip1,ijp1) + akappa(iim1,ijm1,2,1) * u_ice(iip1,ijp1)
-                  ze21 =   akappa(iim1,ijm1,1,1) * v_ice(iip1,ijp1) - akappa(iim1,ijm1,1,2) * u_ice(iip1,ijp1)
-                  zvis11 = 2.0 * zviseta (iim1,ijm1) + dm
-                  zvis22 =       zviszeta(iim1,ijm1) - zviseta(iim1,ijm1)
-                  zvis12 =       zviseta (iim1,ijm1) + dm
-                  zvis21 =       zviseta (iim1,ijm1)
-                  zdiag = zvis22 * ( ze11 + ze22 )
-                  zs11(ji,jj,2,1) =  zvis11 * ze11 + zdiag
-                  zs12(ji,jj,2,1) =  zvis12 * ze12 + zvis21 * ze21
-                  zs22(ji,jj,2,1) =  zvis11 * ze22 + zdiag
-                  zs21(ji,jj,2,1) =  zvis12 * ze21 + zvis21 * ze12
-
-
-                  iim1 = ji - 1
-                  ijm1 = jj
-                  iip1 = ji
-                  ijp1 = jj + 1                   
-                  ze11 =   akappa(iim1,ijm1,1,1) * ( u_ice(iip1,ijp1) - u_ice(iim1,ijp1) )   &
-                     &   + akappa(iim1,ijm1,1,2) * ( v_ice(iip1,ijp1) + v_ice(iim1,ijp1) )
-                  ze12 = + akappa(iim1,ijm1,2,2) * ( u_ice(iim1,ijp1) + u_ice(iip1,ijp1) )   &
-                     &   - akappa(iim1,ijm1,2,1) * ( v_ice(iim1,ijp1) + v_ice(iip1,ijp1) )
-                  ze22 = + akappa(iim1,ijm1,2,2) * ( v_ice(iim1,ijp1) + v_ice(iip1,ijp1) )   &
-                     &   + akappa(iim1,ijm1,2,1) * ( u_ice(iim1,ijp1) + u_ice(iip1,ijp1) )
-                  ze21 =   akappa(iim1,ijm1,1,1) * ( v_ice(iip1,ijp1) - v_ice(iim1,ijp1) )   &
-                     &   - akappa(iim1,ijm1,1,2) * ( u_ice(iip1,ijp1) + u_ice(iim1,ijp1) )
-                  zvis11 = 2.0 * zviseta (iim1,ijm1) + dm
-                  zvis22 =       zviszeta(iim1,ijm1) - zviseta(iim1,ijm1)
-                  zvis12 =       zviseta (iim1,ijm1) + dm
-                  zvis21 =       zviseta (iim1,ijm1)
-                  zdiag = zvis22 * ( ze11 + ze22 )
-                  zs11(ji,jj,1,2) =  zvis11 * ze11 + zdiag
-                  zs12(ji,jj,1,2) =  zvis12 * ze12 + zvis21 * ze21
-                  zs22(ji,jj,1,2) =  zvis11 * ze22 + zdiag
-                  zs21(ji,jj,1,2) =  zvis12 * ze21 + zvis21 * ze12
-
-                  iim1 = ji
-                  ijm1 = jj
-                  iip1 = ji + 1
-                  ijp1 = jj + 1
-                  ze11 =   akappa(iim1,ijm1,1,1) * ( u_ice(iip1,ijm1) + u_ice(iip1,ijp1) - u_ice(iim1,ijp1) )   &
-                     &   + akappa(iim1,ijm1,1,2) * ( v_ice(iip1,ijm1) + v_ice(iip1,ijp1) + v_ice(iim1,ijp1) )
-                  ze12 = - akappa(iim1,ijm1,2,2) * ( u_ice(iip1,ijm1) - u_ice(iim1,ijp1) - u_ice(iip1,ijp1) )   &
-                     &   - akappa(iim1,ijm1,2,1) * ( v_ice(iip1,ijm1) + v_ice(iim1,ijp1) + v_ice(iip1,ijp1) )
-                  ze22 = - akappa(iim1,ijm1,2,2) * ( v_ice(iip1,ijm1) - v_ice(iim1,ijp1) - v_ice(iip1,ijp1) )   &
-                     &   + akappa(iim1,ijm1,2,1) * ( u_ice(iip1,ijm1) + u_ice(iim1,ijp1) + u_ice(iip1,ijp1) )
-                  ze21 =   akappa(iim1,ijm1,1,1) * ( v_ice(iip1,ijm1) + v_ice(iip1,ijp1) - v_ice(iim1,ijp1) )   &
-                     &   - akappa(iim1,ijm1,1,2) * ( u_ice(iip1,ijm1) + u_ice(iip1,ijp1) + u_ice(iim1,ijp1) ) 
-                  zvis11 = 2.0 * zviseta (iim1,ijm1) + dm
-                  zvis22 =       zviszeta(iim1,ijm1) - zviseta(iim1,ijm1)
-                  zvis12 =       zviseta (iim1,ijm1) + dm
-                  zvis21 =       zviseta (iim1,ijm1)
-
-                  zdiag = zvis22 * ( ze11 + ze22 )
-                  zs11(ji,jj,2,2) =  zvis11 * ze11 + zdiag
-                  zs12(ji,jj,2,2) =  zvis12 * ze12 + zvis21 * ze21
-                  zs22(ji,jj,2,2) =  zvis11 * ze22 + zdiag
-                  zs21(ji,jj,2,2) =  zvis12 * ze21 + zvis21 * ze12
-
-               END DO
+            CALL lbc_lnk( zu_n(:,1:jpj), 'I', -1. )
+            CALL lbc_lnk( zv_n(:,1:jpj), 'I', -1. )
+
+            ! Test of Convergence
+            DO jj = k_j1+1 , k_jpj-1
+               zresr(:,jj) = MAX( ABS( zu_a(:,jj) - zu_n(:,jj) ) , ABS( zv_a(:,jj) - zv_n(:,jj) ) )
             END DO
-
-            ! Terms involving already up-dated velocities.
-            !-Using the arrays zu_ice and zv_ice in the computation of the terms ze leads to JACOBI's method; 
-            ! Using arrays u and v in the computation of the terms ze leads to GAUSS-SEIDEL method.
-             
-            DO jj = k_j1+1, k_jpj-1
-               DO ji = 2, jpim1
-                  iim1 = ji - 1
-                  ijm1 = jj - 1
-                  iip1 = ji
-                  ijp1 = jj
-                  ze11 =   akappa(iim1,ijm1,1,1) * ( zu_ice(iip1,ijm1) - zu_ice(iim1,ijm1) - zu_ice(iim1,ijp1) )   &
-                     &   + akappa(iim1,ijm1,1,2) * ( zv_ice(iip1,ijm1) + zv_ice(iim1,ijm1) + zv_ice(iim1,ijp1) )
-                  ze12 = - akappa(iim1,ijm1,2,2) * ( zu_ice(iim1,ijm1) + zu_ice(iip1,ijm1) - zu_ice(iim1,ijp1) )   &
-                     &   - akappa(iim1,ijm1,2,1) * ( zv_ice(iim1,ijm1) + zv_ice(iip1,ijm1) + zv_ice(iim1,ijp1) )
-                  ze22 = - akappa(iim1,ijm1,2,2) * ( zv_ice(iim1,ijm1) + zv_ice(iip1,ijm1) - zv_ice(iim1,ijp1) )   &
-                     &   + akappa(iim1,ijm1,2,1) * ( zu_ice(iim1,ijm1) + zu_ice(iip1,ijm1) + zu_ice(iim1,ijp1) )
-                  ze21 =   akappa(iim1,ijm1,1,1) * ( zv_ice(iip1,ijm1) - zv_ice(iim1,ijm1) - zv_ice(iim1,ijp1) )   &
-                     &  -  akappa(iim1,ijm1,1,2) * ( zu_ice(iip1,ijm1) + zu_ice(iim1,ijm1) + zu_ice(iim1,ijp1) )
-                  zvis11 = 2.0 * zviseta (iim1,ijm1) + dm
-                  zvis22 =       zviszeta(iim1,ijm1) - zviseta(iim1,ijm1)
-                  zvis12 =       zviseta (iim1,ijm1) + dm
-                  zvis21 =       zviseta (iim1,ijm1)
-
-                  zdiag = zvis22 * ( ze11 + ze22 )
-                  zs11(ji,jj,1,1) =  zvis11 * ze11 + zdiag
-                  zs12(ji,jj,1,1) =  zvis12 * ze12 + zvis21 * ze21
-                  zs22(ji,jj,1,1) =  zvis11 * ze22 + zdiag
-                  zs21(ji,jj,1,1) =  zvis12 * ze21 + zvis21 * ze12
-
-#if defined key_agrif
-             END DO
-          END DO
-
-          DO jj = k_j1+1, k_jpj-1
-             DO ji = 2, jpim1
-#endif
-
-                  iim1 = ji
-                  ijm1 = jj - 1
-                  iip1 = ji + 1
-                  ze11 =   akappa(iim1,ijm1,1,1) * ( zu_ice(iip1,ijm1) - zu_ice(iim1,ijm1) )   &
-                     &   + akappa(iim1,ijm1,1,2) * ( zv_ice(iip1,ijm1) + zv_ice(iim1,ijm1) )
-                  ze12 = - akappa(iim1,ijm1,2,2) * ( zu_ice(iim1,ijm1) + zu_ice(iip1,ijm1) )   &
-                     &   - akappa(iim1,ijm1,2,1) * ( zv_ice(iim1,ijm1) + zv_ice(iip1,ijm1) )
-                  ze22 = - akappa(iim1,ijm1,2,2) * ( zv_ice(iim1,ijm1) + zv_ice(iip1,ijm1) )   &
-                     &   + akappa(iim1,ijm1,2,1) * ( zu_ice(iim1,ijm1) + zu_ice(iip1,ijm1) )
-                  ze21 =   akappa(iim1,ijm1,1,1) * ( zv_ice(iip1,ijm1) - zv_ice(iim1,ijm1) )   &
-                     &   - akappa(iim1,ijm1,1,2) * ( zu_ice(iip1,ijm1) + zu_ice(iim1,ijm1) )
-                  zvis11 = 2.0 * zviseta (iim1,ijm1) + dm
-                  zvis22 =       zviszeta(iim1,ijm1) - zviseta(iim1,ijm1)
-                  zvis12 =       zviseta (iim1,ijm1) + dm
-                  zvis21 =       zviseta (iim1,ijm1)
-
-                  zdiag = zvis22 * ( ze11 + ze22 )
-                  zs11(ji,jj,2,1) =  zs11(ji,jj,2,1) + zvis11 * ze11 + zdiag
-                  zs12(ji,jj,2,1) =  zs12(ji,jj,2,1) + zvis12 * ze12 + zvis21 * ze21
-                  zs22(ji,jj,2,1) =  zs22(ji,jj,2,1) + zvis11 * ze22 + zdiag
-                  zs21(ji,jj,2,1) =  zs21(ji,jj,2,1) + zvis12 * ze21 + zvis21 * ze12
-
-
-                  iim1 = ji - 1
-                  ijm1 = jj 
-                  ze11 = - akappa(iim1,ijm1,1,1) * zu_ice(iim1,ijm1) + akappa(iim1,ijm1,1,2) * zv_ice(iim1,ijm1)
-                  ze12 = - akappa(iim1,ijm1,2,2) * zu_ice(iim1,ijm1) - akappa(iim1,ijm1,2,1) * zv_ice(iim1,ijm1)
-                  ze22 = - akappa(iim1,ijm1,2,2) * zv_ice(iim1,ijm1) + akappa(iim1,ijm1,2,1) * zu_ice(iim1,ijm1)
-                  ze21 = - akappa(iim1,ijm1,1,1) * zv_ice(iim1,ijm1) - akappa(iim1,ijm1,1,2) * zu_ice(iim1,ijm1)
-                  zvis11 = 2.0 * zviseta (iim1,ijm1) + dm
-                  zvis22 =       zviszeta(iim1,ijm1) - zviseta(iim1,ijm1)
-                  zvis12 =       zviseta (iim1,ijm1) + dm
-                  zvis21 =       zviseta (iim1,ijm1)
-
-                  zdiag = zvis22 * ( ze11 + ze22 )
-                  zs11(ji,jj,1,2) =  zs11(ji,jj,1,2) + zvis11 * ze11 + zdiag 
-                  zs12(ji,jj,1,2) =  zs12(ji,jj,1,2) + zvis12 * ze12 + zvis21 * ze21
-                  zs22(ji,jj,1,2) =  zs22(ji,jj,1,2) + zvis11 * ze22 + zdiag
-                  zs21(ji,jj,1,2) =  zs21(ji,jj,1,2) + zvis12 * ze21 + zvis21 * ze12
-
-#if defined key_agrif
-             END DO
-          END DO
-
-          DO jj = k_j1+1, k_jpj-1
-             DO ji = 2, jpim1
-#endif
-                  zd1(ji,jj) =   &
-                     + alambd(ji,jj,2,2,2,1) * zs11(ji,jj,2,1) + alambd(ji,jj,2,2,2,2) * zs11(ji,jj,2,2)  &
-                     - alambd(ji,jj,2,2,1,1) * zs11(ji,jj,1,1) - alambd(ji,jj,2,2,1,2) * zs11(ji,jj,1,2)  &
-                     - alambd(ji,jj,1,1,2,1) * zs12(ji,jj,2,1) - alambd(ji,jj,1,1,1,1) * zs12(ji,jj,1,1)  &
-                     + alambd(ji,jj,1,1,2,2) * zs12(ji,jj,2,2) + alambd(ji,jj,1,1,1,2) * zs12(ji,jj,1,2)  &
-                     + alambd(ji,jj,1,2,1,1) * zs21(ji,jj,1,1) + alambd(ji,jj,1,2,2,1) * zs21(ji,jj,2,1)  &
-                     + alambd(ji,jj,1,2,1,2) * zs21(ji,jj,1,2) + alambd(ji,jj,1,2,2,2) * zs21(ji,jj,2,2)  &
-                     - alambd(ji,jj,2,1,1,1) * zs22(ji,jj,1,1) - alambd(ji,jj,2,1,2,1) * zs22(ji,jj,2,1)  &
-                     - alambd(ji,jj,2,1,1,2) * zs22(ji,jj,1,2) - alambd(ji,jj,2,1,2,2) * zs22(ji,jj,2,2)
-                  zd2(ji,jj) =   &
-                     + alambd(ji,jj,2,2,2,1) * zs21(ji,jj,2,1) + alambd(ji,jj,2,2,2,2) * zs21(ji,jj,2,2)  &
-                     - alambd(ji,jj,2,2,1,1) * zs21(ji,jj,1,1) - alambd(ji,jj,2,2,1,2) * zs21(ji,jj,1,2)  &
-                     - alambd(ji,jj,1,1,2,1) * zs22(ji,jj,2,1) - alambd(ji,jj,1,1,1,1) * zs22(ji,jj,1,1)  &
-                     + alambd(ji,jj,1,1,2,2) * zs22(ji,jj,2,2) + alambd(ji,jj,1,1,1,2) * zs22(ji,jj,1,2)  &
-                     - alambd(ji,jj,1,2,1,1) * zs11(ji,jj,1,1) - alambd(ji,jj,1,2,2,1) * zs11(ji,jj,2,1)  &
-                     - alambd(ji,jj,1,2,1,2) * zs11(ji,jj,1,2) - alambd(ji,jj,1,2,2,2) * zs11(ji,jj,2,2)  &
-                     + alambd(ji,jj,2,1,1,1) * zs12(ji,jj,1,1) + alambd(ji,jj,2,1,2,1) * zs12(ji,jj,2,1)  &
-                     + alambd(ji,jj,2,1,1,2) * zs12(ji,jj,1,2) + alambd(ji,jj,2,1,2,2) * zs12(ji,jj,2,2)
-               END DO
+            zresm = MAXVAL( zresr(1:jpi,k_j1+1:k_jpj-1) )
+!!!! this should be faster on scalar processor
+!           zresm = MAXVAL(  MAX( ABS( zu_a(1:jpi,k_j1+1:k_jpj-1) - zu_n(1:jpi,k_j1+1:k_jpj-1) ),   &
+!              &                  ABS( zv_a(1:jpi,k_j1+1:k_jpj-1) - zv_n(1:jpi,k_j1+1:k_jpj-1) ) )  )
+!!!!
+            IF( lk_mpp )   CALL mpp_max( zresm )   ! max over the global domain
+
+            DO jj = k_j1, k_jpj
+               zu_a(:,jj) = zu_n(:,jj)
+               zv_a(:,jj) = zv_n(:,jj)
             END DO
 
-            DO jj = k_j1+1, k_jpj-1
-               DO ji = 2, jpim1
-                  zunw = (  ( za1(ji,jj) + zd1(ji,jj) ) * zc2(ji,jj)        &
-                     &    + ( za2(ji,jj) + zd2(ji,jj) ) * zc1(ji,jj) ) * zden(ji,jj)
-
-                  zvnw = (  ( za2(ji,jj) + zd2(ji,jj) ) * zb1(ji,jj)        &
-                     &    - ( za1(ji,jj) + zd1(ji,jj) ) * zb2(ji,jj) ) * zden(ji,jj)
-
-                  zmask = ( 1.0 - MAX( rzero, SIGN( rone , 1.0 - zmass(ji,jj) ) ) ) * tmu(ji,jj)
-
-                  u_ice(ji,jj) = ( u_ice(ji,jj) + om * ( zunw - u_ice(ji,jj) ) * tmu(ji,jj) ) * zmask
-                  v_ice(ji,jj) = ( v_ice(ji,jj) + om * ( zvnw - v_ice(ji,jj) ) * tmu(ji,jj) ) * zmask
-               END DO
+            IF( zresm <= resl )   EXIT   iflag
+
+            !                                                   ! ================ !
+         END DO    iflag                                        !  end Relaxation  !
+         !                                                      ! ================ !
+
+         IF( zindu == 0 ) THEN      ! even iteration
+            DO jj = k_j1 , k_jpj-1
+               zu0(:,jj) = zu_a(:,jj)
+               zv0(:,jj) = zv_a(:,jj)
             END DO
-
-            CALL lbc_lnk( u_ice, 'I', -1. )
-            CALL lbc_lnk( v_ice, 'I', -1. )
-
-            !---  5.2.5.4. Convergence test.
-            DO jj = k_j1+1 , k_jpj-1
-               zresr(:,jj) = MAX( ABS( u_ice(:,jj) - zu_ice(:,jj) ) , ABS( v_ice(:,jj) - zv_ice(:,jj) ) )
-            END DO
-            zresm = MAXVAL( zresr( 1:jpi , k_j1+1:k_jpj-1 ) )
-            IF( lk_mpp )   CALL mpp_max( zresm )   ! max over the global domain
-
-            IF ( zresm <= resl) EXIT iflag
-
-         END DO iflag
-
-         zindu1 = 1.0 - zindu
-         DO jj = k_j1 , k_jpj-1
-            zu0(:,jj) = zindu * zu0(:,jj) + zindu1 * u_ice(:,jj)
-            zv0(:,jj) = zindu * zv0(:,jj) + zindu1 * v_ice(:,jj)
-         END DO
-      !                                                   ! ==================== !
+         ENDIF
+         !                                                ! ==================== !
       END DO                                              !  end loop over iter  !
       !                                                   ! ==================== !
+
+      ui_ice(:,:) = zu_a(:,1:jpj)
+      vi_ice(:,:) = zv_a(:,1:jpj)
 
       IF(ln_ctl) THEN
          WRITE(charout,FMT="('lim_rhg  : res =',D23.16, ' iter =',I4)") zresm, jter
          CALL prt_ctl_info(charout)
-         CALL prt_ctl(tab2d_1=u_ice, clinfo1=' lim_rhg  : u_ice :', tab2d_2=v_ice, clinfo2=' v_ice :')
+         CALL prt_ctl(tab2d_1=ui_ice, clinfo1=' lim_rhg  : ui_ice :', tab2d_2=vi_ice, clinfo2=' vi_ice :')
       ENDIF
 
Index: trunk/NEMO/LIM_SRC_2/limrst_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limrst_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limrst_2.F90	(revision 888)
@@ -17,6 +17,6 @@
    !!----------------------------------------------------------------------
    USE ice_2
-   USE dom_oce
-   USE ice_oce         ! ice variables
+   USE sbc_oce
+   USE sbc_ice
    USE daymod
 
@@ -27,7 +27,7 @@
    PRIVATE
 
-   PUBLIC   lim_rst_opn_2     ! routine called by ??? module
-   PUBLIC   lim_rst_write_2   ! routine called by ??? module
-   PUBLIC   lim_rst_read_2    ! routine called by ??? module
+   PUBLIC   lim_rst_opn_2     ! routine called by sbcice_lim_2.F90
+   PUBLIC   lim_rst_write_2   ! routine called by sbcice_lim_2.F90
+   PUBLIC   lim_rst_read_2    ! routine called by iceini_2.F90
 
    LOGICAL, PUBLIC ::   lrst_ice         !: logical to control the ice restart write 
@@ -36,5 +36,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2006) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limrst.F90,v 1.15 2007/06/29 14:54:06 opalod Exp $ 
+   !! $ Id: $
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -57,7 +57,7 @@
       
       ! to get better performances with NetCDF format:
-      ! we open and define the ice restart file one ice time step before writing the data (-> at nitrst - 2*nfice + 1)
-      ! except if we write ice restart files every ice time step or if an ice restart file was writen at nitend - 2*nfice + 1
-      IF( kt == nitrst - 2*nfice + 1 .OR. nstock == nfice .OR. ( kt == nitend - nfice + 1 .AND. .NOT. lrst_ice ) ) THEN
+      ! we open and define the ice restart file one ice time step before writing the data (-> at nitrst - 2*nn_fsbc + 1)
+      ! except if we write ice restart files every ice time step or if an ice restart file was writen at nitend - 2*nn_fsbc + 1
+      IF( kt == nitrst - 2*nn_fsbc + 1 .OR. nstock == nn_fsbc .OR. ( kt == nitend - nn_fsbc + 1 .AND. .NOT. lrst_ice ) ) THEN
          ! beware of the format used to write kt (default is i8.8, that should be large enough...)
          IF( nitrst > 99999999 ) THEN   ;   WRITE(clkt, *       ) nitrst
@@ -72,7 +72,7 @@
             CASE DEFAULT         ;   WRITE(numout,*) '             open ice restart NetCDF file: '//clname
             END SELECT
-            IF( kt == nitrst - 2*nfice + 1 ) THEN   
-               WRITE(numout,*)         '             kt = nitrst - 2*nfice + 1 = ', kt,' date= ', ndastp
-            ELSE   ;   WRITE(numout,*) '             kt = '                       , kt,' date= ', ndastp
+            IF( kt == nitrst - 2*nn_fsbc + 1 ) THEN   
+               WRITE(numout,*)         '             kt = nitrst - 2*nn_fsbc + 1 = ', kt,' date= ', ndastp
+            ELSE   ;   WRITE(numout,*) '             kt = '                         , kt,' date= ', ndastp
             ENDIF
          ENDIF
@@ -90,15 +90,15 @@
       !! ** purpose  :   output of sea-ice variable in a netcdf file
       !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt     ! number of iteration
-      !!
-      INTEGER ::   iter     ! kt + nfice -1
-      !!----------------------------------------------------------------------
-
-      iter = kt + nfice - 1   ! ice restarts are written at kt == nitrst - nfice + 1
+      INTEGER, INTENT(in) ::   kt   ! number of iteration
+      !
+      INTEGER ::   iter   ! kt + nn_fsbc -1
+      !!----------------------------------------------------------------------
+
+      iter = kt + nn_fsbc - 1   ! ice restarts are written at kt == nitrst - nn_fsbc + 1
 
       IF( iter == nitrst ) THEN
          IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) 'lim_rst_write_2 : write ice restart file  kt =', kt
-         IF(lwp) WRITE(numout,*) '~~~~~~~'         
+         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~'
       ENDIF
 
@@ -106,6 +106,5 @@
       ! ------------------ 
       !                                                                     ! calendar control
-      CALL iom_rstput( iter, nitrst, numriw, 'nfice' , REAL( nfice, wp) )      ! time-step 
-      CALL iom_rstput( iter, nitrst, numriw, 'kt_ice', REAL( iter , wp) )      ! date
+      CALL iom_rstput( iter, nitrst, numriw, 'kt_ice', REAL( iter, wp) ) 
       
       CALL iom_rstput( iter, nitrst, numriw, 'hicif' , hicif (:,:)   )      ! prognostic variables 
@@ -119,8 +118,6 @@
       CALL iom_rstput( iter, nitrst, numriw, 'tbif2' , tbif  (:,:,2) )
       CALL iom_rstput( iter, nitrst, numriw, 'tbif3' , tbif  (:,:,3) )
-      CALL iom_rstput( iter, nitrst, numriw, 'u_ice' , u_ice (:,:)   )
-      CALL iom_rstput( iter, nitrst, numriw, 'v_ice' , v_ice (:,:)   )
-      CALL iom_rstput( iter, nitrst, numriw, 'gtaux' , gtaux (:,:)   )
-      CALL iom_rstput( iter, nitrst, numriw, 'gtauy' , gtauy (:,:)   )
+      CALL iom_rstput( iter, nitrst, numriw, 'ui_ice', ui_ice(:,:)   )
+      CALL iom_rstput( iter, nitrst, numriw, 'vi_ice', vi_ice(:,:)   )
       CALL iom_rstput( iter, nitrst, numriw, 'qstoif', qstoif(:,:)   )
       CALL iom_rstput( iter, nitrst, numriw, 'fsbbq' , fsbbq (:,:)   )
@@ -175,6 +172,5 @@
       !! ** purpose  :   read of sea-ice variable restart in a netcdf file
       !!----------------------------------------------------------------------
-      !
-      REAL(wp) ::   zfice, ziter
+      REAL(wp) ::   ziter
       !!----------------------------------------------------------------------
 
@@ -182,12 +178,11 @@
          WRITE(numout,*)
          WRITE(numout,*) 'lim_rst_read_2 : read ice NetCDF restart file'
-         WRITE(numout,*) '~~~~~~~~'
+         WRITE(numout,*) '~~~~~~~~~~~~~~'
       ENDIF
 
       CALL iom_open ( 'restart_ice_in', numrir, kiolib = jprstlib )
 
-      CALL iom_get( numrir, 'nfice' , zfice )
-      CALL iom_get( numrir, 'kt_ice', ziter )    
-      IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', ziter
+      CALL iom_get( numrir, 'kt_ice' , ziter )
+      IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', INT( ziter )
       IF(lwp) WRITE(numout,*) '   in any case we force it to nit000 - 1 : ', nit000 - 1
 
@@ -196,8 +191,4 @@
       IF( ( nit000 - INT(ziter) ) /= 1 .AND. ABS( nrstdt ) == 1 )   &
          &     CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nit000 in ice restart',  &
-         &                   '   verify the file or rerun with the value 0 for the',        &
-         &                   '   control of time parameter  nrstdt' )
-      IF( INT(zfice) /= nfice          .AND. ABS( nrstdt ) == 1 )   &
-         &     CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nfice in ice restart',  &
          &                   '   verify the file or rerun with the value 0 for the',        &
          &                   '   control of time parameter  nrstdt' )
@@ -213,8 +204,6 @@
       CALL iom_get( numrir, jpdom_autoglo, 'tbif2' , tbif(:,:,2) )    
       CALL iom_get( numrir, jpdom_autoglo, 'tbif3' , tbif(:,:,3) )    
-      CALL iom_get( numrir, jpdom_autoglo, 'u_ice' , u_ice  )    
-      CALL iom_get( numrir, jpdom_autoglo, 'v_ice' , v_ice  )    
-      CALL iom_get( numrir, jpdom_autoglo, 'gtaux' , gtaux  )    
-      CALL iom_get( numrir, jpdom_autoglo, 'gtauy' , gtauy  )    
+      CALL iom_get( numrir, jpdom_autoglo, 'ui_ice', ui_ice )    
+      CALL iom_get( numrir, jpdom_autoglo, 'vi_ice', vi_ice )    
       CALL iom_get( numrir, jpdom_autoglo, 'qstoif', qstoif )    
       CALL iom_get( numrir, jpdom_autoglo, 'fsbbq' , fsbbq  )    
Index: trunk/NEMO/LIM_SRC_2/limsbc_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limsbc_2.F90	(revision 888)
+++ trunk/NEMO/LIM_SRC_2/limsbc_2.F90	(revision 888)
@@ -0,0 +1,251 @@
+MODULE limsbc_2
+   !!======================================================================
+   !!                       ***  MODULE limsbc_2   ***
+   !!           computation of the flux at the sea ice/ocean interface
+   !!======================================================================
+   !! History : 00-01 (H. Goosse) Original code
+   !!           02-07 (C. Ethe, G. Madec) re-writing F90
+   !!           06-07 (G. Madec) surface module
+   !!----------------------------------------------------------------------
+#if defined key_lim2
+   !!----------------------------------------------------------------------
+   !!   'key_lim2'                                    LIM 2.0 sea-ice model
+   !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !!   lim_sbc_2  : flux at the ice / ocean interface
+   !!----------------------------------------------------------------------
+   USE par_oce          ! ocean parameters
+   USE dom_oce          ! ocean domain
+   USE sbc_ice          ! surface boundary condition
+   USE sbc_oce          ! surface boundary condition
+   USE phycst           ! physical constants
+   USE ocfzpt           ! surface ocean freezing point
+   USE ice_oce          ! sea-ice variable
+   USE ice_2            ! LIM sea-ice variables
+   USE iceini_2         ! ???
+   USE dynspg_oce       ! choice of the surface pressure gradient scheme 
+
+   USE lbclnk           ! ocean lateral boundary condition
+   USE in_out_manager   ! I/O manager
+   USE albedo           ! albedo parameters
+   USE prtctl           ! Print control
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC lim_sbc_2     ! called by sbc_ice_lim_2
+
+   REAL(wp)  ::   epsi16 = 1.e-16  ! constant values
+   REAL(wp)  ::   rzero  = 0.e0    
+   REAL(wp)  ::   rone   = 1.e0
+
+   !! * Substitutions
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   LIM 2.0,  UCL-LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE lim_sbc_2( kt )
+      !!-------------------------------------------------------------------
+      !!                ***  ROUTINE lim_sbc_2 ***
+      !!  
+      !! ** Purpose : Update surface ocean boundary condition over areas
+      !!      that are at least partially covered by sea-ice
+      !!         
+      !! ** Action  : - comput. of the momentum, heat and freshwater/salt
+      !!      fluxes at the ice-ocean interface.
+      !!              - Update 
+      !!     
+      !! ** Outputs : - qsr    : sea heat flux:     solar 
+      !!              - qns    : sea heat flux: non solar
+      !!              - emp    : freshwater budget: volume flux 
+      !!              - emps   : freshwater budget: concentration/dillution 
+      !!              - utau   : sea surface i-stress (ocean referential)
+      !!              - vtau   : sea surface j-stress (ocean referential)
+      !!
+      !! References : Goosse, H. et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90.
+      !!              Tartinville et al. 2001 Ocean Modelling, 3, 95-108.
+      !!---------------------------------------------------------------------
+      INTEGER ::   kt    ! number of iteration
+      !!
+      INTEGER  ::   ji, jj           ! dummy loop indices
+      INTEGER  ::   ifvt, i1mfr, idfr               ! some switches
+      INTEGER  ::   iflt, ial, iadv, ifral, ifrdv
+      REAL(wp) ::   zqsr  , zqns     ! solar & non solar heat flux
+      REAL(wp) ::   zinda            ! switch for testing the values of ice concentration
+      REAL(wp) ::   zfons            ! salt exchanges at the ice/ocean interface
+      REAL(wp) ::   zemp             ! freshwater exchanges at the ice/ocean interface
+      REAL(wp) ::   zfrldu, zfrldv   ! lead fraction at U- & V-points
+      REAL(wp) ::   zutau , zvtau    ! lead fraction at U- & V-points
+      REAL(wp) ::   zu_io , zv_io    ! 2 components of the ice-ocean velocity
+#if defined key_coupled    
+      REAL(wp), DIMENSION(jpi,jpj) ::   zalb     ! albedo of ice under overcast sky
+      REAL(wp), DIMENSION(jpi,jpj) ::   zalbp    ! albedo of ice under clear sky
+#endif
+      REAL(wp) ::   zsang, zmod, zfm
+      REAL(wp), DIMENSION(jpi,jpj) ::   ztio_u, ztio_v   ! ocean stress below sea-ice
+
+      !!---------------------------------------------------------------------
+     
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'lim_sbc_2 : LIM 2.0 sea-ice - surface boundary condition'
+         IF(lwp) WRITE(numout,*) '~~~~~~~~~   '
+      ENDIF
+
+      !------------------------------------------!
+      !      heat flux at the ocean surface      !
+      !------------------------------------------!
+
+!!gm
+!!gm CAUTION   
+!!gm re-verifies the non solar expression, especially over open ocen
+!!gm
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            zinda   = 1.0   - MAX( rzero , SIGN( rone, - ( 1.0 - pfrld(ji,jj) )   ) )
+            ifvt    = zinda * MAX( rzero , SIGN( rone,  - phicif(ji,jj)           ) )
+            i1mfr   = 1.0   - MAX( rzero , SIGN( rone, - ( 1.0 - frld(ji,jj) )    ) )
+            idfr    = 1.0   - MAX( rzero , SIGN( rone, frld(ji,jj) - pfrld(ji,jj) ) )
+            iflt    = zinda  * (1 - i1mfr) * (1 - ifvt )
+            ial     = ifvt   * i1mfr + ( 1 - ifvt ) * idfr
+            iadv    = ( 1  - i1mfr ) * zinda
+            ifral   = ( 1  - i1mfr * ( 1 - ial ) )   
+            ifrdv   = ( 1  - ifral * ( 1 - ial ) ) * iadv 
+            !   computation the solar flux at ocean surface
+            zqsr    = pfrld(ji,jj) * qsr(ji,jj)  + ( 1. - pfrld(ji,jj) ) * fstric(ji,jj)
+            !  computation the non solar heat flux at ocean surface
+            zqns    =  - ( 1. - thcm(ji,jj) ) * zqsr   &   ! part of the solar energy used in leads
+               &       + iflt    * ( fscmbq(ji,jj) + ffltbif(ji,jj) )                            &
+               &       + ifral   * ( ial * qcmif(ji,jj) + (1 - ial) * qldif(ji,jj) ) / rdt_ice   &
+               &       + ifrdv   * ( qfvbq(ji,jj) + qdtcn(ji,jj) ) / rdt_ice
+
+            fsbbq(ji,jj) = ( 1.0 - ( ifvt + iflt ) ) * fscmbq(ji,jj)     ! ???
+            
+            qsr  (ji,jj) = zqsr                                          ! solar heat flux 
+            qns  (ji,jj) = zqns - fdtcn(ji,jj)                           ! non solar heat flux
+         END DO
+      END DO
+  
+      !------------------------------------------!
+      !      mass flux at the ocean surface      !
+      !------------------------------------------!
+
+!!gm
+!!gm CAUTION   
+!!gm re-verifies the emp & emps expression, especially the absence of 1-frld on zfm
+!!gm
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            
+            !  computing freshwater exchanges at the ice/ocean interface
+            zemp = + emp(ji,jj)     *         frld(ji,jj)      &   !  e-p budget over open ocean fraction 
+               &   - tprecip(ji,jj) * ( 1. -  frld(ji,jj) )    &   !  liquid precipitation reaches directly the ocean
+               &   + sprecip(ji,jj) * ( 1. - pfrld(ji,jj) )    &   !  taking into account change in ice cover within the time step
+               &   + rdmsnif(ji,jj) / rdt_ice                      !  freshwaterflux due to snow melting 
+               !                                                   !  ice-covered fraction:
+
+            !  computing salt exchanges at the ice/ocean interface
+            zfons =  ( soce - sice ) * ( rdmicif(ji,jj) / rdt_ice ) 
+            
+            !  converting the salt flux from ice to a freshwater flux from ocean
+            zfm  = zfons / ( sss_m(ji,jj) + epsi16 )
+            
+            emps(ji,jj) = zemp + zfm      ! surface ocean concentration/dilution effect (use on SSS evolution)
+            emp (ji,jj) = zemp            ! surface ocean volume flux (use on sea-surface height evolution)
+
+         END DO
+      END DO
+
+      IF( lk_dynspg_rl )    emp (:,:) = emps(:,:)      ! rigid-lid formulation : emp = emps
+
+      !------------------------------------------!
+      !    momentum flux at the ocean surface    !
+      !------------------------------------------!
+
+      IF ( ln_limdyn ) THEN                        ! Update the stress over ice-over area (only in ice-dynamic case)
+         !                                         ! otherwise the atmosphere-ocean stress is used everywhere
+
+         ! ... ice stress over ocean with a ice-ocean rotation angle (at I-point)
+!CDIR NOVERRCHK
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+               ! ... change the cosinus angle sign in the south hemisphere
+               zsang  = SIGN(1.e0, gphif(ji,jj) ) * sangvg
+               ! ... ice velocity relative to the ocean
+               zu_io  = ui_ice(ji,jj) - ui_oce(ji,jj)
+               zv_io  = vi_ice(ji,jj) - vi_oce(ji,jj)
+               zmod   = rhoco * SQRT( zu_io * zu_io + zv_io * zv_io )
+               ! ... ice stress over ocean with a ice-ocean rotation angle (at I-point)
+               ztio_u(ji,jj) = zmod * ( cangvg * zu_io - zsang * zv_io )
+               ztio_v(ji,jj) = zmod * ( cangvg * zv_io + zsang * zu_io )
+               ! 
+            END DO
+         END DO
+
+         DO jj = 2, jpjm1
+            DO ji = fs_2, fs_jpim1   ! vertor opt.
+               ! ... ice-cover wheighted ice-ocean stress at U and V-points  (from I-point values)
+               zutau  = 0.5 * ( ztio_u(ji+1,jj) + ztio_u(ji+1,jj+1) )
+               zvtau  = 0.5 * ( ztio_v(ji,jj+1) + ztio_v(ji+1,jj+1) )
+               ! ... open-ocean (lead) fraction at U- & V-points (from T-point values)
+               zfrldu = 0.5 * ( frld (ji,jj) + frld (ji+1,jj  ) )
+               zfrldv = 0.5 * ( frld (ji,jj) + frld (ji  ,jj+1) )
+               ! update surface ocean stress
+               utau(ji,jj) = zfrldu * utau(ji,jj) + ( 1. - zfrldu ) * zutau
+               vtau(ji,jj) = zfrldv * vtau(ji,jj) + ( 1. - zfrldv ) * zvtau
+               !
+            END DO
+         END DO
+
+         ! boundary condition on the stress (utau,vtau)
+         CALL lbc_lnk( utau, 'U', -1. )
+         CALL lbc_lnk( vtau, 'V', -1. )
+
+      ENDIF
+
+      !-----------------------------------------------!
+      !   Storing the transmitted variables           !
+      !-----------------------------------------------!
+
+      freeze(:,:) = 1.0 - frld(:,:)       ! Sea ice cover            
+      tn_ice(:,:) = sist(:,:)             ! Ice surface temperature                      
+
+#if defined key_coupled            
+      !------------------------------------------------!
+      !    Computation of snow/ice and ocean albedo    !
+      !------------------------------------------------!
+      zalb  (:,:) = 0.e0
+      zalbp (:,:) = 0.e0
+
+      CALL albedo_ice( sist, hicif, hsnif, zalbp, zalb )
+
+      alb_ice(:,:) =  0.5 * zalbp(:,:) + 0.5 * zalb (:,:)   ! Ice albedo (mean clear and overcast skys)
+#endif
+
+      IF(ln_ctl) THEN
+         CALL prt_ctl(tab2d_1=qsr   , clinfo1=' lim_sbc: qsr    : ', tab2d_2=qns   , clinfo2=' qns     : ')
+         CALL prt_ctl(tab2d_1=emp   , clinfo1=' lim_sbc: emp    : ', tab2d_2=emps  , clinfo2=' emps    : ')
+         CALL prt_ctl(tab2d_1=utau  , clinfo1=' lim_sbc: utau   : ', mask1=umask,   &
+            &         tab2d_2=vtau  , clinfo2=' vtau    : '        , mask2=vmask )
+         CALL prt_ctl(tab2d_1=freeze, clinfo1=' lim_sbc: freeze : ', tab2d_2=tn_ice, clinfo2=' tn_ice  : ')
+      ENDIF 
+   
+    END SUBROUTINE lim_sbc_2
+
+#else
+   !!----------------------------------------------------------------------
+   !!   Default option :        Dummy module       NO LIM 2.0 sea-ice model
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE lim_sbc_2         ! Dummy routine
+   END SUBROUTINE lim_sbc_2
+#endif 
+
+   !!======================================================================
+END MODULE limsbc_2
Index: trunk/NEMO/LIM_SRC_2/limtab_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limtab_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limtab_2.F90	(revision 888)
@@ -21,6 +21,6 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 CONTAINS
Index: trunk/NEMO/LIM_SRC_2/limthd_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limthd_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limthd_2.F90	(revision 888)
@@ -4,4 +4,8 @@
    !!              LIM thermo ice model : ice thermodynamic
    !!======================================================================
+   !! History :  1.0  !  00-01 (LIM)
+   !!            2.0  !  02-07 (C. Ethe, G. Madec) F90
+   !!            2.0  !  03-08 (C. Ethe)  add lim_thd_init
+   !!---------------------------------------------------------------------
 #if defined key_lim2
    !!----------------------------------------------------------------------
@@ -18,5 +22,6 @@
    USE ice_2           ! LIM sea-ice variables
    USE ice_oce         ! sea-ice/ocean variables
-   USE flx_oce         ! sea-ice/ocean forcings variables 
+   USE sbc_oce         ! 
+   USE sbc_ice         ! 
    USE thd_ice_2       ! LIM thermodynamic sea-ice variables
    USE dom_ice_2       ! LIM sea-ice domain
@@ -30,14 +35,11 @@
    PRIVATE
 
-   !! * Routine accessibility
-   PUBLIC lim_thd_2       ! called by lim_step_2
-
-   !! * Module variables
-   REAL(wp)  ::            &  ! constant values
-      epsi20 = 1.e-20   ,  &
-      epsi16 = 1.e-16   ,  &
-      epsi04 = 1.e-04   ,  &
-      zzero  = 0.e0     ,  &
-      zone   = 1.e0
+   PUBLIC   lim_thd_2  ! called by lim_step
+
+   REAL(wp)  ::   epsi20 = 1.e-20   ,  &  ! constant values
+      &           epsi16 = 1.e-16   ,  &
+      &           epsi04 = 1.e-04   ,  &
+      &           zzero  = 0.e0     ,  &
+      &           zone   = 1.e0
 
    !! * Substitutions
@@ -46,6 +48,6 @@
    !!-------- -------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -68,13 +70,8 @@
       !!             - back to the geographic grid
       !!
-      !! ** References :
-      !!       H. Goosse et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90
-      !!
-      !! History :
-      !!   1.0  !  00-01 (LIM)
-      !!   2.0  !  02-07 (C. Ethe, G. Madec) F90
+      !! References :   Goosse et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90
       !!---------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt     ! number of iteration
-
+      !!
       INTEGER  ::   ji, jj,    &   ! dummy loop indices
          nbpb  ,               &   ! nb of icy pts for thermo. cal.
@@ -92,12 +89,10 @@
          zfontn             ,  &   ! heat flux from snow thickness
          zfntlat, zpareff          ! test. the val. of lead heat budget
-      REAL(wp), DIMENSION(jpi,jpj) :: &
-         zhicifp            ,  &   ! ice thickness for outputs
-         zqlbsbq                   ! link with lead energy budget qldif
-      REAL(wp), DIMENSION(jpi,jpj,jpk) :: &
-         zmsk                      ! working array
+      REAL(wp), DIMENSION(jpi,jpj) ::   zhicifp,   &  ! ice thickness for outputs
+         &                              zqlbsbq       ! link with lead energy budget qldif
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zmsk      ! working array
       !!-------------------------------------------------------------------
 
-      IF( kt == nit000  )   CALL lim_thd_init_2  ! Initialization (first time-step only)
+      IF( kt == nit000 )   CALL lim_thd_init_2  ! Initialization (first time-step only)
    
       !-------------------------------------------!
@@ -173,4 +168,6 @@
       !--------------------------------------------------------------------------
 
+      sst_m(:,:) = sst_m(:,:) + rt0
+
       !CDIR NOVERRCHK
       DO jj = 1, jpj
@@ -188,11 +185,11 @@
             !  temperature and turbulent mixing (McPhee, 1992)
             zfric_u        = MAX ( MIN( SQRT( ust2s(ji,jj) ) , zfric_umax ) , zfric_umin )  ! friction velocity
-            fdtcn(ji,jj)  = zindb * rau0 * rcp * 0.006  * zfric_u * ( sst_io(ji,jj) - tfu(ji,jj) ) 
+            fdtcn(ji,jj)  = zindb * rau0 * rcp * 0.006  * zfric_u * ( sst_m(ji,jj) - tfu(ji,jj) ) 
             qdtcn(ji,jj)  = zindb * fdtcn(ji,jj) * frld(ji,jj) * rdt_ice
                         
             !  partial computation of the lead energy budget (qldif)
             zfontn         = ( sprecip(ji,jj) / rhosn ) * xlsn  !   energy for melting
-            zfnsol         = qnsr_oce(ji,jj)  !  total non solar flux
-            qldif(ji,jj)   = tms(ji,jj) * ( qsr_oce(ji,jj) * ( 1.0 - thcm(ji,jj) )   &
+            zfnsol         = qns(ji,jj)                         !  total non solar flux over the ocean
+            qldif(ji,jj)   = tms(ji,jj) * ( qsr(ji,jj) * ( 1.0 - thcm(ji,jj) )   &
                &                               + zfnsol + fdtcn(ji,jj) - zfontn     &
                &                               + ( 1.0 - zindb ) * fsbbq(ji,jj) )   &
@@ -206,5 +203,5 @@
             
             !  energy needed to bring ocean surface layer until its freezing
-            qcmif  (ji,jj) =  rau0 * rcp * fse3t(ji,jj,1) * ( tfu(ji,jj) - sst_io(ji,jj) ) * ( 1 - zinda )
+            qcmif  (ji,jj) =  rau0 * rcp * fse3t(ji,jj,1) * ( tfu(ji,jj) - sst_m(ji,jj) ) * ( 1 - zinda )
             
             !  calculate oceanic heat flux.
@@ -216,4 +213,5 @@
       END DO
       
+      sst_m(:,:) = sst_m(:,:) - rt0
       
       !         Select icy points and fulfill arrays for the vectorial grid.
@@ -258,5 +256,5 @@
          CALL tab_2d_1d_2( nbpb, fr1_i0_1d  (1:nbpb)     , fr1_i0     , jpi, jpj, npb(1:nbpb) )
          CALL tab_2d_1d_2( nbpb, fr2_i0_1d  (1:nbpb)     , fr2_i0     , jpi, jpj, npb(1:nbpb) )
-         CALL tab_2d_1d_2( nbpb, qnsr_ice_1d(1:nbpb)     , qnsr_ice   , jpi, jpj, npb(1:nbpb) )
+         CALL tab_2d_1d_2( nbpb, qns_ice_1d (1:nbpb)     , qns_ice    , jpi, jpj, npb(1:nbpb) )
 #if ! defined key_coupled
          CALL tab_2d_1d_2( nbpb, qla_ice_1d (1:nbpb)     , qla_ice    , jpi, jpj, npb(1:nbpb) )
@@ -404,5 +402,5 @@
          CALL prt_ctl(tab2d_1=qstoif, clinfo1=' lim_thd: qstoif  : ', tab2d_2=fsbbq , clinfo2=' fsbbq  : ')
       ENDIF
-
+       !
     END SUBROUTINE lim_thd_2
 
@@ -419,7 +417,4 @@
       !!
       !! ** input   :   Namelist namicether
-      !!
-      !! history :
-      !!  8.5  ! 03-08 (C. Ethe) original code
       !!-------------------------------------------------------------------
       NAMELIST/namicethd/ hmelt , hiccrit, hicmin, hiclim, amax  ,        &
Index: trunk/NEMO/LIM_SRC_2/limthd_lac_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limthd_lac_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limthd_lac_2.F90	(revision 888)
@@ -30,5 +30,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/LIM_SRC_2/limthd_zdf_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limthd_zdf_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limthd_zdf_2.F90	(revision 888)
@@ -4,7 +4,11 @@
    !!                thermodynamic growth and decay of the ice 
    !!======================================================================
+   !! History :  1.0  !  01-04 (LIM) Original code
+   !!            2.0  !  02-08 (C. Ethe, G. Madec) F90
+   !!----------------------------------------------------------------------
 #if defined key_lim2
    !!----------------------------------------------------------------------
    !!   'key_lim2'                                    LIM 2.0 sea-ice model
+   !!----------------------------------------------------------------------
    !!----------------------------------------------------------------------
    !!   lim_thd_zdf_2 : vertical accr./abl. and lateral ablation of sea ice
@@ -22,18 +26,16 @@
    PRIVATE
 
-   !! * Routine accessibility
-   PUBLIC lim_thd_zdf_2      ! called by lim_thd_2
-
-   !! * Module variables
-   REAL(wp)  ::           &  ! constant values
-      epsi20 = 1.e-20  ,  &
-      epsi13 = 1.e-13  ,  &
-      zzero  = 0.e0    ,  &
-      zone   = 1.e0
+   PUBLIC   lim_thd_zdf_2        ! called by lim_thd_2
+
+   REAL(wp) ::   epsi20 = 1.e-20  ,  &  ! constant values
+      &          epsi13 = 1.e-13  ,  &
+      &          zzero  = 0.e0    ,  &
+      &          zone   = 1.e0
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
 CONTAINS
 
@@ -64,23 +66,12 @@
       !!              - Performs lateral ablation
       !!
-      !! References :
-      !!   Fichefet T. and M. Maqueda 1997, J. Geophys. Res., 102(C6), 12609-12646   
-      !!   Fichefet T. and M. Maqueda 1999, Clim. Dyn, 15(4), 251-268  
+      !! References : Fichefet T. and M. Maqueda 1997, J. Geophys. Res., 102(C6), 12609-12646   
+      !!              Fichefet T. and M. Maqueda 1999, Clim. Dyn, 15(4), 251-268  
+      !!------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kideb    ! Start point on which the  the computation is applied
+      INTEGER, INTENT(in) ::   kiut     ! End point on which the  the computation is applied
       !!
-      !! History :
-      !!   original    : 01-04 (LIM)
-      !!   addition    : 02-08 (C. Ethe, G. Madec)
-      !!------------------------------------------------------------------
-      !! * Arguments
-      INTEGER , INTENT (in) ::  &
-         kideb ,  &  ! Start point on which the  the computation is applied
-         kiut        ! End point on which the  the computation is applied
-
-      !! * Local variables
       INTEGER ::   ji       ! dummy loop indices
-
-      REAL(wp) , DIMENSION(jpij,2) ::  &
-         zqcmlt        ! energy due to surface( /1 ) and bottom melting( /2 )
-
+      REAL(wp), DIMENSION(jpij,2) ::   zqcmlt        ! energy due to surface( /1 ) and bottom melting( /2 )
       REAL(wp), DIMENSION(jpij) ::  &
          ztsmlt      &    ! snow/ice surface melting temperature
@@ -97,6 +88,5 @@
          , zts_old   &    ! previous surface temperature
          , zidsn , z1midsn , zidsnic ! tempory variables
-
-      REAL(wp), DIMENSION(jpij) :: &
+      REAL(wp), DIMENSION(jpij) ::   &
           zfnet       &  ! net heat flux at the top surface( incl. conductive heat flux)
           , zsprecip  &    ! snow accumulation
@@ -109,5 +99,4 @@
           , zfrld_1d    &    ! new sea/ice fraction
           , zep            ! internal temperature of the 2nd layer of the snow/ice system
-
        REAL(wp), DIMENSION(3) :: & 
           zplediag  &    ! principle diagonal, subdiag. and supdiag. of the 
@@ -115,5 +104,4 @@
           , zsupdiag  &    ! of the temperatures inside the snow-ice system
           , zsmbr          ! second member
-
        REAL(wp) :: & 
           zhsu     &     ! thickness of surface layer
@@ -130,5 +118,4 @@
           , zb2 , zd2 , zb3 , zd3 &
           , ztint          ! equivalent temperature at the snow-ice interface
-
        REAL(wp) :: & 
           zexp      &     ! exponential function of the ice thickness
@@ -148,5 +135,4 @@
           , zdtic        &  ! ice internal temp. increment
           , zqnes          ! conductive energy due to ice melting in the first ice layer
-
        REAL(wp) :: & 
           ztbot     &      ! temperature at the bottom surface
@@ -162,5 +148,4 @@
           , zc1, zpc1, zc2, zpc2, zp1, zp2 & ! tempory variables
           , ztb2, ztb3
-
        REAL(wp) :: & 
           zdrmh         &   ! change in snow/ice thick. after snow-ice formation
@@ -181,5 +166,4 @@
        !     Computation of energies due to surface and bottom melting 
        !-----------------------------------------------------------------------
-       
        
        DO ji = kideb , kiut
@@ -201,5 +185,4 @@
        END DO
 
-
        !-------------------------------------------
        !  2. Calculate some intermediate variables.  
@@ -265,5 +248,4 @@
        !     - qstbif_1d, total energy stored in brine pockets (updating)
        !-------------------------------------------------------------------
-
 
        DO ji = kideb , kiut
@@ -288,5 +270,4 @@
        END DO
 
-
        !--------------------------------------------------------------------------------
        !  4. Computation of the surface temperature : determined by considering the 
@@ -333,6 +314,6 @@
           !---computation of the energy balance function 
           zfts    = - z1mi0 (ji) * qsr_ice_1d(ji)   & ! net absorbed solar radiation
-             &      - qnsr_ice_1d(ji)                & ! total non solar radiation
-             &      - zfcsu (ji)                  ! conductive heat flux from the surface
+             &      - qns_ice_1d(ji)                & ! total non solar radiation
+             &      - zfcsu (ji)                      ! conductive heat flux from the surface
           !---computation of surface temperature increment  
           zdts    = -zfts / zdfts
@@ -360,5 +341,5 @@
           sist_1d(ji) = MIN( ztsmlt(ji) , sist_1d(ji) )
 #if ! defined key_coupled
-          qnsr_ice_1d(ji) = qnsr_ice_1d(ji) + dqns_ice_1d(ji) * ( sist_1d(ji) - zts_old(ji) )
+          qns_ice_1d(ji) = qns_ice_1d(ji) + dqns_ice_1d(ji) * ( sist_1d(ji) - zts_old(ji) )
           qla_ice_1d (ji) = qla_ice_1d (ji) + dqla_ice_1d(ji) * ( sist_1d(ji) - zts_old(ji) )
 #endif
@@ -366,11 +347,9 @@
        END DO
 
-     
-
        !     5.2. Calculate available heat for surface ablation. 
        !---------------------------------------------------------------------
 
        DO ji = kideb, kiut
-          zfnet(ji) = qnsr_ice_1d(ji) + z1mi0(ji) * qsr_ice_1d(ji) + zfcsu(ji)          
+          zfnet(ji) = qns_ice_1d(ji) + z1mi0(ji) * qsr_ice_1d(ji) + zfcsu(ji)          
           zfnet(ji) = MAX( zzero , zfnet(ji) )
           zfnet(ji) = zfnet(ji) * MAX( zzero , SIGN( zone , sist_1d(ji) - ztsmlt(ji) ) )
@@ -730,18 +709,11 @@
           dvnbq_1d(ji) = ( 1.0 - frld_1d(ji) ) * ( zhicnew - h_ice_1d(ji) )
           dmgwi_1d(ji) = dmgwi_1d(ji) + ( 1.0 -frld_1d(ji) ) * ( h_snow_1d(ji) - zhsnnew ) * rhosn
-          !  case of natural freshwater flux
-#if defined key_lim_fdd  
-          rdmicif_1d(ji) = rdmicif_1d(ji) + ( 1.0 - frld_1d(ji) )   * ( zhicnew - h_ice_1d(ji) )  * rhoic
+          !---  volume change of ice and snow (used for ocean-ice freshwater flux computation)
+          rdmicif_1d(ji) = rdmicif_1d(ji) + ( 1.0 - frld_1d(ji) )   * ( zhicnew - h_ice_1d (ji) ) * rhoic
           rdmsnif_1d(ji) = rdmsnif_1d(ji) + ( 1.0 - frld_1d(ji) )   * ( zhsnnew - h_snow_1d(ji) ) * rhosn
 
-#else
-          rdmicif_1d(ji) = rdmicif_1d(ji) + ( 1.0 - frld_1d(ji) ) * (  ( zhicnew - h_ice_1d(ji) ) * rhoic   &
-             &                                                    + ( zhsnnew - h_snow_1d(ji) ) * rhosn )
-#endif
-
           !---  Actualize new snow and ice thickness.
-
           h_snow_1d(ji)  = zhsnnew
-          h_ice_1d(ji)  = zhicnew
+          h_ice_1d (ji)  = zhicnew
 
        END DO
@@ -799,16 +771,18 @@
           qstbif_1d(ji) = zdrfrl2 * qstbif_1d(ji)
           frld_1d(ji)    = zfrld_1d(ji)
-
-       END DO
-       
+          !
+       END DO
+       ! 
     END SUBROUTINE lim_thd_zdf_2
+
 #else
-   !!======================================================================
-   !!                       ***  MODULE limthd_zdf_2   ***
-   !!                              no sea ice model  
-   !!======================================================================
+   !!----------------------------------------------------------------------
+   !!   Default Option                                     NO sea-ice model
+   !!----------------------------------------------------------------------
 CONTAINS
    SUBROUTINE lim_thd_zdf_2          ! Empty routine
    END SUBROUTINE lim_thd_zdf_2
 #endif
- END MODULE limthd_zdf_2
+
+   !!======================================================================
+END MODULE limthd_zdf_2
Index: trunk/NEMO/LIM_SRC_2/limtrp_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limtrp_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limtrp_2.F90	(revision 888)
@@ -30,5 +30,5 @@
 
    !! * Routine accessibility
-   PUBLIC lim_trp_2     ! called by ice_step_2
+   PUBLIC lim_trp_2     ! called by sbc_ice_lim_2
 
    !! * Shared module variables
@@ -48,5 +48,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
@@ -112,6 +112,6 @@
          DO jj = 1, jpjm1
             DO ji = 1, jpim1
-               zui_u(ji,jj) = ( u_ice(ji+1,jj  ) + u_ice(ji+1,jj+1) ) / ( MAX( tmu(ji+1,jj  ) + tmu(ji+1,jj+1), zvbord ) )
-               zvi_v(ji,jj) = ( v_ice(ji  ,jj+1) + v_ice(ji+1,jj+1) ) / ( MAX( tmu(ji  ,jj+1) + tmu(ji+1,jj+1), zvbord ) )
+               zui_u(ji,jj) = ( ui_ice(ji+1,jj  ) + ui_ice(ji+1,jj+1) ) / ( MAX( tmu(ji+1,jj  ) + tmu(ji+1,jj+1), zvbord ) )
+               zvi_v(ji,jj) = ( vi_ice(ji  ,jj+1) + vi_ice(ji+1,jj+1) ) / ( MAX( tmu(ji  ,jj+1) + tmu(ji+1,jj+1), zvbord ) )
             END DO
          END DO
@@ -128,5 +128,5 @@
          IF (lk_mpp ) CALL mpp_max(zcfl)
 
-         IF ( zcfl > 0.5 .AND. lwp )   WRITE(numout,*) 'lim_trp : violation of cfl criterion the ',nday,'th day, cfl = ',zcfl
+         IF ( zcfl > 0.5 .AND. lwp )   WRITE(numout,*) 'lim_trp_2 : violation of cfl criterion the ',nday,'th day, cfl = ',zcfl
 
          ! content of properties
Index: trunk/NEMO/LIM_SRC_2/limwri_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limwri_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limwri_2.F90	(revision 888)
@@ -9,5 +9,5 @@
 #if defined key_lim2
    !!----------------------------------------------------------------------
-   !!   'key_lim2'  i                                 LIM 2.0 sea-ice model
+   !!   'key_lim2'                                    LIM 2.0 sea-ice model
    !!----------------------------------------------------------------------
    !!----------------------------------------------------------------------
@@ -15,20 +15,22 @@
    !!   lim_wri_init_2 : initialization and namelist read
    !!----------------------------------------------------------------------
-   USE ioipsl
-   USE dianam    ! build name of file (routine)
    USE phycst
    USE dom_oce
    USE daymod
-   USE in_out_manager
    USE ice_oce         ! ice variables
-   USE flx_oce
+   USE sbc_oce
+   USE sbc_ice
    USE dom_ice_2
    USE ice_2
+
    USE lbclnk
+   USE dianam          ! build name of file (routine)
+   USE in_out_manager
+   USE ioipsl
 
    IMPLICIT NONE
    PRIVATE
 
-   PUBLIC   lim_wri_2        ! routine called by lim_step_2.F90
+   PUBLIC   lim_wri_2      ! routine called by sbc_ice_lim_2
 
    INTEGER, PARAMETER                       ::   jpnoumax = 40   ! maximum number of variable for ice output
@@ -49,7 +51,9 @@
       zone   = 1.e0
 
-   !!----------------------------------------------------------------------
-   !!  LIM 2.0, UCL-LOCEAN-IPSL (2005)
-   !! $Header$
+   !! * Substitutions
+#   include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!  LIM 2.0, UCL-LOCEAN-IPSL (2006)
+   !! $ Id: $
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -79,5 +83,5 @@
       !!-------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt     ! number of iteration
-
+      !!
       INTEGER  ::   ji, jj, jf                      ! dummy loop indices
       CHARACTER(len = 40)  ::   clhstnam, clop
@@ -90,5 +94,5 @@
 
       !                                          !--------------------!
-      IF ( kt == nit000 ) THEN                !   Initialisation   !
+      IF( kt == nit000 ) THEN                    !   Initialisation   !
          !                                       !--------------------!
          CALL lim_wri_init_2 
@@ -97,5 +101,5 @@
 !!Chris         clop     = "ave(only(x))"      !ibug  namelist parameter a ajouter
          clop     = "ave(x)"
-         zout     = nwrite * rdt_ice / nfice
+         zout     = nwrite * rdt_ice / nn_fsbc
          zsec     = 0.
          niter    = 0
@@ -110,9 +114,9 @@
          
          DO jf = 1, noumef
-            IF ( nc(jf) == 1 )   CALL histdef( nice, nam(jf), titn(jf), uni(jf), jpi, jpj   &
-                  &                                , nhorid, 1, 1, 1, -99, 32, clop, zsto, zout )
+            IF( nc(jf) == 1 )   CALL histdef( nice, nam(jf), titn(jf), uni(jf), jpi, jpj   &
+               &                                  , nhorid, 1, 1, 1, -99, 32, clop, zsto, zout )
          END DO
          CALL histend( nice )
-         
+         !
       ENDIF
       !                                          !--------------------!
@@ -120,16 +124,9 @@
       !                                          !--------------------!
 
-!!gm  change the print below to have it only at output time step or when nitend =< 100
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'lim_wri_2 : write ice outputs in NetCDF files at time : ', nyear, nmonth, nday, kt + nfice - 1
-         WRITE(numout,*) '~~~~~~~~~ '
-      ENDIF
-
-      !-- calculs des valeurs instantanees
+      !-- Store instantaneous values in zcmo
       
       zcmo(:,:, 1:jpnoumax ) = 0.e0 
       DO jj = 2 , jpjm1
-         DO ji = 2 , jpim1
+         DO ji = fs_2 , fs_jpim1
             zindh  = MAX( zzero , SIGN( zone , hicif(ji,jj) * (1.0 - frld(ji,jj) ) - 0.10 ) )
             zinda  = MAX( zzero , SIGN( zone , ( 1.0 - frld(ji,jj) ) - 0.10 ) )
@@ -142,23 +139,22 @@
             zcmo(ji,jj,5)  = sist  (ji,jj)
             zcmo(ji,jj,6)  = fbif  (ji,jj)
-            zcmo(ji,jj,7)  = zindb * (  u_ice(ji,jj  ) * tmu(ji,jj  ) + u_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
-                                      + u_ice(ji,jj+1) * tmu(ji,jj+1) + u_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
+            zcmo(ji,jj,7)  = zindb * (  ui_ice(ji,jj  ) * tmu(ji,jj  ) + ui_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
+                                      + ui_ice(ji,jj+1) * tmu(ji,jj+1) + ui_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
                                   / ztmu 
 
-            zcmo(ji,jj,8)  = zindb * (  v_ice(ji,jj  ) * tmu(ji,jj  ) + v_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
-                                      + v_ice(ji,jj+1) * tmu(ji,jj+1) + v_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
+            zcmo(ji,jj,8)  = zindb * (  vi_ice(ji,jj  ) * tmu(ji,jj  ) + vi_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
+                                      + vi_ice(ji,jj+1) * tmu(ji,jj+1) + vi_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
                                   / ztmu
-            zcmo(ji,jj,9)  = sst_io(ji,jj)
-            zcmo(ji,jj,10) = sss_io(ji,jj)
-
-            zcmo(ji,jj,11) = fnsolar(ji,jj) + fsolar(ji,jj)
-            zcmo(ji,jj,12) = fsolar (ji,jj)
-            zcmo(ji,jj,13) = fnsolar(ji,jj)
+            zcmo(ji,jj,9)  = sst_m(ji,jj)
+            zcmo(ji,jj,10) = sss_m(ji,jj)
+            zcmo(ji,jj,11) = qns(ji,jj) + qsr(ji,jj)
+            zcmo(ji,jj,12) = qsr(ji,jj)
+            zcmo(ji,jj,13) = qns(ji,jj)
             ! See thersf for the coefficient
-            zcmo(ji,jj,14) = - fsalt(ji,jj) * rday * ( sss_io(ji,jj) + epsi16 ) / soce
-            zcmo(ji,jj,15) = gtaux(ji,jj)
-            zcmo(ji,jj,16) = gtauy(ji,jj)
-            zcmo(ji,jj,17) = ( 1.0 - frld(ji,jj) ) * qsr_ice (ji,jj) + frld(ji,jj) * qsr_oce (ji,jj)
-            zcmo(ji,jj,18) = ( 1.0 - frld(ji,jj) ) * qnsr_ice(ji,jj) + frld(ji,jj) * qnsr_oce(ji,jj)
+            zcmo(ji,jj,14) = - emps(ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce    !!gm ???
+            zcmo(ji,jj,15) = utaui_ice(ji,jj)
+            zcmo(ji,jj,16) = vtaui_ice(ji,jj)
+            zcmo(ji,jj,17) = qsr_ice(ji,jj)
+            zcmo(ji,jj,18) = qns_ice(ji,jj)
             zcmo(ji,jj,19) = sprecip(ji,jj)
          END DO
@@ -175,5 +171,5 @@
          END DO
          
-         IF ( jf == 7  .OR. jf == 8  .OR. jf == 15 .OR. jf == 16 ) THEN 
+         IF( jf == 7  .OR. jf == 8  .OR. jf == 15 .OR. jf == 16 ) THEN
             CALL lbc_lnk( zfield, 'T', -1. )
          ELSE 
@@ -181,11 +177,9 @@
          ENDIF
          
-         IF ( nc(jf) == 1 ) CALL histwrite( nice, nam(jf), niter, zfield, ndim, ndex51 )
+         IF( nc(jf) == 1 )   CALL histwrite( nice, nam(jf), niter, zfield, ndim, ndex51 )
          
       END DO
       
-      IF ( ( nfice * niter + nit000 - 1 ) >= nitend ) THEN
-         CALL histclo( nice ) 
-      ENDIF
+      IF( ( nn_fsbc * niter + nit000 - 1 ) >= nitend )   CALL histclo( nice ) 
       !
    END SUBROUTINE lim_wri_2
@@ -225,24 +219,18 @@
          field_13, field_14, field_15, field_16, field_17, field_18,   &
          field_19
-!!gm      NAMELIST/namiceout/ noumef, &
-!!           zfield( 1), zfield( 2), zfield( 3), zfield( 4), zfield( 5),   &
-!!           zfield( 6), zfield( 7), zfield( 8), zfield( 9), zfield(10),   &
-!!           zfield(11), zfield(12), zfield(13), zfield(14), zfield(15),   &
-!!gm         zfield(16), zfield(17), zfield(18), zfield(19)
-      !!-------------------------------------------------------------------
-
-      ! Read Namelist namicewri
-      REWIND ( numnam_ice )
+      !!-------------------------------------------------------------------
+
+      REWIND ( numnam_ice )                ! Read Namelist namicewri
       READ   ( numnam_ice  , namiceout )
       
-      zfield(1)  = field_1
-      zfield(2)  = field_2
-      zfield(3)  = field_3
-      zfield(4)  = field_4
-      zfield(5)  = field_5
-      zfield(6)  = field_6
-      zfield(7)  = field_7
-      zfield(8)  = field_8
-      zfield(9)  = field_9
+      zfield( 1) = field_1
+      zfield( 2) = field_2
+      zfield( 3) = field_3
+      zfield( 4) = field_4
+      zfield( 5) = field_5
+      zfield( 6) = field_6
+      zfield( 7) = field_7
+      zfield( 8) = field_8
+      zfield( 9) = field_9
       zfield(10) = field_10
       zfield(11) = field_11
@@ -274,5 +262,5 @@
          DO nf = 1 , noumef         
             WRITE(numout,*) '   ', titn(nf), '   ', nam(nf),'      ', uni(nf),'  ', nc(nf),'        ', cmulti(nf),   &
-               '        ', cadd(nf)
+               &       '        ', cadd(nf)
          END DO
       ENDIF
Index: trunk/NEMO/LIM_SRC_2/limwri_dimg_2.h90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limwri_dimg_2.h90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/limwri_dimg_2.h90	(revision 888)
@@ -2,5 +2,5 @@
    !!----------------------------------------------------------------------
    !!  LIM 2.0, UCL-LOCEAN-IPSL (2005)
-   !! $Header$
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
    !!----------------------------------------------------------------------
@@ -82,5 +82,5 @@
 
        zsto     = rdt_ice
-       zout     = nwrite * rdt_ice / nfice
+       zout     = nwrite * rdt_ice / nn_fsbc
        zsec     = 0.
        niter    = 0
@@ -106,23 +106,23 @@
           zcmo(ji,jj,5)  = sist  (ji,jj)
           zcmo(ji,jj,6)  = fbif  (ji,jj)
-          zcmo(ji,jj,7)  = zindb * (  u_ice(ji,jj  ) * tmu(ji,jj  ) + u_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
-               + u_ice(ji,jj+1) * tmu(ji,jj+1) + u_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
+          zcmo(ji,jj,7)  = zindb * (  ui_ice(ji,jj  ) * tmu(ji,jj  ) + ui_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
+             &                      + ui_ice(ji,jj+1) * tmu(ji,jj+1) + ui_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
                / ztmu 
 
-          zcmo(ji,jj,8)  = zindb * (  v_ice(ji,jj  ) * tmu(ji,jj  ) + v_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
-               + v_ice(ji,jj+1) * tmu(ji,jj+1) + v_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
+          zcmo(ji,jj,8)  = zindb * (  vi_ice(ji,jj  ) * tmu(ji,jj  ) + vi_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
+             &                      + vi_ice(ji,jj+1) * tmu(ji,jj+1) + vi_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
                / ztmu
-          zcmo(ji,jj,9)  = sst_io(ji,jj)
-          zcmo(ji,jj,10) = sss_io(ji,jj)
-
-          zcmo(ji,jj,11) = fnsolar(ji,jj) + fsolar(ji,jj)
-          zcmo(ji,jj,12) = fsolar (ji,jj)
-          zcmo(ji,jj,13) = fnsolar(ji,jj)
+          zcmo(ji,jj,9)  = sst_m(ji,jj)
+          zcmo(ji,jj,10) = sss_m(ji,jj)
+
+          zcmo(ji,jj,11) = qns(ji,jj) + qsr(ji,jj)
+          zcmo(ji,jj,12) = qsr(ji,jj)
+          zcmo(ji,jj,13) = qns(ji,jj)
           ! See thersf for the coefficient
-          zcmo(ji,jj,14) = - fsalt(ji,jj) * rday * ( sss_io(ji,jj) + epsi16 ) / soce
-          zcmo(ji,jj,15) = gtaux(ji,jj)
-          zcmo(ji,jj,16) = gtauy(ji,jj)
-          zcmo(ji,jj,17) = ( 1.0 - frld(ji,jj) ) * qsr_ice (ji,jj) + frld(ji,jj) * qsr_oce (ji,jj)
-          zcmo(ji,jj,18) = ( 1.0 - frld(ji,jj) ) * qnsr_ice(ji,jj) + frld(ji,jj) * qnsr_oce(ji,jj)
+          zcmo(ji,jj,14) = - emps(ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce
+          zcmo(ji,jj,15) = utaui_ice(ji,jj)
+          zcmo(ji,jj,16) = vtaui_ice(ji,jj)
+          zcmo(ji,jj,17) = qsr_ice(ji,jj)
+          zcmo(ji,jj,18) = qns_ice(ji,jj)
           zcmo(ji,jj,19) = sprecip(ji,jj)
        END DO
@@ -132,8 +132,8 @@
     nmoyice = nmoyice + 1 
     ! compute mean value if it is time to write on file
-    IF ( MOD(kt+nfice-1-nit000+1,nwrite) == 0 ) THEN
+    IF ( MOD(kt+nn_fsbc-1-nit000+1,nwrite) == 0 ) THEN
        rcmoy(:,:,:) = rcmoy(:,:,:) / FLOAT(nmoyice)
 #else  
-       IF ( MOD(kt-nfice-1-nit000+1,nwrite) == 0 ) THEN 
+       IF ( MOD(kt-nn_fsbc-1-nit000+1,nwrite) == 0 ) THEN 
           !  case of instantaneaous output rcmoy(:,:, 1:jpnoumax ) = 0.e0
           DO jj = 2 , jpjm1
@@ -149,23 +149,23 @@
                 rcmoy(ji,jj,5)  = sist  (ji,jj)
                 rcmoy(ji,jj,6)  = fbif  (ji,jj)
-                rcmoy(ji,jj,7)  = zindb * (  u_ice(ji,jj  ) * tmu(ji,jj  ) + u_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
-                     + u_ice(ji,jj+1) * tmu(ji,jj+1) + u_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
+                rcmoy(ji,jj,7)  = zindb * (  ui_ice(ji,jj  ) * tmu(ji,jj  ) + ui_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
+                   &                       + ui_ice(ji,jj+1) * tmu(ji,jj+1) + ui_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
                      / ztmu
 
-                rcmoy(ji,jj,8)  = zindb * (  v_ice(ji,jj  ) * tmu(ji,jj  ) + v_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
-                     + v_ice(ji,jj+1) * tmu(ji,jj+1) + v_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
+                rcmoy(ji,jj,8)  = zindb * (  vi_ice(ji,jj  ) * tmu(ji,jj  ) + vi_ice(ji+1,jj  ) * tmu(ji+1,jj  )   &
+                   &                       + vi_ice(ji,jj+1) * tmu(ji,jj+1) + vi_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
                      / ztmu
-                rcmoy(ji,jj,9)  = sst_io(ji,jj)
-                rcmoy(ji,jj,10) = sss_io(ji,jj)
-
-                rcmoy(ji,jj,11) = fnsolar(ji,jj) + fsolar(ji,jj)
-                rcmoy(ji,jj,12) = fsolar (ji,jj)
-                rcmoy(ji,jj,13) = fnsolar(ji,jj)
+                rcmoy(ji,jj,9)  = sst_m(ji,jj)
+                rcmoy(ji,jj,10) = sss_m(ji,jj)
+
+                rcmoy(ji,jj,11) = qns(ji,jj) + qsr(ji,jj)
+                rcmoy(ji,jj,12) = qsr(ji,jj)
+                rcmoy(ji,jj,13) = qns(ji,jj)
                 ! See thersf for the coefficient
-                rcmoy(ji,jj,14) = - fsalt(ji,jj) * rday * ( sss_io(ji,jj) + epsi16 ) / soce
-                rcmoy(ji,jj,15) = gtaux(ji,jj)
-                rcmoy(ji,jj,16) = gtauy(ji,jj)
-                rcmoy(ji,jj,17) = ( 1.0 - frld(ji,jj) ) * qsr_ice (ji,jj) + frld(ji,jj) * qsr_oce (ji,jj)
-                rcmoy(ji,jj,18) = ( 1.0 - frld(ji,jj) ) * qnsr_ice(ji,jj) + frld(ji,jj) * qnsr_oce(ji,jj)
+                rcmoy(ji,jj,14) = - emps(ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce
+                rcmoy(ji,jj,15) = utaui_ice(ji,jj)
+                rcmoy(ji,jj,16) = vtaui_ice(ji,jj)
+                rcmoy(ji,jj,17) = qsr_ice(ji,jj)
+                rcmoy(ji,jj,18) = qns_ice(ji,jj)
                 rcmoy(ji,jj,19) = sprecip(ji,jj)
              END DO
@@ -201,5 +201,5 @@
           rcmoy(:,:,:) = 0.0
           nmoyice = 0 
-       END IF     !  MOD(kt+nfice-1-nit000+1, nwrite == 0 ) !
+       END IF     !  MOD(kt+nn_fsbc-1-nit000+1, nwrite == 0 ) !
 
      END SUBROUTINE lim_wri_2
Index: trunk/NEMO/LIM_SRC_2/par_ice_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/par_ice_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/par_ice_2.F90	(revision 888)
@@ -7,5 +7,5 @@
    !!----------------------------------------------------------------------
    !!  LIM 2.0, UCL-LOCEAN-IPSL (2005)
-   !! $Header$
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
    !!----------------------------------------------------------------------
Index: trunk/NEMO/LIM_SRC_2/thd_ice_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/thd_ice_2.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_2/thd_ice_2.F90	(revision 888)
@@ -9,5 +9,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0, UCL-LOCEAN-IPSL (2005)
-   !! $Header$
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
    !!----------------------------------------------------------------------
@@ -57,5 +57,5 @@
       fr1_i0_1d   ,     &  !:    "                  "      fr1_i0
       fr2_i0_1d   ,     &  !:    "                  "      fr2_i0
-      qnsr_ice_1d ,     &  !:    "                  "      qns_ice
+      qns_ice_1d  ,     &  !:    "                  "      qns_ice
       qfvbq_1d    ,     &  !:    "                  "      qfvbq
       sist_1d     ,     &  !:    "                  "      sist
Index: trunk/NEMO/LIM_SRC_3/ice.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/ice.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/ice.F90	(revision 888)
@@ -9,5 +9,5 @@
    !!----------------------------------------------------------------------
    !!  LIM 3.0, UCL-LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/ice.F90,v 1.4 2005/03/27 18:34:41 opalod Exp $
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
    !!----------------------------------------------------------------------
@@ -493,7 +493,5 @@
       diag_bot_me,                           & ! vertical bottom melt 
       diag_sur_me                              ! vertical surface melt
-   INTEGER , PUBLIC ::   &                      !: indexes of the debugging
-      jiindex,           &                      !  point
-      jjindex
+   INTEGER , PUBLIC ::   jiindx, jjindx        !: indexes of the debugging point
 
 #else
Index: trunk/NEMO/LIM_SRC_3/iceini.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/iceini.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/iceini.F90	(revision 888)
@@ -13,5 +13,6 @@
    USE in_out_manager
    USE ice_oce         ! ice variables
-   USE flx_oce
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE sbc_ice         ! Surface boundary condition: ice fields
    USE phycst          ! Define parameters for the routines
    USE ocfzpt
@@ -50,5 +51,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 3.0,  UCL-ASTR-LOCEAN-IPSL (2008) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/iceini.F90,v 1.4 2005/03/27 18:34:41 opalod Exp $ 
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
@@ -74,9 +75,9 @@
       ! Louvain la Neuve Ice model
       IF( nacc == 1 ) THEN
-          dtsd2   = nfice * rdtmin * 0.5
-          rdt_ice = nfice * rdtmin
+          dtsd2   = nn_fsbc * rdtmin * 0.5
+          rdt_ice = nn_fsbc * rdtmin
       ELSE
-          dtsd2   = nfice * rdt * 0.5
-          rdt_ice = nfice * rdt
+          dtsd2   = nn_fsbc * rdt * 0.5
+          rdt_ice = nn_fsbc * rdt
       ENDIF
 
@@ -104,8 +105,9 @@
       freeze(:,:) = at_i(:,:)   ! initialisation of sea/ice cover    
 # if defined key_coupled
-      alb_ice(:,:) = albege(:,:)      ! sea-ice albedo
+      Must be adpated to LIM3 
+      alb_ice(:,:,:) = albege(:,:)      ! sea-ice albedo
 # endif
       
-      nstart = numit  + nfice      
+      nstart = numit  + nn_fsbc      
       nitrun = nitend - nit000 + 1 
       nlast  = numit  + nitrun 
@@ -188,5 +190,5 @@
 
        WRITE(numout,*) 'lim_itd_ini : Initialization of ice thickness distribution '
-       WRITE(numout,*) '~~~~~~~~~~~~~~~'
+       WRITE(numout,*) '~~~~~~~~~~~~'
 
 !!-- End of declarations
Index: trunk/NEMO/LIM_SRC_3/icestp.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/icestp.F90	(revision 873)
+++ 	(revision )
@@ -1,891 +1,0 @@
-MODULE icestp
-   !!======================================================================
-   !!                       ***  MODULE icestp   ***
-   !!   Sea-Ice model : LIM Sea ice model time-stepping
-   !!======================================================================
-#if defined key_lim3
-   !!----------------------------------------------------------------------
-   !!   'key_lim3' :                                   LIM3 sea-ice model
-   !!----------------------------------------------------------------------
-   !!   ice_stp       : sea-ice model time-stepping
-   !!----------------------------------------------------------------------
-   USE par_ice
-   USE dom_oce
-   USE oce             ! dynamics and tracers variables
-   USE in_out_manager
-   USE ice_oce         ! ice variables
-   USE flx_oce         ! forcings variables
-   USE dom_ice
-   USE cpl_oce         ! nemo add
-   USE daymod
-   USE phycst          ! Define parameters for the routines
-   USE taumod
-   USE ice
-   USE iceini
-   USE ocesbc
-   USE lbclnk
-   USE limdyn
-   USE limtrp
-   USE limthd
-   USE limitd_th
-   USE limitd_me
-   USE limflx
-   USE limdia
-   USE limwri
-   USE limrst
-   USE limupdate       ! update of global variables
-   USE limvar
-   USE prtctl          ! Print control
-
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Routine accessibility
-   PUBLIC ice_stp  ! called by step.F90
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!-----------------------------------------------------
-   !!   LIM 2.0 , UCL-LODYC-IPSL  (2003)
-   !!-----------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE ice_stp ( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE ice_stp  ***
-      !!                   
-      !! ** Purpose :   Louvain la Neuve Sea Ice Model time stepping 
-      !!
-      !! ** Action  : - call the ice dynamics routine 
-      !!              - call the ice advection/diffusion routine 
-      !!              - call the ice thermodynamics routine 
-      !!              - call the routine that computes mass and 
-      !!                heat fluxes at the ice/ocean interface
-      !!              - save the outputs 
-      !!              - save the outputs for restart when necessary
-      !!
-      !! History :
-      !!   1.0  !  99-11  (M. Imbard)  Original code
-      !!        !  01-03  (D. Ludicone, E. Durand, G. Madec) free surf.
-      !!   2.0  !  02-09  (G. Madec, C. Ethe)  F90: Free form and module
-      !!   3.0  !  05-10  (M. Vancoppenolle)   Trend terms, ice salinity, multi-layer model
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt         ! ocean time-step index
-
-      !! * Local declarations
-      INTEGER   ::              & 
-         ji, jj, jk, jl,        &  ! loop indexes
-         index,                 &  ! indexes for ice points
-         numaltests,            &  ! number of alert tests (max 20)
-         alert_id                  ! number of the current alert
-
-      INTEGER, DIMENSION(20) :: &
-         numal                     ! number of alerts positive
-
-      REAL(wp) ::               &
-         ztmelts                   ! ice layer melting point
-      REAL(wp) , DIMENSION(jpi,jpj)    :: &
-         zsss_io, zsss2_io, zsss3_io          ! tempory workspaces
-
-      CHARACTER (len=30), DIMENSION(20) :: &  ! name of alert
-         alname
-      
-      !!----------------------------------------------------------------------
-
-!-------------------------------------------------------------------------------
-! 1) First time step
-!-------------------------------------------------------------------------------
-      !+++++
-      index = 12
-      jiindex = 44
-      jjindex = 140
-
-      WRITE(numout,*) ' The debugging point is : jiindex : ',jiindex,  &
-                                               ' jjindex : ',jjindex
-      !+++++
-
-      IF( kt == nit000 ) THEN
-
-         IF( lk_cpl ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'ice_stp : Louvain la Neuve Ice Model (LIM)'
-            IF(lwp) WRITE(numout,*) '~~~~~~~   coupled case'
-         ELSE
-            IF(lwp) WRITE(numout,*) 'ice_stp : Louvain la Neuve Ice Model (LIM)' 
-            IF(lwp) WRITE(numout,*) '~~~~~~~   forced case using bulk formulea'
-         ENDIF
-
-         gtaux(:,:) = 0.e0  ! Set wind stress to 0 
-         gtauy(:,:) = 0.e0
-
-      ENDIF ! Initial time step
-
-      IF(lwp) WRITE(numout,*) ' ~~~ LIM-@ ~~~      '
-      IF(lwp) WRITE(numout,*) ' Time step : ', kt
-
-!-------------------------------------------------------------------------------
-! 2) SST, SSS, wind stress, ocean velocity and seawater freezing point
-!-------------------------------------------------------------------------------
-
-      !-------------------------------------
-      ! Update SST, SSS and ocean velocity
-      !-------------------------------------
-
-      sst_io(:,:) = sst_io(:,:) + tn(:,:,1) + rt0
-      sss_io(:,:) = sss_io(:,:) + sn(:,:,1)
-
-      ! vectors at F-point
-      DO jj = 2, jpj
-         DO ji = fs_2, jpi  
-            u_io(ji,jj) = u_io(ji,jj) + un(ji,jj,1) 
-            v_io(ji,jj) = v_io(ji,jj) + vn(ji,jj,1) 
-         END DO
-      END DO
-      
-      !------------------------
-      ! Ice model loop starts           
-      !------------------------
-
-      IF( MOD( kt-1, nfice ) == 0 ) THEN
-         
-         !-------------------
-         ! Average SST, SSS
-         !-------------------
-
-         sst_io(:,:) = sst_io(:,:) / FLOAT( nfice ) * tmask(:,:,1)
-         sss_io(:,:) = sss_io(:,:) / FLOAT( nfice )
-
-         !----------------------------------------
-         ! Atmospheric stress and ocean velocity
-         !----------------------------------------
-
-         DO jj = 2, jpj
-            DO ji = fs_2, jpi
-
-               gtaux(ji,jj) = cai / cao * tauxw(ji,jj)
-               gtauy(ji,jj) = cai / cao * tauyw(ji,jj)
-
-               u_io (ji,jj) = u_io(ji,jj) / FLOAT( nfice ) * tmu(ji,jj)
-               v_io (ji,jj) = v_io(ji,jj) / FLOAT( nfice ) * tmv(ji,jj)
-
-            END DO
-         END DO
-
-         ! Boundary conditions
-         CALL lbc_lnk( gtaux(:,:), 'U', -1. )   ! I-point (i.e. ice U-V point)
-         CALL lbc_lnk( gtauy(:,:), 'V', -1. )   ! I-point (i.e. ice U-V point)
-         CALL lbc_lnk( u_io (:,:), 'U', -1. )   ! I-point (i.e. ice U-V point)
-         CALL lbc_lnk( v_io (:,:), 'V', -1. )   ! I-point (i.e. ice U-V point)
-
-         !--------------------------
-         ! Seawater freezing point
-         !--------------------------
-
-         zsss_io (:,:) = SQRT( sss_io(:,:) ) 
-         zsss2_io(:,:) = sss_io(:,:) * sss_io(:,:)
-         zsss3_io(:,:) = zsss_io(:,:) * zsss_io(:,:) * zsss_io(:,:)
-
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               t_bo(ji,jj)  = ABS ( rt0 - 0.0575      * sss_io(ji,jj)      &
-                  &                    + 1.710523e-03 * zsss3_io(ji,jj)    &
-                  &                    - 2.154996e-04 * zsss2_io(ji,jj) )  &
-                            * tms(ji,jj)
-            END DO
-         END DO
-
-         !+++++
-         IF(ln_ctl) THEN         ! print mean trends (used for debugging)
-            CALL prt_ctl_info('Ice Forcings ')
-            CALL prt_ctl(tab2d_1=qsr_oce ,clinfo1=' qsr_oce  : ')
-            CALL prt_ctl(tab2d_1=qnsr_oce,clinfo1=' qnsr_oce : ')
-            CALL prt_ctl(tab2d_1=evap    ,clinfo1=' evap     : ')
-            CALL prt_ctl(tab2d_1=tprecip ,clinfo1=' precip   : ')
-            CALL prt_ctl(tab2d_1=gtaux   ,clinfo1=' u-stress : ', tab2d_2=gtauy   , clinfo2=' v-stress  : ')
-            CALL prt_ctl(tab2d_1=sst_io  ,clinfo1=' sst      : ', tab2d_2=sss_io  , clinfo2=' sss       : ')
-            CALL prt_ctl(tab2d_1=u_io    ,clinfo1=' u_io     : ', tab2d_2=v_io    , clinfo2=' v_io      : ')
-            CALL prt_ctl(tab2d_1=frld    ,clinfo1=' frld   1 : ')
-
-            DO jl = 1, jpl
-               CALL prt_ctl_info('* - category number ', ivar1=jl)
-               CALL prt_ctl(tab3d_1=t_su    , clinfo1=' t_su      : ', kdim=jl)
-               CALL prt_ctl(tab3d_1=qsr_ice , clinfo1=' qsr_ice   : ', kdim=jl)
-               CALL prt_ctl(tab3d_1=qnsr_ice, clinfo1=' qnsr_ice  : ', kdim=jl)
-               CALL prt_ctl(tab3d_1=dqns_ice, clinfo1=' dqns_ice  : ', kdim=jl)
-               CALL prt_ctl(tab3d_1=qla_ice , clinfo1=' qla_ice   : ', kdim=jl)
-               CALL prt_ctl(tab3d_1=dqla_ice, clinfo1=' dqla_ice  : ', kdim=jl)
-            END DO
-         ENDIF
-         !+++++
-
-!----------------------------------------------------------------------------
-! 3) Store old values of ice model global variables
-!----------------------------------------------------------------------------
-
-         old_a_i(:,:,:)   = a_i(:,:,:)     ! ice area
-         old_e_i(:,:,:,:) = e_i(:,:,:,:)   ! ice thermal energy
-         old_v_i(:,:,:)   = v_i(:,:,:)     ! ice volume
-         old_v_s(:,:,:)   = v_s(:,:,:)     ! snow volume
-         old_e_s(:,:,:,:) = e_s(:,:,:,:)   ! snow thermal energy
-         old_smv_i(:,:,:) = smv_i(:,:,:)   ! salt content
-         old_oa_i(:,:,:)  = oa_i(:,:,:)    ! areal age content
-
-         d_a_i_thd(:,:,:)   = 0.0 ; d_a_i_trp(:,:,:)   = 0.0
-         d_v_i_thd(:,:,:)   = 0.0 ; d_v_i_trp(:,:,:)   = 0.0
-         d_e_i_thd(:,:,:,:) = 0.0 ; d_e_i_trp(:,:,:,:) = 0.0
-         d_v_s_thd(:,:,:)   = 0.0 ; d_v_s_trp(:,:,:)   = 0.0
-         d_e_s_thd(:,:,:,:) = 0.0 ; d_e_s_trp(:,:,:,:) = 0.0
-         d_smv_i_thd(:,:,:) = 0.0 ; d_smv_i_trp(:,:,:) = 0.0
-         d_oa_i_thd(:,:,:)  = 0.0 ; d_oa_i_trp(:,:,:)  = 0.0
-
-         fsalt(:,:)     = 0.0     ; fseqv(:,:)     = 0.0
-         fsbri(:,:)     = 0.0     ; fsalt_res(:,:) = 0.0
-         fsalt_rpo(:,:) = 0.0
-         fhmec(:,:)     = 0.0     ; fhbri(:,:) = 0.0; 
-         fmmec(:,:)     = 0.0     ; fheat_res(:,:) = 0.0
-         fheat_rpo(:,:) = 0.0     ; focea2D(:,:) = 0.0
-         fsup2D(:,:)    = 0.0
-
-         diag_sni_gr(:,:) = 0.0   ; diag_lat_gr(:,:) = 0.0
-         diag_bot_gr(:,:) = 0.0   ; diag_dyn_gr(:,:) = 0.0
-         diag_bot_me(:,:) = 0.0   ; diag_sur_me(:,:) = 0.0
-
-         ! dynamical invariants
-         delta_i(:,:) = 0.0
-         divu_i(:,:)  = 0.0
-         shear_i(:,:) = 0.0
-
-         !----------------------
-         ! Ice model time step
-         !----------------------
-         numit = numit + nfice 
-         
-!----------------------------------------------------------------------------
-! 4) Ice routines, compute the trend terms of global variables
-!----------------------------------------------------------------------------
-
-         !                                                           !-----------------------!
-         CALL lim_rst_opn( kt )                                      ! Open Ice restart file !
-         !                                                           !-----------------------!
-
-         !+++++
-         WRITE(numout,*) ' - Beginning the time step - '
-         CALL lim_inst_state(jiindex,jjindex,1)
-         WRITE(numout,*) ' '
-         !+++++
-
-        !---------------------------
-        ! 4.1) Dynamical processes         
-        !---------------------------
-
-        !                                                            !--------------------!
-        CALL lim_dyn                                                 !  Ice dynamics      !  ( rheology/dynamics )
-        !                                                            !--------------------!
-
-        !                                                            !--------------------!
-        CALL lim_trp                                                 !  Ice transport     !
-        !                                                            !--------------------!
-   
-        CALL lim_var_agg(1)  ! aggregate categories, requested
-        CALL lim_var_glo2eqv ! equivalent variables, requested for rafting
-
-        !+++++
-        WRITE(numout,*) ' - After ice dynamics and transport '
-        CALL lim_inst_state(jiindex,jjindex,1)
-        WRITE(numout,*) ' '
-        WRITE(numout,*)
-        WRITE(numout,*) ' Mechanical Check ************** '
-        WRITE(numout,*) ' Check what means ice divergence '
-        WRITE(numout,*) ' Total ice concentration ', at_i (jiindex,jjindex)
-        WRITE(numout,*) ' Total lead fraction     ', ato_i(jiindex,jjindex)
-        WRITE(numout,*) ' Sum of both             ', ato_i(jiindex,jjindex) + at_i(jiindex,jjindex)
-        WRITE(numout,*) ' Sum of both minus 1     ', ato_i(jiindex,jjindex) + at_i(jiindex,jjindex) - 1.00
-        !+++++
-
-        !                                                            !------------------------------------------------!
-        CALL lim_itd_me                                              !  Mechanical redistribution ! (ridging/rafting) !
-        !                                                            !------------------------------------------------!
-
-        !-------------------------
-        ! 4.2 Ice thermodynamics
-        !-------------------------
-
-        CALL lim_var_glo2eqv ! equivalent variables
-        CALL lim_var_agg(1)  ! aggregate ice categories
-        CALL lim_var_bv      ! bulk brine volume (diag)
-
-        !                                                            !--------------------------------!
-        CALL lim_thd                                                 !  Heat diffusion, growth, melt  !
-        !                                                            !--------------------------------!
-     
-        !                                                            !---------------------!
-        !                                                            !  Ice natural aging  !
-        !                                                            !---------------------!
-
-        oa_i(:,:,:) = oa_i(:,:,:) + a_i(:,:,:) * rdt_ice / 86400.00
-
-        !+++++
-        CALL lim_var_glo2eqv ! except the info message that follows, i dont
-                             ! think this one is necessary
-        WRITE(numout,*) ' - After ice thermodynamics '
-        CALL lim_inst_state(jiindex,jjindex,1)
-        !+++++
-
-
-        !                                                            !-------------------------------------------!
-        CALL lim_itd_th                                              !  Remap ice categories, lateral accretion  !
-        !                                                            !-------------------------------------------!
-
-!----------------------------------------------------------------------------
-! 5) Global variables update 
-!----------------------------------------------------------------------------
-
-        CALL lim_var_agg(1)   ! requested by limupdate
-        !                                                            !-------------------------!
-        CALL lim_update                                              ! Global variables update !
-        !                                                            !-------------------------!
-
-        CALL lim_var_glo2eqv ! equivalent variables (outputs)
-        CALL lim_var_agg(2)   ! aggregate ice thickness categories
-
-        !+++++
-        IF(ln_nicep) THEN
-           WRITE(numout,*) ' - Final ice state after lim_update '
-           CALL lim_inst_state(jiindex,jjindex,2)
-           WRITE(numout,*) ' '
-        ENDIF
-        !+++++
-
-!----------------------------------------------------------------------------
-! 6) Fluxes of mass and heat to the ocean
-!----------------------------------------------------------------------------
-
-        !                                                            !------------------------------!
-        CALL lim_flx                                                 ! Ice/Ocean Mass & Heat fluxes !
-        !                                                            !------------------------------!
-
-        !+++++
-        WRITE(numout,*) ' - Final ice state after lim_flx    '
-        CALL lim_inst_state(jiindex,jjindex,3)
-        WRITE(numout,*) ' '
-        !+++++
-
-!----------------------------------------------------------------------------
-! 7) Diagnostics and outputs
-!----------------------------------------------------------------------------
-
-         IF( MOD( numit, ninfo ) == 0 .OR. ntmoy == 1 )  THEN        
-         !                                                           !-------------------------------!
-         CALL lim_dia                                                ! Ice Diagnostics in evolu file !
-         ENDIF                                                       !-------------------------------!
-
-         !                                                           !----------------------------!
-         CALL lim_wri( 1 )                                           ! Ice outputs in icemod file !
-         !                                                           !----------------------------!
-
-         !                                                           !------------------!
-         IF( lrst_ice ) CALL lim_rst_write( kt )                     ! Ice restart file !
-         !                                                           !------------------!
-
-         CALL lim_var_glo2eqv
-
-         ! Re-initialization of forcings
-         qsr_oce (:,:) = 0.e0
-         qsr_ice (:,:,:) = 0.e0
-         qnsr_oce(:,:) = 0.e0
-         qnsr_ice(:,:,:) = 0.e0 
-         dqns_ice(:,:,:) = 0.e0 
-         tprecip (:,:) = 0.e0 
-         sprecip (:,:) = 0.e0
-#if defined key_coupled 
-         rrunoff (:,:) = 0.e0
-         calving (:,:) = 0.e0
-#else
-         qla_ice (:,:,:) = 0.e0
-         dqla_ice(:,:,:) = 0.e0
-         fr1_i0  (:,:) = 0.e0
-         fr2_i0  (:,:) = 0.e0
-         evap    (:,:) = 0.e0
-#endif
-
-!----------------------------------------------------------------------------
-! 7) Alerts in case of model crash
-!----------------------------------------------------------------------------
-
-     numaltests = 10
-     numal(:) = 0
-
-     ! Alert if incompatible volume and concentration
-     alert_id = 2 ! reference number of this alert
-     alname(alert_id) = ' Incompat vol and con         ' ! name of the alert
-
-     DO jl = 1, jpl
-        DO jj = 1, jpj
-           DO ji = 1, jpi
-                 IF ((v_i(ji,jj,jl).NE.0.0).AND.(a_i(ji,jj,jl).EQ.0.0)) THEN
-                    WRITE(numout,*) ' ALERTE 2 '
-                    WRITE(numout,*) ' Incompatible volume and concentration '
-                    WRITE(numout,*) ' at_i     ', at_i(ji,jj)
-                    WRITE(numout,*) ' Point - category', ji, jj, jl
-                    WRITE(numout,*)
-                    WRITE(numout,*) ' a_i *** a_i_old ', a_i(ji,jj,jl), old_a_i(ji,jj,jl)
-                    WRITE(numout,*) ' v_i *** v_i_old ', v_i(ji,jj,jl), old_v_i(ji,jj,jl)
-                    WRITE(numout,*) ' d_a_i_thd/trp   ', d_a_i_thd(ji,jj,jl), d_a_i_trp(ji,jj,jl)
-                    WRITE(numout,*) ' d_v_i_thd/trp   ', d_v_i_thd(ji,jj,jl), d_v_i_trp(ji,jj,jl)
-                    numal(alert_id) = numal(alert_id) + 1
-                 ENDIF
-           END DO
-        END DO
-     END DO
-
-     ! Alerte if very thick ice
-     alert_id = 3 ! reference number of this alert
-     alname(alert_id) = ' Very thick ice               ' ! name of the alert
-     jl = jpl 
-     DO jj = 1, jpj
-        DO ji = 1, jpi
-           IF (ht_i(ji,jj,jl) .GT. 50.0 ) THEN
-              WRITE(numout,*) ' ALERTE 3 '
-              WRITE(numout,*) ' Very thick ice '
-              CALL lim_inst_state(ji,jj,2)
-              WRITE(numout,*) ' '
-              numal(alert_id) = numal(alert_id) + 1
-           ENDIF
-        END DO
-     END DO
-
-     ! Alert if very fast ice
-     alert_id = 4 ! reference number of this alert
-     alname(alert_id) = ' Very fast ice               ' ! name of the alert
-     DO jj = 1, jpj
-        DO ji = 1, jpi
-           IF ( ( ( ABS( u_ice(ji,jj) ) .GT. 0.50) .OR. &
-                  ( ABS( v_ice(ji,jj) ) .GT. 0.50) ) .AND. &
-                ( at_i(ji,jj) .GT. 0.0 ) ) THEN
-              WRITE(numout,*) ' ALERTE 4 '
-              WRITE(numout,*) ' Very fast ice '
-              CALL lim_inst_state(ji,jj,1)
-              WRITE(numout,*) ' ice strength         : ', strength(ji,jj)
-              WRITE(numout,*) ' oceanic stress ftaux : ', ftaux(ji,jj) 
-              WRITE(numout,*) ' oceanic stress ftauy : ', ftauy(ji,jj)
-              WRITE(numout,*) ' atmosph stress gtaux : ', gtaux(ji,jj) 
-              WRITE(numout,*) ' atmosph stress gtauy : ', gtauy(ji,jj)
-              WRITE(numout,*) ' oceanic speed u      : ', u_io(ji,jj)
-              WRITE(numout,*) ' oceanic speed v      : ', v_io(ji,jj)
-              WRITE(numout,*) ' sst                  : ', sst_io(ji,jj)
-              WRITE(numout,*) ' sss                  : ', sss_io(ji,jj)
-              WRITE(numout,*) 
-              numal(alert_id) = numal(alert_id) + 1
-           ENDIF
-        END DO
-     END DO
-
-     ! Alert if there is ice on continents
-     alert_id = 6 ! reference number of this alert
-     alname(alert_id) = ' Ice on continents           ' ! name of the alert
-     DO jj = 1, jpj
-        DO ji = 1, jpi
-           IF ( ( tms(ji,jj) .LE. 0.0 ) .AND. ( at_i(ji,jj) .GT. 0.0 ) ) THEN 
-              WRITE(numout,*) ' ALERTE 6 '
-              WRITE(numout,*) ' Ice on continents '
-              CALL lim_inst_state(ji,jj,1)
-              WRITE(numout,*) ' masks s, u, v        : ', tms(ji,jj), &
-                                                          tmu(ji,jj), &
-                                                          tmv(ji,jj) 
-              WRITE(numout,*) ' sst                  : ', sst_io(ji,jj)
-              WRITE(numout,*) ' sss                  : ', sss_io(ji,jj)
-              WRITE(numout,*) ' at_i(ji,jj)          : ', at_i(ji,jj)
-              WRITE(numout,*) ' v_ice(ji,jj)         : ', v_ice(ji,jj)
-              WRITE(numout,*) ' v_ice(ji,jj-1)       : ', v_ice(ji,jj-1)
-              WRITE(numout,*) ' u_ice(ji-1,jj)       : ', u_ice(ji-1,jj)
-              WRITE(numout,*) ' u_ice(ji,jj)         : ', v_ice(ji,jj)
-
-              numal(alert_id) = numal(alert_id) + 1
-
-           ENDIF
-        END DO
-     END DO
-
-!
-!    ! Alert if very fresh ice
-     alert_id = 7 ! reference number of this alert
-     alname(alert_id) = ' Very fresh ice               ' ! name of the alert
-     DO jl = 1, jpl
-     DO jj = 1, jpj
-        DO ji = 1, jpi
-           IF ( ( ( ABS( sm_i(ji,jj,jl) ) .LT. 0.50) .OR. &
-                  ( ABS( sm_i(ji,jj,jl) ) .LT. 0.50) ) .AND. &
-                ( a_i(ji,jj,jl) .GT. 0.0 ) ) THEN
-!             WRITE(numout,*) ' ALERTE 7 '
-!             WRITE(numout,*) ' Very fresh ice '
-!             CALL lim_inst_state(ji,jj,1)
-!             WRITE(numout,*) ' sst                  : ', sst_io(ji,jj)
-!             WRITE(numout,*) ' sss                  : ', sss_io(ji,jj)
-!             WRITE(numout,*) ' s_i_newice           : ', s_i_newice(ji,jj,1:jpl)
-!             WRITE(numout,*) 
-              numal(alert_id) = numal(alert_id) + 1
-           ENDIF
-        END DO
-     END DO
-     END DO
-!
-
-!    ! Alert if too old ice
-     alert_id = 9 ! reference number of this alert
-     alname(alert_id) = ' Very old   ice               ' ! name of the alert
-     DO jl = 1, jpl
-     DO jj = 1, jpj
-        DO ji = 1, jpi
-           IF ( ( ( ABS( o_i(ji,jj,jl) ) .GT. rdt_ice ) .OR. &
-                  ( ABS( o_i(ji,jj,jl) ) .LT. 0.00) ) .AND. &
-                ( a_i(ji,jj,jl) .GT. 0.0 ) ) THEN
-              WRITE(numout,*) ' ALERTE 9 '
-              WRITE(numout,*) ' Wrong ice age '
-              CALL lim_inst_state(ji,jj,1)
-              WRITE(numout,*) 
-              numal(alert_id) = numal(alert_id) + 1
-           ENDIF
-        END DO
-     END DO
-
-     END DO
-
-     ! Alert on salt flux
-     alert_id = 5 ! reference number of this alert
-     alname(alert_id) = ' High salt flux               ' ! name of the alert
-     DO jj = 1, jpj
-        DO ji = 1, jpi
-           IF (ABS(fsalt(ji,jj)).gt.1.0e-2) THEN
-           WRITE(numout,*) ' ALERTE 5 '
-           WRITE(numout,*) ' High salt flux '
-           CALL lim_inst_state(ji,jj,3)
-           WRITE(numout,*) ' '
-           DO jl = 1, jpl
-              WRITE(numout,*) ' Category no: ', jl
-              WRITE(numout,*) ' a_i        : ', a_i(ji,jj,jl)     , &
-                              ' old_a_i    : ', old_a_i(ji,jj,jl)   
-              WRITE(numout,*) ' d_a_i_trp  : ', d_a_i_trp(ji,jj,jl) , &
-                              ' d_a_i_thd  : ', d_a_i_thd(ji,jj,jl) 
-              WRITE(numout,*) ' v_i        : ', v_i(ji,jj,jl)    , &
-                              ' old_v_i    : ', old_v_i(ji,jj,jl)   
-              WRITE(numout,*) ' d_v_i_trp  : ', d_v_i_trp(ji,jj,jl) , &
-                              ' d_v_i_thd  : ', d_v_i_thd(ji,jj,jl) 
-              WRITE(numout,*) ' '
-              END DO
-              numal(alert_id) = numal(alert_id) + 1
-           ENDIF
-        END DO
-     END DO
-
-     ! Alert if fnsolar very big
-     alert_id = 8 ! reference number of this alert
-     alname(alert_id) = ' fnsolar very big             ' ! name of the alert
-     DO jj = 1, jpj
-        DO ji = 1, jpi
-           IF ( ( ABS( fnsolar(ji,jj) ) .GT. 1500.0 ) .AND. &
-                ( at_i(ji,jj) .GT. 0.0 ) )  THEN
-
-              WRITE(numout,*) ' ALERTE 8 '
-              WRITE(numout,*) ' ji, jj    : ', ji, jj
-              WRITE(numout,*) ' fnsolar : ', fnsolar(ji,jj)
-              WRITE(numout,*) ' Very high non-solar heat flux '
-              WRITE(numout,*) ' sst       : ', sst_io(ji,jj)
-              WRITE(numout,*) ' sss       : ', sss_io(ji,jj)
-              WRITE(numout,*) ' qcmif     : ', qcmif(jiindex,jjindex)
-              WRITE(numout,*) ' qldif     : ', qldif(jiindex,jjindex)
-              WRITE(numout,*) ' qcmif     : ', qcmif(jiindex,jjindex) / rdt_ice
-              WRITE(numout,*) ' qldif     : ', qldif(jiindex,jjindex) / rdt_ice
-              WRITE(numout,*) ' qfvbq     : ', qfvbq(jiindex,jjindex)
-              WRITE(numout,*) ' qdtcn     : ', qdtcn(jiindex,jjindex)
-              WRITE(numout,*) ' qfvbq / dt: ', qfvbq(jiindex,jjindex) / rdt_ice
-              WRITE(numout,*) ' qdtcn / dt: ', qdtcn(jiindex,jjindex) / rdt_ice
-              WRITE(numout,*) ' fdtcn     : ', fdtcn(jiindex,jjindex) 
-              WRITE(numout,*) ' fhmec     : ', fhmec(jiindex,jjindex) 
-              WRITE(numout,*) ' fheat_rpo : ', fheat_rpo(jiindex,jjindex) 
-              WRITE(numout,*) ' fheat_res : ', fheat_res(jiindex,jjindex) 
-              WRITE(numout,*) ' fhbri     : ', fhbri(jiindex,jjindex) 
-
-              CALL lim_inst_state(ji,jj,2)
-              numal(alert_id) = numal(alert_id) + 1
-
-           ENDIF
-        END DO
-     END DO
-     !+++++
- 
-     ! Alert if very warm ice
-     alert_id = 10 ! reference number of this alert
-     alname(alert_id) = ' Very warm ice                ' ! name of the alert
-     numal(alert_id) = 0
-     DO jl = 1, jpl
-     DO jk = 1, nlay_i
-     DO jj = 1, jpj
-        DO ji = 1, jpi
-           ztmelts    =  -tmut*s_i(ji,jj,jk,jl) + rtt
-           IF ( ( t_i(ji,jj,jk,jl) .GE. ztmelts) .AND. &
-                ( v_i(ji,jj,jl)   .GT. 1.0e-6)   .AND. &
-                ( a_i(ji,jj,jl) .GT. 0.0     )  ) THEN
-              WRITE(numout,*) ' ALERTE 10 '
-              WRITE(numout,*) ' ji, jj, jk, jl : ', ji, jj, jk, jl
-              WRITE(numout,*) ' Very warm ice '
-              WRITE(numout,*) ' t_i : ', t_i(ji,jj,jk,jl)
-              WRITE(numout,*) ' e_i : ', e_i(ji,jj,jk,jl)
-              WRITE(numout,*) ' s_i : ', s_i(ji,jj,jk,jl)
-              WRITE(numout,*) ' ztmelts : ', ztmelts
-              numal(alert_id) = numal(alert_id) + 1
-           ENDIF
-        END DO
-     END DO
-     END DO
-     END DO
-
-     alert_id = 1 ! reference number of this alert
-     alname(alert_id) = ' Il n''y a pas d''alerte 1       ' ! name of the alert
-     WRITE(numout,*)
-     WRITE(numout,*) ' All alerts at the end of ice model '
-     DO alert_id = 1, numaltests
-        WRITE(numout,*) alert_id, alname(alert_id)//' : ', numal(alert_id), ' times ! '
-     END DO
-!
-
-      ENDIF ! kt EQ ice time step
-
-   END SUBROUTINE ice_stp
-   
-!------------------------------------------------------------------------------
-   SUBROUTINE lim_inst_state(i,j,n)
-      !!-----------------------------------------------------------------------
-      !!                   ***  ROUTINE lim_inst_state *** 
-      !!                 
-      !! ** Purpose :   Writes global ice state on the (i,j) point 
-      !!                in ocean.ouput 
-      !!                3 possibilities exist 
-      !!                n = 1 -> simple ice state
-      !!                n = 2 -> exhaustive state
-      !!                n = 3 -> ice/ocean salt fluxes
-      !!
-      !! ** input   :   point coordinates (i,j) 
-      !!                n : number of the option
-      !!
-      !! history :
-      !!  9.0  ! 06-12 (M. Vancoppenolle) Original code
-      !!-------------------------------------------------------------------
-      INTEGER, INTENT( in ) ::   i,j,n     ! ocean time-step index
-
-      INTEGER :: jl
-
-      !!-------------------------------------------------------------------
-
-      !----------------
-      !  Simple state
-      !----------------
-
-      IF ( n .EQ. 1 ) THEN
-         WRITE(numout,*) ' lim_inst_state - Point : ',i,j
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
-         WRITE(numout,*) ' Simple state '
-         WRITE(numout,*) ' masks s,u,v   : ', tms(i,j), tmu(i,j), tmv(i,j)
-         WRITE(numout,*) ' lat - long    : ', gphit(i,j), glamt(i,j)
-         WRITE(numout,*) ' Time step     : ', numit
-         WRITE(numout,*) ' - Ice drift   '
-         WRITE(numout,*) '   ~~~~~~~~~~~ '
-         WRITE(numout,*) ' u_ice(i-1,j)  : ', u_ice(i-1,j)
-         WRITE(numout,*) ' u_ice(i  ,j)  : ', u_ice(i,j)
-         WRITE(numout,*) ' v_ice(i  ,j-1): ', v_ice(i,j-1)
-         WRITE(numout,*) ' v_ice(i  ,j)  : ', v_ice(i,j)
-         WRITE(numout,*) ' strength      : ', strength(i,j)
-         WRITE(numout,*)
-         WRITE(numout,*) ' - Cell values '
-         WRITE(numout,*) '   ~~~~~~~~~~~ '
-         WRITE(numout,*) ' cell area     : ', area(i,j)
-         WRITE(numout,*) ' at_i          : ', at_i(i,j)       
-         WRITE(numout,*) ' vt_i          : ', vt_i(i,j)       
-         WRITE(numout,*) ' vt_s          : ', vt_s(i,j)       
-         DO jl = 1, jpl
-            WRITE(numout,*) ' - Category (', jl,')'
-            WRITE(numout,*) ' a_i           : ', a_i(i,j,jl)
-            WRITE(numout,*) ' ht_i          : ', ht_i(i,j,jl)
-            WRITE(numout,*) ' ht_s          : ', ht_s(i,j,jl)
-            WRITE(numout,*) ' v_i           : ', v_i(i,j,jl)
-            WRITE(numout,*) ' v_s           : ', v_s(i,j,jl)
-            WRITE(numout,*) ' e_s           : ', e_s(i,j,1,jl)/1.0e9
-            WRITE(numout,*) ' e_i           : ', e_i(i,j,1:nlay_i,jl)/1.0e9
-            WRITE(numout,*) ' t_su          : ', t_su(i,j,jl)
-            WRITE(numout,*) ' t_snow        : ', t_s(i,j,1,jl)
-            WRITE(numout,*) ' t_i           : ', t_i(i,j,1:nlay_i,jl)
-            WRITE(numout,*) ' sm_i          : ', sm_i(i,j,jl)
-            WRITE(numout,*) ' smv_i         : ', smv_i(i,j,jl)
-            WRITE(numout,*)
-            WRITE(numout,*) ' Pathological case : ', patho_case(i,j,jl)
-         END DO
-      ENDIF
-
-      !--------------------
-      !  Exhaustive state
-      !--------------------
-
-      IF ( n .EQ. 2 ) THEN
-         WRITE(numout,*) ' lim_inst_state - Point : ',i,j
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
-         WRITE(numout,*) ' Exhaustive state '
-         WRITE(numout,*) ' lat - long ', gphit(i,j), glamt(i,j)
-         WRITE(numout,*) ' Time step ', numit
-         WRITE(numout,*) 
-         WRITE(numout,*) ' - Cell values '
-         WRITE(numout,*) '   ~~~~~~~~~~~ '
-         WRITE(numout,*) ' cell area     : ', area(i,j)
-         WRITE(numout,*) ' at_i          : ', at_i(i,j)       
-         WRITE(numout,*) ' vt_i          : ', vt_i(i,j)       
-         WRITE(numout,*) ' vt_s          : ', vt_s(i,j)       
-         WRITE(numout,*) ' sdvt          : ', sdvt(i,j)       
-         WRITE(numout,*) ' u_ice(i-1,j)  : ', u_ice(i-1,j)
-         WRITE(numout,*) ' u_ice(i  ,j)  : ', u_ice(i,j)
-         WRITE(numout,*) ' v_ice(i  ,j-1): ', v_ice(i,j-1)
-         WRITE(numout,*) ' v_ice(i  ,j)  : ', v_ice(i,j)
-         WRITE(numout,*) ' strength      : ', strength(i,j)
-         WRITE(numout,*) ' d_u_ice_dyn   : ', d_u_ice_dyn(i,j), &
-                         ' d_v_ice_dyn   : ', d_v_ice_dyn(i,j)
-         WRITE(numout,*) ' old_u_ice     : ', old_u_ice(i,j)  , &
-                         ' old_v_ice     : ', old_v_ice(i,j)  
-         WRITE(numout,*)
-
-         DO jl = 1, jpl
-              WRITE(numout,*) ' - Category (',jl,')'
-              WRITE(numout,*) '   ~~~~~~~~         ' 
-              WRITE(numout,*) ' ht_i       : ', ht_i(i,j,jl)             , &
-                              ' ht_s       : ', ht_s(i,j,jl)
-              WRITE(numout,*) ' t_i        : ', t_i(i,j,1:nlay_i,jl)
-              WRITE(numout,*) ' t_su       : ', t_su(i,j,jl)             , &
-                              ' t_s        : ', t_s(i,j,1,jl)
-              WRITE(numout,*) ' sm_i       : ', sm_i(i,j,jl)             , &    
-                              ' o_i        : ', o_i(i,j,jl)
-              WRITE(numout,*) ' a_i        : ', a_i(i,j,jl)              , &
-                              ' old_a_i    : ', old_a_i(i,j,jl)   
-              WRITE(numout,*) ' d_a_i_trp  : ', d_a_i_trp(i,j,jl)        , &
-                              ' d_a_i_thd  : ', d_a_i_thd(i,j,jl) 
-              WRITE(numout,*) ' v_i        : ', v_i(i,j,jl)              , &
-                              ' old_v_i    : ', old_v_i(i,j,jl)   
-              WRITE(numout,*) ' d_v_i_trp  : ', d_v_i_trp(i,j,jl)        , &
-                              ' d_v_i_thd  : ', d_v_i_thd(i,j,jl) 
-              WRITE(numout,*) ' v_s        : ', v_s(i,j,jl)              , &
-                              ' old_v_s    : ', old_v_s(i,j,jl)  
-              WRITE(numout,*) ' d_v_s_trp  : ', d_v_s_trp(i,j,jl)        , &
-                              ' d_v_s_thd  : ', d_v_s_thd(i,j,jl)
-              WRITE(numout,*) ' e_i1       : ', e_i(i,j,1,jl)/1.0e9      , &
-                              ' old_ei1    : ', old_e_i(i,j,1,jl)/1.0e9 
-              WRITE(numout,*) ' de_i1_trp  : ', d_e_i_trp(i,j,1,jl)/1.0e9, &
-                              ' de_i1_thd  : ', d_e_i_thd(i,j,1,jl)/1.0e9
-              WRITE(numout,*) ' e_i2       : ', e_i(i,j,2,jl)/1.0e9      , &
-                              ' old_ei2    : ', old_e_i(i,j,2,jl)/1.0e9  
-              WRITE(numout,*) ' de_i2_trp  : ', d_e_i_trp(i,j,2,jl)/1.0e9, &
-                              ' de_i2_thd  : ', d_e_i_thd(i,j,2,jl)/1.0e9
-              WRITE(numout,*) ' e_snow     : ', e_s(i,j,1,jl)            , &
-                              ' old_e_snow : ', old_e_s(i,j,1,jl) 
-              WRITE(numout,*) ' d_e_s_trp  : ', d_e_s_trp(i,j,1,jl)      , &
-                              ' d_e_s_thd  : ', d_e_s_thd(i,j,1,jl)
-              WRITE(numout,*) ' smv_i      : ', smv_i(i,j,jl)            , &
-                              ' old_smv_i  : ', old_smv_i(i,j,jl)   
-              WRITE(numout,*) ' d_smv_i_trp: ', d_smv_i_trp(i,j,jl)      , &
-                              ' d_smv_i_thd: ', d_smv_i_thd(i,j,jl) 
-              WRITE(numout,*) ' oa_i       : ', oa_i(i,j,jl)             , &
-                              ' old_oa_i   : ', old_oa_i(i,j,jl)
-              WRITE(numout,*) ' d_oa_i_trp : ', d_oa_i_trp(i,j,jl)       , &
-                              ' d_oa_i_thd : ', d_oa_i_thd(i,j,jl)
-              WRITE(numout,*) ' Path. case : ', patho_case(i,j,jl)
-        END DO !jl
-
-        WRITE(numout,*)
-        WRITE(numout,*) ' - Heat / FW fluxes '
-        WRITE(numout,*) '   ~~~~~~~~~~~~~~~~ '
-!       WRITE(numout,*) ' fsalt      : ', fsalt(i,j)
-!       WRITE(numout,*) ' fmass      : ', fmass(i,j)
-!       WRITE(numout,*) ' fsbri      : ', fsbri(i,j)
-!       WRITE(numout,*) ' fseqv      : ', fseqv(i,j)
-!       WRITE(numout,*) ' fsalt_res  : ', fsalt_res(i,j)
-        WRITE(numout,*) ' fmmec      : ', fmmec(i,j)
-        WRITE(numout,*) ' fhmec      : ', fhmec(i,j)
-        WRITE(numout,*) ' fhbri      : ', fhbri(i,j)
-        WRITE(numout,*) ' fheat_rpo  : ', fheat_rpo(i,j)
-        WRITE(numout,*) 
-        WRITE(numout,*) ' sst        : ', sst_io(i,j)  
-        WRITE(numout,*) ' sss        : ', sss_io(i,j)  
-        WRITE(numout,*) 
-        WRITE(numout,*) ' - Stresses '
-        WRITE(numout,*) '   ~~~~~~~~ '
-        WRITE(numout,*) ' tauxw      : ', tauxw(i,j) 
-        WRITE(numout,*) ' tauyw      : ', tauyw(i,j)
-        WRITE(numout,*) ' taux       : ', taux(i,j) 
-        WRITE(numout,*) ' tauy       : ', tauy(i,j)
-        WRITE(numout,*) ' ftaux      : ', ftaux(i,j) 
-        WRITE(numout,*) ' ftauy      : ', ftauy(i,j)
-        WRITE(numout,*) ' gtaux      : ', gtaux(i,j) 
-        WRITE(numout,*) ' gtauy      : ', gtauy(i,j)
-        WRITE(numout,*) ' oc. vel. u : ', u_io(i,j)
-        WRITE(numout,*) ' oc. vel. v : ', v_io(i,j)
-     ENDIF
-
-     !---------------------
-     ! Salt / heat fluxes
-     !---------------------
-
-     IF ( n .EQ. 3 ) THEN
-        WRITE(numout,*) ' lim_inst_state - Point : ',i,j
-        WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
-        WRITE(numout,*) ' - Salt / Heat Fluxes '
-        WRITE(numout,*) '   ~~~~~~~~~~~~~~~~ '
-        WRITE(numout,*) ' lat - long ', gphit(i,j), glamt(i,j)
-        WRITE(numout,*) ' Time step ', numit
-        WRITE(numout,*)
-        WRITE(numout,*) ' - Heat fluxes at bottom interface ***'
-        WRITE(numout,*) ' fsolar     : ', fsolar(i,j)
-        WRITE(numout,*) ' fnsolar    : ', fnsolar(i,j)
-        WRITE(numout,*)
-        WRITE(numout,*) ' - Salt fluxes at bottom interface ***'
-        WRITE(numout,*) ' fsalt      : ', fsalt(i,j)
-        WRITE(numout,*) ' fmass      : ', fmass(i,j)
-        WRITE(numout,*) ' fsbri      : ', fsbri(i,j)
-        WRITE(numout,*) ' fseqv      : ', fseqv(i,j)
-        WRITE(numout,*) ' fsalt_res  : ', fsalt_res(i,j)
-        WRITE(numout,*) ' fsalt_rpo  : ', fsalt_rpo(i,j)
-        WRITE(numout,*) ' - Heat fluxes at bottom interface ***'
-        WRITE(numout,*) ' fheat_res  : ', fheat_res(i,j)
-        WRITE(numout,*)
-        WRITE(numout,*) ' - Momentum fluxes '
-        WRITE(numout,*) ' ftaux      : ', ftaux(i,j) 
-        WRITE(numout,*) ' ftauy      : ', ftauy(i,j)
-        WRITE(numout,*) ' gtaux      : ', gtaux(i,j) 
-        WRITE(numout,*) ' gtauy      : ', gtauy(i,j)
-      ENDIF
-
-   END SUBROUTINE
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option                                 NO LIM sea-ice model
-   !!----------------------------------------------------------------------
-   USE in_out_manager
-
-CONTAINS
-
-   SUBROUTINE ice_stp ( kt )            ! Empty routine
-      INTEGER, INTENT( in ) ::   kt     ! ocean time-step index
-
-      IF( kt == nit000 ) THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'No Sea Ice Model'
-         IF(lwp) WRITE(numout,*) '~~~~~~~'
-      ENDIF
-
-   END SUBROUTINE ice_stp
-   
-   SUBROUTINE lim_inst_state(i,j,n)        ! Empty routine
-      INTEGER, INTENT( in ) :: i, j, n
-   END SUBROUTINE
-
-#endif
-
-   !!======================================================================
-END MODULE icestp
Index: trunk/NEMO/LIM_SRC_3/limadv.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limadv.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limadv.F90	(revision 888)
@@ -36,5 +36,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limadv.F90,v 1.4 2005/03/27 18:34:41 opalod Exp $ 
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/LIM_SRC_3/limdia.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limdia.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limdia.F90	(revision 888)
@@ -7,5 +7,5 @@
    !! 1) in lim_dia : add its definition for both hemispheres if wished
    !! 2) add the new titles in lim_dia_init
-   !!
+   !!----------------------------------------------------------------------
 #if defined key_lim3
    !!----------------------------------------------------------------------
@@ -26,4 +26,5 @@
    USE limistate
    USE dom_oce
+   USE sbc_oce         ! Surface boundary condition: ocean fields
 
    IMPLICIT NONE
@@ -73,5 +74,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limdia.F90,v 1.5 2005/03/27 18:34:41 opalod Exp $
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
    !!----------------------------------------------------------------------
@@ -107,5 +108,5 @@
        !---------------------------------------
        zday_min = 273.0        ! zday_min = date of minimum extent, here September 30th
-       zday = FLOAT(numit-nit000) * rdt_ice / ( 86400.0 * FLOAT(nfice) )
+       zday = FLOAT(numit-nit000) * rdt_ice / ( 86400.0 * FLOAT(nn_fsbc) )
        IF (zday.GT.zday_min) THEN 
           zshift_date  =  zday - zday_min
@@ -142,9 +143,9 @@
                 vinfor(31) = vinfor(31) + vt_i(ji,jj)*( u_ice(ji,jj)*u_ice(ji,jj) + & 
                                                         v_ice(ji,jj)*v_ice(ji,jj) )*aire(ji,jj)/1.0e12 
-                vinfor(53) = vinfor(53) + fsalt(ji,jj)*aire(ji,jj) / 1.0e12 !salt flux
+                vinfor(53) = vinfor(53) + emps(ji,jj)*aire(ji,jj) / 1.0e12 !salt flux
                 vinfor(55) = vinfor(55) + fsbri(ji,jj)*aire(ji,jj) / 1.0e12 !brine drainage flux
                 vinfor(57) = vinfor(57) + fseqv(ji,jj)*aire(ji,jj) / 1.0e12 !equivalent salt flux
-                vinfor(59) = vinfor(59) + sst_io(ji,jj)*at_i(ji,jj)*aire(ji,jj) / 1.0e12  !SST
-                vinfor(61) = vinfor(61) + sss_io(ji,jj)*at_i(ji,jj)*aire(ji,jj) / 1.0e12  !SSS
+                vinfor(59) = vinfor(59) +(sst_m(ji,jj)+rt0)*at_i(ji,jj)*aire(ji,jj) / 1.0e12  !SST
+                vinfor(61) = vinfor(61) + sss_m(ji,jj)*at_i(ji,jj)*aire(ji,jj) / 1.0e12  !SSS
                 vinfor(65) = vinfor(65) + et_s(ji,jj)/1.0e9*aire(ji,jj) / 1.0e12  ! snow temperature
                 vinfor(67) = vinfor(67) + et_i(ji,jj)/1.0e9*aire(ji,jj) / 1.0e12       ! ice heat content
@@ -155,5 +156,5 @@
                 vinfor(77) = vinfor(77) + v_i(ji,jj,5)*aire(ji,jj) / 1.0e12 !ice volume
                 vinfor(79) = 0.0
-                vinfor(81) = vinfor(81) + fmass(ji,jj)*aire(ji,jj) / 1.0e12 ! mass flux
+                vinfor(81) = vinfor(81) + emp(ji,jj)*aire(ji,jj) / 1.0e12 ! mass flux
              ENDIF
           END DO
@@ -293,9 +294,9 @@
                 vinfor(32) = vinfor(32) + vt_i(ji,jj)*( u_ice(ji,jj)*u_ice(ji,jj) + & 
                                                         v_ice(ji,jj)*v_ice(ji,jj) )*aire(ji,jj)/1.0e12 !ice vel
-                vinfor(54) = vinfor(54) + at_i(ji,jj)*fsalt(ji,jj)*aire(ji,jj) / 1.0e12 ! Total salt flux
+                vinfor(54) = vinfor(54) + at_i(ji,jj)*emps(ji,jj)*aire(ji,jj) / 1.0e12 ! Total salt flux
                 vinfor(56) = vinfor(56) + at_i(ji,jj)*fsbri(ji,jj)*aire(ji,jj) / 1.0e12 ! Brine drainage salt flux
                 vinfor(58) = vinfor(58) + at_i(ji,jj)*fseqv(ji,jj)*aire(ji,jj) / 1.0e12 ! Equivalent salt flux
-                vinfor(60) = vinfor(60) + sst_io(ji,jj)*at_i(ji,jj)*aire(ji,jj) / 1.0e12  !SST
-                vinfor(62) = vinfor(62) + sss_io(ji,jj)*at_i(ji,jj)*aire(ji,jj) / 1.0e12  !SSS
+                vinfor(60) = vinfor(60) +(sst_m(ji,jj)+rt0)*at_i(ji,jj)*aire(ji,jj) / 1.0e12  !SST
+                vinfor(62) = vinfor(62) + sss_m(ji,jj)*at_i(ji,jj)*aire(ji,jj) / 1.0e12  !SSS
                 vinfor(66) = vinfor(66) + et_s(ji,jj)/1.0e9*aire(ji,jj) / 1.0e12 ! snow temperature
                 vinfor(68) = vinfor(68) + et_i(ji,jj)/1.0e9*aire(ji,jj) / 1.0e12 ! ice enthalpy
@@ -306,5 +307,5 @@
                 vinfor(78) = vinfor(78) + v_i(ji,jj,5)*aire(ji,jj) / 1.0e12 !ice volume
                 vinfor(80) = 0.0
-                vinfor(82) = vinfor(82) + fmass(ji,jj)*aire(ji,jj) / 1.0e12 ! mass flux
+                vinfor(82) = vinfor(82) + emp(ji,jj)*aire(ji,jj) / 1.0e12 ! mass flux
              ENDIF
           END DO
Index: trunk/NEMO/LIM_SRC_3/limdyn.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limdyn.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limdyn.F90	(revision 888)
@@ -16,7 +16,7 @@
    USE dom_ice
    USE dom_oce         ! ocean space and time domain
-   USE taumod
    USE ice
    USE par_ice
+   USE sbc_ice         ! Surface boundary condition: ice fields
    USE ice_oce
    USE iceini
@@ -41,6 +41,6 @@
    !!----------------------------------------------------------------------
    !!   LIM 3.0,  UCL-ASTR-LOCEAN-IPSL (2008)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limdyn.F90,v 1.5 2005/03/27 18:34:41 opalod Exp $
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -90,8 +90,4 @@
       IF ( ln_limdyn ) THEN
 
-         ! ocean velocity
-         u_oce(:,:)  = u_io(:,:) * tmu(:,:)
-         v_oce(:,:)  = v_io(:,:) * tmv(:,:)
-         
          old_u_ice(:,:) = u_ice(:,:) * tmu(:,:)
          old_v_ice(:,:) = v_ice(:,:) * tmv(:,:)
@@ -162,68 +158,21 @@
          ENDIF
 
-         ! Ice-Ocean stress
-         ! ================
-         DO jj = 2, jpjm1
-            zsang  = SIGN(1.e0, gphif(1,jj-1) ) * sangvg
-
-            DO ji = fs_2, fs_jpim1
-               ! computation of wind stress over ocean in X and Y direction
-#if defined key_coupled && defined key_lim_cp1
-!              ztairx =  ( 1.0 - at_i(ji-1,jj)   ) * gtaux(ji-1,jj)   + &
-!                        ( 1.0 - at_i(ji,jj)     ) * gtaux(ji,jj  )   + &
-!                        ( 1.0 - at_i(ji-1,jj-1) ) * gtaux(ji-1,jj-1) + & 
-!                        ( 1.0 - at_i(ji,jj-1)   ) * gtaux(ji,jj-1)
-
-!              ztairy =  ( 1.0 - at_i(ji-1,jj)   ) * gtauy(ji-1,jj  ) + &
-!                        ( 1.0 - at_i(ji,jj  )   ) * gtauy(ji,jj    ) + &
-!                        ( 1.0 - at_i(ji-1,jj-1) ) * gtauy(ji-1,jj-1) + & 
-!                        ( 1.0 - at_i(ji,jj-1)   ) * gtauy(ji,jj-1)
-#else
-               ztairx =  ( 2.0 - at_i(ji,jj) - at_i(ji+1,jj) ) * gtaux(ji,jj) / cai * cao
-               ztairy =  ( 2.0 - at_i(ji,jj) - at_i(ji,jj+1) ) * gtauy(ji,jj) / cai * cao
-
-               zsfrldmx2 = at_i(ji,jj) + at_i(ji+1,jj)
-               zsfrldmy2 = at_i(ji,jj) + at_i(ji,jj+1)
-
-#endif
-               zu_ice   = u_ice(ji,jj) - u_oce(ji,jj)
-               zv_ice   = v_ice(ji,jj) - v_oce(ji,jj)
-               zmod     = SQRT( zu_ice * zu_ice + zv_ice * zv_ice ) 
-
-               ! quadratic drag formulation
-               ztglx   = zsfrldmx2 * rhoco * zmod * ( cangvg * zu_ice - zsang * zv_ice ) 
-               ztgly   = zsfrldmy2 * rhoco * zmod * ( cangvg * zv_ice + zsang * zu_ice ) 
-!
-!              ! IMPORTANT
-!              ! these lignes are bound to prevent numerical oscillations
-!              ! in the ice-ocean stress
-!              ! They are physically ill-based. There is a cleaner solution
-!              ! to try (remember discussion in Paris Gurvan)
-!
-               ztglx   = ztglx * exp( - zmod / 0.5 )
-               ztgly   = ztglx * exp( - zmod / 0.5 )
-
-               tio_u(ji,jj) = - ( ztairx + 1.0 * ztglx ) / ( 2. * rau0 )
-               tio_v(ji,jj) = - ( ztairy + 1.0 * ztgly ) / ( 2. * rau0 )
-            END DO
-         END DO
-         
          ! computation of friction velocity
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1
 
-               zu_ice   = u_ice(ji,jj) - u_io(ji,jj)
+               zu_ice   = u_ice(ji,jj) - u_oce(ji,jj)
                zt11  = rhoco * zu_ice * zu_ice
 
-               zu_ice   = u_ice(ji-1,jj) - u_io(ji-1,jj)
+               zu_ice   = u_ice(ji-1,jj) - u_oce(ji-1,jj)
                zt12  = rhoco * zu_ice * zu_ice
 
-               zv_ice   = v_ice(ji,jj) - v_io(ji,jj)
+               zv_ice   = v_ice(ji,jj) - v_oce(ji,jj)
                zt21  = rhoco * zv_ice * zv_ice
 
-               zv_ice   = v_ice(ji,jj-1) - v_io(ji,jj-1)
+               zv_ice   = v_ice(ji,jj-1) - v_oce(ji,jj-1)
                zt22  = rhoco * zv_ice * zv_ice
-               ztair2 = ( ( gtaux(ji,jj) + gtaux(ji-1,jj) ) / 2. )**2 + &
-                        ( ( gtauy(ji,jj) + gtauy(ji,jj-1) ) / 2. )**2
+               ztair2 = ( ( utaui_ice(ji,jj) + utaui_ice(ji-1,jj) ) / 2. )**2 + &
+                        ( ( vtaui_ice(ji,jj) + vtaui_ice(ji,jj-1) ) / 2. )**2
 
                ! should not be weighted
@@ -241,16 +190,6 @@
           DO jj = 2, jpjm1
              DO ji = fs_2, fs_jpim1
-#if defined key_coupled && defined key_lim_cp1
-                tio_u(ji,jj) = - (  gtaux(ji  ,jj  ) + gtaux(ji-1,jj  )       &
-                   &              + gtaux(ji-1,jj-1) + gtaux(ji  ,jj-1) ) / ( 4 * rau0 )
-
-                tio_v(ji,jj) = - (  gtauy(ji  ,jj )  + gtauy(ji-1,jj  )       &
-                   &              + gtauy(ji-1,jj-1) + gtauy(ji  ,jj-1) ) / ( 4 * rau0 )
-#else
-                tio_u(ji,jj) = - gtaux(ji,jj) / cai * cao / rau0
-                tio_v(ji,jj) = - gtauy(ji,jj) / cai * cao / rau0 
-#endif
-                ztair2 = ( ( gtaux(ji,jj) + gtaux(ji-1,jj) ) / 2. )**2 + &
-                         ( ( gtauy(ji,jj) + gtauy(ji,jj-1) ) / 2. )**2
+                ztair2 = ( ( utaui_ice(ji,jj) + utaui_ice(ji-1,jj) ) / 2. )**2 + &
+                         ( ( vtaui_ice(ji,jj) + vtaui_ice(ji,jj-1) ) / 2. )**2
                 zustm        = SQRT( ztair2  )
 
@@ -262,6 +201,4 @@
 
       CALL lbc_lnk( ust2s, 'T',  1. )   ! T-point
-      CALL lbc_lnk( tio_u, 'U', -1. )   ! I-point (i.e. ice U-V point)
-      CALL lbc_lnk( tio_v, 'V', -1. )   ! I-point (i.e. ice U-V point)
 
       IF(ln_ctl) THEN   ! Control print
@@ -269,5 +206,4 @@
          CALL prt_ctl_info(' - Cell values : ')
          CALL prt_ctl_info('   ~~~~~~~~~~~~~ ')
-         CALL prt_ctl(tab2d_1=tio_u     , clinfo1=' lim_dyn  : tio_u     :', tab2d_2=tio_v , clinfo2=' tio_v :')
          CALL prt_ctl(tab2d_1=ust2s     , clinfo1=' lim_dyn  : ust2s     :')
          CALL prt_ctl(tab2d_1=divu_i    , clinfo1=' lim_dyn  : divu_i    :')
Index: trunk/NEMO/LIM_SRC_3/limflx.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limflx.F90	(revision 873)
+++ 	(revision )
@@ -1,348 +1,0 @@
-MODULE limflx
-   !!======================================================================
-   !!                       ***  MODULE limflx   ***
-   !!           computation of the flux at the sea ice/ocean interface
-   !!======================================================================
-#if defined key_lim3
-   !!----------------------------------------------------------------------
-   !!   'key_lim3'                                      LIM3 sea-ice model
-   !!----------------------------------------------------------------------
-   !!   lim_flx  : flux at the ice / ocean interface
-   !! * Modules used
-   USE par_oce
-   USE phycst
-   USE ocfzpt
-   USE ice_oce
-   USE flx_oce
-   USE dom_oce
-   USE ice
-   USE flxblk
-   USE lbclnk
-   USE in_out_manager
-   USE albedo
-   USE par_ice
-   USE prtctl           ! Print control
-
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Routine accessibility
-   PUBLIC lim_flx       ! called by lim_step
-
-  !! * Module variables
-     REAL(wp)  ::            &  ! constant values
-         epsi16 = 1e-16   ,  &
-         rzero  = 0.0    ,  &
-         rone   = 1.0
-   !! * Substitutions
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limflx.F90,v 1.6 2005/03/27 18:34:41 opalod Exp $
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE lim_flx
-      !!-------------------------------------------------------------------
-      !!                ***  ROUTINE lim_flx ***
-      !!                
-      !!  
-      !! ** Purpose : Computes the mass and heat fluxes to the ocean
-      !!         
-      !! ** Action  : - Initialisation of some variables
-      !!              - comput. of the fluxes at the sea ice/ocean interface
-      !!     
-      !! ** Outputs : - fsolar  : solar heat flux at sea ice/ocean interface
-      !!              - fnsolar : non solar heat flux 
-      !!              - fsalt   : salt flux at sea ice/ocean interface
-      !!              - fmass   : freshwater flux at sea ice/ocean interface
-      !!
-      !!
-      !! ** References :
-      !!       H. Goosse et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90
-      !!         original    : 00-01 (LIM)
-      !!         addition    : 02-07 (C. Ethe, G. Madec)
-      !!---------------------------------------------------------------------
-
-      !! * Modules used
-      !! * Local variables
-      INTEGER ::   ji, jj             ! dummy loop indices
-
-      INTEGER ::   &
-         ifvt, i1mfr, idfr ,   &  ! some switches
-         iflt, ial, iadv, ifral, ifrdv
-      
-      REAL(wp) ::   &
-         zinda  ,              &  ! switch for testing the values of ice concentration
-!!         zfcm1  ,              &  ! solar  heat fluxes
-!!         zfcm2  ,              &  !  non solar heat fluxes
-           zfold  ,            &
-#if defined key_lim_fdd   
-         zfons,                &  ! salt exchanges at the ice/ocean interface
-         zpme                     ! freshwater exchanges at the ice/ocean interface
-#else
-         zprs  , zfons,        &  ! salt exchanges at the ice/ocean interface
-         zpmess                   ! freshwater exchanges at the ice/ocean interface
-#endif
-      REAL(wp), DIMENSION(jpi,jpj) ::  &
-         zfcm1  ,              &  ! solar  heat fluxes
-         zfcm2                    !  non solar heat fluxes      
-#if defined key_coupled    
-      REAL(wp), DIMENSION(jpi,jpj) ::  &
-         zalb  ,               &  ! albedo of ice under overcast sky
-         zalcn ,               &  ! albedo of ocean under overcast sky
-         zalbp ,               &  ! albedo of ice under clear sky
-         zaldum                   ! albedo of ocean under clear sky
-#endif
-      !!---------------------------------------------------------------------
-     
-      !---------------------------------!
-      !      Sea ice/ocean interface    !
-      !---------------------------------!
-       
-      !      heat flux at the ocean surface
-      !-------------------------------------------------------
-      ! pfrld is the lead fraction at the previous time step (actually between TRP and THD)
-      ! changed to old_frld and old ht_i
-       
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            zinda   = 1.0 - MAX( rzero , SIGN( rone , - ( 1.0 - pfrld(ji,jj) ) ) )
-            ifvt    = zinda  *  MAX( rzero , SIGN( rone, -phicif  (ji,jj) ) )  !subscripts are bad here
-            i1mfr   = 1.0 - MAX( rzero , SIGN( rone ,  - ( at_i(ji,jj)       ) ) )
-            idfr    = 1.0 - MAX( rzero , SIGN( rone , ( 1.0 - at_i(ji,jj) ) - pfrld(ji,jj) ) )
-            iflt    = zinda  * (1 - i1mfr) * (1 - ifvt )
-            ial     = ifvt   * i1mfr + ( 1 - ifvt ) * idfr
-            iadv    = ( 1  - i1mfr ) * zinda
-            ifral   = ( 1  - i1mfr * ( 1 - ial ) )   
-            ifrdv   = ( 1  - ifral * ( 1 - ial ) ) * iadv 
-
-       ! switch --- 1.0 ---------------- 0.0 --------------------
-       ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-       ! zinda   | if pfrld = 1       | if pfrld < 1            |
-       !  -> ifvt| if pfrld old_ht_i
-       ! i1mfr   | if frld = 1        | if frld  < 1            |
-       ! idfr    | if frld <= pfrld    | if frld > pfrld        |
-       ! iflt    | 
-       ! ial     |
-       ! iadv    |
-       ! ifral
-       ! ifrdv
-
-            !   computation the solar flux at ocean surface
-            zfcm1(ji,jj)   = pfrld(ji,jj) * qsr_oce(ji,jj)  + ( 1. - pfrld(ji,jj) ) * fstric(ji,jj)
-                ! fstric     Solar flux transmitted trough the ice
-                ! qsr_oce    Net short wave heat flux on free ocean
-! new line
-            fscmbq(ji,jj) = ( 1.0 - pfrld(ji,jj) ) * fstric(ji,jj)
-
-            !  computation the non solar heat flux at ocean surface
-            zfcm2(ji,jj) = - zfcm1(ji,jj)                  &
-               &           + iflt    * ( fscmbq(ji,jj) )   & ! total abl -> fscmbq is given to the ocean
-! fscmbq and ffltbif are obsolete
-!              &           + iflt * ffltbif(ji,jj) !!! only if one category is used
-               &           + ifral   * ( ial * qcmif(ji,jj) + (1 - ial) * qldif(ji,jj) ) / rdt_ice   &
-               &           + ifrdv   * ( qfvbq(ji,jj) + qdtcn(ji,jj) ) / rdt_ice                     &
-               &           + fhmec(ji,jj)     & ! new contribution due to snow melt in ridging!!
-               &           + fheat_rpo(ji,jj) & ! contribution from ridge formation
-               &           + fheat_res(ji,jj)
-                ! fscmbq  Part of the solar radiation transmitted through the ice and going to the ocean
-                !         computed in limthd_zdf.F90
-                ! ffltbif Total heat content of the ice (brine pockets+ice) / delta_t
-                ! qcmif   Energy needed to bring the ocean surface layer until its freezing (ok)
-                ! qldif   heat balance of the lead (or of the open ocean)
-                ! qfvbq   i think this is wrong!
-                ! ---> Array used to store energy in case of total lateral ablation
-                ! qfvbq latent heat uptake/release after accretion/ablation
-                ! qdtcn Energy from the turbulent oceanic heat flux heat flux coming in the lead
-
-            IF ( num_sal .EQ. 2 ) zfcm2(ji,jj) = zfcm2(ji,jj) + &
-                                  fhbri(ji,jj) ! new contribution due to brine drainage 
-
-            ! bottom radiative component is sent to the computation of the
-            ! oceanic heat flux
-            fsbbq(ji,jj) = ( 1.0 - ( ifvt + iflt ) ) * fscmbq(ji,jj)     
-
-            ! used to compute the oceanic heat flux at the next time step
-            fsolar (ji,jj) = zfcm1(ji,jj)                                       ! solar heat flux 
-            fnsolar(ji,jj) = zfcm2(ji,jj) - fdtcn(ji,jj)                        ! non solar heat flux
-!                           ! fdtcn : turbulent oceanic heat flux
-
-
-            IF ( ( ji .EQ. jiindex ) .AND. ( jj .EQ. jjindex) ) THEN
-               WRITE(numout,*) ' lim_flx : heat fluxes '
-               WRITE(numout,*) ' fsolar    : ', fsolar(jiindex,jjindex)
-               WRITE(numout,*) ' zfcm1     : ', zfcm1(jiindex,jjindex)
-               WRITE(numout,*) ' pfrld     : ', pfrld(jiindex,jjindex)
-               WRITE(numout,*) ' qsr_oce   : ', qsr_oce(jiindex,jjindex)
-               WRITE(numout,*) ' fstric    : ', fstric (jiindex,jjindex)
-               WRITE(numout,*)
-               WRITE(numout,*) ' fnsolar   : ', fnsolar(jiindex,jjindex)
-               WRITE(numout,*) ' zfcm2     : ', zfcm2(jiindex,jjindex)
-               WRITE(numout,*) ' zfcm1     : ', zfcm1(jiindex,jjindex)
-               WRITE(numout,*) ' ifral     : ', ifral
-               WRITE(numout,*) ' ial       : ', ial  
-               WRITE(numout,*) ' qcmif     : ', qcmif(jiindex,jjindex)
-               WRITE(numout,*) ' qldif     : ', qldif(jiindex,jjindex)
-               WRITE(numout,*) ' qcmif / dt: ', qcmif(jiindex,jjindex) / rdt_ice
-               WRITE(numout,*) ' qldif / dt: ', qldif(jiindex,jjindex) / rdt_ice
-               WRITE(numout,*) ' ifrdv     : ', ifrdv
-               WRITE(numout,*) ' qfvbq     : ', qfvbq(jiindex,jjindex)
-               WRITE(numout,*) ' qdtcn     : ', qdtcn(jiindex,jjindex)
-               WRITE(numout,*) ' qfvbq / dt: ', qfvbq(jiindex,jjindex) / rdt_ice
-               WRITE(numout,*) ' qdtcn / dt: ', qdtcn(jiindex,jjindex) / rdt_ice
-               WRITE(numout,*) ' '
-               WRITE(numout,*) ' fdtcn     : ', fdtcn(jiindex,jjindex)
-               WRITE(numout,*) ' fhmec     : ', fhmec(jiindex,jjindex)
-               WRITE(numout,*) ' fheat_rpo : ', fheat_rpo(jiindex,jjindex)
-               WRITE(numout,*) ' fhbri     : ', fhbri(jiindex,jjindex)
-               WRITE(numout,*) ' fheat_res : ', fheat_res(jiindex,jjindex)
-            ENDIF
-         END DO
-      END DO
-       
-      !      mass flux at the ocean surface
-      !-------------------------------------------------------
-!     DO jl = 1, jpl
-!        DO jj = 1, jpj
-!           DO ji = 1, jpi
-!              ! this is probably wrong since rdmicif has already been computed
-!              rdmicif(ji,jj) = rdmicif(ji,jj) + rhoic*d_v_i_thd(ji,jj,jl)
-!           END DO
-!        END DO
-!     END DO
-       
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-#if defined key_lim_fdd
-            !  case of realistic freshwater flux (Tartinville et al., 2001) (presently ACTIVATED)
-            !  ------------------------------------------------------------------------------------- 
-            !  The idea of this approach is that the system that we consider is the ICE-OCEAN system
-            !  Thus  FW  flux  =  External ( E-P+snow melt)
-            !       Salt flux  =  Exchanges in the ice-ocean system then converted into FW
-            !                     Associated to Ice formation AND Ice melting
-            !                     Even if i see Ice melting as a FW and SALT flux
-            !        
-
-            !  computing freshwater exchanges at the ice/ocean interface
-            zpme = - evap(ji,jj) * ( 1.0 - at_i(ji,jj) )     &   !  evaporation over oceanic fraction
-               &   + tprecip(ji,jj)                          &   !  total precipitation
-! old fashioned way               
-!              &   - sprecip(ji,jj) * ( 1. - pfrld(ji,jj) )  &   !  remov. snow precip over ice
-               &   - sprecip(ji,jj) * ( 1. - (pfrld(ji,jj)**betas) )  &   !  remov. snow precip over ice
-               &   - rdmsnif(ji,jj) / rdt_ice                &   !  freshwaterflux due to snow melting 
-! new contribution from snow falling when ridging
-               &   + fmmec(ji,jj)
-            
-            !  computing salt exchanges at the ice/ocean interface
-            !  sice should be the same as computed with the ice model
-            zfons =  ( soce - sice ) * ( rdmicif(ji,jj) / rdt_ice ) 
-! SOCE
-            zfons =  ( sss_io(ji,jj) - sice ) * ( rdmicif(ji,jj) / rdt_ice ) 
-            
-            !  salt flux for constant salinity
-            fsalt(ji,jj)      =  zfons / ( sss_io(ji,jj) + epsi16 ) + fsalt_res(ji,jj)
-            zfold             = fsalt(ji,jj)
-            
-            !  salt flux for variable salinity
-            zinda             = 1.0 - MAX( rzero , SIGN( rone , - ( 1.0 - pfrld(ji,jj) ) ) )
-            !correcting brine and salt fluxes
-            fsbri(ji,jj)      =  zinda*fsbri(ji,jj)
-            !  converting the salt fluxes from ice to a freshwater flux from ocean
-            fsalt_res(ji,jj)  =  fsalt_res(ji,jj) / ( sss_io(ji,jj) + epsi16 )
-            fseqv(ji,jj)      =  fseqv(ji,jj)     / ( sss_io(ji,jj) + epsi16 )
-            fsbri(ji,jj)      =  fsbri(ji,jj)     / ( sss_io(ji,jj) + epsi16 )
-            fsalt_rpo(ji,jj)  =  fsalt_rpo(ji,jj) / ( sss_io(ji,jj) + epsi16 )
-
-            !  freshwater mass exchange (positive to the ice, negative for the ocean ?)
-            !  actually it's a salt flux (so it's minus freshwater flux)
-            !  if sea ice grows, zfons is positive, fsalt also
-            !  POSITIVE SALT FLUX FROM THE ICE TO THE OCEAN
-            !  POSITIVE FRESHWATER FLUX FROM THE OCEAN TO THE ICE [kg.m-2.s-1]
-
-            fmass(ji,jj) = - zpme 
-
-#else
-!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-! ON S'EN TAPE hhhhhhaaaaaaaaaaaaaaaaaahahahahahahahahahahahaha
-!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-            !  case of freshwater flux equivalent as salt flux
-            !  dilution effect due to evaporation and precipitation
-            zprs  = ( tprecip(ji,jj) - sprecip(ji,jj) * ( 1. - pfrld(ji,jj) ) ) * soce  
-!SOCE
-            zprs  = ( tprecip(ji,jj) - sprecip(ji,jj) * ( 1. - pfrld(ji,jj) ) ) * sss_io(ji,jj)
-            !  freshwater flux
-            zfons = rdmicif(ji,jj) * ( soce - sice )  &  !  fwf : ice formation and melting
-               &   -  dmgwi(ji,jj) * sice             &  !  fwf : salt flx needed to bring the fresh snow to sea/ice salinity
-               &   + rdmsnif(ji,jj) * soce               !  fwf to ocean due to snow melting 
-!SOCE
-            zfons = rdmicif(ji,jj) * ( sss_io(ji,jj) - sice )  &  !  fwf : ice formation and melting
-               &   -  dmgwi(ji,jj) * sice             &  !  fwf : salt flx needed to bring the fresh snow to sea/ice salinity
-               &   + rdmsnif(ji,jj) * sss_io(ji,jj)      !  fwf to ocean due to snow melting 
-            !  salt exchanges at the ice/ocean interface
-            zpmess         =  zprs - zfons / rdt_ice - evap(ji,jj) * soce * ( 1.0 - at_i(ji,jj) )
-!SOCE
-            zpmess         =  zprs - zfons / rdt_ice - evap(ji,jj) * sss_io(ji,jj) * ( 1.0 - at_i(ji,jj) )
-
-            fsalt(ji,jj) =  - zpmess
-#endif
-!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-         END DO
-      END DO
-
-      fsalt(:,:) = fseqv(:,:) + fsalt_res(:,:) + fsalt_rpo(:,:)
-      IF (num_sal.eq.2) THEN
-         !In case of variable salinity the salt flux has to be accounted for differently
-         ! Brine drainage has to be added
-         fsalt(:,:) = fsbri(:,:) + fseqv(:,:) + fsalt_res(:,:) + fsalt_rpo(:,:)
-      ENDIF
-
-      !-------------------------------------------------------------------!
-      !  computation of others transmitting variables from ice to ocean   !
-      !------------------------------------------ ------------------------!
-
-      !-----------------------------------------------!
-      !   Storing the transmitted variables           !
-      !-----------------------------------------------!
-
-      ftaux (:,:) = - tio_u(:,:) * rau0   ! taux ( ice: N/m2/rau0, ocean: N/m2 )
-      ftauy (:,:) = - tio_v(:,:) * rau0   ! tauy ( ice: N/m2/rau0, ocean: N/m2 )
-      freeze(:,:) = at_i(:,:)             ! Sea ice cover
-      tn_ice(:,:,:) = t_su(:,:,:)
-
-#if defined key_coupled            
-      zalb  (:,:) = 0.e0
-      zalcn (:,:) = 0.e0
-      zalbp (:,:) = 0.e0
-      zaldum(:,:) = 0.e0
-
-      !------------------------------------------------!
-      !  2) Computation of snow/ice and ocean albedo   !
-      !------------------------------------------------!
-      CALL flx_blk_albedo( zalb, zalcn, zalbp, zaldum )
-
-      alb_ice(:,:) =  0.5 * zalbp(:,:) + 0.5 * zalb (:,:)   ! Ice albedo
-#endif
-
-     IF(ln_ctl) THEN
-        CALL prt_ctl(tab2d_1=fsolar, clinfo1=' lim_flx: fsolar : ', tab2d_2=fnsolar, clinfo2=' fnsolar : ')
-        CALL prt_ctl(tab2d_1=fmass , clinfo1=' lim_flx: fmass  : ', tab2d_2=fsalt  , clinfo2=' fsalt   : ')
-        CALL prt_ctl(tab2d_1=ftaux , clinfo1=' lim_flx: ftaux  : ', tab2d_2=ftauy  , clinfo2=' ftauy   : ')
-        CALL prt_ctl(tab2d_1=freeze, clinfo1=' lim_flx: freeze : ')
-        CALL prt_ctl(tab3d_1=tn_ice, clinfo1=' lim_flx: tn_ice : ', kdim=jpl)
-     ENDIF
-
-    END SUBROUTINE lim_flx
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option :        Empty module           NO LIM sea-ice model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE lim_flx         ! Empty routine
-   END SUBROUTINE lim_flx
-#endif 
-
-END MODULE limflx
Index: trunk/NEMO/LIM_SRC_3/limhdf.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limhdf.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limhdf.F90	(revision 888)
@@ -34,5 +34,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limhdf.F90,v 1.5 2005/03/27 18:34:41 opalod Exp $ 
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/LIM_SRC_3/limistate.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limistate.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limistate.F90	(revision 888)
@@ -16,4 +16,5 @@
    USE oce             ! dynamics and tracers variables
    USE dom_oce
+   USE sbc_oce         ! Surface boundary condition: ocean fields
    USE par_ice         ! ice parameters
    USE ice_oce         ! ice variables
@@ -51,6 +52,6 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limistate.F90,v 1.3 2005/03/27 18:34:41 opalod Exp $
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -93,8 +94,4 @@
       CALL lim_istate_init     !  reading the initials parameters of the ice
 
-      !-- Initialisation of sst,sss,u,v do i=1,jpi
-      u_io(:,:)  = 0.e0       ! ice velocity in x direction
-      v_io(:,:)  = 0.e0       ! ice velocity in y direction
-
       ! Initialisation at tn or -2 if ice
       DO jj = 1, jpj
@@ -104,9 +101,4 @@
          END DO
       END DO
-
-      u_io  (:,:) = 0.
-      v_io  (:,:) = 0.
-      sst_io(:,:) = ( nfice - 1 ) * ( tn(:,:,1) + rt0 )   ! use the ocean initial values
-      sss_io(:,:) = ( nfice - 1 ) *   sn(:,:,1)           ! tricky trick *(nfice-1) !
 
       !--------------------------------------------------------------------
@@ -280,5 +272,5 @@
                   !---------------
                   sm_i(ji,jj,jl)   = zidto * sinn  + ( 1.0 - zidto ) * 0.1
-                  smv_i(ji,jj,jl)  = MIN( sm_i(ji,jj,jl) , sss_io(ji,jj) ) * v_i(ji,jj,jl)
+                  smv_i(ji,jj,jl)  = MIN( sm_i(ji,jj,jl) , sss_m(ji,jj) ) * v_i(ji,jj,jl)
 
                   !----------
@@ -405,5 +397,5 @@
 
                   sm_i(ji,jj,jl)   = zidto * sins  + ( 1.0 - zidto ) * 0.1
-                  smv_i(ji,jj,jl)  = MIN( sm_i(ji,jj,jl) , sss_io(ji,jj) ) * v_i(ji,jj,jl)
+                  smv_i(ji,jj,jl)  = MIN( sm_i(ji,jj,jl) , sss_m(ji,jj) ) * v_i(ji,jj,jl)
 
                   !----------
@@ -538,5 +530,4 @@
 
       CALL lbc_lnk( fsbbq  , 'T', 1. )
-      CALL lbc_lnk( sss_io , 'T', 1. )
 
    END SUBROUTINE lim_istate
Index: trunk/NEMO/LIM_SRC_3/limitd_me.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limitd_me.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limitd_me.F90	(revision 888)
@@ -20,4 +20,5 @@
    USE phycst           ! physical constants (ocean directory) 
    USE ice_oce          ! ice variables
+   USE sbc_oce          ! Surface boundary condition: ocean fields
    USE thd_ice
    USE limistate
@@ -743,5 +744,5 @@
       ! Temporal smoothing
       !--------------------
-      IF ( numit .EQ. nit000 + nfice - 1 ) THEN
+      IF ( numit .EQ. nit000 + nn_fsbc - 1 ) THEN
          strp1(:,:) = 0.0            
          strp2(:,:) = 0.0            
@@ -1194,7 +1195,7 @@
       IF ( con_i ) THEN
          CALL lim_column_sum (jpl,   v_i, vice_init )
-         WRITE(numout,*) ' vice_init  : ', vice_init(jiindex,jjindex)
+         WRITE(numout,*) ' vice_init  : ', vice_init(jiindx,jjindx)
          CALL lim_column_sum_energy (jpl, nlay_i,  e_i, eice_init )
-         WRITE(numout,*) ' eice_init  : ', eice_init(jiindex,jjindex)
+         WRITE(numout,*) ' eice_init  : ', eice_init(jiindx,jjindx)
       ENDIF
 
@@ -1363,5 +1364,5 @@
             ! Salinity
             !-------------
-            smsw(ji,jj)       = sss_io(ji,jj) * vsw(ji,jj) * ridge_por 
+            smsw(ji,jj)       = sss_m(ji,jj) * vsw(ji,jj) * ridge_por 
 
             ! salinity of new ridge
@@ -1447,7 +1448,7 @@
                                         - eirft(ji,jj,jk)
             ! sea water heat content
-            ztmelts          = - tmut * sss_io(ji,jj) + rtt
+            ztmelts          = - tmut * sss_m(ji,jj) + rtt
             ! heat content per unit volume
-            zdummy0          = - rcp * ( sst_io(ji,jj) - rtt ) * vsw(ji,jj)
+            zdummy0          = - rcp * ( sst_m(ji,jj) + rt0 - rtt ) * vsw(ji,jj)
 
             ! corrected sea water salinity
@@ -1616,12 +1617,12 @@
          fieldid = ' v_i : limitd_me '
          CALL lim_cons_check (vice_init, vice_final, 1.0e-6, fieldid) 
-         WRITE(numout,*) ' vice_init  : ', vice_init(jiindex,jjindex)
-         WRITE(numout,*) ' vice_final : ', vice_final(jiindex,jjindex)
+         WRITE(numout,*) ' vice_init  : ', vice_init(jiindx,jjindx)
+         WRITE(numout,*) ' vice_final : ', vice_final(jiindx,jjindx)
 
          CALL lim_column_sum_energy (jpl, nlay_i,  e_i, eice_final )
          fieldid = ' e_i : limitd_me '
          CALL lim_cons_check (eice_init, eice_final, 1.0e-2, fieldid) 
-         WRITE(numout,*) ' eice_init  : ', eice_init(jiindex,jjindex)
-         WRITE(numout,*) ' eice_final : ', eice_final(jiindex,jjindex)
+         WRITE(numout,*) ' eice_init  : ', eice_init(jiindx,jjindx)
+         WRITE(numout,*) ' eice_final : ', eice_final(jiindx,jjindx)
       ENDIF
 
@@ -1839,11 +1840,11 @@
 !           fresh_hist(i,j) = fresh_hist(i,j) + xtmp
 
-!           fsalt_res(ji,jj)  = fsalt_res(ji,jj) + ( sss_io(ji,jj)                  ) * & 
+!           fsalt_res(ji,jj)  = fsalt_res(ji,jj) + ( sss_m(ji,jj)                  ) * & 
 !                               rhosn * v_s(ji,jj,jl) / rdt_ice
 
-!           fsalt_res(ji,jj)  = fsalt_res(ji,jj) + ( sss_io(ji,jj) - sm_i(ji,jj,jl) ) * & 
+!           fsalt_res(ji,jj)  = fsalt_res(ji,jj) + ( sss_m(ji,jj) - sm_i(ji,jj,jl) ) * & 
 !                               rhoic * v_i(ji,jj,jl) / rdt_ice
 
-!           fsalt(i,j)      = fsalt(i,j)      + xtmp
+!           emps(i,j)      = emps(i,j)      + xtmp
 !           fsalt_hist(i,j) = fsalt_hist(i,j) + xtmp
 
Index: trunk/NEMO/LIM_SRC_3/limmsh.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limmsh.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limmsh.F90	(revision 888)
@@ -25,5 +25,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 3.0,  UCL-ASTR-LOCEAN-IPSL (2008) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limmsh.F90,v 1.5 2005/03/27 18:34:42 opalod Exp $ 
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/LIM_SRC_3/limrhg.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limrhg.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limrhg.F90	(revision 888)
@@ -16,4 +16,5 @@
    USE dom_oce
    USE dom_ice
+   USE sbc_ice         ! Surface boundary condition: ice fields
    USE ice
    USE iceini
@@ -40,6 +41,6 @@
    !!----------------------------------------------------------------------
    !!   LIM 3.0,  UCL-LOCEAN-IPSL (2008) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limrhg.F90,v 1.5 2005/03/27 18:34:42 opalod Exp $ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -268,19 +269,19 @@
                                           / ( e2t(ji,jj+1) + e2t(ji,jj) + epsd )
             !
-            u_oce1(ji,jj)  = u_io(ji,jj)
-            v_oce2(ji,jj)  = v_io(ji,jj)
+            u_oce1(ji,jj)  = u_oce(ji,jj)
+            v_oce2(ji,jj)  = v_oce(ji,jj)
 
             ! Ocean has no slip boundary condition
-            v_oce1(ji,jj)  = 0.5*( (v_io(ji,jj)+v_io(ji,jj-1))*e1t(ji,jj)    &
-                &                 +(v_io(ji+1,jj)+v_io(ji+1,jj-1))*e1t(ji+1,jj)) &
+            v_oce1(ji,jj)  = 0.5*( (v_oce(ji,jj)+v_oce(ji,jj-1))*e1t(ji,jj)    &
+                &                 +(v_oce(ji+1,jj)+v_oce(ji+1,jj-1))*e1t(ji+1,jj)) &
                 &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)  
 
-            u_oce2(ji,jj)  = 0.5*((u_io(ji,jj)+u_io(ji-1,jj))*e2t(ji,jj)     &
-                &                 +(u_io(ji,jj+1)+u_io(ji-1,jj+1))*e2t(ji,jj+1)) &
+            u_oce2(ji,jj)  = 0.5*((u_oce(ji,jj)+u_oce(ji-1,jj))*e2t(ji,jj)     &
+                &                 +(u_oce(ji,jj+1)+u_oce(ji-1,jj+1))*e2t(ji,jj+1)) &
                 &                / (e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)
 
             ! Wind stress.
-            ztagnx = ( 1. - zfrld1(ji,jj) ) * gtaux(ji,jj)
-            ztagny = ( 1. - zfrld2(ji,jj) ) * gtauy(ji,jj)
+            ztagnx = ( 1. - zfrld1(ji,jj) ) * utaui_ice(ji,jj)
+            ztagny = ( 1. - zfrld2(ji,jj) ) * vtaui_ice(ji,jj)
 
             ! Computation of the velocity field taking into account the ice internal interaction.
@@ -621,6 +622,6 @@
             zdummy = zindb * vt_i(ji,jj) / MAX(at_i(ji,jj) , 1.0e-06 )
             IF ( zdummy .LE. 5.0e-2 ) THEN
-               u_ice(ji,jj) = u_io(ji,jj)
-               v_ice(ji,jj) = v_io(ji,jj)
+               u_ice(ji,jj) = u_oce(ji,jj)
+               v_ice(ji,jj) = v_oce(ji,jj)
             ENDIF ! zdummy
          END DO
Index: trunk/NEMO/LIM_SRC_3/limrst.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limrst.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limrst.F90	(revision 888)
@@ -18,4 +18,6 @@
    USE dom_oce
    USE ice_oce         ! ice variables
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE sbc_ice         ! Surface boundary condition: ice fields
    USE daymod
    USE iom
@@ -34,5 +36,5 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005)
-   !! $Id:$
+   !! $ Id: $
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -55,7 +57,7 @@
       
       ! to get better performances with NetCDF format:
-      ! we open and define the ice restart file one ice time step before writing the data (-> at nitrst - 2*nfice + 1)
-      ! except if we write ice restart files every ice time step or if an ice restart file was writen at nitend - 2*nfice + 1
-      IF( kt == nitrst - 2*nfice + 1 .OR. nstock == nfice .OR. ( kt == nitend - nfice + 1 .AND. .NOT. lrst_ice ) ) THEN
+      ! we open and define the ice restart file one ice time step before writing the data (-> at nitrst - 2*nn_fsbc + 1)
+      ! except if we write ice restart files every ice time step or if an ice restart file was writen at nitend - 2*nn_fsbc + 1
+      IF( kt == nitrst - 2*nn_fsbc + 1 .OR. nstock == nn_fsbc .OR. ( kt == nitend - nn_fsbc + 1 .AND. .NOT. lrst_ice ) ) THEN
          ! beware of the format used to write kt (default is i8.8, that should be large enough...)
          IF( nitrst > 99999999 ) THEN   ;   WRITE(clkt, *       ) nitrst
@@ -70,7 +72,7 @@
             CASE DEFAULT         ;   WRITE(numout,*) '             open ice restart NetCDF file: '//clname
             END SELECT
-            IF( kt == nitrst - 2*nfice + 1 ) THEN   
-               WRITE(numout,*)         '             kt = nitrst - 2*nfice + 1 = ', kt,' date= ', ndastp
-            ELSE   ;   WRITE(numout,*) '             kt = '                       , kt,' date= ', ndastp
+            IF( kt == nitrst - 2*nn_fsbc + 1 ) THEN   
+               WRITE(numout,*)         '             kt = nitrst - 2*nn_fsbc + 1 = ', kt,' date= ', ndastp
+            ELSE   ;   WRITE(numout,*) '             kt = '                         , kt,' date= ', ndastp
             ENDIF
          ENDIF
@@ -100,5 +102,5 @@
       !!----------------------------------------------------------------------
    
-      iter = kt + nfice - 1   ! ice restarts are written at kt == nitrst - nfice + 1
+      iter = kt + nn_fsbc - 1   ! ice restarts are written at kt == nitrst - nn_fsbc + 1
 
       IF( iter == nitrst ) THEN
@@ -111,6 +113,6 @@
       ! ------------------ 
       !                                                                        ! calendar control
-      CALL iom_rstput( iter, nitrst, numriw, 'nfice' , REAL( nfice, wp) )      ! time-step 
-      CALL iom_rstput( iter, nitrst, numriw, 'kt_ice', REAL( iter , wp) )      ! date
+      CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp) )      ! time-step 
+      CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter , wp) )        ! date
 
       ! Prognostic variables 
@@ -158,6 +160,6 @@
       CALL iom_rstput( iter, nitrst, numriw, 'u_ice'     , u_ice      )
       CALL iom_rstput( iter, nitrst, numriw, 'v_ice'     , v_ice      )
-      CALL iom_rstput( iter, nitrst, numriw, 'gtaux'     , gtaux      )
-      CALL iom_rstput( iter, nitrst, numriw, 'gtauy'     , gtauy      )
+      CALL iom_rstput( iter, nitrst, numriw, 'utaui_ice' , utaui_ice  )
+      CALL iom_rstput( iter, nitrst, numriw, 'vtaui_ice' , vtaui_ice  )
       CALL iom_rstput( iter, nitrst, numriw, 'fsbbq'     , fsbbq      )
       CALL iom_rstput( iter, nitrst, numriw, 'stress1_i' , stress1_i  )
@@ -299,6 +301,6 @@
                WRITE(numout,*) ' ~~~ Arctic'
    
-               ji = jiindex
-               jj = jjindex
+               ji = jiindx
+               jj = jjindx
    
                WRITE(numout,*) ' ji, jj ', ji, jj
@@ -387,5 +389,5 @@
       !!----------------------------------------------------------------------
       ! Local variables
-      INTEGER :: ji, jj, jk, jl, index
+      INTEGER :: ji, jj, jk, jl, indx
       REAL(wp) ::   zfice, ziter
       REAL(wp) :: & !parameters for the salinity profile
@@ -405,6 +407,6 @@
       CALL iom_open ( 'restart_ice_in', numrir, kiolib = jprstlib )
 
-      CALL iom_get( numrir, 'nfice' , zfice )
-      CALL iom_get( numrir, 'kt_ice', ziter )    
+      CALL iom_get( numrir, 'nn_fsbc', zfice )
+      CALL iom_get( numrir, 'kt_ice' , ziter )    
       IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', ziter
       IF(lwp) WRITE(numout,*) '   in any case we force it to nit000 - 1 : ', nit000 - 1
@@ -416,7 +418,7 @@
          &                   '   verify the file or rerun with the value 0 for the',        &
          &                   '   control of time parameter  nrstdt' )
-      IF( INT(zfice) /= nfice          .AND. ABS( nrstdt ) == 1 )   &
-         &     CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nfice in ice restart',  &
-         &                   '   verify the file or rerun with the value 0 for the',        &
+      IF( INT(zfice) /= nn_fsbc          .AND. ABS( nrstdt ) == 1 )   &
+         &     CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nn_fsbc in ice restart',  &
+         &                   '   verify the file or rerun with the value 0 for the',         &
          &                   '   control of time parameter  nrstdt' )
 
@@ -512,6 +514,6 @@
       CALL iom_get( numrir, jpdom_autoglo, 'u_ice'     , u_ice      )
       CALL iom_get( numrir, jpdom_autoglo, 'v_ice'     , v_ice      )
-      CALL iom_get( numrir, jpdom_autoglo, 'gtaux'     , gtaux      )
-      CALL iom_get( numrir, jpdom_autoglo, 'gtauy'     , gtauy      )
+      CALL iom_get( numrir, jpdom_autoglo, 'utaui_ice' , utaui_ice  )
+      CALL iom_get( numrir, jpdom_autoglo, 'vtaui_ice' , vtaui_ice  )
       CALL iom_get( numrir, jpdom_autoglo, 'fsbbq'     , fsbbq      )
       CALL iom_get( numrir, jpdom_autoglo, 'stress1_i' , stress1_i  )
@@ -650,5 +652,5 @@
                WRITE(numout,*) ' ~~~ Arctic'
    
-               index = 1
+               indx = 1
                ji = 24
                jj = 24
Index: trunk/NEMO/LIM_SRC_3/limrst_dimg.h90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limrst_dimg.h90	(revision 873)
+++ 	(revision )
@@ -1,304 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                     *** limrst_dimg.h90  ***
-   !!----------------------------------------------------------------------
-   !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limrst_dimg.h90,v 1.2 2005/03/27 18:34:42 opalod Exp $ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-   SUBROUTINE lim_rst_write( kt )
-      !!-----------------------------------------------------------------------
-      !!                  ***  ROUTINE lim_rst_write  ***
-      !!
-      !! ** Purpose : Write restart fields for the LIM in mpp.
-      !!    one file per process, in the same manner as the ocean.
-      !!  
-      !! ** Methode : Each nstock time step, save  which are necessary
-      !!      for restart
-      !!      Record #1 hold general information on the state of the run
-      !!      Data fields (either 3D or 2D ) starts ar record #2
-      !!
-      !! History :
-      !!   9.0   : 04-05 (J.M. Molines ) from limrst_fdir.h90
-      !!-----------------------------------------------------------------------
-      !! * Arguments
-      USE par_ice
-      INTEGER, INTENT(in)  ::   kt        ! number of iteration
-
-      !- dummy variables :
-      INTEGER :: ji, jj, jf
-      INTEGER :: inum=61, it0, irecl8, irec
-
-      REAL(wp),DIMENSION(jpi,jpj,35) ::  zmoment
-      REAL(wp),DIMENSION(2)          :: zinfo
-
-      CHARACTER(len=45)  ::   ccfile = 'restart_ice_out', clres
-      !!-----------------------------------------------------------------------
-           
-      !! This routine is called from icestep if it is the right time to use it.
-      !! no additional check is necessary.
-
-       ! 0. Initializations
-       ! ------------------
-
-       IF(lwp) THEN
-          WRITE(numout,*) ' '
-          WRITE(numout,*) ' lim_rst_write: output done in inum = ',   &
-               inum,' at it= ',kt,' date= ',ndastp
-          WRITE(numout,*) ' -------'
-       ENDIF
-
-       ! Open direct access file, with reclength for 2D wp fields
-       irecl8= jpi * jpj * wp
-       WRITE(clres,'(a,".",i3.3)') TRIM(ccfile),narea
-       OPEN(inum,FILE=clres,FORM='UNFORMATTED', ACCESS='DIRECT', RECL=irecl8 )
-
-
-      it0      = kt
-      
-      zinfo(1) = FLOAT( nfice )   ! iteration number
-      zinfo(2) = FLOAT( it0 )        ! time-step in second
-
-      ! Write in inum
-
-      zmoment(:,:,1)  = sxice (:,:)
-      zmoment(:,:,2)  = syice (:,:)
-      zmoment(:,:,3)  = sxxice(:,:)
-      zmoment(:,:,4)  = syyice(:,:)
-      zmoment(:,:,5)  = sxyice(:,:)
-      zmoment(:,:,6)  = sxsn  (:,:)
-      zmoment(:,:,7)  = sysn  (:,:)
-      zmoment(:,:,8)  = sxxsn (:,:)
-      zmoment(:,:,9)  = syysn (:,:)
-      zmoment(:,:,10) = sxysn (:,:)
-      zmoment(:,:,11) = sxa   (:,:)
-      zmoment(:,:,12) = sya   (:,:)
-      zmoment(:,:,13) = sxxa  (:,:)
-      zmoment(:,:,14) = syya  (:,:)
-      zmoment(:,:,15) = sxya  (:,:)
-      zmoment(:,:,16) = sxc0  (:,:)
-      zmoment(:,:,17) = syc0  (:,:)
-      zmoment(:,:,18) = sxxc0 (:,:)
-      zmoment(:,:,19) = syyc0 (:,:)
-      zmoment(:,:,20) = sxyc0 (:,:)
-      zmoment(:,:,21) = sxc1  (:,:)
-      zmoment(:,:,22) = syc1  (:,:)
-      zmoment(:,:,23) = sxxc1 (:,:)
-      zmoment(:,:,24) = syyc1 (:,:)
-      zmoment(:,:,25) = sxyc1 (:,:)
-      zmoment(:,:,26) = sxc2  (:,:)
-      zmoment(:,:,27) = syc2  (:,:)
-      zmoment(:,:,28) = sxxc2 (:,:)
-      zmoment(:,:,29) = syyc2 (:,:)
-      zmoment(:,:,30) = sxyc2 (:,:)
-      zmoment(:,:,31) = sxst  (:,:)
-      zmoment(:,:,32) = syst  (:,:)
-      zmoment(:,:,33) = sxxst (:,:)
-      zmoment(:,:,34) = syyst (:,:)
-      zmoment(:,:,35) = sxyst (:,:)
-
-      WRITE(inum,REC=1) irecl8, nfice, it0, &
-          &              ndastp, adatrj, jpi, jpj, jpk,  &
-          &              jpni, jpnj, jpnij, narea, jpiglo, jpjglo, &
-          &              nlcit, nlcjt, nldit, nldjt, nleit, nlejt, nimppt, njmppt
-
-      irec= 2
-      WRITE(inum,REC=irec)  ht_i(:,:,1)          ! prognostic variables
-      irec = irec + 1
-      WRITE(inum,REC=irec)  ht_s(:,:,1)
-      irec = irec + 1
-      WRITE(inum,REC=irec)  frld(:,:)
-      irec = irec + 1
-!     WRITE(inum,REC=irec)  sist(:,:)
-!     irec = irec + 1
-      WRITE(inum,REC=irec)  t_su(:,:,1)
-      irec = irec + 1
-# if defined key_coupled 
-      WRITE(inum,REC=irec)  albege(:,:)
-      irec = irec + 1
-# endif
-!     DO jf=1, jplayersp1
-!     WRITE(inum,REC=irec)  tbif(:,:,jf)
-!     irec = irec + 1
-!     END DO
-! MV 2005
-      DO jf=1, nlay_s
-      WRITE(inum,REC=irec)  t_s(:,:,jf,1)
-      irec = irec + 1
-      END DO
-! END MV 2005
-! MV 2005
-      DO jf=1, nlay_i 
-      WRITE(inum,REC=irec)  t_i(:,:,jf,1)
-      irec = irec + 1
-      END DO
-! END MV 2005
-      WRITE(inum,REC=irec)  u_ice(:,:)
-      irec = irec + 1
-      WRITE(inum,REC=irec)  v_ice(:,:)
-      irec = irec + 1
-      WRITE(inum,REC=irec)  gtaux(:,:)
-      irec = irec + 1
-      WRITE(inum,REC=irec)  gtauy(:,:)
-      irec = irec + 1
-! MV 2005
-!     WRITE(inum,REC=irec)  qstoif(:,:)
-!     irec = irec + 1
-! END MV 2005
-      WRITE(inum,REC=irec)  fsbbq(:,:)
-      irec = irec + 1
-      DO jf=1,35
-      WRITE(inum,REC=irec)  zmoment(:,:,jf)
-      irec = irec + 1
-      END DO
- 
-      CLOSE(inum)
-      
-   END SUBROUTINE lim_rst_write
-
-
-   SUBROUTINE lim_rst_read(kt )
-      !!-----------------------------------------------------------------------
-      !!  restart from a state defined in a binary file
-      !!-----------------------------------------------------------------------
-      !! * Arguments
-      USE par_ice
-      INTEGER ,INTENT(out)  ::   kt        ! number of iteration
-
-      !- dummy variables :
-
-      INTEGER :: ji, jj, jf
-      INTEGER :: inum=71, it0, it1, ifice, irecl8, irec
-
-      REAL(wp),DIMENSION(jpi,jpj,35) ::  zmoment
-      REAL(wp),DIMENSION(2) :: zinfo
-
-      CHARACTER(len=45)  ::   ccfile = 'restart_ice_in',clres
-      !!-----------------------------------------------------------------------
-
-      !Initialisations
-
-       ! Open direct access file, with reclength for 2D wp fields
-       WRITE(clres,'(a,".",i3.3)') TRIM(ccfile),narea
-       OPEN(inum,FILE=clres,FORM='UNFORMATTED', ACCESS='DIRECT', RECL=8)
-       READ(inum,REC=1) irecl8
-       CLOSE(inum)
-
-       OPEN(inum,FILE=clres,FORM='UNFORMATTED', ACCESS='DIRECT', RECL=irecl8)
-       READ(inum,REC=1) irecl8, ifice, it1
-      
-
-      !Read inumrst
-
-      it0          = nit000
-
-
-      IF (lwp) THEN
-      WRITE(numout,*)
-      WRITE(numout,*) 'lim_rst_fdir :  READ restart file name ', ccfile, ' at time step : ', it1
-      WRITE(numout,*) '~~~~~~~~~~~~'
-      END IF
-
-
-      !Control of date
-      
-      IF( ( it0 - it1 ) /= 1 .AND. ABS( nrstdt ) == 1 ) THEN
-         IF (lwp) THEN
-         WRITE(numout,cform_err)
-         WRITE(numout,*) ' ===>>>> : problem with nit000 for the restart'
-         WRITE(numout,*) ' we stop. verify the file or rerun with the value  0 for the'
-         WRITE(numout,*) ' control of time parameter  nrstdt'
-         END IF
-         nstop = nstop + 1
-      ENDIF
-
-
-      irec = 2
-      READ(inum,REC=irec)  ht_i(:,:,1)    ! prognostic variables
-      irec = irec +1
-      READ(inum,REC=irec)  ht_s(:,:,1)
-      irec = irec +1
-      READ(inum,REC=irec)  frld(:,:)
-      irec = irec +1
-!     READ(inum,REC=irec)  sist(:,:)
-!     irec = irec +1
-!RB bug
-      READ(inum,REC=irec)  t_su(:,:)
-      irec = irec +1
-# if defined key_coupled
-      READ(inum,REC=irec)  albege(:,:)
-      irec = irec +1
-# endif
-!     DO jf = 1, jplayersp1
-!     READ(inum,REC=irec)  tbif(:,:,jf)
-!     irec = irec +1
-!     END DO
-! MV 2005
-      DO jf = 1, nlay_s 
-      READ(inum,REC=irec)  t_s(:,:,jf,1)
-      irec = irec +1
-      END DO
-      DO jf = 1, nlay_i 
-      READ(inum,REC=irec)  t_i(:,:,jf)
-      irec = irec +1
-      END DO
-! MV 2005
-      READ(inum,REC=irec)  u_ice(:,:)
-      irec = irec +1
-      READ(inum,REC=irec)  v_ice(:,:)
-      irec = irec +1
-      READ(inum,REC=irec)  gtaux(:,:)
-      irec = irec +1
-      READ(inum,REC=irec)  gtauy(:,:)
-      irec = irec +1
-! MV 2005
-!     READ(inum,REC=irec)  qstoif(:,:)
-!     irec = irec +1
-! END MV 2005
-      READ(inum,REC=irec)  fsbbq(:,:)
-      irec = irec +1
-      DO jf = 1, 35
-      READ(inum,REC=irec)  zmoment(:,:,jf)
-      irec = irec +1
-      END DO
- 
-      CLOSE(inum)
-
-      kt = it1
-            sxice(:,:)  = zmoment(:,:,1)
-            syice(:,:)  = zmoment(:,:,2)
-            sxxice(:,:) = zmoment(:,:,3)
-            syyice(:,:) = zmoment(:,:,4)
-            sxyice(:,:) = zmoment(:,:,5)
-            sxsn(:,:)   = zmoment(:,:,6)
-            sysn(:,:)   = zmoment(:,:,7)
-            sxxsn(:,:)  = zmoment(:,:,8)
-            syysn(:,:)  = zmoment(:,:,9)
-            sxysn(:,:)  = zmoment(:,:,10)
-            sxa(:,:)    = zmoment(:,:,11)
-            sya(:,:)    = zmoment(:,:,12)
-            sxxa(:,:)   = zmoment(:,:,13)
-            syya(:,:)   = zmoment(:,:,14)
-            sxya(:,:)   = zmoment(:,:,15)
-            sxc0(:,:)   = zmoment(:,:,16)
-            syc0(:,:)   = zmoment(:,:,17)
-            sxxc0(:,:)  = zmoment(:,:,18)
-            syyc0(:,:)  = zmoment(:,:,19)
-            sxyc0(:,:)  = zmoment(:,:,20)
-            sxc1(:,:)   = zmoment(:,:,21)
-            syc1(:,:)   = zmoment(:,:,22)
-            sxxc1(:,:)  = zmoment(:,:,23)
-            syyc1(:,:)  = zmoment(:,:,24)
-            sxyc1(:,:)  = zmoment(:,:,25)
-            sxc2(:,:)   = zmoment(:,:,26)
-            syc2(:,:)   = zmoment(:,:,27)
-            sxxc2(:,:)  = zmoment(:,:,28)
-            syyc2(:,:)  = zmoment(:,:,29)
-            sxyc2(:,:)  = zmoment(:,:,30)
-            sxst(:,:)   = zmoment(:,:,31)
-            syst(:,:)   = zmoment(:,:,32)
-            sxxst(:,:)  = zmoment(:,:,33)
-            syyst(:,:)  = zmoment(:,:,34)
-            sxyst(:,:)  = zmoment(:,:,35)
-      
-   END SUBROUTINE lim_rst_read
Index: trunk/NEMO/LIM_SRC_3/limsbc.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limsbc.F90	(revision 888)
+++ trunk/NEMO/LIM_SRC_3/limsbc.F90	(revision 888)
@@ -0,0 +1,384 @@
+MODULE limsbc
+   !!======================================================================
+   !!                       ***  MODULE limsbc   ***
+   !!           computation of the flux at the sea ice/ocean interface
+   !!======================================================================
+   !! History : 00-01 (H. Goosse) Original code
+   !!           02-07 (C. Ethe, G. Madec) re-writing F90
+   !!           06-07 (G. Madec) surface module
+   !!----------------------------------------------------------------------
+#if defined key_lim3
+   !!----------------------------------------------------------------------
+   !!   'key_lim3'                                    LIM 3.0 sea-ice model
+   !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !!   lim_sbc  : flux at the ice / ocean interface
+   !!----------------------------------------------------------------------
+   USE par_oce          ! ocean parameters
+   USE par_ice          ! ice parameters
+   USE dom_oce          ! ocean domain
+   USE sbc_ice          ! Surface boundary condition: sea-ice fields
+   USE sbc_oce          ! Surface boundary condition: ocean fields
+   USE phycst           ! physical constants
+   USE ocfzpt           ! surface ocean freezing point
+   USE ice_oce          ! sea-ice variable
+   USE ice              ! LIM sea-ice variables
+   USE iceini           ! ???
+   USE dynspg_oce       ! choice of the surface pressure gradient scheme 
+
+   USE lbclnk           ! ocean lateral boundary condition
+   USE in_out_manager   ! I/O manager
+   USE albedo           ! albedo parameters
+   USE prtctl           ! Print control
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC lim_sbc       ! called by sbc_ice_lim
+
+   REAL(wp)  ::   epsi16 = 1.e-16  ! constant values
+   REAL(wp)  ::   rzero  = 0.e0    
+   REAL(wp)  ::   rone   = 1.e0
+
+   !! * Substitutions
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   LIM 3.0,  UCL-LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE lim_sbc( kt )
+      !!-------------------------------------------------------------------
+      !!                ***  ROUTINE lim_sbc ***
+      !!  
+      !! ** Purpose : Update surface ocean boundary condition over areas
+      !!      that are at least partially covered by sea-ice
+      !!         
+      !! ** Action  : - comput. of the momentum, heat and freshwater/salt
+      !!      fluxes at the ice-ocean interface.
+      !!              - Update 
+      !!     
+      !! ** Outputs : - qsr    : sea heat flux:     solar 
+      !!              - qns    : sea heat flux: non solar
+      !!              - emp    : freshwater budget: volume flux 
+      !!              - emps   : freshwater budget: concentration/dillution 
+      !!              - utau   : sea surface i-stress (ocean referential)
+      !!              - vtau   : sea surface j-stress (ocean referential)
+      !!
+      !! References : Goosse, H. et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90.
+      !!              Tartinville et al. 2001 Ocean Modelling, 3, 95-108.
+      !!---------------------------------------------------------------------
+      INTEGER ::   kt    ! number of iteration
+      !!
+      INTEGER  ::   ji, jj           ! dummy loop indices
+      INTEGER  ::   ifvt, i1mfr, idfr               ! some switches
+      INTEGER  ::   iflt, ial, iadv, ifral, ifrdv
+      REAL(wp) ::   zqsr  , zqns     ! solar & non solar heat flux
+      REAL(wp) ::   zinda            ! switch for testing the values of ice concentration
+      REAL(wp) ::   zfons            ! salt exchanges at the ice/ocean interface
+      REAL(wp) ::   zpme             ! freshwater exchanges at the ice/ocean interface
+      REAL(wp) ::   zfrldu, zfrldv   ! lead fraction at U- & V-points
+      REAL(wp) ::   zutau , zvtau    ! lead fraction at U- & V-points
+      REAL(wp) ::   zu_io , zv_io    ! 2 components of the ice-ocean velocity
+      REAL(wp) ::   ztairx, ztairy   
+      REAL(wp) ::   zsfrldmx2, zsfrldmy2
+      REAL(wp) ::   zu_ice, zv_ice
+      REAL(wp) ::   ztglx , ztgly
+      REAL(wp) ::   ztaux , ztauy
+      
+#if defined key_coupled    
+      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zalb     ! albedo of ice under overcast sky
+      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zalbp    ! albedo of ice under clear sky
+#endif
+      REAL(wp) ::   zsang, zmod, zfm
+      REAL(wp), DIMENSION(jpi,jpj) ::   ztio_u, ztio_v   ! ocean stress below sea-ice
+      REAL(wp), DIMENSION(jpi,jpj) ::   zfcm1 , zfcm2    ! solar/non solar heat fluxes
+
+      !!---------------------------------------------------------------------
+     
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'lim_sbc : LIM 3.0 sea-ice - surface boundary condition'
+         IF(lwp) WRITE(numout,*) '~~~~~~~   '
+      ENDIF
+
+      !------------------------------------------!
+      !      heat flux at the ocean surface      !
+      !------------------------------------------!
+      ! pfrld is the lead fraction at the previous time step (actually between TRP and THD)
+      ! changed to old_frld and old ht_i
+       
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            zinda   = 1.0 - MAX( rzero , SIGN( rone , - ( 1.0 - pfrld(ji,jj) ) ) )
+            ifvt    = zinda  *  MAX( rzero , SIGN( rone, -phicif  (ji,jj) ) )  !subscripts are bad here
+            i1mfr   = 1.0 - MAX( rzero , SIGN( rone ,  - ( at_i(ji,jj)       ) ) )
+            idfr    = 1.0 - MAX( rzero , SIGN( rone , ( 1.0 - at_i(ji,jj) ) - pfrld(ji,jj) ) )
+            iflt    = zinda  * (1 - i1mfr) * (1 - ifvt )
+            ial     = ifvt   * i1mfr + ( 1 - ifvt ) * idfr
+            iadv    = ( 1  - i1mfr ) * zinda
+            ifral   = ( 1  - i1mfr * ( 1 - ial ) )   
+            ifrdv   = ( 1  - ifral * ( 1 - ial ) ) * iadv 
+
+            ! switch --- 1.0 ---------------- 0.0 --------------------
+            ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+            ! zinda   | if pfrld = 1       | if pfrld < 1            |
+            !  -> ifvt| if pfrld old_ht_i
+            ! i1mfr   | if frld = 1        | if frld  < 1            |
+            ! idfr    | if frld <= pfrld    | if frld > pfrld        |
+            ! iflt    | 
+            ! ial     |
+            ! iadv    |
+            ! ifral
+            ! ifrdv
+
+            !   computation the solar flux at ocean surface
+            zfcm1(ji,jj)   = pfrld(ji,jj) * qsr(ji,jj)  + ( 1. - pfrld(ji,jj) ) * fstric(ji,jj)
+                ! fstric     Solar flux transmitted trough the ice
+                ! qsr        Net short wave heat flux on free ocean
+! new line
+            fscmbq(ji,jj) = ( 1.0 - pfrld(ji,jj) ) * fstric(ji,jj)
+
+            !  computation the non solar heat flux at ocean surface
+            zfcm2(ji,jj) = - zfcm1(ji,jj)                  &
+               &           + iflt    * ( fscmbq(ji,jj) )   & ! total abl -> fscmbq is given to the ocean
+! fscmbq and ffltbif are obsolete
+!              &           + iflt * ffltbif(ji,jj) !!! only if one category is used
+               &           + ifral   * ( ial * qcmif(ji,jj) + (1 - ial) * qldif(ji,jj) ) / rdt_ice   &
+               &           + ifrdv   * ( qfvbq(ji,jj) + qdtcn(ji,jj) ) / rdt_ice                     &
+               &           + fhmec(ji,jj)     & ! new contribution due to snow melt in ridging!!
+               &           + fheat_rpo(ji,jj) & ! contribution from ridge formation
+               &           + fheat_res(ji,jj)
+                ! fscmbq  Part of the solar radiation transmitted through the ice and going to the ocean
+                !         computed in limthd_zdf.F90
+                ! ffltbif Total heat content of the ice (brine pockets+ice) / delta_t
+                ! qcmif   Energy needed to bring the ocean surface layer until its freezing (ok)
+                ! qldif   heat balance of the lead (or of the open ocean)
+                ! qfvbq   i think this is wrong!
+                ! ---> Array used to store energy in case of total lateral ablation
+                ! qfvbq latent heat uptake/release after accretion/ablation
+                ! qdtcn Energy from the turbulent oceanic heat flux heat flux coming in the lead
+
+            IF ( num_sal .EQ. 2 ) zfcm2(ji,jj) = zfcm2(ji,jj) + &
+                                  fhbri(ji,jj) ! new contribution due to brine drainage 
+
+            ! bottom radiative component is sent to the computation of the
+            ! oceanic heat flux
+            fsbbq(ji,jj) = ( 1.0 - ( ifvt + iflt ) ) * fscmbq(ji,jj)     
+
+            ! used to compute the oceanic heat flux at the next time step
+            qsr(ji,jj) = zfcm1(ji,jj)                                       ! solar heat flux 
+            qns(ji,jj) = zfcm2(ji,jj) - fdtcn(ji,jj)                        ! non solar heat flux
+!                           ! fdtcn : turbulent oceanic heat flux
+
+
+            IF ( ( ji .EQ. jiindx ) .AND. ( jj .EQ. jjindx) ) THEN
+               WRITE(numout,*) ' lim_sbc : heat fluxes '
+               WRITE(numout,*) ' qsr       : ', qsr(jiindx,jjindx)
+               WRITE(numout,*) ' zfcm1     : ', zfcm1(jiindx,jjindx)
+               WRITE(numout,*) ' pfrld     : ', pfrld(jiindx,jjindx)
+               WRITE(numout,*) ' fstric    : ', fstric (jiindx,jjindx)
+               WRITE(numout,*)
+               WRITE(numout,*) ' qns       : ', qns(jiindx,jjindx)
+               WRITE(numout,*) ' zfcm2     : ', zfcm2(jiindx,jjindx)
+               WRITE(numout,*) ' zfcm1     : ', zfcm1(jiindx,jjindx)
+               WRITE(numout,*) ' ifral     : ', ifral
+               WRITE(numout,*) ' ial       : ', ial  
+               WRITE(numout,*) ' qcmif     : ', qcmif(jiindx,jjindx)
+               WRITE(numout,*) ' qldif     : ', qldif(jiindx,jjindx)
+               WRITE(numout,*) ' qcmif / dt: ', qcmif(jiindx,jjindx) / rdt_ice
+               WRITE(numout,*) ' qldif / dt: ', qldif(jiindx,jjindx) / rdt_ice
+               WRITE(numout,*) ' ifrdv     : ', ifrdv
+               WRITE(numout,*) ' qfvbq     : ', qfvbq(jiindx,jjindx)
+               WRITE(numout,*) ' qdtcn     : ', qdtcn(jiindx,jjindx)
+               WRITE(numout,*) ' qfvbq / dt: ', qfvbq(jiindx,jjindx) / rdt_ice
+               WRITE(numout,*) ' qdtcn / dt: ', qdtcn(jiindx,jjindx) / rdt_ice
+               WRITE(numout,*) ' '
+               WRITE(numout,*) ' fdtcn     : ', fdtcn(jiindx,jjindx)
+               WRITE(numout,*) ' fhmec     : ', fhmec(jiindx,jjindx)
+               WRITE(numout,*) ' fheat_rpo : ', fheat_rpo(jiindx,jjindx)
+               WRITE(numout,*) ' fhbri     : ', fhbri(jiindx,jjindx)
+               WRITE(numout,*) ' fheat_res : ', fheat_res(jiindx,jjindx)
+            ENDIF
+         END DO
+      END DO
+       
+      !------------------------------------------!
+      !      mass flux at the ocean surface      !
+      !------------------------------------------!
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            !  case of realistic freshwater flux (Tartinville et al., 2001) (presently ACTIVATED)
+            !  ------------------------------------------------------------------------------------- 
+            !  The idea of this approach is that the system that we consider is the ICE-OCEAN system
+            !  Thus  FW  flux  =  External ( E-P+snow melt)
+            !       Salt flux  =  Exchanges in the ice-ocean system then converted into FW
+            !                     Associated to Ice formation AND Ice melting
+            !                     Even if i see Ice melting as a FW and SALT flux
+            !        
+
+            !  computing freshwater exchanges at the ice/ocean interface
+            zpme = - emp(ji,jj)     * ( 1.0 - at_i(ji,jj) )  &   !  evaporation over oceanic fraction
+               &   + tprecip(ji,jj) *         at_i(ji,jj)    &   !  total precipitation
+! old fashioned way               
+!              &   - sprecip(ji,jj) * ( 1. - pfrld(ji,jj) )  &   !  remov. snow precip over ice
+               &   - sprecip(ji,jj) * ( 1. - (pfrld(ji,jj)**betas) )  &   !  remov. snow precip over ice
+               &   - rdmsnif(ji,jj) / rdt_ice                &   !  freshwaterflux due to snow melting 
+! new contribution from snow falling when ridging
+               &   + fmmec(ji,jj)
+            
+            !  computing salt exchanges at the ice/ocean interface
+            !  sice should be the same as computed with the ice model
+            zfons =  ( soce - sice ) * ( rdmicif(ji,jj) / rdt_ice ) 
+! SOCE
+            zfons =  ( sss_m(ji,jj) - sice ) * ( rdmicif(ji,jj) / rdt_ice ) 
+            
+!CT useless            !  salt flux for constant salinity
+!CT useless            fsalt(ji,jj)      =  zfons / ( sss_m(ji,jj) + epsi16 ) + fsalt_res(ji,jj)
+            !  salt flux for variable salinity
+            zinda             = 1.0 - MAX( rzero , SIGN( rone , - ( 1.0 - pfrld(ji,jj) ) ) )
+            !  correcting brine and salt fluxes
+            fsbri(ji,jj)      =  zinda*fsbri(ji,jj)
+            !  converting the salt fluxes from ice to a freshwater flux from ocean
+            fsalt_res(ji,jj)  =  fsalt_res(ji,jj) / ( sss_m(ji,jj) + epsi16 )
+            fseqv(ji,jj)      =  fseqv(ji,jj)     / ( sss_m(ji,jj) + epsi16 )
+            fsbri(ji,jj)      =  fsbri(ji,jj)     / ( sss_m(ji,jj) + epsi16 )
+            fsalt_rpo(ji,jj)  =  fsalt_rpo(ji,jj) / ( sss_m(ji,jj) + epsi16 )
+
+            !  freshwater mass exchange (positive to the ice, negative for the ocean ?)
+            !  actually it's a salt flux (so it's minus freshwater flux)
+            !  if sea ice grows, zfons is positive, fsalt also
+            !  POSITIVE SALT FLUX FROM THE ICE TO THE OCEAN
+            !  POSITIVE FRESHWATER FLUX FROM THE OCEAN TO THE ICE [kg.m-2.s-1]
+
+            emp(ji,jj) = - zpme 
+         END DO
+      END DO
+
+      emps(:,:) = fseqv(:,:) + fsalt_res(:,:) + fsalt_rpo(:,:) + emp(:,:)
+      IF (num_sal.eq.2) THEN
+         !In case of variable salinity the salt flux has to be accounted for differently
+         ! Brine drainage has to be added
+         emps(:,:) = fsbri(:,:) + fseqv(:,:) + fsalt_res(:,:) + fsalt_rpo(:,:) + emp(:,:)
+      ENDIF
+      
+      IF( lk_dynspg_rl )    emp (:,:) = emps(:,:)      ! rigid-lid formulation : emp = emps
+
+      !------------------------------------------!
+      !    momentum flux at the ocean surface    !
+      !------------------------------------------!
+
+      IF ( ln_limdyn ) THEN                        ! Update the stress over ice-over area (only in ice-dynamic case)
+         !                                         ! otherwise the atmosphere-ocean stress is used everywhere
+
+         ! ... ice stress over ocean with a ice-ocean rotation angle
+         DO jj = 2, jpjm1
+            zsang  = SIGN(1.e0, gphif(1,jj-1) ) * sangvg
+
+            DO ji = fs_2, fs_jpim1
+               ! computation of wind stress over ocean in X and Y direction
+               ztairx =  ( 2.0 - at_i(ji,jj) - at_i(ji+1,jj) ) * utau(ji,jj)
+               ztairy =  ( 2.0 - at_i(ji,jj) - at_i(ji,jj+1) ) * vtau(ji,jj)
+
+               zsfrldmx2 = at_i(ji,jj) + at_i(ji+1,jj)
+               zsfrldmy2 = at_i(ji,jj) + at_i(ji,jj+1)
+
+               zu_ice   = u_ice(ji,jj) - u_oce(ji,jj)
+               zv_ice   = v_ice(ji,jj) - v_oce(ji,jj)
+               zmod     = SQRT( zu_ice * zu_ice + zv_ice * zv_ice ) 
+
+               ! quadratic drag formulation
+               ztglx   = zsfrldmx2 * rhoco * zmod * ( cangvg * zu_ice - zsang * zv_ice ) 
+               ztgly   = zsfrldmy2 * rhoco * zmod * ( cangvg * zv_ice + zsang * zu_ice ) 
+!
+!              ! IMPORTANT
+!              ! these lines are bound to prevent numerical oscillations
+!              ! in the ice-ocean stress
+!              ! They are physically ill-based. There is a cleaner solution
+!              ! to try (remember discussion in Paris Gurvan)
+!
+               ztglx   = ztglx * exp( - zmod / 0.5 )
+               ztgly   = ztglx * exp( - zmod / 0.5 )
+
+               tio_u(ji,jj) = ( ztairx + 1.0 * ztglx ) / 2.
+               tio_v(ji,jj) = ( ztairy + 1.0 * ztgly ) / 2.
+            END DO
+         END DO
+
+         DO jj = 1, jpjm1
+            DO ji = 1, fs_jpim1   ! vertor opt.
+               zfrldu = MAX( freezn(ji,jj), freezn(ji,jj+1) )   ! ice/ocean indicator at U- and V-points
+               zfrldv = MAX( freezn(ji,jj), freezn(ji+1,jj) )
+               ztaux = tio_u(ji,jj)
+               ztauy = tio_v(ji,jj)
+               utau(ji,jj) = (1.-zfrldu) * utau(ji,jj) + zfrldu * ztaux    ! stress at the ocean surface
+               vtau(ji,jj) = (1.-zfrldv) * vtau(ji,jj) + zfrldv * ztauy
+            END DO
+         END DO
+
+!new fashion         DO jj = 2, jpjm1
+!new fashion            DO ji = fs_2, fs_jpim1   ! vertor opt.
+!new fashion               ! ... ice-cover wheighted ice-ocean stress at U and V-points  (from I-point values)
+!new fashion               zutau  = 0.5 * ( ztio_u(ji+1,jj) + ztio_u(ji+1,jj+1) )
+!new fashion               zvtau  = 0.5 * ( ztio_v(ji,jj+1) + ztio_v(ji+1,jj+1) )
+!new fashion               ! ... open-ocean (lead) fraction at U- & V-points (from T-point values)
+!new fashion               zfrldu = 0.5 * ( frld (ji,jj) + frld (ji+1,jj  ) )
+!new fashion               zfrldv = 0.5 * ( frld (ji,jj) + frld (ji  ,jj+1) )
+!new fashion               ! update surface ocean stress
+!new fashion               utau(ji,jj) = zfrldu * utau(ji,jj) + ( 1. - zfrldu ) * zutau
+!new fashion               vtau(ji,jj) = zfrldv * vtau(ji,jj) + ( 1. - zfrldv ) * zvtau
+!new fashion               !
+!new fashion            END DO
+!new fashion         END DO
+
+         ! boundary condition on the stress (utau,vtau)
+         CALL lbc_lnk( utau, 'U', -1. )
+         CALL lbc_lnk( vtau, 'V', -1. )
+
+      ENDIF
+
+      !-----------------------------------------------!
+      !   Storing the transmitted variables           !
+      !-----------------------------------------------!
+
+      freeze(:,:)   = at_i(:,:)             ! Sea ice cover            
+      tn_ice(:,:,:) = t_su(:,:,:)           ! Ice surface temperature                      
+
+#if defined key_coupled            
+      !------------------------------------------------!
+      !    Computation of snow/ice and ocean albedo    !
+      !------------------------------------------------!
+      zalb  (:,:,:) = 0.e0
+      zalbp (:,:,:) = 0.e0
+
+      CALL albedo_ice( t_su, ht_i, ht_s, zalbp, zalb )
+
+      alb_ice(:,:,:) =  0.5 * zalbp(:,:,:) + 0.5 * zalb (:,:,:)   ! Ice albedo (mean clear and overcast skys)
+#endif
+
+      IF(ln_ctl) THEN
+         CALL prt_ctl(tab2d_1=qsr   , clinfo1=' lim_sbc: qsr    : ', tab2d_2=qns   , clinfo2=' qns     : ')
+         CALL prt_ctl(tab2d_1=emp   , clinfo1=' lim_sbc: emp    : ', tab2d_2=emps  , clinfo2=' emps    : ')
+         CALL prt_ctl(tab2d_1=utau  , clinfo1=' lim_sbc: utau   : ', mask1=umask,   &
+            &         tab2d_2=vtau  , clinfo2=' vtau    : '        , mask2=vmask )
+         CALL prt_ctl(tab2d_1=freeze, clinfo1=' lim_sbc: freeze : ')
+         CALL prt_ctl(tab3d_1=tn_ice, clinfo1=' lim_sbc: tn_ice : ', kdim=jpl)
+      ENDIF 
+   
+    END SUBROUTINE lim_sbc
+
+#else
+   !!----------------------------------------------------------------------
+   !!   Default option :        Dummy module       NO LIM 3.0 sea-ice model
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE lim_sbc           ! Dummy routine
+   END SUBROUTINE lim_sbc
+#endif 
+
+   !!======================================================================
+END MODULE limsbc
Index: trunk/NEMO/LIM_SRC_3/limtab.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limtab.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limtab.F90	(revision 888)
@@ -23,6 +23,6 @@
    !!----------------------------------------------------------------------
    !!   LIM 3.0,  UCL-ASTR-LOCEAN-IPSL (2008) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limtab.F90,v 1.2 2005/03/27 18:34:42 opalod Exp $ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 CONTAINS
Index: trunk/NEMO/LIM_SRC_3/limthd.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limthd.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limthd.F90	(revision 888)
@@ -18,5 +18,6 @@
    USE ice             ! LIM sea-ice variables
    USE ice_oce         ! sea-ice/ocean variables
-   USE flx_oce         ! sea-ice/ocean forcings variables 
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE sbc_ice         ! Surface boundary condition: ice fields
    USE thd_ice         ! LIM thermodynamic sea-ice variables
    USE dom_ice         ! LIM sea-ice domain
@@ -52,6 +53,6 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limthd.F90,v 1.6 2005/03/27 18:34:42 opalod Exp $
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -84,8 +85,5 @@
       !!---------------------------------------------------------------------
       !! * Local variables
-      INTEGER  ::  ji, jj, jk, jl,  &
-                   zji  , zjj,      &   ! dummy loop indices
-                   nbpb ,           &   ! nb of icy pts for thermo. cal.
-                   index
+      INTEGER  ::  ji, jj, jk, jl, nbpb   ! nb of icy pts for thermo. cal.
 
       REAL(wp) ::  &
@@ -211,5 +209,5 @@
 
             ! here the drag will depend on ice thickness and type (0.006)
-            fdtcn(ji,jj)  = zindb * rau0 * rcp * 0.006  * zfric_u * ( sst_io(ji,jj) - t_bo(ji,jj) ) 
+            fdtcn(ji,jj)  = zindb * rau0 * rcp * 0.006  * zfric_u * ( (sst_m(ji,jj) + rt0) - t_bo(ji,jj) ) 
             ! also category dependent
 !           !-- Energy from the turbulent oceanic heat flux heat flux coming in the lead 
@@ -220,7 +218,7 @@
 !           !-- Lead heat budget (part 1, next one is in limthd_dh
 !           !-- qldif -- (or qldif_1d in 1d routines)
-            zfontn         = sprecip(ji,jj) * lfus              !   energy of melting
-            zfnsol         = qnsr_oce(ji,jj)  !  total non solar flux
-            qldif(ji,jj)   = tms(ji,jj) * ( qsr_oce(ji,jj)                          &
+            zfontn         = sprecip(ji,jj) * lfus              ! energy of melting
+            zfnsol         = qns(ji,jj)                         ! total non solar flux
+            qldif(ji,jj)   = tms(ji,jj) * ( qsr(ji,jj)                              &
                &                               + zfnsol + fdtcn(ji,jj) - zfontn     &
                &                               + ( 1.0 - zindb ) * fsbbq(ji,jj) )   &
@@ -242,5 +240,5 @@
             ! Energy needed to bring ocean surface layer until its freezing
             ! qcmif, limflx
-            qcmif  (ji,jj) =  rau0 * rcp * fse3t(ji,jj,1) * ( t_bo(ji,jj) - sst_io(ji,jj) ) * ( 1. - zinda )
+            qcmif  (ji,jj) =  rau0 * rcp * fse3t(ji,jj,1) * ( t_bo(ji,jj) - (sst_m(ji,jj) + rt0) ) * ( 1. - zinda )
 
             !  calculate oceanic heat flux (limthd_dh)
@@ -271,5 +269,5 @@
                ENDIF
                ! debug point to follow
-               IF ( (ji.eq.jiindex).AND.(jj.eq.jjindex) ) THEN
+               IF ( (ji.eq.jiindx).AND.(jj.eq.jjindx) ) THEN
                    jiindex_1d = nbpb
                ENDIF
@@ -310,5 +308,5 @@
             CALL tab_2d_1d( nbpb, fr1_i0_1d  (1:nbpb)     , fr1_i0     , jpi, jpj, npb(1:nbpb) )
             CALL tab_2d_1d( nbpb, fr2_i0_1d  (1:nbpb)     , fr2_i0     , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, qnsr_ice_1d(1:nbpb)     , qnsr_ice(:,:,jl)   , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, qnsr_ice_1d(1:nbpb)     , qns_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
 
 #if ! defined key_coupled
@@ -360,5 +358,5 @@
 
                                           !---------------------------------!
-            CALL lim_thd_sal(1,nbpb,jl)   ! Ice salinity computation        !
+            CALL lim_thd_sal(1,nbpb)      ! Ice salinity computation        !
                                           !---------------------------------!
 
@@ -415,5 +413,5 @@
             CALL tab_1d_2d( nbpb, s_i_newice , npb, s_i_new  (1:nbpb)      , jpi, jpj )
             CALL tab_1d_2d( nbpb, izero(:,:,jl) , npb, i0    (1:nbpb)      , jpi, jpj )
-            CALL tab_1d_2d( nbpb, qnsr_ice(:,:,jl), npb, qnsr_ice_1d(1:nbpb), jpi, jpj)
+            CALL tab_1d_2d( nbpb, qns_ice(:,:,jl), npb, qnsr_ice_1d(1:nbpb), jpi, jpj)
             !+++++
 
@@ -543,5 +541,5 @@
 
       INTEGER  :: &
-         ji,jj,jk            ! loop indices
+         ji,jk               ! loop indices
 
       !!-----------------------------------------------------------------------
@@ -598,5 +596,5 @@
                                        !  is violated
       INTEGER  :: &
-         ji,jj,jk,                  &  !: loop indices
+         ji,jk,                     &  !: loop indices
          zji, zjj
       !!---------------------------------------------------------------------
@@ -726,7 +724,7 @@
          WRITE(numout,*) ' foc        : ', fbif_1d(ji)
          WRITE(numout,*) ' fstroc     : ', fstroc   (zji,zjj,jl)
-         WRITE(numout,*) ' i0        : ', i0(ji)
-         WRITE(numout,*) ' fsolar     : ', (1.0-i0(ji))*qsr_ice_1d(ji)
-         WRITE(numout,*) ' fnsolar    : ', qnsr_ice_1d(ji)
+         WRITE(numout,*) ' i0         : ', i0(ji)
+         WRITE(numout,*) ' qsr_ice    : ', (1.0-i0(ji))*qsr_ice_1d(ji)
+         WRITE(numout,*) ' qns_ice    : ', qnsr_ice_1d(ji)
          WRITE(numout,*) ' Conduction fluxes : '
          WRITE(numout,*) ' fc_s      : ', fc_s(ji,0:nlay_s)
@@ -778,8 +776,5 @@
          numce                         !: number of points for which conservation
                                        !  is violated
-      INTEGER  :: &
-         ji,jj,jk,                  &  !: loop indices
-         zji, zjj
-
+      INTEGER  ::  ji, zji, zjj        ! loop indices
       !!---------------------------------------------------------------------
 
Index: trunk/NEMO/LIM_SRC_3/limthd_dh.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limthd_dh.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limthd_dh.F90	(revision 888)
@@ -16,4 +16,5 @@
    USE phycst           ! physical constants (OCE directory) 
    USE ice_oce          ! ice variables
+   USE sbc_oce          ! Surface boundary condition: ocean fields
    USE thd_ice
    USE iceini
@@ -338,5 +339,5 @@
             zjj                 = ( npb(ji) - 1 ) / jpi + 1
             zfsalt_melt(ji)     = zfsalt_melt(ji) +                           &
-                                  ( sss_io(zji,zjj) - sm_i_b(ji)   ) *        &
+                                  ( sss_m(zji,zjj) - sm_i_b(ji)   ) *         &
                                   a_i_b(ji) *                                 &
                                   MIN( zdeltah(ji,jk) , 0.0 ) * rhoic / rdt_ice 
@@ -368,5 +369,5 @@
             WRITE(numout,*) ' qlbbq_1d: ', qlbbq_1d(ji)
             WRITE(numout,*) ' s_i_new : ', s_i_new(ji)
-            WRITE(numout,*) ' sss_io  : ', sss_io(zji,zjj)
+            WRITE(numout,*) ' sss_m   : ', sss_m(zji,zjj)
          ENDIF
 
@@ -494,6 +495,6 @@
                            zswi2  * 0.26 /  &
                            ( 0.26 + 0.74 * EXP ( - 724300.0 * zgrr ) ) 
-                  zds         = zfracs*sss_io(zji,zjj) - s_i_new(ji)
-                  s_i_new(ji) = zfracs * sss_io(zji,zjj)
+                  zds         = zfracs*sss_m(zji,zjj) - s_i_new(ji)
+                  s_i_new(ji) = zfracs * sss_m(zji,zjj)
                ENDIF ! fc_bo_i
             END DO ! ji
@@ -567,5 +568,5 @@
                   zjj             = ( npb(ji) - 1 ) / jpi + 1
                   zfsalt_melt(ji) = zfsalt_melt(ji) +                         &
-                                   ( sss_io(zji,zjj) - sm_i_b(ji)   ) *       &
+                                   ( sss_m(zji,zjj) - sm_i_b(ji)   ) *        &
                                    a_i_b(ji) * &
                                    MIN( zdeltah(ji,jk) , 0.0 ) * rhoic / rdt_ice 
@@ -596,5 +597,5 @@
                 WRITE(numout,*) ' qlbbq_1d: ', qlbbq_1d(ji)
                 WRITE(numout,*) ' s_i_new : ', s_i_new(ji)
-                WRITE(numout,*) ' sss_io  : ', sss_io(zji,zjj)
+                WRITE(numout,*) ' sss_m   : ', sss_m(zji,zjj)
                 WRITE(numout,*) ' dh_i_bott : ', dh_i_bott(ji)
                 WRITE(numout,*) ' innermelt : ', innermelt(ji)
@@ -701,10 +702,10 @@
          fseqv_1d(ji)  = fseqv_1d(ji) + zihgnew * zfsalt_melt(ji) +           &
                           (1.0 - zihgnew) * rdmicif_1d(ji) *                  &
-                          ( sss_io(zji,zjj) - sm_i_b(ji) ) / rdt_ice
+                          ( sss_m(zji,zjj) - sm_i_b(ji) ) / rdt_ice
          ! new lines
          IF ( num_sal .EQ. 4 ) &
          fseqv_1d(ji)  = fseqv_1d(ji) + zihgnew * zfsalt_melt(ji) +           &
                           (1.0 - zihgnew) * rdmicif_1d(ji) *                  &
-                          ( sss_io(zji,zjj) - bulk_sal ) / rdt_ice
+                          ( sss_m(zji,zjj) - bulk_sal ) / rdt_ice
          ! Heat flux
          ! excessive bottom ablation energy (fsup) - 0 except if jpl = 1
@@ -762,6 +763,4 @@
                              *(ht_s_b(ji)-zhnnew)*rhosn
 
-#if defined key_lim_fdd 
-!(presently Activated) 
          rdmicif_1d(ji) = rdmicif_1d(ji) + a_i_b(ji) & 
                                          * ( zhgnew(ji) - ht_i_b(ji) )*rhoic 
@@ -775,5 +774,5 @@
 
          zsm_snowice  = ( rhoic - rhosn ) / rhoic *            &
-                        sss_io(zji,zjj) 
+                        sss_m(zji,zjj) 
 
          IF ( num_sal .NE. 2 ) zsm_snowice = sm_i_b(ji)
@@ -781,5 +780,5 @@
          IF ( num_sal .NE. 4 ) &
          fseqv_1d(ji)   = fseqv_1d(ji)   + &
-                          ( sss_io(zji,zjj) - zsm_snowice ) * &
+                          ( sss_m(zji,zjj) - zsm_snowice ) * &
                             a_i_b(ji)   * &
                           ( zhgnew(ji) - ht_i_b(ji) ) * rhoic / rdt_ice
@@ -787,5 +786,5 @@
          IF ( num_sal .EQ. 4 ) &
          fseqv_1d(ji)   = fseqv_1d(ji)   + &
-                          ( sss_io(zji,zjj) - bulk_sal    ) * &
+                          ( sss_m(zji,zjj) - bulk_sal    ) * &
                             a_i_b(ji)   * &
                           ( zhgnew(ji) - ht_i_b(ji) ) * rhoic / rdt_ice
@@ -801,9 +800,4 @@
                             - sm_i_b(ji) ) * isnowic     
 
-#else
-         rdmicif_1d(ji) = rdmicif_1d(ji) + a_i_b(ji) &
-                                         * ( zhgnew(ji) - ht_i_b(ji) ) * rhoic &
-                                         + ( zhnnew - ht_s_b(ji) ) * rhosn )
-#endif
 !  Actualize new snow and ice thickness.
          ht_s_b(ji)  = zhnnew
Index: trunk/NEMO/LIM_SRC_3/limthd_lac.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limthd_lac.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limthd_lac.F90	(revision 888)
@@ -1,4 +1,3 @@
 MODULE limthd_lac
-#if defined key_lim3
    !!----------------------------------------------------------------------
    !!   'key_lim3'                                      LIM3 sea-ice model
@@ -8,5 +7,5 @@
    !!                lateral thermodynamic growth of the ice 
    !!======================================================================
-
+#if defined key_lim3
    !!----------------------------------------------------------------------
    !!   lim_lat_acr    : lateral accretion of ice
@@ -17,4 +16,6 @@
    USE phycst
    USE ice_oce         ! ice variables
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE sbc_ice         ! Surface boundary condition: ice fields
    USE thd_ice
    USE dom_ice
@@ -23,6 +24,4 @@
    USE iceini
    USE limtab
-   USE taumod
-   USE blk_oce
    USE limcons
      
@@ -46,6 +45,6 @@
    !!----------------------------------------------------------------------
    !!   LIM 3.0,  UCL-ASTR-LOCEAN-IPSL (2008) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limthd_lac.F90,v 1.5 2005/03/27 18:34:42 opalod Exp $ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -181,5 +180,5 @@
          vt_s_init, vt_s_final,   &  !  snow volume summed over categories
          et_i_init, et_i_final,   &  !  ice energy summed over categories
-         et_s_init, et_s_final       !  snow energy summed over categories
+         et_s_init                   !  snow energy summed over categories
 
       REAL(wp) ::            &
@@ -267,8 +266,8 @@
             !-------------
             ! C-grid wind stress components
-            ztaux         = ( gtaux(ji-1,jj  ) * tmu(ji-1,jj  ) &
-                          +   gtaux(ji  ,jj  ) * tmu(ji  ,jj  ) ) / 2.0
-            ztauy         = ( gtauy(ji  ,jj-1) * tmv(ji  ,jj-1) &
-                          +   gtauy(ji  ,jj  ) * tmv(ji  ,jj  ) ) / 2.0
+            ztaux         = ( utaui_ice(ji-1,jj  ) * tmu(ji-1,jj  ) &
+                          +   utaui_ice(ji  ,jj  ) * tmu(ji  ,jj  ) ) / 2.0
+            ztauy         = ( vtaui_ice(ji  ,jj-1) * tmv(ji  ,jj-1) &
+                          +   vtaui_ice(ji  ,jj  ) * tmv(ji  ,jj  ) ) / 2.0
             ! Square root of wind stress
             ztenagm       =  SQRT( SQRT( ztaux * ztaux + ztauy * ztauy ) )
@@ -343,5 +342,5 @@
                nbpac = nbpac + 1
                npac( nbpac ) = (jj - 1) * jpi + ji
-               IF ( (ji.eq.jiindex).AND.(jj.eq.jjindex) ) THEN
+               IF ( (ji.eq.jiindx).AND.(jj.eq.jjindx) ) THEN
                   jiindex_1d = nbpac
                ENDIF
@@ -418,5 +417,5 @@
               zji            =   MOD( npac(ji) - 1, jpi ) + 1
               zjj            =   ( npac(ji) - 1 ) / jpi + 1
-              zs_newice(ji)  =   MIN( 0.5*sss_io(zji,zjj) , zs_newice(ji) )
+              zs_newice(ji)  =   MIN( 0.5*sss_m(zji,zjj) , zs_newice(ji) )
            END DO ! jl
 
@@ -476,5 +475,5 @@
               zjj            = ( npac(ji) - 1 ) / jpi + 1
               fseqv_1d(ji)   = fseqv_1d(ji) +                                     &
-                               ( sss_io(zji,zjj) - bulk_sal      ) * rhoic *      &
+                               ( sss_m(zji,zjj) - bulk_sal      ) * rhoic *       &
                                zv_newice(ji) / rdt_ice
            END DO
@@ -484,5 +483,5 @@
               zjj            = ( npac(ji) - 1 ) / jpi + 1
               fseqv_1d(ji)   = fseqv_1d(ji) +                                     &
-                               ( sss_io(zji,zjj) - zs_newice(ji) ) * rhoic *      &
+                               ( sss_m(zji,zjj) - zs_newice(ji) ) * rhoic *       &
                                zv_newice(ji) / rdt_ice
            END DO ! ji
@@ -617,5 +616,5 @@
         END DO
 
-        WRITE(numout,*) ' zv_i_ac : ', zv_i_ac(jiindex, 1:jpl)
+        WRITE(numout,*) ' zv_i_ac : ', zv_i_ac(jiindx, 1:jpl)
         DO jl = ice_cat_bounds(jm,1), ice_cat_bounds(jm,2)
            DO ji = 1, nbpac
@@ -626,5 +625,5 @@
            END DO ! ji
         END DO ! jl
-        WRITE(numout,*) ' zv_i_ac : ', zv_i_ac(jiindex, 1:jpl)
+        WRITE(numout,*) ' zv_i_ac : ', zv_i_ac(jiindx, 1:jpl)
 
         !---------------------------------
@@ -796,8 +795,8 @@
 !     CALL lim_cons_check (et_s_init, et_s_final, 1.0e-3, fieldid) 
 
-      WRITE(numout,*) ' vt_i_init : ', vt_i_init(jiindex,jjindex)
-      WRITE(numout,*) ' vt_i_final: ', vt_i_final(jiindex,jjindex)
-      WRITE(numout,*) ' et_i_init : ', et_i_init(jiindex,jjindex)
-      WRITE(numout,*) ' et_i_final: ', et_i_final(jiindex,jjindex)
+      WRITE(numout,*) ' vt_i_init : ', vt_i_init(jiindx,jjindx)
+      WRITE(numout,*) ' vt_i_final: ', vt_i_final(jiindx,jjindx)
+      WRITE(numout,*) ' et_i_init : ', et_i_init(jiindx,jjindx)
+      WRITE(numout,*) ' et_i_final: ', et_i_final(jiindx,jjindx)
 
       ENDIF
Index: trunk/NEMO/LIM_SRC_3/limthd_sal.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limthd_sal.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limthd_sal.F90	(revision 888)
@@ -1,4 +1,3 @@
 MODULE limthd_sal
-#if defined key_lim3
    !!----------------------------------------------------------------------
    !!   'key_lim3'                                      LIM3 sea-ice model
@@ -9,5 +8,5 @@
    !!                               the ice
    !!======================================================================
-
+#if defined key_lim3
    !!----------------------------------------------------------------------
    !!   lim_thd_sal : salinity variations in the ice
@@ -16,4 +15,5 @@
    USE phycst           ! physical constants (ocean directory)
    USE ice_oce          ! ice variables
+   USE sbc_oce          ! Surface boundary condition: ocean fields
    USE thd_ice
    USE iceini
@@ -40,5 +40,5 @@
    CONTAINS
 
-   SUBROUTINE lim_thd_sal(kideb,kiut,jl)
+   SUBROUTINE lim_thd_sal(kideb,kiut)
       !!-------------------------------------------------------------------
       !!                ***  ROUTINE lim_thd_sal  ***       
@@ -76,5 +76,5 @@
       !! * Local variables
       INTEGER, INTENT(in) :: &
-         kideb, kiut, jl         !: thickness category index
+         kideb, kiut             !: thickness category index
 
       INTEGER ::             &
@@ -318,5 +318,5 @@
             zjj                 = ( npb(ji) - 1 ) / jpi + 1
             fseqv_1d(ji) = fseqv_1d(ji)              + & 
-                           ( sss_io(zji,zjj) - bulk_sal    ) * & 
+                           ( sss_m(zji,zjj) - bulk_sal    ) * & 
                            rhoic * a_i_b(ji) * &
                            MAX( dh_i_bott(ji) , 0.0 ) / rdt_ice
@@ -327,5 +327,5 @@
             zjj                 = ( npb(ji) - 1 ) / jpi + 1
             fseqv_1d(ji) = fseqv_1d(ji)              + & 
-                           ( sss_io(zji,zjj) - s_i_new(ji) ) * & 
+                           ( sss_m(zji,zjj) - s_i_new(ji) ) * & 
                              rhoic * a_i_b(ji) * &
                              MAX( dh_i_bott(ji) , 0.0 ) / rdt_ice
Index: trunk/NEMO/LIM_SRC_3/limtrp.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limtrp.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limtrp.F90	(revision 888)
@@ -17,4 +17,5 @@
    USE in_out_manager  ! I/O manager
    USE ice_oce         ! ice variables
+   USE sbc_oce         ! Surface boundary condition: ocean fields
    USE dom_ice
    USE ice
@@ -51,6 +52,6 @@
    !!----------------------------------------------------------------------
    !!   LIM 3.0,  UCL-ASTR-LOCEAN-IPSL (2008)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limtrp.F90,v 1.5 2005/03/27 18:34:42 opalod Exp $
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 CONTAINS
@@ -519,5 +520,5 @@
 
                   ! Ice salinity and age
-                  zsal            = MAX( MIN( (rhoic-rhosn)/rhoic*sss_io(ji,jj)  , &
+                  zsal            = MAX( MIN( (rhoic-rhosn)/rhoic*sss_m(ji,jj)  , &
                                             zusvoic * zs0sm(ji,jj,jl) ), s_i_min ) * &
                                             v_i(ji,jj,jl)
Index: trunk/NEMO/LIM_SRC_3/limupdate.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limupdate.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limupdate.F90	(revision 888)
@@ -25,17 +25,16 @@
    USE in_out_manager
    USE ice_oce         ! ice variables
-   USE flx_oce         ! forcings variables
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE sbc_ice         ! Surface boundary condition: ice fields
    USE dom_ice
    USE daymod
    USE phycst          ! Define parameters for the routines
-   USE taumod
    USE ice
    USE iceini
-   USE ocesbc
    USE lbclnk
    USE limdyn
    USE limtrp
    USE limthd
-   USE limflx
+   USE limsbc
    USE limdia
    USE limwri
@@ -126,11 +125,11 @@
 !+++++ [
         WRITE(numout,*) ' O) Initial values '
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i: ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
-        DO jk = 1, nlay_i
-        WRITE(numout,*) ' e_i : ', e_i(jiindex, jjindex, jk, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i: ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
+        DO jk = 1, nlay_i
+        WRITE(numout,*) ' e_i : ', e_i(jiindx, jjindx, jk, 1:jpl)
         END DO
 !+++++ ]
@@ -238,5 +237,5 @@
 
               !residual salt flux if ice is over-molten
-              fsalt_res(ji,jj)  = fsalt_res(ji,jj) + ( sss_io(ji,jj) - sm_i(ji,jj,jl) ) * & 
+              fsalt_res(ji,jj)  = fsalt_res(ji,jj) + ( sss_m(ji,jj) - sm_i(ji,jj,jl) ) * & 
                              ( rhoic * zdvres / rdt_ice )
 !             fheat_res(ji,jj)  = fheat_res(ji,jj) + rhoic * lfus * zdvres / rdt_ice
@@ -254,5 +253,5 @@
 
               !residual salt flux if snow is over-molten
-              fsalt_res(ji,jj)  = fsalt_res(ji,jj) + sss_io(ji,jj) * & 
+              fsalt_res(ji,jj)  = fsalt_res(ji,jj) + sss_m(ji,jj) * & 
                              ( rhosn * zdvres / rdt_ice )
                              !this flux will be positive if snow was over-molten
@@ -276,11 +275,11 @@
 
      WRITE(numout,*) ' 1. Before update of Global variables '
-     WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-     WRITE(numout,*) ' at_i: ', at_i(jiindex,jjindex)
-     WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
-     WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
-        DO jk = 1, nlay_i
-        WRITE(numout,*) ' e_i : ', e_i(jiindex, jjindex, jk, 1:jpl)
+     WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+     WRITE(numout,*) ' at_i: ', at_i(jiindx,jjindx)
+     WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
+     WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
+        DO jk = 1, nlay_i
+        WRITE(numout,*) ' e_i : ', e_i(jiindx, jjindx, jk, 1:jpl)
         END DO
 !+++++ ]
@@ -294,5 +293,5 @@
      CALL lim_var_glo2eqv ! useless, just for debug
         DO jk = 1, nlay_i
-        WRITE(numout,*) ' t_i : ', t_i(jiindex, jjindex, jk, 1:jpl)
+        WRITE(numout,*) ' t_i : ', t_i(jiindx, jjindx, jk, 1:jpl)
         END DO
      e_i(:,:,:,:) = e_i(:,:,:,:) + d_e_i_trp(:,:,:,:)  
@@ -300,5 +299,5 @@
         WRITE(numout,*) ' After transport update '
         DO jk = 1, nlay_i
-        WRITE(numout,*) ' t_i : ', t_i(jiindex, jjindex, jk, 1:jpl)
+        WRITE(numout,*) ' t_i : ', t_i(jiindx, jjindx, jk, 1:jpl)
         END DO
      e_i(:,:,:,:) = e_i(:,:,:,:) + d_e_i_thd(:,:,:,:)  
@@ -306,5 +305,5 @@
         WRITE(numout,*) ' After thermodyn update '
         DO jk = 1, nlay_i
-        WRITE(numout,*) ' t_i : ', t_i(jiindex, jjindex, jk, 1:jpl)
+        WRITE(numout,*) ' t_i : ', t_i(jiindx, jjindx, jk, 1:jpl)
         END DO
 
@@ -316,13 +315,13 @@
 !+++++ [
      WRITE(numout,*) ' 1. After update of Global variables (2) '
-     WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-     WRITE(numout,*) ' at_i: ', at_i(jiindex,jjindex)
-     WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
-     WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
-     WRITE(numout,*) ' oa_i : ', oa_i(jiindex, jjindex, 1:jpl)
-     WRITE(numout,*) ' e_s : ', e_s(jiindex, jjindex, 1, 1:jpl)
-        DO jk = 1, nlay_i
-        WRITE(numout,*) ' e_i : ', e_i(jiindex, jjindex, jk, 1:jpl)
+     WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+     WRITE(numout,*) ' at_i: ', at_i(jiindx,jjindx)
+     WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
+     WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
+     WRITE(numout,*) ' oa_i : ', oa_i(jiindx, jjindx, 1:jpl)
+     WRITE(numout,*) ' e_s : ', e_s(jiindx, jjindx, 1, 1:jpl)
+        DO jk = 1, nlay_i
+        WRITE(numout,*) ' e_i : ', e_i(jiindx, jjindx, jk, 1:jpl)
         END DO
 !+++++ ]
@@ -348,10 +347,10 @@
 !+++++
      WRITE(numout,*) ' Before everything '
-     WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
-     WRITE(numout,*) ' oa_i:  ', oa_i(jiindex, jjindex, 1:jpl)
-        DO jk = 1, nlay_i
-        WRITE(numout,*) ' e_i : ', e_i(jiindex, jjindex, jk, 1:jpl)
-        END DO
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
+     WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
+     WRITE(numout,*) ' oa_i:  ', oa_i(jiindx, jjindx, 1:jpl)
+        DO jk = 1, nlay_i
+        WRITE(numout,*) ' e_i : ', e_i(jiindx, jjindx, jk, 1:jpl)
+        END DO
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
 !+++++
 
@@ -362,6 +361,6 @@
 !+++++
      WRITE(numout,*) ' After advection   '
-     WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
+     WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
 !+++++
 
@@ -401,11 +400,11 @@
 !+++++ [
         WRITE(numout,*) ' 2.1 '
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i: ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
-        DO jk = 1, nlay_i
-        WRITE(numout,*) ' e_i : ', e_i(jiindex, jjindex, jk, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i: ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
+        DO jk = 1, nlay_i
+        WRITE(numout,*) ' e_i : ', e_i(jiindx, jjindx, jk, 1:jpl)
         END DO
 !+++++ ]
@@ -444,11 +443,11 @@
 !+++++ [
         WRITE(numout,*) ' 2.1 initial '
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i: ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
-        DO jk = 1, nlay_i
-        WRITE(numout,*) ' e_i : ', e_i(jiindex, jjindex, jk, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i: ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
+        DO jk = 1, nlay_i
+        WRITE(numout,*) ' e_i : ', e_i(jiindx, jjindx, jk, 1:jpl)
         END DO
 !+++++ ]
@@ -464,12 +463,12 @@
 !+++++ [
         WRITE(numout,*) ' 2.1 before rebinning '
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i: ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
-        DO jk = 1, nlay_i
-        WRITE(numout,*) ' e_i : ', e_i(jiindex, jjindex, jk, 1:jpl)
-        END DO
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i: ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
+        DO jk = 1, nlay_i
+        WRITE(numout,*) ' e_i : ', e_i(jiindx, jjindx, jk, 1:jpl)
+        END DO
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
 !+++++ ]
 
@@ -483,13 +482,13 @@
 !+++++ [
         WRITE(numout,*) ' 2.1 after rebinning'
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i: ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
-        DO jk = 1, nlay_i
-        WRITE(numout,*) ' e_i : ', e_i(jiindex, jjindex, jk, 1:jpl)
-        WRITE(numout,*) ' t_i : ', t_i(jiindex, jjindex, jk, 1:jpl)
-        END DO
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i: ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
+        DO jk = 1, nlay_i
+        WRITE(numout,*) ' e_i : ', e_i(jiindx, jjindx, jk, 1:jpl)
+        WRITE(numout,*) ' t_i : ', t_i(jiindx, jjindx, jk, 1:jpl)
+        END DO
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
 !+++++ ]
 
@@ -611,13 +610,13 @@
 !+++++ [
         WRITE(numout,*) ' 2.3 after melt of an internal ice layer '
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i: ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
-        DO jk = 1, nlay_i
-        WRITE(numout,*) ' e_i : ', e_i(jiindex, jjindex, jk, 1:jpl)
-        WRITE(numout,*) ' t_i : ', t_i(jiindex, jjindex, jk, 1:jpl)
-        END DO
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i: ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
+        DO jk = 1, nlay_i
+        WRITE(numout,*) ' e_i : ', e_i(jiindx, jjindx, jk, 1:jpl)
+        WRITE(numout,*) ' t_i : ', t_i(jiindx, jjindx, jk, 1:jpl)
+        END DO
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
 !+++++ ]
 
@@ -638,5 +637,5 @@
 
               !++++++
-              IF ( (ji.eq.jiindex) .AND. (jj.eq.jjindex) ) THEN
+              IF ( (ji.eq.jiindx) .AND. (jj.eq.jjindx) ) THEN
                  WRITE(numout,*) ' jl    : ', jl
                  WRITE(numout,*) ' ze_s  : ', ze_s
@@ -737,12 +736,12 @@
 !+++++ [
         WRITE(numout,*) ' 2.8 '
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i: ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
-        DO jk = 1, nlay_i
-        WRITE(numout,*) ' e_i : ', e_i(jiindex, jjindex, jk, 1:jpl)
-        END DO
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i: ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
+        DO jk = 1, nlay_i
+        WRITE(numout,*) ' e_i : ', e_i(jiindx, jjindx, jk, 1:jpl)
+        END DO
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
 !+++++ ]
 
@@ -767,9 +766,9 @@
      WRITE(numout,*) ' 2.9 '
      DO jk = 1, nlay_i
-        WRITE(numout,*) ' e_i : ', e_i(jiindex, jjindex, jk, 1:jpl)
-     END DO
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
-
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
+        WRITE(numout,*) ' e_i : ', e_i(jiindx, jjindx, jk, 1:jpl)
+     END DO
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
+
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
 
      !---------------------
@@ -784,5 +783,5 @@
               DO ji = 1, jpi
                  ! salinity stays in bounds
-                 smv_i(ji,jj,jl)  =  MAX(MIN((rhoic-rhosn)/rhoic*sss_io(ji,jj),smv_i(ji,jj,jl)), &
+                 smv_i(ji,jj,jl)  =  MAX(MIN((rhoic-rhosn)/rhoic*sss_m(ji,jj),smv_i(ji,jj,jl)), &
                   0.1 * v_i(ji,jj,jl) )
                  i_ice_switch    =  1.0-MAX(0.0,SIGN(1.0,-v_i(ji,jj,jl)))
@@ -798,9 +797,9 @@
 !+++++ [
         WRITE(numout,*) ' 2.11 '
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i    ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i    ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
 !+++++ ]
 
@@ -826,9 +825,9 @@
 !+++++ [
         WRITE(numout,*) ' 2.12 '
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i    ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i    ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
 !+++++ ]
 
@@ -873,9 +872,9 @@
 !+++++ [
         WRITE(numout,*) ' 2.13 '
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i    ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i    ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
 !+++++ ]
 
@@ -907,9 +906,9 @@
 !+++++ [
         WRITE(numout,*) ' rebinning before'
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i    ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i    ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
 !+++++ ]
 !old version
@@ -925,9 +924,9 @@
 !+++++ [
         WRITE(numout,*) ' rebinning final'
-        WRITE(numout,*) ' a_i : ', a_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' at_i    ', at_i(jiindex,jjindex)
-        WRITE(numout,*) ' v_i : ', v_i(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' v_s : ', v_s(jiindex, jjindex, 1:jpl)
-        WRITE(numout,*) ' smv_i: ', smv_i(jiindex, jjindex, 1:jpl)
+        WRITE(numout,*) ' a_i : ', a_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' at_i    ', at_i(jiindx,jjindx)
+        WRITE(numout,*) ' v_i : ', v_i(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
+        WRITE(numout,*) ' smv_i: ', smv_i(jiindx, jjindx, 1:jpl)
 !+++++ ]
 
@@ -1014,8 +1013,8 @@
      END DO !ji
 
-     WRITE(numout,*) ' TESTOSC1 ', tio_u(jiindex,jjindex), tio_v(jiindex,jjindex)
-     WRITE(numout,*) ' TESTOSC2 ', u_ice(jiindex,jjindex), v_ice(jiindex,jjindex)
-     WRITE(numout,*) ' TESTOSC3 ', u_oce(jiindex,jjindex), v_oce(jiindex,jjindex)
-     WRITE(numout,*) ' TESTOSC4 ', tauxw(jiindex,jjindex), tauxw(jiindex,jjindex)
+     WRITE(numout,*) ' TESTOSC1 ', tio_u(jiindx,jjindx), tio_v(jiindx,jjindx)
+     WRITE(numout,*) ' TESTOSC2 ', u_ice(jiindx,jjindx), v_ice(jiindx,jjindx)
+     WRITE(numout,*) ' TESTOSC3 ', u_oce(jiindx,jjindx), v_oce(jiindx,jjindx)
+     WRITE(numout,*) ' TESTOSC4 ', utau (jiindx,jjindx), vtau (jiindx,jjindx)
 
 
@@ -1087,5 +1086,5 @@
          CALL prt_ctl_info('   ~~~~~~~~~~~~~~~~~~ ')
          CALL prt_ctl(tab2d_1=fmmec  , clinfo1= ' lim_update : fmmec : ', tab2d_2=fhmec     , clinfo2= ' fhmec     : ')
-         CALL prt_ctl(tab2d_1=sst_io , clinfo1= ' lim_update : sst   : ', tab2d_2=sss_io    , clinfo2= ' sss       : ')
+         CALL prt_ctl(tab2d_1=sst_m  , clinfo1= ' lim_update : sst   : ', tab2d_2=sss_m     , clinfo2= ' sss       : ')
          CALL prt_ctl(tab2d_1=fhbri  , clinfo1= ' lim_update : fhbri : ', tab2d_2=fheat_rpo , clinfo2= ' fheat_rpo : ')
 
@@ -1093,9 +1092,7 @@
          CALL prt_ctl_info(' - Stresses : ')
          CALL prt_ctl_info('   ~~~~~~~~~~ ')
-         CALL prt_ctl(tab2d_1=tauxw , clinfo1= ' lim_update : tauxw : ', tab2d_2=tauyw , clinfo2= ' tauyw : ')
-         CALL prt_ctl(tab2d_1=taux  , clinfo1= ' lim_update : taux  : ', tab2d_2=tauy  , clinfo2= ' tauy  : ')
-         CALL prt_ctl(tab2d_1=ftaux , clinfo1= ' lim_update : ftaux : ', tab2d_2=ftauy , clinfo2= ' ftauy : ')
-         CALL prt_ctl(tab2d_1=gtaux , clinfo1= ' lim_update : gtaux : ', tab2d_2=gtauy , clinfo2= ' gtauy : ')
-         CALL prt_ctl(tab2d_1=u_io  , clinfo1= ' lim_update : u_io  : ', tab2d_2=v_io  , clinfo2= ' v_io  : ')
+         CALL prt_ctl(tab2d_1=utau       , clinfo1= ' lim_update : utau      : ', tab2d_2=vtau       , clinfo2= ' vtau      : ')
+         CALL prt_ctl(tab2d_1=utaui_ice  , clinfo1= ' lim_update : utaui_ice : ', tab2d_2=vtaui_ice  , clinfo2= ' vtaui_ice : ')
+         CALL prt_ctl(tab2d_1=u_oce      , clinfo1= ' lim_update : u_oce     : ', tab2d_2=v_oce      , clinfo2= ' v_oce     : ')
       ENDIF
 
Index: trunk/NEMO/LIM_SRC_3/limvar.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limvar.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limvar.F90	(revision 888)
@@ -1,4 +1,3 @@
 MODULE limvar
-#if defined key_lim3
    !!----------------------------------------------------------------------
    !!   'key_lim3'                                      LIM3 sea-ice model
@@ -33,5 +32,5 @@
    !!                        - ot_i(jpi,jpj)  !average ice age
    !!======================================================================
-
+#if defined key_lim3
    !!----------------------------------------------------------------------
    !! * Modules used
@@ -40,4 +39,5 @@
    USE phycst           ! physical constants (ocean directory) 
    USE ice_oce          ! ice variables
+   USE sbc_oce          ! Surface boundary condition: ocean fields
    USE thd_ice
    USE in_out_manager
@@ -428,5 +428,5 @@
            zind0         ,     & !: switch, = 1 if sm_i lt s_i_0
            zind01        ,     & !: switch, = 1 if sm_i between s_i_0 and s_i_1
-           zindbal       ,     & !: switch, = 1, if 2*sm_i gt sss_io
+           zindbal       ,     & !: switch, = 1, if 2*sm_i gt sss_m
            zargtemp              !: dummy factor
 
@@ -491,7 +491,7 @@
                   zind01 = ( 1.0 - zind0 ) *                                  &
                            MAX( 0.0   , SIGN( 1.0  , s_i_1 - sm_i(ji,jj,jl) ) ) 
-                  ! If 2.sm_i GE sss_io then zindbal = 1
+                  ! If 2.sm_i GE sss_m then zindbal = 1
                   zindbal = MAX( 0.0 , SIGN( 1.0 , 2. * sm_i(ji,jj,jl) -      &
-                  sss_io(ji,jj) ) )
+                  sss_m(ji,jj) ) )
                   zalpha(ji,jj,jl) = zind0  * 1.0                             &
                                    + zind01 * ( sm_i(ji,jj,jl) * dummy_fac0 + &
@@ -692,7 +692,7 @@
                zind01 = ( 1.0 - zind0 ) *                                  &
                         MAX( 0.0   , SIGN( 1.0  , s_i_1 - sm_i_b(ji) ) ) 
-               ! if 2.sm_i GE sss_io then zindbal = 1
+               ! if 2.sm_i GE sss_m then zindbal = 1
                zindbal = MAX( 0.0 , SIGN( 1.0 , 2. * sm_i_b(ji) -      &
-               sss_io(zji,zjj) ) )
+               sss_m(zji,zjj) ) )
 
                zalpha = zind0  * 1.0                                       &
Index: trunk/NEMO/LIM_SRC_3/limwri.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limwri.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limwri.F90	(revision 888)
@@ -1,4 +1,3 @@
 MODULE limwri
-#if defined key_lim3
    !!----------------------------------------------------------------------
    !!   'key_lim3'                                      LIM3 sea-ice model
@@ -8,7 +7,8 @@
    !!         Ice diagnostics :  write ice output files
    !!======================================================================
+#if defined key_lim3
    !!----------------------------------------------------------------------
    !!  LIM 2.0, UCL-LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limwri.F90,v 1.4 2005/03/27 18:34:42 opalod Exp $
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
    !!----------------------------------------------------------------------
@@ -18,5 +18,5 @@
    !! * Modules used
    USE ioipsl
-   USE dianam    ! build name of file (routine)
+   USE dianam          ! build name of file (routine)
    USE phycst
    USE dom_oce
@@ -24,5 +24,6 @@
    USE in_out_manager
    USE ice_oce         ! ice variables
-   USE flx_oce
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE sbc_ice         ! Surface boundary condition: ice fields
    USE dom_ice
    USE ice
@@ -137,5 +138,5 @@
          zsto     = rdt_ice
          clop     = "ave(x)"
-         zout     = nwrite * rdt_ice / nfice
+         zout     = nwrite * rdt_ice / nn_fsbc
          zsec     = 0.
          niter    = 0
@@ -165,5 +166,5 @@
          zsto     = rdt_ice
          clop     = "ave(x)"
-         zout     = nwrite * rdt_ice / nfice
+         zout     = nwrite * rdt_ice / nn_fsbc
          zsec     = 0.
          nitera   = 0
@@ -221,5 +222,5 @@
                zinda  = MAX( zzero , SIGN( zone , at_i(ji,jj) - 0.10 ) )
                zcmo(ji,jj,17) = zcmo(ji,jj,17) + a_i(ji,jj,jl)*qsr_ice (ji,jj,jl) 
-               zcmo(ji,jj,18) = zcmo(ji,jj,18) + a_i(ji,jj,jl)*qnsr_ice(ji,jj,jl) 
+               zcmo(ji,jj,18) = zcmo(ji,jj,18) + a_i(ji,jj,jl)*qns_ice(ji,jj,jl) 
                zcmo(ji,jj,27) = zcmo(ji,jj,27) + t_su(ji,jj,jl)*a_i(ji,jj,jl)/MAX(at_i(ji,jj),epsi16)*zinda
             END DO
@@ -253,17 +254,17 @@
      &                     / 2.0 
             zcmo(ji,jj,8)  = zindb * (  v_ice(ji,jj  ) * tmv(ji,jj)        &
-     &                              + v_ice(ji,jj-1) * tmv(ji,jj-1) )      &
+     &                                + v_ice(ji,jj-1) * tmv(ji,jj-1) )    &
      &                     / 2.0
-            zcmo(ji,jj,9)  = sst_io(ji,jj)
-            zcmo(ji,jj,10) = sss_io(ji,jj)
-
-            zcmo(ji,jj,11) = fnsolar(ji,jj) + fsolar(ji,jj)
-            zcmo(ji,jj,12) = fsolar (ji,jj)
-            zcmo(ji,jj,13) = fnsolar(ji,jj)
+            zcmo(ji,jj,9)  = sst_m(ji,jj)
+            zcmo(ji,jj,10) = sss_m(ji,jj)
+
+            zcmo(ji,jj,11) = qns(ji,jj) + qsr(ji,jj)
+            zcmo(ji,jj,12) = qsr(ji,jj)
+            zcmo(ji,jj,13) = qns(ji,jj)
             zcmo(ji,jj,14) = fhbri(ji,jj)
-            zcmo(ji,jj,15) = gtaux(ji,jj)
-            zcmo(ji,jj,16) = gtauy(ji,jj)
-            zcmo(ji,jj,17) = zcmo(ji,jj,17) + (1.0-at_i(ji,jj))*qsr_oce(ji,jj)
-            zcmo(ji,jj,18) = zcmo(ji,jj,18) + (1.0-at_i(ji,jj))*qnsr_oce (ji,jj)
+            zcmo(ji,jj,15) = utaui_ice(ji,jj)
+            zcmo(ji,jj,16) = vtaui_ice(ji,jj)
+            zcmo(ji,jj,17) = zcmo(ji,jj,17) + (1.0-at_i(ji,jj))*qsr(ji,jj)
+            zcmo(ji,jj,18) = zcmo(ji,jj,18) + (1.0-at_i(ji,jj))*qns(ji,jj)
             zcmo(ji,jj,19) = sprecip(ji,jj)
             zcmo(ji,jj,20) = smt_i(ji,jj)
@@ -299,6 +300,5 @@
          END DO
          
-         IF ( jf == 7  .OR. jf == 8  .OR. jf == 11 .OR. jf == 12 .OR. jf == 15 .OR.   &
-            jf == 16 ) THEN 
+         IF ( jf == 7  .OR. jf == 8  .OR. jf == 15 .OR. jf == 16 ) THEN 
             CALL lbc_lnk( zfield, 'T', -1. )
          ELSE 
@@ -315,5 +315,5 @@
       END DO
 
-      IF ( ( nfice * niter + nit000 - 1 ) >= nitend .OR. kindic < 0 ) THEN
+      IF ( ( nn_fsbc * niter + nit000 - 1 ) >= nitend .OR. kindic < 0 ) THEN
           WRITE(numout,*) ' Closing the icemod file '
           CALL histclo( nice )
@@ -374,5 +374,5 @@
 !     not yet implemented
       
-      IF ( ( nfice * niter + nit000 - 1 ) >= nitend .OR. kindic < 0 ) THEN
+      IF ( ( nn_fsbc * niter + nit000 - 1 ) >= nitend .OR. kindic < 0 ) THEN
          WRITE(numout,*) ' Closing the icemod file '
          CALL histclo( nicea ) 
Index: trunk/NEMO/LIM_SRC_3/limwri_dimg.h90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limwri_dimg.h90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/limwri_dimg.h90	(revision 888)
@@ -2,5 +2,5 @@
    !!----------------------------------------------------------------------
    !!  LIM 2.0, UCL-LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limwri_dimg.h90,v 1.2 2005/03/27 18:34:42 opalod Exp $
+   !! $ Id: $
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
    !!----------------------------------------------------------------------
@@ -80,5 +80,5 @@
 
        zsto     = rdt_ice
-       zout     = nwrite * rdt_ice / nfice
+       zout     = nwrite * rdt_ice / nn_fsbc
        zsec     = 0.
        niter    = 0
@@ -111,16 +111,16 @@
                + v_ice(ji,jj+1) * tmu(ji,jj+1) + v_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
                / ztmu
-          zcmo(ji,jj,9)  = sst_io(ji,jj)
-          zcmo(ji,jj,10) = sss_io(ji,jj)
-
-          zcmo(ji,jj,11) = fnsolar(ji,jj) + fsolar(ji,jj)
-          zcmo(ji,jj,12) = fsolar (ji,jj)
-          zcmo(ji,jj,13) = fnsolar(ji,jj)
+          zcmo(ji,jj,9)  = sst_m(ji,jj)
+          zcmo(ji,jj,10) = sss_m(ji,jj)
+
+          zcmo(ji,jj,11) = qns(ji,jj) + qsr(ji,jj)
+          zcmo(ji,jj,12) = qsr(ji,jj)
+          zcmo(ji,jj,13) = qns(ji,jj)
           ! See thersf for the coefficient
-          zcmo(ji,jj,14) = - fsalt(ji,jj) * rday * ( sss_io(ji,jj) + epsi16 ) / soce
-          zcmo(ji,jj,15) = gtaux(ji,jj)
-          zcmo(ji,jj,16) = gtauy(ji,jj)
-          zcmo(ji,jj,17) = ( 1.0 - frld(ji,jj) ) * qsr_ice (ji,jj) + frld(ji,jj) * qsr_oce (ji,jj)
-          zcmo(ji,jj,18) = ( 1.0 - frld(ji,jj) ) * qnsr_ice(ji,jj) + frld(ji,jj) * qnsr_oce(ji,jj)
+          zcmo(ji,jj,14) = - emps(ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce
+          zcmo(ji,jj,15) = utaui_ice(ji,jj)
+          zcmo(ji,jj,16) = vtaui_ice(ji,jj)
+          zcmo(ji,jj,17) = qsr (ji,jj)
+          zcmo(ji,jj,18) = qns(ji,jj)
           zcmo(ji,jj,19) = sprecip(ji,jj)
        END DO
@@ -154,16 +154,16 @@
                      + v_ice(ji,jj+1) * tmu(ji,jj+1) + v_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) &
                      / ztmu
-                rcmoy(ji,jj,9)  = sst_io(ji,jj)
-                rcmoy(ji,jj,10) = sss_io(ji,jj)
-
-                rcmoy(ji,jj,11) = fnsolar(ji,jj) + fsolar(ji,jj)
-                rcmoy(ji,jj,12) = fsolar (ji,jj)
-                rcmoy(ji,jj,13) = fnsolar(ji,jj)
+                rcmoy(ji,jj,9)  = sst_m(ji,jj)
+                rcmoy(ji,jj,10) = sss_m(ji,jj)
+
+                rcmoy(ji,jj,11) = qns(ji,jj) + qsr(ji,jj)
+                rcmoy(ji,jj,12) = qsr(ji,jj)
+                rcmoy(ji,jj,13) = qns(ji,jj)
                 ! See thersf for the coefficient
-                rcmoy(ji,jj,14) = - fsalt(ji,jj) * rday * ( sss_io(ji,jj) + epsi16 ) / soce
-                rcmoy(ji,jj,15) = gtaux(ji,jj)
-                rcmoy(ji,jj,16) = gtauy(ji,jj)
-                rcmoy(ji,jj,17) = ( 1.0 - frld(ji,jj) ) * qsr_ice (ji,jj) + frld(ji,jj) * qsr_oce (ji,jj)
-                rcmoy(ji,jj,18) = ( 1.0 - frld(ji,jj) ) * qnsr_ice(ji,jj) + frld(ji,jj) * qnsr_oce(ji,jj)
+                rcmoy(ji,jj,14) = - emps(ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce
+                rcmoy(ji,jj,15) = utaui_ice(ji,jj)
+                rcmoy(ji,jj,16) = vtaui_ice(ji,jj)
+                rcmoy(ji,jj,17) = qsr(ji,jj)
+                rcmoy(ji,jj,18) = qns(ji,jj)
                 rcmoy(ji,jj,19) = sprecip(ji,jj)
              END DO
@@ -176,6 +176,5 @@
              zfield(:,:) = (rcmoy(:,:,jf) * cmulti(jf) + cadd(jf)) * tmask(:,:,1)
 
-             IF ( jf == 7  .OR. jf == 8  .OR. jf == 11 .OR. jf == 12 .OR. jf == 15 .OR.   &
-                  jf == 23 .OR. jf == 24 .OR. jf == 16 ) THEN 
+             IF ( jf == 7  .OR. jf == 8  .OR. jf == 15 .OR. jf == 16 ) THEN 
                 CALL lbc_lnk( zfield, 'T', -1. )
              ELSE 
Index: trunk/NEMO/LIM_SRC_3/par_ice.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/par_ice.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/par_ice.F90	(revision 888)
@@ -6,6 +6,6 @@
    !!----------------------------------------------------------------------
    !!  LIM 2.0, UCL-LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/par_ice.F90,v 1.4 2005/03/27 18:34:42 opalod Exp $
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
    !! * Modules used
Index: trunk/NEMO/LIM_SRC_3/thd_ice.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/thd_ice.F90	(revision 873)
+++ trunk/NEMO/LIM_SRC_3/thd_ice.F90	(revision 888)
@@ -8,6 +8,6 @@
    !!----------------------------------------------------------------------
    !!   LIM 2.0, UCL-LOCEAN-IPSL (2005)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/thd_ice.F90,v 1.4 2005/03/27 18:34:42 opalod Exp $
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
    !! * Modules used
Index: trunk/NEMO/NST_SRC/agrif_user.F90
===================================================================
--- trunk/NEMO/NST_SRC/agrif_user.F90	(revision 873)
+++ trunk/NEMO/NST_SRC/agrif_user.F90	(revision 888)
@@ -62,5 +62,5 @@
       USE sol_oce
       USE in_out_manager
-#if defined key_lim3 || defined key_lim3_old
+#if defined key_lim3 || defined key_lim2
       USE ice_oce
 #endif
Index: trunk/NEMO/OPA_SRC/DIA/diafwb.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DIA/diafwb.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DIA/diafwb.F90	(revision 888)
@@ -4,20 +4,21 @@
    !! Ocean diagnostics: freshwater budget
    !!======================================================================
+   !! History :  8.2  !  01-02  (E. Durand)  Original code
+   !!            8.5  !  02-06  (G. Madec)  F90: Free form and module
+   !!            9.0  !  05-11  (V. Garnier) Surface pressure gradient organization
+   !!----------------------------------------------------------------------
 #if ( defined key_orca_r2 || defined  key_orca_r4 ) && ! defined key_dynspg_rl && ! defined key_coupled
    !!----------------------------------------------------------------------
    !!   NOT "key_dynspg_rl" and "key_orca_r2 or 4"
    !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
    !!   dia_fwb     : freshwater budget for global ocean configurations
    !!----------------------------------------------------------------------
-   !! * Modules used
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
    USE phycst          ! physical constants
+   USE sbc_oce         ! ???
    USE zdf_oce         ! ocean vertical physics
    USE in_out_manager  ! I/O manager
-   USE flxrnf          ! ???
-   USE ocesbc          ! ???
-   USE blk_oce         ! ???
-   USE flxblk          ! atmospheric surface quantity
    USE lib_mpp         ! distributed memory computing library
 
@@ -25,17 +26,11 @@
    PRIVATE
 
-   !! * Routine accessibility
    PUBLIC dia_fwb    ! routine called by step.F90
 
-   !! * Shared module variables
    LOGICAL, PUBLIC, PARAMETER ::   lk_diafwb = .TRUE.    !: fresh water budget flag
 
-   !! * Module variables
-   REAL(wp) ::   &
-      a_emp , a_precip, a_rnf,   &
-      a_sshb, a_sshn, a_salb, a_saln,   &
-      a_aminus, a_aplus
-   REAL(wp), DIMENSION(4) ::   &
-      a_flxi, a_flxo, a_temi, a_temo, a_sali, a_salo
+   REAL(wp)               ::   a_emp ,          &
+      &                        a_sshb, a_sshn, a_salb, a_saln
+   REAL(wp), DIMENSION(4) ::   a_flxi, a_flxo, a_temi, a_temo, a_sali, a_salo
 
    !! * Substitutions
@@ -43,7 +38,7 @@
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/DIA/diafwb.F90,v 1.11 2007/06/29 17:01:51 opalod Exp $ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $Header: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -55,17 +50,7 @@
       !!     
       !! ** Purpose :
-      !!	
-      !! ** Method :
-      !!	
-      !! History :
-      !!   8.2  !  01-02  (E. Durand)  Original code
-      !!   8.5  !  02-06  (G. Madec)  F90: Free form and module
-      !!   9.0  !  05-11  (V. Garnier) Surface pressure gradient organization
       !!----------------------------------------------------------------------
-      !! * Arguments
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
-
-      !! * Local declarations
-      CHARACTER (len=32) ::  clname
+      !!
       INTEGER :: inum             ! temporary logical unit
       INTEGER :: ji, jj, jk, jt   ! dummy loop indices
@@ -85,10 +70,6 @@
 
          a_emp    = 0.e0
-         a_precip = 0.e0
-         a_rnf    = 0.e0
          a_sshb   = 0.e0 ! valeur de ssh au debut de la simulation
          a_salb   = 0.e0 ! valeur de sal au debut de la simulation
-         a_aminus = 0.e0
-         a_aplus  = 0.e0
          ! sshb used because diafwb called after tranxt (i.e. after the swap)
          a_sshb = SUM( e1t(:,:) * e2t(:,:) * sshb(:,:) * tmask_i(:,:) )
@@ -108,13 +89,4 @@
       a_emp    = SUM( e1t(:,:) * e2t(:,:) * emp   (:,:) * tmask_i(:,:) )
       IF( lk_mpp )   CALL mpp_sum( a_emp    )       ! sum over the global domain
-#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily
-      a_precip = SUM( e1t(:,:) * e2t(:,:) * watm  (:,:) * tmask_i(:,:) )
-      IF( lk_mpp )   CALL mpp_sum( a_precip )       ! sum over the global domain
-#endif
-      a_rnf    = SUM( e1t(:,:) * e2t(:,:) * runoff(:,:) * tmask_i(:,:) )
-      IF( lk_mpp )   CALL mpp_sum( a_rnf    )       ! sum over the global domain
-
-      IF( aminus /= 0.e0 ) a_aminus = a_aminus + ( MIN( aplus, aminus ) / aminus )
-      IF( aplus  /= 0.e0 ) a_aplus  = a_aplus  + ( MIN( aplus, aminus ) / aplus  )
 
       IF( kt == nitend ) THEN
@@ -142,15 +114,8 @@
          IF( lk_mpp )   CALL mpp_sum( zvol )      ! sum over the global domain
          
-         a_aminus = a_aminus / ( nitend - nit000 + 1 )
-         a_aplus  = a_aplus  / ( nitend - nit000 + 1 )
-
          ! Conversion in m3
          a_emp    = a_emp * rdttra(1) * 1.e-3 
-         a_precip = a_precip * rdttra(1) * 1.e-3 / rday
-         a_rnf    = a_rnf * rdttra(1) * 1.e-3
          
-         ! Alpha1=Alpha0-Rest/(Precip+runoff)
-         !  C A U T I O N : precipitations are negative !!     
-         
+         ! emp correction to bring back the mean ssh to zero
          zempnew = a_sshn / ( ( nitend - nit000 + 1 ) * rdt ) * 1.e3 / zarea
 
@@ -389,12 +354,9 @@
       IF ( kt == nitend .AND. cp_cfg == "orca" ) THEN
 
-         clname = 'STRAIT.dat'
-         CALL ctlopn( inum, clname, 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL',   &
+         CALL ctlopn( inum, 'STRAIT.dat', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL',   &
             &         1, numout, lwp, 1 )
          WRITE(inum,*)
          WRITE(inum,*)    'Net freshwater budget '
          WRITE(inum,9010) '  emp    = ',a_emp,   ' m3 =', a_emp   /(FLOAT(nitend-nit000+1)*rdttra(1)) * 1.e-6,' Sv'
-         WRITE(inum,9010) '  precip = ',a_precip,' m3 =', a_precip/(FLOAT(nitend-nit000+1)*rdttra(1)) * 1.e-6,' Sv'
-         WRITE(inum,9010) '  a_rnf  = ',a_rnf,   ' m3 =', a_rnf   /(FLOAT(nitend-nit000+1)*rdttra(1)) * 1.e-6,' Sv'
          WRITE(inum,*)
          WRITE(inum,9010) '  zarea =',zarea
@@ -417,9 +379,4 @@
          WRITE(inum,9020) '  diff      =',(a_saln-a_salb)/zvol,' psu'
          WRITE(inum,9020) '  S-SLevitus=',a_saln/zvol,' psu'
-         WRITE(inum,*)
-         WRITE(inum,*)    'Coeff : '
-         WRITE(inum,9030) '  Alpha+   =  ', a_aplus
-         WRITE(inum,9030) '  Alpha-   =  ', a_aminus
-         WRITE(inum,*)
          WRITE(inum,*)
          WRITE(inum,*)    'Gibraltar : '
Index: trunk/NEMO/OPA_SRC/DIA/diawri.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DIA/diawri.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DIA/diawri.F90	(revision 888)
@@ -14,9 +14,9 @@
    USE sol_oce         ! solver variables
    USE ice_oce         ! ice variables
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE sbc_ice         ! Surface boundary condition: ice fields
+   USE sbcssr          ! restoring term toward SST/SSS climatology
    USE phycst          ! physical constants
    USE ocfzpt          ! ocean freezing point
-   USE ocesbc          ! surface thermohaline fluxes
-   USE taumod          ! surface stress
-   USE flxrnf          ! ocean runoffs
    USE zdfmxl          ! mixed layer
    USE daymod          ! calendar
@@ -27,5 +27,4 @@
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE in_out_manager  ! I/O manager
-   USE flx_oce         ! sea-ice/ocean forcings variables
    USE diadimg         ! dimg direct access file format output
    USE ioipsl
@@ -54,5 +53,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
@@ -245,22 +244,22 @@
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
 #endif
-#if ! defined key_dynspg_rl && ( defined key_lim3 || defined key_lim2 )
-         ! sowaflup = sowaflep + sorunoff + sowafldp + a term associated to
-         !    internal damping to Levitus that can be diagnosed from others
-         ! sowaflcd = sowaflep + sorunoff + sowafldp + iowaflup
-         CALL histdef( nid_T, "iowaflup", "Ice=>ocean net freshwater"          , "kg/m2/s",   &  ! fsalt
-            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-         CALL histdef( nid_T, "sowaflep", "atmos=>ocean net freshwater"        , "kg/m2/s",   &  ! fmass
-            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-#endif
+!!$#if ! defined key_dynspg_rl && ( defined key_lim3 || defined key_lim2 )
+!!$         ! sowaflup = sowaflep + sorunoff + sowafldp + a term associated to
+!!$         !    internal damping to Levitus that can be diagnosed from others
+!!$         ! sowaflcd = sowaflep + sorunoff + sowafldp + iowaflup
+!!$         CALL histdef( nid_T, "iowaflup", "Ice=>ocean net freshwater"          , "kg/m2/s",   &  ! fsalt
+!!$            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
+!!$         CALL histdef( nid_T, "sowaflep", "atmos=>ocean net freshwater"        , "kg/m2/s",   &  ! fmass
+!!$            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
+!!$#endif
          CALL histdef( nid_T, "sowaflup", "Net Upward Water Flux"              , "Kg/m2/s",   &  ! emp
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-         CALL histdef( nid_T, "sorunoff", "Runoffs"                            , "Kg/m2/s",   &  ! runoffs
-            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
+!!$         CALL histdef( nid_T, "sorunoff", "Runoffs"                            , "Kg/m2/s",   &  ! runoffs
+!!$            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
          CALL histdef( nid_T, "sowaflcd", "concentration/dilution water flux"  , "kg/m2/s",   &  ! emps
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
          CALL histdef( nid_T, "sosalflx", "Surface Salt Flux"                  , "Kg/m2/s",   &  ! emps * sn
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-         CALL histdef( nid_T, "sohefldo", "Net Downward Heat Flux"             , "W/m2"   ,   &  ! qt
+         CALL histdef( nid_T, "sohefldo", "Net Downward Heat Flux"             , "W/m2"   ,   &  ! qns + qsr
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
          CALL histdef( nid_T, "soshfldo", "Shortwave Radiation"                , "W/m2"   ,   &  ! qsr
@@ -281,15 +280,7 @@
 #endif
 
-#if defined key_flx_core
-         CALL histdef( nid_T, "solhflup", "Latent Heat Flux Upward"         , "W/m2"   ,   &  ! qla
-            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-         CALL histdef( nid_T, "solwfldo", "Longwave Radiation downward"     , "W/m2"   ,   &  ! qlw
-            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-         CALL histdef( nid_T, "sosbhfup", "Sensible Heat Flux upward"       , "W/m2"   ,   &  ! qsb
-            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-#endif
-
-
-#if defined key_coupled &&  ! defined key_lim3 && ! defined key_lim2   
+
+
+#if ( defined key_coupled && ! defined key_lim3 && ! defined key_lim2 ) 
          CALL histdef( nid_T, "sohefldp", "Surface Heat Flux: Damping"         , "W/m2"   ,   &  ! qrp
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
@@ -317,9 +308,13 @@
 #endif
 
-#if ( defined key_lim3  || defined key_lim2 ) && defined key_coupled
+#if defined key_coupled 
+# if defined key_lim3
+         Must be adapted to LIM3
+# else
          CALL histdef( nid_T,"soicetem" , "Ice Surface Temperature"            , "K"      ,   &  ! tn_ice
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
          CALL histdef( nid_T,"soicealb" , "Ice Albedo"                         , "[0,1]"  ,   &  ! alb_ice
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
+# endif 
 #endif 
 
@@ -334,5 +329,5 @@
 #endif
          !                                                                                      !!! nid_U : 2D
-         CALL histdef( nid_U, "sozotaux", "Wind Stress along i-axis"           , "N/m2"   ,   &  ! taux
+         CALL histdef( nid_U, "sozotaux", "Wind Stress along i-axis"           , "N/m2"   ,   &  ! utau
             &          jpi, jpj, nh_U, 1  , 1, 1  , - 99, 32, clop, zsto, zout )
 #if defined key_dynspg_rl
@@ -351,5 +346,5 @@
 #endif
          !                                                                                      !!! nid_V : 2D
-         CALL histdef( nid_V, "sometauy", "Wind Stress along j-axis"           , "N/m2"   ,   &  ! tauy
+         CALL histdef( nid_V, "sometauy", "Wind Stress along j-axis"           , "N/m2"   ,   &  ! vtau
             &          jpi, jpj, nh_V, 1  , 1, 1  , - 99, 32, clop, zsto, zout )
 #if defined key_dynspg_rl
@@ -423,14 +418,14 @@
       CALL histwrite( nid_T, "sossheig", it, sshn          , ndim_hT, ndex_hT )   ! sea surface height
 #endif
-#if ! defined key_dynspg_rl && ( defined key_lim3 || defined key_lim2 )
-      CALL histwrite( nid_T, "iowaflup", it, fsalt(:,:)    , ndim_hT, ndex_hT )   ! ice=>ocean water flux
-      CALL histwrite( nid_T, "sowaflep", it, fmass(:,:)    , ndim_hT, ndex_hT )   ! atmos=>ocean water flux
-#endif
+!!$#if ! defined key_dynspg_rl && ( defined key_lim3 || defined key_lim2 )
+!!$      CALL histwrite( nid_T, "iowaflup", it, fsalt(:,:)    , ndim_hT, ndex_hT )   ! ice=>ocean water flux
+!!$      CALL histwrite( nid_T, "sowaflep", it, fmass(:,:)    , ndim_hT, ndex_hT )   ! atmos=>ocean water flux
+!!$#endif
       CALL histwrite( nid_T, "sowaflup", it, emp           , ndim_hT, ndex_hT )   ! upward water flux
-      CALL histwrite( nid_T, "sorunoff", it, runoff        , ndim_hT, ndex_hT )   ! runoff
+!!$      CALL histwrite( nid_T, "sorunoff", it, runoff        , ndim_hT, ndex_hT )   ! runoff
       CALL histwrite( nid_T, "sowaflcd", it, emps          , ndim_hT, ndex_hT )   ! c/d water flux
       zw2d(:,:) = emps(:,:) * sn(:,:,1) * tmask(:,:,1)
       CALL histwrite( nid_T, "sosalflx", it, zw2d          , ndim_hT, ndex_hT )   ! c/d salt flux
-      CALL histwrite( nid_T, "sohefldo", it, qt            , ndim_hT, ndex_hT )   ! total heat flux
+      CALL histwrite( nid_T, "sohefldo", it, qns + qsr     , ndim_hT, ndex_hT )   ! total heat flux
       CALL histwrite( nid_T, "soshfldo", it, qsr           , ndim_hT, ndex_hT )   ! solar heat flux
       CALL histwrite( nid_T, "somxl010", it, hmlp          , ndim_hT, ndex_hT )   ! mixed layer depth
@@ -443,10 +438,5 @@
       CALL histwrite( nid_T, "sosafldp", it, zw2d          , ndim_hT, ndex_hT )   ! salt flux damping
 #endif
-#if defined key_flx_core
-      CALL histwrite( nid_T, "solhflup", it, qla           , ndim_hT, ndex_hT )   ! latent heat flux
-      CALL histwrite( nid_T, "solwfldo", it, qlw           , ndim_hT, ndex_hT )   ! longwave heat flux
-      CALL histwrite( nid_T, "sosbhfup", it, qsb           , ndim_hT, ndex_hT )   ! sensible heat flux
-#endif
-#if  defined key_coupled && ! defined key_lim3 && ! defined key_lim2 
+#if ( defined key_coupled && ! defined key_lim3 && ! defined key_lim2 ) 
       CALL histwrite( nid_T, "sohefldp", it, qrp           , ndim_hT, ndex_hT )   ! heat flux damping
       CALL histwrite( nid_T, "sowafldp", it, erp           , ndim_hT, ndex_hT )   ! freshwater flux damping
@@ -466,7 +456,14 @@
       CALL histwrite( nid_T, "sohtc300", it, htc3          , ndim_hT, ndex_hT )   ! first 300m heaat content
 #endif
-#if ( defined key_lim3  ||  defined key_lim2 ) &&  defined key_coupled 
+
+#if defined key_coupled 
+# if defined key_lim3
+      Must be adapted for LIM3
       CALL histwrite( nid_T, "soicetem", it, tn_ice        , ndim_hT, ndex_hT )   ! surf. ice temperature
       CALL histwrite( nid_T, "soicealb", it, alb_ice       , ndim_hT, ndex_hT )   ! ice albedo
+# else
+      CALL histwrite( nid_T, "soicetem", it, tn_ice        , ndim_hT, ndex_hT )   ! surf. ice temperature
+      CALL histwrite( nid_T, "soicealb", it, alb_ice       , ndim_hT, ndex_hT )   ! ice albedo
+# endif
 #endif
          ! Write fields on U grid
@@ -475,5 +472,5 @@
       CALL histwrite( nid_U, "vozoeivu", it, u_eiv         , ndim_U , ndex_U )    ! i-eiv current
 #endif
-      CALL histwrite( nid_U, "sozotaux", it, taux          , ndim_hU, ndex_hU )   ! i-wind stress
+      CALL histwrite( nid_U, "sozotaux", it, utau          , ndim_hU, ndex_hU )   ! i-wind stress
 #if defined key_dynspg_rl
       CALL lbc_lnk( spgu, 'U', -1. )
@@ -486,5 +483,5 @@
       CALL histwrite( nid_V, "vomeeivv", it, v_eiv         , ndim_V , ndex_V  )   ! j-eiv current
 #endif
-      CALL histwrite( nid_V, "sometauy", it, tauy          , ndim_hV, ndex_hV )   ! j-wind stress
+      CALL histwrite( nid_V, "sometauy", it, vtau          , ndim_hV, ndex_hV )   ! j-wind stress
 #if defined key_dynspg_rl
       CALL lbc_lnk( spgv, 'V', -1. )
@@ -640,20 +637,20 @@
 
       ! Write all fields on T grid
-      CALL histwrite( id_i, "votemper", 1, tn    , jpi*jpj*jpk, idex )    ! now temperature
-      CALL histwrite( id_i, "vosaline", 1, sn    , jpi*jpj*jpk, idex )    ! now salinity
-#if defined key_dynspg_rl
-      CALL histwrite( id_i, "sobarstf", 1, bsfn  , jpi*jpj    , idex )    ! barotropic streamfunction
+      CALL histwrite( id_i, "votemper", 1, tn      , jpi*jpj*jpk, idex )    ! now temperature
+      CALL histwrite( id_i, "vosaline", 1, sn      , jpi*jpj*jpk, idex )    ! now salinity
+#if defined key_dynspg_rl
+      CALL histwrite( id_i, "sobarstf", 1, bsfn     , jpi*jpj    , idex )    ! barotropic streamfunction
 #else
-      CALL histwrite( id_i, "sossheig", 1, sshn  , jpi*jpj    , idex )    ! sea surface height
-#endif
-      CALL histwrite( id_i, "vozocrtx", 1, un    , jpi*jpj*jpk, idex )    ! now i-velocity
-      CALL histwrite( id_i, "vomecrty", 1, vn    , jpi*jpj*jpk, idex )    ! now j-velocity
-      CALL histwrite( id_i, "vovecrtz", 1, wn    , jpi*jpj*jpk, idex )    ! now k-velocity
-      CALL histwrite( id_i, "sowaflup", 1, emp   , jpi*jpj    , idex )    ! freshwater budget
-      CALL histwrite( id_i, "sohefldo", 1, qt    , jpi*jpj    , idex )    ! total heat flux
-      CALL histwrite( id_i, "soshfldo", 1, qsr   , jpi*jpj    , idex )    ! total heat flux
-      CALL histwrite( id_i, "soicecov", 1, freeze, jpi*jpj    , idex )    ! ice cover
-      CALL histwrite( id_i, "sozotaux", 1, taux  , jpi*jpj    , idex )    ! i-wind stress
-      CALL histwrite( id_i, "sometauy", 1, tauy  , jpi*jpj    , idex )    ! j-wind stress
+      CALL histwrite( id_i, "sossheig", 1, sshn     , jpi*jpj    , idex )    ! sea surface height
+#endif
+      CALL histwrite( id_i, "vozocrtx", 1, un       , jpi*jpj*jpk, idex )    ! now i-velocity
+      CALL histwrite( id_i, "vomecrty", 1, vn       , jpi*jpj*jpk, idex )    ! now j-velocity
+      CALL histwrite( id_i, "vovecrtz", 1, wn       , jpi*jpj*jpk, idex )    ! now k-velocity
+      CALL histwrite( id_i, "sowaflup", 1, emp      , jpi*jpj    , idex )    ! freshwater budget
+      CALL histwrite( id_i, "sohefldo", 1, qsr + qns, jpi*jpj    , idex )    ! total heat flux
+      CALL histwrite( id_i, "soshfldo", 1, qsr      , jpi*jpj    , idex )    ! solar heat flux
+      CALL histwrite( id_i, "soicecov", 1, freeze   , jpi*jpj    , idex )    ! ice cover
+      CALL histwrite( id_i, "sozotaux", 1, utau     , jpi*jpj    , idex )    ! i-wind stress
+      CALL histwrite( id_i, "sometauy", 1, vtau     , jpi*jpj    , idex )    ! j-wind stress
 
       ! 3. Close the file
Index: trunk/NEMO/OPA_SRC/DIA/diawri_dimg.h90
===================================================================
--- trunk/NEMO/OPA_SRC/DIA/diawri_dimg.h90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DIA/diawri_dimg.h90	(revision 888)
@@ -3,5 +3,5 @@
   !!----------------------------------------------------------------------
   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-  !! $Header$ 
+  !! $Id$
   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
   !!----------------------------------------------------------------------
@@ -41,8 +41,8 @@
     !!    To be tested with a lot of procs !!!!
     !!
-    !!  level 1:  taux(:,:) * umask(:,:,1) zonal stress in N.m-2
-    !!  level 2:  tauy(:,:) * vmask(:,:,1) meridional stress in N. m-2
-    !!  level 3:   qt  (:,:)               total heat flux (W/m2)
-    !!  level 4:   emp (:,:)               E-P flux (mm/day)
+    !!  level 1:  utau(:,:) * umask(:,:,1) zonal stress in N.m-2
+    !!  level 2:  vtau(:,:) * vmask(:,:,1) meridional stress in N. m-2
+    !!  level 3:  qsr + qns                total heat flux (W/m2)
+    !!  level 4:  emp (:,:)               E-P flux (mm/day)
     !!  level 5:  tb  (:,:,1)-sst          model SST -forcing sst (degree C)
     !!  level 6:  bsfb(:,:)		   streamfunction (m**3/s)
@@ -76,5 +76,4 @@
     !! * modules used
     USE lib_mpp
-    USE dtasst, ONLY : sst
 
     !! * Arguments
@@ -167,7 +166,7 @@
        sm(:,:,:)=sm(:,:,:) + sn (:,:,:)
        !
-       fsel(:,:,1 ) = fsel(:,:,1 ) + taux(:,:) * umask(:,:,1)
-       fsel(:,:,2 ) = fsel(:,:,2 ) + tauy(:,:) * vmask(:,:,1)
-       fsel(:,:,3 ) = fsel(:,:,3 ) + qt  (:,:) 
+       fsel(:,:,1 ) = fsel(:,:,1 ) + utau(:,:) * umask(:,:,1)
+       fsel(:,:,2 ) = fsel(:,:,2 ) + vtau(:,:) * vmask(:,:,1)
+       fsel(:,:,3 ) = fsel(:,:,3 ) + qsr (:,:) + qns  (:,:) 
        fsel(:,:,4 ) = fsel(:,:,4 ) + emp (:,:)
        fsel(:,:,5 ) = fsel(:,:,5 ) + tb  (:,:,1) - sst(:,:)
@@ -187,14 +186,6 @@
        !        fsel(:,:,15) = fsel(:,:,15) + fbt(:,:)
        fsel(:,:,16) = fsel(:,:,16) + emps(:,:)
-#if defined key_lim3 || defined key_lim3_old
-       fsel(:,:,17) = fsel(:,:,17) + fsalt(:,:)
-#endif
 #ifdef key_diaspr   
        fsel(:,:,18) = fsel(:,:,18) + gps(:,:)/g 
-#endif
-#if defined key_flx_core
-       fsel(:,:,21) = fsel(:,:,21) + qla(:,:)
-       fsel(:,:,22) = fsel(:,:,22) + qlw(:,:)
-       fsel(:,:,23) = fsel(:,:,23) + qsb(:,:)
 #endif
        !
@@ -231,5 +222,5 @@
           fsel(:,:,20)= spgv(:,:)
 #endif
-          ! mask mean field with tmask except taux tauy (1,2)
+          ! mask mean field with tmask except utau vtau (1,2)
           DO jk=3,inbsel
             fsel(:,:,jk)=fsel(:,:,jk)*tmask(:,:,1)
@@ -256,7 +247,7 @@
           fsel(:,:,:) = 0._wp
           !
-          fsel(:,:,1 ) = taux(:,:) * umask(:,:,1)
-          fsel(:,:,2 ) = tauy(:,:) * vmask(:,:,1)
-          fsel(:,:,3 ) = qt  (:,:) * tmask(:,:,1)
+          fsel(:,:,1 ) = utau(:,:) * umask(:,:,1)
+          fsel(:,:,2 ) = vtau(:,:) * vmask(:,:,1)
+          fsel(:,:,3 ) = (qsr (:,:) + qnr (:,:)) * tmask(:,:,1)
           fsel(:,:,4 ) = emp (:,:) * tmask(:,:,1)
           fsel(:,:,5 ) = (tb  (:,:,1) -sst(:,:)) *tmask(:,:,1)
@@ -277,16 +268,8 @@
           !         fsel(:,:,15) =  fbt(:,:)
           fsel(:,:,16) =  emps(:,:) * tmask(:,:,1)
-#if defined key_lim3 || defined key_lim3_old
-          fsel(:,:,17) =  fsalt(:,:) * tmask(:,:,1)
-#endif
 #ifdef key_diaspr           
           fsel(:,:,18) =      gps(:,:) /g
           fsel(:,:,19) =      spgu(:,:)
           fsel(:,:,20) =      spgv(:,:)
-#endif
-#if defined key_flx_core
-          fsel(:,:,21) =  qla(:,:)* tmask(:,:,1)
-          fsel(:,:,22) =  qlw(:,:)* tmask(:,:,1)
-          fsel(:,:,23) =  qsb(:,:)* tmask(:,:,1)
 #endif
           !
Index: trunk/NEMO/OPA_SRC/DOM/closea.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DOM/closea.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DOM/closea.F90	(revision 888)
@@ -2,17 +2,22 @@
    !!======================================================================
    !!                       ***  MODULE  closea  ***
-   !! Closed Seas  : 
+   !! Closed Seas  : specific treatments associated with closed seas
    !!======================================================================
+   !! History :   8.2  !  00-05  (O. Marti)  Original code
+   !!             8.5  !  02-06  (E. Durand, G. Madec)  F90
+   !!             9.0  !  06-07  (G. Madec)  add clo_rnf, clo_ups, clo_bat
+   !!----------------------------------------------------------------------
 
    !!----------------------------------------------------------------------
    !!   dom_clo    : modification of the ocean domain for closed seas cases
-   !!   flx_clo    : Special handling of closed seas
-   !!----------------------------------------------------------------------
-   !! * Modules used
+   !!   sbc_clo    : Special handling of closed seas
+   !!   clo_rnf    : set close sea outflows as river mouths (see sbcrnf)
+   !!   clo_ups    : set mixed centered/upstream scheme in closed sea (see traadv_cen2)
+   !!   clo_bat    : set to zero a field over closed sea (see domzrg)
+   !!----------------------------------------------------------------------
    USE oce             ! dynamics and tracers
    USE dom_oce         ! ocean space and time domain
    USE in_out_manager  ! I/O manager
-   USE ocesbc          ! ocean surface boundary conditions (fluxes)
-   USE flxrnf          ! runoffs
+   USE sbc_oce         ! ocean surface boundary conditions
    USE lib_mpp         ! distributed memory computing library
    USE lbclnk          ! ???
@@ -21,32 +26,29 @@
    PRIVATE
 
-   !! * Accessibility
-   PUBLIC dom_clo      ! routine called by dom_init
-   PUBLIC flx_clo      ! routine called by step
-
-   !! * Share module variables
-   INTEGER, PUBLIC, PARAMETER ::   &  !:
-      jpncs   = 4               !: number of closed sea
-   INTEGER, PUBLIC ::          & !!: namclo : closed seas and lakes
-      nclosea =  0                !: = 0 no closed sea or lake
-      !                           !  = 1 closed sea or lake in the domain
-   INTEGER, PUBLIC, DIMENSION (jpncs) ::   &  !:
-      ncstt,           &  !: Type of closed sea
-      ncsi1, ncsj1,    &  !: closed sea limits                                                                 
-      ncsi2, ncsj2,    &  !: 
-      ncsnr               !: number of point where run-off pours
-   INTEGER, PUBLIC, DIMENSION (jpncs,4) ::   &
-      ncsir, ncsjr        !: Location of run-off
-
-   !! * Module variable
-   REAL(wp), DIMENSION (jpncs+1) ::   &
-      surf               ! closed sea surface
+   PUBLIC dom_clo      ! routine called by domain module
+   PUBLIC sbc_clo      ! routine called by step module
+   PUBLIC clo_rnf      ! routine called by sbcrnf module
+   PUBLIC clo_ups      ! routine called in traadv_cen2(_jki) module
+   PUBLIC clo_bat      ! routine called in domzgr module
+
+   !!* Namelist namclo : closed seas and lakes
+   INTEGER, PUBLIC                     ::   nclosea =  0     !: = 0 no closed sea or lake
+      !                                                      !  = 1 closed sea or lake in the domain
+      
+   INTEGER, PUBLIC, PARAMETER          ::   jpncs   = 4      !: number of closed sea
+   INTEGER, PUBLIC, DIMENSION(jpncs)   ::   ncstt            !: Type of closed sea
+   INTEGER, PUBLIC, DIMENSION(jpncs)   ::   ncsi1, ncsj1     !: south-west closed sea limits (i,j)
+   INTEGER, PUBLIC, DIMENSION(jpncs)   ::   ncsi2, ncsj2     !: north-east closed sea limits (i,j)
+   INTEGER, PUBLIC, DIMENSION(jpncs)   ::   ncsnr            !: number of point where run-off pours
+   INTEGER, PUBLIC, DIMENSION(jpncs,4) ::   ncsir, ncsjr     !: Location of runoff
+
+   REAL(wp), DIMENSION (jpncs+1)       ::   surf             ! closed sea surface
 
    !! * Substitutions
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !!  OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $Id$
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -60,19 +62,14 @@
       !!
       !! ** Method  :   if a closed sea is located only in a model grid point
-      !!      just the thermodynamic processes are applied.
-      !!
-      !! ** Action :   ncsi1(), ncsj1() : south-west closed sea limits (i,j)
-      !!               ncsi2(), ncsj2() : north-east Closed sea limits (i,j)
-      !!               ncsir(), ncsjr() : Location of runoff
-      !!               ncsnr            : number of point where run-off pours
-      !!               ncstt            : Type of closed sea
-      !!                                  =0 spread over the world ocean
-      !!                                  =2 put at location runoff
-      !!
-      !! History :
-      !!        !  01-04  (E. Durand)  Original code
-      !!   8.5  !  02-06  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Local variables
+      !!                just the thermodynamic processes are applied.
+      !!
+      !! ** Action  :   ncsi1(), ncsj1() : south-west closed sea limits (i,j)
+      !!                ncsi2(), ncsj2() : north-east Closed sea limits (i,j)
+      !!                ncsir(), ncsjr() : Location of runoff
+      !!                ncsnr            : number of point where run-off pours
+      !!                ncstt            : Type of closed sea
+      !!                                   =0 spread over the world ocean
+      !!                                   =2 put at location runoff
+      !!----------------------------------------------------------------------
       INTEGER ::   jc            ! dummy loop indices
       !!----------------------------------------------------------------------
@@ -90,10 +87,9 @@
 
       IF( cp_cfg == "orca" ) THEN
-   
+         !
          SELECT CASE ( jp_cfg )
          !                                           ! =======================
          CASE ( 2 )                                  !  ORCA_R2 configuration
             !                                        ! =======================
-
             !                                            ! Caspian Sea
             ncsnr(1)   =   1  ;  ncstt(1)   =   0           ! spread over the globe
@@ -116,9 +112,7 @@
             ncsi2(4)   =   6  ;  ncsj2(4)   = 112
             ncsir(4,1) = 171  ;  ncsjr(4,1) = 106 
-
             !                                        ! =======================
          CASE ( 4 )                                  !  ORCA_R4 configuration
             !                                        ! =======================
-
             !                                            ! Caspian Sea
             ncsnr(1)   =  1  ;  ncstt(1)   =  0  
@@ -144,5 +138,4 @@
             ncsi2(4)   = 76  ;  ncsj2(4)   = 61
             ncsir(4,1) = 84  ;  ncsjr(4,1) = 59 
-
             !                                        ! =======================
          CASE ( 025 )                                ! ORCA_R025 configuration
@@ -157,7 +150,7 @@
             ncsi2(2)   = 1304 ; ncsj2(2)   = 747
             ncsir(2,1) = 1    ; ncsjr(2,1) = 1
-
+            !
          END SELECT
-
+         !
       ENDIF
 
@@ -171,12 +164,11 @@
          ncsj2(jc)   = mj1( ncsj2(jc) )  
       END DO
-         
-
+      !
    END SUBROUTINE dom_clo
 
 
-   SUBROUTINE flx_clo( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE flx_clo  ***
+   SUBROUTINE sbc_clo( kt )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE sbc_clo  ***
       !!                    
       !! ** Purpose :   Special handling of closed seas
@@ -186,25 +178,18 @@
       !!      put as run-off in open ocean.
       !!
-      !! ** Action :
-      !!
-      !! History :
-      !!   8.2  !  00-05  (O. Marti)  Original code
-      !!   8.5  !  02-07  (G. Madec)  Free form, F90
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      INTEGER, INTENT (in) :: kt
-
-      !! * Local declarations
-      REAL(wp), DIMENSION (jpncs) :: zemp
-      INTEGER  :: ji, jj, jc, jn
-      REAL(wp) :: zze2
-      !!----------------------------------------------------------------------
-
-      ! 1 - Initialisation
-      ! ------------------
-
-      IF( kt == nit000 ) THEN 
+      !! ** Action  :   emp, emps   updated surface freshwater fluxes at kt
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt   ! ocean model time step
+      !
+      INTEGER                     ::   ji, jj, jc, jn   ! dummy loop indices
+      REAL(wp)                    ::   zze2
+      REAL(wp), DIMENSION (jpncs) ::   zemp
+      !!----------------------------------------------------------------------
+      !
+      !                                                   !------------------!
+      IF( kt == nit000 ) THEN                             !  Initialisation  !
+         !                                                !------------------!
          IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*)'flx_clo : closed seas '
+         IF(lwp) WRITE(numout,*)'sbc_clo : closed seas '
          IF(lwp) WRITE(numout,*)'~~~~~~~'
 
@@ -216,18 +201,7 @@
             DO jj = ncsj1(jc), ncsj2(jc)
                DO ji = ncsi1(jc), ncsi2(jc)
-                  ! surface of closed seas
-                  surf(jc) = surf(jc) + e1t(ji,jj)*e2t(ji,jj)*tmask_i(ji,jj)
-                  ! upstream in closed seas
-                  upsadv(ji,jj) = 0.5
+                  surf(jc) = surf(jc) + e1t(ji,jj) * e2t(ji,jj) * tmask_i(ji,jj)      ! surface of closed seas
                END DO 
             END DO 
-            ! upstream at closed sea outflow
-            IF( ncstt(jc) >= 1 ) THEN 
-                DO jn = 1, 4
-                  ji = mi0( ncsir(jc,jn) )
-                  jj = mj0( ncsjr(jc,jn) )
-                  upsrnfh(ji,jj) = MAX( upsrnfh(ji,jj), 1.0 )
-                END DO 
-            ENDIF 
          END DO 
          IF( lk_mpp )   CALL mpp_sum ( surf, jpncs+1 )       ! mpp: sum over all the global domain
@@ -235,6 +209,5 @@
          IF(lwp) WRITE(numout,*)'     Closed sea surfaces'
          DO jc = 1, jpncs
-            IF(lwp) WRITE(numout,FMT='(1I3,4I4,5X,F16.2)')    &
-                jc, ncsi1(jc), ncsi2(jc), ncsj1(jc), ncsj2(jc), surf(jc)
+            IF(lwp)WRITE(numout,FMT='(1I3,4I4,5X,F16.2)') jc, ncsi1(jc), ncsi2(jc), ncsj1(jc), ncsj2(jc), surf(jc)
          END DO
 
@@ -243,11 +216,9 @@
             surf(jpncs+1) = surf(jpncs+1) - surf(jc)
          END DO           
- 
+         !
       ENDIF
-
-      ! 2 - Computation
-      ! ---------------
-      zemp = 0.e0
-
+      !                                                   !--------------------!
+      !                                                   !  update emp, emps  !
+      zemp = 0.e0                                         !--------------------!
       DO jc = 1, jpncs
          DO jj = ncsj1(jc), ncsj2(jc)
@@ -257,5 +228,5 @@
          END DO 
       END DO
-      IF( lk_mpp )   CALL mpp_sum ( zemp , jpncs )       ! mpp: sum over all the global domain
+      IF( lk_mpp )   CALL mpp_sum ( zemp(:) , jpncs )       ! mpp: sum over all the global domain
 
       IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN      ! Black Sea case for ORCA_R2 configuration
@@ -266,5 +237,5 @@
 
       DO jc = 1, jpncs
-
+         !
          IF( ncstt(jc) == 0 ) THEN 
             ! water/evap excess is shared by all open ocean
@@ -303,5 +274,5 @@
             ENDIF 
          ENDIF 
-
+         !
          DO jj = ncsj1(jc), ncsj2(jc)
             DO ji = ncsi1(jc), ncsi2(jc)
@@ -310,14 +281,99 @@
             END DO  
          END DO 
-
+         !
       END DO 
-
-
-      ! 5. Boundary condition on emp and emps
-      ! -------------------------------------
+      !
       CALL lbc_lnk( emp , 'T', 1. )
       CALL lbc_lnk( emps, 'T', 1. )
-
-   END SUBROUTINE flx_clo
+      !
+   END SUBROUTINE sbc_clo
+   
+   
+   SUBROUTINE clo_rnf( p_rnfmsk )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE sbc_rnf  ***
+      !!                    
+      !! ** Purpose :   allow the treatment of closed sea outflow grid-points
+      !!                to be the same as river mouth grid-points
+      !!
+      !! ** Method  :   set to 1 the runoff mask (mskrnf, see sbcrnf module)
+      !!                at the closed sea outflow grid-point.
+      !!
+      !! ** Action  :   update (p_)mskrnf (set 1 at closed sea outflow)
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   p_rnfmsk   ! river runoff mask (rnfmsk array)
+      !
+      INTEGER  ::   jc, jn      ! dummy loop indices
+      INTEGER  ::   ii, ij      ! temporary integer
+      !!----------------------------------------------------------------------
+      !
+      DO jc = 1, jpncs
+         IF( ncstt(jc) >= 1 ) THEN            ! runoff mask set to 1 at closed sea outflows
+             DO jn = 1, 4
+               ii = mi0( ncsir(jc,jn) )
+               ij = mj0( ncsjr(jc,jn) )
+               p_rnfmsk(ii,ij) = MAX( p_rnfmsk(ii,ij), 1.0 )
+            END DO 
+         ENDIF 
+      END DO 
+      !
+   END SUBROUTINE clo_rnf
+
+   
+   SUBROUTINE clo_ups( p_upsmsk )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE sbc_rnf  ***
+      !!                    
+      !! ** Purpose :   allow the treatment of closed sea outflow grid-points
+      !!                to be the same as river mouth grid-points
+      !!
+      !! ** Method  :   set to 0.5 the upstream mask (upsmsk, see traadv_cen2 
+      !!                module) over the closed seas.
+      !!
+      !! ** Action  :   update (p_)upsmsk (set 0.5 over closed seas)
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   p_upsmsk   ! upstream mask (upsmsk array)
+      !
+      INTEGER  ::   jc, ji, jj      ! dummy loop indices
+      !!----------------------------------------------------------------------
+      !
+      DO jc = 1, jpncs
+         DO jj = ncsj1(jc), ncsj2(jc)
+            DO ji = ncsi1(jc), ncsi2(jc)
+               p_upsmsk(ji,jj) = 0.5            ! mixed upstream/centered scheme over closed seas
+            END DO 
+         END DO 
+       END DO 
+       !
+   END SUBROUTINE clo_ups
+   
+      
+   SUBROUTINE clo_bat( pbat, kbat )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE clo_bat  ***
+      !!                    
+      !! ** Purpose :   suppress closed sea from the domain
+      !!
+      !! ** Method  :   set to 0 the meter and level bathymetry (given in 
+      !!                arguments) over the closed seas.
+      !!
+      !! ** Action  :   set pbat=0 and kbat=0 over closed seas
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   pbat   ! bathymetry in meters (bathy array)
+      INTEGER , DIMENSION(jpi,jpj), INTENT(inout) ::   kbat   ! bathymetry in levels (mbathy array)
+      !
+      INTEGER  ::   jc, ji, jj      ! dummy loop indices
+      !!----------------------------------------------------------------------
+      !
+      DO jc = 1, jpncs
+         DO jj = ncsj1(jc), ncsj2(jc)
+            DO ji = ncsi1(jc), ncsi2(jc)
+               pbat(ji,jj) = 0.e0   
+               kbat(ji,jj) = 0   
+            END DO 
+         END DO 
+       END DO 
+       !
+   END SUBROUTINE clo_bat
 
    !!======================================================================
Index: trunk/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DOM/domain.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DOM/domain.F90	(revision 888)
@@ -13,10 +13,9 @@
    USE oce             ! 
    USE dom_oce         ! ocean space and time domain
+   USE ice_oce         ! ice variables
+   USE sbc_oce         ! surface boundary condition: ocean
    USE phycst          ! physical constants
+   USE daymod          ! calendar
    USE in_out_manager  ! I/O manager
-   USE ice_oce         ! ice variables
-   USE blk_oce         ! bulk variables
-   USE flxrnf          ! runoffs
-   USE daymod          ! calendar
    USE lib_mpp         ! distributed memory computing library
 
@@ -39,5 +38,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
@@ -144,9 +143,9 @@
       NAMELIST/namrun/ no    , cexper   , ln_rstart , nrstdt , nit000,         &
          &             nitend, ndate0   , nleapy   , ninist , nstock,          &
-         &             nwrite, nrunoff  , ln_dimgnnn
+         &             nwrite, ln_dimgnnn
 
       NAMELIST/namdom/ ntopo , e3zps_min, e3zps_rat, ngrid  , nmsh  ,   &
          &             nacc  , atfp     , rdt      , rdtmin , rdtmax,   &
-         &             rdth  , rdtbt    , nfice    , nfbulk , nclosea
+         &             rdth  , rdtbt    , nclosea
       NAMELIST/namcla/ n_cla
       !!----------------------------------------------------------------------
@@ -175,5 +174,4 @@
          WRITE(numout,*) '           frequency of restart file       nstock    = ', nstock
          WRITE(numout,*) '           frequency of output file        nwrite    = ', nwrite
-         WRITE(numout,*) '           runoff option                   nrunoff   = ', nrunoff
          WRITE(numout,*) '           multi file dimgout           ln_dimgnnn   = ', ln_dimgnnn
       ENDIF
@@ -257,20 +255,4 @@
       ENDIF
 
-      IF( lk_lim3 .OR. lk_lim2 ) THEN
-         IF(lwp) WRITE(numout,*) '           ice model coupling frequency      nfice  = ', nfice
-         IF( MOD( nitend - nit000 + 1, nfice) /= 0 ) THEN 
-            WRITE(ctmp1,*) 'experiment length (', nitend - nit000 + 1, ') is NOT a multiple of nfice (', nfice, ')'
-            CALL ctl_stop( ctmp1, 'Impossible to do proper restart files' )
-         ENDIF
-         IF( MOD( nstock             , nfice) /= 0 ) THEN 
-            WRITE(ctmp1,*) 'nstock ('           , nstock             , ') is NOT a multiple of nfice (', nfice, ')'
-            CALL ctl_stop( ctmp1, 'Impossible to do proper restart files' )
-         ENDIF
-         nfbulk = nfice
-         IF( MOD( rday, nfice*rdt ) /= 0 )   CALL ctl_warn( 'nfice is NOT a multiple of the number of time steps in a day' )
-         IF(lwp) WRITE(numout,*) '           bulk computation frequency       nfbulk  = ', nfbulk, ' = nfice if ice model used'
-         IF(lwp) WRITE(numout,*) '           flag closed sea or not           nclosea = ', nclosea
-      ENDIF
-
       ! Default values
       n_cla = 0
Index: trunk/NEMO/OPA_SRC/DOM/domvvl.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DOM/domvvl.F90	(revision 888)
@@ -18,10 +18,10 @@
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE dynspg_oce      ! surface pressure gradient variables
+   USE phycst          ! physical constants
    USE in_out_manager  ! I/O manager
    USE lib_mpp         ! distributed memory computing library
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE dynspg_oce      ! surface pressure gradient variables
-   USE ocesbc          ! ocean surface boundary condition
-   USE phycst          ! physical constants
 
    IMPLICIT NONE
@@ -47,5 +47,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/DTA/dtasss.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DTA/dtasss.F90	(revision 873)
+++ 	(revision )
@@ -1,128 +1,0 @@
-MODULE dtasss
-   !!======================================================================
-   !!                       ***  MODULE  dtasss  ***
-   !! Data : Sea Surface Salinity (SSS)
-   !!======================================================================
-   
-   !!----------------------------------------------------------------------
-   !!   dta_sss      : sss data
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE in_out_manager  ! I/O manager
-   USE ocfzpt          ! ???
-   USE daymod          ! calendar
-
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Shared routine
-   PUBLIC dta_sss
-
-   !! * Shared module variables
-#if defined key_dtasss
-   LOGICAL , PUBLIC, PARAMETER ::   lk_dtasss = .TRUE.   !: sss data flag
-#else
-   LOGICAL , PUBLIC, PARAMETER ::   lk_dtasss = .FALSE.  !: sss data flag
-#endif
-   INTEGER ::   numsss         !: logical unit for surface salinity data
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-      sss             !: surface salinity
-
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , IPSL-LODYC  (2005)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-#if defined key_dtasss
-   !!----------------------------------------------------------------------
-   !!   'key_dtasss'                                               SSS data
-   !!----------------------------------------------------------------------
-
-   SUBROUTINE dta_sss( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE dta_sss  ***
-      !!                    
-      !! ** Purpose :   Read surface salinity data 
-      !!
-      !! ** Method  : - Read a specific sss.
-      !!
-      !! ** Action  : - sss 
-      !!
-      !! History :
-      !!        !  90-03  (O. Marti and Ph Dandin)  Original code
-      !!        !  92-07  (M. Imbard)
-      !!        !  96-11  (E. Guilyardi)  Daily AGCM input files
-      !!        !  00-04  (M. Imbard)  NetCDF FORMAT
-      !!        !  00-10  (J.-P. Boulanger)  passage ORCA a TDH
-      !!        !  01-10  (A. Lazar)  Reynolds default
-      !!   8.5  !  02-06  (G. Madec)  F90: Free form and module
-      !!        !  02-11  (C. Levy)  MPP/MPI NetCDF read
-      !!        !  05-03  (M. Levy) adapt SST to SSS
-      !!----------------------------------------------------------------------
-      !! * Modules used
-      USE iom
-      
-      !! * Arguments
-      INTEGER ::   kt
-
-      !!----------------------------------------------------------------------
-
-      IF( kt == nit000 ) THEN
-
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'dta_sss : yearly mean sea surface salinity data'
-
-         CALL iom_open ( 'sss.nc', numsss ) 
-         CALL iom_get ( numsss, jpdom_data, 'sss', sss, 1 )
-         CALL iom_close ( numsss )
-
-         sss(:,:) = sss(:,:)*tmask(:,:,1)
-
-         IF( lwp ) THEN
-            WRITE(numout,*) ' '
-            WRITE(numout,*) ' read  sea surface salinity ok'
-            WRITE(numout,*) ' '
-            CALL prihre(sss(:,:),jpi,jpj,1,jpi,20,1,jpj,10,1.,numout)
-         ENDIF
-
-      ENDIF
-
-   END SUBROUTINE dta_sss
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option :                                        NO SSS data
-   !!----------------------------------------------------------------------
-
-   SUBROUTINE dta_sss( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE dta_sss  ***
-      !!                    
-      !! ** Purpose :   sea surface salinity data and update it
-      !!     at each time step.   ???
-      !!
-      !! ** Method  : - sss  
-      !!
-      !! History :
-      !!        !  91-03  ()  Original code
-      !!   8.5  !  02-06  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt      ! ocean timestep
-      !!---------------------------------------------------------------------
-      
-      IF( kt == nit000 ) THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'dta_sss : No SSS data'
-         IF(lwp) WRITE(numout,*) '~~~~~~~'
-      ENDIF
-
-      
-   END SUBROUTINE dta_sss
-#endif
-
-   !!======================================================================
-END MODULE dtasss
Index: trunk/NEMO/OPA_SRC/DTA/dtasst.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DTA/dtasst.F90	(revision 873)
+++ 	(revision )
@@ -1,196 +1,0 @@
-MODULE dtasst
-   !!======================================================================
-   !!                       ***  MODULE  dtasst  ***
-   !! Data : Sea Surface Temperature (SST)
-   
-   !!      BUG initialisation  nyearsst !!!!!!bug
-   
-   !!======================================================================
-   
-   !!----------------------------------------------------------------------
-   !!   dta_sst      : Reynolds sst data
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE in_out_manager  ! I/O manager
-   USE ocfzpt          ! ???
-   USE daymod          ! calendar
-
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Shared routine
-   PUBLIC dta_sst
-
-   !! * Shared module variables
-#if defined key_dtasst
-   LOGICAL , PUBLIC, PARAMETER ::   lk_dtasst = .TRUE.   !: sst data flag
-   INTEGER ::   &
-        numsst ,      &              !: logical unit for surface temperature data
-        ndaysst                      !: new day for Reynolds sst
-   CHARACTER (len=34) :: clname      !: filename for daily SST
-#else
-   LOGICAL , PUBLIC, PARAMETER ::   lk_dtasst = .FALSE.  !: sst data flag
-#endif
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-      sst             !: surface temperature
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,2) ::   &  !:
-      rclice          !: climatological ice index (0/1) (2 months)
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-#if defined key_dtasst
-   !!----------------------------------------------------------------------
-   !!   'key_dtasst'                                               SST data
-   !!----------------------------------------------------------------------
-
-   SUBROUTINE dta_sst( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE dta_sst  ***
-      !!                    
-      !! ** Purpose :   Read Reynolds weekly mean sea surface temperature 
-      !!      data and update it at each time step.
-      !!
-      !! ** Method  : - Read a specific REYNOLDS daily sst in Celcius.
-      !!              -  Compute a climatological ice cover rclice (0 or 1)
-      !!
-      !! ** Action  : - sst (Celcius)
-      !!              - rclice, ice/ocean mask (0 or 1)
-      !!
-      !! History :
-      !!        !  90-03  (O. Marti and Ph Dandin)  Original code
-      !!        !  92-07  (M. Imbard)
-      !!        !  96-11  (E. Guilyardi)  Daily AGCM input files
-      !!        !  00-04  (M. Imbard)  NetCDF FORMAT
-      !!        !  00-10  (J.-P. Boulanger)  passage ORCA a TDH
-      !!        !  01-10  (A. Lazar)  Reynolds default
-      !!   8.5  !  02-06  (G. Madec)  F90: Free form and module
-      !!        !  02-11  (C. Levy)  MPP/MPI NetCDF read
-      !!----------------------------------------------------------------------
-      !! * Modules used
-      USE iom
-      
-      !! * Arguments
-      INTEGER ::   kt
-
-      !! * Local save
-
-      !! * Local declarations
-      INTEGER ::   ji, jj
-      !!----------------------------------------------------------------------
-
-      ! -------------------- !
-      ! First call kt=nit000 !
-      ! -------------------- !
-
-      IF( kt == nit000 ) THEN
-
-         ndaysst = 0   ! initializations
-         IF(lwp) WRITE(numout,*) 'dta_sst : DAILY sea surface temperature data'
-         CALL iom_open ( 'sst_1d.nc', numsst ) 
-
-      ENDIF
-
-      ! ----------------- !
-      ! Read daily file   !
-      ! ----------------- !
-
-      ! Read daily SST 
-
-      IF( ndaysst /= nday ) THEN 
-         ndaysst = nday
-
-         CALL iom_get ( numsst, jpdom_data, 'sst', sst, nday_year )
-
-         IF ( kt == nit000 .AND. lwp ) THEN
-            WRITE(numout,*) ' '
-            WRITE(numout,*) ' read daily sea surface temperature ok'
-            WRITE(numout,*) ' '
-            WRITE(numout,*) ' Surface temp day: ', ndastp
-            CALL prihre(sst(:,:),jpi,jpj,1,jpi,20,1,jpj,10,1.,numout)
-         ENDIF
-         
-      ENDIF
-      
-      ! 2. At every time step compute temperature data
-      ! ----------------------------------------------
-      
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            ztgel = fzptn(ji,jj)
-            rclice(ji,jj,1) = tmask(ji,jj,1)
-            IF( sst(ji,jj) >= ztgel )   rclice(ji,jj,1) = 0.e0
-            rclice(ji,jj,2) = rclice(ji,jj,1)
-         END DO
-      END DO
-      IF( kt == nit000 .AND. lwp ) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'Computed Ice cover rclice'
-         WRITE(numout,*)
-         WRITE(numout,*) 'Ice cover : '
-         CALL prihre( rclice(:,:,1), jpi, jpj, 1, jpi, 20, 1, jpj, 10, 1., numout )
-      ENDIF
-      
-      ! Close the file
-      ! --------------
-      
-      IF( kt == nitend )   CALL iom_close (numsst)
-      
-
-   END SUBROUTINE dta_sst
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option :                                        NO SST data
-   !!----------------------------------------------------------------------
-
-   SUBROUTINE dta_sst( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE dta_sst  ***
-      !!                    
-      !! ** Purpose :   sea surface temperature data and update it
-      !!     at each time step.   ???
-      !!
-      !! ** Method  : - sst   = tn
-      !!              - rclice = 1. IF tn =< ztgel
-      !!
-      !! History :
-      !!        !  91-03  ()  Original code
-      !!   8.5  !  02-06  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt      ! ocean timestep
-      
-      !! * Local declarations
-      INTEGER :: ji, jj
-      !!---------------------------------------------------------------------
-      
-      IF( kt == nit000 ) THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'dta_sst : No SST data'
-         IF(lwp) WRITE(numout,*) '~~~~~~~'
-      ENDIF
-      
-      ! 1. Update at each time step
-      ! ---------------------------
-
-      sst   (:,:)   = tn   (:,:,1)
-      rclice(:,:,1) = tmask(:,:,1)
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            IF( tn(ji,jj,1) >= fzptn(ji,jj) ) rclice(ji,jj,1) = 0.e0
-         END DO
-      END DO
-      rclice(:,:,2) = rclice(:,:,1)
-      
-   END SUBROUTINE dta_sst
-#endif
-
-   !!======================================================================
-END MODULE dtasst
Index: trunk/NEMO/OPA_SRC/DYN/dynspg_exp.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DYN/dynspg_exp.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DYN/dynspg_exp.F90	(revision 888)
@@ -16,10 +16,10 @@
    USE oce             ! ocean dynamics and tracers 
    USE dom_oce         ! ocean space and time domain 
-   USE in_out_manager  ! I/O manager
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE obc_oce         ! Lateral open boundary condition
    USE phycst          ! physical constants
-   USE ocesbc          ! ocean surface boundary condition
-   USE obc_oce         ! Lateral open boundary condition
    USE obc_par         ! open boundary condition parameters
    USE obcdta          ! open boundary condition data     (obc_dta_bt routine)
+   USE in_out_manager  ! I/O manager
    USE lib_mpp         ! distributed memory computing library
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
@@ -40,5 +40,5 @@
    !!----------------------------------------------------------------------
    !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/DYN/dynspg_exp.F90,v 1.9 2007/06/05 10:38:27 opalod Exp $ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/DYN/dynspg_flt.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 888)
@@ -25,25 +25,24 @@
    USE dom_oce         ! ocean space and time domain 
    USE zdf_oce         ! ocean vertical physics
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE obc_oce         ! Lateral open boundary condition
+   USE sol_oce         ! ocean elliptic solver
    USE phycst          ! physical constants
-   USE ocesbc          ! ocean surface boundary condition
-   USE flxrnf          ! ocean runoffs
-   USE sol_oce         ! ocean elliptic solver
+   USE domvvl          ! variable volume
    USE solver          ! solver initialization
    USE solpcg          ! preconditionned conjugate gradient solver
    USE solsor          ! Successive Over-relaxation solver
    USE solfet          ! FETI solver
-   USE obc_oce         ! Lateral open boundary condition
    USE obcdyn          ! ocean open boundary condition (obc_dyn routines)
    USE obcvol          ! ocean open boundary condition (obc_vol routines)
+   USE cla_dynspg      ! cross land advection
+   USE in_out_manager  ! I/O manager
    USE lib_mpp         ! distributed memory computing library
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE cla_dynspg      ! cross land advection
    USE prtctl          ! Print control
    USE solmat          ! matrix construction for elliptic solvers
    USE agrif_opa_interp
-   USE in_out_manager  ! I/O manager
    USE iom
    USE restart         ! only for lrst_oce
-   USE domvvl          ! variable volume
 
    IMPLICIT NONE
@@ -58,5 +57,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/DYN/dynspg_flt.F90,v 1.14 2007/06/05 10:38:27 opalod Exp $ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/DYN/dynspg_ts.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 888)
@@ -21,6 +21,8 @@
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE dynspg_oce      ! surface pressure gradient variables
    USE phycst          ! physical constants
-   USE ocesbc          ! ocean surface boundary condition
+   USE domvvl          ! variable volume
    USE obcdta          ! open boundary condition data     
    USE obcfla          ! Flather open boundary condition  
@@ -31,9 +33,7 @@
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE prtctl          ! Print control
-   USE dynspg_oce      ! surface pressure gradient variables
    USE in_out_manager  ! I/O manager
    USE iom
    USE restart         ! only for lrst_oce
-   USE domvvl          ! variable volume
 
    IMPLICIT NONE
@@ -52,5 +52,5 @@
    !!----------------------------------------------------------------------
    !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/DYN/dynspg_ts.F90,v 1.16 2007/06/05 10:38:27 opalod Exp $ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/DYN/dynzad.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DYN/dynzad.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DYN/dynzad.F90	(revision 888)
@@ -16,8 +16,8 @@
    USE oce            ! ocean dynamics and tracers
    USE dom_oce        ! ocean space and time domain
+   USE sbc_oce        ! surface boundary condition: ocean
+   USE trdmod_oce     ! ocean variables trends
+   USE trdmod         ! ocean dynamics trends 
    USE in_out_manager ! I/O manager
-   USE trdmod         ! ocean dynamics trends 
-   USE trdmod_oce     ! ocean variables trends
-   USE flxrnf         ! ocean runoffs
    USE prtctl         ! Print control
 
@@ -32,5 +32,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/DYN/dynzdf_exp.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DYN/dynzdf_exp.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DYN/dynzdf_exp.F90	(revision 888)
@@ -18,6 +18,6 @@
    USE phycst          ! physical constants
    USE zdf_oce         ! ocean vertical physics
+   USE sbc_oce         ! surface boundary condition: ocean
    USE in_out_manager  ! I/O manager
-   USE taumod          ! surface ocean stress
 
    IMPLICIT NONE
@@ -32,5 +32,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -81,6 +81,6 @@
          ! Surface boundary condition
          DO ji = 2, jpim1
-            zwy(ji,1) = taux(ji,jj) * zrau0r
-            zww(ji,1) = tauy(ji,jj) * zrau0r
+            zwy(ji,1) = utau(ji,jj) * zrau0r
+            zww(ji,1) = vtau(ji,jj) * zrau0r
          END DO  
 
Index: trunk/NEMO/OPA_SRC/DYN/dynzdf_imp.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DYN/dynzdf_imp.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DYN/dynzdf_imp.F90	(revision 888)
@@ -14,5 +14,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -20,8 +20,8 @@
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE zdf_oce         ! ocean vertical physics
    USE phycst          ! physical constants
-   USE zdf_oce         ! ocean vertical physics
    USE in_out_manager  ! I/O manager
-   USE taumod          ! surface ocean stress
 
    IMPLICIT NONE
@@ -36,5 +36,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
@@ -141,8 +141,8 @@
 !!! change les resultats (derniers digit, pas significativement + rapide 1* de moins)
 !!!         ua(ji,jj,1) = ub(ji,jj,1)  &
-!!!                      + p2dt * ( ua(ji,jj,1) + taux(ji,jj) / ( fse3u(ji,jj,1)*rau0 ) )
+!!!                      + p2dt * ( ua(ji,jj,1) + utau(ji,jj) / ( fse3u(ji,jj,1)*rau0 ) )
             z2dtf = p2dt / ( fse3u(ji,jj,1)*rau0 )
             ua(ji,jj,1) = ub(ji,jj,1)  &
-                         + p2dt *  ua(ji,jj,1) + z2dtf * taux(ji,jj)
+                         + p2dt *  ua(ji,jj,1) + z2dtf * utau(ji,jj)
          END DO
       END DO
@@ -236,8 +236,8 @@
 !!! change les resultats (derniers digit, pas significativement + rapide 1* de moins)
 !!!         va(ji,jj,1) = vb(ji,jj,1)  &
-!!!                      + p2dt * ( va(ji,jj,1) + tauy(ji,jj) / ( fse3v(ji,jj,1)*rau0 ) )
+!!!                      + p2dt * ( va(ji,jj,1) + vtau(ji,jj) / ( fse3v(ji,jj,1)*rau0 ) )
             z2dtf = p2dt / ( fse3v(ji,jj,1)*rau0 )
             va(ji,jj,1) = vb(ji,jj,1)  &
-                         + p2dt * va(ji,jj,1) + z2dtf * tauy(ji,jj)
+                         + p2dt * va(ji,jj,1) + z2dtf * vtau(ji,jj)
          END DO
       END DO
Index: trunk/NEMO/OPA_SRC/DYN/wzvmod.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DYN/wzvmod.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/DYN/wzvmod.F90	(revision 888)
@@ -13,10 +13,9 @@
    USE oce             ! ocean dynamics and tracers variables
    USE dom_oce         ! ocean space and time domain variables 
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE domvvl          ! Variable volume
    USE in_out_manager  ! I/O manager
    USE prtctl          ! Print control
-
-   USE domvvl          ! Variable volume
    USE phycst
-   USE ocesbc          ! ocean surface boundary condition
    USE lbclnk          ! ocean lateral boundary condition (or mpp link)
 
@@ -31,5 +30,5 @@
    !!----------------------------------------------------------------------
    !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/LDF/ldfeiv.F90
===================================================================
--- trunk/NEMO/OPA_SRC/LDF/ldfeiv.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/LDF/ldfeiv.F90	(revision 888)
@@ -14,8 +14,9 @@
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE sbcrnf          ! river runoffs
    USE ldftra_oce      ! ocean tracer   lateral physics
    USE phycst          ! physical constants
    USE ldfslp          ! iso-neutral slopes
-   USE flxrnf          ! 
    USE in_out_manager  ! I/O manager
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
@@ -29,5 +30,5 @@
    !!----------------------------------------------------------------------
    !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
@@ -188,5 +189,5 @@
             DO ji = 1, jpi
                zaht      = ( 1. -  MIN( 1., ABS( ff(ji,jj) / zf20 ) ) ) * ( aht0 - zaht_min )  &
-                  &      + aht0 * upsrnfh(ji,jj)                          ! enhanced near river mouths
+                  &      + aht0 * rnfmsk(ji,jj)                          ! enhanced near river mouths
                ahtu(ji,jj) = MAX( MAX( zaht_min, aeiu(ji,jj) ) + zaht, aht0 )
                ahtv(ji,jj) = MAX( MAX( zaht_min, aeiv(ji,jj) ) + zaht, aht0 )
Index: trunk/NEMO/OPA_SRC/OBC/obcvol.F90
===================================================================
--- trunk/NEMO/OPA_SRC/OBC/obcvol.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/OBC/obcvol.F90	(revision 888)
@@ -12,9 +12,9 @@
    USE oce             ! ocean dynamics and tracers 
    USE dom_oce         ! ocean space and time domain 
+   USE sbc_oce         ! surface boundary condition: ocean
    USE phycst          ! physical constants
    USE obc_oce         ! ocean open boundary conditions
    USE lib_mpp         ! for mppsum
    USE in_out_manager  ! I/O manager
-   USE ocesbc          ! ocean surface boundary conditions
 
    IMPLICIT NONE
@@ -29,5 +29,5 @@
    !!---------------------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!---------------------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/SBC/albedo.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/albedo.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/SBC/albedo.F90	(revision 888)
@@ -4,37 +4,35 @@
    !! Ocean forcing:  bulk thermohaline forcing of the ocean (or ice)
    !!=====================================================================
-   !!----------------------------------------------------------------------
-   !!   flx_blk_albedo : albedo for ocean and ice (clear and overcast skies)
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE cpl_oce         ! ???
+   !! History :  8.0  !  01-04  (LIM 1.0)
+   !!            8.5  !  03-07  (C. Ethe, G. Madec)  Optimization (old name:shine)
+   !!            9.0  !  04-11  (C. Talandier)  add albedo_init
+   !!             -   !  01-06  (M. Vancoppenolle) LIM 3.0
+   !!             -   !  06-08  (G. Madec)  cleaning for surface module
+   !!----------------------------------------------------------------------
+   !!   albedo_ice  : albedo for   ice (clear and overcast skies)
+   !!   albedo_oce  : albedo for ocean (clear and overcast skies)
+   !!   albedo_init : initialisation of albedo computation
+   !!----------------------------------------------------------------------
    USE phycst          ! physical constants
-   USE daymod
-   USE blk_oce         ! bulk variables
-   USE flx_oce         ! forcings variables
-   USE ocfzpt          ! ???
-   USE in_out_manager
-   USE lbclnk
+   USE in_out_manager  ! I/O manager
 
    IMPLICIT NONE
    PRIVATE
 
-   !! * Accessibility
-   PUBLIC flx_blk_albedo ! routine called by limflx.F90 in coupled
-                         ! and in flxblk.F90 in forced
-   !! * Module variables
-   INTEGER  ::             &  !: nameos : ocean physical parameters
-      albd_init = 0           !: control flag for initialization
-
-   REAL(wp)  ::            &  ! constant values
-      zzero   = 0.e0    ,  &
-      zone    = 1.0
-
-   !! * constants for albedo computation (flx_blk_albedo)
+   PUBLIC albedo_ice   ! routine called sbcice_lim.F90
+   PUBLIC albedo_oce   ! routine called by ???
+
+   INTEGER  ::   albd_init = 0      !: control flag for initialization
+   REAL(wp) ::   zzero     = 0.e0   ! constant values
+   REAL(wp) ::   zone      = 1.e0   !    "       "
+
+   REAL(wp) ::   c1     = 0.05    ! constants values
+   REAL(wp) ::   c2     = 0.10    !    "        "
+   REAL(wp) ::   rmue   = 0.40    !  cosine of local solar altitude
+
+   !!* namelist namalb
    REAL(wp) ::   &
-      c1     = 0.05  ,     &   ! constants values
-      c2     = 0.10  ,     &
+      cgren  = 0.06  ,     &   !  correction of the snow or ice albedo to take into account
+      !                        !  effects of cloudiness (Grenfell & Perovich, 1984)
 #if defined key_lim3
       albice = 0.53  ,     &   !  albedo of melting ice in the arctic and antarctic (Shine & Hendersson-Sellers)
@@ -42,143 +40,81 @@
       albice = 0.50  ,     &   !  albedo of melting ice in the arctic and antarctic (Shine & Hendersson-Sellers)
 #endif
-      cgren  = 0.06  ,     &   !  correction of the snow or ice albedo to take into account
-                               !  effects of cloudiness (Grenfell & Perovich, 1984)
       alphd  = 0.80  ,     &   !  coefficients for linear interpolation used to compute
       alphdi = 0.72  ,     &   !  albedo between two extremes values (Pyane, 1972)
-      alphc  = 0.65  ,     &
-      zmue   = 0.40            !  cosine of local solar altitude
-
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+      alphc  = 0.65 
+
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $Id$
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
 CONTAINS
 
-#if defined key_lim3 || defined key_lim2
-   !!----------------------------------------------------------------------
-   !!   'key_lim3' OR 'key_lim2'               LIM 2.0 or LIM 3.0 ice model
-   !!----------------------------------------------------------------------
-
-   SUBROUTINE flx_blk_albedo( palb , palcn , palbp , palcnp )
-      !!----------------------------------------------------------------------
-      !!               ***  ROUTINE flx_blk_albedo  ***
+   SUBROUTINE albedo_ice( pt_ice, ph_ice, ph_snw, pa_ice_cs, pa_ice_os )
+      !!----------------------------------------------------------------------
+      !!               ***  ROUTINE albedo_ice  ***
       !!          
       !! ** Purpose :   Computation of the albedo of the snow/ice system 
-      !!      as well as the ocean one
+      !!                as well as the ocean one
       !!       
       !! ** Method  : - Computation of the albedo of snow or ice (choose the 
-      !!      rignt one by a large number of tests
+      !!                rignt one by a large number of tests
       !!              - Computation of the albedo of the ocean
       !!
-      !! References :
-      !!      Shine and Hendersson-Sellers 1985, JGR, 90(D1), 2243-2250.
-      !!
-      !! History :
-      !!  8.0   !  01-04  (LIM 1.0)
-      !!  8.5   !  03-07  (C. Ethe, G. Madec)  Optimization (old name:shine)
-      !!  9.0   !  01-06  (M. Vancoppenolle) LIM 3.0
-      !!----------------------------------------------------------------------
-      !! * Modules used
-#if defined key_lim3
-      USE par_ice
-      USE ice                   ! ???
-#elif defined key_lim2
-      USE ice_2                 ! ???
-#endif
-
-      !! * Arguments
-#if defined key_lim3
-      REAL(wp), DIMENSION(jpi,jpj,jpl), INTENT(out) ::  &
-#elif defined key_lim2
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(out) ::  &
-#endif
-         palb         ,     &    !  albedo of ice under overcast sky
-         palbp                   !  albedo of ice under clear sky 
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(out) ::  &
-         palcn        ,     &    !  albedo of ocean under overcast sky
-         palcnp                  !  albedo of ocean under clear sky
-
-      !! * Local variables
-      INTEGER ::    &
-         ji, jj, jl               ! dummy loop indices
-      REAL(wp) ::   & 
-         zmue14         ,     &   !  zmue**1.4
-         zalbpsnm       ,     &   !  albedo of ice under clear sky when snow is melting
-         zalbpsnf       ,     &   !  albedo of ice under clear sky when snow is freezing
-         zalbpsn        ,     &   !  albedo of snow/ice system when ice is coverd by snow
-         zalbpic        ,     &   !  albedo of snow/ice system when ice is free of snow
-         zithsn         ,     &   !  = 1 for hsn >= 0 ( ice is cov. by snow ) ; = 0 otherwise (ice is free of snow)
-         zitmlsn        ,     &   !  = 1 freezinz snow (t_su >=rt0_snow) ; = 0 melting snow (t_su<rt0_snow)
-         zihsc1         ,     &   !  = 1 hsn <= c1 ; = 0 hsn > c1
-         zihsc2                   !  = 1 hsn >= c2 ; = 0 hsn < c2
-#if defined key_lim3
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::  &
-#elif defined key_lim2
-      REAL(wp), DIMENSION(jpi,jpj) ::  &
-#endif
-         zalbfz         ,     &   !  ( = alphdi for freezing ice ; = albice for melting ice )
-         zficeth                  !  function of ice thickness
-#if defined key_lim3
-      LOGICAL , DIMENSION(jpi,jpj,jpl) ::  &
-#elif defined key_lim2
-      LOGICAL , DIMENSION(jpi,jpj) ::  &
-#endif
-         llmask
+      !! References :   Shine and Hendersson-Sellers 1985, JGR, 90(D1), 2243-2250.
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:) ::   pt_ice      !  ice surface temperature
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:) ::   ph_ice      !  sea-ice thickness
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:) ::   ph_snw      !  snow thickness
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:) ::   pa_ice_cs   !  albedo of ice under clear    sky
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:) ::   pa_ice_os   !  albedo of ice under overcast sky
+      !!
+      INTEGER  ::   ji, jj, jl    ! dummy loop indices
+      INTEGER  ::   ijpl          ! number of ice categories (3rd dim of ice input arrays)
+      REAL(wp) ::   zalbpsnm      ! albedo of ice under clear sky when snow is melting
+      REAL(wp) ::   zalbpsnf      ! albedo of ice under clear sky when snow is freezing
+      REAL(wp) ::   zalbpsn       ! albedo of snow/ice system when ice is coverd by snow
+      REAL(wp) ::   zalbpic       ! albedo of snow/ice system when ice is free of snow
+      REAL(wp) ::   zithsn        ! = 1 for hsn >= 0 ( ice is cov. by snow ) ; = 0 otherwise (ice is free of snow)
+      REAL(wp) ::   zitmlsn       ! = 1 freezinz snow (pt_ice >=rt0_snow) ; = 0 melting snow (pt_ice<rt0_snow)
+      REAL(wp) ::   zihsc1        ! = 1 hsn <= c1 ; = 0 hsn > c1
+      REAL(wp) ::   zihsc2        ! = 1 hsn >= c2 ; = 0 hsn < c2
+      !!
+      LOGICAL , DIMENSION(jpi,jpj,SIZE(pt_ice,3)) ::   llmask
+      REAL(wp), DIMENSION(jpi,jpj,SIZE(pt_ice,3)) ::   zalbfz    ! = alphdi for freezing ice ; = albice for melting ice
+      REAL(wp), DIMENSION(jpi,jpj,SIZE(pt_ice,3)) ::   zficeth   !  function of ice thickness
       !!---------------------------------------------------------------------
       
-      ! initialization 
-      IF( albd_init == 0 )   CALL albedo_init
-
-      !-------------------------                                                             
+      ijpl = SIZE( pt_ice, 3 )                     ! number of ice categories
+
+      IF( albd_init == 0 )   CALL albedo_init      ! initialization 
+
+      !---------------------------
       !  Computation of  zficeth
-      !-------------------------- 
-#if defined key_lim3
-      llmask = (ht_s(:,:,:) == 0.e0) .AND. ( t_su(:,:,:) >= rt0_ice )
-#elif defined key_lim2      
-      llmask = (hsnif == 0.e0) .AND. ( sist >= rt0_ice )
-#endif
-      WHERE ( llmask )   !  ice free of snow and melts
-         zalbfz = albice
-      ELSEWHERE                   
-         zalbfz = alphdi
+      !---------------------------
+      llmask = ( ph_snw == 0.e0 ) .AND. ( pt_ice >= rt0_ice )
+      ! ice free of snow and melts
+      WHERE( llmask )   ;   zalbfz = albice
+      ELSEWHERE         ;   zalbfz = alphdi
       END WHERE
-      
-#if defined key_lim3
-      DO jl = 1, jpl
+
+      DO jl = 1, ijpl
          DO jj = 1, jpj
             DO ji = 1, jpi
-               IF( ht_i(ji,jj,jl) > 1.5 ) THEN
+               IF( ph_ice(ji,jj,jl) > 1.5 ) THEN
                   zficeth(ji,jj,jl) = zalbfz(ji,jj,jl)
-               ELSEIF( ht_i(ji,jj,jl) > 1.0  .AND. ht_i(ji,jj,jl) <= 1.5 ) THEN
-                  zficeth(ji,jj,jl) = 0.472 + 2.0 * ( zalbfz(ji,jj,jl) - 0.472 ) * ( ht_i(ji,jj,jl) - 1.0 )
-               ELSEIF( ht_i(ji,jj,jl) > 0.05 .AND. ht_i(ji,jj,jl) <= 1.0 ) THEN
-                  zficeth(ji,jj,jl) = 0.2467 + 0.7049 * ht_i(ji,jj,jl)                               &
-                     &                    - 0.8608 * ht_i(ji,jj,jl) * ht_i(ji,jj,jl)                 &
-                     &                    + 0.3812 * ht_i(ji,jj,jl) * ht_i(ji,jj,jl) * ht_i (ji,jj,jl)
+               ELSEIF( ph_ice(ji,jj,jl) > 1.0  .AND. ph_ice(ji,jj,jl) <= 1.5 ) THEN
+                  zficeth(ji,jj,jl) = 0.472 + 2.0 * ( zalbfz(ji,jj,jl) - 0.472 ) * ( ph_ice(ji,jj,jl) - 1.0 )
+               ELSEIF( ph_ice(ji,jj,jl) > 0.05 .AND. ph_ice(ji,jj,jl) <= 1.0 ) THEN
+                  zficeth(ji,jj,jl) = 0.2467 + 0.7049 * ph_ice(ji,jj,jl)                               &
+                     &                    - 0.8608 * ph_ice(ji,jj,jl) * ph_ice(ji,jj,jl)                 &
+                     &                    + 0.3812 * ph_ice(ji,jj,jl) * ph_ice(ji,jj,jl) * ph_ice (ji,jj,jl)
                ELSE
-                  zficeth(ji,jj,jl) = 0.1 + 3.6 * ht_i(ji,jj,jl) 
+                  zficeth(ji,jj,jl) = 0.1 + 3.6 * ph_ice(ji,jj,jl) 
                ENDIF
             END DO
          END DO
       END DO
-#elif defined key_lim2      
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            IF( hicif(ji,jj) > 1.5 ) THEN
-               zficeth(ji,jj) = zalbfz(ji,jj)
-            ELSEIF( hicif(ji,jj) > 1.0  .AND. hicif(ji,jj) <= 1.5 ) THEN
-               zficeth(ji,jj) = 0.472 + 2.0 * ( zalbfz(ji,jj) - 0.472 ) * ( hicif(ji,jj) - 1.0 )
-            ELSEIF( hicif(ji,jj) > 0.05 .AND. hicif(ji,jj) <= 1.0 ) THEN
-               zficeth(ji,jj) = 0.2467 + 0.7049 * hicif(ji,jj)                                &
-                  &                    - 0.8608 * hicif(ji,jj) * hicif(ji,jj)                 &
-                  &                    + 0.3812 * hicif(ji,jj) * hicif(ji,jj) * hicif (ji,jj)
-            ELSE
-               zficeth(ji,jj) = 0.1 + 3.6 * hicif(ji,jj) 
-            ENDIF
-         END DO
-      END DO
-#endif
       
       !----------------------------------------------- 
@@ -188,30 +124,27 @@
       !    Albedo of snow-ice for clear sky.
       !-----------------------------------------------    
-#if defined key_lim3
-      DO jl = 1, jpl
+      DO jl = 1, ijpl
          DO jj = 1, jpj
             DO ji = 1, jpi
                !  Case of ice covered by snow.             
-            
-               !  freezing snow        
-               zihsc1       = 1.0 - MAX ( zzero , SIGN ( zone , - ( ht_s(ji,jj,jl) - c1 ) ) )
-               zalbpsnf     = ( 1.0 - zihsc1 ) * ( zficeth(ji,jj,jl) + ht_s(ji,jj,jl) * ( alphd - zficeth(ji,jj,jl) ) / c1 ) &
-                  &                 + zihsc1   * alphd  
-
-               !  melting snow                
-               zihsc2       = MAX ( zzero , SIGN ( zone , ht_s(ji,jj,jl) - c2 ) )
-               zalbpsnm     = ( 1.0 - zihsc2 ) * ( albice + ht_s(ji,jj,jl) * ( alphc - albice ) / c2 )                 &
-                  &                 + zihsc2   * alphc 
-
-
-               zitmlsn      =  MAX ( zzero , SIGN ( zone , t_su(ji,jj,jl) - rt0_snow ) )   
-               zalbpsn      =  zitmlsn * zalbpsnm + ( 1.0 - zitmlsn ) * zalbpsnf
+               !                                        !  freezing snow        
+               zihsc1   = 1.0 - MAX( zzero , SIGN( zone , - ( ph_snw(ji,jj,jl) - c1 ) ) )
+               zalbpsnf = ( 1.0 - zihsc1 ) * (  zficeth(ji,jj,jl)                                        &
+                  &                           + ph_snw(ji,jj,jl) * ( alphd - zficeth(ji,jj,jl) ) / c1  )   &
+                  &     +         zihsc1   * alphd  
+               !                                        !  melting snow                
+               zihsc2   = MAX( zzero , SIGN( zone , ph_snw(ji,jj,jl) - c2 ) )
+               zalbpsnm = ( 1.0 - zihsc2 ) * ( albice + ph_snw(ji,jj,jl) * ( alphc - albice ) / c2 )       &
+                  &     +         zihsc2   * alphc 
+               !
+               zitmlsn  =  MAX( zzero , SIGN( zone , pt_ice(ji,jj,jl) - rt0_snow ) )   
+               zalbpsn  =  zitmlsn * zalbpsnm + ( 1.0 - zitmlsn ) * zalbpsnf
             
                !  Case of ice free of snow.
-               zalbpic      = zficeth(ji,jj,jl) 
+               zalbpic  = zficeth(ji,jj,jl) 
             
                ! albedo of the system   
-               zithsn       = 1.0 - MAX ( zzero , SIGN ( zone , - ht_s(ji,jj,jl) ) )
-               palbp(ji,jj,jl) =  zithsn * zalbpsn + ( 1.0 - zithsn ) *  zalbpic
+               zithsn   = 1.0 - MAX( zzero , SIGN( zone , - ph_snw(ji,jj,jl) ) )
+               pa_ice_cs(ji,jj,jl) =  zithsn * zalbpsn + ( 1.0 - zithsn ) *  zalbpic
             END DO
          END DO
@@ -220,99 +153,29 @@
       !    Albedo of snow-ice for overcast sky.
       !----------------------------------------------  
-      palb(:,:,:)   = palbp(:,:,:) + cgren       ! Oberhuber correction
-
-#elif defined key_lim2      
-
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            !  Case of ice covered by snow.             
-            
-            !  melting snow        
-            zihsc1       = 1.0 - MAX ( zzero , SIGN ( zone , - ( hsnif(ji,jj) - c1 ) ) )
-            zalbpsnm     = ( 1.0 - zihsc1 ) * ( zficeth(ji,jj) + hsnif(ji,jj) * ( alphd - zficeth(ji,jj) ) / c1 ) &
-               &                 + zihsc1   * alphd  
-            !  freezing snow                
-            zihsc2       = MAX ( zzero , SIGN ( zone , hsnif(ji,jj) - c2 ) )
-            zalbpsnf     = ( 1.0 - zihsc2 ) * ( albice + hsnif(ji,jj) * ( alphc - albice ) / c2 )                 &
-               &                 + zihsc2   * alphc 
-            
-            zitmlsn      =  MAX ( zzero , SIGN ( zone , sist(ji,jj) - rt0_snow ) )   
-            zalbpsn      =  zitmlsn * zalbpsnf + ( 1.0 - zitmlsn ) * zalbpsnm 
-            
-            !  Case of ice free of snow.
-            zalbpic      = zficeth(ji,jj) 
-            
-            ! albedo of the system   
-            zithsn       = 1.0 - MAX ( zzero , SIGN ( zone , - hsnif(ji,jj) ) )
-            palbp(ji,jj) =  zithsn * zalbpsn + ( 1.0 - zithsn ) *  zalbpic
-         END DO
-      END DO
-      
-      !    Albedo of snow-ice for overcast sky.
-      !----------------------------------------------  
-      palb(:,:)   = palbp(:,:) + cgren                                           
-#endif
-      
-      !--------------------------------------------
-      !    Computation of the albedo of the ocean 
-      !-------------------------- -----------------                                                          
-      
-      !  Parameterization of Briegled and Ramanathan, 1982 
-      zmue14      = zmue**1.4                                       
-      palcnp(:,:) = 0.05 / ( 1.1 * zmue14 + 0.15 )                
-      
-      !  Parameterization of Kondratyev, 1969 and Payne, 1972
-      palcn(:,:)  = 0.06                                                 
-      
-   END SUBROUTINE flx_blk_albedo
-
-# else
-   !!----------------------------------------------------------------------
-   !!   Default option :                                   NO sea-ice model
-   !!----------------------------------------------------------------------
-
-   SUBROUTINE flx_blk_albedo( palb , palcn , palbp , palcnp )
-      !!----------------------------------------------------------------------
-      !!               ***  ROUTINE flx_blk_albedo  ***
+      pa_ice_os(:,:,:) = pa_ice_cs(:,:,:) + cgren       ! Oberhuber correction
+      !
+   END SUBROUTINE albedo_ice
+
+
+   SUBROUTINE albedo_oce( pa_oce_os , pa_oce_cs )
+      !!----------------------------------------------------------------------
+      !!               ***  ROUTINE albedo_oce  ***
       !! 
-      !! ** Purpose :   Computation of the albedo of the snow/ice system
-      !!      as well as the ocean one
-      !!
-      !! ** Method  :   Computation of the albedo of snow or ice (choose the
-      !!      wright one by a large number of tests Computation of the albedo
-      !!      of the ocean
-      !!
-      !! History :
-      !!  8.0   !  01-04  (LIM 1.0)
-      !!  8.5   !  03-07  (C. Ethe, G. Madec)  Optimization (old name:shine)
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(out) ::  &
-         palb         ,     &    !  albedo of ice under overcast sky
-         palcn        ,     &    !  albedo of ocean under overcast sky
-         palbp        ,     &    !  albedo of ice under clear sky
-         palcnp                  !  albedo of ocean under clear sky
-
-      REAL(wp) ::   &
-         zmue14                 !  zmue**1.4
-      !!----------------------------------------------------------------------
-
-      !--------------------------------------------
-      !    Computation of the albedo of the ocean
-      !-------------------------- -----------------
-
-      !  Parameterization of Briegled and Ramanathan, 1982
-      zmue14      = zmue**1.4
-      palcnp(:,:) = 0.05 / ( 1.1 * zmue14 + 0.15 )
-
-      !  Parameterization of Kondratyev, 1969 and Payne, 1972
-      palcn(:,:)  = 0.06
-
-      palb (:,:)  = palcn(:,:)
-      palbp(:,:)  = palcnp(:,:)
-
-   END SUBROUTINE flx_blk_albedo
-
-#endif
+      !! ** Purpose :   Computation of the albedo of the ocean
+      !!
+      !! ** Method  :   ....
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(out) ::   pa_oce_os   !  albedo of ocean under overcast sky
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(out) ::   pa_oce_cs   !  albedo of ocean under clear sky
+      !!
+      REAL(wp) ::   zcoef   ! temporary scalar
+      !!----------------------------------------------------------------------
+      !
+      zcoef = 0.05 / ( 1.1 * rmue**1.4 + 0.15 )      ! Parameterization of Briegled and Ramanathan, 1982 
+      pa_oce_cs(:,:) = zcoef               
+      pa_oce_os(:,:)  = 0.06                         ! Parameterization of Kondratyev, 1969 and Payne, 1972
+      !
+   END SUBROUTINE albedo_oce
+
 
    SUBROUTINE albedo_init
@@ -323,14 +186,6 @@
       !!
       !! ** Method  :   Read the namelist namalb
-      !!
-      !! ** Action  :  
-      !!
-      !!
-      !! History :
-      !!   9.0  !  04-11  (C. Talandier)  Original code
       !!----------------------------------------------------------------------
       NAMELIST/namalb/ cgren, albice, alphd, alphdi, alphc
-      !!----------------------------------------------------------------------
-      !!  OPA 9.0, LODYC-IPSL (2004)
       !!----------------------------------------------------------------------
 
@@ -342,20 +197,17 @@
       READ  ( numnam, namalb )
 
-      ! Control print
-      IF(lwp) THEN
+      IF(lwp) THEN               ! Control print
          WRITE(numout,*)
-         WRITE(numout,*) 'albedo_init : albedo '
+         WRITE(numout,*) 'albedo_init : set albedo parameters from namelist namalb'
          WRITE(numout,*) '~~~~~~~~~~~'
-         WRITE(numout,*) '          Namelist namalb : set albedo parameters'
-         WRITE(numout,*)
-         WRITE(numout,*) '             correction of the snow or ice albedo to take into account cgren = ', cgren
-         WRITE(numout,*) '             albedo of melting ice in the arctic and antarctic        albice = ', albice
-         WRITE(numout,*) '             coefficients for linear                                   alphd = ', alphd
-         WRITE(numout,*) '             interpolation used to compute albedo                     alphdi = ', alphdi
-         WRITE(numout,*) '             between two extremes values (Pyane, 1972)                 alphc = ', alphc
-         WRITE(numout,*)
+         WRITE(numout,*) '             correction for snow and ice albedo                    cgren  = ', cgren
+         WRITE(numout,*) '             albedo of melting ice in the arctic and antarctic     albice = ', albice
+         WRITE(numout,*) '             coefficients for linear                               alphd  = ', alphd
+         WRITE(numout,*) '             interpolation used to compute albedo                  alphdi = ', alphdi
+         WRITE(numout,*) '             between two extremes values (Pyane, 1972)             alphc  = ', alphc
       ENDIF
-
+      !
    END SUBROUTINE albedo_init
+
    !!======================================================================
 END MODULE albedo
Index: trunk/NEMO/OPA_SRC/SBC/blk_oce.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/blk_oce.F90	(revision 873)
+++ 	(revision )
@@ -1,48 +1,0 @@
-MODULE blk_oce
-   !!======================================================================
-   !!                 ***  MODULE  blk_oce  ***
-   !! Bulk   :  bulk parameter and  variables defined in memory 
-   !!======================================================================
-   !! History :
-   !!   8.5  !  02-11  (G. Madec)  F90: Free form and module
-   !!----------------------------------------------------------------------
-   !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_core
-   !!----------------------------------------------------------------------
-   !! ' key_flx_bulk_monthly or defined key_flx_bulk_daily             bulk
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE par_oce          ! ocean parameters
-
-   IMPLICIT NONE
-   
-   !!----------------------------------------------------------------------
-   !! bulk common variables
-   !!----------------------------------------------------------------------
-
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-      watm     ,      &  !: precipitation
-      tatm     ,      &  !: atmospheric temperature
-      hatm     ,      &  !: relative humidity
-      vatm     ,      &  !: wind speed
-      catm               !: percent of cloud cover
-
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj)    ::   &  !:
-      gsst               !: SST mean on nfbulk ocean time step
-
-   REAL(wp) ::        &
-      yearday  ,      &  !: number of days per year
-      rdtbs2             !: bulk time step divide by 2
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option                                         Empty module
-   !!----------------------------------------------------------------------
-#endif
-   
-   INTEGER ::         & !!: namdom : space/time domain (namlist)
-      nfbulk =  5        !: bulk computation frequency 
-   !!----------------------------------------------------------------------
-END MODULE blk_oce
Index: trunk/NEMO/OPA_SRC/SBC/bulk.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/bulk.F90	(revision 873)
+++ 	(revision )
@@ -1,124 +1,0 @@
-MODULE bulk
-   !!======================================================================
-   !!                           ***  bulk  ***
-   !!======================================================================
-#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily
-   !!----------------------------------------------------------------------
-   !!   'key_flx_bulk_monthly'                        monthly bulk formulea
-   !!   'key_flx_bulk_daily'                          daily bulk formulea
-   !!----------------------------------------------------------------------
-   !!   bulk          : computation of fluxes using bulk formulation
-   !!----------------------------------------------------------------------
-   !! * Modules used   
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE ice_oce         ! bulk variable  
-   USE ocfzpt          ! ocean freezing point
-   USE flxblk          ! bulk formulae
-   USE blk_oce         ! bulk variable 
-   USE flx_oce
-   USE taumod
-   USE phycst          ! physical constants
-   USE in_out_manager  ! I/O manager
-   USE prtctl          ! Print control
-
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Routine accessibility
-   PUBLIC blk        ! called by flx.F90   
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE blk( kt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE blk  ***
-      !!        
-      !! ** Purpose :   provide the heat fluxes on ice and ocean 
-      !!                using bulk formulation
-      !!
-      !! History :
-      !!   9.0  !  03-11  (C. Ethe and G. Madec)  F90: Free form and MODULE 
-      !!----------------------------------------------------------------------
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-
-      !! * Local declarations    
-      REAL(wp), DIMENSION(jpi,jpj) ::   zsst 
-# if ( ! defined key_lim3 && !defined key_lim2 )
-      INTEGER  ::   ji, jj         ! dummy loop indices  
-      REAL(wp) ::   ztgel, zicopa
-# endif
-      !!---------------------------------------------------------------------
-
-     ! Initialisation
-     IF( kt == nit000) THEN
-      ! computation of rdtbs2
-        IF( nacc == 1 ) THEN
-           rdtbs2 = nfbulk * rdtmin * 0.5
-        ELSE
-           rdtbs2 = nfbulk * rdt * 0.5
-        ENDIF
-        IF ( .NOT.ln_rstart ) THEN
-           gsst(:,:) =  ( nfbulk - 1 ) * ( tn(:,:,1) + rt0 )
-        ENDIF
-     ENDIF
-
-# if ( ! defined key_lim3 && ! defined key_lim2 )
-      ! opa model ice freeze()      
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            ztgel  = fzptn(ji,jj)
-            zicopa = tmask(ji,jj,1)
-            IF( tn(ji,jj,1) >= ztgel ) zicopa = 0.
-            freeze(ji,jj) = zicopa
-         END DO
-      END DO
-# endif
-
-      gsst(:,:) = gsst(:,:) + tn(:,:,1) + rt0  
-
-      !  Computation of the fluxes       
-      IF( MOD( kt - 1 , nfbulk ) == 0 ) THEN
-
-         zsst(:,:) = gsst(:,:) / REAL( nfbulk ) * tmask(:,:,1)
-
-         CALL flx_blk( zsst )    
-     
-         gsst(:,:) = 0.    
-
-# if ( ! defined key_lim3 && ! defined key_lim2 )
-         IF(ln_ctl) THEN         ! print mean trends (used for debugging)
-            CALL prt_ctl_info(' Forcings ')
-            CALL prt_ctl(tab2d_1=qsr_oce , clinfo1=' qsr_oce   : ', mask1=tmask, ovlap=1)
-            CALL prt_ctl(tab2d_1=qsr_ice , clinfo1=' qsr_ice   : ', mask1=tmask, ovlap=1)
-            CALL prt_ctl(tab2d_1=qnsr_oce, clinfo1=' qnsr_oce  : ', mask1=tmask, ovlap=1)
-            CALL prt_ctl(tab2d_1=qnsr_ice, clinfo1=' qnsr_ice  : ', mask1=tmask, ovlap=1)
-            CALL prt_ctl(tab2d_1=evap    , clinfo1=' evap      : ', mask1=tmask, ovlap=1)
-            CALL prt_ctl(tab2d_1=tprecip , clinfo1=' precip    : ', mask1=tmask, ovlap=1)
-            CALL prt_ctl(tab2d_1=sprecip , clinfo1=' Snow      : ', mask1=tmask, ovlap=1)
-            CALL prt_ctl(tab2d_1=taux    , clinfo1=' u-stress  : ', mask1=tmask, ovlap=1)
-            CALL prt_ctl(tab2d_1=tauy    , clinfo1=' v-stress  : ', mask1=tmask, ovlap=1)
-            CALL prt_ctl(tab2d_1=zsst    , clinfo1=' sst       : ', mask1=tmask, ovlap=1)
-         ENDIF
-# endif   
-      ENDIF
- 
-   END SUBROUTINE blk
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module :                                     NO bulk formulea
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE blk( kt )          ! Dummy routine
-      WRITE(*,*) 'blk: You should not see this print! error? ', kt
-   END SUBROUTINE blk
-#endif
- 
-   !!======================================================================
-END MODULE bulk
Index: trunk/NEMO/OPA_SRC/SBC/cpl_oasis3.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/cpl_oasis3.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/SBC/cpl_oasis3.F90	(revision 888)
@@ -45,4 +45,5 @@
    USE daymod                       ! date and time info
    USE dom_oce                      ! ocean space and time domain
+   USE sbc_ice                      ! surface boundary condition: ice
    USE in_out_manager               ! I/O manager
    USE par_oce                      !
@@ -50,7 +51,7 @@
 
    USE oce, only: tn, un, vn
-   USE ice, only: frld, hicif, hsnif
-   USE flx_oce, only : alb_ice ,  & ! albedo of ice
-                       tn_ice       ! ice surface temperature
+#if defined key_lim2
+   USE ice_2, only: frld, hicif, hsnif
+#endif
 
    IMPLICIT NONE
@@ -116,5 +117,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2006) 
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -309,4 +310,7 @@
 
 #if defined key_cpl_albedo
+# if defined key_lim3
+         Must be adapted for LIM3
+# endif
          tn_ice  = 271.285
 	 alb_ice =   0.75
Index: trunk/NEMO/OPA_SRC/SBC/cpl_oasis4.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/cpl_oasis4.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/SBC/cpl_oasis4.F90	(revision 888)
@@ -120,5 +120,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2006) 
-   !! $Header$ 
+   !! $ Id: $
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/SBC/fldread.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/fldread.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/fldread.F90	(revision 888)
@@ -0,0 +1,260 @@
+MODULE fldread
+   !!======================================================================
+   !!                       ***  MODULE  fldread  ***
+   !! Ocean forcing:  read input field for surface boundary condition
+   !!=====================================================================
+   !! History :  9.0  !  06-06  (G. Madec) Original code
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   fld_read      : read input fields used for the computation of the
+   !!                   surface boundary condition
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE phycst          ! ???
+   USE daymod          ! calendar
+   USE in_out_manager  ! I/O manager
+   USE iom             ! I/O manager library
+
+   IMPLICIT NONE
+   PRIVATE   
+
+   TYPE, PUBLIC ::   FLD_N      !: Namelist field informations
+      CHARACTER(len = 34) ::   clname      ! generic name of the NetCDF flux file
+      REAL(wp)            ::   freqh       ! frequency of each flux file
+      CHARACTER(len = 34) ::   clvar       ! generic name of the variable in the NetCDF flux file
+      LOGICAL             ::   ln_tint     ! time interpolation or not (T/F)
+      INTEGER             ::   nclim       ! =0 interannuel, =1 climatology
+      INTEGER             ::   nstrec      ! starting record, used if nclim=1 (=0 last record of previous year) 
+   END TYPE FLD_N
+
+   TYPE, PUBLIC ::   FLD        !: Input field related variables
+      CHARACTER(len = 256)            ::   clrootname   ! generic name of the NetCDF file
+      CHARACTER(len = 256)            ::   clname       ! current name of the NetCDF file
+      REAL(wp)                        ::   freqh        ! frequency of each flux file
+      CHARACTER(len = 34)             ::   clvar        ! generic name of the variable in the NetCDF flux file
+      LOGICAL                         ::   ln_tint      ! time interpolation or not (T/F)
+      INTEGER                         ::   nyear        ! year of the file (=0000 if climatology)
+      INTEGER                         ::   nclim        ! =0 interannuel, =1 climatology
+      INTEGER                         ::   nstrec       ! starting record if nclim=1 (=0 last record of previous year) 
+      INTEGER                         ::   num          ! logical units of the jpfld files to be read
+      REAL(wp) , DIMENSION(2)         ::   rec_b        ! before record info (1: index, 2: second since Jan. 1st 00h)
+      REAL(wp) , DIMENSION(2)         ::   rec_n        ! now    record info (1: index, 2: second since Jan. 1st 00h)
+      REAL(wp) , DIMENSION(2)         ::   rec_a        ! next   record info (1: index, 2: second since Jan. 1st 00h)
+      REAL(wp) , DIMENSION(2)         ::   rec          ! record time in second since jan. 1st for the 2 records read
+      REAL(wp) , DIMENSION(jpi,jpj)   ::   fnow         ! input fields interpolated to now time step
+      REAL(wp) , DIMENSION(jpi,jpj,2) ::   fdta         !  2 consecutive record of input fields
+   END TYPE FLD
+
+   PUBLIC   fld_read    ! called by sbc... modules
+
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE fld_read( kt, kn_fsbc, sd )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_read  ***
+      !!                   
+      !! ** Purpose :   provide at each time step the surface ocean fluxes
+      !!                (momentum, heat, freshwater and runoff) 
+      !!
+      !! ** Method  :   READ each input fields in NetCDF files using IOM
+      !!      and intepolate it to the model time-step.
+      !!         Several assumptions are made on the input file:
+      !!      blahblahblah....
+      !!----------------------------------------------------------------------
+      INTEGER  , INTENT(in   )               ::   kt        ! ocean time step
+      INTEGER  , INTENT(in   )               ::   kn_fsbc   ! ocean time step
+      TYPE(FLD), INTENT(inout), DIMENSION(:) ::   sd        ! input field related variables
+      !!
+      INTEGER  ::   jf                     ! dummy indices
+      INTEGER  ::   imf                    ! size of the structure sd
+      REAL(wp) ::   zt                     ! ratio at kt between the 2 records
+      REAL(wp), DIMENSION(2) ::   zrec_kt
+      !!---------------------------------------------------------------------
+
+      imf = SIZE( sd )       ! dummy indices
+
+      !                                         ! ===================== !
+      DO jf = 1, imf                            !    LOOP OVER FIELD    !
+         !                                      ! ===================== !
+         !
+         !                                            ! ====================== !
+         IF( kt == nit000 ) THEN                      !     Initialisation     !
+            !                                         ! ====================== !
+            !
+            !                                             ! set filename for current year 
+            SELECT CASE( sd(jf)%nclim )
+            CASE( 0 )   
+               WRITE(sd(jf)%clname, '(a,"_",i4,".nc")' ) TRIM( sd(jf)%clrootname ), nyear
+               sd(jf)%nyear = nyear
+            CASE( 1 )   
+               WRITE(sd(jf)%clname, '(a,  "_0000.nc")' ) TRIM( sd(jf)%clrootname )
+               sd(jf)%nyear = 0000
+            END SELECT
+            CALL iom_open( sd(jf)%clname, sd(jf)%num )    ! open input files
+            !
+            IF( sd(jf)%ln_tint ) THEN                     ! time interpolation: read previous record in now field
+               !
+               sd(jf)%rec_n = fld_rec( sd(jf)%freqh, sd(jf)%ln_tint, sd(jf)%nclim, -1 )     ! record index and time
+               !
+               !                                                                            ! read record
+               CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,2), INT( sd(jf)%rec_n(1) ) )
+               !
+               !                                                                            ! control print
+               IF(lwp) WRITE(numout,*)'fld_read : time-interpolation for ', TRIM( sd(jf)%clvar ),   &
+                  &   ' read previous record =', INT(sd(jf)%rec_n(1)), ' at time = ', sd(jf)%rec_n(2)/rday, ' days'
+               !
+            ENDIF
+            !                                              ! next record to be read
+            sd(jf)%rec_a = fld_rec( sd(jf)%freqh, sd(jf)%ln_tint, sd(jf)%nclim, 0 )
+
+            IF(lwp) WRITE(numout,*)'                                   ',    &
+                  &   ' after record         =', INT(sd(jf)%rec_a(1)), ' at time = ', sd(jf)%rec_a(2)/rday, ' days'
+            !
+         ENDIF
+         !
+         !                                            ! ============================= !
+         IF( sd(jf)%nclim == 0   .AND.   &            !            New Year           !
+             sd(jf)%nyear == nyear - 1 ) THEN         ! ============================= !
+            !
+            CALL iom_close( sd(jf)%num )
+            IF(lwp) WRITE(numout,*) 'fldread : switch to a new year= ', nyear
+            WRITE( sd(jf)%clname, '(a,"_",i4,".nc")' ) TRIM( sd(jf)%clrootname ), nyear
+            sd(jf)%nyear = nyear
+            CALL iom_open( sd(jf)%clname, sd(jf)%num )
+            !
+            IF( sd(jf)%ln_tint ) THEN       ! no record index change, update record time
+               sd(jf)%rec_b(1:2) = fld_rec( sd(jf)%freqh, sd(jf)%ln_tint, sd(jf)%nclim, -1 )
+               sd(jf)%rec_n(1:2) = fld_rec( sd(jf)%freqh, sd(jf)%ln_tint, sd(jf)%nclim,  0 )
+               sd(jf)%rec_a(1:2) = fld_rec( sd(jf)%freqh, sd(jf)%ln_tint, sd(jf)%nclim, +1 )   
+            ELSE                            ! ???
+               sd(jf)%rec_n(1:2) = fld_rec( sd(jf)%freqh, sd(jf)%ln_tint, sd(jf)%nclim, -1 )
+               sd(jf)%rec_a(1:2) = fld_rec( sd(jf)%freqh, sd(jf)%ln_tint, sd(jf)%nclim,  0 )   
+            ENDIF
+            !
+         ENDIF
+         !
+         !                                            ! ============================= !
+         !                                            !   Read / Update input fields  !
+         !                                            ! ============================= !
+         !
+         ! current record index 
+         zrec_kt(1:2) = fld_rec( sd(jf)%freqh, sd(jf)%ln_tint, sd(jf)%nclim, 0 ) 
+         !
+         ! read next record (if required)
+         IF( zrec_kt(1) == sd(jf)%rec_a(1) ) THEN 
+            !
+            IF( sd(jf)%ln_tint ) THEN         ! time interpolation: swap
+               sd(jf)%rec_b = fld_rec( sd(jf)%freqh, sd(jf)%ln_tint, sd(jf)%nclim, -1 )   ! record index & time
+!CDIR COLLAPSE
+               sd(jf)%fdta(:,:,1) = sd(jf)%fdta(:,:,2)                                    ! record field
+            ENDIF
+            !
+            sd(jf)%rec_n(:) = zrec_kt(:)      ! update now record index & time
+            !                                 ! read record
+            CALL iom_get( sd(jf)%num, jpdom_data, sd(jf)%clvar, sd(jf)%fdta(:,:,2), INT( sd(jf)%rec_n(1) ) )
+            !
+            !                                 ! after record index & time
+            sd(jf)%rec_a(1:2) = fld_rec( sd(jf)%freqh, sd(jf)%ln_tint, sd(jf)%nclim, +1 )   
+            !
+            !                                 ! control print
+            IF( sd(jf)%ln_tint ) THEN
+               IF(lwp .AND. nitend - nit000 <= 100 )   WRITE(numout,*)'fld_read: var ', TRIM( sd(jf)%clvar ),   &
+                  & ' D/M=', nday,'/',nmonth,' rec bna:', INT(sd(jf)%rec_b(1)), INT(sd(jf)%rec_n(1)),INT(sd(jf)%rec_a(1)), &
+                  & ' zrec bna', sd(jf)%rec_b(2)/rday, sd(jf)%rec_n(2)/rday, sd(jf)%rec_a(2)/rday
+            ELSE
+               IF(lwp .AND. nitend - nit000 <= 100 )   WRITE(numout,*)'fld_read: var ', TRIM( sd(jf)%clvar ),   &
+                  & ' D/M=', nday,'/',nmonth, ' record :', INT(sd(jf)%rec_n(1)),     &
+                  & ' at', sd(jf)%rec_n(2)/rday, 'day,  next rec', INT(sd(jf)%rec_a(1))
+            ENDIF
+         ENDIF
+
+         IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN                              !** update field at each kn_fsbc time-step
+            !
+            IF( sd(jf)%ln_tint ) THEN                                       !* linear time interpolated field
+               zt =  ( rsec_year - sd(jf)%rec_b(2) ) / ( sd(jf)%rec_n(2) - sd(jf)%rec_b(2) )
+!CDIR COLLAPSE
+               sd(jf)%fnow(:,:) = ( 1. - zt ) * sd(jf)%fdta(:,:,1) + zt * sd(jf)%fdta(:,:,2)
+            ELSE
+!CDIR COLLAPSE
+               sd(jf)%fnow(:,:) = sd(jf)%fdta(:,:,2)                        !* piecewise constant field
+            ENDIF
+            !
+         ENDIF
+         !
+         !                                         ! ======================== !
+         IF( kt == nitend ) THEN                   !  Close the input files   !
+            !                                      ! ======================== !
+            CALL iom_close( sd(jf)%num )
+         ENDIF
+         !                                      ! ===================== !
+      END DO                                    !  END LOOP OVER FIELD  !
+      !                                         ! ===================== !
+   END SUBROUTINE fld_read
+
+
+   FUNCTION fld_rec( pfreq, ld_tint, kclim, kshift )   RESULT( prec_info )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE fld_rec  ***
+      !!
+      !! ** Purpose :   provide 
+      !!
+      !! ** Method  :   
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in)   ::   pfreq       ! record frequency (>0 in hours, <0 in months)
+      LOGICAL , INTENT(in)   ::   ld_tint     ! time interpolation flag (T/F)
+      INTEGER , INTENT(in)   ::   kclim       ! climatology flag (=0/1)
+      INTEGER , INTENT(in)   ::   kshift      ! record shift 
+      REAL(wp), DIMENSION(2) ::   prec_info   ! 1: file record + kshift 
+      !                                       ! 2: associated time [sec] centered at half the record frequency
+      !!
+      INTEGER  ::   iendh, irec
+      REAL(wp) ::   zrec
+      !!----------------------------------------------------------------------
+      !
+      IF( pfreq == -12. ) THEN      ! monthly data
+         !
+         iendh = 12                        ! 12 records per year
+         IF( ld_tint) THEN                 ! time interpolation, shift by 1/2 record
+            zrec  = REAL( nday     ) / REAL( nmonth_len(nmonth) ) + 0.5
+         ELSE
+            zrec  = REAL( nday - 1 ) / REAL( nmonth_len(nmonth) )
+         ENDIF
+         irec = nmonth + kshift + INT( zrec )   ! record index (from 0 to 13)
+         zrec = rmonth_half(irec)               ! record time (second since 00h, Jan. 1st)
+         !
+      ELSE                          ! high frequency data (pfreq in hours)
+         !
+         iendh = INT( 365 * 24 / pfreq )   ! iendh records per year
+         IF( ld_tint ) THEN                ! time interpolation, shift by 1/2 record
+            zrec = rsec_year / ( pfreq * 3600. ) + 0.5 
+         ELSE                 
+            zrec = rsec_year / ( pfreq * 3600. )      
+         ENDIF      
+         irec = 1      + kshift + INT( zrec )                          ! record index (from 0 to iendh+1)
+         zrec = - 0.5 * 3600. * pfreq + 3600. * pfreq * REAL( irec )   ! record time (second since 00h, Jan. 1st)
+         !
+      ENDIF
+      !
+      !                             ! adjuste the record index (climatology or interannual)
+      IF( kclim /= 1 )   THEN 
+         irec = irec + 1                                          ! interannual: additional first record
+      ELSE                     
+         IF( irec  ==         0 )   irec  =            iendh      ! climatology: record 0 is the last record (iendh)
+         IF( irec  >= iendh + 1 )   irec  = MOD( irec, iendh )    ! climatology: apply a modulo iendh
+      ENDIF
+      !
+      prec_info(1) = REAL( irec, wp )
+      prec_info(2) = zrec
+      !
+   END FUNCTION fld_rec
+
+   !!======================================================================
+END MODULE fldread
Index: trunk/NEMO/OPA_SRC/SBC/flx_bulk_daily.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flx_bulk_daily.h90	(revision 873)
+++ 	(revision )
@@ -1,199 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                    ***  flx_bulk_daily  ***
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   bulk          : reading 
-   !!----------------------------------------------------------------------
-   !! * Modules used     C A U T I O N  already defined in flxmod.F90
-
-   !! * Module variables
-   
-   INTEGER ::          &
-      ji, jj,          &  ! loop indices
-      numfl1, numfl2,  &  ! logical units for surface fluxes data
-      numfl3, numfl4,  &  ! 
-      nflx1 , nflx2 ,  &  !  first and second record used
-      ndayflx
-
-   REAL(wp), DIMENSION(jpi,jpj,2,3) ::   &
-      flxdta              ! 2 consecutive set of CLIO/CMAP monthly fluxes
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE flx( kt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE flx  ***
-      !!        
-      !! ** Purpose :   provide the thermohaline fluxes (heat and freshwater)
-      !!      to the ocean at each time step.
-      !!
-      !! ** Method :
-      !!       ORCA FORCED VERSION WITH :
-      !!       Daily climatological NCEP temperature
-      !!       Daily climatological ERS-NCEP winds
-      !!       monthly climatological humidity and clouds
-      !!       monthly climatological CMAP precipitation
-      !!       Read several AGCM daily and monthly fluxes file
-      !!             temperature at 2m   tatm   (K)
-      !!             relative humidite   hatm   (%)
-      !!             wind speed          vatm   (m/s)
-      !!             monthly precip      watm   (kg/m2/day)  from Xie/Arkin
-      !!             clouds              catm   (%)
-      !!
-      !! caution : now, in the opa global model, the net upward water flux is
-      !! -------   with mm/day unit.
-      !!
-      !! History :
-      !!        !  91-03  (O. Marti and Ph Dandin)  Original code
-      !!        !  92-07  (M. Imbard)
-      !!        !  96-11  (E. Guilyardi)  Daily AGCM input files
-      !!        !  99-11  (M. Imbard)  NetCDF FORMAT with io-ipsl
-      !!        !  00-05  (K. Rodgers) Daily Netcdf
-      !!   8.5  !  02-09  (C. Ethe and G. Madec)  F90: Free form and MODULE 
-      !!----------------------------------------------------------------------
-      !! * modules used
-      USE iom             ! I/O library
-      USE blk_oce         ! bulk variable
-      USE bulk            ! bulk module
-      USE ice_oce
-
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt ! ocean time step
-
-      !! * Local declarations      
-      INTEGER  ::   iman,imois,i15
-      REAL(wp) ::   zxy
-      !!---------------------------------------------------------------------
-
-
-      ! Initialization
-      ! --------------
-
-      i15 = INT(2*FLOAT(nday)/(FLOAT(nobis(nmonth))+0.5))
-      iman  = INT( raamo )
-      imois = nmonth + i15 - 1
-      IF (imois == 0) imois = iman
-
-
-      ! 1. first call kt = nit000
-      ! -----------------------
-      
-      IF( kt == nit000 ) THEN
-         ! initializations
-         nflx1 = 0
-         ndayflx = 0
-         IF(lwp) THEN
-            WRITE(numout,*) ' '
-            WRITE(numout,*) ' **** Routine flx_bulk_daily.h90'
-            WRITE(numout,*) ' '
-         ENDIF         
-         ! open files
-         IF(lwp) WRITE(numout,*) ' **** global NCEP flx  daily fields '
-         CALL iom_open ( 'tair_1d.nc', numfl1 )
-         IF(lwp) WRITE(numout,*) ' **** global CLIO flx  monthly fields '
-         CALL iom_open ( 'hum_cloud_1m.nc', numfl2 )
-         IF(lwp) WRITE(numout,*) ' **** global XIE  flx  monthly fields '
-         CALL iom_open ( 'rain_1m.nc', numfl3 )
-         IF(lwp) WRITE(numout,*) ' **** global ERS-NCEP  wind daily  fields '
-         CALL iom_open ( 'wspd_1d.nc', numfl4 )
-      ENDIF
-
-
-      ! 2. Read daily DATA Temperature from NCEP
-      ! ---------------------------------------
-      
-      IF( ndayflx /= nday ) THEN 
-         
-         ndayflx = nday
-         
-         ! read T 2m (Caution in K)
-         CALL iom_get ( numfl1, jpdom_data, 'air', tatm, nday_year )
-         
-         IF(lwp) WRITE (numout,*)' Lecture daily flx record OK :',nday_year
-         IF(lwp) WRITE (numout,*)' '
-         
-         ! conversion of temperature Kelvin --> Celsius  [rt0=273.15]
-         tatm(:,:) = ( tatm(:,:) - rt0 ) 
-         
-         ! read wind speed
-         CALL iom_get ( numfl4, jpdom_data, 'wspd', vatm, nday_year )
-         
-         IF(lwp) WRITE (numout,*)' Lecture daily wind speed flx :',nday_year
-         IF(lwp) WRITE (numout,*)' '
-         
-      ENDIF
-
-      
-      !  3. Read monthly data from CLIO and From Xie
-      !  -------------------------------------------
-      
-      IF( kt == nit000 .OR. imois /= nflx1 ) THEN
-         
-         ! calendar computation
-         
-         ! nflx1 number of the first file record used in the simulation
-         ! flx2 number of the last  file record
-         
-         nflx1 = imois
-         nflx2 = nflx1+1
-         nflx1 = MOD(nflx1,iman)
-         IF ( nflx1 == 0 ) nflx1 = iman
-         nflx2 = MOD(nflx2,iman)
-         IF ( nflx2 == 0 ) nflx2 = iman
-         IF(lwp)WRITE(numout,*) 'first record file used nflx1 ',nflx1
-         IF(lwp)WRITE(numout,*) 'last  record file used nflx2 ',nflx2
-
-         ! Read monthly fluxes data Esbensen Kushnir 
-
-         ! humidity
-         CALL iom_get ( numfl2, jpdom_data, 'socliohu', flxdta(:,:,1,1), nflx1 )
-         CALL iom_get ( numfl2, jpdom_data, 'socliohu', flxdta(:,:,2,1), nflx2 )
-
-         ! clouds
-         CALL iom_get ( numfl2, jpdom_data, 'socliocl', flxdta(:,:,1,2), nflx1 )
-         CALL iom_get ( numfl2, jpdom_data, 'socliocl', flxdta(:,:,2,2), nflx2 )
-
-         ! Read monthly precipitations ds flxdta(:,:,1 ou 2,4) 
-
-         CALL iom_get ( numfl3, jpdom_data, 'rain', flxdta(:,:,1,3), nflx1 )
-         CALL iom_get ( numfl3, jpdom_data, 'rain', flxdta(:,:,2,3), nflx2 )
-                  
-      ENDIF
-
-
-      ! 3. at every time step linear interpolation of precipitation fluxes
-      ! -----------------------------------------------------------
-      
-      zxy = FLOAT(nday) / FLOAT(nobis(nflx1)) + 0.5 - i15
-
-      hatm(:,:) = ( (1.-zxy) * flxdta(:,:,1,1) + zxy  * flxdta(:,:,2,1) ) 
-      catm(:,:) = ( (1.-zxy )* flxdta(:,:,1,2) + zxy  * flxdta(:,:,2,2) )  
-      watm(:,:) = ( (1.-zxy) * flxdta(:,:,1,3) + zxy  * flxdta(:,:,2,3) ) 
-
-      ! 4. Closing all files
-      ! --------------------
-
-      IF( kt == nitend ) THEN
-         CALL iom_close (numfl1)
-         CALL iom_close (numfl2)
-         CALL iom_close (numfl3)
-         CALL iom_close (numfl4)
-      ENDIF
-
-      CALL blk(kt)
-
-#if defined key_lim3
-      tatm_ice(:,:) = tatm(:,:)
-#endif
-      CALL lbc_lnk(tatm_ice, 'T', 1. )  !RB necessary ??
-      
-      CALL FLUSH(numout)
-      
-   END SUBROUTINE flx
-   
Index: trunk/NEMO/OPA_SRC/SBC/flx_bulk_monthly.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flx_bulk_monthly.h90	(revision 873)
+++ 	(revision )
@@ -1,242 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                    ***  flx_blulk_monthly.h90  ***
-   !!----------------------------------------------------------------------
-   !!   flx     : update surface thermohaline fluxes using bulk formulae
-   !!             and fields read in a NetCDF file
-   !!----------------------------------------------------------------------
-   !! * Modules used     C A U T I O N  already defined in flxmod.F90
-
-   !! * Module variables
-   
-   INTEGER ::          &
-      ji, jj,          &  ! loop indices
-      numflx,          &  ! logical unit for surface fluxes data
-      nflx1 , nflx2,   &  !  first and second record used
-      nflx11, nflx12      ! ???
-
-   INTEGER, PARAMETER :: jpf    =  7                   
-   REAL(wp), DIMENSION(jpi,jpj,2,jpf) ::   &
-      flxdta              ! 2 consecutive set of CLIO monthly fluxes
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE flx( kt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE flx  ***
-      !!                   
-      !! ** Purpose :   provide the thermohaline fluxes (heat and freshwater) 
-      !!      to the ocean at each time step.
-      !!
-      !! ** Method  :   Read monthly climatological fluxes in a NetCDF file
-      !!          the net downward radiative flux qsr      1 (watt/m2)
-      !!          the net downward heat flux      q        2 (watt/m2)
-      !!          the net upward water            emp      3 (mm/month)
-      !!              (evaporation - precipitation)
-      !!          the climatological ice cover    rclice   4 (0 or 1)
-      !!
-      !!     Qsr and q is obtained from Esbensen-Kushnir data (opal file) with
-      !!   some corrections :
-      !!          - Data are extended over the polar area and for the net heat
-      !!            flux, values are put at 200 w/m2 on the ice regions
-      !!          - Red sea and Mediterranean values are imposed.
-      !! 
-      !!     emp is the Oberhuber climatology with a function of Levitus 
-      !!   salinity
-      !! 
-      !!     rclice is an handmade climalological ice cover on the polar 
-      !!   regions.
-      !! 
-      !!     runoff is an handmade climalological runoff.
-      !!
-      !! caution : now, in the opa global model, the net upward water flux is
-      !! -------   with mm/day unit.
-      !!
-      !! History :
-      !!        !  91-03  (O. Marti and Ph Dandin)  Original code
-      !!        !  92-07  (M. Imbard)
-      !!        !  96-11  (E. Guilyardi)  Daily AGCM input files
-      !!        !  99-11  (M. Imbard)  NetCDF FORMAT with io-ipsl
-      !!        !  00-10  (J.-P. Boulanger)  adjusted for reading any
-      !!                         daily wind stress data including a climatology
-      !!        !  01-09  (A. Lazar and C. Levy)  Daily NetCDF by default
-      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * modules used
-      USE iom
-      USE blk_oce         ! bulk variable
-      USE bulk            ! bulk module
-      USE ice_oce
-
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-
-      !! * Local declarations
-      INTEGER ::   jm            ! dummy loop indices
-      INTEGER ::   &
-         imois, imois2,       &  ! temporary integers
-         i15  , iman             !    "          "
-      REAL(wp) ::   &
-         zxy   , zdtt  ,      &  !    "         "
-         zttbt , zttat ,      &  !    "         "
-         zdtts6                  !    "         "
-      !!---------------------------------------------------------------------
-
-      ! Initialization
-      ! --------------
-
-      i15 = INT( 2 * FLOAT( nday ) / ( FLOAT( nobis(nmonth) ) + 0.5 ) )
-      iman  = INT( raamo )
-      imois = nmonth + i15 - 1
-      IF( imois == 0 ) imois = iman
-      imois2 = nmonth
-
-      ! 1. first call kt=nit000
-      ! -----------------------
-
-      IF( kt == nit000 ) THEN
-         ! initializations
-         nflx1  = 0
-         nflx11 = 0
-         ! open the file
-         IF(lwp) THEN
-            WRITE(numout,*) ' '
-            WRITE(numout,*) ' **** Routine flx_bulk_monthly.h90'
-            WRITE(numout,*) ' '
-            WRITE(numout,*) ' global CLIO flx monthly fields'
-         ENDIF
-         CALL iom_open ( 'flx.nc', numflx )
-        
-         ! temperature, spline initialization, we read the first record
-         CALL iom_get ( numflx, jpdom_data, 'socliot1', flxdta(:,:,1,5), 1 )
-
-      ENDIF
-
-
-      ! Read monthly file
-      ! ----------------
-
-      IF( kt == nit000 .OR. imois /= nflx1 ) THEN
-
-         ! Calendar computation
-
-         ! nflx1 number of the first file record used in the simulation
-         ! nflx2 number of the last  file record
-
-         nflx1 = imois
-         nflx2 = nflx1+1
-         nflx1 = MOD( nflx1, iman )
-         nflx2 = MOD( nflx2, iman )
-         IF( nflx1 == 0 )   nflx1 = iman
-         IF( nflx2 == 0 )   nflx2 = iman
-         IF(lwp) WRITE(numout,*) 'first record file used nflx1 ',nflx1
-         IF(lwp) WRITE(numout,*) 'last  record file used nflx2 ',nflx2
-         
-         ! Read monthly fluxes data
-
-         ! humidity
-         CALL iom_get ( numflx, jpdom_data, 'socliohu', flxdta(:,:,1,1), nflx1 )
-         CALL iom_get ( numflx, jpdom_data, 'socliohu', flxdta(:,:,2,1), nflx2 )
-         ! 10m wind module
-         CALL iom_get ( numflx, jpdom_data, 'socliowi', flxdta(:,:,1,2), nflx1 )
-         CALL iom_get ( numflx, jpdom_data, 'socliowi', flxdta(:,:,2,2), nflx2 )
-         ! cloud cover
-         CALL iom_get ( numflx, jpdom_data, 'socliocl', flxdta(:,:,1,3), nflx1 )
-         CALL iom_get ( numflx, jpdom_data, 'socliocl', flxdta(:,:,2,3), nflx2 )
-         ! precipitations
-         CALL iom_get ( numflx, jpdom_data, 'socliopl', flxdta(:,:,1,4), nflx1 )
-         CALL iom_get ( numflx, jpdom_data, 'socliopl', flxdta(:,:,2,4), nflx2 )
-         
-         IF(lwp .AND. nitend-nit000 <= 100 ) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) ' read clio flx ok'
-            WRITE(numout,*)
-            DO jm = 1, 4
-               WRITE(numout,*)
-               WRITE(numout,*) 'Clio mounth: ',nflx1,'  field: ',jm,' multiply by ',0.1
-               CALL prihre( flxdta(:,:,1,jm),jpi,jpj,1,jpi,20,1,jpj,10,.1,numout )
-            END DO
-         ENDIF
-
-      ENDIF
-
-      IF( kt == nit000 .OR. imois2 /= nflx11 ) THEN
-
-         ! calendar computation
-         
-         ! nflx1 number of the first file record used in the simulation
-         ! nflx2 number of the last  file record
-         
-         nflx11 = imois2
-         nflx12 = nflx11 + 1
-         nflx11 = MOD( nflx11, iman )
-         nflx12 = MOD( nflx12, iman )
-         IF( nflx11 == 0 )   nflx11 = iman
-         IF( nflx12 == 0 )   nflx12 = iman
-         IF(lwp) WRITE(numout,*) 'first record file used nflx11 ',nflx11
-         IF(lwp) WRITE(numout,*) 'last  record file used nflx12 ',nflx12
-         
-         ! Read monthly fluxes data Esbensen Kushnir 
-         
-         ! air temperature
-         ! Utilisation d'un spline, on lit le champ a mois=nflx1 et nflx2
-         CALL iom_get (numflx,jpdom_data,'socliot1',flxdta(:,:,1,6),nflx11)
-         CALL iom_get (numflx,jpdom_data,'socliot1',flxdta(:,:,2,6),nflx12)
-         ! air temperature derivative (to reconstruct a daily field)
-         CALL iom_get (numflx,jpdom_data,'socliot2',flxdta(:,:,1,7),nflx11)
-         CALL iom_get (numflx,jpdom_data,'socliot2',flxdta(:,:,2,7),nflx12)
-          
-         IF(lwp) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) ' read CLIO flx ok'
-            WRITE(numout,*)
-            DO jm = 6, jpf
-               WRITE(numout,*) 'jpf =  ', jpf !C a u t i o n : information need for SX5NEC compilo bug
-               WRITE(numout,*) 'Clio mounth: ',nflx11,'  field: ',jm,' multiply by ',0.1
-               CALL prihre(flxdta(:,:,1,jm),jpi,jpj,1,jpi,20,1,jpj,10,.1,numout)
-               WRITE(numout,*)
-            END DO
-         ENDIF
-
-      ENDIF
-
-
-      ! 3. at every time step interpolation of fluxes
-      ! ---------------------------------------------
-
-      zxy = FLOAT( nday ) / FLOAT( nobis(nflx1) ) + 0.5 - i15
-
-      zdtt = raajj / raamo
-      zttbt = (REAL(nday) - 1.)/(nobis(nmonth) - 1.)
-
-      zttat = 1. - zttbt
-      zdtts6 = zdtt/6.
-
-      hatm(:,:) = ( (1.-zxy) * flxdta(:,:,1,1) + zxy * flxdta(:,:,2,1) )
-      vatm(:,:) = ( (1.-zxy) * flxdta(:,:,1,2) + zxy * flxdta(:,:,2,2) )
-      catm(:,:) = ( (1.-zxy )* flxdta(:,:,1,3) + zxy * flxdta(:,:,2,3) )
-      watm(:,:) = ( (1.-zxy) * flxdta(:,:,1,4) + zxy * flxdta(:,:,2,4) )
-      tatm(:,:) = ( flxdta(:,:,2,6) - flxdta(:,:,1,6) )/zdtt   &
-                - ((3. * zttat * zttat - 1.) * flxdta(:,:,1,7)   &
-                - ( 3. * zttbt * zttbt - 1.) * flxdta(:,:,2,7) ) * zdtts6   &
-                + flxdta(:,:,1,5)
- 
-      CALL blk( kt )                ! bulk formulea fluxes 
-
-#if defined key_lim3
-      tatm_ice(:,:) = tatm(:,:)
-#endif
-      CALL lbc_lnk(tatm_ice, 'T', 1. )  !RB necessary ??
-
-      ! ------------------- !
-      ! Last call kt=nitend !
-      ! ------------------- !
-
-      ! Closing of the numflx file (required in mpp)
-      IF( kt == nitend ) CALL iom_close (numflx)
-
-   END SUBROUTINE flx
Index: trunk/NEMO/OPA_SRC/SBC/flx_core.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flx_core.h90	(revision 873)
+++ 	(revision )
@@ -1,1114 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                    ***  flx_core.h90  ***
-   !!----------------------------------------------------------------------
-   !!   flx     : update surface thermohaline fluxes from the NCAR data set
-   !!             read in a NetCDF file
-   !!----------------------------------------------------------------------
-   !! * Modules used     C A U T I O N  already defined in flxmod.F90
-
-   !! * Shared module variables
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::  &
-      gsss,            &  !: SSS mean on nfbulk ocean time step
-      gu  , gv ,       &  !: (un,vn)(jk=1) mean over nfbulk ocean time step
-      !                   ! these variables are used for output in diawri
-      qlw_oce  ,       &  !: long wave flx over ocean
-      qla_oce  ,       &  !: latent heat flx over ocean
-      qsb_oce  ,       &  !: sensible heat flx over ocean
-      qlw_ice  ,       &  !: long wave flx over ice
-      qsb_ice             !: sensible heat flx over ice
-
-   !! * Module variables
-   INTEGER, PARAMETER ::   jpfile  = 8  ! maximum number of files to read 
-   CHARACTER (LEN=32), DIMENSION (jpfile) ::  clvarname  
-   CHARACTER (LEN=50), DIMENSION (jpfile) ::  clname 
-
-   INTEGER   ::      isnap
-   INTEGER, DIMENSION(jpfile) ::   &
-      numflxall,           &  ! logical units for surface fluxes data
-      nrecflx  , nrecflx2     ! first and second record to be read in flux file
-   REAL(wp), DIMENSION(jpfile) ::   &
-      freqh                 ! Frequency for each forcing file (hours)
-      !                     ! a negative value of -12 corresponds to monthly
-   REAL(wp), DIMENSION(jpi,jpj,jpfile,2) ::   &
-      flxdta                !:  set of NCAR 6hourly/daily/monthly fluxes
-   LOGICAL  :: &
-        &   ln_2m   = .FALSE.     !: logical flag for height of air temp. and hum.
-   REAL(wp) :: alpha_precip=1.    !: multiplication factor for precipitation
-   !!----------------------------------------------------------------------
-   !! History :
-   !!   9.0  !  04-08  (U. Schweckendiek)  Original code
-   !!        !  05-04  (L. Brodeau, A.M. Treguier)  severals modifications:
-   !!        !         - new bulk routine for efficiency
-   !!        !         - WINDS ARE NOW ASSUMED TO BE AT T POINTS in input files
-   !!        !         - file names and file characteristics in namelist 
-   !!        !         - Implement reading of 6-hourly fields   
-   !!        !  06-02  (S. Masson, G. Madec)  IOM read + NEMO "style"
-   !!        !  12-06  (L. Brodeau) handle both 2m and 10m input fields
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2006)
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/SBC/flx_core.h90,v 1.5 2007/06/05 10:41:37 opalod Exp $
-   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE flx( kt )
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE flx  ***
-      !!                   
-      !! ** Purpose :   provide the thermohaline fluxes (heat and freshwater)
-      !!                and momentum fluxes (tau) 
-      !!      to the ocean at each time step.
-      !!
-      !! ** Method  :   Read NCAR data in a NetCDF file
-      !!               (file names and frequency of inputs specified in namelist)
-      !!          precipitation:  total (rain+snow)
-      !!          precipitation:  snow only 
-      !!          u10,v10 -> scalar wind at 10m in m/s -  ON 'T' GRID POINTS!!!
-      !!          solar radiation (short wave)  in W/m2
-      !!          thermal radiation (long wave) in W/m2
-      !!          specific humidity             in %
-      !!          temperature at 10m            in degrees K
-      !!
-      !!  ** Action  :   
-      !!          call flx_blk_albedo to compute ocean and ice albedo
-      !!          Calculates forcing fluxes to input into ice model 
-      !          or to be used directly for the ocean in ocesbc. 
-      !!
-      !!  ** Outputs 
-      !!          COMMENTS TO BE ADDED -units to be verified!
-      !!          taux    : zonal      wind stress on "u" points  (N/m2)
-      !!          tauy    : meridional wind stress on "v" points  (N/m2)
-      !!          qsr_oce : Solar flux over the ocean (W/m2)
-      !!          qnsr_oce: longwave flux over the ocean (W/m2)
-      !!          qsr_ice : solar flux over the ice (W/m2)
-      !!          qnsr_ice: longwave flux over the ice (W/m2)
-      !!          qla_ice : latent flux over sea-ice (W/m2)
-      !!          dqns_ice: total heat fluxes sensitivity over ice (dQ/dT)
-      !!          dqla_ice: latent heat flux sensitivity over ice (dQla/dT)
-      !!          fr1_i0
-      !!          fr2_i0
-      !!          tprecip
-      !!          sprecip
-      !!          evap
-      !!          
-      !! caution : now, in the opa global model, the net upward water flux is
-      !! -------   with mm/day unit,i.e. Kg/m2/s.
-      !!---------------------------------------------------------------------
-      !! * modules used
-      USE iom
-      USE restart         
-      USE par_oce
-      USE flx_oce
-      USE blk_oce         ! bulk variable
-      USE taumod
-      USE bulk
-      USE phycst
-      USE lbclnk
-      USE dtatem          ! FOR Ce = F(SST(levitus)):
-
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-
-      !! * Local declarations
-      INTEGER , PARAMETER :: jpmaxtime = 366*4   ! maximum time steps in file will be for a 6 hourly field
-                                                 ! and a leap year (necessary variable for flinopen??)
-      INTEGER ::  irectot, irecflx
-      INTEGER ::  ihour                ! current hour of the day at which we read the forcings
-      INTEGER ::   &
-         imois, imois2,             &  ! temporary integers
-         i15  , iman  , inum ,      &  !    "          "
-         ifpr , jfpr  ,             &  ! frequency of index for print in prihre
-         jj   , ji                     !  Loop indices 
-      REAL(wp) ::   &
-         zadatrjb,                  &  ! date (noninteger day) at which we read the forcings
-         zxy    ,                   &  ! scalar for temporal interpolation
-         zcof , zzu , zzv              ! scalar 
-      REAL(wp), DIMENSION(jpi,jpj, jpfile) ::   &
-         flxnow             ! input flux values at current time step 
-      REAL(wp), DIMENSION(jpi,jpj) ::   &
-         dqlw_ice ,      &  ! long wave heat flx sensitivity over ice
-         dqsb_ice ,      &  ! sensible heat flx sensitivity over ice
-         alb_oce_os,     &  ! albedo of the ocean under overcast sky
-         alb_ice_os,     &  ! albedo of the ice under overcast sky
-         alb_ice_cs,     &  ! albedo of ice under clear sky
-         alb_oce_cs,     &  ! albedo of the ocean under clear sky
-         zsst,           &  ! nfbulk : mean SST
-         zsss,           &  ! nfbulk : mean tn_ice(:,:,1)
-         zut,            &  ! nfbulk : mean U at T-point
-         zvt,            &  ! nfbulk : mean V at T-point
-         dUnormt,        &  ! scalar wind (norm) on T points
-         tauxt, tauyt,   &  ! wind stress computed at T-point
-         qsatw,          &  ! specific humidity at zSST
-         qsat,           &  ! specific humidity at zsss 
-         Ch,             &  ! coefficient for sensible heat flux
-         Ce,             &  ! coefficient for latent heat flux
-         Cd,             &  ! coefficient for wind stress
-         zt_zu,          &  !: air temperature at wind speed height
-         zq_zu              !: air spec. hum.  at wind speed height
-      REAL(wp), PARAMETER ::   &
-         rhoa  = 1.22,    &  ! air density
-         cp    = 1000.5,  &  ! specific heat of air
-         Lv    = 2.5e6,   &  ! latent heat of vaporization
-         Ls    = 2.839e6, &  ! latent heat of sublimation
-         Stef  = 5.67e-8, &  ! Stefan Boltzmann constant
-         Cice = 1.63e-3      ! transfert coefficient over ice
-      REAL(wp), DIMENSION(jpi,jpj) ::   &
-         catm1               ! 
-
-      NAMELIST /namcore/  clname, clvarname, freqh, ln_2m, alpha_precip
-      !!---------------------------------------------------------------------
-
-      !! =============================================== !!
-      !!   PART A:   READING FLUX FILES WHEN NECESSARY   !!
-      !! =============================================== !!
-
-      !--- calculation for monthly data 
-      ! i15 = 0 if first half of current month
-      ! i15 = 1 if second half of current month
-      i15 = INT( 2 * FLOAT( nday ) / ( FLOAT( nobis(nmonth) ) + 0.5 ) )
-      iman  = 12
-      imois = nmonth + i15 - 1
-      IF( imois == 0 ) imois = iman
-      imois2 = nmonth
-
-      !--- calculation for 6-hourly data 
-      !    we need the fraction of day, measured in hours at the date of forcings. 
-      !    This is the time step before the date we are calculating, zadatrj 
-      !    "adatrj" (real time in days (noninteger))
-      zadatrjb = adatrj - rdt / rday
-      ihour = INT( ( zadatrjb - INT(zadatrjb) ) * 24 )
-
-      !                                         ! ------------------------ !
-      IF( kt == nit000 ) THEN                   !   first call kt=nit000   !
-         !                                      ! ------------------------ !
-         CALL core_rst ( kt, 'READ' )
-
-         !--- Initializes default values of file names, frequency of forcings 
-         !    and variable to be read in the files, before reading namelist 
-         clname(1) = 'precip.nc'   ; freqh(1) = -12 ; clvarname(1) = 'precip'     ! monthly
-         clname(2) = 'u10.nc'      ; freqh(2) =   6 ; clvarname(2) = 'u10'        ! 6 hourly          
-         clname(3) = 'v10.nc'      ; freqh(3) =   6 ; clvarname(3) = 'v10'        ! 6 hourly    
-         clname(4) = 'q10.nc'      ; freqh(4) =   6 ; clvarname(4) = 'q10'        ! 6 hourly   
-         clname(5) = 'radsw.nc'    ; freqh(5) =  24 ; clvarname(5) = 'radsw'      ! daily 
-         clname(6) = 'radlw.nc'    ; freqh(6) =  24 ; clvarname(6) = 'radlw'      ! daily 
-         clname(7) = 't10.nc'      ; freqh(7) =   6 ; clvarname(7) = 't10'        ! 6 hourly 
-         clname(8) = 'snow.nc'     ; freqh(8) = -12 ; clvarname(8) = 'snow'       ! monthly
-
-         !--- Read Namelist namcore : OMIP/CORE 
-         REWIND ( numnam )
-         READ   ( numnam, namcore )
-
-         ! in case of ln_2m, air temp. and humidity are given at 2 m, thus file name and variable name are changed
-         IF ( ln_2m ) THEN
-           clname(4) = 'q2.nc'      ; clvarname(4) = 'q2'     
-           clname(7) = 't2.nc'      ; clvarname(7) = 't2'    
-           ! but if for some reason, clname and varname were also in the name list, we screw them up !
-           ! re-read the namelist, to restore clname, varname to their namelist value 
-           REWIND ( numnam )
-           READ   ( numnam, namcore )
-         ENDIF
-
-         IF(lwp) THEN
-            WRITE(numout,*)' '
-            WRITE(numout,*)' flx_core : global CORE fields in NetCDF format'
-            WRITE(numout,*)' ~~~~~~~~~~ '
-            WRITE(numout,*) '           ln_2m        = ', ln_2m
-            WRITE(numout,*) '           alpha_precip = ', alpha_precip
-            WRITE(numout,*) '           list of files and frequency (hour), or monthly (-12) '
-            DO ji = 1, jpfile
-                WRITE(numout,*) trim(clname(ji)), ' frequency:', freqh(ji)
-            END DO
-         ENDIF
-
-         !--- Initialization to zero
-         qsr_oce (:,:) = 0.e0
-         qsb_oce (:,:) = 0.e0
-         qla_oce (:,:) = 0.e0
-         qlw_oce (:,:) = 0.e0
-         qnsr_oce(:,:) = 0.e0
-         qsr_ice (:,:) = 0.e0
-         qnsr_ice(:,:) = 0.e0
-         qla_ice (:,:) = 0.e0
-         qlw_ice (:,:) = 0.e0
-         qsb_ice (:,:) = 0.e0
-
-         dqns_ice(:,:) = 0.e0
-         dqla_ice(:,:) = 0.e0
-         tprecip (:,:) = 0.e0
-         sprecip (:,:) = 0.e0
-         evap    (:,:) = 0.e0
-
-         flxnow  (:,:,:) = 1.e-15         !RB
-         flxdta  (:,:,:,:) = 1.e-15       !RB
-
-         nrecflx (:)    = 0      ! switch for reading flux data for each file
-         nrecflx2(:)    = 0      ! switch for reading flux data for each file
-
-         !--- Open the files of the list
-         DO ji = 1, jpfile
-            CALL iom_open( clname(ji), numflxall(ji) )
-         END DO
-
-      ENDIF
-
-      !                                         ! ------------------------ !
-      !                                         !  Read files if required  !
-      !                                         ! ------------------------ !
-
-      !--- read data if necessary checks each file in turn 
-
-      DO ji = 1, jpfile
-
-         IF (  freqh(ji) > 0 .AND.  freqh(ji) <  24 ) THEN          !--- Case of 6-hourly flux data  
-            !--- calculate current snapshot from hour of day 
-            isnap = ihour / INT( freqh(ji) ) + 1
-            !--- reading is necessary when nrecflx(ji) differs from isnap 
-            IF( nrecflx(ji) /= isnap ) THEN   
-               nrecflx(ji) = isnap
-               irecflx = (nday_year-1)*24 / freqh(ji) + isnap
-               irectot = 365*24 / freqh(ji)        !  this variable is not used by iom_get
-               IF(lwp) WRITE (numout,*)' CORE flux 6-h record :',irecflx, ' var:',trim(clvarname(ji))
-               CALL iom_get( numflxall(ji), jpdom_data, clvarname(ji), flxdta(:,:,ji,1), irecflx )
-            ENDIF
-
-         ELSE IF ( freqh(ji) ==  24 ) THEN                             !--- Case of daily flux data  
-
-            !--- reading is necessary when nrecflx(ji) differs from nday
-            IF( nrecflx(ji) /= nday ) THEN   
-               nrecflx(ji) = nday          !! remember present read day
-               irecflx     = nday_year     !! 
-               irectot = 365        !  this variable is not used by iom_get
-               IF(lwp) WRITE (numout,*)'DAILY CORE flux record :',irecflx, ' var:',trim(clvarname(ji))
-               CALL iom_get( numflxall(ji), jpdom_data, clvarname(ji), flxdta(:,:,ji,1), irecflx )
-            ENDIF
-
-         ELSE IF ( freqh(ji) == -12 ) THEN                            !--- Case monthly data from CORE
-            ! we read two months all the time although we 
-            ! could only read one and swap the arrays 
-            IF( kt == nit000 .OR. imois /= nrecflx(ji) ) THEN
-               ! calendar computation
-               ! nrecflx number of the first file record used in the simulation
-               ! nrecflx2 number of the last  file record
-               nrecflx(ji) = imois
-               nrecflx2(ji) = nrecflx(ji)+1
-               nrecflx(ji) = MOD( nrecflx(ji), iman )
-               IF( nrecflx(ji) == 0 )   nrecflx(ji) = iman
-               nrecflx2(ji) = MOD( nrecflx2(ji), iman )
-               IF ( nrecflx2(ji) == 0 ) nrecflx2(ji) = iman
-               irectot = 12        !  this variable is not used by iom_get
-               IF(lwp) WRITE(numout,*) 'MONTHLY CORE flux record 1:', nrecflx(ji),   &
-                  &                    ' rec 2:', nrecflx2(ji), ' var:', trim(clvarname(ji))
-               CALL iom_get( numflxall(ji), jpdom_data, clvarname(ji), flxdta(:,:,ji,1), nrecflx (ji) )
-               CALL iom_get( numflxall(ji), jpdom_data, clvarname(ji), flxdta(:,:,ji,2), nrecflx2(ji) )
-            ENDIF
-         ENDIF
-      END DO    !   end of loop over forcing files to verify if reading is necessary 
-
-      !--- Printout if required      
-      !  IF( MOD( kt - 1 , nfbulk ) == 0 ) THEN
-      !            printout at the initial time step only (unless you want to debug!!)
-      IF( kt == nit000 ) THEN
-         IF(lwp) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) ' read daily and monthly CORE fluxes: ok'
-            WRITE(numout,*)
-            ifpr = INT(jpi/8)      ;      jfpr = INT(jpj/10)
-            DO ji = 1, jpfile 
-               WRITE(numout,*) trim(clvarname(ji)),' day: ',ndastp
-               CALL prihre(flxdta(1,1,ji,1),jpi,jpj,1,jpi,ifpr,1,jpj,jfpr,0.,numout)
-               WRITE(numout,*)
-            END DO
-         ENDIF
-      ENDIF
-
-      !                                         ! ------------------------ !
-      !                                         !   Interpolates in time   !
-      !                                         ! ------------------------ !
-      ! N.B. For now, only monthly values are interpolated, and they 
-      !      are interpolated to the current day, not to the time step.
-      !
-      DO ji = 1, jpfile       
-         IF( freqh(ji) == -12 ) THEN
-            zxy = REAL(nday) / REAL( nobis(imois) ) + 0.5 - i15         !!! <== Caution nobis hard coded !!!
-            flxnow(:,:,ji) = ( ( 1. - zxy) * flxdta(:,:,ji,1) + zxy * flxdta(:,:,ji,2) )
-         ELSE
-            flxnow(:,:,ji) = flxdta(:,:,ji,1)
-         ENDIF
-      END DO
-      ! JMM : add vatm needed in tracer routines  ==> wind module ???
-      vatm(:,:) = SQRT( flxnow(:,:,2) * flxnow(:,:,2) + flxnow(:,:,3) * flxnow(:,:,3) )
-
-
-      !! =============================================== !!
-      !!   PART B:   CORE BULK CALCULATION               !!
-      !! =============================================== !!
-
-      !  for other forcing cases this is done in modules bulk.F90 and flxblk
-
-      !                                         ! ------------------------ !
-      !                                         !   Bulk initialisation    !
-      !                                         ! ------------------------ !
-
-      ! code part from bulk.F90 :
-
-      IF( kt == nit000) THEN
-         !--- computation of rdtbs2     ===>  !gm  is it really usefull ????
-         IF( nacc == 1 ) THEN
-            rdtbs2 = nfbulk * rdtmin * 0.5
-         ELSE
-           rdtbs2 = nfbulk * rdt * 0.5
-         ENDIF
-         IF( .NOT.ln_rstart ) THEN
-            zcof =  REAL( nfbulk - 1, wp )
-            gsst(:,:) =  zcof * ( tn(:,:,1)  + rt0 )
-            gsss(:,:) =  zcof * tn_ice(:,:)
-            gu  (:,:) =  zcof * un(:,:,1)
-            gv  (:,:) =  zcof * vn(:,:,1)
-         ENDIF
-      ENDIF
-
-      ! ----------------------------------------------------------------------------- !
-      !      0   Mean SST, ice temperature and ocean currents over nfbulk pdt         !
-      ! ----------------------------------------------------------------------------- !
-      !
-      gsst(:,:) = gsst(:,:) + (tn(:,:,1) + rt0 )  
-      gsss(:,:) = gsss(:,:) + tn_ice(:,:)
-      gu  (:,:) = gu  (:,:) + un    (:,:,1)
-      gv  (:,:) = gv  (:,:) + vn    (:,:,1)
-
-      IF( MOD( kt - 1 , nfbulk ) == 0 ) THEN
-         !
-!        zsst(:,:) = gsst(:,:) / REAL( nfbulk, wp ) * tmask(:,:,1) ! mean sst in K
-!        zsss(:,:) = gsss(:,:) / REAL( nfbulk ) * tmask(:,:,1) ! mean tn_ice in K
-
-!        where ( zsst(:,:) .eq. 0.e0 ) zsst(:,:) = rt0     !lb vilain !!???
-!        where ( zsss(:,:) .eq. 0.e0 ) zsss(:,:) = rt0     !lb    //
-
-!!gm  better coded:
-         ! Caution set to rt0 over land, not 0 Kelvin (otherwise floating point exception in bulk computation) 
-         zcof =  1. / REAL( nfbulk, wp )
-         zsst(:,:) = gsst(:,:) * zcof * tmask(:,:,1) + rt0 * (1.- tmask(:,:,1))    ! mean sst in K
-         zsss(:,:) = gsss(:,:) * zcof * tmask(:,:,1) + rt0 * (1.- tmask(:,:,1))   ! mean tn_ice in K
-!!gm
-
-         zut(:,:) = 0.e0      !!gm not necessary but at least first and last column
-         zvt(:,:) = 0.e0
-         !            lb
-         ! Interpolation of surface current at T-point, zut and zvt :
-!        DO ji=2, jpi
-!           zut(ji,:) = 0.5*(gu(ji-1,:) + gu(ji,:)) / REAL( nfbulk )
-!        END DO
-!        !
-!        DO jj=2, jpj
-!           zvt(:,jj) = 0.5*(gv(:,jj-1) + gv(:,jj)) / REAL( nfbulk )
-!        END DO
-!!gm better coded
-         zcof =  0.5 / REAL( nfbulk, wp )
-         DO jj = 2, jpjm1
-            DO ji = 1, jpi
-               zut(ji,jj) = ( gu(ji-1,jj  ) + gu(ji,jj) ) * zcof
-               zvt(ji,jj) = ( gv(ji  ,jj-1) + gv(ji,jj) ) * zcof
-            END DO
-         END DO
-!!gm
-
-         CALL lbc_lnk( zut(:,:), 'T', -1. )         
-         CALL lbc_lnk( zvt(:,:), 'T', -1. )         
-
-         ! ----------------------------------------------------------------------------- !
-         !      I   Radiative FLUXES                                                     !
-         ! ----------------------------------------------------------------------------- !
-
-         !--- Ocean & Ice Albedo
-         alb_oce_os(:,:) = 0.   ;   alb_oce_cs(:,:) = 0.   !gm is it necessary ???
-         alb_ice_os(:,:) = 0.   ;   alb_ice_cs(:,:) = 0.
-         CALL flx_blk_albedo( alb_ice_os, alb_oce_os, alb_ice_cs, alb_oce_cs )
-
-         !--- Radiative fluxes over ocean
-         qsr_oce(:,:) = ( 1. - 0.066 ) * flxnow(:,:,5)                                 ! Solar Radiation
-         qlw_oce(:,:) = flxnow(:,:,6) - Stef*zsst(:,:)*zsst(:,:)*zsst(:,:)*zsst(:,:)   ! Long Waves (Infra-red)
-
-         !--- Radiative fluxes over ice
-         qsr_ice(:,:) = ( 1. - alb_ice_cs(:,:) ) * flxnow(:,:,5)                                  ! Solar Radiation
-         qlw_ice(:,:) = 0.95 * ( flxnow(:,:,6) - Stef*zsss(:,:)*zsss(:,:)*zsss(:,:)*zsss(:,:) )   ! Long Waves (Infra-red)
-         !-------------------------------------------------------------------------------!
-
-         ! ----------------------------------------------------------------------------- !
-         !     II    Turbulent FLUXES                                                    !
-         ! ----------------------------------------------------------------------------- !
-         !
-         ! scalar wind ( = | U10m - SSU | )
-         ! It is important to take into account the sea surface courant
-         !                lb
-         ! Now, wind components are provided on T-points within the netcdf input file.
-         ! Thus, the wind module is computded at T-points taking into account the sea
-
-         !--- Module of relative wind
-!        dUnormt(:,:) = sqrt( (flxnow(:,:,2) - zut(:,:))*(flxnow(:,:,2) - zut(:,:))  &
-!             &             + (flxnow(:,:,3) - zvt(:,:))*(flxnow(:,:,3) - zvt(:,:)) )
-!!gm  more efficient coding:
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zzu = flxnow(ji,jj,2) - zut(ji,jj)
-               zzv = flxnow(ji,jj,3) - zvt(ji,jj)
-               dUnormt(ji,jj) = SQRT( zzu*zzu + zzv*zzv )
-            END DO 
-         END DO 
-!!gm
-         !--- specific humidity at temp SST
-         qsatw(:,:) = 0.98*640380*exp(-5107.4/zsst(:,:))/rhoa
-         !
-         !--- specific humidity at temp tn_ice
-         qsat(:,:)  = 11637800*exp(-5897.8/zsss(:,:))/rhoa
-         !
-
-         ! CORE iterartive algo for computation of Cd, Ch, Ce at T-point :
-         ! ===============================================================
-         IF( ln_2m ) THEN
-            IF( kt == nit000 .AND. lwp )   THEN
-               WRITE(numout,*) 
-               WRITE(numout,*) '           Calling TURB_CORE_2Z for bulk transfert coefficients'
-            ENDIF
-            !! If air temp. and spec. hum. are given at different height (2m) than wind (10m) :
-            CALL TURB_CORE_2Z(2.,10.,zsst(:,:), flxnow(:,:,7), qsatw(:,:), flxnow(:,:,4), &
-               &              dUnormt(:,:), Cd(:,:), Ch(:,:), Ce(:,:), zt_zu(:,:), zq_zu(:,:))
-         ELSE
-            IF( kt == nit000 .AND. lwp )    THEN
-               WRITE(numout,*) 
-               WRITE(numout,*) '           Calling TURB_CORE_1Z for bulk transfert coefficients'
-            ENDIF
-            !! If air temp. and spec. hum. are given at same height than wind (10m) :
-            CALL TURB_CORE_1Z(10., zsst(:,:), flxnow(:,:,7), qsatw(:,:), flxnow(:,:,4),  &
-               &              dUnormt(:,:), Cd(:,:), Ch(:,:), Ce(:,:) )
-         ENDIF
-
-         !   II.1) Momentum over ocean and ice
-         !   ---------------------------------
-         ! Tau_x at T-point
-         tauxt(:,:) = rhoa*dUnormt(:,:)*( (1. - freeze(:,:))*Cd(:,:)*(flxnow(:,:,2) - zut(:,:))    &
-              &                          + freeze(:,:)*Cice*flxnow(:,:,2) ) !lb correct pour glace
-         ! Tau_y at T-point
-         tauyt(:,:) = rhoa*dUnormt(:,:)*( (1. - freeze(:,:))*Cd(:,:)*(flxnow(:,:,3) - zvt(:,:))    &
-              &                          + freeze(:,:)*Cice*flxnow(:,:,3) )
-         !
-         CALL lbc_lnk( tauxt(:,:), 'T', -1. )       !!gm seems not decessary at this point....
-         CALL lbc_lnk( tauyt(:,:), 'T', -1. )
-
-         !
-         !Tau_x at U-point
-         DO ji = 1, jpim1
-            taux(ji,:) = 0.5*(tauxt(ji,:) + tauxt(ji+1,:))
-         END DO
-         !
-         ! Tau_y at V-point
-         DO jj = 1, jpjm1
-            tauy(:,jj) = 0.5*(tauyt(:,jj) + tauyt(:,jj+1))
-         END DO
-
-         !
-         !   II.2) Turbulent fluxes over ocean
-         !   ---------------------------------
-         !
-         IF( ln_2m ) THEN
-            !!
-            !! Values of temp. and hum. adjusted to 10m must be used instead of 2m values
-            !! Sensible Heat :    ! right sign for ocean
-            qsb_oce(:,:) = rhoa*cp*Ch(:,:)*(zt_zu(:,:) - zsst(:,:))*dUnormt(:,:)
-            !!
-            !! Latent Heat :      ! wrong sign for ocean
-            evap(:,:)    = rhoa*Ce(:,:)*(qsatw(:,:) - zq_zu(:,:))*dUnormt(:,:)
-            !!
-         ELSE
-            !!
-            !! Sensible Heat :    ! right sign for ocean
-            qsb_oce(:,:) = rhoa*cp*Ch(:,:)*(flxnow(:,:,7) - zsst(:,:))*dUnormt(:,:)
-            !!
-            !! Latent Heat :      ! wrong sign for ocean
-            evap(:,:)    = rhoa*Ce(:,:)*(qsatw(:,:) - flxnow(:,:,4))*dUnormt(:,:)
-            !!
-         END IF
-         !!
-         qla_oce(:,:) =  -Lv * evap(:,:) ! right sign for ocean
-         
-         ! 
-         !   II.3) Turbulent fluxes over ice
-         !   -------------------------------
-         ! 
-         ! Sensible Heat :
-         qsb_ice(:,:) = rhoa*cp*Cice*( flxnow(:,:,7) - zsss(:,:) )*dUnormt(:,:) !lb     use
-         !                                                                    !lb   dUnormt???
-         ! Latent Heat :                                                      !lb or rather Unormt?
-         qla_ice(:,:) = Ls*rhoa*Cice*( flxnow(:,:,4) - qsat(:,:) )*dUnormt(:,:)
-         !
-         !-------------------------------------------------------------------------------------
-
-
-         ! ----------------------------------------------------------------------------- !
-         !     III    Total FLUXES                                                       !
-         ! ----------------------------------------------------------------------------- !
-         !
-         !   III.1) Downward Non Solar flux over ocean
-         !   -----------------------------------------
-         qnsr_oce(:,:) = qlw_oce(:,:) + qsb_oce(:,:) + qla_oce(:,:)
-         !
-         !   III.1) Downward Non Solar flux over ice
-         !   ---------------------------------------
-         qnsr_ice(:,:) = qlw_ice(:,:) + qsb_ice(:,:) + qla_ice(:,:) 
-         !
-         !-------------------------------------------------------------------------------!
-
-         ! 6. TOTAL NON SOLAR SENSITIVITY 
-
-         dqlw_ice(:,:)= 4.0*0.95*Stef*zsss(:,:)*zsss(:,:)*zsss(:,:)
-
-         ! d qla_ice/ d zsss
-         dqla_ice(:,:) = -Ls*Cice*11637800 &
-              * (-5897.8)/(zsss(:,:)*zsss(:,:)) &
-              * exp(-5897.8/zsss(:,:)) * dUnormt(:,:)
-
-         ! d qsb_ice/ d zsss
-         dqsb_ice(:,:) = rhoa * cp * Cice * dUnormt(:,:)
-
-         dqns_ice(:,:) = - ( dqlw_ice(:,:) + dqsb_ice(:,:) + dqla_ice(:,:) )
-
-         !--------------------------------------------------------------------
-         ! FRACTION of net shortwave radiation which is not absorbed in the
-         ! thin surface layer and penetrates inside the ice cover
-         ! ( Maykut and Untersteiner, 1971 ; Ebert and Curry, 1993 )
-
-         catm1(:,:) = 1.0 - 0.3
-         fr1_i0(:,:) = 0.18 * ( 1.0 - catm1(:,:) ) + 0.35 * catm1(:,:)
-         fr2_i0(:,:) = 0.82 * ( 1.0 - catm1(:,:) ) + 0.65 * catm1(:,:)
-
-         !  Total  PRECIPITATION (kg/m2/s)
-         tprecip(:,:) = alpha_precip*flxnow(:,:,1) 
-         ! rename precipitation for freshwater budget calculations:
-!         watm(:,:) =  flxnow(:,:,1)*1000
-         watm(:,:) =  flxnow(:,:,1)*rday
-         !
-
-         !  SNOW PRECIPITATION  (kg/m2/s)
-         sprecip(:,:) =  alpha_precip*flxnow(:,:,8) 
-
-         !---------------------------------------------------------------------
-
-         CALL lbc_lnk( taux (:,:)    , 'U', -1. )
-         CALL lbc_lnk( tauy (:,:)    , 'V', -1. )
-         CALL lbc_lnk( qsr_oce (:,:) , 'T', 1. )
-         CALL lbc_lnk( qnsr_oce(:,:) , 'T', 1. )
-         CALL lbc_lnk( qsr_ice (:,:) , 'T', 1. )
-         CALL lbc_lnk( qnsr_ice(:,:) , 'T', 1. )
-         CALL lbc_lnk( qla_ice (:,:) , 'T', 1. )
-         CALL lbc_lnk( dqns_ice(:,:) , 'T', 1. )
-         CALL lbc_lnk( dqla_ice(:,:) , 'T', 1. )
-         CALL lbc_lnk( fr1_i0  (:,:) , 'T', 1. )
-         CALL lbc_lnk( fr2_i0  (:,:) , 'T', 1. )
-         CALL lbc_lnk( tprecip (:,:) , 'T', 1. )
-         CALL lbc_lnk( sprecip (:,:) , 'T', 1. )
-         CALL lbc_lnk( evap    (:,:) , 'T', 1. )
-         !!
-         !!
-         !!   NEVER mask the windstress!!
-         qsr_oce (:,:) = qsr_oce (:,:)*tmask(:,:,1)
-         qnsr_oce(:,:) = qnsr_oce(:,:)*tmask(:,:,1)
-         qsr_ice (:,:) = qsr_ice (:,:)*tmask(:,:,1)
-         qnsr_ice(:,:) = qnsr_ice(:,:)*tmask(:,:,1)
-         qla_ice (:,:) = qla_ice (:,:)*tmask(:,:,1)
-         dqns_ice(:,:) = dqns_ice(:,:)*tmask(:,:,1)
-         dqla_ice(:,:) = dqla_ice(:,:)*tmask(:,:,1)
-         fr1_i0  (:,:) = fr1_i0  (:,:)*tmask(:,:,1)
-         fr2_i0  (:,:) = fr2_i0  (:,:)*tmask(:,:,1)
-         tprecip (:,:) = tprecip (:,:)*tmask(:,:,1)
-         sprecip (:,:) = sprecip (:,:)*tmask(:,:,1)
-         evap    (:,:) = evap    (:,:)*tmask(:,:,1)
-         gsst(:,:) = 0.e0
-         gsss(:,:) = 0.e0
-         gu  (:,:) = 0.e0
-         gv  (:,:) = 0.e0
-
-         !   Degugging print (A.M. Treguier)       
-         !      write (55) taux, tauy, qnsr_oce, qsb_ice, qnsr_ice, qla_ice, dqns_ice &
-         !  &     , dqla_ice, fr1_i0, fr2_i0, qlw_oce, qla_oce, qsb_oce, evap
-         !      write(numout,*) 'written 14 arrays on unit fort.55'
-
-
-      ENDIF
-
-      ! ------------------- !
-      ! Last call kt=nitend !
-      ! ------------------- !
-
-      ! Closing of the numflx file (required in mpp)
-
-      IF( kt == nitend ) THEN
-         DO ji=1, jpfile 
-            CALL iom_close(numflxall(ji))
-         END DO
-      ENDIF
-      IF ( lrst_oce ) CALL core_rst( kt, 'WRITE' )
-
-   END SUBROUTINE flx
-
-   SUBROUTINE TURB_CORE_1Z(zu, sst, T_a, q_sat, q_a,   &
-      &                        dU, Cd, Ch, Ce   )
-      !!----------------------------------------------------------------------
-      !!                      ***  ROUTINE  turb_core  ***
-      !!
-      !! ** Purpose :   Computes turbulent transfert coefficients of surface
-      !!                fluxes according to Large & Yeager (2004)
-      !!
-      !! ** Method  :   I N E R T I A L   D I S S I P A T I O N   M E T H O D
-      !!      Momentum, Latent and sensible heat exchange coefficients
-      !!      Caution: this procedure should only be used in cases when air
-      !!      temperature (T_air), air specific humidity (q_air) and wind (dU)
-      !!      are provided at the same height 'zzu'!
-      !!
-      !! References :
-      !!      Large & Yeager, 2004 : ???
-      !! History :
-      !!        !  XX-XX  (???     )  Original code
-      !!   9.0  !  05-08  (L. Brodeau) Rewriting and optimization
-      !!----------------------------------------------------------------------
-      !! * Arguments
-
-      REAL(wp), INTENT(in) :: zu                 ! altitude of wind measurement       [m]
-      REAL(wp), INTENT(in), DIMENSION(jpi,jpj) ::  &
-         sst,       &       ! sea surface temperature         [Kelvin]
-         T_a,       &       ! potential air temperature       [Kelvin]
-         q_sat,     &       ! sea surface specific humidity   [kg/kg]
-         q_a,       &       ! specific air humidity           [kg/kg]
-         dU                 ! wind module |U(zu)-U(0)|        [m/s]
-      REAL(wp), intent(out), DIMENSION(jpi,jpj)  :: &
-         Cd,    &                ! transfert coefficient for momentum       (tau)
-         Ch,    &                ! transfert coefficient for temperature (Q_sens)
-         Ce                      ! transfert coefficient for evaporation  (Q_lat)
-
-      !! * Local declarations
-      REAL(wp), DIMENSION(jpi,jpj)  ::   &
-         dU10,        &       ! dU                                   [m/s]
-         dT,          &       ! air/sea temperature differeence      [K]
-         dq,          &       ! air/sea humidity difference          [K]
-         Cd_n10,      &       ! 10m neutral drag coefficient
-         Ce_n10,      &       ! 10m neutral latent coefficient
-         Ch_n10,      &       ! 10m neutral sensible coefficient
-         sqrt_Cd_n10, &       ! root square of Cd_n10
-         sqrt_Cd,     &       ! root square of Cd
-         T_vpot,      &       ! virtual potential temperature        [K]
-         T_star,      &       ! turbulent scale of tem. fluct.
-         q_star,      &       ! turbulent humidity of temp. fluct.
-         U_star,      &       ! turb. scale of velocity fluct.
-         L,           &       ! Monin-Obukov length                  [m]
-         zeta,        &       ! stability parameter at height zu
-         U_n10,       &       ! neutral wind velocity at 10m         [m]   
-         xlogt, xct, zpsi_h, zpsi_m
-      !!
-      INTEGER :: j_itt
-      INTEGER, PARAMETER :: nb_itt = 3
-      INTEGER, DIMENSION(jpi,jpj)  ::   &
-         stab         ! 1st guess stability test integer
-
-      REAL(wp), PARAMETER ::                        &
-         grav   = 9.8,          &  ! gravity                       
-         kappa  = 0.4              ! von Karman s constant
-
-      !! * Start
-      !! Air/sea differences
-      dU10 = max(0.5, dU)     ! we don't want to fall under 0.5 m/s
-      dT = T_a - sst          ! assuming that T_a is allready the potential temp. at zzu
-      dq = q_a - q_sat
-      !!    
-      !! Virtual potential temperature
-      T_vpot = T_a*(1. + 0.608*q_a)
-      !!
-      !! Neutral Drag Coefficient
-      stab    = 0.5 + sign(0.5,dT)    ! stable : stab = 1 ; unstable : stab = 0 
-      Cd_n10  = 1E-3 * ( 2.7/dU10 + 0.142 + dU10/13.09 )    !   L & Y eq. (6a)
-      sqrt_Cd_n10 = sqrt(Cd_n10)
-      Ce_n10  = 1E-3 * ( 34.6 * sqrt_Cd_n10 )               !   L & Y eq. (6b)
-      Ch_n10  = 1E-3*sqrt_Cd_n10*(18*stab + 32.7*(1-stab)) !   L & Y eq. (6c), (6d)
-      !!
-      !! Initializing transfert coefficients with their first guess neutral equivalents :
-      Cd = Cd_n10 ;  Ce = Ce_n10 ;  Ch = Ch_n10 ;  sqrt_Cd = sqrt(Cd)
-
-      !! * Now starting iteration loop
-      DO j_itt=1, nb_itt
-         !! Turbulent scales :
-         U_star  = sqrt_Cd*dU10                !   L & Y eq. (7a)
-         T_star  = Ch/sqrt_Cd*dT               !   L & Y eq. (7b)
-         q_star  = Ce/sqrt_Cd*dq               !   L & Y eq. (7c)
-
-         !! Estimate the Monin-Obukov length :
-         L  = (U_star**2)/( kappa*grav*(T_star/T_vpot + q_star/(q_a + 1./0.608)) )
-
-         !! Stability parameters :
-         zeta = zu/L ;  zeta   = sign( min(abs(zeta),10.0), zeta )
-         zpsi_h = psi_h(zeta)
-         zpsi_m = psi_m(zeta)
-
-         !! Shifting the wind speed to 10m and neutral stability :
-         U_n10 = dU10*1./(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m)) !  L & Y eq. (9a)
-
-         !! Updating the neutral 10m transfer coefficients :
-         Cd_n10  = 1E-3 * (2.7/U_n10 + 0.142 + U_n10/13.09)              !  L & Y eq. (6a)
-         sqrt_Cd_n10 = sqrt(Cd_n10)
-         Ce_n10  = 1E-3 * (34.6 * sqrt_Cd_n10)                           !  L & Y eq. (6b)
-         stab    = 0.5 + sign(0.5,zeta)
-         Ch_n10  = 1E-3*sqrt_Cd_n10*(18.*stab + 32.7*(1-stab))           !  L & Y eq. (6c), (6d)
-
-         !! Shifting the neutral  10m transfer coefficients to ( zu , zeta ) :
-         !!
-         xct = 1. + sqrt_Cd_n10/kappa*(log(zu/10) - zpsi_m)
-         Cd  = Cd_n10/(xct*xct) ;  sqrt_Cd = sqrt(Cd)
-         !!
-         xlogt = log(zu/10.) - zpsi_h
-         !!
-         xct = 1. + Ch_n10*xlogt/kappa/sqrt_Cd_n10
-         Ch  = Ch_n10*sqrt_Cd/sqrt_Cd_n10/xct
-         !!
-         xct = 1. + Ce_n10*xlogt/kappa/sqrt_Cd_n10
-         Ce  = Ce_n10*sqrt_Cd/sqrt_Cd_n10/xct
-         !!
-      END DO
-      !!
-    END SUBROUTINE TURB_CORE_1Z
-
-
-    SUBROUTINE TURB_CORE_2Z(zt, zu, sst, T_zt, q_sat, q_zt, dU, Cd, Ch, Ce, T_zu, q_zu)
-      !!----------------------------------------------------------------------
-      !!                      ***  ROUTINE  turb_core  ***
-      !!
-      !! ** Purpose :   Computes turbulent transfert coefficients of surface 
-      !!                fluxes according to Large & Yeager (2004).
-      !!
-      !! ** Method  :   I N E R T I A L   D I S S I P A T I O N   M E T H O D
-      !!      Momentum, Latent and sensible heat exchange coefficients
-      !!      Caution: this procedure should only be used in cases when air
-      !!      temperature (T_air) and air specific humidity (q_air) are at 2m
-      !!      whereas wind (dU) is at 10m.
-      !!
-      !! References :
-      !!      Large & Yeager, 2004 : ???
-      !! History :
-      !!   9.0  !  06-12  (L. Brodeau) Original code for 2Z
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      REAL(wp), INTENT(in)   :: &
-         zt,      &     ! height for T_zt and q_zt                   [m]
-         zu             ! height for dU                              [m]
-      REAL(wp), INTENT(in), DIMENSION(jpi,jpj) ::  &
-         sst,      &     ! sea surface temperature              [Kelvin]
-         T_zt,     &     ! potential air temperature            [Kelvin]
-         q_sat,    &     ! sea surface specific humidity         [kg/kg]
-         q_zt,     &     ! specific air humidity                 [kg/kg]
-         dU              ! relative wind module |U(zu)-U(0)|       [m/s]
-      REAL(wp), INTENT(out), DIMENSION(jpi,jpj)  ::  &
-         Cd,       &     ! transfer coefficient for momentum         (tau)
-         Ch,       &     ! transfer coefficient for sensible heat (Q_sens)
-         Ce,       &     ! transfert coefficient for evaporation   (Q_lat)
-         T_zu,     &     ! air temp. shifted at zu                     [K]
-         q_zu            ! spec. hum.  shifted at zu               [kg/kg]
-
-      !! * Local declarations
-      REAL(wp), DIMENSION(jpi,jpj) ::  &
-         dU10,        &     ! dU                                [m/s]
-         dT,          &     ! air/sea temperature differeence   [K]
-         dq,          &     ! air/sea humidity difference       [K]
-         Cd_n10,      &     ! 10m neutral drag coefficient
-         Ce_n10,      &     ! 10m neutral latent coefficient
-         Ch_n10,      &     ! 10m neutral sensible coefficient
-         sqrt_Cd_n10, &     ! root square of Cd_n10
-         sqrt_Cd,     &     ! root square of Cd
-         T_vpot_u,    &     ! virtual potential temperature        [K]
-         T_star,      &     ! turbulent scale of tem. fluct.
-         q_star,      &     ! turbulent humidity of temp. fluct.
-         U_star,      &     ! turb. scale of velocity fluct.
-         L,           &     ! Monin-Obukov length                  [m]
-         zeta_u,      &     ! stability parameter at height zu
-         zeta_t,      &     ! stability parameter at height zt
-         U_n10,       &     ! neutral wind velocity at 10m        [m]
-         xlogt, xct, zpsi_hu, zpsi_ht, zpsi_m
-
-      INTEGER :: j_itt
-      INTEGER, PARAMETER :: nb_itt = 3   ! number of itterations
-      INTEGER, DIMENSION(jpi,jpj) :: &
-           &     stab                ! 1st stability test integer
-      REAL(wp), PARAMETER ::                        &
-         grav   = 9.8,      &  ! gravity                       
-         kappa  = 0.4          ! von Karman's constant
-
-      !!  * Start
-
-      !! Initial air/sea differences
-      dU10 = max(0.5, dU)      !  we don't want to fall under 0.5 m/s
-      dT = T_zt - sst 
-      dq = q_zt - q_sat
-
-      !! Neutral Drag Coefficient :
-      stab = 0.5 + sign(0.5,dT)                 ! stab = 1  if dT > 0  -> STABLE
-      Cd_n10  = 1E-3*( 2.7/dU10 + 0.142 + dU10/13.09 ) 
-      sqrt_Cd_n10 = sqrt(Cd_n10)
-      Ce_n10  = 1E-3*( 34.6 * sqrt_Cd_n10 )
-      Ch_n10  = 1E-3*sqrt_Cd_n10*(18*stab + 32.7*(1 - stab))
-
-      !! Initializing transf. coeff. with their first guess neutral equivalents :
-      Cd = Cd_n10 ;  Ce = Ce_n10 ;  Ch = Ch_n10 ;  sqrt_Cd = sqrt(Cd)
-
-      !! Initializing z_u values with z_t values :
-      T_zu = T_zt ;  q_zu = q_zt
-
-      !!  * Now starting iteration loop
-      DO j_itt=1, nb_itt
-         dT = T_zu - sst ;  dq = q_zu - q_sat ! Updating air/sea differences
-         T_vpot_u = T_zu*(1. + 0.608*q_zu)    ! Updating virtual potential temperature at zu
-         U_star = sqrt_Cd*dU10                ! Updating turbulent scales :   (L & Y eq. (7))
-         T_star  = Ch/sqrt_Cd*dT              !
-         q_star  = Ce/sqrt_Cd*dq              !
-         !!
-         L = (U_star*U_star) &                ! Estimate the Monin-Obukov length at height zu
-              & / (kappa*grav/T_vpot_u*(T_star*(1.+0.608*q_zu) + 0.608*T_zu*q_star))
-         !! Stability parameters :
-         zeta_u  = zu/L  ;  zeta_u = sign( min(abs(zeta_u),10.0), zeta_u )
-         zeta_t  = zt/L  ;  zeta_t = sign( min(abs(zeta_t),10.0), zeta_t )
-         zpsi_hu = psi_h(zeta_u)
-         zpsi_ht = psi_h(zeta_t)
-         zpsi_m  = psi_m(zeta_u)
-         !!
-         !! Shifting the wind speed to 10m and neutral stability : (L & Y eq.(9a))
-!        U_n10 = dU10/(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - psi_m(zeta_u)))
-         U_n10 = dU10/(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m))
-         !!
-         !! Shifting temperature and humidity at zu :          (L & Y eq. (9b-9c))
-!        T_zu = T_zt - T_star/kappa*(log(zt/zu) + psi_h(zeta_u) - psi_h(zeta_t))
-         T_zu = T_zt - T_star/kappa*(log(zt/zu) + zpsi_hu - zpsi_ht)
-!        q_zu = q_zt - q_star/kappa*(log(zt/zu) + psi_h(zeta_u) - psi_h(zeta_t))
-         q_zu = q_zt - q_star/kappa*(log(zt/zu) + zpsi_hu - zpsi_ht)
-         !!
-         !! q_zu cannot have a negative value : forcing 0
-         stab = 0.5 + sign(0.5,q_zu) ;  q_zu = stab*q_zu
-         !!
-         !! Updating the neutral 10m transfer coefficients :
-         Cd_n10  = 1E-3 * (2.7/U_n10 + 0.142 + U_n10/13.09)    ! L & Y eq. (6a)
-         sqrt_Cd_n10 = sqrt(Cd_n10)
-         Ce_n10  = 1E-3 * (34.6 * sqrt_Cd_n10)                 ! L & Y eq. (6b)
-         stab    = 0.5 + sign(0.5,zeta_u)
-         Ch_n10  = 1E-3*sqrt_Cd_n10*(18.*stab + 32.7*(1-stab)) ! L & Y eq. (6c-6d)
-         !!
-         !!
-         !! Shifting the neutral 10m transfer coefficients to (zu,zeta_u) :
-!        xct = 1. + sqrt_Cd_n10/kappa*(log(zu/10.) - psi_m(zeta_u))
-         xct = 1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m)
-         Cd = Cd_n10/(xct*xct) ; sqrt_Cd = sqrt(Cd)
-         !!
-!        xlogt = log(zu/10.) - psi_h(zeta_u)
-         xlogt = log(zu/10.) - zpsi_hu
-         !!
-         xct = 1. + Ch_n10*xlogt/kappa/sqrt_Cd_n10
-         Ch  = Ch_n10*sqrt_Cd/sqrt_Cd_n10/xct
-         !!
-         xct = 1. + Ce_n10*xlogt/kappa/sqrt_Cd_n10
-         Ce  = Ce_n10*sqrt_Cd/sqrt_Cd_n10/xct
-         !!
-         !!
-      END DO
-      !!
-    END SUBROUTINE TURB_CORE_2Z
-
-    FUNCTION psi_m(zta)   !! Psis, L & Y eq. (8c), (8d), (8e)
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: zta
-
-      REAL(wp), PARAMETER :: pi = 3.14159
-      REAL(wp), DIMENSION(jpi,jpj)             :: psi_m
-      REAL(wp), DIMENSION(jpi,jpj)             :: X2, X, stabit
-      X2 = sqrt(abs(1. - 16.*zta))  ;  X2 = max(X2 , 1.0) ;  X  = sqrt(X2)
-      stabit    = 0.5 + sign(0.5,zta)
-      psi_m = -5.*zta*stabit  &                                                  ! Stable
-           & + (1. - stabit)*(2*log((1. + X)/2) + log((1. + X2)/2) - 2*atan(X) + pi/2)  ! Unstable 
-    END FUNCTION psi_m
-
-    FUNCTION psi_h(zta)    !! Psis, L & Y eq. (8c), (8d), (8e)
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: zta
-
-      REAL(wp), DIMENSION(jpi,jpj)             :: psi_h
-      REAL(wp), DIMENSION(jpi,jpj)             :: X2, X, stabit
-      X2 = sqrt(abs(1. - 16.*zta))  ;  X2 = max(X2 , 1.) ;  X  = sqrt(X2)
-      stabit    = 0.5 + sign(0.5,zta)
-      psi_h = -5.*zta*stabit  &                                       ! Stable
-           & + (1. - stabit)*(2.*log( (1. + X2)/2. ))                 ! Unstable
-    END FUNCTION psi_h
-
-
-  SUBROUTINE flx_blk_albedo( palb , palcn , palbp , palcnp )
-    !!----------------------------------------------------------------------
-    !!               ***  ROUTINE flx_blk_albedo  ***
-    !!
-    !! ** Purpose :   Computation of the albedo of the snow/ice system
-    !!      as well as the ocean one
-    !!
-    !! ** Method  : - Computation of the albedo of snow or ice (choose the
-    !!      right one by a large number of tests
-    !!              - Computation of the albedo of the ocean
-    !!
-    !! References :
-    !!      Shine and Hendersson-Sellers 1985, JGR, 90(D1), 2243-2250.
-    !!
-    !! History :
-    !!  8.0   !  01-04  (LIM 1.0)
-    !!  8.5   !  03-07  (C. Ethe, G. Madec)  Optimization (old name:shine)
-    !!----------------------------------------------------------------------
-    !! * Modules used
-    USE ice                   ! ???
-
-    !! * Arguments
-    REAL(wp), DIMENSION(jpi,jpj), INTENT(out) ::  &
-         palb         , & !  albedo of ice under overcast sky
-         palcn        , & !  albedo of ocean under overcast sky
-         palbp        , & !  albedo of ice under clear sky
-         palcnp                  !  albedo of ocean under clear sky
-
-    !! * Local variables
-    INTEGER ::    &
-         ji, jj                   ! dummy loop indices
-    REAL(wp) ::   &
-         c1     = 0.05  , & ! constants values
-         c2     = 0.1   , &
-         albice = 0.50  , & !  albedo of melting ice in the arctic and antarctic (Shine & Hendersson-Sellers)
-         cgren  = 0.06  , & !  correction of the snow or ice albedo to take into account
-         !  effects of cloudiness (Grenfell & Perovich, 1984)
-         alphd  = 0.80  , & !  coefficients for linear interpolation used to compute
-         alphdi = 0.72  , & !  albedo between two extremes values (Pyane, 1972)
-         alphc  = 0.65  , &
-         zmue   = 0.4   , &     !  cosine of local solar altitude
-         zzero   = 0.0     ,  &
-         zone    = 1.0
-
-    REAL(wp) ::   &
-         zmue14         , & !  zmue**1.4
-         zalbpsnm       , & !  albedo of ice under clear sky when snow is melting
-         zalbpsnf       , & !  albedo of ice under clear sky when snow is freezing
-         zalbpsn        , & !  albedo of snow/ice system when ice is coverd by snow
-         zalbpic        , & !  albedo of snow/ice system when ice is free of snow
-         zithsn         , & !  = 1 for hsn >= 0 ( ice is cov. by snow ) ; = 0 otherwise (ice is free of snow)
-         zitmlsn        , & !  = 1 freezinz snow (sist >=rt0_snow) ; = 0 melting snow (sist<rt0_snow)
-         zihsc1         , & !  = 1 hsn <= c1 ; = 0 hsn > c1
-         zihsc2                   !  = 1 hsn >= c2 ; = 0 hsn < c2
-    REAL(wp), DIMENSION(jpi,jpj) ::  &
-         zalbfz         , & !  ( = alphdi for freezing ice ; = albice for melting ice )
-         zficeth                  !  function of ice thickness
-    LOGICAL , DIMENSION(jpi,jpj) ::  &
-         llmask
-    !!    to be included for without seaice
-    !!      REAL(wp), DIMENSION(jpi,jpj) ::   &  !:
-    !!      sist   ,   &  !: Sea-Ice Surface Temperature (Kelvin )
-    !!      hsnif  ,   &  !: Snow thickness
-    !!      hicif       !: Ice thickness
-    
-    !!---------------------------------------------------------------------
-
-    !-------------------------
-    !  Computation of  zficeth
-    !--------------------------
-
-    llmask = (hsnif == 0.0) .AND. ( sist >= rt0_ice )
-    WHERE ( llmask )   !  ice free of snow and melts
-       zalbfz = albice
-    ELSEWHERE
-       zalbfz = alphdi
-    END WHERE
-
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          IF( hicif(ji,jj) > 1.5 ) THEN
-             zficeth(ji,jj) = zalbfz(ji,jj)
-          ELSEIF( hicif(ji,jj) > 1.0  .AND. hicif(ji,jj) <= 1.5 ) THEN
-             zficeth(ji,jj) = 0.472 + 2.0 * ( zalbfz(ji,jj) - 0.472 ) * ( hicif(ji,jj) - 1.0 )
-          ELSEIF( hicif(ji,jj) > 0.05 .AND. hicif(ji,jj) <= 1.0 ) THEN
-             zficeth(ji,jj) = 0.2467 + 0.7049 * hicif(ji,jj)                                &
-                  &                    - 0.8608 * hicif(ji,jj) * hicif(ji,jj)                 &
-                  &                    + 0.3812 * hicif(ji,jj) * hicif(ji,jj) * hicif (ji,jj)
-          ELSE
-             zficeth(ji,jj) = 0.1 + 3.6 * hicif(ji,jj)
-          ENDIF
-       END DO
-    END DO
-
-    !-----------------------------------------------
-    !    Computation of the snow/ice albedo system
-    !-------------------------- ---------------------
-
-    !    Albedo of snow-ice for clear sky.
-    !-----------------------------------------------
-     DO jj = 1, jpj
-        DO ji = 1, jpi
-           !  Case of ice covered by snow.
-           !  melting snow
-           zihsc1       = 1.0 - MAX ( zzero , SIGN ( zone , - ( hsnif(ji,jj) - c1 ) ) )
-           zalbpsnm     = ( 1.0 - zihsc1 ) & 
-                * ( zficeth(ji,jj) + hsnif(ji,jj) * ( alphd - zficeth(ji,jj) ) / c1 ) &
-                &                 + zihsc1   * alphd
-          !  freezing snow
-           zihsc2       = MAX ( zzero , SIGN ( zone , hsnif(ji,jj) - c2 ) )
-           zalbpsnf     = ( 1.0 - zihsc2 ) * & 
-                ( albice + hsnif(ji,jj) * ( alphc - albice ) / c2 ) &
-                &                 + zihsc2   * alphc
-
-           zitmlsn      =  MAX ( zzero , SIGN ( zone , sist(ji,jj) - rt0_snow ) )
-           zalbpsn      =  zitmlsn * zalbpsnf + ( 1.0 - zitmlsn ) * zalbpsnm
-
-           !  Case of ice free of snow.
-           zalbpic      = zficeth(ji,jj)
-
-           ! albedo of the system
-           zithsn       = 1.0 - MAX ( zzero , SIGN ( zone , - hsnif(ji,jj) ) )
-           palbp(ji,jj) =  zithsn * zalbpsn + ( 1.0 - zithsn ) *  zalbpic
-        END DO
-     END DO
-
-     !    Albedo of snow-ice for overcast sky.
-     !----------------------------------------------
-     palb(:,:)   = palbp(:,:) + cgren
-
-     !--------------------------------------------
-     !    Computation of the albedo of the ocean
-     !-------------------------- -----------------
-
-
-     !  Parameterization of Briegled and Ramanathan, 1982
-     zmue14      = zmue**1.4
-     palcnp(:,:) = 0.05 / ( 1.1 * zmue14 + 0.15 )
-
-     !  Parameterization of Kondratyev, 1969 and Payne, 1972
-     palcn(:,:)  = 0.06
-
-   END SUBROUTINE flx_blk_albedo
-
-   SUBROUTINE core_rst( kt, cdrw )
-     !!---------------------------------------------------------------------
-     !!                   ***  ROUTINE ts_rst  ***
-     !!
-     !! ** Purpose : Read or write CORE specific variables ( gsss, gu, gv )
-     !!
-     !! ** Method  :
-     !!
-     !!----------------------------------------------------------------------
-     USE iom          ! move to top of flxmod to avoid duplication
-     USE restart      ! move to top of flxmod to avoid duplication
-     !
-     INTEGER         , INTENT(in) ::   kt         ! ocean time-step
-     CHARACTER(len=*), INTENT(in) ::   cdrw       ! "READ"/"WRITE" flag
-     !
-     !!----------------------------------------------------------------------
-     !
-     IF( TRIM(cdrw) == 'READ' ) THEN
-        IF( ln_rstart ) THEN
-              CALL iom_get( numror, jpdom_autoglo, 'gsss', gsss )
-              CALL iom_get( numror, jpdom_autoglo, 'gu', gu )
-              CALL iom_get( numror, jpdom_autoglo, 'gv', gv )
-        ENDIF ! gsss, gu, gv are initialized in the routine ( may be changed )
-     ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN
-        CALL iom_rstput( kt, nitrst, numrow, 'gsss', gsss )
-        CALL iom_rstput( kt, nitrst, numrow, 'gu', gu )
-        CALL iom_rstput( kt, nitrst, numrow, 'gv', gv )
-     ENDIF
-     !
-   END SUBROUTINE core_rst
Index: trunk/NEMO/OPA_SRC/SBC/flx_forced_daily.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flx_forced_daily.h90	(revision 873)
+++ 	(revision )
@@ -1,123 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                    ***  flx_forced_daily  ***
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   flx          : define the thermohaline fluxes for the ocean
-   !!                  in forced mode using flux formulation (not bulk)
-   !!                  (read in NetCDF file)
-   !!----------------------------------------------------------------------
-   !! * Modules used     C A U T I O N  already defined in flxmod.F90
-
-   !! * Module variables
-   INTEGER ::          &
-      numflx,          &  ! logical unit for surface fluxes data
-      ndayflx             ! new day for ecmwf flx forcing
-   REAL(wp), DIMENSION(jpi,jpj,3) ::   &
-      flxdta              ! 3 consecutive daily fluxes
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE flx( kt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE flx  ***
-      !!                   
-      !! ** Purpose :   provide the thermohaline fluxes (heat and freshwater) 
-      !!      to the ocean at each time step.
-      !!
-      !! ** Method  :   READ daily flux file in NetCDF files
-      !!      the net downward radiative flux qsr      1 (watt/m2)
-      !!      the net downward heat flux      q        2 (watt/m2)
-      !!      the net upward water            emp      3 (kg/m2/s)
-      !!      (evaporation - precipitation)
-      !!
-      !! History :
-      !!        !  90-03  (O. Marti and P. Dandin)  Original code
-      !!        !  92-07  (M. Imbard)
-      !!        !  96-11  (E. Guilyardi)  Daily AGCM input files
-      !!        !  99-11  (M. Imbard)  NetCDF FORMAT with io-ipsl
-      !!        !  00-10  (J.-P. Boulanger)  adjusted for reading any
-      !!                         daily wind stress data including a climatology
-      !!        !  01-09  (A. Lazar and C. Levy)  config with no ice model
-      !!   8.5  !  03-07  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Modules used
-      USE iom
-      USE flx_oce
-
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt ! ocean time step
-
-      !!---------------------------------------------------------------------
-
-
-      ! First call kt=nit000
-      ! --------------------
-
-      IF( kt == nit000 ) THEN
-         
-         ndayflx = 0   ! Initialization
-         ! open the file
-         IF(lwp) THEN
-            WRITE(numout,*) ' '
-            WRITE(numout,*) ' **** Routine flx_forced_daily.h90'
-            WRITE(numout,*) ' '
-            WRITE(numout,*) ' daily fluxes Q, Qsr, EmP'
-         ENDIF
-         CALL iom_open ( 'flx_1d.nc', numflx )
-
-      ENDIF
-
-      ! Read daily fluxes in flxdta(1,1,jm) 
-      !     1. Qtot    (w/m2)
-      !     2. Qsr     (w/m2)
-      !     3. emp     (kg/m2/s)
-      
-      IF( ndayflx /= nday ) THEN 
-         
-         ndayflx = nday
-                  
-         ! read Qtot
-         CALL iom_get ( numflx, jpdom_data, 'sohefldo', flxdta(:,:,1), nday_year )
-         ! read qsr
-         CALL iom_get ( numflx, jpdom_data, 'soshfldo', flxdta(:,:,2), nday_year )
-         ! read emp
-         CALL iom_get ( numflx, jpdom_data, 'sowaflup', flxdta(:,:,3), nday_year )
-
-         IF(lwp) WRITE (numout,*)'Lecture flx record :',nday
-
-         IF( nit000 == 1 ) THEN 
-            IF( kt == nit000 ) THEN
-               IF(lwp) THEN
-                  WRITE(numout,*)
-                  WRITE(numout,*) ' read daily fluxes ok'
-                  WRITE(numout,*)
-                  WRITE(numout,*) ' Q * .1, day: ',ndastp
-                  CALL prihre( flxdta(:,:,1),jpi,jpj,1,jpi,20,1,jpj,10,.1,numout )
-                  WRITE(numout,*)
-                  WRITE(numout,*) ' QSR * .1, day: ',ndastp
-                  CALL prihre( flxdta(:,:,2),jpi,jpj,1,jpi,20,1,jpj,10,.1,numout )
-                  WRITE(numout,*)
-                  WRITE(numout,*) ' E-P *86400, day: ',ndastp
-                  CALL prihre( flxdta(:,:,3),jpi,jpj,1,jpi,20,1,jpj,10,86400.,numout )
-                  WRITE(numout,*) ' '
-               ENDIF
-            ENDIF
-         ENDIF
-      ENDIF
-
-      p_qt (:,:) = flxdta(:,:,1)
-      p_qsr(:,:) = flxdta(:,:,2)
-      p_emp(:,:) = flxdta(:,:,3)
-  
-      ! Closing all files
-      ! -----------------
- 
-      IF( kt == nitend ) CALL iom_close ( numflx )
- 
-   END SUBROUTINE flx
Index: trunk/NEMO/OPA_SRC/SBC/flx_oasis_ice.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flx_oasis_ice.h90	(revision 873)
+++ 	(revision )
@@ -1,371 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                     ***  flx_oasis_ice.h90  ***
-   !!----------------------------------------------------------------------
-   !!   flx          : define the thermohaline fluxes for the ocean in
-   !!                  coupled ocean/atmosphere case with sea-ice
-   !!----------------------------------------------------------------------
-
-    REAL(wp) :: zcatm1  (1:jpi,1:jpj)  ! cloud fraction
-
-    REAL(wp) :: qsr_oce_recv   (1:jpi,1:jpj)
-    REAL(wp) :: qsr_ice_recv   (1:jpi,1:jpj)
-    REAL(wp) :: qnsr_oce_recv   (1:jpi,1:jpj)
-    REAL(wp) :: qnsr_ice_recv   (1:jpi,1:jpj)
-    REAL(wp) :: dqns_ice_recv   (1:jpi,1:jpj)
-    REAL(wp) :: tprecip_recv   (1:jpi,1:jpj)    
-    REAL(wp) :: sprecip_recv   (1:jpi,1:jpj)
-    REAL(wp) :: fr1_i0_recv   (1:jpi,1:jpj)    
-    REAL(wp) :: fr2_i0_recv   (1:jpi,1:jpj)    
-    REAL(wp) :: rrunoff_recv   (1:jpi,1:jpj)
-    REAL(wp) :: calving_recv   (1:jpi,1:jpj)
-#if defined key_cpl_ocevel
-    REAL(wp) :: un_weighted (1:jpi,1:jpj)
-    REAL(wp) :: vn_weighted (1:jpi,1:jpj)
-    REAL(wp) :: un_send (1:jpi,1:jpj)
-    REAL(wp) :: vn_send (1:jpi,1:jpj)
-#endif
-    REAL(wp) :: zrunriv (1:jpi,1:jpj)  ! river discharge into ocean
-    REAL(wp) :: zruncot (1:jpi,1:jpj)  ! continental discharge into ocean
-
-    REAL(wp) :: zpew    (1:jpi,1:jpj)  ! P-E over water
-    REAL(wp) :: zpei    (1:jpi,1:jpj)  ! P-E over ice
-    REAL(wp) :: zpsol   (1:jpi,1:jpj)  ! surface downward snow fall
-    REAL(wp) :: zevice  (1:jpi,1:jpj)  ! surface upward snow flux where sea ice
-
-   !! * Modules used     C A U T I O N  already defined in flxmod.F90
-   !!
-   !! * Module variables
-   LOGICAL :: lfirstf=.TRUE.
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
-   !! $Header$ 
-   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-  SUBROUTINE flx( kt )
-    !!---------------------------------------------------------------------
-    !!                    ***  ROUTINE flx  ***
-    !!                   
-    !! ** Purpose :   exchange the thermohaline fields (heat and freshwater) 
-    !!                with the atmosphere at each ocean time step.
-    !!
-    !! ** Method  :   Receive and send fluxes from/to a coupled atmospheric model 
-    !!
-    !! References : The OASIS User Guide, Version 3.0
-    !!
-    !! History :
-    !!   9.0  !  04-11  (R. Redler)  Original code
-    !!        !  05-05  (W. Park, N. Keenlyside) Separation of recv and pass variables (ref.icestp.F90)
-    !!        !  05-09  (W. Park, N. Keenlyside) Implementation of ocean velocity
-    !!        !  06-06  (E. Maisonnave, W. Park) Oasis mask adaptation
-    !!----------------------------------------------------------------------
-    !! * Modules used
-     USE in_out_manager, only: numout ! I/O manager
-     
-    !! * Arguments
-    INTEGER, INTENT( in  ) ::   kt    ! ocean time step
-
-    !! * Local declarations
-    INTEGER :: ji, jj
-
-#if defined key_cpl_ocevel
-    INTEGER :: ikchoix=-1
-#endif
-
-    INTEGER  :: var_id
-    INTEGER  :: info, date, n
-
-    REAL(wp) :: zfacflx
-    REAL(wp) :: zfacwat
-    !
-    !!---------------------------------------------------------------------
-    !
-    ! Initialization
-    ! --------------
-    !
-    ! caution, I presume that you have good UNIT system from coupler to OPA
-    ! that is :
-    ! watt/m2 for znsolc and zqsrc
-    ! kg/m2/s for evaporation, precipitation and runoff
-    zfacflx = 1.e0
-    zfacwat = 1.e3  ! convert [m/s] to [kg/m**2/s]
-    !
-    date = ( kt - nit000 ) * rdttra(1)
-    !
-    ! 1. Send coupling fields
-    !------------------------
-    !
-    var_id = send_id(1)
-    CALL cpl_prism_send ( var_id, date, tn(:,:,1)+rt0, info )      
-    var_id = send_id(2)
-    CALL cpl_prism_send ( var_id, date, 1.0-frld, info )      
-
-#if defined key_cpl_albedo
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-         if (((tn_ice(ji,jj).lt.50).or.(tn_ice(ji,jj).gt.400)) .and. frld(ji,jj).lt.1.) then
-         WRITE(numout,*) ' tn_ice, ERROR ',ji,jj, ' = ', tn_ice(ji,jj), &
-          ' qnsr_ice_recv=', qnsr_ice_recv(ji,jj), ' dqns_ice_recv=', dqns_ice_recv(ji,jj)
-          endif
-       ENDDO
-    ENDDO
-    var_id = send_id(3)
-    CALL cpl_prism_send ( var_id, date, tn_ice, info )      
-
-    var_id = send_id(4)
-    CALL cpl_prism_send ( var_id, date, alb_ice, info )
-#else
-    var_id = send_id(3)
-    CALL cpl_prism_send ( var_id, date, hicif, info )      
-
-    var_id = send_id(4)
-    CALL cpl_prism_send ( var_id, date, hsnif, info )      
-#endif
-
-#if defined key_cpl_ocevel
-    un_weighted = un(:,:,1) * frld + u_ice * ( 1. - frld )
-    vn_weighted = vn(:,:,1) * frld + v_ice * ( 1. - frld )
-    CALL repere ( un_weighted, vn_weighted, un_send, vn_send, ikchoix )
-
-    var_id = send_id(5)
-    CALL cpl_prism_send ( var_id, date, un_send, info )
-
-    var_id = send_id(6)
-    CALL cpl_prism_send ( var_id, date, vn_send, info )
-#endif
-    !
-    ! 2. Receive and build flux fields
-    !---------------------------------
-    !
-    ! I.) Precipitation/Evaporation
-    ! -----------------------------
-    !
-    ! ... a) P-E over water
-    !
-    var_id = recv_id(9)
-    CALL cpl_prism_recv ( var_id, date, zpew,  info )
-    !
-    ! ... b) P-E over ice
-    !
-    var_id = recv_id(10)
-    CALL cpl_prism_recv ( var_id, date, zpei, info )
-    !
-    ! ... c) Snow fall over water and ice
-    !
-    var_id = recv_id(11)
-    CALL cpl_prism_recv ( var_id, date, zpsol, info  )
-    !
-    ! ... d) Evaporation over ice (sublimination)
-    !
-    var_id = recv_id(12)
-    CALL cpl_prism_recv ( var_id, date, zevice, info )
-    !
-    ! calculate water flux (PE over water and ice)  (positive upward)
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          tprecip_recv(ji,jj) = ( zpew(ji,jj) + zpei(ji,jj) ) * tmask(ji,jj,1) * zfacwat
-       ENDDO
-    ENDDO
-    IF (ln_ctl) THEN
-      WRITE(numout,*) ' flx:tprecip_recv    - Minimum value is ', MINVAL(tprecip_recv)
-      WRITE(numout,*) ' flx:tprecip_recv    - Maximum value is ', MAXVAL(tprecip_recv)
-      WRITE(numout,*) ' flx:tprecip_recv    -     Sum value is ', SUM(tprecip_recv)
-    ENDIF
-
-    IF ( SUM(zpew*e1t*e2t) /= SUM(zpew*e1t*e2t*tmask(:,:,1)) ) THEN
-       WRITE(numout,*) ' flx: Forcing values outside Orca mask'
-       WRITE(numout,*) ' flx: Losses in water conservation'
-       WRITE(numout,*) ' flx:   Masked ', SUM(zpew*e1t*e2t*tmask(:,:,1))
-       WRITE(numout,*) ' flx: Unmasked ', SUM(zpew*e1t*e2t)
-       WRITE(numout,*) ' flx: Simulation STOP'
-       CALL FLUSH(numout)
-       STOP
-    END IF
-
-    !
-    ! calculate solid precipitation  (positive upward)
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          sprecip_recv(ji,jj) = ( zpsol(ji,jj) + zevice(ji,jj) ) * tmask(ji,jj,1) * zfacwat
-       ENDDO
-    ENDDO
-    !
-    !
-    ! II.) Solar fluxes
-    ! ------------------
-    !
-    ! ... a) surface net downward shortwave flux
-    !
-    var_id = recv_id(13)
-    CALL cpl_prism_recv ( var_id, date, qsr_oce_recv, info )
-
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          qsr_oce_recv(ji,jj) =  qsr_oce_recv(ji,jj) * tmask(ji,jj,1) * zfacflx
-       ENDDO
-    ENDDO
-    !
-    ! ... b) surface downward non-solar heat flux in air
-    !
-    var_id = recv_id(14)
-    CALL cpl_prism_recv ( var_id, date, qnsr_oce_recv, info)
-
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          qnsr_oce_recv(ji,jj) = qnsr_oce_recv(ji,jj) * tmask(ji,jj,1) * zfacflx
-       ENDDO
-    ENDDO
-    !
-    ! ... c) solar heat flux on sea ice
-    !
-    var_id = recv_id(15)
-    CALL cpl_prism_recv ( var_id, date, qsr_ice_recv, info )
-
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          qsr_ice_recv(ji,jj) = qsr_ice_recv(ji,jj) * tmask(ji,jj,1) * zfacflx
-       ENDDO
-    ENDDO
-    !
-    ! ... d) non-solar heat flux on sea ice
-    !
-    var_id = recv_id(16)
-    CALL cpl_prism_recv ( var_id, date, qnsr_ice_recv, info)
-
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          qnsr_ice_recv(ji,jj) = qnsr_ice_recv(ji,jj) * tmask(ji,jj,1) * zfacflx
-       ENDDO
-    ENDDO
-    !
-    ! ... e) non solar heat flux derivative over ice
-    !
-    var_id = recv_id(17)
-    CALL cpl_prism_recv ( var_id, date, dqns_ice_recv, info)
-
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          dqns_ice_recv(ji,jj) =  dqns_ice_recv(ji,jj) * tmask(ji,jj,1) * zfacflx
-       ENDDO
-    ENDDO
-    !
-    ! Since cloud cover catm not transmitted from atmosphere, init =0. 
-    !
-    catm(:, :) = 0.
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          zcatm1(ji,jj) = 1.0    - catm  (ji,jj)  !  fractional cloud cover
-       END DO
-    END DO
-
-    !  fraction of net shortwave radiation which is not absorbed in the 
-    !  thin surface layer and penetrates inside the ice cover 
-    !  ( Maykut and Untersteiner, 1971 ; Elbert anbd Curry, 1993 )
-    !------------------------------------------------------------------
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          fr1_i0_recv(ji,jj) = 0.18  * zcatm1(ji,jj) + 0.35 * catm(ji,jj) 
-          fr2_i0_recv(ji,jj) = 0.82  * zcatm1(ji,jj) + 0.65 * catm(ji,jj)
-       END DO
-    END DO
-    !
-#if defined key_cpl_discharge
-    ! III.) Runoff
-    ! -----------
-    !
-    ! ... a) ice discharge into ocean
-    !
-    var_id = recv_id(18)
-    CALL cpl_prism_recv ( var_id, date, calving_recv, info )
-
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          calving_recv(ji,jj) = calving_recv(ji,jj) * tmask(ji,jj,1) * zfacwat
-       ENDDO
-    ENDDO
-    !
-    ! ... b) river discharge into ocean
-    !
-    var_id = recv_id(19)
-    CALL cpl_prism_recv ( var_id, date, zrunriv, info )
-    !
-    ! ... c) continental discharge into ocean
-    !
-    var_id = recv_id(20)
-    CALL cpl_prism_recv ( var_id, date, zruncot, info)
-
-    DO jj = 1, jpj
-       DO ji = 1, jpi
-          rrunoff_recv(ji,jj) = ( zrunriv(ji,jj) + zruncot (ji,jj) ) * tmask(ji,jj,1) * zfacwat
-       ENDDO
-    ENDDO
-    !
-#else
-    calving_recv = 0.
-    rrunoff_recv = 0.
-#endif
-
-    ! Oasis mask shift and update lateral boundary conditions (E. Maisonnave)
-    ! not tested when mpp is used, W. Park
-!WSPTEST
-    qsr_oce_recv(jpi-1,:) = qsr_oce_recv(1,:)
-    qsr_ice_recv(jpi-1,:) = qsr_ice_recv(1,:)
-    qnsr_oce_recv(jpi-1,:) = qnsr_oce_recv(1,:)
-    qnsr_ice_recv(jpi-1,:) = qnsr_ice_recv(1,:)
-    dqns_ice_recv(jpi-1,:) = dqns_ice_recv(1,:)
-    tprecip_recv(jpi-1,:) = tprecip_recv(1,:)
-    sprecip_recv(jpi-1,:) = sprecip_recv(1,:)
-    fr1_i0_recv(jpi-1,:) = fr1_i0_recv(1,:)
-    fr2_i0_recv(jpi-1,:) = fr2_i0_recv(1,:)
-    rrunoff_recv(jpi-1,:) = rrunoff_recv(1,:)
-    calving_recv(jpi-1,:) = calving_recv(1,:)
-
-    qsr_oce = qsr_oce_recv
-    qsr_ice = qsr_ice_recv
-    qnsr_oce = qnsr_oce_recv
-    qnsr_ice = qnsr_ice_recv
-    dqns_ice = dqns_ice_recv
-    tprecip = tprecip_recv 
-    sprecip = sprecip_recv 
-    fr1_i0 = fr1_i0_recv  
-    fr2_i0 = fr2_i0_recv  
-!WSP    rrunoff = rrunoff_recv 
-!WSP    calving = calving_recv
-    rrunoff = 0.  !WSP runoff and calving included in tprecip
-    calving = 0.  !WSP
- 
-    IF(ln_ctl) THEN
-    write(numout,*) 'flx:qsr_oce     - Minimum value is ', minval(qsr_oce)
-    write(numout,*) 'flx:qsr_oce     - Maximum value is ', maxval(qsr_oce)
-    write(numout,*) 'flx:qsr_oce     -     Sum value is ', SUM(qsr_oce)
-
-    write(numout,*) 'flx:tprecip     - Minimum value is ', minval(tprecip)
-    write(numout,*) 'flx:tprecip     - Maximum value is ', maxval(tprecip)
-    write(numout,*) 'flx:tprecip     -     Sum value is ', SUM(tprecip)
-    ENDIF
-
-    CALL lbc_lnk( qsr_oce , 'T', 1. )
-    CALL lbc_lnk( qsr_ice , 'T', 1. )
-    CALL lbc_lnk( qnsr_oce, 'T', 1. )
-    CALL lbc_lnk( qnsr_ice, 'T', 1. )
-    CALL lbc_lnk( tprecip , 'T', 1. )
-    CALL lbc_lnk( sprecip , 'T', 1. )
-    CALL lbc_lnk( rrunoff , 'T', 1. )
-    CALL lbc_lnk( dqns_ice, 'T', 1. )
-    CALL lbc_lnk( calving , 'T', 1. )
-    CALL lbc_lnk( fr1_i0  , 'T', 1. )
-    CALL lbc_lnk( fr2_i0  , 'T', 1. )
-
-    IF(ln_ctl) THEN
-    write(numout,*) 'flx(af lbc_lnk):qsr_oce     - Minimum value is ', minval(qsr_oce)
-    write(numout,*) 'flx(af lbc_lnk):qsr_oce     - Maximum value is ', maxval(qsr_oce)
-    write(numout,*) 'flx(af lbc_lnk):qsr_oce     -     Sum value is ', SUM(qsr_oce)
-
-    write(numout,*) 'flx(af lbc_lnk):tprecip     - Minimum value is ', minval(tprecip)
-    write(numout,*) 'flx(af lbc_lnk):tprecip     - Maximum value is ', maxval(tprecip)
-    write(numout,*) 'flx(af lbc_lnk):tprecip     -     Sum value is ', SUM(tprecip)
-    ENDIF
-
-END SUBROUTINE flx
Index: trunk/NEMO/OPA_SRC/SBC/flx_oce.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flx_oce.F90	(revision 873)
+++ 	(revision )
@@ -1,77 +1,0 @@
-MODULE flx_oce
-   !!======================================================================
-   !!                 ***  MODULE  flx_oce  ***
-   !!        parameter and  variables defined in memory in forced mode
-   !!======================================================================
-   !! History :
-   !!   8.5  !  02-11  (C. Ethe)  F90: Free form and module
-   !!----------------------------------------------------------------------
-   !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE par_oce          ! ocean parameters
-# if defined key_lim3
-   USE par_ice
-# endif
-
-   IMPLICIT NONE
-   PRIVATE
-
-
-   !!----------------------------------------------------------------------
-   !! fluxes common variables
-   !!----------------------------------------------------------------------
-#if defined key_flx_forced_daily
-   !!----------------------------------------------------------------------
-   !! 'key_flx_forced_daily'
-   !!----------------------------------------------------------------------
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-      p_qt ,        &   !: total heat flux ( solar + non solar)
-      p_qsr,        &   !: solar heat flux
-      p_emp             !: evaporation minus precipitation            
-
-#elif defined key_lim3 || defined key_lim2 || defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_core
-
-#if defined key_lim3 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl)    ::   &  !:
-#else
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj)    ::   &  !:
-#endif
-      qsr_ice  ,      &  !: solar flux over ice
-      tn_ice   ,      &  !: ice surface temperature
-      qnsr_ice ,      &  !: total non solar heat flux (Longwave downward radiation) over ice
-      dqns_ice           !: total non solar sensibility over ice (LW+SEN+LA)
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj)    ::   &  !:
-      qsr_oce  ,      &  !: solar flux over ocean
-      qnsr_oce ,      &  !: total non solar heat flux (Longwave downward radiation) over ocean 
-      tprecip  ,      &  !: total precipitation ( or liquid precip minus evaporation in coupled mode)
-      sprecip  ,      &  !: solid (snow) precipitation
-      evap     ,      &  !: evaporation over ocean
-      fr1_i0   ,      &  !: 1st part of the fraction of sol. rad.  which penetrate inside the ice cover
-      fr2_i0             !: 2nd part of the fraction of sol. rad.  which penetrate inside the ice cover 
-#if ! defined key_coupled
-#if defined key_lim3 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl)    ::   &  !:
-#else
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj)    ::   &  !:
-#endif
-      qla_ice  ,      &  !: latent flux over ice  
-      dqla_ice           !: latent sensibility over ice
-#elif 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj)    ::   &  !:
-      rrunoff  ,      &  !: runoff
-      calving  ,      &  !: calving
-      alb_ice            !: albedo of ice      
-#endif
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option                                         Empty module
-   !!----------------------------------------------------------------------
-
-#endif
-
-   !!----------------------------------------------------------------------
-END MODULE flx_oce
Index: trunk/NEMO/OPA_SRC/SBC/flxblk.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flxblk.F90	(revision 873)
+++ 	(revision )
@@ -1,1370 +1,0 @@
-MODULE flxblk
-   !!======================================================================
-   !!                       ***  MODULE  flxblk  ***
-   !! Ocean forcing:  bulk thermohaline forcing of the ocean (or ice)
-   !!=====================================================================
-#if  defined key_flx_bulk_monthly || defined key_flx_bulk_daily 
-   !!----------------------------------------------------------------------
-   !!   'key_flx_bulk_monthly'   or                            MONTHLY bulk
-   !!   'key_flx_bulk_daily'                                     DAILY bulk
-   !!----------------------------------------------------------------------
-   !!   flx_blk        : thermohaline fluxes from bulk
-   !!   flx_blk_declin : solar declinaison
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE cpl_oce         ! ???
-   USE phycst          ! physical constants
-   USE daymod
-   USE blk_oce         ! bulk variables
-   USE flx_oce         ! forcings variables
-   USE ocfzpt          ! ???
-   USE in_out_manager
-   USE lbclnk
-   USE albedo
-   USE prtctl          ! Print control
-#if defined key_lim3
-   USE par_ice
-   USE ice
-#elif defined key_lim2
-   USE ice_2
-#endif
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Accessibility
-   PUBLIC flx_blk        ! routine called by flx.F90 
-
-   !! * Module variables
-   INTEGER, PARAMETER  ::   &
-      jpintsr = 24          ! number of time step between sunrise and sunset
-      !                     ! uses for heat flux computation
-   LOGICAL ::   &
-      lbulk_init = .TRUE.   ! flag, bulk initialization done or not)
-
-   REAL(wp), DIMENSION(jpi,jpj) ::   &
-      stauc            ,  &   ! cloud optical depth 
-      sbudyko   
-
-   !! * constants for bulk computation (flx_blk)
-   REAL(wp), DIMENSION(19)  ::  &
-      budyko                  ! BUDYKO's coefficient
-   ! BUDYKO's coefficient (cloudiness effect on LW radiation):
-   DATA budyko / 1.00, 0.98, 0.95, 0.92, 0.89, 0.86, 0.83, 0.80, 0.78, 0.75,  &
-      &          0.72, 0.69, 0.67, 0.64, 0.61, 0.58, 0.56, 0.53, 0.50 /
-   REAL(wp), DIMENSION(20)  :: &
-      tauco                  ! cloud optical depth coefficient
-   ! Cloud optical depth coefficient
-   DATA tauco / 6.6, 6.6, 7.0, 7.2, 7.1, 6.8, 6.5, 6.6, 7.1, 7.6,   &
-      &         6.6, 6.1, 5.6, 5.5, 5.8, 5.8, 5.6, 5.6, 5.6, 5.6 /
-   REAL(wp)  ::            &  ! constant values
-      zeps    = 1.e-20  ,  &
-      zeps0   = 1.e-13  ,  &
-      zeps1   = 1.e-06  ,  &
-      zzero   = 0.e0    ,  &
-      zone    = 1.0
-
-   !! * constants for solar declinaison computation (flx_blk_declin)
-   REAL(wp) ::                &
-      a0  =  0.39507671   ,   &  ! coefficients
-      a1  = 22.85684301   ,   &
-      a2  = -0.38637317   ,   &
-      a3  =  0.15096535   ,   &
-      a4  = -0.00961411   ,   &
-      b1  = -4.29692073   ,   &
-      b2  =  0.05702074   ,   &
-      b3  = -0.09028607   ,   &
-      b4  =  0.00592797
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-CONTAINS
-#if defined key_lim3
-
-   SUBROUTINE flx_blk( psst )
-      !!---------------------------------------------------------------------------
-      !!                     ***  ROUTINE flx_blk  ***
-      !!                 
-      !!  ** Purpose :   Computation of the heat fluxes at ocean and snow/ice
-      !!       surface the solar heat at ocean and snow/ice surfaces and the 
-      !!       sensitivity of total heat fluxes to the SST variations
-      !!         
-      !!  ** Method  :   The flux of heat at the ice and ocean surfaces are derived
-      !!       from semi-empirical ( or bulk ) formulae which relate the flux to 
-      !!       the properties of the surface and of the lower atmosphere. Here, we
-      !!       follow the work of Oberhuber, 1988   
-      !!
-      !!  ** Action  :   call flx_blk_albedo to compute ocean and ice albedo 
-      !!          computation of snow precipitation
-      !!          computation of solar flux at the ocean and ice surfaces
-      !!          computation of the long-wave radiation for the ocean and sea/ice
-      !!          computation of turbulent heat fluxes over water and ice
-      !!          computation of evaporation over water
-      !!          computation of total heat fluxes sensitivity over ice (dQ/dT)
-      !!          computation of latent heat flux sensitivity over ice (dQla/dT)
-      !!
-      !! History :
-      !!   8.0  !  97-06  (Louvain-La-Neuve)  Original code
-      !!   8.5  !  02-09  (C. Ethe , G. Madec )  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      REAL(wp), INTENT( in ), DIMENSION(jpi,jpj) ::   &
-         &                          psst      ! Sea Surface Temperature 
-
-      !! * Local variables
-      INTEGER  ::             &
-         ji, jj, jl, jt    ,  &  ! dummy loop indices
-         indaet            ,  &  !  = -1, 0, 1 for odd, normal and leap years resp.
-         iday              ,  &  ! integer part of day
-         indxb             ,  &  ! index for budyko coefficient
-         indxc                   ! index for cloud depth coefficient
-
-      REAL(wp)  ::            & 
-         zalat , zclat     ,  &  ! latitude in degrees 
-         zmt1, zmt2, zmt3  ,  &  ! tempory air temperatures variables
-         ztatm3, ztatm4    ,  &  ! power 3 and 4 of air temperature
-         z4tatm3           ,  &  ! 4 * ztatm3
-         zcmue             ,  &  ! cosine of local solar altitude
-         zcmue2            ,  &  ! root of zcmue1 
-         zscmue            ,  &  ! square-root of zcmue1 
-         zpcmue            ,  &  ! zcmue1**1.4
-         zdecl             ,  &  ! solar declination
-         zsdecl , zcdecl   ,  &  ! sine and cosine of solar declination 
-         zalbo             ,  &  ! albedo of sea-water
-         zalbi             ,  &  ! albedo of ice
-         ztamr             ,  &  ! air temperature minus triple point of water (rtt)
-         ztaevbk           ,  &  ! part of net longwave radiation
-         zevi , zevo       ,  &  ! vapour pressure of ice and ocean 
-         zind1,zind2,zind3 ,  &  ! switch for testing the values of air temperature
-         zinda             ,  &  ! switch for testing the values of sea ice cover
-         zpis2             ,  &  ! pi / 2
-         z2pi                    ! 2 * pi 
-
-      REAL(wp)  ::            & 
-         zxday             ,  &  ! day of year
-         zdist             ,  &  ! distance between the sun and the earth during the year
-         zdaycor           ,  &  ! corr. factor to take into account the variation of 
-         !                       ! zday when calc. the solar rad.    
-         zesi, zeso        ,  &  ! vapour pressure of ice and ocean at saturation
-         zesi2             ,  &  ! root of zesi 
-         zqsato            ,  &  ! humidity close to the ocean surface (at saturation)   
-         zqsati            ,  &  ! humidity close to the ice surface (at saturation) 
-         zqsati2           ,  &  ! root of  zqsati 
-         zdesidt           ,  &  ! derivative of zesi, function of ice temperature
-         zdteta            ,  &  ! diff. betw. sst and air temperature
-         zdeltaq           ,  &  ! diff. betw. spec. hum. and hum. close to the surface
-         ztvmoy, zobouks   ,  &  ! tempory scalars
-         zpsims, zpsihs, zpsils, zobouku, zxins, zpsimu ,  & 
-         zpsihu, zpsilu, zstab,zpsim, zpsih, zpsil      ,  & 
-         zvatmg, zcmn, zchn, zcln, zcmcmn, zdenum       ,  & 
-         zdtetar, ztvmoyr, zlxins, zcmn2, zchcm, zclcm , zcoef
-
-      REAL(wp)  ::            & 
-         zrhova            ,  &  ! air density per wind speed
-         zcsho , zcleo     ,  &  ! transfer coefficient over ocean
-         zcshi , zclei     ,  &  ! transfer coefficient over ice-free
-         zrhovacleo        ,  &  ! air density per wind speed per transfer coef.
-         zrhovacsho, zrhovaclei, zrhovacshi, & 
-         ztice3            ,  &  ! power 3 of ice temperature
-         zticemb, zticemb2 ,  &  ! tempory air temperatures variables
-         zdqlw_ice         ,  &  ! sensitivity of long-wave flux over ice
-         zdqsb_ice         ,  &  ! sensitivity of sensible heat flux over ice
-         zdqla_ice         ,  &  ! sensitivity of latent heat flux over ice
-         zdl, zdr                ! fractionnal part of latitude
-      REAL(wp), DIMENSION(jpi,jpj) :: & 
-         zpatm            ,  &   ! atmospheric pressure
-         zqatm            ,  &   ! specific humidity
-         zes              ,  &   ! vapour pressure at saturation
-         zev, zevsqr      ,  &   ! vapour pressure and his square-root
-         zrhoa            ,  &   ! air density
-         ztatm            ,  &   ! air temperature in Kelvins
-         zfrld            ,  &   ! fraction of sea ice cover 
-         zcatm1           ,  &   ! fraction of cloud
-         zcldeff                 ! correction factor to account cloud effect
-      REAL(wp), DIMENSION(jpi,jpj) ::   & 
-         zalbocsd         ,  &   ! albedo of ocean
-         zalboos          ,  &   ! albedo of ocean under overcast sky
-         zalbomu          ,  &   ! albedo of ocean when zcmue is 0.4
-         zqsro            ,  &   ! solar radiation over ocean
-         zqsrics          ,  &   ! solar radiation over ice under clear sky
-         zqsrios          ,  &   ! solar radiation over ice under overcast sky
-         zcldcor          ,  &   ! cloud correction
-         zlsrise, zlsset  ,  &   ! sunrise and sunset
-         zlmunoon         ,  &   ! local noon solar altitude
-         zdlha            ,  &   ! length of the ninstr segments of the solar day
-         zps              ,  &   ! sine of latitude per sine of solar decli.
-         zpc                     ! cosine of latitude per cosine of solar decli. 
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   & 
-         zalbics          ,  &   ! albedo of ice under clear sky
-         zalbios                 ! albedo of ice under overcast sky
-
-      REAL(wp), DIMENSION(jpi,jpj) ::   & 
-         zqlw_oce         ,  &   ! long-wave heat flux over ocean
-         zqla_oce         ,  &   ! latent heat flux over ocean
-         zqsb_oce                ! sensible heat flux over ocean
- 
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   & 
-         zqlw_ice         ,  &   ! long-wave heat flux over ice
-         zqla_ice         ,  &   ! latent heat flux over ice
-         zqsb_ice                ! sensible heat flux over ice
- 
-      REAL(wp), DIMENSION(jpi,jpj,jpintsr) ::    &
-         zlha             ,  &   ! local hour angle
-         zalbocs          ,  &   ! tempory var. of ocean albedo under clear sky
-         zsqsro           ,  &   ! tempory var. of solar rad. over ocean 
-         zsqsrics         ,  &   ! temp. var. of solar rad. over ice under clear sky
-         zsqsrios                ! temp. var. of solar rad. over ice under overcast sky
-      !!---------------------------------------------------------------------
-
-      !  Determine cloud optical depths as a function of latitude (Chou et al., 1981).
-      !  and the correction factor for taking into account  the effect of clouds 
-      !------------------------------------------------------
-      IF( lbulk_init ) THEN
-         DO jj = 1, jpj  
-            DO ji = 1 , jpi
-               zalat          = ( 90.e0 - ABS( gphit(ji,jj) ) ) /  5.e0
-               zclat          = ( 95.e0 -      gphit(ji,jj)   ) / 10.e0
-               indxb          = 1 + INT( zalat ) 
-               !  correction factor to account for the effect of clouds 
-               sbudyko(ji,jj) = budyko(indxb)  
-               indxc          = 1 + INT( zclat )  
-               zdl            = zclat - INT( zclat ) 
-               zdr            = 1.0 - zdl
-               stauc(ji,jj)   = zdr * tauco( indxc ) + zdl * tauco( indxc + 1 ) 
-            END DO
-         END DO
-         IF( nleapy == 1 ) THEN
-            yearday = 366.e0
-         ELSE IF( nleapy == 0 ) THEN
-            yearday = 365.e0
-         ELSEIF( nleapy == 30) THEN
-            yearday = 360.e0
-         ENDIF
-         lbulk_init = .FALSE.
-      ENDIF
-
-      zqlw_oce(:,:) = 0.e0
-      zqla_oce(:,:) = 0.e0
-      zqsb_oce(:,:) = 0.e0
-      zqlw_ice(:,:,:) = 0.e0
-      zqla_ice(:,:,:) = 0.e0
-      zqsb_ice(:,:,:) = 0.e0
-
-      zpis2       = rpi / 2.
-      z2pi        = 2. * rpi
-
- !CDIR NOVERRCHK
-      DO jj = 1, jpj
- !CDIR NOVERRCHK
-         DO ji = 1, jpi
-
-            ztatm (ji,jj) = 273.15 + tatm  (ji,jj)  !  air temperature in Kelvins 
-            zcatm1(ji,jj) = 1.0    - catm  (ji,jj)  !  fractional cloud cover
-            zfrld (ji,jj) = 1.0    - freeze(ji,jj)  !  fractional sea ice cover
-            zpatm(ji,jj)  = 101000.               !  pressure 
-      
-            !  Computation of air density, obtained from the equation of state for dry air. 
-            zrhoa(ji,jj) = zpatm(ji,jj) / ( 287.04 * ztatm(ji,jj) )
-      
-            !  zes : Saturation water vapour
-            ztamr = ztatm(ji,jj) - rtt
-            zmt1  = SIGN( 17.269, ztamr )
-            zmt2  = SIGN( 21.875, ztamr )
-            zmt3  = SIGN( 28.200, -ztamr )
-            zes(ji,jj) = 611.0 * EXP (  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &
-               &                      / ( ztatm(ji,jj) - 35.86  + MAX( zzero, zmt3 ) ) )
-
-            !  zev : vapour pressure  (hatm is relative humidity)  
-            zev(ji,jj)   = hatm(ji,jj) * zes(ji,jj) 
-            !  square-root of vapour pressure
-!CDIR NOVERRCHK
-            zevsqr(ji,jj) = SQRT( zev(ji,jj) * 0.01 )
-            !  zqapb  : specific humidity 
-            zqatm(ji,jj) = 0.622 * zev(ji,jj) / ( zpatm(ji,jj) - 0.378 * zev(ji,jj) )
-
-
-            !----------------------------------------------------
-            !   Computation of snow precipitation (Ledley, 1985) |
-            !----------------------------------------------------
-
-            zmt1  =   253.0 - ztatm(ji,jj)
-            zmt2  = ( 272.0 - ztatm(ji,jj) ) / 38.0 
-            zmt3  = ( 281.0 - ztatm(ji,jj) ) / 18.0
-            zind1 = MAX( zzero, SIGN( zone, zmt1 ) )
-            zind2 = MAX( zzero, SIGN( zone, zmt2 ) )
-            zind3 = MAX( zzero, SIGN( zone, zmt3 ) )
-            ! total precipitation
-            tprecip(ji,jj) = watm(ji,jj)
-            ! solid  (snow) precipitation
-            sprecip(ji,jj) = tprecip(ji,jj) *       &
-               &             (           zind1      &
-               &               + ( 1.0 - zind1 ) * ( zind2 * ( 0.5 + zmt2 ) + ( 1.0 - zind2 ) *  zind3 * zmt3 ) ) 
-         END DO
-      END DO
-
-      !----------------------------------------------------------
-      !   Computation of albedo (need to calculates heat fluxes)|
-      !-----------------------------------------------------------
-      
-      CALL flx_blk_albedo( zalbios, zalboos, zalbics, zalbomu )
-
-      !-------------------------------------
-      !   Computation of solar irradiance. |
-      !----------------------------------------
-      indaet   = 1  
-      !  compution of the day of the year at which the fluxes have to be calculate 
-      !--The date corresponds to the middle of the time step.
-      zxday=nday_year + rdtbs2/rday
-
-      iday   = INT( zxday )
-
-      IF(ln_ctl) CALL prt_ctl_info('declin : iday ', ivar1=iday, clinfo2=' nfbulk= ', ivar2=nfbulk)
-
-      !   computation of the solar declination, his sine and his cosine
-      CALL flx_blk_declin( indaet, iday, zdecl )
-      
-      zdecl    = zdecl * rad
-      zsdecl   = SIN( zdecl )
-      zcdecl   = COS( zdecl )
-      
-      !  correction factor added for computation of shortwave flux to take into account the variation of
-      !  the distance between the sun and the earth during the year (Oberhuber 1988)
-      zdist    = zxday * z2pi / yearday
-      zdaycor  = 1.0 + 0.0013 * SIN( zdist ) + 0.0342 * COS( zdist )
-
-!CDIR NOVERRCHK
-      DO jj = 1, jpj
-!CDIR NOVERRCHK
-         DO ji = 1, jpi
-            !  product of sine of latitude and sine of solar declination
-            zps     (ji,jj) = SIN( gphit(ji,jj) * rad ) * zsdecl
-            !  product of cosine of latitude and cosine of solar declination
-            zpc     (ji,jj) = COS( gphit(ji,jj) * rad ) * zcdecl
-            !  computation of the both local time of sunrise and sunset
-            zlsrise (ji,jj) = ACOS( - SIGN( zone, zps(ji,jj) ) * MIN( zone, SIGN( zone, zps(ji,jj) )  &
-               &                     * ( zps(ji,jj) / zpc(ji,jj) ) ) ) 
-            zlsset  (ji,jj) = - zlsrise(ji,jj)
-            !  dividing the solar day into jpintsr segments of length zdlha
-            zdlha   (ji,jj) = ( zlsrise(ji,jj) - zlsset(ji,jj) ) / REAL( jpintsr )
-            !  computation of the local noon solar altitude
-            zlmunoon(ji,jj) = ASIN ( ( zps(ji,jj) + zpc(ji,jj) ) ) / rad
-            
-            !  cloud correction taken from Reed (1977) (imposed lower than 1)
-            zcldcor (ji,jj) = MIN( zone, ( 1.e0 - 0.62 * catm(ji,jj) + 0.0019 * zlmunoon(ji,jj) ) )
-         END DO
-      END DO
-
-         !  Computation of solar heat flux at each time of the day between sunrise and sunset. 
-         !  We do this to a better optimisation of the code 
-         !------------------------------------------------------       
-      DO jl = 1, jpl
-
-!CDIR NOVERRCHK   
-      DO jt = 1, jpintsr   
-         zcoef = FLOAT( jt ) - 0.5
-!CDIR NOVERRCHK     
-         DO jj = 1, jpj
-!CDIR NOVERRCHK
-            DO ji = 1, jpi
-               !  local hour angle
-               zlha (ji,jj,jt) = COS ( zlsrise(ji,jj) - zcoef * zdlha(ji,jj) )
-
-               ! cosine of local solar altitude
-               zcmue              = MAX ( zzero ,   zps(ji,jj) + zpc(ji,jj) * zlha (ji,jj,jt)  )
-               zcmue2             = 1368.0 * zcmue * zcmue
-               zscmue             = SQRT ( zcmue )
-               zpcmue             = zcmue**1.4
-               ! computation of sea-water albedo (Payne, 1972)
-               zalbocs(ji,jj,jt)  = 0.05 / ( 1.1 * zpcmue + 0.15 )
-               zalbo              = zcatm1(ji,jj) * zalbocs(ji,jj,jt) + catm(ji,jj) * zalboos(ji,jj)
-               ! solar heat flux absorbed at ocean surfaces (Zillman, 1972)
-               zevo               = zev(ji,jj) * 1.0e-05
-               zsqsro(ji,jj,jt)   =  ( 1.0 - zalbo ) * zdlha(ji,jj) * zcmue2                &
-                                   / ( ( zcmue + 2.7 ) * zevo + 1.085 * zcmue +  0.10 )
-               !  solar heat flux absorbed at sea/ice surfaces 
-               !  Formulation of Shine and Crane, 1984 adapted for high albedo surfaces 
-
-               !  For clear sky        
-               zevi               = zevo
-               zalbi              = zalbics(ji,jj,jl)
-               zsqsrics(ji,jj,jt) =  ( 1.0 - zalbi ) * zdlha(ji,jj) * zcmue2                &
-                  &                / ( ( 1.0 + zcmue ) * zevi + 1.2 * zcmue + 0.0455 )
-
-               ! For overcast sky
-               zalbi              = zalbios(ji,jj,jl)
-               zsqsrios(ji,jj,jt) = zdlha(ji,jj) *                                                           &
-                  &                 ( ( 53.5 + 1274.5 * zcmue      ) *  zscmue * ( 1.0 - 0.996  * zalbi ) )  &
-                  &                 / (  1.0 + 0.139  * stauc(ji,jj) *           ( 1.0 - 0.9435 * zalbi ) )
-            END DO
-         END DO
-      END DO
-
-
-      !  Computation of daily (between sunrise and sunset) solar heat flux absorbed 
-      !  at the ocean and snow/ice surfaces.
-      !--------------------------------------------------------------------
-
-      zalbocsd(:,:) = 0.e0
-      zqsro   (:,:) = 0.e0
-      zqsrics (:,:) = 0.e0
-      zqsrios (:,:) = 0.e0
-
-      DO jt = 1, jpintsr 
-#   if defined key_vectopt_loop 
-         DO ji = 1, jpij  
-            zalbocsd(ji,1) = zalbocsd(ji,1) + zdlha   (ji,1) * zalbocs(ji,1,jt)   &
-               &                                             / MAX( 2.0 * zlsrise(ji,1) , zeps0 )
-            zqsro   (ji,1) = zqsro   (ji,1) + zsqsro  (ji,1,jt)
-            zqsrics (ji,1) = zqsrics (ji,1) + zsqsrics(ji,1,jt)
-            zqsrios (ji,1) = zqsrios (ji,1) + zsqsrios(ji,1,jt)
-         END DO
-#  else
-         DO jj = 1, jpj
-            DO ji = 1, jpi  
-               zalbocsd(ji,jj) = zalbocsd(ji,jj) + zdlha(ji,jj) * zalbocs(ji,jj,jt)   &
-                  &                                              / MAX( 2.0 * zlsrise(ji,jj) , zeps0 )
-               zqsro  (ji,jj)  = zqsro   (ji,jj) + zsqsro  (ji,jj,jt)
-               zqsrics(ji,jj)  = zqsrics (ji,jj) + zsqsrics(ji,jj,jt)
-               zqsrios(ji,jj)  = zqsrios (ji,jj) + zsqsrios(ji,jj,jt)
-            END DO
-         END DO
-#  endif
-      END DO
-
-      DO jj = 1, jpj
-         DO ji = 1, jpi 
-
-            !------------------------------------------- 
-            !  Computation of shortwave radiation.
-            !-------------------------------------------
-
-            ! the solar heat flux absorbed at ocean and snow/ice surfaces
-            !------------------------------------------------------------
-
-            ! For snow/ice 
-            qsr_ice(ji,jj,jl) = ( zcatm1(ji,jj) * zqsrics(ji,jj) + catm(ji,jj) * zqsrios(ji,jj) ) / z2pi
-
-            ! Taking into account the ellipsity of the earth orbit
-            !-----------------------------------------------------
-
-            qsr_ice(ji,jj,jl) = qsr_ice(ji,jj,jl) * zdaycor
-            !---------------------------------------------------------------------------
-            !   Computation of long-wave radiation  ( Berliand 1952 ; all latitudes )
-            !---------------------------------------------------------------------------
-
-            ! tempory variables
-            ztatm3         = ztatm(ji,jj) * ztatm(ji,jj) * ztatm(ji,jj)
-            ztatm4         = ztatm3 * ztatm(ji,jj)
-            z4tatm3        = 4. * ztatm3
-            zcldeff(ji,jj) = 1.0 - sbudyko(ji,jj) * catm(ji,jj) * catm(ji,jj)    
-            ztaevbk        = ztatm4 * zcldeff(ji,jj) * ( 0.39 - 0.05 * zevsqr(ji,jj) ) 
-
-            !  Long-Wave for Ice
-            !----------------------
-            zqlw_ice(ji,jj,jl) = - emic * stefan * ( ztaevbk + z4tatm3 * ( t_su(ji,jj,jl) - ztatm(ji,jj) ) ) 
-
-         END DO !ji
-      END DO !jj
-
-      END DO !jl
-
-      DO jj = 1, jpj
-         DO ji = 1, jpi 
-
-            !  fraction of net shortwave radiation which is not absorbed in the 
-            !  thin surface layer and penetrates inside the ice cover 
-            !  ( Maykut and Untersteiner, 1971 ; Elbert anbd Curry, 1993 )
-            !------------------------------------------------------------------
-
-            fr1_i0(ji,jj) = 0.18  * zcatm1(ji,jj) + 0.35 * catm(ji,jj) 
-            fr2_i0(ji,jj) = 0.82  * zcatm1(ji,jj) + 0.65 * catm(ji,jj)
-
-            ! the solar heat flux absorbed at ocean and snow/ice surfaces
-            !------------------------------------------------------------
-            ! For ocean
-            qsr_oce(ji,jj) = srgamma * zcldcor(ji,jj) * zqsro(ji,jj) / z2pi
-            zinda          = SIGN( zone , -( -0.5 - zfrld(ji,jj) ) )
-            zinda          = 1.0 - MAX( zzero , zinda )
-            qsr_oce(ji,jj) = ( 1.- zinda ) * qsr_oce(ji,jj)
-
-            ! Taking into account the ellipsity of the earth orbit
-            !-----------------------------------------------------
-            qsr_oce(ji,jj) = qsr_oce(ji,jj) * zdaycor
-
-            !---------------------------------------------------------------------------
-            !   Computation of long-wave radiation  ( Berliand 1952 ; all latitudes )
-            !---------------------------------------------------------------------------
-
-            ! tempory variables
-            ztatm3         = ztatm(ji,jj) * ztatm(ji,jj) * ztatm(ji,jj)
-            ztatm4         = ztatm3 * ztatm(ji,jj)
-            z4tatm3        = 4. * ztatm3
-            zcldeff(ji,jj) = 1.0 - sbudyko(ji,jj) * catm(ji,jj) * catm(ji,jj)    
-            ztaevbk        = ztatm4 * zcldeff(ji,jj) * ( 0.39 - 0.05 * zevsqr(ji,jj) ) 
-
-            !  Long-Wave for Ocean
-            !-----------------------
-            zqlw_oce(ji,jj) = - emic * stefan * ( ztaevbk + z4tatm3 * ( psst  (ji,jj) - ztatm(ji,jj) ) ) 
-
-         END DO
-      END DO
-
-      !----------------------------------------
-      !  Computation of turbulent heat fluxes  ( Latent and sensible ) 
-      !----------------------------------------        
-      !CDIR NOVERRCHK
-      DO jj = 2 , jpjm1
-         !CDIR NOVERRCHK
-         DO  ji = 1, jpi
-
-            !  Turbulent heat fluxes over water
-            !----------------------------------
-
-            ! zeso     : vapour pressure at saturation of ocean
-            ! zqsato   : humidity close to the ocean surface (at saturation)
-            zeso          =  611.0 * EXP ( 17.2693884 * ( psst(ji,jj) - rtt ) * tmask(ji,jj,1) / ( psst(ji,jj) - 35.86 ) )
-            zqsato        = ( 0.622 * zeso ) / ( zpatm(ji,jj) - 0.378 * zeso )
-
-            !  Drag coefficients from Large and Pond (1981,1982)
-            !---------------------------------------------------
-    
-            !  Stability parameters
-            zdteta         = psst(ji,jj) - ztatm(ji,jj)
-            zdeltaq        = zqatm(ji,jj) - zqsato
-            ztvmoy         = ztatm(ji,jj) * ( 1. + 2.2e-3 * ztatm(ji,jj) * zqatm(ji,jj) )
-            zdenum         = MAX( vatm(ji,jj) * vatm(ji,jj) * ztvmoy, zeps )
-            zdtetar        = zdteta / zdenum
-            ztvmoyr        = ztvmoy * ztvmoy * zdeltaq / zdenum
-            
-            ! For stable atmospheric conditions
-            zobouks        = -70.0 * 10. * ( zdtetar + 3.2e-3 * ztvmoyr )
-            zobouks        = MAX( zzero , zobouks )
-            zpsims         = -7.0 * zobouks
-            zpsihs         =  zpsims
-            zpsils         =  zpsims
-
-            !  For unstable atmospheric conditions
-            zobouku        = -100.0 * 10.0 * ( zdtetar + 2.2e-3 * ztvmoyr )
-            zobouku        = MIN( zzero , zobouku )
-            zxins          = ( 1. - 16. * zobouku )**0.25
-            zlxins         = LOG( ( 1. + zxins * zxins ) / 2. )
-            zpsimu         = 2. * LOG( ( 1 + zxins ) / 2. )  + zlxins - 2. * ATAN( zxins ) + zpis2
-            zpsihu         = 2. * zlxins
-            zpsilu         = zpsihu
-
-            ! computation of intermediate values
-            zstab          = MAX( zzero , SIGN( zone , zdteta ) )
-            zpsim          = zstab * zpsimu + (1.0 - zstab ) * zpsims
-            zpsih          = zstab * zpsihu + (1.0 - zstab ) * zpsihs
-            zpsil          = zpsih
-            
-            zvatmg         = MAX( 0.032 * 1.5e-3 * vatm(ji,jj) * vatm(ji,jj) / grav, zeps )
-
-            zcmn           = vkarmn / LOG ( 10. / zvatmg )
-            zcmn2          = zcmn * zcmn
-            zchn           = 0.0327 * zcmn
-            zcln           = 0.0346 * zcmn
-            zcmcmn         = 1 / ( 1 - zcmn * zpsim / vkarmn )
-            zchcm          = zcmcmn / ( 1 - zchn * zpsih / ( vkarmn * zcmn ) )
-            zclcm          = zchcm
-
-
-            !  Transfer cofficient zcsho and zcleo over ocean according to Large and Pond (1981,1982)
-            !-------------------------------------------------------------- 
-            zcsho          = zchn * zchcm
-            zcleo          = zcln * zclcm 
-
-
-            !   Computation of sensible and latent fluxes over Ocean 
-            !----------------------------------------------------------------
-
-            !  computation of intermediate values
-            zrhova         = zrhoa(ji,jj) * vatm(ji,jj)
-            zrhovacsho     = zrhova * zcsho
-            zrhovacleo     = zrhova * zcleo
-
-            ! sensible heat flux
-            zqsb_oce(ji,jj) = zrhovacsho * 1004.0  * ( psst(ji,jj) - ztatm(ji,jj) )  
-         
-            !  latent heat flux 
-            zqla_oce(ji,jj) = MAX(0.e0, zrhovacleo * 2.5e+06 * ( zqsato      - zqatm(ji,jj) ) )
-               
-            !  Calculate evaporation over water. (kg/m2/s)
-            !-------------------------------------------------
-            evap(ji,jj)    = zqla_oce(ji,jj) / cevap
-               
-         END DO !ji
-      END DO !jj
-
-      DO jl = 1, jpl
-      !CDIR NOVERRCHK
-      DO jj = 2 , jpjm1
-         !CDIR NOVERRCHK
-         DO ji = 1, jpi
-               
-            !  Turbulent heat fluxes over snow/ice.
-            !--------------------------------------------------
-            
-            !  zesi     : vapour pressure at saturation of ice
-            !  zqsati   : humidity close to the ice surface (at saturation)
-            zesi           =  611.0 * EXP ( 21.8745587 * tmask(ji,jj,1)   &   ! tmask needed to avoid overflow in the exponential
-               &                                       * ( t_su(ji,jj,jl) - rtt )/ ( t_su(ji,jj,jl)- 7.66 ) )
-            zqsati         = ( 0.622 * zesi ) / ( zpatm(ji,jj) - 0.378 * zesi )
-               
-            !  computation of intermediate values
-            zticemb        = t_su(ji,jj,jl) - 7.66
-            zticemb2       = zticemb * zticemb  
-            ztice3         = t_su(ji,jj,jl) * t_su(ji,jj,jl) * t_su(ji,jj,jl)
-            zqsati2        = zqsati * zqsati
-            zesi2          = zesi * zesi
-            zdesidt        = zesi * ( 9.5 * LOG( 10.0 ) * ( rtt - 7.66 )  / zticemb2 )
-               
-            !  Transfer cofficient zcshi and zclei over ice. Assumed to be constant Parkinson 1979 ; Maykut 1982
-            !--------------------------------------------------------------------
-            zcshi          = 1.75e-03
-            zclei          = zcshi
-               
-            !  Computation of sensible and latent fluxes over ice
-            !----------------------------------------------------------------
-               
-            !  computation of intermediate values
-            zrhova          = zrhoa(ji,jj) * vatm(ji,jj)
-            zrhovaclei      = zrhova * zcshi * 2.834e+06
-            zrhovacshi      = zrhova * zclei * 1004.0
-            
-            !  sensible heat flux
-            zqsb_ice(ji,jj,jl) = zrhovacshi * ( t_su(ji,jj,jl) - ztatm(ji,jj) )
-            
-            !  latent heat flux 
-            zqla_ice(ji,jj,jl) = zrhovaclei * ( zqsati        - zqatm(ji,jj) )
-            qla_ice (ji,jj,jl) = MAX(0.e0, zqla_ice(ji,jj,jl) )
-              
-            !  Computation of sensitivity of non solar fluxes (dQ/dT)
-            !---------------------------------------------------------------
-               
-            !  computation of long-wave, sensible and latent flux sensitivity
-            zdqlw_ice       = 4.0 * emic * stefan * ztice3
-            zdqsb_ice       = zrhovacshi
-            zdqla_ice       = zrhovaclei * ( zdesidt * ( zqsati2 / zesi2 ) * ( zpatm(ji,jj) / 0.622 ) )   
-            
-            !  total non solar sensitivity
-            dqns_ice(ji,jj,jl) = -( zdqlw_ice + zdqsb_ice + zdqla_ice ) 
-            
-            ! latent flux sensitivity
-            dqla_ice(ji,jj,jl) = zdqla_ice
-            
-         END DO
-      END DO
-      END DO !jl
-
-      ! total non solar heat flux over ice
-      qnsr_ice(:,:,:) = zqlw_ice(:,:,:) - zqsb_ice(:,:,:) - qla_ice(:,:,:)
-      ! total non solar heat flux over water 
-      qnsr_oce(:,:) = zqlw_oce(:,:) - zqsb_oce(:,:) - zqla_oce(:,:)
-
-      ! solid precipitations ( kg/m2/day -> kg/m2/s)
-      tprecip(:,:) = tprecip  (:,:) / rday 
-      ! snow  precipitations ( kg/m2/day -> kg/m2/s)
-      sprecip(:,:) = sprecip  (:,:) / rday  
-
-      CALL lbc_lnk( qsr_oce (:,:) , 'T', 1. )
-      CALL lbc_lnk( qnsr_oce(:,:) , 'T', 1. )
-      CALL lbc_lnk( fr1_i0  (:,:) , 'T', 1. )
-      CALL lbc_lnk( fr2_i0  (:,:) , 'T', 1. )
-      CALL lbc_lnk( tprecip (:,:) , 'T', 1. )
-      CALL lbc_lnk( sprecip (:,:) , 'T', 1. )
-      CALL lbc_lnk( evap    (:,:) , 'T', 1. )
-      DO jl = 1, jpl
-         CALL lbc_lnk( qsr_ice (:,:,jl) , 'T', 1. )
-         CALL lbc_lnk( qnsr_ice(:,:,jl) , 'T', 1. )
-         CALL lbc_lnk( dqns_ice(:,:,jl) , 'T', 1. )
-         CALL lbc_lnk( qla_ice (:,:,jl) , 'T', 1. )
-         CALL lbc_lnk( dqla_ice(:,:,jl) , 'T', 1. )
-      END DO
-
-      qsr_oce (:,:) = qsr_oce (:,:)*tmask(:,:,1)
-      qnsr_oce(:,:) = qnsr_oce(:,:)*tmask(:,:,1)
-      DO jl = 1, jpl
-         qsr_ice (:,:,jl) = qsr_ice (:,:,jl)*tmask(:,:,1)
-         qnsr_ice(:,:,jl) = qnsr_ice(:,:,jl)*tmask(:,:,1)
-         qla_ice (:,:,jl) = qla_ice (:,:,jl)*tmask(:,:,1)
-         dqns_ice(:,:,jl) = dqns_ice(:,:,jl)*tmask(:,:,1)
-         dqla_ice(:,:,jl) = dqla_ice(:,:,jl)*tmask(:,:,1)
-      END DO
-      fr1_i0  (:,:) = fr1_i0  (:,:)*tmask(:,:,1)
-      fr2_i0  (:,:) = fr2_i0  (:,:)*tmask(:,:,1)
-      tprecip (:,:) = tprecip (:,:)*tmask(:,:,1)
-      sprecip (:,:) = sprecip (:,:)*tmask(:,:,1)
-      evap    (:,:) = evap    (:,:)*tmask(:,:,1)
-
-
-   END SUBROUTINE flx_blk
-
-
-#else
-
-   SUBROUTINE flx_blk( psst )
-      !!---------------------------------------------------------------------------
-      !!                     ***  ROUTINE flx_blk  ***
-      !!                 
-      !!  ** Purpose :   Computation of the heat fluxes at ocean and snow/ice
-      !!       surface the solar heat at ocean and snow/ice surfaces and the 
-      !!       sensitivity of total heat fluxes to the SST variations
-      !!         
-      !!  ** Method  :   The flux of heat at the ice and ocean surfaces are derived
-      !!       from semi-empirical ( or bulk ) formulae which relate the flux to 
-      !!       the properties of the surface and of the lower atmosphere. Here, we
-      !!       follow the work of Oberhuber, 1988   
-      !!
-      !!  ** Action  :   call flx_blk_albedo to compute ocean and ice albedo 
-      !!          computation of snow precipitation
-      !!          computation of solar flux at the ocean and ice surfaces
-      !!          computation of the long-wave radiation for the ocean and sea/ice
-      !!          computation of turbulent heat fluxes over water and ice
-      !!          computation of evaporation over water
-      !!          computation of total heat fluxes sensitivity over ice (dQ/dT)
-      !!          computation of latent heat flux sensitivity over ice (dQla/dT)
-      !!
-      !! History :
-      !!   8.0  !  97-06  (Louvain-La-Neuve)  Original code
-      !!   8.5  !  02-09  (C. Ethe , G. Madec )  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      REAL(wp), INTENT( in ), DIMENSION(jpi,jpj) ::   &
-         &                          psst      ! Sea Surface Temperature 
-
-      !! * Local variables
-      INTEGER  ::             &
-         ji, jj, jt        ,  &  ! dummy loop indices
-         indaet            ,  &  !  = -1, 0, 1 for odd, normal and leap years resp.
-         iday              ,  &  ! integer part of day
-         indxb             ,  &  ! index for budyko coefficient
-         indxc                   ! index for cloud depth coefficient
-
-      REAL(wp)  ::            & 
-         zalat , zclat     ,  &  ! latitude in degrees 
-         zmt1, zmt2, zmt3  ,  &  ! tempory air temperatures variables
-         ztatm3, ztatm4    ,  &  ! power 3 and 4 of air temperature
-         z4tatm3           ,  &  ! 4 * ztatm3
-         zcmue             ,  &  ! cosine of local solar altitude
-         zcmue2            ,  &  ! root of zcmue1 
-         zscmue            ,  &  ! square-root of zcmue1 
-         zpcmue            ,  &  ! zcmue1**1.4
-         zdecl             ,  &  ! solar declination
-         zsdecl , zcdecl   ,  &  ! sine and cosine of solar declination 
-         zalbo             ,  &  ! albedo of sea-water
-         zalbi             ,  &  ! albedo of ice
-         ztamr             ,  &  ! air temperature minus triple point of water (rtt)
-         ztaevbk           ,  &  ! part of net longwave radiation
-         zevi , zevo       ,  &  ! vapour pressure of ice and ocean 
-         zind1,zind2,zind3 ,  &  ! switch for testing the values of air temperature
-         zinda             ,  &  ! switch for testing the values of sea ice cover
-         zpis2             ,  &  ! pi / 2
-         z2pi                    ! 2 * pi 
-
-      REAL(wp)  ::            & 
-         zxday             ,  &  ! day of year
-         zdist             ,  &  ! distance between the sun and the earth during the year
-         zdaycor           ,  &  ! corr. factor to take into account the variation of 
-         !                       ! zday when calc. the solar rad.    
-         zesi, zeso        ,  &  ! vapour pressure of ice and ocean at saturation
-         zesi2             ,  &  ! root of zesi 
-         zqsato            ,  &  ! humidity close to the ocean surface (at saturation)   
-         zqsati            ,  &  ! humidity close to the ice surface (at saturation) 
-         zqsati2           ,  &  ! root of  zqsati 
-         zdesidt           ,  &  ! derivative of zesi, function of ice temperature
-         zdteta            ,  &  ! diff. betw. sst and air temperature
-         zdeltaq           ,  &  ! diff. betw. spec. hum. and hum. close to the surface
-         ztvmoy, zobouks   ,  &  ! tempory scalars
-         zpsims, zpsihs, zpsils, zobouku, zxins, zpsimu ,  & 
-         zpsihu, zpsilu, zstab,zpsim, zpsih, zpsil      ,  & 
-         zvatmg, zcmn, zchn, zcln, zcmcmn, zdenum       ,  & 
-         zdtetar, ztvmoyr, zlxins, zcmn2, zchcm, zclcm , zcoef
-
-      REAL(wp)  ::            & 
-         zrhova            ,  &  ! air density per wind speed
-         zcsho , zcleo     ,  &  ! transfer coefficient over ocean
-         zcshi , zclei     ,  &  ! transfer coefficient over ice-free
-         zrhovacleo        ,  &  ! air density per wind speed per transfer coef.
-         zrhovacsho, zrhovaclei, zrhovacshi, & 
-         ztice3            ,  &  ! power 3 of ice temperature
-         zticemb, zticemb2 ,  &  ! tempory air temperatures variables
-         zdqlw_ice         ,  &  ! sensitivity of long-wave flux over ice
-         zdqsb_ice         ,  &  ! sensitivity of sensible heat flux over ice
-         zdqla_ice         ,  &  ! sensitivity of latent heat flux over ice
-         zdl, zdr                ! fractionnal part of latitude
-      REAL(wp), DIMENSION(jpi,jpj) :: & 
-         zpatm            ,  &   ! atmospheric pressure
-         zqatm            ,  &   ! specific humidity
-         zes              ,  &   ! vapour pressure at saturation
-         zev, zevsqr      ,  &   ! vapour pressure and his square-root
-         zrhoa            ,  &   ! air density
-         ztatm            ,  &   ! air temperature in Kelvins
-         zfrld            ,  &   ! fraction of sea ice cover 
-         zcatm1           ,  &   ! fraction of cloud
-         zcldeff                 ! correction factor to account cloud effect
-      REAL(wp), DIMENSION(jpi,jpj) ::   & 
-         zalbocsd         ,  &   ! albedo of ocean
-         zalboos          ,  &   ! albedo of ocean under overcast sky
-         zalbics          ,  &   ! albedo of ice under clear sky
-         zalbios          ,  &   ! albedo of ice under overcast sky
-         zalbomu          ,  &   ! albedo of ocean when zcmue is 0.4
-         zqsro            ,  &   ! solar radiation over ocean
-         zqsrics          ,  &   ! solar radiation over ice under clear sky
-         zqsrios          ,  &   ! solar radiation over ice under overcast sky
-         zcldcor          ,  &   ! cloud correction
-         zlsrise, zlsset  ,  &   ! sunrise and sunset
-         zlmunoon         ,  &   ! local noon solar altitude
-         zdlha            ,  &   ! length of the ninstr segments of the solar day
-         zps              ,  &   ! sine of latitude per sine of solar decli.
-         zpc                     ! cosine of latitude per cosine of solar decli. 
-
-      REAL(wp), DIMENSION(jpi,jpj) ::   & 
-         zqlw_oce         ,  &   ! long-wave heat flux over ocean
-         zqlw_ice         ,  &   ! long-wave heat flux over ice
-         zqla_oce         ,  &   ! latent heat flux over ocean
-         zqla_ice         ,  &   ! latent heat flux over ice
-         zqsb_oce         ,  &   ! sensible heat flux over ocean
-         zqsb_ice                ! sensible heat flux over ice
- 
-      REAL(wp), DIMENSION(jpi,jpj,jpintsr) ::    &
-         zlha             ,  &   ! local hour angle
-         zalbocs          ,  &   ! tempory var. of ocean albedo under clear sky
-         zsqsro           ,  &   ! tempory var. of solar rad. over ocean 
-         zsqsrics         ,  &   ! temp. var. of solar rad. over ice under clear sky
-         zsqsrios                ! temp. var. of solar rad. over ice under overcast sky
-      !!---------------------------------------------------------------------
-
-      !---------------------
-      !   Initilization    !
-      !---------------------
-#if ! defined key_lim2
-      tn_ice(:,:) = psst(:,:)
-#endif
-
-      !  Determine cloud optical depths as a function of latitude (Chou et al., 1981).
-      !  and the correction factor for taking into account  the effect of clouds 
-      !------------------------------------------------------
-      IF( lbulk_init ) THEN
-         DO jj = 1, jpj  
-            DO ji = 1 , jpi
-               zalat          = ( 90.e0 - ABS( gphit(ji,jj) ) ) /  5.e0
-               zclat          = ( 95.e0 -      gphit(ji,jj)   ) / 10.e0
-               indxb          = 1 + INT( zalat ) 
-               !  correction factor to account for the effect of clouds 
-               sbudyko(ji,jj) = budyko(indxb)  
-               indxc          = 1 + INT( zclat )  
-               zdl            = zclat - INT( zclat ) 
-               zdr            = 1.0 - zdl
-               stauc(ji,jj)   = zdr * tauco( indxc ) + zdl * tauco( indxc + 1 ) 
-            END DO
-         END DO
-         IF( nleapy == 1 ) THEN
-            yearday = 366.e0
-         ELSE IF( nleapy == 0 ) THEN
-            yearday = 365.e0
-         ELSEIF( nleapy == 30) THEN
-            yearday = 360.e0
-         ENDIF
-         lbulk_init = .FALSE.
-      ENDIF
-
-      zqlw_oce(:,:) = 0.e0
-      zqla_oce(:,:) = 0.e0
-      zqsb_oce(:,:) = 0.e0
-      zqlw_ice(:,:) = 0.e0
-      zqla_ice(:,:) = 0.e0
-      zqsb_ice(:,:) = 0.e0
-
-      zpis2       = rpi / 2.
-      z2pi        = 2. * rpi
-
- !CDIR NOVERRCHK
-      DO jj = 1, jpj
- !CDIR NOVERRCHK
-         DO ji = 1, jpi
-
-            ztatm (ji,jj) = 273.15 + tatm  (ji,jj)  !  air temperature in Kelvins 
-            zcatm1(ji,jj) = 1.0    - catm  (ji,jj)  !  fractional cloud cover
-            zfrld (ji,jj) = 1.0    - freeze(ji,jj)  !  fractional sea ice cover
-            zpatm(ji,jj)  = 101000.               !  pressure 
-      
-            !  Computation of air density, obtained from the equation of state for dry air. 
-            zrhoa(ji,jj) = zpatm(ji,jj) / ( 287.04 * ztatm(ji,jj) )
-      
-            !  zes : Saturation water vapour
-            ztamr = ztatm(ji,jj) - rtt
-            zmt1  = SIGN( 17.269, ztamr )
-            zmt2  = SIGN( 21.875, ztamr )
-            zmt3  = SIGN( 28.200, -ztamr )
-            zes(ji,jj) = 611.0 * EXP (  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &
-               &                      / ( ztatm(ji,jj) - 35.86  + MAX( zzero, zmt3 ) ) )
-
-            !  zev : vapour pressure  (hatm is relative humidity)  
-            zev(ji,jj)   = hatm(ji,jj) * zes(ji,jj) 
-            !  square-root of vapour pressure
-!CDIR NOVERRCHK
-            zevsqr(ji,jj) = SQRT( zev(ji,jj) * 0.01 )
-            !  zqapb  : specific humidity 
-            zqatm(ji,jj) = 0.622 * zev(ji,jj) / ( zpatm(ji,jj) - 0.378 * zev(ji,jj) )
-
-
-            !----------------------------------------------------
-            !   Computation of snow precipitation (Ledley, 1985) |
-            !----------------------------------------------------
-
-            zmt1  =   253.0 - ztatm(ji,jj)
-            zmt2  = ( 272.0 - ztatm(ji,jj) ) / 38.0 
-            zmt3  = ( 281.0 - ztatm(ji,jj) ) / 18.0
-            zind1 = MAX( zzero, SIGN( zone, zmt1 ) )
-            zind2 = MAX( zzero, SIGN( zone, zmt2 ) )
-            zind3 = MAX( zzero, SIGN( zone, zmt3 ) )
-            ! total precipitation
-            tprecip(ji,jj) = watm(ji,jj)
-            ! solid  (snow) precipitation
-            sprecip(ji,jj) = tprecip(ji,jj) *       &
-               &             (           zind1      &
-               &               + ( 1.0 - zind1 ) * ( zind2 * ( 0.5 + zmt2 ) + ( 1.0 - zind2 ) *  zind3 * zmt3 ) ) 
-         END DO
-      END DO
-
-      !----------------------------------------------------------
-      !   Computation of albedo (need to calculates heat fluxes)|
-      !-----------------------------------------------------------
-      
-      CALL flx_blk_albedo( zalbios, zalboos, zalbics, zalbomu )
-
-      !-------------------------------------
-      !   Computation of solar irradiance. |
-      !----------------------------------------
-      indaet   = 1  
-      !  compution of the day of the year at which the fluxes have to be calculate 
-      !--The date corresponds to the middle of the time step.
-      zxday=nday_year + rdtbs2/rday
-
-      iday   = INT( zxday )
-
-      IF(ln_ctl) CALL prt_ctl_info('declin : iday ', ivar1=iday, clinfo2=' nfbulk= ', ivar2=nfbulk)
-
-      !   computation of the solar declination, his sine and his cosine
-      CALL flx_blk_declin( indaet, iday, zdecl )
-      
-      zdecl    = zdecl * rad
-      zsdecl   = SIN( zdecl )
-      zcdecl   = COS( zdecl )
-      
-      !  correction factor added for computation of shortwave flux to take into account the variation of
-      !  the distance between the sun and the earth during the year (Oberhuber 1988)
-      zdist    = zxday * z2pi / yearday
-      zdaycor  = 1.0 + 0.0013 * SIN( zdist ) + 0.0342 * COS( zdist )
-
-!CDIR NOVERRCHK
-      DO jj = 1, jpj
-!CDIR NOVERRCHK
-         DO ji = 1, jpi
-            !  product of sine of latitude and sine of solar declination
-            zps     (ji,jj) = SIN( gphit(ji,jj) * rad ) * zsdecl
-            !  product of cosine of latitude and cosine of solar declination
-            zpc     (ji,jj) = COS( gphit(ji,jj) * rad ) * zcdecl
-            !  computation of the both local time of sunrise and sunset
-            zlsrise (ji,jj) = ACOS( - SIGN( zone, zps(ji,jj) ) * MIN( zone, SIGN( zone, zps(ji,jj) )  &
-               &                     * ( zps(ji,jj) / zpc(ji,jj) ) ) ) 
-            zlsset  (ji,jj) = - zlsrise(ji,jj)
-            !  dividing the solar day into jpintsr segments of length zdlha
-            zdlha   (ji,jj) = ( zlsrise(ji,jj) - zlsset(ji,jj) ) / REAL( jpintsr )
-            !  computation of the local noon solar altitude
-            zlmunoon(ji,jj) = ASIN ( ( zps(ji,jj) + zpc(ji,jj) ) ) / rad
-            
-            !  cloud correction taken from Reed (1977) (imposed lower than 1)
-            zcldcor (ji,jj) = MIN( zone, ( 1.e0 - 0.62 * catm(ji,jj) + 0.0019 * zlmunoon(ji,jj) ) )
-         END DO
-      END DO
-
-         !  Computation of solar heat flux at each time of the day between sunrise and sunset. 
-         !  We do this to a better optimisation of the code 
-         !------------------------------------------------------       
-
-!CDIR NOVERRCHK   
-      DO jt = 1, jpintsr   
-         zcoef = FLOAT( jt ) - 0.5
-!CDIR NOVERRCHK     
-         DO jj = 1, jpj
-!CDIR NOVERRCHK
-            DO ji = 1, jpi
-               !  local hour angle
-               zlha (ji,jj,jt) = COS ( zlsrise(ji,jj) - zcoef * zdlha(ji,jj) )
-
-               ! cosine of local solar altitude
-               zcmue              = MAX ( zzero ,   zps(ji,jj) + zpc(ji,jj) * zlha (ji,jj,jt)  )
-               zcmue2             = 1368.0 * zcmue * zcmue
-               zscmue             = SQRT ( zcmue )
-               zpcmue             = zcmue**1.4
-               ! computation of sea-water albedo (Payne, 1972)
-               zalbocs(ji,jj,jt)  = 0.05 / ( 1.1 * zpcmue + 0.15 )
-               zalbo              = zcatm1(ji,jj) * zalbocs(ji,jj,jt) + catm(ji,jj) * zalboos(ji,jj)
-               ! solar heat flux absorbed at ocean surfaces (Zillman, 1972)
-               zevo               = zev(ji,jj) * 1.0e-05
-               zsqsro(ji,jj,jt)   =  ( 1.0 - zalbo ) * zdlha(ji,jj) * zcmue2                &
-                                   / ( ( zcmue + 2.7 ) * zevo + 1.085 * zcmue +  0.10 )
-               !  solar heat flux absorbed at sea/ice surfaces 
-               !  Formulation of Shine and Crane, 1984 adapted for high albedo surfaces 
-
-               !  For clear sky        
-               zevi               = zevo
-               zalbi              = zalbics(ji,jj)
-               zsqsrics(ji,jj,jt) =  ( 1.0 - zalbi ) * zdlha(ji,jj) * zcmue2                &
-                  &                / ( ( 1.0 + zcmue ) * zevi + 1.2 * zcmue + 0.0455 )
-
-               ! For overcast sky
-               zalbi              = zalbios(ji,jj)
-               zsqsrios(ji,jj,jt) = zdlha(ji,jj) *                                                           &
-                  &                 ( ( 53.5 + 1274.5 * zcmue      ) *  zscmue * ( 1.0 - 0.996  * zalbi ) )  &
-                  &                 / (  1.0 + 0.139  * stauc(ji,jj) *           ( 1.0 - 0.9435 * zalbi ) )
-            END DO
-         END DO
-      END DO
-
-
-      !  Computation of daily (between sunrise and sunset) solar heat flux absorbed 
-      !  at the ocean and snow/ice surfaces.
-      !--------------------------------------------------------------------
-
-      zalbocsd(:,:) = 0.e0
-      zqsro   (:,:) = 0.e0
-      zqsrics (:,:) = 0.e0
-      zqsrios (:,:) = 0.e0
-
-      DO jt = 1, jpintsr 
-#   if defined key_vectopt_loop 
-         DO ji = 1, jpij  
-            zalbocsd(ji,1) = zalbocsd(ji,1) + zdlha   (ji,1) * zalbocs(ji,1,jt)   &
-               &                                             / MAX( 2.0 * zlsrise(ji,1) , zeps0 )
-            zqsro   (ji,1) = zqsro   (ji,1) + zsqsro  (ji,1,jt)
-            zqsrics (ji,1) = zqsrics (ji,1) + zsqsrics(ji,1,jt)
-            zqsrios (ji,1) = zqsrios (ji,1) + zsqsrios(ji,1,jt)
-         END DO
-#  else
-         DO jj = 1, jpj
-            DO ji = 1, jpi  
-               zalbocsd(ji,jj) = zalbocsd(ji,jj) + zdlha(ji,jj) * zalbocs(ji,jj,jt)   &
-                  &                                              / MAX( 2.0 * zlsrise(ji,jj) , zeps0 )
-               zqsro  (ji,jj)  = zqsro   (ji,jj) + zsqsro  (ji,jj,jt)
-               zqsrics(ji,jj)  = zqsrics (ji,jj) + zsqsrics(ji,jj,jt)
-               zqsrios(ji,jj)  = zqsrios (ji,jj) + zsqsrios(ji,jj,jt)
-            END DO
-         END DO
-#  endif
-      END DO
-
-      DO jj = 1, jpj
-         DO ji = 1, jpi 
-
-            !------------------------------------------- 
-            !  Computation of shortwave radiation.
-            !-------------------------------------------
-
-            ! the solar heat flux absorbed at ocean and snow/ice surfaces
-            !------------------------------------------------------------
-
-            ! For ocean
-            qsr_oce(ji,jj) = srgamma * zcldcor(ji,jj) * zqsro(ji,jj) / z2pi
-            zinda          = SIGN( zone , -( -0.5 - zfrld(ji,jj) ) )
-            zinda          = 1.0 - MAX( zzero , zinda )
-            qsr_oce(ji,jj) = ( 1.- zinda ) * qsr_oce(ji,jj)
-
-            ! For snow/ice 
-            qsr_ice(ji,jj) = ( zcatm1(ji,jj) * zqsrics(ji,jj) + catm(ji,jj) * zqsrios(ji,jj) ) / z2pi
-
-
-            ! Taking into account the ellipsity of the earth orbit
-            !-----------------------------------------------------
-
-            qsr_ice(ji,jj) = qsr_ice(ji,jj) * zdaycor
-            qsr_oce(ji,jj) = qsr_oce(ji,jj) * zdaycor
-
-            !  fraction of net shortwave radiation which is not absorbed in the 
-            !  thin surface layer and penetrates inside the ice cover 
-            !  ( Maykut and Untersteiner, 1971 ; Elbert anbd Curry, 1993 )
-            !------------------------------------------------------------------
-
-            fr1_i0(ji,jj) = 0.18  * zcatm1(ji,jj) + 0.35 * catm(ji,jj) 
-            fr2_i0(ji,jj) = 0.82  * zcatm1(ji,jj) + 0.65 * catm(ji,jj)
-
-            !---------------------------------------------------------------------------
-            !   Computation of long-wave radiation  ( Berliand 1952 ; all latitudes )
-            !---------------------------------------------------------------------------
-
-            ! tempory variables
-            ztatm3         = ztatm(ji,jj) * ztatm(ji,jj) * ztatm(ji,jj)
-            ztatm4         = ztatm3 * ztatm(ji,jj)
-            z4tatm3        = 4. * ztatm3
-            zcldeff(ji,jj) = 1.0 - sbudyko(ji,jj) * catm(ji,jj) * catm(ji,jj)    
-            ztaevbk        = ztatm4 * zcldeff(ji,jj) * ( 0.39 - 0.05 * zevsqr(ji,jj) ) 
-
-            !  Long-Wave for Ice
-            !----------------------
-            zqlw_ice(ji,jj) = - emic * stefan * ( ztaevbk + z4tatm3 * ( tn_ice(ji,jj) - ztatm(ji,jj) ) ) 
-
-            !  Long-Wave for Ocean
-            !-----------------------
-            zqlw_oce(ji,jj) = - emic * stefan * ( ztaevbk + z4tatm3 * ( psst  (ji,jj) - ztatm(ji,jj) ) ) 
-
-         END DO
-      END DO
-
-      !----------------------------------------
-      !  Computation of turbulent heat fluxes  ( Latent and sensible ) 
-      !----------------------------------------        
-      !CDIR NOVERRCHK
-      DO jj = 2 , jpjm1
-!ib   DO jj = 1 , jpj
-         !CDIR NOVERRCHK
-         DO  ji = 1, jpi
-
-            !  Turbulent heat fluxes over water
-            !----------------------------------
-
-            ! zeso     : vapour pressure at saturation of ocean
-            ! zqsato   : humidity close to the ocean surface (at saturation)
-            zeso          =  611.0 * EXP ( 17.2693884 * ( psst(ji,jj) - rtt ) * tmask(ji,jj,1) / ( psst(ji,jj) - 35.86 ) )
-            zqsato        = ( 0.622 * zeso ) / ( zpatm(ji,jj) - 0.378 * zeso )
-
-            !  Drag coefficients from Large and Pond (1981,1982)
-            !---------------------------------------------------
-    
-            !  Stability parameters
-            zdteta         = psst(ji,jj) - ztatm(ji,jj)
-            zdeltaq        = zqatm(ji,jj) - zqsato
-            ztvmoy         = ztatm(ji,jj) * ( 1. + 2.2e-3 * ztatm(ji,jj) * zqatm(ji,jj) )
-            zdenum         = MAX( vatm(ji,jj) * vatm(ji,jj) * ztvmoy, zeps )
-!i
-!i          if( zdenum == 0.e0 ) then
-!i               write(numout,*) 'flxblk  zdenum=0 ', ji,jj
-!i               zdenum = zeps
-!i          endif
-!i
-            zdtetar        = zdteta / zdenum
-            ztvmoyr        = ztvmoy * ztvmoy * zdeltaq / zdenum
-            
-            ! For stable atmospheric conditions
-            zobouks        = -70.0 * 10. * ( zdtetar + 3.2e-3 * ztvmoyr )
-            zobouks        = MAX( zzero , zobouks )
-            zpsims         = -7.0 * zobouks
-            zpsihs         =  zpsims
-            zpsils         =  zpsims
-
-            !  For unstable atmospheric conditions
-            zobouku        = -100.0 * 10.0 * ( zdtetar + 2.2e-3 * ztvmoyr )
-            zobouku        = MIN( zzero , zobouku )
-            zxins          = ( 1. - 16. * zobouku )**0.25
-            zlxins         = LOG( ( 1. + zxins * zxins ) / 2. )
-            zpsimu         = 2. * LOG( ( 1 + zxins ) / 2. )  + zlxins - 2. * ATAN( zxins ) + zpis2
-            zpsihu         = 2. * zlxins
-            zpsilu         = zpsihu
-
-            ! computation of intermediate values
-            zstab          = MAX( zzero , SIGN( zone , zdteta ) )
-            zpsim          = zstab * zpsimu + (1.0 - zstab ) * zpsims
-            zpsih          = zstab * zpsihu + (1.0 - zstab ) * zpsihs
-            zpsil          = zpsih
-            
-            zvatmg         = MAX( 0.032 * 1.5e-3 * vatm(ji,jj) * vatm(ji,jj) / grav, zeps )
-!i
-!!          if( zvatmg == 0.e0 ) then
-!!               write(numout,*) 'flxblk  zvatmg=0 ', ji,jj
-!!               zvatmg = zeps
-!!          endif
-!i
-
-            zcmn           = vkarmn / LOG ( 10. / zvatmg )
-            zcmn2          = zcmn * zcmn
-            zchn           = 0.0327 * zcmn
-            zcln           = 0.0346 * zcmn
-            zcmcmn         = 1 / ( 1 - zcmn * zpsim / vkarmn )
-            zchcm          = zcmcmn / ( 1 - zchn * zpsih / ( vkarmn * zcmn ) )
-            zclcm          = zchcm
-
-
-            !  Transfer cofficient zcsho and zcleo over ocean according to Large and Pond (1981,1982)
-            !-------------------------------------------------------------- 
-            zcsho          = zchn * zchcm
-            zcleo          = zcln * zclcm 
-
-
-            !   Computation of sensible and latent fluxes over Ocean 
-            !----------------------------------------------------------------
-
-            !  computation of intermediate values
-            zrhova         = zrhoa(ji,jj) * vatm(ji,jj)
-            zrhovacsho     = zrhova * zcsho
-            zrhovacleo     = zrhova * zcleo
-
-            ! sensible heat flux
-            zqsb_oce(ji,jj) = zrhovacsho * 1004.0  * ( psst(ji,jj) - ztatm(ji,jj) )  
-         
-            !  latent heat flux 
-            zqla_oce(ji,jj) = MAX(0.e0, zrhovacleo * 2.5e+06 * ( zqsato      - zqatm(ji,jj) ) )
-               
-            !  Calculate evaporation over water. (kg/m2/s)
-            !-------------------------------------------------
-            evap(ji,jj)    = zqla_oce(ji,jj) / cevap
-               
-               
-            !  Turbulent heat fluxes over snow/ice.
-            !--------------------------------------------------
-            
-            !  zesi     : vapour pressure at saturation of ice
-            !  zqsati   : humidity close to the ice surface (at saturation)
-            zesi           =  611.0 * EXP ( 21.8745587 * tmask(ji,jj,1)   &   ! tmask needed to avoid overflow in the exponential
-               &                                       * ( tn_ice(ji,jj) - rtt ) / ( tn_ice(ji,jj) - 7.66 ) )
-            zqsati         = ( 0.622 * zesi ) / ( zpatm(ji,jj) - 0.378 * zesi )
-               
-            !  computation of intermediate values
-            zticemb        = ( tn_ice(ji,jj) - 7.66 )
-            zticemb2       = zticemb * zticemb  
-            ztice3         = tn_ice(ji,jj) * tn_ice(ji,jj) * tn_ice(ji,jj)
-            zqsati2        = zqsati * zqsati
-            zesi2          = zesi * zesi
-            zdesidt        = zesi * ( 9.5 * LOG( 10.0 ) * ( rtt - 7.66 )  / zticemb2 )
-               
-            !  Transfer cofficient zcshi and zclei over ice. Assumed to be constant Parkinson 1979 ; Maykut 1982
-            !--------------------------------------------------------------------
-            zcshi          = 1.75e-03
-            zclei          = zcshi
-               
-            !  Computation of sensible and latent fluxes over ice
-            !----------------------------------------------------------------
-               
-            !  computation of intermediate values
-            zrhova          = zrhoa(ji,jj) * vatm(ji,jj)
-            zrhovacshi      = zrhova * zcshi * 2.834e+06
-            zrhovaclei      = zrhova * zclei * 1004.0
-            
-            !  sensible heat flux
-            zqsb_ice(ji,jj) = zrhovaclei * ( tn_ice(ji,jj) - ztatm(ji,jj) )
-            
-            !  latent heat flux 
-            zqla_ice(ji,jj) = zrhovacshi * ( zqsati        - zqatm(ji,jj) )
-            qla_ice (ji,jj) = MAX(0.e0, zqla_ice(ji,jj) )
-              
-            !  Computation of sensitivity of non solar fluxes (dQ/dT)
-            !---------------------------------------------------------------
-               
-            !  computation of long-wave, sensible and latent flux sensitivity
-            zdqlw_ice       = 4.0 * emic * stefan * ztice3
-            zdqsb_ice       = zrhovaclei
-            zdqla_ice       = zrhovacshi * ( zdesidt * ( zqsati2 / zesi2 ) * ( zpatm(ji,jj) / 0.622 ) )         
-            
-            !  total non solar sensitivity
-            dqns_ice(ji,jj) = -( zdqlw_ice + zdqsb_ice + zdqla_ice ) 
-            
-            ! latent flux sensitivity
-            dqla_ice(ji,jj) = zdqla_ice
-            
-         END DO
-      END DO
-
-      ! total non solar heat flux over ice
-      qnsr_ice(:,:) = zqlw_ice(:,:) - zqsb_ice(:,:) - zqla_ice(:,:)
-      ! total non solar heat flux over water 
-      qnsr_oce(:,:) = zqlw_oce(:,:) - zqsb_oce(:,:) - zqla_oce(:,:)
-
-      ! solid precipitations ( kg/m2/day -> kg/m2/s)
-      tprecip(:,:) = tprecip  (:,:) / rday 
-      ! snow  precipitations ( kg/m2/day -> kg/m2/s)
-      sprecip(:,:) = sprecip  (:,:) / rday  
-!i
-      CALL lbc_lnk( qsr_oce (:,:) , 'T', 1. )
-      CALL lbc_lnk( qnsr_oce(:,:) , 'T', 1. )
-      CALL lbc_lnk( qsr_ice (:,:) , 'T', 1. )
-      CALL lbc_lnk( qnsr_ice(:,:) , 'T', 1. )
-      CALL lbc_lnk( qla_ice (:,:) , 'T', 1. )
-      CALL lbc_lnk( dqns_ice(:,:) , 'T', 1. )
-      CALL lbc_lnk( dqla_ice(:,:) , 'T', 1. )
-      CALL lbc_lnk( fr1_i0  (:,:) , 'T', 1. )
-      CALL lbc_lnk( fr2_i0  (:,:) , 'T', 1. )
-      CALL lbc_lnk( tprecip (:,:) , 'T', 1. )
-      CALL lbc_lnk( sprecip (:,:) , 'T', 1. )
-      CALL lbc_lnk( evap    (:,:) , 'T', 1. )
-!i
-!i
-      qsr_oce (:,:) = qsr_oce (:,:)*tmask(:,:,1)
-      qnsr_oce(:,:) = qnsr_oce(:,:)*tmask(:,:,1)
-      qsr_ice (:,:) = qsr_ice (:,:)*tmask(:,:,1)
-      qnsr_ice(:,:) = qnsr_ice(:,:)*tmask(:,:,1)
-      qla_ice (:,:) = qla_ice (:,:)*tmask(:,:,1)
-      dqns_ice(:,:) = dqns_ice(:,:)*tmask(:,:,1)
-      dqla_ice(:,:) = dqla_ice(:,:)*tmask(:,:,1)
-      fr1_i0  (:,:) = fr1_i0  (:,:)*tmask(:,:,1)
-      fr2_i0  (:,:) = fr2_i0  (:,:)*tmask(:,:,1)
-      tprecip (:,:) = tprecip (:,:)*tmask(:,:,1)
-      sprecip (:,:) = sprecip (:,:)*tmask(:,:,1)
-      evap    (:,:) = evap    (:,:)*tmask(:,:,1)
-!i
-
-   END SUBROUTINE flx_blk
-#endif
-
-
-   SUBROUTINE flx_blk_declin( ky, kday, pdecl )
-      !!---------------------------------------------------------------------------
-      !!               ***  ROUTINE flx_blk_declin  ***
-      !!          
-      !! ** Purpose :   Computation of the solar declination for the day
-      !!	        kday ( in decimal degrees ).
-      !!       
-      !! ** Method  :
-      !!
-      !! History :
-      !!         original    : 01-04 (LIM)
-      !!         addition    : 02-08 (C. Ethe, G. Madec)
-      !!---------------------------------------------------------------------
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   &
-         ky  ,        &  ! = -1, 0, 1 for odd, normal and leap years resp.
-         kday            ! day of the year ( kday = 1 on january 1)
-      REAL(wp), INTENT(out) ::  &
-         pdecl            ! solar declination
-
-      !! * Local variables
-      REAL(wp) ::                & 
-         zday                ,   &  ! corresponding day of type year (cf. ky)
-         zp1, zp2, zp3, zp4         ! temporary scalars
-      !!---------------------------------------------------------------------
-      
-      zday = FLOAT( kday ) 
-      
-      IF( ky == 1 )  THEN 
-         zday = zday - 0.5
-      ELSEIF( ky == 3 )  THEN
-         zday = zday - 1.
-      ELSE 
-         zday = REAL( kday )
-      ENDIF
-      
-      zp1 = rpi * ( 2.0 * zday - 367.0 ) / yearday
-      zp2 = 2. * zp1
-      zp3 = 3. * zp1
-      zp4 = 4. * zp1
-      
-      pdecl  = a0                                                                      &
-         &   + a1 * COS( zp1 ) + a2 * COS( zp2 ) + a3 * COS( zp3 ) + a4 * COS( zp4 )   &
-         &   + b1 * SIN( zp1 ) + b2 * SIN( zp2 ) + b3 * SIN( zp3 ) + b4 * SIN( zp4 )
-      
-   END SUBROUTINE flx_blk_declin
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option :           Empty module                     NO bulk
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE flx_blk            ! Empty routine
-   END SUBROUTINE flx_blk
-#endif
-
-   !!======================================================================
-END MODULE flxblk
Index: trunk/NEMO/OPA_SRC/SBC/flxfwb.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flxfwb.F90	(revision 873)
+++ 	(revision )
@@ -1,326 +1,0 @@
-MODULE flxfwb
-   !!======================================================================
-   !!                       ***  MODULE  flxfwb  ***
-   !! Ocean fluxes   : domain averaged freshwater budget
-   !!======================================================================
-#if ! defined key_dynspg_rl
-   !!----------------------------------------------------------------------
-   !!   NOT 'key_dynspg_rl'                        Free surface formulation
-   !!----------------------------------------------------------------------
-   !!   flx_fwb      : freshwater budget for global ocean configurations
-   !!                  in free surface and forced mode
-   !!   flx_fwb_init : freshwater budget for global ocean configurations
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE cpl_oce         ! coupled atmosphere/ocean
-   USE phycst          ! physical constants
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! distribued memory computing library
-   USE flxrnf          ! ocean runoffs
-   USE ocesbc          ! ocean surface boudaries conditions
-   USE blk_oce
-   USE flxblk          ! bulk formulea
-   USE daymod          ! calendar
-
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Routine accessibility
-   PUBLIC flx_fwb      ! routine called by step
-   PUBLIC flx_fwb_init ! routine called by opa
-
-   !! * Share module variables
-   LOGICAL, PUBLIC ::    & !!: * namelist *
-      ln_fwb = .TRUE.       !: Flag to activate the fwb computation
-   REAL(wp), PUBLIC ::   &  !:
-      a_fwb_b  ,         &  !: annual domain averaged freshwater budget
-      a_fwb                 !: for 2 year before (_b) and before year.
-
-   !! * Module variables
-   REAL(wp) ::   &
-      a_emp   ,  & ! domain averaged evaporation minus precipitation
-      a_precip,  & ! domain averaged precipitation
-      a_rnf   ,  & ! domain averaged runoff
-      a_sshb  ,  & ! domain averaged sea surface heigh at nit000
-      a_sshend,  & ! domain averaged sea surface heigh at nitend
-      a_sal000,  & ! domain averaged ocean salinity at nit000 (before time step)
-      a_salend,  & ! domain averaged ocean salinity at nitend (now time step)
-      a_aminus,  & ! 
-      a_aplus
-      REAL(wp), DIMENSION(jpi,jpj) ::  &
-         e1e2_i    ! area of the interior domain (e1t*e2t*tmask_i)
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-   !!----------------------------------------------------------------------
-   !!----------------------------------------------------------------------
-   !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE flx_fwb( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE flx_fwb  ***
-      !!
-      !! ** Purpose :
-      !!
-      !! ** Method  :
-      !!	
-      !! History :
-      !!   8.2  !  01-02  (E. Durand)  Original code
-      !!   8.5  !  02-06  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
-
-      !! * Local declarations
-      CHARACTER (len=32) ::   &
-         clname = 'EMPav.dat'
-      INTEGER  ::   ji, jj, jk        ! dummy loop indices
-      INTEGER  ::   inum              ! temporary logical unit
-      INTEGER  ::   ikty              ! 
-      REAL(wp) ::   &
-         zarea, zvol, zwei,       &  ! temporary scalars
-         zsm0, zempnew                !    "         "
-      !!----------------------------------------------------------------------
-
-      ! Mean global salinity
-      zsm0 = 34.72654
-
-      ! To compute emp mean value mean emp
-
-      IF( kt == nit000 ) THEN
-         IF(lwp) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) 'flx_fwb : FreshWater Budget correction'
-            WRITE(numout,*) '~~~~~~~'
-         ENDIF
-
-         a_emp    = 0.e0
-         a_precip = 0.e0
-         a_rnf    = 0.e0
-         a_sshb   = 0.e0   ! averaged sea surface heigh at nit000 
-         a_sal000 = 0.e0   ! averaged ocean salinity at nit000
-         a_aminus = 0.e0
-         a_aplus  = 0.e0
-         
-         e1e2_i(:,:) = e1t(:,:) * e2t(:,:) * tmask_i(:,:)
-         a_sshb = SUM( e1e2_i(:,:) * sshn(:,:) )
-         IF( lk_mpp )   CALL  mpp_sum( a_sshb   )   ! sum over all the global domain
-         DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zwei  = e1e2_i(ji,jj) * fse3t(ji,jj,jk) * tmask(ji,jj,jk)
-                  a_sal000 = a_sal000 + ( sb(ji,jj,jk) - zsm0 ) * zwei
-               END DO
-            END DO
-         END DO
-         IF( lk_mpp )   CALL  mpp_sum( a_sal000 )   ! sum over the global domain
-
-      ENDIF
-      
-      ! cumulate surface freshwater budget at each time-step
-      ! --------------------------------------====----------
-      a_emp    = SUM( e1e2_i(:,:) * emp   (:,:) )
-      IF( lk_mpp )   CALL  mpp_sum( a_emp    )   ! sum over the global domain
-#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily
-      a_precip = SUM( e1e2_i(:,:) * watm  (:,:) )
-      IF( lk_mpp )   CALL  mpp_sum( a_precip )   ! sum over the global domain
-#endif
-      a_rnf    = SUM( e1e2_i(:,:) * runoff(:,:) )
-      IF( lk_mpp )   CALL  mpp_sum( a_rnf    )   ! sum over the global domain
-
-      IF( aminus /= 0.e0 ) a_aminus = a_aminus + ( MIN( aplus, aminus ) / aminus )
-      IF( aplus  /= 0.e0 ) a_aplus  = a_aplus  + ( MIN( aplus, aminus ) / aplus  )
-
-
-      ! Update empold if new year start
-      ikty = 365 * 86400 / rdttra(1)    !!bug  use of 365 days leap year or 360d year !!!!!!!
-      IF( MOD( kt, ikty ) == 0 ) THEN
-         zarea    = SUM( e1e2_i(:,:)            )
-         IF( lk_mpp )   CALL  mpp_sum( zarea    )   ! sum over the global domain
-         a_fwb_b = a_fwb
-         a_fwb   = SUM( e1e2_i(:,:) * sshn(:,:) )
-         IF( lk_mpp )   CALL  mpp_sum( a_fwb    )   ! sum over the global domain
-
-         a_fwb   = a_fwb * 1.e+3 / ( zarea * 86400. * 365. )    ! convert in Kg/m3/s = mm/s
-         !                                                      !!bug 365d year 
-         empold =  a_fwb                 ! current year freshwater budget correction
-         !                               ! estimate from the previous year budget
-      ENDIF
-
-
-      IF( kt == nitend ) THEN
-         zvol  = 0.e0
-         zempnew = 0.e0
-         ! Mean sea level at nitend
-         a_sshend = SUM( e1e2_i(:,:) * sshn(:,:) )
-         zarea    = SUM( e1e2_i(:,:)             )
-         
-         a_salend = 0.e0
-         DO jk = 1, jpkm1   
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zwei  = e1e2_i(ji,jj) * fse3t(ji,jj,jk) * tmask(ji,jj,jk)
-                  a_salend = a_salend + ( sn(ji,jj,jk) - zsm0 ) * zwei
-                  zvol  = zvol  + zwei
-               END DO
-            END DO
-         END DO
-         IF( lk_mpp ) THEN
-            CALL  mpp_sum( zarea    )   ! sums over all the global domain
-            CALL  mpp_sum( zvol     )        
-            CALL  mpp_sum( a_sshend )        
-            CALL  mpp_sum( a_salend )        
-         ENDIF
-
-         a_aminus = a_aminus / ( nitend - nit000 + 1 )
-         a_aplus  = a_aplus  / ( nitend - nit000 + 1 )
-
-         ! Conversion in m3
-         a_emp    = a_emp    * rdttra(1) * 1.e-3 
-         a_precip = a_precip * rdttra(1) * 1.e-3 / rday
-         a_rnf    = a_rnf    * rdttra(1) * 1.e-3
-         
-      ENDIF
-
-
-      ! Ecriture des diagnostiques 
-      ! --------------------------
-
-      IF( kt == nitend ) THEN
-
-         CALL ctlopn( inum, clname, 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL',   &
-            &           1, numout, .FALSE., 0 )
-         WRITE(inum, "(24X,I8,2ES24.16)" ) nyear, a_fwb_b, a_fwb
-         WRITE(inum,*)
-         WRITE(inum,*)    'Net freshwater budget '
-         WRITE(inum,9010) '  emp    = ', a_emp   , ' m3 =', a_emp   /((nitend-nit000+1)*rdttra(1)) * 1.e-6,' Sv'
-         WRITE(inum,9010) '  precip = ', a_precip, ' m3 =', a_precip/((nitend-nit000+1)*rdttra(1)) * 1.e-6,' Sv'
-         WRITE(inum,9010) '  a_rnf  = ', a_rnf   , ' m3 =', a_rnf   /((nitend-nit000+1)*rdttra(1)) * 1.e-6,' Sv'
-         WRITE(inum,*)
-         WRITE(inum,9010) '  zarea =',zarea
-         WRITE(inum,9010) '  zvol  =',zvol
-         WRITE(inum,*)
-         WRITE(inum,*)    'Mean sea level : '
-         WRITE(inum,9010) '  at nit000 = ',a_sshb           ,' m3 '
-         WRITE(inum,9010) '  at nitend = ',a_sshend         ,' m3 '
-         WRITE(inum,9010) '  diff      = ',(a_sshend-a_sshb),' m3 =', (a_sshend-a_sshb)/((nitend-nit000+1)*rdt) * 1.e-6,' Sv'
-         WRITE(inum,9020) '  mean sea level elevation    =', a_sshend/zarea,' m'
-         WRITE(inum,*)
-         WRITE(inum,*)    'Anomaly of salinity content : '
-         WRITE(inum,9010) '  at nit000 = ', a_sal000           ,' psu.m3 '
-         WRITE(inum,9010) '  at nitend = ', a_salend           ,' psu.m3 '
-         WRITE(inum,9010) '  diff      = ', a_salend - a_sal000,' psu.m3'
-         WRITE(inum,*)
-         WRITE(inum,*)    'Mean salinity : '
-         WRITE(inum,9020) '  at nit000 = ',  a_sal000/zvol+zsm0     ,' psu '
-         WRITE(inum,9020) '  at nitend = ',  a_salend/zvol+zsm0     ,' psu '
-         WRITE(inum,9020) '  diff      = ', (a_salend-a_sal000)/zvol,' psu'
-         WRITE(inum,9020) '  S-SLevitus= ',  a_salend          /zvol,' psu'
-         WRITE(inum,*)
-         WRITE(inum,*)    'Coeff : '
-         WRITE(inum,9030) '  Alpha+   =  ', a_aplus
-         WRITE(inum,9030) '  Alpha-   =  ', a_aminus
-         WRITE(inum,*)
-      ENDIF
-
- 9006 FORMAT(1X,A,ES24.16)
- 9010 FORMAT(1X,A,ES12.5,A,F10.5,A)
- 9020 FORMAT(1X,A,F10.5,A)
- 9030 FORMAT(1X,A,F8.2,A)
-
-   END SUBROUTINE flx_fwb
-
-
-   SUBROUTINE flx_fwb_init
-      !!---------------------------------------------------------------------
-      !!                ***  ROUTINE flx_fwb_init  ***
-      !!
-      !! ** Purpose :
-      !!
-      !! ** Method  :
-      !!  
-      !! History :
-      !!   9.0  !  03-09  (G. Madec)  Original code
-      !!    "   !  05-11  (V. Garnier) Surface pressure gradient organization
-      !!----------------------------------------------------------------------
-      !! * Local declarations
-      CHARACTER (len=32) ::   &
-         clname = 'EMPave_old.dat'
-      INTEGER ::   inum, iyear
-
-      NAMELIST/namfwb/ ln_fwb 
-      !!----------------------------------------------------------------------
-         
-      ! Read Namelist namfwb : freshWater Budget correction
-      ! --------------------
-      REWIND( numnam )
-      READ  ( numnam, namfwb )            
-      
-      ! Parameter control and print
-      ! ---------------------------
-      ! Control print
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'flx_fwb_init : FreshWater Budget correction'
-         WRITE(numout,*) '~~~~~~~~~~~~'
-         WRITE(numout,*) '               Namelist namfwb : set fwb parameters'
-         WRITE(numout,*) '                  use or not fwb correction      ln_fwb   = ', ln_fwb
-      ENDIF
-      ! Option consistency
-#if defined key_dynspg_rl
-      IF(lwp) WRITE '               Rigid-lid option, fwb correction is useless, but valid'
-#endif
-      IF( lk_cpl ) THEN
-         IF(lwp) WRITE(numout,*) '               Coupled option, fwb correction is a flux correction ! '
-         IF(lwp) WRITE(numout,*) '               ln_fwb = .FALSE. is recommanded'
-      ENDIF
-
-      IF( nbit_cmp == 1 .AND. ln_fwb ) THEN
-         CALL ctl_stop( ' Reproductibility tests (nbit_cmp=1) require ln_fwb = .false.' )
-      END IF
-
-      !                                        ! ==============================
-      IF( ln_fwb ) THEN                        !  Freshwater budget correction 
-         !                                     ! ==============================
-         ! Read the corrective factor on precipitations (empold)
-         CALL ctlopn( inum, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL',   &
-            &           1, numout, .FALSE., 1 )
-         READ ( inum, "(24X,I8,2ES24.16)" ) iyear, a_fwb_b, a_fwb
-         CLOSE( inum )
-         empold = a_fwb                  ! current year freshwater budget correction
-         !                               ! estimate from the previous year budget
-         IF(lwp)WRITE(numout,*)
-         IF(lwp)WRITE(numout,*)'flx_fwb_init : year = ',iyear  , ' freshwater budget correction = ', empold
-         IF(lwp)WRITE(numout,*)'               year = ',iyear-1, ' freshwater budget read       = ', a_fwb
-         IF(lwp)WRITE(numout,*)'               year = ',iyear-2, ' freshwater budget read       = ', a_fwb_b
-         !                                    ! ==============================
-      ELSE                                    !      NO  budget correction 
-         !                                    ! ==============================
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*)'               NO freshwater budget correction'
-         empold = 0.e0
-      ENDIF
-
-   END SUBROUTINE flx_fwb_init
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default case :                       
-   !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC ::   ln_fwb = .FALSE.   !: no fwb forced
-CONTAINS
-   SUBROUTINE flx_fwb( kt )                ! dummy routine
-      WRITE(*,*) 'flx_fwb: You should not have seen this print! error?', kt
-   END SUBROUTINE flx_fwb
-   SUBROUTINE flx_fwb_init
-   END SUBROUTINE flx_fwb_init
-#endif
-   !!======================================================================
-END MODULE flxfwb
Index: trunk/NEMO/OPA_SRC/SBC/flxmod.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flxmod.F90	(revision 873)
+++ 	(revision )
@@ -1,192 +1,0 @@
-MODULE flxmod
-   !!======================================================================
-   !!                       ***  MODULE  flxmod  ***
-   !! Ocean forcing:  thermohaline forcing of the ocean
-   !!=====================================================================
-   !! * Modules used
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! distribued memory computing library
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE daymod          ! calendar
-   USE ocfzpt          ! ocean freezing point
-
-#if defined key_oasis3 || defined key_oasis4
-#if defined key_oasis3
-   USE cpl_oasis3      ! OASIS3 coupling (to ECHAM5)
-#elif defined key_oasis4
-   USE cpl_oasis4      ! OASIS4 coupling (to ECHAM5)
-#endif
-   USE flx_oce, only : dqns_ice , & ! : derivative of non solar heat flux on sea ice
-                       qsr_oce  , & ! : solar flux over ocean
-                       qnsr_oce , & ! : total non solar heat flux (longwave downward radiation) over ocean
-                       qsr_ice  , & ! : solar flux over ice
-                       qnsr_ice , & ! : total non solar heat flux (Longwave downward radiation) over ice
-                       tn_ice   , & ! : ice surface temperature
-                       alb_ice  , & ! : albedo of ice
-                       sprecip  , & ! : solid (snow) precipitation over water (!) what about ice?
-                       tprecip  , & ! : total precipitation ( or liquid precip minus evaporation in coupled mode)
-                       calving  , & ! : calving
-                       rrunoff  , & ! : monthly runoff (kg/m2/s)
-                       fr1_i0   , & ! : 1st part of the fraction of sol.rad. which penetrate inside the ice cover
-                       fr2_i0       ! : 2nd part of the fraction of sol.rad. which penetrate inside the ice cover
-
-   USE ice, only    : hicif ,     & ! : ice thickness
-                      frld  ,     & ! : leads fraction = 1-a/totalarea
-                      hsnif  ,    & ! : snow thickness
-                      u_ice , v_ice ! : ice velocity
-
-   USE ice_oce, only : sst_io      ! : sea surface temperature
-
-#if defined key_cpl_ocevel
-   USE geo2ocean, only : repere, repcmo
-#endif
-#endif
-   IMPLICIT NONE
-   PRIVATE
-
-#if defined key_flx_core
-   LOGICAL, PUBLIC ::   lk_core = .TRUE.   !: CORE surface fluxes flag
-#else
-   LOGICAL, PUBLIC ::   lk_core = .FALSE.  !: CORE surface fluxes flag
-#endif
-
-#if defined key_oasis3 || defined key_oasis4
-   REAL(wp), DIMENSION(jpi,jpj) :: catm
-#endif
-   !! * Routine accessibility
-   PUBLIC flx       ! routine called by step.F90
-   PUBLIC flx_init  ! routine called by opa.F90
-
-   !! * local declarations
-   REAL(wp), PUBLIC ::            & !!! surface fluxes namelist (namflx)
-      q0    = 0.e0,               &  ! net heat flux
-      qsr0  = 0.e0,               &  ! solar heat flux
-      emp0  = 0.e0,               &  ! net freshwater flux
-      dqdt0 = -40.,               &  ! coefficient for SST damping (W/m2/K)
-      deds0 = 27.7                   ! coefficient for SSS damping (mm/day)
-   
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-#if defined key_flx_bulk_monthly
-   !!----------------------------------------------------------------------
-   !!   'key_flx_bulk_monthly'   and                           MONTHLY bulk
-   !!   Default option                                         Net CDF file
-   !!----------------------------------------------------------------------
-#  include "flx_bulk_monthly.h90"
-
-#elif defined key_flx_bulk_daily
-   !!----------------------------------------------------------------------
-   !!   'key_flx_bulk_daily'                                     DAILY bulk
-   !!                                                          Net CDF file
-   !!----------------------------------------------------------------------
-#  include "flx_bulk_daily.h90"
-
-#elif defined key_flx_core
-   !!----------------------------------------------------------------------
-   !!   'key_flx_core'   and                     NCAR data (Large & Yeager)
-   !!                                                          Net CDF file
-   !!----------------------------------------------------------------------
-#  include "flx_core.h90"
-
-#elif defined key_flx_forced_daily
-   !!----------------------------------------------------------------------
-   !!   'key_flx_forced_daily'                                 DAILY fluxes
-   !!                                                          Net CDF file
-   !!----------------------------------------------------------------------
-#  include "flx_forced_daily.h90"
-
-#elif defined key_oasis3  ||  defined key_oasis4
-   !!----------------------------------------------------------------------
-   !!   'key_oasis3'  or 'key_oasis4' and           Coupled Ocan/Atmosphere
-   !!   'key_lim3'                               with  LIM sea-ice model
-   !!----------------------------------------------------------------------
-#  include "flx_oasis_ice.h90"
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option                                   Analytical forcing
-   !!----------------------------------------------------------------------
-   !!   flx          : define the thermohaline fluxes for the ocean
-   !!----------------------------------------------------------------------
-   !! * Module used
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE flx ( kt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE flx  ***
-      !!              
-      !! ** Purpose :   provide the thermohaline fluxes (heat and freshwater)
-      !!      to the ocean at each time step.
-      !!
-      !! ** Method  :   Constant surface fluxes (read in namelist (namflx))
-      !!
-      !! ** Action  : - q, qt, qsr, emp, emps, qrp, erp
-      !!
-      !! History :
-      !!        !  91-03  ()  Original code
-      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-      !!---------------------------------------------------------------------
-
-      IF( kt == nit000 )  THEN
-         IF(lwp) WRITE(numout,*)' '
-         IF(lwp) WRITE(numout,*)'flx     : Analytical/Constant surface fluxes'
-         IF(lwp) WRITE(numout,*)'~~~~~~~ '
-         IF(lwp) WRITE(numout,*)'          See the routine oce_sbc'     
-         IF(lwp) WRITE(numout,*)' '
-      ENDIF
-
-   END SUBROUTINE flx
-
-#endif
-
-
-   SUBROUTINE flx_init
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE flx  ***
-      !!              
-      !! ** Purpose :   provide the thermohaline fluxes (heat and freshwater)
-      !!      to the ocean at each time step.
-      !!
-      !! ** Method  :   Constant surface fluxes (read in namelist (namflx))
-      !!
-      !! ** Action  : - q, qt, qsr, emp, emps, qrp, erp
-      !!
-      !! History :
-      !!        !  91-03  ()  Original code
-      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      NAMELIST/namflx/ q0, qsr0, emp0, dqdt0, deds0
-      !!---------------------------------------------------------------------
-
-      ! Read Namelist namflx : surface thermohaline fluxes
-      ! --------------------
-      REWIND ( numnam )
-      READ   ( numnam, namflx )
-
-      IF(lwp) THEN
-         WRITE(numout,*)' '
-         WRITE(numout,*)'flx_init : thermohaline forcing '
-         WRITE(numout,*)'~~~~~~~~ '
-         WRITE(numout,*)'           net heat flux                  q0   = ', q0  , ' W/m2'
-         WRITE(numout,*)'           solar heat flux                qsr0 = ', qsr0, ' W/m2'
-         WRITE(numout,*)'           net heat flux                  emp0 = ', emp0, ' W/m2'
-         WRITE(numout,*)'           coefficient for SST damping   dqdt0 = ', dqdt0,' W/m2/K'
-         WRITE(numout,*)'           coefficient for SSS damping   deds0 = ', deds0,' mm/day'
-      ENDIF
-
-   END SUBROUTINE flx_init
-
-END MODULE flxmod
Index: trunk/NEMO/OPA_SRC/SBC/flxrnf.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flxrnf.F90	(revision 873)
+++ 	(revision )
@@ -1,322 +1,0 @@
-MODULE flxrnf
-   !!======================================================================
-   !!                       ***  MODULE  flxrnf  ***
-   !! Ocean forcing:  runoff
-   !!=====================================================================
-#if defined key_orca_r05
-   !!----------------------------------------------------------------------
-   !!   'key_orca_r05'                               ORCA R05 configuration
-   !!----------------------------------------------------------------------
-#  include "flxrnf_ORCA_R05.h90"
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option                                     Standard runoffs
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   flx_rnf      : monthly runoff read in a NetCDF file
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE dom_oce         ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE in_out_manager  ! I/O manager
-   USE daymod          ! calendar
-   USE iom             ! I/O module
-
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Routine accessibility
-   PUBLIC flx_rnf          ! routine call in step module
-
-   !! * Shared module variables
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-      runoff,           &  !: monthly runoff (kg/m2/s)
-      upsadv,           &  !: mixed adv scheme in straits vicinity (hori.)
-      upsrnfh              !: mixed adv scheme in runoffs vicinity (hori.)
-   REAL(wp), PUBLIC, DIMENSION(jpk) ::   &  !:
-      upsrnfz              !: mixed adv scheme in runoffs vicinity (vert.)
-   INTEGER, PUBLIC ::   &  !:
-      nrunoff =  0         !: runoff option (namelist)
-
-   !! * Module variable
-   REAL(wp), DIMENSION(jpi,jpj,2) ::   &  !:
-      rnfdta               !: monthly runoff data array (kg/m2/s)
-   INTEGER  ::          &  !:
-      numrnf,           &  !: logical unit for runoff data
-      nrnf1, nrnf2         !: first and second record used
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE flx_rnf( kt )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE flx_rnf  ***
-      !!       
-      !! ** Purpose :   Introduce a climatological run off forcing
-      !!
-      !! ** Method :
-      !!      Initialze each mouth of river with a monthly climatology 
-      !!      provided from different data.
-      !!     C a u t i o n : upward water flux, runoff is negative
-      !!                     set at the last loop of the routine
-      !!
-      !! ** Action :
-      !!
-      !! References : 
-      !!       J. D. Milliman and R. H. Meade, 1983 : world-wide delivery
-      !!          of river sediment to the oceans, journal of geology vol 91
-      !!          pp 1-21.
-      !!       G. L. Russell and J. R. Miller, 1990 : global river runoff
-      !!          calculated from a global atmospheric general circulation
-      !!          model, journal of hydrology, 117(1990), pp 241-254.
-      !!       F. Van Der Leeden, Troise F. L., Todd D. K. : the water
-      !!          encyclopedia, second edition, lewis publishers.
-      !!       J. W. Weatherly, J. E. Walsh : The effects of precipitation
-      !!          and river runoff in a coupled ice-ocean model of Arctic
-      !!          Climate dynamics 1996 12:785,798
-      !!       Jacobs et al. 1992. J. Glaciol. 38 (130) 375-387.
-      !!
-      !! History :
-      !!        !  94-10  (G.Madec, M. Pontaud, M. Imbard)  Original code
-      !!        !  97-03  (G.Madec)  time dependent version
-      !!        !  98-06  (J.M. Molines)  exact computation of zxy 
-      !!                         for months that are not 30 days
-      !!        !  98-07  (M. Imbard)  ORCA and mpp option
-      !!        !  99-08  (J.P. Boulanger H.L.Ayina)  New rivers and 
-      !!                         values given in m3/s 
-      !!        !  00-04  (G. Madec, K. Roberts) add antarctica ice discharge.
-      !!        !  00-11  (R. Hordoir, E. Durand)  NetCDF FORMAT
-      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt       ! ocean time step
-
-      !! * Local declarations
-# if ! defined key_coupled
-      INTEGER  ::   ji, jj                 ! dummy loop indices
-      INTEGER ::   &
-         i15 , imois , iman,            &  ! temporary integers
-         idbd, idmeom                      !    "          "
-      REAL(wp) ::   zxy
-# endif
-      INTEGER  ::   ii0, ii1, ij0, ij1     !    "          "
-      !!----------------------------------------------------------------------
-      
-      IF( kt == nit000 ) THEN
-
-         SELECT CASE ( nrunoff )
-
-         CASE ( 0 )
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'flx_rnf : No runoff in this simulation (nrunoff=0)'
-            IF(lwp) WRITE(numout,*) '~~~~~~~'
-            
-         CASE ( 1 )
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'flx_rnf : monthly runoff (nrunoff=1)'
-            IF(lwp) WRITE(numout,*) '~~~~~~~'
-
-         CASE ( 2 )
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'flx_rnf : monthly runoff with upsteam advection'
-            IF(lwp) WRITE(numout,*) '~~~~~~~   in the vicinity of river mouths (nrunoff=2)'
-
-         CASE DEFAULT
-            WRITE(ctmp1,*) ' Error nrunoff = ', nrunoff, ' /= 0, 1 or 2'
-            CALL ctl_stop( ctmp1 )
-
-         END SELECT
-
-         ! Set runoffs and upstream coeff to zero
-         upsadv (:,:) = 0.e0
-
-      ENDIF
-
-
-      ! 1. Initialization
-      ! -----------------
-
-      IF( nrunoff == 1 .OR. nrunoff == 2 ) THEN
-# if ! defined key_coupled
-
-         ! year, month, day
-         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
-         ! Number of days in the month
-         IF( nleapy == 1 .AND. MOD( nyear, 4 ) == 0 ) THEN
-            idbd = nbiss(imois)
-         ELSEIF( nleapy > 1 ) THEN
-            idbd = nleapy
-         ELSE
-            idbd = nobis(imois)
-         ENDIF
-         ! Number of days between imois, 15 and the end of month
-         idmeom = idbd - 15
-# endif
-         
-         ! Open file
-
-         IF( kt == nit000 ) THEN
-
-            nrnf1 = 0   ! initialization
-            IF (lwp) WRITE(numout,*) 'flx_rnf : Monthly runoff'
-            CALL iom_open ( 'runoff_1m_nomask.nc', numrnf )
-            
-         ENDIF
-         
-# if ! defined key_coupled
-
-         ! 2. Read monthly file of runoff
-         ! ------------------------------
-
-         IF( kt == nit000 .OR. imois /= nrnf1 ) THEN
-
-            ! Calendar computation for interpolation
-            !     nrnf1 number of the first array record used in the simulation
-            !     nrnf2 number of the last  array record
-
-            nrnf1 = imois
-            nrnf2 = nrnf1 + 1
-            nrnf1 = MOD( nrnf1, iman )
-            IF( nrnf1 == 0 ) nrnf1 = iman
-            nrnf2 = MOD( nrnf2, iman )
-            IF( nrnf2 == 0 ) nrnf2 = iman
-            
-            IF(lwp) THEN
-               WRITE(numout,*)
-               WRITE(numout,*) ' runoff monthly field'
-               WRITE(numout,*) ' --------------------'
-               WRITE(numout,*) ' NetCDF format'
-               WRITE(numout,*)
-               WRITE(numout,*) 'first array record used nrnf1 ', nrnf1
-               WRITE(numout,*) 'last  array record used nrnf2 ', nrnf2
-               WRITE(numout,*)
-            ENDIF
-            
-            ! Read monthly runoff data in kg/m2/s
-
-            CALL iom_get ( numrnf, jpdom_data, 'sorunoff', rnfdta(:,:,1), nrnf1 )
-            CALL iom_get ( numrnf, jpdom_data, 'sorunoff', rnfdta(:,:,2), nrnf2 )
-
-         ENDIF
-
-         ! Linear interpolation and conversion in upward water flux
-         ! C a u t i o n : runoff is negative and in kg/m2/s 
-
-         zxy = FLOAT( nday + idmeom - idbd * i15 ) / idbd
-
-         runoff(:,:) = -( ( 1.e0 - zxy ) * rnfdta(:,:,1) + zxy * rnfdta(:,:,2) )
-
-         ! Runoff reduction only associated to the ORCA2_LIM configuration
-         ! when reading the NetCDF file runoff_1m_nomask.nc
-         IF( cp_cfg == 'orca' .AND. jp_cfg == 2 )   THEN
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  IF( gphit(ji,jj) > 40 .AND. gphit(ji,jj) < 65 )   runoff(ji,jj) = 0.85 * runoff(ji,jj)
-               END DO
-            END DO
-         ENDIF
-         
-# endif
-
-      ENDIF
-
-
-      ! 3. Mixed advection scheme 
-      ! -------------------------
-
-      IF( nrunoff == 2 .AND. kt == nit000 ) THEN
-
-         ! Upstream and centered scheme in the vicinity of river mouths
-
-         !  Creates the array coef that contains the coefficient to affect to
-         !  the upstream scheme. advection scheme will be:
-         !  coefr * upstream + (1- coefr) centered
-         !  coefr must be between 0 and 1.
-
-         CALL iom_get ( numrnf, jpdom_data, 'socoefr', upsrnfh )
-         
-         upsrnfz(:)   = 0.e0
-         upsrnfz(1)   = 1.0
-         upsrnfz(2)   = 1.0
-         upsrnfz(3)   = 0.5
-         upsrnfz(4)   = 0.25
-         upsrnfz(5)   = 0.125
-         
-         IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN
-            ! ORCA_R2 configuration : upstream scheme in the Sound Strait
-            ij0 = 116   ;   ij1 = 116
-            ii0 = 144   ;   ii1 = 144   ;   upsrnfh( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
-            ii0 = 145   ;   ii1 = 147   ;   upsrnfh( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
-            ii0 = 148   ;   ii1 = 148   ;   upsrnfh( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
-         ENDIF
-
-      ENDIF
-
-      ! Upstream and centered scheme in the vicinity of some straits
-
-      IF( kt == nit000 ) THEN 
-
-         IF( cp_cfg == "orca" ) THEN
-
-            SELECT CASE ( jp_cfg )
-            !                                        ! =======================
-            CASE ( 4 )                               !  ORCA_R4 configuration 
-               !                                     ! =======================
-
-               !                                          ! Gibraltar Strait
-               ii0 =  70   ;   ii1 =  71
-               ij0 =  52   ;   ij1 =  53   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
-         
-               !                                     ! =======================
-            CASE ( 2 )                               !  ORCA_R2 configuration 
-               !                                     ! =======================
-
-               !                                          ! Gibraltar Strait
-               ij0 = 102   ;   ij1 = 102
-               ii0 = 138   ;   ii1 = 138   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.20
-               ii0 = 139   ;   ii1 = 139   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.40
-               ii0 = 140   ;   ii1 = 140   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
-               ij0 = 101   ;   ij1 = 102
-               ii0 = 141   ;   ii1 = 141   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
-
-               !                                          ! Bab el Mandeb Strait
-               ij0 =  87   ;   ij1 =  88
-               ii0 = 164   ;   ii1 = 164   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.10
-               ij0 =  88   ;   ij1 =  88
-               ii0 = 163   ;   ii1 = 163   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
-               ii0 = 162   ;   ii1 = 162   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.40
-               ii0 = 160   ;   ii1 = 161   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
-               ij0 =  89   ;   ij1 =  89
-               ii0 = 158   ;   ii1 = 160   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
-               ij0 =  90   ;   ij1 =  90
-               ii0 = 160   ;   ii1 = 160   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
-
-               !                                          ! Sound Strait
-               ij0 = 116   ;   ij1 = 116
-               ii0 = 145   ;   ii1 = 147   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
-         
-            END SELECT 
-
-         ENDIF
-
-      ENDIF
-     
-      ! 4. Closing all files
-      ! --------------------
-
-      IF( kt == nitend .AND. nrunoff >= 1 )   CALL iom_close( numrnf )
-
-   END SUBROUTINE flx_rnf
-
-#endif
-   !!======================================================================
-END MODULE flxrnf
Index: trunk/NEMO/OPA_SRC/SBC/flxrnf_ORCA_R05.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flxrnf_ORCA_R05.h90	(revision 873)
+++ 	(revision )
@@ -1,1537 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                  *** flxrnf_ORCA_R05.h90  ***
-   !!----------------------------------------------------------------------
-   !!   flx_rnf      : update ocean runoffs for ORCA_R05 configuration
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE dom_oce         ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE in_out_manager  ! I/O manager
-   USE daymod          ! calendar
-
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Routine accessibility
-   PUBLIC flx_rnf         ! routine call by step.F90
-
-   !! * Shared module variables
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-      runoff,            &  !: monthly runoff (kg/m2/s)
-      upsadv,            &  !: mixed adv scheme in straits vicinity (hori.)
-      upsrnfh               !: mixed adv scheme in runoffs vicinity (hori.)
-   REAL(wp), PUBLIC, DIMENSION(jpk) ::   &  !:
-      upsrnfz               !: mixed adv scheme in runoffs vicinity (vert.)
-   INTEGER , PUBLIC ::   &  !:
-      nrunoff =  0          !: runoff option (namelist)
-
-   !! * Module variable
-   REAL(wp), DIMENSION(jpi,jpj,2) ::   &  !:
-      rnfdta                !: monthly runoff data array (kg/m2/s)
-   INTEGER    ::         &  !:
-      nrnf1, nrnf2          !: first and second record used
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE flx_rnf( kt )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE flx_rnf  ***
-      !!       
-      !! ** Purpose :   Introduce a climatological run off forcing
-      !!
-      !! ** Method  :   ORCA R05 configuration
-      !!      Initialze each mouth of river with a monthly climatology 
-      !!      provided from different data.
-      !!     C a u t i o n : upward water flux, runoff is negative
-      !!                     set at the last loop of the routine
-      !!
-      !! ** Action :
-      !!
-      !! References : 
-      !!       J. D. Milliman and R. H. Meade, 1983 : world-wide delivery
-      !!          of river sediment to the oceans, journal of geology vol 91
-      !!          pp 1-21.
-      !!       G. L. Russell and J. R. Miller, 1990 : global river runoff
-      !!          calculated from a global atmospheric general circulation
-      !!          model, journal of hydrology, 117(1990), pp 241-254.
-      !!       F. Van Der Leeden, Troise F. L., Todd D. K. : the water
-      !!          encyclopedia, second edition, lewis publishers.
-      !!       J. W. Weatherly, J. E. Walsh : The effects of precipitation
-      !!          and river runoff in a coupled ice-ocean model of Arctic
-      !!          Climate dynamics 1996 12:785,798
-      !!       Jacobs et al. 1992. J. Glaciol. 38 (130) 375-387.
-      !!
-      !! History :
-      !!        !  94-10  (G.Madec, M. Pontaud, M. Imbard)  Original code
-      !!        !  97-03  (G.Madec)  time dependent version
-      !!        !  98-06  (J.M. Molines)  exact computation of zxy 
-      !!                         for months that are not 30 days
-      !!        !  98-07  (M. Imbard)  ORCA and mpp option
-      !!        !  99-08  (J.P. Boulanger H.L.Ayina)  New rivers and 
-      !!                         values given in m3/s 
-      !!        !  00-04  (G. Madec, K. Roberts) add antarctica ice discharge.
-      !!        !  00-11  (R. Hordoir, E. Durand)  NetCDF FORMAT
-      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Modules used
-
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt ! ocean time step
-
-#if defined key_coupled
-      runoff(:,:) = 0.0e0
-#else
-      !!----------------------------------------------------------------------
-      !!  ORCA_R05
-      !!----------------------------------------------------------------------
-      !! * Local declarations
-      INTEGER, PARAMETER ::   &
-         jpmois=12,   &  ! number of month in the year !
-         jpriv=200,   &  ! maximum number of rivers
-         jpcoef=20       ! maximum number of gridpoints for mouth rivers
-
-      INTEGER  ::   ji, jj, jl, jm, jn, jr, jc
-      INTEGER  ::   i15, imois, iman
-      INTEGER  ::   inbp, idbd, idmeom
-      INTEGER  ::   iirnf(jpcoef,jpriv),ijrnf(jpcoef,jpriv)
-      INTEGER  ::   inb(jpriv)
-
-      REAL(wp) ::   zconv, zxy
-      REAL(wp) ::   zrup1,zrup2,zrup3
-      REAL(wp) ::   zrnfm(jpmois, jpriv)
-      REAL(wp) ::   zcoefr(jpi, jpj, 5)
-      !!----------------------------------------------------------------------
-      !!  OPA 8.5, LODYC-IPSL (2002)
-      !!----------------------------------------------------------------------
-      ! ====
-      ! DATA
-      ! ====
-
-      ! I NORTH AMERICA
-      ! ---------------
-
-      ! 1-Saint Lawrence (Canada) 49N30 67W00               R2
-      ! Old=447 km3/year=14165m3/s; CLIPPER=12430m3/s; ratio=1.14
-      ! --> 13975.249m3/s
-      DATA inb(1)/3/
-      DATA (iirnf(jc,1),jc=1,jpcoef)/ 444, 444, 444, 17*0 /
-      DATA (ijrnf(jc,1),jc=1,jpcoef)/ 367, 368, 369, 17*0 /
-      DATA (zrnfm(jm,1),jm=1,jpmois)/   &
-          11718.,  11971.,  12466.,  14980.,  19257.,  16913.,   &
-          14211.,  13119.,  13367.,  13644.,  13463.,  12594./
-      ! 2-Hudson River (USA) 41N00 77W00                    R1
-      ! Old=12 km3/year=380m3/s; UNESCO(64-83,p255)=408m3/s
-      ! --> 407.416687m3/s
-      DATA inb(2)/1/
-      DATA (iirnf(jc,2),jc=1,jpcoef)/ 426, 19*0 /
-      DATA (ijrnf(jc,2),jc=1,jpcoef)/ 336, 19*0 /
-      DATA (zrnfm(jm,2),jm=1,jpmois)/   &
-          364.,    404.,    648.,    873.,    593.,    301.,   &
-          205.,    171.,    205.,    290.,    379.,    456./
-      ! 3-Missisipi and Atchafalaya (USA) 29N 90W           R1 
-      ! Old=580 km3/year=18380m3/s; CLIPPER=17599m3/s
-      ! --> 17599.334m3/s
-      DATA inb(3)/2/
-      DATA (iirnf(jc,3),jc=1,jpcoef)/ 397, 398, 18*0 /
-      DATA (ijrnf(jc,3),jc=1,jpcoef)/ 312, 313, 18*0 /
-      DATA (zrnfm(jm,3),jm=1,jpmois)/   &
-          19260.,  20813.,  23026.,  28160.,  26510.,  19650.,   &
-          14181.,  10676.,   9578.,  10167.,  11699.,  17472./
-      ! 4-Brazos (USA) 29N58 95W53                          R1
-      ! Old=7 km3/year=222m3/s; UNESCO(65-84, p298)=200m3/s
-      ! --> 199.666656m3/s
-      DATA inb(4)/1/
-      DATA (iirnf(jc,4),jc=1,jpcoef)/ 386, 19*0 /
-      DATA (ijrnf(jc,4),jc=1,jpcoef)/ 311, 19*0 /
-      DATA (zrnfm(jm,4),jm=1,jpmois)/   &
-          165.,    224.,    200.,    266.,    457.,    327.,   &
-          143.,     69.,    102.,    132.,    160.,    151./
-      ! 5-Colorado (Mexico) 31N54 114W57                    R5
-      ! Old=20 km3/year=634m3/s
-      ! --> 634.m3/s
-      DATA inb(5)/2/
-      DATA (iirnf(jc,5),jc=1,jpcoef)/ 347, 348, 18*0 /
-      DATA (ijrnf(jc,5),jc=1,jpcoef)/ 316, 316, 18*0 /
-      DATA (zrnfm(jm,5),jm=1,jpmois)/12*634./ 
-      ! 6-Columbia (USA) 45N60 121W17                       R1
-      ! Old=251 km3/year=7954m3/s; UNESCO(65-84, p312)=5368m3/s
-      ! --> 5368.41602m3/s
-      DATA inb(6)/2/
-      DATA (iirnf(jc,6),jc=1,jpcoef)/ 326, 326, 18*0 /
-      DATA (ijrnf(jc,6),jc=1,jpcoef)/ 360, 361, 18*0 /
-      DATA (zrnfm(jm,6),jm=1,jpmois)/   &
-          4752.,    5077.,    5633.,    6075.,    8422.,    9822.,   &
-          6350.,    4112.,    3273.,    3251.,    3548.,    4106./ 
-      ! 7-Fraser (USA)                                      R5
-      ! Old=112 km3/year=3550m3/s;not found in UNESCO
-      ! --> 3549.99976m3/s
-      DATA inb(7)/2/
-      DATA (iirnf(jc,7),jc=1,jpcoef)/ 317, 317, 18*0 /
-      DATA (ijrnf(jc,7),jc=1,jpcoef)/ 378, 379, 18*0 /
-      DATA (zrnfm(jm,7),jm=1,jpmois)/12*3550./ 
-      ! 8-Yukon (USA) 63N00 165W00                          R3
-      ! Old=195 km3/year=6179m3/s; UNESCO(65-77+80-84, p321)=4245; ratio=1.46
-      ! --> 6017.24951m3/s
-      DATA inb(8)/2/
-      DATA (iirnf(jc,8),jc=1,jpcoef)/ 244, 244, 18*0 /
-      DATA (ijrnf(jc,8),jc=1,jpcoef)/ 413, 414, 18*0 /
-      DATA (zrnfm(jm,8),jm=1,jpmois)/   &
-           1459.,    1213.,    1065.,    1100.,    9067.,   17675.,   &
-          10680.,   11271.,    8658.,    5453.,    2649.,    1917./ 
-      ! 9-Copper (USA) 61N47 144W45                         R2
-      ! Old=39 km3/year=1236m3/s; UNESCO(65-84, p317)=1052m3/s; ratio=1.18
-      ! --> 1236.25m3/s
-      DATA inb(9)/1/
-      DATA (iirnf(jc,9),jc=1,jpcoef)/ 274, 19*0 /
-      DATA (ijrnf(jc,9),jc=1,jpcoef)/ 409, 19*0 /
-      DATA (zrnfm(jm,9),jm=1,jpmois)/   &
-           219.,    195.,    181.,    214.,    904.,   2532.,   &
-          4026.,   3627.,   1632.,    697.,    354.,    254./ 
-      ! 10-Susitna (USA)                                    R5
-      ! Old=40 km3/year=1268m3/s
-      ! --> 1268.m3/s
-      DATA inb(10)/2/
-      DATA (iirnf(jc,10),jc=1,jpcoef)/ 263, 264, 18*0 /
-      DATA (ijrnf(jc,10),jc=1,jpcoef)/ 405, 405, 18*0 /
-      DATA (zrnfm(jm,10),jm=1,jpmois)/12*1268./ 
-      ! 11-McKenzie (Canada) 70N00 135W00                   R3
-      ! Old=306 km3/year=9697m3/s; UNESCO(67+72+7479+82-84, p168)=8343m3/s;
-      ! ratio=1.16
-      ! --> 9606.66797m3/s
-      DATA inb(11)/3/
-      DATA (iirnf(jc,11),jc=1,jpcoef)/ 272, 272, 272, 17*0 /
-      DATA (ijrnf(jc,11),jc=1,jpcoef)/ 451, 452, 453, 17*0 /
-      DATA (zrnfm(jm,11),jm=1,jpmois)/   &
-           3644.,    3400.,    3258.,    3546.,   14188.,   21544.,   &
-          18954.,   15487.,   11284.,   10169.,    5901.,    3905./
-      ! 12-Kuksokwim (USA) 60N00 ~162W30                    R4
-      ! UNESCO(65-84, p318)=1112m3/s (61N87 158E10, Crooked Creek, inland)
-      ! --> 1111.99988m3/s
-      DATA inb(12)/2/
-      DATA (iirnf(jc,12),jc=1,jpcoef)/ 244, 244, 18*0 /
-      DATA (ijrnf(jc,12),jc=1,jpcoef)/ 413, 414, 18*0 /
-      DATA (zrnfm(jm,12),jm=1,jpmois)/   &
-          335.,     308.,     295.,     407.,    2415.,    2027.,   &
-          1917.,   2049.,    1585.,    1072.,     545.,     389./     
-
-      DATA inb(13)/0/
-      DATA inb(14)/0/
-      DATA inb(15)/0/
-
-      ! Total run-offs(I)=60974.2539m3/s
-
-      ! II SOUTH AMERICA
-      ! -----------------
-      ! 16-Chira (Peru) 4s54 81w08                          R2
-      ! Old=5 km3/year=158m3/s; UNESCO (65-68, p357)=80.9; ratio=1.95
-      ! --> 158.000015m3/s
-      DATA inb(16)/1/
-      DATA (iirnf(jc,16),jc=1,jpcoef)/ 414, 19*0 /
-      DATA (ijrnf(jc,16),jc=1,jpcoef)/ 244, 19*0 /
-      DATA (zrnfm(jm,16),jm=1,jpmois)/   &
-          70.,     105.,     564.,     582.,     230.,      94.,   &
-          87.,      47.,      35.,      32.,      29.,      21./
-      ! 17-Magdalena (Colombia) 11N06 74W51                 R2
-      ! Old=237 km3/year=7510m3/s; UNESCO(71-73+76-79, p348)=6973m3/s;
-      ! ratio=1.08
-      ! --> 7451.58301m3/s
-      DATA inb(17)/2/
-      DATA (iirnf(jc,17),jc=1,jpcoef)/ 424, 424, 18*0 /
-      DATA (ijrnf(jc,17),jc=1,jpcoef)/ 270, 271, 18*0 /
-      DATA (zrnfm(jm,17),jm=1,jpmois)/   &
-          6598.,    4441.,    4087.,    5445.,    7380.,    8067.,   &
-          8509.,    7428.,    7631.,    9296.,   10588.,    9949./
-      ! 18-Orinoco (Venezuela) 8N37 62W15!                  R1
-      ! Old=1100 km3/year=34857m3/s; UNESCO(73-75, p364)=28736m3/s;
-      ! HLA=26371m3/s
-      ! Data from HLA: 8.1N - 63.3W   1925/89
-      ! --> 26371.416
-      DATA inb(18)/5/
-      DATA (iirnf(jc,18),jc=1,jpcoef)/ 451, 451, 452, 452, 452, 15*0 /
-      DATA (ijrnf(jc,18),jc=1,jpcoef)/ 271, 272, 271, 272, 272, 15*0 /
-      DATA (zrnfm(jm,18),jm=1,jpmois)/   &
-          10670.,    7513.,    6344.,    6887.,   13086.,   26699.,   &
-          43938.,   59957.,   57435.,   39951.,   27410.,   16567./ 
-      ! 19-Amazon (Brazil) 0S05 50W00                       R1
-      ! Old=6300 km3/year=199634m3/s; CLIPPER=166192m3/s~UNESCO;
-      ! HLA=184806m3/s
-      ! UNESCO data are at Obidos which is far inland and therefore does not
-      ! fully represent the actual discharge
-      ! Data from HLA: 1.5N - 55.3W   1970/96
-      ! --> 184845.484m3/s
-      DATA inb(19)/14/
-      DATA (iirnf(jc,19),jc=1,jpcoef)/ 475, 476, 476, 476, 476,  &
-                                       477, 477, 477, 477, 477,  &
-                                       478, 478, 478, 478, 6*0 /
-      DATA (ijrnf(jc,19),jc=1,jpcoef)/ 254, 251, 252, 253, 254,  &
-                                       250, 251, 252, 253, 254,  &
-                                       250, 251, 252, 253, 6*0 /
-      DATA (zrnfm(jm,19),jm=1,jpmois)/   &
-          152233., 176415., 199941., 225565., 244016., 244861.,   &
-          230711., 203128., 164531., 128486., 118214., 130045. /
-      ! 20-Sao Francisco (Brazil) 10S30 36W24               R1
-      ! Old=97 km3/year=3074m3/s; UNESCO(77-79, p338)=2645m3/s
-      ! --> 2645.3335m3/s
-      DATA inb(20)/1/
-      DATA (iirnf(jc,20),jc=1,jpcoef)/ 498, 19*0 /
-      DATA (ijrnf(jc,20),jc=1,jpcoef)/ 223, 19*0 /
-      DATA (zrnfm(jm,20),jm=1,jpmois)/   &
-          3244.,   4116.,   5139.,   4330.,   2323.,   1800.,     &
-          1587.,   1511.,   1593.,   1740.,   2190.,   2171. /
-      ! 21-Parana+Uruguay(Arg./Uru.) 34S12 58W18            R1 
-      ! Old=470 km3/year=14893m3/s; UNESCO(p323/324)=22263m3/s
-      ! --> 22203.168m3/s 
-      DATA inb(21)/5/
-      DATA (iirnf(jc,21),jc=1,jpcoef)/ 462, 462, 462, 462, 463, 15*0 /
-      DATA (ijrnf(jc,21),jc=1,jpcoef)/ 172, 173, 174, 175, 175, 15*0 /
-      DATA (zrnfm(jm,21),jm=1,jpmois)/   &
-          24803.,   26836.,   24585.,   21358.,   20041.,   21689.,   &
-          22647.,   20403.,   19627.,   21400.,   21126.,   21923./
-      ! 22-Negro (Argentina)  41S02  62W47                  R2
-      ! Old=30 km3/year=951m3/s; UNESCO(65-79,p330)=765m3/s; ratio=1.24
-      ! --> 907.666687m3/s
-      DATA inb(22)/2/
-      DATA (iirnf(jc,22),jc=1,jpcoef)/ 446, 447, 18*0 /
-      DATA (ijrnf(jc,22),jc=1,jpcoef)/ 160, 160, 18*0 /
-      DATA (zrnfm(jm,22),jm=1,jpmois)/   &
-          882.,     587.,     519.,     482.,     623.,     984.,   &
-          1120.,   1294.,    1092.,    1166.,    1105.,    1038./
-      ! 23- Tocantins :  ~48W00 ~0.5S                       R4
-      ! UNESCO(76-77+80-81, p335)=12167m3/s (station far inland!)
-      ! --> 12173.082m3/s
-      DATA inb(23)/4/
-      DATA (iirnf(jc,23),jc=1,jpcoef)/ 479, 480, 481, 482, 16*0 /
-      DATA (ijrnf(jc,23),jc=1,jpcoef)/ 249, 249, 249, 249, 16*0 /
-      DATA (zrnfm(jm,23),jm=1,jpmois)/   &
-          15507.,  24855.,  27854.,  24257.,  15860.,   7861.,   &
-          4440.,   3082.,   2728.,   3417.,   5511.,  10705. /
-
-      DATA inb(24)/0/
-      DATA inb(25)/0/
-
-      ! Total run-offs(II)=256755.75
-      ! Total run-offs(I+II)=317730
-
-      ! III EUROPE
-      ! ----------
-      ! 26-Rhone (France) 43N20 4E50                        R1 
-      ! Old=49 km3/year=1553m3/s; UNESCO(65-83, p512)=1229
-      ! --> 1217.16663m3/s
-      DATA inb(26)/1/
-      DATA (iirnf(jc,26),jc=1,jpcoef)/ 584, 19*0 /
-      DATA (ijrnf(jc,26),jc=1,jpcoef)/ 347, 19*0 /
-      DATA (zrnfm(jm,26),jm=1,jpmois)/   &
-          1385.,    1848.,    1568.,    1311.,    1420.,    1191.,   &
-           937.,     796.,     794.,     962.,    1161.,    1233./
-      ! 27-Po (Italy) 11N10 1W09                            R1 
-      ! Old=46 km3/year=1458m3/s; UNESCO(65-84, p527)=1550m3/s
-      ! --> 1550.08337m3/s
-      DATA inb(27)/1/
-      DATA (iirnf(jc,27),jc=1,jpcoef)/ 599, 19*0 /
-      DATA (ijrnf(jc,27),jc=1,jpcoef)/ 355, 19*0 /
-      DATA (zrnfm(jm,27),jm=1,jpmois)/   &
-          1304.,    1605.,    1856.,    1549.,    1958.,    1760.,   &
-          1040.,    1007.,    1615.,    1907.,    1772.,    1228./
-      ! 28-Danube (Roumania) 45N20 29E40                    R1 
-      ! Old=206 km3/year=6527m3/s; UNESCO(65-84, p544)=7011m3/s
-      ! --> 7011.8335m3/s
-      DATA inb(28)/2/
-      DATA (iirnf(jc,28),jc=1,jpcoef)/ 632, 632, 18*0 /
-      DATA (ijrnf(jc,28),jc=1,jpcoef)/ 356, 357, 18*0 /
-      DATA (zrnfm(jm,28),jm=1,jpmois)/   &
-          6625.,    7352.,    7986.,    9279.,    9482.,    8618.,   &
-          7586.,    6001.,    5210.,    4989.,    4921.,    6093./
-
-      DATA inb(29)/0/
-      DATA inb(30)/0/
-
-      ! Total run-offs(III)=9779.08301m3/s
-      ! Total run-offs(I+II+III)=327509.094m3/s
-      
-      ! IV EURASIAN ARCTIC
-      ! ------------------
-      ! 31-Iana (Russia)                                    R1
-      ! Old=29 km3/year=919m3/s; UNESCO(65-72+74+76-84, p463)=936m3/s
-      ! --> 0m3/s
-      DATA inb(31)/0/
-      DATA (iirnf(jc,31),jc=1,jpcoef)/ 20*0 /
-      DATA (ijrnf(jc,31),jc=1,jpcoef)/ 20*0 /
-      DATA (zrnfm(jm,31),jm=1,jpmois)/   &
-             2.,       1.,       0.,       0.,     917.,    3514.,   &
-          2968.,    2329.,    1322.,     178.,      36.,       8./ 
-      ! 32-Ob (Russia) 66N45 69E30                          R1 
-      ! Old=385 km3/year=12200m3/s; UNESCO(65-84, p478)=12862m3/s
-      ! --> 12861.5m3/s
-      DATA inb(32)/8/
-      DATA (iirnf(jc,32),jc=1,jpcoef)/ 635, 635, 636, 636, 636,637, 637,637,12*0 /
-      DATA (ijrnf(jc,32),jc=1,jpcoef)/ 508, 509, 509, 508, 507,509, 508,507,12*0 /
-     DATA (zrnfm(jm,32),jm=1,jpmois)/12*0./
-!CT bug     DATA (zrnfm(jm,32),jm=1,jpmois)/   &
-!CT bug          4977.,    4150.,    3611.,    3590.,   14723.,   33366.,   &
-!CT bug         30773.,   22785.,   14701.,    9705.,    6078.,    5879./
-      ! 33-Yenesei (Russia) 71N50 82E40                     R1 
-      ! Old=560 km3/year=17745m3/s; UNESCO(65-84, p472)=17462m3/s
-      ! --> 17461.666m3/s
-      DATA inb(33)/9/
-      DATA (iirnf(jc,33),jc=1,jpcoef)/ 114,115,115,116, 117,117,117,118,118,11*0 /
-      DATA (ijrnf(jc,33),jc=1,jpcoef)/ 504,504,503,503, 501,502,503,502,501,11*0 /
-      DATA (zrnfm(jm,33),jm=1,jpmois)/   &
-           6659.,    7007.,    6895.,    7089.,   24183.,   74965.,   &
-          25325.,   15940.,   16050.,   12678.,    6741.,    6008./
-      ! 34-Severnaya Dvina(Russia)64N32 40E30               R5 
-      ! Old=106 km3/year=3359m3/s; not in UNESCO data base
-      ! --> 3359.00024m3/s
-      DATA inb(34)/2/
-      DATA (iirnf(jc,34),jc=1,jpcoef)/ 620, 620, 18*0 /
-      DATA (ijrnf(jc,34),jc=1,jpcoef)/ 448, 449, 18*0 /
-      DATA (zrnfm(jm,34),jm=1,jpmois)/12*3359./
-      ! 35-Lena (Russia) 72N25 126E40                       R1 
-      ! --> 16192.333m3/s
-      DATA inb(35)/9/
-      DATA (iirnf(jc,35),jc=1,jpcoef)/ 142,143,148,148,149,149,150,150,150,11*0 /
-      DATA (ijrnf(jc,35),jc=1,jpcoef)/ 458,458,456,448,449,448,451,450,449,11*0 /
-      DATA (zrnfm(jm,35),jm=1,jpmois)/   &
-           2663.,    2095.,    1629.,    1324.,    7203.,   64230.,   &
-          40810.,   28310.,   25995.,   13299.,    3673.,    3077./
-      ! 36-Kolyma (Russia) 69N30 161E00                     R1
-      ! Old=71 km3/year=2250m3/s; UNESCO(65-84)=2138m3/s
-      ! --> 2138.66675m3/s
-      DATA inb(36)/2/
-      DATA (iirnf(jc,36),jc=1,jpcoef)/ 184, 185, 18*0 /
-      DATA (ijrnf(jc,36),jc=1,jpcoef)/ 429, 429, 18*0 /
-      DATA (zrnfm(jm,36),jm=1,jpmois)/   &
-           131.,      92.,      76.,      65.,    2576.,    9143.,   &
-          4670.,    3727.,    3226.,    1119.,     630.,     209./
-      ! 37-Indigirka (russia) 70N48 148E54                  R1 
-      ! Old=55 km3/year=1743m3/s; UNESCO(65-68+70+72-84)=1622.
-      ! --> 1622.00012m3/s
-      DATA inb(37)/1/
-      DATA (iirnf(jc,37),jc=1,jpcoef)/ 172, 19*0 /
-      DATA (ijrnf(jc,37),jc=1,jpcoef)/ 438, 19*0 /
-      DATA (zrnfm(jm,37),jm=1,jpmois)/   &
-            32.,      17.,      11.,       7.,     354.,    5629.,   &
-          5210.,    4617.,    2823.,     559.,     142.,      63./
-
-      DATA inb(38)/0/
-      DATA inb(39)/0/
-      DATA inb(40)/0/
-
-      ! Total run-offs(IV)=40773.6641m3/s
-      ! Total run-offs(I+II+III+IV)=368282.75m3/s
-
-      ! V ASIA
-      ! ------
-      ! 41-Amur (Russia) 52N56 141E10                       R2
-      ! Old=325 km3/year=10299m3/s; UNESCO(65-84, p451)=8792m3/s; ratio=1.17
-      ! --> 10299.332m3/s
-      DATA inb(41)/2/
-      DATA (iirnf(jc,41),jc=1,jpcoef)/ 141, 141, 18*0 /
-      DATA (ijrnf(jc,41),jc=1,jpcoef)/ 381, 382, 18*0 /
-      DATA (zrnfm(jm,41),jm=1,jpmois)/   &
-           2108.,    1543.,    1252.,    4088.,   15464.,   17336.,   &
-          16100.,   20801.,   21548.,   15658.,    5188.,    2506./
-      ! 42-Liaohe (China) 40N40 122E09                      R5
-      ! Old=6 km3/year=190m3/s; not found in UNESCO data base
-      ! --> 189.999985m3/s
-      DATA inb(42)/1/
-      DATA (iirnf(jc,42),jc=1,jpcoef)/ 100, 19*0 /
-      DATA (ijrnf(jc,42),jc=1,jpcoef)/ 342, 19*0 /
-      DATA (zrnfm(jm,42),jm=1,jpmois)/12*190./
-      ! 43-Daling (China) 40N56 121E43                      R5
-      ! Old=1 km3/year=32m3/s; not found in UNESCO data base
-      ! --> 31.9999962m3/s
-      DATA inb(43)/2/
-      DATA (iirnf(jc,43),jc=1,jpcoef)/  99, 100, 18*0 /
-      DATA (ijrnf(jc,43),jc=1,jpcoef)/ 342, 342, 18*0 /
-      DATA (zrnfm(jm,43),jm=1,jpmois)/12*32./
-      ! 44-Haiho (China) 6N17   1E23
-      ! Old=2 km3/year=64m3/s; not found in UNESCO data base
-      ! --> 63.9999924m3/s
-      DATA inb(44)/1/
-      DATA (iirnf(jc,44),jc=1,jpcoef)/ 121, 19*0 /
-      DATA (ijrnf(jc,44),jc=1,jpcoef)/ 348, 19*0 /
-      DATA (zrnfm(jm,44),jm=1,jpmois)/12*64./
-      ! 45-Yellow/Huangho (China) 37N32 118E19              R2 
-      ! Old=49 km3/year=1553m3/s; UNESCO(p371)=1210m3/s; ratio=1.28
-      ! --> 1552.5m3/s
-      DATA inb(45)/3/
-      DATA (iirnf(jc,45),jc=1,jpcoef)/  92,  92,  92, 17*0 /
-      DATA (ijrnf(jc,45),jc=1,jpcoef)/ 336, 337, 338, 17*0 /
-      DATA (zrnfm(jm,45),jm=1,jpmois)/   &
-           697.,     674.,    1282.,    1206.,    1109.,     778.,   &
-          1964.,    3270.,    3668.,    2133.,     978.,     871./
-      ! 46-Yangtze (China) 31N48 121E10=Changjiang          R2
-      ! Old=900 km3/year=28520m3/s; UNESCO(p372)=25032m3/s; ratio=1.14
-      ! --> 28519.584m3/s
-      DATA inb(46)/2/
-      DATA (iirnf(jc,46),jc=1,jpcoef)/ 100, 100, 18*0 /
-      DATA (ijrnf(jc,46),jc=1,jpcoef)/ 316, 317, 18*0 /
-      DATA (zrnfm(jm,46),jm=1,jpmois)/   &
-          10994.,   10548.,   13254.,   24097.,   36972.,   47197.,   &
-          53891.,   42070.,   37627.,   30762.,   22046.,   12777./
-      ! 47-Pearl/Zhujiang (China) 23N36 106E34=Xijiang      R2 
-      ! Old=302 km3/year=9570m3/s; UNESCO(76,82, p373)=6987m3/s; ratio=1.37
-      ! --> 9570.75m3/s
-      DATA inb(47)/2/
-      DATA (iirnf(jc,47),jc=1,jpcoef)/  72,  73, 18*0 /
-      DATA (ijrnf(jc,47),jc=1,jpcoef)/ 294, 294, 18*0 /
-      DATA (zrnfm(jm,47),jm=1,jpmois)/   &
-           2357.,    2415.,    2634.,    6446.,   14246.,   18395.,   &
-          19213.,   17558.,   12312.,    7255.,    5864.,    6154./
-      ! 48-Red/Hungho (Vietnam) 20N17 106E34                R5 
-      ! Old=123 km3/year=3897m3/s; not in UNESCO data base
-      ! --> 3897.m3/s
-      DATA inb(48)/3/
-      DATA (iirnf(jc,48),jc=1,jpcoef)/  68,  68,  68, 17*0 /
-      DATA (ijrnf(jc,48),jc=1,jpcoef)/ 288, 289, 290, 17*0 /
-      DATA (zrnfm(jm,48),jm=1,jpmois)/12*3897./
-      ! 49-Mekong (Vietnam) 10N33 105E24                    R5
-      ! Old=470 km3/year=14893m3/s; not in UNESCO data base
-      ! --> 14893.0029m3/s
-      DATA inb(49)/3/
-      DATA (iirnf(jc,49),jc=1,jpcoef)/  69,  69,  70, 17*0 /
-      DATA (ijrnf(jc,49),jc=1,jpcoef)/ 269, 270, 270, 17*0 /
-      DATA (zrnfm(jm,49),jm=1,jpmois)/12*14893./
-
-      DATA inb(50)/0/
-      DATA inb(51)/0/
-      DATA inb(52)/0/
-
-      ! 53-Damodar (India)                                  R2
-      ! Old=10 km3/year=320m3/s; UNESCO(p386)=173m3/s; ratio=1.85
-      ! --> 432.916656m3/s
-      DATA inb(53)/1/
-      DATA (iirnf(jc,53),jc=1,jpcoef)/  30, 19*0 /
-      DATA (ijrnf(jc,53),jc=1,jpcoef)/ 294, 19*0 /
-      DATA (zrnfm(jm,53),jm=1,jpmois)/   &
-           51.,      37.,      42.,      49.,      85.,     296.,   &
-          896.,    1390.,    1591.,     542.,     172.,      44./   
-
-      DATA inb(54)/0/
-      DATA inb(55)/0/
-      DATA inb(56)/0/
-      DATA inb(57)/0/
-      DATA inb(58)/0/
-      DATA inb(59)/0/
-      DATA inb(60)/0/
-
-      ! Total run-offs (V)=128642.922m3/s
-      ! Total run-offs (I+II+III+IV+V)=496925.688m3/s
-
-      ! VI AFRICA
-      ! ----------
-      ! 61-Nile (Egypt) 30N10  31E06                        R1
-      ! Old=30 km3/year=951m3/s; UNESCO(73-84)=1251m3/s
-      ! --> 1251.33337m3/s
-      DATA inb(61)/3/
-      DATA (iirnf(jc,61),jc=1,jpcoef)/ 636, 636, 637, 17*0 /
-      DATA (ijrnf(jc,61),jc=1,jpcoef)/ 317, 318, 318, 17*0 /
-      DATA (zrnfm(jm,61),jm=1,jpmois)/   &
-          1239.,    1035.,    1126.,    1110.,    1170.,    1542.,   &
-          1742.,    1559.,    1191.,    1103.,    1075.,    1124./   
-      ! 62-Niger (Nigeria) 5N33   6E33                      R1
-      ! Old=192 km3/year=6084m3/s; HLA=5545m3/s;
-      ! Data from HLA: 4.5N -  6  E   1950/87
-      ! --> 5545.08301m3/s
-      DATA inb(62)/3/
-      DATA (iirnf(jc,62),jc=1,jpcoef)/ 591, 592, 593, 17*0 /
-      DATA (ijrnf(jc,62),jc=1,jpcoef)/ 258, 258, 258, 17*0 /
-      DATA (zrnfm(jm,62),jm=1,jpmois)/   &
-          2029.,    1804.,    1573.,    1418.,    1494.,    2561.,   &
-          5272.,    9629.,   14951.,   16227.,    6842.,    2741./   
-      ! 63-Zaire/Congo (Congo) 6S04  12E24                  R1      
-      ! Old=1250 km3/year=39610m3/s; UNESCO(65-83, p149)=41941m3/s; HLA
-      ! =39720m3/s
-      ! Data from HLA: 6S - 12  E   1902/96
-      ! --> 39719.5m3/s
-      DATA inb(63)/4/
-      DATA (iirnf(jc,63),jc=1,jpcoef)/ 599, 599, 600, 600, 16*0 /
-      DATA (ijrnf(jc,63),jc=1,jpcoef)/ 237, 238, 236, 237, 16*0 /
-      DATA (zrnfm(jm,63),jm=1,jpmois)/   &
-          47200.,   37692.,   34374.,   36603.,   37862.,   35588.,   &
-          30966.,   30774.,   35981.,   42825.,   51455.,   55314./  
-      ! 64-Orange (Sth Africa) 28S41 16E28                  R5
-      ! Old=11 km3/year=349m3/s
-      ! --> 349.000031m3/s
-      DATA inb(64)/2/
-      DATA (iirnf(jc,64),jc=1,jpcoef)/ 609, 609, 18*0 /
-      DATA (ijrnf(jc,64),jc=1,jpcoef)/ 188, 189, 18*0 /
-      DATA (zrnfm(jm,64),jm=1,jpmois)/12*349./
-      ! 65-Zambesi (Mozambique) 18S55 36E04                 R5
-      ! Old=223 km3/year=7066m3/s
-      ! --> 7066.00049m3/s
-      DATA inb(65)/3/
-      DATA (iirnf(jc,65),jc=1,jpcoef)/ 646, 646, 646, 17*0 /
-      DATA (ijrnf(jc,65),jc=1,jpcoef)/ 207, 208, 209, 17*0 /
-      DATA (zrnfm(jm,65),jm=1,jpmois)/12*7066./
-      ! 66-Limpopo (mozambique) 25S15 33E30                 R5
-      ! Old=5 km3/year=158m3/s
-      ! --> 158.m3/s
-      DATA inb(66)/2/
-      DATA (iirnf(jc,66),jc=1,jpcoef)/ 642, 642, 18*0 /
-      DATA (ijrnf(jc,66),jc=1,jpcoef)/ 196, 197, 18*0 /
-      DATA (zrnfm(jm,66),jm=1,jpmois)/12*158./
-      ! 67-Rufiji (tanzania) 8S00 39E20                     R5
-      ! Old=9 km3/year=285m3/s
-      ! --> 285.m3/s
-      DATA inb(67)/1/
-      DATA (iirnf(jc,67),jc=1,jpcoef)/ 655, 19*0 /
-      DATA (ijrnf(jc,67),jc=1,jpcoef)/ 235, 19*0 /
-      DATA (zrnfm(jm,67),jm=1,jpmois)/12*285./
-      ! Other rivers from the Gulf of Guinea
-      ! 68-Kouilou (Congo)  4.5S-11.5E (UNESCO=p51)         R1
-      ! Data from HLA:  4S - 11  E   1953/86 = 919m3/s
-      ! --> 924.25m3/s
-      DATA inb(68)/1/
-      DATA (iirnf(jc,68),jc=1,jpcoef)/ 599, 19*0 /
-      DATA (ijrnf(jc,68),jc=1,jpcoef)/ 240, 19*0 /
-      DATA (zrnfm(jm,68),jm=1,jpmois)/   &
-          1115.,    1166.,    1285.,    1462.,    1454.,     725.,   &
-           480.,     378.,     327.,     400.,    1018.,    1281./
-      ! 69-Nyanga (Gabon)  3S-10E (UNESCO=p66)              R1
-      ! Data from HLA: 2.8N - 10  E   1952/82 = 264m3/s
-      ! --> 264.166687m3/s
-      DATA inb(69)/1/
-      DATA (iirnf(jc,69),jc=1,jpcoef)/ 595, 19*0 /
-      DATA (ijrnf(jc,69),jc=1,jpcoef)/ 244, 19*0 /
-      DATA (zrnfm(jm,69),jm=1,jpmois)/   &
-          126.,      99.,     143.,     253.,     316.,     300.,   &
-          156.,      93.,     231.,     557.,     592.,     304./
-      ! 70-Ogoue (Gabon) 1S-9E (UNESCO, p69)                R1
-      ! Data from HLA: .75S -  9  E   1930/90 = 4512m3/s
-      ! --> 4511.83301m3/s
-      DATA inb(70)/2/
-      DATA (iirnf(jc,70),jc=1,jpcoef)/ 593, 593, 18*0 /
-      DATA (ijrnf(jc,70),jc=1,jpcoef)/ 247, 248, 18*0 /
-      DATA (zrnfm(jm,70),jm=1,jpmois)/   &
-          4514.,    3988.,    4622.,    5403.,    5790.,    4145.,   &
-          2616.,    1961.,    2119.,    4304.,    7870.,    6810./
-      ! 71-Sanaga (Cameroun) 3.5N-9.5E (UNESCO, p31)        R1
-      ! Data from HLA: 3.9N -  9.6E   1944/80 = 1983m3/s
-      ! --> 1982.58337m3/s
-      DATA inb(71)/2/
-      DATA (iirnf(jc,71),jc=1,jpcoef)/ 595, 595, 18*0 /
-      DATA (ijrnf(jc,71),jc=1,jpcoef)/ 255, 256, 18*0 /
-      DATA (zrnfm(jm,71),jm=1,jpmois)/   &
-           813.,     578.,     517.,     633.,     909.,    1278.,   &
-          1928.,    2653.,    4361.,    5470.,    3307.,    1344./
-      ! 72-Nyong (Cameroun) 3.1N-9.5E (UNESCO, p36)         R1
-      ! Data from HLA: 3.5N -  9.8E   1951/84 = 432m3/s
-      ! --> 431.166656m3/s      
-      DATA inb(72)/1/
-      DATA (iirnf(jc,72),jc=1,jpcoef)/ 594, 19*0 /
-      DATA (ijrnf(jc,72),jc=1,jpcoef)/ 257, 19*0 /
-      DATA (zrnfm(jm,72),jm=1,jpmois)/   &
-          232.,     128.,     150.,     266.,     402.,     459.,   &
-          353.,     306.,     604.,     930.,     878.,     466./
-      ! 73-Ntem (Cameroun) 2.5N-9.5E (UNESCO, p36)          R1
-      ! Data from HLA: 3N -  9.8E   1951/87 = 330m3/s      
-      ! --> 329.75m3/s
-      DATA inb(73)/1/
-      DATA (iirnf(jc,73),jc=1,jpcoef)/ 594, 19*0 /
-      DATA (ijrnf(jc,73),jc=1,jpcoef)/ 254, 19*0 /
-      DATA (zrnfm(jm,73),jm=1,jpmois)/   &
-          452.,     455.,     492.,     466.,     482.,     251.,   &
-          151.,     108.,      87.,     133.,     395.,     485./
-      ! 74-Wouri (Cameroun) 4N-9.5E (UNESCO, p34)           R1
-      ! Data from HLA: 4N -  9.5E   1951/84  = 307m3/s
-      ! --> 306.583374m3/s
-      DATA inb(74)/1/
-      DATA (iirnf(jc,74),jc=1,jpcoef)/ 594, 19*0 /
-      DATA (ijrnf(jc,74),jc=1,jpcoef)/ 257, 19*0 /
-      DATA (zrnfm(jm,74),jm=1,jpmois)/   &
-           88.,      63.,      68.,      95.,     139.,     222.,   &
-          395.,     633.,     825.,     675.,     328.,     148./
-      ! 75-Oueme (Benin) 6.5N-2.5E (UNESCO, p27)            R1
-      ! Data from HLA:  6.2N -  2.5E   1951/84 =113m3/s
-      ! --> 112.666664m3/s
-      DATA inb(75)/1/
-      DATA (iirnf(jc,75),jc=1,jpcoef)/ 583, 19*0 /
-      DATA (ijrnf(jc,75),jc=1,jpcoef)/ 262, 19*0 /
-      DATA (zrnfm(jm,75),jm=1,jpmois)/   &
-           0.,       0.,       0.,       0.,       1.,      18.,   &
-          96.,     324.,     531.,     319.,      58.,       5./
-      ! 76-Mono(Tepetou,Benin/Togo) 6.25N-1.8E (U, p27)     R1
-      ! Data from HLA: 6.2N -  1  E   1951/85  = 96m3/s       
-      ! --> 96.4999924m3/s
-      DATA inb(76)/2/
-      DATA (iirnf(jc,76),jc=1,jpcoef)/ 578, 579, 18*0 /
-      DATA (ijrnf(jc,76),jc=1,jpcoef)/ 262, 262, 18*0 /
-      DATA (zrnfm(jm,76),jm=1,jpmois)/   &
-            2.,       1.,       1.,       4.,       8.,      44.,   &
-          168.,     274.,     386.,     215.,      47.,       8./
-      ! 77-Comoe (Ivory Coast) 5N-4W (UNESCO, p56)          R1
-      ! Data from HLA: 5.1N -  4  W   1955/86 = 194m3/s       
-      ! --> 194.25m3/s
-      DATA inb(77)/1/
-      DATA (iirnf(jc,77),jc=1,jpcoef)/ 569, 19*0 /
-      DATA (ijrnf(jc,77),jc=1,jpcoef)/ 260, 19*0 /
-      DATA (zrnfm(jm,77),jm=1,jpmois)/   &
-           14.,       7.,       9.,      17.,      29.,      90.,   &
-          145.,     349.,     740.,     688.,     198.,      45./
-      ! 78-Sassandra (Ivory Coast) 5N-6W (UNESCO, p58)      R1
-      ! Data from HLA: 5N -  6  W   1953/86 = 449m3/s
-      ! --> 449.333344m3/s
-      DATA inb(78)/1/
-      DATA (iirnf(jc,78),jc=1,jpcoef)/ 564, 19*0 /
-      DATA (ijrnf(jc,78),jc=1,jpcoef)/ 260, 19*0 /
-      DATA (zrnfm(jm,78),jm=1,jpmois)/   &
-          144.,     116.,     119.,     143.,     156.,     334.,   &
-          419.,     692.,    1277.,    1190.,     553.,     249./
-      
-      DATA inb(79)/0/
-      DATA inb(80)/0/
-      DATA inb(81)/0/
-      DATA inb(82)/0/
-      DATA inb(83)/0/
-      DATA inb(84)/0/
-      DATA inb(85)/0/
-      DATA inb(86)/0/
-      DATA inb(87)/0/
-      DATA inb(88)/0/
-      DATA inb(89)/0/
-      DATA inb(90)/0/
-
-      ! Total run-offs (VI)=63977.m3/s
-      ! Total run-offs (I+II+III+IV+V+VI)=560902.688m3/s
-
-      ! VII OCEANIA
-      ! ------------
-      ! 91-Murray (Austrlia) 35S34 138E54                   R5
-      ! Old=22 km3/year=697m3/s
-      ! --> 696.999939m3/s
-      DATA inb(91)/3/
-      DATA (iirnf(jc,91),jc=1,jpcoef)/ 129, 130, 130, 17*0 /
-      DATA (ijrnf(jc,91),jc=1,jpcoef)/ 177, 176, 177, 17*0 /
-      DATA (zrnfm(jm,91),jm=1,jpmois)/12*697./
-      ! 92-Haast (N. Zeland) 43S50 169E02                   R5
-      ! Old=6 km3/year=190m3/s
-      ! --> 189.999985m3/s
-      DATA inb(92)/1/
-      DATA (iirnf(jc,92),jc=1,jpcoef)/ 194, 19*0 /
-      DATA (ijrnf(jc,92),jc=1,jpcoef)/ 153, 19*0 /
-      DATA (zrnfm(jm,92),jm=1,jpmois)/12*190./
-      ! 93-Fly (N. Guinea) 8S30 143E05                      R5
-      ! Old=77 km3/year=2440m3/s
-      ! --> 2440.m3/s
-      DATA inb(93)/1/
-      DATA (iirnf(jc,93),jc=1,jpcoef)/ 143, 19*0 /
-      DATA (ijrnf(jc,93),jc=1,jpcoef)/ 233, 19*0 /
-      DATA (zrnfm(jm,93),jm=1,jpmois)/12*2440./
-      ! 94-Purari (N. Guinea) 7S25 145E05                   R4
-      ! Old=77 km3/year=2440m3/s; UNESCO(77+83,p595)=2727m3/s
-      ! --> 2727.33325m3/s
-      DATA inb(94)/1/
-      DATA (iirnf(jc,94),jc=1,jpcoef)/ 146, 19*0 /
-      DATA (ijrnf(jc,94),jc=1,jpcoef)/ 234, 19*0 /
-      DATA (zrnfm(jm,94),jm=1,jpmois)/   &
-          1972.,    3067.,    2332.,    2981.,    2693.,    2876.,   &
-          2867.,    3477.,    2195.,    2967.,    2674.,    2627./
-      ! 95-Choshui ch''i (taiwan) 24N03 120E23              R2
-      ! Old=6 km3/year=190m3/s; UNESCO(65-68, p374)=120m3/s; ratio=1.58 
-      ! --> 0.m3/s
-      DATA inb(95)/0/
-      DATA (iirnf(jc,95),jc=1,jpcoef)/  20*0 /
-      DATA (ijrnf(jc,95),jc=1,jpcoef)/  20*0 /
-      DATA (zrnfm(jm,95),jm=1,jpmois)/   &
-           65.,      63.,      83.,     100.,     177.,     535.,   &
-          332.,     313.,     236.,     193.,     101.,      84./
-      ! 96-Kaoping (Taiwan)                                 R5  
-      ! Old=9 km3/year=285m3/s
-      ! --> 0.m3/s
-      DATA inb(96)/0/
-      DATA (iirnf(jc,96),jc=1,jpcoef)/ 20*0 /
-      DATA (ijrnf(jc,96),jc=1,jpcoef)/ 20*0 /
-      DATA (zrnfm(jm,96),jm=1,jpmois)/12*285./
-      ! 97-Tsengwen (Taiwan)                                R5
-      ! Old=2 km3/year=63m3/s
-      ! --> 0.m3/s
-      DATA inb(97)/0/
-      DATA (iirnf(jc,97),jc=1,jpcoef)/ 20*0 /
-      DATA (ijrnf(jc,97),jc=1,jpcoef)/ 20*0 /
-      DATA (zrnfm(jm,97),jm=1,jpmois)/12*63./
-      ! 98-Hualien (Taiwan)                                 R5
-      ! Old=4 km3/year=127m3/s
-      ! --> 0.m3/s
-      DATA inb(98)/0/
-      DATA (iirnf(jc,98),jc=1,jpcoef)/ 20*0 /
-      DATA (ijrnf(jc,98),jc=1,jpcoef)/ 20*0 /
-      DATA (zrnfm(jm,98),jm=1,jpmois)/12*127./
-      ! 99-Peinan (Taiwan) 22N46 121E10                     R5
-      ! Old=4 km3/year=127m3/s
-      ! --> 127.000008m3/s
-      DATA inb(99)/1/
-      DATA (iirnf(jc,99),jc=1,jpcoef)/  98, 19*0 /
-      DATA (ijrnf(jc,99),jc=1,jpcoef)/ 288, 19*0 /
-      DATA (zrnfm(jm,99),jm=1,jpmois)/12*127./
-      ! 100-Hsiukuluan (Taiwan)                             R5
-      ! Old=4 km3/year=127m3/s
-      ! --> 0.m3/s
-      DATA inb(100)/0/
-      DATA (iirnf(jc,100),jc=1,jpcoef)/ 20*0 /
-      DATA (ijrnf(jc,100),jc=1,jpcoef)/ 20*0 /
-      DATA (zrnfm(jm,100),jm=1,jpmois)/12*127./
-
-
-
-
-
-
-
-       ! I ASIA
-       ! ------
-
-       ! 1-Indus (Pakistan)
-       ! --> 3949m3/s
-       DATA inb(101)/4/
-       DATA (iirnf(jc,101),jc=1,jpcoef)/ 711, 711, 712, 713, 16*0 /
-       DATA (ijrnf(jc,101),jc=1,jpcoef)/ 297, 298, 297, 297, 16*0 /
-       DATA (zrnfm(jm,101),jm=1,jpmois)/  &
-     &      1691.,    2121.,    2083.,    2940.,    3738.,    4198.,  &
-     &      5334.,    8247.,    7833.,    4908.,    2681.,    1614./
-       ! 2-Sabarmati+Mahi+Narmada (India)
-       ! --> 3383m3/s
-       DATA inb(102)/1/
-!CT bug point terre       DATA (iirnf(jc,102),jc=1,jpcoef)/ 720, 19*0 /
-!CT bug point terre       DATA (ijrnf(jc,102),jc=1,jpcoef)/ 292, 19*0 /
-       DATA (iirnf(jc,102),jc=1,jpcoef)/ 719, 19*0 /
-       DATA (ijrnf(jc,102),jc=1,jpcoef)/ 291, 19*0 /
-       DATA (zrnfm(jm,102),jm=1,jpmois)/  &
-     &      1343.,     110.,       0.,       0.,      13.,    3051.,  &
-     &      9453.,   11655.,    7619.,    3547.,    2081.,    1727./
-       ! 3-
-       ! --> 182m3/s
-       DATA inb(103)/1/
-!CT bug point terre       DATA (iirnf(jc,103),jc=1,jpcoef)/ 721, 19*0 /
-!CT bug point terre       DATA (ijrnf(jc,103),jc=1,jpcoef)/ 286, 19*0 /
-       DATA (iirnf(jc,103),jc=1,jpcoef)/ 720, 19*0 /
-       DATA (ijrnf(jc,103),jc=1,jpcoef)/ 286, 19*0 /
-       DATA (zrnfm(jm,103),jm=1,jpmois)/  &
-     &      0.,       0.,       0.,       0.,     225.,     669.,  &
-     &      526.,     327.,     187.,     100.,      62.,      92./
-       ! 4-Mandovi + Zuari + Kalinadi
-       ! --> 347m3/s
-       DATA inb(104)/1/
-       DATA (iirnf(jc,104),jc=1,jpcoef)/ 2, 19*0 /
-       DATA (ijrnf(jc,104),jc=1,jpcoef)/ 282, 19*0 /
-       DATA (zrnfm(jm,104),jm=1,jpmois)/  &
-     &      7.,       0.,       0.,       0.,     428.,    1339.,  &
-     &      966.,     601.,     350.,     190.,     117.,     166./
-       ! 5-                    R2
-       ! --> 190m3/s
-       DATA inb(105)/1/
-       DATA (iirnf(jc,105),jc=1,jpcoef)/ 4, 19*0 /
-       DATA (ijrnf(jc,105),jc=1,jpcoef)/ 279, 19*0 /
-       DATA (zrnfm(jm,105),jm=1,jpmois)/  &
-     &      0.,       0.,       0.,       0.,     363.,     710.,   &
-     &      484.,     315.,     172.,      95.,      59.,      87./
-       ! 6-
-       ! --> 1101m3/s
-       DATA inb(106)/1/
-       DATA (iirnf(jc,106),jc=1,jpcoef)/ 4, 19*0 /
-       DATA (ijrnf(jc,106),jc=1,jpcoef)/ 277, 19*0 /
-       DATA (zrnfm(jm,106),jm=1,jpmois)/   &
-     &      79.,       0.,       0.,       0.,    1457.,    3639.,   &
-     &      3084.,    2031.,    1282.,     696.,     414.,     535. /
-       ! 7-
-       ! --> 948m3/s
-       DATA inb(107)/1/
-       DATA (iirnf(jc,107),jc=1,jpcoef)/ 5, 19*0 /
-       DATA (ijrnf(jc,107),jc=1,jpcoef)/ 275, 19*0 /
-       DATA (zrnfm(jm,107),jm=1,jpmois)/  &
-     &      72.,       0.,       0.,       0.,    1151.,    3038.,     & 
-     &      2583.,    1603.,    1216.,     749.,     426.,     539./
-
-       ! 8-
-       ! --> 551m3/s
-       DATA inb(108)/1/
-       DATA (iirnf(jc,108),jc=1,jpcoef)/ 7, 19*0 /
-       DATA (ijrnf(jc,108),jc=1,jpcoef)/ 271, 19*0 /
-       DATA (zrnfm(jm,108),jm=1,jpmois)/  &
-     &      45.,       0.,       2.,       7.,     680.,    1621.,  &
-     &      1234.,     744.,     784.,     696.,     359.,     442. /
-       ! 9-
-       ! --> 103m3/s
-       DATA inb(109)/1/
-       DATA (iirnf(jc,109),jc=1,jpcoef)/ 8, 19*0 /
-       DATA (ijrnf(jc,109),jc=1,jpcoef)/ 269, 19*0 /
-       DATA (zrnfm(jm,109),jm=1,jpmois)/  &
-     &      11.,       0.,       0.,       0.,     160.,     250.,   &
-     &      200.,     145.,     168.,     146.,      74.,      89. /
-       ! 10-
-       ! --> 99m3/s
-       DATA inb(110)/1/
-       DATA (iirnf(jc,110),jc=1,jpcoef)/12, 19*0 /
-       DATA (ijrnf(jc,110),jc=1,jpcoef)/267, 19*0 /
-       DATA (zrnfm(jm,110),jm=1,jpmois)/  &
-     &      50.,       1.,       1.,       0.,      25.,      69.,  &
-     &      51.,      32.,     176.,     329.,     233.,     222./
-       ! 11- Kaveri (India)
-       ! --> 173m3/s
-       DATA inb(111)/1/
-       DATA (iirnf(jc,111),jc=1,jpcoef)/16, 19*0 /
-       DATA (ijrnf(jc,111),jc=1,jpcoef)/271, 19*0 /
-       DATA (zrnfm(jm,111),jm=1,jpmois)/  &
-     &       97.,       2.,       1.,       2.,      19.,      67.,   &
-     &      108.,     134.,     218.,     515.,     498.,     416. /
-       ! 12-
-       ! --> 116m3/s
-       DATA inb(112)/1/
-       DATA (iirnf(jc,112),jc=1,jpcoef)/16, 19*0 /
-       DATA (ijrnf(jc,112),jc=1,jpcoef)/279, 19*0 /
-       DATA (zrnfm(jm,112),jm=1,jpmois)/  &
-     &       43.,       0.,       0.,       0.,       0.,       0.,   &
-     &        0.,       0.,      99.,     568.,     343.,     342. /
-       ! 13- Krishna
-       ! --> 2864m3/s
-       DATA inb(113)/1/
-       DATA (iirnf(jc,113),jc=1,jpcoef)/ 16, 19*0 /
-       DATA (ijrnf(jc,113),jc=1,jpcoef)/ 281, 19*0 /
-       DATA (zrnfm(jm,113),jm=1,jpmois)/   &
-     &       1368.,     174.,       0.,       0.,     166.,    2362.,  &
-     &       9501.,    8639.,    6053.,    3173.,    1763.,    1175. /
-       ! 14- (SriLanka)
-       ! --> 371m3/s
-       DATA inb(114)/1/
-       DATA (iirnf(jc,114),jc=1,jpcoef)/ 16, 19*0 /
-       DATA (ijrnf(jc,114),jc=1,jpcoef)/ 261, 19*0 /
-       DATA (zrnfm(jm,114),jm=1,jpmois)/  &
-     &      171.,     144.,     292.,     469.,     414.,     309.,  &
-     &      269.,     244.,     526.,     560.,     476.,     588.  /
-       ! 15- (SriLanka)
-       ! --> 305m3/s
-       DATA inb(115)/1/
-       DATA (iirnf(jc,115),jc=1,jpcoef)/18, 19*0 /
-       DATA (ijrnf(jc,115),jc=1,jpcoef)/262, 19*0 /
-       DATA (zrnfm(jm,115),jm=1,jpmois)/  &
-     &      116.,     111.,     225.,     379.,     366.,     300.,  &
-     &      256.,     239.,     385.,     437.,     388.,     467. /
-       ! 16- (SriLanka)
-       ! --> 722m3/s
-       DATA inb(116)/1/
-       DATA (iirnf(jc,116),jc=1,jpcoef)/20, 19*0 /
-       DATA (ijrnf(jc,116),jc=1,jpcoef)/265, 19*0 /
-       DATA (zrnfm(jm,116),jm=1,jpmois)/  &
-     &      711.,     347.,     477.,     556.,     430.,     302.,  &
-     &      228.,     200.,     629.,    1156.,    1579.,    2055.   /
-       ! 17- (SriLanka)
-       ! --> 188m3/s
-       DATA inb(117)/1/
-       DATA (iirnf(jc,117),jc=1,jpcoef)/19, 19*0 /
-       DATA (ijrnf(jc,117),jc=1,jpcoef)/267, 19*0 /
-       DATA (zrnfm(jm,117),jm=1,jpmois)/  &
-     &      189.,      50.,      27.,      17.,      10.,       6.,  &
-     &       4.,       2.,       1.,     236.,     829.,     894. /
-       ! 18- Godavari (India) 17N00  81E45
-       ! --> 2709m3/s
-       DATA inb(118)/1/
-       DATA (iirnf(jc,118),jc=1,jpcoef)/ 19, 19*0 /
-       DATA (ijrnf(jc,118),jc=1,jpcoef)/283, 19*0 /
-       DATA (zrnfm(jm,118),jm=1,jpmois)/  &
-     &      1151.,      57.,       0.,       0.,      38.,    1490.,  &
-     &      6714.,    9065.,    7208.,    3294.,    1874.,    1629. /
-       ! 19-
-       ! --> 116m3/s
-       DATA inb(119)/1/
-       DATA (iirnf(jc,119),jc=1,jpcoef)/23, 19*0 /
-       DATA (ijrnf(jc,119),jc=1,jpcoef)/286, 19*0 /
-       DATA (zrnfm(jm,119),jm=1,jpmois)/  &
-     &         17.,       0.,       0.,       0.,       0.,     103.,  &
-     &        259.,     341.,     330.,     155.,      87.,     110. /
-       ! 20- Mahanadi (India)
-       ! --> 2390m3/s
-       DATA inb(120)/1/
-       DATA (iirnf(jc,120),jc=1,jpcoef)/28, 19*0 /
-       DATA (ijrnf(jc,120),jc=1,jpcoef)/290, 19*0 /
-       DATA (zrnfm(jm,120),jm=1,jpmois)/  &
-     &       809.,       5.,       0.,       0.,      60.,    1401.,  &
-     &      6652.,    8828.,    5410.,    2561.,    1503.,    1452. /
-       ! 21-
-       ! --> 247m3/s
-       DATA inb(121)/1/
-       DATA (iirnf(jc,121),jc=1,jpcoef)/30, 19*0 /
-       DATA (ijrnf(jc,121),jc=1,jpcoef)/294, 19*0 /
-       DATA (zrnfm(jm,121),jm=1,jpmois)/  &
-     &         15.,       0.,       0.,       0.,      73.,     367.,   &
-     &        744.,     722.,     491.,     227.,     137.,     188. /
-       ! 22-
-       ! --> 167m3/s
-       DATA inb(122)/1/
-       DATA (iirnf(jc,122),jc=1,jpcoef)/31, 19*0 /
-       DATA (ijrnf(jc,122),jc=1,jpcoef)/294, 19*0 /
-       DATA (zrnfm(jm,122),jm=1,jpmois)/  &
-     &         16.,       0.,       0.,       0.,      95.,     337.,  &
-     &        488.,     453.,     285.,     143.,      84.,     109. /
-       ! 23-
-       ! --> 206m3/s
-       DATA inb(123)/1/
-       DATA (iirnf(jc,123),jc=1,jpcoef)/32, 19*0 /
-       DATA (ijrnf(jc,123),jc=1,jpcoef)/294, 19*0 /
-       DATA (zrnfm(jm,123),jm=1,jpmois)/  &
-     &         12.,       0.,       0.,       0.,      35.,     400.,  &
-     &        652.,     616.,     347.,     172.,     105.,     144. /
-       ! 24- Ganga + Brahmaputra (Bangladesh) 22N00  91E00
-       ! --> 42436m3/s
-       DATA inb(124)/9/
-       DATA (iirnf(jc,124),jc=1,jpcoef)/ 37, 38, 39, 32, 33, 34, 35  &
-     &      , 36, 37, 11*0 /
-       DATA (ijrnf(jc,124),jc=1,jpcoef)/ 295,295,295,294,294,294,294  &
-     &      , 294, 294, 11*0 /
-       DATA (zrnfm(jm,124),jm=1,jpmois)/  &
-     &        14293.,   4223.,   3004.,  11743.,  32210.,  56899.,  &
-     &        82263.,  95069.,  77997.,  44194.,  23724.,  17272. /
-
-       DATA inb(125)/0/
-      DATA inb(126)/0/
-
-       ! 27- Kuladan
-       ! --> 1541m3/s
-       DATA inb(127)/1/
-       DATA (iirnf(jc,127),jc=1,jpcoef)/42, 19*0 /
-       DATA (ijrnf(jc,127),jc=1,jpcoef)/290, 19*0 /
-       DATA (zrnfm(jm,127),jm=1,jpmois)/  &
-     &        140.,       0.,       0.,      27.,    2280.,    4133.,  &
-     &       4306.,    3049.,    1993.,    1115.,     646.,     812. /
-       ! 28-
-       ! --> 618m3/s
-       DATA inb(128)/1/
-       DATA (iirnf(jc,128),jc=1,jpcoef)/44, 19*0 /
-       DATA (ijrnf(jc,128),jc=1,jpcoef)/287, 19*0 /
-       DATA (zrnfm(jm,128),jm=1,jpmois)/  &
-     &        0.,       0.,       0.,      73.,    1139.,    1755.,  &
-     &      1725.,    1139.,     677.,     362.,     221.,     326. /
-       ! 29-
-       ! --> 158m3/s
-       DATA inb(129)/1/
-       DATA (iirnf(jc,129),jc=1,jpcoef)/44, 19*0 /
-       DATA (ijrnf(jc,129),jc=1,jpcoef)/284, 19*0 /
-       DATA (zrnfm(jm,129),jm=1,jpmois)/  &
-     &        0.,       0.,       0.,       0.,     248.,     419.,  &
-     &      445.,     334.,     201.,     103.,      63.,      93. /
-       ! 30-
-       ! --> 136m3/s
-       DATA inb(130)/1/
-       DATA (iirnf(jc,130),jc=1,jpcoef)/32, 19*0 /
-       DATA (ijrnf(jc,130),jc=1,jpcoef)/277, 19*0 /
-       DATA (zrnfm(jm,130),jm=1,jpmois)/  &
-     &         0.,       0.,       0.,       0.,     223.,     261.,  &
-     &       269.,     315.,     223.,     147.,      86.,     116. /
-       ! 31-
-       ! --> 142m3/s
-       DATA inb(131)/1/
-       DATA (iirnf(jc,131),jc=1,jpcoef)/42, 19*0 /
-       DATA (ijrnf(jc,131),jc=1,jpcoef)/275, 19*0 /
-       DATA (zrnfm(jm,131),jm=1,jpmois)/  &
-     &         0.,       0.,       0.,       0.,     241.,     260.,  &
-     &       270.,     325.,     231.,     158.,      96.,     126.  /
-       ! 32- Irrawady (Myanmar) 15N50  95E06
-       ! --> 16751m3/s
-       DATA inb(132)/3/
-       DATA (iirnf(jc,132),jc=1,jpcoef)/  45,  46, 47, 17*0 /
-       DATA (ijrnf(jc,132),jc=1,jpcoef)/ 282, 281, 282, 17*0 /
-       DATA (zrnfm(jm,132),jm=1,jpmois)/  &
-     &       7174.,     2281.,     80.,    687.,    8133.,   23980.,  &
-     &       38452.,   41442.,  34497.,  23150.,   12529.,    8629. /
-
-       DATA inb(133)/0/
-       DATA inb(134)/0/
-       DATA inb(135)/0/
-       DATA inb(136)/0/
-
-       ! 37- Tenasserim (Myanmar)
-       ! --> 1369m3/s
-       DATA inb(137)/1/
-       DATA (iirnf(jc,137),jc=1,jpcoef)/51, 19*0 /
-       DATA (ijrnf(jc,137),jc=1,jpcoef)/279, 19*0 /
-       DATA (zrnfm(jm,137),jm=1,jpmois)/  &
-     &        65.,       0.,       0.,     540.,    2127.,    3260.,  &
-     &      3540.,    2966.,    1747.,     900.,     544.,     741. /
-       ! 38-
-       ! --> 413m3/s
-       DATA inb(138)/1/
-       DATA (iirnf(jc,138),jc=1,jpcoef)/52, 19*0 /
-       DATA (ijrnf(jc,138),jc=1,jpcoef)/277, 19*0 /
-       DATA (zrnfm(jm,138),jm=1,jpmois)/  &
-     &          0.,       0.,       0.,     202.,     773.,    1000.,  &
-     &       1032.,     831.,     492.,     248.,     153.,     226. /
-       ! 39-
-       ! --> 810m3/s
-       DATA inb(139)/1/
-       DATA (iirnf(jc,139),jc=1,jpcoef)/52, 19*0 /
-       DATA (ijrnf(jc,139),jc=1,jpcoef)/275, 19*0 /
-       DATA (zrnfm(jm,139),jm=1,jpmois)/  &
-     &         59.,       0.,       0.,      22.,    1104.,    1857.,  &
-     &       2069.,    1858.,    1252.,     637.,     373.,     493. /
-       ! 40-
-       ! --> 896m3/s
-       DATA inb(140)/1/
-       DATA (iirnf(jc,140),jc=1,jpcoef)/52, 19*0 /
-       DATA (ijrnf(jc,140),jc=1,jpcoef)/273, 19*0 /
-       DATA (zrnfm(jm,140),jm=1,jpmois)/  &
-     &         94.,       0.,       0.,     196.,    1145.,    1716.,  &
-     &       1936.,    1899.,    1519.,    1000.,     562.,     688. /
-       ! 41-
-       ! --> 559m3/s
-       DATA inb(141)/1/
-       DATA (iirnf(jc,141),jc=1,jpcoef)/52, 19*0 /
-       DATA (ijrnf(jc,141),jc=1,jpcoef)/271, 19*0 /
-       DATA (zrnfm(jm,141),jm=1,jpmois)/  &
-     &       38.,       0.,       0.,     227.,     805.,    1051.,  &
-     &      1105.,    1236.,     941.,     575.,     321.,     416. /
-       ! 42-
-       ! --> 1070m3/s
-       DATA inb(142)/1/
-       DATA (iirnf(jc,142),jc=1,jpcoef)/53, 19*0 /
-       DATA (ijrnf(jc,142),jc=1,jpcoef)/265, 19*0 /
-       DATA (zrnfm(jm,142),jm=1,jpmois)/  &
-     &       356.,      18.,      14.,     160.,     745.,    1123.,  &
-     &      1347.,    1732.,    2076.,    2057.,    1574.,    1639. /
-       ! 43-
-       ! --> 513m3/s
-       DATA inb(143)/1/
-       DATA (iirnf(jc,143),jc=1,jpcoef)/54, 19*0 /
-       DATA (ijrnf(jc,143),jc=1,jpcoef)/263, 19*0 /
-       DATA (zrnfm(jm,143),jm=1,jpmois)/  &
-     &       231.,      12.,     121.,     236.,     216.,     239.,  &
-     &       351.,     517.,    1008.,    1324.,     975.,     929.  /
-       ! 44-
-       ! --> 881m3/s
-       DATA inb(144)/1/
-       DATA (iirnf(jc,144),jc=1,jpcoef)/56, 19*0 /
-       DATA (ijrnf(jc,144),jc=1,jpcoef)/259, 19*0 /
-       DATA (zrnfm(jm,144),jm=1,jpmois)/  &
-     &      558.,     632.,     980.,     902.,     575.,     421.,  &
-     &      432.,     731.,    1276.,    1405.,    1188.,    1480. /
-       ! 45-
-       ! --> 905m3/s
-       DATA inb(145)/1/
-       DATA (iirnf(jc,145),jc=1,jpcoef)/52, 19*0 /
-       DATA (ijrnf(jc,145),jc=1,jpcoef)/259, 19*0 /
-       DATA (zrnfm(jm,145),jm=1,jpmois)/  &
-     &      604.,     552.,     781.,     853.,     627.,     488.,  &
-     &      503.,     781.,    1245.,    1356.,    1331.,    1747. /
-       ! 46-
-       ! --> 136m3/s
-       DATA inb(146)/1/
-       DATA (iirnf(jc,146),jc=1,jpcoef)/50, 19*0 /
-       DATA (ijrnf(jc,146),jc=1,jpcoef)/261, 19*0 /
-       DATA (zrnfm(jm,146),jm=1,jpmois)/  &
-     &      103.,     111.,     126.,     112.,      66.,      40.,  &
-     &       35.,      51.,     126.,     227.,     279.,     362.  /
-       ! 47-
-       ! --> 222m3/s
-       DATA inb(147)/1/
-       DATA (iirnf(jc,147),jc=1,jpcoef)/47, 19*0 /
-       DATA (ijrnf(jc,147),jc=1,jpcoef)/258, 19*0 /
-       DATA (zrnfm(jm,147),jm=1,jpmois)/  &
-     &      176.,     160.,     209.,     197.,     130.,      99.,  &
-     &       90.,     151.,     240.,     342.,     373.,     502./
-       ! 48-
-       ! --> 326m3/s
-       DATA inb(148)/1/
-       DATA (iirnf(jc,148),jc=1,jpcoef)/49, 19*0 /
-       DATA (ijrnf(jc,148),jc=1,jpcoef)/257, 19*0 /
-       DATA (zrnfm(jm,148),jm=1,jpmois)/  &
-     &       226.,     278.,     363.,     301.,     181.,     130.,  &
-     &       131.,     194.,     407.,     505.,     519.,     689. /
-       ! 49-
-       ! --> 203m3/s
-       DATA inb(149)/1/
-       DATA (iirnf(jc,149),jc=1,jpcoef)/50, 19*0 /
-       DATA (ijrnf(jc,149),jc=1,jpcoef)/256, 19*0 /
-       DATA (zrnfm(jm,149),jm=1,jpmois)/  &
-     &      120.,     218.,     233.,     189.,     134.,     128.,  &
-     &      115.,     178.,     244.,     272.,     247.,     360. /
-       ! 50-
-       ! --> 153m3/s
-       DATA inb(150)/1/
-       DATA (iirnf(jc,150),jc=1,jpcoef)/50, 19*0 /
-       DATA (ijrnf(jc,150),jc=1,jpcoef)/255, 19*0 /
-       DATA (zrnfm(jm,150),jm=1,jpmois)/  &
-     &         97.,     108.,     191.,     141.,      97.,      82.,  &
-     &        107.,     118.,     188.,     230.,     208.,     278. /
-       ! 51-
-       ! --> 196m3/s
-       DATA inb(151)/1/
-       DATA (iirnf(jc,151),jc=1,jpcoef)/53, 19*0 /
-       DATA (ijrnf(jc,151),jc=1,jpcoef)/253, 19*0 /
-       DATA (zrnfm(jm,151),jm=1,jpmois)/  &
-     &        74.,     125.,     165.,     123.,     117.,     121.,  &
-     &       160.,     196.,     272.,     322.,     296.,     389. /
-       ! 52-
-       ! --> 166m3/s
-       DATA inb(152)/1/
-       DATA (iirnf(jc,152),jc=1,jpcoef)/53, 19*0 /
-       DATA (ijrnf(jc,152),jc=1,jpcoef)/252, 19*0 /
-       DATA (zrnfm(jm,152),jm=1,jpmois)/  &
-     &      136.,     140.,     192.,     169.,     108.,      80.,  &
-     &      75.,     145.,     200.,     219.,     221.,     307. /
-       ! 53-Tigris+Euphrates (Irak) 31N00  47E25
-       ! --> 4762m3/s
-       DATA inb(153)/3/
-       DATA (iirnf(jc,153),jc=1,jpcoef)/ 673, 673, 674, 17*0 /
-       DATA (ijrnf(jc,153),jc=1,jpcoef)/ 312, 313, 313, 17*0 /
-       DATA (zrnfm(jm,153),jm=1,jpmois)/  &
-     &       6056.,    7229.,    8377.,    8505.,    7966.,    6217.,  &
-     &       3396.,    1898.,    1147.,     869.,    1714.,    3779. /
-
-       DATA (inb(jr),jr=154,200)/47*0/
-
-
-      !  Total run-offs(VII)=6181.33301m3/s
-      !  Total run-offs(I+II+III+IV+V+VI+VII)= 567084. m3/s
-      !                                      = 1.588668056E-6 kg/m2/s
-      !                                      = 17883.5586 km3/Year
-      !                                      = 0.567083955 Sverdrup
-
-      !!----------------------------------------------------------------------
-      !!  OPA 8.5, LODYC-IPSL (2002)
-      !!----------------------------------------------------------------------
-
-      IF( kt == nit000 ) THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'flxrnf : runoff + orca05'
-         IF(lwp) WRITE(numout,*) '~~~~~~'
-         IF(lwp) WRITE(numout,*) '   nrunoff = ', nrunoff
-         IF(lwp) WRITE(numout,*)
-      ENDIF
-
-      ! 0. initialization and  indexes  modification for zoom version
-      ! --------------------------------------------------------------
-      
-      
-      ! conversion factor m3/s --> kg/m2/s *e1t*e2t
-
-      zconv = rauw
-
-      IF( kt == nit000 ) THEN 
-         ! Set runoffs and upstream coeff to zero
-         runoff (:,:) = 0.e0                                                                                  
-         upsrnfh(:,:) = 0.e0
-         upsrnfz(:)   = 0.e0
-         upsadv (:,:) = 0.e0
-         zcoefr(:,:,:) = 0.e0
-
-         IF( nrunoff == 0 ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) ' NO RUNOFF in this simulation '
-            IF(lwp) WRITE(numout,*)
-         ENDIF
-      ENDIF
-
-      ! 1. initialization of the runoff array
-      ! -------------------------------------
-
-      IF( nrunoff == 1 .OR. nrunoff == 2) THEN
-
-         iman  = jpmois
- !!! 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
-         IF( nleapy == 1 .AND. MOD( nyear, 4 ) == 0 ) THEN
-            ! Number of Day Between Data
-            idbd = nbiss(imois)
-         ELSEIF( nleapy > 1 ) THEN
-            idbd = nleapy
-         ELSE
-            idbd = nobis(imois)
-         END IF
-         ! Number of days between imois, 15 and the end of month
-         idmeom = idbd - 15
-         
-         ! 1.1 Calendar computation
-         
-         ! nrnf1 number of the first array record used in the simulation
-         ! nrnf2 number of the last  array record
-         
-         nrnf1 = imois
-         nrnf2 = nrnf1 + 1
-         nrnf1 = MOD( nrnf1, iman )
-         IF( nrnf1 == 0 ) nrnf1 = iman
-         nrnf2 = MOD( nrnf2, iman )
-         IF( nrnf2 == 0 ) nrnf2 = iman
-         
-         IF( kt == nit000 ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'flxrnf routine'
-            IF(lwp) WRITE(numout,*) 'first array record used nrnf1 ',nrnf1
-            IF(lwp) WRITE(numout,*) 'last  array record used nrnf2 ',nrnf2
-         ENDIF
-
-         zxy = FLOAT( nday + idmeom - idbd * i15 ) / idbd
-
-         DO jr = 1, jpriv-1
-            inbp = inb(jr)
-            IF( inbp /= 0 ) THEN
-               DO jl = 1, inbp
-                  DO jj = mj0(ijrnf(jl,jr)), mj1(ijrnf(jl,jr))
-                     DO ji = mi0(iirnf(jl,jr)), mi1(iirnf(jl,jr))
-                        runoff(ji,jj) = runoff(ji,jj)   & 
-                           &          + ( (1.-zxy) * zrnfm(nrnf1,jr)   &
-                           &          +       zxy  * zrnfm(nrnf2,jr)  ) / FLOAT(inbp)
-                     END DO
-                  END DO
-               END DO
-            ENDIF
-         END DO
-
-
-         ! 2. conversion in mm/day
-         ! -----------------------
-         !     C a u t i o n : upward water flux, runoff is negative
-
-         runoff(:,:) = -zconv * runoff(:,:) / ( e1t(:,:) * e2t(:,:) )
-         
-
-         ! 3. advectve coefficient
-         ! -----------------------
-
-         !  Creates the array coef that contains the coefficient to affect to
-         !  the upstream scheme. advection scheme will be:
-         !  coefr * upstream + (1- coefr) centered
-         !  coefr must be between 0 and 1.
-         !  3 values are used: maximum = zrup1, between zrup2, small zrup3.
-         ! 
-         IF( nrunoff == 2 .AND. kt == nit000 ) THEN
-
-            zrup1 = 0.5
-            zrup2 = 0.25
-            zrup3 = 0.125
-            DO jr = 1, jpriv-1
-               inbp = inb(jr)
-               IF( inbp /= 0) THEN
-                  DO jl = 1, inbp
-                     ! ji,jj
-                     DO jj = mj0(ijrnf(jl,jr)), mj1(ijrnf(jl,jr))
-                        DO ji = mi0(iirnf(jl,jr)), mi1(iirnf(jl,jr))
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = zrup1
-                           END DO
-                           zcoefr(ji,jj,4) = zrup2
-                           zcoefr(ji,jj,5) = zrup3
-                        END DO
-                     END DO
-                     ! --> zrup2 (originally = 0.5)
-                     ! ji,jj+1
-                     DO jj = mj0(ijrnf(jl,jr) + 1), mj1(ijrnf(jl,jr) + 1)
-                        DO ji = mi0(iirnf(jl,jr)), mi1(iirnf(jl,jr))
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji,jj-1
-                     DO jj = mj0(ijrnf(jl,jr) - 1), mj1(ijrnf(jl,jr) - 1)
-                        DO ji = mi0(iirnf(jl,jr)), mi1(iirnf(jl,jr))
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji+1,jj-1
-                     DO jj = mj0(ijrnf(jl,jr) - 1), mj1(ijrnf(jl,jr) - 1)
-                        DO ji = mi0(iirnf(jl,jr) + 1), mi1(iirnf(jl,jr) + 1)
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji+1,jj
-                     DO jj = mj0(ijrnf(jl,jr)), mj1(ijrnf(jl,jr))
-                        DO ji = mi0(iirnf(jl,jr) + 1), mi1(iirnf(jl,jr) + 1)
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji+1,jj+1
-                     DO jj = mj0(ijrnf(jl,jr) + 1), mj1(ijrnf(jl,jr) + 1)
-                        DO ji = mi0(iirnf(jl,jr) + 1), mi1(iirnf(jl,jr) + 1)
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji-1,jj+1
-                     DO jj = mj0(ijrnf(jl,jr) + 1), mj1(ijrnf(jl,jr) + 1)
-                        DO ji = mi0(iirnf(jl,jr) - 1), mi1(iirnf(jl,jr) - 1)
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji-1,jj
-                     DO jj = mj0(ijrnf(jl,jr)), mj1(ijrnf(jl,jr))
-                        DO ji = mi0(iirnf(jl,jr) - 1), mi1(iirnf(jl,jr) - 1)
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji-1,jj-1
-                     DO jj = mj0(ijrnf(jl,jr) - 1), mj1(ijrnf(jl,jr) - 1)
-                        DO ji = mi0(iirnf(jl,jr) - 1), mi1(iirnf(jl,jr) - 1)
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! --> zrup3 (originally = 0.25)
-                     ! ji-1,jj+2
-                     DO jj = mj0(ijrnf(jl,jr) + 2), mj1(ijrnf(jl,jr) + 2)
-                        DO ji = mi0(iirnf(jl,jr) - 1), mi1(iirnf(jl,jr) - 1)
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-1,jj-2
-                     DO jj = mj0(ijrnf(jl,jr) - 2), mj1(ijrnf(jl,jr) - 2)
-                        DO ji = mi0(iirnf(jl,jr) - 1), mi1(iirnf(jl,jr) - 1)
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji,jj-2
-                     DO jj = mj0(ijrnf(jl,jr) - 2), mj1(ijrnf(jl,jr) - 2)
-                        DO ji = mi0(iirnf(jl,jr)    ), mi1(iirnf(jl,jr)    )
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji,jj+2
-                     DO jj = mj0(ijrnf(jl,jr) + 2), mj1(ijrnf(jl,jr) + 2)
-                        DO ji = mi0(iirnf(jl,jr)    ), mi1(iirnf(jl,jr)    )
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+1,jj-2
-                     DO jj = mj0(ijrnf(jl,jr) - 2), mj1(ijrnf(jl,jr) - 2)
-                        DO ji = mi0(iirnf(jl,jr) + 1), mi1(iirnf(jl,jr) + 1)
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+1,jj+2
-                     DO jj = mj0(ijrnf(jl,jr) + 2), mj1(ijrnf(jl,jr) + 2)
-                        DO ji = mi0(iirnf(jl,jr) + 1), mi1(iirnf(jl,jr) + 1)
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj-2
-                     DO jj = mj0(ijrnf(jl,jr) - 2), mj1(ijrnf(jl,jr) - 2)
-                        DO ji = mi0(iirnf(jl,jr) + 2), mi1(iirnf(jl,jr) + 2)
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj+2
-                     DO jj = mj0(ijrnf(jl,jr) + 2), mj1(ijrnf(jl,jr) + 2)
-                        DO ji = mi0(iirnf(jl,jr) + 2), mi1(iirnf(jl,jr) + 2)
-                           DO jn = 1, 3  
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj-1
-                     DO jj = mj0(ijrnf(jl,jr) - 1), mj1(ijrnf(jl,jr) - 1)
-                        DO ji = mi0(iirnf(jl,jr) + 2), mi1(iirnf(jl,jr) + 2)
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj+1
-                     DO jj = mj0(ijrnf(jl,jr) + 1), mj1(ijrnf(jl,jr) + 1)
-                        DO ji = mi0(iirnf(jl,jr) + 2), mi1(iirnf(jl,jr) + 2)
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj
-                     DO jj = mj0(ijrnf(jl,jr)    ), mj1(ijrnf(jl,jr)    )
-                        DO ji = mi0(iirnf(jl,jr) + 2), mi1(iirnf(jl,jr) + 2)
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj
-                     DO jj = mj0(ijrnf(jl,jr)    ), mj1(ijrnf(jl,jr)    )
-                        DO ji = mi0(iirnf(jl,jr) - 2), mi1(iirnf(jl,jr) - 2)
-                           DO jn = 1, 3        
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj-2
-                     DO jj = mj0(ijrnf(jl,jr) - 2), mj1(ijrnf(jl,jr) - 2)
-                        DO ji = mi0(iirnf(jl,jr) - 2), mi1(iirnf(jl,jr) - 2)
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj+2
-                     DO jj = mj0(ijrnf(jl,jr) + 2), mj1(ijrnf(jl,jr) + 2)
-                        DO ji = mi0(iirnf(jl,jr) - 2), mi1(iirnf(jl,jr) - 2)
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj-1
-                     DO jj = mj0(ijrnf(jl,jr) - 1), mj1(ijrnf(jl,jr) - 1)
-                        DO ji = mi0(iirnf(jl,jr) - 2), mi1(iirnf(jl,jr) - 2)
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj+1
-                     DO jj = mj0(ijrnf(jl,jr) + 1), mj1(ijrnf(jl,jr) + 1)
-                        DO ji = mi0(iirnf(jl,jr) - 2), mi1(iirnf(jl,jr) - 2)
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                  END DO
-               ENDIF
-            END DO
-            upsrnfh(:,:) = zcoefr(:,:,1)
-            upsrnfz(:)   = 0.e0
-            upsrnfz(1)   = zrup1
-            upsrnfz(2)   = zrup1
-            upsrnfz(3)   = zrup1
-            upsrnfz(4)   = zrup2
-            upsrnfz(5)   = zrup3
-         ENDIF
-      ENDIF
-    
-#endif
-
-   END SUBROUTINE flx_rnf
Index: trunk/NEMO/OPA_SRC/SBC/flxrnf_ORCA_R2.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flxrnf_ORCA_R2.h90	(revision 873)
+++ 	(revision )
@@ -1,1319 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                    ***  flxrnf_ORCA_R2.h90  ***
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!                  OLD ORCA R2 runoff specification
-   !!                      kept here for memory
-   !!                         ( 20/04/2000 )
-   !!----------------------------------------------------------------------
-   !!----------------------------------------------------------------------
-   !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-      !!----------------------------------------------------------------------
-      !! * Local declarations
-      INTEGER :: kt
-      INTEGER, PARAMETER ::   &
-         jpmois =  12,        &  ! number of months
-         jpriv  = 120,        &  ! maximum number of river
-         jpcoef = 300            ! maximum of river mouth grid-points
-      INTEGER ::   &
-         ji, jj, jl, jm,      &  ! dummy loop indices
-         jn, jr, jc              !    "         "
-      INTEGER ::   &
-         i15, imois, iman,    &  ! temporary integers
-         inbp, idbd, idmeom,  &  !    "          "
-         iipt0, iipt1, ijpt0, &  !    "          "
-         ijpt1, ii, ij           !    "          "
-      INTEGER, DIMENSION(jpriv) ::   &
-         inb                     ! ???
-      INTEGER, DIMENSION(jpcoef,jpriv) ::   &
-         iirnf, ijrnf            ! ???
-
-      REAL(wp) ::   &
-         zconv, zxy,          &  ! temporary scalars
-         zrup1, zrup2, zrup3     !    "         "
-      REAL(wp), DIMENSION(jpmois,jpriv) ::   &
-         zrnfm                   ! ???
-      REAL(wp), DIMENSION(jpi, jpj, 5) ::   &
-         zcoefr                  ! ???
-
-      ! ====
-      ! DATA
-      ! ====
-
-      ! I NORTH AMERICA
-      ! ---------------
-
-      ! 1-Saint Lawrence (Canada) 49N30 67W00               R2
-      ! Old=447 km3/year=14165m3/s; CLIPPER=12430m3/s; ratio=1.14
-      ! --> 13975.249m3/s
-      DATA inb(1)/2/
-      DATA (iirnf(jc,1),jc=1,jpcoef)/ 110, 110, 298*0 /
-      DATA (ijrnf(jc,1),jc=1,jpcoef)/ 110, 111, 298*0 /
-      DATA (zrnfm(jm,1),jm=1,jpmois)/   &
-          11718.,  11971.,  12466.,  14980.,  19257.,  16913.,   &
-          14211.,  13119.,  13367.,  13644.,  13463.,  12594./
-      ! 2-Hudson River (USA) 41N00 77W00                    R1
-      ! Old=12 km3/year=380m3/s; UNESCO(64-83,p255)=408m3/s
-      ! --> 407.416687m3/s
-      DATA inb(2)/1/
-      DATA (iirnf(jc,2),jc=1,jpcoef)/ 106, 299*0 /
-      DATA (ijrnf(jc,2),jc=1,jpcoef)/ 104, 299*0 /
-      DATA (zrnfm(jm,2),jm=1,jpmois)/   &
-          364.,    404.,    648.,    873.,    593.,    301.,   &
-          205.,    171.,    205.,    290.,    379.,    456./
-      ! 3-Missisipi and Atchafalaya (USA) 29N 90W           R1 
-      ! Old=580 km3/year=18380m3/s; CLIPPER=17599m3/s
-      ! --> 17599.334m3/s
-      DATA inb(3)/2/
-      DATA (iirnf(jc,3),jc=1,jpcoef)/  97, 98, 298*0 /
-      DATA (ijrnf(jc,3),jc=1,jpcoef)/  97, 97, 298*0 /
-      DATA (zrnfm(jm,3),jm=1,jpmois)/   &
-          19260.,  20813.,  23026.,  28160.,  26510.,  19650.,   &
-          14181.,  10676.,   9578.,  10167.,  11699.,  17472./
-      ! 4-Brazos (USA) 29N58 95W53                          R1
-      ! Old=7 km3/year=222m3/s; UNESCO(65-84, p298)=200m3/s
-      ! --> 199.666656m3/s
-      DATA inb(4)/1/
-      DATA (iirnf(jc,4),jc=1,jpcoef)/  95, 299*0 /
-      DATA (ijrnf(jc,4),jc=1,jpcoef)/  97, 299*0 /
-      DATA (zrnfm(jm,4),jm=1,jpmois)/   &
-          165.,    224.,    200.,    266.,    457.,    327.,   &
-          143.,     69.,    102.,    132.,    160.,    151./
-      ! 5-Colorado (Mexico) 31N54 114W57                    R5
-      ! Old=20 km3/year=634m3/s
-      ! --> 634.m3/s
-      DATA inb(5)/1/
-      DATA (iirnf(jc,5),jc=1,jpcoef)/  88, 299*0 /
-      DATA (ijrnf(jc,5),jc=1,jpcoef)/  94, 299*0 /
-      DATA (zrnfm(jm,5),jm=1,jpmois)/12*634./ 
-      ! 6-Columbia (USA) 45N60 121W17                       R1
-      ! Old=251 km3/year=7954m3/s; UNESCO(65-84, p312)=5368m3/s
-      ! --> 5368.41602m3/s
-      DATA inb(6)/1/
-      DATA (iirnf(jc,6),jc=1,jpcoef)/  79, 299*0 /
-      DATA (ijrnf(jc,6),jc=1,jpcoef)/ 110, 299*0 /
-      DATA (zrnfm(jm,6),jm=1,jpmois)/   &
-          4752.,    5077.,    5633.,    6075.,    8422.,    9822.,   &
-          6350.,    4112.,    3273.,    3251.,    3548.,    4106./ 
-      ! 7-Fraser (USA)                                      R5
-      ! Old=112 km3/year=3550m3/s;not found in UNESCO
-      ! --> 3549.99976m3/s
-      DATA inb(7)/1/
-      DATA (iirnf(jc,7),jc=1,jpcoef)/  77, 299*0 /
-      DATA (ijrnf(jc,7),jc=1,jpcoef)/ 112, 299*0 /
-      DATA (zrnfm(jm,7),jm=1,jpmois)/12*3550./ 
-      ! 8-Yukon (USA) 63N00 165W00                          R3
-      ! Old=195 km3/year=6179m3/s; UNESCO(65-77+80-84, p321)=4245; ratio=1.46
-      ! --> 6017.24951m3/s
-      DATA inb(8)/1/
-      DATA (iirnf(jc,8),jc=1,jpcoef)/  58, 299*0 /
-      DATA (ijrnf(jc,8),jc=1,jpcoef)/ 122, 299*0 /
-      DATA (zrnfm(jm,8),jm=1,jpmois)/   &
-           1459.,    1213.,    1065.,    1100.,    9067.,   17675.,   &
-          10680.,   11271.,    8658.,    5453.,    2649.,    1917./ 
-     ! 9-Copper (USA) 61N47 144W45                          R2
-     ! Old=39 km3/year=1236m3/s; UNESCO(65-84, p317)=1052m3/s; ratio=1.18
-     ! --> 1236.25m3/s
-      DATA inb(9)/1/
-      DATA (iirnf(jc,9),jc=1,jpcoef)/  67, 299*0 /
-      DATA (ijrnf(jc,9),jc=1,jpcoef)/ 119, 299*0 /
-      DATA (zrnfm(jm,9),jm=1,jpmois)/   &
-           219.,    195.,    181.,    214.,    904.,   2532.,   &
-          4026.,   3627.,   1632.,    697.,    354.,    254./ 
-      ! 10-Susitna (USA)                                    R5
-      ! Old=40 km3/year=1268m3/s
-      ! --> 1268.m3/s
-      DATA inb(10)/1/
-      DATA (iirnf(jc,10),jc=1,jpcoef)/  65, 299*0 /
-      DATA (ijrnf(jc,10),jc=1,jpcoef)/ 118, 299*0 /
-      DATA (zrnfm(jm,10),jm=1,jpmois)/12*1268./ 
-      ! 11-McKenzie (Canada) 70N00 135W00                   R3
-      ! Old=306 km3/year=9697m3/s; UNESCO(67+72+7479+82-84, p168)=8343m3/s;
-      ! ratio=1.16
-      ! --> 9606.66797m3/s
-      DATA inb(11)/1/
-      DATA (iirnf(jc,11),jc=1,jpcoef)/  69, 299*0 /
-      DATA (ijrnf(jc,11),jc=1,jpcoef)/ 131, 299*0 /
-      DATA (zrnfm(jm,11),jm=1,jpmois)/   &
-           3644.,    3400.,    3258.,    3546.,   14188.,   21544.,   &
-          18954.,   15487.,   11284.,   10169.,    5901.,    3905./
-      ! 12-Kuksokwim (USA) 60N00 ~162W30                    R4
-      ! UNESCO(65-84, p318)=1112m3/s (61N87 158E10, Crooked Creek, inland)
-      ! --> 1111.99988m3/s
-      DATA inb(12)/1/
-      DATA (iirnf(jc,12),jc=1,jpcoef)/  60, 299*0 /
-      DATA (ijrnf(jc,12),jc=1,jpcoef)/ 118, 299*0 /
-      DATA (zrnfm(jm,12),jm=1,jpmois)/   &
-          335.,     308.,     295.,     407.,    2415.,    2027.,   &
-          1917.,   2049.,    1585.,    1072.,     545.,     389./     
-
-      DATA inb(13)/0/
-      DATA inb(14)/0/
-      DATA inb(15)/0/
-
-      ! Total run-offs(I)=60974.2539m3/s
-
-      ! II SOUTH AMERICA
-      ! -----------------
-      ! 16-Chira (Peru) 4s54 81w08                          R2
-      ! Old=5 km3/year=158m3/s; UNESCO (65-68, p357)=80.9; ratio=1.95
-      ! --> 158.000015m3/s
-      DATA inb(16)/1/
-      DATA (iirnf(jc,16),jc=1,jpcoef)/ 101, 299*0 /
-      DATA (ijrnf(jc,16),jc=1,jpcoef)/  66, 299*0 /
-      DATA (zrnfm(jm,16),jm=1,jpmois)/   &
-          70.,     105.,     564.,     582.,     230.,      94.,   &
-          87.,      47.,      35.,      32.,      29.,      21./
-      ! 17-Magdalena (Colombia) 11N06 74W51                 R2
-      ! Old=237 km3/year=7510m3/s; UNESCO(71-73+76-79, p348)=6973m3/s;
-      ! ratio=1.08
-      ! --> 7451.58301m3/s
-      DATA inb(17)/1/
-      DATA (iirnf(jc,17),jc=1,jpcoef)/ 104, 299*0 /
-      DATA (ijrnf(jc,17),jc=1,jpcoef)/  86, 299*0 /
-      DATA (zrnfm(jm,17),jm=1,jpmois)/   &
-          6598.,    4441.,    4087.,    5445.,    7380.,    8067.,   &
-          8509.,    7428.,    7631.,    9296.,   10588.,    9949./
-      ! 18-Orinoco (Venezuela) 8N37 62W15!                  R1
-      ! Old=1100 km3/year=34857m3/s; UNESCO(73-75, p364)=28736m3/s;
-      ! HLA=26371m3/s
-      ! Data from HLA: 8.1N - 63.3W   1925/89
-      ! --> 26371.416
-      DATA inb(18)/1/
-      DATA (iirnf(jc,18),jc=1,jpcoef)/ 112, 299*0 /
-      DATA (ijrnf(jc,18),jc=1,jpcoef)/  86, 299*0 /
-      DATA (zrnfm(jm,18),jm=1,jpmois)/   &
-          10670.,    7513.,    6344.,    6887.,   13086.,   26699.,   &
-          43938.,   59957.,   57435.,   39951.,   27410.,   16567./ 
-      ! 19-Amazon (Brazil) 0S05 50W00                       R1
-      ! Old=6300 km3/year=199634m3/s; CLIPPER=166192m3/s~UNESCO;
-      ! HLA=184806m3/s
-      ! UNESCO data are at Obidos which is far inland and therefore does not
-      ! fully represent the actual discharge
-      ! Data from HLA: 1.5N - 55.3W   1970/96
-      ! --> 184845.484m3/s
-      DATA inb(19)/2/
-      DATA (iirnf(jc,19),jc=1,jpcoef)/ 117, 117, 298*0 /
-      DATA (ijrnf(jc,19),jc=1,jpcoef)/  75,  76, 298*0 /
-      DATA (zrnfm(jm,19),jm=1,jpmois)/   &
-          152233., 176415., 199941., 225565., 244016., 244861.,   &
-          230711., 203128., 164531., 128486., 118214., 130045. /
-      ! 20-Sao Francisco (Brazil) 10S30 36W24               R1
-      ! Old=97 km3/year=3074m3/s; UNESCO(77-79, p338)=2645m3/s
-      ! --> 2645.3335m3/s
-      DATA inb(20)/1/
-      DATA (iirnf(jc,20),jc=1,jpcoef)/ 123, 299*0 /
-      DATA (ijrnf(jc,20),jc=1,jpcoef)/  59, 299*0 /
-      DATA (zrnfm(jm,20),jm=1,jpmois)/   &
-          3244.,   4116.,   5139.,   4330.,   2323.,   1800.,   &
-          1587.,   1511.,   1593.,   1740.,   2190.,   2171. /
-      ! 21-Parana+Uruguay(Arg./Uru.) 34S12 58W18            R1 
-      ! Old=470 km3/year=14893m3/s; UNESCO(p323/324)=22263m3/s
-      ! --> 22203.168m3/s 
-      DATA inb(21)/2/
-      DATA (iirnf(jc,21),jc=1,jpcoef)/ 114, 114, 298*0 /
-      DATA (ijrnf(jc,21),jc=1,jpcoef)/  46,  47, 298*0 /
-      DATA (zrnfm(jm,21),jm=1,jpmois)/   &
-          24803.,   26836.,   24585.,   21358.,   20041.,   21689.,   &
-          22647.,   20403.,   19627.,   21400.,   21126.,   21923./
-      ! 22-Negro (Argentina)  41S02  62W47                  R2
-      ! Old=30 km3/year=951m3/s; UNESCO(65-79,p330)=765m3/s; ratio=1.24
-      ! --> 907.666687m3/s
-      DATA inb(22)/1/
-      DATA (iirnf(jc,22),jc=1,jpcoef)/ 110, 299*0 /
-      DATA (ijrnf(jc,22),jc=1,jpcoef)/  43, 299*0 /
-      DATA (zrnfm(jm,22),jm=1,jpmois)/   &
-          882.,     587.,     519.,     482.,     623.,     984.,   &
-          1120.,   1294.,    1092.,    1166.,    1105.,    1038./
-     ! 23- Tocantins :  ~48W00 ~0.5S                        R4
-     ! UNESCO(76-77+80-81, p335)=12167m3/s (station far inland!)
-     ! --> 12173.082m3/s
-      DATA inb(23)/1/
-      DATA (iirnf(jc,23),jc=1,jpcoef)/118, 299*0 /
-      DATA (ijrnf(jc,23),jc=1,jpcoef)/ 73, 299*0 /
-      DATA (zrnfm(jm,23),jm=1,jpmois)/   &
-          15507.,  24855.,  27854.,  24257.,  15860.,   7861.,   &
-          4440.,   3082.,   2728.,   3417.,   5511.,  10705. /
-
-      DATA inb(24)/0/
-      DATA inb(25)/0/
-
-      ! Total run-offs(II)=256755.75
-      ! Total run-offs(I+II)=317730
-
-      ! III EUROPE
-      ! ----------
-      ! 26-Rhone (France) 43N20 4E50                        R1 
-      ! Old=49 km3/year=1553m3/s; UNESCO(65-83, p512)=1229
-      ! --> 1217.16663m3/s
-      DATA inb(26)/1/
-      DATA (iirnf(jc,26),jc=1,jpcoef)/ 150, 299*0 /
-      DATA (ijrnf(jc,26),jc=1,jpcoef)/ 108, 299*0 /
-      DATA (zrnfm(jm,26),jm=1,jpmois)/   &
-          1385.,    1848.,    1568.,    1311.,    1420.,    1191.,   &
-           937.,     796.,     794.,     962.,    1161.,    1233./
-      ! 27-Po (Italy) 11N10 1W09                            R1 
-      ! Old=46 km3/year=1458m3/s; UNESCO(65-84, p527)=1550m3/s
-      ! --> 1550.08337m3/s
-      DATA inb(27)/1/
-      DATA (iirnf(jc,27),jc=1,jpcoef)/ 159, 299*0 /
-      DATA (ijrnf(jc,27),jc=1,jpcoef)/ 110, 299*0 /
-      DATA (zrnfm(jm,27),jm=1,jpmois)/   &
-          1304.,    1605.,    1856.,    1549.,    1958.,    1760.,   &
-          1040.,    1007.,    1615.,    1907.,    1772.,    1228./
-      ! 28-Danube (Roumania) 45N20 29E40                    R1 
-      ! Old=206 km3/year=6527m3/s; UNESCO(65-84, p544)=7011m3/s
-      ! --> 7011.8335m3/s
-      DATA inb(28)/1/
-      DATA (iirnf(jc,28),jc=1,jpcoef)/ 171, 299*0 /
-      DATA (ijrnf(jc,28),jc=1,jpcoef)/ 106, 299*0 /
-      DATA (zrnfm(jm,28),jm=1,jpmois)/   &
-          6625.,    7352.,    7986.,    9279.,    9482.,    8618.,   &
-          7586.,    6001.,    5210.,    4989.,    4921.,    6093./
-
-      DATA inb(29)/0/
-      DATA inb(30)/0/
-
-      ! Total run-offs(III)=9779.08301m3/s
-      ! Total run-offs(I+II+III)=327509.094m3/s
-
-      ! IV EURASIAN ARCTIC
-      ! ------------------
-      ! 31-Iana (Russia)                                    R1
-      ! Old=29 km3/year=919m3/s; UNESCO(65-72+74+76-84, p463)=936m3/s
-      ! --> 0m3/s
-      DATA inb(31)/0/
-      DATA (iirnf(jc,31),jc=1,jpcoef)/ 300*0 /
-      DATA (ijrnf(jc,31),jc=1,jpcoef)/ 300*0 /
-      DATA (zrnfm(jm,31),jm=1,jpmois)/   &
-             2.,       1.,       0.,       0.,     917.,    3514.,   &
-          2968.,    2329.,    1322.,     178.,      36.,       8./ 
-      ! 32-Ob (Russia) 66N45 69E30                          R1 
-      ! Old=385 km3/year=12200m3/s; UNESCO(65-84, p478)=12862m3/s
-      ! --> 12861.5m3/s
-      DATA inb(32)/2/
-      DATA (iirnf(jc,32),jc=1,jpcoef)/ 153, 153, 298*0 /
-      DATA (ijrnf(jc,32),jc=1,jpcoef)/ 146, 147, 298*0 /
-      DATA (zrnfm(jm,32),jm=1,jpmois)/   &
-           4977.,    4150.,    3611.,    3590.,   14723.,   33366.,   &
-          30773.,   22785.,   14701.,    9705.,    6078.,    5879./
-      ! 33-Yenesei (Russia) 71N50 82E40                     R1 
-      ! Old=560 km3/year=17745m3/s; UNESCO(65-84, p472)=17462m3/s
-      ! --> 17461.666m3/s
-      DATA inb(33)/1/
-      DATA (iirnf(jc,33),jc=1,jpcoef)/  32, 299*0 /
-      DATA (ijrnf(jc,33),jc=1,jpcoef)/ 147, 299*0 /
-      DATA (zrnfm(jm,33),jm=1,jpmois)/   &
-           6659.,    7007.,    6895.,    7089.,   24183.,   74965.,   &
-          25325.,   15940.,   16050.,   12678.,    6741.,    6008./
-     ! 34-Severnaya Dvina(Russia)64N32 40E30                R5 
-     ! Old=106 km3/year=3359m3/s; not in UNESCO data base
-     ! --> 3359.00024m3/s
-      DATA inb(34)/1/
-      DATA (iirnf(jc,34),jc=1,jpcoef)/ 153, 299*0 /
-      DATA (ijrnf(jc,34),jc=1,jpcoef)/ 133, 299*0 /
-      DATA (zrnfm(jm,34),jm=1,jpmois)/12*3359./
-      ! 35-Lena (Russia) 72N25 126E40                       R1 
-      ! --> 16192.333m3/s
-      DATA inb(35)/1/
-      DATA (iirnf(jc,35),jc=1,jpcoef)/  36, 299*0 /
-      DATA (ijrnf(jc,35),jc=1,jpcoef)/ 137, 299*0 /
-      DATA (zrnfm(jm,35),jm=1,jpmois)/   &
-           2663.,    2095.,    1629.,    1324.,    7203.,   64230.,   &
-          40810.,   28310.,   25995.,   13299.,    3673.,    3077./
-      ! 36-Kolyma (Russia) 69N30 161E00                     R1
-      ! Old=71 km3/year=2250m3/s; UNESCO(65-84)=2138m3/s
-      ! --> 2138.66675m3/s
-      DATA inb(36)/1/
-      DATA (iirnf(jc,36),jc=1,jpcoef)/  46, 299*0 /
-      DATA (ijrnf(jc,36),jc=1,jpcoef)/ 128, 299*0 /
-      DATA (zrnfm(jm,36),jm=1,jpmois)/   &
-           131.,      92.,      76.,      65.,    2576.,    9143.,   &
-          4670.,    3727.,    3226.,    1119.,     630.,     209./
-     ! 37-Indigirka (russia) 70N48 148E54                   R1 
-     ! Old=55 km3/year=1743m3/s; UNESCO(65-68+70+72-84)=1622.
-     ! --> 1622.00012m3/s
-      DATA inb(37)/1/
-      DATA (iirnf(jc,37),jc=1,jpcoef)/  42, 299*0 /
-      DATA (ijrnf(jc,37),jc=1,jpcoef)/ 131, 299*0 /
-      DATA (zrnfm(jm,37),jm=1,jpmois)/   &
-            32.,      17.,      11.,       7.,     354.,    5629.,   &
-          5210.,    4617.,    2823.,     559.,     142.,      63./
-
-      DATA inb(38)/0/
-      DATA inb(39)/0/
-      DATA inb(40)/0/
-
-      ! Total run-offs(IV)=40773.6641m3/s
-      ! Total run-offs(I+II+III+IV)=368282.75m3/s
-
-      ! V ASIA
-      ! ------
-      ! 41-Amur (Russia) 52N56 141E10                       R2
-      ! Old=325 km3/year=10299m3/s; UNESCO(65-84, p451)=8792m3/s; ratio=1.17
-      ! --> 10299.332m3/s
-      DATA inb(41)/1/
-      DATA (iirnf(jc,41),jc=1,jpcoef)/  33, 299*0 /
-      DATA (ijrnf(jc,41),jc=1,jpcoef)/ 116, 299*0 /
-      DATA (zrnfm(jm,41),jm=1,jpmois)/   &
-           2108.,    1543.,    1252.,    4088.,   15464.,   17336.,   &
-          16100.,   20801.,   21548.,   15658.,    5188.,    2506./
-      ! 42-Liaohe (China) 40N40 122E09                      R5
-      ! Old=6 km3/year=190m3/s; not found in UNESCO data base
-      ! --> 189.999985m3/s
-      DATA inb(42)/1/
-      DATA (iirnf(jc,42),jc=1,jpcoef)/  22, 299*0 /
-      DATA (ijrnf(jc,42),jc=1,jpcoef)/ 104, 299*0 /
-      DATA (zrnfm(jm,42),jm=1,jpmois)/12*190./
-      ! 43-Daling (China) 40N56 121E43                      R5
-      ! Old=1 km3/year=32m3/s; not found in UNESCO data base
-      ! --> 31.9999962m3/s
-      DATA inb(43)/1/
-      DATA (iirnf(jc,43),jc=1,jpcoef)/  24, 299*0 /
-      DATA (ijrnf(jc,43),jc=1,jpcoef)/ 104, 299*0 /
-      DATA (zrnfm(jm,43),jm=1,jpmois)/12*32./
-      ! 44-Haiho (China) 6N17   1E23
-      ! Old=2 km3/year=64m3/s; not found in UNESCO data base
-      ! --> 63.9999924m3/s
-      DATA inb(44)/1/
-      DATA (iirnf(jc,44),jc=1,jpcoef)/  28, 299*0 /
-      DATA (ijrnf(jc,44),jc=1,jpcoef)/ 106, 299*0 /
-      DATA (zrnfm(jm,44),jm=1,jpmois)/12*64./
-      ! 45-Yellow/Huangho (China) 37N32 118E19              R2 
-      ! Old=49 km3/year=1553m3/s; UNESCO(p371)=1210m3/s; ratio=1.28
-      ! --> 1552.5m3/s
-      DATA inb(45)/1/
-      DATA (iirnf(jc,45),jc=1,jpcoef)/  22, 299*0 /
-      DATA (ijrnf(jc,45),jc=1,jpcoef)/ 103, 299*0 /
-      DATA (zrnfm(jm,45),jm=1,jpmois)/   &
-           697.,     674.,    1282.,    1206.,    1109.,     778.,   &
-          1964.,    3270.,    3668.,    2133.,     978.,     871./
-      ! 46-Yangtze (China) 31N48 121E10=Changjiang          R2
-      ! Old=900 km3/year=28520m3/s; UNESCO(p372)=25032m3/s; ratio=1.14
-      ! --> 28519.584m3/s
-      DATA inb(46)/1/
-      DATA (iirnf(jc,46),jc=1,jpcoef)/  23, 299*0 /
-      DATA (ijrnf(jc,46),jc=1,jpcoef)/  98, 299*0 /
-      DATA (zrnfm(jm,46),jm=1,jpmois)/   &
-          10994.,   10548.,   13254.,   24097.,   36972.,   47197.,   &
-          53891.,   42070.,   37627.,   30762.,   22046.,   12777./
-      ! 47-Pearl/Zhujiang (China) 23N36 106E34=Xijiang      R2 
-      ! Old=302 km3/year=9570m3/s; UNESCO(76,82, p373)=6987m3/s; ratio=1.37
-      ! --> 9570.75m3/s
-      DATA inb(47)/1/
-      DATA (iirnf(jc,47),jc=1,jpcoef)/  22, 299*0 /
-      DATA (ijrnf(jc,47),jc=1,jpcoef)/  95, 299*0 /
-      DATA (zrnfm(jm,47),jm=1,jpmois)/   &
-           2357.,    2415.,    2634.,    6446.,   14246.,   18395.,   &
-          19213.,   17558.,   12312.,    7255.,    5864.,    6154./
-      ! 48-Red/Hungho (Vietnam) 20N17 106E34                R5 
-      ! Old=123 km3/year=3897m3/s; not in UNESCO data base
-      ! --> 3897.m3/s
-      DATA inb(48)/1/
-      DATA (iirnf(jc,48),jc=1,jpcoef)/  16, 299*0 /
-      DATA (ijrnf(jc,48),jc=1,jpcoef)/  91, 299*0 /
-      DATA (zrnfm(jm,48),jm=1,jpmois)/12*3897./
-      ! 49-Mekong (Vietnam) 10N33 105E24                    R5
-      ! Old=470 km3/year=14893m3/s; not in UNESCO data base
-      ! --> 14893.0029m3/s
-      DATA inb(49)/2/
-      DATA (iirnf(jc,49),jc=1,jpcoef)/  16,  16, 298*0 /
-      DATA (ijrnf(jc,49),jc=1,jpcoef)/  86,  87, 298*0 /
-      DATA (zrnfm(jm,49),jm=1,jpmois)/12*14893./
-      ! 50-Irrawady (Burma) 15N50  95E06                    R5
-      ! Old=428 km3/year=13563m3/s; not in UNESCO data base
-      ! --> 13563.m3/s
-      DATA inb(50)/1/
-      DATA (iirnf(jc,50),jc=1,jpcoef)/  10, 299*0 /
-      DATA (ijrnf(jc,50),jc=1,jpcoef)/  90, 299*0 /
-      DATA (zrnfm(jm,50),jm=1,jpmois)/12*13563./
-      ! 51-Ganges+Brahmaputra (Beng.) 22N00  91E00          R1
-      ! Old=971 km3/year=30769m3/s; UNESCO(69-70+73-75, p367)=31760m3/s
-      ! --> 32147.498m3/s
-      DATA inb(51)/2/
-      DATA (iirnf(jc,51),jc=1,jpcoef)/   7,  8, 298*0 /
-      DATA (ijrnf(jc,51),jc=1,jpcoef)/  93, 93, 298*0 /
-      DATA (zrnfm(jm,51),jm=1,jpmois)/   &
-           6623.,    6315.,    6432.,    9410.,   17263.,   38302.,   &
-          64688.,   80338.,   84802.,   43387.,   17888.,   10322./
-      ! 52-Mehandi (India)                                  R5
-      ! Old=67 km3/year=2123m3/s; not in UNESCO data base
-      ! --> 0m3/s
-      DATA inb(52)/0/
-      DATA (iirnf(jc,52),jc=1,jpcoef)/ 300*0 /
-      DATA (ijrnf(jc,52),jc=1,jpcoef)/ 300*0 /
-      DATA (zrnfm(jm,52),jm=1,jpmois)/12*2123./
-      ! 53-Damodar (India)                                  R2
-      ! Old=10 km3/year=320m3/s; UNESCO(p386)=173m3/s; ratio=1.85
-      ! --> 432.916656m3/s
-      DATA inb(53)/1/
-      DATA (iirnf(jc,53),jc=1,jpcoef)/   6, 299*0 /
-      DATA (ijrnf(jc,53),jc=1,jpcoef)/  93, 299*0 /
-      DATA (zrnfm(jm,53),jm=1,jpmois)/   &
-           51.,      37.,      42.,      49.,      85.,     296.,   &
-          896.,    1390.,    1591.,     542.,     172.,      44./   
-      ! 54-Godavari (India) 17N00  81E45                    R2
-      ! Old=84 km3/year=2662m3/s; UNESCO(p379)=1916m3/s; ratio=1.39
-      ! --> 3670.5m3/s
-      DATA inb(54)/1/
-      DATA (iirnf(jc,54),jc=1,jpcoef)/   3, 299*0 /
-      DATA (ijrnf(jc,54),jc=1,jpcoef)/  90, 299*0 /
-      DATA (zrnfm(jm,54),jm=1,jpmois)/   &
-           988.,     737.,     280.,     219.,     196.,    1691.,   &
-          8063.,   14571.,   11428.,    3953.,    1221.,     699./   
-     ! 55-Indus (Pakistan) 24N20  67E47                     R2
-     ! Old=238 km3/year=7542m3/s; UNESCO (76-79, p428)=2396m3/s; ratio=3.15
-     ! --> 7562.m3/s
-      DATA inb(55)/2/
-      DATA (iirnf(jc,55),jc=1,jpcoef)/ 176, 176, 298*0 /
-      DATA (ijrnf(jc,55),jc=1,jpcoef)/  93,  94, 298*0 /
-      DATA (zrnfm(jm,55),jm=1,jpmois)/   &
-            988.,     737.,    1904.,    1968.,    3625.,    6143.,   &
-          15969.,    36656.,  17173.,    3215.,    1251.,    1115./   
-      ! 56-Tigris and Euphrates (Iraq) 31N00  47E25         R1
-      ! Old=46 km3/year=1458m3/s; UNESCO(76-79, p428)=2396m3/s
-      ! --> 2248.8335m3/s
-      DATA inb(56)/1/
-      DATA (iirnf(jc,56),jc=1,jpcoef)/ 172, 299*0 /
-      DATA (ijrnf(jc,56),jc=1,jpcoef)/  94, 299*0 /
-      DATA (zrnfm(jm,56),jm=1,jpmois)/   &
-          1872.,    2127.,    2962.,    4944.,    5036.,    3078.,   &
-          1362.,     900.,     786.,     993.,    1184.,    1742./   
-
-      DATA inb(57)/0/
-      DATA inb(58)/0/
-      DATA inb(59)/0/
-      DATA inb(60)/0/
-
-      ! Total run-offs (V)=128642.922m3/s
-      ! Total run-offs (I+II+III+IV+V)=496925.688m3/s
-      
-      ! VI AFRICA
-      ! ----------
-      ! 61-Nile (Egypt) 30N10  31E06                        R1
-      ! Old=30 km3/year=951m3/s; UNESCO(73-84)=1251m3/s
-      ! --> 1251.33337m3/s
-      DATA inb(61)/1/
-      DATA (iirnf(jc,61),jc=1,jpcoef)/ 176, 299*0 /
-      DATA (ijrnf(jc,61),jc=1,jpcoef)/  97, 299*0 /
-      DATA (zrnfm(jm,61),jm=1,jpmois)/   &
-          1239.,    1035.,    1126.,    1110.,    1170.,    1542.,   &
-          1742.,    1559.,    1191.,    1103.,    1075.,    1124./   
-      ! 62-Niger (Nigeria) 5N33   6E33                      R1
-      ! Old=192 km3/year=6084m3/s; HLA=5545m3/s;
-      ! Data from HLA: 4.5N -  6  E   1950/87
-      ! --> 5545.08301m3/s
-      DATA inb(62)/1/
-      DATA (iirnf(jc,62),jc=1,jpcoef)/ 146, 299*0 /
-      DATA (ijrnf(jc,62),jc=1,jpcoef)/  81, 299*0 /
-      DATA (zrnfm(jm,62),jm=1,jpmois)/   &
-          2029.,    1804.,    1573.,    1418.,    1494.,    2561.,   &
-          5272.,    9629.,   14951.,   16227.,    6842.,    2741./   
-      ! 63-Zaire/Congo (Congo) 6S04  12E24                  R1      
-      ! Old=1250 km3/year=39610m3/s; UNESCO(65-83, p149)=41941m3/s; HLA
-      ! =39720m3/s
-      ! Data from HLA: 6S - 12  E   1902/96
-      ! --> 39719.5m3/s
-      DATA inb(63)/2/
-      DATA (iirnf(jc,63),jc=1,jpcoef)/ 148, 148, 298*0 /
-      DATA (ijrnf(jc,63),jc=1,jpcoef)/  63,  64, 298*0 /
-      DATA (zrnfm(jm,63),jm=1,jpmois)/   &
-          47200.,   37692.,   34374.,   36603.,   37862.,   35588.,   &
-          30966.,   30774.,   35981.,   42825.,   51455.,   55314./  
-      ! 64-Orange (Sth Africa) 28S41 16E28                  R5
-      ! Old=11 km3/year=349m3/s
-      ! --> 349.000031m3/s
-      DATA inb(64)/1/
-      DATA (iirnf(jc,64),jc=1,jpcoef)/ 150, 299*0 /
-      DATA (ijrnf(jc,64),jc=1,jpcoef)/  51, 299*0 /
-      DATA (zrnfm(jm,64),jm=1,jpmois)/12*349./
-      ! 65-Zambesi (Mozambique) 18S55 36E04                 R5
-      ! Old=223 km3/year=7066m3/s
-      ! --> 7066.00049m3/s
-      DATA inb(65)/1/
-      DATA (iirnf(jc,65),jc=1,jpcoef)/ 160, 299*0 /
-      DATA (ijrnf(jc,65),jc=1,jpcoef)/  56, 299*0 /
-      DATA (zrnfm(jm,65),jm=1,jpmois)/12*7066./
-      ! 66-Limpopo (mozambique) 25S15 33E30                 R5
-      ! Old=5 km3/year=158m3/s
-      ! --> 158.m3/s
-      DATA inb(66)/1/
-      DATA (iirnf(jc,66),jc=1,jpcoef)/ 159, 299*0 /
-      DATA (ijrnf(jc,66),jc=1,jpcoef)/  52, 299*0 /
-      DATA (zrnfm(jm,66),jm=1,jpmois)/12*158./
-      ! 67-Rufiji (tanzania) 8S00 39E20                     R5
-      ! Old=9 km3/year=285m3/s
-      ! --> 285.m3/s
-      DATA inb(67)/1/
-      DATA (iirnf(jc,67),jc=1,jpcoef)/ 162, 299*0 /
-      DATA (ijrnf(jc,67),jc=1,jpcoef)/  62, 299*0 /
-      DATA (zrnfm(jm,67),jm=1,jpmois)/12*285./
-      ! Other rivers from the Gulf of Guinea
-      ! 68-Kouilou (Congo)  4.5S-11.5E (UNESCO=p51)         R1
-      ! Data from HLA:  4S - 11  E   1953/86 = 919m3/s
-      ! --> 924.25m3/s
-      DATA inb(68)/1/
-      DATA (iirnf(jc,68),jc=1,jpcoef)/ 147, 299*0 /
-      DATA (ijrnf(jc,68),jc=1,jpcoef)/  67, 299*0 /
-      DATA (zrnfm(jm,68),jm=1,jpmois)/   &
-          1115.,    1166.,    1285.,    1462.,    1454.,     725.,   &
-           480.,     378.,     327.,     400.,    1018.,    1281./
-      ! 69-Nyanga (Gabon)  3S-10E (UNESCO=p66)              R1
-      ! Data from HLA: 2.8N - 10  E   1952/82 = 264m3/s
-      ! --> 264.166687m3/s
-      DATA inb(69)/1/
-      DATA (iirnf(jc,69),jc=1,jpcoef)/ 147, 299*0 /
-      DATA (ijrnf(jc,69),jc=1,jpcoef)/  68, 299*0 /
-      DATA (zrnfm(jm,69),jm=1,jpmois)/   &
-          126.,      99.,     143.,     253.,     316.,     300.,   &
-          156.,      93.,     231.,     557.,     592.,     304./
-      ! 70-Ogoue (Gabon) 1S-9E (UNESCO, p69)                R1
-      ! Data from HLA: .75S -  9  E   1930/90 = 4512m3/s
-      ! --> 4511.83301m3/s
-      DATA inb(70)/1/
-      DATA (iirnf(jc,70),jc=1,jpcoef)/ 146, 299*0 /
-      DATA (ijrnf(jc,70),jc=1,jpcoef)/  72, 299*0 /
-      DATA (zrnfm(jm,70),jm=1,jpmois)/   &
-          4514.,    3988.,    4622.,    5403.,    5790.,    4145.,   &
-          2616.,    1961.,    2119.,    4304.,    7870.,    6810./
-      ! 71-Sanaga (Cameroun) 3.5N-9.5E (UNESCO, p31)        R1
-      ! Data from HLA: 3.9N -  9.6E   1944/80 = 1983m3/s
-      ! --> 1982.58337m3/s
-      DATA inb(71)/1/
-      DATA (iirnf(jc,71),jc=1,jpcoef)/ 146, 299*0 /
-      DATA (ijrnf(jc,71),jc=1,jpcoef)/  81, 299*0 /
-      DATA (zrnfm(jm,71),jm=1,jpmois)/   &
-           813.,     578.,     517.,     633.,     909.,    1278.,   &
-          1928.,    2653.,    4361.,    5470.,    3307.,    1344./
-      ! 72-Nyong (Cameroun) 3.1N-9.5E (UNESCO, p36)         R1
-      ! Data from HLA: 3.5N -  9.8E   1951/84 = 432m3/s
-      ! --> 431.166656m3/s      
-      DATA inb(72)/1/
-      DATA (iirnf(jc,72),jc=1,jpcoef)/ 146, 299*0 /
-      DATA (ijrnf(jc,72),jc=1,jpcoef)/  80, 299*0 /
-      DATA (zrnfm(jm,72),jm=1,jpmois)/   &
-          232.,     128.,     150.,     266.,     402.,     459.,   &
-          353.,     306.,     604.,     930.,     878.,     466./
-      ! 73-Ntem (Cameroun) 2.5N-9.5E (UNESCO, p36)          R1
-      ! Data from HLA: 3N -  9.8E   1951/87 = 330m3/s      
-      ! --> 329.75m3/s
-      DATA inb(73)/1/
-      DATA (iirnf(jc,73),jc=1,jpcoef)/ 146, 299*0 /
-      DATA (ijrnf(jc,73),jc=1,jpcoef)/  79, 299*0 /
-      DATA (zrnfm(jm,73),jm=1,jpmois)/   &
-          452.,     455.,     492.,     466.,     482.,     251.,   &
-          151.,     108.,      87.,     133.,     395.,     485./
-      ! 74-Wouri (Cameroun) 4N-9.5E (UNESCO, p34)           R1
-      ! Data from HLA: 4N -  9.5E   1951/84  = 307m3/s
-      ! --> 306.583374m3/s
-      DATA inb(74)/1/
-      DATA (iirnf(jc,74),jc=1,jpcoef)/ 145, 299*0 /
-      DATA (ijrnf(jc,74),jc=1,jpcoef)/  81, 299*0 /
-      DATA (zrnfm(jm,74),jm=1,jpmois)/   &
-           88.,      63.,      68.,      95.,     139.,     222.,   &
-          395.,     633.,     825.,     675.,     328.,     148./
-      ! 75-Oueme (Benin) 6.5N-2.5E (UNESCO, p27)            R1
-      ! Data from HLA:  6.2N -  2.5E   1951/84 =113m3/s
-      ! --> 112.666664m3/s
-      DATA inb(75)/1/
-      DATA (iirnf(jc,75),jc=1,jpcoef)/ 144, 299*0 /
-      DATA (ijrnf(jc,75),jc=1,jpcoef)/  83, 299*0 /
-      DATA (zrnfm(jm,75),jm=1,jpmois)/   &
-           0.,       0.,       0.,       0.,       1.,      18.,   &
-          96.,     324.,     531.,     319.,      58.,       5./
-      ! 76-Mono(Tepetou,Benin/Togo) 6.25N-1.8E (U, p27)     R1
-      ! Data from HLA: 6.2N -  1  E   1951/85  = 96m3/s       
-      ! --> 96.4999924m3/s
-      DATA inb(76)/1/
-      DATA (iirnf(jc,76),jc=1,jpcoef)/ 143, 299*0 /
-      DATA (ijrnf(jc,76),jc=1,jpcoef)/  83, 299*0 /
-      DATA (zrnfm(jm,76),jm=1,jpmois)/   &
-            2.,       1.,       1.,       4.,       8.,      44.,   &
-          168.,     274.,     386.,     215.,      47.,       8./
-      ! 77-Comoe (Ivory Coast) 5N-4W (UNESCO, p56)          R1
-      ! Data from HLA: 5.1N -  4  W   1955/86 = 194m3/s       
-      ! --> 194.25m3/s
-      DATA inb(77)/1/
-      DATA (iirnf(jc,77),jc=1,jpcoef)/ 140, 299*0 /
-      DATA (ijrnf(jc,77),jc=1,jpcoef)/  82, 299*0 /
-      DATA (zrnfm(jm,77),jm=1,jpmois)/   &
-           14.,       7.,       9.,      17.,      29.,      90.,   &
-          145.,     349.,     740.,     688.,     198.,      45./
-      ! 78-Sassandra (Ivory Coast) 5N-6W (UNESCO, p58)      R1
-      ! Data from HLA: 5N -  6  W   1953/86 = 449m3/s
-      ! --> 449.333344m3/s
-      DATA inb(78)/1/
-      DATA (iirnf(jc,78),jc=1,jpcoef)/ 139, 299*0 /
-      DATA (ijrnf(jc,78),jc=1,jpcoef)/  82, 299*0 /
-      DATA (zrnfm(jm,78),jm=1,jpmois)/   &
-          144.,     116.,     119.,     143.,     156.,     334.,   &
-          419.,     692.,    1277.,    1190.,     553.,     249./
-
-      DATA inb(79)/0/
-      DATA inb(80)/0/
-      DATA inb(82)/0/
-      DATA inb(83)/0/
-      DATA inb(84)/0/
-      DATA inb(85)/0/
-      DATA inb(86)/0/
-      DATA inb(87)/0/
-      DATA inb(88)/0/
-      DATA inb(89)/0/
-      DATA inb(90)/0/
-
-      ! Total run-offs (VI)=63977.m3/s
-      ! Total run-offs (I+II+III+IV+V+VI)=560902.688m3/s
-      
-      ! VII OCEANIA
-      ! ------------
-      ! 91-Murray (Austrlia) 35S34 138E54                   R5
-      ! Old=22 km3/year=697m3/s
-      ! --> 696.999939m3/s
-      DATA inb(91)/1/
-      DATA (iirnf(jc,91),jc=1,jpcoef)/  30, 299*0 /
-      DATA (ijrnf(jc,91),jc=1,jpcoef)/  47, 299*0 /
-      DATA (zrnfm(jm,91),jm=1,jpmois)/12*697./
-      ! 92-Haast (N. Zeland) 43S50 169E02                   R5
-      ! Old=6 km3/year=190m3/s
-      ! --> 189.999985m3/s
-      DATA inb(92)/1/
-      DATA (iirnf(jc,92),jc=1,jpcoef)/  48, 299*0 /
-      DATA (ijrnf(jc,92),jc=1,jpcoef)/  41, 299*0 /
-      DATA (zrnfm(jm,92),jm=1,jpmois)/12*190./
-      ! 93-Fly (N. Guinea) 8S30 143E05                      R5
-      ! Old=77 km3/year=2440m3/s
-      ! --> 2440.m3/s
-      DATA inb(93)/1/
-      DATA (iirnf(jc,93),jc=1,jpcoef)/  34, 299*0 /
-      DATA (ijrnf(jc,93),jc=1,jpcoef)/  62, 299*0 /
-      DATA (zrnfm(jm,93),jm=1,jpmois)/12*2440./
-      ! 94-Purari (N. Guinea) 7S25 145E05                   R4
-      ! Old=77 km3/year=2440m3/s; UNESCO(77+83,p595)=2727m3/s
-      ! --> 2727.33325m3/s
-      DATA inb(94)/1/
-      DATA (iirnf(jc,94),jc=1,jpcoef)/  36, 299*0 /
-      DATA (ijrnf(jc,94),jc=1,jpcoef)/  64, 299*0 /
-      DATA (zrnfm(jm,94),jm=1,jpmois)/   &
-          1972.,    3067.,    2332.,    2981.,    2693.,    2876.,   &
-          2867.,    3477.,    2195.,    2967.,    2674.,    2627./
-      ! 95-Choshui ch''i (taiwan) 24N03 120E23              R2
-      ! Old=6 km3/year=190m3/s; UNESCO(65-68, p374)=120m3/s; ratio=1.58 
-      ! --> 0.m3/s
-      DATA inb(95)/0/
-      DATA (iirnf(jc,95),jc=1,jpcoef)/  22, 299*0 /
-      DATA (ijrnf(jc,95),jc=1,jpcoef)/  94, 299*0 /
-      DATA (zrnfm(jm,95),jm=1,jpmois)/   &
-           65.,      63.,      83.,     100.,     177.,     535.,   &
-          332.,     313.,     236.,     193.,     101.,      84./
-      ! 96-Kaoping (Taiwan)                                 R5  
-      ! Old=9 km3/year=285m3/s
-      ! --> 0.m3/s
-      DATA inb(96)/0/
-      DATA (iirnf(jc,96),jc=1,jpcoef)/ 300*0 /
-      DATA (ijrnf(jc,96),jc=1,jpcoef)/ 300*0 /
-      DATA (zrnfm(jm,96),jm=1,jpmois)/12*285./
-      ! 97-Tsengwen (Taiwan)                                R5
-      ! Old=2 km3/year=63m3/s
-      ! --> 0.m3/s
-      DATA inb(97)/0/
-      DATA (iirnf(jc,97),jc=1,jpcoef)/ 300*0 /
-      DATA (ijrnf(jc,97),jc=1,jpcoef)/ 300*0 /
-      DATA (zrnfm(jm,97),jm=1,jpmois)/12*63./
-      ! 98-Hualien (Taiwan)                                 R5
-      ! Old=4 km3/year=127m3/s
-      ! --> 0.m3/s
-      DATA inb(98)/0/
-      DATA (iirnf(jc,98),jc=1,jpcoef)/ 300*0 /
-      DATA (ijrnf(jc,98),jc=1,jpcoef)/ 300*0 /
-      DATA (zrnfm(jm,98),jm=1,jpmois)/12*127./
-      ! 99-Peinan (Taiwan) 22N46 121E10                     R5
-      ! Old=4 km3/year=127m3/s
-      ! --> 127.000008m3/s
-      DATA inb(99)/1/
-      DATA (iirnf(jc,99),jc=1,jpcoef)/  23, 299*0 /
-      DATA (ijrnf(jc,99),jc=1,jpcoef)/  94, 299*0 /
-      DATA (zrnfm(jm,99),jm=1,jpmois)/12*127./
-      ! 100-Hsiukuluan (Taiwan)                             R5
-      ! Old=4 km3/year=127m3/s
-      ! --> 0.m3/s
-      DATA inb(100)/0/
-      DATA (iirnf(jc,100),jc=1,jpcoef)/ 300*0 /
-      DATA (ijrnf(jc,100),jc=1,jpcoef)/ 300*0 /
-      DATA (zrnfm(jm,100),jm=1,jpmois)/12*127./
-
-      DATA inb(101)/0/
-      DATA inb(102)/0/
-
-      !  Total run-offs(VII)=6181.33301m3/s
-      !  Total run-offs(I+II+III+IV+V+VI+VII)= 567084. m3/s
-      !                                      = 1.588668056E-6 kg/m2/s
-      !                                      = 17883.5586 km3/Year
-      !                                      = 0.567083955 Sverdrup
-
-      ! VIII ANTARCTICA
-      ! ---------------
-      ! 103 -Antarcti! ice discharge (2 613 Gt/year) (jacobs et al 1992)
-      ! Data from Jacobs et al 92: =2613 km3/year=82857.686454 m3/s
-      ! --> 82858 m3/s
-      DATA inb(103)/295/
-      DATA (iirnf(jc,103),jc=1,jpcoef)/   &
-            1,    2,    3,    3,    4,    4,    5,    6,    7,    8,   &
-            9,    9,   10,   11,   12,   13,   14,   14,   15,   16,   &
-           17,   18,   19,   20,   21,   22,   23,   24,   25,   26,   &
-           27,   28,   29,   30,   31,   32,   32,   33,   34,   35,   &
-           35,   36,   36,   37,   38,   39,   40,   40,   41,   42,   &
-           42,   43,   43,   44,   44,   44,   44,   44,   44,   44,   &
-           45,   45,   45,   45,   46,   46,   46,   46,   46,   47,   &
-           47,   47,   47,   47,   48,   48,   48,   48,   48,   49,   &
-           50,   51,   51,   52,   53,   54,   55,   56,   57,   58,   &
-           59,   60,   61,   62,   62,   63,   63,   64,   65,   66,   &
-           66,   67,   67,   68,   69,   69,   70,   71,   71,   72,   &
-           73,   73,   74,   75,   76,   76,   77,   78,   78,   79,   &
-           80,   81,   82,   83,   83,   84,   85,   86,   87,   88,   &
-           88,   89,   89,   90,   91,   92,   93,   94,   95,   96,   &
-           97,   98,   99,  100,  101,  102,  102,  103,  104,  104,   &
-          104,  104,  104,  105,  105,  106,  106,  107,  107,  107,   &
-          108,  108,  109,  109,  110,  110,  111,  111,  112,  112,   &
-          112,  112,  112,  112,  112,  112,  112,  112,  112,  112,   &
-          112,  112,  112,  112,  112,  113,  113,  113,  113,  113,   &
-          114,  114,  114,  114,  115,  115,  115,  115,  115,  116,   &
-          116,  117,  117,  118,  118,  119,  119,  120,  121,  122,   &
-          123,  124,  124,  125,  125,  126,  126,  127,  128,  128,   &
-          129,  130,  130,  131,  132,  132,  133,  133,  133,  133,   &
-          133,  134,  135,  135,  136,  136,  136,  137,  137,  138,   &
-          139,  140,  141,  142,  142,  143,  144,  145,  146,  147,   &
-          148,  149,  150,  151,  152,  153,  154,  155,  156,  156,   &
-          157,  158,  159,  160,  161,  161,  162,  163,  163,  164,   &
-          165,  165,  166,  166,  167,  168,  169,  170,  171,  171,   &
-          172,  173,  173,  174,  175,  176,  177,  177,  178,  178,   &
-          179,  180,  180,  181,  181,    0,    0,    0,    0,    0    &
-                                      /
-      DATA (ijrnf(jc,103),jc=1,jpcoef)/   &
-           19,   20,   20,   21,   21,   22,   22,   22,   22,   22,   &
-           22,   23,   23,   23,   23,   23,   22,   23,   22,   22,   &
-           22,   22,   22,   22,   22,   22,   22,   22,   22,   22,   &
-           22,   22,   22,   22,   22,   21,   22,   21,   21,   20,   &
-           21,   19,   20,   19,   19,   19,   18,   19,   18,   17,   &
-           18,   16,   17,    3,    4,    5,    6,    7,    8,   16,   &
-            3,    8,    9,   16,    3,    9,   10,   15,   16,    3,   &
-           10,   11,   14,   15,    3,   11,   12,   13,   14,    3,   &
-            3,    2,    3,    2,    2,    2,    2,    2,    2,    2,   &
-            2,    2,    2,    2,    3,    3,    4,    4,    4,    4,   &
-            5,    5,    6,    6,    6,    7,    7,    7,    8,    8,   &
-            8,    9,    9,    9,    9,   10,   10,   10,   11,   11,   &
-           11,   11,   11,   10,   11,   10,   10,   10,   10,   10,   &
-           11,   11,   12,   12,   12,   12,   12,   12,   12,   12,   &
-           12,   12,   12,   12,   12,   12,   13,   13,   13,   14,   &
-           15,   16,   17,   17,   18,   18,   19,   19,   20,   21,   &
-           21,   22,   22,   23,   23,   24,   24,   25,    8,    9,   &
-           10,   11,   12,   13,   14,   15,   16,   17,   18,   19,   &
-           20,   21,   22,   25,   26,    7,    8,   22,   23,   26,   &
-            7,   23,   24,   26,    6,    7,   24,   25,   26,    5,   &
-            6,    4,    5,    3,    4,    2,    3,    2,    2,    2,   &
-            2,    2,    3,    3,    4,    4,    5,    5,    5,    6,   &
-            6,    6,    7,    7,    7,    8,    8,    9,   10,   11,   &
-           12,   12,   12,   13,   13,   14,   15,   15,   16,   16,   &
-           16,   16,   16,   16,   17,   17,   17,   17,   17,   17,   &
-           17,   17,   17,   17,   17,   17,   17,   17,   17,   18,   &
-           18,   18,   18,   18,   18,   19,   19,   19,   20,   20,   &
-           20,   21,   21,   22,   22,   22,   22,   22,   21,   22,   &
-           21,   20,   21,   20,   20,   20,   19,   20,   18,   19,   &
-           18,   18,   19,   19,   20,    0,    0,    0,    0,    0    &
-                                      /
-      DATA (zrnfm(jm,103),jm=1,jpmois)/12*82858./
-
-      !  Total run-offs(VIII)=82858 m3/s
-      !  Total run-offs(I+II+III+IV+V+VI+VII+VIII)= 649941. m3/s
-      !                                           = 0.649940955 Sverdrup
-
-
-      DATA (inb(jr),jr=104,jpriv)/17*0/
-
-      !!----------------------------------------------------------------------
-      !!  OPA 8.5, LODYC-IPSL (2002)
-      !!----------------------------------------------------------------------
-
-      IF( kt == nit000 ) THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'flxrnf : runoff + orca2'
-         IF(lwp) WRITE(numout,*) '~~~~~~'
-         IF(lwp) WRITE(numout,*) '   nrunoff = ', nrunoff
-         IF(lwp) WRITE(numout,*)
-      ENDIF
-
-      ! 0. initialization and  indexes  modification for zoom version
-      ! --------------------------------------------------------------
-      
-      
-      ! conversion factor m3/s --> kg/m2/s *e1t*e2t
-
-      zconv = rauw
-
-      IF( kt == nit000 ) THEN 
-         ! Set runoffs and upstream coeff to zero
-         runoff (:,:) = 0.e0                                                                                  
-         upsrnfh(:,:) = 0.e0
-         upsrnfz(:)   = 0.e0
-         upsadv (:,:) = 0.e0
-         zcoefr(:,:,:) = 0.e0
-
-         IF( nrunoff == 0 ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) ' NO RUNOFF in this simulation '
-            IF(lwp) WRITE(numout,*)
-         ENDIF
-      ENDIF
-
-      ! 1. initialization of the runoff array
-      ! -------------------------------------
-
-      IF( nrunoff == 1 .OR. nrunoff == 2) THEN
-
-         iman  = jpmois
-         
-         i15 = nday / 16
-         
-         imois = nmonth + i15 - 1
-         IF( imois == 0) imois = iman
-         IF( nleapy == 1 .AND. MOD( nyear, 4 ) == 0 ) THEN
-            ! Number of Day Between Data
-            idbd = nbiss(imois)
-         ELSEIF( nleapy > 1 ) THEN
-            idbd = nleapy
-         ELSE
-            idbd = nobis(imois)
-         ENDIF
-         ! Number of days between imois, 15 and the end of month
-         idmeom = idbd - 15
-         
-         ! 1.1 Calendar computation
-         
-         ! nrnf1 number of the first array record used in the simulation
-         ! nrnf2 number of the last  array record
-         
-         nrnf1 = imois
-         nrnf2 = nrnf1 + 1
-         nrnf1 = MOD( nrnf1, iman )
-         IF( nrnf1 == 0 ) nrnf1 = iman
-         nrnf2 = MOD( nrnf2, iman )
-         IF( nrnf2 == 0 ) nrnf2 = iman
-         
-         IF( kt == nit000 ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'flxrnf routine'
-            IF(lwp) WRITE(numout,*) 'first array record used nrnf1 ',nrnf1
-            IF(lwp) WRITE(numout,*) 'last  array record used nrnf2 ',nrnf2
-         ENDIF
-
-         zxy = FLOAT( nday + idmeom - idbd * i15 ) / idbd
-
-         DO jr = 1, jpriv-1
-            inbp = inb(jr)
-            IF( inbp /= 0 ) THEN
-               DO jl = 1, inbp
-                  ii = iirnf(jl,jr) - nimpp + 1 - jpizoom + 1
-                  ij = ijrnf(jl,jr) - njmpp + 1 - jpjzoom + 1
-                  iipt0 = MAX( 1, MIN( ii, jpi   ) )
-                  iipt1 = MAX( 0, MIN( ii, jpi-1 ) )
-                  ijpt0 = MAX( 1, MIN( ij, jpj   ) )
-                  ijpt1 = MAX( 0, MIN( ij, jpj-1 ) )
-                  DO jj = ijpt0, ijpt1
-                     DO ji = iipt0, iipt1
-                        runoff(ji,jj) = runoff(ji,jj)   & 
-                                      + ( (1.-zxy) * zrnfm(nrnf1,jr)   &
-                                      +       zxy  * zrnfm(nrnf2,jr)  ) / FLOAT(inbp)
-                     END DO
-                  END DO
-               END DO
-            ENDIF
-         END DO
-
-
-         ! 2. conversion in mm/day
-         ! -----------------------
-         !     C a u t i o n : upward water flux, runoff is negative
-
-         runoff(:,:) = -zconv * runoff(:,:) / ( e1t(:,:) * e2t(:,:) )
-         
-
-         ! 3. advectve coefficient
-         ! -----------------------
-
-         !  Creates the array coef that contains the coefficient to affect to
-         !  the upstream scheme. advection scheme will be:
-         !  coefr * upstream + (1- coefr) centered
-         !  coefr must be between 0 and 1.
-         !  3 values are used: maximum = zrup1, between zrup2, small zrup3.
-         ! 
-         IF( nrunoff == 2 .AND. kt == nit000 ) THEN
-
-            zrup1 = 0.5
-            zrup2 = 0.25
-            zrup3 = 0.125
-            DO jr = 1, jpriv-1
-               inbp = inb(jr)
-               IF( inbp /= 0) THEN
-                  DO jl = 1, inbp
-                     ! --> zrup1 (originally, = 1 = all upstream).
-                     ! ji,jj
-                     ii = iirnf(jl,jr) - nimpp + 1 - jpizoom - 1
-                     ij = ijrnf(jl,jr) - njmpp + 1 - jpjzoom - 1
-                     iipt0 = MAX( 1, MIN( ii,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii,jpi-1) )
-                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = zrup1
-                           END DO
-                           zcoefr(ji,jj,4) = zrup2
-                           zcoefr(ji,jj,5) = zrup3
-                        END DO
-                     END DO
-                     ! --> zrup2 (originally = 0.5)
-                     ! ji,jj+1
-                     ijpt0 = MAX( 1, MIN( ij+1, jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+1, jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji,jj-1
-                     ijpt0 = MAX( 1, MIN( ij-1, jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-1, jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji+1,jj-1
-                     iipt0 = MAX( 1, MIN( ii+1, jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii+1, jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji+1,jj
-                     ijpt0 = MAX( 1, MIN( ij, jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij, jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji+1,jj+1
-                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji-1,jj+1
-                     iipt0 = MAX( 1, MIN( ii-1,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii-1,jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji-1,jj
-                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji-1,jj-1
-                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! --> zrup3 (originally = 0.25)
-                     ! ji-1,jj+2
-                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-1,jj-2
-                     ijpt0 = MAX( 1, MIN( ij-2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji,jj-2
-                     iipt0 = MAX( 1, MIN( ii,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii,jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji,jj+2
-                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+1,jj-2
-                     iipt0 = MAX( 1, MIN( ii+1,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii+1,jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+1,jj+2
-                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj-2
-                     iipt0 = MAX( 1, MIN( ii+2,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii+2,jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj+2
-                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3  
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj-1
-                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj+1
-                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj
-                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj
-                     iipt0 = MAX( 1, MIN( ii-2,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii-2,jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3        
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj-2
-                     ijpt0 = MAX( 1, MIN( ij-2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj+2
-                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj-1
-                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj+1
-                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                  END DO
-               ENDIF
-            END DO
-            upsrnfh(:,:) = zcoefr(:,:,1)
-            upsrnfz(:)   = 0.e0
-            upsrnfz(1)   = 1.0
-            upsrnfz(2)   = 1.0
-            upsrnfz(3)   = zrup1
-            upsrnfz(4)   = zrup2
-            upsrnfz(5)   = zrup3
-
-            ! Reduces the sea surface restoring term to Levitus98
-            ! in the Sound Strait
-            DO jj = mj0(116), mj1(116)
-               DO ji = mi0(144), mi1(144)
-                  upsrnfh(ji,jj) = 0.25
-               END DO
-               DO ji = mi0(145), mi1(147)
-                  upsrnfh(ji,jj) = 0.5
-               END DO
-               DO ji = mi0(148), mi1(148)
-                  upsrnfh(ji,jj) = 0.25
-               END DO
-            END DO
-         ENDIF
-      ENDIF
-      
-      ! Upstream and centered scheme in the vicinity of some straits
-
-      IF( kt == nit000 ) THEN
-
-         ! ORCA_R2 configuration :
-         ! Gibraltar Strait
-         DO jj = mj0(102), mj1(102)
-            DO ji = mi0(138), mi1(138)
-               upsadv(ji,jj) = 0.2
-            END DO
-         END DO
-         DO jj = mj0(102), mj1(102)
-            DO ji = mi0(139), mi1(139)
-               upsadv(ji,jj) = 0.4
-            END DO
-         END DO
-         DO jj = mj0(102), mj1(102)
-            DO ji = mi0(140), mi1(140)
-               upsadv(ji,jj) = 0.5
-            END DO
-         END DO
-         DO jj = mj0(101), mj1(102)
-            DO ji = mi0(141), mi1(141)
-               upsadv(ji,jj) = 0.5
-            END DO
-         END DO
-         ! Bab el Mandeb Strait
-         DO jj = mj0(87), mj1(88)
-            DO ji = mi0(164), mi1(164)
-               upsadv(ji,jj) = 0.1
-            END DO
-         END DO
-         DO jj = mj0(88), mj1(88)
-            DO ji = mi0(163), mi1(163)
-               upsadv(ji,jj) = 0.25
-            END DO
-         END DO
-         DO jj = mj0(88), mj1(88)
-            DO ji = mi0(162), mi1(162)
-               upsadv(ji,jj) = 0.4
-            END DO
-         END DO
-         DO jj = mj0(88), mj1(88)
-            DO ji = mi0(160), mi1(161)
-               upsadv(ji,jj) = 0.5
-            END DO
-         END DO
-         DO jj = mj0(89), mj1(89)
-            DO ji = mi0(158), mi1(160)
-               upsadv(ji,jj) = 0.25
-            END DO
-         END DO
-         DO jj = mj0(90), mj1(90)
-            DO ji = mi0(160), mi1(160)
-               upsadv(ji,jj) = 0.25
-            END DO
-         END DO
-         ! Sound Strait
-         DO jj = mj0(116), mj1(116)
-            DO ji = mi0(145), mi1(147)
-               upsadv(ji,jj) = 0.5
-            END DO
-         END DO
-
-      ENDIF
Index: trunk/NEMO/OPA_SRC/SBC/flxrnf_ORCA_R4.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/flxrnf_ORCA_R4.h90	(revision 873)
+++ 	(revision )
@@ -1,1339 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                    ***  flxrnf_ORCA_R4.h90  ***
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!                  OLD ORCA R4 runoff specification
-   !!                      kept here for memory
-   !!                         ( 20/04/2000 )
-   !!----------------------------------------------------------------------
-   !!----------------------------------------------------------------------
-   !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-      !!----------------------------------------------------------------------
-      !! * Local declarations
-      INTEGER  :: kt
-      INTEGER  :: jpmois
-      INTEGER  ::   &
-         jpriv,    & ! jpriv : maximum river number
-         jpcoef      ! jpcoef: maximum point number
-      INTEGER, PARAMETER ::   jpmois=12, jpriv=120, jpcoef=150
-
-      INTEGER  ::   ji, jj, jl, jm, jn, jr, jc
-      INTEGER  ::   i15, imois, iman
-      INTEGER  ::   inbp, idbd, idmeom
-      INTEGER  ::   iipt0, iipt1, ijpt0, ijpt1, ii, ij
-      INTEGER  ::   iirnf(jpcoef,jpriv),ijrnf(jpcoef,jpriv)
-      INTEGER  ::   inb(jpriv)
-
-      REAL(wp) ::   zconv, zxy
-      REAL(wp) ::   zrup1,zrup2,zrup3
-      REAL(wp) ::   zrnfm(jpmois, jpriv)
-      REAL(wp) ::   zcoefr(jpi, jpj, 5)
-      CHARACTER (len=20) ::   criver(jpriv)
-
-      REAL(wp) ::   zbilan , zero
-
-      COMMON/zzzrnf/ zrnfm, iirnf, ijrnf, inb
-
-      ! ====
-      ! DATA
-      ! ====
-
-      zero = 0.0e0
-      IF( kt == nit000 ) THEN 
-          criver = "                    "
-          inb = 0
-          iirnf = 0
-          ijrnf = 0
-          zrnfm  = zero
-          runoff = zero
-         
-          ! I NORTH AMERICA
-          ! ---------------
-          
-          ! 1-Saint Lawrence (Canada) 49N30 67W00           R2
-          ! Old=447 km3/year=14165m3/s; CLIPPER=12430m3/s; ratio=1.14
-          ! --> 13975.249m3/s
-          criver(1) = "Saint Lawrence      "
-          inb(1) = 1
-          iirnf(1:1,1) = 57
-          ijrnf(1:1,1) = 55
-          zrnfm(1:jpmois,1) = (/   &
-              11718.,  11971.,  12466.,  14980.,  19257.,  16913.,   &
-              14211.,  13119.,  13367.,  13644.,  13463.,  12594./)
-          ! 2-Hudson River (USA) 41N00 77W00                R1
-          ! Old=12 km3/year=380m3/s; UNESCO(64-83,p255)=408m3/s
-          ! --> 407.416687m3/s
-          criver(2) = "Hudson River        "
-          inb(2) = 1
-          iirnf(1:1,2) = 54
-          ijrnf(1:1,2) = 53
-          zrnfm(1:jpmois,2) = (/   &
-              364.,    404.,    648.,    873.,    593.,    301.,   &
-              205.,    171.,    205.,    290.,    379.,    456./)
-          ! 3-Missisipi and Atchafalaya (USA) 29N 90W       R1 
-          ! Old=580 km3/year=18380m3/s; CLIPPER=17599m3/s
-          ! --> 17599.334m3/s
-          criver(3) = "Missisipi           "
-          inb(3) = 1
-          iirnf(1:1,3) = 50
-          ijrnf(1:1,3) = 49
-          zrnfm(1:jpmois,3) = (/   &
-              19260.,  20813.,  23026.,  28160.,  26510.,  19650.,   &
-              14181.,  10676.,   9578.,  10167.,  11699.,  17472./)
-          ! 4-Brazos (USA) 29N58 95W53                      R1
-          ! Old=7 km3/year=222m3/s; UNESCO(65-84, p298)=200m3/s
-          ! --> 199.666656m3/s
-          criver(4) = "Brazos              "
-          inb(4) = 1
-          iirnf(1:1,4) = 48
-          ijrnf(1:1,4) = 49
-          zrnfm(1:jpmois,4) = (/   &
-              165.,    224.,    200.,    266.,    457.,    327.,   &
-              143.,     69.,    102.,    132.,    160.,    151. /)
-          ! 5-Colorado (Mexico) 31N54 114W57                R5
-          ! Old=20 km3/year=634m3/s
-          ! --> 634.m3/s
-          criver(5) = "Colorado            "
-          inb(5) = 1
-          iirnf(1:1,5) = 43
-          ijrnf(1:1,5) = 50
-          zrnfm(1:jpmois,5) = 634. 
-          ! 6-Columbia (USA) 45N60 121W17                   R1
-          ! Old=251 km3/year=7954m3/s; UNESCO(65-84, p312)=5368m3/s
-          ! --> 5368.41602m3/s
-          criver(6) = "Columbia            "
-          inb(6) = 1
-          iirnf(1:1,6) = 40
-          ijrnf(1:1,6) = 56
-          zrnfm(1:jpmois,6) = (/   &
-              4752.,    5077.,    5633.,    6075.,    8422.,    9822.,   &
-              6350.,    4112.,    3273.,    3251.,    3548.,    4106. /)
-          ! 7-Fraser (USA) 47N 124W                         R5
-          ! Old=112 km3/year=3550m3/s;not found in UNESCO
-          ! --> 3549.99976m3/s
-          criver(7) = "Fraser              "
-          inb(7) = 1
-          iirnf(1:1,7) = 40
-          ijrnf(1:1,7) = 57
-          zrnfm(1:jpmois,7) = 3550. 
-          ! 8-Yukon (USA) 63N00 165W00                      R3
-          ! Old=195 km3/year=6179m3/s; UNESCO(65-77+80-84, p321)=4245; ratio=1.46
-          ! --> 6017.24951m3/s
-          criver(8) = "Yukon               "
-          inb(8) = 1
-          iirnf(1:1,8) = 30
-          ijrnf(1:1,8) = 62
-          zrnfm(1:jpmois,8) = (/   &
-              1459.,    1213.,    1065.,    1100.,    9067.,   17675.,   &
-              10680.,   11271.,    8658.,    5453.,    2649.,    1917./)
-          ! 9-Copper (USA) 61N47 144W45                     R2
-          ! Old=39 km3/year=1236m3/s; UNESCO(65-84, p317)=1052m3/s; ratio=1.18
-          ! --> 1236.25m3/s
-          criver(9) = "Copper              "
-          inb(9) = 1
-          iirnf(1:1,9) = 35
-          ijrnf(1:1,9) = 60
-          zrnfm(1:jpmois,9) = (/   &
-              219.,    195.,    181.,    214.,    904.,   2532.,   &
-              4026.,   3627.,   1632.,    697.,    354.,    254. /) 
-          ! 10-Susitna (USA)   62N 150E                     R5
-          ! Old=40 km3/year=1268m3/s
-          ! --> 1268.m3/s
-          criver(10) = "Susitna             "
-          inb(10) = 1
-          iirnf(1:1,10) = 34
-          ijrnf(1:1,10) = 60
-          zrnfm(1:jpmois,10) = 1268. 
-          ! 11-McKenzie (Canada) 70N00 135W00               R3
-          ! Old=306 km3/year=9697m3/s; UNESCO(67+72+7479+82-84, p168)=8343m3/s;
-          ! ratio=1.16
-          ! --> 9606.66797m3/s
-          criver(11) = "McKenzie            "
-          inb(11) = 1
-          iirnf(1:1,11) = 35
-          ijrnf(1:1,11) = 66
-          zrnfm(1:jpmois,11) = (/   &
-              3644.,    3400.,    3258.,    3546.,   14188.,   21544.,   &
-              18954.,   15487.,   11284.,   10169.,    5901.,    3905./)
-          ! 12-Kuksokwim (USA) 60N00 ~162W30                R4
-          ! UNESCO(65-84, p318)=1112m3/s (61N87 158E10, Crooked Creek, inland)
-          ! --> 1111.99988m3/s
-          criver(12) = "Kuksokwim           "
-          inb(12) = 1
-          iirnf(1:1,12) = 30
-          ijrnf(1:1,12) = 60
-          zrnfm(1:jpmois,12) = (/   &
-              335.,     308.,     295.,     407.,    2415.,    2027.,   &
-              1917.,   2049.,    1585.,    1072.,     545.,     389./)
-          ! 13-Nelson
-          criver(13) = "Nelson              "
-          inb(13) = 1
-          iirnf(1:1,13) = 51
-          ijrnf(1:1,13) = 65
-          zrnfm(1:jpmois,13) = 0.
-
-          ! Total run-offs(I)=60974.2539m3/s
-
-          ! II SOUTH AMERICA
-          ! -----------------
-          ! 16-Chira (Peru) 4s54 81w08                      R2
-          ! Old=5 km3/year=158m3/s; UNESCO (65-68, p357)=80.9; ratio=1.95
-          ! --> 158.000015m3/s
-          criver(16) = "Chira               "
-          inb(16) = 1
-          iirnf(1:1,16) = 51
-          ijrnf(1:1,16) = 34
-          zrnfm(1:jpmois,16) = (/   &
-              70.,     105.,     564.,     582.,     230.,      94.,   &
-              87.,      47.,      35.,      32.,      29.,      21./)
-          ! 17-Magdalena (Colombia) 11N06 74W51             R2
-          ! Old=237 km3/year=7510m3/s; UNESCO(71-73+76-79, p348)=6973m3/s;
-          ! ratio=1.08
-          ! --> 7451.58301m3/s
-          criver(17) = "Magdelena           "
-          inb(17) = 1
-          iirnf(1:1,17) = 53
-          ijrnf(1:1,17) = 45
-          zrnfm(1:jpmois,17) = (/   &
-              6598.,    4441.,    4087.,    5445.,    7380.,    8067.,   &
-              8509.,    7428.,    7631.,    9296.,   10588.,    9949./)
-          ! 18-Orinoco (Venezuela) 8N37 62W15!              R1
-          ! Old=1100 km3/year=34857m3/s; UNESCO(73-75, p364)=28736m3/s;
-          ! HLA=26371m3/s
-          ! Data from HLA: 8.1N - 63.3W   1925/89
-          ! --> 26371.416
-          criver(18) = "Orinico             "
-          inb(18) = 1
-          iirnf(1:1,18) = 57
-          ijrnf(1:1,18) = 44
-          zrnfm(1:jpmois,18) = (/   &
-              10670.,    7513.,    6344.,    6887.,   13086.,   26699.,   &
-              43938.,   59957.,   57435.,   39951.,   27410.,   16567./)
-          ! 19-Amazon (Brazil) 0S05 50W00                   R1
-          ! Old=6300 km3/year=199634m3/s; CLIPPER=166192m3/s~UNESCO;
-          ! HLA=184806m3/s
-          ! UNESCO data are at Obidos which is far inland and therefore does not
-          ! fully represent the actual discharge
-          ! Data from HLA: 1.5N - 55.3W   1970/96
-          ! --> 184845.484m3/s
-          criver(19) = "Amazon              "
-          inb(19) = 3
-          iirnf(1:3,19) = (/ 60, 60, 60 /)
-          ijrnf(1:3,19) = (/ 39, 40, 41 /)
-          zrnfm(1:jpmois,19) = (/   &
-              152233., 176415., 199941., 225565., 244016., 244861.,   &
-              230711., 203128., 164531., 128486., 118214., 130045. /)
-          ! 20-Sao Francisco (Brazil) 10S30 36W24           R1
-          ! Old=97 km3/year=3074m3/s; UNESCO(77-79, p338)=2645m3/s
-          ! --> 2645.3335m3/s
-          criver(20) = "San Fransisco       "
-          inb(20) = 1
-          iirnf(1:1,20) = 63
-          ijrnf(1:1,20) = 31
-          zrnfm(1:jpmois,20) = (/   &
-              3244.,   4116.,   5139.,   4330.,   2323.,   1800.,     &
-              1587.,   1511.,   1593.,   1740.,   2190.,   2171. /)
-          ! 21-Parana+Uruguay(Arg./Uru.) 34S12 58W18        R1 
-          ! Old=470 km3/year=14893m3/s; UNESCO(p323/324)=22263m3/s
-          ! --> 22203.168m3/s 
-          criver(21) = "Parana              "
-          inb(21) = 1
-          iirnf(1:1,21) = 58
-          ijrnf(1:1,21) = 24
-          zrnfm(1:jpmois,21) = (/   &
-              24803.,   26836.,   24585.,   21358.,   20041.,   21689.,   &
-              22647.,   20403.,   19627.,   21400.,   21126.,   21923./)
-          ! 22-Negro (Argentina)  41S02  62W47              R2
-          ! Old=30 km3/year=951m3/s; UNESCO(65-79,p330)=765m3/s; ratio=1.24
-          ! --> 907.666687m3/s
-          criver(22) = "Rio Negro           "
-          inb(22) = 1
-          iirnf(1:1,22) = 56
-          ijrnf(1:1,22) = 22
-          zrnfm(1:jpmois,22) = (/   &
-              882.,     587.,     519.,     482.,     623.,     984.,   &
-              1120.,   1294.,    1092.,    1166.,    1105.,    1038./)
-          ! 23- Tocantins :  ~48W00 ~0.5S                   R4
-          ! UNESCO(76-77+80-81, p335)=12167m3/s (station far inland!)
-          ! --> 12173.082m3/s
-          criver(23) = "Tocantins           "
-          inb(23) = 1
-          iirnf(1:1,23) = 60
-          ijrnf(1:1,23) = 38
-          zrnfm(1:jpmois,23) = (/   &
-              15507.,  24855.,  27854.,  24257.,  15860.,   7861.,   &
-              4440.,   3082.,   2728.,   3417.,   5511.,  10705. /)
-
-          ! Total run-offs(II)=256755.75
-          ! Total run-offs(I+II)=317730
-
-          ! III EUROPE
-          ! ----------
-          ! 26-Rhone (France) 43N20 4E50                    R1 
-          ! Old=49 km3/year=1553m3/s; UNESCO(65-83, p512)=1229
-          ! --> 1217.16663m3/s
-          criver(26) = "Rhone               "
-          inb(26) = 1
-          iirnf(1:1,26) = 76
-          ijrnf(1:1,26) = 55
-          zrnfm(1:jpmois,26) = (/   &
-              1385.,    1848.,    1568.,    1311.,    1420.,    1191.,   &
-              937.,     796.,     794.,     962.,    1161.,    1233./)
-          ! 27-Po (Italy) 41N10 11E09                       R1 
-          ! Old=46 km3/year=1458m3/s; UNESCO(65-84, p527)=1550m3/s
-          ! --> 1550.08337m3/s
-          criver(27) = "Po                  "
-          inb(27) = 1
-          iirnf(1:1,27) = 79
-          ijrnf(1:1,27) = 54
-          zrnfm(1:jpmois,27) = (/   &
-              1304.,    1605.,    1856.,    1549.,    1958.,    1760.,   &
-              1040.,    1007.,    1615.,    1907.,    1772.,    1228./)
-          ! 28-Danube (Roumania) 45N20 29E40                R1 
-          ! Old=206 km3/year=6527m3/s; UNESCO(65-84, p544)=7011m3/s
-          ! --> 7011.8335m3/s
-          criver(28) = "Danube              "
-          inb(28) = 1
-          iirnf(1:1,28) = 87
-          ijrnf(1:1,28) = 53
-          zrnfm(1:jpmois,28) = (/   &
-              6625.,    7352.,    7986.,    9279.,    9482.,    8618.,   &
-              7586.,    6001.,    5210.,    4989.,    4921.,    6093./)
-
-          ! 29-Volga
-          criver(29) = "Volga               "
-          inb(29) = 1
-          iirnf(1:1,29) = 4
-          ijrnf(1:1,29) = 56
-          zrnfm(1:jpmois,29) = 0.
-          ! 30-Dniepr
-          criver(30) = "Dniepr+Don          "
-          inb(30)= 2
-          iirnf(1:2,30) = (/ 89, 90 /)
-          ijrnf(1:2,30) = (/ 56, 56 /)
-
-          ! Total run-offs(III)=9779.08301m3/s
-          ! Total run-offs(I+II+III)=327509.094m3/s
-
-          ! IV EURASIAN ARCTIC
-          ! ------------------
-          ! 31-Iana (Russia)      126E40 72N25              R1
-          ! Old=29 km3/year=919m3/s; UNESCO(65-72+74+76-84, p463)=936m3/s
-          ! --> 0m3/s
-          criver(31) = "Iana                "
-          inb(31) = 1
-          iirnf(1:1,31) = 20
-          ijrnf(1:1,31) = 68
-          zrnfm(1:jpmois,31) = (/   &
-              2.,       1.,       0.,       0.,     917.,    3514.,   &
-              2968.,    2329.,    1322.,   178.,      36.,       8./)
-          ! 32-Ob (Russia) 66N45 69E30                      R1 
-          ! Old=385 km3/year=12200m3/s; UNESCO(65-84, p478)=12862m3/s
-          ! --> 12861.5m3/s
-          criver(32) = "Ob                  "
-          inb(32) = 1
-          iirnf(1:1,32) = 78
-          ijrnf(1:1,32) = 72
-          zrnfm(1:jpmois,32) = (/   &
-              4977.,    4150.,    3611.,    3590.,   14723.,   33366.,   &
-              30773.,   22785.,   14701.,    9705.,    6078.,    5879./)
-          ! 33-Yenesei (Russia) 71N50 82E40                 R1 
-          ! Old=560 km3/year=17745m3/s; UNESCO(65-84, p472)=17462m3/s
-          ! --> 17461.666m3/s
-          criver(33) = "Yenesei             "
-          inb(33) = 1
-          iirnf(1:1,33) = 77
-          ijrnf(1:1,33) = 75
-          zrnfm(1:jpmois,33) = (/   &
-              6659.,    7007.,    6895.,    7089.,   24183.,   74965.,   &
-              25325.,   15940.,   16050.,   12678.,    6741.,    6008./)
-          ! 34-Severnaya Dvina(Russia)64N32 40E30           R5 
-          ! Old=106 km3/year=3359m3/s; not in UNESCO data base
-          ! --> 3359.00024m3/s
-          criver(34) = "Severnaya Dvina     "
-          inb(34) = 1
-          iirnf(1:1,34) = 78
-          ijrnf(1:1,34) = 68
-          zrnfm(1:jpmois,34) = 3359.
-          ! 35-Lena (Russia) 72N25 126E40                   R1 
-          ! --> 16192.333m3/s
-          criver(35) = "Lena                "
-          inb(35) = 1
-          iirnf(1:1,35) = 20
-          ijrnf(1:1,35) = 68
-          zrnfm(1:jpmois,35) = (/   &
-              2663.,    2095.,    1629.,    1324.,    7203.,   64230.,   &
-              40810.,   28310.,   25995.,   13299.,    3673.,    3077./)
-          ! 36-Kolyma (Russia) 69N30 161E00                 R1
-          ! Old=71 km3/year=2250m3/s; UNESCO(65-84)=2138m3/s
-          ! --> 2138.66675m3/s
-          criver(36) = "Kolyma              "
-          inb(36) = 1
-          iirnf(1:1,36) = 24
-          ijrnf(1:1,36) = 65
-          zrnfm(1:jpmois,36) = (/   &
-              131.,      92.,      76.,      65.,    2576.,    9143.,   &
-              4670.,    3727.,    3226.,    1119.,     630.,     209./)
-          ! 37-Indigirka (russia) 70N48 148E54              R1 
-          ! Old=55 km3/year=1743m3/s; UNESCO(65-68+70+72-84)=1622.
-          ! --> 1622.00012m3/s
-          criver(37) = "Indigirka           "
-          inb(37) = 1
-          iirnf(1:1,37) = 23
-          ijrnf(1:1,37) = 66
-          zrnfm(1:jpmois,37) = (/   &
-              32.,      17.,      11.,       7.,     354.,    5629.,   &
-              5210.,    4617.,    2823.,     559.,     142.,      63./)
-          ! 38-Khatanga
-          criver(38) = "Khatanga             "
-          inb(38) = 1
-          iirnf(1:1,38) = 20
-          ijrnf(1:1,38) = 72
-          zrnfm(1:jpmois,38) = 0.
-
-          ! Total run-offs(IV)=40773.6641m3/s
-          ! Total run-offs(I+II+III+IV)=368282.75m3/s
-
-          ! V ASIA
-          ! ------
-          ! 41-Amur (Russia) 52N56 141E10                   R2
-          ! Old=325 km3/year=10299m3/s; UNESCO(65-84, p451)=8792m3/s; ratio=1.17
-          ! --> 10299.332m3/s
-          criver(41) = "Amur                "
-          inb(41) = 1
-          iirnf(1:1,41) = 18
-          ijrnf(1:1,41) = 59
-          zrnfm(1:jpmois,41) = (/   &
-              2108.,    1543.,    1252.,    4088.,   15464.,   17336.,   &
-              16100.,   20801.,   21548.,   15658.,    5188.,    2506./)
-          ! 42-Liaohe (China) 40N40 122E09                  R5
-          ! Old=6 km3/year=190m3/s; not found in UNESCO data base
-          ! --> 189.999985m3/s
-          criver(42) = "Liaohe              "
-          inb(42) = 1
-          iirnf(1:1,42) = 15
-          ijrnf(1:1,42) = 54
-          zrnfm(1:jpmois,42) = 190.
-          ! 43-Daling (China) 40N56 121E43                  R5
-          ! Old=1 km3/year=32m3/s; not found in UNESCO data base
-          ! --> 31.9999962m3/s
-          criver(43) = "Daling              "
-          inb(43) = 1
-          iirnf(1:1,43) = 15
-          ijrnf(1:1,43) = 54
-          zrnfm(1:jpmois,43) = 32.
-          ! 44-Haiho (China) 6N17   1E23
-          ! Old=2 km3/year=64m3/s; not found in UNESCO data base
-          ! --> 63.9999924m3/s
-          criver(44) = "Haiho               "
-          inb(44) = 0
-          iirnf(1:1,44) = 0
-          ijrnf(1:1,44) = 0
-          zrnfm(1:jpmois,44) = 64.
-          ! 45-Yellow/Huangho (China) 37N32 118E19          R2 
-          ! Old=49 km3/year=1553m3/s; UNESCO(p371)=1210m3/s; ratio=1.28
-          ! --> 1552.5m3/s
-          criver(45) = "Yellow/Huangho      "
-          inb(45) = 1
-          iirnf(1:1,45) = 13
-          ijrnf(1:1,45) = 51
-          zrnfm(1:jpmois,45) = (/   &
-              697.,     674.,    1282.,    1206.,    1109.,     778.,   &
-              1964.,    3270.,    3668.,    2133.,     978.,     871./)
-          ! 46-Yangtze (China) 31N48 121E10=Changjiang      R2
-          ! Old=900 km3/year=28520m3/s; UNESCO(p372)=25032m3/s; ratio=1.14
-          ! --> 28519.584m3/s
-          criver(46) = "Yangtze             "
-          inb(46) = 1
-          iirnf(1:1,46) = 13
-          ijrnf(1:1,46) = 50
-          zrnfm(1:jpmois,46) = (/   &
-              10994.,   10548.,   13254.,   24097.,   36972.,   47197.,   &
-              53891.,   42070.,   37627.,   30762.,   22046.,   12777./)
-          ! 47-Pearl/Zhujiang (China) 23N36 106E34=Xijiang  R2 
-          ! Old=302 km3/year=9570m3/s; UNESCO(76,82, p373)=6987m3/s; ratio=1.37
-          ! --> 9570.75m3/s
-          criver(47) = "Pearl Zhujiang       "
-          inb(47) = 1
-          iirnf(1:1,47) = 12
-          ijrnf(1:1,47) = 48
-          zrnfm(1:jpmois,47) = (/   &
-              2357.,    2415.,    2634.,    6446.,   14246.,   18395.,   &
-              19213.,   17558.,   12312.,    7255.,    5864.,    6154./)
-          ! 48-Red/Hungho (Vietnam) 20N17 106E34            R5 
-          ! Old=123 km3/year=3897m3/s; not in UNESCO data base
-          ! --> 3897.m3/s
-          criver(48) = "Red Hungho          "
-          inb(48) = 1
-          iirnf(1:1,48) = 10
-          ijrnf(1:1,48) = 47
-          zrnfm(1:jpmois,48) = 3897.
-          ! 49-Mekong (Vietnam) 10N33 105E24                R5
-          ! Old=470 km3/year=14893m3/s; not in UNESCO data base
-          ! --> 14893.0029m3/s
-          criver(49) = "Mekong              "
-          inb(49) = 1
-          iirnf(1:1,49) =  8
-          ijrnf(1:1,49) = 44
-          zrnfm(1:jpmois,49) = 14893.
-          ! 50-Irrawady (Burma) 15N50  95E06                R5
-          ! Old=428 km3/year=13563m3/s; not in UNESCO data base
-          ! --> 13563.m3/s
-          criver(50) = "Irrawady            "
-          inb(50) = 1
-          iirnf(1:1,50) =  6
-          ijrnf(1:1,50) = 46
-          zrnfm(1:jpmois,50) = 13563.
-          ! 51-Ganges+Brahmaputra (Beng.) 22N00  91E00      R1
-          ! Old=971 km3/year=30769m3/s; UNESCO(69-70+73-75, p367)=31760m3/s
-          ! --> 32147.498m3/s
-          criver(51) = "Ganges              "
-          inb(51) = 2
-          iirnf(1:2,51) = (/  4,  5 /)
-          ijrnf(1:2,51) = (/ 47, 47 /)
-          zrnfm(1:jpmois,51) = (/   &
-              6623.,    6315.,    6432.,    9410.,   17263.,   38302.,   &
-              64688.,   80338.,   84802.,   43387.,   17888.,   10322./)
-          ! 52-Mehandi (India)                              R5
-          ! Old=67 km3/year=2123m3/s; not in UNESCO data base
-          ! --> 0m3/s
-          criver(52) = "Mehandi             "
-          inb(52) = 0
-          iirnf(1:1,52) = 0
-          ijrnf(1:1,52) = 0
-          zrnfm(1:jpmois,52) = 2123.
-          ! 53-Damodar (India)                              R2
-          ! Old=10 km3/year=320m3/s; UNESCO(p386)=173m3/s; ratio=1.85
-          ! --> 432.916656m3/s
-          criver(53) = "Damodar             "
-          inb(53) = 0
-          iirnf(1:1,53) = 0
-          ijrnf(1:1,53) = 0
-          zrnfm(1:jpmois,53) = (/   &
-              51.,      37.,      42.,      49.,      85.,     296.,   &
-              896.,    1390.,    1591.,     542.,     172.,      44./)  
-          ! 54-Godavari (India) 17N00  81E45                R2
-          ! Old=84 km3/year=2662m3/s; UNESCO(p379)=1916m3/s; ratio=1.39
-          ! --> 3670.5m3/s
-          criver(54) = "Godaravi            "
-          inb(54) = 1
-          iirnf(1:1,54) =  3
-          ijrnf(1:1,54) = 46
-          zrnfm(1:jpmois,54) = (/   &
-              988.,     737.,     280.,     219.,     196.,    1691.,   &
-              8063.,   14571.,   11428.,    3953.,    1221.,     699./)
-          ! 55-Indus (Pakistan) 24N20  67E47                R2
-          ! Old=238 km3/year=7542m3/s; UNESCO (76-79, p428)=2396m3/s; ratio=3.15
-          ! --> 7562.m3/s
-          criver(55) = "Indus               "
-          inb(55) = 1
-          iirnf(1:1,55) = 89
-          ijrnf(1:1,55) = 47
-          zrnfm(1:jpmois,55) = (/   &
-              988.,     737.,    1904.,    1968.,    3625.,    6143.,   &
-              15969.,    36656.,  17173.,    3215.,    1251.,    1115./)
-          ! 56-Tigris and Euphrates (Iraq) 31N00  47E25     R1
-          ! Old=46 km3/year=1458m3/s; UNESCO(76-79, p428)=2396m3/s
-          ! --> 2248.8335m3/s
-          criver(56) = "Tigris              "
-          inb(56) = 1
-          iirnf(1:1,56) = 88
-          ijrnf(1:1,56) = 47
-          zrnfm(1:jpmois,56) = (/   &
-              1872.,    2127.,    2962.,    4944.,    5036.,    3078.,   &
-              1362.,     900.,     786.,     993.,    1184.,    1742./)
-
-          ! Total run-offs (V)=128642.922m3/s
-          ! Total run-offs (I+II+III+IV+V)=496925.688m3/s
-
-          ! VI AFRICA
-          ! ----------
-          ! 61-Nile (Egypt) 30N10  31E06                    R1
-          ! Old=30 km3/year=951m3/s; UNESCO(73-84)=1251m3/s
-          ! --> 1251.33337m3/s
-          criver(61) = "Nile                "
-          inb(61) = 1
-          iirnf(1:1,61) = 90
-          ijrnf(1:1,61) = 50
-          zrnfm(1:jpmois,61) = (/   &
-              1239.,    1035.,    1126.,    1110.,    1170.,    1542.,   &
-              1742.,    1559.,    1191.,    1103.,    1075.,    1124./)
-          ! 62-Niger (Nigeria) 5N33   6E33                  R1
-          ! Old=192 km3/year=6084m3/s; HLA=5545m3/s;
-          ! Data from HLA: 4.5N -  6  E   1950/87
-          ! --> 5545.08301m3/s
-          criver(62) = "Niger               "
-          inb(62) = 1
-          iirnf(1:1,62) = 74
-          ijrnf(1:1,62) = 41
-          zrnfm(1:jpmois,62) = (/   &
-              2029.,    1804.,    1573.,    1418.,    1494.,    2561.,   &
-              5272.,    9629.,   14951.,   16227.,    6842.,    2741./)
-          ! 63-Zaire/Congo (Congo) 6S04  12E24              R1      
-          ! Old=1250 km3/year=39610m3/s; UNESCO(65-83, p149)=41941m3/s; HLA
-          ! =39720m3/s
-          ! Data from HLA: 6S - 12  E   1902/96
-          ! --> 39719.5m3/s
-          criver(63) = "Zaire Congo         "
-          inb(63) = 1
-          iirnf(1:1,63) = 75
-          ijrnf(1:1,63) = 33
-          zrnfm(1:jpmois,63) = (/   &
-              47200.,   37692.,   34374.,   36603.,   37862.,   35588.,   &
-              30966.,   30774.,   35981.,   42825.,   51455.,   55314./)
-          ! 64-Orange (Sth Africa) 28S41 16E28              R5
-          ! Old=11 km3/year=349m3/s
-          ! --> 349.000031m3/s
-          criver(64) = "Orange              "
-          inb(64) = 1
-          iirnf(1:1,64) = 76
-          ijrnf(1:1,64) = 26
-          zrnfm(1:jpmois,64) = 349.
-          ! 65-Zambesi (Mozambique) 18S55 36E04             R5
-          ! Old=223 km3/year=7066m3/s
-          ! --> 7066.00049m3/s
-          criver(65) = "Zambesi             "
-          inb(65) = 1
-          iirnf(1:1,65) = 81
-          ijrnf(1:1,65) = 29
-          zrnfm(1:jpmois,65) = 7066.
-          ! 66-Limpopo (mozambique) 25S15 33E30             R5
-          ! Old=5 km3/year=158m3/s
-          ! --> 158.m3/s
-          criver(66) = "Limpopo             "
-          inb(66) = 1
-          iirnf(1:1,66) = 81
-          ijrnf(1:1,66) = 28
-          zrnfm(1:jpmois,66) = 158.
-          ! 67-Rufiji (tanzania) 8S00 39E20                 R5
-          ! Old=9 km3/year=285m3/s
-          ! --> 285.m3/s
-          criver(67) = "Rufiji             "
-          inb(67) = 1
-          iirnf(1:1,67) = 82
-          ijrnf(1:1,67) = 33
-          zrnfm(1:jpmois,67) = 285.
-          ! Other rivers from the Gulf of Guinea
-          ! 68-Kouilou (Congo)  4.5S-11.5E (UNESCO=p51)     R1
-          ! Data from HLA:  4S - 11  E   1953/86 = 919m3/s
-          ! --> 924.25m3/s
-          criver(68) = "Kouilou            "
-          inb(68) = 1
-          iirnf(1:1,68) = 75
-          ijrnf(1:1,68) = 33
-          zrnfm(1:jpmois,68) = (/   &
-              1115.,    1166.,    1285.,    1462.,    1454.,     725.,   &
-              480.,     378.,     327.,     400.,    1018.,    1281./)
-          ! 69-Nyanga (Gabon)  3S-10E (UNESCO=p66)          R1
-          ! Data from HLA: 2.8N - 10  E   1952/82 = 264m3/s
-          ! --> 264.166687m3/s
-          criver(69) = "Nyanga              "
-          inb(69) = 1
-          iirnf(1:1,69) = 74
-          ijrnf(1:1,69) = 36
-          zrnfm(1:jpmois,69) = (/   &
-              126.,      99.,     143.,     253.,     316.,     300.,   &
-              156.,      93.,     231.,     557.,     592.,     304./)
-          ! 70-Ogoue (Gabon) 1S-9E (UNESCO, p69)            R1
-          ! Data from HLA: .75S -  9  E   1930/90 = 4512m3/s
-          ! --> 4511.83301m3/s
-          criver(70) = "Ogoue               "
-          inb(70) = 1
-          iirnf(1:1,70) = 74
-          ijrnf(1:1,70) = 37
-          zrnfm(1:jpmois,70) = (/   &
-              4514.,    3988.,    4622.,    5403.,    5790.,    4145.,   &
-              2616.,    1961.,    2119.,    4304.,    7870.,    6810./)
-          ! 71-Sanaga (Cameroun) 3.5N-9.5E (UNESCO, p31)    R1
-          ! Data from HLA: 3.9N -  9.6E   1944/80 = 1983m3/s
-          ! --> 1982.58337m3/s
-          criver(71) = "Sanaga              "
-          inb(71) = 1
-          iirnf(1:1,71) = 74
-          ijrnf(1:1,71) = 41
-          zrnfm(1:jpmois,71) = (/   &
-              813.,     578.,     517.,     633.,     909.,    1278.,   &
-              1928.,    2653.,    4361.,    5470.,    3307.,    1344./)
-          ! 72-Nyong (Cameroun) 3.1N-9.5E (UNESCO, p36)     R1
-          ! Data from HLA: 3.5N -  9.8E   1951/84 = 432m3/s
-          ! --> 431.166656m3/s      
-          criver(72) = "Nyong               "
-          inb(72) = 1
-          iirnf(1:1,72) = 74
-          ijrnf(1:1,72) = 41
-          zrnfm(1:jpmois,72) = (/   &
-              232.,     128.,     150.,     266.,     402.,     459.,   &
-              353.,     306.,     604.,     930.,     878.,     466./)
-          ! 73-Ntem (Cameroun) 2.5N-9.5E (UNESCO, p36)      R1
-          ! Data from HLA: 3N -  9.8E   1951/87 = 330m3/s      
-          ! --> 329.75m3/s
-          criver(73) = "Ntem                "
-          inb(73) = 1
-          iirnf(1:1,73) = 74
-          ijrnf(1:1,73) = 41
-          zrnfm(1:jpmois,73) = (/   &
-              452.,     455.,     492.,     466.,     482.,     251.,   &
-              151.,     108.,      87.,     133.,     395.,     485./)
-          ! 74-Wouri (Cameroun) 4N-9.5E (UNESCO, p34)       R1
-          ! Data from HLA: 4N -  9.5E   1951/84  = 307m3/s
-          ! --> 306.583374m3/s
-          criver(74) = "Wouri               "
-          inb(74) = 1
-          iirnf(1:1,74) = 74
-          ijrnf(1:1,74) = 41
-          zrnfm(1:jpmois,74) = (/   &
-              88.,      63.,      68.,      95.,     139.,     222.,   &
-              395.,     633.,     825.,     675.,     328.,     148./)
-          ! 75-Oueme (Benin) 6.5N-2.5E (UNESCO, p27)        R1
-          ! Data from HLA:  6.2N -  2.5E   1951/84 =113m3/s
-          ! --> 112.666664m3/s
-          criver(75) = "Oueme               "
-          inb(75) = 1
-          iirnf(1:1,75) = 73
-          ijrnf(1:1,75) = 42
-          zrnfm(1:jpmois,75) = (/   &
-              0.,       0.,       0.,       0.,       1.,      18.,   &
-              96.,     324.,     531.,     319.,      58.,       5./)
-          ! 76-Mono(Tepetou,Benin/Togo) 6.25N-1.8E (U, p27) R1
-          ! Data from HLA: 6.2N -  1  E   1951/85  = 96m3/s       
-          ! --> 96.4999924m3/s
-          criver(76) = "Mono                "
-          inb(76) = 1
-          iirnf(1:1,76) = 72
-          ijrnf(1:1,76) = 42
-          zrnfm(1:jpmois,76) = (/   &
-              2.,       1.,       1.,       4.,       8.,      44.,   &
-              168.,     274.,     386.,     215.,      47.,       8./)
-          ! 77-Comoe (Ivory Coast) 5N-4W (UNESCO, p56)      R1
-          ! Data from HLA: 5.1N -  4  W   1955/86 = 194m3/s       
-          ! --> 194.25m3/s
-          criver(77) = "Comoe               "
-          inb(77) = 1
-          iirnf(1:1,77) = 71
-          ijrnf(1:1,77) = 41
-          zrnfm(1:jpmois,77) = (/   &
-              14.,       7.,       9.,      17.,      29.,      90.,   &
-              145.,     349.,     740.,     688.,     198.,      45./)
-          ! 78-Sassandra (Ivory Coast) 5N-6W (UNESCO, p58)  R1
-          ! Data from HLA: 5N -  6  W   1953/86 = 449m3/s
-          ! --> 449.333344m3/s
-          criver(78) = "Sassandra           "
-          inb(78) = 1
-          iirnf(1:1,78) = 71
-          ijrnf(1:1,78) = 41
-          zrnfm(1:jpmois,78) = (/   &
-              144.,     116.,     119.,     143.,     156.,     334.,   &
-              419.,     692.,    1277.,    1190.,     553.,     249./)
-          ! 79-Jubba (Somali Coast)
-          criver(79) = "Jubba               "
-          inb(79) = 1
-          iirnf(1:1,79) = 84
-          ijrnf(1:1,79) = 39
-          zrnfm(1:jpmois,79) = 0.
-          ! 80-Senaga
-          criver(80) = "Senegal             "
-          inb(79) = 1
-          iirnf(1:1,80) = 66
-          ijrnf(1:1,80) = 47
-          zrnfm(1:jpmois,79) = 0.
-      
-          ! Total run-offs (VI)=63977.m3/s
-          ! Total run-offs (I+II+III+IV+V+VI)=560902.688m3/s
-          
-          ! VII OCEANIA
-          ! ------------
-          ! 91-Murray (Australia) 35S34 138E54              R5
-          ! Old=22 km3/year=697m3/s
-          ! --> 696.999939m3/s
-          criver(91) = "Murray              "
-          inb(91) = 1
-          iirnf(1:1,91) = 16
-          ijrnf(1:1,91) = 24
-          zrnfm(1:jpmois,91) = 697.
-          ! 92-Haast (N. Zeland) 43S50 169E02               R5
-          ! Old=6 km3/year=190m3/s
-          ! --> 189.999985m3/s
-          criver(92) = "Haast               "
-          inb(92) = 1
-          iirnf(1:1,92) = 24
-          ijrnf(1:1,92) = 22
-          zrnfm(1:jpmois,92) = 190.
-          ! 93-Fly (N. Guinea) 8S30 143E05                  R5
-          ! Old=77 km3/year=2440m3/s
-          ! --> 2440.m3/s
-          criver(93) = "Fly                 "
-          inb(93) = 1
-          iirnf(1:1,93) = 19
-          ijrnf(1:1,93) = 31
-          zrnfm(1:jpmois,93) = 2440.
-          ! 94-Purari (N. Guinea) 7S25 145E05               R4
-          ! Old=77 km3/year=2440m3/s; UNESCO(77+83,p595)=2727m3/s
-          ! --> 2727.33325m3/s
-          criver(94) = "Purari              "
-          inb(94) = 1
-          iirnf(1:1,94) = 19
-          ijrnf(1:1,94) = 33
-          zrnfm(1:jpmois,94) = (/   &
-              1972.,    3067.,    2332.,    2981.,    2693.,    2876.,   &
-              2867.,    3477.,    2195.,    2967.,    2674.,    2627./)
-          ! 95-Choshui ch''i (taiwan) 24N03 120E23          R2
-          ! Old=6 km3/year=190m3/s; UNESCO(65-68, p374)=120m3/s; ratio=1.58 
-          ! --> 0.m3/s
-          criver(95) = "Choshui             "
-          inb(95) = 1
-          iirnf(1:1,95) = 12
-          ijrnf(1:1,95) = 48
-          zrnfm(1:jpmois,95) = (/   &
-              65.,      63.,      83.,     100.,     177.,     535.,   &
-              332.,     313.,     236.,     193.,     101.,      84./)
-          ! 96-Kaoping (Taiwan)                             R5  
-          ! Old=9 km3/year=285m3/s
-          ! --> 0.m3/s
-          criver(96) = "Kaoping             "
-          inb(96) = 0
-          iirnf(1:1,96) = 0
-          ijrnf(1:1,96) = 0
-          zrnfm(1:jpmois,96) = 285.
-          ! 97-Tsengwen (Taiwan)                            R5
-          ! Old=2 km3/year=63m3/s
-          ! --> 0.m3/s
-          criver(97) = "Tsengwen            "
-          inb(97) = 0
-          iirnf(1:1,97) = 0
-          ijrnf(1:1,97) = 0
-          zrnfm(1:jpmois,97) = 63.
-          ! 98-Hualien (Taiwan)                             R5
-          ! Old=4 km3/year=127m3/s
-          ! --> 0.m3/s
-          criver(98) = "Hualien             "
-          inb(98) = 0
-          iirnf(1:1,98) = 0
-          ijrnf(1:1,98) = 0
-          zrnfm(1:jpmois,98) = 127.
-          ! 99-Peinan (Taiwan) 22N46 121E10                 R5
-          ! Old=4 km3/year=127m3/s
-          ! --> 127.000008m3/s
-          criver(99) = "Peinan              "
-          inb(99) = 1
-          iirnf(1:1,99) = 12
-          ijrnf(1:1,99) = 48
-          zrnfm(1:jpmois,99) = 127.
-          ! 100-Hsiukuluan (Taiwan)                         R5
-          ! Old=4 km3/year=127m3/s
-          ! --> 0.m3/s
-          criver(100) = "Hsiukuluan          "
-          inb(100) = 0
-          iirnf(1:1,100) = 0
-          ijrnf(1:1,100) = 0
-          zrnfm(1:jpmois,100) = 127.
-
-          !  Total run-offs(VII)=6181.33301m3/s
-          
-
-          ! VIII ANTARCTICA
-          ! ---------------
-          ! 103 -Antarctic ice discharge (2 613 Gt/year) (jacobs et al 1992)
-          ! Data from Jacobs et al 92: =2613 km3/year=82857.686454 m3/s
-          ! --> 82858 m3/s
-          criver(103) = "Antarctica         "
-          inb(103) = 108
-          iirnf(1:108,103) = (/   &
-               2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,   &
-              21,22,23,24,25,25,24,24,24,25,26,27,28,29,30,31,32,33,34,   &
-              35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,51,53,   &
-              53,53,53,54,54,54,56,57,57,57,57,57,57,57,57,57,57,58,59,   &
-              60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,   &
-              79,80,81,82,83,84,85,86,87,88,89,90,91 /)
-          ijrnf(1:108,103) = (/   &
-              12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,   &
-              10,10, 9, 9, 8, 7, 6, 5, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3,   &
-               3, 4, 5, 6, 6, 6, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7,   &
-               8, 9,10,10,11,12,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 2,   &
-               2, 2, 2, 2, 3, 4, 4, 5, 7, 8, 9, 9, 9, 9, 9, 9,10,10,10,   &
-              10,10,10,10,11,12,12,12,12,11,11,10,10 /)
-          zrnfm(1:jpmois,100) = 82858.0
-                   
-
-          !  Total run-offs(I+II+III+IV+V+VI+VII)= 567084. m3/s
-          !                                      = 1.588668056E-6 kg/m2/s
-          !                                      = 17883.5586 km3/Year
-          !                                      = 0.567083955 Sverdrup
-      ENDIF
-
-      !!----------------------------------------------------------------------
-      !!  OPA 8.5, LODYC-IPSL (2002)
-      !!----------------------------------------------------------------------
-
-      IF( kt == nit000 ) THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'flxrnf : runoff + orca4'
-         IF(lwp) WRITE(numout,*) '~~~~~~'
-         IF(lwp) WRITE(numout,*) '   nrunoff = ', nrunoff
-         IF(lwp) WRITE(numout,*)
-      ENDIF
-
-      ! 0. initialization and  indexes  modification for zoom version
-      ! --------------------------------------------------------------
-      
-      
-      ! conversion factor m3/s --> kg/m2/s *e1t*e2t
-
-      zconv = rauw
-
-      IF( kt == nit000 ) THEN 
-         ! Set runoffs and upstream coeff to zero
-         runoff (:,:) = 0.e0                                                                                  
-         upsrnfh(:,:) = 0.e0
-         upsrnfz(:)   = 0.e0
-         upsadv (:,:) = 0.e0
-         zcoefr(:,:,:) = 0.e0
-
-         IF( nrunoff == 0 ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) ' NO RUNOFF in this simulation '
-            IF(lwp) WRITE(numout,*)
-         ENDIF
-      ENDIF
-
-      IF( kt == nit000 ) THEN
-         IF( nrunoff >= 1 ) THEN 
-            zbilan = 0.0 
-!OCL SCALAR
-            DO jr = 1, jpriv-1
-               inbp = inb(jr)
-               IF( inbp /= 0 ) THEN
-                  ii = mj0(iirnf(1,jr))
-                  ij = mi0(ijrnf(1,jr))
-                  ii = MAX( 2, MIN( ii, jpi-1 ) )
-                  ij = MAX( 2, MIN( ij, jpj-1 ) )
-!OCL SCALAR
-                  IF( tmask(ii,ij,1) <= 0.5 ) THEN 
-                     IF(lwp) WRITE(numout,*) 'Erreur riviere masquee   ', ii, ij, jr, criver(jr)
-                  ENDIF
-                  IF( tmask(ii-1,ij,1)*tmask(ii+1,ij,1)   &
-                     *tmask(ii,ij-1,1)*tmask(ii,ij+1,1) /= 0. )THEN 
-                     IF(lwp) WRITE(numout,*) 'Erreur riviere non cotiere ',ii, ij, jr, criver(jr)
-                  ENDIF
-                  DO nrnf1 = 1, jpmois
-                     zbilan = zbilan + zrnfm(nrnf1,jr) * tmask(ii,ij,1)
-                  END DO
-               ENDIF
-            END DO
-            IF(lwp) WRITE(numout,*) 'zrnfm (runoff) ', zero, zconv, rauw, SUM(zrnfm)
-            IF(lwp) THEN 
-               WRITE(numout,'("Total runoff : ",1E30.15)' ) zbilan
-               WRITE(numout,*) 'Run-off : POSITION and value '
-               WRITE(numout,*) 'ji jj glamt gphit annual mask 12-month '
-!OCL SCALAR
-               DO jr = 1, jpriv-1
-                  inbp = inb(jr)
-                  IF(inbp /= 0) THEN
-!OCL SCALAR
-                     DO jl = 1, inbp
-                        ii = mj0(iirnf(jl,jr))
-                        ij = mi0(ijrnf(jl,jr))
-                        WRITE(numout,'(2I3,1X,1A20,2X,2I4,2F7.1,1I3,1PE10.1,1I2,12E9.1)')   &
-                           jr, jl, criver(jr),   &
-                           ii, ij, glamt(ii,ij), gphit(ii,ij), inbp,   &
-                           SUM(zrnfm(1:jpmois,jr))/float(inbp),   &
-                           NINT(tmask(ii,ij,1)),   &
-                           zrnfm(1:jpmois,jr)/float(inbp)
-                     END DO
-                  ENDIF
-               END DO
-            ENDIF
-            IF(lwp) WRITE(numout,*) ' zrnfm (runoff) ', zero, zconv, rauw, SUM(zrnfm)
-         ENDIF
-      ENDIF
-
-      ! 1. initialization of the runoff array
-      ! -------------------------------------
-
-      IF( nrunoff == 1 .OR. nrunoff == 2) THEN
-
-         iman  = jpmois
-         
-         i15 = nday/16
-         
-         imois = nmonth + i15 - 1
-         IF( imois == 0) imois = iman
-         IF( nleapy == 1 .AND. MOD( nyear, 4 ) == 0 ) THEN
-            ! Number of Day Between Data
-            idbd = nbiss(imois)
-         ELSEIF( nleapy > 1 ) THEN
-            idbd = nleapy
-         ELSE
-            idbd = nobis(imois)
-         ENDIF
-         ! Number of days between imois, 15 and the end of month
-         idmeom = idbd - 15
-         
-         ! 1.1 Calendar computation
-         
-         ! nrnf1 number of the first array record used in the simulation
-         ! nrnf2 number of the last  array record
-         
-         nrnf1 = imois
-         nrnf2 = nrnf1 + 1
-         nrnf1 = MOD( nrnf1, iman )
-         IF( nrnf1 == 0 ) nrnf1 = iman
-         nrnf2 = MOD( nrnf2, iman )
-         IF( nrnf2 == 0 ) nrnf2 = iman
-         
-         IF( kt == nit000 ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'flxrnf routine'
-            IF(lwp) WRITE(numout,*) 'first array record used nrnf1 ',nrnf1
-            IF(lwp) WRITE(numout,*) 'last  array record used nrnf2 ',nrnf2
-            IF(lwp) WRITE(numout,*) 'total zrnfm ', SUM(zrnfm)
-            IF(lwp) WRITE(numout,*) 'total surface ', SUM(e1t*e2t*tmask(:,:,1))
-         ENDIF
-
-         zxy = FLOAT( nday + idmeom - idbd * i15 ) / idbd
-
-!OCL SCALAR
-         DO jr = 1, jpriv-1
-            inbp = inb(jr)
-!OCL SCALAR
-            IF( inbp /= 0 ) THEN
-               DO jl = 1, inbp
-                  ii = iirnf(jl,jr) - nimpp + 1 - jpizoom + 1
-                  ij = ijrnf(jl,jr) - njmpp + 1 - jpjzoom + 1
-                  iipt0 = MAX( 1, MIN( ii, jpi   ) )
-                  iipt1 = MAX( 0, MIN( ii, jpi-1 ) )
-                  ijpt0 = MAX( 1, MIN( ij, jpj   ) )
-                  ijpt1 = MAX( 0, MIN( ij, jpj-1 ) )
-                  DO jj = ijpt0, ijpt1
-                     DO ji = iipt0, iipt1
-                        runoff(ji,jj) = runoff(ji,jj)   & 
-                                      + ( (1.-zxy) * zrnfm(nrnf1,jr)   &
-                                      +       zxy  * zrnfm(nrnf2,jr)  ) / FLOAT(inbp)      
-                     END DO
-                  END DO
-               END DO
-            ENDIF
-         END DO
-
-
-         ! 2. conversion in mm/day
-         ! -----------------------
-         !     C a u t i o n : upward water flux, runoff is negative
-
-         runoff(:,:) = -zconv * runoff(:,:) / ( e1t(:,:) * e2t(:,:) )
-         
-
-         ! 3. advectve coefficient
-         ! -----------------------
-
-         !  Creates the array coef that contains the coefficient to affect to
-         !  the upstream scheme. advection scheme will be:
-         !  coefr * upstream + (1- coefr) centered
-         !  coefr must be between 0 and 1.
-         !  3 values are used: maximum = zrup1, between zrup2, small zrup3.
-         ! 
-         IF( nrunoff == 2 .AND. kt == nit000 ) THEN
-
-            zrup1 = 0.5
-            zrup2 = 0.25
-            zrup3 = 0.125
-            DO jr = 1, jpriv-1
-               inbp = inb(jr)
-               IF( inbp /= 0) THEN
-                  DO jl = 1, inbp
-                     ! --> zrup1 (originally, = 1 = all upstream).
-                     ! ji,jj
-                     ii = iirnf(jl,jr) - nimpp + 1 - jpizoom - 1
-                     ij = ijrnf(jl,jr) - njmpp + 1 - jpjzoom - 1
-                     iipt0 = MAX( 1, MIN( ii,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii,jpi-1) )
-                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = zrup1
-                           END DO
-                           zcoefr(ji,jj,4) = zrup2
-                           zcoefr(ji,jj,5) = zrup3
-                        END DO
-                     END DO
-                     ! --> zrup2 (originally = 0.5)
-                     ! ji,jj+1
-                     ijpt0 = MAX( 1, MIN( ij+1, jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+1, jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji,jj-1
-                     ijpt0 = MAX( 1, MIN( ij-1, jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-1, jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji+1,jj-1
-                     iipt0 = MAX( 1, MIN( ii+1, jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii+1, jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji+1,jj
-                     ijpt0 = MAX( 1, MIN( ij, jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij, jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji+1,jj+1
-                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji-1,jj+1
-                     iipt0 = MAX( 1, MIN( ii-1,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii-1,jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji-1,jj
-                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! ji-1,jj-1
-                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
-                           END DO
-                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
-                        END DO
-                     END DO
-                     ! --> zrup3 (originally = 0.25)
-                     ! ji-1,jj+2
-                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-1,jj-2
-                     ijpt0 = MAX( 1, MIN( ij-2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji,jj-2
-                     iipt0 = MAX( 1, MIN( ii,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii,jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji,jj+2
-                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+1,jj-2
-                     iipt0 = MAX( 1, MIN( ii+1,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii+1,jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+1,jj+2
-                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj-2
-                     iipt0 = MAX( 1, MIN( ii+2,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii+2,jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj+2
-                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3  
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj-1
-                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj+1
-                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji+2,jj
-                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj
-                     iipt0 = MAX( 1, MIN( ii-2,jpi  ) )
-                     iipt1 = MAX( 0, MIN( ii-2,jpi-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3        
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj-2
-                     ijpt0 = MAX( 1, MIN( ij-2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj+2
-                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj-1
-                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                     ! ji-2,jj+1
-                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
-                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
-                     DO jj = ijpt0, ijpt1
-                        DO ji = iipt0, iipt1
-                           DO jn = 1, 3 
-                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
-                           END DO
-                        END DO
-                     END DO
-                  END DO
-               ENDIF
-            END DO
-            upsrnfh(:,:) = zcoefr(:,:,1)
-            upsrnfz(:)   = 0.e0
-            upsrnfz(1)   = 1.0
-            upsrnfz(2)   = 1.0
-            upsrnfz(3)   = zrup1
-            upsrnfz(4)   = zrup2
-            upsrnfz(5)   = zrup3
-         ENDIF
-      ENDIF
-      
-      ! Upstream and centered scheme in the vicinity of some straits
-      
-      IF( kt == nit000 ) THEN
-
-         ! ORCA_R4 configuration :
-         ! Gibraltar Strait
-         DO jj = mj0(52), mj1(53)
-            DO ji = mi0(70), mi1(71)
-               upsadv(ji,jj) = 0.5
-            END DO
-         END DO
-
-      ENDIF
Index: trunk/NEMO/OPA_SRC/SBC/oasis4_date.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/oasis4_date.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/SBC/oasis4_date.F90	(revision 888)
@@ -11,5 +11,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2006) 
-   !! $Header$ 
+   !! $ Id: $
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/SBC/ocesbc.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/ocesbc.F90	(revision 873)
+++ 	(revision )
@@ -1,939 +1,0 @@
-MODULE ocesbc
-   !!======================================================================
-   !!                     ***  MODULE  ocesbc  ***
-   !!                     Ocean surface boundary conditions
-   !!======================================================================
-
-   !!----------------------------------------------------------------------
-   !!   oce_sbc     : ???
-   !!   oce_sbc_dmp : ???
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE oce            ! dynamics and tracers variables
-   USE dom_oce        ! ocean space domain variables
-   USE cpl_oce        ! coupled ocean-atmosphere variables
-   USE ice_oce        ! sea-ice variable
-   USE blk_oce        ! bulk variables
-   USE flx_oce        ! sea-ice/ocean forcings variables
-   USE phycst         ! Define parameters for the routines
-   USE taumod         ! surface stress forcing
-   USE flxmod         ! thermohaline fluxes
-   USE flxrnf         ! runoffs forcing
-   USE tradmp         ! damping salinity trend
-   USE dtatem         ! ocean temperature data
-   USE dtasal         ! ocean salinity data
-   USE ocfzpt         ! surface ocean freezing point
-   USE lbclnk         ! ocean lateral boundary condition
-   USE lib_mpp        ! distribued memory computing library
-   USE in_out_manager ! I/O manager
-   USE prtctl         ! Print control
-
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Accessibility
-   PUBLIC oce_sbc    ! routine called by step
-
-   !! * Shared module variables
-   REAL(wp), PUBLIC ::   &  !:
-      aplus, aminus,     &  !:
-      empold = 0.e0         !: current year freshwater budget correction
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-      qt  ,         &  !: total surface heat flux (w/m2)
-      qsr ,         &  !: solar radiation (w/m2)
-      qla ,         &  !: Latent heat flux (W/m2)
-      qlw ,         &  !: Long Wave Heat Flux (W/m2)
-      qsb ,         &  !: Sensible Heat Flux (W/m2)
-      emp ,         &  !: evaporation minus precipitation (kg/m2/s = mm/s)
-      emps,         &  !: evaporation - precipitation (free surface)
-      qrp ,         &  !: heat flux damping (w/m2)
-      erp              !: evaporation damping (kg/m2/s = mm/s)
-#if ! defined key_dynspg_rl
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
-      dmp              !: internal dampind term
-#endif
-
-#  include "domzgr_substitute.h90"
-#  include "vectopt_loop_substitute.h90"
-
-   !!----------------------------------------------------------------------
-   !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-CONTAINS
-
-#if defined key_lim3 || defined key_lim2
-   !!----------------------------------------------------------------------
-   !!   'key_lim3'     :                                 LIM2 sea-ice model
-   !!   'key_lim2'     :                                 LIM3 sea-ice model
-   !!----------------------------------------------------------------------
-# if defined key_coupled
-      !!----------------------------------------------------------------------
-      !!   'key_coupled' :                            Coupled Ocean/Atmosphere
-      !!----------------------------------------------------------------------
-
-   SUBROUTINE oce_sbc( kt )
-      !!---------------------------------------------------------------------
-      !!                 ***  ROUTINE oce_sbc  ***
-      !!                    
-      !! ** Purpose :   Ocean surface boundaries conditions with 
-      !!        Louvain la Neuve Sea Ice Model in coupled mode
-      !!
-      !! History :
-      !!   1.0  !  00-10  (O. Marti)  Original code
-      !!   2.0  !  02-12  (G. Madec)  F90: Free form and module
-      !!   9.0  !  05-11  (V. Garnier) Surface pressure gradient organization
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-
-      !! * Local declarations
-      INTEGER ::   ji, jj                   ! dummy loop indices
-      REAL(wp) ::   ztx, ztaux, zty, ztauy
-      REAL(wp) ::   ztdta, ztgel, zqrp
-      !!----------------------------------------------------------------------
-
-      ! 1. initialization to zero at kt = nit000
-      ! ---------------------------------------
-
-      IF( kt == nit000 ) THEN     
-         qsr   (:,:) = 0.e0
-         freeze(:,:) = 0.e0
-         qt    (:,:) = 0.e0
-         qrp   (:,:) = 0.e0
-         emp   (:,:) = 0.e0
-         emps  (:,:) = 0.e0
-         erp   (:,:) = 0.e0
-#if ! defined key_dynspg_rl 
-         dmp   (:,:) = 0.e0
-#endif
-      ENDIF
-
-      IF( MOD( kt-1, nfice ) == 0 ) THEN 
-
-         CALL oce_sbc_dmp   ! Computation of internal and evaporation damping terms       
-
-         ! Surface heat flux (W/m2)
-         ! -----------------------
-
-         ! restoring heat flux
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               ztgel = fzptn(ji,jj)
-#if defined key_dtasst
-               ztdta = MAX( sst(ji,jj),    ztgel )
-#else
-               ztdta = MAX( t_dta(ji,jj,1), ztgel )
-#endif
-               zqrp = dqdt0 * ( tb(ji,jj,1) - ztdta )
-
-               qrp(ji,jj) = (1.0-freeze(ji,jj) ) * zqrp
-            END DO
-         END DO
-
-         ! non solar heat flux + solar flux + restoring
-         qt (:,:) = fnsolar(:,:) + fsolar(:,:) + qrp(:,:)
-
-         ! solar flux
-         qsr(:,:) = fsolar(:,:)
-
-#if ! defined key_dynspg_rl  
-         ! total concentration/dilution effect (use on SSS)
-         emps(:,:) = fmass(:,:) + fsalt(:,:) + runoff(:,:) + erp(:,:)
-
-         ! total volume flux (use on sea-surface height)
-         emp (:,:) = fmass(:,:)  -  dmp(:,:) + runoff(:,:) + erp(:,:)
-#else
-         ! Rigid-lid (emp=emps=E-P-R+Erp) 
-         ! freshwater flux
-         emps(:,:) = fmass(:,:) + fsalt(:,:) + runoff(:,:) + erp(:,:)
-         emp (:,:) = emps(:,:)
-#endif
-
-         DO jj = 1, jpjm1
-            DO ji = 1, fs_jpim1   ! vertor opt.
-               ztx   = 0.5 * ( freeze(ji+1,jj) + freeze(ji+1,jj+1) )
-               zty   = 0.5 * ( freeze(ji,jj+1) + freeze(ji+1,jj+1) )
-#if defined key_lim3
-               ztaux = ftaux(ji,jj)
-               ztauy = ftauy(ji,jj)
-#elif defined key_lim2
-               ztaux = 0.5 * ( ftaux (ji+1,jj) + ftaux (ji+1,jj+1) )
-               ztauy = 0.5 * ( ftauy (ji,jj+1) + ftauy (ji+1,jj+1) )
-#endif
-               taux(ji,jj) = (1.0-ztx) * taux(ji,jj) + ztx * ztaux
-               tauy(ji,jj) = (1.0-zty) * tauy(ji,jj) + zty * ztauy
-            END DO
-         END DO
-         CALL lbc_lnk( taux, 'U', -1. )
-         CALL lbc_lnk( tauy, 'V', -1. )    
-
-         ! Re-initialization of fluxes
-         sst_io(:,:) = 0.e0
-         sss_io(:,:) = 0.e0
-         u_io  (:,:) = 0.e0
-         v_io  (:,:) = 0.e0
-         gtaux (:,:) = 0.e0
-         gtauy (:,:) = 0.e0
-
-      ENDIF
-
-   END SUBROUTINE oce_sbc
-
-# elif defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_core
-      !!----------------------------------------------------------------------
-      !!   'key_lim3'                              with  LIM sea-ice model
-      !!----------------------------------------------------------------------
-
-   SUBROUTINE oce_sbc( kt )
-      !!---------------------------------------------------------------------
-      !!                   ***  ROUTINE oce_sbc  ***
-      !!                    
-      !! ** Purpose : - Ocean surface boundary conditions with LIM sea-ice
-      !!        model in forced mode using bulk formulea
-      !!
-      !! History :
-      !!   1.0  !  99-11  (M. Imbard)  Original code
-      !!        !  01-03  (D. Ludicone, E. Durand, G. Madec) free surf.
-      !!   2.0  !  02-09  (G. Madec, C. Ethe)  F90: Free form and module
-      !!   9.0  !  05-11  (V. Garnier) Surface pressure gradient organization
-      !!----------------------------------------------------------------------
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-
-      !! * Local declarations
-      INTEGER  ::   ji, jj                   ! dummy loop indices
-      REAL(wp) ::   ztx, ztaux, zty, ztauy
-      !!----------------------------------------------------------------------
-
-      ! 1. initialization to zero at kt = nit000
-      ! ---------------------------------------
-
-      IF( kt == nit000 ) THEN     
-         qsr    (:,:) = 0.e0
-         qt     (:,:) = 0.e0
-         qla    (:,:) = 0.e0
-         qlw    (:,:) = 0.e0
-         qsb    (:,:) = 0.e0
-         qrp    (:,:) = 0.e0
-         emp    (:,:) = 0.e0
-         emps   (:,:) = 0.e0
-         erp    (:,:) = 0.e0
-#if ! defined key_dynspg_rl 
-         dmp    (:,:) = 0.e0
-#endif
-      ENDIF
-#if defined key_flx_core
-      qla(:,:) = (1 - freeze(:,:))*qla_oce + freeze(:,:)*qla_ice(:,:)
-      qsb(:,:) = (1 - freeze(:,:))*qsb_oce + freeze(:,:)*qsb_ice(:,:)
-      qlw(:,:) = (1 - freeze(:,:))*qlw_oce + freeze(:,:)*qlw_ice(:,:)
-#endif
-      IF( MOD( kt-1, nfice ) == 0 ) THEN
-
-         CALL oce_sbc_dmp       ! Computation of internal and evaporation damping terms       
-
-         ! Surface Ocean fluxes
-         ! ====================
-
-         ! Surface heat flux (W/m2)
-         ! -----------------
-
-         qt  (:,:) = fnsolar(:,:) + fsolar(:,:)     ! non solar heat flux + solar flux
-         qsr (:,:) = fsolar(:,:)                     ! solar flux
-
-#if ! defined key_dynspg_rl     
-         ! total concentration/dilution effect (use on SSS)
-         emps(:,:) = fmass(:,:) + fsalt(:,:) + runoff(:,:) + erp(:,:) + empold
-
-         ! total volume flux (use on sea-surface height)
-         emp (:,:) = fmass(:,:) -   dmp(:,:) + runoff(:,:) + erp(:,:) + empold      
-#else
-         ! Rigid-lid (emp=emps=E-P-R+Erp)
-         emps(:,:) = fmass(:,:) + fsalt(:,:) + runoff(:,:) + erp(:,:)     ! freshwater flux
-         emp (:,:) = emps(:,:)
-
-#endif
-
-         ! Surface stress
-         ! --------------
-
-         ! update the stress beloww sea-ice area
-         DO jj = 1, jpjm1
-            DO ji = 1, fs_jpim1   ! vertor opt.
-               ztx         = MAX( freezn(ji,jj), freezn(ji,jj+1) )   ! ice/ocean indicator at U- and V-points
-               zty         = MAX( freezn(ji,jj), freezn(ji+1,jj) )
-#if defined key_lim3
-               ztaux = ftaux(ji,jj)
-               ztauy = ftauy(ji,jj)
-#elif defined key_lim2
-               ztaux = 0.5 * ( ftaux (ji+1,jj) + ftaux (ji+1,jj+1) )
-               ztauy = 0.5 * ( ftauy (ji,jj+1) + ftauy (ji+1,jj+1) )
-#endif
-               taux(ji,jj) = (1.-ztx) * taux(ji,jj) + ztx * ztaux    ! stress at the ocean surface
-               tauy(ji,jj) = (1.-zty) * tauy(ji,jj) + zty * ztauy
-            END DO
-         END DO
-
-         ! boundary condition on the stress (taux,tauy)
-         CALL lbc_lnk( taux, 'U', -1. )
-         CALL lbc_lnk( tauy, 'V', -1. )
-
-         ! Re-initialization of fluxes
-         sst_io(:,:) = 0.e0
-         sss_io(:,:) = 0.e0
-         u_io  (:,:) = 0.e0
-         v_io  (:,:) = 0.e0
-
-      ENDIF
-
-   END SUBROUTINE oce_sbc
-
-# else
-      !!----------------------------------------------------------------------
-      !!   Error option               LIM sea-ice model requires bulk formulea
-      !!----------------------------------------------------------------------
-      This line forced a compilation error
-# endif
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option                                 NO LIM sea-ice model
-   !!----------------------------------------------------------------------
-# if defined key_coupled
-      !!----------------------------------------------------------------------
-      !!   'key_coupled' :                            Coupled Ocean/Atmosphere
-      !!----------------------------------------------------------------------
-
-   SUBROUTINE oce_sbc( kt )
-      !!---------------------------------------------------------------------
-      !!                 ***  ROUTINE oce_sbc  ***
-      !!                    
-      !! ** Purpose :   Ocean surface boundaries conditions in 
-      !!                coupled ocean/atmosphere case without sea-ice
-      !!
-      !! History :
-      !!   1.0  !  00-10  (O. Marti)  Original code
-      !!   2.0  !  02-12  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Modules used
-      USE cpl_oce       ! coupled ocean-atmosphere variables
-
-      !! * Arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step index
-
-      !! * Local declarations
-      INTEGER  ::   ji, jj, jf         ! dummy loop indices
-      REAL(wp) ::   ztgel,          &  ! temporary scalars
-         zice, zhemis, zqrp, zqri,  &  !    "         "
-         zq, zqi, zerp, ze, zei, zro   !    "         "
-      !!----------------------------------------------------------------------
-
-      ! Compute fluxes
-      ! --------------
-
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-
-            ztgel = fzptn(ji,jj)   ! local freezing temperature
-
-            ! opa model ice freeze()
-
-            zice = tmask(ji,jj,1)
-            IF( tn(ji,jj,1) >=  ztgel ) zice = 0.
-            freeze(ji,jj) = zice
-
-            ! hemisphere indicator (=1 north, =-1 south)
-
-            zhemis = float(isign(1, mjg(jj)-(jpjglo/2+1)))
-
-            ! a) net downward radiative flux qsr()
-            ! - AGCM qsrc if no ice
-            ! - zero under ice (zice=1)
-
-            qsr(ji,jj) = (1.-zice)*qsrc(ji,jj)*tmask(ji,jj,1)
-
-            ! b) heat flux damping term qrp()
-            ! - no damping if no  ice      (zice=0) 
-            ! - gamma*min(0,t-tgel) if ice (zice=1)
-
-            zqrp = 0.
-            zqri = dqdt0*MIN( 0., tb(ji,jj,1)-ztgel )
-            qrp(ji,jj) = ( ( 1. - zice ) * zqrp + zice * zqri ) * tmask(ji,jj,1)
-
-
-            ! c) net downward heat flux q() = q0 + qrp()
-            ! for q0
-            ! - AGCM qc if no  ice (zice=0)
-            ! - -2 watt/m2 (arctic) or -4 watt/m2 (antarctic) if ice (zice=1)
-            zq  = qc(ji,jj)
-            zqi = -3. + zhemis
-            qt(ji,jj) = ( (1.-zice) * zq + zice * zqi ) * tmask(ji,jj,1) + qrp(ji,jj)
-
-            ! d) water flux damping term erp()
-            ! - no damping
-            zerp = 0.
-            erp(ji,jj) = zerp
-
-            ! e) net upward water flux e() = eo + runoff() + erp()
-            ! for e0
-            ! - AGCM if no ice (zice=0)
-            ! - 1.mm/day if climatological and opa ice (zice=1)
-            ze  = ec(ji,jj)
-            zei = 1./rday
-            zro = runoff(ji,jj)
-            emp(ji,jj) = ( ( 1. - zice ) *  ze + zice * zei + zro ) * tmask(ji,jj,1) + erp(ji,jj)
-
-            ! f) net upward water flux for the salinity surface 
-            !    boundary condition
-            emps(:,:) = emp(:,:)
-
-         END DO
-      END DO
-
-   END SUBROUTINE oce_sbc
-# elif defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_forced_daily || defined key_flx_core
-      !!-------------------------------------------------------------------------
-      !!   'key_flx_bulk_monthly' or 'key_flx_bulk_daily' or  core   bulk formulea
-      !!   'key_flx_forced_daily'                                or no bulk case 
-      !!-------------------------------------------------------------------------
-
-   SUBROUTINE oce_sbc( kt )
-      !!---------------------------------------------------------------------
-      !!                   ***  ROUTINE oce_sbc  ***
-      !!                    
-      !! ** Purpose :   Ocean surface boundary conditions in forced mode
-      !!      using either flux or bulk formulation.
-      !!
-      !! History :
-      !!   1.0  !  99-11  (M. Imbard)  Original code
-      !!        !  01-03  (D. Ludicone, E. Durand, G. Madec) free surf.
-      !!   2.0  !  02-09  (G. Madec, C. Ethe)  F90: Free form and module
-      !!   9.0  !  05-11  (V. Garnier) Surface pressure gradient organization
-      !!----------------------------------------------------------------------
-      !! * Modules used
-      USE daymod                 ! calendar
-#if ! defined key_dtasst
-      USE dtasst, ONLY : rclice  ! sea surface temperature data
-#endif
-#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_core
-      USE blk_oce                ! bulk variables
-#endif
-#if defined key_flx_forced_daily
-      USE flx_oce                ! sea-ice/ocean forcings variables
-#endif
-
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-
-      !! * local declarations
-      INTEGER ::   ji, jj        ! dummy loop arguments
-      INTEGER ::   i15, ifreq             !      
-      REAL(wp) ::  zxy
-      REAL(wp) ::  zsice, zqri, zqrp, ztdta, zqrj
-      REAL(wp) ::  zq, zqi, zhemis
-      REAL(wp), DIMENSION(jpi,jpj) :: zeri, zerps, ziclim
-      REAL(wp), DIMENSION(jpi,jpj) :: zqt, zqsr, zemp  
-      !!----------------------------------------------------------------------
- 
-
-#if defined key_flx_core
-      CALL ctl_stop( 'flxcore and no ice model not tested yet' )
-#endif
-
-      ! 1. initialization to zero at kt = nit000
-      ! ---------------------------------------
-
-      IF( kt == nit000 ) THEN     
-         qsr    (:,:) = 0.e0
-         freeze (:,:) = 0.e0
-         qt     (:,:) = 0.e0
-         qla    (:,:) = 0.e0
-         qlw    (:,:) = 0.e0
-         qsb    (:,:) = 0.e0
-         qrp    (:,:) = 0.e0
-         emp    (:,:) = 0.e0
-         emps   (:,:) = 0.e0
-         erp    (:,:) = 0.e0
-#if ! defined key_dynspg_rl 
-         dmp    (:,:) = 0.e0
-#endif
-      ENDIF
-
-#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_core
-      ifreq      = nfbulk
-      zqt (:,:)  = qsr_oce(:,:) + qnsr_oce(:,:)
-      zqsr(:,:)  = qsr_oce(:,:)
-      zemp(:,:)  = evap(:,:) - tprecip(:,:)
-#endif 
-
-#if defined key_flx_forced_daily
-      ifreq      = 1
-      zqt (:,:)  = p_qt (:,:)
-      zqsr(:,:)  = p_qsr(:,:)
-      zemp(:,:)  = p_emp(:,:)
-#endif 
-#if defined key_flx_core
-      qla(:,:) = (1 - freeze(:,:))*qla_oce + freeze(:,:)*qla_ice(:,:)
-      qsb(:,:) = (1 - freeze(:,:))*qsb_oce + freeze(:,:)*qsb_ice(:,:)
-      qlw(:,:) = (1 - freeze(:,:))*qlw_oce + freeze(:,:)*qlw_ice(:,:)
-#endif 
-      IF( MOD( kt-1, ifreq) == 0 ) THEN
-         ! Computation of internal and evaporation damping terms       
-         CALL oce_sbc_dmp
-
-         zsice = - 0.04 / 0.8    ! ratio of isohaline compressibility over isotherme compressibility 
-                                 ! ( d rho / dt ) / ( d rho / ds )      ( s = 34, t = -1.8 )
-         ! Flux computation
-         DO jj = 1, jpj
-            DO ji = 1, jpi      
-               ! climatological ice 
-               ziclim(ji,jj) = FLOAT( NINT( rclice(ji,jj,1) ) )
-
-               ! avoid surfreezing point            
-               tn(ji,jj,1) = MAX( tn(ji,jj,1), fzptn(ji,jj) )
-
-               ! hemisphere indicator (=1 north, =-1 south)           
-               zhemis = FLOAT( isign(1, mjg(jj) - (jpjdta/2+1) ) )
-
-               ! restoring temperature (ztdta >= to local freezing temperature)            
-#if defined key_dtasst
-               ztdta = MAX( sst(ji,jj),    fzptn(ji,jj) )
-#else
-               ztdta = MAX( t_dta(ji,jj,1), fzptn(ji,jj) )
-#endif
-
-               ! a) net downward radiative flux qsr()           
-               qsr(ji,jj) = (1.-ziclim(ji,jj)) * zqsr(ji,jj) * tmask(ji,jj,1)
-
-               ! b) heat flux damping term qrp()
-               ! - gamma*(t-tlevitus) if no  climatological ice (ziclim=0)
-               ! - gamma*(t-(tgel-1.))  if climatological ice and no opa ice   (ziclim=1 zicopa=0)
-               ! - gamma*min(0,t-tgel) if climatological and opa ice (ziclim=1 zicopa=1)
-
-               zqri = dqdt0 * ( tb(ji,jj,1) - ( fzptn(ji,jj) - 1.) )
-               zqrj = dqdt0 * MIN( 0., tb(ji,jj,1) - fzptn(ji,jj) )
-
-               qrp(ji,jj) =  ( ziclim(ji,jj) * ( (1 - freeze(ji,jj)) * zqri    &
-                 &                                  + freeze(ji,jj)  * zqrj ) ) * tmask(ji,jj,1)
-
-#if ! defined key_flx_bulk_monthly && ! defined key_flx_bulk_daily && ! defined key_flx_core
-               zqrp = dqdt0 * ( tb(ji,jj,1) - ztdta )
-               qrp(ji,jj) = qrp(ji,jj) + (1. - ziclim(ji,jj)) * zqrp
-# endif
-
-               ! c) net downward heat flux q() = q0 + qrp()
-               ! for q0
-               ! - ECMWF fluxes if no climatological ice      (ziclim=0)
-               ! - qrp if climatological ice and no opa ice   (ziclim=1 zicopa=0)
-               ! - -2 watt/m2 (arctic) or -4 watt/m2 (antarctic) if climatological and opa ice 
-               !                                              (ziclim=1 zicopa=1)
-               zq  = zqt(ji,jj)
-               zqi = -3. + zhemis
-               qt (ji,jj) = ( (1.-ziclim(ji,jj)) * zq   &
-                  +ziclim(ji,jj)  * freeze(ji,jj) * zqi )   &
-                  * tmask(ji,jj,1)   &
-                  + qrp(ji,jj)
-
-            END DO
-         END DO
-
-#if ! defined key_dynspg_rl 
-         ! Free-surface
-
-         ! Water flux for zero buoyancy flux if no opa ice and ice clim
-         zeri(:,:) = -zsice * qrp(:,:) * ro0cpr * rauw / 34.0
-         zerps(:,:) = ziclim(:,:) * ( (1-freeze(:,:)) * zeri(:,:) )
-
-         ! Contribution to sea level:
-         ! net upward water flux emp() = e-p + runoff() + erp() + dmp + empold
-         emp (:,:) = zemp(:,:)     &   ! e-p data
-            &      + runoff(:,:)   &   ! runoff data
-            &      + erp(:,:)      &   ! restoring term to SSS data
-            &      + dmp(:,:)      &   ! freshwater flux associated with internal damping
-            &      + empold            ! domain averaged annual mean correction
-
-         ! Contribution to salinity:
-         ! net upward water flux emps() = e-p + runoff() + erp() + zerps + empold
-         emps(:,:) = zemp(:,:)     &
-            &      + runoff(:,:)   &
-            &      + erp(:,:)      &
-            &      + zerps(:,:)    &
-            &      + empold 
-#else
-         ! Rigid-lid (emp=emps=E-P-R+Erp)
-         ! freshwater flux
-         zeri(:,:)  = -zsice * qrp(:,:) * ro0cpr * rauw / 34.0
-         zerps(:,:) = ziclim(:,:) * ( (1-freeze(:,:)) * zeri(:,:) )
-         emps (:,:) = zemp(:,:)     &
-            &       + runoff(:,:)   &
-            &       + erp(:,:)      &
-            &       + zerps(:,:)
-         emp (:,:) = emps(:,:)
-#endif  
-
-         ! Boundary condition on emp for free surface option
-         ! -------------------------------------------------
-         CALL lbc_lnk( emp, 'T', 1. )
-
-      ENDIF
-
-   END SUBROUTINE oce_sbc
-
-# else
-      !!----------------------------------------------------------------------
-      !!   Default option :                                 Analytical forcing
-      !!----------------------------------------------------------------------
-
-   SUBROUTINE oce_sbc( kt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE oce_sbc  ***
-      !!              
-      !! ** Purpose :   provide the thermohaline fluxes (heat and freshwater)
-      !!                to the ocean at each time step.
-      !!
-      !! ** Method  :   Constant surface fluxes (read in namelist (namflx))
-      !!
-      !! ** Action  : - qt, qsr, emp, emps, qrp, erp
-      !!
-      !! History :
-      !!        !  91-03  ()  Original code
-      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
-      !!   9.0  !  04-05  (A. Koch-Larrouy) Add Gyre configuration 
-      !!----------------------------------------------------------------------
-      !! * Modules used
-      USE flxrnf                       ! ocean runoffs
-      USE daymod, ONLY : nyear         ! calendar
-      USE dtasss                       ! sea surface salinity data
-
-      !! * arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-
-      !! * local declarations
-      REAL(wp) ::                   & !!! surface fluxes namelist (namflx)
-         q0   = 0.e0,               &  ! net heat flux
-         qsr0 = 0.e0,               &  ! solar heat flux
-         emp0 = 0.e0                   ! net freshwater flux
-      REAL(wp) ::   zsrp,           &
-         zemp_S, zemp_N, zemp_sais, &
-         zTstar, zcos_sais1, zconv, &
-         zcos_sais2
-      REAL(wp) ::           &
-         zsumemp,           &          ! tampon used for the emp sum
-         zsurf,             &          ! tampon used for the domain sum
-         ztime,             &          ! time in hour
-         ztimemax1, ztimemin1, &       ! 21th june,   and 21th december if date0 = 1st january
-         ztimemax2, ztimemin2          ! 21th august, and 21th february if date0 = 1st january
-      REAL(wp), DIMENSION(jpi,jpj) :: t_star
-      INTEGER  ::   ji, jj             ! dummy loop indices
-
-      INTEGER  ::           &
-         zyear0,            &          ! initial year
-         zmonth0,           &          ! initial month
-         zday0,             &          ! initial day
-         zday_year0                    ! initial day since january 1st
-
-      NAMELIST/namflx/ q0, qsr0, emp0
-      !!---------------------------------------------------------------------
-
-      !same temperature, E-P as in HAZELEGER 2000
-
-      IF( cp_cfg == 'gyre' ) THEN
-
-          zyear0  = ndate0 / 10000                              ! initial year
-          zmonth0 = ( ndate0 - zyear0 * 10000 ) / 100           ! initial month
-          zday0   = ndate0 - zyear0 * 10000 - zmonth0 * 100     ! initial day betwen 1 and 30
-          zday_year0= (zmonth0-1)*30.+zday0                     ! initial day betwen 1 and 360
-
-          ! current day (in hours) since january the 1st of the current year
-          ztime = FLOAT( kt ) * rdt / (rmmss * rhhmm)  &    !  total incrementation (in hours)
-             &     - (nyear  - 1) * rjjhh * raajj           !  minus years since beginning of experiment (in hours)
-
-          ! 21th june at 24h  in hours
-          ztimemax1 = ((5.*30.)+21.)* 24.
-          ! 21th december in hours
-          ! rjjhh * raajj / 4 = 1 seasonal cycle in hours
-          ztimemin1 = ztimemax1 + rjjhh * raajj / 2         
-          ! 21th july at 24h in hours
-          ztimemax2 = ((6.*30.)+21.)* 24.
-          ! 21th january day in hours
-          ! rjjhh * raajj / 4 = 1 seasonal cycle in hours
-          ztimemin2 = ztimemax2 - rjjhh * raajj / 2         
-
-          ! amplitudes
-          zemp_S   = 0.7       ! intensity of COS in the South
-          zemp_N   = 0.8       ! intensity of COS in the North
-          zemp_sais= 0.1
-          zTstar   = 28.3      ! intemsity from 28.3 a -5 deg
-
-          ! 1/2 period between 21th June and 21th December
-          zcos_sais1 = COS( (ztime - ztimemax1) / (ztimemin1 - ztimemax1) * rpi )    
-
-          ! 1/2 period between 21th July and 21th January
-          zcos_sais2 = COS( (ztime - ztimemax2) / (ztimemax2 - ztimemin2) * rpi )
-
-          zconv = 3.16e-5      ! convert 1m/yr->3.16e-5mm/s
-          DO jj = 1, jpj
-             DO ji = 1, jpi
-                ! domain from 15 deg to 50 deg between 27 and 28  degC at 15N, -3 
-                ! and 13 degC at 50N 53.5 + or - 11 = 1/4 period :
-                ! 64.5 in summer, 42.5 in winter
-                t_star (ji,jj) = zTstar * ( 1 + 1. / 50. * zcos_sais2 )   &                  
-                   &             * COS( rpi * (gphit(ji,jj) - 5.)        &                  
-                   &                        / (53.5 * ( 1 + 11 / 53.5 * zcos_sais2 ) * 2.) ) 
-                qt  (ji,jj) = dqdt0 * ( tb(ji,jj,1) - t_star(ji,jj) )
-                IF( gphit(ji,jj) >= 14.845 .AND. 37.2 >= gphit(ji,jj)) THEN
-                   ! zero at 37.8 deg, max at 24.6 deg
-                   emp  (ji,jj) =   zemp_S * zconv   &
-                      &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (24.6 - 37.2) )  & 
-                      &         * ( 1 - zemp_sais / zemp_S * zcos_sais1)
-                   emps (ji,jj) = emp  (ji,jj)
-                ELSE
-                   ! zero at 37.8 deg, max at 46.8 deg
-                   emp (ji,jj) =  - zemp_N * zconv   &
-                      &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (46.8 - 37.2) )  & 
-                      &         * ( 1 - zemp_sais / zemp_N * zcos_sais1 )
-                   emps (ji,jj) = emp  (ji,jj)
-                ENDIF
-                ! 23.5 deg : tropics
-                qsr (ji,jj) =  230 * COS( 3.1415 * ( gphit(ji,jj) - 23.5 * zcos_sais1 ) / ( 0.9 * 180 ) )   
-             END DO
-          END DO
-
-          ! Compute the emp flux such as its integration on the whole domain at each time is zero
-          IF( nbench /= 1 .AND. nbit_cmp /= 1 ) THEN
-             zsumemp = 0.e0   ;   zsurf = 0.e0
-             DO jj = 1, jpj
-                DO ji = 1, jpi
-                   zsumemp = zsumemp + emp(ji,jj) * tmask(ji,jj,1) * tmask_i(ji,jj)
-                   zsurf =  zsurf + tmask(ji,jj,1) * tmask_i(ji,jj)
-                END DO
-             END DO
-
-             IF( lk_mpp )   CALL mpp_sum( zsumemp  )       ! sum over the global domain
-             IF( lk_mpp )   CALL mpp_sum( zsurf    )       ! sum over the global domain
-
-             ! Default GYRE configuration
-             zsumemp = zsumemp / zsurf
-          ELSE
-             ! Benchmark GYRE configuration (to allow the bit to bit comparison between Mpp/Mono case)
-             zsumemp = 0.e0   ;    zsurf = 0.e0
-          ENDIF
-
-          IF( lk_dtasss ) THEN           ! Sea surface salinity damping
-             ! deds0 from (mm/day) => (mm/s)
-             zsrp = deds0 / rday 
-             erp(:,:) = zsrp * ( sss(:,:) - sb(:,:,1) ) / ( sn(:,:,1) + 1.e-20 )
-          ELSE                           ! NO Sea surface salinity damping 
-             zsrp = 0.e0
-             erp(:,:) = 0.e0
-          ENDIF
-
-          ! freshwater fluxes terms
-          DO jj = 1, jpj
-             DO ji = 1, jpi
-                emp(ji, jj) =  emp(ji,jj) - zsumemp * tmask(ji,jj,1)
-                emps(ji, jj)=  emp(ji,jj) + erp(ji,jj)
-             END DO
-          END DO
-
-         IF( kt == nit000 .AND. lwp ) THEN
-            WRITE(numout,*)' ocesbc  : analytical formulation for gyre'
-            WRITE(numout,*)' ~~~~~~~ '
-            WRITE(numout,*)'           nyear      = ', nyear
-            WRITE(numout,*)'           ztime      = ',ztime
-            WRITE(numout,*)'           ztimemax1  = ',ztimemax1
-            WRITE(numout,*)'           ztimemin1  = ',ztimemin1
-            WRITE(numout,*)'           ztimemax2  = ',ztimemax2
-            WRITE(numout,*)'           ztimemin2  = ',ztimemin2
-            WRITE(numout,*)'           zyear0     = ', zyear0
-            WRITE(numout,*)'           zmonth0    = ', zmonth0
-            WRITE(numout,*)'           zday0      = ', zday0
-            WRITE(numout,*)'           zday_year0 = ',zday_year0
-            WRITE(numout,*)'           raajj      = ', raajj
-            WRITE(numout,*)'           zemp_S     = ',zemp_S 
-            WRITE(numout,*)'           zemp_N     = ',zemp_N 
-            WRITE(numout,*)'           zemp_sais  = ',zemp_sais
-            WRITE(numout,*)'           zTstar     = ',zTstar 
-            WRITE(numout,*)'           zsumemp    = ',zsumemp
-            WRITE(numout,*)'           zsurf      = ',zsurf 
-            WRITE(numout,*)'           dqdt0      = ',dqdt0
-            WRITE(numout,*)'           deds0      = ',deds0
-            WRITE(numout,*)'           zconv      = ',zconv 
-         ENDIF
-
-      ELSE
-
-         ! Constant surface fluxes
-
-         IF( kt == nit000 ) THEN
-            IF(lwp) THEN
-               WRITE(numout,*)' '
-               WRITE(numout,*)' ocesbc  : Constant surface fluxes read in namelist'
-               WRITE(numout,*)' ~~~~~~~ '
-               WRITE(numout,*)'           Namelist namflx: set the constant flux values'
-               WRITE(numout,*)'              net heat flux          q0   = ', q0  , ' W/m2'
-               WRITE(numout,*)'              solar heat flux        qsr0 = ', qsr0, ' W/m2'
-               WRITE(numout,*)'              net heat flux          emp0 = ', emp0, ' W/m2'
-            ENDIF
-
-            qt    (:,:) = q0
-            qsr   (:,:) = qsr0
-            emp   (:,:) = emp0
-            emps  (:,:) = emp0
-            qrp   (:,:) = 0.e0
-            erp   (:,:) = 0.e0
-
-            runoff(:,:) = 0.e0
-         ENDIF
-
-      ENDIF
-
-   END SUBROUTINE oce_sbc
-
-# endif
-#endif
-
-#if defined key_dtasal
-   !!----------------------------------------------------------------------
-   !!   'key_dtasal'                                          salinity data
-   !!----------------------------------------------------------------------
-   SUBROUTINE oce_sbc_dmp
-      !!---------------------------------------------------------------------
-      !!                   ***  ROUTINE oce_sbc_dmp  ***
-      !!                    
-      !! ** Purpose : Computation of internal and evaporation damping terms 
-      !!        for ocean surface boundary conditions 
-      !!
-      !! History :
-      !!   9.0  !  04-01  (G. Madec, C. Ethe)  Original code
-      !!   9.0  !  05-11  (V. Garnier) Surface pressure gradient organization
-      !!----------------------------------------------------------------------
-      !! * Local declarations
-      INTEGER ::   ji, jj                   ! dummy loop indices
-      REAL(wp), DIMENSION(jpi,jpj)  :: zsss, zfreeze
-      REAL(wp) ::   zerp, zsrp
-      CHARACTER (len=71) :: charout
-#if ! defined key_dynspg_rl
-      REAL(wp) ::   zwei
-      REAL(wp) ::   zerpplus(jpi,jpj), zerpminus(jpi,jpj)
-      REAL(wp) ::   zplus, zminus, zadefi
-# if defined key_tradmp
-      INTEGER jk
-      REAL(wp), DIMENSION(jpi,jpj) ::   zstrdmp
-# endif
-#endif
-      !!----------------------------------------------------------------------
-
-#if defined key_lim3 || defined key_lim2
-      ! sea ice indicator (1 or 0)
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            freezn(ji,jj) = MAX(0., SIGN(1., freeze(ji,jj)-rsmall) )
-         END DO
-      END DO
-      zsss   (:,:) = sss_io(:,:)
-      zfreeze(:,:) = freezn(:,:)
-#else
-      zsss   (:,:) = sb    (:,:,1)
-      zfreeze(:,:) = freeze(:,:)
-#endif
-
-      ! Initialisation
-      ! --------------
-      ! Restoring coefficients on SST and SSS   
-      zsrp = dqdt0 * ro0cpr * rauw   ! (Kg/m2/s) 
-
-#if ! defined key_dynspg_rl 
-      ! Free-surface
-         
-      ! Internal damping
-# if defined key_tradmp
-      ! Vertical mean of dampind trend (computed in tradmp module)
-      zstrdmp(:,:) = 0.e0
-      DO jk = 1, jpk
-         zstrdmp(:,:) = zstrdmp(:,:) + strdmp(:,:,jk) * fse3t(:,:,jk)
-      END DO
-      ! volume flux associated to internal damping to climatology
-      dmp(:,:) = zstrdmp(:,:) * rauw / ( zsss(:,:) + 1.e-20 )
-# else
-      dmp(:,:) = 0.e0            ! No internal damping
-# endif
-      
-      !   evaporation damping term ( Surface restoring )
-      zerpplus (:,:) = 0.e0
-      zerpminus(:,:) = 0.e0
-      zplus  =  15. / rday
-      zminus = -15. / rday
-      
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            zerp = ( 1. - 2.*upsrnfh(ji,jj) ) * zsrp   &
-               & * ( zsss(ji,jj) - s_dta(ji,jj,1) )     &
-               & / ( zsss(ji,jj) + 1.e-20        )
-            
-            zerp = MIN( zerp, zplus  )
-            zerp = MAX( zerp, zminus )
-            erp(ji,jj) = zerp
-            zerpplus (ji,jj) = MAX( erp(ji,jj), 0.e0 )
-            zerpminus(ji,jj) = MIN( erp(ji,jj), 0.e0 )
-         END DO
-      END DO
-
-      aplus  = 0.e0
-      aminus = 0.e0
-
-      IF( nbit_cmp == 1) THEN
-
-         IF(ln_ctl)   THEN
-            WRITE(charout,FMT="('oce_sbc_dmp : a+ = ',D23.16, ' a- = ',D23.16)") aplus, aminus
-            CALL prt_ctl_info(charout)
-         ENDIF
-         erp(:,:) = 0.e0
-
-      ELSE
-
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zwei   = e1t(ji,jj) * e2t(ji,jj) * tmask_i(ji,jj)
-               aplus  = aplus  + zerpplus (ji,jj) * zwei
-               aminus = aminus - zerpminus(ji,jj) * zwei
-            END DO
-         END DO
-         IF( lk_mpp )   CALL mpp_sum( aplus  )   ! sums over the global domain
-         IF( lk_mpp )   CALL mpp_sum( aminus )
-
-         IF(ln_ctl)   THEN
-            WRITE(charout,FMT="('oce_sbc_dmp : a+ = ',D23.16, ' a- = ',D23.16)") aplus, aminus
-            CALL prt_ctl_info(charout)
-         ENDIF
-
-         zadefi = MIN( aplus, aminus )
-         IF( zadefi == 0.e0 ) THEN 
-            erp(:,:) = 0.e0
-         ELSE
-            erp(:,:) = zadefi * ( zerpplus(:,:) / aplus + zerpminus(:,:) / aminus )
-         ENDIF
-
-      END IF
-#else
-      ! Rigid-lid (emp=emps=E-P-R+Erp)
-
-      erp(:,:) = ( 1. - zfreeze(:,:) ) * zsrp    &   ! surface restoring term
-         &     * ( zsss(:,:) - s_dta(:,:,1) )     &
-         &     / ( zsss(:,:) + 1.e-20      )
-#endif
-
-   END SUBROUTINE oce_sbc_dmp
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy routine                                      NO salinity data
-   !!----------------------------------------------------------------------
-   SUBROUTINE oce_sbc_dmp         ! Dummy routine
-      WRITE(*,*) 'oce_sbc_dmp: you should not have seen that print! error?'
-   END SUBROUTINE oce_sbc_dmp
-#endif
-
-   !!======================================================================
-END MODULE ocesbc
Index: trunk/NEMO/OPA_SRC/SBC/sbc_ice.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbc_ice.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbc_ice.F90	(revision 888)
@@ -0,0 +1,72 @@
+MODULE sbc_ice
+   !!======================================================================
+   !!                 ***  MODULE  sbc_ice  ***
+   !!        parameter and  variables defined in memory in forced mode
+   !!======================================================================
+   !! History :  9.0  !  06-08  (G. Modec)  Surface module
+   !!----------------------------------------------------------------------
+#if defined key_lim3 || defined key_lim2
+   !!----------------------------------------------------------------------
+   !!   'key_lim2' or 'key_lim3' :             LIM 2.0 or 3.0 sea-ice model
+   !!----------------------------------------------------------------------
+   USE par_oce          ! ocean parameters
+#if defined key_lim3
+   USE par_ice          ! ice parameters
+#endif
+
+   IMPLICIT NONE
+   PRIVATE
+
+#if defined key_lim3 
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   qns_ice     !: non solar heat flux over ice  [W/m2]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   qsr_ice     !: solar heat flux over ice      [W/m2]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   dqns_ice    !: non solar heat flux sensibility over ice (LW+SEN+LA) [W/m2/K]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   tn_ice      !: ice surface temperature       [K]
+#else
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qns_ice     !: non solar heat flux over ice  [W/m2]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qsr_ice     !: solar heat flux over ice      [W/m2]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   dqns_ice    !: non solar heat flux sensibility over ice (LW+SEN+LA) [W/m2/K]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   tn_ice      !: ice surface temperature       [K]
+#endif
+
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   tprecip     !: total precipitation           [Kg/m2/s]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sprecip     !: solid precipitation           [Kg/m2/s]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   utaui_ice   !: u-stress over ice (I-point)   [N/m2]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   vtaui_ice   !: v-stress over ice (I-point)   [N/m2]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fr1_i0      !: 1st fraction of sol. rad.  which penetrate inside the ice cover
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   fr2_i0      !: 2nd fraction of sol. rad.  which penetrate inside the ice cover
+
+#if ! defined key_coupled
+
+# if defined key_lim3 
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   qla_ice   !: latent flux over ice
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   dqla_ice  !: latent sensibility over ice
+# else
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qla_ice   !: latent flux over ice
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   dqla_ice  !: latent sensibility over ice
+# endif
+
+#else
+
+# if defined key_lim3 
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   alb_ice   !: albedo of ice
+# else
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   alb_ice       !: albedo of ice
+# endif
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rrunoff       !: runoff
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   calving       !: calving
+
+#endif
+
+#else
+   !!----------------------------------------------------------------------
+   !!   Empty module                                   NO LIM sea-ice model
+   !!----------------------------------------------------------------------
+#endif
+
+   !!----------------------------------------------------------------------
+   !!  OPA 9.0 , LOCEAN-IPSL (2005)
+   !! $ Id: $ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+END MODULE sbc_ice
Index: trunk/NEMO/OPA_SRC/SBC/sbc_oce.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 888)
@@ -0,0 +1,37 @@
+MODULE sbc_oce
+   !!======================================================================
+   !!                       ***  MODULE  sbc_oce  ***
+   !! Surface module :   variables defined in core memory 
+   !!======================================================================
+   !! History :  9.0   !  06-06  (G. Madec)  Original code
+   !!----------------------------------------------------------------------
+   USE par_oce          ! ocean parameters
+
+   IMPLICIT NONE
+   PRIVATE
+   
+   !!----------------------------------------------------------------------
+   !!              Ocean Surface Boundary Condition fields
+   !!----------------------------------------------------------------------
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   utau      !: sea surface i-stress (ocean referential)     [N/m2]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   vtau      !: sea surface j-stress (ocean referential)     [N/m2]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qns       !: sea heat flux: non solar                     [W/m2]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qsr       !: sea heat flux:     solar                     [W/m2]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   emp       !: freshwater budget: volume flux               [Kg/m2/s]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   emps      !: freshwater budget: concentration/dillution   [Kg/m2/s]
+
+   !!----------------------------------------------------------------------
+   !!                     Sea Surface Mean fields
+   !!----------------------------------------------------------------------
+   INTEGER , PUBLIC                     ::   nn_fsbc   !: frequency of sbc computation (as well as sea-ice model)
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ssu_m     !: mean (nn_fsbc time-step) surface sea i-current (U-point) [m/s]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   ssv_m     !: mean (nn_fsbc time-step) surface sea j-current (V-point) [m/s]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sst_m     !: mean (nn_fsbc time-step) surface sea temperature     [Celsius]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   sss_m     !: mean (nn_fsbc time-step) surface sea salinity            [psu]
+
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!======================================================================
+END MODULE sbc_oce
Index: trunk/NEMO/OPA_SRC/SBC/sbcana.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcana.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcana.F90	(revision 888)
@@ -0,0 +1,297 @@
+MODULE sbcana
+   !!======================================================================
+   !!                       ***  MODULE  sbcana  ***
+   !! Ocean forcing:  analytical momentum, heat and freshwater forcings
+   !!=====================================================================
+   !! History :  9.0   !  06-06  (G. Madec)  Original code
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   sbc_ana  : set an analytical ocean forcing
+   !!   sbc_gyre : set the GYRE configuration analytical forcing
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE phycst          ! physical constants
+   USE daymod          ! calendar
+   USE ocfzpt          ! ocean freezing point
+   USE in_out_manager  ! I/O manager
+   USE lib_mpp         ! distribued memory computing library
+   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   sbc_ana    ! routine called in sbcmod module
+   PUBLIC   sbc_gyre   ! routine called in sbcmod module
+
+   !! * Namelist namsbc_ana
+   INTEGER  ::   nn_tau000 = 1      ! nb of time-step during which the surface stress
+      !                             ! increase from 0 to its nominal value 
+   REAL(wp) ::   rn_utau0  = 0.e0   ! constant wind stress value in i-direction
+   REAL(wp) ::   rn_vtau0  = 0.e0   ! constant wind stress value in j-direction
+   REAL(wp) ::   rn_qns0   = 0.e0   ! non solar heat flux
+   REAL(wp) ::   rn_qsr0   = 0.e0   !     solar heat flux
+   REAL(wp) ::   rn_emp0   = 0.e0   ! net freshwater flux
+   NAMELIST/namsbc_ana/ nn_tau000, rn_utau0, rn_vtau0, rn_qns0, rn_qsr0, rn_emp0
+   
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE sbc_ana( kt )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE sbc_ana ***
+      !!              
+      !! ** Purpose :   provide at each time-step the ocean surface boundary
+      !!      condition, i.e. the momentum, heat and freshwater fluxes.
+      !!
+      !! ** Method  :   Constant and uniform surface forcing specified from
+      !!      namsbc_ana namelist parameters. All the fluxes are time inde-
+      !!      pendant except the stresses which increase from zero during
+      !!      the first nn_tau000 time-step 
+      !!      * C A U T I O N : never mask the surface stress field !
+      !!
+      !! ** Action  : - set the ocean surface boundary condition, i.e.  
+      !!                   utau, vtau, qns, qsr, emp, emps
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt       ! ocean time step
+      !
+      REAL(wp)            ::   zfacto   ! local scalar
+      !!---------------------------------------------------------------------
+      !
+      IF( kt == nit000 ) THEN
+         !
+         REWIND ( numnam )                   ! Read Namelist namsbc : surface fluxes
+         READ   ( numnam, namsbc_ana )
+
+         IF(lwp) WRITE(numout,*)' '
+         IF(lwp) WRITE(numout,*)' sbc_ana : Constant surface fluxes read in namsbc_ana namelist'
+         IF(lwp) WRITE(numout,*)' ~~~~~~~ '
+         IF(lwp) WRITE(numout,*)'              spin up of the stress  nn_tau000 = ', nn_tau000, ' time-steps'
+         IF(lwp) WRITE(numout,*)'              constant i-stress      rn_utau0  = ', rn_utau0 , ' N/m2'
+         IF(lwp) WRITE(numout,*)'              constant j-stress      rn_vtau0  = ', rn_vtau0 , ' N/m2'
+         IF(lwp) WRITE(numout,*)'              non solar heat flux    rn_qns0   = ', rn_qns0  , ' W/m2'
+         IF(lwp) WRITE(numout,*)'              solar heat flux        rn_qsr0   = ', rn_qsr0  , ' W/m2'
+         IF(lwp) WRITE(numout,*)'              net heat flux          rn_emp0   = ', rn_emp0  , ' Kg/m2/s'
+
+         nn_tau000 = MAX( nn_tau000, 1 )   ! must be >= 1
+         qns   (:,:) = rn_qns0
+         qsr   (:,:) = rn_qsr0
+         emp   (:,:) = rn_emp0
+         emps  (:,:) = rn_emp0
+         !
+      ENDIF
+   
+      ! Increase the surface stress to its nominal value during the first nn_tau000 time-steps
+         
+      IF( kt <= nn_tau000 ) THEN
+         zfacto = 0.5 * (  1. - COS( rpi * FLOAT( kt ) / FLOAT( nn_tau000 ) )  )
+         utau(:,:) = zfacto * rn_utau0
+         vtau(:,:) = zfacto * rn_vtau0
+      ENDIF
+      !   
+   END SUBROUTINE sbc_ana
+
+
+   SUBROUTINE sbc_gyre( kt )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE sbc_ana ***
+      !!              
+      !! ** Purpose :   provide at each time-step the ocean surface boundary
+      !!      condition, i.e. the momentum, heat and freshwater fluxes.
+      !!
+      !! ** Method  :   analytical seasonal cycle for GYRE configuration.
+      !!      * C A U T I O N : never mask the surface stress field !
+      !!
+      !! ** Action  : - set the ocean surface boundary condition, i.e.   
+      !!                   utau, vtau, qns, qsr, emp, emps
+      !!
+      !! Reference : Hazeleger, W., and S. Drijfhout, JPO, 30, 677-695, 2000.
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt          ! ocean time step
+
+      INTEGER  ::   ji, jj                 ! dummy loop indices
+      INTEGER  ::   zyear0                 ! initial year 
+      INTEGER  ::   zmonth0                ! initial month
+      INTEGER  ::   zday0                  ! initial day
+      INTEGER  ::   zday_year0             ! initial day since january 1st
+      REAL(wp) ::   ztau     , ztau_sais   ! wind intensity and of the seasonal cycle
+      REAL(wp) ::   ztime                  ! time in hour
+      REAL(wp) ::   ztimemax , ztimemin    ! 21th June, and 21th decem. if date0 = 1st january
+      REAL(wp) ::   ztimemax1, ztimemin1   ! 21th June, and 21th decem. if date0 = 1st january
+      REAL(wp) ::   ztimemax2, ztimemin2   ! 21th June, and 21th decem. if date0 = 1st january
+      REAL(wp) ::   ztaun                  ! intensity
+      REAL(wp) ::   zemp_s, zemp_n, zemp_sais, ztstar
+      REAL(wp) ::   zcos_sais1, zcos_sais2, ztrp, zconv, t_star
+      REAL(wp) ::   zsumemp, zsurf
+      !!---------------------------------------------------------------------
+         
+      ! ---------------------------- !
+      !  heat and freshwater fluxes  !
+      ! ---------------------------- !
+      !same temperature, E-P as in HAZELEGER 2000
+
+      zyear0     =   ndate0 / 10000                             ! initial year
+      zmonth0    = ( ndate0 - zyear0 * 10000 ) / 100            ! initial month
+      zday0      =   ndate0 - zyear0 * 10000 - zmonth0 * 100    ! initial day betwen 1 and 30
+      zday_year0 = ( zmonth0 - 1 ) * 30.+zday0                  ! initial day betwen 1 and 360
+
+      ! current day (in hours) since january the 1st of the current year
+      ztime = REAL( kt ) * rdt / (rmmss * rhhmm)   &       !  total incrementation (in hours)
+         &      - (nyear  - 1) * rjjhh * raajj             !  minus years since beginning of experiment (in hours)
+
+      ztimemax1 = ((5.*30.)+21.)* 24.                      ! 21th june     at 24h in hours
+      ztimemin1 = ztimemax1 + rjjhh * raajj / 2            ! 21th december        in hours
+      ztimemax2 = ((6.*30.)+21.)* 24.                      ! 21th july     at 24h in hours
+      ztimemin2 = ztimemax2 - rjjhh * raajj / 2            ! 21th january         in hours
+      !                                                    ! NB: rjjhh * raajj / 4 = one seasonal cycle in hours
+
+      ! amplitudes
+      zemp_S    = 0.7       ! intensity of COS in the South
+      zemp_N    = 0.8       ! intensity of COS in the North
+      zemp_sais = 0.1
+      zTstar    = 28.3      ! intemsity from 28.3 a -5 deg
+
+      ! 1/2 period between 21th June and 21th December and between 21th July and 21th January
+      zcos_sais1 = COS( (ztime - ztimemax1) / (ztimemin1 - ztimemax1) * rpi ) 
+      zcos_sais2 = COS( (ztime - ztimemax2) / (ztimemax2 - ztimemin2) * rpi )
+
+      ztrp= - 40.e0        ! retroaction term on heat fluxes (W/m2/K)
+      zconv = 3.16e-5      ! convertion factor: 1 m/yr => 3.16e-5 mm/s
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ! domain from 15 deg to 50 deg between 27 and 28  degC at 15N, -3
+            ! and 13 degC at 50N 53.5 + or - 11 = 1/4 period :
+            ! 64.5 in summer, 42.5 in winter
+            t_star = zTstar * ( 1 + 1. / 50. * zcos_sais2 )                &
+               &                    * COS( rpi * (gphit(ji,jj) - 5.)               &
+               &                    / ( 53.5 * ( 1 + 11 / 53.5 * zcos_sais2 ) * 2.) )
+            ! 23.5 deg : tropics
+            qsr (ji,jj) =  230 * COS( 3.1415 * ( gphit(ji,jj) - 23.5 * zcos_sais1 ) / ( 0.9 * 180 ) )
+            qns (ji,jj) = ztrp * ( tb(ji,jj,1) - t_star ) - qsr(ji,jj)
+            IF( gphit(ji,jj) >= 14.845 .AND. 37.2 >= gphit(ji,jj) ) THEN    ! zero at 37.8 deg, max at 24.6 deg
+               emp  (ji,jj) =   zemp_S * zconv   &
+                  &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (24.6 - 37.2) )  &
+                  &         * ( 1 - zemp_sais / zemp_S * zcos_sais1)
+            ELSE
+               emp (ji,jj) =  - zemp_N * zconv   &
+                  &         * SIN( rpi / 2 * (gphit(ji,jj) - 37.2) / (46.8 - 37.2) )  &
+                  &         * ( 1 - zemp_sais / zemp_N * zcos_sais1 )
+            ENDIF
+         END DO
+      END DO
+      emps(:,:) = emp(:,:)
+
+      ! Compute the emp flux such as its integration on the whole domain at each time is zero
+      IF( nbench /= 1 .AND. nbit_cmp /= 1 ) THEN
+         zsumemp = 0.e0   ;   zsurf = 0.e0
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zsumemp = zsumemp + emp(ji,jj) * tmask(ji,jj,1) * tmask_i(ji,jj)
+               zsurf   = zsurf   +              tmask(ji,jj,1) * tmask_i(ji,jj)
+            END DO
+         END DO
+
+         IF( lk_mpp )   CALL mpp_sum( zsumemp  )       ! sum over the global domain
+         IF( lk_mpp )   CALL mpp_sum( zsurf    )       ! sum over the global domain
+
+         ! Default GYRE configuration
+         zsumemp = zsumemp / zsurf
+      ELSE
+         ! Benchmark GYRE configuration (to allow the bit to bit comparison between Mpp/Mono case)
+         zsumemp = 0.e0   ;    zsurf = 0.e0
+      ENDIF
+
+      !salinity terms
+      emp (:,:) = emp(:,:) - zsumemp * tmask(:,:,1)
+      emps(:,:) = emp(:,:)
+
+
+      ! ---------------------------- !
+      !       momentum fluxes        !
+      ! ---------------------------- !
+      ! same wind as in Wico
+      !test date0 : ndate0 = 010203
+      zyear0  =   ndate0 / 10000
+      zmonth0 = ( ndate0 - zyear0 * 10000 ) / 100
+      zday0   =   ndate0 - zyear0 * 10000 - zmonth0 * 100
+      !Calculates nday_year, day since january 1st
+      zday_year0 = (zmonth0-1)*30.+zday0
+
+      !accumulates days of previous months of this year
+      ! day (in hours) since january the 1st
+      ztime = FLOAT( kt ) * rdt / (rmmss * rhhmm)  &  ! incrementation in hour
+         &     - (nyear - 1) * rjjhh * raajj          !  - nber of hours the precedent years
+      ztimemax = ((5.*30.)+21.)* 24.               ! 21th june     in hours
+      ztimemin = ztimemax + rjjhh * raajj / 2      ! 21th december in hours
+      !                                            ! NB: rjjhh * raajj / 4 = 1 seasonal cycle in hours
+
+      ! mean intensity at 0.105 ; srqt(2) because projected with 45deg angle
+      ztau = 0.105 / SQRT( 2. )
+      ! seasonal oscillation intensity
+      ztau_sais = 0.015
+      ztaun = ztau - ztau_sais * COS( (ztime - ztimemax) / (ztimemin - ztimemax) * rpi )
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+           ! domain from 15deg to 50deg and 1/2 period along 14deg
+           ! so 5/4 of half period with seasonal cycle
+           utau(ji,jj) = - ztaun * SIN( rpi * (gphiu(ji,jj) - 15.) / (29.-15.) )
+           vtau(ji,jj) =   ztaun * SIN( rpi * (gphiv(ji,jj) - 15.) / (29.-15.) )
+         END DO
+      END DO
+
+      ! ---------------------------------- !
+      !  control print at first time-step  !
+      ! ---------------------------------- !
+      IF( kt == nit000 .AND. lwp ) THEN 
+         WRITE(numout,*)
+         WRITE(numout,*)'sbc_gyre : analytical surface fluxes for GYRE configuration'               
+         WRITE(numout,*)'~~~~~~~~ ' 
+         WRITE(numout,*)'           nyear      = ', nyear
+         WRITE(numout,*)'           nmonth     = ', nmonth
+         WRITE(numout,*)'           nday       = ', nday
+         WRITE(numout,*)'           nday_year  = ',nday_year
+         WRITE(numout,*)'           ztime      = ', ztime
+         WRITE(numout,*)'           ztimemax1  = ', ztimemax1
+         WRITE(numout,*)'           ztimemin1  = ', ztimemin1
+         WRITE(numout,*)'           ztimemax2  = ', ztimemax2
+         WRITE(numout,*)'           ztimemin2  = ', ztimemin2
+         WRITE(numout,*)'           zyear0     = ', zyear0
+         WRITE(numout,*)'           zmonth0    = ', zmonth0
+         WRITE(numout,*)'           zday0      = ', zday0
+         WRITE(numout,*)'           zday_year0 = ', zday_year0
+         WRITE(numout,*)'           raajj      = ', raajj
+         WRITE(numout,*)'           zemp_S     = ', zemp_S
+         WRITE(numout,*)'           zemp_N     = ', zemp_N
+         WRITE(numout,*)'           zemp_sais  = ', zemp_sais
+         WRITE(numout,*)'           zTstar     = ', zTstar
+         WRITE(numout,*)'           zsumemp    = ', zsumemp
+         WRITE(numout,*)'           zsurf      = ', zsurf
+         WRITE(numout,*)'           ztrp       = ', ztrp
+         WRITE(numout,*)'           zconv      = ', zconv
+
+         WRITE(numout,*)'           ndastp     = ',ndastp
+         WRITE(numout,*)'           adatrj     = ',adatrj
+         WRITE(numout,*)'           ztime      = ',ztime
+
+         WRITE(numout,*)'           ztimemax   = ',ztimemax
+         WRITE(numout,*)'           ztimemin   = ',ztimemin
+         WRITE(numout,*)'           zyear0     = ', zyear0
+         WRITE(numout,*)'           zmonth0    = ', zmonth0
+         WRITE(numout,*)'           zday0      = ', zday0
+         WRITE(numout,*)'           zday_year0 = ',zday_year0
+         WRITE(numout,*)'           raajj  = ', raajj
+      ENDIF
+
+   END SUBROUTINE sbc_gyre
+
+   !!======================================================================
+END MODULE sbcana
Index: trunk/NEMO/OPA_SRC/SBC/sbcblk_clio.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 888)
@@ -0,0 +1,987 @@
+MODULE sbcblk_clio
+   !!======================================================================
+   !!                   ***  MODULE  sbcblk_clio  ***
+   !! Ocean forcing:  bulk thermohaline forcing of the ocean (or ice)
+   !!=====================================================================
+   !! History :  OPA  !  1997-06 (Louvain-La-Neuve)  Original code
+   !!                 !  2001-04 (C. Ethe) add flx_blk_declin
+   !!   NEMO     2.0  !  2002-08 (C. Ethe, G. Madec) F90: Free form and module
+   !!            3.0  !  2008-03 (C. Talandier, G. Madec) surface module + LIM3
+   !!----------------------------------------------------------------------
+   !!   sbc_blk_clio   : CLIO bulk formulation: read and update required input fields
+   !!   blk_clio_oce   : ocean CLIO bulk formulea: compute momentum, heat and freswater fluxes for the ocean
+   !!   blk_ice_clio   : ice   CLIO bulk formulea: compute momentum, heat and freswater fluxes for the sea-ice
+   !!   blk_clio_qsr_oce : shortwave radiation for ocean computed from the cloud cover
+   !!   blk_clio_qsr_ice : shortwave radiation for ice   computed from the cloud cover
+   !!   flx_blk_declin : solar declinaison
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE phycst          ! physical constants
+   USE daymod          ! calendar
+   USE ocfzpt          ! ocean freezing point
+   USE fldread         ! read input fields
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE iom             ! I/O manager library
+   USE in_out_manager  ! I/O manager
+   USE lib_mpp         ! distribued memory computing library
+   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+
+   USE albedo
+   USE prtctl          ! Print control
+#if defined key_lim3
+   USE par_ice
+   USE ice
+#elif defined key_lim2
+   USE par_ice_2
+   USE ice_2
+#endif
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC sbc_blk_clio        ! routine called by sbcmod.F90 
+   PUBLIC blk_ice_clio        ! routine called by sbcice_lim.F90 
+
+   INTEGER , PARAMETER ::   jpfld   = 7           ! maximum number of files to read 
+   INTEGER , PARAMETER ::   jp_utau = 1           ! index of wind stress (i-component)      (N/m2)    at U-point
+   INTEGER , PARAMETER ::   jp_vtau = 2           ! index of wind stress (j-component)      (N/m2)    at V-point
+   INTEGER , PARAMETER ::   jp_wndm = 3           ! index of 10m wind module                 (m/s)    at T-point
+   INTEGER , PARAMETER ::   jp_humi = 4           ! index of specific humidity               ( % )
+   INTEGER , PARAMETER ::   jp_ccov = 5           ! index of cloud cover                     ( % )
+   INTEGER , PARAMETER ::   jp_tair = 6           ! index of 10m air temperature             (Kelvin)
+   INTEGER , PARAMETER ::   jp_prec = 7           ! index of total precipitation (rain+snow) (Kg/m2/s)
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input fields (file informations, fields read)
+
+   INTEGER, PARAMETER  ::   jpintsr = 24          ! number of time step between sunrise and sunset
+   !                                              ! uses for heat flux computation
+   LOGICAL ::   lbulk_init = .TRUE.               ! flag, bulk initialization done or not)
+
+   REAL(wp) ::   cai = 1.40e-3 ! best estimate of atm drag in order to get correct FS export in ORCA2-LIM
+   REAL(wp) ::   cao = 1.00e-3 ! chosen by default  ==> should depends on many things...  !!gmto be updated
+
+   REAL(wp) ::   yearday     !: number of days per year   
+   REAL(wp) ::   rdtbs2      !: number of days per year   
+   
+   REAL(wp), DIMENSION(19)  ::  budyko            ! BUDYKO's coefficient (cloudiness effect on LW radiation)
+   DATA budyko / 1.00, 0.98, 0.95, 0.92, 0.89, 0.86, 0.83, 0.80, 0.78, 0.75,   &
+      &          0.72, 0.69, 0.67, 0.64, 0.61, 0.58, 0.56, 0.53, 0.50 /
+   REAL(wp), DIMENSION(20)  :: tauco              ! cloud optical depth coefficient
+   DATA tauco / 6.6, 6.6, 7.0, 7.2, 7.1, 6.8, 6.5, 6.6, 7.1, 7.6,   &
+      &         6.6, 6.1, 5.6, 5.5, 5.8, 5.8, 5.6, 5.6, 5.6, 5.6 /
+   !!
+   REAL(wp), DIMENSION(jpi,jpj) ::   sbudyko      ! cloudiness effect on LW radiation
+   REAL(wp), DIMENSION(jpi,jpj) ::   stauc        ! cloud optical depth 
+   
+   REAL(wp)  ::   zeps    = 1.e-20                ! constant values
+   REAL(wp)  ::   zeps0   = 1.e-13  
+
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008) 
+   !! $Id:$ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+
+   SUBROUTINE sbc_blk_clio( kt )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE sbc_blk_clio  ***
+      !!                   
+      !! ** Purpose :   provide at each time step the surface ocean fluxes
+      !!      (momentum, heat, freshwater and runoff) 
+      !!
+      !! ** Method  :   READ each fluxes in NetCDF files
+      !!      The i-component of the stress                utau   (N/m2)
+      !!      The j-component of the stress                vtau   (N/m2)
+      !!      the net downward heat flux                   qtot   (watt/m2)
+      !!      the net downward radiative flux              qsr    (watt/m2)
+      !!      the net upward water (evapo - precip)        emp    (kg/m2/s)
+      !!                Assumptions made:
+      !!       - each file content an entire year (read record, not the time axis)
+      !!       - first and last record are part of the previous and next year
+      !!         (useful for time interpolation)
+      !!       - the number of records is 2 + 365*24 / freqh(jf)
+      !!         or 366 in leap year case
+      !!
+      !!      C A U T I O N : never mask the surface stress fields
+      !!                      the stress is assumed to be in the mesh referential
+      !!                      i.e. the (i,j) referential
+      !!
+      !! ** Action  :   defined at each time-step at the air-sea interface
+      !!              - utau  &  vtau   : stress components in geographical ref.
+      !!              - qns   &  qsr    : non solar and solar heat fluxes
+      !!              - emp             : evap - precip (volume flux)
+      !!              - emps            : evap - precip (concentration/dillution)
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
+      !!
+      INTEGER  ::   jf, ifpr, jfpr     ! dummy indices
+      INTEGER  ::   ierror             ! return error code
+      !!
+      CHARACTER(len=100) ::  cn_dir                            !   Root directory for location of CLIO files
+      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i                 ! array of namelist informations on the fields to read
+      TYPE(FLD_N) ::   sn_utau, sn_vtau, sn_wndm, sn_tair      ! informations about the fields to be read
+      TYPE(FLD_N) ::   sn_humi, sn_ccov, sn_prec               !   "                                 "
+      !!
+      NAMELIST/namsbc_clio/ cn_dir, sn_utau, sn_vtau, sn_wndm, sn_humi,   &
+         &                          sn_ccov, sn_tair, sn_prec
+      !!---------------------------------------------------------------------
+
+      !                                         ! ====================== !
+      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
+         !                                      ! ====================== !
+         ! set file information (default values)
+         cn_dir = './'       ! directory in which the model is executed
+
+         ! (NB: frequency positive => hours, negative => months)
+         !            !    file     ! frequency !  variable  ! time intep !  clim  ! starting !
+         !            !    name     !  (hours)  !   name     !   (T/F)    !  (0/1) !  record  !
+         sn_utau = FLD_N( 'utau'    ,    24.    ,  'utau'    ,  .true.    ,    0   ,     0    ) 
+         sn_vtau = FLD_N( 'vtau'    ,    24.    ,  'vtau'    ,  .true.    ,    0   ,     0    ) 
+         sn_wndm = FLD_N( 'mwnd10m' ,    24.    ,  'm_10'    ,  .true.    ,    0   ,     0    ) 
+         sn_tair = FLD_N( 'tair10m' ,    24.    ,  't_10'    ,  .FALSE.   ,    0   ,     0    ) 
+         sn_humi = FLD_N( 'humi10m' ,    24.    ,  'q_10'    ,  .FALSE.   ,    0   ,     0    ) 
+         sn_ccov = FLD_N( 'ccover'  ,   -12.    ,  'cloud'   ,  .TRUE.    ,    0   ,     0    ) 
+         sn_prec = FLD_N( 'precip'  ,   -12.    ,  'precip'  ,  .TRUE.    ,    0   ,     0    ) 
+
+         REWIND( numnam )                    ! ... read in namlist namsbc_clio
+         READ  ( numnam, namsbc_clio )
+
+         ! store namelist information in an array
+         slf_i(jp_utau) = sn_utau   ;   slf_i(jp_vtau) = sn_vtau   ;   slf_i(jp_wndm) = sn_wndm
+         slf_i(jp_tair) = sn_tair   ;   slf_i(jp_humi) = sn_humi
+         slf_i(jp_ccov) = sn_ccov   ;   slf_i(jp_prec) = sn_prec
+         
+         ! set sf structure
+         ALLOCATE( sf(jpfld), STAT=ierror )
+         IF( ierror > 0 ) THEN
+            CALL ctl_stop( 'sbc_blk_clio: unable to allocate sf structure' )   ;   RETURN
+         ENDIF
+         !
+         DO jf = 1, jpfld
+            WRITE(sf(jf)%clrootname,'(a,a)' )   TRIM( cn_dir ), TRIM( slf_i(jf)%clname )
+            sf(jf)%freqh   = slf_i(jf)%freqh
+            sf(jf)%clvar   = slf_i(jf)%clvar
+            sf(jf)%ln_tint = slf_i(jf)%ln_tint
+            sf(jf)%nclim   = slf_i(jf)%nclim
+            sf(jf)%nstrec  = slf_i(jf)%nstrec
+         END DO
+
+         IF(lwp) THEN      ! control print
+            WRITE(numout,*)            
+            WRITE(numout,*) 'sbc_blk_clio : flux formulattion for ocean surface boundary condition'
+            WRITE(numout,*) '~~~~~~~~~~~~ '
+            WRITE(numout,*) '          namsbc_clio Namelist'
+            WRITE(numout,*) '          list of files and frequency (>0: in hours ; <0 in months)'
+            DO jf = 1, jpfld
+                WRITE(numout,*) '               file root name: ' , TRIM( sf(jf)%clrootname ),   &
+                   &                          ' variable name: '  , TRIM( sf(jf)%clvar      )
+                WRITE(numout,*) '               frequency: '      ,       sf(jf)%freqh       ,   &
+                   &                          ' time interp: '    ,       sf(jf)%ln_tint     ,   &
+                   &                          ' climatology: '    ,       sf(jf)%nclim       ,   &
+                   &                          ' starting record: ',       sf(jf)%nstrec
+            END DO
+         ENDIF
+         !
+      ENDIF
+      !                                         ! ====================== !
+      !                                         !    At each time-step   !
+      !                                         ! ====================== !
+      !
+      CALL fld_read( kt, nn_fsbc, sf )                ! input fields provided at the current time-step
+      !
+      IF(lwp .AND. nitend-nit000 <= 100 ) THEN
+         IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN
+            WRITE(numout,*)
+            WRITE(numout,*) ' read monthly CLIO fluxes: ok, kt: ', kt
+            WRITE(numout,*)
+            ifpr = INT(jpi/8)      ;      jfpr = INT(jpj/10)
+            WRITE(numout,*) TRIM(sf(jp_utau)%clvar),' day: ',ndastp
+            CALL prihre( sf(jp_utau)%fnow,jpi,jpj,1,jpi,ifpr,1,jpj,jfpr,0.,numout )
+            WRITE(numout,*)
+            WRITE(numout,*) TRIM(sf(jp_vtau)%clvar),' day: ',ndastp
+            CALL prihre( sf(jp_vtau)%fnow,jpi,jpj,1,jpi,ifpr,1,jpj,jfpr,0.,numout )
+            WRITE(numout,*)
+            WRITE(numout,*) TRIM(sf(jp_humi)%clvar),' day: ',ndastp
+            CALL prihre( sf(jp_humi)%fnow,jpi,jpj,1,jpi,ifpr,1,jpj,jfpr,0.,numout )
+            WRITE(numout,*)
+            WRITE(numout,*) TRIM(sf(jp_wndm)%clvar),' day: ',ndastp
+            CALL prihre( sf(jp_wndm)%fnow,jpi,jpj,1,jpi,ifpr,1,jpj,jfpr,0.,numout )
+            WRITE(numout,*)
+            WRITE(numout,*) TRIM(sf(jp_ccov)%clvar),' day: ',ndastp
+            CALL prihre( sf(jp_ccov)%fnow,jpi,jpj,1,jpi,ifpr,1,jpj,jfpr,0.,numout )
+            WRITE(numout,*)
+            WRITE(numout,*) TRIM(sf(jp_prec)%clvar),' day: ',ndastp
+            CALL prihre( sf(jp_prec)%fnow,jpi,jpj,1,jpi,ifpr,1,jpj,jfpr,0.,numout )
+            WRITE(numout,*)
+            WRITE(numout,*) TRIM(sf(jp_tair)%clvar),' day: ',ndastp
+            CALL prihre( sf(jp_tair)%fnow,jpi,jpj,1,jpi,ifpr,1,jpj,jfpr,0.,numout )
+            WRITE(numout,*)
+         ENDIF
+      ENDIF
+
+      IF( MOD( kt - 1, nn_fsbc ) == 0 ) THEN
+          CALL blk_oce_clio( sst_m, ssu_m, ssv_m )    ! compute the surface ocean fluxes using CLIO bulk formulea
+      ENDIF                                           ! 
+      !
+   END SUBROUTINE sbc_blk_clio
+
+
+   SUBROUTINE blk_oce_clio( pst, pu, pv )
+      !!---------------------------------------------------------------------------
+      !!                     ***  ROUTINE blk_oce_clio  ***
+      !!                 
+      !!  ** Purpose :   Compute momentum, heat and freshwater fluxes at ocean surface
+      !!               using CLIO bulk formulea
+      !!         
+      !!  ** Method  :   The flux of heat at the ocean surfaces are derived
+      !!       from semi-empirical ( or bulk ) formulae which relate the flux to 
+      !!       the properties of the surface and of the lower atmosphere. Here, we
+      !!       follow the work of Oberhuber, 1988   
+      !!               - momentum flux (stresses) directly read in files at U- and V-points
+      !!               - compute ocean/ice albedos (call albedo_oce/albedo_ice)  
+      !!               - compute shortwave radiation for ocean (call blk_clio_qsr_oce)
+      !!               - compute long-wave radiation for the ocean
+      !!               - compute the turbulent heat fluxes over the ocean
+      !!               - deduce the evaporation over the ocean
+      !!  ** Action  :   Fluxes over the ocean:
+      !!               - utau, vtau  i- and j-component of the wind stress
+      !!               - qns, qsr    non-slor and solar heat flux
+      !!               - emp, emps   evaporation minus precipitation
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in), DIMENSION(jpi,jpj) ::   pst   ! surface temperature                      [Celcius]
+      REAL(wp), INTENT(in), DIMENSION(jpi,jpj) ::   pu    ! surface current at U-point (i-component) [m/s]
+      REAL(wp), INTENT(in), DIMENSION(jpi,jpj) ::   pv    ! surface current at V-point (j-component) [m/s]
+      !!
+      INTEGER  ::   ji, jj   ! dummy loop indices
+      !!
+      REAL(wp) ::   zrhova, zcsho, zcleo, zcldeff               ! temporary scalars
+      REAL(wp) ::   zqsato, zdteta, zdeltaq, ztvmoy, zobouks    !    -         -
+      REAL(wp) ::   zpsims, zpsihs, zpsils, zobouku, zxins, zpsimu   !    -         -
+      REAL(wp) ::   zpsihu, zpsilu, zstab,zpsim, zpsih, zpsil   !    -         -
+      REAL(wp) ::   zvatmg, zcmn, zchn, zcln, zcmcmn, zdenum    !    -         -
+      REAL(wp) ::   zdtetar, ztvmoyr, zlxins, zchcm, zclcm      !    -         -
+      REAL(wp) ::   zmt1, zmt2, zmt3, ztatm3, ztamr, ztaevbk    !    -         -
+      REAL(wp) ::   zsst, ztatm, zcco1, zpatm, zinda            !    -         -
+      REAL(wp) ::   zrhoa, zev, zes, zeso, zqatm, zevsqr        !    -         -
+      !!
+      REAL(wp), DIMENSION(jpi,jpj) ::   zqlw        ! long-wave heat flux over ocean
+      REAL(wp), DIMENSION(jpi,jpj) ::   zqla        ! latent heat flux over ocean
+      REAL(wp), DIMENSION(jpi,jpj) ::   zqsb        ! sensible heat flux over ocean
+      !!---------------------------------------------------------------------
+
+      zpatm = 101000.      ! atmospheric pressure  (assumed constant here)
+
+      !------------------------------------!
+      !   momentum fluxes  (utau, vtau )   !
+      !------------------------------------!
+!CDIR COLLAPSE
+      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)
+         END DO
+      END DO
+
+      !------------------------------------------------!
+      !   Shortwave radiation for ocean and snow/ice   !
+      !------------------------------------------------!
+      
+      CALL blk_clio_qsr_oce( qsr )
+
+      ! CAUTION: ocean shortwave radiation sets to zero if more than 50% of sea-ice !!gm to be removed
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            zinda    = MAX(  0.e0, SIGN(  1.e0, -( -1.5 - freeze(ji,jj) )  )  )
+            qsr(ji,jj) = zinda * qsr(ji,jj)
+         END DO
+      END DO
+
+
+      !------------------------!
+      !   Other ocean fluxes   !
+      !------------------------!
+!CDIR NOVERRCHK
+!CDIR COLLAPSE
+      DO jj = 1, jpj
+!CDIR NOVERRCHK
+         DO ji = 1, jpi
+            !
+            zsst  = pst(ji,jj)              + rt0           ! converte Celcius to Kelvin the SST and Tair
+            ztatm = sf(jp_tair)%fnow(ji,jj) + rt0           ! 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)
+            zrhoa = zpatm / ( 287.04 * ztatm )              ! air density (equation of state for dry air) 
+            ztamr = ztatm - rtt                             ! Saturation water vapour
+            zmt1  = SIGN( 17.269,  ztamr )                  !           ||
+            zmt2  = SIGN( 21.875,  ztamr )                  !          \  /
+            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  
+            zevsqr = SQRT( zev * 0.01 )                     ! square-root of vapour pressure
+            zqatm = 0.622 * zev / ( zpatm - 0.378 * zev )   ! specific humidity 
+
+            !--------------------------------------!
+            !  long-wave radiation over the ocean  !  ( Berliand 1952 ; all latitudes )
+            !--------------------------------------!
+            ztatm3  = ztatm * ztatm * ztatm
+            zcldeff = 1.0 - sbudyko(ji,jj) * sf(jp_ccov)%fnow(ji,jj) * sf(jp_ccov)%fnow(ji,jj)    
+            ztaevbk = ztatm * ztatm3 * zcldeff * ( 0.39 - 0.05 * zevsqr ) 
+            !
+            zqlw(ji,jj) = - emic * stefan * ( ztaevbk + 4. * ztatm3 * ( zsst - ztatm ) ) 
+
+            !--------------------------------------------------
+            !  Latent and sensible heat fluxes over the ocean 
+            !--------------------------------------------------
+            !                                                          ! vapour pressure at saturation of ocean
+            zeso =  611.0 * EXP ( 17.2693884 * ( zsst - rtt ) * tmask(ji,jj,1) / ( zsst - 35.86 ) )
+
+            zqsato = ( 0.622 * zeso ) / ( zpatm - 0.378 * zeso )       ! humidity close to the ocean surface (at saturation)
+
+            ! Drag coefficients from Large and Pond (1981,1982)
+            !                                                          ! Stability parameters
+            zdteta  = zsst - ztatm
+            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 )
+            zdtetar = zdteta / zdenum
+            ztvmoyr = ztvmoy * ztvmoy * zdeltaq / zdenum
+            !                                                          ! case of stable atmospheric conditions
+            zobouks = -70.0 * 10. * ( zdtetar + 3.2e-3 * ztvmoyr )
+            zobouks = MAX( 0.e0, zobouks )
+            zpsims = -7.0 * zobouks
+            zpsihs =  zpsims
+            zpsils =  zpsims
+            !                                                          ! case of unstable atmospheric conditions
+            zobouku = MIN(  0.e0, -100.0 * 10.0 * ( zdtetar + 2.2e-3 * ztvmoyr )  )
+            zxins   = ( 1. - 16. * zobouku )**0.25
+            zlxins  = LOG( ( 1. + zxins * zxins ) / 2. )
+            zpsimu  = 2. * LOG( ( 1 + zxins ) * 0.5 )  + zlxins - 2. * ATAN( zxins ) + rpi * 0.5
+            zpsihu  = 2. * zlxins
+            zpsilu  = zpsihu
+            !                                                          ! intermediate values
+            zstab   = MAX( 0.e0, SIGN( 1.e0, zdteta ) )
+            zpsim   = zstab * zpsimu + ( 1.0 - zstab ) * zpsims
+            zpsih   = zstab * zpsihu + ( 1.0 - zstab ) * zpsihs
+            zpsil   = zpsih
+            
+            zvatmg         = MAX( 0.032 * 1.5e-3 * sf(jp_wndm)%fnow(ji,jj) * sf(jp_wndm)%fnow(ji,jj) / grav, zeps )
+            zcmn           = vkarmn / LOG ( 10. / zvatmg )
+            zchn           = 0.0327 * zcmn
+            zcln           = 0.0346 * zcmn
+            zcmcmn         = 1. / ( 1. - zcmn * zpsim / vkarmn )
+            zchcm          = zcmcmn / ( 1. - zchn * zpsih / ( vkarmn * zcmn ) )
+            zclcm          = zchcm
+            !                                                          ! transfert coef. (Large and Pond 1981,1982)
+            zcsho          = zchn * zchcm                                
+            zcleo          = zcln * zclcm 
+
+            zrhova         = zrhoa * sf(jp_wndm)%fnow(ji,jj)
+
+            ! sensible heat flux
+            zqsb(ji,jj) = zrhova * zcsho * 1004.0  * ( zsst - ztatm )  
+         
+            ! latent heat flux (bounded by zero)
+            zqla(ji,jj) = MAX(  0.e0, zrhova * zcleo * 2.5e+06 * ( zqsato - zqatm )  )
+            !               
+         END DO
+      END DO
+      
+      ! ----------------------------------------------------------------------------- !
+      !     III    Total FLUXES                                                       !
+      ! ----------------------------------------------------------------------------- !
+!CDIR COLLAPSE
+      qns (:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)      ! Downward Non Solar flux
+!CDIR COLLAPSE
+      emp (:,:) = zqla(:,:) / cevap - sf(jp_prec)%fnow(:,:) / rday * tmask(:,:,1)
+!CDIR COLLAPSE
+      emps(:,:) = emp(:,:)
+      !
+      IF(ln_ctl) THEN
+         CALL prt_ctl(tab2d_1=zqsb , clinfo1=' blk_oce_clio: zqsb   : ', tab2d_2=zqlw , clinfo2=' zqlw  : ')
+         CALL prt_ctl(tab2d_1=zqla , clinfo1=' blk_oce_clio: zqla   : ', tab2d_2=qsr  , clinfo2=' qsr   : ')
+         CALL prt_ctl(tab2d_1=pst  , clinfo1=' blk_oce_clio: pst    : ', tab2d_2=emp  , clinfo2=' emp   : ')
+         CALL prt_ctl(tab2d_1=utau , clinfo1=' blk_oce_clio: utau   : ', mask1=umask,   &
+            &         tab2d_2=vtau , clinfo2=' vtau : ', mask2=vmask )
+      ENDIF
+
+   END SUBROUTINE blk_oce_clio
+
+
+   SUBROUTINE blk_ice_clio(  pst   , pui   , pvi   , palb_cs, palb_os ,   &
+      &                      p_taui, p_tauj, p_qns , p_qsr,   &
+      &                      p_qla , p_dqns, p_dqla,          &
+      &                      p_tpr , p_spr ,                  &
+      &                      p_fr1 , p_fr2 , cd_grid  )
+      !!---------------------------------------------------------------------------
+      !!                     ***  ROUTINE blk_ice_clio  ***
+      !!                 
+      !!  ** Purpose :   Computation of the heat fluxes at ocean and snow/ice
+      !!       surface the solar heat at ocean and snow/ice surfaces and the 
+      !!       sensitivity of total heat fluxes to the SST variations
+      !!         
+      !!  ** Method  :   The flux of heat at the ice and ocean surfaces are derived
+      !!       from semi-empirical ( or bulk ) formulae which relate the flux to 
+      !!       the properties of the surface and of the lower atmosphere. Here, we
+      !!       follow the work of Oberhuber, 1988   
+      !!
+      !!  ** Action  :   call albedo_oce/albedo_ice to compute ocean/ice albedo 
+      !!          computation of snow precipitation
+      !!          computation of solar flux at the ocean and ice surfaces
+      !!          computation of the long-wave radiation for the ocean and sea/ice
+      !!          computation of turbulent heat fluxes over water and ice
+      !!          computation of evaporation over water
+      !!          computation of total heat fluxes sensitivity over ice (dQ/dT)
+      !!          computation of latent heat flux sensitivity over ice (dQla/dT)
+      !!
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   pst      ! ice surface temperature                   [Kelvin]
+      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   pui      ! ice surface velocity (i-component, I-point)  [m/s]
+      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   pvi      ! ice surface velocity (j-component, I-point)  [m/s]
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   palb_cs  ! ice albedo (clear    sky) (alb_ice_cs)         [%]
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   palb_os  ! ice albedo (overcast sky) (alb_ice_os)         [%]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_taui   ! surface ice stress at I-point (i-component) [N/m2]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_tauj   ! surface ice stress at I-point (j-component) [N/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qns    ! non solar heat flux over ice (T-point)      [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qsr    !     solar heat flux over ice (T-point)      [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qla    ! latent    heat flux over ice (T-point)      [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_dqns   ! non solar heat sensistivity  (T-point)      [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_dqla   ! latent    heat sensistivity  (T-point)      [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_tpr    ! total precipitation          (T-point)   [Kg/m2/s]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_spr    ! solid precipitation          (T-point)   [Kg/m2/s]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_fr1    ! 1sr fraction of qsr penetration in ice         [%]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_fr2    ! 2nd fraction of qsr penetration in ice         [%]
+      CHARACTER(len=1), INTENT(in   )             ::   cd_grid  ! type of sea-ice grid ("C" or "B" grid)
+      !!
+      INTEGER  ::   ji, jj, jl    ! dummy loop indices
+      INTEGER  ::   ijpl          ! number of ice categories (size of 3rd dim of input arrays)
+      !!
+      REAL(wp) ::   zcoef, zmt1, zmt2, zmt3, ztatm3             ! temporary scalars
+      REAL(wp) ::   ztaevbk, zind1, zind2, zind3, ztamr         !    -         -
+      REAL(wp) ::   zesi, zqsati, zdesidt                       !    -         -
+      REAL(wp) ::   zdqla, zcldeff, zev, zes, zpatm, zrhova     !    -         -
+      REAL(wp) ::   zcshi, zclei, zrhovaclei, zrhovacshi        !    -         -
+      REAL(wp) ::   ztice3, zticemb, zticemb2, zdqlw, zdqsb     !    -         -
+      !!
+      REAL(wp), DIMENSION(jpi,jpj) ::   ztatm   ! Tair in Kelvin
+      REAL(wp), DIMENSION(jpi,jpj) ::   zqatm   ! specific humidity
+      REAL(wp), DIMENSION(jpi,jpj) ::   zevsqr  ! vapour pressure square-root
+      REAL(wp), DIMENSION(jpi,jpj) ::   zrhoa   ! air density
+      REAL(wp), DIMENSION(jpi,jpj,SIZE(pst,3)) ::   z_qlw, z_qsb
+      !!---------------------------------------------------------------------
+
+      ijpl  = SIZE( pst, 3 )                 ! number of ice categories
+      zpatm = 101000.                        ! atmospheric pressure  (assumed constant  here)
+
+      !------------------------------------!
+      !   momentum fluxes  (utau, vtau )   !
+      !------------------------------------!
+
+      SELECT CASE( cd_grid )
+      CASE( 'C' )                          ! C-grid ice dynamics
+         ! Change from wind speed to wind stress over OCEAN (cao is used)
+         zcoef = cai / cao 
+!CDIR COLLAPSE
+         DO jj = 1 , jpj
+            DO ji = 1, jpi
+               p_taui(ji,jj) = zcoef * utau(ji,jj)
+               p_tauj(ji,jj) = zcoef * vtau(ji,jj)
+            END DO
+         END DO
+      CASE( 'B' )                          ! B-grid ice dynamics
+         ! stress from ocean U- and V-points to ice U,V point
+!CDIR COLLAPSE
+         DO jj = 2, jpj
+            DO ji = fs_2, jpi   ! vector opt.
+               p_taui(ji,jj) = 0.5 * ( utau(ji-1,jj  ) + utau(ji-1,jj-1) )
+               p_tauj(ji,jj) = 0.5 * ( vtau(ji  ,jj-1) + vtau(ji-1,jj-1) )
+            END DO
+         END DO
+         CALL lbc_lnk( p_taui(:,:), 'I', -1. )   ! I-point (i.e. ice U-V point)
+         CALL lbc_lnk( p_tauj(:,:), 'I', -1. )   ! I-point (i.e. ice U-V point)
+      END SELECT
+
+
+      !  Determine cloud optical depths as a function of latitude (Chou et al., 1981).
+      !  and the correction factor for taking into account  the effect of clouds 
+      !------------------------------------------------------
+!CDIR NOVERRCHK
+!CDIR COLLAPSE
+      DO jj = 1, jpj
+!CDIR NOVERRCHK
+         DO ji = 1, jpi
+            ztatm (ji,jj) = sf(jp_tair)%fnow(ji,jj) + rt0            ! air temperature in Kelvins 
+      
+            zrhoa(ji,jj) = zpatm / ( 287.04 * ztatm(ji,jj) )         ! air density (equation of state for dry air) 
+      
+            ztamr = ztatm(ji,jj) - rtt                               ! Saturation water vapour
+            zmt1  = SIGN( 17.269,  ztamr )
+            zmt2  = SIGN( 21.875,  ztamr )
+            zmt3  = SIGN( 28.200, -ztamr )
+            zes   = 611.0 * EXP(  ABS( ztamr ) * MIN ( zmt1, zmt2 )   &
+               &                / ( ztatm(ji,jj) - 35.86  + MAX( 0.e0, zmt3 ) )  )
+
+            zev = sf(jp_humi)%fnow(ji,jj) * 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 
+
+            !----------------------------------------------------
+            !   Computation of snow precipitation (Ledley, 1985) |
+            !----------------------------------------------------
+            zmt1  =   253.0 - ztatm(ji,jj)            ;   zind1 = MAX( 0.e0, SIGN( 1.e0, zmt1 ) )
+            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
+               &         * (          zind1      &                   ! solid  (snow) precipitation [kg/m2/s]
+               &            + ( 1.0 - zind1 ) * (          zind2   * ( 0.5 + zmt2 )   &
+               &                                 + ( 1.0 - zind2 ) *  zind3 * zmt3  )   ) 
+
+            !----------------------------------------------------!
+            !  fraction of net penetrative shortwave radiation   !
+            !----------------------------------------------------!
+            ! 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)
+         END DO
+      END DO
+      
+      !-----------------------------------------------------------!
+      !  snow/ice Shortwave radiation   (abedo already computed)  !
+      !-----------------------------------------------------------!
+      CALL blk_clio_qsr_ice( palb_cs, palb_os, p_qsr )
+
+      !                                     ! ========================== !
+      DO jl = 1, ijpl                       !  Loop over ice categories  !
+         !                                  ! ========================== !
+!CDIR NOVERRCHK
+!CDIR COLLAPSE
+         DO jj = 1 , jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+               !-------------------------------------------!
+               !  long-wave radiation over ice categories  !  ( Berliand 1952 ; all latitudes )
+               !-------------------------------------------!
+               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)    
+               ztaevbk = ztatm3 * ztatm(ji,jj) * zcldeff * ( 0.39 - 0.05 * zevsqr(ji,jj) ) 
+               !
+               z_qlw(ji,jj,jl) = - emic * stefan * ( ztaevbk + 4. * ztatm3 * ( pst(ji,jj,jl) - ztatm(ji,jj) ) ) 
+
+               !----------------------------------------
+               !  Turbulent heat fluxes over snow/ice     ( Latent and sensible ) 
+               !----------------------------------------        
+
+               ! vapour pressure at saturation of ice (tmask to avoid overflow in the exponential)
+               zesi =  611.0 * EXP( 21.8745587 * tmask(ji,jj,1) * ( pst(ji,jj,jl) - rtt )/ ( pst(ji,jj,jl) - 7.66 ) )
+               ! humidity close to the ice surface (at saturation)
+               zqsati   = ( 0.622 * zesi ) / ( zpatm - 0.378 * zesi )
+               
+               !  computation of intermediate values
+               zticemb  = pst(ji,jj,jl) - 7.66
+               zticemb2 = zticemb * zticemb  
+               ztice3   = pst(ji,jj,jl) * pst(ji,jj,jl) * pst(ji,jj,jl)
+               zdesidt  = zesi * ( 9.5 * LOG( 10.0 ) * ( rtt - 7.66 )  / zticemb2 )
+               
+               !  Transfer cofficients assumed to be constant (Parkinson 1979 ; Maykut 1982)
+               zcshi    = 1.75e-03
+               zclei    = zcshi
+               
+               !  sensible and latent fluxes over ice
+               zrhova     = zrhoa(ji,jj) * sf(jp_wndm)%fnow(ji,jj)      ! computation of intermediate values
+               zrhovaclei = zrhova * zcshi * 2.834e+06
+               zrhovacshi = zrhova * zclei * 1004.0
+            
+               !  sensible heat flux
+               z_qsb(ji,jj,jl) = zrhovacshi * ( pst(ji,jj,jl) - ztatm(ji,jj) )
+            
+               !  latent heat flux 
+               p_qla(ji,jj,jl) = MAX(  0.e0, zrhovaclei * ( zqsati - zqatm(ji,jj) )  )
+              
+               !  sensitivity of non solar fluxes (dQ/dT) (long-wave, sensible and latent fluxes)
+               zdqlw = 4.0 * emic * stefan * ztice3
+               zdqsb = zrhovacshi
+               zdqla = zrhovaclei * ( zdesidt * ( zqsati * zqsati / ( zesi * zesi ) ) * ( zpatm / 0.622 ) )   
+               !
+               p_dqla(ji,jj,jl) = zdqla                           ! latent flux sensitivity
+               p_dqns(ji,jj,jl) = -( zdqlw + zdqsb + zdqla )      !  total non solar sensitivity
+            END DO
+            !
+         END DO
+         !
+      END DO
+      !
+      ! ----------------------------------------------------------------------------- !
+      !    Total FLUXES                                                       !
+      ! ----------------------------------------------------------------------------- !
+      !
+!CDIR COLLAPSE
+      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]
+      !
+!!gm : not necessary as all input data are lbc_lnk...
+      CALL lbc_lnk( p_fr1  (:,:) , 'T', 1. )
+      CALL lbc_lnk( p_fr2  (:,:) , 'T', 1. )
+      DO jl = 1, ijpl
+         CALL lbc_lnk( p_qns (:,:,jl) , 'T', 1. )
+         CALL lbc_lnk( p_dqns(:,:,jl) , 'T', 1. )
+         CALL lbc_lnk( p_qla (:,:,jl) , 'T', 1. )
+         CALL lbc_lnk( p_dqla(:,:,jl) , 'T', 1. )
+      END DO
+
+!!gm : mask is not required on forcing
+      DO jl = 1, ijpl
+         p_qns (:,:,jl) = p_qns (:,:,jl) * tmask(:,:,1)
+         p_qla (:,:,jl) = p_qla (:,:,jl) * tmask(:,:,1)
+         p_dqns(:,:,jl) = p_dqns(:,:,jl) * tmask(:,:,1)
+         p_dqla(:,:,jl) = p_dqla(:,:,jl) * tmask(:,:,1)
+      END DO
+
+      IF(ln_ctl) THEN
+         CALL prt_ctl(tab3d_1=z_qsb  , clinfo1=' blk_ice_clio: z_qsb  : ', tab3d_2=z_qlw  , clinfo2=' z_qlw  : ', kdim=ijpl)
+         CALL prt_ctl(tab3d_1=p_qla  , clinfo1=' blk_ice_clio: z_qla  : ', tab3d_2=p_qsr  , clinfo2=' p_qsr  : ', kdim=ijpl)
+         CALL prt_ctl(tab3d_1=p_dqns , clinfo1=' blk_ice_clio: p_dqns : ', tab3d_2=p_qns  , clinfo2=' p_qns  : ', kdim=ijpl)
+         CALL prt_ctl(tab3d_1=p_dqla , clinfo1=' blk_ice_clio: p_dqla : ', tab3d_2=pst    , clinfo2=' pst    : ', kdim=ijpl)
+         CALL prt_ctl(tab2d_1=p_tpr  , clinfo1=' blk_ice_clio: p_tpr  : ', tab2d_2=p_spr  , clinfo2=' p_spr  : ')
+         CALL prt_ctl(tab2d_1=p_taui , clinfo1=' blk_ice_clio: p_taui : ', tab2d_2=p_tauj , clinfo2=' p_tauj : ')
+      ENDIF
+
+
+   END SUBROUTINE blk_ice_clio
+
+
+   SUBROUTINE blk_clio_qsr_oce( pqsr_oce )
+      !!---------------------------------------------------------------------------
+      !!                     ***  ROUTINE blk_clio_qsr_oce  ***
+      !!                 
+      !!  ** Purpose :   Computation of the shortwave radiation at the ocean and the
+      !!               snow/ice surfaces. 
+      !!         
+      !!  ** Method  : - computed qsr from the cloud cover for both ice and ocean 
+      !!               - also initialise sbudyko and stauc once for all 
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj)     ::   pqsr_oce    ! shortwave radiation  over the ocean
+      !!
+      INTEGER, PARAMETER  ::   jp24 = 24   ! sampling of the daylight period (sunrise to sunset) into 24 equal parts
+      !!      
+      INTEGER  ::   ji, jj, jt    ! dummy loop indices 
+      INTEGER  ::   indaet            !  = -1, 0, 1 for odd, normal and leap years resp.
+      INTEGER  ::   iday              ! integer part of day
+      INTEGER  ::   indxb, indxc      ! index for cloud depth coefficient
+
+      REAL(wp)  ::   zalat , zclat, zcmue, zcmue2    ! local scalars 
+      REAL(wp)  ::   zmt1, zmt2, zmt3                ! 
+      REAL(wp)  ::   zdecl, zsdecl , zcdecl          ! 
+      REAL(wp)  ::   za_oce, ztamr                   !
+
+      REAL(wp) ::   zdl, zlha                        ! local scalars
+      REAL(wp) ::   zlmunoon, zcldcor, zdaycor       !   
+      REAL(wp) ::   zxday, zdist, zcoef, zcoef1      !
+      REAL(wp) ::   zes
+      !!
+      REAL(wp), DIMENSION(jpi,jpj) ::   zev          ! vapour pressure
+      REAL(wp), DIMENSION(jpi,jpj) ::   zdlha, zlsrise, zlsset     ! 2D workspace
+
+      REAL(wp), DIMENSION(jpi,jpj) ::   zps, zpc   ! sine (cosine) of latitude per sine (cosine) of solar declination 
+      !!---------------------------------------------------------------------
+
+
+      IF( lbulk_init ) THEN             !   Initilization at first time step only
+         rdtbs2 = nn_fsbc * rdt * 0.5
+         ! cloud optical depths as a function of latitude (Chou et al., 1981).
+         ! and the correction factor for taking into account  the effect of clouds 
+         DO jj = 1, jpj
+            DO ji = 1 , jpi
+               zalat          = ( 90.e0 - ABS( gphit(ji,jj) ) ) /  5.e0
+               zclat          = ( 95.e0 -      gphit(ji,jj)   ) / 10.e0
+               indxb          = 1 + INT( zalat )
+               indxc          = 1 + INT( zclat )
+               zdl            = zclat - INT( zclat )
+               !  correction factor to account for the effect of clouds
+               sbudyko(ji,jj) = budyko(indxb)
+               stauc  (ji,jj) = ( 1.e0 - zdl ) * tauco( indxc ) + zdl * tauco( indxc + 1 )
+            END DO
+         END DO
+         IF    ( nleapy == 1 ) THEN   ;   yearday = 366.e0
+         ELSEIF( nleapy == 0 ) THEN   ;   yearday = 365.e0
+         ELSEIF( nleapy == 30) THEN   ;   yearday = 360.e0
+         ENDIF
+         lbulk_init = .FALSE.
+      ENDIF
+
+
+      ! Saturated water vapour and vapour pressure
+      ! ------------------------------------------
+!CDIR NOVERRCHK
+!CDIR COLLAPSE
+      DO jj = 1, jpj
+!CDIR NOVERRCHK
+         DO ji = 1, jpi
+            ztamr = sf(jp_tair)%fnow(ji,jj) + rt0 - 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) + rt0 - 35.86  + MAX( 0.e0, zmt3 ) )  )
+            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj) * zes * 1.0e-05                   ! vapour pressure  
+         END DO
+      END DO
+
+      !-----------------------------------!
+      !  Computation of solar irradiance  !
+      !-----------------------------------!
+!!gm : hard coded  leap year ???
+      indaet   = 1                                    ! = -1, 0, 1 for odd, normal and leap years resp.
+      zxday = nday_year + rdtbs2 / rday               ! day of the year at which the fluxes are calculated
+      iday  = INT( zxday )                            ! (centred at the middle of the ice time step)
+      CALL flx_blk_declin( indaet, iday, zdecl )      ! solar declination of the current day
+      zsdecl = SIN( zdecl * rad )                     ! its sine
+      zcdecl = COS( zdecl * rad )                     ! its cosine
+
+
+      !  correction factor added for computation of shortwave flux to take into account the variation of
+      !  the distance between the sun and the earth during the year (Oberhuber 1988)
+      zdist    = zxday * 2. * rpi / yearday
+      zdaycor  = 1.0 + 0.0013 * SIN( zdist ) + 0.0342 * COS( zdist )
+
+!CDIR NOVERRCHK
+      DO jj = 1, jpj
+!CDIR NOVERRCHK
+         DO ji = 1, jpi
+            !  product of sine (cosine) of latitude and sine (cosine) of solar declination
+            zps(ji,jj) = SIN( gphit(ji,jj) * rad ) * zsdecl
+            zpc(ji,jj) = COS( gphit(ji,jj) * rad ) * zcdecl
+            !  computation of the both local time of sunrise and sunset
+            zlsrise(ji,jj) = ACOS( - SIGN( 1.e0, zps(ji,jj) )    &
+               &                   * MIN(  1.e0, SIGN( 1.e0, zps(ji,jj) ) * ( zps(ji,jj) / zpc(ji,jj) )  )   )
+            zlsset (ji,jj) = - zlsrise(ji,jj)
+            !  dividing the solar day into jp24 segments of length zdlha
+            zdlha  (ji,jj) = ( zlsrise(ji,jj) - zlsset(ji,jj) ) / REAL( jp24 )
+         END DO
+      END DO
+
+
+      !---------------------------------------------!
+      !  shortwave radiation absorbed by the ocean  !
+      !---------------------------------------------!
+      pqsr_oce(:,:)   = 0.e0      ! set ocean qsr to zero      
+
+      ! compute and sum ocean qsr over the daylight (i.e. between sunrise and sunset)
+!CDIR NOVERRCHK   
+      DO jt = 1, jp24
+         zcoef = FLOAT( jt ) - 0.5
+!CDIR NOVERRCHK     
+!CDIR COLLAPSE
+         DO jj = 1, jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+               zlha = COS(  zlsrise(ji,jj) - zcoef * zdlha(ji,jj)  )                  ! local hour angle
+               zcmue              = MAX( 0.e0 ,   zps(ji,jj) + zpc(ji,jj) * zlha  )   ! cos of local solar altitude
+               zcmue2             = 1368.0 * zcmue * zcmue
+
+               ! 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
+
+                  ! solar heat flux absorbed by the ocean (Zillman, 1972)
+               pqsr_oce(ji,jj) = pqsr_oce(ji,jj)                                         &
+                  &            + ( 1.0 - za_oce ) * zdlha(ji,jj) * zcmue2                &
+                  &            / ( ( zcmue + 2.7 ) * zev(ji,jj) + 1.085 * zcmue +  0.10 )
+            END DO
+         END DO
+      END DO
+      ! Taking into account the ellipsity of the earth orbit, the clouds AND masked if sea-ice cover > 0%
+      zcoef1 = srgamma * zdaycor / ( 2. * rpi )
+!CDIR COLLAPSE
+      DO jj = 1, jpj
+         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)
+               &                          + 0.0019 * zlmunoon )                 )
+            pqsr_oce(ji,jj) = zcoef1 * zcldcor * pqsr_oce(ji,jj) * tmask(ji,jj,1)   ! and zcoef1: ellipsity
+         END DO
+      END DO
+
+   END SUBROUTINE blk_clio_qsr_oce
+
+
+   SUBROUTINE blk_clio_qsr_ice( pa_ice_cs, pa_ice_os, pqsr_ice )
+      !!---------------------------------------------------------------------------
+      !!                     ***  ROUTINE blk_clio_qsr_ice  ***
+      !!                 
+      !!  ** Purpose :   Computation of the shortwave radiation at the ocean and the
+      !!               snow/ice surfaces. 
+      !!         
+      !!  ** Method  : - computed qsr from the cloud cover for both ice and ocean 
+      !!               - also initialise sbudyko and stauc once for all 
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:) ::   pa_ice_cs   ! albedo of ice under clear sky
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:) ::   pa_ice_os   ! albedo of ice under overcast sky
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:) ::   pqsr_ice    ! shortwave radiation over the ice/snow
+      !!
+      INTEGER, PARAMETER  ::   jp24 = 24   ! sampling of the daylight period (sunrise to sunset) into 24 equal parts
+      !!
+      INTEGER  ::   ji, jj, jl, jt    ! dummy loop indices
+      INTEGER  ::   ijpl              ! number of ice categories (3rd dim of pqsr_ice)
+      INTEGER  ::   indaet            !  = -1, 0, 1 for odd, normal and leap years resp.
+      INTEGER  ::   iday              ! integer part of day
+      !!
+      REAL(wp) ::   zcmue, zcmue2, ztamr          ! temporary scalars 
+      REAL(wp) ::   zmt1, zmt2, zmt3              !    -         -
+      REAL(wp) ::   zdecl, zsdecl, zcdecl         !    -         -
+      REAL(wp) ::   zlha, zdaycor, zes            !    -         -
+      REAL(wp) ::   zxday, zdist, zcoef, zcoef1   !    -         -
+      REAL(wp) ::   zqsr_ice_cs, zqsr_ice_os      !    -         -
+      !!
+      REAL(wp), DIMENSION(jpi,jpj) ::   zev                      ! vapour pressure
+      REAL(wp), DIMENSION(jpi,jpj) ::   zdlha, zlsrise, zlsset   ! 2D workspace
+      REAL(wp), DIMENSION(jpi,jpj) ::   zps, zpc   ! sine (cosine) of latitude per sine (cosine) of solar declination 
+      !!---------------------------------------------------------------------
+
+      ijpl = SIZE(pqsr_ice, 3 )      ! number of ice categories
+      
+      ! Saturated water vapour and vapour pressure
+      ! ------------------------------------------
+!CDIR NOVERRCHK
+!CDIR COLLAPSE
+      DO jj = 1, jpj
+!CDIR NOVERRCHK
+         DO ji = 1, jpi           
+            ztamr = sf(jp_tair)%fnow(ji,jj) + rt0 - 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) + rt0 - 35.86  + MAX( 0.e0, zmt3 ) )  )
+            zev(ji,jj) = sf(jp_humi)%fnow(ji,jj) * zes * 1.0e-05                   ! vapour pressure  
+         END DO
+      END DO
+
+      !-----------------------------------!
+      !  Computation of solar irradiance  !
+      !-----------------------------------!
+!!gm : hard coded  leap year ???
+      indaet   = 1                                    ! = -1, 0, 1 for odd, normal and leap years resp.
+      zxday = nday_year + rdtbs2 / rday               ! day of the year at which the fluxes are calculated
+      iday  = INT( zxday )                            ! (centred at the middle of the ice time step)
+      CALL flx_blk_declin( indaet, iday, zdecl )      ! solar declination of the current day
+      zsdecl = SIN( zdecl * rad )                     ! its sine
+      zcdecl = COS( zdecl * rad )                     ! its cosine
+
+      
+      !  correction factor added for computation of shortwave flux to take into account the variation of
+      !  the distance between the sun and the earth during the year (Oberhuber 1988)
+      zdist    = zxday * 2. * rpi / yearday
+      zdaycor  = 1.0 + 0.0013 * SIN( zdist ) + 0.0342 * COS( zdist )
+
+!CDIR NOVERRCHK
+      DO jj = 1, jpj
+!CDIR NOVERRCHK
+         DO ji = 1, jpi
+            !  product of sine (cosine) of latitude and sine (cosine) of solar declination
+            zps(ji,jj) = SIN( gphit(ji,jj) * rad ) * zsdecl
+            zpc(ji,jj) = COS( gphit(ji,jj) * rad ) * zcdecl
+            !  computation of the both local time of sunrise and sunset
+            zlsrise(ji,jj) = ACOS( - SIGN( 1.e0, zps(ji,jj) )    &
+               &                   * MIN(  1.e0, SIGN( 1.e0, zps(ji,jj) ) * ( zps(ji,jj) / zpc(ji,jj) )  )   ) 
+            zlsset (ji,jj) = - zlsrise(ji,jj)
+            !  dividing the solar day into jp24 segments of length zdlha
+            zdlha  (ji,jj) = ( zlsrise(ji,jj) - zlsset(ji,jj) ) / REAL( jp24 )
+         END DO
+      END DO
+
+
+      !---------------------------------------------!
+      !  shortwave radiation absorbed by the ice    !
+      !---------------------------------------------!
+      ! compute and sum ice qsr over the daylight for each ice categories
+      pqsr_ice(:,:,:) = 0.e0
+      zcoef1 = zdaycor / ( 2. * rpi )       ! Correction for the ellipsity of the earth orbit
+      
+      !                    !----------------------------! 
+      DO jl = 1, ijpl      !  loop over ice categories  !
+         !                 !----------------------------! 
+!CDIR NOVERRCHK   
+         DO jt = 1, jp24   
+            zcoef = FLOAT( jt ) - 0.5
+!CDIR NOVERRCHK     
+!CDIR COLLAPSE
+            DO jj = 1, jpj
+!CDIR NOVERRCHK
+               DO ji = 1, jpi
+                  zlha = COS(  zlsrise(ji,jj) - zcoef * zdlha(ji,jj)  )                  ! local hour angle
+                  zcmue              = MAX( 0.e0 ,   zps(ji,jj) + zpc(ji,jj) * zlha  )   ! cos of local solar altitude
+                  zcmue2             = 1368.0 * zcmue * zcmue
+                  
+                  !  solar heat flux absorbed by the ice/snow system (Shine and Crane 1984 adapted to high albedo) 
+                  zqsr_ice_cs =  ( 1.0 - pa_ice_cs(ji,jj,jl) ) * zdlha(ji,jj) * zcmue2        &   ! clear sky
+                     &        / ( ( 1.0 + zcmue ) * zev(ji,jj) + 1.2 * zcmue + 0.0455 )
+                  zqsr_ice_os = zdlha(ji,jj) * SQRT( zcmue )                                  &   ! overcast sky
+                     &        * ( 53.5 + 1274.5 * zcmue )      * ( 1.0 - 0.996  * pa_ice_os(ji,jj,jl) )    &
+                     &        / (  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  )
+               END DO
+            END DO
+         END DO
+         !
+         ! Correction : Taking into account the ellipsity of the earth orbit
+         pqsr_ice(:,:,jl) = pqsr_ice(:,:,jl) * zcoef1 * tmask(:,:,1)
+         !
+         !                 !--------------------------------! 
+      END DO               !  end loop over ice categories  !
+      !                    !--------------------------------! 
+
+
+!!gm  : this should be suppress as input data have been passed through lbc_lnk
+      DO jl = 1, ijpl
+         CALL lbc_lnk( pqsr_ice(:,:,jl) , 'T', 1. )
+      END DO
+      !
+   END SUBROUTINE blk_clio_qsr_ice
+
+
+   SUBROUTINE flx_blk_declin( ky, kday, pdecl )
+      !!---------------------------------------------------------------------------
+      !!               ***  ROUTINE flx_blk_declin  ***
+      !!          
+      !! ** Purpose :   Computation of the solar declination for the day
+      !!       
+      !! ** Method  :   ???
+      !!---------------------------------------------------------------------
+      INTEGER , INTENT(in   ) ::   ky      ! = -1, 0, 1 for odd, normal and leap years resp.
+      INTEGER , INTENT(in   ) ::   kday    ! day of the year ( kday = 1 on january 1)
+      REAL(wp), INTENT(  out) ::   pdecl   ! solar declination
+      !!
+      REAL(wp) ::   a0  =  0.39507671      ! coefficients for solar declinaison computation
+      REAL(wp) ::   a1  = 22.85684301      !     "              ""                 "
+      REAL(wp) ::   a2  = -0.38637317      !     "              ""                 "
+      REAL(wp) ::   a3  =  0.15096535      !     "              ""                 "
+      REAL(wp) ::   a4  = -0.00961411      !     "              ""                 "
+      REAL(wp) ::   b1  = -4.29692073      !     "              ""                 "
+      REAL(wp) ::   b2  =  0.05702074      !     "              ""                 "
+      REAL(wp) ::   b3  = -0.09028607      !     "              ""                 "
+      REAL(wp) ::   b4  =  0.00592797
+      !!
+      REAL(wp) ::   zday   ! corresponding day of type year (cf. ky)
+      REAL(wp) ::   zp     ! temporary scalars
+      !!---------------------------------------------------------------------
+            
+      IF    ( ky == 1 )  THEN   ;   zday = REAL( kday ) - 0.5
+      ELSEIF( ky == 3 )  THEN   ;   zday = REAL( kday ) - 1.
+      ELSE                      ;   zday = REAL( kday )
+      ENDIF
+      
+      zp = rpi * ( 2.0 * zday - 367.0 ) / yearday
+      
+      pdecl  = a0                                                                      &
+         &   + a1 * COS( zp ) + a2 * COS( 2. * zp ) + a3 * COS( 3. * zp ) + a4 * COS( 4. * zp )   &
+         &   + b1 * SIN( zp ) + b2 * SIN( 2. * zp ) + b3 * SIN( 3. * zp ) + b4 * SIN( 4. * zp )
+      !
+   END SUBROUTINE flx_blk_declin
+
+   !!======================================================================
+END MODULE sbcblk_clio
Index: trunk/NEMO/OPA_SRC/SBC/sbcblk_core.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 888)
@@ -0,0 +1,843 @@
+MODULE sbcblk_core
+   !!======================================================================
+   !!                       ***  MODULE  sbcblk_core  ***
+   !! Ocean forcing:  momentum, heat and freshwater flux formulation
+   !!=====================================================================
+   !! History :  1.0   !  04-08  (U. Schweckendiek)  Original code
+   !!            2.0   !  05-04  (L. Brodeau, A.M. Treguier) additions: 
+   !!                            -  new bulk routine for efficiency
+   !!                            -  WINDS ARE NOW ASSUMED TO BE AT T POINTS in input files !!!!
+   !!                            -  file names and file characteristics in namelist 
+   !!                            -  Implement reading of 6-hourly fields   
+   !!            3.0   !  06-06  (G. Madec) sbc rewritting
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   sbc_blk_core  : bulk formulation as ocean surface boundary condition
+   !!                   (forced mode, CORE bulk formulea)
+   !!   blk_oce_core  : ocean: computes momentum, heat and freshwater fluxes
+   !!   blk_ice_core  : ice  : computes momentum, heat and freshwater fluxes
+   !!   turb_core     : computes the CORE turbulent transfer coefficients 
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE phycst          ! physical constants
+   USE daymod          ! calendar
+   USE ocfzpt          ! ocean freezing point
+   USE fldread         ! read input fields
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE iom             ! I/O manager library
+   USE in_out_manager  ! I/O manager
+   USE lib_mpp         ! distribued memory computing library
+   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+   USE prtctl          ! Print control
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   sbc_blk_core       ! routine called in sbcmod module
+   PUBLIC   blk_ice_core       ! routine called in sbc_ice_lim module
+      
+   INTEGER , PARAMETER ::   jpfld   = 8           ! maximum number of files to read 
+   INTEGER , PARAMETER ::   jp_wndi = 1           ! index of 10m wind velocity (i-component) (m/s)    at T-point
+   INTEGER , PARAMETER ::   jp_wndj = 2           ! index of 10m wind velocity (j-component) (m/s)    at T-point
+   INTEGER , PARAMETER ::   jp_humi = 3           ! index of specific humidity               ( % )
+   INTEGER , PARAMETER ::   jp_qsr  = 4           ! index of solar heat                      (W/m2)
+   INTEGER , PARAMETER ::   jp_qlw  = 5           ! index of Long wave                       (W/m2)
+   INTEGER , PARAMETER ::   jp_tair = 6           ! index of 10m air temperature             (Kelvin)
+   INTEGER , PARAMETER ::   jp_prec = 7           ! index of total precipitation (rain+snow) (Kg/m2/s)
+   INTEGER , PARAMETER ::   jp_snow = 8           ! index of snow (solid prcipitation)       (kg/m2/s)
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input fields (file informations, fields read)
+         
+   !! * CORE bulk parameters
+   REAL(wp), PARAMETER ::   rhoa =    1.22        ! air density
+   REAL(wp), PARAMETER ::   cpa  = 1000.5         ! specific heat of air
+   REAL(wp), PARAMETER ::   Lv   =    2.5e6       ! latent heat of vaporization
+   REAL(wp), PARAMETER ::   Ls   =    2.839e6     ! latent heat of sublimation
+   REAL(wp), PARAMETER ::   Stef =    5.67e-8     ! Stefan Boltzmann constant
+   REAL(wp), PARAMETER ::   Cice =    1.63e-3     ! transfer coefficient over ice
+
+   LOGICAL  ::   ln_2m = .FALSE.                  !: logical flag for height of air temp. and hum
+   REAL(wp) ::   alpha_precip=1.                  !: multiplication factor for precipitation
+
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE sbc_blk_core( kt )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE sbc_blk_core  ***
+      !!                   
+      !! ** Purpose :   provide at each time step the surface ocean fluxes
+      !!      (momentum, heat, freshwater and runoff) 
+      !!
+      !! ** Method  :   READ each fluxes in NetCDF files
+      !!      The i-component of the stress                utau   (N/m2)
+      !!      The j-component of the stress                vtau   (N/m2)
+      !!      the net downward heat flux                   qtot   (watt/m2)
+      !!      the net downward radiative flux              qsr    (watt/m2)
+      !!      the net upward water (evapo - precip)        emp    (kg/m2/s)
+      !!                Assumptions made:
+      !!       - each file content an entire year (read record, not the time axis)
+      !!       - first and last record are part of the previous and next year
+      !!         (useful for time interpolation)
+      !!       - the number of records is 2 + 365*24 / freqh(jf)
+      !!         or 366 in leap year case
+      !!
+      !!      C A U T I O N : never mask the surface stress fields
+      !!                      the stress is assumed to be in the mesh referential
+      !!                      i.e. the (i,j) referential
+      !!
+      !! ** Action  :   defined at each time-step at the air-sea interface
+      !!              - utau  &  vtau   : stress components in geographical ref.
+      !!              - qns   &  qsr    : non solar and solar heat fluxes
+      !!              - emp             : evap - precip (volume flux)
+      !!              - emps            : evap - precip (concentration/dillution)
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
+      !!
+      INTEGER  ::   jf       ! dummy indices
+      INTEGER  ::   ierror   ! return error code
+      !!
+      CHARACTER(len=100) ::  cn_dir   !   Root directory for location of core files
+      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i     ! array of namelist informations on the fields to read
+      TYPE(FLD_N) ::   sn_wndi, sn_wndj, sn_humi, sn_qsr       ! informations about the fields to be read
+      TYPE(FLD_N) ::   sn_qlw , sn_tair, sn_prec, sn_snow      !   "                                 "
+      NAMELIST/namsbc_core/ cn_dir, ln_2m, alpha_precip, sn_wndi, sn_wndj, sn_humi, sn_qsr,   &
+         &                                               sn_qlw , sn_tair, sn_prec, sn_snow
+      !!---------------------------------------------------------------------
+
+      !                                         ! ====================== !
+      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
+         !                                      ! ====================== !
+         ! set file information (default values)
+         cn_dir = './'       ! directory in which the model is executed
+
+         ! (NB: frequency positive => hours, negative => months)
+         !            !    file     ! frequency !  variable  ! time intep !  clim  ! starting !
+         !            !    name     !  (hours)  !   name     !   (T/F)    !  (0/1) !  record  !
+         sn_wndi = FLD_N( 'uwnd10m' ,    24.    ,  'u_10'    ,  .FALSE.   ,    0   ,     0    ) 
+         sn_wndj = FLD_N( 'vwnd10m' ,    24.    ,  'v_10'    ,  .FALSE.   ,    0   ,     0    ) 
+         sn_qsr  = FLD_N( 'qsw'     ,    24.    ,  'qsw'     ,  .FALSE.   ,    0   ,     0    ) 
+         sn_qlw  = FLD_N( 'qlw'     ,    24.    ,  'qlw'     ,  .FALSE.   ,    0   ,     0    ) 
+         sn_tair = FLD_N( 'tair10m' ,    24.    ,  't_10'    ,  .FALSE.   ,    0   ,     0    ) 
+         sn_humi = FLD_N( 'humi10m' ,    24.    ,  'q_10'    ,  .FALSE.   ,    0   ,     0    ) 
+         sn_prec = FLD_N( 'precip'  ,   -12.    ,  'precip'  ,  .TRUE.    ,    0   ,     0    ) 
+         sn_snow = FLD_N( 'snow'    ,   -12.    ,  'snow'    ,  .TRUE.    ,    0   ,     0    ) 
+
+         REWIND( numnam )                    ! ... read in namlist namsbc_core
+         READ  ( numnam, namsbc_core )
+
+         ! store namelist information in an array
+         slf_i(jp_wndi) = sn_wndi   ;   slf_i(jp_wndj) = sn_wndj
+         slf_i(jp_qsr ) = sn_qsr    ;   slf_i(jp_qlw ) = sn_qlw
+         slf_i(jp_tair) = sn_tair   ;   slf_i(jp_humi) = sn_humi
+         slf_i(jp_prec) = sn_prec   ;   slf_i(jp_snow) = sn_snow
+         
+         ! set sf structure
+         ALLOCATE( sf(jpfld), STAT=ierror )
+         IF( ierror > 0 ) THEN
+            CALL ctl_stop( 'sbc_blk_core: unable to allocate sf structure' )   ;   RETURN
+         ENDIF
+
+         DO jf = 1, jpfld
+            WRITE(sf(jf)%clrootname,'(a,a)' )   TRIM( cn_dir ), TRIM( slf_i(jf)%clname )
+            sf(jf)%freqh   = slf_i(jf)%freqh
+            sf(jf)%clvar   = slf_i(jf)%clvar
+            sf(jf)%ln_tint = slf_i(jf)%ln_tint
+            sf(jf)%nclim   = slf_i(jf)%nclim
+            sf(jf)%nstrec  = slf_i(jf)%nstrec
+         END DO
+
+         IF(lwp) THEN      ! control print
+            WRITE(numout,*)            
+            WRITE(numout,*) 'sbc_blk_core : flux formulattion for ocean surface boundary condition'
+            WRITE(numout,*) '~~~~~~~~~~~~ '
+            WRITE(numout,*) '          namsbc_core Namelist'
+            WRITE(numout,*) '          ln_2m        = ', ln_2m
+            WRITE(numout,*) '          alpha_precip = ', alpha_precip
+            WRITE(numout,*) '          list of files and frequency (>0: in hours ; <0 in months)'
+            DO jf = 1, jpfld
+                WRITE(numout,*) '               file root name: ' , TRIM( sf(jf)%clrootname ),   &
+                   &                          ' variable name: '  , TRIM( sf(jf)%clvar      )
+                WRITE(numout,*) '               frequency: '      ,       sf(jf)%freqh       ,   &
+                   &                          ' time interp: '    ,       sf(jf)%ln_tint     ,   &
+                   &                          ' climatology: '    ,       sf(jf)%nclim       ,   &
+                   &                          ' starting record: ',       sf(jf)%nstrec
+            END DO
+            IF( ln_2m )   THEN
+               WRITE(numout,*) '          Calling TURB_CORE_2Z for bulk transfert coefficients'
+            ELSE
+               WRITE(numout,*) '          Calling TURB_CORE_1Z for bulk transfert coefficients'
+            ENDIF
+            WRITE(numout,*)            
+            !
+         ENDIF
+         !
+      ENDIF
+
+
+      CALL fld_read( kt, nn_fsbc, sf )                ! input fields provided at the current time-step
+
+      IF( MOD( kt - 1, nn_fsbc ) == 0 ) THEN
+          CALL blk_oce_core( sst_m, ssu_m, ssv_m )    ! compute the surface ocean fluxes using CLIO bulk formulea
+      ENDIF
+      !                                               ! using CORE bulk formulea
+   END SUBROUTINE sbc_blk_core
+   
+   
+   SUBROUTINE blk_oce_core( pst, pu, pv )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE blk_core  ***
+      !!
+      !! ** Purpose :   provide the momentum, heat and freshwater fluxes at
+      !!      the ocean surface at each time step
+      !!
+      !! ** Method  :   CORE bulk formulea for the ocean using atmospheric
+      !!      fields read in sbc_read
+      !! 
+      !! ** Outputs : - utau    : i-component of the stress at U-point  (N/m2)
+      !!              - vtau    : j-component of the stress at V-point  (N/m2)
+      !!              - qsr     : Solar heat flux over the ocean        (W/m2)
+      !!              - qns     : Non Solar heat flux over the ocean    (W/m2)
+      !!              - evap    : Evaporation over the ocean            (kg/m2/s)
+      !!              - tprecip : Total precipitation                   (Kg/m2/s)
+      !!              - sprecip : Solid precipitation                   (Kg/m2/s)
+      !!---------------------------------------------------------------------
+      REAL(wp), INTENT(in), DIMENSION(jpi,jpj) ::   pst   ! surface temperature                      [Celcius]
+      REAL(wp), INTENT(in), DIMENSION(jpi,jpj) ::   pu    ! surface current at U-point (i-component) [m/s]
+      REAL(wp), INTENT(in), DIMENSION(jpi,jpj) ::   pv    ! surface current at V-point (j-component) [m/s]
+
+      INTEGER  ::   ji, jj     ! dummy loop indices
+      REAL(wp) ::   zcoef_qsatw
+      REAL(wp), DIMENSION(jpi,jpj) ::   zwnd_i, zwnd_j    ! wind speed components at T-point
+      REAL(wp), DIMENSION(jpi,jpj) ::   zwind_speed_t     ! wind speed module     at T-point ( = | U10m - Uoce | )
+      REAL(wp), DIMENSION(jpi,jpj) ::   zqsatw            ! specific humidity at pst
+      REAL(wp), DIMENSION(jpi,jpj) ::   zqlw, zqsb        ! long wave and sensible heat fluxes
+      REAL(wp), DIMENSION(jpi,jpj) ::   zqla, zevap       ! latent heat fluxes and evaporation
+      REAL(wp), DIMENSION(jpi,jpj) ::   Cd                ! transfer coefficient for momentum      (tau)
+      REAL(wp), DIMENSION(jpi,jpj) ::   Ch                ! transfer coefficient for sensible heat (Q_sens)
+      REAL(wp), DIMENSION(jpi,jpj) ::   Ce                ! tansfert coefficient for evaporation   (Q_lat)
+      REAL(wp), DIMENSION(jpi,jpj) ::   zst               ! surface temperature in Kelvin
+      REAL(wp), DIMENSION(jpi,jpj) ::   zt_zu             ! air temperature at wind speed height
+      REAL(wp), DIMENSION(jpi,jpj) ::   zq_zu             ! air spec. hum.  at wind speed height
+      !!---------------------------------------------------------------------
+
+      ! local scalars ( place there for vector optimisation purposes)
+      zcoef_qsatw = 0.98 * 640380. / rhoa
+      
+      zst(:,:) = pst(:,:) + rt0      ! converte Celcius to Kelvin (and set minimum value far above 0 K)
+
+      ! ----------------------------------------------------------------------------- !
+      !      0   Wind components and module at T-point relative to the moving ocean   !
+      ! ----------------------------------------------------------------------------- !
+      ! ... components ( U10m - U_oce ) at T-point (unmasked)
+      zwnd_i(:,:) = 0.e0  
+      zwnd_j(:,:) = 0.e0
+#if defined key_vectopt_loop
+!CDIR COLLAPSE
+#endif
+      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) )  )
+         END DO
+      END DO
+      CALL lbc_lnk( zwnd_i(:,:) , 'T', -1. )
+      CALL lbc_lnk( zwnd_j(:,:) , 'T', -1. )
+      ! ... scalar wind ( = | U10m - U_oce | ) at T-point (masked)
+!CDIR NOVERRCHK
+!CDIR COLLAPSE
+      zwind_speed_t(:,:) = SQRT(  zwnd_i(:,:) * zwnd_i(:,:)   &
+         &                      + zwnd_j(:,:) * zwnd_j(:,:)  ) * tmask(:,:,1)
+
+      ! ----------------------------------------------------------------------------- !
+      !      I   Radiative FLUXES                                                     !
+      ! ----------------------------------------------------------------------------- !
+    
+      ! 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
+                      
+      ! ----------------------------------------------------------------------------- !
+      !     II    Turbulent FLUXES                                                    !
+      ! ----------------------------------------------------------------------------- !
+
+      ! ... specific humidity at SST and IST
+!CDIR NOVERRCHK
+!CDIR COLLAPSE
+      zqsatw(:,:) = zcoef_qsatw * EXP( -5107.4 / zst(:,:) ) 
+
+      ! ... NCAR Bulk formulae, computation of Cd, Ch, Ce at T-point :
+      IF( ln_2m ) THEN
+         !! If air temp. and spec. hum. are given at different height (2m) than wind (10m) :
+         CALL TURB_CORE_2Z(2.,10., zst   , sf(jp_tair)%fnow,                  &
+            &                      zqsatw, sf(jp_humi)%fnow, zwind_speed_t,   &
+            &                      Cd, Ch, Ce, zt_zu, zq_zu )
+      ELSE
+         !! If air temp. and spec. hum. are given at same height than wind (10m) :
+!gm bug?  at the compiling phase, add a copy in temporary arrays...  ==> check perf
+!         CALL TURB_CORE_1Z( 10., zst   (:,:), sf(jp_tair)%fnow(:,:),                       &
+!            &                    zqsatw(:,:), sf(jp_humi)%fnow(:,:), zwind_speed_t(:,:),   &
+!            &                    Cd(:,:), Ch(:,:), Ce(:,:) )
+!gm bug
+         CALL TURB_CORE_1Z( 10., zst   , sf(jp_tair)%fnow,                  &
+            &                    zqsatw, sf(jp_humi)%fnow, zwind_speed_t,   &
+            &                    Cd, Ch, Ce )
+      ENDIF
+
+      ! ... utau, vtau at U- and V_points, resp.
+      !     Note the use of 0.5*(2-umask) in order to unmask the stress along coastlines
+      zwnd_i(:,:) = rhoa * zwind_speed_t(:,:) * Cd(:,:) * zwnd_i(:,:)
+      zwnd_j(:,:) = rhoa * zwind_speed_t(:,:) * Cd(:,:) * zwnd_j(:,:)
+      DO jj = 1, jpjm1
+         DO ji = 1, fs_jpim1
+            utau(ji,jj) = 0.5 * ( 2. - umask(ji,jj,1) ) * ( zwnd_i(ji,jj) + zwnd_i(ji+1,jj  ) )
+            vtau(ji,jj) = 0.5 * ( 2. - vmask(ji,jj,1) ) * ( zwnd_j(ji,jj) + zwnd_j(ji  ,jj+1) )
+         END DO
+      END DO
+      CALL lbc_lnk( utau(:,:), 'U', -1. )
+      CALL lbc_lnk( vtau(:,:), 'V', -1. )
+
+      !  Turbulent fluxes over ocean
+      ! -----------------------------
+      IF( ln_2m ) THEN
+         ! Values of temp. and hum. adjusted to 10m must be used instead of 2m values
+         zevap(:,:) = MAX( 0.e0, rhoa    *Ce(:,:)*( zqsatw(:,:) - zq_zu(:,:) ) * zwind_speed_t(:,:) )   ! Evaporation
+         zqsb (:,:) =            rhoa*cpa*Ch(:,:)*( zst   (:,:) - zt_zu(:,:) ) * zwind_speed_t(:,:)     ! Sensible Heat
+      ELSE
+!CDIR COLLAPSE
+         zevap(:,:) = MAX( 0.e0, rhoa    *Ce(:,:)*( zqsatw(:,:) - sf(jp_humi)%fnow(:,:) ) * zwind_speed_t(:,:) )   ! Evaporation
+!CDIR COLLAPSE
+         zqsb (:,:) =            rhoa*cpa*Ch(:,:)*( zst   (:,:) - sf(jp_tair)%fnow(:,:) ) * zwind_speed_t(:,:)     ! Sensible Heat
+      ENDIF
+!CDIR COLLAPSE
+      zqla (:,:) = Lv * zevap(:,:)                                                              ! Latent Heat
+
+      IF(ln_ctl) THEN
+         CALL prt_ctl( tab2d_1=zqla   , clinfo1=' blk_oce_core: zqla   : ', tab2d_2=Ce , clinfo2=' Ce  : ' )
+         CALL prt_ctl( tab2d_1=zqsb   , clinfo1=' blk_oce_core: zqsb   : ', tab2d_2=Ch , clinfo2=' Ch  : ' )
+         CALL prt_ctl( tab2d_1=zqlw   , clinfo1=' blk_oce_core: zqlw   : ', tab2d_2=qsr, clinfo2=' qsr : ' )
+         CALL prt_ctl( tab2d_1=zqsatw , clinfo1=' blk_oce_core: zqsatw : ', tab2d_2=zst, clinfo2=' zst : ' )
+         CALL prt_ctl( tab2d_1=utau   , clinfo1=' blk_oce_core: utau   : ', mask1=umask,   &
+            &          tab2d_2=vtau   , clinfo2=' vtau : ', mask2=vmask )
+         CALL prt_ctl( tab2d_1=zwind_speed_t, clinfo1=' blk_oce_core: zwind_speed_t : ')
+         CALL prt_ctl( tab2d_1=zst    , clinfo1=' blk_oce_core: zst    : ')
+      ENDIF
+       
+      ! ----------------------------------------------------------------------------- !
+      !     III    Total FLUXES                                                       !
+      ! ----------------------------------------------------------------------------- !
+     
+!CDIR COLLAPSE
+      qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)      ! Downward Non Solar flux
+!CDIR COLLAPSE
+      emp (:,:) = zevap(:,:) - sf(jp_prec)%fnow(:,:) * alpha_precip * tmask(:,:,1)
+!CDIR COLLAPSE
+      emps(:,:) = zevap(:,:) - sf(jp_prec)%fnow(:,:) * alpha_precip * tmask(:,:,1)
+      !
+   END SUBROUTINE blk_oce_core
+   
+   
+   SUBROUTINE blk_ice_core(  pst   , pui   , pvi   , palb ,   &
+      &                      p_taui, p_tauj, p_qns , p_qsr,   &
+      &                      p_qla , p_dqns, p_dqla,          &
+      &                      p_tpr , p_spr ,                  &
+      &                      p_fr1 , p_fr2 , cd_grid  ) 
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE blk_ice_core  ***
+      !!
+      !! ** Purpose :   provide the surface boundary condition over sea-ice
+      !!
+      !! ** Method  :   compute momentum, heat and freshwater exchanged
+      !!                between atmosphere and sea-ice using CORE bulk
+      !!                formulea, ice variables and read atmmospheric fields.
+      !!                NB: ice drag coefficient is assumed to be a constant
+      !! 
+      !! caution : the net upward water flux has with mm/day unit
+      !!---------------------------------------------------------------------
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   pst      ! ice surface temperature (>0, =rt0 over land) [Kelvin]
+      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   pui      ! ice surface velocity (i- and i- components      [m/s]
+      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj) ::   pvi      !    at I-point (B-grid) or U & V-point (C-grid)
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   palb     ! ice albedo (clear sky) (alb_ice_cs)               [%]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_taui   ! i- & j-components of surface ice stress        [N/m2]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_tauj   !   at I-point (B-grid) or U & V-point (C-grid)
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qns    ! non solar heat flux over ice (T-point)         [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qsr    !     solar heat flux over ice (T-point)         [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qla    ! latent    heat flux over ice (T-point)         [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_dqns   ! non solar heat sensistivity  (T-point)         [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_dqla   ! latent    heat sensistivity  (T-point)         [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_tpr    ! total precipitation          (T-point)      [Kg/m2/s]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_spr    ! solid precipitation          (T-point)      [Kg/m2/s]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_fr1    ! 1sr fraction of qsr penetration in ice (T-point)  [%]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_fr2    ! 2nd fraction of qsr penetration in ice (T-point)  [%]
+      CHARACTER(len=1), INTENT(in   )             ::   cd_grid  ! ice grid ( C or B-grid)
+      !!
+      INTEGER  ::   ji, jj, jl    ! dummy loop indices
+      INTEGER  ::   ijpl          ! number of ice categories (size of 3rd dim of input arrays)
+      REAL(wp) ::   zst2, zst3
+      REAL(wp) ::   zcoef_wnorm, zcoef_wnorm2, zcoef_dqlw, zcoef_dqla, zcoef_dqsb
+      REAL(wp) ::   zcoef_frca                                   ! fractional cloud amount
+      REAL(wp) ::   zwnorm_f, zwndi_f , zwndj_f                  ! relative wind module and components at F-point
+      REAL(wp) ::             zwndi_t , zwndj_t                  ! relative wind components at T-point
+      REAL(wp), DIMENSION(jpi,jpj) ::   z_wnds_t                 ! wind speed ( = | U10m - U_ice | ) at T-point
+      REAL(wp), DIMENSION(jpi,jpj,SIZE(pst,3)) ::   z_qlw        ! long wave heat flux over ice
+      REAL(wp), DIMENSION(jpi,jpj,SIZE(pst,3)) ::   z_qsb        ! sensible  heat flux over ice
+      REAL(wp), DIMENSION(jpi,jpj,SIZE(pst,3)) ::   z_dqlw       ! sensible  heat flux over ice
+      REAL(wp), DIMENSION(jpi,jpj,SIZE(pst,3)) ::   z_dqsb       ! sensible  heat flux over ice
+      !!---------------------------------------------------------------------
+
+      ijpl  = SIZE( pst, 3 )                 ! number of ice categories
+
+      ! local scalars ( place there for vector optimisation purposes)
+      zcoef_wnorm = rhoa * Cice
+      zcoef_wnorm2 = rhoa * Cice * 0.5
+      zcoef_dqlw = 4.0 * 0.95 * Stef
+      zcoef_dqla = -Ls * Cice * 11637800. * (-5897.8)
+      zcoef_dqsb = rhoa * cpa * Cice
+      zcoef_frca = 1.0  - 0.3
+
+!!gm brutal....
+      z_wnds_t(:,:) = 0.e0
+      p_taui  (:,:) = 0.e0
+      p_tauj  (:,:) = 0.e0
+!!gm end
+
+      ! ----------------------------------------------------------------------------- !
+      !    Wind components and module relative to the moving ocean ( U10m - U_ice )   !
+      ! ----------------------------------------------------------------------------- !
+      SELECT CASE( cd_grid )
+      CASE( 'B' )                  ! B-grid ice dynamics :   I-point (i.e. F-point with sea-ice indexation)
+         !                           and scalar wind at T-point ( = | U10m - U_ice | ) (masked)
+#if defined key_vectopt_loop
+!CDIR COLLAPSE
+#endif
+!CDIR NOVERRCHK
+         DO jj = 2, jpjm1
+            DO ji = fs_2, fs_jpim1
+               ! ... 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)
+               zwnorm_f = zcoef_wnorm * SQRT( zwndi_f * zwndi_f + zwndj_f * zwndj_f )
+               ! ... ice stress at I-point
+               p_taui(ji,jj) = zwnorm_f * zwndi_f
+               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)   &
+                  &                                        + 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)   &
+                  &                                        + 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)
+            END DO
+         END DO
+         CALL lbc_lnk( p_taui  , 'I', -1. )
+         CALL lbc_lnk( p_tauj  , 'I', -1. )
+         CALL lbc_lnk( z_wnds_t, 'T',  1. )
+         !
+      CASE( 'C' )                  ! C-grid ice dynamics :   U & V-points (same as ocean)
+#if defined key_vectopt_loop
+!CDIR COLLAPSE
+#endif
+         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) )  )
+               z_wnds_t(ji,jj)  = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
+            END DO
+         END DO
+#if defined key_vectopt_loop
+!CDIR COLLAPSE
+#endif
+         DO jj = 2, jpjm1
+            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) )
+               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) )
+            END DO
+         END DO
+         CALL lbc_lnk( p_taui  , 'U', -1. )
+         CALL lbc_lnk( p_tauj  , 'V', -1. )
+         CALL lbc_lnk( z_wnds_t, 'T',  1. )
+         !
+      END SELECT
+
+      !                                     ! ========================== !
+      DO jl = 1, ijpl                       !  Loop over ice categories  !
+         !                                  ! ========================== !
+!CDIR NOVERRCHK
+!CDIR COLLAPSE
+         DO jj = 1 , jpj
+!CDIR NOVERRCHK
+            DO ji = 1, jpi
+               ! ----------------------------!
+               !      I   Radiative FLUXES   !
+               ! ----------------------------!
+               zst2 = pst(ji,jj,jl) * pst(ji,jj,jl)
+               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)
+               ! Long  Wave (lw)
+               z_qlw(ji,jj,jl) = 0.95 * (  sf(jp_qlw)%fnow(ji,jj)       &                         
+                  &                   - Stef * pst(ji,jj,jl) * zst3  ) * tmask(ji,jj,1)
+               ! lw sensitivity
+               z_dqlw(ji,jj,jl) = zcoef_dqlw * zst3                                               
+
+               ! ----------------------------!
+               !     II    Turbulent FLUXES  !
+               ! ----------------------------!
+
+               ! ... 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) )
+               ! 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)  ) )
+               ! 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) )
+               ! Sensible heat sensitivity (Dqsb_ice/Dtn_ice)
+               z_dqsb(ji,jj,jl) = zcoef_dqsb * z_wnds_t(ji,jj)
+
+               ! ----------------------------!
+               !     III    Total FLUXES     !
+               ! ----------------------------!
+               ! Downward Non Solar flux
+               p_qns (ji,jj,jl) =     z_qlw (ji,jj,jl) - z_qsb (ji,jj,jl) - p_qla (ji,jj,jl)      
+               ! Total non solar heat flux sensitivity for ice
+               p_dqns(ji,jj,jl) = - ( z_dqlw(ji,jj,jl) + z_dqsb(ji,jj,jl) + p_dqla(ji,jj,jl) )    
+            END DO
+            !
+         END DO
+         !
+      END DO
+      !
+      !--------------------------------------------------------------------
+      ! FRACTIONs of net shortwave radiation which is not absorbed in the
+      ! thin surface layer and penetrates inside the ice cover
+      ! ( Maykut and Untersteiner, 1971 ; Ebert and Curry, 1993 )
+    
+!CDIR COLLAPSE
+      p_fr1(:,:) = ( 0.18 * ( 1.0 - zcoef_frca ) + 0.35 * zcoef_frca )
+!CDIR COLLAPSE
+      p_fr2(:,:) = ( 0.82 * ( 1.0 - zcoef_frca ) + 0.65 * zcoef_frca )
+       
+!CDIR COLLAPSE
+      p_tpr(:,:) = sf(jp_prec)%fnow(:,:) * alpha_precip      ! total precipitation [kg/m2/s]
+!CDIR COLLAPSE
+      p_spr(:,:) = sf(jp_snow)%fnow(:,:) * alpha_precip      ! solid precipitation [kg/m2/s]
+      !
+      IF(ln_ctl) THEN
+         CALL prt_ctl(tab3d_1=p_qla   , clinfo1=' blk_ice_core: p_qla  : ', tab3d_2=z_qsb   , clinfo2=' z_qsb  : ', kdim=ijpl)
+         CALL prt_ctl(tab3d_1=z_qlw   , clinfo1=' blk_ice_core: z_qlw  : ', tab3d_2=p_dqla  , clinfo2=' p_dqla : ', kdim=ijpl)
+         CALL prt_ctl(tab3d_1=z_dqsb  , clinfo1=' blk_ice_core: z_dqsb : ', tab3d_2=z_dqlw  , clinfo2=' z_dqlw : ', kdim=ijpl)
+         CALL prt_ctl(tab3d_1=p_dqns  , clinfo1=' blk_ice_core: p_dqns : ', tab3d_2=p_qsr   , clinfo2=' p_qsr  : ', kdim=ijpl)
+         CALL prt_ctl(tab3d_1=pst     , clinfo1=' blk_ice_core: pst    : ', tab3d_2=p_qns   , clinfo2=' p_qns  : ', kdim=ijpl)
+         CALL prt_ctl(tab2d_1=p_tpr   , clinfo1=' blk_ice_core: p_tpr  : ', tab2d_2=p_spr   , clinfo2=' p_spr  : ')
+         CALL prt_ctl(tab2d_1=p_taui  , clinfo1=' blk_ice_core: p_taui : ', tab2d_2=p_tauj  , clinfo2=' p_tauj : ')
+         CALL prt_ctl(tab2d_1=z_wnds_t, clinfo1=' blk_ice_core: z_wnds_t : ')
+      ENDIF
+
+   END SUBROUTINE blk_ice_core
+  
+
+   SUBROUTINE TURB_CORE_1Z(zu, sst, T_a, q_sat, q_a,   &
+      &                        dU, Cd, Ch, Ce   )
+      !!----------------------------------------------------------------------
+      !!                      ***  ROUTINE  turb_core  ***
+      !!
+      !! ** Purpose :   Computes turbulent transfert coefficients of surface
+      !!                fluxes according to Large & Yeager (2004)
+      !!
+      !! ** Method  :   I N E R T I A L   D I S S I P A T I O N   M E T H O D
+      !!      Momentum, Latent and sensible heat exchange coefficients
+      !!      Caution: this procedure should only be used in cases when air
+      !!      temperature (T_air), air specific humidity (q_air) and wind (dU)
+      !!      are provided at the same height 'zzu'!
+      !!
+      !! References :
+      !!      Large & Yeager, 2004 : ???
+      !! History :
+      !!        !  XX-XX  (???     )  Original code
+      !!   9.0  !  05-08  (L. Brodeau) Rewriting and optimization
+      !!----------------------------------------------------------------------
+      !! * Arguments
+
+      REAL(wp), INTENT(in) :: zu                 ! altitude of wind measurement       [m]
+      REAL(wp), INTENT(in), DIMENSION(jpi,jpj) ::  &
+         sst,       &       ! sea surface temperature         [Kelvin]
+         T_a,       &       ! potential air temperature       [Kelvin]
+         q_sat,     &       ! sea surface specific humidity   [kg/kg]
+         q_a,       &       ! specific air humidity           [kg/kg]
+         dU                 ! wind module |U(zu)-U(0)|        [m/s]
+      REAL(wp), intent(out), DIMENSION(jpi,jpj)  :: &
+         Cd,    &                ! transfert coefficient for momentum       (tau)
+         Ch,    &                ! transfert coefficient for temperature (Q_sens)
+         Ce                      ! transfert coefficient for evaporation  (Q_lat)
+
+      !! * Local declarations
+      REAL(wp), DIMENSION(jpi,jpj)  ::   &
+         dU10,        &       ! dU                                   [m/s]
+         dT,          &       ! air/sea temperature differeence      [K]
+         dq,          &       ! air/sea humidity difference          [K]
+         Cd_n10,      &       ! 10m neutral drag coefficient
+         Ce_n10,      &       ! 10m neutral latent coefficient
+         Ch_n10,      &       ! 10m neutral sensible coefficient
+         sqrt_Cd_n10, &       ! root square of Cd_n10
+         sqrt_Cd,     &       ! root square of Cd
+         T_vpot,      &       ! virtual potential temperature        [K]
+         T_star,      &       ! turbulent scale of tem. fluct.
+         q_star,      &       ! turbulent humidity of temp. fluct.
+         U_star,      &       ! turb. scale of velocity fluct.
+         L,           &       ! Monin-Obukov length                  [m]
+         zeta,        &       ! stability parameter at height zu
+         U_n10,       &       ! neutral wind velocity at 10m         [m]   
+         xlogt, xct, zpsi_h, zpsi_m
+      !!
+      INTEGER :: j_itt
+      INTEGER, PARAMETER :: nb_itt = 3
+      INTEGER, DIMENSION(jpi,jpj)  ::   &
+         stab         ! 1st guess stability test integer
+
+      REAL(wp), PARAMETER ::                        &
+         grav   = 9.8,          &  ! gravity                       
+         kappa  = 0.4              ! von Karman s constant
+
+      !! * Start
+      !! Air/sea differences
+      dU10 = max(0.5, dU)     ! we don't want to fall under 0.5 m/s
+      dT = T_a - sst          ! assuming that T_a is allready the potential temp. at zzu
+      dq = q_a - q_sat
+      !!    
+      !! Virtual potential temperature
+      T_vpot = T_a*(1. + 0.608*q_a)
+      !!
+      !! Neutral Drag Coefficient
+      stab    = 0.5 + sign(0.5,dT)    ! stable : stab = 1 ; unstable : stab = 0 
+      Cd_n10  = 1E-3 * ( 2.7/dU10 + 0.142 + dU10/13.09 )    !   L & Y eq. (6a)
+      sqrt_Cd_n10 = sqrt(Cd_n10)
+      Ce_n10  = 1E-3 * ( 34.6 * sqrt_Cd_n10 )               !   L & Y eq. (6b)
+      Ch_n10  = 1E-3*sqrt_Cd_n10*(18*stab + 32.7*(1-stab)) !   L & Y eq. (6c), (6d)
+      !!
+      !! Initializing transfert coefficients with their first guess neutral equivalents :
+      Cd = Cd_n10 ;  Ce = Ce_n10 ;  Ch = Ch_n10 ;  sqrt_Cd = sqrt(Cd)
+
+      !! * Now starting iteration loop
+      DO j_itt=1, nb_itt
+         !! Turbulent scales :
+         U_star  = sqrt_Cd*dU10                !   L & Y eq. (7a)
+         T_star  = Ch/sqrt_Cd*dT               !   L & Y eq. (7b)
+         q_star  = Ce/sqrt_Cd*dq               !   L & Y eq. (7c)
+
+         !! Estimate the Monin-Obukov length :
+         L  = (U_star**2)/( kappa*grav*(T_star/T_vpot + q_star/(q_a + 1./0.608)) )
+
+         !! Stability parameters :
+         zeta = zu/L ;  zeta   = sign( min(abs(zeta),10.0), zeta )
+         zpsi_h = psi_h(zeta)
+         zpsi_m = psi_m(zeta)
+
+         !! Shifting the wind speed to 10m and neutral stability :
+         U_n10 = dU10*1./(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m)) !  L & Y eq. (9a)
+
+         !! Updating the neutral 10m transfer coefficients :
+         Cd_n10  = 1E-3 * (2.7/U_n10 + 0.142 + U_n10/13.09)              !  L & Y eq. (6a)
+         sqrt_Cd_n10 = sqrt(Cd_n10)
+         Ce_n10  = 1E-3 * (34.6 * sqrt_Cd_n10)                           !  L & Y eq. (6b)
+         stab    = 0.5 + sign(0.5,zeta)
+         Ch_n10  = 1E-3*sqrt_Cd_n10*(18.*stab + 32.7*(1-stab))           !  L & Y eq. (6c), (6d)
+
+         !! Shifting the neutral  10m transfer coefficients to ( zu , zeta ) :
+         !!
+         xct = 1. + sqrt_Cd_n10/kappa*(log(zu/10) - zpsi_m)
+         Cd  = Cd_n10/(xct*xct) ;  sqrt_Cd = sqrt(Cd)
+         !!
+         xlogt = log(zu/10.) - zpsi_h
+         !!
+         xct = 1. + Ch_n10*xlogt/kappa/sqrt_Cd_n10
+         Ch  = Ch_n10*sqrt_Cd/sqrt_Cd_n10/xct
+         !!
+         xct = 1. + Ce_n10*xlogt/kappa/sqrt_Cd_n10
+         Ce  = Ce_n10*sqrt_Cd/sqrt_Cd_n10/xct
+         !!
+      END DO
+      !!
+    END SUBROUTINE TURB_CORE_1Z
+
+
+    SUBROUTINE TURB_CORE_2Z(zt, zu, sst, T_zt, q_sat, q_zt, dU, Cd, Ch, Ce, T_zu, q_zu)
+      !!----------------------------------------------------------------------
+      !!                      ***  ROUTINE  turb_core  ***
+      !!
+      !! ** Purpose :   Computes turbulent transfert coefficients of surface 
+      !!                fluxes according to Large & Yeager (2004).
+      !!
+      !! ** Method  :   I N E R T I A L   D I S S I P A T I O N   M E T H O D
+      !!      Momentum, Latent and sensible heat exchange coefficients
+      !!      Caution: this procedure should only be used in cases when air
+      !!      temperature (T_air) and air specific humidity (q_air) are at 2m
+      !!      whereas wind (dU) is at 10m.
+      !!
+      !! References :
+      !!      Large & Yeager, 2004 : ???
+      !! History :
+      !!   9.0  !  06-12  (L. Brodeau) Original code for 2Z
+      !!----------------------------------------------------------------------
+      !! * Arguments
+      REAL(wp), INTENT(in)   :: &
+         zt,      &     ! height for T_zt and q_zt                   [m]
+         zu             ! height for dU                              [m]
+      REAL(wp), INTENT(in), DIMENSION(jpi,jpj) ::  &
+         sst,      &     ! sea surface temperature              [Kelvin]
+         T_zt,     &     ! potential air temperature            [Kelvin]
+         q_sat,    &     ! sea surface specific humidity         [kg/kg]
+         q_zt,     &     ! specific air humidity                 [kg/kg]
+         dU              ! relative wind module |U(zu)-U(0)|       [m/s]
+      REAL(wp), INTENT(out), DIMENSION(jpi,jpj)  ::  &
+         Cd,       &     ! transfer coefficient for momentum         (tau)
+         Ch,       &     ! transfer coefficient for sensible heat (Q_sens)
+         Ce,       &     ! transfert coefficient for evaporation   (Q_lat)
+         T_zu,     &     ! air temp. shifted at zu                     [K]
+         q_zu            ! spec. hum.  shifted at zu               [kg/kg]
+
+      !! * Local declarations
+      REAL(wp), DIMENSION(jpi,jpj) ::  &
+         dU10,        &     ! dU                                [m/s]
+         dT,          &     ! air/sea temperature differeence   [K]
+         dq,          &     ! air/sea humidity difference       [K]
+         Cd_n10,      &     ! 10m neutral drag coefficient
+         Ce_n10,      &     ! 10m neutral latent coefficient
+         Ch_n10,      &     ! 10m neutral sensible coefficient
+         sqrt_Cd_n10, &     ! root square of Cd_n10
+         sqrt_Cd,     &     ! root square of Cd
+         T_vpot_u,    &     ! virtual potential temperature        [K]
+         T_star,      &     ! turbulent scale of tem. fluct.
+         q_star,      &     ! turbulent humidity of temp. fluct.
+         U_star,      &     ! turb. scale of velocity fluct.
+         L,           &     ! Monin-Obukov length                  [m]
+         zeta_u,      &     ! stability parameter at height zu
+         zeta_t,      &     ! stability parameter at height zt
+         U_n10,       &     ! neutral wind velocity at 10m        [m]
+         xlogt, xct, zpsi_hu, zpsi_ht, zpsi_m
+
+      INTEGER :: j_itt
+      INTEGER, PARAMETER :: nb_itt = 3   ! number of itterations
+      INTEGER, DIMENSION(jpi,jpj) :: &
+           &     stab                ! 1st stability test integer
+      REAL(wp), PARAMETER ::                        &
+         grav   = 9.8,      &  ! gravity                       
+         kappa  = 0.4          ! von Karman's constant
+
+      !!  * Start
+
+      !! Initial air/sea differences
+      dU10 = max(0.5, dU)      !  we don't want to fall under 0.5 m/s
+      dT = T_zt - sst 
+      dq = q_zt - q_sat
+
+      !! Neutral Drag Coefficient :
+      stab = 0.5 + sign(0.5,dT)                 ! stab = 1  if dT > 0  -> STABLE
+      Cd_n10  = 1E-3*( 2.7/dU10 + 0.142 + dU10/13.09 ) 
+      sqrt_Cd_n10 = sqrt(Cd_n10)
+      Ce_n10  = 1E-3*( 34.6 * sqrt_Cd_n10 )
+      Ch_n10  = 1E-3*sqrt_Cd_n10*(18*stab + 32.7*(1 - stab))
+
+      !! Initializing transf. coeff. with their first guess neutral equivalents :
+      Cd = Cd_n10 ;  Ce = Ce_n10 ;  Ch = Ch_n10 ;  sqrt_Cd = sqrt(Cd)
+
+      !! Initializing z_u values with z_t values :
+      T_zu = T_zt ;  q_zu = q_zt
+
+      !!  * Now starting iteration loop
+      DO j_itt=1, nb_itt
+         dT = T_zu - sst ;  dq = q_zu - q_sat ! Updating air/sea differences
+         T_vpot_u = T_zu*(1. + 0.608*q_zu)    ! Updating virtual potential temperature at zu
+         U_star = sqrt_Cd*dU10                ! Updating turbulent scales :   (L & Y eq. (7))
+         T_star  = Ch/sqrt_Cd*dT              !
+         q_star  = Ce/sqrt_Cd*dq              !
+         !!
+         L = (U_star*U_star) &                ! Estimate the Monin-Obukov length at height zu
+              & / (kappa*grav/T_vpot_u*(T_star*(1.+0.608*q_zu) + 0.608*T_zu*q_star))
+         !! Stability parameters :
+         zeta_u  = zu/L  ;  zeta_u = sign( min(abs(zeta_u),10.0), zeta_u )
+         zeta_t  = zt/L  ;  zeta_t = sign( min(abs(zeta_t),10.0), zeta_t )
+         zpsi_hu = psi_h(zeta_u)
+         zpsi_ht = psi_h(zeta_t)
+         zpsi_m  = psi_m(zeta_u)
+         !!
+         !! Shifting the wind speed to 10m and neutral stability : (L & Y eq.(9a))
+!        U_n10 = dU10/(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - psi_m(zeta_u)))
+         U_n10 = dU10/(1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m))
+         !!
+         !! Shifting temperature and humidity at zu :          (L & Y eq. (9b-9c))
+!        T_zu = T_zt - T_star/kappa*(log(zt/zu) + psi_h(zeta_u) - psi_h(zeta_t))
+         T_zu = T_zt - T_star/kappa*(log(zt/zu) + zpsi_hu - zpsi_ht)
+!        q_zu = q_zt - q_star/kappa*(log(zt/zu) + psi_h(zeta_u) - psi_h(zeta_t))
+         q_zu = q_zt - q_star/kappa*(log(zt/zu) + zpsi_hu - zpsi_ht)
+         !!
+         !! q_zu cannot have a negative value : forcing 0
+         stab = 0.5 + sign(0.5,q_zu) ;  q_zu = stab*q_zu
+         !!
+         !! Updating the neutral 10m transfer coefficients :
+         Cd_n10  = 1E-3 * (2.7/U_n10 + 0.142 + U_n10/13.09)    ! L & Y eq. (6a)
+         sqrt_Cd_n10 = sqrt(Cd_n10)
+         Ce_n10  = 1E-3 * (34.6 * sqrt_Cd_n10)                 ! L & Y eq. (6b)
+         stab    = 0.5 + sign(0.5,zeta_u)
+         Ch_n10  = 1E-3*sqrt_Cd_n10*(18.*stab + 32.7*(1-stab)) ! L & Y eq. (6c-6d)
+         !!
+         !!
+         !! Shifting the neutral 10m transfer coefficients to (zu,zeta_u) :
+!        xct = 1. + sqrt_Cd_n10/kappa*(log(zu/10.) - psi_m(zeta_u))
+         xct = 1. + sqrt_Cd_n10/kappa*(log(zu/10.) - zpsi_m)
+         Cd = Cd_n10/(xct*xct) ; sqrt_Cd = sqrt(Cd)
+         !!
+!        xlogt = log(zu/10.) - psi_h(zeta_u)
+         xlogt = log(zu/10.) - zpsi_hu
+         !!
+         xct = 1. + Ch_n10*xlogt/kappa/sqrt_Cd_n10
+         Ch  = Ch_n10*sqrt_Cd/sqrt_Cd_n10/xct
+         !!
+         xct = 1. + Ce_n10*xlogt/kappa/sqrt_Cd_n10
+         Ce  = Ce_n10*sqrt_Cd/sqrt_Cd_n10/xct
+         !!
+         !!
+      END DO
+      !!
+    END SUBROUTINE TURB_CORE_2Z
+
+
+    FUNCTION psi_m(zta)   !! Psis, L & Y eq. (8c), (8d), (8e)
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: zta
+
+      REAL(wp), PARAMETER :: pi = 3.141592653589793_wp
+      REAL(wp), DIMENSION(jpi,jpj)             :: psi_m
+      REAL(wp), DIMENSION(jpi,jpj)             :: X2, X, stabit
+      X2 = sqrt(abs(1. - 16.*zta))  ;  X2 = max(X2 , 1.0) ;  X  = sqrt(X2)
+      stabit    = 0.5 + sign(0.5,zta)
+      psi_m = -5.*zta*stabit  &                                                  ! Stable
+           & + (1. - stabit)*(2*log((1. + X)/2) + log((1. + X2)/2) - 2*atan(X) + pi/2)  ! Unstable 
+    END FUNCTION psi_m
+
+    FUNCTION psi_h(zta)    !! Psis, L & Y eq. (8c), (8d), (8e)
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: zta
+
+      REAL(wp), DIMENSION(jpi,jpj)             :: psi_h
+      REAL(wp), DIMENSION(jpi,jpj)             :: X2, X, stabit
+      X2 = sqrt(abs(1. - 16.*zta))  ;  X2 = max(X2 , 1.) ;  X  = sqrt(X2)
+      stabit    = 0.5 + sign(0.5,zta)
+      psi_h = -5.*zta*stabit  &                                       ! Stable
+           & + (1. - stabit)*(2.*log( (1. + X2)/2. ))                 ! Unstable
+    END FUNCTION psi_h
+  
+   !!======================================================================
+END MODULE sbcblk_core
Index: trunk/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 888)
@@ -0,0 +1,383 @@
+MODULE sbccpl
+   !!======================================================================
+   !!                       ***  MODULE  sbccpl  ***
+   !! Ocean forcing:  momentum, heat and freshwater coupled formulation
+   !!=====================================================================
+   !! History :  9.0   !  06-07  (R. Redler, N. Keenlyside, W. Park) 
+   !!                            Original code split into flxmod & taumod
+   !!            9.0   !  06-07  (G. Madec)  surface module
+   !!----------------------------------------------------------------------
+#if defined key_sbc_cpl
+   !!----------------------------------------------------------------------
+   !!   'key_sbc_cpl'                   Coupled Ocean/Atmosphere formulation
+   !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !!   namsbc_cpl   : coupled formulation namlist
+   !!   sbc_cpl      : coupled formulation for the ocean surface boundary condition
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE phycst          ! physical constants
+   USE in_out_manager  ! I/O manager
+   USE lib_mpp         ! distribued memory computing library
+   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+   USE daymod          ! calendar
+
+   USE cpl_oasis3      ! OASIS3 coupling (to ECHAM5)
+   USE cpl_oasis4      ! OASIS4 coupling (to ECHAM5)
+   USE geo2ocean, ONLY : repere, repcmo
+   USE ice_2, only     : frld       ! : leads fraction = 1-a/totalarea
+
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+
+   USE iom             ! NetCDF library
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   sbc_cpl       ! routine called by step.F90
+
+   LOGICAL, PUBLIC ::   lk_sbc_cpl = .TRUE.   !: coupled formulation flag
+
+   INTEGER , PARAMETER                 ::   jpfld   = 5    ! maximum number of files to read 
+   INTEGER , PARAMETER                 ::   jp_taux = 1    ! index of wind stress (i-component) file
+   INTEGER , PARAMETER                 ::   jp_tauy = 2    ! index of wind stress (j-component) file
+   INTEGER , PARAMETER                 ::   jp_qtot = 3    ! index of total (non solar+solar) heat file
+   INTEGER , PARAMETER                 ::   jp_qsr  = 4    ! index of solar heat file
+   INTEGER , PARAMETER                 ::   jp_emp  = 5    ! index of evaporation-precipation file
+   
+!!wonsun         
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &
+      taux, tauy       &  !: surface stress components in (i,j) referential
+
+
+   USE sbc_ice, only : dqns_ice , & ! : derivative of non solar heat flux on sea ice
+                       qsr_ice  , & ! : solar flux over ice
+                       qns_ice  , & ! : total non solar heat flux (Longwave downward radiation) over ice
+                       tn_ice   , & ! : ice surface temperature
+                       alb_ice  , & ! : albedo of ice
+                       sprecip  , & ! : solid (snow) precipitation over water (!) what about ice?
+                       tprecip  , & ! : total precipitation ( or liquid precip minus evaporation in coupled mode)
+                       calving  , & ! : calving
+                       rrunoff  , & ! : monthly runoff (kg/m2/s)
+                       fr1_i0   , & ! : 1st part of the fraction of sol.rad. which penetrate inside the ice cover
+                       fr2_i0       ! : 2nd part of the fraction of sol.rad. which penetrate inside the ice cover
+
+   USE ice_2, only  : hicif ,     & ! : ice thickness
+                      frld  ,     & ! : leads fraction = 1-a/totalarea
+                      hsnif  ,    & ! : snow thickness
+                      u_ice , v_ice ! : ice velocity
+
+   USE sbc_oce, only : sst_m        ! : sea surface temperature
+
+   REAL(wp), PUBLIC ::            & !!! surface fluxes namelist (namflx)
+      q0    = 0.e0,               &  ! net heat flux
+      qsr0  = 0.e0,               &  ! solar heat flux
+      emp0  = 0.e0,               &  ! net freshwater flux
+      dqdt0 = -40.,               &  ! coefficient for SST damping (W/m2/K)
+      deds0 = 27.7                   ! coefficient for SSS damping (mm/day)
+   
+    REAL(wp), DIMENSION(jpi,jpj) ::   qsr_oce_recv , qsr_ice_recv 
+    REAL(wp), DIMENSION(jpi,jpj) ::   qns_oce_recv, qns_ice_recv
+    REAL(wp), DIMENSION(jpi,jpj) ::   dqns_ice_recv
+    REAL(wp), DIMENSION(jpi,jpj) ::   tprecip_recv , precip_recv
+    REAL(wp), DIMENSION(jpi,jpj) ::   fr1_i0_recv  , fr2_i0_recv     
+    REAL(wp), DIMENSION(jpi,jpj) ::   rrunoff_recv , calving_recv   
+#if defined key_cpl_ocevel
+    REAL(wp), DIMENSION(jpi,jpj) :: un_weighted, vn_weighted
+    REAL(wp), DIMENSION(jpi,jpj) :: un_send    , vn_send 
+#endif
+    REAL(wp), DIMENSION(jpi,jpj) :: zrunriv   ! river discharge into ocean
+    REAL(wp), DIMENSION(jpi,jpj) :: zruncot   ! continental discharge into ocean
+
+    REAL(wp), DIMENSION(jpi,jpj) :: zpew      ! P-E over water
+    REAL(wp), DIMENSION(jpi,jpj) :: zpei      ! P-E over ice
+    REAL(wp), DIMENSION(jpi,jpj) :: zpsol     ! surface downward snow fall
+    REAL(wp), DIMENSION(jpi,jpj) :: zevice    ! surface upward snow flux where sea ice
+!!wonsun         
+
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE sbc_cpl( kt )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE sbc_cpl  ***
+      !!                   
+      !! ** Purpose :   provide at each time step the surface ocean fluxes
+      !!                (momentum, heat, freshwater and runoff) in coupled mode
+      !!
+      !! ** Method  : - Recieve from a Atmospheric model via OASIS coupler :
+      !!                   i-component of the stress              taux  (N/m2)
+      !!                   j-component of the stress              tauy  (N/m2)
+      !!                   net downward heat flux                 qtot  (watt/m2)
+      !!                   net downward radiative flux            qsr   (watt/m2)
+      !!                   net upward freshwater (evapo - precip) emp   (kg/m2/s)
+      !!              - send to the Atmospheric model via OASIS coupler :
+      !!
+      !! ** Action  :   update at each time-step the two components of the 
+      !!                surface stress in both (i,j) and geographical ref.
+      !!
+      !!
+      !!      CAUTION :  - never mask the surface stress fields
+      !!
+      !! ** Action  :   update at each time-step
+      !!              - taux  & tauy    : stress components in (i,j) referential
+      !!              - qns             : non solar heat flux
+      !!              - qsr             : solar heat flux
+      !!              - emp             : evap - precip (volume flux)
+      !!              - emps            : evap - precip (concentration/dillution)
+      !!
+      !! References : The OASIS User Guide, Version 3.0 and 4.0
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt   ! ocean time step
+      !!
+      INTEGER  ::   ji, jj      ! dummy loop indices
+#if defined key_cpl_ocevel
+      INTEGER  ::   ikchoix 
+#endif
+      INTEGER  ::   var_id, info
+      INTEGER  ::   date          !????  !!gm bug  this is a real !!!
+      REAL(wp) ::   zfacflx, zfacwat, zfact
+
+      REAL(wp), DIMENSION(jpi,jpj) ::   ztaueuw, ztauevw   ! eastward  wind stress over water at U and V-points
+      REAL(wp), DIMENSION(jpi,jpj) ::   ztaunuw, ztaunvw   ! northward wind stress over water at U and V-points
+      REAL(wp), DIMENSION(jpi,jpj) ::   ztaueui, ztauevi   ! eastward  wind stress over ice   at U and V-points
+      REAL(wp), DIMENSION(jpi,jpj) ::   ztaunui, ztaunvi   ! northward wind stress over ice   at U and V-points
+      REAL(wp), DIMENSION(jpi,jpj) ::   ztaueu , ztauev    ! eastward wind stress combined
+      REAL(wp), DIMENSION(jpi,jpj) ::   ztaunu , ztaunv    ! northward wind stress combined 
+      !!---------------------------------------------------------------------
+
+      date = ( kt - nit000 ) * rdttra(1)        ! date of exxhanges
+      !                                         ! Conversion factor (ocean units are W/m2 and Kg/m2/s]
+      zfacflx = 1.e0  ! no conversion    [W/m2]         ! W/m2 heat fluxes are send by the Atmosphere 
+      zfacwat = 1.e3  ! convert [m/s] to [kg/m2/s]      ! m/s freshwater fluxes are send by the atmosphere
+
+
+      !                                         ! =========================== !
+      !                                         !     Send Coupling fields    !
+      !                                         ! =========================== !
+      ! 
+!!gm bug ?  here send instantaneous SST, not mean over the coupling period....
+      var_id = send_id(1)   ;   CALL cpl_prism_send( var_id, date, tn(:,:,1)+rt0, info )   ! ocean surface temperature [K]
+      var_id = send_id(2)   ;   CALL cpl_prism_send( var_id, date, 1.0-frld     , info )   ! fraction of ice-cover
+#if defined key_cpl_albedo
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            IF( ( tn_ice(ji,jj) < 50 .OR. tn_ice(ji,jj) > 400 ) .AND. frld(ji,jj) < 1. ) THEN
+              WRITE(numout,*) ' tn_ice, ERROR ', ji, jj, ' = ', tn_ice(ji,jj),   &
+                 &            ' qns_ice_recv=', qns_ice_recv(ji,jj), ' dqns_ice_recv=', dqns_ice_recv(ji,jj)
+            ENDIF
+         END DO
+      END DO
+      var_id = send_id(3)   ;   CALL cpl_prism_send( var_id, date, tn_ice      , info )    ! ice surface temperature [K]  
+      var_id = send_id(4)   ;   CALL cpl_prism_send( var_id, date, alb_ice     , info )    ! ice albedo [%]
+#else
+      var_id = send_id(3)   ;   CALL cpl_prism_send( var_id, date, hicif       , info )    ! ice  thickness [m]
+      var_id = send_id(4)   ;   CALL cpl_prism_send( var_id, date, hsnif       , info )    ! snow thickness [m]
+#endif
+#if defined key_cpl_ocevel
+!!gm bug???  I have to check the grid point position...
+!!           a priori there is a error here as un, vn are not at the same grid point....
+!!           there should be a averaged to set u and v at T-point.... with caution for sea-ice velocity at I-point....
+      un_weighted = un(:,:,1) * frld + u_ice * ( 1. - frld )
+      vn_weighted = vn(:,:,1) * frld + v_ice * ( 1. - frld )
+      ikchoix = - 1         ! converte from (i,j) to geographic referential
+      CALL repere( un_weighted, vn_weighted, un_send, vn_send, ikchoix )
+!!gm bug : at lbc_lnk is to be added on un_send and vn_send  
+      var_id = send_id(5)   ;   CALL cpl_prism_send( var_id, date, un_send    , info )        ! surface current [m/s]
+      var_id = send_id(6)   ;   CALL cpl_prism_send( var_id, date, vn_send    , info )        ! surface current [m/s]
+#endif
+
+      !                                         ! =========================== !
+      !                                         !   Recieve Momentum fluxes   !
+      !                                         ! =========================== !
+      ! 
+      ! ... Receive wind stress fields in geographic component over water and ice
+      var_id = recv_id(1)   ;   CALL cpl_prism_recv( var_id, date, ztaueuw, info )           ! ???
+      var_id = recv_id(2)   ;   CALL cpl_prism_recv( var_id, date, ztaunuw, info )
+      var_id = recv_id(3)   ;   CALL cpl_prism_recv( var_id, date, ztaueui, info )
+      var_id = recv_id(4)   ;   CALL cpl_prism_recv( var_id, date, ztaunui, info )
+      var_id = recv_id(5)   ;   CALL cpl_prism_recv( var_id, date, ztauevw, info )
+      var_id = recv_id(6)   ;   CALL cpl_prism_recv( var_id, date, ztaunvw, info )
+      var_id = recv_id(7)   ;   CALL cpl_prism_recv( var_id, date, ztauevi, info )
+      var_id = recv_id(8)   ;   CALL cpl_prism_recv( var_id, date, ztaunvi, info )
+      !
+!!gm bug : keep separate ice and ocean stress !
+      ! ... combine water / ice stresses
+      ztaueu(:,:) = ztaueuw(:,:) * frld(:,:) + ztaueui(:,:) * ( 1.0 - frld(:,:) )
+      ztaunu(:,:) = ztaunuw(:,:) * frld(:,:) + ztaunui(:,:) * ( 1.0 - frld(:,:) )
+      ztauev(:,:) = ztauevw(:,:) * frld(:,:) + ztauevi(:,:) * ( 1.0 - frld(:,:) )
+      ztaunv(:,:) = ztaunvw(:,:) * frld(:,:) + ztaunvi(:,:) * ( 1.0 - frld(:,:) )
+      !
+      ! ... rotate vector components from geographic to (i,j) referential
+      CALL repcmo ( ztaueu, ztaunu, ztauev, ztaunv, utau, vtau, kt )
+      !
+!!gm bug??  not sure but put that for security
+      CALL lbc_lnk( utau , 'U', -1. )
+      CALL lbc_lnk( vtau , 'V', -1. )
+!!gm end bug??
+      !
+      !                                         ! =========================== !
+      !                                         !     Recieve heat fluxes     !
+      !                                         ! =========================== !
+      !
+      var_id = recv_id(13)   ;   CALL cpl_prism_recv( var_id, date, qsr_oce_recv , info )   ! ocean surface net downward shortwave flux
+      var_id = recv_id(14)   ;   CALL cpl_prism_recv( var_id, date, qns_oce_recv , info )   ! ocean surface downward non-solar heat flux
+      var_id = recv_id(15)   ;   CALL cpl_prism_recv( var_id, date, qsr_ice_recv , info )   ! ice solar heat flux
+      var_id = recv_id(16)   ;   CALL cpl_prism_recv( var_id, date, qns_ice_recv , info )   ! ice non-solar heat flux
+      var_id = recv_id(17)   ;   CALL cpl_prism_recv( var_id, date, dqns_ice_recv, info )   ! ice non-solar heat flux sensitivity
+
+      qsr_oce_recv (:,:) = qsr_oce_recv (:,:) * tmask(:,:,1) * zfacflx
+      qns_oce_recv (:,:) = qns_oce_recv (:,:) * tmask(:,:,1) * zfacflx
+      qsr_ice_recv (:,:) = qsr_ice_recv (:,:) * tmask(:,:,1) * zfacflx
+      qns_ice_recv (:,:) = qns_ice_recv (:,:) * tmask(:,:,1) * zfacflx
+      dqns_ice_recv(:,:) = dqns_ice_recv(:,:) * tmask(:,:,1) * zfacflx
+
+      IF( kt == nit000 ) THEN                   ! set once for all qsr penetration in sea-ice
+         !                                      ! Since cloud cover catm not transmitted from atmosphere, it is set to 0. 
+         !                                      ! i.e. constant penetration fractions of 0.18 and 0.82
+         !  fraction of net shortwave radiation which is not absorbed in the thin surface layer and penetrates
+         !  inside the ice cover ( Maykut and Untersteiner, 1971 ; Elbert anbd Curry, 1993 )
+         fr1_i0_recv(:,:) = 0.18 
+         fr2_i0_recv(:,:) = 0.82
+      ENDIF
+      !
+      !                                         ! =========================== !
+      !                                         !  Recieve freshwater fluxes  !
+      !                                         ! =========================== !
+      !
+      var_id = recv_id( 9)   ;   CALL cpl_prism_recv( var_id, date, zpew  , info )      ! P-E over water
+      var_id = recv_id(10)   ;   CALL cpl_prism_recv( var_id, date, zpei  , info )      ! P-E over ice
+      var_id = recv_id(11)   ;   CALL cpl_prism_recv( var_id, date, zpsol , info )      ! Snow fall over water and ice
+      var_id = recv_id(12)   ;   CALL cpl_prism_recv( var_id, date, zevice, info )      ! Evaporation over ice (sublimination)
+      !
+      ! ... calculate water flux (P-E over open ocean and ice) and solid precipitation  (positive upward)
+      tprecip_recv(:,:) = ( zpew (:,:) + zpei  (:,:) ) * tmask(:,:,1) * zfacwat
+      sprecip_recv(:,:) = ( zpsol(:,:) + zevice(:,:) ) * tmask(:,:,1) * zfacwat
+      
+      ! ... Control print & check
+      IF(ln_ctl) THEN
+         WRITE(numout,*) ' flx:tprecip_recv    - Minimum value is ', MINVAL( tprecip_recv )
+         WRITE(numout,*) ' flx:tprecip_recv    - Maximum value is ', MAXVAL( tprecip_recv )
+         WRITE(numout,*) ' flx:tprecip_recv    -     Sum value is ', SUM   ( tprecip_recv )
+      ENDIF
+!!gm bug in mpp SUM require a mmp_sum call
+!!gm further more this test is quite expensive ...  only needed at the first time-step???
+      IF( SUM( zpew*e1t*e2t ) /= SUM( zpew*e1t*e2t*tmask(:,:,1) ) ) THEN
+         WRITE(numout,*) ' flx: Forcing values outside Orca mask'
+         WRITE(numout,*) ' flx: Losses in water conservation'
+         WRITE(numout,*) ' flx:   Masked ', SUM(zpew*e1t*e2t*tmask(:,:,1))
+         WRITE(numout,*) ' flx: Unmasked ', SUM(zpew*e1t*e2t)
+         WRITE(numout,*) ' flx: Simulation STOP'
+         CALL FLUSH(numout)
+         STOP
+      END IF
+      !
+#if defined key_cpl_discharge
+      ! Runoffs
+      var_id = recv_id(18)   ;   CALL cpl_prism_recv ( var_id, date, calving_recv, info )   ! ice discharge into ocean
+      var_id = recv_id(19)   ;   CALL cpl_prism_recv ( var_id, date, zrunriv     , info )   ! river discharge into ocean
+      var_id = recv_id(20)   ;   CALL cpl_prism_recv ( var_id, date, zruncot     , info )   ! continental discharge into ocean
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            zfact = zfacwat * tmask(ji,jj,1) 
+            calving_recv(ji,jj) =               calving_recv(ji,jj)   * zfact
+            rrunoff_recv(ji,jj) = ( zrunriv(ji,jj) + zruncot(ji,jj) ) * zfact
+         END DO
+      END DO
+#else
+      calving_recv(:,:) = 0.
+      rrunoff_recv(:,:) = 0.
+#endif
+
+!!gm  bug  :  this is not valid in mpp
+!!gm          and I presum this is not required at all as a lbc_lnk is applied to all the fields at the end of the routine
+      ! Oasis mask shift and update lateral boundary conditions (E. Maisonnave)
+      ! not tested when mpp is used, W. Park
+!WSPTEST
+      qsr_oce_recv (jpi-1,:) = qsr_oce_recv (1,:)
+      qsr_ice_recv (jpi-1,:) = qsr_ice_recv (1,:)
+      qns_oce_recv (jpi-1,:) = qns_oce_recv (1,:)
+      qns_ice_recv (jpi-1,:) = qns_ice_recv (1,:)
+      dqns_ice_recv(jpi-1,:) = dqns_ice_recv(1,:)
+      tprecip_recv (jpi-1,:) = tprecip_recv (1,:)
+      sprecip_recv (jpi-1,:) = sprecip_recv (1,:)
+      fr1_i0_recv  (jpi-1,:) = fr1_i0_recv  (1,:)
+      fr2_i0_recv  (jpi-1,:) = fr2_i0_recv  (1,:)
+      rrunoff_recv (jpi-1,:) = rrunoff_recv (1,:)
+      calving_recv (jpi-1,:) = calving_recv (1,:)
+!!gm end bug
+
+      qsr     (:,:) = qsr_oce_recv (:,:)      ! ocean surface boundary condition
+      qns     (:,:) = qns_oce_recv (:,:)
+      emp     (:,:) = zpew         (:,:)
+      emps    (:,:) = zpew         (:,:)
+      
+      qsr_ice (:,:) = qsr_ice_recv (:,:)      ! ice forcing fields
+      qns_ice (:,:) = qns_ice_recv (:,:)
+      dqns_ice(:,:) = dqns_ice_recv(:,:)
+      tprecip (:,:) = tprecip_recv (:,:)
+      sprecip (:,:) = sprecip_recv (:,:)
+      fr1_i0  (:,:) = fr1_i0_recv  (:,:)
+      fr2_i0  (:,:) = fr2_i0_recv  (:,:)
+      
+!WSP    rrunoff = rrunoff_recv 
+!WSP    calving = calving_recv
+      rrunoff (:,:) = 0.e0   !WSP runoff and calving included in tprecip
+      calving (:,:) = 0.e0   !WSP
+ 
+      IF(ln_ctl) THEN
+         WRITE(numout,*) 'flx:qsr_oce     - Minimum value is ', MINVAL( qsr_oce )
+         WRITE(numout,*) 'flx:qsr_oce     - Maximum value is ', MAXVAL( qsr_oce )
+         WRITE(numout,*) 'flx:qsr_oce     -     Sum value is ', SUM   ( qsr_oce )
+         !
+         WRITE(numout,*) 'flx:tprecip     - Minimum value is ', MINVAL( tprecip )
+         WRITE(numout,*) 'flx:tprecip     - Maximum value is ', MAXVAL( tprecip )
+         WRITE(numout,*) 'flx:tprecip     -     Sum value is ', SUM   ( tprecip )
+      ENDIF
+
+      CALL lbc_lnk( qsr_oce , 'T', 1. )
+      CALL lbc_lnk( qsr_ice , 'T', 1. )
+      CALL lbc_lnk( qns_oce , 'T', 1. )
+      CALL lbc_lnk( qns_ice , 'T', 1. )
+      CALL lbc_lnk( tprecip , 'T', 1. )
+      CALL lbc_lnk( sprecip , 'T', 1. )
+      CALL lbc_lnk( rrunoff , 'T', 1. )
+      CALL lbc_lnk( dqns_ice, 'T', 1. )
+      CALL lbc_lnk( calving , 'T', 1. )
+      CALL lbc_lnk( fr1_i0  , 'T', 1. )
+      CALL lbc_lnk( fr2_i0  , 'T', 1. )
+
+      IF(ln_ctl) THEN
+         WRITE(numout,*) 'flx(af lbc_lnk):qsr_oce     - Minimum value is ', MINVAL( qsr_oce )
+         WRITE(numout,*) 'flx(af lbc_lnk):qsr_oce     - Maximum value is ', MAXVAL( qsr_oce )
+         WRITE(numout,*) 'flx(af lbc_lnk):qsr_oce     -     Sum value is ', SUM   ( qsr_oce )
+         !
+         WRITE(numout,*) 'flx(af lbc_lnk):tprecip     - Minimum value is ', MINVAL( tprecip )
+         WRITE(numout,*) 'flx(af lbc_lnk):tprecip     - Maximum value is ', MAXVAL( tprecip )
+         WRITE(numout,*) 'flx(af lbc_lnk):tprecip     -     Sum value is ', SUM   ( tprecip )
+      ENDIF
+      !
+   END SUBROUTINE sbc_cpl
+
+#else
+   !!----------------------------------------------------------------------
+   !!   Dummy routine                              NO sea surface restoring
+   !!----------------------------------------------------------------------
+   LOGICAL, PUBLIC ::   lk_sbc_cpl = .FALSE.   !: coupled formulation flag
+CONTAINS
+   SUBROUTINE sbc_cpl( kt )         ! Dummy routine
+      WRITE(*,*) 'sbc_cpl: you should not have seen that print! error?', kt
+   END SUBROUTINE sbc_cpl
+#endif
+
+   !!======================================================================
+END MODULE sbccpl
Index: trunk/NEMO/OPA_SRC/SBC/sbcflx.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 888)
@@ -0,0 +1,199 @@
+MODULE sbcflx
+   !!======================================================================
+   !!                       ***  MODULE  sbcflx  ***
+   !! Ocean forcing:  momentum, heat and freshwater flux formulation
+   !!=====================================================================
+   !! History :  9.0   !  06-06  (G. Madec)  Original code
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   namflx   : flux formulation namlist
+   !!   sbc_flx  : flux formulation as ocean surface boundary condition
+   !!              (forced mode, fluxes read in NetCDF files)
+   !!----------------------------------------------------------------------
+   !! question diverses
+   !!  *   ajouter un test sur la division entier de freqh et rdttra ???
+   !!  **  ajoute dans namelist: 1 year forcing files
+   !!                         or forcing file starts at the begining of the run
+   !!  *** we assume that the forcing file start and end with the previous
+   !!      year last record and the next year first record (useful for
+   !!      time interpolation, required even if no time interp???)
+   !!  *   ajouter un test sur la division de la frequence en pas de temps
+   !!  ==> daymod ajout de nsec_year = number of second since the begining of the year
+   !!      assumed to be 0 at 0h january the 1st (i.e. 24h december the 31)
+   !!
+   !!  *** regrouper dtatem et dtasal
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE phycst          ! physical constants
+   USE daymod          ! calendar
+   USE ocfzpt          ! ocean freezing point
+   USE fldread         ! read input fields
+   USE iom             ! IOM library
+   USE in_out_manager  ! I/O manager
+   USE lib_mpp         ! distribued memory computing library
+   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC sbc_flx       ! routine called by step.F90
+
+   INTEGER , PARAMETER ::   jpfld   = 5   ! maximum number of files to read 
+   INTEGER , PARAMETER ::   jp_utau = 1   ! index of wind stress (i-component) file
+   INTEGER , PARAMETER ::   jp_vtau = 2   ! index of wind stress (j-component) file
+   INTEGER , PARAMETER ::   jp_qtot = 3   ! index of total (non solar+solar) heat file
+   INTEGER , PARAMETER ::   jp_qsr  = 4   ! index of solar heat file
+   INTEGER , PARAMETER ::   jp_emp  = 5   ! index of evaporation-precipation file
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf    ! structure of input fields (file informations, fields read)
+
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE sbc_flx( kt )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE sbc_flx  ***
+      !!                   
+      !! ** Purpose :   provide at each time step the surface ocean fluxes
+      !!                (momentum, heat, freshwater and runoff) 
+      !!
+      !! ** Method  : - READ each fluxes in NetCDF files:
+      !!                   i-component of the stress              utau  (N/m2)
+      !!                   j-component of the stress              vtau  (N/m2)
+      !!                   net downward heat flux                 qtot  (watt/m2)
+      !!                   net downward radiative flux            qsr   (watt/m2)
+      !!                   net upward freshwater (evapo - precip) emp   (kg/m2/s)
+      !!                Assumptions made:
+      !!                 - each file content an entire year (read record, not the time axis)
+      !!                 - first and last record are part of the previous and next year
+      !!                   (useful for time interpolation)
+      !!                 - the number of records is 2 + 365*24 / freqh(jf)
+      !!                   or 366 in leap year case
+      !!
+      !!      CAUTION :  - never mask the surface stress fields
+      !!                 - the stress is assumed to be in the mesh referential
+      !!                   i.e. the (i,j) referential
+      !!
+      !! ** Action  :   update at each time-step
+      !!              - utau  & vtau    : stress components in (i,j) referential
+      !!              - qns             : non solar heat flux
+      !!              - qsr             : solar heat flux
+      !!              - emp             : evap - precip (volume flux)
+      !!              - emps            : evap - precip (concentration/dillution)
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt   ! ocean time step
+      !!
+      INTEGER  ::   ji, jj, jf   ! dummy indices
+      INTEGER  ::   ierror       ! return error code
+      REAL(wp) ::   zfact        ! temporary scalar
+      !!
+      CHARACTER(len=100) ::  cn_dir                               ! Root directory for location of flx files
+      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i                    ! array of namelist information structures
+      TYPE(FLD_N) ::   sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp  ! informations about the fields to be read
+      NAMELIST/namsbc_flx/ cn_dir, sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp
+      !!---------------------------------------------------------------------
+   INTEGER , PARAMETER ::   jp_utau = 1   ! index of wind stress (i-component) file
+   INTEGER , PARAMETER ::   jp_vtau = 2   ! index of wind stress (j-component) file
+   INTEGER , PARAMETER ::   jp_qtot = 3   ! index of total (non solar+solar) heat file
+   INTEGER , PARAMETER ::   jp_qsr  = 4   ! index of solar heat file
+   INTEGER , PARAMETER ::   jp_emp  = 5   ! index of evaporation-precipation file
+
+
+      !                                         ! ====================== !
+      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
+         !                                      ! ====================== !
+         ! 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  ! starting !
+         !            !   name    !  (hours)  !   name     !   (T/F)    !  (0/1) !  record  !
+         sn_utau = FLD_N( 'utau.nc' ,    24.    ,  'utau'    ,  .FALSE.   ,    0   ,     0    )
+         sn_vtau = FLD_N( 'vtau.nc' ,    24.    ,  'vtau'    ,  .FALSE.   ,    0   ,     0    )
+         sn_qtot = FLD_N( 'qtot.nc' ,    24.    ,  'qtot'    ,  .FALSE.   ,    0   ,     0    )
+         sn_qsr  = FLD_N( 'qsr.nc'  ,    24.    ,  'qsr'     ,  .FALSE.   ,    0   ,     0    )
+         sn_emp  = FLD_N( 'emp.nc'  ,    24.    ,  'emp'     ,  .FALSE.   ,    0   ,     0    )
+
+         REWIND ( numnam )               ! ... read in namlist namflx
+         READ   ( numnam, namsbc_flx ) 
+
+         ! store namelist information in an array
+         slf_i(jp_utau) = sn_utau   ;   slf_i(jp_vtau) = sn_vtau
+         slf_i(jp_qtot) = sn_qtot   ;   slf_i(jp_qsr ) = sn_qsr 
+         slf_i(jp_emp ) = sn_emp
+
+         ! set sf structure
+         ALLOCATE( sf(jpfld), STAT=ierror )
+         IF( ierror > 0 ) THEN
+            CALL ctl_stop( 'sbc_flx: unable to allocate sf structure' )   ;   RETURN
+         ENDIF
+
+         DO jf = 1, jpfld
+            WRITE(sf(jf)%clrootname,'(a,a)' )   TRIM( cn_dir ), TRIM( slf_i(jf)%clname )
+            sf(jf)%freqh   = slf_i(jf)%freqh
+            sf(jf)%clvar   = slf_i(jf)%clvar
+            sf(jf)%ln_tint = slf_i(jf)%ln_tint
+            sf(jf)%nclim   = slf_i(jf)%nclim
+            sf(jf)%nstrec  = slf_i(jf)%nstrec
+         END DO
+
+         IF(lwp) THEN      ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) 'sbc_flx : flux formulation for ocean surface boundary condition'
+            WRITE(numout,*) '~~~~~~~ '
+            WRITE(numout,*) '          namsbc_flx Namelist'
+            WRITE(numout,*) '          list of files and frequency (>0: in hours ; <0 in months)'
+            DO jf = 1, jpfld
+                WRITE(numout,*) '               root filename: '  , trim( sf(jf)%clrootname ),   &
+                   &                          ' variable name: '  , trim( sf(jf)%clvar      )
+                WRITE(numout,*) '               frequency: '      ,       sf(jf)%freqh       ,   &
+                   &                          ' time interp: '    ,       sf(jf)%ln_tint     ,   &
+                   &                          ' climatology: '    ,       sf(jf)%nclim       ,   &
+                   &                          ' starting record: ',       sf(jf)%nstrec
+            END DO
+         ENDIF
+         !
+      ENDIF
+
+      CALL fld_read( kt, nn_fsbc, sf )           ! Read input fields and provides the
+      !                                          ! input fields at the current time-step
+
+      ! set the ocean fluxes from read fields
+!CDIR COLLAPSE
+      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)
+         END DO
+      END DO
+
+      ! control print (if less than 100 time-step asked)
+      IF( nitend-nit000 <= 100 .AND. lwp ) THEN
+         WRITE(numout,*) 
+         WRITE(numout,*) '        read daily momentum, heat and freshwater fluxes OK'
+         DO jf = 1, jpfld
+            IF( jf == jp_utau .OR. jf == jp_vtau )   zfact =     1.
+            IF( jf == jp_qtot .OR. jf == jp_qsr  )   zfact =     0.1
+            IF( jf == jp_emp                     )   zfact = 86400.
+            WRITE(numout,*) 
+            WRITE(numout,*) ' day: ', ndastp , TRIM(sf(jf)%clvar), ' * ', zfact
+            CALL prihre( sf(jf)%fnow, jpi, jpj, 1, jpi, 20, 1, jpj, 10, 1., numout )
+         END DO
+         CALL FLUSH(numout)
+      ENDIF
+      !
+   END SUBROUTINE sbc_flx
+
+   !!======================================================================
+END MODULE sbcflx
Index: trunk/NEMO/OPA_SRC/SBC/sbcfwb.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 888)
@@ -0,0 +1,150 @@
+MODULE sbcfwb
+   !!======================================================================
+   !!                       ***  MODULE  sbcfwb  ***
+   !! Ocean fluxes   : domain averaged freshwater budget
+   !!======================================================================
+   !! History :  8.2  !  01-02  (E. Durand)  Original code
+   !!            8.5  !  02-06  (G. Madec)  F90: Free form and module
+   !!            9.0  !  06-08  (G. Madec)  Surface module
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   sbc_fwb      : freshwater budget for global ocean configurations
+   !!                  in free surface and forced mode
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! surface ocean boundary condition
+   USE cpl_oce         ! coupled atmosphere/ocean
+   USE phycst          ! physical constants
+   USE sbcrnf          ! ocean runoffs
+   USE daymod          ! calendar
+   USE in_out_manager  ! I/O manager
+   USE lib_mpp         ! distribued memory computing library
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   sbc_fwb      ! routine called by step
+
+   REAL(wp) ::   a_fwb_b            ! annual domain averaged freshwater budget
+   REAL(wp) ::   a_fwb              ! for 2 year before (_b) and before year.
+   REAL(wp) ::   empold             ! empold to be suppressed
+   REAL(wp) ::   area               ! global mean ocean surface (interior domain)
+
+   REAL(wp), DIMENSION(jpi,jpj) ::   e1e2_i    ! area of the interior domain (e1t*e2t*tmask_i)
+
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!  OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE sbc_fwb( kt, kn_fwb, kn_fsbc )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE sbc_fwb  ***
+      !!
+      !! ** Purpose :   Control the mean sea surface drift
+      !!
+      !! ** Method  :   several ways  depending on kn_fwb
+      !!                =0 no control 
+      !!                =1 annual global mean corrected from previous year
+      !!                =2 global mean of emp set to zero at each nn_fsbc time step
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   kt       ! ocean time-step index
+      INTEGER, INTENT( in ) ::   kn_fsbc  ! 
+      INTEGER, INTENT( in ) ::   kn_fwb   ! ocean time-step index
+      !!
+      INTEGER  ::   inum = 11             ! temporary logical unit
+      INTEGER  ::   ikty, iyear           ! 
+      LOGICAL  ::   llbon
+      CHARACTER (len=32) ::   clname = 'EMPave_old.dat'
+      REAL(wp) ::   z_emp                 ! temporary scalars
+      !!----------------------------------------------------------------------
+      !
+      IF( kt == nit000 ) THEN
+         !
+         IF(lwp) THEN
+            WRITE(numout,*)
+            WRITE(numout,*) 'sbc_fwb : FreshWater Budget correction'
+            WRITE(numout,*) '~~~~~~~'
+            IF( kn_fwb == 1 )   WRITE(numout,*) '          instantaneously set to zero'
+            IF( kn_fwb == 2 )   WRITE(numout,*) '          adjusted from previous year budget'
+         ENDIF
+         !
+         e1e2_i(:,:) = e1t(:,:) * e2t(:,:) * tmask_i(:,:)
+         area = SUM( e1e2_i(:,:) )
+         IF( lk_mpp )   CALL  mpp_sum( area    )   ! sum over the global domain
+         !
+      ENDIF
+      
+
+      SELECT CASE ( kn_fwb )
+      !
+      CASE ( 1 )                               ! global mean emp set to zero
+         IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN
+            z_emp = SUM( e1e2_i(:,:) * emp(:,:) ) / area
+            IF( lk_mpp )   CALL  mpp_sum( z_emp    )   ! sum over the global domain
+            emp (:,:) = emp (:,:) - z_emp
+            emps(:,:) = emps(:,:) - z_emp
+         ENDIF
+         !
+      CASE ( 2 )                               ! emp budget adjusted from the previous year
+         ! initialisation
+         IF( kt == nit000 ) THEN
+            ! Read the corrective factor on precipitations (empold)
+            INQUIRE( FILE=clname, EXIST=llbon )
+            IF( llbon ) THEN
+               OPEN ( inum, FILE=clname)
+               READ ( inum, "(24X,I8,2ES24.16)" ) iyear, a_fwb_b, a_fwb
+               CLOSE( inum )
+               empold = a_fwb                  ! current year freshwater budget correction
+               !                               ! estimate from the previous year budget
+               IF(lwp)WRITE(numout,*)
+               IF(lwp)WRITE(numout,*)'sbc_fwb : year = ',iyear  , ' freshwater budget correction = ', empold
+               IF(lwp)WRITE(numout,*)'          year = ',iyear-1, ' freshwater budget read       = ', a_fwb
+               IF(lwp)WRITE(numout,*)'          year = ',iyear-2, ' freshwater budget read       = ', a_fwb_b
+            ELSE
+               WRITE(ctmp1,*)'sbc_fwb : unable to read the file', clname
+               CALL ctl_stop( ctmp1 )
+            ENDIF
+         ENDIF
+         ! 
+         ! Update empold if new year start
+         ikty = 365 * 86400 / rdttra(1)    !!bug  use of 365 days leap year or 360d year !!!!!!!
+         IF( MOD( kt, ikty ) == 0 ) THEN
+            a_fwb_b = a_fwb
+            a_fwb   = SUM( e1e2_i(:,:) * sshn(:,:) )
+            IF( lk_mpp )   CALL  mpp_sum( a_fwb    )   ! sum over the global domain
+            a_fwb   = a_fwb * 1.e+3 / ( area * 86400. * 365. )     ! convert in Kg/m3/s = mm/s
+!!gm        !                                                      !!bug 365d year 
+            empold =  a_fwb                 ! current year freshwater budget correction
+            !                               ! estimate from the previous year budget
+         ENDIF
+         ! 
+         ! correct the freshwater fluxes
+         IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN
+            emp (:,:) = emp (:,:) - empold
+            emps(:,:) = emps(:,:) - empold
+         ENDIF
+         !
+         ! save empold value in a file
+         IF( kt == nitend ) THEN
+            OPEN( inum, FILE='EMPave.dat' )
+            WRITE(inum, "(24X,I8,2ES24.16)" ) nyear, a_fwb_b, a_fwb
+         ENDIF
+         !
+      CASE DEFAULT    ! you should never be there
+         WRITE(ctmp1,*)'sbc_fwb : nn_fwb = ', kn_fwb, ' is not permitted for the FreshWater Budget correction, choose either 0/1/2'
+         CALL ctl_stop( ctmp1 )
+         !
+      END SELECT
+      !
+   END SUBROUTINE sbc_fwb
+
+   !!======================================================================
+END MODULE sbcfwb
Index: trunk/NEMO/OPA_SRC/SBC/sbcice_if.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcice_if.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcice_if.F90	(revision 888)
@@ -0,0 +1,159 @@
+MODULE sbcice_if
+   !!======================================================================
+   !!                       ***  MODULE  sbcice  ***
+   !! Surface module :  update surface ocean boundary condition over ice
+   !!                   covered area using ice-if model
+   !!======================================================================
+   !! History :  9.0   !  06-06  (G. Madec)  Original code
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   sbc_ice_if     : update sbc in ice-covered area
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE phycst          ! physical constants
+   USE ocfzpt          ! ocean freezing point
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE fldread         ! read input field
+   USE iom             ! I/O manager library
+   USE in_out_manager  ! I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   sbc_ice_if      ! routine called in sbcmod
+
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_ice   ! structure of input ice-cover (file informations, fields read)
+   
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE sbc_ice_if( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE sbc_ice_if  ***
+      !!
+      !! ** Purpose :   handle surface boundary condition over ice cover area
+      !!      when sea-ice model are not used
+      !!
+      !! ** Method  : - read sea-ice cover climatology
+      !!              - blah blah blah, ...
+      !!
+      !! ** Action  :   qns, qsr:  update heat flux below sea-ice
+      !!                emp, emps: update freshwater flux below sea-ice
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in)          ::   kt         ! ocean time step
+      !
+      CHARACTER(len=100) ::   cn_dir              ! Root directory for location of ice-if files
+      TYPE(FLD_N)        ::   sn_ice              ! informations about the fields to be read
+      NAMELIST/namsbc_iif/ cn_dir, sn_ice
+      !
+      INTEGER  ::   ji, jj     ! dummy loop indices
+      INTEGER  ::   ierror     ! return error code
+      REAL(wp) ::   ztrp, zsice, zt_fzp, zicover_obs, zicover_opa
+      REAL(wp) ::   zqri, zqrj, zqrp, zqi
+      !!---------------------------------------------------------------------
+      !                                         ! ====================== !
+      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
+         !                                      ! ====================== !
+         ! 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  ! starting !
+         !            !   name    !  (hours)  !   name     !   (T/F)    !  (0/1) !  record  !
+         sn_ice = FLD_N('ice_cover',   -12.   ,  'ice_cov'  ,  .TRUE.    ,    1   ,     0    )
+
+         REWIND ( numnam )               ! ... read in namlist namiif
+         READ   ( numnam, namsbc_iif )
+
+         ALLOCATE( sf_ice(1), STAT=ierror )
+         IF( ierror > 0 ) THEN
+            CALL ctl_stop( 'sbc_ice_if: unable to allocate sf_ice structure' )   ;   RETURN
+         ENDIF
+
+         ! store namelist information in sf_ice structure
+         WRITE(sf_ice(1)%clrootname,'(a,a)' )   TRIM( cn_dir ), TRIM( sn_ice%clname )
+         sf_ice(1)%freqh   = sn_ice%freqh
+         sf_ice(1)%clvar   = sn_ice%clvar
+         sf_ice(1)%ln_tint = sn_ice%ln_tint
+         sf_ice(1)%nclim   = sn_ice%nclim
+         sf_ice(1)%nstrec  = sn_ice%nstrec
+
+         IF(lwp) THEN      ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) 'sbc_ice_if : ice-if sea-ice model'
+            WRITE(numout,*) '~~~~~~~~~~ '
+            WRITE(numout,*) '   ice-cover data in the following file: '
+            WRITE(numout,*) '          list of files and frequency (>0: in hours ; <0 in months)'
+            WRITE(numout,*) '               root filename: '  , trim( sf_ice(1)%clrootname ),   &
+               &                          ' variable name: '  , trim( sf_ice(1)%clvar      )
+            WRITE(numout,*) '               frequency: '      ,       sf_ice(1)%freqh       ,   &
+               &                          ' time interp: '    ,       sf_ice(1)%ln_tint     ,   &
+               &                          ' climatology: '    ,       sf_ice(1)%nclim       ,   &
+               &                          ' starting record: ',       sf_ice(1)%nstrec
+         ENDIF
+         !
+      ENDIF
+
+      CALL fld_read( kt, nn_fsbc, sf_ice )           ! Read input fields and provides the
+      !                                              ! input fields at the current time-step
+      
+      IF( MOD( kt-1, nn_fsbc) == 0 ) THEN
+         !
+         ztrp = -40.             ! restoring terme for temperature (w/m2/k)
+         zsice = - 0.04 / 0.8    ! ratio of isohaline compressibility over isotherme compressibility
+                                 ! ( d rho / dt ) / ( d rho / ds )      ( s = 34, t = -1.8 )
+         ! Flux computation
+!CDIR COLLAPSE
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ! ... sea surface freezing point temperature [Celcius]
+               zt_fzp = (  ( - 0.0575 + 1.710523e-3 * SQRT( sss_m(ji,jj) )   &
+            &                         - 2.154996e-4 *       sss_m(ji,jj)   ) * sss_m(ji,jj)  ) * tmask(ji,jj,1)
+            
+               ! ... indicators : ice cover (obs, ocean model) & hemisphere (=1 north, =-1 south)
+               zicover_obs = sf_ice(1)%fnow(ji,jj)                                                ! observed 
+               zicover_opa = MAX( 0., SIGN( 1., zt_fzp - sst_m(ji,jj) )  ) * tmask(ji,jj,1)   ! model   
+
+               ! ... avoid over-freezing point temperature
+               tn(ji,jj,1) = MAX( tn(ji,jj,1), zt_fzp )
+
+               ! ... solar heat flux : zero below observed ice cover
+               qsr(ji,jj) = ( 1. - zicover_obs ) * qsr(ji,jj)
+
+               ! ... non solar heat flux : add a damping term 
+               !      - gamma*(t-(tgel-1.))  if observed ice and no opa ice   (zicover_obs=1 zicover_opa=0)
+               !      - gamma*min(0,t-tgel)  if observed ice and opa ice      (zicover_obs=1 zicover_opa=1)
+
+               zqri = ztrp * ( tb(ji,jj,1) - ( zt_fzp - 1.) )
+               zqrj = ztrp * MIN( 0., tb(ji,jj,1) - zt_fzp )
+
+               zqrp =  ( zicover_obs * ( (1. - zicover_opa ) * zqri    &
+                 &                      +      zicover_opa   * zqrj ) ) * tmask(ji,jj,1)
+
+               ! c) net downward heat flux q() = q0 + qrp()
+               ! for q0
+               ! # qns unchanged              if no climatological ice              (zicover_obs=0)
+               ! # qns = zqrp                 if climatological ice and no opa ice  (zicover_obs=1, zicover_opa=0)
+               ! # qns = zqrp -2(-4) watt/m2  if climatological ice and opa ice     (zicover_obs=1, zicover_opa=1)
+               ! (-2=arctic, -4=antarctic)   
+               zqi = -3. + SIGN( 1.e0, ff(ji,jj) )
+               qns(ji,jj) = ( ( 1.- zicover_obs ) * qns(ji,jj)   &
+                  &          +      zicover_obs   * zicover_opa * zqi ) * tmask(ji,jj,1)   &
+                  &       + zqrp
+            END DO
+         END DO
+         !
+      ENDIF
+      !
+   END SUBROUTINE sbc_ice_if
+
+   !!======================================================================
+END MODULE sbcice_if
Index: trunk/NEMO/OPA_SRC/SBC/sbcice_lim.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 888)
@@ -0,0 +1,763 @@
+MODULE sbcice_lim
+   !!======================================================================
+   !!                       ***  MODULE  sbcice_lim  ***
+   !! Surface module :  update surface ocean boundary condition over ice
+   !!                   covered area using LIM sea-ice model
+   !! Sea-Ice model  :  LIM 3.0 Sea ice model time-stepping
+   !!======================================================================
+   !! History :  9.0   !  06-12  (M. Vancoppenolle) Original code
+   !!            9.0   !  06-06  (G. Madec)  Surface module from icestp.F90
+   !!----------------------------------------------------------------------
+#if defined key_lim3
+   !!----------------------------------------------------------------------
+   !!   'key_lim3' :                                  LIM 3.0 sea-ice model
+   !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !!   sbc_ice_lim  : sea-ice model time-stepping and
+   !!                  update ocean sbc over ice-covered area
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE par_ice         ! sea-ice parameters
+   USE ice
+   USE iceini
+   USE ice_oce         ! ice variables
+   USE dom_ice
+   USE cpl_oce
+
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE sbc_ice         ! Surface boundary condition: ice   fields
+   USE sbcblk_core     ! Surface boundary condition: CORE bulk
+   USE sbcblk_clio     ! Surface boundary condition: CLIO bulk
+   USE albedo
+
+   USE daymod          ! day calendar
+   USE phycst          ! Define parameters for the routines
+   USE eosbn2          ! equation of state
+   USE limdyn          ! Ice dynamics
+   USE limtrp          ! Ice transport
+   USE limthd          ! Ice thermodynamics
+   USE limitd_th       ! Thermodynamics on ice thickness distribution 
+   USE limitd_me       ! Mechanics on ice thickness distribution
+   USE limsbc          ! sea surface boundary condition
+   USE limdia          ! Ice diagnostics
+   USE limwri          ! Ice outputs
+   USE limrst          ! Ice restarts
+   USE limupdate       ! update of global variables
+   USE limvar          ! Ice variables switch
+
+   USE lbclnk
+   USE iom             ! I/O manager library
+   USE in_out_manager  ! I/O manager
+   USE prtctl          ! Print control
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC sbc_ice_lim  ! routine called by sbcmod.F90
+   
+   CHARACTER(len=1) ::   cl_grid = 'C'     ! type of grid used in ice dynamics
+
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE sbc_ice_lim( kt, kblk )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE sbc_ice_lim  ***
+      !!                   
+      !! ** Purpose :   update the ocean surface boundary condition via the 
+      !!                Louvain la Neuve Sea Ice Model time stepping 
+      !!
+      !! ** Method  :   ice model time stepping
+      !!              - call the ice dynamics routine 
+      !!              - call the ice advection/diffusion routine 
+      !!              - call the ice thermodynamics routine 
+      !!              - call the routine that computes mass and 
+      !!                heat fluxes at the ice/ocean interface
+      !!              - save the outputs 
+      !!              - save the outputs for restart when necessary
+      !!
+      !! ** Action  : - time evolution of the LIM sea-ice model
+      !!              - update all sbc variables below sea-ice:
+      !!                utau, vtau, qns , qsr, emp , emps
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt      ! ocean time step
+      INTEGER, INTENT(in) ::   kblk    ! type of bulk (=3 CLIO, =4 CORE)
+      !!
+      INTEGER  ::   ji, jj, jk, jl     ! dummy loop indices
+      INTEGER  ::   indx               ! indexes for ice points
+      INTEGER  ::   numaltests         ! number of alert tests (max 20)
+      INTEGER  ::   alert_id           ! number of the current alert
+      REAL(wp) ::   ztmelts            ! ice layer melting point
+      INTEGER , DIMENSION(20) ::  numal                     ! number of alerts positive
+      CHARACTER (len=30), DIMENSION(20) ::   alname      ! name of alert
+      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   alb_ice_os   ! albedo of the ice under overcast sky
+      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   alb_ice_cs   ! albedo of ice under clear sky
+      !!----------------------------------------------------------------------
+
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'sbc_ice_lim : update ocean surface boudary condition' 
+         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~   via Louvain la Neuve Ice Model (LIM) time stepping'
+
+         CALL ice_init
+
+         !+++++
+         indx = 12
+         jiindx = 44
+         jjindx = 140
+         WRITE(numout,*) ' The debugging point is : jiindx : ',jiindx,  &
+                                                  ' jjindx : ',jjindx
+         !+++++
+
+      ENDIF
+
+      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN
+         !
+         ! ... mean surface ocean current at ice dynamics point
+         !     C-grid dynamics :  U- & V-points as the ocean
+         DO jj = 2, jpj
+            DO ji = fs_2, jpi
+               u_oce(ji,jj) = ssu_m(ji,jj) * tmu(ji,jj)
+               v_oce(ji,jj) = ssv_m(ji,jj) * tmv(ji,jj)
+            END DO
+         END DO
+         CALL lbc_lnk( u_oce, 'U', -1. )   ! U-point
+         CALL lbc_lnk( v_oce, 'V', -1. )   ! V-point
+
+         ! ... masked sea surface freezing temperature [Kelvin] (set to rt0 over land)
+!old fashion         zsss_m (:,:) = SQRT( sss_m(:,:) )
+!old fashion         zsss2_m(:,:) = sss_m(:,:) * sss_m(:,:)
+!old fashion         zsss3_m(:,:) = zsss_m(:,:) * zsss_m(:,:) * zsss_m(:,:)
+!old fashion
+!old fashion         DO jj = 1, jpj
+!old fashion            DO ji = 1, jpi
+!old fashion               t_bo(ji,jj)  = ABS ( rt0 - 0.0575      * sss_m(ji,jj)      &
+!old fashion                  &                    + 1.710523e-03 * zsss3_m(ji,jj)    &
+!old fashion                  &                    - 2.154996e-04 * zsss2_m(ji,jj) )  &
+!old fashion                            * tms(ji,jj)
+!old fashion            END DO
+!old fashion         END DO
+         t_bo(:,:) = tfreez( sss_m ) +  rt0 
+
+
+         ! ... ice albedo
+         CALL albedo_ice( t_su, ht_i, ht_s, alb_ice_cs, alb_ice_os )
+
+         ! ... Sea-ice surface boundary conditions output from bulk formulae :
+         !     - utaui_ice  ! surface ice stress i-component (I-point)   [N/m2]
+         !     - vtaui_ice  ! surface ice stress j-component (I-point)   [N/m2]
+         !     - qns_ice    ! non solar heat flux over ice   (T-point)   [W/m2]
+         !     - qsr_ice    !     solar heat flux over ice   (T-point)   [W/m2]
+         !     - qla_ice    ! latent    heat flux over ice   (T-point)   [W/m2]
+         !     - dqns_ice   ! non solar heat sensistivity    (T-point)   [W/m2]
+         !     - dqla_ice   ! latent    heat sensistivity    (T-point)   [W/m2]
+         !     - tprecip    ! total precipitation            (T-point)   [Kg/m2/s]
+         !     - sprecip    ! solid precipitation            (T-point)   [Kg/m2/s]
+         !     - fr1_i0     ! 1sr fraction of qsr penetration in ice     [%]
+         !     - fr2_i0     ! 2nd fraction of qsr penetration in ice     [%]
+         !
+         SELECT CASE( kblk )
+         CASE( 3 )           ! CLIO bulk formulation
+            CALL blk_ice_clio( t_su , u_ice , v_ice   , alb_ice_cs, alb_ice_os,            &
+               &                             utaui_ice, vtaui_ice , qns_ice   , qsr_ice,   &
+               &                             qla_ice  , dqns_ice  , dqla_ice  ,            &
+               &                             tprecip  , sprecip   ,                        &
+               &                             fr1_i0   , fr2_i0    , cl_grid  )
+         CASE( 4 )           ! CORE bulk formulation
+            CALL blk_ice_core( t_su , u_ice , v_ice   , alb_ice_cs,                      &
+               &                             utaui_ice, vtaui_ice , qns_ice , qsr_ice,   &
+               &                             qla_ice  , dqns_ice  , dqla_ice,            &
+               &                             tprecip  , sprecip   ,                      &
+               &                             fr1_i0   , fr2_i0    , cl_grid  )
+         END SELECT
+
+         IF(ln_ctl) THEN         ! print mean trends (used for debugging)
+            CALL prt_ctl_info( 'Ice Forcings ' )
+            CALL prt_ctl( tab2d_1=tprecip  ,clinfo1=' sbc_ice_lim: precip   : ' )
+            CALL prt_ctl( tab2d_1=utaui_ice,clinfo1=' sbc_ice_lim: utaui_ice: ', tab2d_2=vtaui_ice, clinfo2=' vtaui_ice: ' )
+            CALL prt_ctl( tab2d_1=sst_m    ,clinfo1=' sbc_ice_lim: sst      : ', tab2d_2=sss_m    , clinfo2=' sss      : ' )
+            CALL prt_ctl( tab2d_1=u_oce    ,clinfo1=' sbc_ice_lim: u_io     : ', tab2d_2=v_oce    , clinfo2=' v_io     : ' )
+            CALL prt_ctl( tab2d_1=frld     ,clinfo1=' sbc_ice_lim: frld   1 : ' )
+            !
+            DO jl = 1, jpl
+               CALL prt_ctl_info('* - category number ', ivar1=jl)
+               CALL prt_ctl(tab3d_1=t_su    , clinfo1=' sbc_ice_lim: t_su      : ', kdim=jl)
+               CALL prt_ctl(tab3d_1=qsr_ice , clinfo1=' sbc_ice_lim: qsr_ice   : ', kdim=jl)
+               CALL prt_ctl(tab3d_1=qns_ice , clinfo1=' sbc_ice_lim: qns_ice   : ', kdim=jl)
+               CALL prt_ctl(tab3d_1=dqns_ice, clinfo1=' sbc_ice_lim: dqns_ice  : ', kdim=jl)
+               CALL prt_ctl(tab3d_1=qla_ice , clinfo1=' sbc_ice_lim: qla_ice   : ', kdim=jl)
+               CALL prt_ctl(tab3d_1=dqla_ice, clinfo1=' sbc_ice_lim: dqla_ice  : ', kdim=jl)
+            END DO
+            !
+         ENDIF
+
+         !------------------------------------------------
+         ! Store old values of ice model global variables
+         !------------------------------------------------
+
+         old_a_i(:,:,:)   = a_i(:,:,:)     ! ice area
+         old_e_i(:,:,:,:) = e_i(:,:,:,:)   ! ice thermal energy
+         old_v_i(:,:,:)   = v_i(:,:,:)     ! ice volume
+         old_v_s(:,:,:)   = v_s(:,:,:)     ! snow volume 
+         old_e_s(:,:,:,:) = e_s(:,:,:,:)   ! snow thermal energy
+         old_smv_i(:,:,:) = smv_i(:,:,:)   ! salt content
+         old_oa_i(:,:,:)  = oa_i(:,:,:)    ! areal age content
+
+         d_a_i_thd(:,:,:)   = 0.e0 ; d_a_i_trp(:,:,:)   = 0.e0
+         d_v_i_thd(:,:,:)   = 0.e0 ; d_v_i_trp(:,:,:)   = 0.e0
+         d_e_i_thd(:,:,:,:) = 0.e0 ; d_e_i_trp(:,:,:,:) = 0.e0
+         d_v_s_thd(:,:,:)   = 0.e0 ; d_v_s_trp(:,:,:)   = 0.e0
+         d_e_s_thd(:,:,:,:) = 0.e0 ; d_e_s_trp(:,:,:,:) = 0.e0
+         d_smv_i_thd(:,:,:) = 0.e0 ; d_smv_i_trp(:,:,:) = 0.e0
+         d_oa_i_thd(:,:,:)  = 0.e0 ; d_oa_i_trp(:,:,:)  = 0.e0
+
+         emps(:,:)      = 0.e0     ; fseqv(:,:)     = 0.e0
+         fsbri(:,:)     = 0.e0     ; fsalt_res(:,:) = 0.e0
+         fsalt_rpo(:,:) = 0.e0
+         fhmec(:,:)     = 0.e0     ; fhbri(:,:)     = 0.e0
+         fmmec(:,:)     = 0.e0     ; fheat_res(:,:) = 0.e0
+         fheat_rpo(:,:) = 0.e0     ; focea2D(:,:)   = 0.e0
+         fsup2D(:,:)    = 0.e0
+
+         diag_sni_gr(:,:) = 0.e0   ; diag_lat_gr(:,:) = 0.e0
+         diag_bot_gr(:,:) = 0.e0   ; diag_dyn_gr(:,:) = 0.e0
+         diag_bot_me(:,:) = 0.e0   ; diag_sur_me(:,:) = 0.e0
+
+         ! dynamical invariants
+         delta_i(:,:) = 0.e0
+         divu_i(:,:)  = 0.e0
+         shear_i(:,:) = 0.e0
+
+         !----------------!
+         ! Ice model step !
+         !----------------!
+                         numit = numit + nn_fsbc
+                         CALL lim_rst_opn( kt )          ! Open Ice restart file
+                         !+++++
+                         WRITE(numout,*) ' - Beginning the time step - '
+                         CALL lim_inst_state(jiindx,jjindx,1)
+                         WRITE(numout,*) ' '
+                         !+++++
+         !---------------------|
+         ! Dynamical processes |       
+         !---------------------|
+                         CALL lim_dyn                    ! Ice dynamics    ( rheology/dynamics )
+                         CALL lim_trp                    ! Ice transport   ( Advection/diffusion )
+                         CALL lim_var_agg(1)             ! aggregate categories, requested
+                         CALL lim_var_glo2eqv            ! equivalent variables, requested for rafting
+                         !+++++
+                         WRITE(numout,*) ' - After ice dynamics and transport '
+                         CALL lim_inst_state(jiindx,jjindx,1)
+                         WRITE(numout,*) ' '
+                         WRITE(numout,*)
+                         WRITE(numout,*) ' Mechanical Check ************** '
+                         WRITE(numout,*) ' Check what means ice divergence '
+                         WRITE(numout,*) ' Total ice concentration ', at_i (jiindx,jjindx)
+                         WRITE(numout,*) ' Total lead fraction     ', ato_i(jiindx,jjindx)
+                         WRITE(numout,*) ' Sum of both             ', ato_i(jiindx,jjindx) + at_i(jiindx,jjindx)
+                         WRITE(numout,*) ' Sum of both minus 1     ', ato_i(jiindx,jjindx) + at_i(jiindx,jjindx) - 1.00
+                         !+++++
+                         CALL lim_itd_me                 ! Mechanical redistribution ! (ridging/rafting)
+         !--------------------|
+         ! Ice thermodynamics |
+         !--------------------|
+                         CALL lim_var_glo2eqv            ! equivalent variables
+                         CALL lim_var_agg(1)             ! aggregate ice categories
+                         CALL lim_var_bv                 ! bulk brine volume (diag)
+                         CALL lim_thd                    ! Ice thermodynamics 
+                         oa_i(:,:,:) = oa_i(:,:,:)   &
+                            &         + a_i(:,:,:)   &
+                            &         * rdt_ice      &
+                            &         / 86400.00         ! Ice natural aging
+                         CALL lim_var_glo2eqv            ! except info message that follows, 
+                         !                               ! this CALL is maybe not necessary
+                         !+++++
+                         WRITE(numout,*) ' - After ice thermodynamics '
+                         CALL lim_inst_state(jiindx,jjindx,1)
+                         !+++++
+                         CALL lim_itd_th                 !  Remap ice categories, lateral accretion  !
+         !-------------------------|
+         ! Global variables update |
+         !-------------------------|
+                         CALL lim_var_agg(1)             ! requested by limupdate
+                         CALL lim_update                 ! Global variables update
+                         CALL lim_var_glo2eqv            ! equivalent variables (outputs)
+                         CALL lim_var_agg(2)             ! aggregate ice thickness categories
+                         !+++++
+                         IF(ln_nicep) THEN
+                            WRITE(numout,*) ' - Final ice state after lim_update '
+                            CALL lim_inst_state(jiindx,jjindx,2)
+                            WRITE(numout,*) ' '
+                         ENDIF
+                         !+++++
+         !--------------------------------------|
+         ! Fluxes of mass and heat to the ocean |
+         !--------------------------------------|
+                         CALL lim_sbc( kt )              ! Ice/Ocean Mass & Heat fluxes 
+                         !+++++
+                         WRITE(numout,*) ' - Final ice state after lim_flx    '
+                         CALL lim_inst_state(jiindx,jjindx,3)
+                         WRITE(numout,*) ' '
+                         !+++++
+         !-------------------------|
+         ! Diagnostics and outputs |
+         !-------------------------|
+         IF( MOD( kt+nn_fsbc-1, ninfo ) == 0 .OR. ntmoy == 1 )   &
+          &              CALL lim_dia                    ! Ice Diagnostics 
+                         CALL lim_wri      ( 1  )        ! Ice outputs 
+         IF( lrst_ice )  CALL lim_rst_write( kt )        ! Ice restart file 
+                         CALL lim_var_glo2eqv
+         !
+         ! Re-initialization of forcings
+         qsr     (:,:)   = 0.e0
+         qns     (:,:)   = 0.e0
+         tprecip (:,:)   = 0.e0 
+         sprecip (:,:)   = 0.e0
+         qsr_ice (:,:,:) = 0.e0
+         qns_ice (:,:,:) = 0.e0 
+         dqns_ice(:,:,:) = 0.e0 
+#if ! defined key_coupled 
+         qla_ice (:,:,:) = 0.e0
+         dqla_ice(:,:,:) = 0.e0
+         fr1_i0  (:,:)   = 0.e0
+         fr2_i0  (:,:)   = 0.e0
+#else
+         rrunoff (:,:)   = 0.e0
+         calving (:,:)   = 0.e0
+#endif
+         !
+         !-------------------------------|
+         ! Alerts in case of model crash |
+         !-------------------------------|
+
+         numaltests = 10
+         numal(:) = 0
+
+         ! Alert if incompatible volume and concentration
+         alert_id = 2 ! reference number of this alert
+         alname(alert_id) = ' Incompat vol and con         ' ! name of the alert
+
+         DO jl = 1, jpl
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                     IF ((v_i(ji,jj,jl).NE.0.0).AND.(a_i(ji,jj,jl).EQ.0.0)) THEN
+                        WRITE(numout,*) ' ALERTE 2 '
+                        WRITE(numout,*) ' Incompatible volume and concentration '
+                        WRITE(numout,*) ' at_i     ', at_i(ji,jj)
+                        WRITE(numout,*) ' Point - category', ji, jj, jl
+                        WRITE(numout,*)
+                        WRITE(numout,*) ' a_i *** a_i_old ', a_i(ji,jj,jl), old_a_i(ji,jj,jl)
+                        WRITE(numout,*) ' v_i *** v_i_old ', v_i(ji,jj,jl), old_v_i(ji,jj,jl)
+                        WRITE(numout,*) ' d_a_i_thd/trp   ', d_a_i_thd(ji,jj,jl), d_a_i_trp(ji,jj,jl)
+                        WRITE(numout,*) ' d_v_i_thd/trp   ', d_v_i_thd(ji,jj,jl), d_v_i_trp(ji,jj,jl)
+                        numal(alert_id) = numal(alert_id) + 1
+                     ENDIF
+               END DO
+            END DO
+         END DO
+
+         ! Alerte if very thick ice
+         alert_id = 3 ! reference number of this alert
+         alname(alert_id) = ' Very thick ice               ' ! name of the alert
+         jl = jpl 
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF (ht_i(ji,jj,jl) .GT. 50.0 ) THEN
+                  WRITE(numout,*) ' ALERTE 3 '
+                  WRITE(numout,*) ' Very thick ice '
+                  CALL lim_inst_state(ji,jj,2)
+                  WRITE(numout,*) ' '
+                  numal(alert_id) = numal(alert_id) + 1
+               ENDIF
+            END DO
+         END DO
+
+         ! Alert if very fast ice
+         alert_id = 4 ! reference number of this alert
+         alname(alert_id) = ' Very fast ice               ' ! name of the alert
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF ( ( ( ABS( u_ice(ji,jj) ) .GT. 0.50) .OR. &
+                      ( ABS( v_ice(ji,jj) ) .GT. 0.50) ) .AND. &
+                    ( at_i(ji,jj) .GT. 0.0 ) ) THEN
+                  WRITE(numout,*) ' ALERTE 4 '
+                  WRITE(numout,*) ' Very fast ice '
+                  CALL lim_inst_state(ji,jj,1)
+                  WRITE(numout,*) ' ice strength             : ', strength(ji,jj)
+                  WRITE(numout,*) ' oceanic stress utau      : ', utau(ji,jj) 
+                  WRITE(numout,*) ' oceanic stress vtau      : ', vtau(ji,jj)
+                  WRITE(numout,*) ' sea-ice stress utaui_ice : ', utaui_ice(ji,jj) 
+                  WRITE(numout,*) ' sea-ice stress vtaui_ice : ', vtaui_ice(ji,jj)
+                  WRITE(numout,*) ' oceanic speed u          : ', u_oce(ji,jj)
+                  WRITE(numout,*) ' oceanic speed v          : ', v_oce(ji,jj)
+                  WRITE(numout,*) ' sst                      : ', sst_m(ji,jj)
+                  WRITE(numout,*) ' sss                      : ', sss_m(ji,jj)
+                  WRITE(numout,*) 
+                  numal(alert_id) = numal(alert_id) + 1
+               ENDIF
+            END DO
+         END DO
+
+         ! Alert if there is ice on continents
+         alert_id = 6 ! reference number of this alert
+         alname(alert_id) = ' Ice on continents           ' ! name of the alert
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF ( ( tms(ji,jj) .LE. 0.0 ) .AND. ( at_i(ji,jj) .GT. 0.0 ) ) THEN 
+                  WRITE(numout,*) ' ALERTE 6 '
+                  WRITE(numout,*) ' Ice on continents '
+                  CALL lim_inst_state(ji,jj,1)
+                  WRITE(numout,*) ' masks s, u, v        : ', tms(ji,jj), &
+                                                              tmu(ji,jj), &
+                                                              tmv(ji,jj) 
+                  WRITE(numout,*) ' sst                  : ', sst_m(ji,jj)
+                  WRITE(numout,*) ' sss                  : ', sss_m(ji,jj)
+                  WRITE(numout,*) ' at_i(ji,jj)          : ', at_i(ji,jj)
+                  WRITE(numout,*) ' v_ice(ji,jj)         : ', v_ice(ji,jj)
+                  WRITE(numout,*) ' v_ice(ji,jj-1)       : ', v_ice(ji,jj-1)
+                  WRITE(numout,*) ' u_ice(ji-1,jj)       : ', u_ice(ji-1,jj)
+                  WRITE(numout,*) ' u_ice(ji,jj)         : ', v_ice(ji,jj)
+
+                  numal(alert_id) = numal(alert_id) + 1
+
+               ENDIF
+            END DO
+         END DO
+
+         ! Alert if very fresh ice
+         alert_id = 7 ! reference number of this alert
+         alname(alert_id) = ' Very fresh ice               ' ! name of the alert
+         DO jl = 1, jpl
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF ( ( ( ABS( sm_i(ji,jj,jl) ) .LT. 0.50) .OR. &
+                      ( ABS( sm_i(ji,jj,jl) ) .LT. 0.50) ) .AND. &
+                    ( a_i(ji,jj,jl) .GT. 0.0 ) ) THEN
+!                 WRITE(numout,*) ' ALERTE 7 '
+!                 WRITE(numout,*) ' Very fresh ice '
+!                 CALL lim_inst_state(ji,jj,1)
+!                 WRITE(numout,*) ' sst                  : ', sst_m(ji,jj)
+!                 WRITE(numout,*) ' sss                  : ', sss_m(ji,jj)
+!                 WRITE(numout,*) ' s_i_newice           : ', s_i_newice(ji,jj,1:jpl)
+!                 WRITE(numout,*) 
+                  numal(alert_id) = numal(alert_id) + 1
+               ENDIF
+            END DO
+         END DO
+         END DO
+
+         ! Alert if too old ice
+         alert_id = 9 ! reference number of this alert
+         alname(alert_id) = ' Very old   ice               ' ! name of the alert
+         DO jl = 1, jpl
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF ( ( ( ABS( o_i(ji,jj,jl) ) .GT. rdt_ice ) .OR. &
+                      ( ABS( o_i(ji,jj,jl) ) .LT. 0.00) ) .AND. &
+                    ( a_i(ji,jj,jl) .GT. 0.0 ) ) THEN
+                  WRITE(numout,*) ' ALERTE 9 '
+                  WRITE(numout,*) ' Wrong ice age '
+                  CALL lim_inst_state(ji,jj,1)
+                  WRITE(numout,*) 
+                  numal(alert_id) = numal(alert_id) + 1
+               ENDIF
+            END DO
+         END DO
+
+         END DO
+
+         ! Alert on salt flux
+         alert_id = 5 ! reference number of this alert
+         alname(alert_id) = ' High salt flux               ' ! name of the alert
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF (ABS(emps(ji,jj)).gt.1.0e-2) THEN
+               WRITE(numout,*) ' ALERTE 5 '
+               WRITE(numout,*) ' High salt flux '
+               CALL lim_inst_state(ji,jj,3)
+               WRITE(numout,*) ' '
+               DO jl = 1, jpl
+                  WRITE(numout,*) ' Category no: ', jl
+                  WRITE(numout,*) ' a_i        : ', a_i(ji,jj,jl)     , &
+                                  ' old_a_i    : ', old_a_i(ji,jj,jl)   
+                  WRITE(numout,*) ' d_a_i_trp  : ', d_a_i_trp(ji,jj,jl) , &
+                                  ' d_a_i_thd  : ', d_a_i_thd(ji,jj,jl) 
+                  WRITE(numout,*) ' v_i        : ', v_i(ji,jj,jl)    , &
+                                  ' old_v_i    : ', old_v_i(ji,jj,jl)   
+                  WRITE(numout,*) ' d_v_i_trp  : ', d_v_i_trp(ji,jj,jl) , &
+                                  ' d_v_i_thd  : ', d_v_i_thd(ji,jj,jl) 
+                  WRITE(numout,*) ' '
+                  END DO
+                  numal(alert_id) = numal(alert_id) + 1
+               ENDIF
+            END DO
+         END DO
+
+         ! Alert if qns very big
+         alert_id = 8 ! reference number of this alert
+         alname(alert_id) = ' qns very big             ' ! name of the alert
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF ( ( ABS( qns(ji,jj) ) .GT. 1500.0 ) .AND. &
+                    ( at_i(ji,jj) .GT. 0.0 ) )  THEN
+
+                  WRITE(numout,*) ' ALERTE 8 '
+                  WRITE(numout,*) ' ji, jj    : ', ji, jj
+                  WRITE(numout,*) ' qns       : ', qns(ji,jj)
+                  WRITE(numout,*) ' Very high non-solar heat flux '
+                  WRITE(numout,*) ' sst       : ', sst_m(ji,jj)
+                  WRITE(numout,*) ' sss       : ', sss_m(ji,jj)
+                  WRITE(numout,*) ' qcmif     : ', qcmif(jiindx,jjindx)
+                  WRITE(numout,*) ' qldif     : ', qldif(jiindx,jjindx)
+                  WRITE(numout,*) ' qcmif     : ', qcmif(jiindx,jjindx) / rdt_ice
+                  WRITE(numout,*) ' qldif     : ', qldif(jiindx,jjindx) / rdt_ice
+                  WRITE(numout,*) ' qfvbq     : ', qfvbq(jiindx,jjindx)
+                  WRITE(numout,*) ' qdtcn     : ', qdtcn(jiindx,jjindx)
+                  WRITE(numout,*) ' qfvbq / dt: ', qfvbq(jiindx,jjindx) / rdt_ice
+                  WRITE(numout,*) ' qdtcn / dt: ', qdtcn(jiindx,jjindx) / rdt_ice
+                  WRITE(numout,*) ' fdtcn     : ', fdtcn(jiindx,jjindx) 
+                  WRITE(numout,*) ' fhmec     : ', fhmec(jiindx,jjindx) 
+                  WRITE(numout,*) ' fheat_rpo : ', fheat_rpo(jiindx,jjindx) 
+                  WRITE(numout,*) ' fheat_res : ', fheat_res(jiindx,jjindx) 
+                  WRITE(numout,*) ' fhbri     : ', fhbri(jiindx,jjindx) 
+
+                  CALL lim_inst_state(ji,jj,2)
+                  numal(alert_id) = numal(alert_id) + 1
+
+               ENDIF
+            END DO
+         END DO
+         !+++++
+ 
+         ! Alert if very warm ice
+         alert_id = 10 ! reference number of this alert
+         alname(alert_id) = ' Very warm ice                ' ! name of the alert
+         numal(alert_id) = 0
+         DO jl = 1, jpl
+         DO jk = 1, nlay_i
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ztmelts    =  -tmut*s_i(ji,jj,jk,jl) + rtt
+               IF ( ( t_i(ji,jj,jk,jl) .GE. ztmelts) .AND. &
+                    ( v_i(ji,jj,jl)   .GT. 1.0e-6)   .AND. &
+                    ( a_i(ji,jj,jl) .GT. 0.0     )  ) THEN
+                  WRITE(numout,*) ' ALERTE 10 '
+                  WRITE(numout,*) ' ji, jj, jk, jl : ', ji, jj, jk, jl
+                  WRITE(numout,*) ' Very warm ice '
+                  WRITE(numout,*) ' t_i : ', t_i(ji,jj,jk,jl)
+                  WRITE(numout,*) ' e_i : ', e_i(ji,jj,jk,jl)
+                  WRITE(numout,*) ' s_i : ', s_i(ji,jj,jk,jl)
+                  WRITE(numout,*) ' ztmelts : ', ztmelts
+                  numal(alert_id) = numal(alert_id) + 1
+               ENDIF
+            END DO
+         END DO
+         END DO
+         END DO
+
+         alert_id = 1 ! reference number of this alert
+         alname(alert_id) = ' Il n''y a pas d''alerte 1       ' ! name of the alert
+         WRITE(numout,*)
+         WRITE(numout,*) ' All alerts at the end of ice model '
+         DO alert_id = 1, numaltests
+            WRITE(numout,*) alert_id, alname(alert_id)//' : ', numal(alert_id), ' times ! '
+         END DO
+         !
+      ENDIF  ! End sea-ice coupling
+      !
+   END SUBROUTINE sbc_ice_lim
+
+
+   SUBROUTINE lim_inst_state( ki, kj, kn )
+      !!-----------------------------------------------------------------------
+      !!                   ***  ROUTINE lim_inst_state *** 
+      !!                 
+      !! ** Purpose :   Writes global ice state on the (i,j) point 
+      !!                in ocean.ouput 
+      !!                3 possibilities exist 
+      !!                n = 1 -> simple ice state
+      !!                n = 2 -> exhaustive state
+      !!                n = 3 -> ice/ocean salt fluxes
+      !!
+      !! ** input   :   point coordinates (i,j) 
+      !!                n : number of the option
+      !!-------------------------------------------------------------------
+      INTEGER, INTENT( in ) ::   ki, kj, kn     ! ocean time-step index
+      INTEGER :: jl
+      !!-------------------------------------------------------------------
+
+      !----------------
+      !  Simple state
+      !----------------
+
+      IF ( kn .EQ. 1 ) THEN
+         WRITE(numout,*) ' lim_inst_state - Point : ',ki,kj
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
+         WRITE(numout,*) ' Simple state '
+         WRITE(numout,*) ' masks s,u,v   : ', tms(ki,kj), tmu(ki,kj), tmv(ki,kj)
+         WRITE(numout,*) ' lat - long    : ', gphit(ki,kj), glamt(ki,kj)
+         WRITE(numout,*) ' Time step     : ', numit
+         WRITE(numout,*) ' - Ice drift   '
+         WRITE(numout,*) '   ~~~~~~~~~~~ '
+         WRITE(numout,*) ' u_ice(i-1,j)  : ', u_ice(ki-1,kj)
+         WRITE(numout,*) ' u_ice(i  ,j)  : ', u_ice(ki,kj)
+         WRITE(numout,*) ' v_ice(i  ,j-1): ', v_ice(ki,kj-1)
+         WRITE(numout,*) ' v_ice(i  ,j)  : ', v_ice(ki,kj)
+         WRITE(numout,*) ' strength      : ', strength(ki,kj)
+         WRITE(numout,*)
+         WRITE(numout,*) ' - Cell values '
+         WRITE(numout,*) '   ~~~~~~~~~~~ '
+         WRITE(numout,*) ' cell area     : ', area(ki,kj)
+         WRITE(numout,*) ' at_i          : ', at_i(ki,kj)       
+         WRITE(numout,*) ' vt_i          : ', vt_i(ki,kj)       
+         WRITE(numout,*) ' vt_s          : ', vt_s(ki,kj)       
+         DO jl = 1, jpl
+            WRITE(numout,*) ' - Category (', jl,')'
+            WRITE(numout,*) ' a_i           : ', a_i(ki,kj,jl)
+            WRITE(numout,*) ' ht_i          : ', ht_i(ki,kj,jl)
+            WRITE(numout,*) ' ht_s          : ', ht_s(ki,kj,jl)
+            WRITE(numout,*) ' v_i           : ', v_i(ki,kj,jl)
+            WRITE(numout,*) ' v_s           : ', v_s(ki,kj,jl)
+            WRITE(numout,*) ' e_s           : ', e_s(ki,kj,1,jl)/1.0e9
+            WRITE(numout,*) ' e_i           : ', e_i(ki,kj,1:nlay_i,jl)/1.0e9
+            WRITE(numout,*) ' t_su          : ', t_su(ki,kj,jl)
+            WRITE(numout,*) ' t_snow        : ', t_s(ki,kj,1,jl)
+            WRITE(numout,*) ' t_i           : ', t_i(ki,kj,1:nlay_i,jl)
+            WRITE(numout,*) ' sm_i          : ', sm_i(ki,kj,jl)
+            WRITE(numout,*) ' smv_i         : ', smv_i(ki,kj,jl)
+            WRITE(numout,*)
+            WRITE(numout,*) ' Pathological case : ', patho_case(ki,kj,jl)
+         END DO
+      ENDIF
+
+      !--------------------
+      !  Exhaustive state
+      !--------------------
+
+      IF ( kn .EQ. 2 ) THEN
+         WRITE(numout,*) ' lim_inst_state - Point : ',ki,kj
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
+         WRITE(numout,*) ' Exhaustive state '
+         WRITE(numout,*) ' lat - long ', gphit(ki,kj), glamt(ki,kj)
+         WRITE(numout,*) ' Time step ', numit
+         WRITE(numout,*) 
+         WRITE(numout,*) ' - Cell values '
+         WRITE(numout,*) '   ~~~~~~~~~~~ '
+         WRITE(numout,*) ' cell area     : ', area(ki,kj)
+         WRITE(numout,*) ' at_i          : ', at_i(ki,kj)       
+         WRITE(numout,*) ' vt_i          : ', vt_i(ki,kj)       
+         WRITE(numout,*) ' vt_s          : ', vt_s(ki,kj)       
+         WRITE(numout,*) ' sdvt          : ', sdvt(ki,kj)       
+         WRITE(numout,*) ' u_ice(i-1,j)  : ', u_ice(ki-1,kj)
+         WRITE(numout,*) ' u_ice(i  ,j)  : ', u_ice(ki,kj)
+         WRITE(numout,*) ' v_ice(i  ,j-1): ', v_ice(ki,kj-1)
+         WRITE(numout,*) ' v_ice(i  ,j)  : ', v_ice(ki,kj)
+         WRITE(numout,*) ' strength      : ', strength(ki,kj)
+         WRITE(numout,*) ' d_u_ice_dyn   : ', d_u_ice_dyn(ki,kj), ' d_v_ice_dyn   : ', d_v_ice_dyn(ki,kj)
+         WRITE(numout,*) ' old_u_ice     : ', old_u_ice(ki,kj)  , ' old_v_ice     : ', old_v_ice(ki,kj)  
+         WRITE(numout,*)
+
+         DO jl = 1, jpl
+              WRITE(numout,*) ' - Category (',jl,')'
+              WRITE(numout,*) '   ~~~~~~~~         ' 
+              WRITE(numout,*) ' ht_i       : ', ht_i(ki,kj,jl)             , ' ht_s       : ', ht_s(ki,kj,jl)
+              WRITE(numout,*) ' t_i        : ', t_i(ki,kj,1:nlay_i,jl)
+              WRITE(numout,*) ' t_su       : ', t_su(ki,kj,jl)             , ' t_s        : ', t_s(ki,kj,1,jl)
+              WRITE(numout,*) ' sm_i       : ', sm_i(ki,kj,jl)             , ' o_i        : ', o_i(ki,kj,jl)
+              WRITE(numout,*) ' a_i        : ', a_i(ki,kj,jl)              , ' old_a_i    : ', old_a_i(ki,kj,jl)   
+              WRITE(numout,*) ' d_a_i_trp  : ', d_a_i_trp(ki,kj,jl)        , ' d_a_i_thd  : ', d_a_i_thd(ki,kj,jl) 
+              WRITE(numout,*) ' v_i        : ', v_i(ki,kj,jl)              , ' old_v_i    : ', old_v_i(ki,kj,jl)   
+              WRITE(numout,*) ' d_v_i_trp  : ', d_v_i_trp(ki,kj,jl)        , ' d_v_i_thd  : ', d_v_i_thd(ki,kj,jl) 
+              WRITE(numout,*) ' v_s        : ', v_s(ki,kj,jl)              , ' old_v_s    : ', old_v_s(ki,kj,jl)  
+              WRITE(numout,*) ' d_v_s_trp  : ', d_v_s_trp(ki,kj,jl)        , ' d_v_s_thd  : ', d_v_s_thd(ki,kj,jl)
+              WRITE(numout,*) ' e_i1       : ', e_i(ki,kj,1,jl)/1.0e9      , ' old_ei1    : ', old_e_i(ki,kj,1,jl)/1.0e9 
+              WRITE(numout,*) ' de_i1_trp  : ', d_e_i_trp(ki,kj,1,jl)/1.0e9, ' de_i1_thd  : ', d_e_i_thd(ki,kj,1,jl)/1.0e9
+              WRITE(numout,*) ' e_i2       : ', e_i(ki,kj,2,jl)/1.0e9      , ' old_ei2    : ', old_e_i(ki,kj,2,jl)/1.0e9  
+              WRITE(numout,*) ' de_i2_trp  : ', d_e_i_trp(ki,kj,2,jl)/1.0e9, ' de_i2_thd  : ', d_e_i_thd(ki,kj,2,jl)/1.0e9
+              WRITE(numout,*) ' e_snow     : ', e_s(ki,kj,1,jl)            , ' old_e_snow : ', old_e_s(ki,kj,1,jl) 
+              WRITE(numout,*) ' d_e_s_trp  : ', d_e_s_trp(ki,kj,1,jl)      , ' d_e_s_thd  : ', d_e_s_thd(ki,kj,1,jl)
+              WRITE(numout,*) ' smv_i      : ', smv_i(ki,kj,jl)            , ' old_smv_i  : ', old_smv_i(ki,kj,jl)   
+              WRITE(numout,*) ' d_smv_i_trp: ', d_smv_i_trp(ki,kj,jl)      , ' d_smv_i_thd: ', d_smv_i_thd(ki,kj,jl) 
+              WRITE(numout,*) ' oa_i       : ', oa_i(ki,kj,jl)             , ' old_oa_i   : ', old_oa_i(ki,kj,jl)
+              WRITE(numout,*) ' d_oa_i_trp : ', d_oa_i_trp(ki,kj,jl)       , ' d_oa_i_thd : ', d_oa_i_thd(ki,kj,jl)
+              WRITE(numout,*) ' Path. case : ', patho_case(ki,kj,jl)
+        END DO !jl
+
+        WRITE(numout,*)
+        WRITE(numout,*) ' - Heat / FW fluxes '
+        WRITE(numout,*) '   ~~~~~~~~~~~~~~~~ '
+!       WRITE(numout,*) ' fsbri      : ', fsbri(ki,kj)
+!       WRITE(numout,*) ' fseqv      : ', fseqv(ki,kj)
+!       WRITE(numout,*) ' fsalt_res  : ', fsalt_res(ki,kj)
+        WRITE(numout,*) ' fmmec      : ', fmmec(ki,kj)
+        WRITE(numout,*) ' fhmec      : ', fhmec(ki,kj)
+        WRITE(numout,*) ' fhbri      : ', fhbri(ki,kj)
+        WRITE(numout,*) ' fheat_rpo  : ', fheat_rpo(ki,kj)
+        WRITE(numout,*) 
+        WRITE(numout,*) ' sst        : ', sst_m(ki,kj)  
+        WRITE(numout,*) ' sss        : ', sss_m(ki,kj)  
+        WRITE(numout,*) 
+        WRITE(numout,*) ' - Stresses '
+        WRITE(numout,*) '   ~~~~~~~~ '
+        WRITE(numout,*) ' utaui_ice  : ', utaui_ice(ki,kj) 
+        WRITE(numout,*) ' vtaui_ice  : ', vtaui_ice(ki,kj)
+        WRITE(numout,*) ' utau       : ', utau(ki,kj) 
+        WRITE(numout,*) ' vtau       : ', vtau(ki,kj)
+        WRITE(numout,*) ' oc. vel. u : ', u_oce(ki,kj)
+        WRITE(numout,*) ' oc. vel. v : ', v_oce(ki,kj)
+     ENDIF
+
+     !---------------------
+     ! Salt / heat fluxes
+     !---------------------
+
+     IF ( kn .EQ. 3 ) THEN
+        WRITE(numout,*) ' lim_inst_state - Point : ',ki,kj
+        WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
+        WRITE(numout,*) ' - Salt / Heat Fluxes '
+        WRITE(numout,*) '   ~~~~~~~~~~~~~~~~ '
+        WRITE(numout,*) ' lat - long ', gphit(ki,kj), glamt(ki,kj)
+        WRITE(numout,*) ' Time step ', numit
+        WRITE(numout,*)
+        WRITE(numout,*) ' - Heat fluxes at bottom interface ***'
+        WRITE(numout,*) ' qsr        : ', qsr(ki,kj)
+        WRITE(numout,*) ' qns        : ', qns(ki,kj)
+        WRITE(numout,*)
+        WRITE(numout,*) ' - Salt fluxes at bottom interface ***'
+        WRITE(numout,*) ' emps       : ', emps(ki,kj)
+        WRITE(numout,*) ' emp        : ', emp(ki,kj)
+        WRITE(numout,*) ' fsbri      : ', fsbri(ki,kj)
+        WRITE(numout,*) ' fseqv      : ', fseqv(ki,kj)
+        WRITE(numout,*) ' fsalt_res  : ', fsalt_res(ki,kj)
+        WRITE(numout,*) ' fsalt_rpo  : ', fsalt_rpo(ki,kj)
+        WRITE(numout,*) ' - Heat fluxes at bottom interface ***'
+        WRITE(numout,*) ' fheat_res  : ', fheat_res(ki,kj)
+        WRITE(numout,*)
+        WRITE(numout,*) ' - Momentum fluxes '
+        WRITE(numout,*) ' utau      : ', utau(ki,kj) 
+        WRITE(numout,*) ' vtau      : ', vtau(ki,kj)
+      ENDIF
+
+   END SUBROUTINE lim_inst_state
+
+#else
+   !!----------------------------------------------------------------------
+   !!   Default option           Dummy module      NO LIM 3.0 sea-ice model
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE sbc_ice_lim ( kt, kblk )     ! Dummy routine
+      WRITE(*,*) 'sbc_ice_lim: You should not have seen this print! error?', kt, kblk
+   END SUBROUTINE sbc_ice_lim
+#endif
+
+   !!======================================================================
+END MODULE sbcice_lim
Index: trunk/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 888)
@@ -0,0 +1,205 @@
+MODULE sbcice_lim_2
+   !!======================================================================
+   !!                       ***  MODULE  sbcice_lim_2  ***
+   !! Surface module :  update surface ocean boundary condition over ice
+   !!                   covered area using LIM sea-ice model
+   !! Sea-Ice model  :  LIM 2.0 Sea ice model time-stepping
+   !!======================================================================
+   !! History :  9.0   !  06-06  (G. Madec)  from icestp_2.F90
+   !!----------------------------------------------------------------------
+#if defined key_lim2
+   !!----------------------------------------------------------------------
+   !!   'key_lim2' :                                  LIM 2.0 sea-ice model
+   !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !!   sbc_ice_lim_2  : sea-ice model time-stepping and
+   !!                    update ocean sbc over ice-covered area
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE ice_2
+   USE iceini_2
+   USE ice_oce         ! ice variables
+   USE dom_ice_2
+   USE cpl_oce
+
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE sbc_ice         ! Surface boundary condition: ice   fields
+   USE sbcblk_core     ! Surface boundary condition: CORE bulk
+   USE sbcblk_clio     ! Surface boundary condition: CLIO bulk
+   USE albedo
+
+   USE daymod          ! day calendar
+   USE phycst          ! Define parameters for the routines
+   USE eosbn2          ! equation of state
+   USE limdyn_2
+   USE limtrp_2
+   USE limdmp_2
+   USE limthd_2
+   USE limsbc_2        ! sea surface boundary condition
+   USE limdia_2
+   USE limwri_2
+   USE limrst_2
+
+   USE lbclnk
+   USE iom             ! I/O manager library
+   USE in_out_manager  ! I/O manager
+   USE prtctl          ! Print control
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC sbc_ice_lim_2 ! routine called by sbcmod.F90
+   
+   CHARACTER(len=1) ::   cl_grid = 'B'     ! type of grid used in ice dynamics
+
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE sbc_ice_lim_2( kt, kblk )
+      !!---------------------------------------------------------------------
+      !!                  ***  ROUTINE sbc_ice_lim_2  ***
+      !!                   
+      !! ** Purpose :   update the ocean surface boundary condition via the 
+      !!                Louvain la Neuve Sea Ice Model time stepping 
+      !!
+      !! ** Method  :   ice model time stepping
+      !!              - call the ice dynamics routine 
+      !!              - call the ice advection/diffusion routine 
+      !!              - call the ice thermodynamics routine 
+      !!              - call the routine that computes mass and 
+      !!                heat fluxes at the ice/ocean interface
+      !!              - save the outputs 
+      !!              - save the outputs for restart when necessary
+      !!
+      !! ** Action  : - time evolution of the LIM sea-ice model
+      !!              - update all sbc variables below sea-ice:
+      !!                utau, vtau, qns , qsr, emp , emps
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt      ! ocean time step
+      INTEGER, INTENT(in) ::   kblk    ! type of bulk (=3 CLIO, =4 CORE)
+      !!
+      INTEGER  ::   ji, jj   ! dummy loop indices
+      REAL(wp), DIMENSION(jpi,jpj,1) ::   alb_ice_os   ! albedo of the ice under overcast sky
+      REAL(wp), DIMENSION(jpi,jpj,1) ::   alb_ice_cs   ! albedo of ice under clear sky
+      REAL(wp), DIMENSION(jpi,jpj,1) ::   zsist        ! surface ice temperature (K)
+      REAL(wp), DIMENSION(jpi,jpj,1) ::   zhicif       ! ice thickness
+      REAL(wp), DIMENSION(jpi,jpj,1) ::   zhsnif       ! snow thickness
+      REAL(wp), DIMENSION(jpi,jpj,1) ::   zqns_ice     ! non solar sea-ice heat flux
+      REAL(wp), DIMENSION(jpi,jpj,1) ::   zqsr_ice     !     solar sea-ice heat flux
+      REAL(wp), DIMENSION(jpi,jpj,1) ::   zqla_ice     ! ice latent heat flux
+      REAL(wp), DIMENSION(jpi,jpj,1) ::   zdqns_ice    ! sensitivity ice net heat flux
+      REAL(wp), DIMENSION(jpi,jpj,1) ::   zdqla_ice    ! sensitivity ice latent heat flux
+      !!----------------------------------------------------------------------
+
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'sbc_ice_lim_2 : update ocean surface boudary condition' 
+         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~   via Louvain la Neuve Ice Model (LIM) time stepping'
+
+         CALL ice_init_2
+
+      ENDIF
+
+      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN
+         !
+         ! ... mean surface ocean current at ice dynamics point
+         !     B-grid dynamics :  I-point (F-point with sea-ice indexation)
+         DO jj = 2, jpj
+            DO ji = fs_2, jpi   ! vector opt.
+               ui_oce(ji,jj) = 0.5 * ( ssu_m(ji-1,jj  ) + ssu_m(ji-1,jj-1) ) * tmu(ji,jj)
+               vi_oce(ji,jj) = 0.5 * ( ssv_m(ji  ,jj-1) + ssv_m(ji-1,jj-1) ) * tmu(ji,jj)
+            END DO
+         END DO
+         CALL lbc_lnk( ui_oce, 'I', -1. )   ! I-point (i.e. F-point with ice indices)
+         CALL lbc_lnk( vi_oce, 'I', -1. )   ! I-point (i.e. F-point with ice indices)
+
+         ! ... masked sea surface freezing temperature [Kelvin] (set to rt0 over land)
+         tfu(:,:) = tfreez( sss_m ) +  rt0 
+
+         zsist (:,:,1) = sist (:,:)
+         zhicif(:,:,1) = hicif(:,:)   ;   zhsnif(:,:,1) = hsnif(:,:)
+
+         ! ... ice albedo
+         CALL albedo_ice( zsist, zhicif, zhsnif, alb_ice_cs, alb_ice_os )
+
+         ! ... Sea-ice surface boundary conditions output from bulk formulae :
+         !     - utaui_ice  ! surface ice stress i-component (I-point)   [N/m2]
+         !     - vtaui_ice  ! surface ice stress j-component (I-point)   [N/m2]
+         !     - qns_ice    ! non solar heat flux over ice   (T-point)   [W/m2]
+         !     - qsr_ice    !     solar heat flux over ice   (T-point)   [W/m2]
+         !     - qla_ice    ! latent    heat flux over ice   (T-point)   [W/m2]
+         !     - dqns_ice   ! non solar heat sensistivity    (T-point)   [W/m2]
+         !     - dqla_ice   ! latent    heat sensistivity    (T-point)   [W/m2]
+         !     - tprecip    ! total precipitation            (T-point)   [Kg/m2/s]
+         !     - sprecip    ! solid precipitation            (T-point)   [Kg/m2/s]
+         !     - fr1_i0     ! 1sr fraction of qsr penetration in ice     [%]
+         !     - fr2_i0     ! 2nd fraction of qsr penetration in ice     [%]
+         !
+         SELECT CASE( kblk )
+         CASE( 3 )           ! CLIO bulk formulation
+            CALL blk_ice_clio( zsist , ui_ice , vi_ice   , alb_ice_cs , alb_ice_os ,             &
+               &                               utaui_ice , vtaui_ice  , zqns_ice   , zqsr_ice,   &
+               &                               zqla_ice  , zdqns_ice  , zdqla_ice  ,             &
+               &                               tprecip   , sprecip    ,                          &
+               &                               fr1_i0    , fr2_i0     , cl_grid  )
+         CASE( 4 )           ! CORE bulk formulation
+            CALL blk_ice_core( zsist , ui_ice , vi_ice   , alb_ice_cs ,                         &
+               &                               utaui_ice , vtaui_ice  , zqns_ice  , zqsr_ice,   &
+               &                               zqla_ice  , zdqns_ice  , zdqla_ice ,             &
+               &                               tprecip   , sprecip    ,                         &
+               &                               fr1_i0    , fr2_i0     , cl_grid)
+         END SELECT
+
+         qsr_ice(:,:) = zqsr_ice(:,:,1)
+         qns_ice(:,:) = zqns_ice(:,:,1)   ;   dqns_ice(:,:) = zdqns_ice(:,:,1)
+         qla_ice(:,:) = zqla_ice(:,:,1)   ;   dqla_ice(:,:) = zdqla_ice(:,:,1)
+
+         IF(ln_ctl) THEN         ! print mean trends (used for debugging)
+            CALL prt_ctl_info( 'Ice Forcings ' )
+            CALL prt_ctl( tab2d_1=tprecip  ,clinfo1=' sbc_ice_lim: precip   : ', tab2d_2=sprecip  , clinfo2=' Snow     : ' )
+            CALL prt_ctl( tab2d_1=utaui_ice,clinfo1=' sbc_ice_lim: utaui_ice: ', tab2d_2=vtaui_ice, clinfo2=' vtaui_ice: ' )
+            CALL prt_ctl( tab2d_1=sst_m    ,clinfo1=' sbc_ice_lim: sst      : ', tab2d_2=sss_m    , clinfo2=' sss      : ' )
+            CALL prt_ctl( tab2d_1=ui_oce   ,clinfo1=' sbc_ice_lim: u_io     : ', tab2d_2=vi_oce   , clinfo2=' v_io     : ' )
+            CALL prt_ctl( tab2d_1=hsnif    ,clinfo1=' sbc_ice_lim: hsnif  1 : ', tab2d_2=hicif    , clinfo2=' hicif    : ' )
+            CALL prt_ctl( tab2d_1=frld     ,clinfo1=' sbc_ice_lim: frld   1 : ', tab2d_2=sist     , clinfo2=' sist     : ' )
+         ENDIF
+
+         ! ---------------- !
+         !  Ice model step  !
+         ! ---------------- !
+         ;                              CALL lim_rst_opn_2  ( kt )      ! Open Ice restart file
+         ;                              CALL lim_dyn_2      ( kt )      ! Ice dynamics    ( rheology/dynamics )
+         ;                              CALL lim_trp_2      ( kt )      ! Ice transport   ( Advection/diffusion )
+         IF( ln_limdmp )                CALL lim_dmp_2      ( kt )      ! Ice damping 
+         ;                              CALL lim_thd_2      ( kt )      ! Ice thermodynamics 
+         ;                              CALL lim_sbc_2      ( kt )      ! Ice/Ocean Mass & Heat fluxes 
+         IF( MOD( kt+nn_fsbc-1, ninfo ) == 0 .OR.   &
+            &  ntmoy == 1 )             CALL lim_dia_2      ( kt )      ! Ice Diagnostics 
+         ;                              CALL lim_wri_2      ( kt )      ! Ice outputs 
+         IF( lrst_ice )                 CALL lim_rst_write_2( kt )      ! Ice restart file 
+         !
+      ENDIF
+      !
+   END SUBROUTINE sbc_ice_lim_2
+
+#else
+   !!----------------------------------------------------------------------
+   !!   Default option           Dummy module      NO LIM 2.0 sea-ice model
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE sbc_ice_lim_2 ( kt, kblk )     ! Dummy routine
+      WRITE(*,*) 'sbc_ice_lim_2: You should not have seen this print! error?', kt, kblk
+   END SUBROUTINE sbc_ice_lim_2
+#endif
+
+   !!======================================================================
+END MODULE sbcice_lim_2
Index: trunk/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 888)
@@ -0,0 +1,265 @@
+MODULE sbcmod
+   !!======================================================================
+   !!                       ***  MODULE  sbcmod  ***
+   !! Surface module :  provide to the ocean its surface boundary condition
+   !!======================================================================
+   !! History :  9.0   !  06-07  (G. Madec)  Original code
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   sbc_init       : read namsbc namelist
+   !!   sbc            : surface ocean momentum, heat and freshwater 
+   !!                    boundary conditions
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE daymod          ! calendar
+   USE phycst          ! physical constants
+   USE ocfzpt          ! ocean freezing point
+
+   USE ice_oce         ! sea-ice model : LIM
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE sbcssm          ! surface boundary condition: sea-surface mean variables
+   USE sbcana          ! surface boundary condition: analytical formulation
+   USE sbcflx          ! surface boundary condition: flux formulation
+   USE sbcblk_clio     ! surface boundary condition: bulk formulation : CLIO
+   USE sbcblk_core     ! surface boundary condition: bulk formulation : CORE
+   USE sbcice_if       ! surface boundary condition: ice-if sea-ice model
+   USE sbcice_lim      ! surface boundary condition: LIM 3.0 sea-ice model
+   USE sbcice_lim_2    ! surface boundary condition: LIM 2.0 sea-ice model
+   USE sbccpl          ! surface boundary condition: coupled florulation
+   USE sbcssr          ! surface boundary condition: sea surface restoring
+   USE sbcrnf          ! surface boundary condition: runoffs
+   USE sbcfwb          ! surface boundary condition: freshwater budget
+   USE closea          ! closed sea
+
+   USE prtctl          ! Print control                    (prt_ctl routine)
+   USE restart         ! ocean restart
+   USE iom
+   USE in_out_manager  ! I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   sbc        ! routine called by step.F90
+   
+   !! * namsbc namelist (public variables)
+   LOGICAL , PUBLIC ::   ln_ana      = .FALSE.   !: analytical boundary condition flag
+   LOGICAL , PUBLIC ::   ln_flx      = .FALSE.   !: flux      formulation
+   LOGICAL , PUBLIC ::   ln_blk_clio = .FALSE.   !: CLIO bulk formulation
+   LOGICAL , PUBLIC ::   ln_blk_core = .FALSE.   !: CORE bulk formulation
+   LOGICAL , PUBLIC ::   ln_cpl      = .FALSE.   !: coupled   formulation (overwritten by key_sbc_coupled )
+   LOGICAL , PUBLIC ::   ln_dm2dc    = .FALSE.   !: Daily mean to Diurnal Cycle short wave (qsr)
+   LOGICAL , PUBLIC ::   ln_rnf      = .FALSE.   !: runoffs / runoff mouths
+   LOGICAL , PUBLIC ::   ln_ssr      = .FALSE.   !: Sea Surface restoring on SST and/or SSS      
+   INTEGER , PUBLIC ::   nn_ice      = 0         !: flag on ice in the surface boundary condition (=0/1/2)
+   INTEGER , PUBLIC ::   nn_fwb      = 0         !: type of FreshWater Budget control (=0/1/2)
+   NAMELIST/namsbc/ nn_fsbc, ln_ana, ln_flx, ln_blk_clio, ln_blk_core, ln_cpl,   &
+      &             nn_ice , ln_dm2dc, ln_rnf, ln_ssr, nn_fwb
+
+   INTEGER ::   nsbc   ! type of surface boundary condition (deduced from namsbc informations)
+   INTEGER ::   nice   ! type of ice in the surface boundary condition (deduced from namsbc informations)
+      
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE sbc_init
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE sbc_init ***
+      !!
+      !! ** Purpose :   Initialisation of the ocean surface boundary computation
+      !!
+      !! ** Method  :   Read the namsbc namelist and set derived parameters
+      !!
+      !! ** Action  : - read namsbc parameters
+      !!              - nsbc: type of sbc
+      !!----------------------------------------------------------------------
+      INTEGER ::   icpt      ! temporary integer
+      !!----------------------------------------------------------------------
+
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) 'sbc_init : surface boundary condition setting'
+         WRITE(numout,*) '~~~~~~~~ '
+      ENDIF
+
+      REWIND ( numnam )                   ! Read Namelist namsbc
+      READ   ( numnam, namsbc )
+
+      ! overwrite namelist parameter using CPP key information
+!!gmhere 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( lk_lim2 )            nn_ice      = 2
+      IF( lk_lim3 )            nn_ice      = 3
+      IF( cp_cfg == 'gyre' ) THEN
+          ln_ana      = .TRUE.   
+          nn_ice      =   0
+      ENDIF
+      
+      ! Control print
+      IF(lwp) THEN
+         WRITE(numout,*) '        Namelist namsbc (overwritten using CPP key defined)'
+         WRITE(numout,*) '           frequency update of sbc (and ice)             nn_fsbc     = ', nn_fsbc
+         WRITE(numout,*) '           Type of sbc : '
+         WRITE(numout,*) '              analytical formulation                     ln_ana      = ', ln_ana
+         WRITE(numout,*) '              flux       formulation                     ln_flx      = ', ln_flx
+         WRITE(numout,*) '              CLIO bulk  formulation                     ln_blk_clio = ', ln_blk_clio
+         WRITE(numout,*) '              CLIO bulk  formulation                     ln_blk_core = ', ln_blk_core
+         WRITE(numout,*) '              coupled    formulation (T if key_sbc_cpl)  ln_cpl      = ', ln_cpl
+         WRITE(numout,*) '           Misc. options of sbc : '
+         WRITE(numout,*) '              ice management in the sbc (=0/1/2)         nn_ice      = ', nn_ice 
+         WRITE(numout,*) '              daily mean to diurnal cycle qsr            ln_dm2dc    = ', ln_dm2dc 
+         WRITE(numout,*) '              runoff / runoff mouths                     ln_rnf      = ', ln_rnf
+         WRITE(numout,*) '              Sea Surface Restoring on SST and/or SSS    ln_ssr      = ', ln_ssr
+         WRITE(numout,*) '              FreshWater Budget control  (=0/1/2)        nn_fwb      = ', nn_fwb
+         WRITE(numout,*) '              closed sea (=0/1) (set in namdom)          nclosea     = ', nclosea
+      ENDIF
+
+      ! Check consistancy   !!gm mixture of real and integer : coding to be changed....
+
+      IF( .NOT. ln_rnf )   nn_runoff = 0      ! no runoff, or runoff mouths
+
+      IF( nn_ice == 2 )   THEN
+         IF( MOD( nitend - nit000 + 1, nn_fsbc) /= 0 ) THEN 
+            WRITE(ctmp1,*) 'experiment length (', nitend - nit000 + 1, ') is NOT a multiple of nn_fsbc (', nn_fsbc, ')'
+            CALL ctl_stop( ctmp1, 'Impossible to do proper restart files' )
+         ENDIF
+         IF( MOD( nstock, nn_fsbc) /= 0 ) THEN 
+            WRITE(ctmp1,*) 'nstock ('           , nstock             , ') is NOT a multiple of nn_fsbc (', nn_fsbc, ')'
+            CALL ctl_stop( ctmp1, 'Impossible to do proper restart files' )
+         ENDIF
+      ENDIF
+
+      IF( MOD( rday, nn_fsbc*rdt ) /= 0 )   CALL ctl_warn( 'nn_fsbc is NOT a multiple of the number of time steps in a day' )
+
+      IF( nn_ice == 2 .AND. .NOT.( ln_blk_clio .OR. ln_blk_core ) )   &
+         &   CALL ctl_stop( 'sbc_init: sea-ice model requires a bulk formulation' )
+      
+      ! Choice of the Surface Boudary Condition (set nsbc)
+      icpt = 0
+      IF( ln_ana          ) THEN   ;   nsbc =  1   ; icpt = icpt + 1   ;   ENDIF       ! analytical      formulation
+      IF( ln_flx          ) THEN   ;   nsbc =  2   ; icpt = icpt + 1   ;   ENDIF       ! flux            formulation
+      IF( ln_blk_clio     ) THEN   ;   nsbc =  3   ; icpt = icpt + 1   ;   ENDIF       ! CLIO bulk       formulation
+      IF( ln_blk_core     ) THEN   ;   nsbc =  4   ; icpt = icpt + 1   ;   ENDIF       ! CORE bulk       formulation
+      IF( ln_cpl          ) THEN   ;   nsbc =  5   ; icpt = icpt + 1   ;   ENDIF       ! Coupled         formulation
+      IF( cp_cfg == 'gyre') THEN   ;   nsbc =  0                       ;   ENDIF       ! GYRE analytical formulation
+      IF( lk_esopa        )            nsbc = -1                                       ! esopa test, ALL formulations
+
+      IF( icpt /= 1 .AND. .NOT.lk_esopa ) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) '           E R R O R in setting the sbc, one and only one namelist/CPP key option '
+         WRITE(numout,*) '                     must be choosen. You choose ', icpt, ' option(s)'
+         WRITE(numout,*) '                     We stop'
+         nstop = nstop + 1
+      ENDIF
+      IF(lwp) THEN
+         WRITE(numout,*)
+         IF( nsbc == -1 )   WRITE(numout,*) '              ESOPA test All surface boundary conditions'
+         IF( nsbc ==  0 )   WRITE(numout,*) '              GYRE analytical formulation'
+         IF( nsbc ==  1 )   WRITE(numout,*) '              analytical formulation'
+         IF( nsbc ==  2 )   WRITE(numout,*) '              flux formulation'
+         IF( nsbc ==  3 )   WRITE(numout,*) '              CLIO bulk formulation'
+         IF( nsbc ==  4 )   WRITE(numout,*) '              CORE bulk formulation'
+         IF( nsbc ==  5 )   WRITE(numout,*) '              coupled formulation'
+      ENDIF
+      !
+   END SUBROUTINE sbc_init
+
+
+   SUBROUTINE sbc( kt )
+      !!---------------------------------------------------------------------
+      !!                    ***  ROUTINE sbc  ***
+      !!              
+      !! ** Purpose :   provide at each time-step the ocean surface boundary
+      !!                condition (momentum, heat and freshwater fluxes)
+      !!
+      !! ** Method  :   blah blah  to be written ????????? 
+      !!                CAUTION : never mask the surface stress field (tke sbc)
+      !!
+      !! ** Action  : - set the ocean surface boundary condition, i.e.  
+      !!                utau, vtau, qns, qsr, emp, emps, qrp, erp
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt       ! ocean time step
+      !!---------------------------------------------------------------------
+
+      IF( kt == nit000 )   CALL sbc_init         ! Read namsbc namelist : surface module
+
+      ! ocean to sbc mean sea surface variables (ss._m)
+      ! ---------------------------------------
+      CALL sbc_ssm( kt )                         ! sea surface mean currents (at U- and V-points), 
+      !                                          ! temperature and salinity (at T-point) over nf_sbc time-step
+      !                                          ! (i.e. sst_m, sss_m, ssu_m, ssv_m)
+
+!!gm  add a flag on nn_fsbc frequency ?????  except the diurnal cycle!
+!!    IF( MOD( kt - 1, nn_fsbc ) == 0 ) THEN
+
+
+      ! sbc formulation
+      ! ---------------
+         
+      SELECT CASE( nsbc )                        ! Compute ocean surface boundary condition
+      !                                          ! (i.e. utau,vtau, qns, qsr, emp, emps)
+      CASE(  0 )   ;   CALL sbc_gyre    ( kt )      ! analytical formulation : GYRE configuration
+      CASE(  1 )   ;   CALL sbc_ana     ( kt )      ! analytical formulation : uniform sbc
+      CASE(  2 )   ;   CALL sbc_flx     ( kt )      ! flux formulation
+      CASE(  3 )   ;   CALL sbc_blk_clio( kt )      ! bulk formulation : CLIO for the ocean
+      CASE(  4 )   ;   CALL sbc_blk_core( kt )      ! bulk formulation : CORE for the ocean
+      CASE(  5 )   ;   CALL sbc_cpl     ( kt )      ! coupled formulation
+      CASE( -1 )                                
+         ;             CALL sbc_ana     ( kt )      ! ESOPA, test ALL the formulations
+         ;             CALL sbc_gyre    ( kt )
+         ;             CALL sbc_flx     ( kt )
+         ;             CALL sbc_blk_clio( kt )
+         ;             CALL sbc_blk_core( kt )
+         ;             CALL sbc_cpl     ( kt )
+      END SELECT
+
+      ! Misc. Options
+      ! -------------
+
+!!gm  IF( ln_dm2dc       )   CALL sbc_dcy( kt )                 ! Daily mean qsr distributed over the Diurnal Cycle
+      
+      SELECT CASE( nn_ice )                                     ! Update sbc over ice-covered areas
+      CASE(  1 )   ;         CALL sbc_ice_if ( kt )                  ! Ice-cover climatology ("Ice-if" model)
+         !                                                           ! (update heat and freshwater fluxes)
+      CASE(  2 )   ;         CALL sbc_ice_lim_2( kt, nsbc )          ! LIM 2.0 ice model
+         !                                                           ! (update heat and freshwater fluxes)
+      CASE(  3 )   ;         CALL sbc_ice_lim  ( kt, nsbc )          ! LIM 3.0 ice model
+      END SELECT                                                     ! (update all fluxes using bulk + LIM)
+
+      IF( ln_ssr         )   CALL sbc_ssr( kt )                 ! add SST/SSS damping term
+
+      IF( ln_rnf         )   CALL sbc_rnf( kt )                 ! add runoffs to fresh water fluxes
+ 
+      IF( nn_fwb    /= 0 )   CALL sbc_fwb( kt, nn_fwb, nn_fsbc )         ! control the freshwater budget
+
+      IF( nclosea == 1 )   CALL sbc_clo( kt )                   ! treatment of closed sea in the model domain 
+      !                                                         ! (update freshwater fluxes)
+      !
+      IF(ln_ctl) THEN         ! print mean trends (used for debugging)
+         CALL prt_ctl(tab2d_1=emp    , clinfo1=' emp  - : ', mask1=tmask, ovlap=1)
+         CALL prt_ctl(tab2d_1=emps   , clinfo1=' emps - : ', mask1=tmask, ovlap=1)
+         CALL prt_ctl(tab2d_1=qns    , clinfo1=' qns  - : ', mask1=tmask, ovlap=1)
+         CALL prt_ctl(tab2d_1=qsr    , clinfo1=' qsr  - : ', mask1=tmask, ovlap=1)
+         CALL prt_ctl(tab3d_1=tmask  , clinfo1=' tmask  : ', mask1=tmask, ovlap=1, kdim=jpk)
+         CALL prt_ctl(tab3d_1=tn     , clinfo1=' sst  - : ', mask1=tmask, ovlap=1, kdim=1)
+         CALL prt_ctl(tab3d_1=sn     , clinfo1=' sss  - : ', mask1=tmask, ovlap=1, kdim=1)
+         CALL prt_ctl(tab2d_1=utau   , clinfo1=' utau - : ', mask1=umask, &
+                      tab2d_2=vtau   , clinfo2=' vtau - : ', mask2=vmask, ovlap=1)
+      ENDIF
+
+!!gm
+!!    ENDIF
+!!gm
+      !
+   END SUBROUTINE sbc
+
+   !!======================================================================
+END MODULE sbcmod
Index: trunk/NEMO/OPA_SRC/SBC/sbcrnf.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 888)
@@ -0,0 +1,245 @@
+MODULE sbcrnf
+   !!======================================================================
+   !!                       ***  MODULE  sbcrnf  ***
+   !! Ocean forcing:  river runoff
+   !!=====================================================================
+   !! History :       !  00-11  (R. Hordoir, E. Durand)  NetCDF FORMAT
+   !!            8.5  !  02-09  (G. Madec)  F90: Free form and module
+   !!            9.0  !  06-07  (G. Madec)  Surface module 
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   sbc_rnf      : monthly runoffs read in a NetCDF file
+   !!   rnf_mouth    : set river mouth mask
+   !!----------------------------------------------------------------------
+   USE dom_oce         ! ocean space and time domain
+   USE phycst          ! physical constants
+   USE dom_oce         ! ocean domain variables
+   USE sbc_oce         ! surface boundary condition variables
+   USE fldread         ! ???
+   USE in_out_manager  ! I/O manager
+   USE daymod          ! calendar
+   USE iom             ! I/O module
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC sbc_rnf          ! routine call in step module
+
+   !! * namsbc_rnf namelist
+   INTEGER           , PUBLIC ::   nn_runoff  = 1       !: runoffs flag
+   REAL(wp)          , PUBLIC ::   rn_hrnf    = 0.e0    !: runoffs, depth over which enhanced vertical mixing is used
+   REAL(wp)          , PUBLIC ::   rn_avt_rnf = 0.e0    !: runoffs, value of the additional vertical mixing coef. [m2/s]
+   CHARACTER(len=100), PUBLIC ::   cn_dir     = './'    !: Root directory for location of ssr files
+   TYPE(FLD_N)       , PUBLIC ::   sn_rnf               !: information about the runoff file to be read
+   TYPE(FLD_N)       , PUBLIC ::   sn_cnf               !: information about the runoff mouth file to be read
+   NAMELIST/namsbc_rnf/ nn_runoff, rn_hrnf, rn_avt_rnf, cn_dir, sn_rnf, sn_cnf
+
+   INTEGER , PUBLIC                     ::   nkrnf = 0   !: number of levels over which Kz is increased at river mouths
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rnfmsk      !: river mouth mask (hori.)
+   REAL(wp), PUBLIC, DIMENSION(jpk)     ::   rnfmsk_z    !: river mouth mask (vert.)
+
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_rnf   ! structure of input SST (file information, fields read)
+
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE sbc_rnf( kt )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE sbc_rnf  ***
+      !!       
+      !! ** Purpose :   Introduce a climatological run off forcing
+      !!
+      !! ** Method  :   Set each river mouth with a monthly climatology 
+      !!                provided from different data.
+      !!                CAUTION : upward water flux, runoff forced to be < 0
+      !!
+      !! ** Action  :   runoff updated runoff field at time-step kt
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt          ! ocean time step
+      !
+      INTEGER  ::   ji, jj   ! dummy loop indices
+      INTEGER  ::   ierror   ! temporary integer
+      !!----------------------------------------------------------------------
+      !                                                   !------------------!
+      IF( kt == nit000 ) THEN                             !  Initialisation  !
+         !                                                !------------------!
+         ! Default values (NB: frequency positive => hours, negative => months)
+         !            !   file    ! frequency !  variable  ! time intep !  clim  ! starting !
+         !            !   name    !  (hours)  !   name     !   (T/F)    !  (0/1) !  record  !
+         sn_rnf = FLD_N( 'runoffs',   -12.    , 'sorunoff' ,  .TRUE.    ,    1   ,     0    )
+         sn_cnf = FLD_N( 'runoffs',     0.    , 'sorunoff' ,  .FALSE.   ,    1   ,     0    )
+
+         !
+         REWIND ( numnam )                   ! Read Namelist namsbc_rnf
+         READ   ( numnam, namsbc_rnf )
+
+         ! Control print
+         IF(lwp) THEN
+            WRITE(numout,*)
+            WRITE(numout,*) 'sbc_rnf : runoff '
+            WRITE(numout,*) '~~~~~~~ '
+            WRITE(numout,*) '   Namelist namsbc_rnf'
+            WRITE(numout,*) '      runoff type (=-1/1/2)                      nn_runoff   = ', nn_runoff
+            WRITE(numout,*) '      river mouth additional Kz                  rn_avt_rnf  = ', rn_avt_rnf
+            WRITE(numout,*) '      depth of river mouth additional mixing     rn_hrnf     = ', rn_hrnf
+         ENDIF
+
+         IF( nn_runoff >= 1 ) THEN      ! set sf_rnf structure
+            !
+            ALLOCATE( sf_rnf(1), STAT=ierror )
+            IF( ierror > 0 ) THEN
+               CALL ctl_stop( 'sbc_rnf: unable to allocate sf_rnf structure' )   ;   RETURN
+            ENDIF
+            ! namelist informations stored in sf_rnf structures
+            WRITE( sf_rnf(1)%clrootname, '(a,a)' )   TRIM( cn_dir ), TRIM( sn_rnf%clname )
+            sf_rnf(1)%freqh   = sn_rnf%freqh
+            sf_rnf(1)%clvar   = sn_rnf%clvar
+            sf_rnf(1)%ln_tint = sn_rnf%ln_tint
+            sf_rnf(1)%nclim   = sn_rnf%nclim
+            sf_rnf(1)%nstrec  = sn_rnf%nstrec
+            IF(lwp) THEN             ! control print
+               WRITE(numout,*) '   Runoffs data read in the following file: '
+               WRITE(numout,*) '               root filename: '  , trim( sf_rnf(1)%clrootname ),   &
+                  &                          ' variable name: '  , trim( sf_rnf(1)%clvar      )
+               WRITE(numout,*) '               frequency: '      ,       sf_rnf(1)%freqh       ,   &
+                  &                          ' time interp: '    ,       sf_rnf(1)%ln_tint     ,   &
+                  &                          ' climatology: '    ,       sf_rnf(1)%nclim       ,   &
+                  &                          ' starting record: ',       sf_rnf(1)%nstrec
+            ENDIF
+         ENDIF
+
+         IF( nn_runoff == 1 ) THEN
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) '          No specific treatment at river mouths'
+            rnfmsk  (:,:) = 0.e0 
+            rnfmsk_z(:)   = 0.e0
+            nkrnf = 0
+         ELSE
+            !
+            ! Number of level over which Kz increase in vicinity of river mouths
+            IF( rn_hrnf == 0.e0 ) THEN
+               nkrnf = 0
+            ELSE
+               nkrnf = 2
+               DO WHILE( nkrnf == jpkm1 .OR. gdepw_0(nkrnf) > rn_hrnf )
+                  nkrnf = nkrnf + 1
+               END DO
+               IF( ln_sco )   &
+                  CALL ctl_warn( 'sbc_rnf: number of levels over which Kz is increased is computed for zco...' )
+            ENDIF
+            !
+            ! river mouths mask
+            CALL rnf_mouth            ! set river mouth mask
+            !
+         ENDIF
+
+         IF( nn_runoff /= -1 .AND. nn_runoff /= 1 .AND. nn_runoff /= 2 ) THEN
+            WRITE(ctmp1,*) 'sbc_rnf: Error nn_runoff = ', nn_runoff, ' /= -1, 1 or 2'
+            CALL ctl_stop( ctmp1 )
+         ENDIF
+
+         ! Control print
+         IF(lwp) THEN
+            IF( nn_runoff == -1 ) THEN
+               WRITE(numout,*) '          runoff directly provided in the precipitations'
+            ELSE
+               WRITE(numout,*) '          monthly runoff read in NetCDF file '
+            ENDIF
+            IF( nn_runoff ==  1 ) THEN
+               WRITE(numout,*) '          No Kz increase nor upstream advection at river mouths'
+            ELSE
+               IF(lwp) WRITE(numout,*) '          mixed upstream/centered at river mouths (ln_traadv_cen2=T) ' 
+               IF(lwp) WRITE(numout,*) '          Kz is increased by ', rn_avt_rnf,' m2/s  over ', nkrnf, ' w-levels'
+            ENDIF
+         ENDIF
+         !
+      ENDIF
+      !                                                   !-------------------!
+      IF( nn_runoff == 1 .OR. nn_runoff == 2 ) THEN       !   Update runoff   !
+         !                                                !-------------------!
+         !
+         CALL fld_read( kt, nn_fsbc, sf_rnf )   ! Read Runoffs data and provides it
+         !                                      ! at the current time-step
+
+         ! Runoff reduction only associated to the ORCA2_LIM configuration
+         ! when reading the NetCDF file runoff_1m_nomask.nc
+         IF( cp_cfg == 'orca' .AND. jp_cfg == 2 )   THEN
+            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)
+               END DO
+            END DO
+         ENDIF
+
+         ! C a u t i o n : runoff is negative and in kg/m2/s 
+
+         emp (:,:) = emp (:,:) - ABS( sf_rnf(1)%fnow(:,:) )
+         emps(:,:) = emps(:,:) - ABS( sf_rnf(1)%fnow(:,:) )
+         !
+      ENDIF
+      !
+   END SUBROUTINE sbc_rnf
+
+
+   SUBROUTINE rnf_mouth
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE rnf_mouth  ***
+      !!       
+      !! ** Purpose :   define the river mouths mask
+      !!
+      !! ** Method  :   read the river mouth mask (=0/1) in the river runoff
+      !!                climatological file. Defined a given vertical structure. 
+      !!                CAUTION, the vertical structure is hard coded on the 
+      !!                first 5 levels.
+      !!                This fields can be used to:
+      !!                 - set an upstream advection scheme  
+      !!                   (nn_runoff=2 and ln_traadv_cen2=T)
+      !!                 - increase vertical on the top nn_krnf vertical levels 
+      !!                   at river runoff input grid point (nn_krnf>=2, see step.F90)
+      !!                 - set to zero SSS restoring flux at river mouth grid points
+      !!
+      !! ** Action  :   rnfmsk   set to 1 at river runoff input, 0 elsewhere
+      !!                rnfmsk_z vertical structure
+      !!----------------------------------------------------------------------
+      USE closea, ONLY :    nclosea, clo_rnf   ! closed sea flag, rnfmsk update routine
+      !
+      INTEGER           ::   inum        ! temporary integers
+      CHARACTER(len=32) ::   cl_rnfile   ! runoff file name
+      !!----------------------------------------------------------------------
+      ! 
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'rnf_mouth : river mouth mask'
+      IF(lwp) WRITE(numout,*) '~~~~~~~~~ '
+
+      WRITE(cl_rnfile, '(a,a)')   TRIM( cn_dir ), TRIM( sn_cnf%clname )
+      SELECT CASE( sn_cnf%nclim )
+      CASE( 0 )
+         WRITE(cl_rnfile, '(a,a,"_",i4,".nc")' ) TRIM( cn_dir ), TRIM( sn_cnf%clname ), nyear
+      CASE( 1 )
+         WRITE(cl_rnfile, '(a,a,  "_0000.nc")' ) TRIM( cn_dir ), TRIM( sn_cnf%clname )
+      END SELECT
+
+      ! horizontal mask (read in NetCDF file)
+      CALL iom_open ( cl_rnfile, inum )                           ! open file
+      CALL iom_get  ( inum, jpdom_data, sn_cnf%clvar, rnfmsk )    ! read the river mouth array
+      CALL iom_close( inum )                                      ! close file
+      
+      IF( nclosea == 1 )    CALL clo_rnf( rnfmsk )                ! closed sea inflow set as ruver mouth
+
+      rnfmsk_z(:)   = 0.e0                                        ! vertical structure 
+      rnfmsk_z(1)   = 1.0
+      rnfmsk_z(2)   = 1.0                                         ! **********
+      rnfmsk_z(3)   = 0.5                                         ! HARD CODED on the 5 first levels
+      rnfmsk_z(4)   = 0.25                                        ! **********
+      rnfmsk_z(5)   = 0.125
+      !         
+   END SUBROUTINE rnf_mouth
+   
+   !!======================================================================
+END MODULE sbcrnf
Index: trunk/NEMO/OPA_SRC/SBC/sbcrnf_ORCA_R05.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcrnf_ORCA_R05.h90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcrnf_ORCA_R05.h90	(revision 888)
@@ -0,0 +1,1537 @@
+   !!----------------------------------------------------------------------
+   !!                  *** flxrnf_ORCA_R05.h90  ***
+   !!----------------------------------------------------------------------
+   !!   flx_rnf      : update ocean runoffs for ORCA_R05 configuration
+   !!----------------------------------------------------------------------
+   !! * Modules used
+   USE dom_oce         ! ocean space and time domain
+   USE phycst          ! physical constants
+   USE in_out_manager  ! I/O manager
+   USE daymod          ! calendar
+
+   IMPLICIT NONE
+   PRIVATE
+
+   !! * Routine accessibility
+   PUBLIC flx_rnf         ! routine call by step.F90
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
+      runoff,            &  !: monthly runoff (kg/m2/s)
+      upsadv,            &  !: mixed adv scheme in straits vicinity (hori.)
+      upsrnfh               !: mixed adv scheme in runoffs vicinity (hori.)
+   REAL(wp), PUBLIC, DIMENSION(jpk) ::   &  !:
+      upsrnfz               !: mixed adv scheme in runoffs vicinity (vert.)
+   INTEGER , PUBLIC ::   &  !:
+      nrunoff =  0          !: runoff option (namelist)
+
+   !! * Module variable
+   REAL(wp), DIMENSION(jpi,jpj,2) ::   &  !:
+      rnfdta                !: monthly runoff data array (kg/m2/s)
+   INTEGER    ::         &  !:
+      nrnf1, nrnf2          !: first and second record used
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
+   !! $ Id: $ 
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE flx_rnf( kt )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE flx_rnf  ***
+      !!       
+      !! ** Purpose :   Introduce a climatological run off forcing
+      !!
+      !! ** Method  :   ORCA R05 configuration
+      !!      Initialze each mouth of river with a monthly climatology 
+      !!      provided from different data.
+      !!     C a u t i o n : upward water flux, runoff is negative
+      !!                     set at the last loop of the routine
+      !!
+      !! ** Action :
+      !!
+      !! References : 
+      !!       J. D. Milliman and R. H. Meade, 1983 : world-wide delivery
+      !!          of river sediment to the oceans, journal of geology vol 91
+      !!          pp 1-21.
+      !!       G. L. Russell and J. R. Miller, 1990 : global river runoff
+      !!          calculated from a global atmospheric general circulation
+      !!          model, journal of hydrology, 117(1990), pp 241-254.
+      !!       F. Van Der Leeden, Troise F. L., Todd D. K. : the water
+      !!          encyclopedia, second edition, lewis publishers.
+      !!       J. W. Weatherly, J. E. Walsh : The effects of precipitation
+      !!          and river runoff in a coupled ice-ocean model of Arctic
+      !!          Climate dynamics 1996 12:785,798
+      !!       Jacobs et al. 1992. J. Glaciol. 38 (130) 375-387.
+      !!
+      !! History :
+      !!        !  94-10  (G.Madec, M. Pontaud, M. Imbard)  Original code
+      !!        !  97-03  (G.Madec)  time dependent version
+      !!        !  98-06  (J.M. Molines)  exact computation of zxy 
+      !!                         for months that are not 30 days
+      !!        !  98-07  (M. Imbard)  ORCA and mpp option
+      !!        !  99-08  (J.P. Boulanger H.L.Ayina)  New rivers and 
+      !!                         values given in m3/s 
+      !!        !  00-04  (G. Madec, K. Roberts) add antarctica ice discharge.
+      !!        !  00-11  (R. Hordoir, E. Durand)  NetCDF FORMAT
+      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
+      !!----------------------------------------------------------------------
+      !! * Modules used
+
+      !! * arguments
+      INTEGER, INTENT( in  ) ::   kt ! ocean time step
+
+#if defined key_coupled
+      runoff(:,:) = 0.0e0
+#else
+      !!----------------------------------------------------------------------
+      !!  ORCA_R05
+      !!----------------------------------------------------------------------
+      !! * Local declarations
+      INTEGER, PARAMETER ::   &
+         jpmois=12,   &  ! number of month in the year !
+         jpriv=200,   &  ! maximum number of rivers
+         jpcoef=20       ! maximum number of gridpoints for mouth rivers
+
+      INTEGER  ::   ji, jj, jl, jm, jn, jr, jc
+      INTEGER  ::   i15, imois, iman
+      INTEGER  ::   inbp, idbd, idmeom
+      INTEGER  ::   iirnf(jpcoef,jpriv),ijrnf(jpcoef,jpriv)
+      INTEGER  ::   inb(jpriv)
+
+      REAL(wp) ::   zconv, zxy
+      REAL(wp) ::   zrup1,zrup2,zrup3
+      REAL(wp) ::   zrnfm(jpmois, jpriv)
+      REAL(wp) ::   zcoefr(jpi, jpj, 5)
+      !!----------------------------------------------------------------------
+      !!  OPA 8.5, LODYC-IPSL (2002)
+      !!----------------------------------------------------------------------
+      ! ====
+      ! DATA
+      ! ====
+
+      ! I NORTH AMERICA
+      ! ---------------
+
+      ! 1-Saint Lawrence (Canada) 49N30 67W00               R2
+      ! Old=447 km3/year=14165m3/s; CLIPPER=12430m3/s; ratio=1.14
+      ! --> 13975.249m3/s
+      DATA inb(1)/3/
+      DATA (iirnf(jc,1),jc=1,jpcoef)/ 444, 444, 444, 17*0 /
+      DATA (ijrnf(jc,1),jc=1,jpcoef)/ 367, 368, 369, 17*0 /
+      DATA (zrnfm(jm,1),jm=1,jpmois)/   &
+          11718.,  11971.,  12466.,  14980.,  19257.,  16913.,   &
+          14211.,  13119.,  13367.,  13644.,  13463.,  12594./
+      ! 2-Hudson River (USA) 41N00 77W00                    R1
+      ! Old=12 km3/year=380m3/s; UNESCO(64-83,p255)=408m3/s
+      ! --> 407.416687m3/s
+      DATA inb(2)/1/
+      DATA (iirnf(jc,2),jc=1,jpcoef)/ 426, 19*0 /
+      DATA (ijrnf(jc,2),jc=1,jpcoef)/ 336, 19*0 /
+      DATA (zrnfm(jm,2),jm=1,jpmois)/   &
+          364.,    404.,    648.,    873.,    593.,    301.,   &
+          205.,    171.,    205.,    290.,    379.,    456./
+      ! 3-Missisipi and Atchafalaya (USA) 29N 90W           R1 
+      ! Old=580 km3/year=18380m3/s; CLIPPER=17599m3/s
+      ! --> 17599.334m3/s
+      DATA inb(3)/2/
+      DATA (iirnf(jc,3),jc=1,jpcoef)/ 397, 398, 18*0 /
+      DATA (ijrnf(jc,3),jc=1,jpcoef)/ 312, 313, 18*0 /
+      DATA (zrnfm(jm,3),jm=1,jpmois)/   &
+          19260.,  20813.,  23026.,  28160.,  26510.,  19650.,   &
+          14181.,  10676.,   9578.,  10167.,  11699.,  17472./
+      ! 4-Brazos (USA) 29N58 95W53                          R1
+      ! Old=7 km3/year=222m3/s; UNESCO(65-84, p298)=200m3/s
+      ! --> 199.666656m3/s
+      DATA inb(4)/1/
+      DATA (iirnf(jc,4),jc=1,jpcoef)/ 386, 19*0 /
+      DATA (ijrnf(jc,4),jc=1,jpcoef)/ 311, 19*0 /
+      DATA (zrnfm(jm,4),jm=1,jpmois)/   &
+          165.,    224.,    200.,    266.,    457.,    327.,   &
+          143.,     69.,    102.,    132.,    160.,    151./
+      ! 5-Colorado (Mexico) 31N54 114W57                    R5
+      ! Old=20 km3/year=634m3/s
+      ! --> 634.m3/s
+      DATA inb(5)/2/
+      DATA (iirnf(jc,5),jc=1,jpcoef)/ 347, 348, 18*0 /
+      DATA (ijrnf(jc,5),jc=1,jpcoef)/ 316, 316, 18*0 /
+      DATA (zrnfm(jm,5),jm=1,jpmois)/12*634./ 
+      ! 6-Columbia (USA) 45N60 121W17                       R1
+      ! Old=251 km3/year=7954m3/s; UNESCO(65-84, p312)=5368m3/s
+      ! --> 5368.41602m3/s
+      DATA inb(6)/2/
+      DATA (iirnf(jc,6),jc=1,jpcoef)/ 326, 326, 18*0 /
+      DATA (ijrnf(jc,6),jc=1,jpcoef)/ 360, 361, 18*0 /
+      DATA (zrnfm(jm,6),jm=1,jpmois)/   &
+          4752.,    5077.,    5633.,    6075.,    8422.,    9822.,   &
+          6350.,    4112.,    3273.,    3251.,    3548.,    4106./ 
+      ! 7-Fraser (USA)                                      R5
+      ! Old=112 km3/year=3550m3/s;not found in UNESCO
+      ! --> 3549.99976m3/s
+      DATA inb(7)/2/
+      DATA (iirnf(jc,7),jc=1,jpcoef)/ 317, 317, 18*0 /
+      DATA (ijrnf(jc,7),jc=1,jpcoef)/ 378, 379, 18*0 /
+      DATA (zrnfm(jm,7),jm=1,jpmois)/12*3550./ 
+      ! 8-Yukon (USA) 63N00 165W00                          R3
+      ! Old=195 km3/year=6179m3/s; UNESCO(65-77+80-84, p321)=4245; ratio=1.46
+      ! --> 6017.24951m3/s
+      DATA inb(8)/2/
+      DATA (iirnf(jc,8),jc=1,jpcoef)/ 244, 244, 18*0 /
+      DATA (ijrnf(jc,8),jc=1,jpcoef)/ 413, 414, 18*0 /
+      DATA (zrnfm(jm,8),jm=1,jpmois)/   &
+           1459.,    1213.,    1065.,    1100.,    9067.,   17675.,   &
+          10680.,   11271.,    8658.,    5453.,    2649.,    1917./ 
+      ! 9-Copper (USA) 61N47 144W45                         R2
+      ! Old=39 km3/year=1236m3/s; UNESCO(65-84, p317)=1052m3/s; ratio=1.18
+      ! --> 1236.25m3/s
+      DATA inb(9)/1/
+      DATA (iirnf(jc,9),jc=1,jpcoef)/ 274, 19*0 /
+      DATA (ijrnf(jc,9),jc=1,jpcoef)/ 409, 19*0 /
+      DATA (zrnfm(jm,9),jm=1,jpmois)/   &
+           219.,    195.,    181.,    214.,    904.,   2532.,   &
+          4026.,   3627.,   1632.,    697.,    354.,    254./ 
+      ! 10-Susitna (USA)                                    R5
+      ! Old=40 km3/year=1268m3/s
+      ! --> 1268.m3/s
+      DATA inb(10)/2/
+      DATA (iirnf(jc,10),jc=1,jpcoef)/ 263, 264, 18*0 /
+      DATA (ijrnf(jc,10),jc=1,jpcoef)/ 405, 405, 18*0 /
+      DATA (zrnfm(jm,10),jm=1,jpmois)/12*1268./ 
+      ! 11-McKenzie (Canada) 70N00 135W00                   R3
+      ! Old=306 km3/year=9697m3/s; UNESCO(67+72+7479+82-84, p168)=8343m3/s;
+      ! ratio=1.16
+      ! --> 9606.66797m3/s
+      DATA inb(11)/3/
+      DATA (iirnf(jc,11),jc=1,jpcoef)/ 272, 272, 272, 17*0 /
+      DATA (ijrnf(jc,11),jc=1,jpcoef)/ 451, 452, 453, 17*0 /
+      DATA (zrnfm(jm,11),jm=1,jpmois)/   &
+           3644.,    3400.,    3258.,    3546.,   14188.,   21544.,   &
+          18954.,   15487.,   11284.,   10169.,    5901.,    3905./
+      ! 12-Kuksokwim (USA) 60N00 ~162W30                    R4
+      ! UNESCO(65-84, p318)=1112m3/s (61N87 158E10, Crooked Creek, inland)
+      ! --> 1111.99988m3/s
+      DATA inb(12)/2/
+      DATA (iirnf(jc,12),jc=1,jpcoef)/ 244, 244, 18*0 /
+      DATA (ijrnf(jc,12),jc=1,jpcoef)/ 413, 414, 18*0 /
+      DATA (zrnfm(jm,12),jm=1,jpmois)/   &
+          335.,     308.,     295.,     407.,    2415.,    2027.,   &
+          1917.,   2049.,    1585.,    1072.,     545.,     389./     
+
+      DATA inb(13)/0/
+      DATA inb(14)/0/
+      DATA inb(15)/0/
+
+      ! Total run-offs(I)=60974.2539m3/s
+
+      ! II SOUTH AMERICA
+      ! -----------------
+      ! 16-Chira (Peru) 4s54 81w08                          R2
+      ! Old=5 km3/year=158m3/s; UNESCO (65-68, p357)=80.9; ratio=1.95
+      ! --> 158.000015m3/s
+      DATA inb(16)/1/
+      DATA (iirnf(jc,16),jc=1,jpcoef)/ 414, 19*0 /
+      DATA (ijrnf(jc,16),jc=1,jpcoef)/ 244, 19*0 /
+      DATA (zrnfm(jm,16),jm=1,jpmois)/   &
+          70.,     105.,     564.,     582.,     230.,      94.,   &
+          87.,      47.,      35.,      32.,      29.,      21./
+      ! 17-Magdalena (Colombia) 11N06 74W51                 R2
+      ! Old=237 km3/year=7510m3/s; UNESCO(71-73+76-79, p348)=6973m3/s;
+      ! ratio=1.08
+      ! --> 7451.58301m3/s
+      DATA inb(17)/2/
+      DATA (iirnf(jc,17),jc=1,jpcoef)/ 424, 424, 18*0 /
+      DATA (ijrnf(jc,17),jc=1,jpcoef)/ 270, 271, 18*0 /
+      DATA (zrnfm(jm,17),jm=1,jpmois)/   &
+          6598.,    4441.,    4087.,    5445.,    7380.,    8067.,   &
+          8509.,    7428.,    7631.,    9296.,   10588.,    9949./
+      ! 18-Orinoco (Venezuela) 8N37 62W15!                  R1
+      ! Old=1100 km3/year=34857m3/s; UNESCO(73-75, p364)=28736m3/s;
+      ! HLA=26371m3/s
+      ! Data from HLA: 8.1N - 63.3W   1925/89
+      ! --> 26371.416
+      DATA inb(18)/5/
+      DATA (iirnf(jc,18),jc=1,jpcoef)/ 451, 451, 452, 452, 452, 15*0 /
+      DATA (ijrnf(jc,18),jc=1,jpcoef)/ 271, 272, 271, 272, 272, 15*0 /
+      DATA (zrnfm(jm,18),jm=1,jpmois)/   &
+          10670.,    7513.,    6344.,    6887.,   13086.,   26699.,   &
+          43938.,   59957.,   57435.,   39951.,   27410.,   16567./ 
+      ! 19-Amazon (Brazil) 0S05 50W00                       R1
+      ! Old=6300 km3/year=199634m3/s; CLIPPER=166192m3/s~UNESCO;
+      ! HLA=184806m3/s
+      ! UNESCO data are at Obidos which is far inland and therefore does not
+      ! fully represent the actual discharge
+      ! Data from HLA: 1.5N - 55.3W   1970/96
+      ! --> 184845.484m3/s
+      DATA inb(19)/14/
+      DATA (iirnf(jc,19),jc=1,jpcoef)/ 475, 476, 476, 476, 476,  &
+                                       477, 477, 477, 477, 477,  &
+                                       478, 478, 478, 478, 6*0 /
+      DATA (ijrnf(jc,19),jc=1,jpcoef)/ 254, 251, 252, 253, 254,  &
+                                       250, 251, 252, 253, 254,  &
+                                       250, 251, 252, 253, 6*0 /
+      DATA (zrnfm(jm,19),jm=1,jpmois)/   &
+          152233., 176415., 199941., 225565., 244016., 244861.,   &
+          230711., 203128., 164531., 128486., 118214., 130045. /
+      ! 20-Sao Francisco (Brazil) 10S30 36W24               R1
+      ! Old=97 km3/year=3074m3/s; UNESCO(77-79, p338)=2645m3/s
+      ! --> 2645.3335m3/s
+      DATA inb(20)/1/
+      DATA (iirnf(jc,20),jc=1,jpcoef)/ 498, 19*0 /
+      DATA (ijrnf(jc,20),jc=1,jpcoef)/ 223, 19*0 /
+      DATA (zrnfm(jm,20),jm=1,jpmois)/   &
+          3244.,   4116.,   5139.,   4330.,   2323.,   1800.,     &
+          1587.,   1511.,   1593.,   1740.,   2190.,   2171. /
+      ! 21-Parana+Uruguay(Arg./Uru.) 34S12 58W18            R1 
+      ! Old=470 km3/year=14893m3/s; UNESCO(p323/324)=22263m3/s
+      ! --> 22203.168m3/s 
+      DATA inb(21)/5/
+      DATA (iirnf(jc,21),jc=1,jpcoef)/ 462, 462, 462, 462, 463, 15*0 /
+      DATA (ijrnf(jc,21),jc=1,jpcoef)/ 172, 173, 174, 175, 175, 15*0 /
+      DATA (zrnfm(jm,21),jm=1,jpmois)/   &
+          24803.,   26836.,   24585.,   21358.,   20041.,   21689.,   &
+          22647.,   20403.,   19627.,   21400.,   21126.,   21923./
+      ! 22-Negro (Argentina)  41S02  62W47                  R2
+      ! Old=30 km3/year=951m3/s; UNESCO(65-79,p330)=765m3/s; ratio=1.24
+      ! --> 907.666687m3/s
+      DATA inb(22)/2/
+      DATA (iirnf(jc,22),jc=1,jpcoef)/ 446, 447, 18*0 /
+      DATA (ijrnf(jc,22),jc=1,jpcoef)/ 160, 160, 18*0 /
+      DATA (zrnfm(jm,22),jm=1,jpmois)/   &
+          882.,     587.,     519.,     482.,     623.,     984.,   &
+          1120.,   1294.,    1092.,    1166.,    1105.,    1038./
+      ! 23- Tocantins :  ~48W00 ~0.5S                       R4
+      ! UNESCO(76-77+80-81, p335)=12167m3/s (station far inland!)
+      ! --> 12173.082m3/s
+      DATA inb(23)/4/
+      DATA (iirnf(jc,23),jc=1,jpcoef)/ 479, 480, 481, 482, 16*0 /
+      DATA (ijrnf(jc,23),jc=1,jpcoef)/ 249, 249, 249, 249, 16*0 /
+      DATA (zrnfm(jm,23),jm=1,jpmois)/   &
+          15507.,  24855.,  27854.,  24257.,  15860.,   7861.,   &
+          4440.,   3082.,   2728.,   3417.,   5511.,  10705. /
+
+      DATA inb(24)/0/
+      DATA inb(25)/0/
+
+      ! Total run-offs(II)=256755.75
+      ! Total run-offs(I+II)=317730
+
+      ! III EUROPE
+      ! ----------
+      ! 26-Rhone (France) 43N20 4E50                        R1 
+      ! Old=49 km3/year=1553m3/s; UNESCO(65-83, p512)=1229
+      ! --> 1217.16663m3/s
+      DATA inb(26)/1/
+      DATA (iirnf(jc,26),jc=1,jpcoef)/ 584, 19*0 /
+      DATA (ijrnf(jc,26),jc=1,jpcoef)/ 347, 19*0 /
+      DATA (zrnfm(jm,26),jm=1,jpmois)/   &
+          1385.,    1848.,    1568.,    1311.,    1420.,    1191.,   &
+           937.,     796.,     794.,     962.,    1161.,    1233./
+      ! 27-Po (Italy) 11N10 1W09                            R1 
+      ! Old=46 km3/year=1458m3/s; UNESCO(65-84, p527)=1550m3/s
+      ! --> 1550.08337m3/s
+      DATA inb(27)/1/
+      DATA (iirnf(jc,27),jc=1,jpcoef)/ 599, 19*0 /
+      DATA (ijrnf(jc,27),jc=1,jpcoef)/ 355, 19*0 /
+      DATA (zrnfm(jm,27),jm=1,jpmois)/   &
+          1304.,    1605.,    1856.,    1549.,    1958.,    1760.,   &
+          1040.,    1007.,    1615.,    1907.,    1772.,    1228./
+      ! 28-Danube (Roumania) 45N20 29E40                    R1 
+      ! Old=206 km3/year=6527m3/s; UNESCO(65-84, p544)=7011m3/s
+      ! --> 7011.8335m3/s
+      DATA inb(28)/2/
+      DATA (iirnf(jc,28),jc=1,jpcoef)/ 632, 632, 18*0 /
+      DATA (ijrnf(jc,28),jc=1,jpcoef)/ 356, 357, 18*0 /
+      DATA (zrnfm(jm,28),jm=1,jpmois)/   &
+          6625.,    7352.,    7986.,    9279.,    9482.,    8618.,   &
+          7586.,    6001.,    5210.,    4989.,    4921.,    6093./
+
+      DATA inb(29)/0/
+      DATA inb(30)/0/
+
+      ! Total run-offs(III)=9779.08301m3/s
+      ! Total run-offs(I+II+III)=327509.094m3/s
+      
+      ! IV EURASIAN ARCTIC
+      ! ------------------
+      ! 31-Iana (Russia)                                    R1
+      ! Old=29 km3/year=919m3/s; UNESCO(65-72+74+76-84, p463)=936m3/s
+      ! --> 0m3/s
+      DATA inb(31)/0/
+      DATA (iirnf(jc,31),jc=1,jpcoef)/ 20*0 /
+      DATA (ijrnf(jc,31),jc=1,jpcoef)/ 20*0 /
+      DATA (zrnfm(jm,31),jm=1,jpmois)/   &
+             2.,       1.,       0.,       0.,     917.,    3514.,   &
+          2968.,    2329.,    1322.,     178.,      36.,       8./ 
+      ! 32-Ob (Russia) 66N45 69E30                          R1 
+      ! Old=385 km3/year=12200m3/s; UNESCO(65-84, p478)=12862m3/s
+      ! --> 12861.5m3/s
+      DATA inb(32)/8/
+      DATA (iirnf(jc,32),jc=1,jpcoef)/ 635, 635, 636, 636, 636,637, 637,637,12*0 /
+      DATA (ijrnf(jc,32),jc=1,jpcoef)/ 508, 509, 509, 508, 507,509, 508,507,12*0 /
+     DATA (zrnfm(jm,32),jm=1,jpmois)/12*0./
+!CT bug     DATA (zrnfm(jm,32),jm=1,jpmois)/   &
+!CT bug          4977.,    4150.,    3611.,    3590.,   14723.,   33366.,   &
+!CT bug         30773.,   22785.,   14701.,    9705.,    6078.,    5879./
+      ! 33-Yenesei (Russia) 71N50 82E40                     R1 
+      ! Old=560 km3/year=17745m3/s; UNESCO(65-84, p472)=17462m3/s
+      ! --> 17461.666m3/s
+      DATA inb(33)/9/
+      DATA (iirnf(jc,33),jc=1,jpcoef)/ 114,115,115,116, 117,117,117,118,118,11*0 /
+      DATA (ijrnf(jc,33),jc=1,jpcoef)/ 504,504,503,503, 501,502,503,502,501,11*0 /
+      DATA (zrnfm(jm,33),jm=1,jpmois)/   &
+           6659.,    7007.,    6895.,    7089.,   24183.,   74965.,   &
+          25325.,   15940.,   16050.,   12678.,    6741.,    6008./
+      ! 34-Severnaya Dvina(Russia)64N32 40E30               R5 
+      ! Old=106 km3/year=3359m3/s; not in UNESCO data base
+      ! --> 3359.00024m3/s
+      DATA inb(34)/2/
+      DATA (iirnf(jc,34),jc=1,jpcoef)/ 620, 620, 18*0 /
+      DATA (ijrnf(jc,34),jc=1,jpcoef)/ 448, 449, 18*0 /
+      DATA (zrnfm(jm,34),jm=1,jpmois)/12*3359./
+      ! 35-Lena (Russia) 72N25 126E40                       R1 
+      ! --> 16192.333m3/s
+      DATA inb(35)/9/
+      DATA (iirnf(jc,35),jc=1,jpcoef)/ 142,143,148,148,149,149,150,150,150,11*0 /
+      DATA (ijrnf(jc,35),jc=1,jpcoef)/ 458,458,456,448,449,448,451,450,449,11*0 /
+      DATA (zrnfm(jm,35),jm=1,jpmois)/   &
+           2663.,    2095.,    1629.,    1324.,    7203.,   64230.,   &
+          40810.,   28310.,   25995.,   13299.,    3673.,    3077./
+      ! 36-Kolyma (Russia) 69N30 161E00                     R1
+      ! Old=71 km3/year=2250m3/s; UNESCO(65-84)=2138m3/s
+      ! --> 2138.66675m3/s
+      DATA inb(36)/2/
+      DATA (iirnf(jc,36),jc=1,jpcoef)/ 184, 185, 18*0 /
+      DATA (ijrnf(jc,36),jc=1,jpcoef)/ 429, 429, 18*0 /
+      DATA (zrnfm(jm,36),jm=1,jpmois)/   &
+           131.,      92.,      76.,      65.,    2576.,    9143.,   &
+          4670.,    3727.,    3226.,    1119.,     630.,     209./
+      ! 37-Indigirka (russia) 70N48 148E54                  R1 
+      ! Old=55 km3/year=1743m3/s; UNESCO(65-68+70+72-84)=1622.
+      ! --> 1622.00012m3/s
+      DATA inb(37)/1/
+      DATA (iirnf(jc,37),jc=1,jpcoef)/ 172, 19*0 /
+      DATA (ijrnf(jc,37),jc=1,jpcoef)/ 438, 19*0 /
+      DATA (zrnfm(jm,37),jm=1,jpmois)/   &
+            32.,      17.,      11.,       7.,     354.,    5629.,   &
+          5210.,    4617.,    2823.,     559.,     142.,      63./
+
+      DATA inb(38)/0/
+      DATA inb(39)/0/
+      DATA inb(40)/0/
+
+      ! Total run-offs(IV)=40773.6641m3/s
+      ! Total run-offs(I+II+III+IV)=368282.75m3/s
+
+      ! V ASIA
+      ! ------
+      ! 41-Amur (Russia) 52N56 141E10                       R2
+      ! Old=325 km3/year=10299m3/s; UNESCO(65-84, p451)=8792m3/s; ratio=1.17
+      ! --> 10299.332m3/s
+      DATA inb(41)/2/
+      DATA (iirnf(jc,41),jc=1,jpcoef)/ 141, 141, 18*0 /
+      DATA (ijrnf(jc,41),jc=1,jpcoef)/ 381, 382, 18*0 /
+      DATA (zrnfm(jm,41),jm=1,jpmois)/   &
+           2108.,    1543.,    1252.,    4088.,   15464.,   17336.,   &
+          16100.,   20801.,   21548.,   15658.,    5188.,    2506./
+      ! 42-Liaohe (China) 40N40 122E09                      R5
+      ! Old=6 km3/year=190m3/s; not found in UNESCO data base
+      ! --> 189.999985m3/s
+      DATA inb(42)/1/
+      DATA (iirnf(jc,42),jc=1,jpcoef)/ 100, 19*0 /
+      DATA (ijrnf(jc,42),jc=1,jpcoef)/ 342, 19*0 /
+      DATA (zrnfm(jm,42),jm=1,jpmois)/12*190./
+      ! 43-Daling (China) 40N56 121E43                      R5
+      ! Old=1 km3/year=32m3/s; not found in UNESCO data base
+      ! --> 31.9999962m3/s
+      DATA inb(43)/2/
+      DATA (iirnf(jc,43),jc=1,jpcoef)/  99, 100, 18*0 /
+      DATA (ijrnf(jc,43),jc=1,jpcoef)/ 342, 342, 18*0 /
+      DATA (zrnfm(jm,43),jm=1,jpmois)/12*32./
+      ! 44-Haiho (China) 6N17   1E23
+      ! Old=2 km3/year=64m3/s; not found in UNESCO data base
+      ! --> 63.9999924m3/s
+      DATA inb(44)/1/
+      DATA (iirnf(jc,44),jc=1,jpcoef)/ 121, 19*0 /
+      DATA (ijrnf(jc,44),jc=1,jpcoef)/ 348, 19*0 /
+      DATA (zrnfm(jm,44),jm=1,jpmois)/12*64./
+      ! 45-Yellow/Huangho (China) 37N32 118E19              R2 
+      ! Old=49 km3/year=1553m3/s; UNESCO(p371)=1210m3/s; ratio=1.28
+      ! --> 1552.5m3/s
+      DATA inb(45)/3/
+      DATA (iirnf(jc,45),jc=1,jpcoef)/  92,  92,  92, 17*0 /
+      DATA (ijrnf(jc,45),jc=1,jpcoef)/ 336, 337, 338, 17*0 /
+      DATA (zrnfm(jm,45),jm=1,jpmois)/   &
+           697.,     674.,    1282.,    1206.,    1109.,     778.,   &
+          1964.,    3270.,    3668.,    2133.,     978.,     871./
+      ! 46-Yangtze (China) 31N48 121E10=Changjiang          R2
+      ! Old=900 km3/year=28520m3/s; UNESCO(p372)=25032m3/s; ratio=1.14
+      ! --> 28519.584m3/s
+      DATA inb(46)/2/
+      DATA (iirnf(jc,46),jc=1,jpcoef)/ 100, 100, 18*0 /
+      DATA (ijrnf(jc,46),jc=1,jpcoef)/ 316, 317, 18*0 /
+      DATA (zrnfm(jm,46),jm=1,jpmois)/   &
+          10994.,   10548.,   13254.,   24097.,   36972.,   47197.,   &
+          53891.,   42070.,   37627.,   30762.,   22046.,   12777./
+      ! 47-Pearl/Zhujiang (China) 23N36 106E34=Xijiang      R2 
+      ! Old=302 km3/year=9570m3/s; UNESCO(76,82, p373)=6987m3/s; ratio=1.37
+      ! --> 9570.75m3/s
+      DATA inb(47)/2/
+      DATA (iirnf(jc,47),jc=1,jpcoef)/  72,  73, 18*0 /
+      DATA (ijrnf(jc,47),jc=1,jpcoef)/ 294, 294, 18*0 /
+      DATA (zrnfm(jm,47),jm=1,jpmois)/   &
+           2357.,    2415.,    2634.,    6446.,   14246.,   18395.,   &
+          19213.,   17558.,   12312.,    7255.,    5864.,    6154./
+      ! 48-Red/Hungho (Vietnam) 20N17 106E34                R5 
+      ! Old=123 km3/year=3897m3/s; not in UNESCO data base
+      ! --> 3897.m3/s
+      DATA inb(48)/3/
+      DATA (iirnf(jc,48),jc=1,jpcoef)/  68,  68,  68, 17*0 /
+      DATA (ijrnf(jc,48),jc=1,jpcoef)/ 288, 289, 290, 17*0 /
+      DATA (zrnfm(jm,48),jm=1,jpmois)/12*3897./
+      ! 49-Mekong (Vietnam) 10N33 105E24                    R5
+      ! Old=470 km3/year=14893m3/s; not in UNESCO data base
+      ! --> 14893.0029m3/s
+      DATA inb(49)/3/
+      DATA (iirnf(jc,49),jc=1,jpcoef)/  69,  69,  70, 17*0 /
+      DATA (ijrnf(jc,49),jc=1,jpcoef)/ 269, 270, 270, 17*0 /
+      DATA (zrnfm(jm,49),jm=1,jpmois)/12*14893./
+
+      DATA inb(50)/0/
+      DATA inb(51)/0/
+      DATA inb(52)/0/
+
+      ! 53-Damodar (India)                                  R2
+      ! Old=10 km3/year=320m3/s; UNESCO(p386)=173m3/s; ratio=1.85
+      ! --> 432.916656m3/s
+      DATA inb(53)/1/
+      DATA (iirnf(jc,53),jc=1,jpcoef)/  30, 19*0 /
+      DATA (ijrnf(jc,53),jc=1,jpcoef)/ 294, 19*0 /
+      DATA (zrnfm(jm,53),jm=1,jpmois)/   &
+           51.,      37.,      42.,      49.,      85.,     296.,   &
+          896.,    1390.,    1591.,     542.,     172.,      44./   
+
+      DATA inb(54)/0/
+      DATA inb(55)/0/
+      DATA inb(56)/0/
+      DATA inb(57)/0/
+      DATA inb(58)/0/
+      DATA inb(59)/0/
+      DATA inb(60)/0/
+
+      ! Total run-offs (V)=128642.922m3/s
+      ! Total run-offs (I+II+III+IV+V)=496925.688m3/s
+
+      ! VI AFRICA
+      ! ----------
+      ! 61-Nile (Egypt) 30N10  31E06                        R1
+      ! Old=30 km3/year=951m3/s; UNESCO(73-84)=1251m3/s
+      ! --> 1251.33337m3/s
+      DATA inb(61)/3/
+      DATA (iirnf(jc,61),jc=1,jpcoef)/ 636, 636, 637, 17*0 /
+      DATA (ijrnf(jc,61),jc=1,jpcoef)/ 317, 318, 318, 17*0 /
+      DATA (zrnfm(jm,61),jm=1,jpmois)/   &
+          1239.,    1035.,    1126.,    1110.,    1170.,    1542.,   &
+          1742.,    1559.,    1191.,    1103.,    1075.,    1124./   
+      ! 62-Niger (Nigeria) 5N33   6E33                      R1
+      ! Old=192 km3/year=6084m3/s; HLA=5545m3/s;
+      ! Data from HLA: 4.5N -  6  E   1950/87
+      ! --> 5545.08301m3/s
+      DATA inb(62)/3/
+      DATA (iirnf(jc,62),jc=1,jpcoef)/ 591, 592, 593, 17*0 /
+      DATA (ijrnf(jc,62),jc=1,jpcoef)/ 258, 258, 258, 17*0 /
+      DATA (zrnfm(jm,62),jm=1,jpmois)/   &
+          2029.,    1804.,    1573.,    1418.,    1494.,    2561.,   &
+          5272.,    9629.,   14951.,   16227.,    6842.,    2741./   
+      ! 63-Zaire/Congo (Congo) 6S04  12E24                  R1      
+      ! Old=1250 km3/year=39610m3/s; UNESCO(65-83, p149)=41941m3/s; HLA
+      ! =39720m3/s
+      ! Data from HLA: 6S - 12  E   1902/96
+      ! --> 39719.5m3/s
+      DATA inb(63)/4/
+      DATA (iirnf(jc,63),jc=1,jpcoef)/ 599, 599, 600, 600, 16*0 /
+      DATA (ijrnf(jc,63),jc=1,jpcoef)/ 237, 238, 236, 237, 16*0 /
+      DATA (zrnfm(jm,63),jm=1,jpmois)/   &
+          47200.,   37692.,   34374.,   36603.,   37862.,   35588.,   &
+          30966.,   30774.,   35981.,   42825.,   51455.,   55314./  
+      ! 64-Orange (Sth Africa) 28S41 16E28                  R5
+      ! Old=11 km3/year=349m3/s
+      ! --> 349.000031m3/s
+      DATA inb(64)/2/
+      DATA (iirnf(jc,64),jc=1,jpcoef)/ 609, 609, 18*0 /
+      DATA (ijrnf(jc,64),jc=1,jpcoef)/ 188, 189, 18*0 /
+      DATA (zrnfm(jm,64),jm=1,jpmois)/12*349./
+      ! 65-Zambesi (Mozambique) 18S55 36E04                 R5
+      ! Old=223 km3/year=7066m3/s
+      ! --> 7066.00049m3/s
+      DATA inb(65)/3/
+      DATA (iirnf(jc,65),jc=1,jpcoef)/ 646, 646, 646, 17*0 /
+      DATA (ijrnf(jc,65),jc=1,jpcoef)/ 207, 208, 209, 17*0 /
+      DATA (zrnfm(jm,65),jm=1,jpmois)/12*7066./
+      ! 66-Limpopo (mozambique) 25S15 33E30                 R5
+      ! Old=5 km3/year=158m3/s
+      ! --> 158.m3/s
+      DATA inb(66)/2/
+      DATA (iirnf(jc,66),jc=1,jpcoef)/ 642, 642, 18*0 /
+      DATA (ijrnf(jc,66),jc=1,jpcoef)/ 196, 197, 18*0 /
+      DATA (zrnfm(jm,66),jm=1,jpmois)/12*158./
+      ! 67-Rufiji (tanzania) 8S00 39E20                     R5
+      ! Old=9 km3/year=285m3/s
+      ! --> 285.m3/s
+      DATA inb(67)/1/
+      DATA (iirnf(jc,67),jc=1,jpcoef)/ 655, 19*0 /
+      DATA (ijrnf(jc,67),jc=1,jpcoef)/ 235, 19*0 /
+      DATA (zrnfm(jm,67),jm=1,jpmois)/12*285./
+      ! Other rivers from the Gulf of Guinea
+      ! 68-Kouilou (Congo)  4.5S-11.5E (UNESCO=p51)         R1
+      ! Data from HLA:  4S - 11  E   1953/86 = 919m3/s
+      ! --> 924.25m3/s
+      DATA inb(68)/1/
+      DATA (iirnf(jc,68),jc=1,jpcoef)/ 599, 19*0 /
+      DATA (ijrnf(jc,68),jc=1,jpcoef)/ 240, 19*0 /
+      DATA (zrnfm(jm,68),jm=1,jpmois)/   &
+          1115.,    1166.,    1285.,    1462.,    1454.,     725.,   &
+           480.,     378.,     327.,     400.,    1018.,    1281./
+      ! 69-Nyanga (Gabon)  3S-10E (UNESCO=p66)              R1
+      ! Data from HLA: 2.8N - 10  E   1952/82 = 264m3/s
+      ! --> 264.166687m3/s
+      DATA inb(69)/1/
+      DATA (iirnf(jc,69),jc=1,jpcoef)/ 595, 19*0 /
+      DATA (ijrnf(jc,69),jc=1,jpcoef)/ 244, 19*0 /
+      DATA (zrnfm(jm,69),jm=1,jpmois)/   &
+          126.,      99.,     143.,     253.,     316.,     300.,   &
+          156.,      93.,     231.,     557.,     592.,     304./
+      ! 70-Ogoue (Gabon) 1S-9E (UNESCO, p69)                R1
+      ! Data from HLA: .75S -  9  E   1930/90 = 4512m3/s
+      ! --> 4511.83301m3/s
+      DATA inb(70)/2/
+      DATA (iirnf(jc,70),jc=1,jpcoef)/ 593, 593, 18*0 /
+      DATA (ijrnf(jc,70),jc=1,jpcoef)/ 247, 248, 18*0 /
+      DATA (zrnfm(jm,70),jm=1,jpmois)/   &
+          4514.,    3988.,    4622.,    5403.,    5790.,    4145.,   &
+          2616.,    1961.,    2119.,    4304.,    7870.,    6810./
+      ! 71-Sanaga (Cameroun) 3.5N-9.5E (UNESCO, p31)        R1
+      ! Data from HLA: 3.9N -  9.6E   1944/80 = 1983m3/s
+      ! --> 1982.58337m3/s
+      DATA inb(71)/2/
+      DATA (iirnf(jc,71),jc=1,jpcoef)/ 595, 595, 18*0 /
+      DATA (ijrnf(jc,71),jc=1,jpcoef)/ 255, 256, 18*0 /
+      DATA (zrnfm(jm,71),jm=1,jpmois)/   &
+           813.,     578.,     517.,     633.,     909.,    1278.,   &
+          1928.,    2653.,    4361.,    5470.,    3307.,    1344./
+      ! 72-Nyong (Cameroun) 3.1N-9.5E (UNESCO, p36)         R1
+      ! Data from HLA: 3.5N -  9.8E   1951/84 = 432m3/s
+      ! --> 431.166656m3/s      
+      DATA inb(72)/1/
+      DATA (iirnf(jc,72),jc=1,jpcoef)/ 594, 19*0 /
+      DATA (ijrnf(jc,72),jc=1,jpcoef)/ 257, 19*0 /
+      DATA (zrnfm(jm,72),jm=1,jpmois)/   &
+          232.,     128.,     150.,     266.,     402.,     459.,   &
+          353.,     306.,     604.,     930.,     878.,     466./
+      ! 73-Ntem (Cameroun) 2.5N-9.5E (UNESCO, p36)          R1
+      ! Data from HLA: 3N -  9.8E   1951/87 = 330m3/s      
+      ! --> 329.75m3/s
+      DATA inb(73)/1/
+      DATA (iirnf(jc,73),jc=1,jpcoef)/ 594, 19*0 /
+      DATA (ijrnf(jc,73),jc=1,jpcoef)/ 254, 19*0 /
+      DATA (zrnfm(jm,73),jm=1,jpmois)/   &
+          452.,     455.,     492.,     466.,     482.,     251.,   &
+          151.,     108.,      87.,     133.,     395.,     485./
+      ! 74-Wouri (Cameroun) 4N-9.5E (UNESCO, p34)           R1
+      ! Data from HLA: 4N -  9.5E   1951/84  = 307m3/s
+      ! --> 306.583374m3/s
+      DATA inb(74)/1/
+      DATA (iirnf(jc,74),jc=1,jpcoef)/ 594, 19*0 /
+      DATA (ijrnf(jc,74),jc=1,jpcoef)/ 257, 19*0 /
+      DATA (zrnfm(jm,74),jm=1,jpmois)/   &
+           88.,      63.,      68.,      95.,     139.,     222.,   &
+          395.,     633.,     825.,     675.,     328.,     148./
+      ! 75-Oueme (Benin) 6.5N-2.5E (UNESCO, p27)            R1
+      ! Data from HLA:  6.2N -  2.5E   1951/84 =113m3/s
+      ! --> 112.666664m3/s
+      DATA inb(75)/1/
+      DATA (iirnf(jc,75),jc=1,jpcoef)/ 583, 19*0 /
+      DATA (ijrnf(jc,75),jc=1,jpcoef)/ 262, 19*0 /
+      DATA (zrnfm(jm,75),jm=1,jpmois)/   &
+           0.,       0.,       0.,       0.,       1.,      18.,   &
+          96.,     324.,     531.,     319.,      58.,       5./
+      ! 76-Mono(Tepetou,Benin/Togo) 6.25N-1.8E (U, p27)     R1
+      ! Data from HLA: 6.2N -  1  E   1951/85  = 96m3/s       
+      ! --> 96.4999924m3/s
+      DATA inb(76)/2/
+      DATA (iirnf(jc,76),jc=1,jpcoef)/ 578, 579, 18*0 /
+      DATA (ijrnf(jc,76),jc=1,jpcoef)/ 262, 262, 18*0 /
+      DATA (zrnfm(jm,76),jm=1,jpmois)/   &
+            2.,       1.,       1.,       4.,       8.,      44.,   &
+          168.,     274.,     386.,     215.,      47.,       8./
+      ! 77-Comoe (Ivory Coast) 5N-4W (UNESCO, p56)          R1
+      ! Data from HLA: 5.1N -  4  W   1955/86 = 194m3/s       
+      ! --> 194.25m3/s
+      DATA inb(77)/1/
+      DATA (iirnf(jc,77),jc=1,jpcoef)/ 569, 19*0 /
+      DATA (ijrnf(jc,77),jc=1,jpcoef)/ 260, 19*0 /
+      DATA (zrnfm(jm,77),jm=1,jpmois)/   &
+           14.,       7.,       9.,      17.,      29.,      90.,   &
+          145.,     349.,     740.,     688.,     198.,      45./
+      ! 78-Sassandra (Ivory Coast) 5N-6W (UNESCO, p58)      R1
+      ! Data from HLA: 5N -  6  W   1953/86 = 449m3/s
+      ! --> 449.333344m3/s
+      DATA inb(78)/1/
+      DATA (iirnf(jc,78),jc=1,jpcoef)/ 564, 19*0 /
+      DATA (ijrnf(jc,78),jc=1,jpcoef)/ 260, 19*0 /
+      DATA (zrnfm(jm,78),jm=1,jpmois)/   &
+          144.,     116.,     119.,     143.,     156.,     334.,   &
+          419.,     692.,    1277.,    1190.,     553.,     249./
+      
+      DATA inb(79)/0/
+      DATA inb(80)/0/
+      DATA inb(81)/0/
+      DATA inb(82)/0/
+      DATA inb(83)/0/
+      DATA inb(84)/0/
+      DATA inb(85)/0/
+      DATA inb(86)/0/
+      DATA inb(87)/0/
+      DATA inb(88)/0/
+      DATA inb(89)/0/
+      DATA inb(90)/0/
+
+      ! Total run-offs (VI)=63977.m3/s
+      ! Total run-offs (I+II+III+IV+V+VI)=560902.688m3/s
+
+      ! VII OCEANIA
+      ! ------------
+      ! 91-Murray (Austrlia) 35S34 138E54                   R5
+      ! Old=22 km3/year=697m3/s
+      ! --> 696.999939m3/s
+      DATA inb(91)/3/
+      DATA (iirnf(jc,91),jc=1,jpcoef)/ 129, 130, 130, 17*0 /
+      DATA (ijrnf(jc,91),jc=1,jpcoef)/ 177, 176, 177, 17*0 /
+      DATA (zrnfm(jm,91),jm=1,jpmois)/12*697./
+      ! 92-Haast (N. Zeland) 43S50 169E02                   R5
+      ! Old=6 km3/year=190m3/s
+      ! --> 189.999985m3/s
+      DATA inb(92)/1/
+      DATA (iirnf(jc,92),jc=1,jpcoef)/ 194, 19*0 /
+      DATA (ijrnf(jc,92),jc=1,jpcoef)/ 153, 19*0 /
+      DATA (zrnfm(jm,92),jm=1,jpmois)/12*190./
+      ! 93-Fly (N. Guinea) 8S30 143E05                      R5
+      ! Old=77 km3/year=2440m3/s
+      ! --> 2440.m3/s
+      DATA inb(93)/1/
+      DATA (iirnf(jc,93),jc=1,jpcoef)/ 143, 19*0 /
+      DATA (ijrnf(jc,93),jc=1,jpcoef)/ 233, 19*0 /
+      DATA (zrnfm(jm,93),jm=1,jpmois)/12*2440./
+      ! 94-Purari (N. Guinea) 7S25 145E05                   R4
+      ! Old=77 km3/year=2440m3/s; UNESCO(77+83,p595)=2727m3/s
+      ! --> 2727.33325m3/s
+      DATA inb(94)/1/
+      DATA (iirnf(jc,94),jc=1,jpcoef)/ 146, 19*0 /
+      DATA (ijrnf(jc,94),jc=1,jpcoef)/ 234, 19*0 /
+      DATA (zrnfm(jm,94),jm=1,jpmois)/   &
+          1972.,    3067.,    2332.,    2981.,    2693.,    2876.,   &
+          2867.,    3477.,    2195.,    2967.,    2674.,    2627./
+      ! 95-Choshui ch''i (taiwan) 24N03 120E23              R2
+      ! Old=6 km3/year=190m3/s; UNESCO(65-68, p374)=120m3/s; ratio=1.58 
+      ! --> 0.m3/s
+      DATA inb(95)/0/
+      DATA (iirnf(jc,95),jc=1,jpcoef)/  20*0 /
+      DATA (ijrnf(jc,95),jc=1,jpcoef)/  20*0 /
+      DATA (zrnfm(jm,95),jm=1,jpmois)/   &
+           65.,      63.,      83.,     100.,     177.,     535.,   &
+          332.,     313.,     236.,     193.,     101.,      84./
+      ! 96-Kaoping (Taiwan)                                 R5  
+      ! Old=9 km3/year=285m3/s
+      ! --> 0.m3/s
+      DATA inb(96)/0/
+      DATA (iirnf(jc,96),jc=1,jpcoef)/ 20*0 /
+      DATA (ijrnf(jc,96),jc=1,jpcoef)/ 20*0 /
+      DATA (zrnfm(jm,96),jm=1,jpmois)/12*285./
+      ! 97-Tsengwen (Taiwan)                                R5
+      ! Old=2 km3/year=63m3/s
+      ! --> 0.m3/s
+      DATA inb(97)/0/
+      DATA (iirnf(jc,97),jc=1,jpcoef)/ 20*0 /
+      DATA (ijrnf(jc,97),jc=1,jpcoef)/ 20*0 /
+      DATA (zrnfm(jm,97),jm=1,jpmois)/12*63./
+      ! 98-Hualien (Taiwan)                                 R5
+      ! Old=4 km3/year=127m3/s
+      ! --> 0.m3/s
+      DATA inb(98)/0/
+      DATA (iirnf(jc,98),jc=1,jpcoef)/ 20*0 /
+      DATA (ijrnf(jc,98),jc=1,jpcoef)/ 20*0 /
+      DATA (zrnfm(jm,98),jm=1,jpmois)/12*127./
+      ! 99-Peinan (Taiwan) 22N46 121E10                     R5
+      ! Old=4 km3/year=127m3/s
+      ! --> 127.000008m3/s
+      DATA inb(99)/1/
+      DATA (iirnf(jc,99),jc=1,jpcoef)/  98, 19*0 /
+      DATA (ijrnf(jc,99),jc=1,jpcoef)/ 288, 19*0 /
+      DATA (zrnfm(jm,99),jm=1,jpmois)/12*127./
+      ! 100-Hsiukuluan (Taiwan)                             R5
+      ! Old=4 km3/year=127m3/s
+      ! --> 0.m3/s
+      DATA inb(100)/0/
+      DATA (iirnf(jc,100),jc=1,jpcoef)/ 20*0 /
+      DATA (ijrnf(jc,100),jc=1,jpcoef)/ 20*0 /
+      DATA (zrnfm(jm,100),jm=1,jpmois)/12*127./
+
+
+
+
+
+
+
+       ! I ASIA
+       ! ------
+
+       ! 1-Indus (Pakistan)
+       ! --> 3949m3/s
+       DATA inb(101)/4/
+       DATA (iirnf(jc,101),jc=1,jpcoef)/ 711, 711, 712, 713, 16*0 /
+       DATA (ijrnf(jc,101),jc=1,jpcoef)/ 297, 298, 297, 297, 16*0 /
+       DATA (zrnfm(jm,101),jm=1,jpmois)/  &
+     &      1691.,    2121.,    2083.,    2940.,    3738.,    4198.,  &
+     &      5334.,    8247.,    7833.,    4908.,    2681.,    1614./
+       ! 2-Sabarmati+Mahi+Narmada (India)
+       ! --> 3383m3/s
+       DATA inb(102)/1/
+!CT bug point terre       DATA (iirnf(jc,102),jc=1,jpcoef)/ 720, 19*0 /
+!CT bug point terre       DATA (ijrnf(jc,102),jc=1,jpcoef)/ 292, 19*0 /
+       DATA (iirnf(jc,102),jc=1,jpcoef)/ 719, 19*0 /
+       DATA (ijrnf(jc,102),jc=1,jpcoef)/ 291, 19*0 /
+       DATA (zrnfm(jm,102),jm=1,jpmois)/  &
+     &      1343.,     110.,       0.,       0.,      13.,    3051.,  &
+     &      9453.,   11655.,    7619.,    3547.,    2081.,    1727./
+       ! 3-
+       ! --> 182m3/s
+       DATA inb(103)/1/
+!CT bug point terre       DATA (iirnf(jc,103),jc=1,jpcoef)/ 721, 19*0 /
+!CT bug point terre       DATA (ijrnf(jc,103),jc=1,jpcoef)/ 286, 19*0 /
+       DATA (iirnf(jc,103),jc=1,jpcoef)/ 720, 19*0 /
+       DATA (ijrnf(jc,103),jc=1,jpcoef)/ 286, 19*0 /
+       DATA (zrnfm(jm,103),jm=1,jpmois)/  &
+     &      0.,       0.,       0.,       0.,     225.,     669.,  &
+     &      526.,     327.,     187.,     100.,      62.,      92./
+       ! 4-Mandovi + Zuari + Kalinadi
+       ! --> 347m3/s
+       DATA inb(104)/1/
+       DATA (iirnf(jc,104),jc=1,jpcoef)/ 2, 19*0 /
+       DATA (ijrnf(jc,104),jc=1,jpcoef)/ 282, 19*0 /
+       DATA (zrnfm(jm,104),jm=1,jpmois)/  &
+     &      7.,       0.,       0.,       0.,     428.,    1339.,  &
+     &      966.,     601.,     350.,     190.,     117.,     166./
+       ! 5-                    R2
+       ! --> 190m3/s
+       DATA inb(105)/1/
+       DATA (iirnf(jc,105),jc=1,jpcoef)/ 4, 19*0 /
+       DATA (ijrnf(jc,105),jc=1,jpcoef)/ 279, 19*0 /
+       DATA (zrnfm(jm,105),jm=1,jpmois)/  &
+     &      0.,       0.,       0.,       0.,     363.,     710.,   &
+     &      484.,     315.,     172.,      95.,      59.,      87./
+       ! 6-
+       ! --> 1101m3/s
+       DATA inb(106)/1/
+       DATA (iirnf(jc,106),jc=1,jpcoef)/ 4, 19*0 /
+       DATA (ijrnf(jc,106),jc=1,jpcoef)/ 277, 19*0 /
+       DATA (zrnfm(jm,106),jm=1,jpmois)/   &
+     &      79.,       0.,       0.,       0.,    1457.,    3639.,   &
+     &      3084.,    2031.,    1282.,     696.,     414.,     535. /
+       ! 7-
+       ! --> 948m3/s
+       DATA inb(107)/1/
+       DATA (iirnf(jc,107),jc=1,jpcoef)/ 5, 19*0 /
+       DATA (ijrnf(jc,107),jc=1,jpcoef)/ 275, 19*0 /
+       DATA (zrnfm(jm,107),jm=1,jpmois)/  &
+     &      72.,       0.,       0.,       0.,    1151.,    3038.,     & 
+     &      2583.,    1603.,    1216.,     749.,     426.,     539./
+
+       ! 8-
+       ! --> 551m3/s
+       DATA inb(108)/1/
+       DATA (iirnf(jc,108),jc=1,jpcoef)/ 7, 19*0 /
+       DATA (ijrnf(jc,108),jc=1,jpcoef)/ 271, 19*0 /
+       DATA (zrnfm(jm,108),jm=1,jpmois)/  &
+     &      45.,       0.,       2.,       7.,     680.,    1621.,  &
+     &      1234.,     744.,     784.,     696.,     359.,     442. /
+       ! 9-
+       ! --> 103m3/s
+       DATA inb(109)/1/
+       DATA (iirnf(jc,109),jc=1,jpcoef)/ 8, 19*0 /
+       DATA (ijrnf(jc,109),jc=1,jpcoef)/ 269, 19*0 /
+       DATA (zrnfm(jm,109),jm=1,jpmois)/  &
+     &      11.,       0.,       0.,       0.,     160.,     250.,   &
+     &      200.,     145.,     168.,     146.,      74.,      89. /
+       ! 10-
+       ! --> 99m3/s
+       DATA inb(110)/1/
+       DATA (iirnf(jc,110),jc=1,jpcoef)/12, 19*0 /
+       DATA (ijrnf(jc,110),jc=1,jpcoef)/267, 19*0 /
+       DATA (zrnfm(jm,110),jm=1,jpmois)/  &
+     &      50.,       1.,       1.,       0.,      25.,      69.,  &
+     &      51.,      32.,     176.,     329.,     233.,     222./
+       ! 11- Kaveri (India)
+       ! --> 173m3/s
+       DATA inb(111)/1/
+       DATA (iirnf(jc,111),jc=1,jpcoef)/16, 19*0 /
+       DATA (ijrnf(jc,111),jc=1,jpcoef)/271, 19*0 /
+       DATA (zrnfm(jm,111),jm=1,jpmois)/  &
+     &       97.,       2.,       1.,       2.,      19.,      67.,   &
+     &      108.,     134.,     218.,     515.,     498.,     416. /
+       ! 12-
+       ! --> 116m3/s
+       DATA inb(112)/1/
+       DATA (iirnf(jc,112),jc=1,jpcoef)/16, 19*0 /
+       DATA (ijrnf(jc,112),jc=1,jpcoef)/279, 19*0 /
+       DATA (zrnfm(jm,112),jm=1,jpmois)/  &
+     &       43.,       0.,       0.,       0.,       0.,       0.,   &
+     &        0.,       0.,      99.,     568.,     343.,     342. /
+       ! 13- Krishna
+       ! --> 2864m3/s
+       DATA inb(113)/1/
+       DATA (iirnf(jc,113),jc=1,jpcoef)/ 16, 19*0 /
+       DATA (ijrnf(jc,113),jc=1,jpcoef)/ 281, 19*0 /
+       DATA (zrnfm(jm,113),jm=1,jpmois)/   &
+     &       1368.,     174.,       0.,       0.,     166.,    2362.,  &
+     &       9501.,    8639.,    6053.,    3173.,    1763.,    1175. /
+       ! 14- (SriLanka)
+       ! --> 371m3/s
+       DATA inb(114)/1/
+       DATA (iirnf(jc,114),jc=1,jpcoef)/ 16, 19*0 /
+       DATA (ijrnf(jc,114),jc=1,jpcoef)/ 261, 19*0 /
+       DATA (zrnfm(jm,114),jm=1,jpmois)/  &
+     &      171.,     144.,     292.,     469.,     414.,     309.,  &
+     &      269.,     244.,     526.,     560.,     476.,     588.  /
+       ! 15- (SriLanka)
+       ! --> 305m3/s
+       DATA inb(115)/1/
+       DATA (iirnf(jc,115),jc=1,jpcoef)/18, 19*0 /
+       DATA (ijrnf(jc,115),jc=1,jpcoef)/262, 19*0 /
+       DATA (zrnfm(jm,115),jm=1,jpmois)/  &
+     &      116.,     111.,     225.,     379.,     366.,     300.,  &
+     &      256.,     239.,     385.,     437.,     388.,     467. /
+       ! 16- (SriLanka)
+       ! --> 722m3/s
+       DATA inb(116)/1/
+       DATA (iirnf(jc,116),jc=1,jpcoef)/20, 19*0 /
+       DATA (ijrnf(jc,116),jc=1,jpcoef)/265, 19*0 /
+       DATA (zrnfm(jm,116),jm=1,jpmois)/  &
+     &      711.,     347.,     477.,     556.,     430.,     302.,  &
+     &      228.,     200.,     629.,    1156.,    1579.,    2055.   /
+       ! 17- (SriLanka)
+       ! --> 188m3/s
+       DATA inb(117)/1/
+       DATA (iirnf(jc,117),jc=1,jpcoef)/19, 19*0 /
+       DATA (ijrnf(jc,117),jc=1,jpcoef)/267, 19*0 /
+       DATA (zrnfm(jm,117),jm=1,jpmois)/  &
+     &      189.,      50.,      27.,      17.,      10.,       6.,  &
+     &       4.,       2.,       1.,     236.,     829.,     894. /
+       ! 18- Godavari (India) 17N00  81E45
+       ! --> 2709m3/s
+       DATA inb(118)/1/
+       DATA (iirnf(jc,118),jc=1,jpcoef)/ 19, 19*0 /
+       DATA (ijrnf(jc,118),jc=1,jpcoef)/283, 19*0 /
+       DATA (zrnfm(jm,118),jm=1,jpmois)/  &
+     &      1151.,      57.,       0.,       0.,      38.,    1490.,  &
+     &      6714.,    9065.,    7208.,    3294.,    1874.,    1629. /
+       ! 19-
+       ! --> 116m3/s
+       DATA inb(119)/1/
+       DATA (iirnf(jc,119),jc=1,jpcoef)/23, 19*0 /
+       DATA (ijrnf(jc,119),jc=1,jpcoef)/286, 19*0 /
+       DATA (zrnfm(jm,119),jm=1,jpmois)/  &
+     &         17.,       0.,       0.,       0.,       0.,     103.,  &
+     &        259.,     341.,     330.,     155.,      87.,     110. /
+       ! 20- Mahanadi (India)
+       ! --> 2390m3/s
+       DATA inb(120)/1/
+       DATA (iirnf(jc,120),jc=1,jpcoef)/28, 19*0 /
+       DATA (ijrnf(jc,120),jc=1,jpcoef)/290, 19*0 /
+       DATA (zrnfm(jm,120),jm=1,jpmois)/  &
+     &       809.,       5.,       0.,       0.,      60.,    1401.,  &
+     &      6652.,    8828.,    5410.,    2561.,    1503.,    1452. /
+       ! 21-
+       ! --> 247m3/s
+       DATA inb(121)/1/
+       DATA (iirnf(jc,121),jc=1,jpcoef)/30, 19*0 /
+       DATA (ijrnf(jc,121),jc=1,jpcoef)/294, 19*0 /
+       DATA (zrnfm(jm,121),jm=1,jpmois)/  &
+     &         15.,       0.,       0.,       0.,      73.,     367.,   &
+     &        744.,     722.,     491.,     227.,     137.,     188. /
+       ! 22-
+       ! --> 167m3/s
+       DATA inb(122)/1/
+       DATA (iirnf(jc,122),jc=1,jpcoef)/31, 19*0 /
+       DATA (ijrnf(jc,122),jc=1,jpcoef)/294, 19*0 /
+       DATA (zrnfm(jm,122),jm=1,jpmois)/  &
+     &         16.,       0.,       0.,       0.,      95.,     337.,  &
+     &        488.,     453.,     285.,     143.,      84.,     109. /
+       ! 23-
+       ! --> 206m3/s
+       DATA inb(123)/1/
+       DATA (iirnf(jc,123),jc=1,jpcoef)/32, 19*0 /
+       DATA (ijrnf(jc,123),jc=1,jpcoef)/294, 19*0 /
+       DATA (zrnfm(jm,123),jm=1,jpmois)/  &
+     &         12.,       0.,       0.,       0.,      35.,     400.,  &
+     &        652.,     616.,     347.,     172.,     105.,     144. /
+       ! 24- Ganga + Brahmaputra (Bangladesh) 22N00  91E00
+       ! --> 42436m3/s
+       DATA inb(124)/9/
+       DATA (iirnf(jc,124),jc=1,jpcoef)/ 37, 38, 39, 32, 33, 34, 35  &
+     &      , 36, 37, 11*0 /
+       DATA (ijrnf(jc,124),jc=1,jpcoef)/ 295,295,295,294,294,294,294  &
+     &      , 294, 294, 11*0 /
+       DATA (zrnfm(jm,124),jm=1,jpmois)/  &
+     &        14293.,   4223.,   3004.,  11743.,  32210.,  56899.,  &
+     &        82263.,  95069.,  77997.,  44194.,  23724.,  17272. /
+
+       DATA inb(125)/0/
+      DATA inb(126)/0/
+
+       ! 27- Kuladan
+       ! --> 1541m3/s
+       DATA inb(127)/1/
+       DATA (iirnf(jc,127),jc=1,jpcoef)/42, 19*0 /
+       DATA (ijrnf(jc,127),jc=1,jpcoef)/290, 19*0 /
+       DATA (zrnfm(jm,127),jm=1,jpmois)/  &
+     &        140.,       0.,       0.,      27.,    2280.,    4133.,  &
+     &       4306.,    3049.,    1993.,    1115.,     646.,     812. /
+       ! 28-
+       ! --> 618m3/s
+       DATA inb(128)/1/
+       DATA (iirnf(jc,128),jc=1,jpcoef)/44, 19*0 /
+       DATA (ijrnf(jc,128),jc=1,jpcoef)/287, 19*0 /
+       DATA (zrnfm(jm,128),jm=1,jpmois)/  &
+     &        0.,       0.,       0.,      73.,    1139.,    1755.,  &
+     &      1725.,    1139.,     677.,     362.,     221.,     326. /
+       ! 29-
+       ! --> 158m3/s
+       DATA inb(129)/1/
+       DATA (iirnf(jc,129),jc=1,jpcoef)/44, 19*0 /
+       DATA (ijrnf(jc,129),jc=1,jpcoef)/284, 19*0 /
+       DATA (zrnfm(jm,129),jm=1,jpmois)/  &
+     &        0.,       0.,       0.,       0.,     248.,     419.,  &
+     &      445.,     334.,     201.,     103.,      63.,      93. /
+       ! 30-
+       ! --> 136m3/s
+       DATA inb(130)/1/
+       DATA (iirnf(jc,130),jc=1,jpcoef)/32, 19*0 /
+       DATA (ijrnf(jc,130),jc=1,jpcoef)/277, 19*0 /
+       DATA (zrnfm(jm,130),jm=1,jpmois)/  &
+     &         0.,       0.,       0.,       0.,     223.,     261.,  &
+     &       269.,     315.,     223.,     147.,      86.,     116. /
+       ! 31-
+       ! --> 142m3/s
+       DATA inb(131)/1/
+       DATA (iirnf(jc,131),jc=1,jpcoef)/42, 19*0 /
+       DATA (ijrnf(jc,131),jc=1,jpcoef)/275, 19*0 /
+       DATA (zrnfm(jm,131),jm=1,jpmois)/  &
+     &         0.,       0.,       0.,       0.,     241.,     260.,  &
+     &       270.,     325.,     231.,     158.,      96.,     126.  /
+       ! 32- Irrawady (Myanmar) 15N50  95E06
+       ! --> 16751m3/s
+       DATA inb(132)/3/
+       DATA (iirnf(jc,132),jc=1,jpcoef)/  45,  46, 47, 17*0 /
+       DATA (ijrnf(jc,132),jc=1,jpcoef)/ 282, 281, 282, 17*0 /
+       DATA (zrnfm(jm,132),jm=1,jpmois)/  &
+     &       7174.,     2281.,     80.,    687.,    8133.,   23980.,  &
+     &       38452.,   41442.,  34497.,  23150.,   12529.,    8629. /
+
+       DATA inb(133)/0/
+       DATA inb(134)/0/
+       DATA inb(135)/0/
+       DATA inb(136)/0/
+
+       ! 37- Tenasserim (Myanmar)
+       ! --> 1369m3/s
+       DATA inb(137)/1/
+       DATA (iirnf(jc,137),jc=1,jpcoef)/51, 19*0 /
+       DATA (ijrnf(jc,137),jc=1,jpcoef)/279, 19*0 /
+       DATA (zrnfm(jm,137),jm=1,jpmois)/  &
+     &        65.,       0.,       0.,     540.,    2127.,    3260.,  &
+     &      3540.,    2966.,    1747.,     900.,     544.,     741. /
+       ! 38-
+       ! --> 413m3/s
+       DATA inb(138)/1/
+       DATA (iirnf(jc,138),jc=1,jpcoef)/52, 19*0 /
+       DATA (ijrnf(jc,138),jc=1,jpcoef)/277, 19*0 /
+       DATA (zrnfm(jm,138),jm=1,jpmois)/  &
+     &          0.,       0.,       0.,     202.,     773.,    1000.,  &
+     &       1032.,     831.,     492.,     248.,     153.,     226. /
+       ! 39-
+       ! --> 810m3/s
+       DATA inb(139)/1/
+       DATA (iirnf(jc,139),jc=1,jpcoef)/52, 19*0 /
+       DATA (ijrnf(jc,139),jc=1,jpcoef)/275, 19*0 /
+       DATA (zrnfm(jm,139),jm=1,jpmois)/  &
+     &         59.,       0.,       0.,      22.,    1104.,    1857.,  &
+     &       2069.,    1858.,    1252.,     637.,     373.,     493. /
+       ! 40-
+       ! --> 896m3/s
+       DATA inb(140)/1/
+       DATA (iirnf(jc,140),jc=1,jpcoef)/52, 19*0 /
+       DATA (ijrnf(jc,140),jc=1,jpcoef)/273, 19*0 /
+       DATA (zrnfm(jm,140),jm=1,jpmois)/  &
+     &         94.,       0.,       0.,     196.,    1145.,    1716.,  &
+     &       1936.,    1899.,    1519.,    1000.,     562.,     688. /
+       ! 41-
+       ! --> 559m3/s
+       DATA inb(141)/1/
+       DATA (iirnf(jc,141),jc=1,jpcoef)/52, 19*0 /
+       DATA (ijrnf(jc,141),jc=1,jpcoef)/271, 19*0 /
+       DATA (zrnfm(jm,141),jm=1,jpmois)/  &
+     &       38.,       0.,       0.,     227.,     805.,    1051.,  &
+     &      1105.,    1236.,     941.,     575.,     321.,     416. /
+       ! 42-
+       ! --> 1070m3/s
+       DATA inb(142)/1/
+       DATA (iirnf(jc,142),jc=1,jpcoef)/53, 19*0 /
+       DATA (ijrnf(jc,142),jc=1,jpcoef)/265, 19*0 /
+       DATA (zrnfm(jm,142),jm=1,jpmois)/  &
+     &       356.,      18.,      14.,     160.,     745.,    1123.,  &
+     &      1347.,    1732.,    2076.,    2057.,    1574.,    1639. /
+       ! 43-
+       ! --> 513m3/s
+       DATA inb(143)/1/
+       DATA (iirnf(jc,143),jc=1,jpcoef)/54, 19*0 /
+       DATA (ijrnf(jc,143),jc=1,jpcoef)/263, 19*0 /
+       DATA (zrnfm(jm,143),jm=1,jpmois)/  &
+     &       231.,      12.,     121.,     236.,     216.,     239.,  &
+     &       351.,     517.,    1008.,    1324.,     975.,     929.  /
+       ! 44-
+       ! --> 881m3/s
+       DATA inb(144)/1/
+       DATA (iirnf(jc,144),jc=1,jpcoef)/56, 19*0 /
+       DATA (ijrnf(jc,144),jc=1,jpcoef)/259, 19*0 /
+       DATA (zrnfm(jm,144),jm=1,jpmois)/  &
+     &      558.,     632.,     980.,     902.,     575.,     421.,  &
+     &      432.,     731.,    1276.,    1405.,    1188.,    1480. /
+       ! 45-
+       ! --> 905m3/s
+       DATA inb(145)/1/
+       DATA (iirnf(jc,145),jc=1,jpcoef)/52, 19*0 /
+       DATA (ijrnf(jc,145),jc=1,jpcoef)/259, 19*0 /
+       DATA (zrnfm(jm,145),jm=1,jpmois)/  &
+     &      604.,     552.,     781.,     853.,     627.,     488.,  &
+     &      503.,     781.,    1245.,    1356.,    1331.,    1747. /
+       ! 46-
+       ! --> 136m3/s
+       DATA inb(146)/1/
+       DATA (iirnf(jc,146),jc=1,jpcoef)/50, 19*0 /
+       DATA (ijrnf(jc,146),jc=1,jpcoef)/261, 19*0 /
+       DATA (zrnfm(jm,146),jm=1,jpmois)/  &
+     &      103.,     111.,     126.,     112.,      66.,      40.,  &
+     &       35.,      51.,     126.,     227.,     279.,     362.  /
+       ! 47-
+       ! --> 222m3/s
+       DATA inb(147)/1/
+       DATA (iirnf(jc,147),jc=1,jpcoef)/47, 19*0 /
+       DATA (ijrnf(jc,147),jc=1,jpcoef)/258, 19*0 /
+       DATA (zrnfm(jm,147),jm=1,jpmois)/  &
+     &      176.,     160.,     209.,     197.,     130.,      99.,  &
+     &       90.,     151.,     240.,     342.,     373.,     502./
+       ! 48-
+       ! --> 326m3/s
+       DATA inb(148)/1/
+       DATA (iirnf(jc,148),jc=1,jpcoef)/49, 19*0 /
+       DATA (ijrnf(jc,148),jc=1,jpcoef)/257, 19*0 /
+       DATA (zrnfm(jm,148),jm=1,jpmois)/  &
+     &       226.,     278.,     363.,     301.,     181.,     130.,  &
+     &       131.,     194.,     407.,     505.,     519.,     689. /
+       ! 49-
+       ! --> 203m3/s
+       DATA inb(149)/1/
+       DATA (iirnf(jc,149),jc=1,jpcoef)/50, 19*0 /
+       DATA (ijrnf(jc,149),jc=1,jpcoef)/256, 19*0 /
+       DATA (zrnfm(jm,149),jm=1,jpmois)/  &
+     &      120.,     218.,     233.,     189.,     134.,     128.,  &
+     &      115.,     178.,     244.,     272.,     247.,     360. /
+       ! 50-
+       ! --> 153m3/s
+       DATA inb(150)/1/
+       DATA (iirnf(jc,150),jc=1,jpcoef)/50, 19*0 /
+       DATA (ijrnf(jc,150),jc=1,jpcoef)/255, 19*0 /
+       DATA (zrnfm(jm,150),jm=1,jpmois)/  &
+     &         97.,     108.,     191.,     141.,      97.,      82.,  &
+     &        107.,     118.,     188.,     230.,     208.,     278. /
+       ! 51-
+       ! --> 196m3/s
+       DATA inb(151)/1/
+       DATA (iirnf(jc,151),jc=1,jpcoef)/53, 19*0 /
+       DATA (ijrnf(jc,151),jc=1,jpcoef)/253, 19*0 /
+       DATA (zrnfm(jm,151),jm=1,jpmois)/  &
+     &        74.,     125.,     165.,     123.,     117.,     121.,  &
+     &       160.,     196.,     272.,     322.,     296.,     389. /
+       ! 52-
+       ! --> 166m3/s
+       DATA inb(152)/1/
+       DATA (iirnf(jc,152),jc=1,jpcoef)/53, 19*0 /
+       DATA (ijrnf(jc,152),jc=1,jpcoef)/252, 19*0 /
+       DATA (zrnfm(jm,152),jm=1,jpmois)/  &
+     &      136.,     140.,     192.,     169.,     108.,      80.,  &
+     &      75.,     145.,     200.,     219.,     221.,     307. /
+       ! 53-Tigris+Euphrates (Irak) 31N00  47E25
+       ! --> 4762m3/s
+       DATA inb(153)/3/
+       DATA (iirnf(jc,153),jc=1,jpcoef)/ 673, 673, 674, 17*0 /
+       DATA (ijrnf(jc,153),jc=1,jpcoef)/ 312, 313, 313, 17*0 /
+       DATA (zrnfm(jm,153),jm=1,jpmois)/  &
+     &       6056.,    7229.,    8377.,    8505.,    7966.,    6217.,  &
+     &       3396.,    1898.,    1147.,     869.,    1714.,    3779. /
+
+       DATA (inb(jr),jr=154,200)/47*0/
+
+
+      !  Total run-offs(VII)=6181.33301m3/s
+      !  Total run-offs(I+II+III+IV+V+VI+VII)= 567084. m3/s
+      !                                      = 1.588668056E-6 kg/m2/s
+      !                                      = 17883.5586 km3/Year
+      !                                      = 0.567083955 Sverdrup
+
+      !!----------------------------------------------------------------------
+      !!  OPA 8.5, LODYC-IPSL (2002)
+      !!----------------------------------------------------------------------
+
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'flxrnf : runoff + orca05'
+         IF(lwp) WRITE(numout,*) '~~~~~~'
+         IF(lwp) WRITE(numout,*) '   nrunoff = ', nrunoff
+         IF(lwp) WRITE(numout,*)
+      ENDIF
+
+      ! 0. initialization and  indexes  modification for zoom version
+      ! --------------------------------------------------------------
+      
+      
+      ! conversion factor m3/s --> kg/m2/s *e1t*e2t
+
+      zconv = rauw
+
+      IF( kt == nit000 ) THEN 
+         ! Set runoffs and upstream coeff to zero
+         runoff (:,:) = 0.e0                                                                                  
+         upsrnfh(:,:) = 0.e0
+         upsrnfz(:)   = 0.e0
+         upsadv (:,:) = 0.e0
+         zcoefr(:,:,:) = 0.e0
+
+         IF( nrunoff == 0 ) THEN
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) ' NO RUNOFF in this simulation '
+            IF(lwp) WRITE(numout,*)
+         ENDIF
+      ENDIF
+
+      ! 1. initialization of the runoff array
+      ! -------------------------------------
+
+      IF( nrunoff == 1 .OR. nrunoff == 2) THEN
+
+         iman  = jpmois
+ !!! 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
+         IF( nn_leap_year == 1 .AND. MOD( nyear, 4 ) == 0 ) THEN
+            ! Number of Day Between Data
+            idbd = nbiss(imois)
+         ELSEIF( nn_leap_year > 1 ) THEN
+            idbd = nn_leap_year
+         ELSE
+            idbd = nobis(imois)
+         END IF
+         ! Number of days between imois, 15 and the end of month
+         idmeom = idbd - 15
+         
+         ! 1.1 Calendar computation
+         
+         ! nrnf1 number of the first array record used in the simulation
+         ! nrnf2 number of the last  array record
+         
+         nrnf1 = imois
+         nrnf2 = nrnf1 + 1
+         nrnf1 = MOD( nrnf1, iman )
+         IF( nrnf1 == 0 ) nrnf1 = iman
+         nrnf2 = MOD( nrnf2, iman )
+         IF( nrnf2 == 0 ) nrnf2 = iman
+         
+         IF( kt == nit000 ) THEN
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) 'flxrnf routine'
+            IF(lwp) WRITE(numout,*) 'first array record used nrnf1 ',nrnf1
+            IF(lwp) WRITE(numout,*) 'last  array record used nrnf2 ',nrnf2
+         ENDIF
+
+         zxy = FLOAT( nday + idmeom - idbd * i15 ) / idbd
+
+         DO jr = 1, jpriv-1
+            inbp = inb(jr)
+            IF( inbp /= 0 ) THEN
+               DO jl = 1, inbp
+                  DO jj = mj0(ijrnf(jl,jr)), mj1(ijrnf(jl,jr))
+                     DO ji = mi0(iirnf(jl,jr)), mi1(iirnf(jl,jr))
+                        runoff(ji,jj) = runoff(ji,jj)   & 
+                           &          + ( (1.-zxy) * zrnfm(nrnf1,jr)   &
+                           &          +       zxy  * zrnfm(nrnf2,jr)  ) / FLOAT(inbp)
+                     END DO
+                  END DO
+               END DO
+            ENDIF
+         END DO
+
+
+         ! 2. conversion in mm/day
+         ! -----------------------
+         !     C a u t i o n : upward water flux, runoff is negative
+
+         runoff(:,:) = -zconv * runoff(:,:) / ( e1t(:,:) * e2t(:,:) )
+         
+
+         ! 3. advectve coefficient
+         ! -----------------------
+
+         !  Creates the array coef that contains the coefficient to affect to
+         !  the upstream scheme. advection scheme will be:
+         !  coefr * upstream + (1- coefr) centered
+         !  coefr must be between 0 and 1.
+         !  3 values are used: maximum = zrup1, between zrup2, small zrup3.
+         ! 
+         IF( nrunoff == 2 .AND. kt == nit000 ) THEN
+
+            zrup1 = 0.5
+            zrup2 = 0.25
+            zrup3 = 0.125
+            DO jr = 1, jpriv-1
+               inbp = inb(jr)
+               IF( inbp /= 0) THEN
+                  DO jl = 1, inbp
+                     ! ji,jj
+                     DO jj = mj0(ijrnf(jl,jr)), mj1(ijrnf(jl,jr))
+                        DO ji = mi0(iirnf(jl,jr)), mi1(iirnf(jl,jr))
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = zrup1
+                           END DO
+                           zcoefr(ji,jj,4) = zrup2
+                           zcoefr(ji,jj,5) = zrup3
+                        END DO
+                     END DO
+                     ! --> zrup2 (originally = 0.5)
+                     ! ji,jj+1
+                     DO jj = mj0(ijrnf(jl,jr) + 1), mj1(ijrnf(jl,jr) + 1)
+                        DO ji = mi0(iirnf(jl,jr)), mi1(iirnf(jl,jr))
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji,jj-1
+                     DO jj = mj0(ijrnf(jl,jr) - 1), mj1(ijrnf(jl,jr) - 1)
+                        DO ji = mi0(iirnf(jl,jr)), mi1(iirnf(jl,jr))
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji+1,jj-1
+                     DO jj = mj0(ijrnf(jl,jr) - 1), mj1(ijrnf(jl,jr) - 1)
+                        DO ji = mi0(iirnf(jl,jr) + 1), mi1(iirnf(jl,jr) + 1)
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji+1,jj
+                     DO jj = mj0(ijrnf(jl,jr)), mj1(ijrnf(jl,jr))
+                        DO ji = mi0(iirnf(jl,jr) + 1), mi1(iirnf(jl,jr) + 1)
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji+1,jj+1
+                     DO jj = mj0(ijrnf(jl,jr) + 1), mj1(ijrnf(jl,jr) + 1)
+                        DO ji = mi0(iirnf(jl,jr) + 1), mi1(iirnf(jl,jr) + 1)
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji-1,jj+1
+                     DO jj = mj0(ijrnf(jl,jr) + 1), mj1(ijrnf(jl,jr) + 1)
+                        DO ji = mi0(iirnf(jl,jr) - 1), mi1(iirnf(jl,jr) - 1)
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji-1,jj
+                     DO jj = mj0(ijrnf(jl,jr)), mj1(ijrnf(jl,jr))
+                        DO ji = mi0(iirnf(jl,jr) - 1), mi1(iirnf(jl,jr) - 1)
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji-1,jj-1
+                     DO jj = mj0(ijrnf(jl,jr) - 1), mj1(ijrnf(jl,jr) - 1)
+                        DO ji = mi0(iirnf(jl,jr) - 1), mi1(iirnf(jl,jr) - 1)
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! --> zrup3 (originally = 0.25)
+                     ! ji-1,jj+2
+                     DO jj = mj0(ijrnf(jl,jr) + 2), mj1(ijrnf(jl,jr) + 2)
+                        DO ji = mi0(iirnf(jl,jr) - 1), mi1(iirnf(jl,jr) - 1)
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-1,jj-2
+                     DO jj = mj0(ijrnf(jl,jr) - 2), mj1(ijrnf(jl,jr) - 2)
+                        DO ji = mi0(iirnf(jl,jr) - 1), mi1(iirnf(jl,jr) - 1)
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji,jj-2
+                     DO jj = mj0(ijrnf(jl,jr) - 2), mj1(ijrnf(jl,jr) - 2)
+                        DO ji = mi0(iirnf(jl,jr)    ), mi1(iirnf(jl,jr)    )
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji,jj+2
+                     DO jj = mj0(ijrnf(jl,jr) + 2), mj1(ijrnf(jl,jr) + 2)
+                        DO ji = mi0(iirnf(jl,jr)    ), mi1(iirnf(jl,jr)    )
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+1,jj-2
+                     DO jj = mj0(ijrnf(jl,jr) - 2), mj1(ijrnf(jl,jr) - 2)
+                        DO ji = mi0(iirnf(jl,jr) + 1), mi1(iirnf(jl,jr) + 1)
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+1,jj+2
+                     DO jj = mj0(ijrnf(jl,jr) + 2), mj1(ijrnf(jl,jr) + 2)
+                        DO ji = mi0(iirnf(jl,jr) + 1), mi1(iirnf(jl,jr) + 1)
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj-2
+                     DO jj = mj0(ijrnf(jl,jr) - 2), mj1(ijrnf(jl,jr) - 2)
+                        DO ji = mi0(iirnf(jl,jr) + 2), mi1(iirnf(jl,jr) + 2)
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj+2
+                     DO jj = mj0(ijrnf(jl,jr) + 2), mj1(ijrnf(jl,jr) + 2)
+                        DO ji = mi0(iirnf(jl,jr) + 2), mi1(iirnf(jl,jr) + 2)
+                           DO jn = 1, 3  
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj-1
+                     DO jj = mj0(ijrnf(jl,jr) - 1), mj1(ijrnf(jl,jr) - 1)
+                        DO ji = mi0(iirnf(jl,jr) + 2), mi1(iirnf(jl,jr) + 2)
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj+1
+                     DO jj = mj0(ijrnf(jl,jr) + 1), mj1(ijrnf(jl,jr) + 1)
+                        DO ji = mi0(iirnf(jl,jr) + 2), mi1(iirnf(jl,jr) + 2)
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj
+                     DO jj = mj0(ijrnf(jl,jr)    ), mj1(ijrnf(jl,jr)    )
+                        DO ji = mi0(iirnf(jl,jr) + 2), mi1(iirnf(jl,jr) + 2)
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj
+                     DO jj = mj0(ijrnf(jl,jr)    ), mj1(ijrnf(jl,jr)    )
+                        DO ji = mi0(iirnf(jl,jr) - 2), mi1(iirnf(jl,jr) - 2)
+                           DO jn = 1, 3        
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj-2
+                     DO jj = mj0(ijrnf(jl,jr) - 2), mj1(ijrnf(jl,jr) - 2)
+                        DO ji = mi0(iirnf(jl,jr) - 2), mi1(iirnf(jl,jr) - 2)
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj+2
+                     DO jj = mj0(ijrnf(jl,jr) + 2), mj1(ijrnf(jl,jr) + 2)
+                        DO ji = mi0(iirnf(jl,jr) - 2), mi1(iirnf(jl,jr) - 2)
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj-1
+                     DO jj = mj0(ijrnf(jl,jr) - 1), mj1(ijrnf(jl,jr) - 1)
+                        DO ji = mi0(iirnf(jl,jr) - 2), mi1(iirnf(jl,jr) - 2)
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj+1
+                     DO jj = mj0(ijrnf(jl,jr) + 1), mj1(ijrnf(jl,jr) + 1)
+                        DO ji = mi0(iirnf(jl,jr) - 2), mi1(iirnf(jl,jr) - 2)
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                  END DO
+               ENDIF
+            END DO
+            upsrnfh(:,:) = zcoefr(:,:,1)
+            upsrnfz(:)   = 0.e0
+            upsrnfz(1)   = zrup1
+            upsrnfz(2)   = zrup1
+            upsrnfz(3)   = zrup1
+            upsrnfz(4)   = zrup2
+            upsrnfz(5)   = zrup3
+         ENDIF
+      ENDIF
+    
+#endif
+
+   END SUBROUTINE flx_rnf
Index: trunk/NEMO/OPA_SRC/SBC/sbcrnf_ORCA_R2.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcrnf_ORCA_R2.h90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcrnf_ORCA_R2.h90	(revision 888)
@@ -0,0 +1,1340 @@
+   !!----------------------------------------------------------------------
+   !!                    ***  flxrnf_ORCA_R2.h90  ***
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!                  OLD ORCA R2 runoff specification
+   !!                      kept here for memory
+   !!                         ( 20/04/2000 )
+   !!----------------------------------------------------------------------
+   !! History :         !  94-10  (G.Madec, M. Pontaud, M. Imbard)  Original code
+   !!                   !  97-03  (G.Madec)  time dependent version
+   !!                   !  98-06  (J.M. Molines)  exact computation of zxy 
+   !!                                      for months that are not 30 days
+   !!                   !  98-07  (M. Imbard)  ORCA and mpp option
+   !!                   !  99-08  (J.P. Boulanger H.L.Ayina)  New rivers and 
+   !!                                                   values given in m3/s 
+   !!                   !  00-04  (G. Madec, K. Roberts) add antarctica ice discharge.
+   !!----------------------------------------------------------------------
+   !! References : 
+   !!       J. D. Milliman and R. H. Meade, 1983 : world-wide delivery
+   !!          of river sediment to the oceans, journal of geology vol 91
+   !!          pp 1-21.
+   !!       G. L. Russell and J. R. Miller, 1990 : global river runoff
+   !!          calculated from a global atmospheric general circulation
+   !!          model, journal of hydrology, 117(1990), pp 241-254.
+   !!       F. Van Der Leeden, Troise F. L., Todd D. K. : the water
+   !!          encyclopedia, second edition, lewis publishers.
+   !!       J. W. Weatherly, J. E. Walsh : The effects of precipitation
+   !!          and river runoff in a coupled ice-ocean model of Arctic
+   !!          Climate dynamics 1996 12:785,798
+   !!       Jacobs et al. 1992. J. Glaciol. 38 (130) 375-387.
+   !!----------------------------------------------------------------------
+   !!  OPA 9.0 , LOCEAN-IPSL (2005) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+      !!----------------------------------------------------------------------
+      INTEGER :: kt
+      INTEGER, PARAMETER ::   &
+         jpmois =  12,        &  ! number of months
+         jpriv  = 120,        &  ! maximum number of river
+         jpcoef = 300            ! maximum of river mouth grid-points
+      INTEGER ::   &
+         ji, jj, jl, jm,      &  ! dummy loop indices
+         jn, jr, jc              !    "         "
+      INTEGER ::   &
+         i15, imois, iman,    &  ! temporary integers
+         inbp, idbd, idmeom,  &  !    "          "
+         iipt0, iipt1, ijpt0, &  !    "          "
+         ijpt1, ii, ij           !    "          "
+      INTEGER, DIMENSION(jpriv) ::   &
+         inb                     ! ???
+      INTEGER, DIMENSION(jpcoef,jpriv) ::   &
+         iirnf, ijrnf            ! ???
+
+      REAL(wp) ::   &
+         zconv, zxy,          &  ! temporary scalars
+         zrup1, zrup2, zrup3     !    "         "
+      REAL(wp), DIMENSION(jpmois,jpriv) ::   &
+         zrnfm                   ! ???
+      REAL(wp), DIMENSION(jpi, jpj, 5) ::   &
+         zcoefr                  ! ???
+
+      ! ====
+      ! DATA
+      ! ====
+
+      ! I NORTH AMERICA
+      ! ---------------
+
+      ! 1-Saint Lawrence (Canada) 49N30 67W00               R2
+      ! Old=447 km3/year=14165m3/s; CLIPPER=12430m3/s; ratio=1.14
+      ! --> 13975.249m3/s
+      DATA inb(1)/2/
+      DATA (iirnf(jc,1),jc=1,jpcoef)/ 110, 110, 298*0 /
+      DATA (ijrnf(jc,1),jc=1,jpcoef)/ 110, 111, 298*0 /
+      DATA (zrnfm(jm,1),jm=1,jpmois)/   &
+          11718.,  11971.,  12466.,  14980.,  19257.,  16913.,   &
+          14211.,  13119.,  13367.,  13644.,  13463.,  12594./
+      ! 2-Hudson River (USA) 41N00 77W00                    R1
+      ! Old=12 km3/year=380m3/s; UNESCO(64-83,p255)=408m3/s
+      ! --> 407.416687m3/s
+      DATA inb(2)/1/
+      DATA (iirnf(jc,2),jc=1,jpcoef)/ 106, 299*0 /
+      DATA (ijrnf(jc,2),jc=1,jpcoef)/ 104, 299*0 /
+      DATA (zrnfm(jm,2),jm=1,jpmois)/   &
+          364.,    404.,    648.,    873.,    593.,    301.,   &
+          205.,    171.,    205.,    290.,    379.,    456./
+      ! 3-Missisipi and Atchafalaya (USA) 29N 90W           R1 
+      ! Old=580 km3/year=18380m3/s; CLIPPER=17599m3/s
+      ! --> 17599.334m3/s
+      DATA inb(3)/2/
+      DATA (iirnf(jc,3),jc=1,jpcoef)/  97, 98, 298*0 /
+      DATA (ijrnf(jc,3),jc=1,jpcoef)/  97, 97, 298*0 /
+      DATA (zrnfm(jm,3),jm=1,jpmois)/   &
+          19260.,  20813.,  23026.,  28160.,  26510.,  19650.,   &
+          14181.,  10676.,   9578.,  10167.,  11699.,  17472./
+      ! 4-Brazos (USA) 29N58 95W53                          R1
+      ! Old=7 km3/year=222m3/s; UNESCO(65-84, p298)=200m3/s
+      ! --> 199.666656m3/s
+      DATA inb(4)/1/
+      DATA (iirnf(jc,4),jc=1,jpcoef)/  95, 299*0 /
+      DATA (ijrnf(jc,4),jc=1,jpcoef)/  97, 299*0 /
+      DATA (zrnfm(jm,4),jm=1,jpmois)/   &
+          165.,    224.,    200.,    266.,    457.,    327.,   &
+          143.,     69.,    102.,    132.,    160.,    151./
+      ! 5-Colorado (Mexico) 31N54 114W57                    R5
+      ! Old=20 km3/year=634m3/s
+      ! --> 634.m3/s
+      DATA inb(5)/1/
+      DATA (iirnf(jc,5),jc=1,jpcoef)/  88, 299*0 /
+      DATA (ijrnf(jc,5),jc=1,jpcoef)/  94, 299*0 /
+      DATA (zrnfm(jm,5),jm=1,jpmois)/12*634./ 
+      ! 6-Columbia (USA) 45N60 121W17                       R1
+      ! Old=251 km3/year=7954m3/s; UNESCO(65-84, p312)=5368m3/s
+      ! --> 5368.41602m3/s
+      DATA inb(6)/1/
+      DATA (iirnf(jc,6),jc=1,jpcoef)/  79, 299*0 /
+      DATA (ijrnf(jc,6),jc=1,jpcoef)/ 110, 299*0 /
+      DATA (zrnfm(jm,6),jm=1,jpmois)/   &
+          4752.,    5077.,    5633.,    6075.,    8422.,    9822.,   &
+          6350.,    4112.,    3273.,    3251.,    3548.,    4106./ 
+      ! 7-Fraser (USA)                                      R5
+      ! Old=112 km3/year=3550m3/s;not found in UNESCO
+      ! --> 3549.99976m3/s
+      DATA inb(7)/1/
+      DATA (iirnf(jc,7),jc=1,jpcoef)/  77, 299*0 /
+      DATA (ijrnf(jc,7),jc=1,jpcoef)/ 112, 299*0 /
+      DATA (zrnfm(jm,7),jm=1,jpmois)/12*3550./ 
+      ! 8-Yukon (USA) 63N00 165W00                          R3
+      ! Old=195 km3/year=6179m3/s; UNESCO(65-77+80-84, p321)=4245; ratio=1.46
+      ! --> 6017.24951m3/s
+      DATA inb(8)/1/
+      DATA (iirnf(jc,8),jc=1,jpcoef)/  58, 299*0 /
+      DATA (ijrnf(jc,8),jc=1,jpcoef)/ 122, 299*0 /
+      DATA (zrnfm(jm,8),jm=1,jpmois)/   &
+           1459.,    1213.,    1065.,    1100.,    9067.,   17675.,   &
+          10680.,   11271.,    8658.,    5453.,    2649.,    1917./ 
+     ! 9-Copper (USA) 61N47 144W45                          R2
+     ! Old=39 km3/year=1236m3/s; UNESCO(65-84, p317)=1052m3/s; ratio=1.18
+     ! --> 1236.25m3/s
+      DATA inb(9)/1/
+      DATA (iirnf(jc,9),jc=1,jpcoef)/  67, 299*0 /
+      DATA (ijrnf(jc,9),jc=1,jpcoef)/ 119, 299*0 /
+      DATA (zrnfm(jm,9),jm=1,jpmois)/   &
+           219.,    195.,    181.,    214.,    904.,   2532.,   &
+          4026.,   3627.,   1632.,    697.,    354.,    254./ 
+      ! 10-Susitna (USA)                                    R5
+      ! Old=40 km3/year=1268m3/s
+      ! --> 1268.m3/s
+      DATA inb(10)/1/
+      DATA (iirnf(jc,10),jc=1,jpcoef)/  65, 299*0 /
+      DATA (ijrnf(jc,10),jc=1,jpcoef)/ 118, 299*0 /
+      DATA (zrnfm(jm,10),jm=1,jpmois)/12*1268./ 
+      ! 11-McKenzie (Canada) 70N00 135W00                   R3
+      ! Old=306 km3/year=9697m3/s; UNESCO(67+72+7479+82-84, p168)=8343m3/s;
+      ! ratio=1.16
+      ! --> 9606.66797m3/s
+      DATA inb(11)/1/
+      DATA (iirnf(jc,11),jc=1,jpcoef)/  69, 299*0 /
+      DATA (ijrnf(jc,11),jc=1,jpcoef)/ 131, 299*0 /
+      DATA (zrnfm(jm,11),jm=1,jpmois)/   &
+           3644.,    3400.,    3258.,    3546.,   14188.,   21544.,   &
+          18954.,   15487.,   11284.,   10169.,    5901.,    3905./
+      ! 12-Kuksokwim (USA) 60N00 ~162W30                    R4
+      ! UNESCO(65-84, p318)=1112m3/s (61N87 158E10, Crooked Creek, inland)
+      ! --> 1111.99988m3/s
+      DATA inb(12)/1/
+      DATA (iirnf(jc,12),jc=1,jpcoef)/  60, 299*0 /
+      DATA (ijrnf(jc,12),jc=1,jpcoef)/ 118, 299*0 /
+      DATA (zrnfm(jm,12),jm=1,jpmois)/   &
+          335.,     308.,     295.,     407.,    2415.,    2027.,   &
+          1917.,   2049.,    1585.,    1072.,     545.,     389./     
+
+      DATA inb(13)/0/
+      DATA inb(14)/0/
+      DATA inb(15)/0/
+
+      ! Total run-offs(I)=60974.2539m3/s
+
+      ! II SOUTH AMERICA
+      ! -----------------
+      ! 16-Chira (Peru) 4s54 81w08                          R2
+      ! Old=5 km3/year=158m3/s; UNESCO (65-68, p357)=80.9; ratio=1.95
+      ! --> 158.000015m3/s
+      DATA inb(16)/1/
+      DATA (iirnf(jc,16),jc=1,jpcoef)/ 101, 299*0 /
+      DATA (ijrnf(jc,16),jc=1,jpcoef)/  66, 299*0 /
+      DATA (zrnfm(jm,16),jm=1,jpmois)/   &
+          70.,     105.,     564.,     582.,     230.,      94.,   &
+          87.,      47.,      35.,      32.,      29.,      21./
+      ! 17-Magdalena (Colombia) 11N06 74W51                 R2
+      ! Old=237 km3/year=7510m3/s; UNESCO(71-73+76-79, p348)=6973m3/s;
+      ! ratio=1.08
+      ! --> 7451.58301m3/s
+      DATA inb(17)/1/
+      DATA (iirnf(jc,17),jc=1,jpcoef)/ 104, 299*0 /
+      DATA (ijrnf(jc,17),jc=1,jpcoef)/  86, 299*0 /
+      DATA (zrnfm(jm,17),jm=1,jpmois)/   &
+          6598.,    4441.,    4087.,    5445.,    7380.,    8067.,   &
+          8509.,    7428.,    7631.,    9296.,   10588.,    9949./
+      ! 18-Orinoco (Venezuela) 8N37 62W15!                  R1
+      ! Old=1100 km3/year=34857m3/s; UNESCO(73-75, p364)=28736m3/s;
+      ! HLA=26371m3/s
+      ! Data from HLA: 8.1N - 63.3W   1925/89
+      ! --> 26371.416
+      DATA inb(18)/1/
+      DATA (iirnf(jc,18),jc=1,jpcoef)/ 112, 299*0 /
+      DATA (ijrnf(jc,18),jc=1,jpcoef)/  86, 299*0 /
+      DATA (zrnfm(jm,18),jm=1,jpmois)/   &
+          10670.,    7513.,    6344.,    6887.,   13086.,   26699.,   &
+          43938.,   59957.,   57435.,   39951.,   27410.,   16567./ 
+      ! 19-Amazon (Brazil) 0S05 50W00                       R1
+      ! Old=6300 km3/year=199634m3/s; CLIPPER=166192m3/s~UNESCO;
+      ! HLA=184806m3/s
+      ! UNESCO data are at Obidos which is far inland and therefore does not
+      ! fully represent the actual discharge
+      ! Data from HLA: 1.5N - 55.3W   1970/96
+      ! --> 184845.484m3/s
+      DATA inb(19)/2/
+      DATA (iirnf(jc,19),jc=1,jpcoef)/ 117, 117, 298*0 /
+      DATA (ijrnf(jc,19),jc=1,jpcoef)/  75,  76, 298*0 /
+      DATA (zrnfm(jm,19),jm=1,jpmois)/   &
+          152233., 176415., 199941., 225565., 244016., 244861.,   &
+          230711., 203128., 164531., 128486., 118214., 130045. /
+      ! 20-Sao Francisco (Brazil) 10S30 36W24               R1
+      ! Old=97 km3/year=3074m3/s; UNESCO(77-79, p338)=2645m3/s
+      ! --> 2645.3335m3/s
+      DATA inb(20)/1/
+      DATA (iirnf(jc,20),jc=1,jpcoef)/ 123, 299*0 /
+      DATA (ijrnf(jc,20),jc=1,jpcoef)/  59, 299*0 /
+      DATA (zrnfm(jm,20),jm=1,jpmois)/   &
+          3244.,   4116.,   5139.,   4330.,   2323.,   1800.,   &
+          1587.,   1511.,   1593.,   1740.,   2190.,   2171. /
+      ! 21-Parana+Uruguay(Arg./Uru.) 34S12 58W18            R1 
+      ! Old=470 km3/year=14893m3/s; UNESCO(p323/324)=22263m3/s
+      ! --> 22203.168m3/s 
+      DATA inb(21)/2/
+      DATA (iirnf(jc,21),jc=1,jpcoef)/ 114, 114, 298*0 /
+      DATA (ijrnf(jc,21),jc=1,jpcoef)/  46,  47, 298*0 /
+      DATA (zrnfm(jm,21),jm=1,jpmois)/   &
+          24803.,   26836.,   24585.,   21358.,   20041.,   21689.,   &
+          22647.,   20403.,   19627.,   21400.,   21126.,   21923./
+      ! 22-Negro (Argentina)  41S02  62W47                  R2
+      ! Old=30 km3/year=951m3/s; UNESCO(65-79,p330)=765m3/s; ratio=1.24
+      ! --> 907.666687m3/s
+      DATA inb(22)/1/
+      DATA (iirnf(jc,22),jc=1,jpcoef)/ 110, 299*0 /
+      DATA (ijrnf(jc,22),jc=1,jpcoef)/  43, 299*0 /
+      DATA (zrnfm(jm,22),jm=1,jpmois)/   &
+          882.,     587.,     519.,     482.,     623.,     984.,   &
+          1120.,   1294.,    1092.,    1166.,    1105.,    1038./
+     ! 23- Tocantins :  ~48W00 ~0.5S                        R4
+     ! UNESCO(76-77+80-81, p335)=12167m3/s (station far inland!)
+     ! --> 12173.082m3/s
+      DATA inb(23)/1/
+      DATA (iirnf(jc,23),jc=1,jpcoef)/118, 299*0 /
+      DATA (ijrnf(jc,23),jc=1,jpcoef)/ 73, 299*0 /
+      DATA (zrnfm(jm,23),jm=1,jpmois)/   &
+          15507.,  24855.,  27854.,  24257.,  15860.,   7861.,   &
+          4440.,   3082.,   2728.,   3417.,   5511.,  10705. /
+
+      DATA inb(24)/0/
+      DATA inb(25)/0/
+
+      ! Total run-offs(II)=256755.75
+      ! Total run-offs(I+II)=317730
+
+      ! III EUROPE
+      ! ----------
+      ! 26-Rhone (France) 43N20 4E50                        R1 
+      ! Old=49 km3/year=1553m3/s; UNESCO(65-83, p512)=1229
+      ! --> 1217.16663m3/s
+      DATA inb(26)/1/
+      DATA (iirnf(jc,26),jc=1,jpcoef)/ 150, 299*0 /
+      DATA (ijrnf(jc,26),jc=1,jpcoef)/ 108, 299*0 /
+      DATA (zrnfm(jm,26),jm=1,jpmois)/   &
+          1385.,    1848.,    1568.,    1311.,    1420.,    1191.,   &
+           937.,     796.,     794.,     962.,    1161.,    1233./
+      ! 27-Po (Italy) 11N10 1W09                            R1 
+      ! Old=46 km3/year=1458m3/s; UNESCO(65-84, p527)=1550m3/s
+      ! --> 1550.08337m3/s
+      DATA inb(27)/1/
+      DATA (iirnf(jc,27),jc=1,jpcoef)/ 159, 299*0 /
+      DATA (ijrnf(jc,27),jc=1,jpcoef)/ 110, 299*0 /
+      DATA (zrnfm(jm,27),jm=1,jpmois)/   &
+          1304.,    1605.,    1856.,    1549.,    1958.,    1760.,   &
+          1040.,    1007.,    1615.,    1907.,    1772.,    1228./
+      ! 28-Danube (Roumania) 45N20 29E40                    R1 
+      ! Old=206 km3/year=6527m3/s; UNESCO(65-84, p544)=7011m3/s
+      ! --> 7011.8335m3/s
+      DATA inb(28)/1/
+      DATA (iirnf(jc,28),jc=1,jpcoef)/ 171, 299*0 /
+      DATA (ijrnf(jc,28),jc=1,jpcoef)/ 106, 299*0 /
+      DATA (zrnfm(jm,28),jm=1,jpmois)/   &
+          6625.,    7352.,    7986.,    9279.,    9482.,    8618.,   &
+          7586.,    6001.,    5210.,    4989.,    4921.,    6093./
+
+      DATA inb(29)/0/
+      DATA inb(30)/0/
+
+      ! Total run-offs(III)=9779.08301m3/s
+      ! Total run-offs(I+II+III)=327509.094m3/s
+
+      ! IV EURASIAN ARCTIC
+      ! ------------------
+      ! 31-Iana (Russia)                                    R1
+      ! Old=29 km3/year=919m3/s; UNESCO(65-72+74+76-84, p463)=936m3/s
+      ! --> 0m3/s
+      DATA inb(31)/0/
+      DATA (iirnf(jc,31),jc=1,jpcoef)/ 300*0 /
+      DATA (ijrnf(jc,31),jc=1,jpcoef)/ 300*0 /
+      DATA (zrnfm(jm,31),jm=1,jpmois)/   &
+             2.,       1.,       0.,       0.,     917.,    3514.,   &
+          2968.,    2329.,    1322.,     178.,      36.,       8./ 
+      ! 32-Ob (Russia) 66N45 69E30                          R1 
+      ! Old=385 km3/year=12200m3/s; UNESCO(65-84, p478)=12862m3/s
+      ! --> 12861.5m3/s
+      DATA inb(32)/2/
+      DATA (iirnf(jc,32),jc=1,jpcoef)/ 153, 153, 298*0 /
+      DATA (ijrnf(jc,32),jc=1,jpcoef)/ 146, 147, 298*0 /
+      DATA (zrnfm(jm,32),jm=1,jpmois)/   &
+           4977.,    4150.,    3611.,    3590.,   14723.,   33366.,   &
+          30773.,   22785.,   14701.,    9705.,    6078.,    5879./
+      ! 33-Yenesei (Russia) 71N50 82E40                     R1 
+      ! Old=560 km3/year=17745m3/s; UNESCO(65-84, p472)=17462m3/s
+      ! --> 17461.666m3/s
+      DATA inb(33)/1/
+      DATA (iirnf(jc,33),jc=1,jpcoef)/  32, 299*0 /
+      DATA (ijrnf(jc,33),jc=1,jpcoef)/ 147, 299*0 /
+      DATA (zrnfm(jm,33),jm=1,jpmois)/   &
+           6659.,    7007.,    6895.,    7089.,   24183.,   74965.,   &
+          25325.,   15940.,   16050.,   12678.,    6741.,    6008./
+     ! 34-Severnaya Dvina(Russia)64N32 40E30                R5 
+     ! Old=106 km3/year=3359m3/s; not in UNESCO data base
+     ! --> 3359.00024m3/s
+      DATA inb(34)/1/
+      DATA (iirnf(jc,34),jc=1,jpcoef)/ 153, 299*0 /
+      DATA (ijrnf(jc,34),jc=1,jpcoef)/ 133, 299*0 /
+      DATA (zrnfm(jm,34),jm=1,jpmois)/12*3359./
+      ! 35-Lena (Russia) 72N25 126E40                       R1 
+      ! --> 16192.333m3/s
+      DATA inb(35)/1/
+      DATA (iirnf(jc,35),jc=1,jpcoef)/  36, 299*0 /
+      DATA (ijrnf(jc,35),jc=1,jpcoef)/ 137, 299*0 /
+      DATA (zrnfm(jm,35),jm=1,jpmois)/   &
+           2663.,    2095.,    1629.,    1324.,    7203.,   64230.,   &
+          40810.,   28310.,   25995.,   13299.,    3673.,    3077./
+      ! 36-Kolyma (Russia) 69N30 161E00                     R1
+      ! Old=71 km3/year=2250m3/s; UNESCO(65-84)=2138m3/s
+      ! --> 2138.66675m3/s
+      DATA inb(36)/1/
+      DATA (iirnf(jc,36),jc=1,jpcoef)/  46, 299*0 /
+      DATA (ijrnf(jc,36),jc=1,jpcoef)/ 128, 299*0 /
+      DATA (zrnfm(jm,36),jm=1,jpmois)/   &
+           131.,      92.,      76.,      65.,    2576.,    9143.,   &
+          4670.,    3727.,    3226.,    1119.,     630.,     209./
+     ! 37-Indigirka (russia) 70N48 148E54                   R1 
+     ! Old=55 km3/year=1743m3/s; UNESCO(65-68+70+72-84)=1622.
+     ! --> 1622.00012m3/s
+      DATA inb(37)/1/
+      DATA (iirnf(jc,37),jc=1,jpcoef)/  42, 299*0 /
+      DATA (ijrnf(jc,37),jc=1,jpcoef)/ 131, 299*0 /
+      DATA (zrnfm(jm,37),jm=1,jpmois)/   &
+            32.,      17.,      11.,       7.,     354.,    5629.,   &
+          5210.,    4617.,    2823.,     559.,     142.,      63./
+
+      DATA inb(38)/0/
+      DATA inb(39)/0/
+      DATA inb(40)/0/
+
+      ! Total run-offs(IV)=40773.6641m3/s
+      ! Total run-offs(I+II+III+IV)=368282.75m3/s
+
+      ! V ASIA
+      ! ------
+      ! 41-Amur (Russia) 52N56 141E10                       R2
+      ! Old=325 km3/year=10299m3/s; UNESCO(65-84, p451)=8792m3/s; ratio=1.17
+      ! --> 10299.332m3/s
+      DATA inb(41)/1/
+      DATA (iirnf(jc,41),jc=1,jpcoef)/  33, 299*0 /
+      DATA (ijrnf(jc,41),jc=1,jpcoef)/ 116, 299*0 /
+      DATA (zrnfm(jm,41),jm=1,jpmois)/   &
+           2108.,    1543.,    1252.,    4088.,   15464.,   17336.,   &
+          16100.,   20801.,   21548.,   15658.,    5188.,    2506./
+      ! 42-Liaohe (China) 40N40 122E09                      R5
+      ! Old=6 km3/year=190m3/s; not found in UNESCO data base
+      ! --> 189.999985m3/s
+      DATA inb(42)/1/
+      DATA (iirnf(jc,42),jc=1,jpcoef)/  22, 299*0 /
+      DATA (ijrnf(jc,42),jc=1,jpcoef)/ 104, 299*0 /
+      DATA (zrnfm(jm,42),jm=1,jpmois)/12*190./
+      ! 43-Daling (China) 40N56 121E43                      R5
+      ! Old=1 km3/year=32m3/s; not found in UNESCO data base
+      ! --> 31.9999962m3/s
+      DATA inb(43)/1/
+      DATA (iirnf(jc,43),jc=1,jpcoef)/  24, 299*0 /
+      DATA (ijrnf(jc,43),jc=1,jpcoef)/ 104, 299*0 /
+      DATA (zrnfm(jm,43),jm=1,jpmois)/12*32./
+      ! 44-Haiho (China) 6N17   1E23
+      ! Old=2 km3/year=64m3/s; not found in UNESCO data base
+      ! --> 63.9999924m3/s
+      DATA inb(44)/1/
+      DATA (iirnf(jc,44),jc=1,jpcoef)/  28, 299*0 /
+      DATA (ijrnf(jc,44),jc=1,jpcoef)/ 106, 299*0 /
+      DATA (zrnfm(jm,44),jm=1,jpmois)/12*64./
+      ! 45-Yellow/Huangho (China) 37N32 118E19              R2 
+      ! Old=49 km3/year=1553m3/s; UNESCO(p371)=1210m3/s; ratio=1.28
+      ! --> 1552.5m3/s
+      DATA inb(45)/1/
+      DATA (iirnf(jc,45),jc=1,jpcoef)/  22, 299*0 /
+      DATA (ijrnf(jc,45),jc=1,jpcoef)/ 103, 299*0 /
+      DATA (zrnfm(jm,45),jm=1,jpmois)/   &
+           697.,     674.,    1282.,    1206.,    1109.,     778.,   &
+          1964.,    3270.,    3668.,    2133.,     978.,     871./
+      ! 46-Yangtze (China) 31N48 121E10=Changjiang          R2
+      ! Old=900 km3/year=28520m3/s; UNESCO(p372)=25032m3/s; ratio=1.14
+      ! --> 28519.584m3/s
+      DATA inb(46)/1/
+      DATA (iirnf(jc,46),jc=1,jpcoef)/  23, 299*0 /
+      DATA (ijrnf(jc,46),jc=1,jpcoef)/  98, 299*0 /
+      DATA (zrnfm(jm,46),jm=1,jpmois)/   &
+          10994.,   10548.,   13254.,   24097.,   36972.,   47197.,   &
+          53891.,   42070.,   37627.,   30762.,   22046.,   12777./
+      ! 47-Pearl/Zhujiang (China) 23N36 106E34=Xijiang      R2 
+      ! Old=302 km3/year=9570m3/s; UNESCO(76,82, p373)=6987m3/s; ratio=1.37
+      ! --> 9570.75m3/s
+      DATA inb(47)/1/
+      DATA (iirnf(jc,47),jc=1,jpcoef)/  22, 299*0 /
+      DATA (ijrnf(jc,47),jc=1,jpcoef)/  95, 299*0 /
+      DATA (zrnfm(jm,47),jm=1,jpmois)/   &
+           2357.,    2415.,    2634.,    6446.,   14246.,   18395.,   &
+          19213.,   17558.,   12312.,    7255.,    5864.,    6154./
+      ! 48-Red/Hungho (Vietnam) 20N17 106E34                R5 
+      ! Old=123 km3/year=3897m3/s; not in UNESCO data base
+      ! --> 3897.m3/s
+      DATA inb(48)/1/
+      DATA (iirnf(jc,48),jc=1,jpcoef)/  16, 299*0 /
+      DATA (ijrnf(jc,48),jc=1,jpcoef)/  91, 299*0 /
+      DATA (zrnfm(jm,48),jm=1,jpmois)/12*3897./
+      ! 49-Mekong (Vietnam) 10N33 105E24                    R5
+      ! Old=470 km3/year=14893m3/s; not in UNESCO data base
+      ! --> 14893.0029m3/s
+      DATA inb(49)/2/
+      DATA (iirnf(jc,49),jc=1,jpcoef)/  16,  16, 298*0 /
+      DATA (ijrnf(jc,49),jc=1,jpcoef)/  86,  87, 298*0 /
+      DATA (zrnfm(jm,49),jm=1,jpmois)/12*14893./
+      ! 50-Irrawady (Burma) 15N50  95E06                    R5
+      ! Old=428 km3/year=13563m3/s; not in UNESCO data base
+      ! --> 13563.m3/s
+      DATA inb(50)/1/
+      DATA (iirnf(jc,50),jc=1,jpcoef)/  10, 299*0 /
+      DATA (ijrnf(jc,50),jc=1,jpcoef)/  90, 299*0 /
+      DATA (zrnfm(jm,50),jm=1,jpmois)/12*13563./
+      ! 51-Ganges+Brahmaputra (Beng.) 22N00  91E00          R1
+      ! Old=971 km3/year=30769m3/s; UNESCO(69-70+73-75, p367)=31760m3/s
+      ! --> 32147.498m3/s
+      DATA inb(51)/2/
+      DATA (iirnf(jc,51),jc=1,jpcoef)/   7,  8, 298*0 /
+      DATA (ijrnf(jc,51),jc=1,jpcoef)/  93, 93, 298*0 /
+      DATA (zrnfm(jm,51),jm=1,jpmois)/   &
+           6623.,    6315.,    6432.,    9410.,   17263.,   38302.,   &
+          64688.,   80338.,   84802.,   43387.,   17888.,   10322./
+      ! 52-Mehandi (India)                                  R5
+      ! Old=67 km3/year=2123m3/s; not in UNESCO data base
+      ! --> 0m3/s
+      DATA inb(52)/0/
+      DATA (iirnf(jc,52),jc=1,jpcoef)/ 300*0 /
+      DATA (ijrnf(jc,52),jc=1,jpcoef)/ 300*0 /
+      DATA (zrnfm(jm,52),jm=1,jpmois)/12*2123./
+      ! 53-Damodar (India)                                  R2
+      ! Old=10 km3/year=320m3/s; UNESCO(p386)=173m3/s; ratio=1.85
+      ! --> 432.916656m3/s
+      DATA inb(53)/1/
+      DATA (iirnf(jc,53),jc=1,jpcoef)/   6, 299*0 /
+      DATA (ijrnf(jc,53),jc=1,jpcoef)/  93, 299*0 /
+      DATA (zrnfm(jm,53),jm=1,jpmois)/   &
+           51.,      37.,      42.,      49.,      85.,     296.,   &
+          896.,    1390.,    1591.,     542.,     172.,      44./   
+      ! 54-Godavari (India) 17N00  81E45                    R2
+      ! Old=84 km3/year=2662m3/s; UNESCO(p379)=1916m3/s; ratio=1.39
+      ! --> 3670.5m3/s
+      DATA inb(54)/1/
+      DATA (iirnf(jc,54),jc=1,jpcoef)/   3, 299*0 /
+      DATA (ijrnf(jc,54),jc=1,jpcoef)/  90, 299*0 /
+      DATA (zrnfm(jm,54),jm=1,jpmois)/   &
+           988.,     737.,     280.,     219.,     196.,    1691.,   &
+          8063.,   14571.,   11428.,    3953.,    1221.,     699./   
+     ! 55-Indus (Pakistan) 24N20  67E47                     R2
+     ! Old=238 km3/year=7542m3/s; UNESCO (76-79, p428)=2396m3/s; ratio=3.15
+     ! --> 7562.m3/s
+      DATA inb(55)/2/
+      DATA (iirnf(jc,55),jc=1,jpcoef)/ 176, 176, 298*0 /
+      DATA (ijrnf(jc,55),jc=1,jpcoef)/  93,  94, 298*0 /
+      DATA (zrnfm(jm,55),jm=1,jpmois)/   &
+            988.,     737.,    1904.,    1968.,    3625.,    6143.,   &
+          15969.,    36656.,  17173.,    3215.,    1251.,    1115./   
+      ! 56-Tigris and Euphrates (Iraq) 31N00  47E25         R1
+      ! Old=46 km3/year=1458m3/s; UNESCO(76-79, p428)=2396m3/s
+      ! --> 2248.8335m3/s
+      DATA inb(56)/1/
+      DATA (iirnf(jc,56),jc=1,jpcoef)/ 172, 299*0 /
+      DATA (ijrnf(jc,56),jc=1,jpcoef)/  94, 299*0 /
+      DATA (zrnfm(jm,56),jm=1,jpmois)/   &
+          1872.,    2127.,    2962.,    4944.,    5036.,    3078.,   &
+          1362.,     900.,     786.,     993.,    1184.,    1742./   
+
+      DATA inb(57)/0/
+      DATA inb(58)/0/
+      DATA inb(59)/0/
+      DATA inb(60)/0/
+
+      ! Total run-offs (V)=128642.922m3/s
+      ! Total run-offs (I+II+III+IV+V)=496925.688m3/s
+      
+      ! VI AFRICA
+      ! ----------
+      ! 61-Nile (Egypt) 30N10  31E06                        R1
+      ! Old=30 km3/year=951m3/s; UNESCO(73-84)=1251m3/s
+      ! --> 1251.33337m3/s
+      DATA inb(61)/1/
+      DATA (iirnf(jc,61),jc=1,jpcoef)/ 176, 299*0 /
+      DATA (ijrnf(jc,61),jc=1,jpcoef)/  97, 299*0 /
+      DATA (zrnfm(jm,61),jm=1,jpmois)/   &
+          1239.,    1035.,    1126.,    1110.,    1170.,    1542.,   &
+          1742.,    1559.,    1191.,    1103.,    1075.,    1124./   
+      ! 62-Niger (Nigeria) 5N33   6E33                      R1
+      ! Old=192 km3/year=6084m3/s; HLA=5545m3/s;
+      ! Data from HLA: 4.5N -  6  E   1950/87
+      ! --> 5545.08301m3/s
+      DATA inb(62)/1/
+      DATA (iirnf(jc,62),jc=1,jpcoef)/ 146, 299*0 /
+      DATA (ijrnf(jc,62),jc=1,jpcoef)/  81, 299*0 /
+      DATA (zrnfm(jm,62),jm=1,jpmois)/   &
+          2029.,    1804.,    1573.,    1418.,    1494.,    2561.,   &
+          5272.,    9629.,   14951.,   16227.,    6842.,    2741./   
+      ! 63-Zaire/Congo (Congo) 6S04  12E24                  R1      
+      ! Old=1250 km3/year=39610m3/s; UNESCO(65-83, p149)=41941m3/s; HLA
+      ! =39720m3/s
+      ! Data from HLA: 6S - 12  E   1902/96
+      ! --> 39719.5m3/s
+      DATA inb(63)/2/
+      DATA (iirnf(jc,63),jc=1,jpcoef)/ 148, 148, 298*0 /
+      DATA (ijrnf(jc,63),jc=1,jpcoef)/  63,  64, 298*0 /
+      DATA (zrnfm(jm,63),jm=1,jpmois)/   &
+          47200.,   37692.,   34374.,   36603.,   37862.,   35588.,   &
+          30966.,   30774.,   35981.,   42825.,   51455.,   55314./  
+      ! 64-Orange (Sth Africa) 28S41 16E28                  R5
+      ! Old=11 km3/year=349m3/s
+      ! --> 349.000031m3/s
+      DATA inb(64)/1/
+      DATA (iirnf(jc,64),jc=1,jpcoef)/ 150, 299*0 /
+      DATA (ijrnf(jc,64),jc=1,jpcoef)/  51, 299*0 /
+      DATA (zrnfm(jm,64),jm=1,jpmois)/12*349./
+      ! 65-Zambesi (Mozambique) 18S55 36E04                 R5
+      ! Old=223 km3/year=7066m3/s
+      ! --> 7066.00049m3/s
+      DATA inb(65)/1/
+      DATA (iirnf(jc,65),jc=1,jpcoef)/ 160, 299*0 /
+      DATA (ijrnf(jc,65),jc=1,jpcoef)/  56, 299*0 /
+      DATA (zrnfm(jm,65),jm=1,jpmois)/12*7066./
+      ! 66-Limpopo (mozambique) 25S15 33E30                 R5
+      ! Old=5 km3/year=158m3/s
+      ! --> 158.m3/s
+      DATA inb(66)/1/
+      DATA (iirnf(jc,66),jc=1,jpcoef)/ 159, 299*0 /
+      DATA (ijrnf(jc,66),jc=1,jpcoef)/  52, 299*0 /
+      DATA (zrnfm(jm,66),jm=1,jpmois)/12*158./
+      ! 67-Rufiji (tanzania) 8S00 39E20                     R5
+      ! Old=9 km3/year=285m3/s
+      ! --> 285.m3/s
+      DATA inb(67)/1/
+      DATA (iirnf(jc,67),jc=1,jpcoef)/ 162, 299*0 /
+      DATA (ijrnf(jc,67),jc=1,jpcoef)/  62, 299*0 /
+      DATA (zrnfm(jm,67),jm=1,jpmois)/12*285./
+      ! Other rivers from the Gulf of Guinea
+      ! 68-Kouilou (Congo)  4.5S-11.5E (UNESCO=p51)         R1
+      ! Data from HLA:  4S - 11  E   1953/86 = 919m3/s
+      ! --> 924.25m3/s
+      DATA inb(68)/1/
+      DATA (iirnf(jc,68),jc=1,jpcoef)/ 147, 299*0 /
+      DATA (ijrnf(jc,68),jc=1,jpcoef)/  67, 299*0 /
+      DATA (zrnfm(jm,68),jm=1,jpmois)/   &
+          1115.,    1166.,    1285.,    1462.,    1454.,     725.,   &
+           480.,     378.,     327.,     400.,    1018.,    1281./
+      ! 69-Nyanga (Gabon)  3S-10E (UNESCO=p66)              R1
+      ! Data from HLA: 2.8N - 10  E   1952/82 = 264m3/s
+      ! --> 264.166687m3/s
+      DATA inb(69)/1/
+      DATA (iirnf(jc,69),jc=1,jpcoef)/ 147, 299*0 /
+      DATA (ijrnf(jc,69),jc=1,jpcoef)/  68, 299*0 /
+      DATA (zrnfm(jm,69),jm=1,jpmois)/   &
+          126.,      99.,     143.,     253.,     316.,     300.,   &
+          156.,      93.,     231.,     557.,     592.,     304./
+      ! 70-Ogoue (Gabon) 1S-9E (UNESCO, p69)                R1
+      ! Data from HLA: .75S -  9  E   1930/90 = 4512m3/s
+      ! --> 4511.83301m3/s
+      DATA inb(70)/1/
+      DATA (iirnf(jc,70),jc=1,jpcoef)/ 146, 299*0 /
+      DATA (ijrnf(jc,70),jc=1,jpcoef)/  72, 299*0 /
+      DATA (zrnfm(jm,70),jm=1,jpmois)/   &
+          4514.,    3988.,    4622.,    5403.,    5790.,    4145.,   &
+          2616.,    1961.,    2119.,    4304.,    7870.,    6810./
+      ! 71-Sanaga (Cameroun) 3.5N-9.5E (UNESCO, p31)        R1
+      ! Data from HLA: 3.9N -  9.6E   1944/80 = 1983m3/s
+      ! --> 1982.58337m3/s
+      DATA inb(71)/1/
+      DATA (iirnf(jc,71),jc=1,jpcoef)/ 146, 299*0 /
+      DATA (ijrnf(jc,71),jc=1,jpcoef)/  81, 299*0 /
+      DATA (zrnfm(jm,71),jm=1,jpmois)/   &
+           813.,     578.,     517.,     633.,     909.,    1278.,   &
+          1928.,    2653.,    4361.,    5470.,    3307.,    1344./
+      ! 72-Nyong (Cameroun) 3.1N-9.5E (UNESCO, p36)         R1
+      ! Data from HLA: 3.5N -  9.8E   1951/84 = 432m3/s
+      ! --> 431.166656m3/s      
+      DATA inb(72)/1/
+      DATA (iirnf(jc,72),jc=1,jpcoef)/ 146, 299*0 /
+      DATA (ijrnf(jc,72),jc=1,jpcoef)/  80, 299*0 /
+      DATA (zrnfm(jm,72),jm=1,jpmois)/   &
+          232.,     128.,     150.,     266.,     402.,     459.,   &
+          353.,     306.,     604.,     930.,     878.,     466./
+      ! 73-Ntem (Cameroun) 2.5N-9.5E (UNESCO, p36)          R1
+      ! Data from HLA: 3N -  9.8E   1951/87 = 330m3/s      
+      ! --> 329.75m3/s
+      DATA inb(73)/1/
+      DATA (iirnf(jc,73),jc=1,jpcoef)/ 146, 299*0 /
+      DATA (ijrnf(jc,73),jc=1,jpcoef)/  79, 299*0 /
+      DATA (zrnfm(jm,73),jm=1,jpmois)/   &
+          452.,     455.,     492.,     466.,     482.,     251.,   &
+          151.,     108.,      87.,     133.,     395.,     485./
+      ! 74-Wouri (Cameroun) 4N-9.5E (UNESCO, p34)           R1
+      ! Data from HLA: 4N -  9.5E   1951/84  = 307m3/s
+      ! --> 306.583374m3/s
+      DATA inb(74)/1/
+      DATA (iirnf(jc,74),jc=1,jpcoef)/ 145, 299*0 /
+      DATA (ijrnf(jc,74),jc=1,jpcoef)/  81, 299*0 /
+      DATA (zrnfm(jm,74),jm=1,jpmois)/   &
+           88.,      63.,      68.,      95.,     139.,     222.,   &
+          395.,     633.,     825.,     675.,     328.,     148./
+      ! 75-Oueme (Benin) 6.5N-2.5E (UNESCO, p27)            R1
+      ! Data from HLA:  6.2N -  2.5E   1951/84 =113m3/s
+      ! --> 112.666664m3/s
+      DATA inb(75)/1/
+      DATA (iirnf(jc,75),jc=1,jpcoef)/ 144, 299*0 /
+      DATA (ijrnf(jc,75),jc=1,jpcoef)/  83, 299*0 /
+      DATA (zrnfm(jm,75),jm=1,jpmois)/   &
+           0.,       0.,       0.,       0.,       1.,      18.,   &
+          96.,     324.,     531.,     319.,      58.,       5./
+      ! 76-Mono(Tepetou,Benin/Togo) 6.25N-1.8E (U, p27)     R1
+      ! Data from HLA: 6.2N -  1  E   1951/85  = 96m3/s       
+      ! --> 96.4999924m3/s
+      DATA inb(76)/1/
+      DATA (iirnf(jc,76),jc=1,jpcoef)/ 143, 299*0 /
+      DATA (ijrnf(jc,76),jc=1,jpcoef)/  83, 299*0 /
+      DATA (zrnfm(jm,76),jm=1,jpmois)/   &
+            2.,       1.,       1.,       4.,       8.,      44.,   &
+          168.,     274.,     386.,     215.,      47.,       8./
+      ! 77-Comoe (Ivory Coast) 5N-4W (UNESCO, p56)          R1
+      ! Data from HLA: 5.1N -  4  W   1955/86 = 194m3/s       
+      ! --> 194.25m3/s
+      DATA inb(77)/1/
+      DATA (iirnf(jc,77),jc=1,jpcoef)/ 140, 299*0 /
+      DATA (ijrnf(jc,77),jc=1,jpcoef)/  82, 299*0 /
+      DATA (zrnfm(jm,77),jm=1,jpmois)/   &
+           14.,       7.,       9.,      17.,      29.,      90.,   &
+          145.,     349.,     740.,     688.,     198.,      45./
+      ! 78-Sassandra (Ivory Coast) 5N-6W (UNESCO, p58)      R1
+      ! Data from HLA: 5N -  6  W   1953/86 = 449m3/s
+      ! --> 449.333344m3/s
+      DATA inb(78)/1/
+      DATA (iirnf(jc,78),jc=1,jpcoef)/ 139, 299*0 /
+      DATA (ijrnf(jc,78),jc=1,jpcoef)/  82, 299*0 /
+      DATA (zrnfm(jm,78),jm=1,jpmois)/   &
+          144.,     116.,     119.,     143.,     156.,     334.,   &
+          419.,     692.,    1277.,    1190.,     553.,     249./
+
+      DATA inb(79)/0/
+      DATA inb(80)/0/
+      DATA inb(82)/0/
+      DATA inb(83)/0/
+      DATA inb(84)/0/
+      DATA inb(85)/0/
+      DATA inb(86)/0/
+      DATA inb(87)/0/
+      DATA inb(88)/0/
+      DATA inb(89)/0/
+      DATA inb(90)/0/
+
+      ! Total run-offs (VI)=63977.m3/s
+      ! Total run-offs (I+II+III+IV+V+VI)=560902.688m3/s
+      
+      ! VII OCEANIA
+      ! ------------
+      ! 91-Murray (Austrlia) 35S34 138E54                   R5
+      ! Old=22 km3/year=697m3/s
+      ! --> 696.999939m3/s
+      DATA inb(91)/1/
+      DATA (iirnf(jc,91),jc=1,jpcoef)/  30, 299*0 /
+      DATA (ijrnf(jc,91),jc=1,jpcoef)/  47, 299*0 /
+      DATA (zrnfm(jm,91),jm=1,jpmois)/12*697./
+      ! 92-Haast (N. Zeland) 43S50 169E02                   R5
+      ! Old=6 km3/year=190m3/s
+      ! --> 189.999985m3/s
+      DATA inb(92)/1/
+      DATA (iirnf(jc,92),jc=1,jpcoef)/  48, 299*0 /
+      DATA (ijrnf(jc,92),jc=1,jpcoef)/  41, 299*0 /
+      DATA (zrnfm(jm,92),jm=1,jpmois)/12*190./
+      ! 93-Fly (N. Guinea) 8S30 143E05                      R5
+      ! Old=77 km3/year=2440m3/s
+      ! --> 2440.m3/s
+      DATA inb(93)/1/
+      DATA (iirnf(jc,93),jc=1,jpcoef)/  34, 299*0 /
+      DATA (ijrnf(jc,93),jc=1,jpcoef)/  62, 299*0 /
+      DATA (zrnfm(jm,93),jm=1,jpmois)/12*2440./
+      ! 94-Purari (N. Guinea) 7S25 145E05                   R4
+      ! Old=77 km3/year=2440m3/s; UNESCO(77+83,p595)=2727m3/s
+      ! --> 2727.33325m3/s
+      DATA inb(94)/1/
+      DATA (iirnf(jc,94),jc=1,jpcoef)/  36, 299*0 /
+      DATA (ijrnf(jc,94),jc=1,jpcoef)/  64, 299*0 /
+      DATA (zrnfm(jm,94),jm=1,jpmois)/   &
+          1972.,    3067.,    2332.,    2981.,    2693.,    2876.,   &
+          2867.,    3477.,    2195.,    2967.,    2674.,    2627./
+      ! 95-Choshui ch''i (taiwan) 24N03 120E23              R2
+      ! Old=6 km3/year=190m3/s; UNESCO(65-68, p374)=120m3/s; ratio=1.58 
+      ! --> 0.m3/s
+      DATA inb(95)/0/
+      DATA (iirnf(jc,95),jc=1,jpcoef)/  22, 299*0 /
+      DATA (ijrnf(jc,95),jc=1,jpcoef)/  94, 299*0 /
+      DATA (zrnfm(jm,95),jm=1,jpmois)/   &
+           65.,      63.,      83.,     100.,     177.,     535.,   &
+          332.,     313.,     236.,     193.,     101.,      84./
+      ! 96-Kaoping (Taiwan)                                 R5  
+      ! Old=9 km3/year=285m3/s
+      ! --> 0.m3/s
+      DATA inb(96)/0/
+      DATA (iirnf(jc,96),jc=1,jpcoef)/ 300*0 /
+      DATA (ijrnf(jc,96),jc=1,jpcoef)/ 300*0 /
+      DATA (zrnfm(jm,96),jm=1,jpmois)/12*285./
+      ! 97-Tsengwen (Taiwan)                                R5
+      ! Old=2 km3/year=63m3/s
+      ! --> 0.m3/s
+      DATA inb(97)/0/
+      DATA (iirnf(jc,97),jc=1,jpcoef)/ 300*0 /
+      DATA (ijrnf(jc,97),jc=1,jpcoef)/ 300*0 /
+      DATA (zrnfm(jm,97),jm=1,jpmois)/12*63./
+      ! 98-Hualien (Taiwan)                                 R5
+      ! Old=4 km3/year=127m3/s
+      ! --> 0.m3/s
+      DATA inb(98)/0/
+      DATA (iirnf(jc,98),jc=1,jpcoef)/ 300*0 /
+      DATA (ijrnf(jc,98),jc=1,jpcoef)/ 300*0 /
+      DATA (zrnfm(jm,98),jm=1,jpmois)/12*127./
+      ! 99-Peinan (Taiwan) 22N46 121E10                     R5
+      ! Old=4 km3/year=127m3/s
+      ! --> 127.000008m3/s
+      DATA inb(99)/1/
+      DATA (iirnf(jc,99),jc=1,jpcoef)/  23, 299*0 /
+      DATA (ijrnf(jc,99),jc=1,jpcoef)/  94, 299*0 /
+      DATA (zrnfm(jm,99),jm=1,jpmois)/12*127./
+      ! 100-Hsiukuluan (Taiwan)                             R5
+      ! Old=4 km3/year=127m3/s
+      ! --> 0.m3/s
+      DATA inb(100)/0/
+      DATA (iirnf(jc,100),jc=1,jpcoef)/ 300*0 /
+      DATA (ijrnf(jc,100),jc=1,jpcoef)/ 300*0 /
+      DATA (zrnfm(jm,100),jm=1,jpmois)/12*127./
+
+      DATA inb(101)/0/
+      DATA inb(102)/0/
+
+      !  Total run-offs(VII)=6181.33301m3/s
+      !  Total run-offs(I+II+III+IV+V+VI+VII)= 567084. m3/s
+      !                                      = 1.588668056E-6 kg/m2/s
+      !                                      = 17883.5586 km3/Year
+      !                                      = 0.567083955 Sverdrup
+
+      ! VIII ANTARCTICA
+      ! ---------------
+      ! 103 -Antarcti! ice discharge (2 613 Gt/year) (jacobs et al 1992)
+      ! Data from Jacobs et al 92: =2613 km3/year=82857.686454 m3/s
+      ! --> 82858 m3/s
+      DATA inb(103)/295/
+      DATA (iirnf(jc,103),jc=1,jpcoef)/   &
+            1,    2,    3,    3,    4,    4,    5,    6,    7,    8,   &
+            9,    9,   10,   11,   12,   13,   14,   14,   15,   16,   &
+           17,   18,   19,   20,   21,   22,   23,   24,   25,   26,   &
+           27,   28,   29,   30,   31,   32,   32,   33,   34,   35,   &
+           35,   36,   36,   37,   38,   39,   40,   40,   41,   42,   &
+           42,   43,   43,   44,   44,   44,   44,   44,   44,   44,   &
+           45,   45,   45,   45,   46,   46,   46,   46,   46,   47,   &
+           47,   47,   47,   47,   48,   48,   48,   48,   48,   49,   &
+           50,   51,   51,   52,   53,   54,   55,   56,   57,   58,   &
+           59,   60,   61,   62,   62,   63,   63,   64,   65,   66,   &
+           66,   67,   67,   68,   69,   69,   70,   71,   71,   72,   &
+           73,   73,   74,   75,   76,   76,   77,   78,   78,   79,   &
+           80,   81,   82,   83,   83,   84,   85,   86,   87,   88,   &
+           88,   89,   89,   90,   91,   92,   93,   94,   95,   96,   &
+           97,   98,   99,  100,  101,  102,  102,  103,  104,  104,   &
+          104,  104,  104,  105,  105,  106,  106,  107,  107,  107,   &
+          108,  108,  109,  109,  110,  110,  111,  111,  112,  112,   &
+          112,  112,  112,  112,  112,  112,  112,  112,  112,  112,   &
+          112,  112,  112,  112,  112,  113,  113,  113,  113,  113,   &
+          114,  114,  114,  114,  115,  115,  115,  115,  115,  116,   &
+          116,  117,  117,  118,  118,  119,  119,  120,  121,  122,   &
+          123,  124,  124,  125,  125,  126,  126,  127,  128,  128,   &
+          129,  130,  130,  131,  132,  132,  133,  133,  133,  133,   &
+          133,  134,  135,  135,  136,  136,  136,  137,  137,  138,   &
+          139,  140,  141,  142,  142,  143,  144,  145,  146,  147,   &
+          148,  149,  150,  151,  152,  153,  154,  155,  156,  156,   &
+          157,  158,  159,  160,  161,  161,  162,  163,  163,  164,   &
+          165,  165,  166,  166,  167,  168,  169,  170,  171,  171,   &
+          172,  173,  173,  174,  175,  176,  177,  177,  178,  178,   &
+          179,  180,  180,  181,  181,    0,    0,    0,    0,    0    &
+                                      /
+      DATA (ijrnf(jc,103),jc=1,jpcoef)/   &
+           19,   20,   20,   21,   21,   22,   22,   22,   22,   22,   &
+           22,   23,   23,   23,   23,   23,   22,   23,   22,   22,   &
+           22,   22,   22,   22,   22,   22,   22,   22,   22,   22,   &
+           22,   22,   22,   22,   22,   21,   22,   21,   21,   20,   &
+           21,   19,   20,   19,   19,   19,   18,   19,   18,   17,   &
+           18,   16,   17,    3,    4,    5,    6,    7,    8,   16,   &
+            3,    8,    9,   16,    3,    9,   10,   15,   16,    3,   &
+           10,   11,   14,   15,    3,   11,   12,   13,   14,    3,   &
+            3,    2,    3,    2,    2,    2,    2,    2,    2,    2,   &
+            2,    2,    2,    2,    3,    3,    4,    4,    4,    4,   &
+            5,    5,    6,    6,    6,    7,    7,    7,    8,    8,   &
+            8,    9,    9,    9,    9,   10,   10,   10,   11,   11,   &
+           11,   11,   11,   10,   11,   10,   10,   10,   10,   10,   &
+           11,   11,   12,   12,   12,   12,   12,   12,   12,   12,   &
+           12,   12,   12,   12,   12,   12,   13,   13,   13,   14,   &
+           15,   16,   17,   17,   18,   18,   19,   19,   20,   21,   &
+           21,   22,   22,   23,   23,   24,   24,   25,    8,    9,   &
+           10,   11,   12,   13,   14,   15,   16,   17,   18,   19,   &
+           20,   21,   22,   25,   26,    7,    8,   22,   23,   26,   &
+            7,   23,   24,   26,    6,    7,   24,   25,   26,    5,   &
+            6,    4,    5,    3,    4,    2,    3,    2,    2,    2,   &
+            2,    2,    3,    3,    4,    4,    5,    5,    5,    6,   &
+            6,    6,    7,    7,    7,    8,    8,    9,   10,   11,   &
+           12,   12,   12,   13,   13,   14,   15,   15,   16,   16,   &
+           16,   16,   16,   16,   17,   17,   17,   17,   17,   17,   &
+           17,   17,   17,   17,   17,   17,   17,   17,   17,   18,   &
+           18,   18,   18,   18,   18,   19,   19,   19,   20,   20,   &
+           20,   21,   21,   22,   22,   22,   22,   22,   21,   22,   &
+           21,   20,   21,   20,   20,   20,   19,   20,   18,   19,   &
+           18,   18,   19,   19,   20,    0,    0,    0,    0,    0    &
+                                      /
+      DATA (zrnfm(jm,103),jm=1,jpmois)/12*82858./
+
+      !  Total run-offs(VIII)=82858 m3/s
+      !  Total run-offs(I+II+III+IV+V+VI+VII+VIII)= 649941. m3/s
+      !                                           = 0.649940955 Sverdrup
+
+
+      DATA (inb(jr),jr=104,jpriv)/17*0/
+
+      !!----------------------------------------------------------------------
+      !!  OPA 8.5, LODYC-IPSL (2002)
+      !!----------------------------------------------------------------------
+
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'flxrnf : runoff + orca2'
+         IF(lwp) WRITE(numout,*) '~~~~~~'
+         IF(lwp) WRITE(numout,*) '   nrunoff = ', nrunoff
+         IF(lwp) WRITE(numout,*)
+      ENDIF
+
+      ! 0. initialization and  indexes  modification for zoom version
+      ! --------------------------------------------------------------
+      
+      
+      ! conversion factor m3/s --> kg/m2/s *e1t*e2t
+
+      zconv = rauw
+
+      IF( kt == nit000 ) THEN 
+         ! Set runoffs and upstream coeff to zero
+         runoff (:,:) = 0.e0                                                                                  
+         upsrnfh(:,:) = 0.e0
+         upsrnfz(:)   = 0.e0
+         upsadv (:,:) = 0.e0
+         zcoefr(:,:,:) = 0.e0
+
+         IF( nrunoff == 0 ) THEN
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) ' NO RUNOFF in this simulation '
+            IF(lwp) WRITE(numout,*)
+         ENDIF
+      ENDIF
+
+      ! 1. initialization of the runoff array
+      ! -------------------------------------
+
+      IF( nrunoff == 1 .OR. nrunoff == 2) THEN
+
+         iman  = jpmois
+         
+         i15 = nday / 16
+         
+         imois = nmonth + i15 - 1
+         IF( imois == 0) imois = iman
+         IF( nn_leap_year == 1 .AND. MOD( nyear, 4 ) == 0 ) THEN
+            ! Number of Day Between Data
+            idbd = nbiss(imois)
+         ELSEIF( nn_leap_year > 1 ) THEN
+            idbd = nn_leap_year
+         ELSE
+            idbd = nobis(imois)
+         ENDIF
+         ! Number of days between imois, 15 and the end of month
+         idmeom = idbd - 15
+         
+         ! 1.1 Calendar computation
+         
+         ! nrnf1 number of the first array record used in the simulation
+         ! nrnf2 number of the last  array record
+         
+         nrnf1 = imois
+         nrnf2 = nrnf1 + 1
+         nrnf1 = MOD( nrnf1, iman )
+         IF( nrnf1 == 0 ) nrnf1 = iman
+         nrnf2 = MOD( nrnf2, iman )
+         IF( nrnf2 == 0 ) nrnf2 = iman
+         
+         IF( kt == nit000 ) THEN
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) 'flxrnf routine'
+            IF(lwp) WRITE(numout,*) 'first array record used nrnf1 ',nrnf1
+            IF(lwp) WRITE(numout,*) 'last  array record used nrnf2 ',nrnf2
+         ENDIF
+
+         zxy = FLOAT( nday + idmeom - idbd * i15 ) / idbd
+
+         DO jr = 1, jpriv-1
+            inbp = inb(jr)
+            IF( inbp /= 0 ) THEN
+               DO jl = 1, inbp
+                  ii = iirnf(jl,jr) - nimpp + 1 - jpizoom + 1
+                  ij = ijrnf(jl,jr) - njmpp + 1 - jpjzoom + 1
+                  iipt0 = MAX( 1, MIN( ii, jpi   ) )
+                  iipt1 = MAX( 0, MIN( ii, jpi-1 ) )
+                  ijpt0 = MAX( 1, MIN( ij, jpj   ) )
+                  ijpt1 = MAX( 0, MIN( ij, jpj-1 ) )
+                  DO jj = ijpt0, ijpt1
+                     DO ji = iipt0, iipt1
+                        runoff(ji,jj) = runoff(ji,jj)   & 
+                                      + ( (1.-zxy) * zrnfm(nrnf1,jr)   &
+                                      +       zxy  * zrnfm(nrnf2,jr)  ) / FLOAT(inbp)
+                     END DO
+                  END DO
+               END DO
+            ENDIF
+         END DO
+
+
+         ! 2. conversion in mm/day
+         ! -----------------------
+         !     C a u t i o n : upward water flux, runoff is negative
+
+         runoff(:,:) = -zconv * runoff(:,:) / ( e1t(:,:) * e2t(:,:) )
+         
+
+         ! 3. advectve coefficient
+         ! -----------------------
+
+         !  Creates the array coef that contains the coefficient to affect to
+         !  the upstream scheme. advection scheme will be:
+         !  coefr * upstream + (1- coefr) centered
+         !  coefr must be between 0 and 1.
+         !  3 values are used: maximum = zrup1, between zrup2, small zrup3.
+         ! 
+         IF( nrunoff == 2 .AND. kt == nit000 ) THEN
+
+            zrup1 = 0.5
+            zrup2 = 0.25
+            zrup3 = 0.125
+            DO jr = 1, jpriv-1
+               inbp = inb(jr)
+               IF( inbp /= 0) THEN
+                  DO jl = 1, inbp
+                     ! --> zrup1 (originally, = 1 = all upstream).
+                     ! ji,jj
+                     ii = iirnf(jl,jr) - nimpp + 1 - jpizoom - 1
+                     ij = ijrnf(jl,jr) - njmpp + 1 - jpjzoom - 1
+                     iipt0 = MAX( 1, MIN( ii,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii,jpi-1) )
+                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = zrup1
+                           END DO
+                           zcoefr(ji,jj,4) = zrup2
+                           zcoefr(ji,jj,5) = zrup3
+                        END DO
+                     END DO
+                     ! --> zrup2 (originally = 0.5)
+                     ! ji,jj+1
+                     ijpt0 = MAX( 1, MIN( ij+1, jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+1, jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji,jj-1
+                     ijpt0 = MAX( 1, MIN( ij-1, jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-1, jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji+1,jj-1
+                     iipt0 = MAX( 1, MIN( ii+1, jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii+1, jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji+1,jj
+                     ijpt0 = MAX( 1, MIN( ij, jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij, jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji+1,jj+1
+                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji-1,jj+1
+                     iipt0 = MAX( 1, MIN( ii-1,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii-1,jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji-1,jj
+                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji-1,jj-1
+                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! --> zrup3 (originally = 0.25)
+                     ! ji-1,jj+2
+                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-1,jj-2
+                     ijpt0 = MAX( 1, MIN( ij-2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji,jj-2
+                     iipt0 = MAX( 1, MIN( ii,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii,jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji,jj+2
+                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+1,jj-2
+                     iipt0 = MAX( 1, MIN( ii+1,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii+1,jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+1,jj+2
+                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj-2
+                     iipt0 = MAX( 1, MIN( ii+2,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii+2,jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj+2
+                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3  
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj-1
+                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj+1
+                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj
+                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj
+                     iipt0 = MAX( 1, MIN( ii-2,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii-2,jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3        
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj-2
+                     ijpt0 = MAX( 1, MIN( ij-2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj+2
+                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj-1
+                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj+1
+                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                  END DO
+               ENDIF
+            END DO
+            upsrnfh(:,:) = zcoefr(:,:,1)
+            upsrnfz(:)   = 0.e0
+            upsrnfz(1)   = 1.0
+            upsrnfz(2)   = 1.0
+            upsrnfz(3)   = zrup1
+            upsrnfz(4)   = zrup2
+            upsrnfz(5)   = zrup3
+
+            ! Reduces the sea surface restoring term to Levitus98
+            ! in the Sound Strait
+            DO jj = mj0(116), mj1(116)
+               DO ji = mi0(144), mi1(144)
+                  upsrnfh(ji,jj) = 0.25
+               END DO
+               DO ji = mi0(145), mi1(147)
+                  upsrnfh(ji,jj) = 0.5
+               END DO
+               DO ji = mi0(148), mi1(148)
+                  upsrnfh(ji,jj) = 0.25
+               END DO
+            END DO
+         ENDIF
+      ENDIF
+      
+      ! Upstream and centered scheme in the vicinity of some straits
+
+      IF( kt == nit000 ) THEN
+
+         ! ORCA_R2 configuration :
+         ! Gibraltar Strait
+         DO jj = mj0(102), mj1(102)
+            DO ji = mi0(138), mi1(138)
+               upsadv(ji,jj) = 0.2
+            END DO
+         END DO
+         DO jj = mj0(102), mj1(102)
+            DO ji = mi0(139), mi1(139)
+               upsadv(ji,jj) = 0.4
+            END DO
+         END DO
+         DO jj = mj0(102), mj1(102)
+            DO ji = mi0(140), mi1(140)
+               upsadv(ji,jj) = 0.5
+            END DO
+         END DO
+         DO jj = mj0(101), mj1(102)
+            DO ji = mi0(141), mi1(141)
+               upsadv(ji,jj) = 0.5
+            END DO
+         END DO
+         ! Bab el Mandeb Strait
+         DO jj = mj0(87), mj1(88)
+            DO ji = mi0(164), mi1(164)
+               upsadv(ji,jj) = 0.1
+            END DO
+         END DO
+         DO jj = mj0(88), mj1(88)
+            DO ji = mi0(163), mi1(163)
+               upsadv(ji,jj) = 0.25
+            END DO
+         END DO
+         DO jj = mj0(88), mj1(88)
+            DO ji = mi0(162), mi1(162)
+               upsadv(ji,jj) = 0.4
+            END DO
+         END DO
+         DO jj = mj0(88), mj1(88)
+            DO ji = mi0(160), mi1(161)
+               upsadv(ji,jj) = 0.5
+            END DO
+         END DO
+         DO jj = mj0(89), mj1(89)
+            DO ji = mi0(158), mi1(160)
+               upsadv(ji,jj) = 0.25
+            END DO
+         END DO
+         DO jj = mj0(90), mj1(90)
+            DO ji = mi0(160), mi1(160)
+               upsadv(ji,jj) = 0.25
+            END DO
+         END DO
+         ! Sound Strait
+         DO jj = mj0(116), mj1(116)
+            DO ji = mi0(145), mi1(147)
+               upsadv(ji,jj) = 0.5
+            END DO
+         END DO
+
+      ENDIF
Index: trunk/NEMO/OPA_SRC/SBC/sbcrnf_ORCA_R4.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcrnf_ORCA_R4.h90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcrnf_ORCA_R4.h90	(revision 888)
@@ -0,0 +1,1339 @@
+   !!----------------------------------------------------------------------
+   !!                    ***  flxrnf_ORCA_R4.h90  ***
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!                  OLD ORCA R4 runoff specification
+   !!                      kept here for memory
+   !!                         ( 20/04/2000 )
+   !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !!  OPA 9.0 , LOCEAN-IPSL (2005) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+      !!----------------------------------------------------------------------
+      !! * Local declarations
+      INTEGER  :: kt
+      INTEGER  :: jpmois
+      INTEGER  ::   &
+         jpriv,    & ! jpriv : maximum river number
+         jpcoef      ! jpcoef: maximum point number
+      INTEGER, PARAMETER ::   jpmois=12, jpriv=120, jpcoef=150
+
+      INTEGER  ::   ji, jj, jl, jm, jn, jr, jc
+      INTEGER  ::   i15, imois, iman
+      INTEGER  ::   inbp, idbd, idmeom
+      INTEGER  ::   iipt0, iipt1, ijpt0, ijpt1, ii, ij
+      INTEGER  ::   iirnf(jpcoef,jpriv),ijrnf(jpcoef,jpriv)
+      INTEGER  ::   inb(jpriv)
+
+      REAL(wp) ::   zconv, zxy
+      REAL(wp) ::   zrup1,zrup2,zrup3
+      REAL(wp) ::   zrnfm(jpmois, jpriv)
+      REAL(wp) ::   zcoefr(jpi, jpj, 5)
+      CHARACTER (len=20) ::   criver(jpriv)
+
+      REAL(wp) ::   zbilan , zero
+
+      COMMON/zzzrnf/ zrnfm, iirnf, ijrnf, inb
+
+      ! ====
+      ! DATA
+      ! ====
+
+      zero = 0.0e0
+      IF( kt == nit000 ) THEN 
+          criver = "                    "
+          inb = 0
+          iirnf = 0
+          ijrnf = 0
+          zrnfm  = zero
+          runoff = zero
+         
+          ! I NORTH AMERICA
+          ! ---------------
+          
+          ! 1-Saint Lawrence (Canada) 49N30 67W00           R2
+          ! Old=447 km3/year=14165m3/s; CLIPPER=12430m3/s; ratio=1.14
+          ! --> 13975.249m3/s
+          criver(1) = "Saint Lawrence      "
+          inb(1) = 1
+          iirnf(1:1,1) = 57
+          ijrnf(1:1,1) = 55
+          zrnfm(1:jpmois,1) = (/   &
+              11718.,  11971.,  12466.,  14980.,  19257.,  16913.,   &
+              14211.,  13119.,  13367.,  13644.,  13463.,  12594./)
+          ! 2-Hudson River (USA) 41N00 77W00                R1
+          ! Old=12 km3/year=380m3/s; UNESCO(64-83,p255)=408m3/s
+          ! --> 407.416687m3/s
+          criver(2) = "Hudson River        "
+          inb(2) = 1
+          iirnf(1:1,2) = 54
+          ijrnf(1:1,2) = 53
+          zrnfm(1:jpmois,2) = (/   &
+              364.,    404.,    648.,    873.,    593.,    301.,   &
+              205.,    171.,    205.,    290.,    379.,    456./)
+          ! 3-Missisipi and Atchafalaya (USA) 29N 90W       R1 
+          ! Old=580 km3/year=18380m3/s; CLIPPER=17599m3/s
+          ! --> 17599.334m3/s
+          criver(3) = "Missisipi           "
+          inb(3) = 1
+          iirnf(1:1,3) = 50
+          ijrnf(1:1,3) = 49
+          zrnfm(1:jpmois,3) = (/   &
+              19260.,  20813.,  23026.,  28160.,  26510.,  19650.,   &
+              14181.,  10676.,   9578.,  10167.,  11699.,  17472./)
+          ! 4-Brazos (USA) 29N58 95W53                      R1
+          ! Old=7 km3/year=222m3/s; UNESCO(65-84, p298)=200m3/s
+          ! --> 199.666656m3/s
+          criver(4) = "Brazos              "
+          inb(4) = 1
+          iirnf(1:1,4) = 48
+          ijrnf(1:1,4) = 49
+          zrnfm(1:jpmois,4) = (/   &
+              165.,    224.,    200.,    266.,    457.,    327.,   &
+              143.,     69.,    102.,    132.,    160.,    151. /)
+          ! 5-Colorado (Mexico) 31N54 114W57                R5
+          ! Old=20 km3/year=634m3/s
+          ! --> 634.m3/s
+          criver(5) = "Colorado            "
+          inb(5) = 1
+          iirnf(1:1,5) = 43
+          ijrnf(1:1,5) = 50
+          zrnfm(1:jpmois,5) = 634. 
+          ! 6-Columbia (USA) 45N60 121W17                   R1
+          ! Old=251 km3/year=7954m3/s; UNESCO(65-84, p312)=5368m3/s
+          ! --> 5368.41602m3/s
+          criver(6) = "Columbia            "
+          inb(6) = 1
+          iirnf(1:1,6) = 40
+          ijrnf(1:1,6) = 56
+          zrnfm(1:jpmois,6) = (/   &
+              4752.,    5077.,    5633.,    6075.,    8422.,    9822.,   &
+              6350.,    4112.,    3273.,    3251.,    3548.,    4106. /)
+          ! 7-Fraser (USA) 47N 124W                         R5
+          ! Old=112 km3/year=3550m3/s;not found in UNESCO
+          ! --> 3549.99976m3/s
+          criver(7) = "Fraser              "
+          inb(7) = 1
+          iirnf(1:1,7) = 40
+          ijrnf(1:1,7) = 57
+          zrnfm(1:jpmois,7) = 3550. 
+          ! 8-Yukon (USA) 63N00 165W00                      R3
+          ! Old=195 km3/year=6179m3/s; UNESCO(65-77+80-84, p321)=4245; ratio=1.46
+          ! --> 6017.24951m3/s
+          criver(8) = "Yukon               "
+          inb(8) = 1
+          iirnf(1:1,8) = 30
+          ijrnf(1:1,8) = 62
+          zrnfm(1:jpmois,8) = (/   &
+              1459.,    1213.,    1065.,    1100.,    9067.,   17675.,   &
+              10680.,   11271.,    8658.,    5453.,    2649.,    1917./)
+          ! 9-Copper (USA) 61N47 144W45                     R2
+          ! Old=39 km3/year=1236m3/s; UNESCO(65-84, p317)=1052m3/s; ratio=1.18
+          ! --> 1236.25m3/s
+          criver(9) = "Copper              "
+          inb(9) = 1
+          iirnf(1:1,9) = 35
+          ijrnf(1:1,9) = 60
+          zrnfm(1:jpmois,9) = (/   &
+              219.,    195.,    181.,    214.,    904.,   2532.,   &
+              4026.,   3627.,   1632.,    697.,    354.,    254. /) 
+          ! 10-Susitna (USA)   62N 150E                     R5
+          ! Old=40 km3/year=1268m3/s
+          ! --> 1268.m3/s
+          criver(10) = "Susitna             "
+          inb(10) = 1
+          iirnf(1:1,10) = 34
+          ijrnf(1:1,10) = 60
+          zrnfm(1:jpmois,10) = 1268. 
+          ! 11-McKenzie (Canada) 70N00 135W00               R3
+          ! Old=306 km3/year=9697m3/s; UNESCO(67+72+7479+82-84, p168)=8343m3/s;
+          ! ratio=1.16
+          ! --> 9606.66797m3/s
+          criver(11) = "McKenzie            "
+          inb(11) = 1
+          iirnf(1:1,11) = 35
+          ijrnf(1:1,11) = 66
+          zrnfm(1:jpmois,11) = (/   &
+              3644.,    3400.,    3258.,    3546.,   14188.,   21544.,   &
+              18954.,   15487.,   11284.,   10169.,    5901.,    3905./)
+          ! 12-Kuksokwim (USA) 60N00 ~162W30                R4
+          ! UNESCO(65-84, p318)=1112m3/s (61N87 158E10, Crooked Creek, inland)
+          ! --> 1111.99988m3/s
+          criver(12) = "Kuksokwim           "
+          inb(12) = 1
+          iirnf(1:1,12) = 30
+          ijrnf(1:1,12) = 60
+          zrnfm(1:jpmois,12) = (/   &
+              335.,     308.,     295.,     407.,    2415.,    2027.,   &
+              1917.,   2049.,    1585.,    1072.,     545.,     389./)
+          ! 13-Nelson
+          criver(13) = "Nelson              "
+          inb(13) = 1
+          iirnf(1:1,13) = 51
+          ijrnf(1:1,13) = 65
+          zrnfm(1:jpmois,13) = 0.
+
+          ! Total run-offs(I)=60974.2539m3/s
+
+          ! II SOUTH AMERICA
+          ! -----------------
+          ! 16-Chira (Peru) 4s54 81w08                      R2
+          ! Old=5 km3/year=158m3/s; UNESCO (65-68, p357)=80.9; ratio=1.95
+          ! --> 158.000015m3/s
+          criver(16) = "Chira               "
+          inb(16) = 1
+          iirnf(1:1,16) = 51
+          ijrnf(1:1,16) = 34
+          zrnfm(1:jpmois,16) = (/   &
+              70.,     105.,     564.,     582.,     230.,      94.,   &
+              87.,      47.,      35.,      32.,      29.,      21./)
+          ! 17-Magdalena (Colombia) 11N06 74W51             R2
+          ! Old=237 km3/year=7510m3/s; UNESCO(71-73+76-79, p348)=6973m3/s;
+          ! ratio=1.08
+          ! --> 7451.58301m3/s
+          criver(17) = "Magdelena           "
+          inb(17) = 1
+          iirnf(1:1,17) = 53
+          ijrnf(1:1,17) = 45
+          zrnfm(1:jpmois,17) = (/   &
+              6598.,    4441.,    4087.,    5445.,    7380.,    8067.,   &
+              8509.,    7428.,    7631.,    9296.,   10588.,    9949./)
+          ! 18-Orinoco (Venezuela) 8N37 62W15!              R1
+          ! Old=1100 km3/year=34857m3/s; UNESCO(73-75, p364)=28736m3/s;
+          ! HLA=26371m3/s
+          ! Data from HLA: 8.1N - 63.3W   1925/89
+          ! --> 26371.416
+          criver(18) = "Orinico             "
+          inb(18) = 1
+          iirnf(1:1,18) = 57
+          ijrnf(1:1,18) = 44
+          zrnfm(1:jpmois,18) = (/   &
+              10670.,    7513.,    6344.,    6887.,   13086.,   26699.,   &
+              43938.,   59957.,   57435.,   39951.,   27410.,   16567./)
+          ! 19-Amazon (Brazil) 0S05 50W00                   R1
+          ! Old=6300 km3/year=199634m3/s; CLIPPER=166192m3/s~UNESCO;
+          ! HLA=184806m3/s
+          ! UNESCO data are at Obidos which is far inland and therefore does not
+          ! fully represent the actual discharge
+          ! Data from HLA: 1.5N - 55.3W   1970/96
+          ! --> 184845.484m3/s
+          criver(19) = "Amazon              "
+          inb(19) = 3
+          iirnf(1:3,19) = (/ 60, 60, 60 /)
+          ijrnf(1:3,19) = (/ 39, 40, 41 /)
+          zrnfm(1:jpmois,19) = (/   &
+              152233., 176415., 199941., 225565., 244016., 244861.,   &
+              230711., 203128., 164531., 128486., 118214., 130045. /)
+          ! 20-Sao Francisco (Brazil) 10S30 36W24           R1
+          ! Old=97 km3/year=3074m3/s; UNESCO(77-79, p338)=2645m3/s
+          ! --> 2645.3335m3/s
+          criver(20) = "San Fransisco       "
+          inb(20) = 1
+          iirnf(1:1,20) = 63
+          ijrnf(1:1,20) = 31
+          zrnfm(1:jpmois,20) = (/   &
+              3244.,   4116.,   5139.,   4330.,   2323.,   1800.,     &
+              1587.,   1511.,   1593.,   1740.,   2190.,   2171. /)
+          ! 21-Parana+Uruguay(Arg./Uru.) 34S12 58W18        R1 
+          ! Old=470 km3/year=14893m3/s; UNESCO(p323/324)=22263m3/s
+          ! --> 22203.168m3/s 
+          criver(21) = "Parana              "
+          inb(21) = 1
+          iirnf(1:1,21) = 58
+          ijrnf(1:1,21) = 24
+          zrnfm(1:jpmois,21) = (/   &
+              24803.,   26836.,   24585.,   21358.,   20041.,   21689.,   &
+              22647.,   20403.,   19627.,   21400.,   21126.,   21923./)
+          ! 22-Negro (Argentina)  41S02  62W47              R2
+          ! Old=30 km3/year=951m3/s; UNESCO(65-79,p330)=765m3/s; ratio=1.24
+          ! --> 907.666687m3/s
+          criver(22) = "Rio Negro           "
+          inb(22) = 1
+          iirnf(1:1,22) = 56
+          ijrnf(1:1,22) = 22
+          zrnfm(1:jpmois,22) = (/   &
+              882.,     587.,     519.,     482.,     623.,     984.,   &
+              1120.,   1294.,    1092.,    1166.,    1105.,    1038./)
+          ! 23- Tocantins :  ~48W00 ~0.5S                   R4
+          ! UNESCO(76-77+80-81, p335)=12167m3/s (station far inland!)
+          ! --> 12173.082m3/s
+          criver(23) = "Tocantins           "
+          inb(23) = 1
+          iirnf(1:1,23) = 60
+          ijrnf(1:1,23) = 38
+          zrnfm(1:jpmois,23) = (/   &
+              15507.,  24855.,  27854.,  24257.,  15860.,   7861.,   &
+              4440.,   3082.,   2728.,   3417.,   5511.,  10705. /)
+
+          ! Total run-offs(II)=256755.75
+          ! Total run-offs(I+II)=317730
+
+          ! III EUROPE
+          ! ----------
+          ! 26-Rhone (France) 43N20 4E50                    R1 
+          ! Old=49 km3/year=1553m3/s; UNESCO(65-83, p512)=1229
+          ! --> 1217.16663m3/s
+          criver(26) = "Rhone               "
+          inb(26) = 1
+          iirnf(1:1,26) = 76
+          ijrnf(1:1,26) = 55
+          zrnfm(1:jpmois,26) = (/   &
+              1385.,    1848.,    1568.,    1311.,    1420.,    1191.,   &
+              937.,     796.,     794.,     962.,    1161.,    1233./)
+          ! 27-Po (Italy) 41N10 11E09                       R1 
+          ! Old=46 km3/year=1458m3/s; UNESCO(65-84, p527)=1550m3/s
+          ! --> 1550.08337m3/s
+          criver(27) = "Po                  "
+          inb(27) = 1
+          iirnf(1:1,27) = 79
+          ijrnf(1:1,27) = 54
+          zrnfm(1:jpmois,27) = (/   &
+              1304.,    1605.,    1856.,    1549.,    1958.,    1760.,   &
+              1040.,    1007.,    1615.,    1907.,    1772.,    1228./)
+          ! 28-Danube (Roumania) 45N20 29E40                R1 
+          ! Old=206 km3/year=6527m3/s; UNESCO(65-84, p544)=7011m3/s
+          ! --> 7011.8335m3/s
+          criver(28) = "Danube              "
+          inb(28) = 1
+          iirnf(1:1,28) = 87
+          ijrnf(1:1,28) = 53
+          zrnfm(1:jpmois,28) = (/   &
+              6625.,    7352.,    7986.,    9279.,    9482.,    8618.,   &
+              7586.,    6001.,    5210.,    4989.,    4921.,    6093./)
+
+          ! 29-Volga
+          criver(29) = "Volga               "
+          inb(29) = 1
+          iirnf(1:1,29) = 4
+          ijrnf(1:1,29) = 56
+          zrnfm(1:jpmois,29) = 0.
+          ! 30-Dniepr
+          criver(30) = "Dniepr+Don          "
+          inb(30)= 2
+          iirnf(1:2,30) = (/ 89, 90 /)
+          ijrnf(1:2,30) = (/ 56, 56 /)
+
+          ! Total run-offs(III)=9779.08301m3/s
+          ! Total run-offs(I+II+III)=327509.094m3/s
+
+          ! IV EURASIAN ARCTIC
+          ! ------------------
+          ! 31-Iana (Russia)      126E40 72N25              R1
+          ! Old=29 km3/year=919m3/s; UNESCO(65-72+74+76-84, p463)=936m3/s
+          ! --> 0m3/s
+          criver(31) = "Iana                "
+          inb(31) = 1
+          iirnf(1:1,31) = 20
+          ijrnf(1:1,31) = 68
+          zrnfm(1:jpmois,31) = (/   &
+              2.,       1.,       0.,       0.,     917.,    3514.,   &
+              2968.,    2329.,    1322.,   178.,      36.,       8./)
+          ! 32-Ob (Russia) 66N45 69E30                      R1 
+          ! Old=385 km3/year=12200m3/s; UNESCO(65-84, p478)=12862m3/s
+          ! --> 12861.5m3/s
+          criver(32) = "Ob                  "
+          inb(32) = 1
+          iirnf(1:1,32) = 78
+          ijrnf(1:1,32) = 72
+          zrnfm(1:jpmois,32) = (/   &
+              4977.,    4150.,    3611.,    3590.,   14723.,   33366.,   &
+              30773.,   22785.,   14701.,    9705.,    6078.,    5879./)
+          ! 33-Yenesei (Russia) 71N50 82E40                 R1 
+          ! Old=560 km3/year=17745m3/s; UNESCO(65-84, p472)=17462m3/s
+          ! --> 17461.666m3/s
+          criver(33) = "Yenesei             "
+          inb(33) = 1
+          iirnf(1:1,33) = 77
+          ijrnf(1:1,33) = 75
+          zrnfm(1:jpmois,33) = (/   &
+              6659.,    7007.,    6895.,    7089.,   24183.,   74965.,   &
+              25325.,   15940.,   16050.,   12678.,    6741.,    6008./)
+          ! 34-Severnaya Dvina(Russia)64N32 40E30           R5 
+          ! Old=106 km3/year=3359m3/s; not in UNESCO data base
+          ! --> 3359.00024m3/s
+          criver(34) = "Severnaya Dvina     "
+          inb(34) = 1
+          iirnf(1:1,34) = 78
+          ijrnf(1:1,34) = 68
+          zrnfm(1:jpmois,34) = 3359.
+          ! 35-Lena (Russia) 72N25 126E40                   R1 
+          ! --> 16192.333m3/s
+          criver(35) = "Lena                "
+          inb(35) = 1
+          iirnf(1:1,35) = 20
+          ijrnf(1:1,35) = 68
+          zrnfm(1:jpmois,35) = (/   &
+              2663.,    2095.,    1629.,    1324.,    7203.,   64230.,   &
+              40810.,   28310.,   25995.,   13299.,    3673.,    3077./)
+          ! 36-Kolyma (Russia) 69N30 161E00                 R1
+          ! Old=71 km3/year=2250m3/s; UNESCO(65-84)=2138m3/s
+          ! --> 2138.66675m3/s
+          criver(36) = "Kolyma              "
+          inb(36) = 1
+          iirnf(1:1,36) = 24
+          ijrnf(1:1,36) = 65
+          zrnfm(1:jpmois,36) = (/   &
+              131.,      92.,      76.,      65.,    2576.,    9143.,   &
+              4670.,    3727.,    3226.,    1119.,     630.,     209./)
+          ! 37-Indigirka (russia) 70N48 148E54              R1 
+          ! Old=55 km3/year=1743m3/s; UNESCO(65-68+70+72-84)=1622.
+          ! --> 1622.00012m3/s
+          criver(37) = "Indigirka           "
+          inb(37) = 1
+          iirnf(1:1,37) = 23
+          ijrnf(1:1,37) = 66
+          zrnfm(1:jpmois,37) = (/   &
+              32.,      17.,      11.,       7.,     354.,    5629.,   &
+              5210.,    4617.,    2823.,     559.,     142.,      63./)
+          ! 38-Khatanga
+          criver(38) = "Khatanga             "
+          inb(38) = 1
+          iirnf(1:1,38) = 20
+          ijrnf(1:1,38) = 72
+          zrnfm(1:jpmois,38) = 0.
+
+          ! Total run-offs(IV)=40773.6641m3/s
+          ! Total run-offs(I+II+III+IV)=368282.75m3/s
+
+          ! V ASIA
+          ! ------
+          ! 41-Amur (Russia) 52N56 141E10                   R2
+          ! Old=325 km3/year=10299m3/s; UNESCO(65-84, p451)=8792m3/s; ratio=1.17
+          ! --> 10299.332m3/s
+          criver(41) = "Amur                "
+          inb(41) = 1
+          iirnf(1:1,41) = 18
+          ijrnf(1:1,41) = 59
+          zrnfm(1:jpmois,41) = (/   &
+              2108.,    1543.,    1252.,    4088.,   15464.,   17336.,   &
+              16100.,   20801.,   21548.,   15658.,    5188.,    2506./)
+          ! 42-Liaohe (China) 40N40 122E09                  R5
+          ! Old=6 km3/year=190m3/s; not found in UNESCO data base
+          ! --> 189.999985m3/s
+          criver(42) = "Liaohe              "
+          inb(42) = 1
+          iirnf(1:1,42) = 15
+          ijrnf(1:1,42) = 54
+          zrnfm(1:jpmois,42) = 190.
+          ! 43-Daling (China) 40N56 121E43                  R5
+          ! Old=1 km3/year=32m3/s; not found in UNESCO data base
+          ! --> 31.9999962m3/s
+          criver(43) = "Daling              "
+          inb(43) = 1
+          iirnf(1:1,43) = 15
+          ijrnf(1:1,43) = 54
+          zrnfm(1:jpmois,43) = 32.
+          ! 44-Haiho (China) 6N17   1E23
+          ! Old=2 km3/year=64m3/s; not found in UNESCO data base
+          ! --> 63.9999924m3/s
+          criver(44) = "Haiho               "
+          inb(44) = 0
+          iirnf(1:1,44) = 0
+          ijrnf(1:1,44) = 0
+          zrnfm(1:jpmois,44) = 64.
+          ! 45-Yellow/Huangho (China) 37N32 118E19          R2 
+          ! Old=49 km3/year=1553m3/s; UNESCO(p371)=1210m3/s; ratio=1.28
+          ! --> 1552.5m3/s
+          criver(45) = "Yellow/Huangho      "
+          inb(45) = 1
+          iirnf(1:1,45) = 13
+          ijrnf(1:1,45) = 51
+          zrnfm(1:jpmois,45) = (/   &
+              697.,     674.,    1282.,    1206.,    1109.,     778.,   &
+              1964.,    3270.,    3668.,    2133.,     978.,     871./)
+          ! 46-Yangtze (China) 31N48 121E10=Changjiang      R2
+          ! Old=900 km3/year=28520m3/s; UNESCO(p372)=25032m3/s; ratio=1.14
+          ! --> 28519.584m3/s
+          criver(46) = "Yangtze             "
+          inb(46) = 1
+          iirnf(1:1,46) = 13
+          ijrnf(1:1,46) = 50
+          zrnfm(1:jpmois,46) = (/   &
+              10994.,   10548.,   13254.,   24097.,   36972.,   47197.,   &
+              53891.,   42070.,   37627.,   30762.,   22046.,   12777./)
+          ! 47-Pearl/Zhujiang (China) 23N36 106E34=Xijiang  R2 
+          ! Old=302 km3/year=9570m3/s; UNESCO(76,82, p373)=6987m3/s; ratio=1.37
+          ! --> 9570.75m3/s
+          criver(47) = "Pearl Zhujiang       "
+          inb(47) = 1
+          iirnf(1:1,47) = 12
+          ijrnf(1:1,47) = 48
+          zrnfm(1:jpmois,47) = (/   &
+              2357.,    2415.,    2634.,    6446.,   14246.,   18395.,   &
+              19213.,   17558.,   12312.,    7255.,    5864.,    6154./)
+          ! 48-Red/Hungho (Vietnam) 20N17 106E34            R5 
+          ! Old=123 km3/year=3897m3/s; not in UNESCO data base
+          ! --> 3897.m3/s
+          criver(48) = "Red Hungho          "
+          inb(48) = 1
+          iirnf(1:1,48) = 10
+          ijrnf(1:1,48) = 47
+          zrnfm(1:jpmois,48) = 3897.
+          ! 49-Mekong (Vietnam) 10N33 105E24                R5
+          ! Old=470 km3/year=14893m3/s; not in UNESCO data base
+          ! --> 14893.0029m3/s
+          criver(49) = "Mekong              "
+          inb(49) = 1
+          iirnf(1:1,49) =  8
+          ijrnf(1:1,49) = 44
+          zrnfm(1:jpmois,49) = 14893.
+          ! 50-Irrawady (Burma) 15N50  95E06                R5
+          ! Old=428 km3/year=13563m3/s; not in UNESCO data base
+          ! --> 13563.m3/s
+          criver(50) = "Irrawady            "
+          inb(50) = 1
+          iirnf(1:1,50) =  6
+          ijrnf(1:1,50) = 46
+          zrnfm(1:jpmois,50) = 13563.
+          ! 51-Ganges+Brahmaputra (Beng.) 22N00  91E00      R1
+          ! Old=971 km3/year=30769m3/s; UNESCO(69-70+73-75, p367)=31760m3/s
+          ! --> 32147.498m3/s
+          criver(51) = "Ganges              "
+          inb(51) = 2
+          iirnf(1:2,51) = (/  4,  5 /)
+          ijrnf(1:2,51) = (/ 47, 47 /)
+          zrnfm(1:jpmois,51) = (/   &
+              6623.,    6315.,    6432.,    9410.,   17263.,   38302.,   &
+              64688.,   80338.,   84802.,   43387.,   17888.,   10322./)
+          ! 52-Mehandi (India)                              R5
+          ! Old=67 km3/year=2123m3/s; not in UNESCO data base
+          ! --> 0m3/s
+          criver(52) = "Mehandi             "
+          inb(52) = 0
+          iirnf(1:1,52) = 0
+          ijrnf(1:1,52) = 0
+          zrnfm(1:jpmois,52) = 2123.
+          ! 53-Damodar (India)                              R2
+          ! Old=10 km3/year=320m3/s; UNESCO(p386)=173m3/s; ratio=1.85
+          ! --> 432.916656m3/s
+          criver(53) = "Damodar             "
+          inb(53) = 0
+          iirnf(1:1,53) = 0
+          ijrnf(1:1,53) = 0
+          zrnfm(1:jpmois,53) = (/   &
+              51.,      37.,      42.,      49.,      85.,     296.,   &
+              896.,    1390.,    1591.,     542.,     172.,      44./)  
+          ! 54-Godavari (India) 17N00  81E45                R2
+          ! Old=84 km3/year=2662m3/s; UNESCO(p379)=1916m3/s; ratio=1.39
+          ! --> 3670.5m3/s
+          criver(54) = "Godaravi            "
+          inb(54) = 1
+          iirnf(1:1,54) =  3
+          ijrnf(1:1,54) = 46
+          zrnfm(1:jpmois,54) = (/   &
+              988.,     737.,     280.,     219.,     196.,    1691.,   &
+              8063.,   14571.,   11428.,    3953.,    1221.,     699./)
+          ! 55-Indus (Pakistan) 24N20  67E47                R2
+          ! Old=238 km3/year=7542m3/s; UNESCO (76-79, p428)=2396m3/s; ratio=3.15
+          ! --> 7562.m3/s
+          criver(55) = "Indus               "
+          inb(55) = 1
+          iirnf(1:1,55) = 89
+          ijrnf(1:1,55) = 47
+          zrnfm(1:jpmois,55) = (/   &
+              988.,     737.,    1904.,    1968.,    3625.,    6143.,   &
+              15969.,    36656.,  17173.,    3215.,    1251.,    1115./)
+          ! 56-Tigris and Euphrates (Iraq) 31N00  47E25     R1
+          ! Old=46 km3/year=1458m3/s; UNESCO(76-79, p428)=2396m3/s
+          ! --> 2248.8335m3/s
+          criver(56) = "Tigris              "
+          inb(56) = 1
+          iirnf(1:1,56) = 88
+          ijrnf(1:1,56) = 47
+          zrnfm(1:jpmois,56) = (/   &
+              1872.,    2127.,    2962.,    4944.,    5036.,    3078.,   &
+              1362.,     900.,     786.,     993.,    1184.,    1742./)
+
+          ! Total run-offs (V)=128642.922m3/s
+          ! Total run-offs (I+II+III+IV+V)=496925.688m3/s
+
+          ! VI AFRICA
+          ! ----------
+          ! 61-Nile (Egypt) 30N10  31E06                    R1
+          ! Old=30 km3/year=951m3/s; UNESCO(73-84)=1251m3/s
+          ! --> 1251.33337m3/s
+          criver(61) = "Nile                "
+          inb(61) = 1
+          iirnf(1:1,61) = 90
+          ijrnf(1:1,61) = 50
+          zrnfm(1:jpmois,61) = (/   &
+              1239.,    1035.,    1126.,    1110.,    1170.,    1542.,   &
+              1742.,    1559.,    1191.,    1103.,    1075.,    1124./)
+          ! 62-Niger (Nigeria) 5N33   6E33                  R1
+          ! Old=192 km3/year=6084m3/s; HLA=5545m3/s;
+          ! Data from HLA: 4.5N -  6  E   1950/87
+          ! --> 5545.08301m3/s
+          criver(62) = "Niger               "
+          inb(62) = 1
+          iirnf(1:1,62) = 74
+          ijrnf(1:1,62) = 41
+          zrnfm(1:jpmois,62) = (/   &
+              2029.,    1804.,    1573.,    1418.,    1494.,    2561.,   &
+              5272.,    9629.,   14951.,   16227.,    6842.,    2741./)
+          ! 63-Zaire/Congo (Congo) 6S04  12E24              R1      
+          ! Old=1250 km3/year=39610m3/s; UNESCO(65-83, p149)=41941m3/s; HLA
+          ! =39720m3/s
+          ! Data from HLA: 6S - 12  E   1902/96
+          ! --> 39719.5m3/s
+          criver(63) = "Zaire Congo         "
+          inb(63) = 1
+          iirnf(1:1,63) = 75
+          ijrnf(1:1,63) = 33
+          zrnfm(1:jpmois,63) = (/   &
+              47200.,   37692.,   34374.,   36603.,   37862.,   35588.,   &
+              30966.,   30774.,   35981.,   42825.,   51455.,   55314./)
+          ! 64-Orange (Sth Africa) 28S41 16E28              R5
+          ! Old=11 km3/year=349m3/s
+          ! --> 349.000031m3/s
+          criver(64) = "Orange              "
+          inb(64) = 1
+          iirnf(1:1,64) = 76
+          ijrnf(1:1,64) = 26
+          zrnfm(1:jpmois,64) = 349.
+          ! 65-Zambesi (Mozambique) 18S55 36E04             R5
+          ! Old=223 km3/year=7066m3/s
+          ! --> 7066.00049m3/s
+          criver(65) = "Zambesi             "
+          inb(65) = 1
+          iirnf(1:1,65) = 81
+          ijrnf(1:1,65) = 29
+          zrnfm(1:jpmois,65) = 7066.
+          ! 66-Limpopo (mozambique) 25S15 33E30             R5
+          ! Old=5 km3/year=158m3/s
+          ! --> 158.m3/s
+          criver(66) = "Limpopo             "
+          inb(66) = 1
+          iirnf(1:1,66) = 81
+          ijrnf(1:1,66) = 28
+          zrnfm(1:jpmois,66) = 158.
+          ! 67-Rufiji (tanzania) 8S00 39E20                 R5
+          ! Old=9 km3/year=285m3/s
+          ! --> 285.m3/s
+          criver(67) = "Rufiji             "
+          inb(67) = 1
+          iirnf(1:1,67) = 82
+          ijrnf(1:1,67) = 33
+          zrnfm(1:jpmois,67) = 285.
+          ! Other rivers from the Gulf of Guinea
+          ! 68-Kouilou (Congo)  4.5S-11.5E (UNESCO=p51)     R1
+          ! Data from HLA:  4S - 11  E   1953/86 = 919m3/s
+          ! --> 924.25m3/s
+          criver(68) = "Kouilou            "
+          inb(68) = 1
+          iirnf(1:1,68) = 75
+          ijrnf(1:1,68) = 33
+          zrnfm(1:jpmois,68) = (/   &
+              1115.,    1166.,    1285.,    1462.,    1454.,     725.,   &
+              480.,     378.,     327.,     400.,    1018.,    1281./)
+          ! 69-Nyanga (Gabon)  3S-10E (UNESCO=p66)          R1
+          ! Data from HLA: 2.8N - 10  E   1952/82 = 264m3/s
+          ! --> 264.166687m3/s
+          criver(69) = "Nyanga              "
+          inb(69) = 1
+          iirnf(1:1,69) = 74
+          ijrnf(1:1,69) = 36
+          zrnfm(1:jpmois,69) = (/   &
+              126.,      99.,     143.,     253.,     316.,     300.,   &
+              156.,      93.,     231.,     557.,     592.,     304./)
+          ! 70-Ogoue (Gabon) 1S-9E (UNESCO, p69)            R1
+          ! Data from HLA: .75S -  9  E   1930/90 = 4512m3/s
+          ! --> 4511.83301m3/s
+          criver(70) = "Ogoue               "
+          inb(70) = 1
+          iirnf(1:1,70) = 74
+          ijrnf(1:1,70) = 37
+          zrnfm(1:jpmois,70) = (/   &
+              4514.,    3988.,    4622.,    5403.,    5790.,    4145.,   &
+              2616.,    1961.,    2119.,    4304.,    7870.,    6810./)
+          ! 71-Sanaga (Cameroun) 3.5N-9.5E (UNESCO, p31)    R1
+          ! Data from HLA: 3.9N -  9.6E   1944/80 = 1983m3/s
+          ! --> 1982.58337m3/s
+          criver(71) = "Sanaga              "
+          inb(71) = 1
+          iirnf(1:1,71) = 74
+          ijrnf(1:1,71) = 41
+          zrnfm(1:jpmois,71) = (/   &
+              813.,     578.,     517.,     633.,     909.,    1278.,   &
+              1928.,    2653.,    4361.,    5470.,    3307.,    1344./)
+          ! 72-Nyong (Cameroun) 3.1N-9.5E (UNESCO, p36)     R1
+          ! Data from HLA: 3.5N -  9.8E   1951/84 = 432m3/s
+          ! --> 431.166656m3/s      
+          criver(72) = "Nyong               "
+          inb(72) = 1
+          iirnf(1:1,72) = 74
+          ijrnf(1:1,72) = 41
+          zrnfm(1:jpmois,72) = (/   &
+              232.,     128.,     150.,     266.,     402.,     459.,   &
+              353.,     306.,     604.,     930.,     878.,     466./)
+          ! 73-Ntem (Cameroun) 2.5N-9.5E (UNESCO, p36)      R1
+          ! Data from HLA: 3N -  9.8E   1951/87 = 330m3/s      
+          ! --> 329.75m3/s
+          criver(73) = "Ntem                "
+          inb(73) = 1
+          iirnf(1:1,73) = 74
+          ijrnf(1:1,73) = 41
+          zrnfm(1:jpmois,73) = (/   &
+              452.,     455.,     492.,     466.,     482.,     251.,   &
+              151.,     108.,      87.,     133.,     395.,     485./)
+          ! 74-Wouri (Cameroun) 4N-9.5E (UNESCO, p34)       R1
+          ! Data from HLA: 4N -  9.5E   1951/84  = 307m3/s
+          ! --> 306.583374m3/s
+          criver(74) = "Wouri               "
+          inb(74) = 1
+          iirnf(1:1,74) = 74
+          ijrnf(1:1,74) = 41
+          zrnfm(1:jpmois,74) = (/   &
+              88.,      63.,      68.,      95.,     139.,     222.,   &
+              395.,     633.,     825.,     675.,     328.,     148./)
+          ! 75-Oueme (Benin) 6.5N-2.5E (UNESCO, p27)        R1
+          ! Data from HLA:  6.2N -  2.5E   1951/84 =113m3/s
+          ! --> 112.666664m3/s
+          criver(75) = "Oueme               "
+          inb(75) = 1
+          iirnf(1:1,75) = 73
+          ijrnf(1:1,75) = 42
+          zrnfm(1:jpmois,75) = (/   &
+              0.,       0.,       0.,       0.,       1.,      18.,   &
+              96.,     324.,     531.,     319.,      58.,       5./)
+          ! 76-Mono(Tepetou,Benin/Togo) 6.25N-1.8E (U, p27) R1
+          ! Data from HLA: 6.2N -  1  E   1951/85  = 96m3/s       
+          ! --> 96.4999924m3/s
+          criver(76) = "Mono                "
+          inb(76) = 1
+          iirnf(1:1,76) = 72
+          ijrnf(1:1,76) = 42
+          zrnfm(1:jpmois,76) = (/   &
+              2.,       1.,       1.,       4.,       8.,      44.,   &
+              168.,     274.,     386.,     215.,      47.,       8./)
+          ! 77-Comoe (Ivory Coast) 5N-4W (UNESCO, p56)      R1
+          ! Data from HLA: 5.1N -  4  W   1955/86 = 194m3/s       
+          ! --> 194.25m3/s
+          criver(77) = "Comoe               "
+          inb(77) = 1
+          iirnf(1:1,77) = 71
+          ijrnf(1:1,77) = 41
+          zrnfm(1:jpmois,77) = (/   &
+              14.,       7.,       9.,      17.,      29.,      90.,   &
+              145.,     349.,     740.,     688.,     198.,      45./)
+          ! 78-Sassandra (Ivory Coast) 5N-6W (UNESCO, p58)  R1
+          ! Data from HLA: 5N -  6  W   1953/86 = 449m3/s
+          ! --> 449.333344m3/s
+          criver(78) = "Sassandra           "
+          inb(78) = 1
+          iirnf(1:1,78) = 71
+          ijrnf(1:1,78) = 41
+          zrnfm(1:jpmois,78) = (/   &
+              144.,     116.,     119.,     143.,     156.,     334.,   &
+              419.,     692.,    1277.,    1190.,     553.,     249./)
+          ! 79-Jubba (Somali Coast)
+          criver(79) = "Jubba               "
+          inb(79) = 1
+          iirnf(1:1,79) = 84
+          ijrnf(1:1,79) = 39
+          zrnfm(1:jpmois,79) = 0.
+          ! 80-Senaga
+          criver(80) = "Senegal             "
+          inb(79) = 1
+          iirnf(1:1,80) = 66
+          ijrnf(1:1,80) = 47
+          zrnfm(1:jpmois,79) = 0.
+      
+          ! Total run-offs (VI)=63977.m3/s
+          ! Total run-offs (I+II+III+IV+V+VI)=560902.688m3/s
+          
+          ! VII OCEANIA
+          ! ------------
+          ! 91-Murray (Australia) 35S34 138E54              R5
+          ! Old=22 km3/year=697m3/s
+          ! --> 696.999939m3/s
+          criver(91) = "Murray              "
+          inb(91) = 1
+          iirnf(1:1,91) = 16
+          ijrnf(1:1,91) = 24
+          zrnfm(1:jpmois,91) = 697.
+          ! 92-Haast (N. Zeland) 43S50 169E02               R5
+          ! Old=6 km3/year=190m3/s
+          ! --> 189.999985m3/s
+          criver(92) = "Haast               "
+          inb(92) = 1
+          iirnf(1:1,92) = 24
+          ijrnf(1:1,92) = 22
+          zrnfm(1:jpmois,92) = 190.
+          ! 93-Fly (N. Guinea) 8S30 143E05                  R5
+          ! Old=77 km3/year=2440m3/s
+          ! --> 2440.m3/s
+          criver(93) = "Fly                 "
+          inb(93) = 1
+          iirnf(1:1,93) = 19
+          ijrnf(1:1,93) = 31
+          zrnfm(1:jpmois,93) = 2440.
+          ! 94-Purari (N. Guinea) 7S25 145E05               R4
+          ! Old=77 km3/year=2440m3/s; UNESCO(77+83,p595)=2727m3/s
+          ! --> 2727.33325m3/s
+          criver(94) = "Purari              "
+          inb(94) = 1
+          iirnf(1:1,94) = 19
+          ijrnf(1:1,94) = 33
+          zrnfm(1:jpmois,94) = (/   &
+              1972.,    3067.,    2332.,    2981.,    2693.,    2876.,   &
+              2867.,    3477.,    2195.,    2967.,    2674.,    2627./)
+          ! 95-Choshui ch''i (taiwan) 24N03 120E23          R2
+          ! Old=6 km3/year=190m3/s; UNESCO(65-68, p374)=120m3/s; ratio=1.58 
+          ! --> 0.m3/s
+          criver(95) = "Choshui             "
+          inb(95) = 1
+          iirnf(1:1,95) = 12
+          ijrnf(1:1,95) = 48
+          zrnfm(1:jpmois,95) = (/   &
+              65.,      63.,      83.,     100.,     177.,     535.,   &
+              332.,     313.,     236.,     193.,     101.,      84./)
+          ! 96-Kaoping (Taiwan)                             R5  
+          ! Old=9 km3/year=285m3/s
+          ! --> 0.m3/s
+          criver(96) = "Kaoping             "
+          inb(96) = 0
+          iirnf(1:1,96) = 0
+          ijrnf(1:1,96) = 0
+          zrnfm(1:jpmois,96) = 285.
+          ! 97-Tsengwen (Taiwan)                            R5
+          ! Old=2 km3/year=63m3/s
+          ! --> 0.m3/s
+          criver(97) = "Tsengwen            "
+          inb(97) = 0
+          iirnf(1:1,97) = 0
+          ijrnf(1:1,97) = 0
+          zrnfm(1:jpmois,97) = 63.
+          ! 98-Hualien (Taiwan)                             R5
+          ! Old=4 km3/year=127m3/s
+          ! --> 0.m3/s
+          criver(98) = "Hualien             "
+          inb(98) = 0
+          iirnf(1:1,98) = 0
+          ijrnf(1:1,98) = 0
+          zrnfm(1:jpmois,98) = 127.
+          ! 99-Peinan (Taiwan) 22N46 121E10                 R5
+          ! Old=4 km3/year=127m3/s
+          ! --> 127.000008m3/s
+          criver(99) = "Peinan              "
+          inb(99) = 1
+          iirnf(1:1,99) = 12
+          ijrnf(1:1,99) = 48
+          zrnfm(1:jpmois,99) = 127.
+          ! 100-Hsiukuluan (Taiwan)                         R5
+          ! Old=4 km3/year=127m3/s
+          ! --> 0.m3/s
+          criver(100) = "Hsiukuluan          "
+          inb(100) = 0
+          iirnf(1:1,100) = 0
+          ijrnf(1:1,100) = 0
+          zrnfm(1:jpmois,100) = 127.
+
+          !  Total run-offs(VII)=6181.33301m3/s
+          
+
+          ! VIII ANTARCTICA
+          ! ---------------
+          ! 103 -Antarctic ice discharge (2 613 Gt/year) (jacobs et al 1992)
+          ! Data from Jacobs et al 92: =2613 km3/year=82857.686454 m3/s
+          ! --> 82858 m3/s
+          criver(103) = "Antarctica         "
+          inb(103) = 108
+          iirnf(1:108,103) = (/   &
+               2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,   &
+              21,22,23,24,25,25,24,24,24,25,26,27,28,29,30,31,32,33,34,   &
+              35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,51,53,   &
+              53,53,53,54,54,54,56,57,57,57,57,57,57,57,57,57,57,58,59,   &
+              60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,   &
+              79,80,81,82,83,84,85,86,87,88,89,90,91 /)
+          ijrnf(1:108,103) = (/   &
+              12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,   &
+              10,10, 9, 9, 8, 7, 6, 5, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3,   &
+               3, 4, 5, 6, 6, 6, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7,   &
+               8, 9,10,10,11,12,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 2,   &
+               2, 2, 2, 2, 3, 4, 4, 5, 7, 8, 9, 9, 9, 9, 9, 9,10,10,10,   &
+              10,10,10,10,11,12,12,12,12,11,11,10,10 /)
+          zrnfm(1:jpmois,100) = 82858.0
+                   
+
+          !  Total run-offs(I+II+III+IV+V+VI+VII)= 567084. m3/s
+          !                                      = 1.588668056E-6 kg/m2/s
+          !                                      = 17883.5586 km3/Year
+          !                                      = 0.567083955 Sverdrup
+      ENDIF
+
+      !!----------------------------------------------------------------------
+      !!  OPA 8.5, LODYC-IPSL (2002)
+      !!----------------------------------------------------------------------
+
+      IF( kt == nit000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'flxrnf : runoff + orca4'
+         IF(lwp) WRITE(numout,*) '~~~~~~'
+         IF(lwp) WRITE(numout,*) '   nrunoff = ', nrunoff
+         IF(lwp) WRITE(numout,*)
+      ENDIF
+
+      ! 0. initialization and  indexes  modification for zoom version
+      ! --------------------------------------------------------------
+      
+      
+      ! conversion factor m3/s --> kg/m2/s *e1t*e2t
+
+      zconv = rauw
+
+      IF( kt == nit000 ) THEN 
+         ! Set runoffs and upstream coeff to zero
+         runoff (:,:) = 0.e0                                                                                  
+         upsrnfh(:,:) = 0.e0
+         upsrnfz(:)   = 0.e0
+         upsadv (:,:) = 0.e0
+         zcoefr(:,:,:) = 0.e0
+
+         IF( nrunoff == 0 ) THEN
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) ' NO RUNOFF in this simulation '
+            IF(lwp) WRITE(numout,*)
+         ENDIF
+      ENDIF
+
+      IF( kt == nit000 ) THEN
+         IF( nrunoff >= 1 ) THEN 
+            zbilan = 0.0 
+!OCL SCALAR
+            DO jr = 1, jpriv-1
+               inbp = inb(jr)
+               IF( inbp /= 0 ) THEN
+                  ii = mj0(iirnf(1,jr))
+                  ij = mi0(ijrnf(1,jr))
+                  ii = MAX( 2, MIN( ii, jpi-1 ) )
+                  ij = MAX( 2, MIN( ij, jpj-1 ) )
+!OCL SCALAR
+                  IF( tmask(ii,ij,1) <= 0.5 ) THEN 
+                     IF(lwp) WRITE(numout,*) 'Erreur riviere masquee   ', ii, ij, jr, criver(jr)
+                  ENDIF
+                  IF( tmask(ii-1,ij,1)*tmask(ii+1,ij,1)   &
+                     *tmask(ii,ij-1,1)*tmask(ii,ij+1,1) /= 0. )THEN 
+                     IF(lwp) WRITE(numout,*) 'Erreur riviere non cotiere ',ii, ij, jr, criver(jr)
+                  ENDIF
+                  DO nrnf1 = 1, jpmois
+                     zbilan = zbilan + zrnfm(nrnf1,jr) * tmask(ii,ij,1)
+                  END DO
+               ENDIF
+            END DO
+            IF(lwp) WRITE(numout,*) 'zrnfm (runoff) ', zero, zconv, rauw, SUM(zrnfm)
+            IF(lwp) THEN 
+               WRITE(numout,'("Total runoff : ",1E30.15)' ) zbilan
+               WRITE(numout,*) 'Run-off : POSITION and value '
+               WRITE(numout,*) 'ji jj glamt gphit annual mask 12-month '
+!OCL SCALAR
+               DO jr = 1, jpriv-1
+                  inbp = inb(jr)
+                  IF(inbp /= 0) THEN
+!OCL SCALAR
+                     DO jl = 1, inbp
+                        ii = mj0(iirnf(jl,jr))
+                        ij = mi0(ijrnf(jl,jr))
+                        WRITE(numout,'(2I3,1X,1A20,2X,2I4,2F7.1,1I3,1PE10.1,1I2,12E9.1)')   &
+                           jr, jl, criver(jr),   &
+                           ii, ij, glamt(ii,ij), gphit(ii,ij), inbp,   &
+                           SUM(zrnfm(1:jpmois,jr))/float(inbp),   &
+                           NINT(tmask(ii,ij,1)),   &
+                           zrnfm(1:jpmois,jr)/float(inbp)
+                     END DO
+                  ENDIF
+               END DO
+            ENDIF
+            IF(lwp) WRITE(numout,*) ' zrnfm (runoff) ', zero, zconv, rauw, SUM(zrnfm)
+         ENDIF
+      ENDIF
+
+      ! 1. initialization of the runoff array
+      ! -------------------------------------
+
+      IF( nrunoff == 1 .OR. nrunoff == 2) THEN
+
+         iman  = jpmois
+         
+         i15 = nday/16
+         
+         imois = nmonth + i15 - 1
+         IF( imois == 0) imois = iman
+         IF( nn_leap_year == 1 .AND. MOD( nyear, 4 ) == 0 ) THEN
+            ! Number of Day Between Data
+            idbd = nbiss(imois)
+         ELSEIF( nn_leap_year > 1 ) THEN
+            idbd = nn_leap_year
+         ELSE
+            idbd = nobis(imois)
+         ENDIF
+         ! Number of days between imois, 15 and the end of month
+         idmeom = idbd - 15
+         
+         ! 1.1 Calendar computation
+         
+         ! nrnf1 number of the first array record used in the simulation
+         ! nrnf2 number of the last  array record
+         
+         nrnf1 = imois
+         nrnf2 = nrnf1 + 1
+         nrnf1 = MOD( nrnf1, iman )
+         IF( nrnf1 == 0 ) nrnf1 = iman
+         nrnf2 = MOD( nrnf2, iman )
+         IF( nrnf2 == 0 ) nrnf2 = iman
+         
+         IF( kt == nit000 ) THEN
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) 'flxrnf routine'
+            IF(lwp) WRITE(numout,*) 'first array record used nrnf1 ',nrnf1
+            IF(lwp) WRITE(numout,*) 'last  array record used nrnf2 ',nrnf2
+            IF(lwp) WRITE(numout,*) 'total zrnfm ', SUM(zrnfm)
+            IF(lwp) WRITE(numout,*) 'total surface ', SUM(e1t*e2t*tmask(:,:,1))
+         ENDIF
+
+         zxy = FLOAT( nday + idmeom - idbd * i15 ) / idbd
+
+!OCL SCALAR
+         DO jr = 1, jpriv-1
+            inbp = inb(jr)
+!OCL SCALAR
+            IF( inbp /= 0 ) THEN
+               DO jl = 1, inbp
+                  ii = iirnf(jl,jr) - nimpp + 1 - jpizoom + 1
+                  ij = ijrnf(jl,jr) - njmpp + 1 - jpjzoom + 1
+                  iipt0 = MAX( 1, MIN( ii, jpi   ) )
+                  iipt1 = MAX( 0, MIN( ii, jpi-1 ) )
+                  ijpt0 = MAX( 1, MIN( ij, jpj   ) )
+                  ijpt1 = MAX( 0, MIN( ij, jpj-1 ) )
+                  DO jj = ijpt0, ijpt1
+                     DO ji = iipt0, iipt1
+                        runoff(ji,jj) = runoff(ji,jj)   & 
+                                      + ( (1.-zxy) * zrnfm(nrnf1,jr)   &
+                                      +       zxy  * zrnfm(nrnf2,jr)  ) / FLOAT(inbp)      
+                     END DO
+                  END DO
+               END DO
+            ENDIF
+         END DO
+
+
+         ! 2. conversion in mm/day
+         ! -----------------------
+         !     C a u t i o n : upward water flux, runoff is negative
+
+         runoff(:,:) = -zconv * runoff(:,:) / ( e1t(:,:) * e2t(:,:) )
+         
+
+         ! 3. advectve coefficient
+         ! -----------------------
+
+         !  Creates the array coef that contains the coefficient to affect to
+         !  the upstream scheme. advection scheme will be:
+         !  coefr * upstream + (1- coefr) centered
+         !  coefr must be between 0 and 1.
+         !  3 values are used: maximum = zrup1, between zrup2, small zrup3.
+         ! 
+         IF( nrunoff == 2 .AND. kt == nit000 ) THEN
+
+            zrup1 = 0.5
+            zrup2 = 0.25
+            zrup3 = 0.125
+            DO jr = 1, jpriv-1
+               inbp = inb(jr)
+               IF( inbp /= 0) THEN
+                  DO jl = 1, inbp
+                     ! --> zrup1 (originally, = 1 = all upstream).
+                     ! ji,jj
+                     ii = iirnf(jl,jr) - nimpp + 1 - jpizoom - 1
+                     ij = ijrnf(jl,jr) - njmpp + 1 - jpjzoom - 1
+                     iipt0 = MAX( 1, MIN( ii,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii,jpi-1) )
+                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = zrup1
+                           END DO
+                           zcoefr(ji,jj,4) = zrup2
+                           zcoefr(ji,jj,5) = zrup3
+                        END DO
+                     END DO
+                     ! --> zrup2 (originally = 0.5)
+                     ! ji,jj+1
+                     ijpt0 = MAX( 1, MIN( ij+1, jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+1, jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji,jj-1
+                     ijpt0 = MAX( 1, MIN( ij-1, jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-1, jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji+1,jj-1
+                     iipt0 = MAX( 1, MIN( ii+1, jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii+1, jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji+1,jj
+                     ijpt0 = MAX( 1, MIN( ij, jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij, jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji+1,jj+1
+                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji-1,jj+1
+                     iipt0 = MAX( 1, MIN( ii-1,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii-1,jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji-1,jj
+                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! ji-1,jj-1
+                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup2, zcoefr(ji,jj,jn) )
+                           END DO
+                           zcoefr(ji,jj,4) = MAX( zrup3, zcoefr(ji,jj,4) )
+                        END DO
+                     END DO
+                     ! --> zrup3 (originally = 0.25)
+                     ! ji-1,jj+2
+                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-1,jj-2
+                     ijpt0 = MAX( 1, MIN( ij-2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji,jj-2
+                     iipt0 = MAX( 1, MIN( ii,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii,jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji,jj+2
+                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+1,jj-2
+                     iipt0 = MAX( 1, MIN( ii+1,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii+1,jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+1,jj+2
+                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj-2
+                     iipt0 = MAX( 1, MIN( ii+2,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii+2,jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj+2
+                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3  
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj-1
+                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj+1
+                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji+2,jj
+                     ijpt0 = MAX( 1, MIN( ij,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj
+                     iipt0 = MAX( 1, MIN( ii-2,jpi  ) )
+                     iipt1 = MAX( 0, MIN( ii-2,jpi-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3        
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj-2
+                     ijpt0 = MAX( 1, MIN( ij-2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj+2
+                     ijpt0 = MAX( 1, MIN( ij+2,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+2,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj-1
+                     ijpt0 = MAX( 1, MIN( ij-1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij-1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                     ! ji-2,jj+1
+                     ijpt0 = MAX( 1, MIN( ij+1,jpj  ) )
+                     ijpt1 = MAX( 0, MIN( ij+1,jpj-1) )
+                     DO jj = ijpt0, ijpt1
+                        DO ji = iipt0, iipt1
+                           DO jn = 1, 3 
+                              zcoefr(ji,jj,jn) = MAX( zrup3, zcoefr(ji,jj,jn) )
+                           END DO
+                        END DO
+                     END DO
+                  END DO
+               ENDIF
+            END DO
+            upsrnfh(:,:) = zcoefr(:,:,1)
+            upsrnfz(:)   = 0.e0
+            upsrnfz(1)   = 1.0
+            upsrnfz(2)   = 1.0
+            upsrnfz(3)   = zrup1
+            upsrnfz(4)   = zrup2
+            upsrnfz(5)   = zrup3
+         ENDIF
+      ENDIF
+      
+      ! Upstream and centered scheme in the vicinity of some straits
+      
+      IF( kt == nit000 ) THEN
+
+         ! ORCA_R4 configuration :
+         ! Gibraltar Strait
+         DO jj = mj0(52), mj1(53)
+            DO ji = mi0(70), mi1(71)
+               upsadv(ji,jj) = 0.5
+            END DO
+         END DO
+
+      ENDIF
Index: trunk/NEMO/OPA_SRC/SBC/sbcssm.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcssm.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcssm.F90	(revision 888)
@@ -0,0 +1,147 @@
+MODULE sbcssm
+   !!======================================================================
+   !!                       ***  MODULE  sbcssm  ***
+   !! Surface module :  provide time-mean ocean surface variables
+   !!======================================================================
+   !! History :  9.0   !  06-07  (G. Madec)  Original code
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   sbc_ssm        : calculate sea surface mean currents, temperature,  
+   !!                    and salinity over nn_fsbc time-step
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE daymod          ! calendar
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE prtctl          ! Print control                    (prt_ctl routine)
+   USE restart         ! ocean restart
+   USE iom
+   USE in_out_manager  ! I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   sbc_ssm    ! routine called by step.F90
+   
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE sbc_ssm( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE sbc_oce  ***
+      !!                     
+      !! ** Purpose :   provide ocean surface variable to sea-surface boundary
+      !!                condition computation 
+      !!                
+      !! ** Method  :   compute mean surface velocity (2 components at U and 
+      !!      V-points) [m/s], temperature [Celcius] and salinity [psu] over
+      !!      the periode (kt - nn_fsbc) to kt
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt        ! ocean time step
+      !
+      REAL(wp) ::   zcoef       ! temporary scalar
+      REAL(wp) ::   zf_sbc      ! read sbc frequency 
+      !!---------------------------------------------------------------------
+      !                                                   ! ---------------------------------------- !
+      IF( nn_fsbc == 1 ) THEN                             !      Instantaneous surface fields        !
+         !                                                ! ---------------------------------------- !
+         IF( kt == nit000 ) THEN
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) 'sbc_ssm : sea surface mean fields, nn_fsbc=1 : instantaneous values'
+            IF(lwp) WRITE(numout,*) '~~~~~~~ '
+         ENDIF
+         !
+         ssu_m(:,:) = un(:,:,1)
+         ssv_m(:,:) = vn(:,:,1)
+         sst_m(:,:) = tn(:,:,1)
+         sss_m(:,:) = sn(:,:,1)
+         !
+      ELSE
+         !                                                ! ---------------------------------------- !
+         IF( kt == nit000) THEN                           !       Initialisation: 1st time-step      !
+            !                                             ! ---------------------------------------- !
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) 'sbc_ssm : sea surface mean fields'
+            !
+            IF( ln_rstart .AND. iom_varid( numror, 'nn_fsbc' ) > 0 ) THEN 
+               CALL iom_get( numror             , 'nn_fsbc', zf_sbc )   ! sbc frequency of previous run
+               CALL iom_get( numror, jpdom_local, 'ssu_m'  , ssu_m  )   ! sea surface mean velocity    (T-point)
+               CALL iom_get( numror, jpdom_local, 'ssv_m'  , ssv_m  )   !   "         "    velocity    (V-point)
+               CALL iom_get( numror, jpdom_local, 'sst_m'  , sst_m  )   !   "         "    temperature (T-point)
+               CALL iom_get( numror, jpdom_local, 'sss_m'  , sss_m  )   !   "         "    salinity    (T-point)
+               !
+               IF( zf_sbc /= REAL( nn_fsbc, wp ) ) THEN      ! nn_fsbc has changed between 2 runs
+                  IF(lwp) WRITE(numout,*) '~~~~~~~   restart with a change in the frequency of mean ',   &
+                     &                    'from ', zf_sbc, ' to ', nn_fsbc
+                  zcoef = REAL( nn_fsbc - 1, wp ) / zf_sbc
+                  ssu_m(:,:) = zcoef * ssu_m(:,:)
+                  ssv_m(:,:) = zcoef * ssv_m(:,:)
+                  sst_m(:,:) = zcoef * sst_m(:,:)
+                  sss_m(:,:) = zcoef * sss_m(:,:)
+               ELSE
+                  IF(lwp) WRITE(numout,*) '~~~~~~~   mean fields read in the ocean restart file'
+               ENDIF
+            ELSE
+               IF(lwp) WRITE(numout,*) '~~~~~~~   mean fields initialised to instantaneous values'
+               zcoef = REAL( nn_fsbc - 1, wp )
+               ssu_m(:,:) = zcoef * un(:,:,1)
+               ssv_m(:,:) = zcoef * vn(:,:,1)
+               sst_m(:,:) = zcoef * tn(:,:,1)
+               sss_m(:,:) = zcoef * sn(:,:,1)
+            ENDIF
+            !                                             ! ---------------------------------------- !
+         ELSEIF( MOD( kt - 2 , nn_fsbc ) == 0 ) THEN      !   Initialisation: New mean computation   !
+            !                                             ! ---------------------------------------- !
+            ssu_m(:,:) = 0.e0      ! reset to zero ocean mean sbc fields
+            ssv_m(:,:) = 0.e0
+            sst_m(:,:) = 0.e0
+            sss_m(:,:) = 0.e0
+         ENDIF
+         !                                                ! ---------------------------------------- !
+         !                                                !        Cumulate at each time step        !
+         !                                                ! ---------------------------------------- !
+         ssu_m(:,:) = ssu_m(:,:) + un(:,:,1)
+         ssv_m(:,:) = ssv_m(:,:) + vn(:,:,1)
+         sst_m(:,:) = sst_m(:,:) + tn(:,:,1)
+         sss_m(:,:) = sss_m(:,:) + sn(:,:,1)
+
+         !                                                ! ---------------------------------------- !
+         IF( MOD( kt - 1 , nn_fsbc ) == 0 ) THEN          !   Mean value at each nn_fsbc time-step   !
+            !                                             ! ---------------------------------------- !
+            zcoef = 1. / REAL( nn_fsbc, wp )
+            sst_m(:,:) = sst_m(:,:) * zcoef           ! mean SST             [Celcius]
+            sss_m(:,:) = sss_m(:,:) * zcoef           ! mean SSS             [psu]
+            ssu_m(:,:) = ssu_m(:,:) * zcoef           ! mean suface current  [m/s]
+            ssv_m(:,:) = ssv_m(:,:) * zcoef           !
+            !
+         ENDIF
+         !                                                ! ---------------------------------------- !
+         IF( lrst_oce ) THEN                              !      Write in the ocean restart file     !
+            !                                             ! ---------------------------------------- !
+            IF(lwp) WRITE(numout,*)
+            IF(lwp) WRITE(numout,*) 'sbc_ssm : sea surface mean fields written in ocean restart file ',   &
+               &                    'at it= ', kt,' date= ', ndastp
+            IF(lwp) WRITE(numout,*) '~~~~~~~'
+            zf_sbc = REAL( nn_fsbc, wp )
+            CALL iom_rstput( kt, nitrst, numrow, 'nn_fsbc', zf_sbc )    ! sbc frequency
+            CALL iom_rstput( kt, nitrst, numrow, 'ssu_m'  , ssu_m  )    ! sea surface mean fields
+            CALL iom_rstput( kt, nitrst, numrow, 'ssv_m'  , ssv_m  )
+            CALL iom_rstput( kt, nitrst, numrow, 'sst_m'  , sst_m  )
+            CALL iom_rstput( kt, nitrst, numrow, 'sss_m'  , sss_m  )
+            !
+         ENDIF
+         !
+      ENDIF
+      !
+   END SUBROUTINE sbc_ssm
+
+   !!======================================================================
+END MODULE sbcssm
Index: trunk/NEMO/OPA_SRC/SBC/sbcssr.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 888)
+++ trunk/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 888)
@@ -0,0 +1,223 @@
+MODULE sbcssr
+   !!======================================================================
+   !!                       ***  MODULE  sbcssr  ***
+   !! Surface module :  add to heat and fresh water fluxes a restoring term
+   !!                   toward observed SST/SSS
+   !!======================================================================
+   !! History :  9.0   !  06-06  (G. Madec)  Original code
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   sbc_ssr        : add to sbc a restoring term toward SST/SSS climatology
+   !!----------------------------------------------------------------------
+   USE oce             ! ocean dynamics and tracers
+   USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! surface boundary condition
+   USE phycst          ! physical constants
+   USE daymod          ! calendar
+   USE ocfzpt          ! ocean freezing point
+   USE sbcrnf          ! surface boundary condition : runoffs
+   USE fldread         ! read input fields
+   USE iom             ! I/O manager
+   USE in_out_manager  ! I/O manager
+   USE lib_mpp         ! distribued memory computing library
+   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   sbc_ssr    ! routine called in sbcmod
+   
+   REAL(wp), ALLOCATABLE, DIMENSION(:)   ::   buffer   ! Temporary buffer for exchange
+
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_sst   ! structure of input SST (file informations, fields read)
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_sss   ! structure of input SSS (file informations, fields read)
+
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   erp       !: evaporation damping                          [kg/m2/s]
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   qrp       !: heat flux damping                            [w/m2]
+
+   !! * Namelist namsbc_ssr
+   INTEGER ::   nn_sstr, nn_sssr   ! SST/SSS indicator
+   REAL(wp) ::  dqdt   , deds      ! restoring term factor
+
+   !! * Substitutions
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE sbc_ssr( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE sbc_ssr  ***
+      !!
+      !! ** Purpose :   Add to heat and/or freshwater fluxes a damping term
+      !!                toward observed SST and/or SSS.
+      !!
+      !! ** Method  : - Read namelist namsbc_ssr
+      !!              - Read observed SST and/or SSS
+      !!              - at each nscb time step
+      !!                   add a retroaction term on qns    (nn_sstr = 1)
+      !!                   add a damping term on emps       (nn_sssr = 1)
+      !!                   add a damping term on emp & emps (nn_sssr = 2)
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in   ) ::   kt   ! ocean time step
+      !!
+      INTEGER  ::   ji, jj   ! dummy loop indices
+      REAL(wp) ::   zerp     ! local scalar for evaporation damping
+      REAL(wp) ::   zqrp     ! local scalar for heat flux damping
+      REAL(wp) ::   zsrp     ! local scalar for unit conversion of deds factor
+      INTEGER  ::   ierror   ! return error code
+      !!
+      CHARACTER(len=100) ::  cn_dir          ! Root directory for location of ssr files
+      TYPE(FLD_N) ::   sn_sst, sn_sss        ! informations about the fields to be read
+      NAMELIST/namsbc_ssr/ cn_dir, nn_sstr, nn_sssr, dqdt, deds, sn_sst, sn_sss
+      !!----------------------------------------------------------------------
+      !                                               ! -------------------- !
+      IF( kt == nit000 ) THEN                         ! First call kt=nit000 !
+         !                                            ! -------------------- !
+         !                         ! set file information
+         nn_sstr = 0
+         nn_sssr = 0
+         dqdt = -40.e0
+         deds = -27.70
+         cn_dir = './'       ! directory in which the model is executed
+         ! ... default values (NB: frequency positive => hours, negative => months)
+         !            !   file    ! frequency !  variable  ! time intep !  clim  ! starting !
+         !            !   name    !  (hours)  !   name     !   (T/F)    !  (0/1) !  record  !
+         sn_sst = FLD_N( 'sst'     ,    24.    ,  'sst'     ,  .FALSE.   ,    0   ,     0    )
+         sn_sss = FLD_N( 'sss'     ,   -12.    ,  'sss'     ,  .TRUE.    ,    0   ,     0    )
+
+         REWIND ( numnam )         ! ... read in namlist namflx
+         READ( numnam, namsbc_ssr ) 
+
+         IF(lwp) THEN              ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) 'sbc_ssr : SST and/or SSS damping term '
+            WRITE(numout,*) '~~~~~~~ '
+            WRITE(numout,*) '          SST restoring term (Yes=1)             nn_sstr = ', nn_sstr
+            WRITE(numout,*) '          SSS damping term (Yes=1, salt flux)    nn_sssr = ', nn_sssr
+            WRITE(numout,*) '                           (Yes=2, volume flux) '
+            WRITE(numout,*) '          dQ/dT (restoring magnitude on SST)     dqdt    = ', dqdt, ' W/m2/K'
+            WRITE(numout,*) '          dE/dS (restoring magnitude on SST)     deds    = ', deds, ' mm/day'
+         ENDIF
+
+         IF( nn_sstr == 1 ) THEN      ! set sf_sst structure
+            !
+            ALLOCATE( sf_sst(1), STAT=ierror )
+            IF( ierror > 0 ) THEN
+               CALL ctl_stop( 'sbc_ssr: unable to allocate sf_sst structure' )   ;   RETURN
+            ENDIF
+            ! namelist informations stored in sf_sst structures
+            WRITE( sf_sst(1)%clrootname, '(a,a)' )   TRIM( cn_dir ), TRIM( sn_sst%clname )
+            sf_sst(1)%freqh   = sn_sst%freqh
+            sf_sst(1)%clvar   = sn_sst%clvar 
+            sf_sst(1)%ln_tint = sn_sst%ln_tint
+            sf_sst(1)%nclim   = sn_sst%nclim  
+            sf_sst(1)%nstrec  = sn_sst%nstrec  
+            IF(lwp) THEN             ! control print
+               WRITE(numout,*) '   SST restoring term toward SST data in the following file: '
+               WRITE(numout,*) '               root filename: '  , trim( sf_sst(1)%clrootname ),   &
+                  &                          ' variable name: '  , trim( sf_sst(1)%clvar      )
+               WRITE(numout,*) '               frequency: '      ,       sf_sst(1)%freqh       ,   &
+                  &                          ' time interp: '    ,       sf_sst(1)%ln_tint     ,   &
+                  &                          ' climatology: '    ,       sf_sst(1)%nclim       ,   &
+                  &                          ' starting record: ',       sf_sst(1)%nstrec
+            ENDIF
+         ENDIF
+         !
+         IF( nn_sssr == 1 ) THEN      ! set sf_sss structure
+            !
+            ALLOCATE( sf_sss(1), STAT=ierror )
+            IF( ierror > 0 ) THEN
+               CALL ctl_stop( 'sbc_ssr: unable to allocate sf_sss structure' )   ;   RETURN
+            ENDIF
+            ! namelist informations stored in sf_sss structures
+            WRITE( sf_sss(1)%clrootname, '(a,a)' )   TRIM( cn_dir ), TRIM( sn_sss%clname )
+            sf_sss(1)%freqh   = sn_sss%freqh
+            sf_sss(1)%clvar   = sn_sss%clvar
+            sf_sss(1)%ln_tint = sn_sss%ln_tint
+            sf_sss(1)%nclim   = sn_sss%nclim
+            sf_sss(1)%nstrec  = sn_sss%nstrec
+            IF(lwp) THEN             ! control print
+               WRITE(numout,*) '   SSS dampming  term toward SSS data in the following file: ' 
+               WRITE(numout,*) '               root filename: '  , trim( sf_sss(1)%clrootname ),   &
+                  &                          ' variable name: '  , trim( sf_sss(1)%clvar      )
+               WRITE(numout,*) '               frequency: '      ,       sf_sss(1)%freqh       ,   &
+                  &                          ' time interp: '    ,       sf_sss(1)%ln_tint     ,   &
+                  &                          ' climatology: '    ,       sf_sss(1)%nclim       ,   &
+                  &                          ' starting record: ',       sf_sss(1)%nstrec
+            ENDIF
+         ENDIF
+         !
+         ! Initialize qrp and erp if no restoring 
+         IF( nn_sstr /= 1                   )   qrp(:,:) = 0.e0 
+         IF( nn_sssr /= 1 .OR. nn_sssr /= 2 )   erp(:,:) = 0.e0 
+      ENDIF
+
+      IF( nn_sstr + nn_sssr /= 0 ) THEN
+
+         IF( nn_sstr == 1)   CALL fld_read( kt, nn_fsbc, sf_sst )   ! Read SST data and provides it
+         !                                                          ! at the current time-step
+         IF( nn_sssr == 1)   CALL fld_read( kt, nn_fsbc, sf_sss )   ! Read SSS data and provides it
+         !                                                          ! at the current time-step
+ 
+         !                                         ! ========================= !
+         IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN      !    Add restoring term     !
+            !                                      ! ========================= !
+            !
+            IF( nn_sstr == 1 ) THEN                   ! Temperature restoring term
+!CDIR COLLAPSE
+               ! use zqrp scalar to optimize memory access (speedup the loop)
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     zqrp = dqdt * ( sst_m(ji,jj) - sf_sst(1)%fnow(ji,jj) )
+                     qns(ji,jj) = qns(ji,jj) + zqrp
+                     qrp(ji,jj) = zqrp
+                  END DO
+               END DO
+            ENDIF
+            !
+            IF( nn_sssr == 1 ) THEN                   ! Salinity damping term (salt flux, emps only)
+!CDIR COLLAPSE
+               ! use zerp scalar to optimize memory access (speedup the loop)
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     zsrp = deds / rday                               ! from [mm/day] to [kg/m2/s]
+                     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) + 1.e-20   )
+                     emps(ji,jj) = emps(ji,jj) + zerp
+                     erp( ji,jj) = zerp
+                  END DO
+               END DO
+            ELSEIF( nn_sssr == 2 ) THEN               ! Salinity damping term (volume flux, emp and emps)
+!CDIR COLLAPSE
+               ! use zerp scalar to optimize memory access (speedup the loop)
+               DO jj = 1, jpj
+                  DO ji = 1, jpi                            
+                     zsrp = deds / rday                               ! from [mm/day] to [kg/m2/s]
+                     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) + 1.e-20   )
+                     emp (ji,jj) = emp (ji,jj) + zerp
+                     emps(ji,jj) = emps(ji,jj) + zerp
+                     erp (ji,jj) = zerp
+                  END DO
+               END DO
+            ENDIF
+            !
+         ENDIF
+         !
+      ENDIF
+
+      !!gm ... to be written                     ! Output sbc fields (using IOM)
+      ! prevoir comment obtenir l info sst sss ssr
+      !
+   END SUBROUTINE sbc_ssr
+      
+   !!======================================================================
+END MODULE sbcssr
Index: trunk/NEMO/OPA_SRC/SBC/tau_forced_daily.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/tau_forced_daily.h90	(revision 873)
+++ 	(revision )
@@ -1,112 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                   ***  tau_forced_daily.h90  ***
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   tau     :   update the surface stress - daily fields in NetCDF file
-   !!----------------------------------------------------------------------
-   !! * local modules variables
-   INTEGER ::   &
-      numtau,         &  ! logical unit for the i-component of the wind data
-      numtav,         &  ! logical unit for the j-component of the wind data
-      ndaytau            ! new day for ers/ncep tau forcing
-
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE tau( kt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE tau  ***
-      !!     
-      !! ** Purpose :   provide to the ocean the stress at each time step
-      !!
-      !! ** Method  :   Read the daily surface stress components in NetCDF 
-      !!      file. They are given in the (i,j) referential 
-      !!        The i-component is given at U-point (INTERP package)
-      !!        The j-component is given at V-point (INTERP package)
-      !!
-      !!    CAUTION: never mask the surface stress field !
-      !!
-      !! ** Action  :   update at each time-step the two components of the 
-      !!      surface stress in both (i,j) and geographical referencial
-      !!
-      !! History :
-      !!   4.0  !  91-03  (G. Madec)  Original code
-      !!   6.0  !  92-07  (M. Imbard)
-      !!   8.1  !  00-08  (D. Ludicone) adapted to ERS-NCEP
-      !!   8.5  !  02-11  (G. Madec)  F90: Free form and module
-      !!        !  03-07  (C. Ethe, G. Madec)  daily generic forcing
-      !!----------------------------------------------------------------------
-      USE iom       ! NetCDF library
-
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-     
-      !!---------------------------------------------------------------------
-
-      ! -------------------- !
-      ! First call kt=nit000 !
-      ! -------------------- !
-
-      IF( kt == nit000 ) THEN
-         
-         ndaytau = 0   ! initialization
-         IF(lwp) THEN
-            WRITE(numout,*) ' '
-            WRITE(numout,*) ' tau    : DAILY wind stress in NetCDF files'
-         ENDIF
-         ! open the files
-         CALL iom_open ( 'taux_1d.nc', numtau )
-         CALL iom_open ( 'tauy_1d.nc', numtav )
-         
-      ENDIF
-
-      ! ----------------- !
-      ! Read daily file   !
-      ! ----------------- !
-
-      IF ( ndaytau /= nday ) THEN
-            
-         ndaytau = nday
-            
-         ! Read daily wind stress data
-
-         CALL iom_get ( numtau, jpdom_data, 'taux', taux, nday_year )
-         CALL iom_get ( numtav, jpdom_data, 'tauy', tauy, nday_year )
-
-#if defined key_lim3
-      tauxw = taux
-      tauyw = tauy
-#endif
-            
-         IF (lwp .AND. nitend-nit000 <= 100 ) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) ' read daily wind stress ok'
-            WRITE(numout,*)
-            WRITE(numout,*) ' day: ', ndastp , '  taux: 1 multiply by ', 1.
-            CALL prihre( taux, jpi, jpj, 1, jpi, 20, 1, jpj, 10, 1., numout )
-            WRITE(numout,*)
-            WRITE(numout,*) ' day: ', ndastp , '  tauy: 1 multiply by ', 1.
-            CALL prihre( tauy, jpi, jpj, 1, jpi, 20, 1, jpj, 10, 1., numout )
-            WRITE(numout,*) ' ' 
-         ENDIF
-            
-         CALL FLUSH(numout)
-
-      ENDIF
-         
-      ! ------------------- !
-      ! Last call kt=nitend !
-      ! ------------------- !
-
-      ! Closing of the 2 files
-      IF( kt == nitend ) THEN
-          CALL iom_close( numtau )
-          CALL iom_close( numtav )
-      ENDIF
-         
-   END SUBROUTINE tau
Index: trunk/NEMO/OPA_SRC/SBC/tau_forced_monthly.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/tau_forced_monthly.h90	(revision 873)
+++ 	(revision )
@@ -1,153 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                ***  tau_forced_monthly.h90  ***
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   tau     : update the surface wind stress - monthly fields in NetCDF
-   !!             file.
-   !!----------------------------------------------------------------------
-   !! * local modules variables
-   INTEGER ::   &
-      numtau,   &   ! logical unit for the i-component of the wind data
-      numtav,   &   ! logical unit for the j-component of the wind data
-      ntau1, ntau2  ! index of the first and second record used
-   REAL(wp), DIMENSION(jpi,jpj,2) ::   &
-      taux_dta,    &  ! i- and j-components of the surface stress (Pascal)
-      tauy_dta        ! at 2 consecutive months in the (i,j) referential
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE tau( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE tau  ***
-      !!              
-      !! ** Purpose :   provide to the ocean the stress at each time step
-      !!
-      !! ** Method  : - Read the 2 monthly surface stress components in NetCDF 
-      !!      file at 2 consecutive time-steps
-      !!        They are given in the (i,j) referential 
-      !!        The i-component is given at U-point (INTERP package)
-      !!        The j-component is given at V-point (INTERP package)
-      !!              - a linear time-interpolation is performed to provide the
-      !!      stress at the kt time-step.
-      !!
-      !!    CAUTION: never mask the surface stress field !
-      !!
-      !! ** Action :
-      !!        update at each time-step the two components of the surface
-      !!      stress in both (i,j) and geographical referencial
-      !!
-      !! History :
-      !!   4.0  !  91-03  (G. Madec)  Original code
-      !!   6.0  !  92-07  (M. Imbard)
-      !!   8.1  !  00-08  (D. Ludicone) adapted to ERS-NCEP
-      !!   8.5  !  02-11  (G. Madec)  F90: Free form and module
-      !!        !                     daily/monthly, forced/coupled form
-      !!----------------------------------------------------------------------
-      !! * Modules used
-      USE iom      
-      !! * Arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-
-      !! * Local declarations
-      INTEGER :: imois, iman, i15
-      REAL(wp) :: zxy          ! coefficient of the linear time interpolation
-      !!---------------------------------------------------------------------
-
-      ! -------------- !
-      ! Initialization !
-      ! -------------- !
-      
-      ! iman=number of dates in data file (12 for a year of monthly values)
-      iman  = INT( raamo )
-      i15 = INT( 2*FLOAT( nday ) / ( FLOAT( nobis(nmonth) ) + 0.5 ) )
-      imois = nmonth + i15 - 1
-      IF( imois == 0 ) imois = iman
-
-      ! -------------------- !
-      ! First call kt=nit000 !
-      ! -------------------- !
-
-      IF( kt == nit000 ) THEN
-         
-         ntau1 = 0   ! initialization
-         IF(lwp) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) ' tau    : MONTHLY climatological wind stress (NetCDF files)'
-         ENDIF
-         CALL iom_open ( 'taux_1m.nc', numtau )
-         CALL iom_open ( 'tauy_1m.nc', numtav )
-         
-      ENDIF
-      
-      ! ----------------- !
-      ! Read monthly file !
-      ! ----------------- !
-
-      IF( kt == nit000 .OR. imois /= ntau1 ) THEN
-
-         ! Calendar computation
-         ntau1 = imois          ! index of the first record
-         ntau2 = ntau1 + 1      ! index of the last  record
-         ntau1 = MOD( ntau1, iman )
-         IF( ntau1 == 0 ) ntau1 = iman
-         ntau2 = MOD( ntau2, iman )
-         IF( ntau2 == 0 ) ntau2 = iman
-         IF(lwp) WRITE(numout,*) 'first month used ntau1 = ', ntau1
-         IF(lwp) WRITE(numout,*) 'last  month used ntau2 = ', ntau2
-
-         ! Read the corresponding 2 monthly stress data
-         ! ntau1
-         CALL iom_get ( numtau, jpdom_data, 'sozotaux', taux_dta(:,:,1), ntau1 )
-         CALL iom_get ( numtav, jpdom_data, 'sometauy', tauy_dta(:,:,1), ntau1 )
-
-         CALL iom_get ( numtau, jpdom_data, 'sozotaux', taux_dta(:,:,2), ntau2 )
-         CALL iom_get ( numtav, jpdom_data, 'sometauy', tauy_dta(:,:,2), ntau2 )
-         
-         IF(lwp .AND. nitend-nit000 <= 100 ) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) ' monthly stress read'
-            WRITE(numout,*)
-            WRITE(numout,*) ' month: ', ntau1, '  taux: 1 multiply by ', 1.
-            CALL prihre( taux_dta(:,:,1), jpi, jpj, 1, jpi, 20, 1, jpj, 10, 1., numout )
-            WRITE(numout,*)
-            WRITE(numout,*) ' month: ', ntau2, '  tauy: 2 multiply by ', 1.
-            CALL prihre( tauy_dta(:,:,2), jpi, jpj, 1, jpi, 20, 1, jpj, 10, 1., numout )
-         ENDIF
-
-         CALL FLUSH(numout)
-
-      ENDIF
-
-      ! ------------------------------- !
-      ! linear time interpolation at kt !
-      ! ------------------------------- !
-
-      ! zxy : coefficient for linear interpolation in time
-
-      zxy = FLOAT( nday ) / FLOAT( nobis(ntau1) ) + 0.5 - i15
-
-      taux(:,:) = (1.-zxy) * taux_dta(:,:,1) + zxy * taux_dta(:,:,2)
-      tauy(:,:) = (1.-zxy) * tauy_dta(:,:,1) + zxy * tauy_dta(:,:,2)
-
-#if defined key_lim3
-      tauxw = taux 
-      tauyw = tauy 
-#endif
-
-      ! ------------------- !
-      ! Last call kt=nitend !
-      ! ------------------- !
-
-      ! Closing of the 2 files (required in mpp)
-      IF( kt == nitend ) THEN
-          CALL iom_close(numtau)
-          CALL iom_close(numtav)
-      ENDIF
-
-   END SUBROUTINE tau
Index: trunk/NEMO/OPA_SRC/SBC/tau_oasis_ice.h90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/tau_oasis_ice.h90	(revision 873)
+++ 	(revision )
@@ -1,120 +1,0 @@
-   !!----------------------------------------------------------------------
-   !!                   ***  tau_oasis_ice.h90  ***
-   !!----------------------------------------------------------------------
-
-   REAL(wp)  :: ztaueuw (1:jpi,1:jpj)  ! eastward wind stress over water 
-   REAL(wp)  :: ztaunuw (1:jpi,1:jpj)  ! northward wind stress over water 
-   REAL(wp)  :: ztaueui (1:jpi,1:jpj)  ! eastward wind stress over ice
-   REAL(wp)  :: ztaunui (1:jpi,1:jpj)  ! northward wind stress over ice 
-   REAL(wp)  :: ztaueu  (1:jpi,1:jpj)  ! eastward wind stress combined
-   REAL(wp)  :: ztaunu  (1:jpi,1:jpj)  ! northward wind stress combined 
-   REAL(wp)  :: ztauevw (1:jpi,1:jpj)
-   REAL(wp)  :: ztaunvw (1:jpi,1:jpj)
-   REAL(wp)  :: ztauevi (1:jpi,1:jpj)
-   REAL(wp)  :: ztaunvi (1:jpi,1:jpj)
-   REAL(wp)  :: ztauev  (1:jpi,1:jpj)
-   REAL(wp)  :: ztaunv  (1:jpi,1:jpj)
-   REAL(wp)  :: ztauzv  (1:jpi,1:jpj)
-
-   !!----------------------------------------------------------------------
-   !!   tau     :   update the surface stress - coupled case with LIM
-   !!               sea-ice model
-   !!----------------------------------------------------------------------
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/SBC/tau_oasis_ice.h90,v 1.2 2007/06/29 14:23:07 opalod Exp $ 
-   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE tau( kt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE tau  ***
-      !!  
-      !! ** Purpose :   provide to the ocean the stress at each time step
-      !!
-      !! ** Method  :   Coupled case with LIM sea-ice model
-      !!      Read wind stress from a coupled Atmospheric model
-      !!      - horizontal interpolation is done in OASIS
-      !!        They are given in the 3D referential 
-      !!      (3 components at both U- and V-points)
-      !!
-      !!    CAUTION: never mask the surface stress field !
-      !!
-      !! ** Action  :   update at each time-step the two components of the 
-      !!                surface stress in both (i,j) and geographical ref.
-      !!
-      !! References : The OASIS User Guide, Version 3.0
-      !!
-      !! History :
-      !!   9.0  !  04-10  (R. Redler)  original Code for OASIS3
-      !!   9.0  !  05-12  (W. Park, N. Keenlyside)  Removal of z-components
-      !!----------------------------------------------------------------------
-      !! * Modules used
-     USE in_out_manager, only:numout             ! I/O manager
-      !! * Arguments
-      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
-
-      !! * Local declarations
-      INTEGER :: ji,jj
-      INTEGER :: var_id
-
-      INTEGER  :: info
-
-      INTEGER  :: dater
-
-      LOGICAL, SAVE :: lfirstt=.true.
-
-      !!---------------------------------------------------------------------
-      
-      ! 0. Initialization
-      !------------------
-      !
-      dater = ( kt - nit000 ) * rdttra(1)
-      !
-      ! 1. Receive wind stress fields and rotate them onto OPA grid
-      !------------------------------------------------------------
-      !
-      var_id = recv_id(1)
-      CALL cpl_prism_recv ( var_id, dater, ztaueuw, info )
-
-      var_id = recv_id(2)
-      CALL cpl_prism_recv ( var_id, dater, ztaunuw, info )
-
-      var_id = recv_id(3)
-      CALL cpl_prism_recv ( var_id, dater, ztaueui, info )
-
-      var_id = recv_id(4)
-      CALL cpl_prism_recv ( var_id, dater, ztaunui, info )
-
-      var_id = recv_id(5)
-      CALL cpl_prism_recv ( var_id, dater, ztauevw, info )
-
-      var_id = recv_id(6)
-      CALL cpl_prism_recv ( var_id, dater, ztaunvw, info )
-
-      var_id = recv_id(7)
-      CALL cpl_prism_recv ( var_id, dater, ztauevi, info )
-
-      var_id = recv_id(8)
-      CALL cpl_prism_recv ( var_id, dater, ztaunvi, info )
-
-      !
-      ! ... add field over water and ice 
-      !
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-              ztaueu(ji,jj) = ztaueuw(ji,jj) * frld(ji,jj) + ztaueui(ji,jj) * ( 1.0 - frld(ji,jj) )
-              ztaunu(ji,jj) = ztaunuw(ji,jj) * frld(ji,jj) + ztaunui(ji,jj) * ( 1.0 - frld(ji,jj) )
-              ztauev(ji,jj) = ztauevw(ji,jj) * frld(ji,jj) + ztauevi(ji,jj) * ( 1.0 - frld(ji,jj) )
-              ztaunv(ji,jj) = ztaunvw(ji,jj) * frld(ji,jj) + ztaunvi(ji,jj) * ( 1.0 - frld(ji,jj) )
-         ENDDO
-      ENDDO
-      !
-      ! ... rotate vector components
-      !
-      CALL repcmo ( ztaueu, ztaunu, ztauev, ztaunv, taux, tauy )
-
-      !
-   END SUBROUTINE tau
Index: trunk/NEMO/OPA_SRC/SBC/taumod.F90
===================================================================
--- trunk/NEMO/OPA_SRC/SBC/taumod.F90	(revision 873)
+++ 	(revision )
@@ -1,214 +1,0 @@
-MODULE taumod
-   !!======================================================================
-   !!                       ***  MODULE  taumod  ***
-   !! Ocean forcing : stress at the the ocean surface
-   !!=====================================================================
-
-   !!----------------------------------------------------------------------
-   !!   tau          : define the surface stress for the ocean
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE dom_oce         ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE in_out_manager  ! I/O manager
-   USE daymod          ! calendar
-   USE lbclnk          ! 
-
-#if defined key_oasis3 || defined key_oasis4
-   USE geo2ocean, only : repcmo
-   USE ice, only       : frld       ! : leads fraction = 1-a/totalarea
-#if defined key_oasis3
-   USE cpl_oasis3      ! OASIS3 coupling (to ECHAM5)
-#elif defined key_oasis4
-   USE cpl_oasis4      ! OASIS4 coupling (to ECHAM5)
-#endif
-#endif
-   IMPLICIT NONE
-   PRIVATE
-
-   !! * Routine accessibility
-   PUBLIC tau                ! routine called by step.F90
-
-  !! * Share modules variables
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &
-      taux, tauy,      &  !: surface stress components in (i,j) referential
-#if defined key_lim3
-      tauxw, tauyw,    &  !: surface wind stress components in (i,j) referential
-      slotx, sloty,    &  !: time-slope for surface windstress in (i,j) referential
-      tauxg, tauyg        !: surface stress components in geographical
-      !                   !  referential (used in output)
-#endif
-
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-#if defined key_tau_monthly
-   ! Monthly climatology in (i,j) referential  (i-comp. at U-pt and j-comp. at V-pt)
-   !!----------------------------------------------------------------------
-   !!   'key_tau_monthly'                        MONTHLY climatology stress
-   !!   default case                                   NetCDF files
-   !!----------------------------------------------------------------------
-#   include "tau_forced_monthly.h90"
-
-# elif defined key_tau_daily
-   !!----------------------------------------------------------------------
-   !!   'key_tau_daily'                                 DAILY stress
-   !!                                                   NetCDF files
-   !!----------------------------------------------------------------------
-   ! Daily climatology/interannual in (i,j) referential  (i-comp. at U-pt and j-comp. at V-pt)
-#   include "tau_forced_daily.h90"
-
-#elif defined key_oasis3  ||  defined key_oasis4
-   ! Coupled case : stress at the coupling frequency
-   !!----------------------------------------------------------------------
-   !!   'key_oasis3' or 'key_oasis4' and           Coupled Ocean/Atmosphere
-   !!   'key_lim3'or 'key_lim2'                              LIM sea-ice
-   !!----------------------------------------------------------------------
-   ! New way: 3D referential link to the earth (avoid north pole pb)
-   ! (3 component stress defined at U- and V-points)
-#  include "tau_oasis_ice.h90"
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option                                     constant forcing
-   !!----------------------------------------------------------------------
-   !! * local modules variables
-   INTEGER  ::       & !!! * Namelist numtau *
-      ntau000 = 1       ! nb of time-step during which the surface stress
-      !                 ! increase from 0 to its nominal value (taudta) (>0)
-   REAL(wp) ::       & !!! * Namelist numtau *
-      tau0x = 0.e0 , &  ! constant wind stress value in i-direction
-      tau0y = 0.e0      ! constant wind stress value in j-direction
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE tau( kt )
-      !!---------------------------------------------------------------------
-      !!                    ***  ROUTINE tau  ***
-      !! 
-      !! ** Purpose :   provide the ocean surface stress at each time step
-      !!
-      !! ** Method  :   Constant surface stress increasing from 0 to taudta 
-      !!      value during the first ntau000 time-step (namelist)
-      !!        CAUTION: never mask the surface stress field !
-      !!
-      !! ** Action  : - update taux , tauy the stress in (i,j) ref.
-      !!
-      !! History :
-      !!   4.0  !  91-03  (G. Madec)  Original code
-      !!   8.5  !  02-11  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      INTEGER, INTENT( in  ) ::   kt    ! ocean time step
-      REAL(wp) ::   ztau, ztau_sais, &  ! wind intensity and of the seasonal cycle
-         ztime,                      &  ! time in hour
-         ztimemax, ztimemin,         &  ! 21th June, and 21th decem. if date0 = 1st january
-         ztaun                          ! intensity 
-      INTEGER  ::   ji, jj              ! dummy loop indices
-
-      INTEGER  ::           &
-         zyear0,            &           ! initial year
-         zmonth0,           &           ! initial month
-         zday0,             &           ! initial day
-         zday_year0                    ! initial day since january 1st
-        
-
-      !! * Local declarations
-      REAL(wp) ::   zfacto              ! 
-
-      NAMELIST/namtau/ ntau000, tau0x, tau0y
-      !!---------------------------------------------------------------------
-
-      IF( cp_cfg == 'gyre' ) THEN
-
-         zyear0  = ndate0 / 10000                             ! initial year
-         zmonth0 = ( ndate0 - zyear0 * 10000 ) / 100          ! initial month
-         zday0   = ndate0 - zyear0 * 10000 - zmonth0 * 100    ! initial day betwen 1 and 30
-
-         zday_year0 = (zmonth0-1)*30.+zday0                   ! initial day betwen 1 and 360
-
-         ! current day (in hours) since january the 1st of the current year
-          ztime = FLOAT( kt ) * rdt / (rmmss * rhhmm)  &    !  total incrementation (in hours)
-             &     - (nyear  - 1) * rjjhh * raajj           !  minus years since beginning of experiment (in hours)
-
-
-        ! 21th june at 24h in hours
-         ztimemax = ((5.*30.)+21.)* 24.
-         ! 21th december day in hours
-         ! rjjhh * raajj / 4 = 1 seasonal cycle in hours
-         ztimemin = ztimemax + rjjhh * raajj / 2  
-
-         ! mean intensity at 0.105/srqt(2) because projected with 45deg angle
-         ztau = 0.105 / SQRT(2.)            
-         ! seasonal oscillation intensity
-         ztau_sais = 0.015                  
-         ztaun = ztau - ztau_sais * COS( (ztime - ztimemax) / (ztimemin - ztimemax) * rpi )
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-              ! domain from 15deg to 50deg and 1/2 period along 14deg 
-              ! so 5/4 of half period with seasonal cycle
-              taux (ji,jj) = - ztaun * SIN( rpi * (gphiu(ji,jj) - 15.) / (29.-15.) )
-              tauy (ji,jj) =   ztaun * SIN( rpi * (gphiv(ji,jj) - 15.) / (29.-15.) )
-            END DO
-         END DO
-   
-         IF( kt == nit000 .AND. lwp ) THEN
-            WRITE(numout,*)' tau    : analytical formulation for gyre'
-            WRITE(numout,*)' ~~~~~~~ '
-            WRITE(numout,*)'          nyear      = ', nyear
-            WRITE(numout,*)'          nmonth     = ', nmonth
-            WRITE(numout,*)'          nday       = ', nday
-            WRITE(numout,*)'          nday_year  = ',nday_year
-            WRITE(numout,*)'          ndastp     = ',ndastp
-            WRITE(numout,*)'          adatrj     = ',adatrj
-            WRITE(numout,*)'          ztime      = ',ztime
-            WRITE(numout,*)'          ztimemax   = ',ztimemax
-            WRITE(numout,*)'          ztimemin   = ',ztimemin
-            WRITE(numout,*)'          zyear0     = ', zyear0
-            WRITE(numout,*)'          zmonth0    = ', zmonth0
-            WRITE(numout,*)'          zday0      = ', zday0
-            WRITE(numout,*)'          zday_year0 = ',zday_year0
-            WRITE(numout,*)'          raajj      = ', raajj
-            WRITE(numout,*)'          ztau       = ', ztau
-            WRITE(numout,*)'          ztau_sais  = ', ztau_sais
-            WRITE(numout,*)'          ztaun      = ', ztaun
-         ENDIF
-   
-      ELSE
-
-         IF( kt == nit000 ) THEN
-   
-            ! Read Namelist namtau : surface wind stress
-            ! --------------------
-            REWIND ( numnam )
-            READ   ( numnam, namtau )
-   
-            IF(lwp) WRITE(numout,*)' '
-            IF(lwp) WRITE(numout,*)' tau     : Constant surface wind stress read in namelist'
-            IF(lwp) WRITE(numout,*)' ~~~~~~~ '
-            IF(lwp) WRITE(numout,*)'           Namelist namtau: set the constant stress values'
-            IF(lwp) WRITE(numout,*)'              spin up of the stress  ntau000 = ', ntau000, ' time-steps'
-            IF(lwp) WRITE(numout,*)'              constant i-stress      tau0x   = ', tau0x  , ' N/m2'
-            IF(lwp) WRITE(numout,*)'              constant j-stress      tau0y   = ', tau0y  , ' N/m2'
-   
-            ntau000 = MAX( ntau000, 1 )   ! must be >= 1
-   
-         ENDIF
-   
-         ! Increase the surface stress to its nominal value in ntau000 time-step
-         
-         IF( kt <= ntau000 ) THEN
-            zfacto = 0.5 * (  1. - COS( rpi * FLOAT( kt ) / FLOAT( ntau000 ) )  )
-            taux (:,:) = zfacto * tau0x
-            tauy (:,:) = zfacto * tau0y
-         ENDIF
-
-      ENDIF
-      
-   END SUBROUTINE tau
-#endif
-   !!======================================================================
-END MODULE taumod
Index: trunk/NEMO/OPA_SRC/TRA/traadv_cen2.F90
===================================================================
--- trunk/NEMO/OPA_SRC/TRA/traadv_cen2.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/TRA/traadv_cen2.F90	(revision 888)
@@ -1,11 +1,13 @@
 MODULE traadv_cen2
-   !!==============================================================================
-   !!                       ***  MODULE  traadv_cen2  ***
+   !!======================================================================
+   !!                     ***  MODULE  traadv_cen2  ***
    !! Ocean active tracers:  horizontal & vertical advective trend
-   !!==============================================================================
-   !! History :  8.2  !  01-08  (G. Madec, E. Durand)  trahad+trazad = traadv 
-   !!            8.5  !  02-06  (G. Madec)  F90: Free form and module
-   !!            9.0  !  05-11  (V. Garnier) Surface pressure gradient organization
-   !!            " "  !  06-04  (R. Benshila, G. Madec) Step reorganization
+   !!======================================================================
+   !! History :   8.2  !  01-08  (G. Madec, E. Durand)  trahad+trazad=traadv 
+   !!             8.5  !  02-06  (G. Madec)  F90: Free form and module
+   !!             9.0  !  04-08  (C. Talandier) New trends organization
+   !!             " "  !  05-11  (V. Garnier) Surface pressure gradient organization
+   !!             " "  !  06-04  (R. Benshila, G. Madec) Step reorganization
+   !!             " "  !  06-07  (G. madec)  add ups_orca_set routine
    !!----------------------------------------------------------------------
 
@@ -13,17 +15,21 @@
    !!   tra_adv_cen2 : update the tracer trend with the horizontal and
    !!                  vertical advection trends using a seconder order
+   !!   ups_orca_set : allow mixed upstream/centered scheme in specific
+   !!                  area (set for orca 2 and 4 only)
    !!----------------------------------------------------------------------
    USE oce             ! ocean dynamics and active tracers
    USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient
+   USE trdmod_oce      ! ocean variables trends
    USE trdmod          ! ocean active tracers trends 
-   USE trdmod_oce      ! ocean variables trends
-   USE flxrnf          !
+   USE closea          ! closed sea
    USE trabbl          ! advective term in the BBL
    USE ocfzpt          !
+   USE sbcrnf          ! river runoffs
+   USE in_out_manager  ! I/O manager
    USE lib_mpp
    USE lbclnk          ! ocean lateral boundary condition (or mpp link)
-   USE in_out_manager  ! I/O manager
    USE diaptr          ! poleward transport diagnostics
-   USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient
    USE prtctl          ! Print control
 
@@ -31,5 +37,9 @@
    PRIVATE
 
-   PUBLIC   tra_adv_cen2   ! routine called by step.F90
+   PUBLIC   tra_adv_cen2    ! routine called by step.F90
+   PUBLIC   ups_orca_set    ! routine used by traadv_cen2_jki.F90
+
+   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   upsmsk    !: mixed upstream/centered scheme near some straits 
+   !                                                   !  and in closed seas (orca 2 and 4 configurations)
 
    REAL(wp), DIMENSION(jpi,jpj) ::   btr2   ! inverse of T-point surface [1/(e1t*e2t)]
@@ -39,6 +49,6 @@
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -118,14 +128,13 @@
       !!
       INTEGER  ::   ji, jj, jk                           ! dummy loop indices
-      REAL(wp) ::                           &
-         zbtr, zta, zsa, zfui, zfvj,        &  ! temporary scalars
-         zhw, ze3tr, zcofi, zcofj,          &  !    "         "
-         zupsut, zupsvt, zupsus, zupsvs,    &  !    "         "
-         zfp_ui, zfp_vj, zfm_ui, zfm_vj,    &  !    "         "
-         zcofk, zupst, zupss, zcent,        &  !    "         "
-         zcens, zfp_w, zfm_w,               &  !    "         "
-         zcenut, zcenvt, zcenus, zcenvs,    &  !    "         "
-         z_hdivn_x, z_hdivn_y, z_hdivn
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zwz, ztrdt, zind   ! 3D workspace 
+      REAL(wp) ::   zta, zsa, zbtr, zhw, ze3tr,       &  ! temporary scalars
+         &          zfp_ui, zfp_vj, zfp_w , zfui  ,   &  !    "         "
+         &          zfm_ui, zfm_vj, zfm_w , zfvj  ,   &  !    "         "
+         &          zcofi , zcofj , zcofk ,           &  !    "         "
+         &          zupsut, zupsus, zcenut, zcenus,   &  !    "         "
+         &          zupsvt, zupsvs, zcenvt, zcenvs,   &  !    "         "
+         &          zupst , zupss , zcent , zcens ,   &  !    "         "
+         &          z_hdivn_x, z_hdivn_y, z_hdivn 
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zwz, ztrdt, zind   ! 3D workspace
       REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zww, ztrds         !  "      "
       !!----------------------------------------------------------------------
@@ -136,6 +145,10 @@
          IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~   Vector optimization case'
          IF(lwp) WRITE(numout,*)
-         ! 
-         btr2(:,:) = 1. / ( e1t(:,:) * e2t(:,:) )
+         !
+         upsmsk(:,:) = 0.e0                              ! not upstream by default
+         IF( cp_cfg == "orca" )   CALL ups_orca_set      ! set mixed Upstream/centered scheme near some straits
+         !                                               ! and in closed seas (orca2 and orca4 only)
+         !   
+         btr2(:,:) = 1. / ( e1t(:,:) * e2t(:,:) )        ! inverse of T-point surface
       ENDIF
 
@@ -145,10 +158,10 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               zind(ji,jj,jk) =  MAX ( upsrnfh(ji,jj) * upsrnfz(jk),     &  ! changing advection scheme near runoff
-                  &                    upsadv(ji,jj)                     &  ! in the vicinity of some straits
+               zind(ji,jj,jk) = MAX (   &
+                  rnfmsk(ji,jj) * rnfmsk_z(jk),      &  ! near runoff mouths (& closed sea outflows)
+                  upsmsk(ji,jj)                      &  ! some of some straits
 #if defined key_lim3 || defined key_lim2
-                  &                  , tmask(ji,jj,jk)                   &  ! half upstream tracer fluxes
-                  &                  * MAX( 0., SIGN( 1., fzptn(ji,jj)   &  ! if tn < ("freezing"+0.1 )
-                  &                                +0.1-tn(ji,jj,jk) ) ) &
+                  !                                     ! below ice covered area (if tn < "freezing"+0.1 )
+                  , MAX(  0., SIGN( 1., fzptn(ji,jj) + 0.1 - tn(ji,jj,jk) )  ) * tmask(ji,jj,jk)   &
 #endif
                   &                  )
@@ -157,7 +170,8 @@
       END DO
 
-
-      !  Horizontal advective fluxes
-      ! -----------------------------
+      ! I. Horizontal advective fluxes
+      ! ------------------------------
+      !  Second order centered tracer flux at u and v-points
+      ! -----------------------------------------------------
       !                                                ! ===============
       DO jk = 1, jpkm1                                 ! Horizontal slab
@@ -278,6 +292,6 @@
          &                       tab3d_2=sa, clinfo2=            ' Sa: ', mask2=tmask, clinfo3='tra' )
 
-      ! 4. "zonal" mean advective heat and salt transport 
-      ! -------------------------------------------------
+      ! "zonal" mean advective heat and salt transport 
+      ! ----------------------------------------------
 
       IF( ln_diaptr .AND. ( MOD( kt, nf_ptr ) == 0 ) ) THEN
@@ -312,5 +326,5 @@
       ENDIF
 
-      ! 1. Vertical advective fluxes
+      ! 1. Vertical advective fluxes 
       ! ----------------------------
       ! Second order centered tracer flux at w-point
@@ -386,4 +400,65 @@
       !
    END SUBROUTINE tra_adv_cen2
+   
+   
+   SUBROUTINE ups_orca_set
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE ups_orca_set  ***
+      !!       
+      !! ** Purpose :   add a portion of upstream scheme in area where the
+      !!                centered scheme generates too strong overshoot
+      !!
+      !! ** Method  :   orca (R4 and R2) confiiguration setting. Set upsmsk
+      !!                array to nozero value in some straith. 
+      !!
+      !! ** Action : - upsmsk set to 1 at some strait, 0 elsewhere for orca
+      !!----------------------------------------------------------------------
+      INTEGER  ::   ii0, ii1, ij0, ij1      ! temporary integers
+      !!----------------------------------------------------------------------
+      
+      ! mixed upstream/centered scheme near river mouths
+      ! ------------------------------------------------
+      SELECT CASE ( jp_cfg )
+      !                                        ! =======================
+      CASE ( 4 )                               !  ORCA_R4 configuration 
+         !                                     ! =======================
+         !                                          ! Gibraltar Strait
+         ii0 =  70   ;   ii1 =  71
+         ij0 =  52   ;   ij1 =  53   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
+         !
+         !                                     ! =======================
+      CASE ( 2 )                               !  ORCA_R2 configuration 
+         !                                     ! =======================
+         !                                          ! Gibraltar Strait
+         ij0 = 102   ;   ij1 = 102
+         ii0 = 138   ;   ii1 = 138   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.20
+         ii0 = 139   ;   ii1 = 139   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.40
+         ii0 = 140   ;   ii1 = 140   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
+         ij0 = 101   ;   ij1 = 102
+         ii0 = 141   ;   ii1 = 141   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
+         !                                          ! Bab el Mandeb Strait
+         ij0 =  87   ;   ij1 =  88
+         ii0 = 164   ;   ii1 = 164   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.10
+         ij0 =  88   ;   ij1 =  88
+         ii0 = 163   ;   ii1 = 163   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
+         ii0 = 162   ;   ii1 = 162   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.40
+         ii0 = 160   ;   ii1 = 161   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
+         ij0 =  89   ;   ij1 =  89
+         ii0 = 158   ;   ii1 = 160   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
+         ij0 =  90   ;   ij1 =  90
+         ii0 = 160   ;   ii1 = 160   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
+         !                                          ! Sound Strait
+         ij0 = 116   ;   ij1 = 116
+         ii0 = 144   ;   ii1 = 144   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
+         ii0 = 145   ;   ii1 = 147   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
+         ii0 = 148   ;   ii1 = 148   ;   upsmsk( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
+         !
+      END SELECT 
+      
+      ! mixed upstream/centered scheme over closed seas
+      ! -----------------------------------------------
+      CALL clo_ups( upsmsk(:,:) )
+      !
+   END SUBROUTINE ups_orca_set
 
    !!======================================================================
Index: trunk/NEMO/OPA_SRC/TRA/traadv_qck.F90
===================================================================
--- trunk/NEMO/OPA_SRC/TRA/traadv_qck.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/TRA/traadv_qck.F90	(revision 888)
@@ -14,14 +14,12 @@
    USE oce             ! ocean dynamics and active tracers
    USE dom_oce         ! ocean space and time domain
+   USE dynspg_oce      ! 
+   USE trdmod_oce      ! ocean variables trends
    USE trdmod          ! ocean active tracers trends 
-   USE trdmod_oce      ! ocean variables trends
-   USE flxrnf          !
    USE trabbl          ! advective term in the BBL
-   USE ocfzpt          !
    USE lib_mpp
    USE lbclnk          ! ocean lateral boundary condition (or mpp link)
    USE in_out_manager  ! I/O manager
    USE diaptr          ! poleward transport diagnostics
-   USE dynspg_oce      ! 
    USE prtctl          ! Print control
 
@@ -47,5 +45,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/TRA/tranxt.F90
===================================================================
--- trunk/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 888)
@@ -21,17 +21,16 @@
    USE dom_oce         ! ocean space and time domain variables 
    USE zdf_oce         ! ???
+   USE dynspg_oce      ! surface pressure gradient variables
+   USE trdmod_oce      ! ocean variables trends
+   USE trdmod          ! ocean active tracers trends 
+   USE phycst
+   USE domvvl          ! variable volume
+   USE obctra          ! open boundary condition (obc_tra routine)
    USE in_out_manager  ! I/O manager
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE obctra          ! open boundary condition (obc_tra routine)
-   USE trdmod          ! ocean active tracers trends 
-   USE trdmod_oce      ! ocean variables trends
    USE prtctl          ! Print control
    USE agrif_opa_update
    USE agrif_opa_interp
 
-   USE ocesbc          ! ocean surface boundary condition
-   USE domvvl          ! variable volume
-   USE dynspg_oce      ! surface pressure gradient variables
-   USE phycst
 
    IMPLICIT NONE
@@ -47,5 +46,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2006) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/TRA/tranxt.F90,v 1.12 2007/05/25 15:51:50 opalod Exp $ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/TRA/traqsr.F90
===================================================================
--- trunk/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 888)
@@ -17,9 +17,9 @@
    USE oce             ! ocean dynamics and active tracers
    USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE trc_oce         ! share SMS/Ocean variables
+   USE trdmod_oce      ! ocean variables trends
    USE trdmod          ! ocean active tracers trends 
-   USE trdmod_oce      ! ocean variables trends
    USE in_out_manager  ! I/O manager
-   USE trc_oce         ! share SMS/Ocean variables
-   USE ocesbc          ! thermohaline fluxes
    USE phycst          ! physical constants
    USE prtctl          ! Print control
@@ -46,5 +46,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/TRA/trasbc.F90
===================================================================
--- trunk/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 888)
@@ -13,6 +13,6 @@
    !!----------------------------------------------------------------------
    USE oce             ! ocean dynamics and active tracers
+   USE sbc_oce         ! surface boundary condition: ocean
    USE dom_oce         ! ocean space domain variables
-   USE ocesbc          ! surface thermohaline fluxes
    USE phycst          ! physical constant
    USE traqsr          ! solar radiation penetration
@@ -32,5 +32,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -132,9 +132,9 @@
 #endif
             IF( lk_vvl) THEN
-               zta = ro0cpr * ( qt(ji,jj) - qsr(ji,jj) ) * zse3t &   ! temperature : heat flux
+               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 = 0.e0                                            ! No salinity concent./dilut. effect
             ELSE
-               zta = ro0cpr * ( qt(ji,jj) - qsr(ji,jj) ) * zse3t     ! temperature : heat flux
+               zta = ro0cpr * qns(ji,jj) * zse3t     ! temperature : heat flux
                zsa = emps(ji,jj) * zsrau * sn(ji,jj,1)   * zse3t     ! salinity :  concent./dilut. effect
             ENDIF
Index: trunk/NEMO/OPA_SRC/TRA/trazdf.F90
===================================================================
--- trunk/NEMO/OPA_SRC/TRA/trazdf.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/TRA/trazdf.F90	(revision 888)
@@ -14,4 +14,6 @@
    USE dom_oce         ! ocean space and time domain variables 
    USE zdf_oce         ! ocean vertical physics variables
+   USE sbc_oce         ! surface boundary condition: ocean
+   USE dynspg_oce
 
    USE trazdf_exp      ! vertical diffusion: explicit (tra_zdf_exp     routine)
@@ -25,6 +27,4 @@
 
    USE phycst
-   USE dynspg_oce
-   USE ocesbc          ! ocean surface boundary condition
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE domvvl          ! variable volume
@@ -47,5 +47,5 @@
    !!----------------------------------------------------------------------
    !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/TRD/trdmod.F90
===================================================================
--- trunk/NEMO/OPA_SRC/TRD/trdmod.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/TRD/trdmod.F90	(revision 888)
@@ -12,5 +12,4 @@
    !!   trd_mod_init     : Initialization step
    !!----------------------------------------------------------------------
-   USE phycst                  ! physical constants
    USE oce                     ! ocean dynamics and tracers variables
    USE dom_oce                 ! ocean space and time domain variables
@@ -18,9 +17,10 @@
    USE trdmod_oce              ! ocean variables trends
    USE ldftra_oce              ! ocean active tracers lateral physics
+   USE sbc_oce                 ! surface boundary condition: ocean
+   USE phycst                  ! physical constants
    USE trdvor                  ! ocean vorticity trends 
    USE trdicp                  ! ocean bassin integral constraints properties
    USE trdmld                  ! ocean active mixed layer tracers trends 
    USE in_out_manager          ! I/O manager
-   USE taumod                  ! surface ocean stress
 
    IMPLICIT NONE
@@ -37,5 +37,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -124,6 +124,6 @@
                   DO ji = fs_2, fs_jpim1   ! vector opt.
                      ! save the surface forcing momentum fluxes
-                     ztswu(ji,jj) = taux(ji,jj) / ( fse3u(ji,jj,1)*rau0 )
-                     ztswv(ji,jj) = tauy(ji,jj) / ( fse3v(ji,jj,1)*rau0 )
+                     ztswu(ji,jj) = utau(ji,jj) / ( fse3u(ji,jj,1)*rau0 )
+                     ztswv(ji,jj) = vtau(ji,jj) / ( fse3v(ji,jj,1)*rau0 )
                      ! save bottom friction momentum fluxes
                      ikbu   = MIN( mbathy(ji+1,jj  ), mbathy(ji,jj) )
@@ -175,6 +175,6 @@
                DO ji = fs_2, fs_jpim1   ! vector opt.
                   ! save the surface forcing momentum fluxes
-                  ztswu(ji,jj) = taux(ji,jj) / ( fse3u(ji,jj,1)*rau0 )
-                  ztswv(ji,jj) = tauy(ji,jj) / ( fse3v(ji,jj,1)*rau0 )
+                  ztswu(ji,jj) = utau(ji,jj) / ( fse3u(ji,jj,1)*rau0 )
+                  ztswv(ji,jj) = vtau(ji,jj) / ( fse3v(ji,jj,1)*rau0 )
                   ! save bottom friction momentum fluxes
                   ikbu   = MIN( mbathy(ji+1,jj  ), mbathy(ji,jj) )
Index: trunk/NEMO/OPA_SRC/ZDF/zdfkpp.F90
===================================================================
--- trunk/NEMO/OPA_SRC/ZDF/zdfkpp.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/ZDF/zdfkpp.F90	(revision 888)
@@ -21,8 +21,7 @@
    USE dom_oce         ! ocean space and time domain
    USE zdf_oce         ! ocean vertical physics
+   USE sbc_oce         ! surface boundary condition: ocean
    USE phycst          ! physical constants
-   USE taumod          ! surface stress
    USE eosbn2          ! equation of state
-   USE ocesbc          ! thermohaline fluxes
    USE zdfddm          ! double diffusion mixing
    USE in_out_manager  ! I/O manager
@@ -148,5 +147,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL   (2005)
-   !! $Header$ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -460,7 +459,7 @@
             zBosol(ji,jj) = grav * zthermal * qsr(ji,jj)
             ! Non radiative surface buoyancy force
-            zBo   (ji,jj) = grav * zthermal * ( qt(ji,jj) - qsr(ji,jj) ) -  grav * zhalin * emp(ji,jj)
+            zBo   (ji,jj) = grav * zthermal * qns(ji,jj) -  grav * zhalin * emp(ji,jj)
             ! Surface Temperature flux for non-local term
-            wt0(ji,jj) = - qt(ji,jj) * ro0cpr * tmask(ji,jj,1)
+            wt0(ji,jj) = - ( qsr(ji,jj) + qns(ji,jj) )* ro0cpr * tmask(ji,jj,1)
             ! Surface salinity flux for non-local term
             ws0(ji,jj) = - ( emp(ji,jj) * sn(ji,jj,1) * rcs ) * tmask(ji,jj,1)
@@ -476,6 +475,6 @@
             zrhos         = rhop(ji,jj,1) + zflageos * rau0 * ( 1. - tmask(ji,jj,1) )  
             ! Friction velocity (zustar), at T-point : LMD94 eq. 2
-            ztx           = 0.5 * ( taux(ji,jj) + taux(ji - 1, jj    ) )
-            zty           = 0.5 * ( tauy(ji,jj) + tauy(ji    , jj - 1) )
+            ztx           = 0.5 * ( utau(ji,jj) + utau(ji - 1, jj    ) )
+            zty           = 0.5 * ( vtau(ji,jj) + vtau(ji    , jj - 1) )
             ztau          = SQRT( ztx * ztx + zty * zty )
             zustar(ji,jj) = SQRT( ztau / ( zrhos +  epsln ) )
Index: trunk/NEMO/OPA_SRC/ZDF/zdftke.F90
===================================================================
--- trunk/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 888)
@@ -31,6 +31,6 @@
    USE dom_oce         ! ocean space and time domain
    USE zdf_oce         ! ocean vertical physics
+   USE sbc_oce         ! surface boundary condition: ocean
    USE phycst          ! physical constants
-   USE taumod          ! surface stress
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE prtctl          ! Print control
@@ -79,5 +79,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2006) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/ZDF/zdftke.F90,v 1.16 2007/06/05 10:39:27 opalod Exp $ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -99,5 +99,5 @@
       !!                  - ediss / emxl en**(2/3)        ! dissipation
       !!      with the boundary conditions:
-      !!         surface: en = max( emin0,ebb sqrt(taux^2 + tauy^2) )
+      !!         surface: en = max( emin0,ebb sqrt(utau^2 + vtau^2) )
       !!         bottom : en = emin
       !!      -1- The dissipation and mixing turbulent lengh scales are computed
@@ -299,5 +299,5 @@
       ! 2. Surface boundary condition on tke and its eddy viscosity (zmxlm)
       ! -------------------------------------------------
-      ! en(1)   = ebb sqrt(taux^2+tauy^2) / rau0  (min value emin0)
+      ! en(1)   = ebb sqrt(utau^2+vtau^2) / rau0  (min value emin0)
       ! zmxlm(1) = avmb(1) and zmxlm(jpk) = 0.
 !CDIR NOVERRCHK
@@ -305,6 +305,6 @@
 !CDIR NOVERRCHK
          DO ji = fs_2, fs_jpim1   ! vector opt.
-            ztx2 = taux(ji-1,jj  ) + taux(ji,jj)
-            zty2 = tauy(ji  ,jj-1) + tauy(ji,jj)
+            ztx2 = utau(ji-1,jj  ) + utau(ji,jj)
+            zty2 = vtau(ji  ,jj-1) + vtau(ji,jj)
             zesurf = zbbrau * SQRT( ztx2 * ztx2 + zty2 * zty2 )
             en (ji,jj,1) = MAX( zesurf, emin0 ) * tmask(ji,jj,1)
Index: trunk/NEMO/OPA_SRC/cla.F90
===================================================================
--- trunk/NEMO/OPA_SRC/cla.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/cla.F90	(revision 888)
@@ -19,7 +19,7 @@
    USE oce             ! ocean dynamics and tracers variables
    USE dom_oce         ! ocean space and time domain variables 
+   USE sbc_oce         ! surface boundary condition: ocean
    USE in_out_manager  ! I/O manager
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE ocesbc          ! ocean surface boundary condition (fluxes)
    USE lib_mpp         ! distributed memory computing
 
@@ -48,5 +48,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/cla_div.F90
===================================================================
--- trunk/NEMO/OPA_SRC/cla_div.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/cla_div.F90	(revision 888)
@@ -18,6 +18,6 @@
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! surface boundary condition: ocean
    USE in_out_manager  ! I/O manager
-   USE ocesbc          ! ocean surface boundary condition (fluxes)
    USE lib_mpp         ! distributed memory computing library
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
@@ -45,5 +45,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/cla_dynspg.F90
===================================================================
--- trunk/NEMO/OPA_SRC/cla_dynspg.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/cla_dynspg.F90	(revision 888)
@@ -13,7 +13,6 @@
    USE obc_oce         ! Lateral open boundary condition
    USE sol_oce         ! solver variables
+   USE sbc_oce         ! surface boundary condition: ocean
    USE phycst          ! physical constants
-   USE ocesbc          ! ocean surface boundary condition (fluxes)
-   USE flxrnf          ! ocean runoffs
    USE solpcg          ! preconditionned conjugate gradient solver
    USE solsor          ! Successive Over-relaxation solver
@@ -36,5 +35,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/cpl.F90
===================================================================
--- trunk/NEMO/OPA_SRC/cpl.F90	(revision 873)
+++ 	(revision )
@@ -1,763 +1,0 @@
-MODULE cpl
-   !!======================================================================
-   !!                       ***  MODULE cpl  ***
-   !! Coupled O/A : coupled ocean-atmosphere case using OASIS
-   !!=====================================================================
-#if defined key_coupled
-   !!----------------------------------------------------------------------
-   !!   'key_coupled'                              coupled Ocean/Atmosphere
-   !!----------------------------------------------------------------------
-   !!   cpl_init     : initialization of coupled mode communication
-   !!   cpl_read     : read the coupled namelist
-   !!   cpl_stp      : exchange fields in coupled mode
-   !!----------------------------------------------------------------------
-   !! * Modules used
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE in_out_manager  ! I/O manager
-   USE cpl_oce         ! coupled exchange variables (???)
-   USE flx_oce         ! in case of ice 
-   USE ocfzpt          ! ocean freezing point
-   USE daymod          ! calendar
-
-   IMPLICIT NONE
-   PRIVATE
-
-   !! Routine accessibility
-   PUBLIC cpl_init     ! routine called in opa module
-   PUBLIC cpl_stp      ! routine called in step module
-   !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE cpl_init( kastp, kexch, kstep )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE cpl_init  ***
-      !!
-      !! ** Purpose :   Initialize coupled mode communication for ocean
-      !!    exchange process identifiers and timestep information
-      !!    between AGCM, OGCM and COUPLER. (OASIS software)
-      !!
-      !! ** Method  :  3 types :
-      !!      a) Use named pipes(FIFO) to exchange process identifiers
-      !!          between the 3 programs
-      !!      b) USE a messag passing method with PVM language (CLIM)
-      !!      c) USE SVIPC method
-      !!
-      !! ** Input   :   npiat     : agcm process identifier
-      !!                npicp     : coupler process identifier
-      !!                npioc     : ogcm process identifier
-      !!
-      !! Reference  :   see Epicoa 0803 (1992)
-      !!
-      !! History :
-      !!        !  92-09  (L. Terray)  Original code
-      !!        !  96-07  (L. Terray)  OASIS version 2
-      !!        !  96-11  (E. Guilyardi)  run-off + Taux,Tauy x2
-      !!        !  98-04  (M.A Foujols, S. Valcke, M. Imbard)  OASIS2.2
-      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      INTEGER, INTENT(in ) ::   &
-         kastp,      &  ! total number of timesteps in oceanic model
-         kexch,      &  ! frequency of exchange for the fluxes (in time steps)
-         kstep          ! timestep value (in seconds)
-
-      !! * Local declarations
-      INTEGER,DIMENSION(3)  :: iparal
-      INTEGER               :: ifcpl, idt, info, imxtag, istep
-
-      CHARACTER (len=9) ::   clpoolnam 
-      INTEGER           :: ipoolhandle, ipoolsize, jf
-      CHARACTER (len=3) ::   cljobnam      ! experiment name
-      INTEGER           :: ierror
-!      INTEGER,DIMENSION(4) ::  imess
-      INTEGER,DIMENSION(4) ::  imesso
-      !!----------------------------------------------------------------------
-     
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'cpl_init : initialization in coupled ocean/atmosphere case'
-      IF(lwp) WRITE(numout,*) '~~~~~~~~'
-      IF(lwp) WRITE(numout,*)
-     
-#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_forced_daily
-      CALL ctl_stop( 'key_coupled and key_flx_bulk_... are incompatible' )
-#endif
- 
-      CALL cpl_read           ! read the coupled mode information in namelist
-
-      CALL flush(numout)
-
-      ! I- PIPE
-      ! --------
-      ! W A R N I N G : PIPE technique is temporary diseable (nov. 2000)
-
-      IF( cchan == 'PIPE' ) THEN 
-
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'Making pipes for fields to receive from CPL'
-         IF(lwp) WRITE(numout,*)
-         CALL flush(numout)
-         ierror = 0
-
-         ! loop to define pipes (CPL=atmos to ocean)
-
-         DO jf = 1, nflxc2o  
-            ! CALL PIPE_Model_Define( numout, cpl_readflx(jf), jpread, info )
-            IF( info /= 0 ) ierror = ierror + 1
-         END DO
-         DO jf = 1, ntauc2o
-            ! CALL PIPE_Model_Define( numout, cpl_readtau(jf), jpread, info )
-            IF( info /= 0 ) ierror = ierror + 1
-         END DO
-         
-         IF(lwp) WRITE(numout,*) ' '
-         IF(lwp) WRITE(numout,*) 'Making pipes for fields to send to CPL'
-         IF(lwp) WRITE(numout,*) ' '
-         
-         ! loop to define pipes (ocean to atmos=CPL)
-
-         DO jf = 1, nfldo2c
-            ! CALL PIPE_Model_Define( numout, cpl_writ(jf), jpwrit, info )
-            IF( info /= 0 ) ierror = ierror + 1
-         END DO
-
-         IF( ierror /= 0 ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'cpl_init: end of job due to error in pipes definitions'
-            CALL abort('')
-         END IF
-         
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'All pipes have been made'
-         
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'Communication test between OCE and CPL'
-         CALL flush(numout)
-         
-         ! CALL PIPE_Model_Stepi(numout, imess, nmodcpl, imesso, ierror)
-         
-         IF( ierror /= 0 ) THEN
-            IF(lwp) WRITE(numout,*)
-            IF(lwp) WRITE(numout,*) 'cpl_init: end of job due to error in exchange first informations with Oasis'
-            CALL abort('')
-         END IF
-         
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'Communication test between OCE and CPL is OK'
-         IF(lwp) WRITE(numout,*) ' total simulation time in oasis = ',imesso(1)
-         IF(lwp) WRITE(numout,*) ' total number of iterations is  = ',imesso(2)
-         IF(lwp) WRITE(numout,*) ' value of oasis timestep  is    = ',imesso(3)
-         IF(lwp) WRITE(numout,*) ' process id for oasis  is       = ',imesso(4)
-         CALL flush(numout)
-         
-         ! II SVIPC
-         ! ---------
-         ! W A R N I N G : SVIPC technique is temporary diseable (nov. 2000)
-         
-         
-      ELSE IF( cchan == 'SIPC' ) THEN
-
-         ! debug for more information
-
-         ! CALL SVIPC_debug(1)
-
-         ! Define the experiment name :
-
-          cljobnam = 'IPC'      ! as $JOBNAM in namcouple
-
-          ! Attach to shared memory pool used to exchange initial infos 
-
-          info = 0
-          ! CALL SIPC_Init_Model (cljobnam, cplmodnam, 1, info)
-          IF( info /= 0 ) THEN 
-             IF(lwp) WRITE(numout,*)
-             IF(lwp) WRITE(numout,*)'WARNING: Problem with attachement to',info 
-             IF(lwp) WRITE(numout,*)'         initial memory pool(s) in ocean'
-             IF(lwp) WRITE(numout,*)
-             CALL abort('STOP in ocean')
-          ENDIF
-
-          ! Attach to pools used to exchange fields from ocean to coupler
-
-          DO jf = 1, nfldo2c
-             ! Pool name:
-             clpoolnam = 'P'//cpl_writ(jf)
-             ! CALL SIPC_Attach(clpoolnam, ipoolhandle)
-             ! Resulting pool handle:
-             mpoolwrit(jf) = ipoolhandle  
-          END DO
-
-          ! Attach to pools used to exchange fields from coupler to ocean
-          
-          DO jf = 1, nflxc2o
-             ! Pool name:
-             clpoolnam = 'P'//cpl_readflx(jf)
-             ! CALL SIPC_Attach(clpoolnam, ipoolhandle)
-             ! Resulting pool handle:
-             mpoolread(jf) = ipoolhandle  
-          END DO  
-
-          DO jf = 1, ntauc2o
-             ! Pool name:
-             clpoolnam = 'P'//cpl_readtau(jf)
-             ! CALL SIPC_Attach(clpoolnam, ipoolhandle)
-             ! Resulting pool handle:
-             mpoolread(jf+nflxc2o) = ipoolhandle  
-          END DO 
-
-          ! Exchange of initial infos
-
-          ! Write data array isend to pool READ by Oasis
-
-          info = 0
-          ipoolsize = 4*jpbyteint
-          ! CALL SVIPC_write(mpoolinitr, imess, ipoolsize, info)
-
-          ! Find error if any
-
-          IF( info < 0 ) THEN
-             IF(lwp) WRITE(numout,*)
-             IF(lwp) WRITE(numout,*) 'Problem in ocean in writing initial' 
-             IF(lwp) WRITE(numout,*) 'infos to the shared memory segment(s)'
-             IF(lwp) WRITE(numout,*)
-          ELSE
-             IF(lwp) WRITE(numout,*)
-             IF(lwp) WRITE(numout,*) 'Initial infos written in ocean'            
-             IF(lwp) WRITE(numout,*) 'to the shared memory segment(s)'
-             IF(lwp) WRITE(numout,*)
-          ENDIF
-
-          ! Read data array irecv from pool written by Oasis
-
-          info = 0
-          ipoolsize = 4 * jpbyteint
-          CALL svipc_read(mpoolinitw, imesso, ipoolsize, info)
-
-          ! Find error if any
-
-          IF( info < 0 ) THEN
-             IF(lwp) WRITE(numout,*) '   '
-             IF(lwp) WRITE(numout,*) 'Problem in ocean in reading initial' 
-             IF(lwp) WRITE(numout,*) 'infos from the shared memory segment(s)'
-             IF(lwp) WRITE(numout,*) '   '
-          ELSE
-             IF(lwp) WRITE(numout,*) '   '
-             IF(lwp) WRITE(numout,*) 'Initial infos read by ocean'                
-             IF(lwp) WRITE(numout,*) 'from the shared memory segment(s)'
-             IF(lwp) WRITE(numout,*) '   '
-             IF(lwp) WRITE(numout,*) ' ntime, niter, nstep, Oasis pid:'
-             IF(lwp) WRITE(numout,*) imesso(1), imesso(2), imesso(3), imesso(4) 
-          ENDIF
-
-          ! Detach from shared memory segment(s)
-
-          info = 0
-          ! CALL SVIPC_close(mpoolinitw, 0, info)
-          
-          ! Find error if any
-
-          IF( info < 0 ) THEN
-             IF(lwp) WRITE(numout,*) 'Problem in detaching from shared memory segment(s)'
-             IF(lwp) WRITE(numout,*) 'used by ocean to read initial infos' 
-          ENDIF
-
-          ! III CLIM
-          ! --------
-
-      ELSE IF( cchan == 'CLIM' ) THEN
-
-         ! Define the number of processors involved in the coupling for
-         ! Oasis (=1) and each model (as last two INTEGER on $CHATYPE line
-         ! in the namcouple); they will be stored in a COMMON in mpiclim.h
-         ! (used for CLIM/MPI2 only)
-         mpi_nproc(0)=1
-         mpi_nproc(1)=1
-         mpi_nproc(2)=1 
-
-         ! Define the number of processors used by each model as in
-         ! $CHATYPE line of namcouple (used for CLIM/MPI2 only)
-         mpi_totproc(1)=1
-         mpi_totproc(2)=1
-         
-         ! Define names of each model as in $NBMODEL line of namcouple
-         ! (used for CLIM/MPI2 only)
-         cmpi_modnam(1)='lmdz.x'
-         cmpi_modnam(2)=cplmodnam
-         !  
-         ! 1.1-Define the experiment name :
-         
-         cljobnam = 'CLI'      ! as $JOBNAM in namcouple
-         
-         OPEN ( UNIT = 7, FILE = 'trace', STATUS = 'unknown', FORM = 'formatted')
-         CALL clim_init ( cljobnam, cplmodnam, 3, 7,   &
-                          kastp, kexch, kstep,   &
-                          5, 3600, 3600, info )
-
-         IF( info /= clim_ok ) THEN
-            IF(lwp) WRITE( numout, *) 'cpl_init : pb init clim, error code is = ', info
-            CALL abort( 'STOP in cpl_init' )
-         ELSE
-            IF(lwp) WRITE(numout,*) 'cpl_init : init clim ok '
-         ENDIF
-         
-         iparal ( clim_strategy ) = clim_serial
-         iparal ( clim_length   ) = jpiglo*jpjglo
-         iparal ( clim_offset   ) = 0
-         
-         ! loop to define messages (CPL=atmos to ocean)
-         DO jf = 1, nflxc2o
-            CALL CLIM_Define ( cpl_readflx(jf), clim_in, clim_double, iparal, info )  
-         END DO
-         DO jf = 1, ntauc2o
-            CALL CLIM_Define ( cpl_readtau(jf), clim_in, clim_double, iparal, info )  
-         END DO
-         
-         ! loop to define messages (ocean to CPL=atmos)
-         DO jf = 1, nfldo2c
-            CALL CLIM_Define ( cpl_writ(jf), clim_out, clim_double, iparal, info )   
-         END DO
-         
-         IF(lwp) WRITE(numout,*) 'cpl_init : clim_define ok '
-         
-         CALL CLIM_Start( imxtag, info )
-         
-         IF( info /= clim_ok ) THEN
-            IF(lwp) WRITE(numout,*) 'cpl_init : pb start clim, error code is = ', info
-            CALL abort( 'stop in cpl_init' )
-         ELSE
-            IF(lwp) WRITE(numout,*) 'cpl_init : start clim ok '
-         ENDIF
-         
-         CALL CLIM_Stepi ( cploasis, istep, ifcpl, idt, info )
-
-         IF( info /= clim_ok ) THEN
-            IF(lwp) WRITE(numout,*) ' warning : problem in getting step info from oasis '
-            IF(lwp) WRITE(numout,*) ' =======   error code number = ', info
-         ELSE
-            IF(lwp) WRITE(numout,*) ' got step information from oasis '
-         ENDIF
-         IF(lwp) WRITE(numout,*) ' number of tstep in oasis ', istep
-         IF(lwp) WRITE(numout,*) ' exchange frequency in oasis ', ifcpl
-         IF(lwp) WRITE(numout,*) ' length of tstep in oasis ', idt
-      ENDIF
-
-   END SUBROUTINE cpl_init
-
-
-   SUBROUTINE cpl_read
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE cpl_read  ***
-      !!                    
-      !! ** Purpose :   Read and print options for the coupled run (namelist)
-      !!
-      !! ** Method  :   ???
-      !!
-      !! History :
-      !!   8.5  !  02-12  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * Local declarations
-      INTEGER :: jf
-
-      NAMELIST/namcpl/ nexco, cchan, nmodcpl, cplmodnam, cploasis   &
-          , nfldo2c, nflxc2o, ntauc2o, cpl_f_readflx, cpl_f_readtau   &
-          , cpl_f_writ, cpl_readflx, cpl_readtau, cpl_writ
-      !!----------------------------------------------------------------------
-      
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' cpl_read : read the coupled parameters in namelist'
-      IF(lwp) WRITE(numout,*) ' ~~~~~~~~'
-      IF(lwp) WRITE(numout,*)
-
-      ! Default values
-      
-      nexco = 24
-      cchan='PIPE'              ! echange TYPE
-      nmodcpl = 2
-      cplmodnam = 'opa.xx'      ! model name : as $NBMODEL in namcouple
-      cploasis = 'Oasis'        ! coupler name : as in coupler
-
-      ! -Define symbolic name for fields exchanged from ocean to coupler,
-      ! must be the same as (1) of the field  definition in namcouple:
-      nfldo2c=2
-      cpl_writ(1)='SOSSTSST'
-      cpl_writ(2)='SOICECOV'
-
-      ! -Define files name for fields exchanged from ocean to coupler,
-      ! must be the same as (6) of the field  definition in namcouple:
-      nflxc2o=6
-      cpl_readflx(1)='SONSFLDO' ! non solar heat flux (positif vers l'ocean)
-      cpl_readflx(2)='SOSHFLDO' ! solar flux
-      cpl_readflx(3)='SOTOPRSU' ! precip
-      cpl_readflx(4)='SOTFSHSU' ! evaporation
-      cpl_readflx(5)='SORUNCOA' ! coastal run-off
-      cpl_readflx(6)='SORIVFLU' ! river run-off
-      ntauc2o=2
-      cpl_readtau(1)='SOZOTAUX' ! first zonal wind stress
-      cpl_readtau(2)='SOZOTAU2' ! second zonal wind stress
-      cpl_readtau(3)='SOMETAUY' ! first meridien wind stress
-      cpl_readtau(4)='SOMETAU2' ! second meridien wind stress
-
-      ! -Define files name for fields exchanged from ocean to coupler,
-      ! must be the same as (6) of the field  definition in namcouple:
-      cpl_f_writ(1)='ocesst'
-      cpl_f_writ(2)='oceice'
-
-      ! -Define files name for fields exchanged from coupler to ocean
-      ! must be the same as (7) of the field  definition in namcouple:
-      cpl_f_readflx(1)='oceflx'
-      cpl_f_readflx(2)='oceflx'
-      cpl_f_readflx(3)='oceflx'
-      cpl_f_readflx(4)='oceflx'
-      cpl_f_readflx(5)='oceflx'
-      cpl_f_readflx(6)='oceflx'
-      cpl_f_readtau(1)='ocetau'
-      cpl_f_readtau(2)='ocetau'
-      cpl_f_readtau(3)='ocetau'
-      cpl_f_readtau(4)='ocetau'
-
-      ! Namelist namcpl : coupling mode and frequency
-      REWIND( numnam )
-      READ  ( numnam, namcpl )
-
-      IF(lwp) THEN
-         WRITE(numout,*) 'namcpl'
-         WRITE(numout,*) 
-         WRITE(numout,*) ' Coupling exchange frequency    nexco  = ',nexco
-         WRITE(numout,*) ' Coupling exchange technique    cchan  = ',cchan
-         WRITE(numout,*) ' Mode Coupling technique      nmodcpl  = ',nmodcpl
-         WRITE(numout,*) ' Define the model name      cplmodnam  = ',cplmodnam
-         WRITE(numout,*) ' Define the coupler name      cploasis = ',cploasis
-         WRITE(numout,*) ' Fields number ocean to coupler nfldo2c= ',nfldo2c
-         WRITE(numout,*) ' Flux fields coupler to ocean nflxc2o  = ',nflxc2o
-         WRITE(numout,*) ' Stress fields coupler to ocean ntauc2o= ',ntauc2o
-         IF ( cchan == 'PIPE' .OR.  cchan == 'pipe' ) THEN
-            cchan='PIPE'
-            WRITE(numout,*)'(communication between models made by pipes)'
-         ELSEIF( cchan == 'CLIM' .OR. cchan == 'clim' ) THEN
-            cchan='CLIM'
-            WRITE(numout,*)'(communication between models made by CLIM-PVM)'
-         ELSEIF( cchan == 'SIPC' .OR. cchan == 'sipc' ) THEN
-            cchan='SIPC'
-            WRITE(numout,*)'(communication between models made by the',  &
-               'Share Memory Segment and Semaphore)'
-         ELSE
-            WRITE(numout,*) 'technic not yet implemented ',cchan
-            STOP 'in cpl_read'
-         ENDIF
-         DO jf = 1, nflxc2o
-            WRITE(numout,*) 'file to receive field number = ',jf,'  ',cpl_f_readflx(jf) 
-         END DO
-         DO jf = 1, ntauc2o
-            WRITE(numout,*) 'file to receive field number = ',jf,'  ',cpl_f_readtau(jf) 
-         END DO
-         DO jf = 1, nfldo2c
-            WRITE(numout,*) 'file to send field number = ',jf,'  ',cpl_f_writ(jf)
-         END DO
-         WRITE(numout,*) ' fields received from coupler'
-         DO jf = 1, nflxc2o
-            WRITE(numout,*) 'symbolic name for field number = ',jf,'  ',cpl_readflx(jf) 
-         END DO
-         DO jf = 1, ntauc2o
-            WRITE(numout,*) 'symbolic name for field number = ',jf,'  ',cpl_readtau(jf) 
-         END DO
-         WRITE(numout,*) ' fields send to coupler'
-         DO jf = 1, nfldo2c
-            WRITE(numout,*) 'symbolic name for field number = ',jf,'  ',cpl_writ(jf)
-         END DO
-      ENDIF
-
-   END SUBROUTINE cpl_read
-
-
-   SUBROUTINE cpl_stp( kt )
-      !!---------------------------------------------------------------------
-      !!                  ***  ROUTINE cpl_stp  ***
-      !!                      *****************
-      !!                      * OASIS routine *
-      !!                      *****************
-      !! ** Purpose : - At each coupling time-step,this routine sends fields
-      !!      like sst or ice cover to the coupler.
-      !!              - At each time-step computes time average values 
-      !!              - Specific treatment for the last time-step
-      !!
-      !! ** Method  :   3 types available:
-      !!      a) Use named pipes(FIFO) to exchange process identifiers
-      !!         between the 3 programs
-      !!      b) USE a messag passing method with PVM language (CLIM)
-      !!      c) USE SVIPC method
-      !!
-      !! History :
-      !!        !  92-09 (L. Terray)  Original code
-      !!        !  96-07 (L. Terray)  OASIS version 2
-      !!        !  96-11 (E. Guilyardi)  run-off + Taux,Tauy x2
-      !!        !  98-04 (M.A Foujols, S. Valcke, M. Imbard)  OASIS2.2
-      !!   8.5  !  02-06  (G. Madec)  F90: Free form and module
-      !!----------------------------------------------------------------------
-      !! * modules used
-      USE ioipsl
-      USE phycst          ! physical constants
-
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt    ! ocean time-step
-
-      !! * Local declarations
-      INTEGER :: ji, jj, jn, jf           ! dummy loop indexes
-      INTEGER :: icstep, info, ierror, isize
-      INTEGER :: iflmax, iunmax
-      INTEGER :: ifile(jpmaxfld), ifield(jpmaxfld)
-      CHARACTER (len=8) ::  clfile(jpmaxfld) 
-      LOGICAL :: llfind
-      REAL(wp), DIMENSION(jpiglo,jpjglo) ::    &
-         zstoc, zieoc, zalboc, zticoc
-      
-      ! netcdf outputs
-       
-      CHARACTER (len=80) ::  clcplsnam
-      INTEGER, SAVE ::  nhoridcs, nidcs, ndexcs(1)
-      LOGICAL, SAVE :: lfirsts = .TRUE.
-      REAL(wp) ::    zjulian
-      
-      ! Additions for SVIPC
-      
-      INTEGER  :: index
-!      INTEGER, DIMENSION(3) :: infos
-      CHARACTER (len=3) ::  clmodinf       ! Header or not
-!      CHARACTER (len=3) ::  cljobnam      ! experiment name
-      !!----------------------------------------------------------------------
-
-      ! coupled mode Ocean/Atmosphere
-
-      ! 0. Initialization
-      ! -----------------
-
-      isize = jpiglo * jpjglo
-
-      ! First time step: ocean sst and ice sea-ice extend set to zero
-      IF( kt == nit000 ) THEN
-         sstoc(:,:) = 0.e0
-         sieoc(:,:) = 0.e0
-         alboc(:,:) = 0.e0
-         ticoc(:,:) = 0.e0
-
-         ! initialisation for netcdf outputs
-         ! 
-         ndexcs(:) = 0
-         clcplsnam = "cpl_oce_sst"
-
-         ! Compute julian date from starting date of the run
-         CALL ymds2ju( nyear, nmonth, nday, 0.e0, zjulian )
-         CALL histbeg(clcplsnam, jpiglo, glamt, jpjglo, gphit,   &
-            1, jpiglo, 1, jpjglo, 0,   &
-            zjulian, rdt, nhoridcs, nidcs, domain_id=nidom)
-         ! no vertical axis
-         DO jf = 1, nfldo2c
-            CALL histdef(nidcs, cpl_writ(jf),cpl_writ(jf),"-",jpi,    &
-               jpj, nhoridcs, 1, 1, 1, -99, 32, "inst", rdt, rdt)
-         END DO
-         CALL histend(nidcs)
-      ENDIF
-
-      ! 1. Cumulated sst and sea-ice extend
-      !------------------------------------
-
-      sstoc(:,:) = sstoc(:,:) + ( 1.0 - freeze(:,:) ) * ( tn(:,:,1) + rt0 )
-      sieoc(:,:) = sieoc(:,:) + freeze(:,:)
-
-#if defined key_lim3 || defined key_lim2
-      alboc(:,:) = alboc(:,:) + freeze(:,:) * alb_ice(:,:)
-      ticoc(:,:) = ticoc(:,:) + freeze(:,:) * tn_ice(:,:) 
-#else
-      alboc(:,:) = alboc(:,:) + freeze(:,:) * 0.8
-      ticoc(:,:) = ticoc(:,:) + freeze(:,:) * ( -10.e0 + rt0 )
-#endif
-
-
-      ! 2. Send coupling fields to OASIS
-      !---------------------------------
-
-      IF( MOD( kt, nexco ) == 0 ) THEN
-
-         ! 2.1 Average : mean coupling fields
-         zstoc (:,:) = 0.e0
-         zieoc (:,:) = 0.e0
-         zalboc(:,:) = 0.e0
-         zticoc(:,:) = 0.e0
-         DO jj = 1, nlcj
-            DO ji = 1, nlci
-               zstoc (mig(ji),mjg(jj)) = sstoc(ji,jj) / FLOAT( nexco )
-               zieoc (mig(ji),mjg(jj)) = sieoc(ji,jj) / FLOAT( nexco )
-               zalboc(mig(ji),mjg(jj)) = alboc(ji,jj) / FLOAT( nexco )
-               zticoc(mig(ji),mjg(jj)) = ticoc(ji,jj) / FLOAT( nexco )
-            END DO
-         END DO
-         icstep = kt - nit000 + 1
-
-         WRITE(numout,*)
-         WRITE(numout,*) 'STEP: Send fields to CPL with kt= ', kt
-         WRITE(numout,*)
-
-         ! outputs
-
-         CALL histwrite( nidcs, cpl_writ(1), kt, zstoc , jpi*jpj, ndexcs )
-         CALL histwrite( nidcs, cpl_writ(2), kt, zieoc , jpi*jpj, ndexcs )
-         CALL histwrite( nidcs, cpl_writ(3), kt, zalboc, jpi*jpj, ndexcs )
-         CALL histwrite( nidcs, cpl_writ(4), kt, zticoc, jpi*jpj, ndexcs )
-         CALL histsync ( nidcs )
-
-         ! 2.2 Last time step (clim or pipe) or pipe mode
-         ! 
-         IF( kt == nitend .OR. cchan == 'PIPE' ) THEN 
-
-            ! finalize outputs
-
-            CALL histclo( nidcs )
-
-            ! WRITE fields for coupler with pipe technique or for last time step
-
-            ! initialisation
-
-            iflmax =  1
-            iunmax = 99
-            
-            clfile(iflmax) = cpl_f_writ(iflmax)     ! keeps first file name
-            ifile(iflmax) = iunmax                  ! keeps first file unit
-            iunmax = iunmax - 1                     ! decrements file unit maximum
-            ifield(1) = ifile(iflmax)               ! keeps file unit for field
-
-            ! different files names counter
-            DO jf = 2, nfldo2c
-               llfind = .FALSE.
-               DO jn = 1, iflmax
-                  IF( .NOT. llfind ) THEN
-                     IF( cpl_f_writ(jf) == clfile(jn) ) THEN
-                        ifield(jf) = ifile(jn)      ! keep file unit for field
-                        llfind = .TRUE.
-                     ENDIF
-                  END IF
-               END DO
-               IF( .NOT. llfind) THEN
-                  iflmax = iflmax + 1               ! increment the number of different files
-                  clfile(iflmax) = cpl_f_writ(jf)   ! keep file name
-                  ifile (iflmax) = iunmax           ! keep file unit for file
-                  ifield(jf) = ifile(iflmax)        ! keep file unit for field
-                  iunmax = iunmax-1                 ! decrement unit maximum number from 99 to 98...
-               ENDIF
-            END DO
-            !          
-            DO jn = 1, iflmax 
-               OPEN (ifile(jn), FILE=clfile(jn), FORM='UNFORMATTED')
-            END DO
-            !              
-            DO jf = 1, nfldo2c
-               IF( jf == 1 ) CALL locwrite(cpl_writ(jf),zstoc , isize, ifield(jf), ierror, numout) 
-               IF( jf == 2 ) CALL locwrite(cpl_writ(jf),zieoc , isize, ifield(jf), ierror, numout) 
-               IF( jf == 3 ) CALL locwrite(cpl_writ(jf),zalboc, isize, ifield(jf), ierror, numout) 
-               IF( jf == 4 ) CALL locwrite(cpl_writ(jf),zticoc, isize, ifield(jf), ierror, numout) 
-            END DO
-
-            ! simulate a FLUSH
-
-            DO jn = 1, iflmax 
-               CLOSE( ifile(jn) )
-            END DO
-
-            ! Clim mode
-            IF( cchan == 'CLIM' ) THEN  ! inform PVM daemon, I have finished
-               CALL CLIM_Quit( CLIM_ContPvm, info )
-               IF( info /= CLIM_Ok ) THEN
-                  WRITE (6, *) 'An error occured while leaving CLIM. Error = ',info
-               ENDIF
-            ENDIF
-
-         ENDIF
-
-         ! IF last we have finished if not pass info to the atmosphere
-
-         IF ( kt /= nitend ) THEN
-
-            ! 2.3 normal exchange
-
-            ! PIPE mode      
-            IF( cchan == 'PIPE' ) THEN 
-
-               ! Send message to pipes for CPL=atmosphere
-
-               ! DO jf = 1, nfldo2c
-               !    CALL PIPE_Model_Send(cpl_writ(jf), icstep, numout)
-               ! END DO 
-
-               ! SIPC mode
-            ELSE IF( cchan == 'SIPC' ) THEN
-
-               ! Define IF a header must be encapsulated within the field brick :
-               clmodinf = 'NOT'  ! as $MODINFO in namcouple  
-
-               ! IF clmodinf = 'YES', define encapsulated infos to be exchanged
-               !    infos(1) = initial date
-               !    infos(2) = timestep
-               !    infos(3) = actual time
-               !
-               ! Writing of output field SST SOSSTSST
-               !
-               ! Index of SST in total number of fields jpfldo2a: 
-               index = 1
-               !
-               ! CALL SIPC_Write_Model(index, isize, clmodinf, cljobnam, infos, zstoc)
-               !
-               ! Writing of output field Sea-Ice SOICECOV 
-               !
-               ! Index of sea-ice in total number of fields jpfldo2a: 
-               index = 2
-               !
-               ! CALL SIPC_Write_Model(index, isize, clmodinf, cljobnam, infos, zieoc)
-   
-               ! CLIM mode
-            ELSE IF( cchan == 'CLIM' ) THEN
-   
-               DO jn = 1, nfldo2c
-   
-                  IF (jn == 1) CALL CLIM_Export(cpl_writ(jn), icstep, zstoc , info)
-                  IF (jn == 2) CALL CLIM_Export(cpl_writ(jn), icstep, zieoc , info)
-                  IF (jn == 3) CALL CLIM_Export(cpl_writ(jn), icstep, zalboc, info)
-                  IF (jn == 4) CALL CLIM_Export(cpl_writ(jn), icstep, zticoc, info)
-
-                  IF (info /= CLIM_Ok) THEN
-                     WRITE (numout,*) 'STEP : Pb giving', cpl_writ(jn), ':', jn
-                     WRITE (numout,*) ' at timestep = ', icstep, 'kt = ', kt
-                     WRITE (numout,*) 'Clim error code is = ',info
-                     WRITE (numout,*) 'STOP in stpcpl '
-                     CALL abort(' stpcpl ')
-                  ENDIF
-               END DO
-            ENDIF
-
-            ! reset cumulative sst and sea-ice extend to zero
-            sstoc(:,:) = 0.e0
-            sieoc(:,:) = 0.e0
-            alboc(:,:) = 0.e0
-            ticoc(:,:) = 0.e0
-         ENDIF
-      ENDIF
-
-   END SUBROUTINE cpl_stp
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default case           Dummy module         forced Ocean/Atmosphere
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE cpl_init            ! Dummy routine
-      WRITE(*,*) 'cpl_init: You should have not see this print! error?'
-   END SUBROUTINE cpl_init
-   SUBROUTINE cpl_stp( kt )       ! Dummy routine
-      WRITE(*,*) 'cpl_stp: You should have not see this print! error?', kt
-   END SUBROUTINE cpl_stp
-#endif
-
-   !!======================================================================
-END MODULE cpl
Index: trunk/NEMO/OPA_SRC/cpl_oce.F90
===================================================================
--- trunk/NEMO/OPA_SRC/cpl_oce.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/cpl_oce.F90	(revision 888)
@@ -16,5 +16,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
@@ -218,5 +218,5 @@
       qsrc           !: solar radiation (w m-2)
 
-#  if defined key_lim3 || defined key_lim3
+#  if defined key_lim3 || defined key_lim2
    REAL(wp), DIMENSION(jpi,jpj) ::   &  !:
       watm        ,    &  !:
Index: trunk/NEMO/OPA_SRC/daymod.F90
===================================================================
--- trunk/NEMO/OPA_SRC/daymod.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/daymod.F90	(revision 888)
@@ -4,9 +4,16 @@
    !! Ocean        :  calendar 
    !!=====================================================================
+   !! History :        !  94-09  (M. Pontaud M. Imbard)  Original code
+   !!                  !  97-03  (O. Marti)
+   !!                  !  97-05  (G. Madec) 
+   !!                  !  97-08  (M. Imbard)
+   !!             9.0  !  03-09  (G. Madec)  F90 + nyear, nmonth, nday
+   !!                  !  04-01  (A.M. Treguier) new calculation based on adatrj
+   !!                  !  06-08  (G. Madec)  surface module major update
+   !!----------------------------------------------------------------------      
 
    !!----------------------------------------------------------------------
    !!   day        : calendar
    !!----------------------------------------------------------------------
-   !! * Modules used
    USE dom_oce         ! ocean space and time domain
    USE phycst          ! physical constants
@@ -17,23 +24,33 @@
    PRIVATE
 
-   !! * Routine accessibility
    PUBLIC day        ! called by step.F90
 
-   !! * Shared module variables
-   INTEGER , PUBLIC ::   &  !:
-      nyear     ,   &  !: current year
-      nmonth    ,   &  !: current month
-      nday      ,   &  !: current day of the month
-      nday_year ,   &  !: curent day counted from jan 1st of the current year
-      ndastp           !: time step date in year/month/day aammjj
-   REAL(wp), PUBLIC ::   &  !:
-       adatrj   ,   &  !: number of elapsed days since the begining of the run
-       adatrj0         !: value of adatrj at nit000-1 (before the present run).
-       !               !  it is the accumulated duration of previous runs
-       !               !  that may have been run with different time steps.
-   !!----------------------------------------------------------------------
-   !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
+   INTEGER , PUBLIC ::   nyear       !: current year
+   INTEGER , PUBLIC ::   nmonth      !: current month
+   INTEGER , PUBLIC ::   nday        !: current day of the month
+   INTEGER , PUBLIC ::   nday_year   !: current day counted from jan 1st of the current year
+   REAL(wp), PUBLIC ::   rsec_year   !: current time step counted in second since 00h jan 1st of the current year
+   REAL(wp), PUBLIC ::   rsec_month  !: current time step counted in second since 00h 1st day of the current month
+   REAL(wp), PUBLIC ::   rsec_day    !: current time step counted in second since 00h         of the current day
+   INTEGER , PUBLIC ::   ndastp      !: time step date in year/month/day aammjj
+
+!!gm supprimer adatrj et adatrj0 ==> remplacer par rsecday.....
+   REAL(wp), PUBLIC ::   adatrj      !: number of elapsed days since the begining of the run
+   REAL(wp), PUBLIC ::   adatrj0     !: value of adatrj at nit000-1 (before the present run).
+   !                                 !  it is the accumulated duration of previous runs
+   !                                 !  that may have been run with different time steps.
+   INTEGER , PUBLIC, DIMENSION(0:13) ::   nmonth_len   !: length of the current year
+
+   INTEGER, PUBLIC, DIMENSION(12) ::   nbiss = (/ 31, 29, 31, 30, 31, 30,    &  !: number of days per month
+      &                                           31, 31, 30, 31, 30, 31 /)     !: (leap-year)
+   INTEGER, PUBLIC, DIMENSION(12) ::   nobis = (/ 31, 28, 31, 30, 31, 30,    &  !: number of days per month
+      &                                           31, 31, 30, 31, 30, 31 /)     !: (365 days a year)
+
+   REAL(wp), PUBLIC, DIMENSION(0:14) ::   rmonth_half(0:14)
+
+   !!----------------------------------------------------------------------
+   !!  OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $Id$
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -54,21 +71,10 @@
       !!              - ndastp    : =nyear*10000+nmonth*100+nday
       !!              - adatrj    : date in days since the beginning of the run
-      !!
-      !! History :
-      !!        !  94-09  (M. Pontaud M. Imbard)  Original code
-      !!        !  97-03  (O. Marti)
-      !!        !  97-05  (G. Madec) 
-      !!        !  97-08  (M. Imbard)
-      !!   9.0  !  03-09  (G. Madec)  F90 + nyear, nmonth, nday
-      !!        !  04-01  (A.M. Treguier) new calculation based on adatrj
+      !!              - rsec_year : current time of the year (in second since 00h, jan 1st)
       !!----------------------------------------------------------------------      
-      !! * Arguments
-      INTEGER, INTENT( in ) ::   kt      ! ocean time-step indices
-
-      !! * Local declarations
-      INTEGER  ::   js                   ! dummy loop indice
-      INTEGER  ::   iend, iday0, iday1   ! temporary integers
-      REAL(wp) :: zadatrjn, zadatrjb     ! adatrj at timestep kt-1 and kt-2 
-      CHARACTER (len=25) :: charout
+      INTEGER, INTENT(in) ::   kt        ! ocean time-step indices
+      !
+      INTEGER  ::   js, jm               ! dummy loop indice
+      CHARACTER (len=25) ::   charout
       !!----------------------------------------------------------------------
 
@@ -77,85 +83,115 @@
       !-----------------------------------------------------------------
 
-      IF( kt == nit000 ) THEN
-
+      !                        ! ---------------- !
+      IF( kt == -1 ) THEN      !  Initialisation  !
+         !                     ! ---------------- !
+         !
          IF( .NOT.ln_rstart )   adatrj0 = 0.e0      ! adatrj0 initialized in rst_read when restart 
 
-         adatrj  = adatrj0
+         ! set the calandar from adatrj0 and ndastp (read in restart file and namelist)
+         adatrj  =   adatrj0      !???? bug.... toujours rest   !!gm
          nyear   =   ndastp / 10000
          nmonth  = ( ndastp - (nyear * 10000) ) / 100
          nday    =   ndastp - (nyear * 10000) - ( nmonth * 100 ) 
 
-         ! Calculates nday_year, day since january 1st (useful to read  daily forcing fields)
+         ! length of the month of the current year (from nleapy, read in namelist)
+         nmonth_len(0) = nbiss(12)   ;   nmonth_len(13) = nbiss(1)
+         SELECT CASE( nleapy )
+         CASE( 1  )   
+            IF( MOD( nyear, 4 ) == 0 ) THEN
+               ;          nmonth_len(1:12) = nbiss(:)      ! 366 days per year (leap year)
+            ELSE
+               ;          nmonth_len(1:12) = nobis(:)      ! 365 days per year
+            ENDIF
+         CASE( 0  )   ;   nmonth_len(1:12) = nobis(:)      ! 365 days per year
+         CASE( 2: )   ;   nmonth_len(1:13) = nleapy        ! 12*nleapy days per year
+         END SELECT
+
+         ! half month in second since the bigining of the year
+         rmonth_half(0) = - 0.5 * rday * REAL( nmonth_len( 0 ) )
+         DO jm = 1, 12
+            rmonth_half(jm) = rmonth_half(jm-1) + 0.5 * rday * REAL( nmonth_len(jm-1) + nmonth_len(jm) )
+         END DO
+         rmonth_half(13) = rmonth_half( 1 ) + 365. * rday
+         rmonth_half(14) = rmonth_half( 2 ) + 365. * rday
+
+         ! day since january 1st (useful to read  daily forcing fields)
          nday_year =  nday
-         !                               ! accumulates days of previous months of this year
-         DO js = 1, nmonth-1
-            IF( nleapy == 1 .AND. MOD( nyear, 4 ) == 0 ) THEN
-               nday_year = nday_year + nbiss(js)
-            ELSE
-               nday_year = nday_year + nobis(js)
+         DO js = 1, nmonth - 1             ! accumulates days of previous months of this year
+            nday_year = nday_year + nmonth_len(js)
+         END DO
+
+         ! number of seconds since...
+         IF( ln_rstart )   THEN
+            rsec_year  = REAL( nday_year ) * rday     - rdttra(1)      ! 00h 1st day of the current year
+            rsec_month = REAL( nday      ) * rday     - rdttra(1)      ! 00h 1st day of the current month
+            rsec_day   = REAL( nday      ) * rday     - rdttra(1)      ! 00h         of the current day
+         ELSE
+            rsec_year  = REAL( nday_year - 1 ) * rday - rdttra(1)      ! 00h 1st day of the current year
+            rsec_month = REAL( nday      - 1 ) * rday - rdttra(1)      ! 00h 1st day of the current month
+            rsec_day   =                              - rdttra(1)      ! 00h         of the current day
+         ENDIF
+
+         ! control print
+         IF(lwp) WRITE(numout,*)' ==============>> time-step =', kt, ' Initial DATE Y/M/D = ',   &
+               &                   nyear, '/', nmonth, '/', nday, '  rsec_day:', rsec_day
+
+         !                     ! -------------------------------- ! 
+      ELSE                     !  Model calendar at time-step kt  !
+         !                     ! -------------------------------- ! 
+
+         rsec_year  = rsec_year  + rdttra(1)                 ! New time-step
+         rsec_month = rsec_month + rdttra(1)                 ! New time-step
+         rsec_day   = rsec_day   + rdttra(1)                 ! New time-step
+
+         adatrj    = adatrj0 + ( kt - nit000 + 1 ) * rdttra(1) / rday
+
+         IF( rsec_day >= rday ) THEN
+            !
+            rsec_day  = 0.e0                               ! NEW day
+            nday      = nday + 1
+            nday_year = nday_year + 1
+            !
+            IF( nday == nmonth_len(nmonth) + 1 ) THEN      ! NEW month
+               nday  = 1
+               rsec_month = 0.e0   
+               nmonth = nmonth + 1
+               IF( nmonth == 13 ) THEN                     ! NEW year
+                  nyear     = nyear + 1
+                  nmonth    = 1
+                  nday_year = 1
+                  rsec_year = 0.e0
+                  !                                        ! update the length of the month
+                  IF( nleapy == 1 ) THEN                   ! of the current year (if necessary)
+                     IF( MOD( nyear, 4 ) == 0 ) THEN
+                        nmonth_len(1:12) = nbiss(:)              ! 366 days per year (leap year)
+                     ELSE
+                        nmonth_len(1:12) = nobis(:)              ! 365 days per year
+                     ENDIF
+                     ! half month in second since the bigining of the year
+                     rmonth_half(0) = - 0.5 * rday * REAL( nmonth_len( 0 ) )
+                     DO jm = 1, 12
+                        rmonth_half(jm) = rmonth_half(jm-1) + 0.5 * rday * REAL( nmonth_len(jm-1) + nmonth_len(jm) )
+                     END DO
+                     rmonth_half(13) = rmonth_half( 1 ) + 365. * rday
+                     rmonth_half(14) = rmonth_half( 2 ) + 365. * rday
+                  ENDIF
+               ENDIF
             ENDIF
-         END DO
-
-      ENDIF
-
-      ! I.  calculates adatrj, zadatrjn, zadatrjb.
-      ! ------------------------------------------------------------------
-
-      adatrj    = adatrj0 + ( kt - nit000 + 1 ) * rdttra(1) / rday
-      zadatrjn  = adatrj0 + ( kt - nit000     ) * rdttra(1) / rday
-      zadatrjb  = adatrj0 + ( kt - nit000 - 1 ) * rdttra(1) / rday
-
-
-      ! II.  increment the date.  The date corresponds to 'now' variables (kt-1),
-      !      which is the time step of forcing fields. 
-      !      Do not do this at nit000  unless nrstdt= 2
-      !      In that case ndastp (read in restart) was for step nit000-2
-      ! -------------------------------------------------------------------
-
-      iday0 = INT( zadatrjb )
-      iday1 = INT( zadatrjn )
-
-      IF( iday1 - iday0 >= 1 .AND. ( kt /= nit000 .OR. nrstdt == 2 ) ) THEN
-
-         ! increase calendar
-         nyear  =   ndastp / 10000
-         nmonth = ( ndastp - (nyear * 10000) ) / 100
-         nday   =   ndastp - (nyear * 10000) - ( nmonth * 100 ) 
-         nday = nday + 1
-         IF( nleapy == 1 .AND. MOD( nyear, 4 ) == 0 ) THEN
-            iend = nbiss(nmonth)
-         ELSEIF( nleapy > 1 ) THEN 
-            iend = nleapy
-         ELSE 
-            iend = nobis(nmonth)
+
+            !
+            ndastp = nyear * 10000 + nmonth * 100 + nday   ! NEW date
+            !
+           IF(lwp) WRITE(numout,'(a,i8,a,i4,a,i2,a,i2,a,i3)') '======>> time-step =', kt,   &
+              &   '      New day, DATE Y/M/D = ', nyear, '/', nmonth, '/', nday, '      nday_year = ', nday_year
+           IF(lwp) WRITE(numout,'(a,F9.0,a,F9.0,a,F9.0)') '         rsec_year = ', rsec_year,   &
+              &   '   rsec_month = ', rsec_month, '   rsec_day = ', rsec_day
          ENDIF
-         IF( nday == iend + 1 ) THEN
-            nday  = 1
-            nmonth = nmonth + 1
-            IF( nmonth == 13 ) THEN
-               nmonth  = 1
-               nyear = nyear + 1
-            ENDIF
+
+         IF(ln_ctl) THEN
+            WRITE(charout,FMT="('kt =', I4,'  d/m/y =',I2,I2,I4)") kt, nday, nmonth, nyear
+            CALL prt_ctl_info(charout)
          ENDIF
-         ndastp = nyear * 10000 + nmonth * 100 + nday
-
-         ! Calculates nday_year, day since january 1st (useful to read  daily forcing fields)
-         nday_year =  nday
-         !                                ! accumulates days of previous months of this year
-         DO js = 1, nmonth-1
-            IF( nleapy == 1 .AND. MOD( nyear, 4 ) == 0 ) THEN
-               nday_year = nday_year + nbiss(js)
-            ELSE
-               nday_year = nday_year + nobis(js)
-            ENDIF
-         END DO
-
-         IF(lwp) WRITE(numout,*)' ==============>> time-step =', kt, ' New day, DATE= ',   &
-            &                   nyear, '/', nmonth, '/', nday, 'nday_year:', nday_year
-      ENDIF
-
-      IF(ln_ctl) THEN
-         WRITE(charout,FMT="('kt =', I4,'  d/m/y =',I2,I2,I4)") kt, nday, nmonth, nyear
-         CALL prt_ctl_info(charout, itime=kt)
+         !
       ENDIF
 
Index: trunk/NEMO/OPA_SRC/eosbn2.F90
===================================================================
--- trunk/NEMO/OPA_SRC/eosbn2.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/eosbn2.F90	(revision 888)
@@ -5,4 +5,17 @@
    !!                                               - Brunt-Vaisala frequency 
    !!==============================================================================
+   !! History :       !  89-03  (O. Marti)  Original code
+   !!            6.0  !  94-07  (G. Madec, M. Imbard)  add bn2
+   !!            6.0  !  94-08  (G. Madec)  Add Jackett & McDougall eos
+   !!            7.0  !  96-01  (G. Madec)  statement function for e3
+   !!            8.1  !  97-07  (G. Madec)  introduction of neos, OPA8.1
+   !!            8.1  !  97-07  (G. Madec)  density instead of volumic mass
+   !!                 !  99-02  (G. Madec, N. Grima) semi-implicit pressure gradient
+   !!                 !  01-09  (M. Ben Jelloul)  bugfix onlinear eos
+   !!            8.5  !  02-10  (G. Madec)  add eos_init
+   !!            8.5  !  02-11  (G. Madec, A. Bozec)  partial step, eos_insitu_2d
+   !!            9.0  !  03-08  (G. Madec)  F90, free form
+   !!            9.0  !  06-08  (G. Madec)  add tfreez function
+   !!----------------------------------------------------------------------
 
    !!----------------------------------------------------------------------
@@ -13,7 +26,7 @@
    !!   eos_insitu_2d  : Compute the in situ density for 2d fields
    !!   eos_bn2        : Compute the Brunt-Vaisala frequency
+   !!   tfreez         : Compute the surface freezing temperature
    !!   eos_init       : set eos parameters (namelist)
    !!----------------------------------------------------------------------
-   !! * Modules used
    USE dom_oce         ! ocean space and time domain
    USE phycst          ! physical constants
@@ -33,30 +46,28 @@
    END INTERFACE 
 
-   !! * Routine accessibility
-   PUBLIC eos        ! called by step.F90, inidtr.F90, tranpc.F90 and intgrd.F90
-   PUBLIC bn2        ! called by step.F90
-   PUBLIC eos_init   ! called by step.F90
-
-   !! * Share module variables
-   INTEGER , PUBLIC ::   &  !: nameos : ocean physical parameters
-      neos      = 0,     &  !: = 0/1/2 type of eq. of state and Brunt-Vaisala frequ.
-      neos_init = 0         !: control flag for initialization
-
-   REAL(wp), PUBLIC ::   &  !: nameos : ocean physical parameters
-      ralpha = 2.0e-4,   &  !: thermal expension coeff. (linear equation of state)
-      rbeta  = 7.7e-4       !: saline  expension coeff. (linear equation of state)
+   PUBLIC   eos        ! called by step, istate, tranpc and zpsgrd modules
+   PUBLIC   bn2        ! called by step module
+   PUBLIC   tfreez     ! called by sbcice_... modules
+
+   !!* Namelist (nameos)
+   INTEGER , PUBLIC ::   neos   = 0        !: = 0/1/2 type of eq. of state and Brunt-Vaisala frequ.
+   REAL(wp), PUBLIC ::   ralpha = 2.0e-4   !: thermal expension coeff. (linear equation of state)
+   REAL(wp), PUBLIC ::   rbeta  = 7.7e-4   !: saline  expension coeff. (linear equation of state)
+   NAMELIST/nameos/ neos, ralpha, rbeta
    
+   INTEGER ::   neos_init = 0         !: control flag for initialization
+
    !! * Substitutions
 #  include "domzgr_substitute.h90"
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !!   OPA 9.0 , LOCEAN-IPSL (2006) 
+   !! $Id$
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
 CONTAINS
 
-   SUBROUTINE eos_insitu ( ptem, psal, prd )
+   SUBROUTINE eos_insitu( ptem, psal, prd )
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE eos_insitu  ***
@@ -92,24 +103,10 @@
       !! ** Action  :   compute prd , the in situ density (no units)
       !!
-      !! References :
-      !!      Jackett, D.R., and T.J. McDougall. J. Atmos. Ocean. Tech., 1994
-      !!
-      !! History :
-      !!        !  89-03 (o. Marti)  Original code
-      !!        ! 94-08 (G. Madec)
-      !!        !  96-01 (G. Madec) statement function for e3
-      !!        !  97-07 (G. Madec) introduction of neos, OPA8.1
-      !!        !  97-07 (G. Madec) density instead of volumic mass
-      !!        !  99-02 (G. Madec, N. Grima) semi-implicit pressure gradient
-      !!        !  01-09 (M. Ben Jelloul) bugfix   
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( in ) ::   &
-         ptem,                 &  ! potential temperature
-         psal                     ! salinity
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( out ) ::   &
-         prd                      ! potential density (surface referenced)
-
-      !! * Local declarations
+      !! References :   Jackett and McDougall, J. Atmos. Ocean. Tech., 1994
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   ptem   ! potential temperature  [Celcius]
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   psal   ! salinity               [psu]
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(  out) ::   prd    ! in situ density 
+      !!
       INTEGER ::  ji, jj, jk      ! dummy loop indices
       REAL(wp) ::   &          
@@ -119,20 +116,15 @@
          zd , zc , zaw, za ,   &  !    "         "
          zb1, za1, zkw, zk0       !    "         "
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   &
-         zws                      ! temporary workspace
-      !!----------------------------------------------------------------------
-
-
-      ! initialization (in not already done)
-      IF( neos_init == 0 ) CALL eos_init
-
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zws   ! temporary workspace
+      !!----------------------------------------------------------------------
+
+      IF( neos_init == 0 ) CALL eos_init      ! initialization (in not already done)
 
       SELECT CASE ( neos )
-
+      !
       CASE ( 0 )               ! Jackett and McDougall (1994) formulation
-
+         !
 !CDIR NOVERRCHK
          zws(:,:,:) = SQRT( ABS( psal(:,:,:) ) )
-
          !                                                ! ===============
          DO jk = 1, jpkm1                                 ! Horizontal slab
@@ -181,8 +173,7 @@
          END DO                                           !   End of slab
          !                                                ! ===============
-
-
+         !
       CASE ( 1 )               ! Linear formulation function of temperature only
-
+         !
          !                                                ! ===============
          DO jk = 1, jpkm1                                 ! Horizontal slab
@@ -199,8 +190,7 @@
          END DO                                           !   End of slab
          !                                                ! ===============
-
-
+         !
       CASE ( 2 )               ! Linear formulation function of temperature and salinity
-
+         !
          !                                                ! ===============
          DO jk = 1, jpkm1                                 ! Horizontal slab
@@ -217,20 +207,18 @@
          END DO                                           !   End of slab
          !                                                ! ===============
-
+         !
       CASE DEFAULT
-
+         !
          WRITE(ctmp1,*) '          bad flag value for neos = ', neos
          CALL ctl_stop( ctmp1 )
-
+         !
       END SELECT
-
-      IF(ln_ctl)   THEN
-         CALL prt_ctl(tab3d_1=prd, clinfo1=' eos  : ', ovlap=1, kdim=jpk)
-      ENDIF
-
+      !
+      IF(ln_ctl)   CALL prt_ctl(tab3d_1=prd, clinfo1=' eos  : ', ovlap=1, kdim=jpk)
+      !
    END SUBROUTINE eos_insitu
 
 
-   SUBROUTINE eos_insitu_pot ( ptem, psal, prd, prhop)
+   SUBROUTINE eos_insitu_pot( ptem, psal, prd, prhop )
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE eos_insitu_pot  ***
@@ -275,45 +263,27 @@
       !!              - prhop, the potential volumic mass (Kg/m3)
       !!
-      !! References :
-      !!      Jackett, D.R., and T.J. McDougall. J. Atmos. Ocean. Tech., 1994
-      !!      Brown, J. A. and K. A. Campana. Mon. Weather Rev., 1978
-      !!
-      !! History :
-      !!   4.0  !  89-03  (O. Marti)
-      !!        !  94-08  (G. Madec)
-      !!        !  96-01  (G. Madec) statement function for e3
-      !!        !  97-07  (G. Madec) introduction of neos, OPA8.1
-      !!        !  97-07  (G. Madec) density instead of volumic mass
-      !!        !  99-02  (G. Madec, N. Grima) semi-implicit pressure gradient
-      !!        !  01-09  (M. Ben Jelloul) bugfix   
-      !!   9.0  !  03-08  (G. Madec)  F90, free form
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( in ) ::   &
-         ptem,   &  ! potential temperature
-         psal       ! salinity
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( out ) ::   &
-         prd,    &  ! potential density (surface referenced)
-         prhop      ! potential density (surface referenced)
-
-      !! * Local declarations
+      !! References :   Jackett and McDougall, J. Atmos. Ocean. Tech., 1994
+      !!                Brown and Campana, Mon. Weather Rev., 1978
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   ptem   ! potential temperature  [Celcius]
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   psal   ! salinity               [psu]
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(  out) ::   prd    ! in situ density 
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(  out) ::   prhop  ! potential density (surface referenced)
+
       INTEGER  ::  ji, jj, jk                ! dummy loop indices
       REAL(wp) ::   &             ! temporary scalars
          zt, zs, zh, zsr, zr1, zr2, zr3, zr4, zrhop, ze, zbw,   &
          zb, zd, zc, zaw, za, zb1, za1, zkw, zk0
-      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zws
-      !!----------------------------------------------------------------------
-
-      ! initialization (in not already done)
-      IF( neos_init == 0 ) CALL eos_init
-
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zws
+      !!----------------------------------------------------------------------
+
+      IF( neos_init == 0 ) CALL eos_init      ! initialization (in not already done)
 
       SELECT CASE ( neos )
-
+      !
       CASE ( 0 )               ! Jackett and McDougall (1994) formulation
-
+         !
 !CDIR NOVERRCHK
          zws(:,:,:) = SQRT( ABS( psal(:,:,:) ) )
-
          !                                                ! ===============
          DO jk = 1, jpkm1                                 ! Horizontal slab
@@ -326,5 +296,4 @@
                   zh = fsdept(ji,jj,jk)
                   ! square root salinity
-!!Edmee           zsr= SQRT( ABS( zs ) )
                   zsr= zws(ji,jj,jk)
                   ! compute volumic mass pure water at atm pressure
@@ -366,8 +335,7 @@
          END DO                                           !   End of slab
          !                                                ! ===============
-
-
+         !
       CASE ( 1 )               ! Linear formulation function of temperature only
-
+         !
          !                                                ! ===============
          DO jk = 1, jpkm1                                 ! Horizontal slab
@@ -385,8 +353,7 @@
          END DO                                           !   End of slab
          !                                                ! ===============
-
-
+         !
       CASE ( 2 )               ! Linear formulation function of temperature and salinity
-
+         !
          !                                                ! ===============
          DO jk = 1, jpkm1                                 ! Horizontal slab
@@ -404,19 +371,18 @@
          END DO                                           !   End of slab
          !                                                ! ===============
-
+         !
       CASE DEFAULT
-
+         !
          WRITE(ctmp1,*) '          bad flag value for neos = ', neos
          CALL ctl_stop( ctmp1 )
-
+         !
       END SELECT
-
-      IF(ln_ctl)   THEN
-         CALL prt_ctl(tab3d_1=prd, clinfo1=' eos-p: ', tab3d_2=prhop, clinfo2=' pot : ', ovlap=1, kdim=jpk)
-      ENDIF
-
+      !
+      IF(ln_ctl)   CALL prt_ctl( tab3d_1=prd, clinfo1=' eos-p: ', tab3d_2=prhop, clinfo2=' pot : ', ovlap=1, kdim=jpk )
+      !
    END SUBROUTINE eos_insitu_pot
 
-   SUBROUTINE eos_insitu_2d ( ptem, psal, pdep, prd )
+
+   SUBROUTINE eos_insitu_2d( ptem, psal, pdep, prd )
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE eos_insitu_2d  ***
@@ -452,37 +418,27 @@
       !! ** Action  : - prd , the in situ density (no units)
       !!
-      !! References :
-      !!      Jackett, D.R., and T.J. McDougall. J. Atmos. Ocean. Tech., 1994
-      !!
-      !! History :
-      !!   8.5  !  02-11  (G. Madec, A. Bozec)  partial step
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      REAL(wp), DIMENSION(jpi,jpj), INTENT( in ) ::   &
-         ptem,                           &  ! potential temperature
-         psal,                           &  ! salinity
-         pdep                               ! depth
-      REAL(wp), DIMENSION(jpi,jpj), INTENT( out ) ::   &
-         prd                                ! potential density (surface referenced)
-
-      !! * Local declarations
-      INTEGER ::  ji, jj                    ! dummy loop indices
+      !! References :   Jackett and McDougall, J. Atmos. Ocean. Tech., 1994
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) ::   ptem   ! potential temperature  [Celcius]
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) ::   psal   ! salinity               [psu]
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) ::   pdep   ! depth                  [m]
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(  out) ::   prd    ! in situ density 
+      !!
+      INTEGER  ::  ji, jj                    ! dummy loop indices
       REAL(wp) ::   &             ! temporary scalars
          zt, zs, zh, zsr, zr1, zr2, zr3, zr4, zrhop, ze, zbw,   &
          zb, zd, zc, zaw, za, zb1, za1, zkw, zk0,               &
          zmask
-      REAL(wp), DIMENSION(jpi,jpj) :: zws
-      !!----------------------------------------------------------------------
-
-
-      ! initialization (in not already done)
-      IF( neos_init == 0 ) CALL eos_init
+      REAL(wp), DIMENSION(jpi,jpj) ::   zws
+      !!----------------------------------------------------------------------
+
+      IF( neos_init == 0 ) CALL eos_init      ! initialization (in not already done)
 
       prd(:,:) = 0.e0
 
       SELECT CASE ( neos )
-
+      !
       CASE ( 0 )               ! Jackett and McDougall (1994) formulation
-
+      !
 !CDIR NOVERRCHK
          DO jj = 1, jpjm1
@@ -492,10 +448,8 @@
             END DO
          END DO
-
          !                                                ! ===============
          DO jj = 1, jpjm1                                 ! Horizontal slab
             !                                             ! ===============
             DO ji = 1, fs_jpim1   ! vector opt.
-
                zmask = tmask(ji,jj,1)      ! land/sea bottom mask = surf. mask
 
@@ -535,13 +489,12 @@
                ! masked in situ density anomaly
                prd(ji,jj) = ( zrhop / (  1.0 - zh / ( zk0 - zh * ( za - zh * zb ) )  ) - rau0 )   &
-                          / rau0 * zmask
-            END DO
-            !                                             ! ===============
-         END DO                                           !   End of slab
-         !                                                ! ===============
-
-
+                  &       / rau0 * zmask
+            END DO
+            !                                             ! ===============
+         END DO                                           !   End of slab
+         !                                                ! ===============
+         !
       CASE ( 1 )               ! Linear formulation function of temperature only
-
+         !
          !                                                ! ===============
          DO jj = 1, jpjm1                                 ! Horizontal slab
@@ -553,8 +506,7 @@
          END DO                                           !   End of slab
          !                                                ! ===============
-
-
+         !
       CASE ( 2 )               ! Linear formulation function of temperature and salinity
-
+         !
          !                                                ! ===============
          DO jj = 1, jpjm1                                 ! Horizontal slab
@@ -566,14 +518,14 @@
          END DO                                           !   End of slab
          !                                                ! ===============
-
+         !
       CASE DEFAULT
-
+         !
          WRITE(ctmp1,*) '          bad flag value for neos = ', neos
          CALL ctl_stop( ctmp1 )
-
+         !
       END SELECT
 
-      IF(ln_ctl)   CALL prt_ctl(tab2d_1=prd, clinfo1=' eos2d: ')
-
+      IF(ln_ctl)   CALL prt_ctl( tab2d_1=prd, clinfo1=' eos2d: ' )
+      !
    END SUBROUTINE eos_insitu_2d
 
@@ -607,31 +559,17 @@
       !! ** Action  : - pn2 : the brunt-vaisala frequency
       !!
-      !! References :
-      !!      McDougall, T. J., J. Phys. Oceanogr., 17, 1950-1964, 1987.
-      !!
-      !! History :
-      !!   6.0  !  94-07  (G. Madec, M. Imbard)  Original code
-      !!   8.0  !  97-07  (G. Madec) introduction of statement functions
-      !!   8.5  !  02-07  (G. Madec) Free form, F90
-      !!   8.5  !  02-08  (G. Madec) introduction of arguments
-      !!----------------------------------------------------------------------
-      !! * Arguments
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( in ) ::   &
-         ptem,                           &  ! potential temperature
-         psal                               ! salinity
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( out ) ::   &
-         pn2                               ! Brunt-Vaisala frequency
-
-      !! * Local declarations
+      !! References :   McDougall, J. Phys. Oceanogr., 17, 1950-1964, 1987.
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   ptem   ! potential temperature   [Celcius]
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   psal   ! salinity                [psu]
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(  out) ::   pn2    ! Brunt-Vaisala frequency [s-1]
+
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
-      REAL(wp) ::   &
-         zgde3w, zt, zs, zh,  &  ! temporary scalars 
-         zalbet, zbeta           !    "         "
+      REAL(wp) ::   zgde3w, zt, zs, zh,  &  ! temporary scalars 
+         &          zalbet, zbeta           !    "         "
 #if defined key_zdfddm
       REAL(wp) ::   zds          ! temporary scalars
 #endif
       !!----------------------------------------------------------------------
-      !!  OPA8.5, LODYC-IPSL (2002)
-      !!----------------------------------------------------------------------
 
       ! pn2 : first and last levels
@@ -644,7 +582,7 @@
 
       SELECT CASE ( neos )
-
+      !
       CASE ( 0 )               ! Jackett and McDougall (1994) formulation
-
+         !
          !                                                ! ===============
          DO jk = 2, jpkm1                                 ! Horizontal slab
@@ -696,8 +634,7 @@
          END DO                                           !   End of slab
          !                                                ! ===============
-
-
+         !
       CASE ( 1 )               ! Linear formulation function of temperature only
-
+         !
          !                                                ! ===============
          DO jk = 2, jpkm1                                 ! Horizontal slab
@@ -712,8 +649,7 @@
          END DO                                           !   End of slab
          !                                                ! ===============
-
-
+         !
       CASE ( 2 )               ! Linear formulation function of temperature and salinity
-
+         !
          !                                                ! ===============
          DO jk = 2, jpkm1                                 ! Horizontal slab
@@ -740,22 +676,40 @@
          END DO                                           !   End of slab
          !                                                ! ===============
-
+         !
       CASE DEFAULT
-
+         !
          WRITE(ctmp1,*) '          bad flag value for neos = ', neos
          CALL ctl_stop( ctmp1 )
-
+         !
       END SELECT
 
-      IF(ln_ctl)   THEN
-         CALL prt_ctl(tab3d_1=pn2, clinfo1=' bn2  : ', ovlap=1, kdim=jpk)
+      IF(ln_ctl)   CALL prt_ctl(tab3d_1=pn2, clinfo1=' bn2  : ', ovlap=1, kdim=jpk)
 #if defined key_zdfddm
-         CALL prt_ctl(tab3d_1=rrau, clinfo1=' rrau : ', ovlap=1, kdim=jpk)
+      IF(ln_ctl)   CALL prt_ctl(tab3d_1=rrau, clinfo1=' rrau : ', ovlap=1, kdim=jpk)
 #endif
-      ENDIF
-
+      !
    END SUBROUTINE eos_bn2
 
 
+   FUNCTION tfreez( psal ) RESULT( ptf )
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE eos_init  ***
+      !!
+      !! ** Purpose :   Compute the sea surface freezing temperature [Celcius]
+      !!
+      !! ** Method  :   UNESCO freezing point at the surface (pressure = 0???)
+      !!       freezing point [Celcius]=(-.0575+1.710523e-3*sqrt(abs(s))-2.154996e-4*s)*s-7.53e-4*p
+      !!       checkvalue: tf= -2.588567 Celsius for s=40.0psu, p=500. decibars
+      !!
+      !! Reference  :   UNESCO tech. papers in the marine science no. 28. 1978
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) ::   psal   ! salinity             [psu]
+      REAL(wp), DIMENSION(jpi,jpj)                ::   ptf    ! freezing temperature [Celcius]
+      !!----------------------------------------------------------------------
+      ptf(:,:) = ( - 0.0575 + 1.710523e-3 * SQRT( psal(:,:) )   &
+         &                  - 2.154996e-4 *       psal(:,:)   ) * psal(:,:)
+   END FUNCTION tfreez
+
+
    SUBROUTINE eos_init
       !!----------------------------------------------------------------------
@@ -764,23 +718,10 @@
       !! ** Purpose :   initializations for the equation of state
       !!
-      !! ** Method  :   Read the namelist nameos
-      !!
-      !! ** Action  :   blahblah....
-      !!
-      !! History :
-      !!   8.5  !  02-10  (G. Madec)  Original code
-      !!----------------------------------------------------------------------
-      NAMELIST/nameos/ neos, ralpha, rbeta
-      !!----------------------------------------------------------------------
-      !!  OPA 8.5, LODYC-IPSL (2002)
-      !!----------------------------------------------------------------------
-
-      ! set the initialization flag to 1
-      neos_init = 1           ! indicate that the initialization has been done
-
-      ! namelist nameos : ocean physical parameters
-
-      ! Read Namelist nameos : equation of state
-      REWIND( numnam )
+      !! ** Method  :   Read the namelist nameos and control the parameters
+      !!----------------------------------------------------------------------
+
+      neos_init = 1               ! indicate that the initialization has been done
+
+      REWIND( numnam )            ! Read Namelist nameos : equation of state
       READ  ( numnam, nameos )
 
@@ -791,9 +732,7 @@
          WRITE(numout,*) '~~~~~~~~'
          WRITE(numout,*) '          Namelist nameos : set eos parameters'
-         WRITE(numout,*)
          WRITE(numout,*) '             flag for eq. of state and N^2  neos   = ', neos
          WRITE(numout,*) '             thermal exp. coef. (linear)    ralpha = ', ralpha
          WRITE(numout,*) '             saline  exp. coef. (linear)    rbeta  = ', rbeta
-         WRITE(numout,*)
       ENDIF
 
@@ -801,23 +740,21 @@
 
       CASE ( 0 )               ! Jackett and McDougall (1994) formulation
-
+         IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) '          use of Jackett & McDougall (1994) equation of state and'
          IF(lwp) WRITE(numout,*) '                 McDougall (1987) Brunt-Vaisala frequency'
-
+         !
       CASE ( 1 )               ! Linear formulation function of temperature only
-
+         IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) '          use of linear eos rho(T) = rau0 * ( 1.0285 - ralpha * T )'
          IF( lk_zdfddm ) CALL ctl_stop( '          double diffusive mixing parameterization requires',   &
               &                         ' that T and S are used as state variables' )
-
+         !
       CASE ( 2 )               ! Linear formulation function of temperature and salinity
-
+         IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) '          use of linear eos rho(T,S) = rau0 * ( rbeta * S - ralpha * T )'
-
-      CASE DEFAULT
-
+         !
+      CASE DEFAULT             ! E R R O R in neos 
          WRITE(ctmp1,*) '          bad flag value for neos = ', neos
          CALL ctl_stop( ctmp1 )
-
       END SELECT
 
Index: trunk/NEMO/OPA_SRC/ice_oce.F90
===================================================================
--- trunk/NEMO/OPA_SRC/ice_oce.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/ice_oce.F90	(revision 888)
@@ -8,14 +8,13 @@
    !!----------------------------------------------------------------------
    !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header$ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
-#if defined key_lim2 || defined key_lim3
+#if defined key_lim3 || defined key_lim2
    !!----------------------------------------------------------------------
-   !!   'key_lim2 or key_lim3 '   :             LIM 2.0 or 3.0 ice model
+   !!   'key_lim2' or 'key_lim3'   :               LIM 2.0 or 3.0 ice model
    !!----------------------------------------------------------------------
    !! * Modules used
    USE par_oce         ! ocean parameters
-   USE blk_oce         ! bulk parameters
 
    IMPLICIT NONE
@@ -47,12 +46,4 @@
 # endif
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !: field exchanges with ice model to ocean
-      sst_io, sss_io , &  !: sea surface temperature (C) and salinity (PSU)
-      u_io  , v_io   , &  !: velocity at ice surface (m/s)
-      fsolar, fnsolar, &  !: solar and non-solar heat fluxes (W/m2)
-      fsalt , fmass  , &  !: salt and freshwater fluxes
-      ftaux , ftauy  , &  !: wind stresses
-      gtaux , gtauy       !: wind stresses
-
 # if defined key_lim3
    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !: field exchanges with ice model to ocean
@@ -68,5 +59,5 @@
 #else
    !!----------------------------------------------------------------------
-   !!   Default option                                 NO LIM sea-ice model
+   !!   Default option                      NO LIM 2.0 or 3.0 sea-ice model
    !!----------------------------------------------------------------------
    LOGICAL, PUBLIC, PARAMETER ::   lk_lim2        = .FALSE.  !: No LIM 2.0 ice model
@@ -74,7 +65,4 @@
 #endif
 
-   INTEGER, PUBLIC ::   &  !: namdom : space/time domain (namlist)
-      nfice =  5           !: coupling frequency OPA ICELLN  nfice 
-
    !!----------------------------------------------------------------------
 END MODULE ice_oce
Index: trunk/NEMO/OPA_SRC/istate.F90
===================================================================
--- trunk/NEMO/OPA_SRC/istate.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/istate.F90	(revision 888)
@@ -55,5 +55,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2006) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/istate.F90,v 1.20 2007/06/06 20:25:36 opalod Exp $ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -81,4 +81,5 @@
          neuler = 1                              ! Set time-step indicator at nit000 (leap-frog)
          CALL rst_read                           ! Read the restart file
+         CALL day( -1 )                          ! model calendar (using both namelist and restart infos)
       ELSE
          !                                    ! Start from rest
@@ -86,4 +87,5 @@
          neuler = 0                              ! Set time-step indicator at nit000 (euler forward)
          adatrj = 0._wp
+         CALL day( -1 )                          ! model calendar (using namelist infos)
          numror = 0                              ! define numror = 0 -> no restart file to read
          !                                       ! Initialization of ocean to zero
Index: trunk/NEMO/OPA_SRC/lbclnk.F90
===================================================================
--- trunk/NEMO/OPA_SRC/lbclnk.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/lbclnk.F90	(revision 888)
@@ -93,5 +93,5 @@
       !!----------------------------------------------------------------------
       !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-      !! $Header$ 
+      !! $Id$
       !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
       !!----------------------------------------------------------------------
@@ -329,5 +329,5 @@
 
 
-   SUBROUTINE lbc_lnk_3d( pt3d, cd_type, psgn, cd_mpp )
+   SUBROUTINE lbc_lnk_3d( pt3d, cd_type, psgn, cd_mpp, pval )
       !!---------------------------------------------------------------------
       !!                  ***  ROUTINE lbc_lnk_3d  ***
@@ -355,15 +355,24 @@
       CHARACTER(len=3), INTENT( in ), OPTIONAL ::    &
          cd_mpp        ! fill the overlap area only (here do nothing)
+      REAL(wp)        , INTENT(in   ), OPTIONAL           ::   pval      ! background value (used at closed boundaries)
 
       !! * Local declarations
       INTEGER  ::   ji, jk
       INTEGER  ::   ijt, iju
+      REAL(wp) ::   zland
       !!----------------------------------------------------------------------
       !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-      !! $Header$ 
+      !! $Id$
       !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
       !!----------------------------------------------------------------------
 
-      IF (PRESENT(cd_mpp)) THEN
+      IF( PRESENT( pval ) ) THEN      ! set land value (zero by default)
+         zland = pval
+      ELSE
+         zland = 0.e0
+      ENDIF
+
+
+      IF( PRESENT( cd_mpp ) ) THEN
          ! only fill the overlap area and extra allows 
          ! this is in mpp case. In this module, just do nothing
@@ -385,8 +394,8 @@
             SELECT CASE ( cd_type )
             CASE ( 'T' , 'U' , 'V' , 'W' )             ! T-, U-, V-, W-points
-               pt3d( 1 ,:,jk) = 0.e0
-               pt3d(jpi,:,jk) = 0.e0
-            CASE ( 'F' )                               ! F-point
-               pt3d(jpi,:,jk) = 0.e0
+               pt3d( 1 ,:,jk) = zland
+               pt3d(jpi,:,jk) = zland
+            CASE ( 'F' )                               ! F-point
+               pt3d(jpi,:,jk) = zland
             END SELECT
 
@@ -402,14 +411,14 @@
             CASE ( 'T' , 'U' , 'W' )                   ! T-, U-, W-points
                pt3d(:, 1 ,jk) = pt3d(:,3,jk)
-               pt3d(:,jpj,jk) = 0.e0
+               pt3d(:,jpj,jk) = zland
             CASE ( 'V' , 'F' )                         ! V-, F-points
                pt3d(:, 1 ,jk) = psgn * pt3d(:,2,jk)
-               pt3d(:,jpj,jk) = 0.e0
+               pt3d(:,jpj,jk) = zland
             END SELECT
 
          CASE ( 3 , 4 )                        ! *  North fold  T-point pivot
 
-!            pt3d( 1 ,jpj,jk) = 0.e0
-!            pt3d(jpi,jpj,jk) = 0.e0
+            pt3d( 1 ,jpj,jk) = zland
+            pt3d(jpi,jpj,jk) = zland
 
             SELECT CASE ( cd_type )
@@ -417,5 +426,5 @@
                DO ji = 2, jpi
                   ijt = jpi-ji+2
-                  pt3d(ji, 1 ,jk) = 0.e0
+                  pt3d(ji, 1 ,jk) = zland
                   pt3d(ji,jpj,jk) = psgn * pt3d(ijt,jpj-2,jk)
                END DO
@@ -427,5 +436,5 @@
                DO ji = 1, jpi-1
                   iju = jpi-ji+1
-                  pt3d(ji, 1 ,jk) = 0.e0
+                  pt3d(ji, 1 ,jk) = zland
                   pt3d(ji,jpj,jk) = psgn * pt3d(iju,jpj-2,jk)
                END DO
@@ -437,5 +446,5 @@
                   DO ji = 2, jpi
                      ijt = jpi-ji+2
-                     pt3d(ji,  1  ,jk) = 0.e0
+                     pt3d(ji,  1  ,jk) = zland
                      pt3d(ji,jpj-1,jk) = psgn * pt3d(ijt,jpj-2,jk)
                      pt3d(ji,jpj  ,jk) = psgn * pt3d(ijt,jpj-3,jk)
@@ -451,6 +460,6 @@
          CASE ( 5 , 6 )                        ! *  North fold  F-point pivot
 
-            pt3d( 1 ,jpj,jk) = 0.e0
-            pt3d(jpi,jpj,jk) = 0.e0
+            pt3d( 1 ,jpj,jk) = zland
+            pt3d(jpi,jpj,jk) = zland
 
             SELECT CASE ( cd_type )
@@ -458,5 +467,5 @@
                DO ji = 1, jpi
                   ijt = jpi-ji+1
-                  pt3d(ji, 1 ,jk) = 0.e0
+                  pt3d(ji, 1 ,jk) = zland
                   pt3d(ji,jpj,jk) = psgn * pt3d(ijt,jpj-1,jk)
                END DO
@@ -464,5 +473,5 @@
                   DO ji = 1, jpi-1
                      iju = jpi-ji
-                     pt3d(ji, 1 ,jk) = 0.e0
+                     pt3d(ji, 1 ,jk) = zland
                      pt3d(ji,jpj,jk) = psgn * pt3d(iju,jpj-1,jk)
                   END DO
@@ -470,5 +479,5 @@
                   DO ji = 1, jpi
                      ijt = jpi-ji+1
-                     pt3d(ji, 1 ,jk) = 0.e0
+                     pt3d(ji, 1 ,jk) = zland
                      pt3d(ji,jpj,jk) = psgn * pt3d(ijt,jpj-2,jk)
                   END DO
@@ -492,8 +501,8 @@
             SELECT CASE ( cd_type )
             CASE ( 'T' , 'U' , 'V' , 'W' )             ! T-, U-, V-, W-points
-               pt3d(:, 1 ,jk) = 0.e0
-               pt3d(:,jpj,jk) = 0.e0
-            CASE ( 'F' )                               ! F-point
-               pt3d(:,jpj,jk) = 0.e0
+               pt3d(:, 1 ,jk) = zland
+               pt3d(:,jpj,jk) = zland
+            CASE ( 'F' )                               ! F-point
+               pt3d(:,jpj,jk) = zland
             END SELECT
 
@@ -506,5 +515,5 @@
 
 
-   SUBROUTINE lbc_lnk_2d( pt2d, cd_type, psgn, cd_mpp )
+   SUBROUTINE lbc_lnk_2d( pt2d, cd_type, psgn, cd_mpp, pval )
       !!---------------------------------------------------------------------
       !!                 ***  ROUTINE lbc_lnk_2d  ***
@@ -532,11 +541,17 @@
       CHARACTER(len=3), INTENT( in ), OPTIONAL ::    &
          cd_mpp        ! fill the overlap area only (here do nothing)
+      REAL(wp)        , INTENT(in   ), OPTIONAL           ::   pval      ! background value (used at closed boundaries)
 
       !! * Local declarations
       INTEGER  ::   ji
       INTEGER  ::   ijt, iju
+      REAL(wp) ::   zland
       !!----------------------------------------------------------------------
-      !!  OPA 8.5, LODYC-IPSL (2002)
-      !!----------------------------------------------------------------------
+
+      IF( PRESENT( pval ) ) THEN      ! set land value (zero by default)
+         zland = pval
+      ELSE
+         zland = 0.e0
+      ENDIF
 
       IF (PRESENT(cd_mpp)) THEN
@@ -556,11 +571,11 @@
          SELECT CASE ( cd_type )
          CASE ( 'T' , 'U' , 'V' , 'W' )                ! T-, U-, V-, W-points
-            pt2d( 1 ,:) = 0.e0
-            pt2d(jpi,:) = 0.e0
+            pt2d( 1 ,:) = zland
+            pt2d(jpi,:) = zland
          CASE ( 'F' )                                  ! F-point, ice U-V point
-            pt2d(jpi,:) = 0.e0 
+            pt2d(jpi,:) = zland
          CASE ( 'I' )                                  ! F-point, ice U-V point
-            pt2d( 1 ,:) = 0.e0 
-            pt2d(jpi,:) = 0.e0 
+            pt2d( 1 ,:) = zland
+            pt2d(jpi,:) = zland
          END SELECT
 
@@ -576,15 +591,15 @@
          CASE ( 'T' , 'U' , 'W' )                      ! T-, U-, W-points
             pt2d(:, 1 ) = pt2d(:,3)
-            pt2d(:,jpj) = 0.e0
+            pt2d(:,jpj) = zland
          CASE ( 'V' , 'F' , 'I' )                      ! V-, F-points, ice U-V point
             pt2d(:, 1 ) = psgn * pt2d(:,2)
-            pt2d(:,jpj) = 0.e0
+            pt2d(:,jpj) = zland
          END SELECT
 
       CASE ( 3 , 4 )                           ! * North fold  T-point pivot
 
-!         pt2d( 1 , 1 ) = 0.e0        !!!!!  bug gm ??? !Edmee
-!         pt2d( 1 ,jpj) = 0.e0
-!         pt2d(jpi,jpj) = 0.e0
+         pt2d( 1 , 1 ) = zland       !!!!!  bug gm ??? !Edmee
+         pt2d( 1 ,jpj) = zland
+         pt2d(jpi,jpj) = zland
 
          SELECT CASE ( cd_type )
@@ -593,5 +608,5 @@
             DO ji = 2, jpi
                ijt = jpi-ji+2
-               pt2d(ji, 1 ) = 0.e0
+               pt2d(ji, 1 ) = zland
                pt2d(ji,jpj) = psgn * pt2d(ijt,jpj-2)
             END DO
@@ -604,5 +619,5 @@
             DO ji = 1, jpi-1
                iju = jpi-ji+1
-               pt2d(ji, 1 ) = 0.e0
+               pt2d(ji, 1 ) = zland
                pt2d(ji,jpj) = psgn * pt2d(iju,jpj-2)
             END DO
@@ -615,5 +630,5 @@
             DO ji = 2, jpi
                ijt = jpi-ji+2
-               pt2d(ji, 1   ) = 0.e0
+               pt2d(ji, 1   ) = zland
                pt2d(ji,jpj-1) = psgn * pt2d(ijt,jpj-2)
                pt2d(ji,jpj  ) = psgn * pt2d(ijt,jpj-3)
@@ -628,5 +643,5 @@
 
          CASE ( 'I' )                                  ! ice U-V point
-            pt2d(:, 1 ) = 0.e0
+            pt2d(:, 1 ) = zland
             pt2d(2,jpj) = psgn * pt2d(3,jpj-1)
             DO ji = 3, jpi
@@ -639,7 +654,7 @@
       CASE ( 5 , 6 )                           ! * North fold  F-point pivot
 
-         pt2d( 1 , 1 ) = 0.e0           !!bug  ???
-         pt2d( 1 ,jpj) = 0.e0
-         pt2d(jpi,jpj) = 0.e0
+         pt2d( 1 , 1 ) = zland          !!bug  ???
+         pt2d( 1 ,jpj) = zland
+         pt2d(jpi,jpj) = zland
 
          SELECT CASE ( cd_type )
@@ -648,5 +663,5 @@
             DO ji = 1, jpi
                ijt = jpi-ji+1
-               pt2d(ji, 1 ) = 0.e0
+               pt2d(ji, 1 ) = zland
                pt2d(ji,jpj) = psgn * pt2d(ijt,jpj-1)
             END DO
@@ -655,5 +670,5 @@
             DO ji = 1, jpi-1
                iju = jpi-ji
-               pt2d(ji, 1 ) = 0.e0
+               pt2d(ji, 1 ) = zland
                pt2d(ji,jpj) = psgn * pt2d(iju,jpj-1)
             END DO
@@ -662,5 +677,5 @@
             DO ji = 1, jpi
                ijt = jpi-ji+1
-               pt2d(ji, 1 ) = 0.e0
+               pt2d(ji, 1 ) = zland
                pt2d(ji,jpj) = psgn * pt2d(ijt,jpj-2)
             END DO
@@ -681,6 +696,6 @@
 
          CASE ( 'I' )                                  ! ice U-V point
-            pt2d( : , 1 ) = 0.e0
-            pt2d( 2 ,jpj) = 0.e0
+            pt2d( : , 1 ) = zland
+            pt2d( 2 ,jpj) = zland
             DO ji = 2 , jpim1
                ijt = jpi - ji + 2
@@ -694,11 +709,11 @@
          SELECT CASE ( cd_type )
          CASE ( 'T' , 'U' , 'V' , 'W' )                ! T-, U-, V-, W-points
-            pt2d(:, 1 ) = 0.e0
-            pt2d(:,jpj) = 0.e0
+            pt2d(:, 1 ) = zland
+            pt2d(:,jpj) = zland
          CASE ( 'F' )                                  ! F-point
-            pt2d(:,jpj) = 0.e0
+            pt2d(:,jpj) = zland
          CASE ( 'I' )                                  ! ice U-V point
-            pt2d(:, 1 ) = 0.e0
-            pt2d(:,jpj) = 0.e0
+            pt2d(:, 1 ) = zland
+            pt2d(:,jpj) = zland
          END SELECT
 
Index: trunk/NEMO/OPA_SRC/lib_mpp.F90
===================================================================
--- trunk/NEMO/OPA_SRC/lib_mpp.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/lib_mpp.F90	(revision 888)
@@ -48,5 +48,5 @@
    !!----------------------------------------------------------------------
    !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/lib_mpp.F90,v 1.21 2007/06/05 10:28:55 opalod Exp $ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!---------------------------------------------------------------------
@@ -278,5 +278,5 @@
    !!----------------------------------------------------------------------
    !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/lib_mpp.F90,v 1.21 2007/06/05 10:28:55 opalod Exp $ 
+   !! $Id$
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!---------------------------------------------------------------------
@@ -605,5 +605,5 @@
 #endif
 
-   SUBROUTINE mpp_lnk_3d( ptab, cd_type, psgn, cd_mpp )
+   SUBROUTINE mpp_lnk_3d( ptab, cd_type, psgn, cd_mpp, pval )
       !!----------------------------------------------------------------------
       !!                  ***  routine mpp_lnk_3d  ***
@@ -640,4 +640,5 @@
       CHARACTER(len=3), INTENT( in ), OPTIONAL ::    &
          cd_mpp        ! fill the overlap area only 
+      REAL(wp)        , INTENT(in   ), OPTIONAL           ::   pval      ! background value (used at closed boundaries)
 
       !! * Local variables
@@ -646,8 +647,15 @@
       INTEGER ::   ml_req1, ml_req2, ml_err     ! for key_mpi_isend
       INTEGER ::   ml_stat(MPI_STATUS_SIZE)     ! for key_mpi_isend
+      REAL(wp) ::   zland
       !!----------------------------------------------------------------------
 
       ! 1. standard boundary treatment
       ! ------------------------------
+
+      IF( PRESENT( pval ) ) THEN      ! set land value (zero by default)
+         zland = pval
+      ELSE
+         zland = 0.e0
+      ENDIF
 
       IF( PRESENT( cd_mpp ) ) THEN
@@ -670,8 +678,8 @@
             SELECT CASE ( cd_type )
             CASE ( 'T', 'U', 'V', 'W' )
-               ptab(     1       :jpreci,:,:) = 0.e0
-               ptab(nlci-jpreci+1:jpi   ,:,:) = 0.e0
+               ptab(     1       :jpreci,:,:) = zland
+               ptab(nlci-jpreci+1:jpi   ,:,:) = zland
             CASE ( 'F' )
-               ptab(nlci-jpreci+1:jpi   ,:,:) = 0.e0
+               ptab(nlci-jpreci+1:jpi   ,:,:) = zland
             END SELECT 
          ENDIF
@@ -681,8 +689,8 @@
          SELECT CASE ( cd_type )
          CASE ( 'T', 'U', 'V', 'W' )
-            ptab(:,     1       :jprecj,:) = 0.e0
-            ptab(:,nlcj-jprecj+1:jpj   ,:) = 0.e0
+            ptab(:,     1       :jprecj,:) = zland
+            ptab(:,nlcj-jprecj+1:jpj   ,:) = zland
          CASE ( 'F' )
-            ptab(:,nlcj-jprecj+1:jpj   ,:) = 0.e0
+            ptab(:,nlcj-jprecj+1:jpj   ,:) = zland
          END SELECT
      
@@ -1058,5 +1066,5 @@
 
 
-   SUBROUTINE mpp_lnk_2d( pt2d, cd_type, psgn, cd_mpp )
+   SUBROUTINE mpp_lnk_2d( pt2d, cd_type, psgn, cd_mpp, pval )
       !!----------------------------------------------------------------------
       !!                  ***  routine mpp_lnk_2d  ***
@@ -1092,4 +1100,5 @@
       CHARACTER(len=3), INTENT( in ), OPTIONAL ::    &
          cd_mpp        ! fill the overlap area only 
+      REAL(wp)        , INTENT(in   ), OPTIONAL           ::   pval      ! background value (used at closed boundaries)
 
       !! * Local variables
@@ -1100,5 +1109,12 @@
       INTEGER  ::   ml_req1, ml_req2, ml_err     ! for key_mpi_isend
       INTEGER  ::   ml_stat(MPI_STATUS_SIZE)     ! for key_mpi_isend
+      REAL(wp) ::   zland
       !!----------------------------------------------------------------------
+
+      IF( PRESENT( pval ) ) THEN      ! set land value (zero by default)
+         zland = pval
+      ELSE
+         zland = 0.e0
+      ENDIF
 
       ! 1. standard boundary treatment
@@ -1123,8 +1139,8 @@
             SELECT CASE ( cd_type )
             CASE ( 'T', 'U', 'V', 'W' , 'I' )
-               pt2d(     1       :jpreci,:) = 0.e0
-               pt2d(nlci-jpreci+1:jpi   ,:) = 0.e0
+               pt2d(     1       :jpreci,:) = zland
+               pt2d(nlci-jpreci+1:jpi   ,:) = zland
             CASE ( 'F' )
-               pt2d(nlci-jpreci+1:jpi   ,:) = 0.e0
+               pt2d(nlci-jpreci+1:jpi   ,:) = zland
             END SELECT
          ENDIF
@@ -1134,8 +1150,8 @@
          SELECT CASE ( cd_type )
          CASE ( 'T', 'U', 'V', 'W' , 'I' )
-            pt2d(:,     1       :jprecj) = 0.e0
-            pt2d(:,nlcj-jprecj+1:jpj   ) = 0.e0
+            pt2d(:,     1       :jprecj) = zland
+            pt2d(:,nlcj-jprecj+1:jpj   ) = zland
          CASE ( 'F' )
-            pt2d(:,nlcj-jprecj+1:jpj   ) = 0.e0
+            pt2d(:,nlcj-jprecj+1:jpj   ) = zland
          END SELECT
 
@@ -1402,5 +1418,5 @@
   
             CASE ( 'I' )                                  ! ice U-V point
-               pt2d( 2 ,nlcj) = 0.e0
+               pt2d( 2 ,nlcj) = zland
                DO ji = 2 , nlci-1
                   ijt = iloc - ji + 2
@@ -3087,5 +3103,5 @@
       INTEGER , INTENT( in  )                  ::   kdim        ! size of array
       INTEGER , INTENT(inout), DIMENSION(kdim) ::   ktab        ! input array
-      INTEGER , INTENT(in), OPTIONAL         ::   kcom  
+      INTEGER , INTENT(in)   , OPTIONAL        ::   kcom  
   
 #if defined key_mpp_shmem
@@ -3197,5 +3213,5 @@
       INTEGER , INTENT( in  )                  ::   kdim        ! size of array
       INTEGER , INTENT(inout), DIMENSION(kdim) ::   ktab        ! input array
-      INTEGER , INTENT(in), OPTIONAL        ::   kcom        ! input array
+      INTEGER , INTENT( in  ), OPTIONAL        ::   kcom        ! input array
   
 #if defined key_mpp_shmem
@@ -3538,5 +3554,5 @@
     INTEGER , INTENT( in  )                  ::   kdim
     REAL(wp), INTENT(inout), DIMENSION(kdim) ::   ptab
-    INTEGER , INTENT( in  ), OPTIONAL     ::   kcom
+    INTEGER , INTENT( in  ), OPTIONAL        ::   kcom
 
 #if defined key_mpp_shmem
@@ -3595,5 +3611,5 @@
     !! * Arguments
     REAL(wp), INTENT(inout) ::   ptab      ! ???
-    INTEGER, INTENT(in), OPTIONAL ::   kcom      ! ???
+    INTEGER , INTENT( in  ), OPTIONAL ::   kcom      ! ???
 
 #if defined key_mpp_shmem
@@ -3703,5 +3719,5 @@
     !! * Arguments
     REAL(wp), INTENT( inout ) ::   ptab        ! 
-    INTEGER,INTENT(in), OPTIONAL :: kcom
+    INTEGER , INTENT(  in   ), OPTIONAL :: kcom
 
 #if defined key_mpp_shmem
@@ -3753,5 +3769,5 @@
     INTEGER , INTENT( in )                     ::   kdim      ! size of ptab
     REAL(wp), DIMENSION(kdim), INTENT( inout ) ::   ptab      ! input array
-    INTEGER, INTENT(in), OPTIONAL :: kcom
+    INTEGER , INTENT( in ), OPTIONAL           :: kcom
 
 #if defined key_mpp_shmem
@@ -3811,5 +3827,5 @@
     !!-----------------------------------------------------------------------
     REAL(wp), INTENT(inout) ::   ptab        ! input scalar
-    INTEGER, INTENT(in), OPTIONAL :: kcom
+    INTEGER , INTENT( in  ), OPTIONAL :: kcom
 
 #if defined key_mpp_shmem
@@ -5454,5 +5470,5 @@
       INTEGER               :: kdim
       INTEGER, OPTIONAL     :: kcom 
-      WRITE(*,*) 'mppmax_a_int: You should not have seen this print! error?', kdim, karr(1)
+      WRITE(*,*) 'mppmax_a_int: You should not have seen this print! error?', kdim, karr(1), kcom
    END SUBROUTINE mppmax_a_int
 
@@ -5568,11 +5584,12 @@
    END SUBROUTINE mppstop
 
-   SUBROUTINE mpp_ini_lim
-      WRITE(*,*) 'mpp_ini_north: You should not have seen this print! error?'
-   END SUBROUTINE mpp_ini_lim
+   SUBROUTINE mpp_ini_ice(kcom)
+      INTEGER :: kcom
+      WRITE(*,*) 'mpp_ini_ice: You should not have seen this print! error?',kcom
+   END SUBROUTINE mpp_ini_ice
 
    SUBROUTINE mpp_comm_free(kcom)
       INTEGER :: kcom
-      WRITE(*,*) 'mpp_comm_free: You should not have seen this print! error?'
+      WRITE(*,*) 'mpp_comm_free: You should not have seen this print! error?',kcom
    END SUBROUTINE mpp_comm_free
 
Index: trunk/NEMO/OPA_SRC/opa.F90
===================================================================
--- trunk/NEMO/OPA_SRC/opa.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/opa.F90	(revision 888)
@@ -36,7 +36,8 @@
    !!----------------------------------------------------------------------
    !! * Modules used
+   USE oce             ! dynamics and tracers variables
    USE cpl_oce         ! ocean-atmosphere-sea ice coupled exchanges
    USE dom_oce         ! ocean space domain variables
-   USE oce             ! dynamics and tracers variables
+   USE sbc_oce         ! surface boundary condition: ocean
    USE trdmod_oce      ! ocean variables trends
    USE daymod          ! calendar
@@ -59,15 +60,6 @@
 
    USE phycst          ! physical constant                  (par_cst routine)
-#if defined key_lim3
-   USE iceini          ! initialization of sea-ice         (ice_init routine)
-#endif
-#if defined key_lim2
-   USE iceini_2        ! initialization of sea-ice         (ice_init_2 routine)
-#endif
-   USE cpl             ! coupled ocean/atmos.              (cpl_init routine)
    USE ocfzpt          ! ocean freezing point              (oc_fz_pt routine)
    USE trdmod          ! momentum/tracers trends       (trd_mod_init routine)
-   USE flxfwb          ! freshwater budget correction  (flx_fwb_init routine)
-   USE flxmod          ! thermohaline forcing of the ocean (flx_init routine)
 
    USE diaptr          ! poleward transports           (dia_ptr_init routine)
@@ -99,5 +91,5 @@
    !!----------------------------------------------------------------------
    !!  OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/opa.F90,v 1.38 2007/06/05 10:32:02 opalod Exp $ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -281,17 +273,7 @@
       IF( lk_obc    )   CALL obc_init       ! Open boundaries 
 
-      CALL day( nit000 )                    ! Calendar
-
       CALL istate_init                      ! ocean initial state (Dynamics and tracers)
 
       CALL oc_fz_pt                         ! Surface freezing point
-
-#if defined key_lim3
-      CALL ice_init                         ! Sea ice model LIM3
-#endif
-
-#if defined key_lim2
-      CALL ice_init_2                       ! Sea ice model LIM2
-#endif
 
       !                                     ! Ocean physics
@@ -319,8 +301,4 @@
       CALL cpl_prism_define
 #endif
-
-      CALL flx_init                         ! Thermohaline forcing initialization
-
-      CALL flx_fwb_init                     ! FreshWater Budget correction
 
       CALL dia_ptr_init                     ! Poleward TRansports initialization
@@ -475,5 +453,4 @@
       USE dtatem        ! temperature data
       USE dtasal        ! salinity data
-      USE dtasst        ! sea surface temperature data
       !!----------------------------------------------------------------------
 
Index: trunk/NEMO/OPA_SRC/phycst.F90
===================================================================
--- trunk/NEMO/OPA_SRC/phycst.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/phycst.F90	(revision 888)
@@ -4,5 +4,14 @@
    !!     Definition of of both ocean and ice parameters used in the code
    !!=====================================================================
-   !! * Modules used
+   !! 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 
+   !!----------------------------------------------------------------------
+
+   !!----------------------------------------------------------------------
+   !!   phy_cst  : define and print physical constant and domain parameters
+   !!----------------------------------------------------------------------
    USE par_oce          ! ocean parameters
    USE in_out_manager   ! I/O manager
@@ -11,18 +20,9 @@
    PRIVATE
 
-   !! * Routine accessibility
-   PUBLIC phy_cst          ! routine called by inipar.F90
-
-   !! * Shared module variables
-   INTEGER, PUBLIC, DIMENSION(12) ::   &  !:
-      nbiss = (/ 31, 29, 31, 30, 31, 30,      &  !: number of days per month
-         &       31, 31, 30, 31, 30, 31 /) ,  &  !  (leap-year)
-      nobis = (/ 31, 28, 31, 30, 31, 30,      &  !: number of days per month
-         &       31, 31, 30, 31, 30, 31 /)       !  (365 days a year)
-   
-   REAL(wp), PUBLIC ::                        &  !:
-      rpi = 3.141592653589793_wp           ,  &  !: pi
-      rad = 3.141592653589793_wp / 180._wp ,  &  !: conversion from degre into radian
-      rsmall = 0.5 * EPSILON( 1. )               !: smallest real computer value
+   PUBLIC   phy_cst     ! routine called by inipar.F90
+
+   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. )           !: smallest real computer value
    
    REAL(wp), PUBLIC ::          & !:
@@ -54,5 +54,5 @@
 #endif
       rau0     = 1020._wp   ,  &  !: volumic mass of reference (kg/m3)
-      rauw     = 1000._wp   ,  &  !: density of pure water (kg/m3)
+      rauw     = 1000._wp   ,  &  !: volumic mass of pure water (kg/m3)
       rcp      =    4.e+3_wp,  &  !: ocean specific heat
       ro0cpr                      !: = 1. / ( rau0 * rcp )
@@ -66,5 +66,5 @@
       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       ,   &  !: density of sea ice (kg/m3)
+      rhoic   = 917._wp       ,   &  !: volumic mass of sea ice (kg/m3)
       tmut    =   0.054       ,   &  !: decrease of seawater meltpoint with salinity
 #else
@@ -76,7 +76,7 @@
       xlic    = 300.33e+6_wp  ,   &  !: volumetric latent heat fusion of ice
       xsn     =   2.8e+6      ,   &  !: latent heat of sublimation of snow
-      rhoic   = 900._wp       ,   &  !: density of sea ice (kg/m3)
+      rhoic   = 900._wp       ,   &  !: volumic mass of sea ice (kg/m3)
 #endif
-      rhosn   = 330._wp       ,   &  !: density of snow (kg/m3)
+      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)
@@ -99,15 +99,6 @@
       !!
       !! ** Purpose :   Print model parameters and set and print the constants
-      !!
-      !! ** Method  :   no
-      !!
-      !! 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 
-      !!----------------------------------------------------------------------
-      !! * Local variables
-      CHARACTER (len=64) ::   cform = "(A9, 3(A13, I7) )" 
+      !!----------------------------------------------------------------------
+      CHARACTER (len=64) ::   cform = "(A12, 3(A13, I7) )" 
       !!----------------------------------------------------------------------
 
@@ -119,22 +110,17 @@
       ! ----------------
       IF(lwp) THEN
-         WRITE(numout,*) '       parameter file'
-         WRITE(numout,*)
+         WRITE(numout,*) '       Domain info'
          WRITE(numout,*) '          dimension of model'
-         WRITE(numout,*) '              Local domain      Global domain       Data domain '
-         WRITE(numout,cform) '         ','   jpi     : ', jpi, '   jpiglo  : ', jpiglo, '   jpidta  : ', jpidta
-         WRITE(numout,cform) '         ','   jpj     : ', jpj, '   jpjglo  : ', jpjglo, '   jpjdta  : ', jpjdta
-         WRITE(numout,cform) '         ','   jpk     : ', jpk, '   jpk     : ', jpk   , '   jpkdta  : ', jpkdta
-         WRITE(numout,*)      '        ','   jpij    : ', jpij
-         WRITE(numout,*)
+         WRITE(numout,*) '                 Local domain      Global domain       Data domain '
+         WRITE(numout,cform) '            ','   jpi     : ', jpi, '   jpiglo  : ', jpiglo, '   jpidta  : ', jpidta
+         WRITE(numout,cform) '            ','   jpj     : ', jpj, '   jpjglo  : ', jpjglo, '   jpjdta  : ', jpjdta
+         WRITE(numout,cform) '            ','   jpk     : ', jpk, '   jpk     : ', jpk   , '   jpkdta  : ', jpkdta
+         WRITE(numout,*)      '           ','   jpij    : ', jpij
          WRITE(numout,*) '          mpp local domain info (mpp)'
          WRITE(numout,*) '             jpni    : ', jpni, '   jpreci  : ', jpreci
          WRITE(numout,*) '             jpnj    : ', jpnj, '   jprecj  : ', jprecj
          WRITE(numout,*) '             jpnij   : ', jpnij
-
-         WRITE(numout,*)
          WRITE(numout,*) '          lateral domain boundary condition type : jperio  = ', jperio
-         WRITE(numout,*) '          domain island (use in rigid-lid case)  : jpisl   = ', jpisl 
-         WRITE(numout,*) '                                                   jpnisl  = ', jpnisl
+         WRITE(numout,*) '          domain island (use in rigid-lid case)  : jpisl   = ', jpisl, '   jpnisl  = ', jpnisl
       ENDIF
 
@@ -142,5 +128,5 @@
       ! ----------------
       IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) '       constants'
+      IF(lwp) WRITE(numout,*) '       Constants'
 
       IF(lwp) WRITE(numout,*)
Index: trunk/NEMO/OPA_SRC/restart.F90
===================================================================
--- trunk/NEMO/OPA_SRC/restart.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/restart.F90	(revision 888)
@@ -19,6 +19,4 @@
    USE phycst          ! physical constants
    USE daymod          ! calendar
-   USE ice_oce         ! ice variables
-   USE blk_oce         ! bulk variables
    USE cpl_oce, ONLY : lk_cpl              !
    USE in_out_manager  ! I/O manager
@@ -43,5 +41,5 @@
    !!----------------------------------------------------------------------
    !!  OPA 9.0 , LOCEAN-IPSL (2006) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/restart.F90,v 1.27 2007/06/05 10:35:19 opalod Exp $ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -143,19 +141,4 @@
       CALL iom_rstput( kt, nitrst, numrow, 'rotn'   , rotn    )
       CALL iom_rstput( kt, nitrst, numrow, 'hdivn'  , hdivn   )
-
-#if defined key_lim3 || defined key_lim2
-      CALL iom_rstput( kt, nitrst, numrow, 'nfice'  , REAL( nfice, wp) )   !  ice computation frequency
-      CALL iom_rstput( kt, nitrst, numrow, 'sst_io' , sst_io  )
-      CALL iom_rstput( kt, nitrst, numrow, 'sss_io' , sss_io  )
-      CALL iom_rstput( kt, nitrst, numrow, 'u_io'   , u_io    )
-      CALL iom_rstput( kt, nitrst, numrow, 'v_io'   , v_io    )
-# if defined key_coupled
-      CALL iom_rstput( kt, nitrst, numrow, 'alb_ice', alb_ice )
-# endif
-#endif
-#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_core 
-      CALL iom_rstput( kt, nitrst, numrow, 'nfbulk' , REAL( nfbulk, wp) )   !  bulk computation frequency
-      CALL iom_rstput( kt, nitrst, numrow, 'gsst'   , gsst    )
-#endif
 
       IF( nn_dynhpg_rst == 1 .OR. lk_vvl ) THEN
@@ -209,8 +192,5 @@
       !!                    has been stored in the restart file.
       !!----------------------------------------------------------------------
-      REAL(wp) ::   zcoef, zkt, zrdt, zrdttra1, zndastp, znfice, znfbulk
-#if defined key_lim3 || defined key_lim2
-      INTEGER  ::   ji, jj
-#endif
+      REAL(wp) ::   zkt, zrdt, zrdttra1, zndastp
       !!----------------------------------------------------------------------
 
@@ -304,62 +284,4 @@
       ENDIF
 
-      !!sm: TO BE MOVED IN NEW SURFACE MODULE...
-
-#if defined key_lim3 || defined key_lim2
-      ! Louvain La Neuve Sea Ice Model
-      IF( iom_varid( numror, 'nfice', ldstop = .FALSE. ) > 0 ) then 
-         CALL iom_get( numror             , 'nfice'  , znfice  )   ! ice computation frequency
-         CALL iom_get( numror, jpdom_autoglo, 'sst_io' , sst_io  )
-         CALL iom_get( numror, jpdom_autoglo, 'sss_io' , sss_io  )
-         CALL iom_get( numror, jpdom_autoglo, 'u_io'   , u_io    )
-         CALL iom_get( numror, jpdom_autoglo, 'v_io'   , v_io    )
-# if defined key_coupled
-         CALL iom_get( numror, jpdom_autoglo, 'alb_ice', alb_ice )
-# endif
-         IF( znfice /= REAL( nfice, wp ) ) THEN      ! if nfice changed between 2 runs
-            zcoef = REAL( nfice-1, wp ) / znfice
-            sst_io(:,:) = zcoef * sst_io(:,:)
-            sss_io(:,:) = zcoef * sss_io(:,:)
-            u_io  (:,:) = zcoef * u_io  (:,:)
-            v_io  (:,:) = zcoef * v_io  (:,:)
-         ENDIF
-      ELSE
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'rst_read :  LLN sea Ice Model => Ice initialization'
-         IF(lwp) WRITE(numout,*)
-         zcoef = REAL( nfice-1, wp )
-         sst_io(:,:) = zcoef *( tn(:,:,1) + rt0 )          !!bug a explanation is needed here!
-         sss_io(:,:) = zcoef *  sn(:,:,1)
-         zcoef = 0.5 * REAL( nfice-1, wp )
-         DO jj = 2, jpj
-            DO ji = fs_2, jpi   ! vector opt.
-               u_io(ji,jj) = zcoef * ( un(ji-1,jj  ,1) + un(ji-1,jj-1,1) )
-               v_io(ji,jj) = zcoef * ( vn(ji  ,jj-1,1) + vn(ji-1,jj-1,1) )
-            END DO
-         END DO
-# if defined key_coupled
-         alb_ice(:,:) = 0.8 * tmask(:,:,1)
-# endif
-      ENDIF
-#endif
-#if defined key_flx_bulk_monthly || defined key_flx_bulk_daily || defined key_flx_core 
-      ! Louvain La Neuve Sea Ice Model
-      IF( iom_varid( numror, 'nfbulk', ldstop = .FALSE. ) > 0 ) THEN 
-         CALL iom_get( numror             , 'nfbulk', znfbulk )   ! bulk computation frequency
-         CALL iom_get( numror, jpdom_autoglo, 'gsst'  , gsst    )
-         IF( znfbulk /= REAL(nfbulk, wp) ) THEN      ! if you change nfbulk between 2 runs
-            zcoef = REAL( nfbulk-1, wp ) / znfbulk
-            gsst(:,:) = zcoef * gsst(:,:)
-         ENDIF
-      ELSE
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'rst_read :  LLN sea Ice Model => Ice initialization'
-         IF(lwp) WRITE(numout,*)
-         gsst(:,:) = REAL( nfbulk - 1, wp )*( tn(:,:,1) + rt0 )
-      ENDIF
-#endif
-
-      !!sm: end of TO BE MOVED IN NEW SURFACE MODULE...
-
       IF( iom_varid( numror, 'rhd', ldstop = .FALSE. ) > 0 ) THEN
          CALL iom_get( numror, jpdom_autoglo, 'rhd' , rhd  )
Index: trunk/NEMO/OPA_SRC/step.F90
===================================================================
--- trunk/NEMO/OPA_SRC/step.F90	(revision 873)
+++ trunk/NEMO/OPA_SRC/step.F90	(revision 888)
@@ -4,6 +4,5 @@
    !! Time-stepping    : manager of the ocean, tracer and ice time stepping
    !!======================================================================
-   !! History :        !  91-03  ()  Original code
-   !!                  !  91-11  (G. Madec)
+   !! History :        !  91-03  (G. Madec)  Original code
    !!                  !  92-06  (M. Imbard)  add a first output record
    !!                  !  96-04  (G. Madec)  introduction of dynspg
@@ -20,4 +19,7 @@
    !!             " "  !  06-01  (L. Debreu, C. Mazauric)  Agrif implementation
    !!             " "  !  06-07  (S. Masson)  restart using iom
+   !!             " "  !  06-08  (G. Madec)  surface module 
+   !!----------------------------------------------------------------------
+
    !!----------------------------------------------------------------------
    !!   stp            : OPA system time-stepping
@@ -30,5 +32,5 @@
    USE cpl_oce         ! coupled ocean-atmosphere variables
    USE in_out_manager  ! I/O manager
-   USE iom
+   USE iom             !
    USE lbclnk
 
@@ -37,12 +39,6 @@
    USE dtatem          ! ocean temperature data           (dta_tem routine)
    USE dtasal          ! ocean salinity    data           (dta_sal routine)
-   USE dtasst          ! ocean sea surface temperature    (dta_sst routine)
-   USE dtasss          ! ocean sea surface salinity       (dta_sss routine)
-   USE taumod          ! surface stress                   (tau     routine)
-   USE flxmod          ! thermohaline fluxes              (flx     routine)
-   USE ocesbc          ! thermohaline fluxes              (oce_sbc routine)
-   USE flxrnf          ! runoffs                          (flx_rnf routine)
-   USE flxfwb          ! freshwater budget correction     (flx_fwb routine)
-   USE closea          ! closed sea freshwater budget     (flx_clo routine)
+   USE sbcmod          ! surface boundary condition       (sbc     routine)
+   USE sbcrnf          ! surface boundary condition: runoff variables
    USE ocfzpt          ! surface ocean freezing point    (oc_fz_pt routine)
 
@@ -96,10 +92,5 @@
    USE zpshde          ! partial step: hor. derivative     (zps_hde routine)
    USE ice_oce         ! sea-ice variable
-#if defined key_lim3
-   USE icestp          ! sea-ice time-stepping             (ice_stp routine)
-#endif
-#if defined key_lim2
-   USE icestp_2        ! sea-ice time-stepping             (ice_stp_2 routine)
-#endif
+
    USE diawri          ! Standard run outputs             (dia_wri routine)
    USE trdicp          ! Ocean momentum/tracers trends    (trd_wri routine)
@@ -119,5 +110,4 @@
    USE stpctl          ! time stepping control            (stp_ctl routine)
    USE restart         ! ocean restart                    (rst_wri routine)
-   USE cpl             ! exchanges in coupled mode        (cpl_stp routine)
    USE prtctl          ! Print control                    (prt_ctl routine)
    USE domvvl          ! variable volume                  (dom_vvl routine)
@@ -137,5 +127,5 @@
    !!----------------------------------------------------------------------
    !!   OPA 9.0 , LOCEAN-IPSL (2005) 
-   !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/step.F90,v 1.35 2007/06/01 16:55:39 opalod Exp $ 
+   !! $Id$
    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
    !!----------------------------------------------------------------------
@@ -166,10 +156,9 @@
       !! * Arguments
 #if defined key_agrif   
-      INTEGER               :: kstp   ! ocean time-step index
+      INTEGER             ::   kstp   ! ocean time-step index
 #else
-      INTEGER, INTENT( in ) :: kstp   ! ocean time-step index
+      INTEGER, INTENT(in) ::   kstp   ! ocean time-step index
 #endif      
-
-      !! * local declarations
+      INTEGER ::   jk       ! dummy loop indice
       INTEGER ::   indic    ! error indicator if < 0
       !! ---------------------------------------------------------------------
@@ -182,6 +171,4 @@
       indic = 1                    ! reset to no error condition
 
-      adatrj = adatrj + rdt/86400._wp
-
       CALL day( kstp )             ! Calendar
 
@@ -189,55 +176,18 @@
 
       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-      ! Update data, open boundaries and Forcings
+      ! Update data, open boundaries, surface boundary condition (including sea-ice)
       !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
       IF( lk_dtatem  )   CALL dta_tem( kstp )         ! update 3D temperature data
-
-      IF( lk_dtasal  )   CALL dta_sal( kstp )         ! Salinity data
-
-      IF( lk_dtasst  )   CALL dta_sst( kstp )         ! Sea Surface Temperature data
-
-      IF( lk_dtasss  )   CALL dta_sss( kstp )         ! Sea Surface Salinity data
+      IF( lk_dtasal  )   CALL dta_sal( kstp )         ! update 3D salinity data
+
+                         CALL sbc    ( kstp )         ! Sea Boundary Condition (including sea-ice)
 
       IF( lk_obc     )   CALL obc_dta( kstp )         ! update dynamic and tracer data at open boundaries
-
       IF( lk_obc     )   CALL obc_rad( kstp )         ! compute phase velocities at open boundaries
 
-      IF( .NOT. lk_core )    CALL tau( kstp )         ! wind stress
-
-                         CALL flx_rnf( kstp )         ! runoff data
-
-                         CALL flx( kstp )             ! heat and freshwater fluxes
-
-#if defined key_lim3
-      CALL ice_stp( kstp )           ! sea-ice model (Update stress & fluxes)
-#endif
-#if defined key_lim2
-      CALL ice_stp_2( kstp )         ! sea-ice model (Update stress & fluxes)
-#endif
-
-                         CALL oce_sbc( kstp )         ! ocean surface boudaries
-
-      IF( ln_fwb     )   CALL flx_fwb( kstp )         ! freshwater budget
-
-      IF( nclosea == 1 ) CALL flx_clo( kstp )         ! closed sea in the domain (update freshwater fluxes)
-
-      IF( kstp == nit000 ) THEN 
-         IF( ninist == 1 ) THEN                       ! Output the initial state and forcings
-            CALL dia_wri_state( 'output.init' )
-         ENDIF
-      ENDIF
-
-      IF(ln_ctl) THEN         ! print mean trends (used for debugging)
-         CALL prt_ctl(tab2d_1=emp    , clinfo1=' emp  -   : ', mask1=tmask, ovlap=1)
-         CALL prt_ctl(tab2d_1=emps   , clinfo1=' emps -   : ', mask1=tmask, ovlap=1)
-         CALL prt_ctl(tab2d_1=qt     , clinfo1=' qt   -   : ', mask1=tmask, ovlap=1)
-         CALL prt_ctl(tab2d_1=qsr    , clinfo1=' qsr  -   : ', mask1=tmask, ovlap=1)
-         CALL prt_ctl(tab2d_1=runoff , clinfo1=' runoff   : ', mask1=tmask, ovlap=1)
-         CALL prt_ctl(tab3d_1=tmask  , clinfo1=' tmask    : ', mask1=tmask, ovlap=1, kdim=jpk)
-         CALL prt_ctl(tab3d_1=tn     , clinfo1=' sst  -   : ', mask1=tmask, ovlap=1, kdim=1)
-         CALL prt_ctl(tab3d_1=sn     , clinfo1=' sss  -   : ', mask1=tmask, ovlap=1, kdim=1)
-         CALL prt_ctl(tab2d_1=taux   , clinfo1=' tau  - x : ', mask1=umask, &
-            &         tab2d_2=tauy   , clinfo2='      - y : ', mask2=vmask,ovlap=1)
+      IF( ninist == 1 ) THEN                       ! Output the initial state and forcings
+                        CALL dia_wri_state( 'output.init' )
+                        ninist = 0
       ENDIF
 
@@ -252,5 +202,5 @@
       !-----------------------------------------------------------------------
 
-                       CALL bn2( tb, sb, rn2 )              ! before Brunt-Vaisala frequency
+                        CALL bn2( tb, sb, rn2 )              ! before Brunt-Vaisala frequency
       
       !                                                     ! Vertical eddy viscosity and diffusivity coefficients
@@ -267,16 +217,11 @@
       ENDIF
 
-      IF( cp_cfg == "orca" ) THEN                           ! ORCA: Reduce vertical mixing in some specific areas
-         SELECT CASE ( jp_cfg )
-            CASE ( 05 )                         ! ORCA R2 configuration
-               avt  (:,:,2) = avt  (:,:,2) + 1.e-3 * upsrnfh(:,:)   ! increase diffusivity of rivers mouths
-            CASE ( 025 )                         ! ORCA R025 configuration
-               avt  (:,:,2) = avt  (:,:,2) + 2.e-3 * upsrnfh(:,:)   ! increase diffusivity of rivers mouths
-         END SELECT
+      IF( nn_runoff /=0 ) THEN                              ! increase diffusivity at rivers mouths
+         DO jk = 2, nkrnf   ;   avt(:,:,jk) = avt(:,:,jk) + rn_avt_rnf * rnfmsk(:,:)   ;   END DO
       ENDIF
 
       IF( ln_zdfevd )   CALL zdf_evd( kstp )                 ! enhanced vertical eddy diffusivity
 
-      IF( lk_zdfddm .AND. .NOT. lk_zdfkpp)   &
+      IF( lk_zdfddm .AND. .NOT. lk_zdfkpp )   &
          &              CALL zdf_ddm( kstp )                 ! double diffusive mixing
 
@@ -291,12 +236,9 @@
       ! N.B. ua, va, ta, sa arrays are used as workspace in this section
       !-----------------------------------------------------------------------
-
       IF( lk_ldfslp     )   CALL ldf_slp( kstp, rhd, rn2 )       ! before slope of the lateral mixing
-
 #if defined key_traldf_c2d
       IF( lk_traldf_eiv )   CALL ldf_eiv( kstp )                 ! eddy induced velocity coefficient
 #endif
 
-
 #if defined key_passivetrc
       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@@ -305,9 +247,6 @@
       ! N.B. ua, va, ta, sa arrays are used as workspace in this section
       !-----------------------------------------------------------------------
-
                              CALL trc_stp( kstp, indic )            ! time-stepping
-
-#endif
-
+#endif
 
       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@@ -316,25 +255,16 @@
       ! N.B. ua, va arrays are used as workspace in this section
       !-----------------------------------------------------------------------
-
                              ta(:,:,:) = 0.e0               ! set tracer trends to zero
                              sa(:,:,:) = 0.e0
 
                              CALL tra_sbc    ( kstp )       ! surface boundary condition
-
       IF( ln_traqsr      )   CALL tra_qsr    ( kstp )       ! penetrative solar radiation qsr
-
       IF( lk_trabbc      )   CALL tra_bbc    ( kstp )       ! bottom heat flux
-
       IF( lk_trabbl_dif  )   CALL tra_bbl_dif( kstp )       ! diffusive bottom boundary layer scheme
       IF( lk_trabbl_adv  )   CALL tra_bbl_adv( kstp )       ! advective (and/or diffusive) bottom boundary layer scheme
-
       IF( lk_tradmp      )   CALL tra_dmp    ( kstp )       ! internal damping trends
-
                              CALL tra_adv    ( kstp )       ! horizontal & vertical advection
-
       IF( n_cla == 1     )   CALL tra_cla    ( kstp )       ! Cross Land Advection (Update Hor. advection)
-
       IF( lk_zdfkpp )        CALL tra_kpp    ( kstp )       ! KPP non-local tracer fluxes
-
                              CALL tra_ldf    ( kstp )       ! lateral mixing
 #if defined key_agrif
@@ -342,7 +272,5 @@
 #endif
                              CALL tra_zdf    ( kstp )       ! vertical mixing
-
                              CALL tra_nxt( kstp )           ! tracer fields at next time step
-
       IF( ln_zdfnpc      )   CALL tra_npc( kstp )           ! update the new (t,s) fields by non
       !                                                     ! penetrative convective adjustment
@@ -365,13 +293,9 @@
       ! N.B. ta, sa arrays are used as workspace in this section 
       !-----------------------------------------------------------------------
-
-
                                ua(:,:,:) = 0.e0               ! set dynamics trends to zero
                                va(:,:,:) = 0.e0
 
                                CALL dyn_adv( kstp )           ! advection (vector or flux form)
-
                                CALL dyn_vor( kstp )           ! vorticity term including Coriolis
-
                                CALL dyn_ldf( kstp )           ! lateral mixing
 #if defined key_agrif
@@ -379,18 +303,11 @@
 #endif
                                CALL dyn_hpg( kstp )           ! horizontal gradient of Hydrostatic pressure
-
                                CALL dyn_zdf( kstp )           ! vertical diffusion
-
       IF( lk_dynspg_rl ) THEN
          IF( lk_obc    )       CALL obc_spg( kstp )           ! surface pressure gradient at open boundaries
       ENDIF
-                       indic=0
-!i bug lbc sur emp
-      CALL lbc_lnk( emp, 'T', 1. )
-!i
+                               indic=0
                                CALL dyn_spg( kstp, indic )    ! surface pressure gradient
-
                                CALL dyn_nxt( kstp )           ! lateral velocity at next time step
-
       IF( lk_vvl )             CALL dom_vvl                   ! vertical mesh at next time step
 
@@ -401,24 +318,14 @@
       ! N.B. ua, va, ta, sa arrays are used as workspace in this section
       !-----------------------------------------------------------------------
-
                        CALL oc_fz_pt                        ! ocean surface freezing temperature
-
                        CALL div_cur( kstp )                 ! Horizontal divergence & Relative vorticity
-
       IF( n_cla == 1 ) CALL div_cla( kstp )                 ! Cross Land Advection (Update Hor. divergence)
-
                        CALL wzv( kstp )                     ! Vertical velocity
 
-
-
-      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-      ! Control, and restarts
-      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      ! N.B. ua, va, ta, sa arrays are used as workspace in this section
-      !-----------------------------------------------------------------------
-      !                                                     ! Time loop: control and print
+      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+      ! Control and restarts
+      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                  CALL stp_ctl( kstp, indic )
       IF( indic < 0          )   CALL ctl_stop( 'step: indic < 0' )
-
       IF( kstp == nit000     )   CALL iom_close( numror )             ! close input  ocean restart file
       IF( lrst_oce           )   CALL rst_write  ( kstp )             ! write output ocean restart file
@@ -431,5 +338,5 @@
       !-----------------------------------------------------------------------
 
-      IF ( nstop == 0 ) THEN                                ! Diagnostics
+      IF( nstop == 0 ) THEN                                 ! Diagnostics:
          IF( lk_floats  )   CALL flo_stp( kstp )                 ! drifting Floats
          IF( lk_trddyn  )   CALL trd_dwr( kstp )                 ! trends: dynamics 
@@ -443,7 +350,6 @@
          IF( lk_diafwb  )   CALL dia_fwb( kstp )                 ! Fresh water budget diagnostics
          IF( ln_diaptr  )   CALL dia_ptr( kstp )                 ! Poleward TRansports diagnostics
-
-         !                                                 ! Outputs
-                            CALL dia_wri    ( kstp, indic )      ! ocean model: outputs
+         !                                                 ! outputs
+                            CALL dia_wri( kstp, indic )          ! ocean model: outputs
       ENDIF
 
Index: trunk/NEMO/TOP_SRC/TRP/trcadv_cen2.F90
===================================================================
--- trunk/NEMO/TOP_SRC/TRP/trcadv_cen2.F90	(revision 873)
+++ trunk/NEMO/TOP_SRC/TRP/trcadv_cen2.F90	(revision 888)
@@ -164,5 +164,5 @@
                zind(ji,jj,jk) =  MAX ( upsrnfh(ji,jj) * upsrnfz(jk),     &  ! changing advection scheme near runoff
                   &                    upsadv(ji,jj)                     &  ! in the vicinity of some straits
-#if defined key_lim3
+#if defined key_lim3 || defined key_lim2
                   &                  , tmask(ji,jj,jk)                   &  ! half upstream tracer fluxes
                   &                  * MAX( 0., SIGN( 1., fzptn(ji,jj)   &  ! if tn < ("freezing"+0.1 )
