Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/GYRE/EXP00/namelist
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/GYRE/EXP00/namelist	(revision 2667)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/GYRE/EXP00/namelist	(revision 2668)
@@ -672,5 +672,4 @@
 !!======================================================================
 !!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
-!!   nammpp_dyndist    Massively Parallel domain decomposition          ("key_agrif" && "key_mpp_dyndist")
 !!   namctl            Control prints & Benchmark
 !!   namsol            elliptic solver / island / free surface 
@@ -696,11 +695,7 @@
                            !  buffer blocking send or immediate non-blocking sends, resp.
    nn_buffer   =   0       !  size in bytes of exported buffer ('B' case), 0 no exportation
-/
-!-----------------------------------------------------------------------
-&nammpp_dyndist !   Massively Parallel Distribution for AGRIF zoom      ("key_agrif" && "key_mpp_dyndist")
-!-----------------------------------------------------------------------
-   jpni        =    1      !  jpni   number of processors following i
-   jpnj        =    1      !  jpnj   number of processors following j
-   jpnij       =    1      !  jpnij  number of local domains
+   jpni        =   0       !  jpni   number of processors following i (set automatically if < 1)     
+   jpnj        =   0       !  jpnj   number of processors following j (set automatically if < 1)     
+   jpnij       =   0       !  jpnij  number of local domains (set automatically if < 1)              
 /
 !-----------------------------------------------------------------------
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist	(revision 2667)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist	(revision 2668)
@@ -669,8 +669,7 @@
 
 !!======================================================================
-!!                  ***  Miscelaneous namelists  ***
+!!                  ***  Miscellaneous namelists  ***
 !!======================================================================
 !!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
-!!   nammpp_dyndist    Massively Parallel domain decomposition          ("key_agrif" && "key_mpp_dyndist")
 !!   namctl            Control prints & Benchmark
 !!   namsol            elliptic solver / island / free surface 
@@ -696,11 +695,7 @@
                            !  buffer blocking send or immediate non-blocking sends, resp.
    nn_buffer   =   0       !  size in bytes of exported buffer ('B' case), 0 no exportation
-/
-!-----------------------------------------------------------------------
-&nammpp_dyndist !   Massively Parallel Distribution for AGRIF zoom      ("key_agrif" && "key_mpp_dyndist")
-!-----------------------------------------------------------------------
-   jpni        =    1      !  jpni   number of processors following i
-   jpnj        =    1      !  jpnj   number of processors following j
-   jpnij       =    1      !  jpnij  number of local domains
+   jpni        =   0       !  jpni   number of processors following i (set automatically if < 1)
+   jpnj        =   0       !  jpnj   number of processors following j (set automatically if < 1)
+   jpnij       =   0       !  jpnij  number of local domains (set automatically if < 1)
 /
 !-----------------------------------------------------------------------
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist	(revision 2667)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist	(revision 2668)
@@ -686,5 +686,4 @@
 !!======================================================================
 !!   nammpp            Massively Parallel Processing                    ("key_mpp_mpi)
-!!   nammpp_dyndist    Massively Parallel domain decomposition          ("key_agrif" && "key_mpp_dyndist")
 !!   namctl            Control prints & Benchmark
 !!   namsol            elliptic solver / island / free surface 
@@ -710,11 +709,7 @@
                            !  buffer blocking send or immediate non-blocking sends, resp.
    nn_buffer   =   0       !  size in bytes of exported buffer ('B' case), 0 no exportation
-/
-!-----------------------------------------------------------------------
-&nammpp_dyndist !   Massively Parallel Distribution for AGRIF zoom      ("key_agrif" && "key_mpp_dyndist")
-!-----------------------------------------------------------------------
-   jpni        =    1      !  jpni   number of processors following i
-   jpnj        =    1      !  jpnj   number of processors following j
-   jpnij       =    1      !  jpnij  number of local domains
+   jpni        =   0       !  jpni   number of processors following i (set automatically if < 1)
+   jpnj        =   0       !  jpnj   number of processors following j (set automatically if < 1)
+   jpnij       =   0       !  jpnij  number of local domains (set automatically if < 1)
 /
 !-----------------------------------------------------------------------
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 2667)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 2668)
@@ -232,5 +232,5 @@
       LOGICAL ::   mpi_was_called
       !
-      NAMELIST/nammpp/ cn_mpi_send, nn_buffer
+      NAMELIST/nammpp/ cn_mpi_send, nn_buffer, jpni, jpnj, jpnij
       !!----------------------------------------------------------------------
       !
@@ -240,4 +240,5 @@
       WRITE(ldtxt(ii),*) '~~~~~~ '                                                                ;   ii = ii + 1
       !
+      jpni = -1; jpnj = -1; jpnij = -1
       REWIND( kumnam )               ! Namelist namrun : parameters of the run
       READ  ( kumnam, nammpp )
@@ -246,4 +247,18 @@
       WRITE(ldtxt(ii),*) '      mpi send type                      cn_mpi_send = ', cn_mpi_send   ;   ii = ii + 1
       WRITE(ldtxt(ii),*) '      size in bytes of exported buffer   nn_buffer   = ', nn_buffer     ;   ii = ii + 1
+
+      IF(jpnij < 1)THEN
+         ! If jpnij is not specified in namelist then we calculate it - this
+         ! means there will be no land cutting out.
+         jpnij = jpni * jpnj
+      END IF
+
+      IF( (jpni < 1) .OR. (jpnj < 1) )THEN
+         WRITE(ldtxt(ii),*) '      jpni, jpnj and jpnij will be calculated automatically'; ii = ii + 1
+      ELSE
+         WRITE(ldtxt(ii),*) '      processor grid extent in i         jpni = ',jpni; ii = ii + 1
+         WRITE(ldtxt(ii),*) '      processor grid extent in j         jpnj = ',jpnj; ii = ii + 1
+         WRITE(ldtxt(ii),*) '      number of local domains           jpnij = ',jpnij; ii = ii +1
+      END IF
 
       CALL mpi_initialized ( mpi_was_called, code )
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 2667)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 2668)
@@ -184,5 +184,5 @@
       INTEGER ::   ji            ! dummy loop indices
       INTEGER ::   ilocal_comm   ! local integer
-      CHARACTER(len=80), DIMENSION(10) ::   cltxt
+      CHARACTER(len=80), DIMENSION(16) ::   cltxt
       !!
       NAMELIST/namctl/ ln_ctl  , nn_print, nn_ictls, nn_ictle,   &
@@ -223,13 +223,16 @@
       lwp = (narea == 1) .OR. ln_ctl                        ! control of all listing output print
 
-      ! Decide on size of grid now that we have our communicator size
-
+      ! If dimensions of processor grid weren't specified in the namelist file 
+      ! then we calculate them here now that we have our communicator size
+      IF( (jpni < 1) .OR. (jpnj < 1) )THEN
 #if   defined key_mpp_mpi   ||   defined key_mpp_shmem
-      CALL nemo_partition(mppsize)
+         CALL nemo_partition(mppsize)
 #else
-      jpni = 1
-      jpnj = 1
-      jpnij = jpni*jpnj
-#endif
+         jpni = 1
+         jpnj = 1
+         jpnij = jpni*jpnj
+#endif
+      END IF
+
       ! Calculate domain dimensions given calculated jpni and jpnj
       ! This used to be done in par_oce.F90 when they were parameters rather
@@ -537,7 +540,6 @@
          jpni = ifact(imin + 1)
       ENDIF
+      !
       jpnij = jpni*jpnj
-
-      WRITE(*,*) 'ARPDBG: jpni = ',jpni,'jpnj = ',jpnj,'jpnij = ',jpnij
       !
    END SUBROUTINE nemo_partition
