Index: branches/2015/nemo_v3_6_STABLE/NEMOGCM/TOOLS/SIREN/src/create_restart.f90
===================================================================
--- branches/2015/nemo_v3_6_STABLE/NEMOGCM/TOOLS/SIREN/src/create_restart.f90	(revision 5616)
+++ branches/2015/nemo_v3_6_STABLE/NEMOGCM/TOOLS/SIREN/src/create_restart.f90	(revision 6392)
@@ -9,11 +9,11 @@
 !> @file
 !> @brief 
-!> This program create restart file.
+!> This program creates restart file.
 !>
 !> @details
 !> @section sec1 method
 !> Variables could be extracted from fine grid file, interpolated from coarse
-!> grid file or restart file, or manually written.<br/> 
-!> Then they are split over new decomposition. 
+!> grid file or restart file. Variables could also be manually written.<br/> 
+!> Then they are split over new layout. 
 !> @note 
 !>    method could be different for each variable.
@@ -28,5 +28,5 @@
 !>    you could find a template of the namelist in templates directory.
 !>
-!>    create_restart.nam comprise 9 namelists:<br/>
+!>    create_restart.nam contains 9 namelists:<br/>
 !>       - logger namelist (namlog)
 !>       - config namelist (namcfg)
@@ -39,8 +39,4 @@
 !>       - output namelist (namout)
 !>    
-!>    @note 
-!>       All namelists have to be in file create_restart.nam 
-!>       however variables of those namelists are all optional.
-!>
 !>    * _logger namelist (namlog)_:<br/>
 !>       - cn_logfile   : log filename
@@ -52,4 +48,6 @@
 !>       - cn_varcfg : variable configuration file
 !> (see ./SIREN/cfg/variable.cfg)
+!>       - cn_dumcfg : useless (dummy) configuration file, for useless 
+!> dimension or variable (see ./SIREN/cfg/dummy.cfg).
 !>
 !>    * _coarse grid namelist (namcrs):<br/>
@@ -82,29 +80,5 @@
 !>
 !>    * _variable namelist (namvar)_:<br/>
-!>       - cn_varinfo : list of variable and extra information about request(s) 
-!>       to be used.<br/>
-!>          each elements of *cn_varinfo* is a string character
-!>          (separated by ',').<br/>
-!>          it is composed of the variable name follow by ':', 
-!>          then request(s) to be used on this variable.<br/> 
-!>          request could be:
-!>             - int = interpolation method
-!>             - ext = extrapolation method
-!>             - flt = filter method
-!>             - min = minimum value
-!>             - max = maximum value
-!>             - unt = new units
-!>             - unf = unit scale factor (linked to new units)
-!>
-!>             requests must be separated by ';'.<br/>
-!>             order of requests does not matter.<br/>
-!>
-!>          informations about available method could be find in @ref interp,
-!>          @ref extrap and @ref filter.<br/>
-!>          Example: 'votemper: int=linear; flt=hann; ext=dist_weight','vosaline: int=cubic'
-!>          @note 
-!>             If you do not specify a method which is required, 
-!>             default one is apply.
-!>       - cn_varfile : list of variable, and corresponding file<br/> 
+!>       - cn_varfile : list of variable, and associated file<br/> 
 !>          *cn_varfile* is the path and filename of the file where find
 !>          variable.<br/>
@@ -131,9 +105,35 @@
 !>             - 'all:restart.dimg'
 !>
+!>       - cn_varinfo : list of variable and extra information about request(s) 
+!>       to be used.<br/>
+!>          each elements of *cn_varinfo* is a string character
+!>          (separated by ',').<br/>
+!>          it is composed of the variable name follow by ':', 
+!>          then request(s) to be used on this variable.<br/> 
+!>          request could be:
+!>             - int = interpolation method
+!>             - ext = extrapolation method
+!>             - flt = filter method
+!>             - min = minimum value
+!>             - max = maximum value
+!>             - unt = new units
+!>             - unf = unit scale factor (linked to new units)
+!>
+!>             requests must be separated by ';'.<br/>
+!>             order of requests does not matter.<br/>
+!>
+!>          informations about available method could be find in @ref interp,
+!>          @ref extrap and @ref filter.<br/>
+!>          Example: 'votemper: int=linear; flt=hann; ext=dist_weight',
+!>                   'vosaline: int=cubic'
+!>          @note 
+!>             If you do not specify a method which is required, 
+!>             default one is apply.
+!>
 !>    * _nesting namelist (namnst)_:<br/>
 !>       - in_rhoi  : refinement factor in i-direction
 !>       - in_rhoj  : refinement factor in j-direction
 !>       @note 
-!>          coarse grid indices will be deduced from fine grid
+!>          coarse grid indices will be computed from fine grid
 !>          coordinate file.
 !>
@@ -141,6 +141,6 @@
 !>       - cn_fileout : output file
 !>       - ln_extrap : extrapolate land point or not
-!>       - in_niproc : i-direction number of processor
-!>       - in_njproc : j-direction numebr of processor
+!>       - in_niproc : number of processor in i-direction
+!>       - in_njproc : number of processor in j-direction
 !>       - in_nproc  : total number of processor to be used
 !>       - cn_type   : output format ('dimg', 'cdf')
@@ -156,4 +156,6 @@
 !> - extrapolate all land points, and add ln_extrap in namelist.
 !> - allow to change unit.
+!> @date September, 2015
+!> - manage useless (dummy) variable, attributes, and dimension
 !>
 !> @note Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -173,5 +175,5 @@
    USE iom                             ! I/O manager
    USE grid                            ! grid manager
-   USE vgrid                            ! vertical grid manager
+   USE vgrid                           ! vertical grid manager
    USE extrap                          ! extrapolation manager
    USE interp                          ! interpolation manager
@@ -183,5 +185,4 @@
 
    IMPLICIT NONE
-
 
    ! local variable
@@ -212,4 +213,5 @@
 
    LOGICAL                                            :: ll_exist
+   LOGICAL                                            :: ll_sameGrid
 
    TYPE(TDOM)                                         :: tl_dom1
@@ -242,53 +244,54 @@
    ! namelist variable
    ! namlog
-   CHARACTER(LEN=lc) :: cn_logfile = 'create_restart.log' 
-   CHARACTER(LEN=lc) :: cn_verbosity = 'warning' 
-   INTEGER(i4)       :: in_maxerror = 5
+   CHARACTER(LEN=lc)                       :: cn_logfile = 'create_restart.log' 
+   CHARACTER(LEN=lc)                       :: cn_verbosity = 'warning' 
+   INTEGER(i4)                             :: in_maxerror = 5
 
    ! namcfg
-   CHARACTER(LEN=lc) :: cn_varcfg = 'variable.cfg' 
+   CHARACTER(LEN=lc)                       :: cn_varcfg = 'variable.cfg' 
+   CHARACTER(LEN=lc)                       :: cn_dumcfg = 'dummy.cfg'
 
    ! namcrs
-   CHARACTER(LEN=lc) :: cn_coord0 = '' 
-   INTEGER(i4)       :: in_perio0 = -1
+   CHARACTER(LEN=lc)                       :: cn_coord0 = '' 
+   INTEGER(i4)                             :: in_perio0 = -1
 
    ! namfin
-   CHARACTER(LEN=lc) :: cn_coord1 = ''
-   CHARACTER(LEN=lc) :: cn_bathy1 = ''
-   INTEGER(i4)       :: in_perio1 = -1
+   CHARACTER(LEN=lc)                       :: cn_coord1 = ''
+   CHARACTER(LEN=lc)                       :: cn_bathy1 = ''
+   INTEGER(i4)                             :: in_perio1 = -1
 
    !namzgr
-   REAL(dp)          :: dn_pp_to_be_computed = 0._dp
-   REAL(dp)          :: dn_ppsur     = -3958.951371276829_dp
-   REAL(dp)          :: dn_ppa0      =   103.9530096000000_dp
-   REAL(dp)          :: dn_ppa1      =     2.4159512690000_dp
-   REAL(dp)          :: dn_ppa2      =   100.7609285000000_dp
-   REAL(dp)          :: dn_ppkth     =    15.3510137000000_dp
-   REAL(dp)          :: dn_ppkth2    =    48.0298937200000_dp
-   REAL(dp)          :: dn_ppacr     =     7.0000000000000_dp
-   REAL(dp)          :: dn_ppacr2    =    13.000000000000_dp
-   REAL(dp)          :: dn_ppdzmin   = 6._dp
-   REAL(dp)          :: dn_pphmax    = 5750._dp
-   INTEGER(i4)       :: in_nlevel    = 75
+   REAL(dp)                                :: dn_pp_to_be_computed = 0._dp
+   REAL(dp)                                :: dn_ppsur   = -3958.951371276829_dp
+   REAL(dp)                                :: dn_ppa0    =   103.953009600000_dp
+   REAL(dp)                                :: dn_ppa1    =     2.415951269000_dp
+   REAL(dp)                                :: dn_ppa2    =   100.760928500000_dp
+   REAL(dp)                                :: dn_ppkth   =    15.351013700000_dp
+   REAL(dp)                                :: dn_ppkth2  =    48.029893720000_dp
+   REAL(dp)                                :: dn_ppacr   =     7.000000000000_dp
+   REAL(dp)                                :: dn_ppacr2  =    13.000000000000_dp
+   REAL(dp)                                :: dn_ppdzmin = 6._dp
+   REAL(dp)                                :: dn_pphmax  = 5750._dp
+   INTEGER(i4)                             :: in_nlevel  = 75
 
    !namzps
-   REAL(dp)          :: dn_e3zps_min = 25._dp
-   REAL(dp)          :: dn_e3zps_rat = 0.2_dp
+   REAL(dp)                                :: dn_e3zps_min = 25._dp
+   REAL(dp)                                :: dn_e3zps_rat = 0.2_dp
 
    ! namvar
+   CHARACTER(LEN=lc), DIMENSION(ip_maxvar) :: cn_varfile = ''
    CHARACTER(LEN=lc), DIMENSION(ip_maxvar) :: cn_varinfo = ''
-   CHARACTER(LEN=lc), DIMENSION(ip_maxvar) :: cn_varfile = ''
 
    ! namnst
-   INTEGER(i4)       :: in_rhoi = 0
-   INTEGER(i4)       :: in_rhoj = 0
+   INTEGER(i4)                             :: in_rhoi = 0
+   INTEGER(i4)                             :: in_rhoj = 0
 
    ! namout
-   CHARACTER(LEN=lc) :: cn_fileout = 'restart.nc' 
-   LOGICAL           :: ln_extrap  = .FALSE.
-   INTEGER(i4)       :: in_nproc   = 0
-   INTEGER(i4)       :: in_niproc  = 0
-   INTEGER(i4)       :: in_njproc  = 0
-   CHARACTER(LEN=lc) :: cn_type    = ''
+   CHARACTER(LEN=lc)                       :: cn_fileout = 'restart.nc' 
+   LOGICAL                                 :: ln_extrap  = .FALSE.
+   INTEGER(i4)                             :: in_nproc   = 0
+   INTEGER(i4)                             :: in_niproc  = 0
+   INTEGER(i4)                             :: in_njproc  = 0
+   CHARACTER(LEN=lc)                       :: cn_type    = ''
 
    !-------------------------------------------------------------------
@@ -300,5 +303,6 @@
 
    NAMELIST /namcfg/ &  !< configuration namelist
-   &  cn_varcfg         !< variable configuration file
+   &  cn_varcfg, &      !< variable configuration file
+   &  cn_dumcfg         !< dummy configuration file
 
    NAMELIST /namcrs/ &  !< coarse grid namelist
@@ -330,6 +334,6 @@
 
    NAMELIST /namvar/ &  !< variable namelist
-   &  cn_varinfo, &     !< list of variable and interpolation method to be used.
-   &  cn_varfile        !< list of variable file
+   &  cn_varfile, &     !< list of variable file
+   &  cn_varinfo        !< list of variable and interpolation method to be used.
    
    NAMELIST /namnst/ &  !< nesting namelist
@@ -382,4 +386,11 @@
       ! get variable extra information
       CALL var_def_extra(TRIM(cn_varcfg))
+
+      ! get dummy variable
+      CALL var_get_dummy(TRIM(cn_dumcfg))
+      ! get dummy dimension
+      CALL dim_get_dummy(TRIM(cn_dumcfg))
+      ! get dummy attribute
+      CALL att_get_dummy(TRIM(cn_dumcfg))
 
       READ( il_fileid, NML = namcrs )
@@ -509,5 +520,5 @@
 
                jvar=jvar+1
-               
+
                WRITE(*,'(2x,a,a)') "work on variable "//&
                &  TRIM(tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj)%c_name)
@@ -541,5 +552,4 @@
             CALL iom_mpp_open(tl_mpp)
 
-
             ! get or check depth value
             CALL create_restart_check_depth( tl_mpp, tl_depth )
@@ -551,17 +561,29 @@
             CALL iom_mpp_close(tl_mpp)
 
-            IF( ANY( tl_mpp%t_dim(1:2)%i_len /= &
-            &        tl_coord0%t_dim(1:2)%i_len) )THEN
+            IF( ANY(tl_mpp%t_dim(1:2)%i_len /= tl_coord0%t_dim(1:2)%i_len) .OR.&
+            &   ALL(il_rho(:)==1) )THEN
             !!! extract value from fine grid 
 
-               IF( ANY( tl_mpp%t_dim(1:2)%i_len <= &
+               IF( ANY( tl_mpp%t_dim(1:2)%i_len < &
                &        tl_coord1%t_dim(1:2)%i_len) )THEN
-                  CALL logger_fatal("CREATE RESTART: dimension in file "//&
+                  CALL logger_fatal("CREATE RESTART: dimensions in file "//&
                   &  TRIM(tl_mpp%c_name)//" smaller than those in fine"//&
                   &  " grid coordinates.")
                ENDIF
 
+               ! use coord0 instead of mpp for restart file case 
+               !  (without lon,lat)
+               ll_sameGrid=.FALSE.
+               IF( ALL(tl_mpp%t_dim(1:2)%i_len /= tl_coord0%t_dim(1:2)%i_len) &
+               &   )THEN
+                  ll_sameGrid=.TRUE. 
+               ENDIF
+
                ! compute domain on fine grid
-               il_ind(:,:)=grid_get_coarse_index(tl_mpp, tl_coord1 )
+               IF( ll_sameGrid )THEN
+                  il_ind(:,:)=grid_get_coarse_index(tl_mpp, tl_coord1 )
+               ELSE
+                  il_ind(:,:)=grid_get_coarse_index(tl_coord0, tl_coord1 )
+               ENDIF
 
                il_imin1=il_ind(1,1) ; il_imax1=il_ind(1,2)
@@ -569,8 +591,15 @@
 
                !- check grid coincidence
-               CALL grid_check_coincidence( tl_mpp, tl_coord1, &
-               &                            il_imin1, il_imax1, &
-               &                            il_jmin1, il_jmax1, &
-               &                            il_rho(:) )
+               IF( ll_sameGrid )THEN
+                  CALL grid_check_coincidence( tl_mpp, tl_coord1, &
+                  &                            il_imin1, il_imax1, &
+                  &                            il_jmin1, il_jmax1, &
+                  &                            il_rho(:) )
+               ELSE
+                  CALL grid_check_coincidence( tl_coord0, tl_coord1, &
+                  &                            il_imin1, il_imax1, &
+                  &                            il_jmin1, il_jmax1, &
+                  &                            il_rho(:) )
+               ENDIF
 
                ! compute domain
@@ -754,4 +783,5 @@
 
    DO ji=1,ip_maxdim
+
       IF( tl_dim(ji)%l_use )THEN
          CALL mpp_move_dim(tl_mppout, tl_dim(ji))
@@ -763,4 +793,5 @@
          END SELECT 
       ENDIF
+
    ENDDO
 
@@ -879,5 +910,5 @@
    !> and with dimension of the coordinate file.<br/> 
    !> Then the variable array of value is split into equal subdomain.
-   !> Each subdomain is filled with the corresponding value of the matrix.
+   !> Each subdomain is filled with the associated value of the matrix.
    !>
    !> @author J.Paul
@@ -1169,6 +1200,6 @@
             &        tl_depth%d_value(:,:,:,:) ) )THEN
 
-               CALL logger_fatal("CREATE BOUNDARY: depth value from "//&
-               &  TRIM(tl_multi%t_mpp(ji)%c_name)//" not conform "//&
+               CALL logger_warn("CREATE BOUNDARY: depth value from "//&
+               &  TRIM(td_mpp%c_name)//" not conform "//&
                &  " to those from former file(s).")
 
@@ -1226,6 +1257,6 @@
             IF( tl_date1 - tl_date2 /= 0 )THEN
 
-               CALL logger_fatal("CREATE BOUNDARY: date from "//&
-               &  TRIM(tl_multi%t_mpp(ji)%c_name)//" not conform "//&
+               CALL logger_warn("CREATE BOUNDARY: date from "//&
+               &  TRIM(td_mpp%c_name)//" not conform "//&
                &  " to those from former file(s).")
 
