Index: branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 6982)
+++ branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 7024)
@@ -14,8 +14,10 @@
    !!            3.6  !  2013     ( J. Simeon, C. Calone, G. Madec, C. Ethe ) Online coarsening of outputs
    !!            3.7  !  2015-11  (G. Madec, A. Coward)  time varying zgr by default
+   !!            4.0  !  2016-10  (G. Madec, S. Flavoni)  domain configuration / user defined interface
    !!----------------------------------------------------------------------
    
    !!----------------------------------------------------------------------
    !!   dom_init      : initialize the space and time domain
+   !!   dom_glo       : initialize global domain <--> local domain indices
    !!   dom_nam       : read and contral domain namelists
    !!   dom_ctl       : control print for the ocean domain
@@ -32,6 +34,7 @@
    USE domwri         ! domain: write the meshmask file
    USE domvvl         ! variable volume
-   USE c1d            ! 1D vertical configuration
-   USE dyncor_c1d     ! Coriolis term (c1d case)         (cor_c1d routine)
+   USE c1d            ! 1D configuration
+   USE domc1d         ! 1D configuration: column location
+   USE dyncor_c1d     ! 1D configuration: Coriolis term    (cor_c1d routine)
    !
    USE in_out_manager ! I/O manager
@@ -84,5 +87,5 @@
          !
          WRITE(numout,*)     '   Domain info'
-         WRITE(numout,*)     '      dimension of model'
+         WRITE(numout,*)     '      dimension of model:'
          WRITE(numout,*)     '             Local domain      Global domain       Data domain '
          WRITE(numout,cform) '        ','   jpi     : ', jpi, '   jpiglo  : ', jpiglo
@@ -90,13 +93,33 @@
          WRITE(numout,cform) '        ','   jpk     : ', jpk, '   jpkglo  : ', jpkglo
          WRITE(numout,cform) '       ' ,'   jpij    : ', jpij
-         WRITE(numout,*)     '      mpp local domain info (mpp)'
+         WRITE(numout,*)     '      mpp local domain info (mpp):'
          WRITE(numout,*)     '              jpni    : ', jpni, '   jpreci  : ', jpreci
          WRITE(numout,*)     '              jpnj    : ', jpnj, '   jprecj  : ', jprecj
          WRITE(numout,*)     '              jpnij   : ', jpnij
          WRITE(numout,*)     '      lateral boundary of the Global domain : jperio  = ', jperio
-      ENDIF
+         SELECT CASE ( jperio )
+         CASE( 0 )   ;   WRITE(numout,*) '         (i.e. closed)'
+         CASE( 1 )   ;   WRITE(numout,*) '         (i.e. cyclic east-west)'
+         CASE( 2 )   ;   WRITE(numout,*) '         (i.e. equatorial symmetric)'
+         CASE( 3 )   ;   WRITE(numout,*) '         (i.e. north fold with T-point pivot)'
+         CASE( 4 )   ;   WRITE(numout,*) '         (i.e. cyclic east-west and north fold with T-point pivot)'
+         CASE( 5 )   ;   WRITE(numout,*) '         (i.e. north fold with F-point pivot)'
+         CASE( 6 )   ;   WRITE(numout,*) '         (i.e. cyclic east-west and north fold with F-point pivot)'
+         CASE DEFAULT
+            CALL ctl_stop( 'jperio is out of range' )
+         END SELECT
+         WRITE(numout,*)     '      Ocean model configuration used:'
+         WRITE(numout,*)     '              cp_cfg = ', cp_cfg
+         WRITE(numout,*)     '              jp_cfg = ', jp_cfg
+      ENDIF
+      !
+      !      
+!!gm  This should be removed with the new configuration interface
+      IF( lk_c1d .AND. ln_c1d_locpt )  CALL dom_c1d( rn_lat1d, rn_lon1d )
+!!gm end
       !
       !           !==  Reference coordinate system  ==!
-      !      
+      !
+      CALL dom_glo                     ! global domain versus local domain
       CALL dom_nam                     ! read namelist ( namrun, namdom )
       CALL dom_clo( cp_cfg, jp_cfg )   ! Closed seas and lake
@@ -174,4 +197,70 @@
       !
    END SUBROUTINE dom_init
+
+
+   SUBROUTINE dom_glo
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE dom_glo  ***
+      !!
+      !! ** Purpose :   initialization of global domain <--> local domain indices
+      !!
+      !! ** Method  :   
+      !!
+      !! ** Action  : - mig , mjg : local  domain indices ==> global domain indices
+      !!              - mi0 , mi1 : global domain indices ==> local  domain indices
+      !!              - mj0,, mj1   (global point not in the local domain ==> mi0>mi1 and/or mj0>mj1)
+      !!----------------------------------------------------------------------
+      INTEGER ::   ji, jj   ! dummy loop argument
+      !!----------------------------------------------------------------------
+      !
+      DO ji = 1, jpi                 ! local domain indices ==> global domain indices
+        mig(ji) = ji + nimpp - 1
+      END DO
+      DO jj = 1, jpj
+        mjg(jj) = jj + njmpp - 1
+      END DO
+      !                              ! global domain indices ==> local domain indices
+      !                                   ! (return (m.0,m.1)=(1,0) if data domain gridpoint is to the west/south of the 
+      !                                   ! local domain, or (m.0,m.1)=(jp.+1,jp.) to the east/north of local domain. 
+      DO ji = 1, jpiglo
+        mi0(ji) = MAX( 1 , MIN( ji - nimpp + 1, jpi+1 ) )
+        mi1(ji) = MAX( 0 , MIN( ji - nimpp + 1, jpi   ) )
+      END DO
+      DO jj = 1, jpjglo
+        mj0(jj) = MAX( 1 , MIN( jj - njmpp + 1, jpj+1 ) )
+        mj1(jj) = MAX( 0 , MIN( jj - njmpp + 1, jpj   ) )
+      END DO
+      IF(lwp) THEN                   ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) 'dom_glo : domain: global <<==>> local '
+         WRITE(numout,*) '~~~~~~~ '
+         WRITE(numout,*) '   global domain:   jpiglo = ', jpiglo, ' jpjglo = ', jpjglo, ' jpkglo = ', jpkglo
+         WRITE(numout,*) '   local  domain:   jpi    = ', jpi   , ' jpj    = ', jpj   , ' jpk    = ', jpk
+         WRITE(numout,*)
+         WRITE(numout,*) '   conversion from local to global domain indices (and vise versa) done'
+         IF( nn_print >= 1 ) THEN
+            WRITE(numout,*)
+            WRITE(numout,*) '          conversion local  ==> global i-index domain'
+            WRITE(numout,25)              (mig(ji),ji = 1,jpi)
+            WRITE(numout,*)
+            WRITE(numout,*) '          conversion global ==> local  i-index domain'
+            WRITE(numout,*) '             starting index'
+            WRITE(numout,25)              (mi0(ji),ji = 1,jpiglo)
+            WRITE(numout,*) '             ending index'
+            WRITE(numout,25)              (mi1(ji),ji = 1,jpiglo)
+            WRITE(numout,*)
+            WRITE(numout,*) '          conversion local  ==> global j-index domain'
+            WRITE(numout,25)              (mjg(jj),jj = 1,jpj)
+            WRITE(numout,*)
+            WRITE(numout,*) '          conversion global ==> local  j-index domain'
+            WRITE(numout,*) '             starting index'
+            WRITE(numout,25)              (mj0(jj),jj = 1,jpjglo)
+            WRITE(numout,*) '             ending index'
+            WRITE(numout,25)              (mj1(jj),jj = 1,jpjglo)
+         ENDIF
+      ENDIF
+ 25   FORMAT( 100(10x,19i4,/) )
+      !
+   END SUBROUTINE dom_glo
 
 
Index: branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DOM/domcfg.F90
===================================================================
--- branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DOM/domcfg.F90	(revision 6982)
+++ 	(revision )
@@ -1,144 +1,0 @@
-MODULE domcfg
-   !!==============================================================================
-   !!                       ***  MODULE domcfg   ***
-   !! Ocean initialization : domain configuration initialization
-   !!==============================================================================
-   !! History :  1.0  ! 2003-09  (G. Madec)  Original code
-   !!            3.2  ! 2009-07  (R. Benshila) Suppression of rigid-lid option
-   !!----------------------------------------------------------------------
-
-   !!----------------------------------------------------------------------
-   !!   dom_cfg       : initialize the domain configuration
-   !!----------------------------------------------------------------------
-   USE dom_oce        ! ocean space and time domain
-   USE phycst         ! physical constants
-   !
-   USE in_out_manager ! I/O manager
-   USE lib_mpp        ! distributed memory computing library
-   USE timing         ! Timing
-   USE c1d            ! 1D configuration
-   USE domc1d         ! 1D configuration: column location
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   dom_cfg    ! called by opa.F90
-
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.2 , LODYC-IPSL  (2009)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE dom_cfg
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE dom_cfg  ***
-      !!                    
-      !! ** Purpose :   set the domain configuration
-      !!
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('dom_cfg')
-      !
-      IF(lwp) THEN                   ! Control print
-         WRITE(numout,*)
-         WRITE(numout,*) 'dom_cfg : set the ocean configuration'
-         WRITE(numout,*) '~~~~~~~ '
-         WRITE(numout,*) '   ocean model configuration used :   cp_cfg = ', cp_cfg, ' jp_cfg = ', jp_cfg
-         !
-         WRITE(numout,*) '   global domain lateral boundaries'
-         !
-         IF( jperio == 0 )   WRITE(numout,*) '      jperio= 0, closed'
-         IF( jperio == 1 )   WRITE(numout,*) '      jperio= 1, cyclic east-west'
-         IF( jperio == 2 )   WRITE(numout,*) '      jperio= 2, equatorial symmetric'
-         IF( jperio == 3 )   WRITE(numout,*) '      jperio= 3, north fold with T-point pivot'
-         IF( jperio == 4 )   WRITE(numout,*) '      jperio= 4, cyclic east-west and north fold with T-point pivot'
-         IF( jperio == 5 )   WRITE(numout,*) '      jperio= 5, north fold with F-point pivot'
-         IF( jperio == 6 )   WRITE(numout,*) '      jperio= 6, cyclic east-west and north fold with F-point pivot'
-      ENDIF
-      !
-      IF( jperio <  0 .OR. jperio > 6 )   CALL ctl_stop( 'jperio is out of range' )
-      !
-      CALL dom_glo                   ! global domain versus zoom and/or local domain
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('dom_cfg')
-      !
-   END SUBROUTINE dom_cfg
-
-
-   SUBROUTINE dom_glo
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE dom_glo  ***
-      !!
-      !! ** Purpose :   initialization for global and local domain
-      !!
-      !! ** Method  :   
-      !!
-      !! ** Action  : - mig , mjg : local  domain indices ==> global domain indices
-      !!              - mi0 , mi1 : global domain indices ==> local  domain indices
-      !!              - mj0,, mj1   (global point not in the local domain ==> mi0>mi1 and/or mj0>mj1)
-      !!----------------------------------------------------------------------
-      INTEGER ::   ji, jj   ! dummy loop argument
-      !!----------------------------------------------------------------------
-!!gm  This should be removed with the new configuration interface
-      !                              ! recalculate jp_izoom/jp_jzoom given lat/lon
-      IF( lk_c1d .AND. ln_c1d_locpt )  CALL dom_c1d( rn_lat1d, rn_lon1d )
-!!gm end
-      !
-      !                        ! ============== !
-      !                        !  Local domain  ! 
-      !                        ! ============== !
-      DO ji = 1, jpi                 ! local domain indices ==> global domain indices
-        mig(ji) = ji + nimpp - 1
-      END DO
-      DO jj = 1, jpj
-        mjg(jj) = jj + njmpp - 1
-      END DO
-      !
-      !                              ! global domain indices ==> local domain indices
-      !                                   ! (return (m.0,m.1)=(1,0) if data domain gridpoint is to the west/south of the 
-      !                                   !local domain, or (m.0,m.1)=(jp.+1,jp.) to the east/north of local domain. 
-      DO ji = 1, jpiglo
-        mi0(ji) = MAX( 1 , MIN( ji - nimpp + 1, jpi+1 ) )
-        mi1(ji) = MAX( 0 , MIN( ji - nimpp + 1, jpi   ) )
-      END DO
-      DO jj = 1, jpjglo
-        mj0(jj) = MAX( 1 , MIN( jj - njmpp + 1, jpj+1 ) )
-        mj1(jj) = MAX( 0 , MIN( jj - njmpp + 1, jpj   ) )
-      END DO
-      IF(lwp) THEN                   ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) 'dom_glo : domain: global <<==>> local '
-         WRITE(numout,*) '~~~~~~~ '
-         WRITE(numout,*) '          global domain:   jpiglo = ', jpiglo, ' jpjglo = ', jpjglo, ' jpkglo = ', jpkglo
-         WRITE(numout,*) '          local  domain:   jpi    = ', jpi   , ' jpj    = ', jpj   , ' jpk    = ', jpk
-         WRITE(numout,*)
-         IF( nn_print >= 1 ) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) '          conversion local  ==> data i-index domain'
-            WRITE(numout,25)              (mig(ji),ji = 1,jpi)
-            WRITE(numout,*)
-            WRITE(numout,*) '          conversion data   ==> local  i-index domain'
-            WRITE(numout,*) '             starting index'
-            WRITE(numout,25)              (mi0(ji),ji = 1,jpiglo)
-            WRITE(numout,*) '             ending index'
-            WRITE(numout,25)              (mi1(ji),ji = 1,jpiglo)
-            WRITE(numout,*)
-            WRITE(numout,*) '          conversion local  ==> data j-index domain'
-            WRITE(numout,25)              (mjg(jj),jj = 1,jpj)
-            WRITE(numout,*)
-            WRITE(numout,*) '          conversion data  ==> local j-index domain'
-            WRITE(numout,*) '             starting index'
-            WRITE(numout,25)              (mj0(jj),jj = 1,jpjglo)
-            WRITE(numout,*) '             ending index'
-            WRITE(numout,25)              (mj1(jj),jj = 1,jpjglo)
-         ENDIF
-      ENDIF
- 25   FORMAT( 100(10x,19i4,/) )
-
-      !
-   END SUBROUTINE dom_glo
-
-   !!======================================================================
-END MODULE domcfg
Index: branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 6982)
+++ branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 7024)
@@ -33,4 +33,5 @@
    !!             -   ! 2013-06  (I. Epicoco, S. Mocavero, CMCC) nemo_northcomms: setup avoiding MPI communication 
    !!             -   ! 2014-12  (G. Madec) remove KPP scheme and cross-land advection (cla)
+   !!            4.0  ! 2016-10  (G. Madec, S. Flavoni)  domain configuration / user defined interface
    !!----------------------------------------------------------------------
 
@@ -45,5 +46,4 @@
    !!----------------------------------------------------------------------
    USE step_oce       ! module used in the ocean time stepping module (step.F90)
-   USE domcfg         ! domain configuration               (dom_cfg routine)
    USE mppini         ! shared/distributed memory setting (mpp_init routine)
    USE domain         ! domain initialization             (dom_init routine)
@@ -131,5 +131,5 @@
       CALL Agrif_Init_Grids()      ! AGRIF: set the meshes
 #endif
-
+      !
       !                            !-----------------------!
       CALL nemo_init               !==  Initialisations  ==!
@@ -453,5 +453,4 @@
       IF( lk_c1d        )   CALL     c1d_init   ! 1D column configuration
                             CALL     wad_init   ! Wetting and drying options
-                            CALL     dom_cfg    ! Domain configuration
                             CALL     dom_init   ! Domain
       IF( ln_crs        )   CALL     crs_init   ! coarsened grid: domain initialization 
