Index: branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdy_oce.F90
===================================================================
--- branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdy_oce.F90	(revision 6019)
+++ branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdy_oce.F90	(revision 6020)
@@ -8,5 +8,5 @@
    !!            3.3  !  2010-09  (D. Storkey) add ice boundary conditions
    !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
-   !!            3.6  !  2012-01  (C. Rousset) add ice boundary conditions for lim3
+   !!            3.6  !  2014-01  (C. Rousset) add ice boundary conditions for lim3
    !!----------------------------------------------------------------------
 #if defined key_bdy 
@@ -22,15 +22,15 @@
 
    TYPE, PUBLIC ::   OBC_INDEX    !: Indices and weights which define the open boundary
-      INTEGER,          DIMENSION(jpbgrd) ::  nblen
-      INTEGER,          DIMENSION(jpbgrd) ::  nblenrim
-      INTEGER, POINTER, DIMENSION(:,:)   ::  nbi
-      INTEGER, POINTER, DIMENSION(:,:)   ::  nbj
-      INTEGER, POINTER, DIMENSION(:,:)   ::  nbr
-      INTEGER, POINTER, DIMENSION(:,:)   ::  nbmap
-      REAL(wp)   , POINTER, DIMENSION(:,:)   ::  nbw
-      REAL(wp)   , POINTER, DIMENSION(:,:)   ::  nbd
-      REAL(wp)   , POINTER, DIMENSION(:,:)   ::  nbdout
-      REAL(wp)   , POINTER, DIMENSION(:,:)   ::  flagu
-      REAL(wp)   , POINTER, DIMENSION(:,:)   ::  flagv
+      INTEGER ,          DIMENSION(jpbgrd) ::  nblen
+      INTEGER ,          DIMENSION(jpbgrd) ::  nblenrim
+      INTEGER , POINTER, DIMENSION(:,:)    ::  nbi
+      INTEGER , POINTER, DIMENSION(:,:)    ::  nbj
+      INTEGER , POINTER, DIMENSION(:,:)    ::  nbr
+      INTEGER , POINTER, DIMENSION(:,:)    ::  nbmap
+      REAL(wp), POINTER, DIMENSION(:,:)    ::  nbw
+      REAL(wp), POINTER, DIMENSION(:,:)    ::  nbd
+      REAL(wp), POINTER, DIMENSION(:,:)    ::  nbdout
+      REAL(wp), POINTER, DIMENSION(:,:)    ::  flagu
+      REAL(wp), POINTER, DIMENSION(:,:)    ::  flagv
    END TYPE OBC_INDEX
 
@@ -41,33 +41,33 @@
 
    TYPE, PUBLIC ::   OBC_DATA     !: Storage for external data
-      INTEGER,       DIMENSION(2)     ::  nread
-      LOGICAL                         ::  ll_ssh
-      LOGICAL                         ::  ll_u2d
-      LOGICAL                         ::  ll_v2d
-      LOGICAL                         ::  ll_u3d
-      LOGICAL                         ::  ll_v3d
-      LOGICAL                         ::  ll_tem
-      LOGICAL                         ::  ll_sal
-      REAL(wp), POINTER, DIMENSION(:)     ::  ssh
-      REAL(wp), POINTER, DIMENSION(:)     ::  u2d
-      REAL(wp), POINTER, DIMENSION(:)     ::  v2d
-      REAL(wp), POINTER, DIMENSION(:,:)   ::  u3d
-      REAL(wp), POINTER, DIMENSION(:,:)   ::  v3d
-      REAL(wp), POINTER, DIMENSION(:,:)   ::  tem
-      REAL(wp), POINTER, DIMENSION(:,:)   ::  sal
+      INTEGER          , DIMENSION(2)   ::  nread
+      LOGICAL                           ::  ll_ssh
+      LOGICAL                           ::  ll_u2d
+      LOGICAL                           ::  ll_v2d
+      LOGICAL                           ::  ll_u3d
+      LOGICAL                           ::  ll_v3d
+      LOGICAL                           ::  ll_tem
+      LOGICAL                           ::  ll_sal
+      REAL(wp), POINTER, DIMENSION(:)   ::  ssh
+      REAL(wp), POINTER, DIMENSION(:)   ::  u2d
+      REAL(wp), POINTER, DIMENSION(:)   ::  v2d
+      REAL(wp), POINTER, DIMENSION(:,:) ::  u3d
+      REAL(wp), POINTER, DIMENSION(:,:) ::  v3d
+      REAL(wp), POINTER, DIMENSION(:,:) ::  tem
+      REAL(wp), POINTER, DIMENSION(:,:) ::  sal
 #if defined key_lim2
-      LOGICAL                         ::  ll_frld
-      LOGICAL                         ::  ll_hicif
-      LOGICAL                         ::  ll_hsnif
-      REAL(wp), POINTER, DIMENSION(:)     ::  frld
-      REAL(wp), POINTER, DIMENSION(:)     ::  hicif
-      REAL(wp), POINTER, DIMENSION(:)     ::  hsnif
+      LOGICAL                           ::   ll_frld
+      LOGICAL                           ::   ll_hicif
+      LOGICAL                           ::   ll_hsnif
+      REAL(wp), POINTER, DIMENSION(:)   ::   frld
+      REAL(wp), POINTER, DIMENSION(:)   ::   hicif
+      REAL(wp), POINTER, DIMENSION(:)   ::   hsnif
 #elif defined key_lim3
-      LOGICAL                         ::  ll_a_i
-      LOGICAL                         ::  ll_ht_i
-      LOGICAL                         ::  ll_ht_s
-      REAL, POINTER, DIMENSION(:,:)   ::  a_i   !: now ice leads fraction climatology
-      REAL, POINTER, DIMENSION(:,:)   ::  ht_i  !: Now ice  thickness climatology
-      REAL, POINTER, DIMENSION(:,:)   ::  ht_s  !: now snow thickness
+      LOGICAL                           ::   ll_a_i
+      LOGICAL                           ::   ll_ht_i
+      LOGICAL                           ::   ll_ht_s
+      REAL(wp), POINTER, DIMENSION(:,:) ::   a_i    !: now ice leads fraction climatology
+      REAL(wp), POINTER, DIMENSION(:,:) ::   ht_i   !: Now ice  thickness climatology
+      REAL(wp), POINTER, DIMENSION(:,:) ::   ht_s   !: now snow thickness
 #endif
    END TYPE OBC_DATA
@@ -99,15 +99,15 @@
    INTEGER, DIMENSION(jp_bdy)           ::   nn_tra_dta     !: = 0 use the initial state as bdy dta ; 
                                                             !: = 1 read it in a NetCDF file
-   LOGICAL, DIMENSION(jp_bdy) ::   ln_tra_dmp               !: =T Tracer damping
-   LOGICAL, DIMENSION(jp_bdy) ::   ln_dyn3d_dmp             !: =T Baroclinic velocity damping
-   REAL(wp),    DIMENSION(jp_bdy) ::   rn_time_dmp              !: Damping time scale in days
-   REAL(wp),    DIMENSION(jp_bdy) ::   rn_time_dmp_out          !: Damping time scale in days at radiation outflow points
+   LOGICAL , DIMENSION(jp_bdy) ::   ln_tra_dmp              !: =T Tracer damping
+   LOGICAL , DIMENSION(jp_bdy) ::   ln_dyn3d_dmp            !: =T Baroclinic velocity damping
+   REAL(wp), DIMENSION(jp_bdy) ::   rn_time_dmp             !: Damping time scale in days
+   REAL(wp), DIMENSION(jp_bdy) ::   rn_time_dmp_out         !: Damping time scale in days at radiation outflow points
 
    CHARACTER(len=20), DIMENSION(jp_bdy) ::   cn_ice_lim       ! Choice of boundary condition for sea ice variables 
-   INTEGER, DIMENSION(jp_bdy)           ::   nn_ice_lim_dta   !: = 0 use the initial state as bdy dta ; 
+   INTEGER , DIMENSION(jp_bdy)          ::   nn_ice_lim_dta   !: = 0 use the initial state as bdy dta ; 
                                                               !: = 1 read it in a NetCDF file
-   REAL(wp),    DIMENSION(jp_bdy) ::   rn_ice_tem             !: choice of the temperature of incoming sea ice
-   REAL(wp),    DIMENSION(jp_bdy) ::   rn_ice_sal             !: choice of the salinity    of incoming sea ice
-   REAL(wp),    DIMENSION(jp_bdy) ::   rn_ice_age             !: choice of the age         of incoming sea ice
+   REAL(wp), DIMENSION(jp_bdy) ::   rn_ice_tem              !: choice of the temperature of incoming sea ice
+   REAL(wp), DIMENSION(jp_bdy) ::   rn_ice_sal              !: choice of the salinity    of incoming sea ice
+   REAL(wp), DIMENSION(jp_bdy) ::   rn_ice_age              !: choice of the age         of incoming sea ice
    !
    
Index: branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90
===================================================================
--- branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90	(revision 6019)
+++ branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90	(revision 6020)
@@ -29,5 +29,4 @@
    USE iom             ! IOM library
    USE in_out_manager  ! I/O logical units
-   USE dynspg_oce, ONLY: lk_dynspg_ts ! Split-explicit free surface flag
 #if defined key_lim2
    USE ice_2
@@ -388,10 +387,21 @@
       END DO  ! ib_bdy
 
-      ! bg jchanut tschanges
 #if defined key_tide
-      ! Add tides if not split-explicit free surface else this is done in ts loop
-      IF (.NOT.lk_dynspg_ts) CALL bdy_dta_tides( kt=kt, time_offset=time_offset )
-#endif
-      ! end jchanut tschanges
+      IF (ln_dynspg_ts) THEN      ! Fill temporary arrays with slow-varying bdy data                           
+         DO ib_bdy = 1, nb_bdy    ! Tidal component added in ts loop
+            IF ( nn_dyn2d_dta(ib_bdy) .ge. 2 ) THEN
+               nblen => idx_bdy(ib_bdy)%nblen
+               nblenrim => idx_bdy(ib_bdy)%nblenrim
+               IF( cn_dyn2d(ib_bdy) == 'frs' ) THEN; ilen1(:)=nblen(:) ; ELSE ; ilen1(:)=nblenrim(:) ; ENDIF 
+               IF ( dta_bdy(ib_bdy)%ll_ssh ) dta_bdy_s(ib_bdy)%ssh(1:ilen1(1)) = dta_bdy(ib_bdy)%ssh(1:ilen1(1))
+               IF ( dta_bdy(ib_bdy)%ll_u2d ) dta_bdy_s(ib_bdy)%u2d(1:ilen1(2)) = dta_bdy(ib_bdy)%u2d(1:ilen1(2))
+               IF ( dta_bdy(ib_bdy)%ll_v2d ) dta_bdy_s(ib_bdy)%v2d(1:ilen1(3)) = dta_bdy(ib_bdy)%v2d(1:ilen1(3))
+            ENDIF
+         END DO
+      ELSE ! Add tides if not split-explicit free surface else this is done in ts loop
+         !
+         CALL bdy_dta_tides( kt=kt, time_offset=time_offset )
+      ENDIF
+#endif
 
       IF ( ln_apr_obc ) THEN
@@ -423,5 +433,4 @@
       !!                
       !!----------------------------------------------------------------------
-      USE dynspg_oce, ONLY: lk_dynspg_ts
       !!
       INTEGER     ::  ib_bdy, jfld, jstart, jend, ierror  ! local indices
@@ -430,4 +439,5 @@
       CHARACTER(len=100)                     ::   cn_dir        ! Root directory for location of data files
       CHARACTER(len=100), DIMENSION(nb_bdy)  ::   cn_dir_array  ! Root directory for location of data files
+      CHARACTER(len = 256)::   clname                           ! temporary file name
       LOGICAL                                ::   ln_full_vel   ! =T => full velocities in 3D boundary data
                                                                 ! =F => baroclinic velocities in 3D boundary data
@@ -669,12 +679,20 @@
             ! sea ice
             IF( nn_ice_lim_dta(ib_bdy) .eq. 1 ) THEN
-
                ! Test for types of ice input (lim2 or lim3) 
-               CALL iom_open ( bn_a_i%clname, inum )
-               id1 = iom_varid ( inum, bn_a_i%clvar, kdimsz=zdimsz, kndims=zndims, ldstop = .FALSE. )
+               ! Build file name to find dimensions 
+               clname=TRIM(bn_a_i%clname)
+               IF( .NOT. bn_a_i%ln_clim ) THEN   
+                                                  WRITE(clname, '(a,"_y",i4.4)' ) TRIM( bn_a_i%clname ), nyear    ! add year
+                  IF( bn_a_i%cltype /= 'yearly' ) WRITE(clname, '(a,"m" ,i2.2)' ) TRIM( clname        ), nmonth   ! add month
+               ELSE
+                  IF( bn_a_i%cltype /= 'yearly' ) WRITE(clname, '(a,"_m",i2.2)' ) TRIM( bn_a_i%clname ), nmonth   ! add month
+               ENDIF
+               IF( bn_a_i%cltype == 'daily' .OR. bn_a_i%cltype(1:4) == 'week' ) &
+               &                                  WRITE(clname, '(a,"d" ,i2.2)' ) TRIM( clname        ), nday     ! add day
+               !
+               CALL iom_open  ( clname, inum )
+               id1 = iom_varid( inum, bn_a_i%clvar, kdimsz=zdimsz, kndims=zndims, ldstop = .FALSE. )
                CALL iom_close ( inum )
-               !CALL fld_clopn ( bn_a_i, nyear, nmonth, nday, ldstop=.TRUE. )
-               !CALL iom_open ( bn_a_i%clname, inum )
-               !id1 = iom_varid ( bn_a_i%num, bn_a_i%clvar, kdimsz=zdimsz, kndims=zndims, ldstop = .FALSE. )
+
       	       IF ( zndims == 4 ) THEN
                  ll_bdylim3 = .TRUE.   ! lim3 input
Index: branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90
===================================================================
--- branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90	(revision 6019)
+++ branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90	(revision 6020)
@@ -24,5 +24,4 @@
    USE oce             ! ocean dynamics and tracers 
    USE dom_oce         ! ocean space and time domain
-   USE dynspg_oce      
    USE bdy_oce         ! ocean open boundary conditions
    USE bdydyn2d        ! open boundary conditions for barotropic solution
@@ -35,6 +34,5 @@
    PRIVATE
 
-   PUBLIC   bdy_dyn     ! routine called in dynspg_flt (if lk_dynspg_flt) or 
-                        ! dyn_nxt (if lk_dynspg_ts or lk_dynspg_exp)
+   PUBLIC   bdy_dyn    ! routine called in dyn_nxt
 
 #  include "domzgr_substitute.h90"
Index: branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90
===================================================================
--- branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90	(revision 6019)
+++ branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90	(revision 6020)
@@ -23,5 +23,4 @@
    USE bdy_oce         ! ocean open boundary conditions
    USE bdylib          ! BDY library routines
-   USE dynspg_oce      ! for barotropic variables
    USE phycst          ! physical constants
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
Index: branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim.F90
===================================================================
--- branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim.F90	(revision 6019)
+++ branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim.F90	(revision 6020)
@@ -59,13 +59,15 @@
       !!
       !!----------------------------------------------------------------------
-      INTEGER, INTENT( in ) :: kt     ! Main time step counter
-      INTEGER               :: ib_bdy ! Loop index
-
+      INTEGER, INTENT( in ) ::   kt   ! Main time step counter
+      !
+      INTEGER ::   ib_bdy   ! Loop index
+      !!----------------------------------------------------------------------
+      !
 #if defined key_lim3
       CALL lim_var_glo2eqv
 #endif
-
+      !
       DO ib_bdy=1, nb_bdy
-
+         !
          SELECT CASE( cn_ice_lim(ib_bdy) )
          CASE('none')
@@ -76,13 +78,14 @@
             CALL ctl_stop( 'bdy_ice_lim : unrecognised option for open boundaries for ice fields' )
          END SELECT
-
+         !
       END DO
-
+      !
 #if defined key_lim3
       CALL lim_var_zapsmall
       CALL lim_var_agg(1)
 #endif
-
+      !
    END SUBROUTINE bdy_ice_lim
+
 
    SUBROUTINE bdy_ice_frs( idx, dta, kt, ib_bdy )
@@ -96,19 +99,22 @@
       !!             dimensional baroclinic ocean model with realistic topography. Tellus, 365-382.
       !!------------------------------------------------------------------------------
-      TYPE(OBC_INDEX), INTENT(in) ::   idx  ! OBC indices
-      TYPE(OBC_DATA),  INTENT(in) ::   dta  ! OBC external data
-      INTEGER,         INTENT(in) ::   kt   ! main time-step counter
+      TYPE(OBC_INDEX), INTENT(in) ::   idx     ! OBC indices
+      TYPE(OBC_DATA),  INTENT(in) ::   dta     ! OBC external data
+      INTEGER,         INTENT(in) ::   kt      ! main time-step counter
       INTEGER,         INTENT(in) ::   ib_bdy  ! BDY set index
-
+      !
       INTEGER  ::   jpbound            ! 0 = incoming ice
-                                       ! 1 = outgoing ice
+      !                                ! 1 = outgoing ice
       INTEGER  ::   jb, jk, jgrd, jl   ! dummy loop indices
       INTEGER  ::   ji, jj, ii, ij     ! local scalar
       REAL(wp) ::   zwgt, zwgt1        ! local scalar
       REAL(wp) ::   ztmelts, zdh
-
-      !!------------------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 ) CALL timing_start('bdy_ice_frs')
+#if  defined key_lim2 && ! defined key_lim2_vp && defined key_agrif
+     USE ice_2, vt_s => hsnm
+     USE ice_2, vt_i => hicm
+#endif
+      !!------------------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )   CALL timing_start('bdy_ice_frs')
       !
       jgrd = 1      ! Everything is at T-points here
@@ -177,30 +183,29 @@
             ! condition on ice thickness depends on the ice velocity
             ! if velocity is outward (strictly), then ice thickness, volume... must be equal to adjacent values
-            jpbound = 0; ii = ji; ij = jj;
-
+            jpbound = 0   ;   ii = ji   ;   ij = jj
+            !
             IF( u_ice(ji+1,jj  ) < 0. .AND. umask(ji-1,jj  ,1) == 0. ) jpbound = 1; ii = ji+1; ij = jj
             IF( u_ice(ji-1,jj  ) > 0. .AND. umask(ji+1,jj  ,1) == 0. ) jpbound = 1; ii = ji-1; ij = jj
             IF( v_ice(ji  ,jj+1) < 0. .AND. vmask(ji  ,jj-1,1) == 0. ) jpbound = 1; ii = ji  ; ij = jj+1
             IF( v_ice(ji  ,jj-1) > 0. .AND. vmask(ji  ,jj+1,1) == 0. ) jpbound = 1; ii = ji  ; ij = jj-1
-
+            !
             IF( nn_ice_lim_dta(ib_bdy) == 0 ) jpbound = 0; ii = ji; ij = jj   ! case ice boundaries = initial conditions
-                                                                              !      do not make state variables dependent on velocity
-               
-
+            !                                                                 !      do not make state variables dependent on velocity
+            !
             rswitch = MAX( 0.0_wp , SIGN ( 1.0_wp , at_i(ii,ij) - 0.01 ) ) ! 0 if no ice
-
+            !
             ! concentration and thickness
             a_i (ji,jj,jl) = a_i (ii,ij,jl) * rswitch
             ht_i(ji,jj,jl) = ht_i(ii,ij,jl) * rswitch
             ht_s(ji,jj,jl) = ht_s(ii,ij,jl) * rswitch
-
+            !
             ! Ice and snow volumes
             v_i(ji,jj,jl) = ht_i(ji,jj,jl) * a_i(ji,jj,jl)
             v_s(ji,jj,jl) = ht_s(ji,jj,jl) * a_i(ji,jj,jl)
-
+            !
             SELECT CASE( jpbound )
-
-            CASE( 0 ) ! velocity is inward
-
+            !
+            CASE( 0 )   ! velocity is inward
+               !
                ! Ice salinity, age, temperature
                sm_i(ji,jj,jl)   = rswitch * rn_ice_sal(ib_bdy)  + ( 1.0 - rswitch ) * rn_simin
@@ -214,7 +219,7 @@
                   s_i(ji,jj,jk,jl) = rswitch * rn_ice_sal(ib_bdy) + ( 1.0 - rswitch ) * rn_simin
                END DO
-               
-            CASE( 1 ) ! velocity is outward
- 
+               !
+            CASE( 1 )   ! velocity is outward
+               !
                ! Ice salinity, age, temperature
                sm_i(ji,jj,jl)   = rswitch * sm_i(ii,ij,jl)  + ( 1.0 - rswitch ) * rn_simin
@@ -228,13 +233,12 @@
                   s_i(ji,jj,jk,jl) = rswitch * s_i(ii,ij,jk,jl) + ( 1.0 - rswitch ) * rn_simin
                END DO
-
+               !
             END SELECT
-
-            ! if salinity is constant, then overwrite rn_ice_sal
-            IF( nn_icesal == 1 ) THEN
-               sm_i(ji,jj,jl)   = rn_icesal
+            !
+            IF( nn_icesal == 1 ) THEN     ! constant salinity : overwrite rn_ice_sal
+               sm_i(ji,jj  ,jl) = rn_icesal
                s_i (ji,jj,:,jl) = rn_icesal
             ENDIF
-
+            !
             ! contents
             smv_i(ji,jj,jl)  = MIN( sm_i(ji,jj,jl) , sss_m(ji,jj) ) * v_i(ji,jj,jl)
@@ -255,7 +259,7 @@
                e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * a_i(ji,jj,jl) * ht_i(ji,jj,jl) * r1_nlay_i
             END DO
-
+            !
          END DO
- 
+         !
          CALL lbc_bdy_lnk(  a_i(:,:,jl), 'T', 1., ib_bdy )
          CALL lbc_bdy_lnk( ht_i(:,:,jl), 'T', 1., ib_bdy )
@@ -263,5 +267,5 @@
          CALL lbc_bdy_lnk(  v_i(:,:,jl), 'T', 1., ib_bdy )
          CALL lbc_bdy_lnk(  v_s(:,:,jl), 'T', 1., ib_bdy )
- 
+         !
          CALL lbc_bdy_lnk( smv_i(:,:,jl), 'T', 1., ib_bdy )
          CALL lbc_bdy_lnk(  sm_i(:,:,jl), 'T', 1., ib_bdy )
@@ -276,10 +280,10 @@
             CALL lbc_bdy_lnk(e_i(:,:,jk,jl), 'T', 1., ib_bdy )
          END DO
-
+         !
       END DO !jl
-    
+      !
 #endif
       !      
-      IF( nn_timing == 1 ) CALL timing_stop('bdy_ice_frs')
+      IF( nn_timing == 1 )   CALL timing_stop('bdy_ice_frs')
       !
    END SUBROUTINE bdy_ice_frs
@@ -296,11 +300,11 @@
       !! 2013-06 : C. Rousset
       !!------------------------------------------------------------------------------
-      !!
       CHARACTER(len=1), INTENT(in)  ::   cd_type   ! nature of velocity grid-points
+      !
       INTEGER  ::   jb, jgrd           ! dummy loop indices
       INTEGER  ::   ji, jj             ! local scalar
       INTEGER  ::   ib_bdy             ! Loop index
       REAL(wp) ::   zmsk1, zmsk2, zflag
-     !!------------------------------------------------------------------------------
+      !!------------------------------------------------------------------------------
       !
       IF( nn_timing == 1 ) CALL timing_start('bdy_ice_lim_dyn')
@@ -309,18 +313,15 @@
          !
          SELECT CASE( cn_ice_lim(ib_bdy) )
-
+         !
          CASE('none')
-
             CYCLE
-            
+            !
          CASE('frs')
-            
+            !
             IF( nn_ice_lim_dta(ib_bdy) == 0 ) CYCLE            ! case ice boundaries = initial conditions 
-                                                               !      do not change ice velocity (it is only computed by rheology)
- 
+            !                                                  !      do not change ice velocity (it is only computed by rheology)
             SELECT CASE ( cd_type )
-               
-            CASE ( 'U' )
-               
+            !     
+            CASE ( 'U' )  
                jgrd = 2      ! u velocity
                DO jb = 1, idx_bdy(ib_bdy)%nblen(jgrd)
@@ -328,10 +329,10 @@
                   jj    = idx_bdy(ib_bdy)%nbj(jb,jgrd)
                   zflag = idx_bdy(ib_bdy)%flagu(jb,jgrd)
-                  
+                  !
                   IF ( ABS( zflag ) == 1. ) THEN  ! eastern and western boundaries
                      ! one of the two zmsk is always 0 (because of zflag)
                      zmsk1 = 1._wp - MAX( 0.0_wp, SIGN ( 1.0_wp , - vt_i(ji+1,jj) ) ) ! 0 if no ice
                      zmsk2 = 1._wp - MAX( 0.0_wp, SIGN ( 1.0_wp , - vt_i(ji-1,jj) ) ) ! 0 if no ice
-                     
+                     !  
                      ! u_ice = u_ice of the adjacent grid point except if this grid point is ice-free (then u_ice = u_oce)
                      u_ice (ji,jj) = u_ice(ji+1,jj) * 0.5_wp * ABS( zflag + 1._wp ) * zmsk1 + &
@@ -345,11 +346,9 @@
                   rswitch = MAX( 0.0_wp , SIGN ( 1.0_wp , at_i(ji,jj) - 0.01_wp ) ) ! 0 if no ice
                   u_ice(ji,jj) = rswitch * u_ice(ji,jj)
-                  
-               ENDDO
-               
+                  !
+               END DO
                CALL lbc_bdy_lnk( u_ice(:,:), 'U', -1., ib_bdy )
-               
+               !
             CASE ( 'V' )
-               
                jgrd = 3      ! v velocity
                DO jb = 1, idx_bdy(ib_bdy)%nblen(jgrd)
@@ -357,10 +356,10 @@
                   jj    = idx_bdy(ib_bdy)%nbj(jb,jgrd)
                   zflag = idx_bdy(ib_bdy)%flagv(jb,jgrd)
-                  
+                  !
                   IF ( ABS( zflag ) == 1. ) THEN  ! northern and southern boundaries
                      ! one of the two zmsk is always 0 (because of zflag)
                      zmsk1 = 1._wp - MAX( 0.0_wp, SIGN ( 1.0_wp , - vt_i(ji,jj+1) ) ) ! 0 if no ice
                      zmsk2 = 1._wp - MAX( 0.0_wp, SIGN ( 1.0_wp , - vt_i(ji,jj-1) ) ) ! 0 if no ice
-                     
+                     !  
                      ! u_ice = u_ice of the adjacent grid point except if this grid point is ice-free (then u_ice = u_oce)
                      v_ice (ji,jj) = v_ice(ji,jj+1) * 0.5_wp * ABS( zflag + 1._wp ) * zmsk1 + &
@@ -374,19 +373,18 @@
                   rswitch = MAX( 0.0_wp , SIGN ( 1.0_wp , at_i(ji,jj) - 0.01 ) ) ! 0 if no ice
                   v_ice(ji,jj) = rswitch * v_ice(ji,jj)
-                  
-               ENDDO
-               
+                  !
+               END DO
                CALL lbc_bdy_lnk( v_ice(:,:), 'V', -1., ib_bdy )
-                  
+               !
             END SELECT
-            
+            !
          CASE DEFAULT
             CALL ctl_stop( 'bdy_ice_lim_dyn : unrecognised option for open boundaries for ice fields' )
          END SELECT
-         
-      ENDDO
-
+         !
+      END DO
+      !
       IF( nn_timing == 1 ) CALL timing_stop('bdy_ice_lim_dyn')
-      
+      !
     END SUBROUTINE bdy_ice_lim_dyn
 
Index: branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90
===================================================================
--- branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90	(revision 6019)
+++ branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90	(revision 6020)
@@ -76,5 +76,5 @@
       INTEGER  ::   ib_bdy, ii, ij, ik, igrd, ib, ir, iseg ! dummy loop indices
       INTEGER  ::   icount, icountr, ibr_max, ilen1, ibm1  ! local integers
-      INTEGER  ::   iw, ie, is, in, inum, id_dummy         !   -       -
+      INTEGER  ::   iwe, ies, iso, ino, inum, id_dummy     !   -       -
       INTEGER  ::   igrd_start, igrd_end, jpbdta           !   -       -
       INTEGER  ::   jpbdtau, jpbdtas                       !   -       -
@@ -777,8 +777,8 @@
 !      is = mjg(1) + 1            ! if monotasking and no zoom, is=2
 !      in = mjg(1) + nlcj-1 - 1   ! if monotasking and no zoom, in=jpjm1      
-      iw = mig(1) - jpizoom + 2         ! if monotasking and no zoom, iw=2
-      ie = mig(1) + nlci - jpizoom - 1  ! if monotasking and no zoom, ie=jpim1
-      is = mjg(1) - jpjzoom + 2         ! if monotasking and no zoom, is=2
-      in = mjg(1) + nlcj - jpjzoom - 1  ! if monotasking and no zoom, in=jpjm1
+      iwe = mig(1) - jpizoom + 2         ! if monotasking and no zoom, iw=2
+      ies = mig(1) + nlci - jpizoom - 1  ! if monotasking and no zoom, ie=jpim1
+      iso = mjg(1) - jpjzoom + 2         ! if monotasking and no zoom, is=2
+      ino = mjg(1) + nlcj - jpjzoom - 1  ! if monotasking and no zoom, in=jpjm1
 
       ALLOCATE( nbondi_bdy(nb_bdy))
@@ -853,6 +853,6 @@
                ENDIF
                ! check if point is in local domain
-               IF(  nbidta(ib,igrd,ib_bdy) >= iw .AND. nbidta(ib,igrd,ib_bdy) <= ie .AND.   &
-                  & nbjdta(ib,igrd,ib_bdy) >= is .AND. nbjdta(ib,igrd,ib_bdy) <= in       ) THEN
+               IF(  nbidta(ib,igrd,ib_bdy) >= iwe .AND. nbidta(ib,igrd,ib_bdy) <= ies .AND.   &
+                  & nbjdta(ib,igrd,ib_bdy) >= iso .AND. nbjdta(ib,igrd,ib_bdy) <= ino      ) THEN
                   !
                   icount = icount  + 1
@@ -890,4 +890,5 @@
          com_south_b = 0
          com_north_b = 0
+
          DO igrd = 1, jpbgrd
             icount  = 0
@@ -896,6 +897,6 @@
                DO ib = 1, nblendta(igrd,ib_bdy)
                   ! check if point is in local domain and equals ir
-                  IF(  nbidta(ib,igrd,ib_bdy) >= iw .AND. nbidta(ib,igrd,ib_bdy) <= ie .AND.   &
-                     & nbjdta(ib,igrd,ib_bdy) >= is .AND. nbjdta(ib,igrd,ib_bdy) <= in .AND.   &
+                  IF(  nbidta(ib,igrd,ib_bdy) >= iwe .AND. nbidta(ib,igrd,ib_bdy) <= ies .AND.   &
+                     & nbjdta(ib,igrd,ib_bdy) >= iso .AND. nbjdta(ib,igrd,ib_bdy) <= ino .AND.   &
                      & nbrdta(ib,igrd,ib_bdy) == ir  ) THEN
                      !
@@ -1594,5 +1595,5 @@
             ELSE
                ! This is a corner
-               WRITE(numout,*) 'Found a South-West corner at (i,j): ', jpiwob(ib), jpjwdt(ib)
+               IF(lwp) WRITE(numout,*) 'Found a South-West corner at (i,j): ', jpiwob(ib), jpjwdt(ib)
                CALL bdy_ctl_corn(npckgw(ib), icornw(ib,1))
                itest=itest+1
@@ -1608,5 +1609,5 @@
             ELSE
                ! This is a corner
-               WRITE(numout,*) 'Found a North-West corner at (i,j): ', jpiwob(ib), jpjwft(ib)
+               IF(lwp) WRITE(numout,*) 'Found a North-West corner at (i,j): ', jpiwob(ib), jpjwft(ib)
                CALL bdy_ctl_corn(npckgw(ib), icornw(ib,2))
                itest=itest+1
@@ -1638,5 +1639,5 @@
             ELSE
                ! This is a corner
-               WRITE(numout,*) 'Found a South-East corner at (i,j): ', jpieob(ib)+1, jpjedt(ib)
+               IF(lwp) WRITE(numout,*) 'Found a South-East corner at (i,j): ', jpieob(ib)+1, jpjedt(ib)
                CALL bdy_ctl_corn(npckge(ib), icorne(ib,1))
                itest=itest+1
@@ -1652,5 +1653,5 @@
             ELSE
                ! This is a corner
-               WRITE(numout,*) 'Found a North-East corner at (i,j): ', jpieob(ib)+1, jpjeft(ib)
+               IF(lwp) WRITE(numout,*) 'Found a North-East corner at (i,j): ', jpieob(ib)+1, jpjeft(ib)
                CALL bdy_ctl_corn(npckge(ib), icorne(ib,2))
                itest=itest+1
Index: branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90
===================================================================
--- branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90	(revision 6019)
+++ branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90	(revision 6020)
@@ -33,5 +33,4 @@
 !   USE tide_mod       ! Useless ??
    USE fldread
-   USE dynspg_oce, ONLY: lk_dynspg_ts
 
    IMPLICIT NONE
@@ -54,5 +53,5 @@
    TYPE(TIDES_DATA), PUBLIC, DIMENSION(jp_bdy), TARGET :: tides  !: External tidal harmonics data
 !$AGRIF_END_DO_NOT_TREAT
-   TYPE(OBC_DATA)  , PRIVATE, DIMENSION(jp_bdy) :: dta_bdy_s  !: bdy external data (slow component)
+   TYPE(OBC_DATA)  , PUBLIC, DIMENSION(jp_bdy) :: dta_bdy_s  !: bdy external data (slow component)
 
    !!----------------------------------------------------------------------
@@ -270,13 +269,12 @@
             ENDIF
             !
-            IF ( lk_dynspg_ts ) THEN ! Allocate arrays to save slowly varying boundary data during
-                                     ! time splitting integration
-               ALLOCATE( dta_bdy_s(ib_bdy)%ssh ( ilen0(1) ) )
-               ALLOCATE( dta_bdy_s(ib_bdy)%u2d ( ilen0(2) ) )
-               ALLOCATE( dta_bdy_s(ib_bdy)%v2d ( ilen0(3) ) )
-               dta_bdy_s(ib_bdy)%ssh(:) = 0.e0
-               dta_bdy_s(ib_bdy)%u2d(:) = 0.e0
-               dta_bdy_s(ib_bdy)%v2d(:) = 0.e0
-            ENDIF
+            ! Allocate slow varying data in the case of time splitting:
+            ! Do it anyway because at this stage knowledge of free surface scheme is unknown
+            ALLOCATE( dta_bdy_s(ib_bdy)%ssh ( ilen0(1) ) )
+            ALLOCATE( dta_bdy_s(ib_bdy)%u2d ( ilen0(2) ) )
+            ALLOCATE( dta_bdy_s(ib_bdy)%v2d ( ilen0(3) ) )
+            dta_bdy_s(ib_bdy)%ssh(:) = 0.e0
+            dta_bdy_s(ib_bdy)%u2d(:) = 0.e0
+            dta_bdy_s(ib_bdy)%v2d(:) = 0.e0
             !
          ENDIF ! nn_dyn2d_dta(ib_bdy) .ge. 2
@@ -397,5 +395,5 @@
       !!
       LOGICAL  :: lk_first_btstp  ! =.TRUE. if time splitting and first barotropic step
-      INTEGER,          DIMENSION(jpbgrd) :: ilen0 
+      INTEGER, DIMENSION(jpbgrd) :: ilen0 
       INTEGER, DIMENSION(1:jpbgrd) :: nblen, nblenrim  ! short cuts
       INTEGER  :: itide, ib_bdy, ib, igrd                     ! loop indices
@@ -416,5 +414,5 @@
       ! Absolute time from model initialization:   
       IF( PRESENT(kit) ) THEN  
-         z_arg = ( kt + (kit+0.5_wp*(time_add-1)) / REAL(nn_baro,wp) ) * rdt
+         z_arg = ( kt + (kit+time_add-1) / REAL(nn_baro,wp) ) * rdt
       ELSE                              
          z_arg = ( kt + time_add ) * rdt
@@ -456,16 +454,9 @@
             zoff = -kt_tide * rdt ! time offset relative to nodal factor computation time
             !
-            ! If time splitting, save data at first barotropic iteration
-            IF ( PRESENT(kit) ) THEN
-               IF ( lk_first_btstp ) THEN ! Save slow varying open boundary data:
-                  IF ( dta_bdy(ib_bdy)%ll_ssh ) dta_bdy_s(ib_bdy)%ssh(1:ilen0(1)) = dta_bdy(ib_bdy)%ssh(1:ilen0(1))
-                  IF ( dta_bdy(ib_bdy)%ll_u2d ) dta_bdy_s(ib_bdy)%u2d(1:ilen0(2)) = dta_bdy(ib_bdy)%u2d(1:ilen0(2))
-                  IF ( dta_bdy(ib_bdy)%ll_v2d ) dta_bdy_s(ib_bdy)%v2d(1:ilen0(3)) = dta_bdy(ib_bdy)%v2d(1:ilen0(3))
-
-               ELSE ! Initialize arrays from slow varying open boundary data:            
-                  IF ( dta_bdy(ib_bdy)%ll_ssh ) dta_bdy(ib_bdy)%ssh(1:ilen0(1)) = dta_bdy_s(ib_bdy)%ssh(1:ilen0(1))
-                  IF ( dta_bdy(ib_bdy)%ll_u2d ) dta_bdy(ib_bdy)%u2d(1:ilen0(2)) = dta_bdy_s(ib_bdy)%u2d(1:ilen0(2))
-                  IF ( dta_bdy(ib_bdy)%ll_v2d ) dta_bdy(ib_bdy)%v2d(1:ilen0(3)) = dta_bdy_s(ib_bdy)%v2d(1:ilen0(3))
-               ENDIF
+            ! If time splitting, initialize arrays from slow varying open boundary data:
+            IF ( PRESENT(kit) ) THEN           
+               IF ( dta_bdy(ib_bdy)%ll_ssh ) dta_bdy(ib_bdy)%ssh(1:ilen0(1)) = dta_bdy_s(ib_bdy)%ssh(1:ilen0(1))
+               IF ( dta_bdy(ib_bdy)%ll_u2d ) dta_bdy(ib_bdy)%u2d(1:ilen0(2)) = dta_bdy_s(ib_bdy)%u2d(1:ilen0(2))
+               IF ( dta_bdy(ib_bdy)%ll_v2d ) dta_bdy(ib_bdy)%v2d(1:ilen0(3)) = dta_bdy_s(ib_bdy)%v2d(1:ilen0(3))
             ENDIF
             !
Index: branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdyvol.F90
===================================================================
--- branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdyvol.F90	(revision 6019)
+++ branches/UKMO/icebergs_restart_single_file/NEMOGCM/NEMO/OPA_SRC/BDY/bdyvol.F90	(revision 6020)
@@ -10,28 +10,29 @@
    !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
    !!----------------------------------------------------------------------
-#if   defined key_bdy   &&   defined key_dynspg_flt
+#if   defined key_bdy
    !!----------------------------------------------------------------------
-   !!   'key_bdy'            AND      unstructured open boundary conditions
-   !!   'key_dynspg_flt'                              filtered free surface
+   !!   'key_bdy'      unstructured open boundary conditions
    !!----------------------------------------------------------------------
-   USE timing          ! Timing
    USE oce             ! ocean dynamics and tracers 
-   USE sbcisf          ! ice shelf
+   USE bdy_oce         ! ocean open boundary conditions
+   USE sbc_oce         ! ocean surface boundary conditions
    USE dom_oce         ! ocean space and time domain 
    USE phycst          ! physical constants
-   USE bdy_oce         ! ocean open boundary conditions
+   USE sbcisf          ! ice shelf
+   !
+   USE in_out_manager  ! I/O manager
    USE lib_mpp         ! for mppsum
-   USE in_out_manager  ! I/O manager
-   USE sbc_oce         ! ocean surface boundary conditions
+   USE timing          ! Timing
+   USE lib_fortran     ! Fortran routines library
 
    IMPLICIT NONE
    PRIVATE
 
-   PUBLIC bdy_vol        ! routine called by dynspg_flt.h90
+   PUBLIC bdy_vol      
 
    !! * Substitutions
 #  include "domzgr_substitute.h90"
    !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
+   !! NEMO/OPA 3.6 , NEMO Consortium (2014)
    !! $Id$
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
@@ -43,6 +44,6 @@
       !!                      ***  ROUTINE bdyvol  ***
       !!
-      !! ** Purpose :   This routine is called in dynspg_flt to control 
-      !!      the volume of the system. A correction velocity is calculated
+      !! ** Purpose :   This routine controls the volume of the system. 
+      !!      A correction velocity is calculated
       !!      to correct the total transport through the unstructured OBC. 
       !!      The total depth used is constant (H0) to be consistent with the 
@@ -78,9 +79,9 @@
       TYPE(OBC_INDEX), POINTER :: idx
       !!-----------------------------------------------------------------------------
-
-      IF( nn_timing == 1 ) CALL timing_start('bdy_vol')
-
+      !
+      IF( nn_timing == 1 )   CALL timing_start('bdy_vol')
+      !
       IF( ln_vol ) THEN
-
+      !
       IF( kt == nit000 ) THEN 
          IF(lwp) WRITE(numout,*)
@@ -91,13 +92,17 @@
       ! Calculate the cumulate surface Flux z_cflxemp (m3/s) over all the domain
       ! -----------------------------------------------------------------------
-      z_cflxemp = SUM ( ( emp(:,:)-rnf(:,:)+rdivisf*fwfisf(:,:) ) * bdytmask(:,:) * e1t(:,:) * e2t(:,:) ) / rau0
+!!gm replace these lines :
+      z_cflxemp = SUM ( ( emp(:,:)-rnf(:,:)+fwfisf(:,:) ) * bdytmask(:,:) * e1e2t(:,:) ) / rau0
       IF( lk_mpp )   CALL mpp_sum( z_cflxemp )     ! sum over the global domain
+!!gm   by :
+!!gm      z_cflxemp = glob_sum(  ( emp(:,:)-rnf(:,:)+fwfisf(:,:) ) * bdytmask(:,:) * e1e2t(:,:)  ) / rau0
+!!gm
 
       ! Transport through the unstructured open boundary
       ! ------------------------------------------------
-      zubtpecor = 0.e0
+      zubtpecor = 0._wp
       DO ib_bdy = 1, nb_bdy
          idx => idx_bdy(ib_bdy)
-
+         !
          jgrd = 2                               ! cumulate u component contribution first 
          DO jb = 1, idx%nblenrim(jgrd)
@@ -116,5 +121,5 @@
             END DO
          END DO
-
+         !
       END DO
       IF( lk_mpp )   CALL mpp_sum( zubtpecor )   ! sum over the global domain
@@ -123,13 +128,13 @@
       ! ------------------------------
       IF( nn_volctl==1 ) THEN   ;   zubtpecor = ( zubtpecor - z_cflxemp) / bdysurftot 
-      ELSE                   ;   zubtpecor =   zubtpecor             / bdysurftot
+      ELSE                      ;   zubtpecor =   zubtpecor             / bdysurftot
       END IF
 
       ! Correction of the total velocity on the unstructured boundary to respect the mass flux conservation
       ! -------------------------------------------------------------
-      ztranst = 0.e0
+      ztranst = 0._wp
       DO ib_bdy = 1, nb_bdy
          idx => idx_bdy(ib_bdy)
-
+         !
          jgrd = 2                               ! correct u component
          DO jb = 1, idx%nblenrim(jgrd)
@@ -150,5 +155,5 @@
             END DO
          END DO
-
+         !
       END DO
       IF( lk_mpp )   CALL mpp_sum( ztranst )   ! sum over the global domain
@@ -169,5 +174,5 @@
       !
       END IF ! ln_vol
-
+      !
    END SUBROUTINE bdy_vol
 
