Index: branches/2015/dev_merge_2015/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90
===================================================================
--- branches/2015/dev_merge_2015/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90	(revision 6059)
+++ branches/2015/dev_merge_2015/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90	(revision 6060)
@@ -45,5 +45,4 @@
    INTEGER, ALLOCATABLE, DIMENSION(:)   ::   nb_bdy_fld        ! Number of fields to update for each boundary set.
    INTEGER                              ::   nb_bdy_fld_sum    ! Total number of fields to update for all boundary sets.
-
    LOGICAL,           DIMENSION(jp_bdy) ::   ln_full_vel_array ! =T => full velocities in 3D boundary conditions
                                                                ! =F => baroclinic velocities in 3D boundary conditions
@@ -58,5 +57,4 @@
 #endif
 
-#  include "domzgr_substitute.h90"
    !!----------------------------------------------------------------------
    !! NEMO/OPA 3.3 , NEMO Consortium (2010)
@@ -75,26 +73,24 @@
       !!                
       !!----------------------------------------------------------------------
-      !!
-      INTEGER, INTENT( in )           ::   kt    ! ocean time-step index 
-      INTEGER, INTENT( in ), OPTIONAL ::   jit   ! subcycle time-step index (for timesplitting option)
-      INTEGER, INTENT( in ), OPTIONAL ::   time_offset  ! time offset in units of timesteps. NB. if jit
-                                                        ! is present then units = subcycle timesteps.
-                                                        ! time_offset = 0 => get data at "now" time level
-                                                        ! time_offset = -1 => get data at "before" time level
-                                                        ! time_offset = +1 => get data at "after" time level
-                                                        ! etc.
-      !!
-      INTEGER     ::  ib_bdy, jfld, jstart, jend, ib, ii, ij, ik, igrd, jl  ! local indices
+      INTEGER, INTENT(in)           ::   kt           ! ocean time-step index 
+      INTEGER, INTENT(in), OPTIONAL ::   jit          ! subcycle time-step index (for timesplitting option)
+      INTEGER, INTENT(in), OPTIONAL ::   time_offset  ! time offset in units of timesteps. NB. if jit
+      !                                               ! is present then units = subcycle timesteps.
+      !                                               ! time_offset = 0 => get data at "now" time level
+      !                                               ! time_offset = -1 => get data at "before" time level
+      !                                               ! time_offset = +1 => get data at "after" time level
+      !                                               ! etc.
+      !
+      INTEGER ::  ib_bdy, jfld, jstart, jend, ib, ii, ij, ik, igrd, jl  ! local indices
       INTEGER,          DIMENSION(jpbgrd) ::   ilen1 
       INTEGER, POINTER, DIMENSION(:)      ::   nblen, nblenrim  ! short cuts
       TYPE(OBC_DATA), POINTER             ::   dta              ! short cut
-      !!
       !!---------------------------------------------------------------------------
-      !!
-      IF( nn_timing == 1 ) CALL timing_start('bdy_dta')
-
+      !
+      IF( nn_timing == 1 )   CALL timing_start('bdy_dta')
+      !
       ! Initialise data arrays once for all from initial conditions where required
       !---------------------------------------------------------------------------
-      IF( kt .eq. nit000 .and. .not. PRESENT(jit) ) THEN
+      IF( kt == nit000 .AND. .NOT.PRESENT(jit) ) THEN
 
          ! Calculate depth-mean currents
@@ -102,10 +98,10 @@
          
          DO ib_bdy = 1, nb_bdy
-
+            !
             nblen => idx_bdy(ib_bdy)%nblen
             nblenrim => idx_bdy(ib_bdy)%nblenrim
             dta => dta_bdy(ib_bdy)
 
-            IF( nn_dyn2d_dta(ib_bdy) .eq. 0 ) THEN 
+            IF( nn_dyn2d_dta(ib_bdy) == 0 ) THEN 
                ilen1(:) = nblen(:)
                IF( dta%ll_ssh ) THEN 
@@ -135,5 +131,5 @@
             ENDIF
 
-            IF( nn_dyn3d_dta(ib_bdy) .eq. 0 ) THEN 
+            IF( nn_dyn3d_dta(ib_bdy) == 0 ) THEN 
                ilen1(:) = nblen(:)
                IF( dta%ll_u3d ) THEN 
@@ -159,5 +155,5 @@
             ENDIF
 
-            IF( nn_tra_dta(ib_bdy) .eq. 0 ) THEN 
+            IF( nn_tra_dta(ib_bdy) == 0 ) THEN 
                ilen1(:) = nblen(:)
                IF( dta%ll_tem ) THEN
@@ -184,5 +180,5 @@
 
 #if defined key_lim2
-            IF( nn_ice_lim_dta(ib_bdy) .eq. 0 ) THEN 
+            IF( nn_ice_lim_dta(ib_bdy) == 0 ) THEN 
                ilen1(:) = nblen(:)
                IF( dta%ll_frld ) THEN
@@ -212,5 +208,5 @@
             ENDIF
 #elif defined key_lim3
-            IF( nn_ice_lim_dta(ib_bdy) .eq. 0 ) THEN 
+            IF( nn_ice_lim_dta(ib_bdy) == 0 ) THEN 
                ilen1(:) = nblen(:)
                IF( dta%ll_a_i ) THEN
@@ -246,9 +242,7 @@
             ENDIF
 #endif
-
-         ENDDO ! ib_bdy
-
-
-      ENDIF ! kt .eq. nit000
+         END DO ! ib_bdy
+         !
+      ENDIF ! kt == nit000
 
       ! update external data from files
@@ -258,5 +252,5 @@
       DO ib_bdy = 1, nb_bdy   
          dta => dta_bdy(ib_bdy)
-         IF( nn_dta(ib_bdy) .eq. 1 ) THEN ! skip this bit if no external data required
+         IF( nn_dta(ib_bdy) == 1 ) THEN ! skip this bit if no external data required
       
             IF( PRESENT(jit) ) THEN
@@ -264,11 +258,11 @@
                ! jit is optional argument for fld_read and bdytide_update
                IF( cn_dyn2d(ib_bdy) /= 'none' ) THEN
-                  IF( nn_dyn2d_dta(ib_bdy) .eq. 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays
-                     IF( dta%ll_ssh ) dta%ssh(:) = 0.0
-                     IF( dta%ll_u2d ) dta%u2d(:) = 0.0
-                     IF( dta%ll_u3d ) dta%v2d(:) = 0.0
+                  IF( nn_dyn2d_dta(ib_bdy) == 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays
+                     IF( dta%ll_ssh ) dta%ssh(:) = 0._wp
+                     IF( dta%ll_u2d ) dta%u2d(:) = 0._wp
+                     IF( dta%ll_u3d ) dta%v2d(:) = 0._wp
                   ENDIF
                   IF (cn_tra(ib_bdy) /= 'runoff') THEN
-                     IF( nn_dyn2d_dta(ib_bdy) .EQ. 1 .OR. nn_dyn2d_dta(ib_bdy) .EQ. 3 ) THEN
+                     IF( nn_dyn2d_dta(ib_bdy) == 1 .OR. nn_dyn2d_dta(ib_bdy) == 3 ) THEN
 
                         jend = jstart + dta%nread(2) - 1
@@ -278,9 +272,9 @@
                         ! If full velocities in boundary data then extract barotropic velocities from 3D fields
                         IF( ln_full_vel_array(ib_bdy) .AND.                                             &
-                          &    ( nn_dyn2d_dta(ib_bdy) .EQ. 1 .OR. nn_dyn2d_dta(ib_bdy) .EQ. 3 .OR.  &
-                          &      nn_dyn3d_dta(ib_bdy) .EQ. 1 ) )THEN
+                          &    ( nn_dyn2d_dta(ib_bdy) == 1 .OR. nn_dyn2d_dta(ib_bdy) == 3 .OR.  &
+                          &      nn_dyn3d_dta(ib_bdy) == 1 ) )THEN
 
                            igrd = 2                      ! zonal velocity
-                           dta%u2d(:) = 0.0
+                           dta%u2d(:) = 0._wp
                            DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd)
                               ii   = idx_bdy(ib_bdy)%nbi(ib,igrd)
@@ -288,10 +282,10 @@
                               DO ik = 1, jpkm1
                                  dta%u2d(ib) = dta%u2d(ib) &
-                       &                          + fse3u(ii,ij,ik) * umask(ii,ij,ik) * dta%u3d(ib,ik)
+                       &                          + e3u_n(ii,ij,ik) * umask(ii,ij,ik) * dta%u3d(ib,ik)
                               END DO
-                              dta%u2d(ib) =  dta%u2d(ib) * hur(ii,ij)
+                              dta%u2d(ib) =  dta%u2d(ib) * r1_hu_n(ii,ij)
                            END DO
                            igrd = 3                      ! meridional velocity
-                           dta%v2d(:) = 0.0
+                           dta%v2d(:) = 0._wp
                            DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd)
                               ii   = idx_bdy(ib_bdy)%nbi(ib,igrd)
@@ -299,7 +293,7 @@
                               DO ik = 1, jpkm1
                                  dta%v2d(ib) = dta%v2d(ib) &
-                       &                       + fse3v(ii,ij,ik) * vmask(ii,ij,ik) * dta%v3d(ib,ik)
+                       &                       + e3v_n(ii,ij,ik) * vmask(ii,ij,ik) * dta%v3d(ib,ik)
                               END DO
-                              dta%v2d(ib) =  dta%v2d(ib) * hvr(ii,ij)
+                              dta%v2d(ib) =  dta%v2d(ib) * r1_hv_n(ii,ij)
                            END DO
                         ENDIF                    
@@ -331,8 +325,8 @@
                   END DO
                ELSE
-                  IF( nn_dyn2d_dta(ib_bdy) .eq. 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays
-                     IF( dta%ll_ssh ) dta%ssh(:) = 0.0
-                     IF( dta%ll_u2d ) dta%u2d(:) = 0.0
-                     IF( dta%ll_v2d ) dta%v2d(:) = 0.0
+                  IF( nn_dyn2d_dta(ib_bdy) == 2 ) THEN ! tidal harmonic forcing ONLY: initialise arrays
+                     IF( dta%ll_ssh ) dta%ssh(:) = 0._wp
+                     IF( dta%ll_u2d ) dta%u2d(:) = 0._wp
+                     IF( dta%ll_v2d ) dta%v2d(:) = 0._wp
                   ENDIF
                   IF( dta%nread(1) .gt. 0 ) THEN ! update external data
@@ -343,8 +337,8 @@
                   ! If full velocities in boundary data then split into barotropic and baroclinic data
                   IF( ln_full_vel_array(ib_bdy) .and.                                             &
-                    & ( nn_dyn2d_dta(ib_bdy) .EQ. 1 .OR. nn_dyn2d_dta(ib_bdy) .EQ. 3 .OR. &
-                    &   nn_dyn3d_dta(ib_bdy) .EQ. 1 ) ) THEN
+                    & ( nn_dyn2d_dta(ib_bdy) == 1 .OR. nn_dyn2d_dta(ib_bdy) == 3 .OR. &
+                    &   nn_dyn3d_dta(ib_bdy) == 1 ) ) THEN
                      igrd = 2                      ! zonal velocity
-                     dta%u2d(:) = 0.0
+                     dta%u2d(:) = 0._wp
                      DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd)
                         ii   = idx_bdy(ib_bdy)%nbi(ib,igrd)
@@ -352,7 +346,7 @@
                         DO ik = 1, jpkm1
                            dta%u2d(ib) = dta%u2d(ib) &
-                 &                       + fse3u(ii,ij,ik) * umask(ii,ij,ik) * dta%u3d(ib,ik)
+                 &                       + e3u_n(ii,ij,ik) * umask(ii,ij,ik) * dta%u3d(ib,ik)
                         END DO
-                        dta%u2d(ib) =  dta%u2d(ib) * hur(ii,ij)
+                        dta%u2d(ib) =  dta%u2d(ib) * r1_hu_n(ii,ij)
                         DO ik = 1, jpkm1
                            dta%u3d(ib,ik) = dta%u3d(ib,ik) - dta%u2d(ib)
@@ -360,5 +354,5 @@
                      END DO
                      igrd = 3                      ! meridional velocity
-                     dta%v2d(:) = 0.0
+                     dta%v2d(:) = 0._wp
                      DO ib = 1, idx_bdy(ib_bdy)%nblen(igrd)
                         ii   = idx_bdy(ib_bdy)%nbi(ib,igrd)
@@ -366,7 +360,7 @@
                         DO ik = 1, jpkm1
                            dta%v2d(ib) = dta%v2d(ib) &
-                 &                       + fse3v(ii,ij,ik) * vmask(ii,ij,ik) * dta%v3d(ib,ik)
+                 &                       + e3v_n(ii,ij,ik) * vmask(ii,ij,ik) * dta%v3d(ib,ik)
                         END DO
-                        dta%v2d(ib) =  dta%v2d(ib) * hvr(ii,ij)
+                        dta%v2d(ib) =  dta%v2d(ib) * r1_hv_n(ii,ij)
                         DO ik = 1, jpkm1
                            dta%v3d(ib,ik) = dta%v3d(ib,ik) - dta%v2d(ib)
@@ -413,15 +407,15 @@
                   ij   = idx_bdy(ib_bdy)%nbj(ib,igrd)
                   dta_bdy(ib_bdy)%ssh(ib) = dta_bdy(ib_bdy)%ssh(ib) + ssh_ib(ii,ij)
-               ENDDO
-            ENDIF
-         ENDDO
+               END DO
+            ENDIF
+         END DO
       ENDIF
-
+      !
       IF( nn_timing == 1 ) CALL timing_stop('bdy_dta')
-
-      END SUBROUTINE bdy_dta
-
-
-      SUBROUTINE bdy_dta_init
+      !
+   END SUBROUTINE bdy_dta
+
+
+   SUBROUTINE bdy_dta_init
       !!----------------------------------------------------------------------
       !!                   ***  SUBROUTINE bdy_dta_init  ***
@@ -433,8 +427,6 @@
       !!                
       !!----------------------------------------------------------------------
-      !!
-      INTEGER     ::  ib_bdy, jfld, jstart, jend, ierror  ! local indices
-      INTEGER      ::   ios                               ! Local integer output status for namelist read
-      !!
+      INTEGER ::   ib_bdy, jfld, jstart, jend, ierror, ios     ! Local integers
+      !
       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
@@ -469,7 +461,7 @@
       NAMELIST/nambdy_dta/ ln_full_vel
       !!---------------------------------------------------------------------------
-
-      IF( nn_timing == 1 ) CALL timing_start('bdy_dta_init')
-
+      !
+      IF( nn_timing == 1 )   CALL timing_start('bdy_dta_init')
+      !
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) 'bdy_dta_ini : initialization of data at the open boundaries'
@@ -486,5 +478,5 @@
 #endif
                               )
-         IF(nn_dta(ib_bdy) .gt. 1) nn_dta(ib_bdy) = 1
+         IF(nn_dta(ib_bdy) > 1) nn_dta(ib_bdy) = 1
       END DO
 
@@ -494,20 +486,20 @@
       nb_bdy_fld(:) = 0
       DO ib_bdy = 1, nb_bdy         
-         IF( cn_dyn2d(ib_bdy) /= 'none' .and. ( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) ) THEN
+         IF( cn_dyn2d(ib_bdy) /= 'none' .and. ( nn_dyn2d_dta(ib_bdy) == 1 .or. nn_dyn2d_dta(ib_bdy) == 3 ) ) THEN
             nb_bdy_fld(ib_bdy) = nb_bdy_fld(ib_bdy) + 3
          ENDIF
-         IF( cn_dyn3d(ib_bdy) /= 'none' .and. nn_dyn3d_dta(ib_bdy) .eq. 1 ) THEN
+         IF( cn_dyn3d(ib_bdy) /= 'none' .and. nn_dyn3d_dta(ib_bdy) == 1 ) THEN
             nb_bdy_fld(ib_bdy) = nb_bdy_fld(ib_bdy) + 2
          ENDIF
-         IF( cn_tra(ib_bdy) /= 'none' .and. nn_tra_dta(ib_bdy) .eq. 1  ) THEN
+         IF( cn_tra(ib_bdy) /= 'none' .and. nn_tra_dta(ib_bdy) == 1  ) THEN
             nb_bdy_fld(ib_bdy) = nb_bdy_fld(ib_bdy) + 2
          ENDIF
 #if ( defined key_lim2 || defined key_lim3 )
-         IF( cn_ice_lim(ib_bdy) /= 'none' .and. nn_ice_lim_dta(ib_bdy) .eq. 1  ) THEN
+         IF( cn_ice_lim(ib_bdy) /= 'none' .and. nn_ice_lim_dta(ib_bdy) == 1  ) THEN
             nb_bdy_fld(ib_bdy) = nb_bdy_fld(ib_bdy) + 3
          ENDIF
 #endif               
          IF(lwp) WRITE(numout,*) 'Maximum number of files to open =',nb_bdy_fld(ib_bdy)
-      ENDDO            
+      END DO            
 
       nb_bdy_fld_sum = SUM( nb_bdy_fld )
@@ -535,11 +527,11 @@
       jfld = 0 
       DO ib_bdy = 1, nb_bdy         
-         IF( nn_dta(ib_bdy) .eq. 1 ) THEN
+         IF( nn_dta(ib_bdy) == 1 ) THEN
             READ  ( numnam_ref, nambdy_dta, IOSTAT = ios, ERR = 901)
-901         IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy_dta in reference namelist', lwp )
+901         IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_dta in reference namelist', lwp )
 
             READ  ( numnam_cfg, nambdy_dta, IOSTAT = ios, ERR = 902 )
-902         IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy_dta in configuration namelist', lwp )
-            IF(lwm) WRITE ( numond, nambdy_dta )
+902         IF( ios /= 0 )   CALL ctl_nam ( ios , 'nambdy_dta in configuration namelist', lwp )
+            IF(lwm) WRITE( numond, nambdy_dta )
 
             cn_dir_array(ib_bdy) = cn_dir
@@ -553,5 +545,5 @@
             ! Only read in necessary fields for this set.
             ! Important that barotropic variables come first.
-            IF( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) THEN 
+            IF( nn_dyn2d_dta(ib_bdy) == 1 .or. nn_dyn2d_dta(ib_bdy) == 3 ) THEN 
 
                IF( dta%ll_ssh ) THEN 
@@ -592,8 +584,8 @@
             ! read 3D velocities if baroclinic velocities require OR if
             ! barotropic velocities required and ln_full_vel set to .true.
-            IF( nn_dyn3d_dta(ib_bdy) .eq. 1 .or. &
-           &  ( ln_full_vel_array(ib_bdy) .and. ( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) ) ) THEN
-
-               IF( dta%ll_u3d .or. ( ln_full_vel_array(ib_bdy) .and. dta%ll_u2d ) ) THEN
+            IF( nn_dyn3d_dta(ib_bdy) == 1 .OR. &
+           &  ( ln_full_vel_array(ib_bdy) .AND. ( nn_dyn2d_dta(ib_bdy) == 1 .or. nn_dyn2d_dta(ib_bdy) == 3 ) ) ) THEN
+
+               IF( dta%ll_u3d .OR. ( ln_full_vel_array(ib_bdy) .and. dta%ll_u2d ) ) THEN
                   if(lwp) write(numout,*) '++++++ reading in u3d field'
                   jfld = jfld + 1
@@ -606,5 +598,5 @@
                ENDIF
 
-               IF( dta%ll_v3d .or. ( ln_full_vel_array(ib_bdy) .and. dta%ll_v2d ) ) THEN
+               IF( dta%ll_v3d .OR. ( ln_full_vel_array(ib_bdy) .and. dta%ll_v2d ) ) THEN
                   if(lwp) write(numout,*) '++++++ reading in v3d field'
                   jfld = jfld + 1
@@ -620,5 +612,5 @@
 
             ! temperature and salinity
-            IF( nn_tra_dta(ib_bdy) .eq. 1 ) THEN
+            IF( nn_tra_dta(ib_bdy) == 1 ) THEN
 
                IF( dta%ll_tem ) THEN
@@ -646,5 +638,5 @@
 #if defined key_lim2
             ! sea ice
-            IF( nn_ice_lim_dta(ib_bdy) .eq. 1 ) THEN
+            IF( nn_ice_lim_dta(ib_bdy) == 1 ) THEN
 
                IF( dta%ll_frld ) THEN
@@ -678,5 +670,5 @@
 #elif defined key_lim3
             ! sea ice
-            IF( nn_ice_lim_dta(ib_bdy) .eq. 1 ) THEN
+            IF( nn_ice_lim_dta(ib_bdy) == 1 ) THEN
                ! Test for types of ice input (lim2 or lim3) 
                ! Build file name to find dimensions 
@@ -733,5 +725,5 @@
             ! Recalculate field counts
             !-------------------------
-            IF( ib_bdy .eq. 1 ) THEN 
+            IF( ib_bdy == 1 ) THEN 
                nb_bdy_fld_sum = 0
                nb_bdy_fld(ib_bdy) = jfld
@@ -744,5 +736,5 @@
             dta%nread(1) = nb_bdy_fld(ib_bdy)
 
-         ENDIF ! nn_dta .eq. 1
+         ENDIF ! nn_dta == 1
       ENDDO ! ib_bdy
 
@@ -785,5 +777,5 @@
          endif
 
-         IF ( nn_dyn2d_dta(ib_bdy) .eq. 0 .or. nn_dyn2d_dta(ib_bdy) .eq. 2 ) THEN
+         IF ( nn_dyn2d_dta(ib_bdy) == 0 .or. nn_dyn2d_dta(ib_bdy) == 2 ) THEN
             if(lwp) write(numout,*) '++++++ dta%ssh/u2d/u3d allocated space'
             IF( dta%ll_ssh ) ALLOCATE( dta%ssh(nblen(1)) )
@@ -791,5 +783,5 @@
             IF( dta%ll_v2d ) ALLOCATE( dta%v2d(nblen(3)) )
          ENDIF
-         IF ( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) THEN
+         IF ( nn_dyn2d_dta(ib_bdy) == 1 .or. nn_dyn2d_dta(ib_bdy) == 3 ) THEN
             IF( dta%ll_ssh ) THEN
                if(lwp) write(numout,*) '++++++ dta%ssh pointing to fnow'
@@ -819,11 +811,11 @@
          ENDIF
 
-         IF ( nn_dyn3d_dta(ib_bdy) .eq. 0 ) THEN
+         IF ( nn_dyn3d_dta(ib_bdy) == 0 ) THEN
             if(lwp) write(numout,*) '++++++ dta%u3d/v3d allocated space'
             IF( dta%ll_u3d ) ALLOCATE( dta_bdy(ib_bdy)%u3d(nblen(2),jpk) )
             IF( dta%ll_v3d ) ALLOCATE( dta_bdy(ib_bdy)%v3d(nblen(3),jpk) )
          ENDIF
-         IF ( nn_dyn3d_dta(ib_bdy) .eq. 1 .or. &
-           &  ( ln_full_vel_array(ib_bdy) .and. ( nn_dyn2d_dta(ib_bdy) .eq. 1 .or. nn_dyn2d_dta(ib_bdy) .eq. 3 ) ) ) THEN
+         IF ( nn_dyn3d_dta(ib_bdy) == 1 .or. &
+           &  ( ln_full_vel_array(ib_bdy) .and. ( nn_dyn2d_dta(ib_bdy) == 1 .or. nn_dyn2d_dta(ib_bdy) == 3 ) ) ) THEN
             IF ( dta%ll_u3d .or. ( ln_full_vel_array(ib_bdy) .and. dta%ll_u2d ) ) THEN
                if(lwp) write(numout,*) '++++++ dta%u3d pointing to fnow'
@@ -838,5 +830,5 @@
          ENDIF
 
-         IF( nn_tra_dta(ib_bdy) .eq. 0 ) THEN
+         IF( nn_tra_dta(ib_bdy) == 0 ) THEN
             if(lwp) write(numout,*) '++++++ dta%tem/sal allocated space'
             IF( dta%ll_tem ) ALLOCATE( dta_bdy(ib_bdy)%tem(nblen(1),jpk) )
@@ -857,5 +849,5 @@
 #if defined key_lim2
          IF (cn_ice_lim(ib_bdy) /= 'none') THEN
-            IF( nn_ice_lim_dta(ib_bdy) .eq. 0 ) THEN
+            IF( nn_ice_lim_dta(ib_bdy) == 0 ) THEN
                ALLOCATE( dta_bdy(ib_bdy)%frld(nblen(1)) )
                ALLOCATE( dta_bdy(ib_bdy)%hicif(nblen(1)) )
@@ -872,5 +864,5 @@
 #elif defined key_lim3
          IF (cn_ice_lim(ib_bdy) /= 'none') THEN
-            IF( nn_ice_lim_dta(ib_bdy) .eq. 0 ) THEN
+            IF( nn_ice_lim_dta(ib_bdy) == 0 ) THEN
                ALLOCATE( dta_bdy(ib_bdy)%a_i (nblen(1),jpl) )
                ALLOCATE( dta_bdy(ib_bdy)%ht_i(nblen(1),jpl) )
@@ -892,18 +884,18 @@
                   ALLOCATE( dta_bdy(ib_bdy)%ht_i(nblen(1),jpl) )
                   ALLOCATE( dta_bdy(ib_bdy)%ht_s(nblen(1),jpl) )
-                  dta_bdy(ib_bdy)%a_i (:,:) = 0.0
-                  dta_bdy(ib_bdy)%ht_i(:,:) = 0.0
-                  dta_bdy(ib_bdy)%ht_s(:,:) = 0.0
-               ENDIF
-
-            ENDIF
-         ENDIF
-#endif
-
-      ENDDO ! ib_bdy 
-
+                  dta_bdy(ib_bdy)%a_i (:,:) = 0._wp
+                  dta_bdy(ib_bdy)%ht_i(:,:) = 0._wp
+                  dta_bdy(ib_bdy)%ht_s(:,:) = 0._wp
+               ENDIF
+
+            ENDIF
+         ENDIF
+#endif
+         !
+      END DO ! ib_bdy 
+      !
       IF( nn_timing == 1 ) CALL timing_stop('bdy_dta_init')
-
-      END SUBROUTINE bdy_dta_init
+      !
+   END SUBROUTINE bdy_dta_init
 
 #else
