Index: /NEMO/releases/release-4.0/src/OCE/BDY/bdy_oce.F90
===================================================================
--- /NEMO/releases/release-4.0/src/OCE/BDY/bdy_oce.F90	(revision 10932)
+++ /NEMO/releases/release-4.0/src/OCE/BDY/bdy_oce.F90	(revision 10933)
@@ -85,5 +85,5 @@
    !
    INTEGER                    ::   nb_bdy                   !: number of open boundary sets
-   INTEGER                    ::   nb_jpk_bdy               !: number of levels in the bdy data (set < 0 if consistent with planned run)
+   INTEGER, DIMENSION(jp_bdy) ::   nb_jpk_bdy               !: number of levels in the bdy data (set < 0 if consistent with planned run)
    INTEGER, DIMENSION(jp_bdy) ::   nn_rimwidth              !: boundary rim width for Flow Relaxation Scheme
    INTEGER                    ::   nn_volctl                !: = 0 the total volume will have the variability of the surface Flux E-P 
Index: /NEMO/releases/release-4.0/src/OCE/BDY/bdydta.F90
===================================================================
--- /NEMO/releases/release-4.0/src/OCE/BDY/bdydta.F90	(revision 10932)
+++ /NEMO/releases/release-4.0/src/OCE/BDY/bdydta.F90	(revision 10933)
@@ -243,5 +243,5 @@
                         IF( ln_full_vel_array(jbdy) ) THEN
                            CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), map=nbmap_ptr(jstart:jend),  &
-                                     & kit=jit, kt_offset=time_offset , jpk_bdy=nb_jpk_bdy,   &
+                                     & kit=jit, kt_offset=time_offset , jpk_bdy=nb_jpk_bdy(jbdy),   &
                                      & fvl=ln_full_vel_array(jbdy)  )
                         ELSE
@@ -313,5 +313,5 @@
                      jend = jstart + dta%nread(1) - 1
                      CALL fld_read( kt=kt, kn_fsbc=1, sd=bf(jstart:jend), &
-                                  & map=nbmap_ptr(jstart:jend), kt_offset=time_offset, jpk_bdy=nb_jpk_bdy,   &
+                                  & map=nbmap_ptr(jstart:jend), kt_offset=time_offset, jpk_bdy=nb_jpk_bdy(jbdy),   &
                                   & fvl=ln_full_vel_array(jbdy) )
                   ENDIF
@@ -446,5 +446,5 @@
       NAMELIST/nambdy_dta/ bn_a_i, bn_h_i, bn_h_s
 #endif
-      NAMELIST/nambdy_dta/ ln_full_vel, nb_jpk_bdy
+      NAMELIST/nambdy_dta/ ln_full_vel
       !!---------------------------------------------------------------------------
       !
Index: /NEMO/releases/release-4.0/src/OCE/BDY/bdyini.F90
===================================================================
--- /NEMO/releases/release-4.0/src/OCE/BDY/bdyini.F90	(revision 10932)
+++ /NEMO/releases/release-4.0/src/OCE/BDY/bdyini.F90	(revision 10933)
@@ -140,5 +140,5 @@
       INTEGER, ALLOCATABLE, DIMENSION(:,:,:)  ::   nbrdta           ! Discrete distance from rim points
       CHARACTER(LEN=1),DIMENSION(jpbgrd)      ::   cgrid
-      INTEGER :: com_east, com_west, com_south, com_north          ! Flags for boundaries sending
+      INTEGER :: com_east, com_west, com_south, com_north, jpk_max  ! Flags for boundaries sending
       INTEGER :: com_east_b, com_west_b, com_south_b, com_north_b  ! Flags for boundaries receiving
       INTEGER :: iw_b(4), ie_b(4), is_b(4), in_b(4)                ! Arrays for neighbours coordinates
@@ -397,5 +397,5 @@
           IF(lwp) WRITE(numout,*)
         ENDIF
-        IF( nb_jpk_bdy > 0 ) THEN
+        IF( nb_jpk_bdy(ib_bdy) > 0 ) THEN
            IF(lwp) WRITE(numout,*) '*** open boundary will be interpolate in the vertical onto the native grid ***'
         ELSE
@@ -516,25 +516,16 @@
          ALLOCATE( nbidta(jpbdta, jpbgrd, nb_bdy), nbjdta(jpbdta, jpbgrd, nb_bdy),    &
             &      nbrdta(jpbdta, jpbgrd, nb_bdy) )
-
-         IF( nb_jpk_bdy>0 ) THEN
-            ALLOCATE( dta_global(jpbdtau, 1, nb_jpk_bdy) )
-            ALLOCATE( dta_global_z(jpbdtau, 1, nb_jpk_bdy) )
-            ALLOCATE( dta_global_dz(jpbdtau, 1, nb_jpk_bdy) )
-         ELSE
-            ALLOCATE( dta_global(jpbdtau, 1, jpk) )
-            ALLOCATE( dta_global_z(jpbdtau, 1, jpk) ) ! needed ?? TODO
-            ALLOCATE( dta_global_dz(jpbdtau, 1, jpk) )! needed ?? TODO
-         ENDIF
+         
+         jpk_max = MAXVAL(nb_jpk_bdy)
+         jpk_max = MAX(jpk_max, jpk)
+
+         ALLOCATE( dta_global(jpbdtau, 1, jpk_max) )
+         ALLOCATE( dta_global_z(jpbdtau, 1, jpk_max) ) ! needed ?? TODO
+         ALLOCATE( dta_global_dz(jpbdtau, 1, jpk_max) )! needed ?? TODO
 
          IF ( icount>0 ) THEN
-            IF( nb_jpk_bdy>0 ) THEN
-               ALLOCATE( dta_global2(jpbdtas, nrimmax, nb_jpk_bdy) )
-               ALLOCATE( dta_global2_z(jpbdtas, nrimmax, nb_jpk_bdy) )
-               ALLOCATE( dta_global2_dz(jpbdtas, nrimmax, nb_jpk_bdy) )
-            ELSE
-               ALLOCATE( dta_global2(jpbdtas, nrimmax, jpk) )
-               ALLOCATE( dta_global2_z(jpbdtas, nrimmax, jpk) ) ! needed ?? TODO
-               ALLOCATE( dta_global2_dz(jpbdtas, nrimmax, jpk) )! needed ?? TODO  
-            ENDIF
+            ALLOCATE( dta_global2(jpbdtas, nrimmax, jpk_max) )
+            ALLOCATE( dta_global2_z(jpbdtas, nrimmax, jpk_max) ) ! needed ?? TODO
+            ALLOCATE( dta_global2_dz(jpbdtas, nrimmax, jpk_max) )! needed ?? TODO  
          ENDIF
          ! 
