Index: /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90
===================================================================
--- /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 4399)
+++ /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90	(revision 4400)
@@ -800,9 +800,9 @@
       !
       ! Compute and store the deepest bottom level of any grid-type at each grid point
-      ! For use in removing data below ocean floor from halo exchanges.
+      ! For use in removing data below ocean floor from compute loops
       mbkmax(:,:) = MAX(mbkt(:,:)+1, mbku(:,:), mbkv(:,:))
       jpkf = MAXVAL( mbkmax(:,:) )
       jpkfm1 = jpkf - 1
-      WRITE(*,*) narea,': ARPDBG: jpkf = ', jpkf
+      WRITE(*,*) narea,': ARPDBG: shallowest pt and jpkf = ', MINVAL(mbkmax(:,:)), jpkf
 
       !
Index: /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/LBC/exchmod.F90
===================================================================
--- /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/LBC/exchmod.F90	(revision 4399)
+++ /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/LBC/exchmod.F90	(revision 4400)
@@ -300,5 +300,5 @@
     USE par_oce, ONLY: wp, jpreci, jprecj, jpim1
     USE dom_oce, ONLY: nlci, nlcj, nldi, nlei, nldj, nlej, &
-                       nperio, nbondi, npolj, narea
+                       nperio, nbondi, npolj, narea, jpkf
     USE mapcomm_mod, ONLY: Iminus, Iplus, NONE, ilbext, iubext, cyclic_bc
     USE mapcomm_mod, ONLY: trimmed, eidx, widx
@@ -356,4 +356,8 @@
        kdim1 = SIZE(b3,dim=3)
 #endif
+       ! If we've been passed a 'standard' 3D array then
+       ! we can limit the length of our z loops to the
+       ! no. of levels above the ocean floor.
+       IF(kdim1 == jpk)kdim1 = jpkf
     ELSEIF ( PRESENT(ib3) ) THEN
 #if defined key_z_first
@@ -362,4 +366,8 @@
        kdim1 = SIZE(ib3,dim=3)
 #endif
+       ! If we've been passed a 'standard' 3D array then
+       ! we can limit the length of our z loops to the
+       ! no. of levels above the ocean floor.
+       IF(kdim1 == jpk)kdim1 = jpkf
     ELSEIF ( PRESENT(b2) ) THEN
        kdim1 = SIZE(b2,dim=2)
@@ -568,5 +576,5 @@
 #if defined key_z_first
              DO jj = 1,jpj,1
-                DO jk = 1,jpk,1
+                DO jk = 1,kdim1,1
                    b3( 1, jj, jk) = b3(jpim1, jj, jk)
                    b3(jpi,jj, jk) = b3(    2, jj, jk)
@@ -574,11 +582,11 @@
              END DO
 #else
-             b3( 1, :, :) = b3(jpim1, :, :)
-             b3(jpi,:, :) = b3(    2, :, :)
+             b3( 1, :, 1:kdim1) = b3(jpim1, :, 1:kdim1)
+             b3(jpi,:, 1:kdim1) = b3(    2, :, 1:kdim1)
 #endif
           ELSE IF ( PRESENT(ib3) ) THEN
 
-             ib3( 1, :, :) = ib3(jpim1, :, :)
-             ib3(jpi,:, :) = ib3(    2, :, :)
+             ib3( 1, :, 1:kdim1) = ib3(jpim1, :, 1:kdim1)
+             ib3(jpi,:, 1:kdim1) = ib3(    2, :, 1:kdim1)
           END IF
 
@@ -609,10 +617,10 @@
                    DO jj=1,jpj,1
                       DO ji=1,jpreci,1
-                         DO jk=1,jpk,1
+                         DO jk=1,kdim1,1
                             b3(ji, jj, jk) = zland
                          END DO
                       END DO
                       DO ji=nlci-jpreci+1,jpi,1
-                         DO jk=1,jpk,1
+                         DO jk=1,kdim1,1
                             b3(ji, jj, jk) = zland
                          END DO
@@ -620,6 +628,6 @@
                    END DO
 #else
-                   b3(1:jpreci         , :, :) = zland
-                   b3(nlci-jpreci+1:jpi, :, :) = zland
+                   b3(1:jpreci         , :, 1:kdim1) = zland
+                   b3(nlci-jpreci+1:jpi, :, 1:kdim1) = zland
 #endif
                 CASE ( 'F' )
@@ -627,5 +635,5 @@
                    DO jj=1,jpj,1
                       DO ji = nlci-jpreci+1,jpi,1
-                         DO jk = 1,jpk,1
+                         DO jk = 1,kdim1,1
                             b3(ji, jj, jk) = zland
                          END DO
@@ -633,5 +641,5 @@
                    END DO
 #else
-                   b3(nlci-jpreci+1:jpi, :, :) = zland
+                   b3(nlci-jpreci+1:jpi, :, 1:kdim1) = zland
 #endif
                 END SELECT
@@ -639,8 +647,8 @@
                 SELECT CASE ( cd_type )
                 CASE ( 'T', 'U', 'V', 'W' )
-                   ib3(1:jpreci         , :, :) = iland
-                   ib3(nlci-jpreci+1:jpi, :, :) = iland
+                   ib3(1:jpreci         , :, 1:kdim1) = iland
+                   ib3(nlci-jpreci+1:jpi, :, 1:kdim1) = iland
                 CASE ( 'F' )
-                   ib3(nlci-jpreci+1:jpi, :, :) = iland
+                   ib3(nlci-jpreci+1:jpi, :, 1:kdim1) = iland
                 END SELECT
              END IF
@@ -678,5 +686,5 @@
                 DO jj=1,jprecj,1
                    DO ji=1,jpi,1
-                      DO jk = 1,jpk,1
+                      DO jk = 1,kdim1,1
                          b3(ji, jj, jk) = zland
                       END DO
@@ -685,5 +693,5 @@
                 DO jj=nlcj-jprecj+1,jpj,1
                    DO ji=1,jpi,1
-                      DO jk = 1,jpk,1
+                      DO jk = 1,kdim1,1
                          b3(ji, jj, jk) = zland
                       END DO
@@ -691,6 +699,6 @@
                 END DO
 #else
-                b3(:, 1:jprecj         , :) = zland
-                b3(:, nlcj-jprecj+1:jpj, :) = zland
+                b3(:, 1:jprecj         , 1:kdim1) = zland
+                b3(:, nlcj-jprecj+1:jpj, 1:kdim1) = zland
 #endif
              CASE ( 'F' )
@@ -698,5 +706,5 @@
                 DO jj=nlcj-jprecj+1,jpj,1
                    DO ji=1,jpi,1
-                      DO jk = 1,jpk,1
+                      DO jk = 1,kdim1,1
                          b3(ji, jj, jk) = zland
                       END DO
@@ -704,5 +712,5 @@
                 END DO
 #else
-                b3(:, nlcj-jprecj+1:jpj, :) = zland
+                b3(:, nlcj-jprecj+1:jpj, 1:kdim1) = zland
 #endif
              END SELECT
@@ -710,8 +718,8 @@
              SELECT CASE ( cd_type )
              CASE ( 'T', 'U', 'V', 'W' )
-                ib3(:, 1:jprecj         , :) = iland
-                ib3(:, nlcj-jprecj+1:jpj, :) = iland
+                ib3(:, 1:jprecj         , 1:kdim1) = iland
+                ib3(:, nlcj-jprecj+1:jpj, 1:kdim1) = iland
              CASE ( 'F' )
-                ib3(:, nlcj-jprecj+1:jpj, :) = iland
+                ib3(:, nlcj-jprecj+1:jpj, 1:kdim1) = iland
              END SELECT
           END IF
@@ -766,8 +774,4 @@
                               cd_type=cd_type, lfill=lfillarg)
 
-          !CALL exchr_generic (b2=b2,ib2=ib2,b3=b3,ib3=ib3,nhalo=nhalo, &
-          !                    nhexch=nhexch, handle=itag,              &
-          !                    comm1=Iplus,comm2=Iminus,comm3=NONE,comm4=NONE)
-          !                           comm1=comm1,comm2=comm2,comm3=comm3,comm4=comm4 )
        END IF        ! ndim_rank_north > 0
        !END SELECT    ! npolj 
Index: /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/LBC/exchtestmod.F90
===================================================================
--- /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/LBC/exchtestmod.F90	(revision 4399)
+++ /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/LBC/exchtestmod.F90	(revision 4400)
@@ -11,5 +11,5 @@
                         do_real_tests       = .TRUE. , &
                         do_integer_timings  = .FALSE., &
-                        do_real_timings     = .FALSE., &
+                        do_real_timings     = .TRUE.,  &
                         use_exch_list       = .FALSE.   ! Whether to use the halo
                                                         ! packing API for the tests
Index: /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/TOOLS/RK_PARTITION/README
===================================================================
--- /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/TOOLS/RK_PARTITION/README	(revision 4400)
+++ /branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/TOOLS/RK_PARTITION/README	(revision 4400)
@@ -0,0 +1,9 @@
+This tool can be used to generate a domain decomposition using recursive k-section
+partitioning. The decomposition is written to file and may subsequently be hand-edited
+for fine tuning.
+
+Requirements: Bathymetry of model domain in bathy_levels.nc;
+              NEMO namelist file describing the job you want to run (principally to 
+              get the z-coordinate options).
+
+Run make_partition.exe -h to get a list of the available flags. 
