Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/AMM12/EXP00/namelist_cfg
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/AMM12/EXP00/namelist_cfg	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/AMM12/EXP00/namelist_cfg	(revision 6862)
@@ -208,5 +208,6 @@
 /
 !-----------------------------------------------------------------------
-&nambdy        !  unstructured open boundaries                          ("key_bdy")
+&nambdy        !  unstructured open boundaries
+    ln_bdy         = .true.
     nb_bdy         =  1
     cn_dyn2d       = 'flather'
@@ -216,5 +217,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/CONFIG/AMM12/cpp_AMM12.fcm
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/AMM12/cpp_AMM12.fcm	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/AMM12/cpp_AMM12.fcm	(revision 6862)
@@ -1,1 +1,1 @@
- bld::tool::fppkeys  key_bdy key_tide key_zdfgls key_diainstant key_mpp_mpi key_iomput
+ bld::tool::fppkeys key_tide key_zdfgls key_diainstant key_mpp_mpi key_iomput
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/SHARED/namelist_ref
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 6862)
@@ -621,4 +621,5 @@
 &nambdy        !  unstructured open boundaries                          ("key_bdy")
 !-----------------------------------------------------------------------
+    ln_bdy         = .false.              !  Use unstructured open boundaries
     nb_bdy         = 0                    !  number of open boundary sets
     ln_coords_file = .true.               !  =T : read bdy coordinates from file
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/LIM_SRC_3/limcons.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/LIM_SRC_3/limcons.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/LIM_SRC_3/limcons.F90	(revision 6862)
@@ -286,5 +286,4 @@
       REAL(wp), PARAMETER             :: zconv = 1.e-9 ! convert W to GW and kg to Mt
 
-#if ! defined key_bdy
       ! heat flux
       zhfx  = glob_sum( ( hfx_in - hfx_out - diag_heat - diag_trp_ei - diag_trp_es - SUM( qevap_ice * a_i_b, dim=3 ) )  &
@@ -304,5 +303,4 @@
       IF( ABS( zsfx ) > zs_sill ) WRITE(numout,*) 'violation sfx    [psu*Mt/day]   (',cd_routine,')  = ',(zsfx)
       IF( ABS( zhfx ) > zh_sill ) WRITE(numout,*) 'violation hfx    [GW]           (',cd_routine,')  = ',(zhfx)
-#endif
 
    END SUBROUTINE lim_cons_final
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90	(revision 6862)
@@ -41,7 +41,6 @@
    USE agrif_lim2_interp
 #endif
-#if defined key_bdy
+   USE bdy_oce   , ONLY: ln_bdy
    USE bdyice_lim
-#endif
 
    IMPLICIT NONE
@@ -460,7 +459,5 @@
             CALL agrif_rhg_lim2( jter, nn_nevp, 'U' )
 #endif
-#if defined key_bdy
-         CALL bdy_ice_lim_dyn( 'U' )
-#endif         
+         IF( ln_bdy ) CALL bdy_ice_lim_dyn( 'U' )
 
             DO jj = k_j1+1, k_jpj-1
@@ -486,7 +483,5 @@
             CALL agrif_rhg_lim2( jter, nn_nevp, 'V' )
 #endif
-#if defined key_bdy
-         CALL bdy_ice_lim_dyn( 'V' )
-#endif         
+         IF( ln_bdy ) CALL bdy_ice_lim_dyn( 'V' )
 
          ELSE 
@@ -513,7 +508,5 @@
             CALL agrif_rhg_lim2( jter, nn_nevp, 'V' )
 #endif
-#if defined key_bdy
-         CALL bdy_ice_lim_dyn( 'V' )
-#endif         
+         IF( ln_bdy ) CALL bdy_ice_lim_dyn( 'V' )
 
             DO jj = k_j1+1, k_jpj-1
@@ -538,7 +531,5 @@
             CALL agrif_rhg_lim2( jter, nn_nevp, 'U' )
 #endif
-#if defined key_bdy
-         CALL bdy_ice_lim_dyn( 'U' )
-#endif         
+         IF( ln_bdy ) CALL bdy_ice_lim_dyn( 'U' )
 
          ENDIF
@@ -577,8 +568,7 @@
       CALL agrif_rhg_lim2( nn_nevp , nn_nevp, 'V' )
 #endif
-#if defined key_bdy
-      CALL bdy_ice_lim_dyn( 'U' )
-      CALL bdy_ice_lim_dyn( 'V' )
-#endif         
+      IF( ln_bdy ) THEN
+         CALL bdy_ice_lim_dyn( 'U' ) ; CALL bdy_ice_lim_dyn( 'V' )
+      ENDIF
 
       DO jj = k_j1+1, k_jpj-1 
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90	(revision 6862)
@@ -36,4 +36,5 @@
    USE limctl         ! 
    USE limcons        ! 
+   USE bdy_oce  , ONLY: ln_bdy
    !
    USE in_out_manager ! I/O manager
@@ -221,5 +222,5 @@
 
       ! conservation test
-      IF( ln_limdiahsb )   CALL lim_cons_final( 'limsbc' )
+      IF( ln_limdiahsb .AND. .NOT. ln_bdy)   CALL lim_cons_final( 'limsbc' )
 
       ! control prints
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/NST_SRC/agrif_user.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/NST_SRC/agrif_user.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/NST_SRC/agrif_user.F90	(revision 6862)
@@ -61,5 +61,5 @@
    USE nemogcm
    USE tradmp
-   USE bdy_par
+   USE bdy_oce   , ONLY: ln_bdy
 
    IMPLICIT NONE
@@ -78,5 +78,5 @@
    ln_tradmp = .FALSE.
    ! no open boundary on fine grids
-   lk_bdy = .FALSE.
+   ln_bdy = .FALSE.
 
 
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdy_oce.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdy_oce.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdy_oce.F90	(revision 6862)
@@ -10,14 +10,12 @@
    !!            3.6  !  2014-01  (C. Rousset) add ice boundary conditions for lim3
    !!----------------------------------------------------------------------
-#if defined key_bdy 
-   !!----------------------------------------------------------------------
-   !!   'key_bdy'                      Unstructured Open Boundary Condition
-   !!----------------------------------------------------------------------
    USE par_oce         ! ocean parameters
-   USE bdy_par         ! Unstructured boundary parameters
    USE lib_mpp         ! distributed memory computing
 
    IMPLICIT NONE
    PUBLIC
+
+   INTEGER, PUBLIC, PARAMETER ::   jp_bdy  = 10       !: Maximum number of bdy sets
+   INTEGER, PUBLIC, PARAMETER ::   jpbgrd  = 3        !: Number of horizontal grid types used  (T, U, V)
 
    TYPE, PUBLIC ::   OBC_INDEX    !: Indices and weights which define the open boundary
@@ -82,4 +80,6 @@
    !! Namelist variables
    !!----------------------------------------------------------------------
+   LOGICAL, PUBLIC            ::   ln_bdy                   !: Unstructured Ocean Boundary Condition
+
    CHARACTER(len=80), DIMENSION(jp_bdy) ::   cn_coords_file !: Name of bdy coordinates file
    CHARACTER(len=80)                    ::   cn_mask_file   !: Name of bdy mask file
@@ -166,11 +166,4 @@
    END FUNCTION bdy_oce_alloc
 
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                NO Unstructured Open Boundary Condition
-   !!----------------------------------------------------------------------
-   LOGICAL ::   ln_tides = .false.  !: =T apply tidal harmonic forcing along open boundaries
-#endif
-
    !!======================================================================
 END MODULE bdy_oce
Index: anches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdy_par.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdy_par.F90	(revision 6861)
+++ 	(revision )
@@ -1,43 +1,0 @@
-MODULE bdy_par
-   !!======================================================================
-   !!                      ***  MODULE bdy_par   ***
-   !! Unstructured Open Boundary Cond. :   define related parameters
-   !!======================================================================
-   !! History :  1.0  !  2005-01  (J. Chanut, A. Sellar)  Original code
-   !!            3.0  !  2008-04  (NEMO team)  add in the reference version
-   !!            3.3  !  2010-09  (D. Storkey and E. O'Dea) update for Shelf configurations
-   !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
-   !!----------------------------------------------------------------------
-#if defined   key_bdy
-   !!----------------------------------------------------------------------
-   !!   'key_bdy' :                    Unstructured Open Boundary Condition
-   !!----------------------------------------------------------------------
-
-   IMPLICIT NONE
-   PUBLIC
-
-# if ! defined key_agrif
-   LOGICAL, PUBLIC, PARAMETER ::   lk_bdy  = .TRUE.   !: Unstructured Ocean Boundary Condition flag
-# else
-   LOGICAL, PUBLIC            ::   lk_bdy  = .TRUE.   !: Unstructured Ocean Boundary Condition flag
-# endif
-   INTEGER, PUBLIC, PARAMETER ::   jp_bdy  = 10       !: Maximum number of bdy sets
-   INTEGER, PUBLIC, PARAMETER ::   jpbgrd  = 3	      !: Number of horizontal grid types used  (T, U, V)
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option :            NO Unstructured open boundary condition
-   !!----------------------------------------------------------------------
-# if ! defined key_agrif
-   LOGICAL, PUBLIC, PARAMETER ::   lk_bdy  = .FALSE.   !: Unstructured Ocean Boundary Condition flag
-# else
-   LOGICAL, PUBLIC            ::   lk_bdy  = .FALSE.   !: Unstructured Ocean Boundary Condition flag
-# endif
-#endif
-
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!======================================================================
-END MODULE bdy_par
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90	(revision 6862)
@@ -12,8 +12,4 @@
    !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
    !!            3.6  !  2012-01  (C. Rousset) add ice boundary conditions for lim3
-   !!----------------------------------------------------------------------
-#if defined key_bdy
-   !!----------------------------------------------------------------------
-   !!   'key_bdy'                     Open Boundary Conditions
    !!----------------------------------------------------------------------
    !!    bdy_dta        : read external data along open boundaries from file
@@ -899,20 +895,4 @@
    END SUBROUTINE bdy_dta_init
 
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                   NO Open Boundary Conditions
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE bdy_dta( kt, jit, time_offset ) ! Empty routine
-      INTEGER, INTENT( in )           ::   kt    
-      INTEGER, INTENT( in ), OPTIONAL ::   jit   
-      INTEGER, INTENT( in ), OPTIONAL ::   time_offset
-      WRITE(*,*) 'bdy_dta: You should not have seen this print! error?', kt
-   END SUBROUTINE bdy_dta
-   SUBROUTINE bdy_dta_init()                  ! Empty routine
-      WRITE(*,*) 'bdy_dta_init: You should not have seen this print! error?'
-   END SUBROUTINE bdy_dta_init
-#endif
-
    !!==============================================================================
 END MODULE bdydta
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn.F90	(revision 6862)
@@ -11,8 +11,4 @@
    !!            3.3  !  2010-09  (D.Storkey) add ice boundary conditions
    !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
-   !!----------------------------------------------------------------------
-#if defined key_bdy 
-   !!----------------------------------------------------------------------
-   !!   'key_bdy' :                    Unstructured Open Boundary Condition
    !!----------------------------------------------------------------------
    !!   bdy_dyn        : split velocities into barotropic and baroclinic parts
@@ -137,14 +133,4 @@
    END SUBROUTINE bdy_dyn
 
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                   NO Unstruct Open Boundary Conditions
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE bdy_dyn( kt )      ! Empty routine
-      WRITE(*,*) 'bdy_dyn: You should not have seen this print! error?', kt
-   END SUBROUTINE bdy_dyn
-#endif
-
    !!======================================================================
 END MODULE bdydyn
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90	(revision 6862)
@@ -7,8 +7,4 @@
    !!            3.5  !  2012     (S. Mocavero, I. Epicoco) Optimization of BDY communications
    !!            3.5  !  2013-07  (J. Chanut) Compliant with time splitting changes
-   !!----------------------------------------------------------------------
-#if defined key_bdy 
-   !!----------------------------------------------------------------------
-   !!   'key_bdy' :                    Unstructured Open Boundary Condition
    !!----------------------------------------------------------------------
    !!   bdy_dyn2d          : Apply open boundary conditions to barotropic variables.
@@ -310,16 +306,4 @@
    END SUBROUTINE bdy_ssh
 
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                   NO Unstruct Open Boundary Conditions
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE bdy_dyn2d( kt )      ! Empty routine
-      INTEGER, intent(in) :: kt
-      WRITE(*,*) 'bdy_dyn2d: You should not have seen this print! error?', kt
-   END SUBROUTINE bdy_dyn2d
-
-#endif
-
    !!======================================================================
 END MODULE bdydyn2d
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn3d.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn3d.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn3d.F90	(revision 6862)
@@ -6,8 +6,4 @@
    !! History :  3.4  !  2011     (D. Storkey) new module as part of BDY rewrite 
    !!            3.5  !  2012     (S. Mocavero, I. Epicoco) Optimization of BDY communications
-   !!----------------------------------------------------------------------
-#if defined key_bdy 
-   !!----------------------------------------------------------------------
-   !!   'key_bdy' :                    Unstructured Open Boundary Condition
    !!----------------------------------------------------------------------
    !!   bdy_dyn3d        : apply open boundary conditions to baroclinic velocities
@@ -296,17 +292,4 @@
    END SUBROUTINE bdy_dyn3d_dmp
 
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                   NO Unstruct Open Boundary Conditions
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE bdy_dyn3d( kt )      ! Empty routine
-      WRITE(*,*) 'bdy_dyn3d: You should not have seen this print! error?', kt
-   END SUBROUTINE bdy_dyn3d
-   SUBROUTINE bdy_dyn3d_dmp( kt )      ! Empty routine
-      WRITE(*,*) 'bdy_dyn3d_dmp: You should not have seen this print! error?', kt
-   END SUBROUTINE bdy_dyn3d_dmp
-#endif
-
    !!======================================================================
 END MODULE bdydyn3d
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim.F90	(revision 6862)
@@ -8,7 +8,6 @@
    !!              -   !  2012-01 (C. Rousset)  add lim3 and remove useless jk loop 
    !!----------------------------------------------------------------------
-#if defined   key_bdy   &&  ( defined key_lim2 || defined key_lim3 )
-   !!----------------------------------------------------------------------
-   !!   'key_bdy'            and                 Unstructured Open Boundary Conditions
+#if defined key_lim2 || defined key_lim3
+   !!----------------------------------------------------------------------
    !!   'key_lim2'                                                 LIM-2 sea ice model
    !!   'key_lim3'                                                 LIM-3 sea ice model
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 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90	(revision 6862)
@@ -13,8 +13,5 @@
    !!            3.4  !  2012     (J. Chanut) straight open boundary case update
    !!            3.5  !  2012     (S. Mocavero, I. Epicoco) optimization of BDY communications
-   !!----------------------------------------------------------------------
-#if defined key_bdy
-   !!----------------------------------------------------------------------
-   !!   'key_bdy'                     Unstructured Open Boundary Conditions
+   !!            3.7  !  2016     (T. Lovato) Remove bdy macro, call here init for dta and tides
    !!----------------------------------------------------------------------
    !!   bdy_init      : Initialization of unstructured open boundaries
@@ -23,4 +20,6 @@
    USE dom_oce        ! ocean space and time domain
    USE bdy_oce        ! unstructured open boundary conditions
+   USE bdydta         ! open boundary cond. setting   (bdy_dta_init routine)
+   USE bdytides       ! open boundary cond. setting   (bdytide_init routine)
    USE sbctide  , ONLY: lk_tide ! Tidal forcing or not
    USE phycst   , ONLY: rday
@@ -94,10 +93,10 @@
       INTEGER                              ::   nbdyind, nbdybeg, nbdyend
       !!
-      NAMELIST/nambdy/ nb_bdy, ln_coords_file, cn_coords_file,                 &
+      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,                 &
+         &             cn_ice_lim, nn_ice_lim_dta,                             &
+         &             rn_ice_tem, rn_ice_sal, rn_ice_age,                     &
          &             ln_vol, nn_volctl, nn_rimwidth
          !
@@ -108,11 +107,4 @@
       IF( nn_timing == 1 )   CALL timing_start('bdy_init')
       !
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'bdy_init : initialization of open boundaries'
-      IF(lwp) WRITE(numout,*) '~~~~~~~~'
-      !
-      IF( jperio /= 0 )   CALL ctl_stop( 'Cyclic or symmetric,',   &
-         &                               ' and general open boundary condition are not compatible' )
-
       cgrid = (/'t','u','v'/)
       
@@ -133,5 +125,18 @@
       ! -----------------------------------------
       !                                   ! control prints
-      IF(lwp) WRITE(numout,*) '   nambdy'
+      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,',   &
+         &                               ' and general open boundary condition are not compatible' )
 
       IF( nb_bdy == 0 ) THEN 
@@ -1300,4 +1305,11 @@
       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')
       !
@@ -1713,13 +1725,4 @@
    END SUBROUTINE bdy_ctl_corn
 
-#else
-   !!---------------------------------------------------------------------------------
-   !!   Dummy module                                   NO open boundaries
-   !!---------------------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE bdy_init      ! Dummy routine
-   END SUBROUTINE bdy_init
-#endif
-
    !!=================================================================================
 END MODULE bdyini
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdylib.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdylib.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdylib.F90	(revision 6862)
@@ -6,7 +6,4 @@
    !! History :  3.6  !  2013     (D. Storkey) original code
    !!----------------------------------------------------------------------
-#if defined key_bdy 
-   !!----------------------------------------------------------------------
-   !!   'key_bdy' :                    Unstructured Open Boundary Condition
    !!----------------------------------------------------------------------
    !!   bdy_orlanski_2d
@@ -355,18 +352,4 @@
    END SUBROUTINE bdy_orlanski_3d
 
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                   NO Unstruct Open Boundary Conditions
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE bdy_orlanski_2d( idx, igrd, phib, phia, phi_ext  )      ! Empty routine
-      WRITE(*,*) 'bdy_orlanski_2d: You should not have seen this print! error?', kt
-   END SUBROUTINE bdy_orlanski_2d
-   SUBROUTINE bdy_orlanski_3d( idx, igrd, phib, phia, phi_ext  )      ! Empty routine
-      WRITE(*,*) 'bdy_orlanski_3d: You should not have seen this print! error?', kt
-   END SUBROUTINE bdy_orlanski_3d
-#endif
-
    !!======================================================================
 END MODULE bdylib
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90	(revision 6862)
@@ -11,8 +11,4 @@
    !!            3.5  !  2013-07  (J. Chanut) Compliant with time splitting changes
    !!----------------------------------------------------------------------
-#if defined key_bdy
-   !!----------------------------------------------------------------------
-   !!   'key_bdy'     Open Boundary Condition
-   !!----------------------------------------------------------------------
    !!   bdytide_init  : read of namelist and initialisation of tidal harmonics data
    !!   tide_update   : calculation of tidal forcing at each timestep
@@ -21,5 +17,4 @@
    USE dom_oce        ! ocean space and time domain
    USE phycst         ! physical constants
-   USE bdy_par        ! Unstructured boundary parameters
    USE bdy_oce        ! ocean open boundary conditions
    USE tideini        ! 
@@ -598,23 +593,4 @@
   END SUBROUTINE tide_init_velocities
 
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module         NO Unstruct Open Boundary Conditions for tides
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE bdytide_init             ! Empty routine
-      WRITE(*,*) 'bdytide_init: You should not have seen this print! error?'
-   END SUBROUTINE bdytide_init
-   SUBROUTINE bdytide_update( kt, jit )   ! Empty routine
-      WRITE(*,*) 'bdytide_update: You should not have seen this print! error?', kt, jit
-   END SUBROUTINE bdytide_update
-   SUBROUTINE bdy_dta_tides( kt, kit, time_offset )     ! Empty routine
-      INTEGER, INTENT( in )            ::   kt          ! Dummy argument empty routine      
-      INTEGER, INTENT( in ),OPTIONAL   ::   kit         ! Dummy argument empty routine
-      INTEGER, INTENT( in ),OPTIONAL   ::   time_offset ! Dummy argument empty routine
-      WRITE(*,*) 'bdy_dta_tides: You should not have seen this print! error?', kt, jit
-   END SUBROUTINE bdy_dta_tides
-#endif
-
    !!======================================================================
 END MODULE bdytides
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdytra.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdytra.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdytra.F90	(revision 6862)
@@ -8,8 +8,4 @@
    !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
    !!            3.5  !  2012     (S. Mocavero, I. Epicoco) Optimization of BDY communications
-   !!----------------------------------------------------------------------
-#if defined key_bdy
-   !!----------------------------------------------------------------------
-   !!   'key_bdy'                     Unstructured Open Boundary Conditions
    !!----------------------------------------------------------------------
    !!   bdy_tra            : Apply open boundary conditions to T and S
@@ -308,18 +304,4 @@
    END SUBROUTINE bdy_tra_dmp
  
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                   NO Unstruct Open Boundary Conditions
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE bdy_tra(kt)      ! Empty routine
-      WRITE(*,*) 'bdy_tra: You should not have seen this print! error?', kt
-   END SUBROUTINE bdy_tra
-
-   SUBROUTINE bdy_tra_dmp(kt)      ! Empty routine
-      WRITE(*,*) 'bdy_tra_dmp: You should not have seen this print! error?', kt
-   END SUBROUTINE bdy_tra_dmp
-#endif
-
    !!======================================================================
 END MODULE bdytra
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdyvol.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdyvol.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/BDY/bdyvol.F90	(revision 6862)
@@ -9,8 +9,4 @@
    !!            3.0  !  2008-04  (NEMO team)  add in the reference version
    !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
-   !!----------------------------------------------------------------------
-#if defined key_bdy
-   !!----------------------------------------------------------------------
-   !!   'key_bdy'                     unstructured open boundary conditions
    !!----------------------------------------------------------------------
    USE oce            ! ocean dynamics and tracers 
@@ -175,14 +171,4 @@
    END SUBROUTINE bdy_vol
 
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                   NO Unstruct Open Boundary Conditions
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE bdy_vol( kt )        ! Empty routine
-      WRITE(*,*) 'bdy_vol: You should not have seen this print! error?', kt
-   END SUBROUTINE bdy_vol
-#endif
-
    !!======================================================================
 END MODULE bdyvol
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 6862)
@@ -23,6 +23,6 @@
    USE trabbc          ! bottom boundary condition 
    USE trabbc          ! bottom boundary condition
-   USE bdy_par         ! (for lk_bdy)
    USE restart         ! ocean restart
+   USE bdy_oce   , ONLY: ln_bdy
    !
    USE iom             ! I/O manager
@@ -399,5 +399,5 @@
       surf_tot  = glob_sum( surf(:,:) )                                       ! total ocean surface area
 
-      IF( lk_bdy ) CALL ctl_warn( 'dia_hsb does not take open boundary fluxes into account' )         
+      IF( ln_bdy ) CALL ctl_warn( 'dia_hsb does not take open boundary fluxes into account' )         
       !
       ! ---------------------------------- !
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90	(revision 6862)
@@ -88,5 +88,5 @@
       !!      are defined with the proper value at lateral domain boundaries.
       !!
-      !!      In case of open boundaries (lk_bdy=T):
+      !!      In case of open boundaries (ln_bdy=T):
       !!        - tmask is set to 1 on the points to be computed bay the open
       !!          boundaries routines.
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 6862)
@@ -32,5 +32,5 @@
    USE dynspg_ts      ! surface pressure gradient: split-explicit scheme
    USE domvvl         ! variable volume
-   USE bdy_oce        ! ocean open boundary conditions
+   USE bdy_oce   , ONLY: ln_bdy
    USE bdydta         ! ocean open boundary conditions
    USE bdydyn         ! ocean open boundary conditions
@@ -77,5 +77,5 @@
       !!              * Apply lateral boundary conditions on after velocity 
       !!             at the local domain boundaries through lbc_lnk call,
-      !!             at the one-way open boundaries (lk_bdy=T),
+      !!             at the one-way open boundaries (ln_bdy=T),
       !!             at the AGRIF zoom   boundaries (lk_agrif=T)
       !!
@@ -147,12 +147,9 @@
       CALL lbc_lnk( va, 'V', -1. ) 
       !
-# if defined key_bdy
       !                                !* BDY open boundaries
-      IF( lk_bdy .AND. ln_dynspg_exp )   CALL bdy_dyn( kt )
-      IF( lk_bdy .AND. ln_dynspg_ts  )   CALL bdy_dyn( kt, dyn3d_only=.true. )
+      IF( ln_bdy .AND. ln_dynspg_exp )   CALL bdy_dyn( kt )
+      IF( ln_bdy .AND. ln_dynspg_ts  )   CALL bdy_dyn( kt, dyn3d_only=.true. )
 
 !!$   Do we need a call to bdy_vol here??
-      !
-# endif
       !
       IF( l_trddyn ) THEN             ! prepare the atf trend computation + some diagnostics
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 6862)
@@ -33,5 +33,5 @@
    USE dynvor          ! vorticity term
    USE wet_dry         ! wetting/drying flux limter
-   USE bdy_par         ! for lk_bdy
+   USE bdy_oce   , ONLY: ln_bdy
    USE bdytides        ! open boundary condition data
    USE bdydyn2d        ! open boundary conditions on barotropic variables
@@ -608,5 +608,5 @@
          ! Update only tidal forcing at open boundaries
 #if defined key_tide
-         IF( lk_bdy      .AND. lk_tide )   CALL bdy_dta_tides( kt, kit=jn, time_offset= noffset+1 )
+         IF( ln_bdy      .AND. lk_tide )   CALL bdy_dta_tides( kt, kit=jn, time_offset= noffset+1 )
          IF( ln_tide_pot .AND. lk_tide )   CALL upd_tide     ( kt, kit=jn, time_offset= noffset   )
 #endif
@@ -705,8 +705,7 @@
          CALL lbc_lnk( ssha_e, 'T',  1._wp )
 
-#if defined key_bdy
          ! Duplicate sea level across open boundaries (this is only cosmetic if linssh=T)
-         IF( lk_bdy )   CALL bdy_ssh( ssha_e )
-#endif
+         IF( ln_bdy )   CALL bdy_ssh( ssha_e )
+
 #if defined key_agrif
          IF( .NOT.Agrif_Root() )   CALL agrif_ssh_ts( jn )
@@ -967,8 +966,7 @@
          CALL lbc_lnk_multi( ua_e, 'U', -1._wp, va_e , 'V', -1._wp )
          !
-#if defined key_bdy  
          !                                                 ! open boundaries
-         IF( lk_bdy )   CALL bdy_dyn2d( jn, ua_e, va_e, un_e, vn_e, hur_e, hvr_e, ssha_e )
-#endif
+         IF( ln_bdy )   CALL bdy_dyn2d( jn, ua_e, va_e, un_e, vn_e, hur_e, hvr_e, ssha_e )
+
 #if defined key_agrif                                                           
          IF( .NOT.Agrif_Root() )  CALL agrif_dyn_ts( jn )  ! Agrif
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90	(revision 6862)
@@ -22,6 +22,5 @@
    USE divhor         ! horizontal divergence
    USE phycst         ! physical constants
-   USE bdy_oce        ! 
-   USE bdy_par        !
+   USE bdy_oce   , ONLY: ln_bdy, bdytmask
    USE bdydyn2d       ! bdy_ssh routine
 #if defined key_agrif
@@ -116,10 +115,8 @@
          CALL agrif_ssh( kt )
 # endif
-# if defined key_bdy
-         IF( lk_bdy ) THEN
+         IF( ln_bdy ) THEN
             CALL lbc_lnk( ssha, 'T', 1. )    ! Not sure that's necessary
             CALL bdy_ssh( ssha )             ! Duplicate sea level across open boundaries
          ENDIF
-# endif
       ENDIF
 
@@ -211,11 +208,9 @@
       ENDIF
 
-#if defined key_bdy
-      IF( lk_bdy ) THEN
+      IF( ln_bdy ) THEN
          DO jk = 1, jpkm1
             wn(:,:,jk) = wn(:,:,jk) * bdytmask(:,:)
          END DO
       ENDIF
-#endif
       !
       IF( nn_timing == 1 )  CALL timing_stop('wzv')
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90	(revision 6862)
@@ -666,7 +666,6 @@
       !!                using a general mapping (for open boundaries)
       !!----------------------------------------------------------------------
-#if defined key_bdy
-      USE bdy_oce, ONLY:  dta_global, dta_global2         ! workspace to read in global data arrays
-#endif 
+      USE bdy_oce, ONLY: ln_bdy, dta_global, dta_global2         ! workspace to read in global data arrays
+
       INTEGER                   , INTENT(in ) ::   num     ! stream number
       CHARACTER(LEN=*)          , INTENT(in ) ::   clvar   ! variable name
@@ -692,12 +691,12 @@
       ilendta = iom_file(num)%dimsz(1,idvar)
 
-#if defined key_bdy
-      ipj = iom_file(num)%dimsz(2,idvar)
-      IF( map%ll_unstruc) THEN   ! unstructured open boundary data file
-         dta_read => dta_global
-      ELSE                       ! structured open boundary data file
-         dta_read => dta_global2
-      ENDIF
-#endif
+      IF ( ln_bdy ) THEN
+         ipj = iom_file(num)%dimsz(2,idvar)
+         IF( map%ll_unstruc) THEN   ! unstructured open boundary data file
+            dta_read => dta_global
+         ELSE                       ! structured open boundary data file
+            dta_read => dta_global2
+         ENDIF
+      ENDIF
 
       IF(lwp) WRITE(numout,*) 'Dim size for ',        TRIM(clvar),' is ', ilendta
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 6862)
@@ -62,7 +62,6 @@
    USE timing          ! Timing
 
-#if defined key_bdy 
-   USE bdyice_lim       ! unstructured open boundary data  (bdy_ice_lim routine)
-#endif
+   USE bdy_oce   , ONLY: ln_bdy
+   USE bdyice_lim      ! unstructured open boundary data  (bdy_ice_lim routine)
 
    IMPLICIT NONE
@@ -166,8 +165,6 @@
             IF( nn_monocat /= 2 ) CALL lim_itd_me ! Mechanical redistribution ! (ridging/rafting)
             !
-#if defined key_bdy
-            CALL bdy_ice_lim( kt )                ! bdy ice thermo 
-            IF( ln_icectl )       CALL lim_prt( kt, iiceprt, jiceprt, 1, ' - ice thermo bdy - ' )
-#endif
+            IF( ln_bdy )  CALL bdy_ice_lim( kt )                ! bdy ice thermo 
+            IF( ln_bdy .AND. ln_icectl )  CALL lim_prt( kt, iiceprt, jiceprt, 1, ' - ice thermo bdy - ' )
             !
             CALL lim_update1( kt )                ! Corrections
@@ -380,7 +377,6 @@
       r1_nlay_s = 1._wp / REAL( nlay_s, wp )
       !
-#if defined key_bdy
-      IF( lwp .AND. ln_limdiahsb )  CALL ctl_warn('online conservation check activated but it does not work with BDY')
-#endif
+      IF( lwp .AND. ln_bdy .AND. ln_limdiahsb )  &
+      &   CALL ctl_warn('online conservation check activated but it does not work with BDY')
       !
    END SUBROUTINE ice_run
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 6862)
@@ -54,7 +54,6 @@
 # endif
 
-#if defined key_bdy 
+   USE bdy_oce   , ONLY: ln_bdy
    USE bdyice_lim       ! unstructured open boundary data  (bdy_ice_lim routine)
-#endif
 
    IMPLICIT NONE
@@ -230,7 +229,5 @@
                            CALL lim_trp_2      ( kt )      ! Ice transport   ( Advection/diffusion )
            IF( ln_limdmp ) CALL lim_dmp_2      ( kt )      ! Ice damping 
-#if defined key_bdy
-                           CALL bdy_ice_lim( kt ) ! bdy ice thermo
-#endif
+           IF( ln_bdy    ) CALL bdy_ice_lim( kt ) ! bdy ice thermo
          END IF
          !                                             ! Ice surface fluxes in coupled mode 
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 6862)
@@ -47,5 +47,5 @@
    USE traqsr         ! active tracers: light penetration
    USE sbcwave        ! Wave module
-   USE bdy_par        ! Require lk_bdy
+   USE bdy_oce   , ONLY: ln_bdy
    !
    USE prtctl         ! Print control                    (prt_ctl routine)
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcwave.F90	(revision 6862)
@@ -12,6 +12,6 @@
    !!----------------------------------------------------------------------
    USE oce            ! 
-   USE sbc_oce	       ! Surface boundary condition: ocean fields
-   USE bdy_oce        !
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE bdy_oce   , ONLY: ln_bdy, bdytmask
    USE domvvl         !
    !
@@ -19,5 +19,5 @@
    USE in_out_manager ! I/O manager
    USE lib_mpp        ! distribued memory computing library
-   USE fldread	       ! read input fields
+   USE fldread        ! read input fields
    USE wrk_nemo       !
 
@@ -32,6 +32,6 @@
    INTEGER , PARAMETER ::   jp_wn  = 3   ! index of wave number                 (1/m)    at T-point
 
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:)  :: sf_cd	  ! structure of input fields (file informations, fields read) Drag Coefficient
-   TYPE(FLD), ALLOCATABLE, DIMENSION(:)  :: sf_sd	  ! structure of input fields (file informations, fields read) Stokes Drift
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:)  :: sf_cd         ! structure of input fields (file informations, fields read) Drag Coefficient
+   TYPE(FLD), ALLOCATABLE, DIMENSION(:)  :: sf_sd         ! structure of input fields (file informations, fields read) Stokes Drift
 
    REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION (:,:)   :: cdn_wave 
@@ -172,11 +172,11 @@
             wsd3d(:,:,jk) = wsd3d(:,:,jk+1) - ze3hdiv(:,:,jk)
          END DO
-#if defined key_bdy
-         IF( lk_bdy ) THEN
+         !
+         IF( ln_bdy ) THEN
             DO jk = 1, jpkm1
                wsd3d(:,:,jk) = wsd3d(:,:,jk) * bdytmask(:,:)
             END DO
          ENDIF
-#endif
+         !
          CALL wrk_dealloc( jpi,jpj,jpk,   zusd_t, zvsd_t, ze3hdiv )
          ! 
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 6862)
@@ -37,5 +37,5 @@
    USE ldftra          ! lateral physics on tracers
    USE ldfslp
-   USE bdy_oce         ! BDY open boundary condition variables
+   USE bdy_oce   , ONLY: ln_bdy
    USE bdytra          ! open boundary condition (bdy_tra routine)
    !
@@ -79,5 +79,5 @@
       !!              - Apply lateral boundary conditions on (ta,sa) 
       !!             at the local domain   boundaries through lbc_lnk call, 
-      !!             at the one-way open boundaries (lk_bdy=T), 
+      !!             at the one-way open boundaries (ln_bdy=T), 
       !!             at the AGRIF zoom   boundaries (lk_agrif=T)
       !!
@@ -111,7 +111,5 @@
       CALL lbc_lnk( tsa(:,:,:,jp_sal), 'T', 1._wp )
       !
-#if defined key_bdy 
-      IF( lk_bdy )   CALL bdy_tra( kt )  ! BDY open boundaries
-#endif
+      IF( ln_bdy )   CALL bdy_tra( kt )  ! BDY open boundaries
  
       ! set time step size (Euler/Leapfrog)
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 6862)
@@ -52,7 +52,6 @@
 #endif
    USE tideini        ! tidal components initialization   (tide_ini routine)
+   USE bdy_oce   , ONLY: ln_bdy
    USE bdyini         ! open boundary cond. setting       (bdy_init routine)
-   USE bdydta         ! open boundary cond. setting   (bdy_dta_init routine)
-   USE bdytides       ! open boundary cond. setting   (bdytide_init routine)
    USE sbctide, ONLY  : lk_tide
    USE istate         ! initial state setting          (istate_init routine)
@@ -435,10 +434,5 @@
       IF( lk_tide       )   CALL    tide_init   ! tidal harmonics
                             CALL     sbc_init   ! surface boundary conditions (including sea-ice)
-!!gm ==>> bdy_init should call bdy_dta_init and bdytide_init  NOT in nemogcm !!!
-      IF( lk_bdy        )   CALL     bdy_init   ! Open boundaries initialisation
-      IF( lk_bdy        )   CALL bdy_dta_init   ! Open boundaries initialisation of external data arrays
-      IF( lk_bdy .AND. lk_tide )   &
-         &                  CALL bdytide_init   ! Open boundaries initialisation of tidal harmonic forcing
-         
+                            CALL     bdy_init   ! Open boundaries initialisation
       !                                      ! Ocean physics
       !                                         ! Vertical physics
@@ -659,7 +653,5 @@
       USE diadct    , ONLY: diadct_alloc 
 #endif 
-#if defined key_bdy
       USE bdy_oce   , ONLY: bdy_oce_alloc
-#endif
       !
       INTEGER :: ierr
@@ -676,7 +668,5 @@
       ierr = ierr + diadct_alloc    ()          ! 
 #endif 
-#if defined key_bdy
       ierr = ierr + bdy_oce_alloc   ()          ! bdy masks (incl. initialization)
-#endif
       !
       IF( lk_mpp    )   CALL mpp_sum( ierr )
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/step.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 6862)
@@ -106,5 +106,5 @@
       IF( lk_tide    )   CALL sbc_tide( kstp )                   ! update tide potential
       IF( ln_apr_dyn )   CALL sbc_apr ( kstp )                   ! atmospheric pressure (NB: call before bdy_dta which needs ssh_ib) 
-      IF( lk_bdy     )   CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries
+      IF( ln_bdy     )   CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries
                          CALL sbc     ( kstp )                   ! Sea Boundary Condition (including sea-ice)
 
@@ -200,5 +200,5 @@
       IF(  lk_asminc .AND. ln_asmiau .AND. ln_dyninc )   &
                &         CALL dyn_asm_inc   ( kstp )  ! apply dynamics assimilation increment
-      IF( lk_bdy     )   CALL bdy_dyn3d_dmp ( kstp )  ! bdy damping trends
+      IF( ln_bdy     )   CALL bdy_dyn3d_dmp ( kstp )  ! bdy damping trends
 #if defined key_agrif
       IF(.NOT. Agrif_Root())  & 
@@ -259,5 +259,5 @@
       IF( lk_trabbl  )   CALL tra_bbl       ( kstp )  ! advective (and/or diffusive) bottom boundary layer scheme
       IF( ln_tradmp  )   CALL tra_dmp       ( kstp )  ! internal damping trends
-      IF( lk_bdy     )   CALL bdy_tra_dmp   ( kstp )  ! bdy damping trends
+      IF( ln_bdy     )   CALL bdy_tra_dmp   ( kstp )  ! bdy damping trends
 #if defined key_agrif
       IF(.NOT. Agrif_Root())  & 
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/step_oce.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/step_oce.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/OPA_SRC/step_oce.F90	(revision 6862)
@@ -47,6 +47,5 @@
    USE stopts 
 
-   USE bdy_par          ! for lk_bdy
-   USE bdy_oce          ! for dmp logical
+   USE bdy_oce    , ONLY: ln_bdy
    USE bdydta           ! open boundary condition data     (bdy_dta routine)
    USE bdytra           ! bdy cond. for tracers            (bdy_tra routine)
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/SAS_SRC/nemogcm.F90	(revision 6862)
@@ -59,9 +59,5 @@
    USE lbcnfd, ONLY: isendto, nsndto, nfsloop, nfeloop ! Setup of north fold exchanges
    USE icbstp          ! handle bergs, calving, themodynamics and transport
-#if defined key_bdy
    USE bdyini          ! open boundary cond. setting       (bdy_init routine). clem: mandatory for LIM3
-   USE bdydta          ! open boundary cond. setting   (bdy_dta_init routine). clem: mandatory for LIM3
-#endif
-   USE bdy_par
 
    IMPLICIT NONE
@@ -363,6 +359,5 @@
       !           the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules. 
       !           This is not clean and should be changed in the future. 
-      IF( lk_bdy        )   CALL     bdy_init
-      IF( lk_bdy        )   CALL bdy_dta_init
+                            CALL     bdy_init
       ! ==>
       
@@ -514,10 +509,6 @@
       USE diawri    , ONLY: dia_wri_alloc
       USE dom_oce   , ONLY: dom_oce_alloc
-#if defined key_bdy   
-      USE bdy_oce   , ONLY: bdy_oce_alloc
+      USE bdy_oce   , ONLY: ln_bdy, bdy_oce_alloc
       USE oce         ! clem: mandatory for LIM3 because needed for bdy arrays
-#else
-      USE oce       , ONLY : sshn, sshb, snwice_mass, snwice_mass_b, snwice_fmass
-#endif
       !
       INTEGER :: ierr,ierr1,ierr2,ierr3,ierr4,ierr5,ierr6,ierr7,ierr8
@@ -527,25 +518,23 @@
       ierr =        dia_wri_alloc   ()
       ierr = ierr + dom_oce_alloc   ()          ! ocean domain
-#if defined key_bdy
       ierr = ierr + bdy_oce_alloc   ()          ! bdy masks (incl. initialization)
-      ierr = ierr + oce_alloc       ()          ! (tsn...)
-#endif
-
-#if ! defined key_bdy
-       ALLOCATE( snwice_mass(jpi,jpj)  , snwice_mass_b(jpi,jpj),             &
-         &      snwice_fmass(jpi,jpj)  , STAT= ierr1 )
-      !
-      ! lim code currently uses surface temperature and salinity in tsn array for initialisation
-      ! and ub, vb arrays in ice dynamics, so allocate enough of arrays to use
-      ! clem: should not be needed. To be checked out
-      jpm = MAX(jp_tem, jp_sal)
-      ALLOCATE( tsn(jpi,jpj,1,jpm)  , STAT=ierr2 )
-      ALLOCATE( ub(jpi,jpj,1)       , STAT=ierr3 )
-      ALLOCATE( vb(jpi,jpj,1)       , STAT=ierr4 )
-      ALLOCATE( tsb(jpi,jpj,1,jpm)  , STAT=ierr5 )
-      ALLOCATE( sshn(jpi,jpj)       , STAT=ierr6 )
-      ALLOCATE( un(jpi,jpj,1)       , STAT=ierr7 )
-      ALLOCATE( vn(jpi,jpj,1)       , STAT=ierr8 )
-      ierr = ierr + ierr1 + ierr2 + ierr3 + ierr4 + ierr5 + ierr6 + ierr7 + ierr8
+# if ! defined key_lim2 && ! defined key_lim3
+         ierr = ierr + oce_alloc       ()          ! (tsn...)
+# else
+         ALLOCATE( snwice_mass(jpi,jpj)  , snwice_mass_b(jpi,jpj),             &
+            &      snwice_fmass(jpi,jpj)  , STAT= ierr1 )
+         !
+         ! lim code currently uses surface temperature and salinity in tsn array for initialisation
+         ! and ub, vb arrays in ice dynamics, so allocate enough of arrays to use
+         ! clem: should not be needed. To be checked out
+         jpm = MAX(jp_tem, jp_sal)
+         ALLOCATE( tsn(jpi,jpj,1,jpm)  , STAT=ierr2 )
+         ALLOCATE( ub(jpi,jpj,1)       , STAT=ierr3 )
+         ALLOCATE( vb(jpi,jpj,1)       , STAT=ierr4 )
+         ALLOCATE( tsb(jpi,jpj,1,jpm)  , STAT=ierr5 )
+         ALLOCATE( sshn(jpi,jpj)       , STAT=ierr6 )
+         ALLOCATE( un(jpi,jpj,1)       , STAT=ierr7 )
+         ALLOCATE( vn(jpi,jpj,1)       , STAT=ierr8 )
+         ierr = ierr + ierr1 + ierr2 + ierr3 + ierr4 + ierr5 + ierr6 + ierr7 + ierr8
 #endif
       !
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/SAS_SRC/step.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/SAS_SRC/step.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/SAS_SRC/step.F90	(revision 6862)
@@ -23,8 +23,6 @@
    USE eosbn2           ! equation of state                (eos_bn2 routine)
    USE diawri           ! Standard run outputs             (dia_wri routine)
-   USE bdy_par          ! clem: mandatory for LIM3
-#if defined key_bdy
+   USE bdy_oce   , ONLY: ln_bdy
    USE bdydta           ! clem: mandatory for LIM3
-#endif
    USE stpctl           ! time stepping control            (stp_ctl routine)
    !
@@ -82,7 +80,5 @@
       !           From SAS: ocean bdy data are wrong  (but we do not care) and ice bdy data are OK.  
       !           This is not clean and should be changed in the future. 
-#if defined key_bdy
-      IF( lk_bdy     )       CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries
-#endif
+      IF( ln_bdy     )       CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries
       ! ==>
                              CALL sbc    ( kstp )         ! Sea Boundary Condition (including sea-ice)
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 6862)
@@ -33,6 +33,6 @@
    USE trdtra
    USE tranxt
+   USE bdy_oce   , ONLY: ln_bdy
    USE trcbdy          ! BDY open boundaries
-   USE bdy_par, only: lk_bdy
 # if defined key_agrif
    USE agrif_top_interp
@@ -99,5 +99,5 @@
       END DO
 
-      IF( lk_bdy )  CALL trc_bdy( kt )
+      IF( ln_bdy )  CALL trc_bdy( kt )
 
       !                                ! set time step size (Euler/Leapfrog)
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90	(revision 6862)
@@ -25,6 +25,6 @@
    USE trcsbc          ! surface boundary condition          (trc_sbc routine)
    USE zpshde          ! partial step: hor. derivative       (zps_hde routine)
+   USE bdy_oce   , ONLY: ln_bdy
    USE trcbdy          ! BDY open boundaries
-   USE bdy_par, only: lk_bdy
 
 #if defined key_agrif
@@ -65,5 +65,5 @@
          IF( lk_trabbl )        CALL trc_bbl    ( kt )      ! advective (and/or diffusive) bottom boundary layer scheme
          IF( ln_trcdmp )        CALL trc_dmp    ( kt )      ! internal damping trends
-         IF( lk_bdy )           CALL trc_bdy_dmp( kt )      ! BDY damping trends
+         IF( ln_bdy )           CALL trc_bdy_dmp( kt )      ! BDY damping trends
                                 CALL trc_adv    ( kt )      ! horizontal & vertical advection 
          !                                                         ! Partial top/bottom cell: GRADh( trb )  
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trc.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 6862)
@@ -14,7 +14,5 @@
    USE par_oce
    USE par_trc
-#if defined key_bdy
-   USE bdy_oce, only: nb_bdy, OBC_DATA
-#endif
+   USE bdy_oce, only: ln_bdy, nb_bdy, OBC_DATA
    
    IMPLICIT NONE
@@ -189,5 +187,4 @@
 # endif
    !
-#if defined key_bdy
    CHARACTER(len=20), PUBLIC, ALLOCATABLE,  SAVE,  DIMENSION(:)   ::  cn_trc_dflt          ! Default OBC condition for all tracers
    CHARACTER(len=20), PUBLIC, ALLOCATABLE,  SAVE,  DIMENSION(:)   ::  cn_trc               ! Choice of boundary condition for tracers
@@ -195,5 +192,4 @@
    ! External data structure of BDY for TOP. Available elements: cn_obc, ll_trc, trcnow, dmp
    TYPE(OBC_DATA),    PUBLIC, ALLOCATABLE, DIMENSION(:,:), TARGET ::  trcdta_bdy           !: bdy external data (local process)
-#endif
    !
 
@@ -210,6 +206,8 @@
       !!-------------------------------------------------------------------
       USE lib_mpp, ONLY: ctl_warn
+      INTEGER :: ierr(2)
       !!-------------------------------------------------------------------
       !
+      ierr(:) = 0
       ALLOCATE( trn(jpi,jpj,jpk,jptra), trb(jpi,jpj,jpk,jptra), tra(jpi,jpj,jpk,jptra),       &  
          &      trc_i(jpi,jpj,jptra)  , trc_o(jpi,jpj,jptra)                          ,       &
@@ -223,9 +221,13 @@
          &      ln_trc_sbc(jptra)     , ln_trc_cbc(jptra)     , ln_trc_obc(jptra)     ,       &
 #endif
-#if defined key_bdy
-         &      cn_trc_dflt(nb_bdy)   , cn_trc(nb_bdy)        , nn_trcdmp_bdy(nb_bdy) ,       &
+         &      STAT = ierr(1)  )
+
+      IF ( ln_bdy ) THEN
+         ALLOCATE( cn_trc_dflt(nb_bdy)   , cn_trc(nb_bdy)     , nn_trcdmp_bdy(nb_bdy) ,       &
          &      trcdta_bdy(jptra,nb_bdy)                                              ,       &
-#endif
-         &      STAT = trc_alloc  )
+         &      STAT = ierr(2)  )
+      ENDIF
+         !
+      trc_alloc = MAXVAL( ierr )
 
       IF( trc_alloc /= 0 )   CALL ctl_warn('trc_alloc: failed to allocate arrays')
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trcbc.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trcbc.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trcbc.F90	(revision 6862)
@@ -19,7 +19,5 @@
    USE lib_mpp       !  MPP library
    USE fldread       !  read input fields
-#if defined key_bdy
-   USE bdy_oce, only: nb_bdy , idx_bdy, ln_coords_file, rn_time_dmp, rn_time_dmp_out
-#endif
+   USE bdy_oce,  ONLY: ln_bdy, nb_bdy , idx_bdy, ln_coords_file, rn_time_dmp, rn_time_dmp_out
 
    IMPLICIT NONE
@@ -78,7 +76,6 @@
       !!
       NAMELIST/namtrc_bc/ cn_dir_sbc, cn_dir_cbc, cn_dir_obc, sn_trcobc, rn_trofac, sn_trcsbc, rn_trsfac, sn_trccbc, rn_trcfac
-#if defined key_bdy
       NAMELIST/namtrc_bdy/ cn_trc_dflt, cn_trc, nn_trcdmp_bdy
-#endif
+
       !!----------------------------------------------------------------------
       IF( nn_timing == 1 )  CALL timing_start('trc_bc_init')
@@ -128,37 +125,38 @@
       IF(lwm) WRITE ( numont, namtrc_bc )
 
-#if defined key_bdy
-      REWIND( numnat_ref )              ! Namelist namtrc_bc in reference namelist : Passive tracer data structure
-      READ  ( numnat_ref, namtrc_bdy, IOSTAT = ios, ERR = 903)
-903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in reference namelist', lwp )
-
-      REWIND( numnat_cfg )              ! Namelist namtrc_bc in configuration namelist : Passive tracer data structure
-      READ  ( numnat_cfg, namtrc_bdy, IOSTAT = ios, ERR = 904 )
-904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in configuration namelist', lwp )
-      IF(lwm) WRITE ( numont, namtrc_bdy )
-      ! setup up preliminary informations for BDY structure
-      DO jn = 1, ntrc
-         DO ib = 1, nb_bdy
-            ! Set type of obc in BDY data structure (around here we may plug user override of obc type from nml)
-            IF ( ln_trc_obc(jn) ) THEN
-               trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc(ib) )
-            ELSE
-               trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc_dflt(ib) )
-            ENDIF
-            ! set damping use in BDY data structure
-            trcdta_bdy(jn,ib)%dmp = .false.
-            IF(nn_trcdmp_bdy(ib) .EQ. 1 .AND. ln_trc_obc(jn) ) trcdta_bdy(jn,ib)%dmp = .true.
-            IF(nn_trcdmp_bdy(ib) .EQ. 2 ) trcdta_bdy(jn,ib)%dmp = .true.
-            IF(trcdta_bdy(jn,ib)%cn_obc == 'frs' .AND. nn_trcdmp_bdy(ib) .NE. 0 )  &
-                & CALL ctl_stop( 'Use FRS OR relaxation' )
-            IF (nn_trcdmp_bdy(ib) .LT. 0 .OR. nn_trcdmp_bdy(ib) .GT. 2)            &
-                & CALL ctl_stop( 'Not a valid option for nn_trcdmp_bdy. Allowed: 0,1,2.' )
+      IF ( ln_bdy ) THEN
+         REWIND( numnat_ref )              ! Namelist namtrc_bdy in reference namelist : Passive tracer data structure
+         READ  ( numnat_ref, namtrc_bdy, IOSTAT = ios, ERR = 903)
+903      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in reference namelist', lwp )
+
+         REWIND( numnat_cfg )              ! Namelist namtrc_bdy in configuration namelist : Passive tracer data structure
+         READ  ( numnat_cfg, namtrc_bdy, IOSTAT = ios, ERR = 904 )
+904      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in configuration namelist', lwp )
+         IF(lwm) WRITE ( numont, namtrc_bdy )
+      
+         ! setup up preliminary informations for BDY structure
+         DO jn = 1, ntrc
+            DO ib = 1, nb_bdy
+               ! Set type of obc in BDY data structure (around here we may plug user override of obc type from nml)
+               IF ( ln_trc_obc(jn) ) THEN
+                  trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc(ib) )
+               ELSE
+                  trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc_dflt(ib) )
+               ENDIF
+               ! set damping use in BDY data structure
+               trcdta_bdy(jn,ib)%dmp = .false.
+               IF(nn_trcdmp_bdy(ib) .EQ. 1 .AND. ln_trc_obc(jn) ) trcdta_bdy(jn,ib)%dmp = .true.
+               IF(nn_trcdmp_bdy(ib) .EQ. 2 ) trcdta_bdy(jn,ib)%dmp = .true.
+               IF(trcdta_bdy(jn,ib)%cn_obc == 'frs' .AND. nn_trcdmp_bdy(ib) .NE. 0 )  &
+                   & CALL ctl_stop( 'Use FRS OR relaxation' )
+               IF (nn_trcdmp_bdy(ib) .LT. 0 .OR. nn_trcdmp_bdy(ib) .GT. 2)            &
+                   & CALL ctl_stop( 'Not a valid option for nn_trcdmp_bdy. Allowed: 0,1,2.' )
+            ENDDO
          ENDDO
-      ENDDO
-
-#else
-      ! Force all tracers OBC to false if bdy not used
-      ln_trc_obc = .false.
-#endif
+      ELSE
+         ! Force all tracers OBC to false if bdy not used
+         ln_trc_obc = .false.
+      ENDIF
+
       ! compose BC data indexes
       DO jn = 1, ntrc
@@ -198,6 +196,6 @@
          WRITE(numout,*) ' '
          WRITE(numout,'(a,i3)') '   Total tracers to be initialized with OPEN BCs data:', nb_trcobc
-#if defined key_bdy
-         IF ( nb_trcobc > 0 ) THEN
+
+         IF ( ln_bdy .AND. nb_trcobc > 0 ) THEN
             WRITE(numout,*) '   #trc        NAME        Boundary     Mult.Fact.   OBC Settings'
             DO jn = 1, ntrc
@@ -217,5 +215,5 @@
             ENDDO
          ENDIF
-#endif
+
          WRITE(numout,'(2a)') '   OPEN BC data repository : ', TRIM(cn_dir_obc)
       ENDIF
@@ -225,7 +223,6 @@
 
       !
-#if defined key_bdy
       ! OPEN Lateral boundary conditions
-      IF( nb_trcobc > 0 ) THEN 
+      IF( ln_bdy .AND. nb_trcobc > 0 ) THEN 
          ALLOCATE ( sf_trcobc(nb_trcobc), rf_trofac(nb_trcobc), nbmap_ptr(nb_trcobc), STAT=ierr1 )
          IF( ierr1 > 0 ) THEN
@@ -272,5 +269,5 @@
          CALL fld_fill( sf_trcobc, slf_i, cn_dir_obc, 'trc_bc_init', 'Passive tracer OBC data', 'namtrc_bc' )
       ENDIF
-#endif
+
       ! SURFACE Boundary conditions
       IF( nb_trcsbc > 0 ) THEN       !  allocate only if the number of tracer to initialise is greater than zero
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trcbdy.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trcbdy.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trcbdy.F90	(revision 6862)
@@ -10,7 +10,5 @@
    !!            3.6  !  2015     (T. Lovato) Adapt BDY for tracers in TOP component
    !!----------------------------------------------------------------------
-#if defined key_bdy && key_top
-   !!----------------------------------------------------------------------
-   !!   'key_bdy'                     Unstructured Open Boundary Conditions
+#if defined key_top
    !!----------------------------------------------------------------------
    !!   trc_bdy            : Apply open boundary conditions to T and S
@@ -24,5 +22,5 @@
    USE lbclnk                       ! ocean lateral boundary conditions (or mpp link)
    USE in_out_manager               ! I/O manager
-   USE bdy_oce, only: idx_bdy, OBC_INDEX, BDYTMASK, lk_bdy       ! ocean open boundary conditions
+   USE bdy_oce, only: idx_bdy, OBC_INDEX, BDYTMASK, ln_bdy       ! ocean open boundary conditions
 
    IMPLICIT NONE
Index: /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trcsub.F90
===================================================================
--- /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trcsub.F90	(revision 6861)
+++ /branches/2016/dev_r6522_SIMPLIF_3/NEMOGCM/NEMO/TOP_SRC/trcsub.F90	(revision 6862)
@@ -20,5 +20,5 @@
 #endif
 #if defined key_zdfgls
-   USE zdfgls, ONLY: en
+   USE zdfgls    , ONLY: en
 #endif
    USE trabbl
@@ -26,6 +26,6 @@
    USE domvvl
    USE divhor          ! horizontal divergence            (div_hor routine)
-   USE sbcrnf, ONLY: h_rnf, nk_rnf   ! River runoff 
-   USE bdy_oce
+   USE sbcrnf    , ONLY: h_rnf, nk_rnf    ! River runoff
+   USE bdy_oce   , ONLY: ln_bdy, bdytmask ! BDY
 #if defined key_agrif
    USE agrif_opa_update
@@ -505,8 +505,8 @@
       CALL agrif_ssh( kt )
 #endif
-#if defined key_bdy
-      ssha(:,:) = ssha(:,:) * bdytmask(:,:)
-      CALL lbc_lnk( ssha, 'T', 1. ) 
-#endif
+      IF( ln_bdy ) THEN
+         ssha(:,:) = ssha(:,:) * bdytmask(:,:)
+         CALL lbc_lnk( ssha, 'T', 1. ) 
+      ENDIF
 #endif
       !
@@ -520,7 +520,5 @@
             &                      - ( e3t_a(:,:,jk) - e3t_b(:,:,jk) )    &
             &                         * tmask(:,:,jk) * z1_2dt
-#if defined key_bdy
-         wn(:,:,jk) = wn(:,:,jk) * bdytmask(:,:)
-#endif
+         IF( ln_bdy ) wn(:,:,jk) = wn(:,:,jk) * bdytmask(:,:)
       END DO
       !
