Changeset d7935de in flexpart.git for src/readreleases.f90


Ignore:
Timestamp:
Sep 11, 2018, 6:06:31 PM (6 years ago)
Author:
pesei <petra seibert at univie ac at>
Branches:
univie
Children:
93786a1
Parents:
34f1452
Message:

modify most input read subroutines

changed some variable names (mostly for I-N reasons)
includes two names appearing also in timemanager, com_mod
corrected a few mistakes
simplified some parts of code
changed options/RELEASES which is in nml fmt correspondingly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/readreleases.f90

    r5184a7c rd7935de  
    3333  !     Update: 29 January 2001                                                *
    3434  !     Release altitude can be either in magl or masl                         *
    35   !     HSO, 12 August 2013
    36   !     Added optional namelist input
     35  !     HSO, 12 August 2013: Added optional namelist input                     *
     36  !     PS, 2/2015: access= -> position= (ported from 9.2 review)              *
     37  !     PS, 8/2018: check for uninitialised mass (ticket:204),                 *
     38  !          rename int/real variables, a bit of code layout improvement       *
    3739  !                                                                            *
    3840  !*****************************************************************************
     
    7476  implicit none
    7577
    76   integer :: numpartmax,i,j,id1,it1,id2,it2,idum,stat,irel,ispc,nsettle
     78  integer :: numpartmax,i,j,id1,it1,id2,it2,idum,iallocstat,irel,ispc,nsettle
    7779  integer,parameter :: num_min_discrete=100
    7880  real :: vsh(ni),fracth(ni),schmih(ni),releaserate,xdum,cun
    7981  real(kind=dp) :: jul1,jul2,julm,juldate
    80   real,parameter :: eps2=1.e-9
    8182  character(len=50) :: line
    8283  logical :: old
    8384
    8485  ! help variables for namelist reading
    85   integer :: numpoints, parts, readerror
    86   integer*2 :: zkind
     86  integer :: numpoints, nparts, ios
     87  integer*2 :: ikindz
    8788  integer :: idate1, itime1, idate2, itime2
    88   real :: lon1,lon2,lat1,lat2,z1,z2
     89  real :: rlon1,rlon2,rlat1,rlat2,z1,z2
    8990  character*40 :: comment
    9091  integer,parameter :: unitreleasesout=2
    91   real,allocatable, dimension (:) :: mass
    92   integer,allocatable, dimension (:) :: specnum_rel,specnum_rel2
     92  real,allocatable, dimension (:) :: rmass
     93  integer,allocatable, dimension (:) :: numspec_rel,numspec_rel2
    9394
    9495  ! declare namelists
    9596  namelist /releases_ctrl/ &
    9697       nspec, &
    97        specnum_rel
     98       numspec_rel
    9899
    99100  namelist /release/ &
    100101       idate1, itime1, &
    101102       idate2, itime2, &
    102        lon1, lon2, &
    103        lat1, lat2, &
     103       rlon1, rlon2, &
     104       rlat1, rlat2, &
    104105       z1, z2, &
    105        zkind, &
    106        mass, &
    107        parts, &
     106       ikindz, &
     107       rmass, &
     108       nparts, &
    108109       comment
     110! initialiase mass
    109111
    110112  numpoint=0
    111113
    112   ! allocate with maxspec for first input loop
    113   allocate(mass(maxspec),stat=stat)
    114   if (stat.ne.0) write(*,*)'ERROR: could not allocate mass'
    115   allocate(specnum_rel(maxspec),stat=stat)
    116   if (stat.ne.0) write(*,*)'ERROR: could not allocate specnum_rel'
    117 
    118   ! presetting namelist releases_ctrl
     114! allocate with maxspec for first input loop
     115  allocate(rmass(maxspec),stat=iallocstat)
     116  if (iallocstat.ne.0) write(*,*)'ERROR: could not allocate rmass'
     117  allocate(numspec_rel(maxspec),stat=iallocstat)
     118  if (iallocstat.ne.0) write(*,*)'ERROR: could not allocate numspec_rel'
     119
     120! presetting namelist releases_ctrl
    119121  nspec = -1  ! use negative value to determine failed namelist input
    120   specnum_rel = 0
    121 
    122   !sec, read release to find how many releasepoints should be allocated
    123   open(unitreleases,file=path(1)(1:length(1))//'RELEASES',status='old',form='formatted',err=999)
    124 
    125   ! check if namelist input provided
    126   read(unitreleases,releases_ctrl,iostat=readerror)
    127 
    128   ! prepare namelist output if requested
     122  numspec_rel = 0
     123
     124!SEC: read release to find how many releasepoints should be allocated
     125  open(unitreleases,file=path(1)(1:length(1))//'RELEASES',status='old', &
     126    form='formatted',err=999)
     127
     128! prepare namelist output if requested
    129129  if (nmlout.and.lroot) then
    130     open(unitreleasesout,file=path(2)(1:length(2))//'RELEASES.namelist',access='append',status='replace',err=1000)
    131   endif
    132 
    133   if ((readerror.ne.0).or.(nspec.lt.0)) then
    134 
    135   ! no namelist format, close file and allow reopening in old format
     130    open(unitreleasesout,file=path(2)(1:length(2))//'RELEASES.namelist', &
     131      position='append',status='replace',err=1000)
     132  endif
     133
     134! check whether namelist input is available
     135  read(unitreleases,releases_ctrl,iostat=ios)
     136
     137  if (ios .ne. 0 .or. nspec .lt. 0 ) then
     138
     139  ! not in namelist format, close file and reopen as simple text file
     140
    136141    close(unitreleases)
    137     open(unitreleases,file=path(1)(1:length(1))//'RELEASES',status='old',err=999)
    138 
    139     readerror=1 ! indicates old format
    140 
    141   ! Check the format of the RELEASES file (either in free format,
    142   ! or using a formatted mask)
     142    open(unitreleases,file=path(1)(1:length(1))//'RELEASES', status='old', &
     143      err=999)
     144
     145    ios=1 ! indicates old format
     146
     147  ! Check the format of the RELEASES file
     148  ! (either in free format, or using a formatted mask)
    143149  ! Use of formatted mask is assumed if line 10 contains the word 'DIRECTION'
    144150  !**************************************************************************
     151! Note PS: something has changed, now Total is checked. Is this compatible??
    145152
    146153    call skplin(12,unitreleases)
     
    163170    if (old) call skplin(2,unitreleases)
    164171    do i=1,nspec
    165       read(unitreleases,*,err=998) specnum_rel(i)
     172      read(unitreleases,*,err=998) numspec_rel(i)
    166173      if (old) call skplin(2,unitreleases)
    167174    end do
     
    20220925  numpoint=numpoint-1
    203210
    204   else
    205 
    206     readerror=0
    207     do while (readerror.eq.0)
     211  else ! read namelist input
     212
     213    ios=0
     214    do while (ios.eq.0)  ! loop over release points
    208215      idate1=-1
    209       read(unitreleases,release,iostat=readerror)
    210       if ((idate1.lt.0).or.(readerror.ne.0)) then
    211         readerror=1
     216      read(unitreleases,release,iostat=ios)
     217      if (idate1.lt.0 .or. ios.ne.0) then
     218        ios=1
    212219      else
    213220        numpoint=numpoint+1
    214221      endif
    215222    end do
    216     readerror=0
    217   endif ! if namelist input
     223    ios=0
     224
     225  endif
    218226
    219227  rewind(unitreleases)
     
    221229  if (nspec.gt.maxspec) goto 994
    222230
    223   ! allocate arrays of matching size for number of species (namelist output)
    224   deallocate(mass)
    225   allocate(mass(nspec),stat=stat)
    226   if (stat.ne.0) write(*,*)'ERROR: could not allocate mass'
    227   allocate(specnum_rel2(nspec),stat=stat)
    228   if (stat.ne.0) write(*,*)'ERROR: could not allocate specnum_rel2'
    229   specnum_rel2=specnum_rel(1:nspec)
    230   deallocate(specnum_rel)
     231! allocate arrays of matching size for number of species (namelist output)
     232  deallocate(rmass)
     233  allocate(rmass(nspec),stat=iallocstat)
     234  if (iallocstat.ne.0) write(*,*)'ERROR: could not allocate rmass'
     235  allocate(numspec_rel2(nspec),stat=iallocstat)
     236  if (iallocstat.ne.0) write(*,*)'ERROR: could not allocate numspec_rel2'
     237
     238  numspec_rel2 = numspec_rel(1:nspec)
     239
     240  deallocate(numspec_rel)
    231241  ! eso: BUG, crashes here for nspec=12 and maxspec=6,
    232242  ! TODO: catch error and exit
    233   allocate(specnum_rel(nspec),stat=stat)
    234   if (stat.ne.0) write(*,*)'ERROR: could not allocate specnum_rel'
    235   specnum_rel=specnum_rel2
    236   deallocate(specnum_rel2)
    237 
    238   !allocate memory for numpoint releaspoints
    239   allocate(ireleasestart(numpoint),stat=stat)
    240   if (stat.ne.0) write(*,*)'ERROR: could not allocate ireleasestart'
    241   allocate(ireleaseend(numpoint),stat=stat)
    242   if (stat.ne.0) write(*,*)'ERROR: could not allocate ireleaseend'
    243   allocate(xpoint1(numpoint),stat=stat)
    244   if (stat.ne.0) write(*,*)'ERROR: could not allocate xpoint1'
    245   allocate(xpoint2(numpoint),stat=stat)
    246   if (stat.ne.0) write(*,*)'ERROR: could not allocate xpoint2'
    247   allocate(ypoint1(numpoint),stat=stat)
    248   if (stat.ne.0) write(*,*)'ERROR: could not allocate ypoint1'
    249   allocate(ypoint2(numpoint),stat=stat)
    250   if (stat.ne.0) write(*,*)'ERROR: could not allocate ypoint2'
    251   allocate(zpoint1(numpoint),stat=stat)
    252   if (stat.ne.0) write(*,*)'ERROR: could not allocate zpoint1'
    253   allocate(zpoint2(numpoint),stat=stat)
    254   if (stat.ne.0) write(*,*)'ERROR: could not allocate zpoint2'
    255   allocate(kindz(numpoint),stat=stat)
    256   if (stat.ne.0) write(*,*)'ERROR: could not allocate kindz'
    257   allocate(xmass(numpoint,maxspec),stat=stat)
    258   if (stat.ne.0) write(*,*)'ERROR: could not allocate xmass'
    259   allocate(rho_rel(numpoint),stat=stat)
    260   if (stat.ne.0) write(*,*)'ERROR: could not allocate rho_rel'
    261   allocate(npart(numpoint),stat=stat)
    262   if (stat.ne.0) write(*,*)'ERROR: could not allocate npart'
    263   allocate(xmasssave(numpoint),stat=stat)
    264   if (stat.ne.0) write(*,*)'ERROR: could not allocate xmasssave'
    265 
    266   if (lroot) write (*,*) 'Releasepoints : ', numpoint
    267 
    268   do i=1,numpoint
    269     xmasssave(i)=0.
    270   end do
     243  allocate(numspec_rel(nspec),stat=iallocstat)
     244  if (iallocstat.ne.0) write(*,*)'ERROR: could not allocate numspec_rel'
     245
     246  numspec_rel = numspec_rel2
     247
     248  deallocate(numspec_rel2)
     249
     250! allocate memory for numpoint releaspoints
     251  allocate ( &
     252    ireleasestart(numpoint), ireleaseend(numpoint),xpoint1(numpoint), &
     253    xpoint2(numpoint), ypoint1(numpoint), ypoint2(numpoint), &
     254    zpoint1(numpoint), zpoint2(numpoint), kindz(numpoint), &
     255    xmass(numpoint,maxspec), rho_rel(numpoint), npart(numpoint), &
     256    xmasssave(numpoint), &
     257      stat=iallocstat )
     258  if (iallocstat.ne.0) write(*,*)'ERROR: could not allocate variables' // &
     259    ' dimensioned numpoint =', numpoint
     260
     261  if (lroot) write (*,*) 'Release points : ', numpoint
     262
     263  xmasssave(:)=0.
    271264
    272265  !now save the information
    273   DEP=.false.
    274   DRYDEP=.false.
    275   WETDEP=.false.
    276   OHREA=.false.
    277   do i=1,maxspec
    278     DRYDEPSPEC(i)=.false.
    279     WETDEPSPEC(i)=.false.
    280   end do
    281 
    282   if (readerror.ne.0) then
     266  dep   =.false.
     267  drydep=.false.
     268  wetdep=.false.
     269  ohrea =.false.
     270  drydepspec(:)=.false.
     271  wetdepspec(:)=.false.
     272
     273  if (ios.ne.0) then
     274
    283275  ! Skip first 11 lines (file header)
    284276  !**********************************
     
    292284    if (nspec.gt.maxspec) goto 994
    293285    if (old) call skplin(2,unitreleases)
    294   endif
    295 
    296   ! namelist output
    297   if (nmlout.and.lroot) then
    298     write(unitreleasesout,nml=releases_ctrl)
    299   endif
    300 
     286
     287  endif
     288
     289! namelist output
     290  if (nmlout.and.lroot) write(unitreleasesout,nml=releases_ctrl)
     291
     292! species loop
    301293  do i=1,nspec
    302     if (readerror.ne.0) then
    303       read(unitreleases,*,err=998) specnum_rel(i)
     294 
     295    if (ios.ne.0) then
     296      read(unitreleases,*,err=998) numspec_rel(i)
    304297      if (old) call skplin(2,unitreleases)
    305       call readspecies(specnum_rel(i),i)
     298      call readspecies(numspec_rel(i),i)
    306299    else
    307       call readspecies(specnum_rel(i),i)
     300      call readspecies(numspec_rel(i),i)
    308301    endif
    309302
     
    322315  !*****************
    323316
    324     if (((iout.eq.2).or.(iout.eq.3)).and.(weightmolar(i).lt.0.)) then
     317    if ( (iout.eq.2 .or. iout.eq.3) .and. weightmolar(i).lt.0. ) then
    325318      write(*,*) 'For mixing ratio output, valid molar weight'
    326319      write(*,*) 'must be specified for all simulated species.'
     
    334327
    335328    decay(i)=0.693147/decay(i) !conversion half life to decay constant
    336 
     329! Note PS: this should be replace by = alog(2.)/decay(i)
     330! keep it for the moment so that results are not affect in test phase of v10
    337331
    338332  ! Dry deposition of gases
    339333  !************************
    340334
    341     if (reldiff(i).gt.0.) rm(i)=1./(henry(i)/3000.+100.*f0(i))    ! mesophyll resistance
     335    if (reldiff(i).gt.0.) rm(i)=1./( henry(i)/3000. + 100.*f0(i) )! mesophyll resistance
    342336
    343337  ! Dry deposition of particles
    344338  !****************************
    345339
    346     vsetaver(i)=0.
    347     cunningham(i)=0.
    348     dquer(i)=dquer(i)*1000000.        ! Conversion m to um
     340    vsetaver(i) = 0.
     341    cunningham(i) = 0.
     342    dquer(i) = dquer(i)*1.e6 ! Conversion m to um
    349343    if (density(i).gt.0.) then         ! Additional parameters
    350344      call part0(dquer(i),dsigma(i),density(i),fracth,schmih,cun,vsh)
    351345      do j=1,ni
    352         fract(i,j)=fracth(j)
    353         schmi(i,j)=schmih(j)
    354         vset(i,j)=vsh(j)
    355         cunningham(i)=cunningham(i)+cun*fract(i,j)
    356         vsetaver(i)=vsetaver(i)-vset(i,j)*fract(i,j)
     346        fract(i,j) = fracth(j)
     347        schmi(i,j) = schmih(j)
     348        vset(i,j) = vsh(j)
     349        cunningham(i) = cunningham(i) + cun*fract(i,j)
     350        vsetaver(i) = vsetaver(i) - vset(i,j)*fract(i,j)
    357351      end do
    358352      if (lroot) write(*,*) 'Average settling velocity: ',i,vsetaver(i)
     
    368362
    369363  ! ESO 04.2016 check for below-cloud scavenging (gas or aerosol)
    370     if ((dquer(i).le.0..and.(weta_gas(i).gt.0. .or. wetb_gas(i).gt.0.)) .or. &
    371          &(dquer(i).gt.0. .and. (crain_aero(i) .gt. 0. .or. csnow_aero(i).gt.0.)))  then
    372       WETDEP=.true.
    373       WETDEPSPEC(i)=.true.
     364    if ( &
     365      dquer(i).le.0. .and. (weta_gas(i)  .gt.0. .or. wetb_gas(i)  .gt.0.) .or. &
     366      dquer(i).gt.0. .and. (crain_aero(i).gt.0. .or. csnow_aero(i).gt.0.)  &
     367       )  then
     368      wetdep        = .true.
     369      wetdepspec(i) = .true.
    374370      if (lroot) then
    375371        write (*,*) '  Below-cloud scavenging: ON'
     
    381377
    382378  ! NIK 31.01.2013 + 10.12.2013 + 15.02.2015
    383     if (dquer(i).gt.0..and.(ccn_aero(i).gt.0. .or. in_aero(i).gt.0.))  then
    384       WETDEP=.true.
    385       WETDEPSPEC(i)=.true.
     379    if (dquer(i).gt.0. .and. (ccn_aero(i).gt.0. .or. in_aero(i).gt.0.))  then
     380      wetdep        = .true.
     381      wetdepspec(i) = .true.
    386382      if (lroot) then
    387383        write (*,*) '  In-cloud scavenging: ON'
     
    394390
    395391    if (ohcconst(i).gt.0.) then
    396       OHREA=.true.
     392      ohrea = .true.
    397393      if (lroot) write (*,*) '  OHreaction switched on: ',ohcconst(i),i
    398394    endif
    399395
    400     if ((reldiff(i).gt.0.).or.(density(i).gt.0.).or.(dryvel(i).gt.0.)) then
    401       DRYDEP=.true.
    402       DRYDEPSPEC(i)=.true.
     396    if (reldiff(i).gt.0. .or. density(i).gt.0. .or. dryvel(i).gt.0.) then
     397      drydep        = .true.
     398      drydepspec(i) = .true.
    403399    endif
    404400
     
    415411101 numpoint=numpoint+1
    416412
    417   if (readerror.lt.1) then ! reading namelist format
     413  if (ios.lt.1) then ! reading namelist format
    418414
    419415    if (numpoint.gt.numpoints) goto 250
    420     zkind = 1
    421     mass = 0
    422     parts = 0
     416    ikindz = 1
     417    rmass = -1. ! initialise as negative to catch if not given in input
     418    nparts = 0
    423419    comment = ' '
    424     read(unitreleases,release,iostat=readerror)
     420    read(unitreleases,release,iostat=ios)
    425421    id1=idate1
    426422    it1=itime1
    427423    id2=idate2
    428424    it2=itime2
    429     xpoint1(numpoint)=lon1
    430     xpoint2(numpoint)=lon2
    431     ypoint1(numpoint)=lat1
    432     ypoint2(numpoint)=lat2
     425    xpoint1(numpoint)=rlon1
     426    xpoint2(numpoint)=rlon2
     427    ypoint1(numpoint)=rlat1
     428    ypoint2(numpoint)=rlat2
    433429    zpoint1(numpoint)=z1
    434430    zpoint2(numpoint)=z2
    435     kindz(numpoint)=zkind
     431    kindz(numpoint)=ikindz
    436432    do i=1,nspec
    437       xmass(numpoint,i)=mass(i)
     433      if (rmass(i) .lt. 0.) goto 995 ! write error and stop
     434      xmass(numpoint,i)=rmass(i)
    438435    end do
    439     npart(numpoint)=parts
     436    npart(numpoint)=nparts
    440437    compoint(min(1001,numpoint))=comment
    441438
     
    445442    endif
    446443
    447   else
     444  else ! simple text format
    448445
    449446    read(unitreleases,*,end=250)
     
    471468      read(unitreleases,*,err=998) xmass(numpoint,i)
    472469      if (old) call skplin(2,unitreleases)
    473       mass(i)=xmass(numpoint,i)
     470      rmass(i)=xmass(numpoint,i)
    474471    end do
    475472  !save compoint only for the first 1000 release points
     
    489486      idate2=id2
    490487      itime2=it2
    491       lon1=xpoint1(numpoint)
    492       lon2=xpoint2(numpoint)
    493       lat1=ypoint1(numpoint)
    494       lat2=ypoint2(numpoint)
     488      rlon1=xpoint1(numpoint)
     489      rlon2=xpoint2(numpoint)
     490      rlat1=ypoint1(numpoint)
     491      rlat2=ypoint2(numpoint)
    495492      z1=zpoint1(numpoint)
    496493      z2=zpoint2(numpoint)
    497       zkind=kindz(numpoint)
    498       parts=npart(numpoint)
     494      ikindz=kindz(numpoint)
     495      nparts=npart(numpoint)
    499496      write(unitreleasesout,nml=release)
    500497    endif
    501498
    502499    if (numpoint.le.1000) then
    503       if((xpoint1(numpoint).eq.0.).and.(ypoint1(numpoint).eq.0.).and. &
    504            (xpoint2(numpoint).eq.0.).and.(ypoint2(numpoint).eq.0.).and. &
    505            (compoint(numpoint)(1:8).eq.'        ')) goto 250
     500      if (xpoint1(numpoint).eq.0. .and. ypoint1(numpoint).eq.0. .and. &
     501          xpoint2(numpoint).eq.0. .and. ypoint2(numpoint).eq.0. .and. &
     502          compoint(numpoint)(1:8).eq.'        ') goto 250
    506503    else
    507       if((xpoint1(numpoint).eq.0.).and.(ypoint1(numpoint).eq.0.).and. &
    508            (xpoint2(numpoint).eq.0.).and.(ypoint2(numpoint).eq.0.)) goto 250
     504      if (xpoint1(numpoint).eq.0. .and. ypoint1(numpoint).eq.0. .and. &
     505          xpoint2(numpoint).eq.0. .and. ypoint2(numpoint).eq.0.) goto 250
    509506    endif
    510507
     
    539536  !*********************************************************************
    540537
    541   if (xpoint1(numpoint).lt.xlon0) &
    542        xpoint1(numpoint)=xpoint1(numpoint)+360.
    543   if (xpoint1(numpoint).gt.xlon0+(nxmin1)*dx) &
    544        xpoint1(numpoint)=xpoint1(numpoint)-360.
    545   if (xpoint2(numpoint).lt.xlon0) &
    546        xpoint2(numpoint)=xpoint2(numpoint)+360.
    547   if (xpoint2(numpoint).gt.xlon0+(nxmin1)*dx) &
    548        xpoint2(numpoint)=xpoint2(numpoint)-360.
     538  if (xpoint1(numpoint) .lt. xlon0) &
     539      xpoint1(numpoint) = xpoint1(numpoint) + 360.
     540  if (xpoint1(numpoint) .gt. xlon0+nxmin1*dx) &
     541      xpoint1(numpoint) = xpoint1(numpoint) - 360.
     542  if (xpoint2(numpoint) .lt. xlon0) &
     543      xpoint2(numpoint) = xpoint2(numpoint) + 360.
     544  if (xpoint2(numpoint) .gt. xlon0+nxmin1*dx) &
     545      xpoint2(numpoint) = xpoint2(numpoint) - 360.
    549546
    550547  ! Determine relative beginning and ending times of particle release
     
    562559  if (mdomainfill.eq.0) then   ! no domain filling
    563560    if (ldirect.eq.1) then
    564       if ((jul1.lt.bdate).or.(jul2.gt.edate)) then
     561      if (jul1.lt.bdate .or. jul2.gt.edate) then
    565562        write(*,*) 'FLEXPART MODEL ERROR'
    566563        write(*,*) 'Release starts before simulation begins or ends'
     
    577574      endif
    578575    else if (ldirect.eq.-1) then
    579       if ((jul1.lt.edate).or.(jul2.gt.bdate)) then
     576      if (jul1.lt.edate .or. jul2.gt.bdate) then
    580577        write(*,*) 'FLEXPART MODEL ERROR'
    581578        write(*,*) 'Release starts before simulation begins or ends'
     
    586583      if (npart(numpoint).gt.num_min_discrete) then
    587584        ireleasestart(numpoint)=int((jul1-bdate)*86400.)
    588         ireleaseend(numpoint)=int((jul2-bdate)*86400.)
     585        ireleaseend(numpoint) = int((jul2-bdate)*86400.)
    589586      else
    590587        ireleasestart(numpoint)=int((julm-bdate)*86400.)
    591         ireleaseend(numpoint)=int((julm-bdate)*86400.)
     588        ireleaseend(numpoint) = int((julm-bdate)*86400.)
    592589      endif
    593590    endif
     
    600597
    601598  if (ireleasestart(numpoint).ne.ireleaseend(numpoint)) then
    602     releaserate=releaserate+real(npart(numpoint))/ &
    603          real(ireleaseend(numpoint)-ireleasestart(numpoint))
     599    releaserate = releaserate + real( npart(numpoint) ) / &
     600      real( ireleaseend(numpoint) - ireleasestart(numpoint) )
    604601  else
    605602    releaserate=99999999
     
    634631      nsettle=0
    635632      do ispc=1,nspec
    636         if (xmass(irel,ispc).gt.eps2) nsettle=nsettle+1
     633        if (xmass(irel,ispc).gt.tiny(1.)) nsettle=nsettle+1
    637634      end do
    638635      if (nsettle.gt.1) lsettling=.false.
     
    641638
    642639  if (lroot) then
    643     if (.not.lsettling) then
    644       write(*,*) 'WARNING: more than 1 species per release point, settling &
    645            &disabled'
    646     end if
     640    if (.not.lsettling) &
     641     write(*,*) 'WARNING: more than 1 species per release point,' &
     642           // ' settling disabled'
    647643  end if
    648644
     
    651647  !************************************************************************
    652648
    653   if (releaserate.gt. &
    654        0.99*real(maxpart)/real(lage(nageclass))) then
     649  if (releaserate .gt. 0.99*real(maxpart)/real(lage(nageclass))) then
    655650    if (numpartmax.gt.maxpart.and.lroot) then
    656651      write(*,*) '#####################################################'
     
    670665      write(*,*) 'Maximum allowed release rate is: ', &
    671666           real(maxpart)/real(lage(nageclass)),' particles per second'
    672       write(*,*) &
    673            'Total number of particles released during the simulation is: ', &
    674            numpartmax
     667      write(*,*) 'Total number of particles released during the simulation is:'&
     668        ,numpartmax
    675669      write(*,*) 'Maximum allowed number of particles is: ',maxpart
    676670    endif
     
    679673
    680674  if (lroot) then
    681     write(*,FMT='(A,ES14.7)') ' Total mass released:', sum(xmass(1:numpoint,1:nspec))
     675    write(*,FMT='(A,ES14.7)') ' Total mass released:', &
     676      sum(xmass(1:numpoint,1:nspec))
    682677  end if
    683678
    684679  return
    685680
    686 994 write(*,*) '#####################################################'
     681995 write(*,*) '#####################################################'
    687682  write(*,*) '#### FLEXPART MODEL SUBROUTINE READRELEASES:     ####'
    688683  write(*,*) '####                                             ####'
    689   write(*,*) '#### ERROR - MAXIMUM NUMBER OF EMITTED SPECIES IS####'
    690   write(*,*) '#### TOO LARGE. PLEASE REDUCE NUMBER OF SPECIES. ####'
     684  write(*,*) '#### ERROR - mass for species',i,' not given     ####'
    691685  write(*,*) '#####################################################'
     686  stop 'readreleases - undefined mass'
     687
     688994 write(*,*) '######################################################'
     689  write(*,*) '#### FLEXPART MODEL SUBROUTINE READRELEASES:      ####'
     690  write(*,*) '####                                              ####'
     691  write(*,*) '#### ERROR - MAXIMUM NUMBER OF EMITTED SPECIES IS ####'
     692  write(*,*) '#### TOO LARGE. PLEASE REDUCE NUMBER OF SPECIES.  ####'
     693  write(*,*) '######################################################'
    692694  stop
    693695
     
    702704  stop
    703705
    704 
    705706999 write(*,*) '#####################################################'
    706707  write(*,*) '   FLEXPART MODEL SUBROUTINE READRELEASES: '
     
    713714
    7147151000 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "RELEASES"    #### '
    715   write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY       #### '
     716  write(*,*)    ' #### CANNOT BE OPENED IN THE DIRECTORY        #### '
    716717  write(*,'(a)') path(2)(1:length(2))
    717718  stop
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG