Index: branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/C1D_PAPA/EXP00/namelist_cfg
===================================================================
--- branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/C1D_PAPA/EXP00/namelist_cfg	(revision 6862)
+++ branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/C1D_PAPA/EXP00/namelist_cfg	(revision 6863)
@@ -178,9 +178,9 @@
 /
 !-----------------------------------------------------------------------
-&nambdy        !  unstructured open boundaries                          ("key_bdy")
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&nambdy_dta      !  open boundaries - external data           ("key_bdy")
+&nambdy        !  unstructured open boundaries                          
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nambdy_dta      !  open boundaries - external data           
 !-----------------------------------------------------------------------
 /
Index: branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/GYRE/EXP00/namelist_cfg
===================================================================
--- branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/GYRE/EXP00/namelist_cfg	(revision 6862)
+++ branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/GYRE/EXP00/namelist_cfg	(revision 6863)
@@ -158,9 +158,9 @@
 /
 !-----------------------------------------------------------------------
-&nambdy        !  unstructured open boundaries                          ("key_bdy")
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&nambdy_dta      !  open boundaries - external data           ("key_bdy")
+&nambdy        !  unstructured open boundaries                          
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nambdy_dta      !  open boundaries - external data           
 !-----------------------------------------------------------------------
 /
Index: branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/GYRE_BFM/EXP00/namelist_cfg
===================================================================
--- branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/GYRE_BFM/EXP00/namelist_cfg	(revision 6862)
+++ branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/GYRE_BFM/EXP00/namelist_cfg	(revision 6863)
@@ -163,9 +163,9 @@
 /
 !-----------------------------------------------------------------------
-&nambdy        !  unstructured open boundaries                          ("key_bdy")
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&nambdy_dta      !  open boundaries - external data           ("key_bdy")
+&nambdy        !  unstructured open boundaries                          
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nambdy_dta      !  open boundaries - external data           
 !-----------------------------------------------------------------------
 /
Index: branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/GYRE_XIOS/EXP00/namelist_cfg
===================================================================
--- branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/GYRE_XIOS/EXP00/namelist_cfg	(revision 6862)
+++ branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/GYRE_XIOS/EXP00/namelist_cfg	(revision 6863)
@@ -156,9 +156,9 @@
 /
 !-----------------------------------------------------------------------
-&nambdy        !  unstructured open boundaries                          ("key_bdy")
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&nambdy_dta      !  open boundaries - external data           ("key_bdy")
+&nambdy        !  unstructured open boundaries                          
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nambdy_dta      !  open boundaries - external data           
 !-----------------------------------------------------------------------
 /
Index: branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_cfg
===================================================================
--- branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_cfg	(revision 6862)
+++ branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_cfg	(revision 6863)
@@ -142,9 +142,9 @@
 /
 !-----------------------------------------------------------------------
-&nambdy        !  unstructured open boundaries                          ("key_bdy")
-!-----------------------------------------------------------------------
-/
-!-----------------------------------------------------------------------
-&nambdy_dta      !  open boundaries - external data           ("key_bdy")
+&nambdy        !  unstructured open boundaries                          
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nambdy_dta      !  open boundaries - external data           
 !-----------------------------------------------------------------------
 /
Index: branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/SHARED/namelist_ref
===================================================================
--- branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 6862)
+++ branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 6863)
@@ -589,7 +589,7 @@
 !!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif")
 !!   nam_tide      Tidal forcing 
-!!   nambdy        Unstructured open boundaries                         ("key_bdy")
-!!   nambdy_dta    Unstructured open boundaries - external data         ("key_bdy")
-!!   nambdy_tide   tidal forcing at open boundaries                     ("key_bdy_tides")
+!!   nambdy        Unstructured open boundaries                         
+!!   nambdy_dta    Unstructured open boundaries - external data         
+!!   nambdy_tide   tidal forcing at open boundaries                     
 !!======================================================================
 !
@@ -619,5 +619,5 @@
 /
 !-----------------------------------------------------------------------
-&nambdy        !  unstructured open boundaries                          ("key_bdy")
+&nambdy        !  unstructured open boundaries                          
 !-----------------------------------------------------------------------
     ln_bdy         = .false.              !  Use unstructured open boundaries
@@ -654,5 +654,5 @@
 /
 !-----------------------------------------------------------------------
-&nambdy_dta    !  open boundaries - external data                       ("key_bdy")
+&nambdy_dta    !  open boundaries - external data                       
 !-----------------------------------------------------------------------
 !              !  file name      ! frequency (hours) ! variable  ! time interp.!  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
Index: branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90
===================================================================
--- branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90	(revision 6862)
+++ branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90	(revision 6863)
@@ -52,11 +52,75 @@
    !!----------------------------------------------------------------------
 CONTAINS
-   
+
    SUBROUTINE bdy_init
       !!----------------------------------------------------------------------
       !!                 ***  ROUTINE bdy_init  ***
+      !!
+      !! ** Purpose :   Initialization of the dynamics and tracer fields with
+      !!              unstructured open boundaries.
+      !!
+      !! ** Method  :   Read initialization arrays (mask, indices) to identify
+      !!              an unstructured open boundary
+      !!
+      !! ** Input   :  bdy_init.nc, input file for unstructured open boundaries
+      !!----------------------------------------------------------------------
+      NAMELIST/nambdy/ ln_bdy, nb_bdy, ln_coords_file, cn_coords_file,         &
+         &             ln_mask_file, cn_mask_file, cn_dyn2d, nn_dyn2d_dta,     &
+         &             cn_dyn3d, nn_dyn3d_dta, cn_tra, nn_tra_dta,             &
+         &             ln_tra_dmp, ln_dyn3d_dmp, rn_time_dmp, rn_time_dmp_out, &
+         &             cn_ice_lim, nn_ice_lim_dta,                             &
+         &             rn_ice_tem, rn_ice_sal, rn_ice_age,                     &
+         &             ln_vol, nn_volctl, nn_rimwidth
+         !
+      INTEGER  ::   ios                 ! Local integer output status for namelist read
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )   CALL timing_start('bdy_init')
+
+      ! ------------------------
+      ! Read namelist parameters
+      ! ------------------------
+      REWIND( numnam_ref )              ! Namelist nambdy in reference namelist :Unstructured open boundaries
+      READ  ( numnam_ref, nambdy, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in reference namelist', lwp )
+      !
+      REWIND( numnam_cfg )              ! Namelist nambdy in configuration namelist :Unstructured open boundaries
+      READ  ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in configuration namelist', lwp )
+      IF(lwm) WRITE ( numond, nambdy )
+
+      ! -----------------------------------------
+      ! unstructured open boundaries use control
+      ! -----------------------------------------
+      IF ( ln_bdy ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'bdy_init : initialization of open boundaries'
+         IF(lwp) WRITE(numout,*) '~~~~~~~~'
+         !
+         ! Open boundaries definition (arrays and masks)
+         CALL bdy_segs
+         !
+         ! Open boundaries initialisation of external data arrays
+         CALL bdy_dta_init
+         !
+         ! Open boundaries initialisation of tidal harmonic forcing
+         IF( lk_tide ) CALL bdytide_init
+         !
+      ELSE
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) 'bdy_init : open boundaries not used (ln_bdy = F)'
+         IF(lwp) WRITE(numout,*) '~~~~~~~~'
+         !
+      ENDIF
+      !
+      IF( nn_timing == 1 )   CALL timing_stop('bdy_init')
+      !
+   END SUBROUTINE bdy_init
+   
+   SUBROUTINE bdy_segs
+      !!----------------------------------------------------------------------
+      !!                 ***  ROUTINE bdy_init  ***
       !!         
-      !! ** Purpose :   Initialization of the dynamics and tracer fields with 
-      !!              unstructured open boundaries.
+      !! ** Purpose :   Definition of unstructured open boundaries.
       !!
       !! ** Method  :   Read initialization arrays (mask, indices) to identify 
@@ -89,53 +153,19 @@
       REAL(wp), POINTER, DIMENSION(:,:)       ::   zfmask  ! temporary fmask array excluding coastal boundary condition (shlat)
       !!
-      CHARACTER(LEN=80),DIMENSION(jpbgrd)  ::   clfile     ! Namelist variables
       CHARACTER(LEN=1)                     ::   ctypebdy   !     -        - 
       INTEGER                              ::   nbdyind, nbdybeg, nbdyend
       !!
-      NAMELIST/nambdy/ ln_bdy, nb_bdy, ln_coords_file, cn_coords_file,         &
-         &             ln_mask_file, cn_mask_file, cn_dyn2d, nn_dyn2d_dta,     &
-         &             cn_dyn3d, nn_dyn3d_dta, cn_tra, nn_tra_dta,             &  
-         &             ln_tra_dmp, ln_dyn3d_dmp, rn_time_dmp, rn_time_dmp_out, &
-         &             cn_ice_lim, nn_ice_lim_dta,                             &
-         &             rn_ice_tem, rn_ice_sal, rn_ice_age,                     &
-         &             ln_vol, nn_volctl, nn_rimwidth
-         !
       NAMELIST/nambdy_index/ ctypebdy, nbdyind, nbdybeg, nbdyend
       INTEGER  ::   ios                 ! Local integer output status for namelist read
       !!----------------------------------------------------------------------
       !
-      IF( nn_timing == 1 )   CALL timing_start('bdy_init')
+      IF( nn_timing == 1 )   CALL timing_start('bdy_segs')
       !
       cgrid = (/'t','u','v'/)
-      
-      ! ------------------------
-      ! Read namelist parameters
-      ! ------------------------
-      REWIND( numnam_ref )              ! Namelist nambdy in reference namelist :Unstructured open boundaries  
-      READ  ( numnam_ref, nambdy, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in reference namelist', lwp )
-      !
-      REWIND( numnam_cfg )              ! Namelist nambdy in configuration namelist :Unstructured open boundaries
-      READ  ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy in configuration namelist', lwp )
-      IF(lwm) WRITE ( numond, nambdy )
 
       ! -----------------------------------------
       ! Check and write out namelist parameters
       ! -----------------------------------------
-      !                                   ! control prints
-      IF ( ln_bdy ) THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'bdy_init : initialization of open boundaries'
-         IF(lwp) WRITE(numout,*) '~~~~~~~~'
-      ELSE
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'bdy_init : open boundaries not used (ln_bdy = F)'
-         IF(lwp) WRITE(numout,*) '~~~~~~~~'
-         IF( nn_timing == 1 )   CALL timing_stop('bdy_init')
-         return
-      ENDIF
-
-      IF( jperio /= 0 )   CALL ctl_stop( 'bdy_init: Cyclic or symmetric,',   &
+      IF( jperio /= 0 )   CALL ctl_stop( 'bdy_segs: Cyclic or symmetric,',   &
          &                               ' and general open boundary condition are not compatible' )
 
@@ -844,5 +874,5 @@
                IF(lwp) THEN         ! Since all procs read global data only need to do this check on one proc...
                   IF( nbrdta(ib,igrd,ib_bdy) < nbrdta(ibm1,igrd,ib_bdy) ) THEN
-                     CALL ctl_stop('bdy_init : ERROR : boundary data in file must be defined ', &
+                     CALL ctl_stop('bdy_segs : ERROR : boundary data in file must be defined ', &
                           &        ' in order of distance from edge nbr A utility for re-ordering ', &
                           &        ' boundary coordinates and data files exists in the TOOLS/OBC directory')
@@ -1305,15 +1335,7 @@
       CALL wrk_dealloc(jpi,jpj,   zfmask ) 
       !
-      ! Open boundaries initialisation of external data arrays
-      CALL bdy_dta_init
-      !
-      ! Open boundaries initialisation of tidal harmonic forcing
-      IF( lk_tide ) CALL bdytide_init
-
-      !
-      IF( nn_timing == 1 )   CALL timing_stop('bdy_init')
-      !
-   END SUBROUTINE bdy_init
-
+      IF( nn_timing == 1 )   CALL timing_stop('bdy_segs')
+      !
+   END SUBROUTINE bdy_segs
 
    SUBROUTINE bdy_ctl_seg
