Ignore:
Timestamp:
Feb 16, 2015, 6:21:09 PM (9 years ago)
Author:
pesei
Message:

Implement switch for incremental deposition, see ticket:113 and many small changes, see changelog.txt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/petra/src/readcommand.f90

    r30 r36  
    11!**********************************************************************
    2 ! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
     2! Copyright 1998-2015                                                 *
    33! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
    44! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
     
    2929  !                                                                            *
    3030  !     18 May 1996                                                            *
    31   !     HSO, 1 July 2014                                                       *
    32   !     Added optional namelist input                                          *
     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
    3335  !                                                                            *
    3436  !*****************************************************************************
     
    6971  ! mdomainfill          1 use domain-filling option, 0 not, 2 use strat. O3   *
    7072  !                                                                            *
     73  ! ldep_incr            .true.  for incremental,
     74  !                      .false. for accumulated deposition output (DEFAULT)
    7175  ! Constants:                                                                 *
    7276  ! unitcommand          unit connected to file COMMAND                        *
     
    7983  implicit none
    8084
    81   real(kind=dp) :: juldate
    82   character(len=50) :: line
     85  real (kind=dp) :: juldate
     86  character (len=50) :: line
    8387  logical :: old
    84   integer :: readerror
     88  integer :: ireaderror, icmdstat
    8589
    8690  namelist /command/ &
     
    110114  linit_cond, &
    111115  lnetcdfout, &
    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
     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.
    143149
    144150  ! Open the command file and read user options
     
    148154
    149155  ! try namelist input (default)
    150   read(unitcommand,command,iostat=readerror)
     156  read(unitcommand,command,iostat=ireaderror)
    151157  close(unitcommand)
    152158
    153159  ! distinguish namelist from fixed text input
    154   if ((readerror.ne.0).or.(ldirect.eq.0)) then ! parse as text file format
     160  if ((ireaderror .ne. 0) .or. (ldirect .eq. 0)) then
     161   
     162    ! parse as text file format
    155163 
    156164    open(unitcommand,file=path(1)(1:length(1))//'COMMAND',status='old', err=999)
     
    225233    read(unitcommand,*) nested_output
    226234    if (old) call skplin(3,unitcommand)
    227     read(unitcommand,*) linit_cond
    228     if (old) call skplin(3,unitcommand)
    229     read(unitcommand,*) surf_only
     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
    230246    close(unitcommand)
    231247
     
    233249
    234250  ! write command file in namelist format to output directory if requested
    235   if (nmlout.eqv..true.) then
     251  if (nmlout .eqv. .true.) then
    236252    open(unitcommand,file=path(2)(1:length(2))//'COMMAND.namelist',err=1000)
    237253    write(unitcommand,nml=command)
     
    244260  !***************************************************************
    245261
    246   if (ctl.ge.0.1) then
     262  if (ctl .ge. 0.1) then
    247263    turbswitch=.true.
    248264  else
     
    308324  !************************************************************************
    309325
    310   if (ldirect.eq.1) linit_cond=0
    311   if ((linit_cond.lt.0).or.(linit_cond.gt.2)) then
     326  if (ldirect .eq. 1) linit_cond=0
     327  if ((linit_cond .lt. 0) .or. (linit_cond .gt. 2)) then
    312328    write(*,*) ' #### FLEXPART MODEL ERROR! INVALID OPTION    #### '
    313329    write(*,*) ' #### FOR LINIT_COND IN FILE "COMMAND".       #### '
     
    318334  !******************
    319335
    320   if (iedate.lt.ibdate) then
     336  if (iedate .lt. ibdate) then
    321337    write(*,*) ' #### FLEXPART MODEL ERROR! BEGINNING DATE    #### '
    322338    write(*,*) ' #### IS LARGER THAN ENDING DATE. CHANGE      #### '
     
    324340    write(*,*) ' #### "COMMAND".                              #### '
    325341    stop
    326   else if (iedate.eq.ibdate) then
    327     if (ietime.lt.ibtime) then
     342  else if (iedate .eq. ibdate) then
     343    if (ietime .lt. ibtime) then
    328344    write(*,*) ' #### FLEXPART MODEL ERROR! BEGINNING TIME    #### '
    329345    write(*,*) ' #### IS LARGER THAN ENDING TIME. CHANGE      #### '
     
    338354  !************************************
    339355
    340   if (ctl.gt.0.) then
     356  if (ctl .gt. 0.) then
    341357    method=1
    342358    mintime=minstep
     
    347363
    348364!  check for netcdf output switch (use for non-namelist input only!)
    349   if (iout.ge.8) then
     365  if (iout .ge. 8) then
    350366     lnetcdfout = 1
    351367     iout = iout - 8
     
    360376  !**********************************************************************
    361377
    362   if ((iout.lt.1).or.(iout.gt.5)) then
     378  if ((iout .lt. 1) .or.  (iout .gt. 5)) then
    363379    write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
    364380    write(*,*) ' #### IOUT MUST BE 1, 2, 3, 4, OR 5 FOR       #### '
     
    369385
    370386  !AF check consistency between units and volume mixing ratio
    371   if ( ((iout.eq.2).or.(iout.eq.3)).and. &
    372        (ind_source.gt.1 .or.ind_receptor.gt.1) ) then
     387  if ( ((iout .eq. 2) .or.  (iout .eq. 3)) .and. &
     388       (ind_source .gt. 1 .or. ind_receptor .gt. 1) ) then
    373389    write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
    374390    write(*,*) ' #### VOLUME MIXING RATIO ONLY SUPPORTED      #### '
     
    381397  !*****************************************************************************
    382398
    383   if ((ioutputforeachrelease.eq.1).and.(mquasilag.eq.1)) then
     399  if ((ioutputforeachrelease .eq. 1) .and. (mquasilag .eq. 1)) then
    384400      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    385401      write(*,*) '#### OUTPUTFOREACHRELEASE AND QUASILAGRANGIAN####'
     
    392408  !*****************************************************************************
    393409
    394   if ((ldirect.lt.0).and.(mquasilag.eq.1)) then
     410  if ((ldirect .lt. 0) .and. (mquasilag .eq. 1)) then
    395411      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    396412      write(*,*) '#### FOR BACKWARD RUNS, QUASILAGRANGIAN MODE ####'
     
    404420  !*****************************************************************************
    405421
    406   if ((ldirect.lt.0).and.(ioutputforeachrelease.eq.0)) then
     422  if ((ldirect .lt. 0) .and. (ioutputforeachrelease .eq. 0)) then
    407423      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    408424      write(*,*) '#### FOR BACKWARD RUNS, IOUTPUTFOREACHRLEASE ####'
     
    416432  !*****************************************************************************
    417433
    418   if ((mdomainfill.eq.1).and.(ioutputforeachrelease.eq.1)) then
     434  if ((mdomainfill .eq. 1) .and. (ioutputforeachrelease .eq. 1)) then
    419435      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    420436      write(*,*) '#### FOR DOMAIN FILLING RUNS OUTPUT FOR      ####'
     
    429445  !*****************************************************************************
    430446
    431   if (ldirect.lt.0) then
    432     if ((iout.eq.2).or.(iout.eq.3)) then
     447  if (ldirect .lt. 0) then
     448    if ((iout .eq. 2) .or. (iout .eq. 3)) then
    433449      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    434450      write(*,*) '#### FOR BACKWARD RUNS, IOUT MUST BE 1,4,OR 5####'
     
    442458  !*****************************************************************************
    443459
    444   if (mdomainfill.ge.1) then
    445     if ((iout.eq.4).or.(iout.eq.5)) then
     460  if (mdomainfill .ge. 1) then
     461    if ((iout .eq. 4) .or. (iout .eq. 5)) then
    446462      write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
    447463      write(*,*) '#### FOR DOMAIN-FILLING TRAJECTORY OPTION,   ####'
     
    456472  !****************************************************************
    457473
    458   if ((ipout.ne.0).and.(ipout.ne.1).and.(ipout.ne.2)) then
     474  if ((ipout .ne. 0) .and. (ipout .ne. 1) .and. (ipout .ne. 2)) then
    459475    write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
    460476    write(*,*) ' #### IPOUT MUST BE 1, 2 OR 3!                #### '
     
    462478  endif
    463479
    464   if(lsubgrid.ne.1.and.verbosity.eq.0) then
     480  if(lsubgrid .ne. 1 .and. verbosity .eq. 0) then
    465481    write(*,*) '             ----------------               '
    466482    write(*,*) ' INFORMATION: SUBGRIDSCALE TERRAIN EFFECT IS'
     
    473489  !***********************************************************
    474490
    475   if ((lconvection.ne.0).and.(lconvection.ne.1)) then
     491  if ((lconvection .ne. 0) .and. (lconvection .ne. 1)) then
    476492    write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
    477493    write(*,*) ' #### LCONVECTION MUST BE SET TO EITHER 1 OR 0#### '
     
    483499  !*************************************************************
    484500
    485   if (lsynctime.gt.(idiffnorm/2)) then
     501  if (lsynctime .gt. (idiffnorm/2)) then
    486502    write(*,*) ' #### FLEXPART MODEL ERROR! SYNCHRONISATION   #### '
    487503    write(*,*) ' #### TIME IS TOO LONG. MAKE IT SHORTER.      #### '
     
    494510  !*****************************************************************************
    495511
    496   if (loutaver.eq.0) then
     512  if (loutaver .eq. 0) then
    497513    write(*,*) ' #### FLEXPART MODEL ERROR! TIME AVERAGE OF   #### '
    498514    write(*,*) ' #### CONCENTRATION FIELD OUTPUT MUST NOT BE  #### '
     
    502518  endif
    503519
    504   if (loutaver.gt.loutstep) then
     520  if (loutaver .gt. loutstep) then
    505521    write(*,*) ' #### FLEXPART MODEL ERROR! TIME AVERAGE OF   #### '
    506522    write(*,*) ' #### CONCENTRATION FIELD OUTPUT MUST NOT BE  #### '
     
    510526  endif
    511527
    512   if (loutsample.gt.loutaver) then
     528  if (loutsample .gt. loutaver) then
    513529    write(*,*) ' #### FLEXPART MODEL ERROR! SAMPLING TIME OF  #### '
    514530    write(*,*) ' #### CONCENTRATION FIELD OUTPUT MUST NOT BE  #### '
     
    518534  endif
    519535
    520   if (mod(loutaver,lsynctime).ne.0) then
     536  if (mod(loutaver,lsynctime) .ne. 0) then
    521537    write(*,*) ' #### FLEXPART MODEL ERROR! AVERAGING TIME OF #### '
    522538    write(*,*) ' #### CONCENTRATION FIELD MUST BE A MULTIPLE  #### '
     
    525541  endif
    526542
    527   if ((loutaver/lsynctime).lt.2) then
     543  if ((loutaver/lsynctime) .lt. 2) then
    528544    write(*,*) ' #### FLEXPART MODEL ERROR! AVERAGING TIME OF #### '
    529545    write(*,*) ' #### CONCENTRATION FIELD MUST BE AT LEAST    #### '
     
    532548  endif
    533549
    534   if (mod(loutstep,lsynctime).ne.0) then
     550  if (mod(loutstep,lsynctime) .ne. 0) then
    535551    write(*,*) ' #### FLEXPART MODEL ERROR! INTERVAL BETWEEN  #### '
    536552    write(*,*) ' #### CONCENTRATION FIELDS MUST BE A MULTIPLE #### '
     
    539555  endif
    540556
    541   if ((loutstep/lsynctime).lt.2) then
     557  if ((loutstep/lsynctime) .lt. 2) then
    542558    write(*,*) ' #### FLEXPART MODEL ERROR! INTERVAL BETWEEN  #### '
    543559    write(*,*) ' #### CONCENTRATION FIELDS MUST BE AT LEAST   #### '
     
    546562  endif
    547563
    548   if (mod(loutsample,lsynctime).ne.0) then
     564  if (mod(loutsample,lsynctime) .ne. 0) then
    549565    write(*,*) ' #### FLEXPART MODEL ERROR! SAMPLING TIME OF  #### '
    550566    write(*,*) ' #### CONCENTRATION FIELD MUST BE A MULTIPLE  #### '
     
    553569  endif
    554570
    555   if (itsplit.lt.loutaver) then
     571  if (itsplit .lt. loutaver) then
    556572    write(*,*) ' #### FLEXPART MODEL ERROR! SPLITTING TIME FOR#### '
    557573    write(*,*) ' #### PARTICLES IS TOO SHORT. PLEASE INCREASE #### '
     
    560576  endif
    561577
    562   if ((mquasilag.eq.1).and.(iout.ge.4)) then
     578  if ((mquasilag .eq. 1) .and. (iout .ge. 4)) then
    563579    write(*,*) ' #### FLEXPART MODEL ERROR! CONFLICTING       #### '
    564580    write(*,*) ' #### OPTIONS: IF MQUASILAG=1, PLUME          #### '
     
    571587
    572588  outstep=real(abs(loutstep))
    573   if (ldirect.eq.1) then
     589  if (ldirect .eq. 1) then
    574590    bdate=juldate(ibdate,ibtime)
    575591    edate=juldate(iedate,ietime)
    576592    ideltas=nint((edate-bdate)*86400.)
    577   else if (ldirect.eq.-1) then
     593  else if (ldirect .eq. -1) then
    578594    loutaver=-1*loutaver
    579595    loutstep=-1*loutstep
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG