Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/readcommand.f90

    r36 r30  
    11!**********************************************************************
    2 ! Copyright 1998-2015                                                 *
     2! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
    33! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
    44! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
     
    2929  !                                                                            *
    3030  !     18 May 1996                                                            *
    31   !
    32   !     HSO, 1 July 2014: Added optional namelist input
    33   !     PS 2/2015: add ldep_incr as optional command input
    34   !                make new parameters (last 3) optional for bwd compatibility
     31  !     HSO, 1 July 2014                                                       *
     32  !     Added optional namelist input                                          *
    3533  !                                                                            *
    3634  !*****************************************************************************
     
    7169  ! mdomainfill          1 use domain-filling option, 0 not, 2 use strat. O3   *
    7270  !                                                                            *
    73   ! ldep_incr            .true.  for incremental,
    74   !                      .false. for accumulated deposition output (DEFAULT)
    7571  ! Constants:                                                                 *
    7672  ! unitcommand          unit connected to file COMMAND                        *
     
    8379  implicit none
    8480
    85   real (kind=dp) :: juldate
    86   character (len=50) :: line
     81  real(kind=dp) :: juldate
     82  character(len=50) :: line
    8783  logical :: old
    88   integer :: ireaderror, icmdstat
     84  integer :: readerror
    8985
    9086  namelist /command/ &
     
    114110  linit_cond, &
    115111  lnetcdfout, &
    116   surf_only, &
    117   ldep_incr
    118 
    119   ! Set default values for namelist command
    120   ldirect = 0
    121   ibdate = 20000101
    122   ibtime = 0
    123   iedate = 20000102
    124   ietime = 0
    125   loutstep = 10800
    126   loutaver = 10800
    127   loutsample = 900
    128   itsplit = 999999999
    129   lsynctime = 900
    130   ctl = -5.0
    131   ifine = 4
    132   iout = 3
    133   ipout = 0
    134   lsubgrid = 1
    135   lconvection = 1
    136   lagespectra = 0
    137   ipin = 1
    138   ioutputforeachrelease = 1
    139   iflux = 1
    140   mdomainfill = 0
    141   ind_source = 1
    142   ind_receptor = 1
    143   mquasilag = 0
    144   nested_output = 0
    145   linit_cond = 0
    146   lnetcdfout = 0
    147   surf_only = 0
    148   ldep_incr = .false.
     112  surf_only   
     113
     114  ! Presetting namelist command
     115  ldirect=0
     116  ibdate=20000101
     117  ibtime=0
     118  iedate=20000102
     119  ietime=0
     120  loutstep=10800
     121  loutaver=10800
     122  loutsample=900
     123  itsplit=999999999
     124  lsynctime=900
     125  ctl=-5.0
     126  ifine=4
     127  iout=3
     128  ipout=0
     129  lsubgrid=1
     130  lconvection=1
     131  lagespectra=0
     132  ipin=1
     133  ioutputforeachrelease=1
     134  iflux=1
     135  mdomainfill=0
     136  ind_source=1
     137  ind_receptor=1
     138  mquasilag=0
     139  nested_output=0
     140  linit_cond=0
     141  lnetcdfout=0
     142  surf_only=0
    149143
    150144  ! Open the command file and read user options
     
    154148
    155149  ! try namelist input (default)
    156   read(unitcommand,command,iostat=ireaderror)
     150  read(unitcommand,command,iostat=readerror)
    157151  close(unitcommand)
    158152
    159153  ! distinguish namelist from fixed text input
    160   if ((ireaderror .ne. 0) .or. (ldirect .eq. 0)) then
    161    
    162     ! parse as text file format
     154  if ((readerror.ne.0).or.(ldirect.eq.0)) then ! parse as text file format
    163155 
    164156    open(unitcommand,file=path(1)(1:length(1))//'COMMAND',status='old', err=999)
     
    233225    read(unitcommand,*) nested_output
    234226    if (old) call skplin(3,unitcommand)
    235     read(unitcommand,*,iostat=icmdstat) linit_cond
    236     if (icmdstat .gt. 0) &
    237       print*, 'readcommand: linit_cond not read properly',icmdstat,linit_cond
    238     if (old) call skplin(3,unitcommand)
    239     read(unitcommand,*,iostat=icmdstat) surf_only
    240     if (icmdstat .gt. 0) &
    241       print*, 'readcommand: linit_cond not read properly',icmdstat,surf_only
    242     if (old) call skplin(3,unitcommand)
    243     read(unitcommand,*,iostat=icmdstat) ldep_incr
    244     if (icmdstat .gt. 0) &
    245       print*, 'readcommand: linit_cond not read properly',icmdstat, ldep_incr
     227    read(unitcommand,*) linit_cond
     228    if (old) call skplin(3,unitcommand)
     229    read(unitcommand,*) surf_only
    246230    close(unitcommand)
    247231
     
    249233
    250234  ! write command file in namelist format to output directory if requested
    251   if (nmlout .eqv. .true.) then
     235  if (nmlout.eqv..true.) then
    252236    open(unitcommand,file=path(2)(1:length(2))//'COMMAND.namelist',err=1000)
    253237    write(unitcommand,nml=command)
     
    260244  !***************************************************************
    261245
    262   if (ctl .ge. 0.1) then
     246  if (ctl.ge.0.1) then
    263247    turbswitch=.true.
    264248  else
     
    324308  !************************************************************************
    325309
    326   if (ldirect .eq. 1) linit_cond=0
    327   if ((linit_cond .lt. 0) .or. (linit_cond .gt. 2)) then
     310  if (ldirect.eq.1) linit_cond=0
     311  if ((linit_cond.lt.0).or.(linit_cond.gt.2)) then
    328312    write(*,*) ' #### FLEXPART MODEL ERROR! INVALID OPTION    #### '
    329313    write(*,*) ' #### FOR LINIT_COND IN FILE "COMMAND".       #### '
     
    334318  !******************
    335319
    336   if (iedate .lt. ibdate) then
     320  if (iedate.lt.ibdate) then
    337321    write(*,*) ' #### FLEXPART MODEL ERROR! BEGINNING DATE    #### '
    338322    write(*,*) ' #### IS LARGER THAN ENDING DATE. CHANGE      #### '
     
    340324    write(*,*) ' #### "COMMAND".                              #### '
    341325    stop
    342   else if (iedate .eq. ibdate) then
    343     if (ietime .lt. ibtime) then
     326  else if (iedate.eq.ibdate) then
     327    if (ietime.lt.ibtime) then
    344328    write(*,*) ' #### FLEXPART MODEL ERROR! BEGINNING TIME    #### '
    345329    write(*,*) ' #### IS LARGER THAN ENDING TIME. CHANGE      #### '
     
    354338  !************************************
    355339
    356   if (ctl .gt. 0.) then
     340  if (ctl.gt.0.) then
    357341    method=1
    358342    mintime=minstep
     
    363347
    364348!  check for netcdf output switch (use for non-namelist input only!)
    365   if (iout .ge. 8) then
     349  if (iout.ge.8) then
    366350     lnetcdfout = 1
    367351     iout = iout - 8
     
    376360  !**********************************************************************
    377361
    378   if ((iout .lt. 1) .or.  (iout .gt. 5)) then
     362  if ((iout.lt.1).or.(iout.gt.5)) then
    379363    write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
    380364    write(*,*) ' #### IOUT MUST BE 1, 2, 3, 4, OR 5 FOR       #### '
     
    385369
    386370  !AF check consistency between units and volume mixing ratio
    387   if ( ((iout .eq. 2) .or.  (iout .eq. 3)) .and. &
    388        (ind_source .gt. 1 .or. ind_receptor .gt. 1) ) then
     371  if ( ((iout.eq.2).or.(iout.eq.3)).and. &
     372       (ind_source.gt.1 .or.ind_receptor.gt.1) ) then
    389373    write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
    390374    write(*,*) ' #### VOLUME MIXING RATIO ONLY SUPPORTED      #### '
     
    397381  !*****************************************************************************
    398382
    399   if ((ioutputforeachrelease .eq. 1) .and. (mquasilag .eq. 1)) then
     383  if ((ioutputforeachrelease.eq.1).and.(mquasilag.eq.1)) then
    400384      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    401385      write(*,*) '#### OUTPUTFOREACHRELEASE AND QUASILAGRANGIAN####'
     
    408392  !*****************************************************************************
    409393
    410   if ((ldirect .lt. 0) .and. (mquasilag .eq. 1)) then
     394  if ((ldirect.lt.0).and.(mquasilag.eq.1)) then
    411395      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    412396      write(*,*) '#### FOR BACKWARD RUNS, QUASILAGRANGIAN MODE ####'
     
    420404  !*****************************************************************************
    421405
    422   if ((ldirect .lt. 0) .and. (ioutputforeachrelease .eq. 0)) then
     406  if ((ldirect.lt.0).and.(ioutputforeachrelease.eq.0)) then
    423407      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    424408      write(*,*) '#### FOR BACKWARD RUNS, IOUTPUTFOREACHRLEASE ####'
     
    432416  !*****************************************************************************
    433417
    434   if ((mdomainfill .eq. 1) .and. (ioutputforeachrelease .eq. 1)) then
     418  if ((mdomainfill.eq.1).and.(ioutputforeachrelease.eq.1)) then
    435419      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    436420      write(*,*) '#### FOR DOMAIN FILLING RUNS OUTPUT FOR      ####'
     
    445429  !*****************************************************************************
    446430
    447   if (ldirect .lt. 0) then
    448     if ((iout .eq. 2) .or. (iout .eq. 3)) then
     431  if (ldirect.lt.0) then
     432    if ((iout.eq.2).or.(iout.eq.3)) then
    449433      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    450434      write(*,*) '#### FOR BACKWARD RUNS, IOUT MUST BE 1,4,OR 5####'
     
    458442  !*****************************************************************************
    459443
    460   if (mdomainfill .ge. 1) then
    461     if ((iout .eq. 4) .or. (iout .eq. 5)) then
     444  if (mdomainfill.ge.1) then
     445    if ((iout.eq.4).or.(iout.eq.5)) then
    462446      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    463447      write(*,*) '#### FOR DOMAIN-FILLING TRAJECTORY OPTION,   ####'
     
    472456  !****************************************************************
    473457
    474   if ((ipout .ne. 0) .and. (ipout .ne. 1) .and. (ipout .ne. 2)) then
     458  if ((ipout.ne.0).and.(ipout.ne.1).and.(ipout.ne.2)) then
    475459    write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
    476460    write(*,*) ' #### IPOUT MUST BE 1, 2 OR 3!                #### '
     
    478462  endif
    479463
    480   if(lsubgrid .ne. 1 .and. verbosity .eq. 0) then
     464  if(lsubgrid.ne.1.and.verbosity.eq.0) then
    481465    write(*,*) '             ----------------               '
    482466    write(*,*) ' INFORMATION: SUBGRIDSCALE TERRAIN EFFECT IS'
     
    489473  !***********************************************************
    490474
    491   if ((lconvection .ne. 0) .and. (lconvection .ne. 1)) then
     475  if ((lconvection.ne.0).and.(lconvection.ne.1)) then
    492476    write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
    493477    write(*,*) ' #### LCONVECTION MUST BE SET TO EITHER 1 OR 0#### '
     
    499483  !*************************************************************
    500484
    501   if (lsynctime .gt. (idiffnorm/2)) then
     485  if (lsynctime.gt.(idiffnorm/2)) then
    502486    write(*,*) ' #### FLEXPART MODEL ERROR! SYNCHRONISATION   #### '
    503487    write(*,*) ' #### TIME IS TOO LONG. MAKE IT SHORTER.      #### '
     
    510494  !*****************************************************************************
    511495
    512   if (loutaver .eq. 0) then
     496  if (loutaver.eq.0) then
    513497    write(*,*) ' #### FLEXPART MODEL ERROR! TIME AVERAGE OF   #### '
    514498    write(*,*) ' #### CONCENTRATION FIELD OUTPUT MUST NOT BE  #### '
     
    518502  endif
    519503
    520   if (loutaver .gt. loutstep) then
     504  if (loutaver.gt.loutstep) then
    521505    write(*,*) ' #### FLEXPART MODEL ERROR! TIME AVERAGE OF   #### '
    522506    write(*,*) ' #### CONCENTRATION FIELD OUTPUT MUST NOT BE  #### '
     
    526510  endif
    527511
    528   if (loutsample .gt. loutaver) then
     512  if (loutsample.gt.loutaver) then
    529513    write(*,*) ' #### FLEXPART MODEL ERROR! SAMPLING TIME OF  #### '
    530514    write(*,*) ' #### CONCENTRATION FIELD OUTPUT MUST NOT BE  #### '
     
    534518  endif
    535519
    536   if (mod(loutaver,lsynctime) .ne. 0) then
     520  if (mod(loutaver,lsynctime).ne.0) then
    537521    write(*,*) ' #### FLEXPART MODEL ERROR! AVERAGING TIME OF #### '
    538522    write(*,*) ' #### CONCENTRATION FIELD MUST BE A MULTIPLE  #### '
     
    541525  endif
    542526
    543   if ((loutaver/lsynctime) .lt. 2) then
     527  if ((loutaver/lsynctime).lt.2) then
    544528    write(*,*) ' #### FLEXPART MODEL ERROR! AVERAGING TIME OF #### '
    545529    write(*,*) ' #### CONCENTRATION FIELD MUST BE AT LEAST    #### '
     
    548532  endif
    549533
    550   if (mod(loutstep,lsynctime) .ne. 0) then
     534  if (mod(loutstep,lsynctime).ne.0) then
    551535    write(*,*) ' #### FLEXPART MODEL ERROR! INTERVAL BETWEEN  #### '
    552536    write(*,*) ' #### CONCENTRATION FIELDS MUST BE A MULTIPLE #### '
     
    555539  endif
    556540
    557   if ((loutstep/lsynctime) .lt. 2) then
     541  if ((loutstep/lsynctime).lt.2) then
    558542    write(*,*) ' #### FLEXPART MODEL ERROR! INTERVAL BETWEEN  #### '
    559543    write(*,*) ' #### CONCENTRATION FIELDS MUST BE AT LEAST   #### '
     
    562546  endif
    563547
    564   if (mod(loutsample,lsynctime) .ne. 0) then
     548  if (mod(loutsample,lsynctime).ne.0) then
    565549    write(*,*) ' #### FLEXPART MODEL ERROR! SAMPLING TIME OF  #### '
    566550    write(*,*) ' #### CONCENTRATION FIELD MUST BE A MULTIPLE  #### '
     
    569553  endif
    570554
    571   if (itsplit .lt. loutaver) then
     555  if (itsplit.lt.loutaver) then
    572556    write(*,*) ' #### FLEXPART MODEL ERROR! SPLITTING TIME FOR#### '
    573557    write(*,*) ' #### PARTICLES IS TOO SHORT. PLEASE INCREASE #### '
     
    576560  endif
    577561
    578   if ((mquasilag .eq. 1) .and. (iout .ge. 4)) then
     562  if ((mquasilag.eq.1).and.(iout.ge.4)) then
    579563    write(*,*) ' #### FLEXPART MODEL ERROR! CONFLICTING       #### '
    580564    write(*,*) ' #### OPTIONS: IF MQUASILAG=1, PLUME          #### '
     
    587571
    588572  outstep=real(abs(loutstep))
    589   if (ldirect .eq. 1) then
     573  if (ldirect.eq.1) then
    590574    bdate=juldate(ibdate,ibtime)
    591575    edate=juldate(iedate,ietime)
    592576    ideltas=nint((edate-bdate)*86400.)
    593   else if (ldirect .eq. -1) then
     577  else if (ldirect.eq.-1) then
    594578    loutaver=-1*loutaver
    595579    loutstep=-1*loutstep
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG