!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer, 
!                     version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms 
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer 
!version 3 or (at your option) any later version that should be found at: 
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html 
!
!This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
!without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
!See the above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software; 
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec), 
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------
***s/r v4d_settings
*
#include "model_macros_f.h"
*

      integer function v4d_settings (mode),1
*
*implicits
      use v4dz, only: V4dz_degree,V4dzge_degree,V4dzga_degree 
*
      implicit none
      integer mode
*
*author
*     M. Desgagne    - JanSummer  2006
*
*revision
* v3_30 - Desgagne M.       - initial MPI version
* v3_31 - Tanguay M.        - Control BC
*
*object
*  Default configuration and reading namelist
*
#include "lun.cdk"
#include "step.cdk"
#include "path.cdk"
#include "tr3d.cdk"
#include "v4dg.cdk"
#include "v4dj.cdk"
#include "v4dm.cdk"
#include "v4dr.cdk"
#include "v4dg_bc.cdk"
*
*modules
      integer  fnom
      external fnom
*
      integer nrec,unf

#include "v4d_nml.cdk"
*
*-------------------------------------------------------------------
*
      v4d_settings = -1
*
      V4dg_conf     = 0
      V4dg_output_L = .true.
      V4dg_sensib_L = .false.
      V4dg_twin_L   = .false.
      V4dg_4dvar_L  = .false.
      V4dg_sgvc_L   = .false.
      V4dj_mask_L   = .false.     
      V4dg_sgvc_dt0 = 0
      V4dg_chum_s   = 'LQ'
*
      V4dr_redotr_L = .false.
*
      V4dg_stepob   = Step_total
      V4dg_inv      = 1
      V4dg_incore_L = .true.
*
      V4dg_identity_L = .false.
*
      V4dg_pruv_L     = .true.
*
      V4dz_degree     = 1
      V4dzge_degree   = 1
      V4dzga_degree   = 1
*
      V4dg_anincr_L = .false.
*
      V4dm_itmax    = 2 
      V4dm_simax    = 2 
*
      if (mode .gt. 0) then

      unf = 0
      if (fnom (unf, trim(Path_nml_S), 'SEQ' , nrec) .ne. 0) goto 6666

      rewind(unf)
      read (unf, nml=var4d   , end = 6655, err=9140)
*
 6655 call fclos (unf)

      endif

 6666 v4d_settings = 1
      return
*
 9140 if (Lun_out.gt.0) then
         write (Lun_out, 9350)
         write (Lun_out, 8000)
      endif
      return
*
 8000 format (/,'========= ABORT IN S/R v4d_settings.f ============='/)
 9350 format (/,' NAMELIST var4d    INVALID IN FILE: model_settings '/)
*
*-------------------------------------------------------------------
*
      end