Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydta.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydta.F90	(revision 11223)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydta.F90	(revision 11224)
@@ -54,5 +54,8 @@
    INTEGER , PARAMETER ::   jp_bdyh_i = 9     ! 
    INTEGER , PARAMETER ::   jp_bdyh_S = 10    ! 
-                                                              ! =F => baroclinic velocities in 3D boundary conditions
+#if ! defined key_si3
+   INTEGER , PARAMETER ::   jpl = 1
+#endif
+                                                             ! =F => baroclinic velocities in 3D boundary conditions
 !$AGRIF_DO_NOT_TREAT
    TYPE(FLD), PUBLIC, ALLOCATABLE, DIMENSION(:,:), TARGET ::   bf   ! structure of input fields (file informations, fields read)
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydyn2d.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydyn2d.F90	(revision 11223)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/OCE/BDY/bdydyn2d.F90	(revision 11224)
@@ -14,5 +14,4 @@
    !!   bdy_ssh            : Duplicate sea level across open boundaries
    !!----------------------------------------------------------------------
-   USE oce, only : sshdta => spgu             ! ocean dynamics and tracers 
    USE dom_oce         ! ocean space and time domain
    USE bdy_oce         ! ocean open boundary conditions
@@ -186,4 +185,5 @@
       REAL(wp) ::   zfla                             ! Flather correction
       REAL(wp) ::   z1_2                             ! 
+      REAL(wp), DIMENSION(jpi,jpj) ::   sshdta       ! 2D version of dta%ssh
       !!----------------------------------------------------------------------
 
@@ -203,8 +203,6 @@
          ii = idx%nbi(jb,igrd)
          ij = idx%nbj(jb,igrd)
-         IF( ll_wd ) THEN
-            sshdta(ii, ij) = dta%ssh(jb)  - ssh_ref 
-         ELSE
-            sshdta(ii, ij) = dta%ssh(jb)
+         IF( ll_wd ) THEN   ;   sshdta(ii, ij) = dta%ssh(jb) - ssh_ref 
+         ELSE               ;   sshdta(ii, ij) = dta%ssh(jb)
          ENDIF
       END DO
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/SAS/step.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/SAS/step.F90	(revision 11223)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/SAS/step.F90	(revision 11224)
@@ -96,5 +96,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( ln_bdy     )       CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries
+      IF( ln_bdy     )       CALL bdy_dta ( kstp, kt_offset=+1 )   ! update dynamic & tracer data at open boundaries
       ! ==>
                              CALL sbc    ( kstp )         ! Sea Boundary Condition (including sea-ice)
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/TOP/trcbc.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/TOP/trcbc.F90	(revision 11223)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/TOP/trcbc.F90	(revision 11224)
@@ -44,5 +44,4 @@
    TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:), TARGET  :: sf_trcobc
 #endif
-   TYPE(MAP_POINTER), ALLOCATABLE, DIMENSION(:) :: nbmap_ptr   ! array of pointers to nbmap
 
    !! * Substitutions
@@ -133,5 +132,7 @@
          READ  ( numnat_ref, namtrc_bdy, IOSTAT = ios, ERR = 903)
 903      IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_bdy in reference namelist', lwp )
-
+         ! make sur that all elements of the namelist variables have a default definition from namelist_ref
+         cn_trc     (2:jp_bdy) = cn_trc     (1)
+         cn_trc_dflt(2:jp_bdy) = cn_trc_dflt(1)
          REWIND( numnat_cfg )              ! Namelist namtrc_bdy in configuration namelist : Passive tracer data structure
          READ  ( numnat_cfg, namtrc_bdy, IOSTAT = ios, ERR = 904 )
@@ -234,5 +235,5 @@
       ! OPEN Lateral boundary conditions
       IF( ln_bdy .AND. nb_trcobc > 0 ) THEN 
-         ALLOCATE ( sf_trcobc(nb_trcobc), rf_trofac(nb_trcobc), nbmap_ptr(nb_trcobc), STAT=ierr1 )
+         ALLOCATE ( sf_trcobc(nb_trcobc), rf_trofac(nb_trcobc), STAT=ierr1 )
          IF( ierr1 > 0 ) THEN
             CALL ctl_stop( 'trc_bc_ini: unable to allocate sf_trcobc structure' )   ;   RETURN
@@ -257,8 +258,4 @@
                   trcdta_bdy(jn,ib)%trc => sf_trcobc(jl)%fnow(:,1,:)
                   trcdta_bdy(jn,ib)%rn_fac = rf_trofac(jl)
-                  ! create OBC mapping array
-                  nbmap_ptr(jl)%ptr => idx_bdy(ib)%nbmap(:,igrd)
-                  nbmap_ptr(jl)%ll_unstruc = ln_coords_file(igrd)
-                  !
                ELSE                          !* Initialise obc arrays from initial conditions *!
                   ALLOCATE ( trcdta_bdy(jn,ib)%trc(nblen,jpk) )
@@ -276,4 +273,13 @@
          !
          CALL fld_fill( sf_trcobc, slf_i, cn_dir_obc, 'trc_bc_ini', 'Passive tracer OBC data', 'namtrc_bc' )
+         DO jn = 1, ntrc   ! define imap pointer, must be done after the call to fld_fill
+            DO ib = 1, nb_bdy
+               IF( ln_trc_obc(jn) ) THEN     !* Initialise from external data *!
+                  jl = n_trc_indobc(jn)
+                  sf_trcobc(jl)%imap => idx_bdy(ib)%nbmap(1:idx_bdy(ib)%nblen(igrd),igrd)
+               ENDIF
+            END DO
+         END DO
+         !
       ENDIF
 
@@ -362,8 +368,8 @@
       IF( PRESENT(jit) ) THEN 
          !
-         ! OPEN boundary conditions (use time_offset=+1 as they are applied at the end of the step)
+         ! OPEN boundary conditions (use kt_offset=+1 as they are applied at the end of the step)
          IF( nb_trcobc > 0 ) THEN
            if (lwp) write(numout,'(a,i5,a,i10)') '   reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt
-           CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, map=nbmap_ptr, kit=jit, kt_offset=+1)
+           CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, kit=jit, kt_offset=+1)
          ENDIF
          !
@@ -382,8 +388,8 @@
       ELSE
          !
-         ! OPEN boundary conditions (use time_offset=+1 as they are applied at the end of the step)
+         ! OPEN boundary conditions (use kt_offset=+1 as they are applied at the end of the step)
          IF( nb_trcobc > 0 ) THEN
            if (lwp) write(numout,'(a,i5,a,i10)') '   reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt
-           CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, map=nbmap_ptr, kt_offset=+1)
+           CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, kt_offset=+1)
          ENDIF
          !
Index: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/TOP/trcbdy.F90
===================================================================
--- NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/TOP/trcbdy.F90	(revision 11223)
+++ NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/TOP/trcbdy.F90	(revision 11224)
@@ -46,5 +46,5 @@
       INTEGER, INTENT( in ) :: kt     ! Main time step counter
       !!
-      INTEGER                           :: ib_bdy ,jn ,igrd ! Loop indices
+      INTEGER                           :: ib_bdy ,ir, jn ,igrd ! Loop indices
       REAL(wp), POINTER, DIMENSION(:,:) ::  ztrc
       REAL(wp), POINTER                 ::  zfac
