[e200b7a] | 1 | !********************************************************************** |
---|
| 2 | ! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010 * |
---|
| 3 | ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa, * |
---|
| 4 | ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann * |
---|
| 5 | ! * |
---|
| 6 | ! This file is part of FLEXPART. * |
---|
| 7 | ! * |
---|
| 8 | ! FLEXPART is free software: you can redistribute it and/or modify * |
---|
| 9 | ! it under the terms of the GNU General Public License as published by* |
---|
| 10 | ! the Free Software Foundation, either version 3 of the License, or * |
---|
| 11 | ! (at your option) any later version. * |
---|
| 12 | ! * |
---|
| 13 | ! FLEXPART is distributed in the hope that it will be useful, * |
---|
| 14 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
| 15 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
---|
| 16 | ! GNU General Public License for more details. * |
---|
| 17 | ! * |
---|
| 18 | ! You should have received a copy of the GNU General Public License * |
---|
| 19 | ! along with FLEXPART. If not, see <http://www.gnu.org/licenses/>. * |
---|
| 20 | !********************************************************************** |
---|
| 21 | |
---|
| 22 | subroutine readreleases |
---|
| 23 | |
---|
| 24 | !***************************************************************************** |
---|
| 25 | ! * |
---|
| 26 | ! This routine reads the release point specifications for the current * |
---|
| 27 | ! model run. Several release points can be used at the same time. * |
---|
| 28 | ! * |
---|
| 29 | ! Author: A. Stohl * |
---|
| 30 | ! * |
---|
| 31 | ! 18 May 1996 * |
---|
| 32 | ! * |
---|
| 33 | ! Update: 29 January 2001 * |
---|
| 34 | ! Release altitude can be either in magl or masl * |
---|
[b4d29ce] | 35 | ! HSO, 12 August 2013 |
---|
| 36 | ! Added optional namelist input |
---|
[e200b7a] | 37 | ! * |
---|
| 38 | !***************************************************************************** |
---|
| 39 | ! * |
---|
| 40 | ! Variables: * |
---|
| 41 | ! decay decay constant of species * |
---|
| 42 | ! dquer [um] mean particle diameters * |
---|
| 43 | ! dsigma e.g. dsigma=10 or dsigma=0.1 means that 68% of the mass* |
---|
| 44 | ! are between 0.1*dquer and 10*dquer * |
---|
| 45 | ! ireleasestart, ireleaseend [s] starting time and ending time of each * |
---|
| 46 | ! release * |
---|
| 47 | ! kindz 1: zpoint is in m agl, 2: zpoint is in m asl, 3: zpoint* |
---|
| 48 | ! is in hPa * |
---|
| 49 | ! npart number of particles to be released * |
---|
| 50 | ! nspec number of species to be released * |
---|
| 51 | ! density [kg/m3] density of the particles * |
---|
| 52 | ! rm [s/m] Mesophyll resistance * |
---|
| 53 | ! species name of species * |
---|
| 54 | ! xmass total mass of each species * |
---|
| 55 | ! xpoint1,ypoint1 geograf. coordinates of lower left corner of release * |
---|
| 56 | ! area * |
---|
| 57 | ! xpoint2,ypoint2 geograf. coordinates of upper right corner of release * |
---|
| 58 | ! area * |
---|
[341f4b7] | 59 | ! weta_gas, wetb_gas parameters for below-cloud scavenging (gas) * |
---|
| 60 | ! crain_aero, csnow_aero parameters for below-cloud scavenging (aerosol) * |
---|
| 61 | ! ccn_aero, in_aero parameters for in-cloud scavenging (aerosol) * |
---|
[e200b7a] | 62 | ! zpoint1,zpoint2 height range, over which release takes place * |
---|
[f13406c] | 63 | ! num_min_discrete if less, release cannot be randomized and happens at * |
---|
| 64 | ! time mid-point of release interval * |
---|
[8a65cb0] | 65 | ! lroot true if serial version, or if MPI and root process * |
---|
[e200b7a] | 66 | ! * |
---|
| 67 | !***************************************************************************** |
---|
| 68 | |
---|
| 69 | use point_mod |
---|
| 70 | use xmass_mod |
---|
| 71 | use par_mod |
---|
| 72 | use com_mod |
---|
| 73 | |
---|
| 74 | implicit none |
---|
| 75 | |
---|
[b4d29ce] | 76 | integer :: numpartmax,i,j,id1,it1,id2,it2,idum,stat |
---|
[f13406c] | 77 | integer,parameter :: num_min_discrete=100 |
---|
[e200b7a] | 78 | real :: vsh(ni),fracth(ni),schmih(ni),releaserate,xdum,cun |
---|
[f13406c] | 79 | real(kind=dp) :: jul1,jul2,julm,juldate |
---|
[e200b7a] | 80 | character(len=50) :: line |
---|
| 81 | logical :: old |
---|
| 82 | |
---|
[b4d29ce] | 83 | ! help variables for namelist reading |
---|
| 84 | integer :: numpoints, parts, readerror |
---|
| 85 | integer*2 :: zkind |
---|
| 86 | integer :: idate1, itime1, idate2, itime2 |
---|
| 87 | real :: lon1,lon2,lat1,lat2,z1,z2 |
---|
| 88 | character*40 :: comment |
---|
| 89 | integer,parameter :: unitreleasesout=2 |
---|
| 90 | real,allocatable, dimension (:) :: mass |
---|
| 91 | integer,allocatable, dimension (:) :: specnum_rel,specnum_rel2 |
---|
| 92 | |
---|
| 93 | ! declare namelists |
---|
| 94 | namelist /releases_ctrl/ & |
---|
| 95 | nspec, & |
---|
| 96 | specnum_rel |
---|
| 97 | |
---|
| 98 | namelist /release/ & |
---|
| 99 | idate1, itime1, & |
---|
| 100 | idate2, itime2, & |
---|
| 101 | lon1, lon2, & |
---|
| 102 | lat1, lat2, & |
---|
| 103 | z1, z2, & |
---|
| 104 | zkind, & |
---|
| 105 | mass, & |
---|
| 106 | parts, & |
---|
| 107 | comment |
---|
[e200b7a] | 108 | |
---|
[b4d29ce] | 109 | numpoint=0 |
---|
[e200b7a] | 110 | |
---|
[b4d29ce] | 111 | ! allocate with maxspec for first input loop |
---|
| 112 | allocate(mass(maxspec),stat=stat) |
---|
| 113 | if (stat.ne.0) write(*,*)'ERROR: could not allocate mass' |
---|
| 114 | allocate(specnum_rel(maxspec),stat=stat) |
---|
| 115 | if (stat.ne.0) write(*,*)'ERROR: could not allocate specnum_rel' |
---|
[e200b7a] | 116 | |
---|
[b4d29ce] | 117 | ! presetting namelist releases_ctrl |
---|
| 118 | nspec = -1 ! use negative value to determine failed namelist input |
---|
| 119 | specnum_rel = 0 |
---|
| 120 | |
---|
| 121 | !sec, read release to find how many releasepoints should be allocated |
---|
| 122 | open(unitreleases,file=path(1)(1:length(1))//'RELEASES',status='old',form='formatted',err=999) |
---|
| 123 | |
---|
| 124 | ! check if namelist input provided |
---|
| 125 | read(unitreleases,releases_ctrl,iostat=readerror) |
---|
| 126 | |
---|
| 127 | ! prepare namelist output if requested |
---|
[8a65cb0] | 128 | if (nmlout.and.lroot) then |
---|
| 129 | open(unitreleasesout,file=path(2)(1:length(2))//'RELEASES.namelist',access='append',status='replace',err=1000) |
---|
[e200b7a] | 130 | endif |
---|
| 131 | |
---|
[b4d29ce] | 132 | if ((readerror.ne.0).or.(nspec.lt.0)) then |
---|
[e200b7a] | 133 | |
---|
[b4d29ce] | 134 | ! no namelist format, close file and allow reopening in old format |
---|
| 135 | close(unitreleases) |
---|
| 136 | open(unitreleases,file=path(1)(1:length(1))//'RELEASES',status='old',err=999) |
---|
[e200b7a] | 137 | |
---|
[b4d29ce] | 138 | readerror=1 ! indicates old format |
---|
[e200b7a] | 139 | |
---|
[b4d29ce] | 140 | ! Check the format of the RELEASES file (either in free format, |
---|
| 141 | ! or using a formatted mask) |
---|
| 142 | ! Use of formatted mask is assumed if line 10 contains the word 'DIRECTION' |
---|
| 143 | !************************************************************************** |
---|
[e200b7a] | 144 | |
---|
[b4d29ce] | 145 | call skplin(12,unitreleases) |
---|
| 146 | read (unitreleases,901) line |
---|
| 147 | 901 format (a) |
---|
| 148 | if (index(line,'Total') .eq. 0) then |
---|
| 149 | old = .false. |
---|
| 150 | else |
---|
| 151 | old = .true. |
---|
| 152 | endif |
---|
| 153 | rewind(unitreleases) |
---|
[e200b7a] | 154 | |
---|
[b4d29ce] | 155 | |
---|
| 156 | ! Skip first 11 lines (file header) |
---|
| 157 | !********************************** |
---|
| 158 | |
---|
| 159 | call skplin(11,unitreleases) |
---|
| 160 | |
---|
| 161 | read(unitreleases,*,err=998) nspec |
---|
| 162 | if (old) call skplin(2,unitreleases) |
---|
| 163 | do i=1,nspec |
---|
| 164 | read(unitreleases,*,err=998) specnum_rel(i) |
---|
| 165 | if (old) call skplin(2,unitreleases) |
---|
| 166 | end do |
---|
| 167 | |
---|
| 168 | numpoint=0 |
---|
| 169 | 100 numpoint=numpoint+1 |
---|
| 170 | read(unitreleases,*,end=25) |
---|
| 171 | read(unitreleases,*,err=998,end=25) idum,idum |
---|
| 172 | if (old) call skplin(2,unitreleases) |
---|
| 173 | read(unitreleases,*,err=998) idum,idum |
---|
| 174 | if (old) call skplin(2,unitreleases) |
---|
| 175 | read(unitreleases,*,err=998) xdum |
---|
| 176 | if (old) call skplin(2,unitreleases) |
---|
| 177 | read(unitreleases,*,err=998) xdum |
---|
| 178 | if (old) call skplin(2,unitreleases) |
---|
[e200b7a] | 179 | read(unitreleases,*,err=998) xdum |
---|
| 180 | if (old) call skplin(2,unitreleases) |
---|
[b4d29ce] | 181 | read(unitreleases,*,err=998) xdum |
---|
| 182 | if (old) call skplin(2,unitreleases) |
---|
| 183 | read(unitreleases,*,err=998) idum |
---|
| 184 | if (old) call skplin(2,unitreleases) |
---|
| 185 | read(unitreleases,*,err=998) xdum |
---|
| 186 | if (old) call skplin(2,unitreleases) |
---|
| 187 | read(unitreleases,*,err=998) xdum |
---|
| 188 | if (old) call skplin(2,unitreleases) |
---|
| 189 | read(unitreleases,*,err=998) idum |
---|
| 190 | if (old) call skplin(2,unitreleases) |
---|
| 191 | do i=1,nspec |
---|
| 192 | read(unitreleases,*,err=998) xdum |
---|
| 193 | if (old) call skplin(2,unitreleases) |
---|
| 194 | end do |
---|
| 195 | !save compoint only for the first 1000 release points |
---|
| 196 | read(unitreleases,'(a40)',err=998) compoint(1)(1:40) |
---|
| 197 | if (old) call skplin(1,unitreleases) |
---|
| 198 | |
---|
| 199 | goto 100 |
---|
| 200 | |
---|
| 201 | 25 numpoint=numpoint-1 |
---|
| 202 | |
---|
| 203 | else |
---|
| 204 | |
---|
| 205 | readerror=0 |
---|
| 206 | do while (readerror.eq.0) |
---|
| 207 | idate1=-1 |
---|
| 208 | read(unitreleases,release,iostat=readerror) |
---|
| 209 | if ((idate1.lt.0).or.(readerror.ne.0)) then |
---|
| 210 | readerror=1 |
---|
| 211 | else |
---|
| 212 | numpoint=numpoint+1 |
---|
| 213 | endif |
---|
| 214 | end do |
---|
| 215 | readerror=0 |
---|
| 216 | endif ! if namelist input |
---|
| 217 | |
---|
| 218 | rewind(unitreleases) |
---|
| 219 | |
---|
[4c64400] | 220 | if (nspec.gt.maxspec) goto 994 |
---|
| 221 | |
---|
[b4d29ce] | 222 | ! allocate arrays of matching size for number of species (namelist output) |
---|
| 223 | deallocate(mass) |
---|
| 224 | allocate(mass(nspec),stat=stat) |
---|
| 225 | if (stat.ne.0) write(*,*)'ERROR: could not allocate mass' |
---|
| 226 | allocate(specnum_rel2(nspec),stat=stat) |
---|
| 227 | if (stat.ne.0) write(*,*)'ERROR: could not allocate specnum_rel2' |
---|
| 228 | specnum_rel2=specnum_rel(1:nspec) |
---|
[b0434e1] | 229 | deallocate(specnum_rel) |
---|
| 230 | ! eso: BUG, crashes here for nspec=12 and maxspec=6, |
---|
| 231 | ! TODO: catch error and exit |
---|
[b4d29ce] | 232 | allocate(specnum_rel(nspec),stat=stat) |
---|
| 233 | if (stat.ne.0) write(*,*)'ERROR: could not allocate specnum_rel' |
---|
| 234 | specnum_rel=specnum_rel2 |
---|
| 235 | deallocate(specnum_rel2) |
---|
| 236 | |
---|
| 237 | !allocate memory for numpoint releaspoints |
---|
| 238 | allocate(ireleasestart(numpoint),stat=stat) |
---|
| 239 | if (stat.ne.0) write(*,*)'ERROR: could not allocate ireleasestart' |
---|
| 240 | allocate(ireleaseend(numpoint),stat=stat) |
---|
| 241 | if (stat.ne.0) write(*,*)'ERROR: could not allocate ireleaseend' |
---|
| 242 | allocate(xpoint1(numpoint),stat=stat) |
---|
| 243 | if (stat.ne.0) write(*,*)'ERROR: could not allocate xpoint1' |
---|
| 244 | allocate(xpoint2(numpoint),stat=stat) |
---|
| 245 | if (stat.ne.0) write(*,*)'ERROR: could not allocate xpoint2' |
---|
| 246 | allocate(ypoint1(numpoint),stat=stat) |
---|
| 247 | if (stat.ne.0) write(*,*)'ERROR: could not allocate ypoint1' |
---|
| 248 | allocate(ypoint2(numpoint),stat=stat) |
---|
| 249 | if (stat.ne.0) write(*,*)'ERROR: could not allocate ypoint2' |
---|
| 250 | allocate(zpoint1(numpoint),stat=stat) |
---|
| 251 | if (stat.ne.0) write(*,*)'ERROR: could not allocate zpoint1' |
---|
| 252 | allocate(zpoint2(numpoint),stat=stat) |
---|
| 253 | if (stat.ne.0) write(*,*)'ERROR: could not allocate zpoint2' |
---|
| 254 | allocate(kindz(numpoint),stat=stat) |
---|
| 255 | if (stat.ne.0) write(*,*)'ERROR: could not allocate kindz' |
---|
| 256 | allocate(xmass(numpoint,maxspec),stat=stat) |
---|
| 257 | if (stat.ne.0) write(*,*)'ERROR: could not allocate xmass' |
---|
| 258 | allocate(rho_rel(numpoint),stat=stat) |
---|
| 259 | if (stat.ne.0) write(*,*)'ERROR: could not allocate rho_rel' |
---|
| 260 | allocate(npart(numpoint),stat=stat) |
---|
| 261 | if (stat.ne.0) write(*,*)'ERROR: could not allocate npart' |
---|
| 262 | allocate(xmasssave(numpoint),stat=stat) |
---|
| 263 | if (stat.ne.0) write(*,*)'ERROR: could not allocate xmasssave' |
---|
| 264 | |
---|
[8a65cb0] | 265 | if (lroot) write (*,*) 'Releasepoints : ', numpoint |
---|
[b4d29ce] | 266 | |
---|
| 267 | do i=1,numpoint |
---|
| 268 | xmasssave(i)=0. |
---|
[e200b7a] | 269 | end do |
---|
| 270 | |
---|
| 271 | !now save the information |
---|
| 272 | DEP=.false. |
---|
| 273 | DRYDEP=.false. |
---|
| 274 | WETDEP=.false. |
---|
| 275 | OHREA=.false. |
---|
| 276 | do i=1,maxspec |
---|
| 277 | DRYDEPSPEC(i)=.false. |
---|
[c8fc724] | 278 | WETDEPSPEC(i)=.false. |
---|
[e200b7a] | 279 | end do |
---|
| 280 | |
---|
[b4d29ce] | 281 | if (readerror.ne.0) then |
---|
| 282 | ! Skip first 11 lines (file header) |
---|
| 283 | !********************************** |
---|
[e200b7a] | 284 | |
---|
[b4d29ce] | 285 | call skplin(11,unitreleases) |
---|
[e200b7a] | 286 | |
---|
[b4d29ce] | 287 | ! Assign species-specific parameters needed for physical processes |
---|
| 288 | !************************************************************************* |
---|
[e200b7a] | 289 | |
---|
[b4d29ce] | 290 | read(unitreleases,*,err=998) nspec |
---|
| 291 | if (nspec.gt.maxspec) goto 994 |
---|
| 292 | if (old) call skplin(2,unitreleases) |
---|
| 293 | endif |
---|
[e200b7a] | 294 | |
---|
[b4d29ce] | 295 | ! namelist output |
---|
[8a65cb0] | 296 | if (nmlout.and.lroot) then |
---|
[b4d29ce] | 297 | write(unitreleasesout,nml=releases_ctrl) |
---|
| 298 | endif |
---|
[e200b7a] | 299 | |
---|
| 300 | do i=1,nspec |
---|
[b4d29ce] | 301 | if (readerror.ne.0) then |
---|
| 302 | read(unitreleases,*,err=998) specnum_rel(i) |
---|
| 303 | if (old) call skplin(2,unitreleases) |
---|
| 304 | call readspecies(specnum_rel(i),i) |
---|
| 305 | else |
---|
| 306 | call readspecies(specnum_rel(i),i) |
---|
| 307 | endif |
---|
[e200b7a] | 308 | |
---|
[b4d29ce] | 309 | ! For backward runs, only 1 species is allowed |
---|
| 310 | !********************************************* |
---|
[e200b7a] | 311 | |
---|
[b4d29ce] | 312 | !if ((ldirect.lt.0).and.(nspec.gt.1)) then |
---|
| 313 | !write(*,*) '#####################################################' |
---|
| 314 | !write(*,*) '#### FLEXPART MODEL SUBROUTINE READRELEASES: ####' |
---|
| 315 | !write(*,*) '#### FOR BACKWARD RUNS, ONLY 1 SPECIES IS ALLOWED####' |
---|
| 316 | !write(*,*) '#####################################################' |
---|
| 317 | ! stop |
---|
| 318 | !endif |
---|
[e200b7a] | 319 | |
---|
[b4d29ce] | 320 | ! Molecular weight |
---|
| 321 | !***************** |
---|
[e200b7a] | 322 | |
---|
[b4d29ce] | 323 | if (((iout.eq.2).or.(iout.eq.3)).and.(weightmolar(i).lt.0.)) then |
---|
[e200b7a] | 324 | write(*,*) 'For mixing ratio output, valid molar weight' |
---|
| 325 | write(*,*) 'must be specified for all simulated species.' |
---|
| 326 | write(*,*) 'Check table SPECIES or choose concentration' |
---|
| 327 | write(*,*) 'output instead if molar weight is not known.' |
---|
| 328 | stop |
---|
| 329 | endif |
---|
| 330 | |
---|
[b4d29ce] | 331 | ! Radioactive decay |
---|
| 332 | !****************** |
---|
[e200b7a] | 333 | |
---|
| 334 | decay(i)=0.693147/decay(i) !conversion half life to decay constant |
---|
| 335 | |
---|
| 336 | |
---|
[b4d29ce] | 337 | ! Dry deposition of gases |
---|
| 338 | !************************ |
---|
[e200b7a] | 339 | |
---|
[b4d29ce] | 340 | if (reldiff(i).gt.0.) rm(i)=1./(henry(i)/3000.+100.*f0(i)) ! mesophyll resistance |
---|
[e200b7a] | 341 | |
---|
[b4d29ce] | 342 | ! Dry deposition of particles |
---|
| 343 | !**************************** |
---|
[e200b7a] | 344 | |
---|
| 345 | vsetaver(i)=0. |
---|
| 346 | cunningham(i)=0. |
---|
| 347 | dquer(i)=dquer(i)*1000000. ! Conversion m to um |
---|
[b4d29ce] | 348 | if (density(i).gt.0.) then ! Additional parameters |
---|
| 349 | call part0(dquer(i),dsigma(i),density(i),fracth,schmih,cun,vsh) |
---|
[e200b7a] | 350 | do j=1,ni |
---|
| 351 | fract(i,j)=fracth(j) |
---|
| 352 | schmi(i,j)=schmih(j) |
---|
| 353 | vset(i,j)=vsh(j) |
---|
| 354 | cunningham(i)=cunningham(i)+cun*fract(i,j) |
---|
| 355 | vsetaver(i)=vsetaver(i)-vset(i,j)*fract(i,j) |
---|
| 356 | end do |
---|
[8a65cb0] | 357 | if (lroot) write(*,*) 'Average settling velocity: ',i,vsetaver(i) |
---|
[e200b7a] | 358 | endif |
---|
| 359 | |
---|
[b4d29ce] | 360 | ! Dry deposition for constant deposition velocity |
---|
| 361 | !************************************************ |
---|
[e200b7a] | 362 | |
---|
| 363 | dryvel(i)=dryvel(i)*0.01 ! conversion to m/s |
---|
| 364 | |
---|
[8a65cb0] | 365 | ! Check if wet deposition or OH reaction shall be calculated |
---|
| 366 | !*********************************************************** |
---|
[05cf28d] | 367 | |
---|
| 368 | ! ESO 04.2016 check for below-cloud scavenging (gas or aerosol) |
---|
| 369 | if ((dquer(i).le.0..and.(weta_gas(i).gt.0. .or. wetb_gas(i).gt.0.)) .or. & |
---|
| 370 | &(dquer(i).gt.0. .and. (crain_aero(i) .gt. 0. .or. csnow_aero(i).gt.0.))) then |
---|
[e200b7a] | 371 | WETDEP=.true. |
---|
[c8fc724] | 372 | WETDEPSPEC(i)=.true. |
---|
[8a65cb0] | 373 | if (lroot) then |
---|
[05cf28d] | 374 | write (*,*) ' Below-cloud scavenging: ON' |
---|
| 375 | ! write (*,*) 'Below-cloud scavenging coefficients: ',weta(i),i |
---|
[8a65cb0] | 376 | end if |
---|
[4fbe7a5] | 377 | else |
---|
[05cf28d] | 378 | if (lroot) write (*,*) ' Below-cloud scavenging: OFF' |
---|
[e200b7a] | 379 | endif |
---|
[4fbe7a5] | 380 | |
---|
[8a65cb0] | 381 | ! NIK 31.01.2013 + 10.12.2013 + 15.02.2015 |
---|
[05cf28d] | 382 | if (dquer(i).gt.0..and.(ccn_aero(i).gt.0. .or. in_aero(i).gt.0.)) then |
---|
[4fbe7a5] | 383 | WETDEP=.true. |
---|
[c8fc724] | 384 | WETDEPSPEC(i)=.true. |
---|
[8a65cb0] | 385 | if (lroot) then |
---|
[05cf28d] | 386 | write (*,*) ' In-cloud scavenging: ON' |
---|
[0f20c31] | 387 | ! write (*,*) 'In-cloud scavenging coefficients: ',& |
---|
[341f4b7] | 388 | ! &ccn_aero(i),in_aero(i),i !,wetc_in(i), wetd_in(i),i |
---|
[8a65cb0] | 389 | end if |
---|
| 390 | else |
---|
[05cf28d] | 391 | if (lroot) write (*,*) ' In-cloud scavenging: OFF' |
---|
[4fbe7a5] | 392 | endif |
---|
| 393 | |
---|
[8a65cb0] | 394 | if (ohcconst(i).gt.0.) then |
---|
[e200b7a] | 395 | OHREA=.true. |
---|
[05cf28d] | 396 | if (lroot) write (*,*) ' OHreaction switched on: ',ohcconst(i),i |
---|
[e200b7a] | 397 | endif |
---|
| 398 | |
---|
[b4d29ce] | 399 | if ((reldiff(i).gt.0.).or.(density(i).gt.0.).or.(dryvel(i).gt.0.)) then |
---|
[e200b7a] | 400 | DRYDEP=.true. |
---|
| 401 | DRYDEPSPEC(i)=.true. |
---|
| 402 | endif |
---|
| 403 | |
---|
[c8fc724] | 404 | end do ! end loop over species |
---|
[e200b7a] | 405 | |
---|
[b4d29ce] | 406 | if (WETDEP.or.DRYDEP) DEP=.true. |
---|
[e200b7a] | 407 | |
---|
| 408 | ! Read specifications for each release point |
---|
| 409 | !******************************************* |
---|
[b4d29ce] | 410 | numpoints=numpoint |
---|
[e200b7a] | 411 | numpoint=0 |
---|
| 412 | numpartmax=0 |
---|
| 413 | releaserate=0. |
---|
[b4d29ce] | 414 | 101 numpoint=numpoint+1 |
---|
| 415 | |
---|
| 416 | if (readerror.lt.1) then ! reading namelist format |
---|
| 417 | |
---|
| 418 | if (numpoint.gt.numpoints) goto 250 |
---|
| 419 | zkind = 1 |
---|
| 420 | mass = 0 |
---|
| 421 | parts = 0 |
---|
| 422 | comment = ' ' |
---|
| 423 | read(unitreleases,release,iostat=readerror) |
---|
| 424 | id1=idate1 |
---|
| 425 | it1=itime1 |
---|
| 426 | id2=idate2 |
---|
| 427 | it2=itime2 |
---|
| 428 | xpoint1(numpoint)=lon1 |
---|
| 429 | xpoint2(numpoint)=lon2 |
---|
| 430 | ypoint1(numpoint)=lat1 |
---|
| 431 | ypoint2(numpoint)=lat2 |
---|
| 432 | zpoint1(numpoint)=z1 |
---|
| 433 | zpoint2(numpoint)=z2 |
---|
| 434 | kindz(numpoint)=zkind |
---|
| 435 | do i=1,nspec |
---|
| 436 | xmass(numpoint,i)=mass(i) |
---|
| 437 | end do |
---|
| 438 | npart(numpoint)=parts |
---|
| 439 | compoint(min(1001,numpoint))=comment |
---|
| 440 | |
---|
| 441 | ! namelist output |
---|
[8a65cb0] | 442 | if (nmlout.and.lroot) then |
---|
[b4d29ce] | 443 | write(unitreleasesout,nml=release) |
---|
| 444 | endif |
---|
| 445 | |
---|
[e200b7a] | 446 | else |
---|
| 447 | |
---|
[b4d29ce] | 448 | read(unitreleases,*,end=250) |
---|
| 449 | read(unitreleases,*,err=998,end=250) id1,it1 |
---|
| 450 | if (old) call skplin(2,unitreleases) |
---|
| 451 | read(unitreleases,*,err=998) id2,it2 |
---|
| 452 | if (old) call skplin(2,unitreleases) |
---|
| 453 | read(unitreleases,*,err=998) xpoint1(numpoint) |
---|
| 454 | if (old) call skplin(2,unitreleases) |
---|
| 455 | read(unitreleases,*,err=998) ypoint1(numpoint) |
---|
| 456 | if (old) call skplin(2,unitreleases) |
---|
| 457 | read(unitreleases,*,err=998) xpoint2(numpoint) |
---|
| 458 | if (old) call skplin(2,unitreleases) |
---|
| 459 | read(unitreleases,*,err=998) ypoint2(numpoint) |
---|
| 460 | if (old) call skplin(2,unitreleases) |
---|
| 461 | read(unitreleases,*,err=998) kindz(numpoint) |
---|
| 462 | if (old) call skplin(2,unitreleases) |
---|
| 463 | read(unitreleases,*,err=998) zpoint1(numpoint) |
---|
| 464 | if (old) call skplin(2,unitreleases) |
---|
| 465 | read(unitreleases,*,err=998) zpoint2(numpoint) |
---|
| 466 | if (old) call skplin(2,unitreleases) |
---|
| 467 | read(unitreleases,*,err=998) npart(numpoint) |
---|
| 468 | if (old) call skplin(2,unitreleases) |
---|
| 469 | do i=1,nspec |
---|
| 470 | read(unitreleases,*,err=998) xmass(numpoint,i) |
---|
| 471 | if (old) call skplin(2,unitreleases) |
---|
| 472 | mass(i)=xmass(numpoint,i) |
---|
| 473 | end do |
---|
| 474 | !save compoint only for the first 1000 release points |
---|
| 475 | if (numpoint.le.1000) then |
---|
| 476 | read(unitreleases,'(a40)',err=998) compoint(numpoint)(1:40) |
---|
| 477 | comment=compoint(numpoint)(1:40) |
---|
| 478 | else |
---|
| 479 | read(unitreleases,'(a40)',err=998) compoint(1001)(1:40) |
---|
| 480 | comment=compoint(1001)(1:40) |
---|
| 481 | endif |
---|
| 482 | if (old) call skplin(1,unitreleases) |
---|
| 483 | |
---|
| 484 | ! namelist output |
---|
[8a65cb0] | 485 | if (nmlout.and.lroot) then |
---|
[b4d29ce] | 486 | idate1=id1 |
---|
| 487 | itime1=it1 |
---|
| 488 | idate2=id2 |
---|
| 489 | itime2=it2 |
---|
| 490 | lon1=xpoint1(numpoint) |
---|
| 491 | lon2=xpoint2(numpoint) |
---|
| 492 | lat1=ypoint1(numpoint) |
---|
| 493 | lat2=ypoint2(numpoint) |
---|
| 494 | z1=zpoint1(numpoint) |
---|
| 495 | z2=zpoint2(numpoint) |
---|
| 496 | zkind=kindz(numpoint) |
---|
| 497 | parts=npart(numpoint) |
---|
| 498 | write(unitreleasesout,nml=release) |
---|
| 499 | endif |
---|
| 500 | |
---|
| 501 | if (numpoint.le.1000) then |
---|
| 502 | if((xpoint1(numpoint).eq.0.).and.(ypoint1(numpoint).eq.0.).and. & |
---|
| 503 | (xpoint2(numpoint).eq.0.).and.(ypoint2(numpoint).eq.0.).and. & |
---|
| 504 | (compoint(numpoint)(1:8).eq.' ')) goto 250 |
---|
| 505 | else |
---|
| 506 | if((xpoint1(numpoint).eq.0.).and.(ypoint1(numpoint).eq.0.).and. & |
---|
| 507 | (xpoint2(numpoint).eq.0.).and.(ypoint2(numpoint).eq.0.)) goto 250 |
---|
| 508 | endif |
---|
| 509 | |
---|
| 510 | endif ! if namelist format |
---|
[e200b7a] | 511 | |
---|
| 512 | ! If a release point contains no particles, stop and issue error message |
---|
| 513 | !*********************************************************************** |
---|
| 514 | |
---|
| 515 | if (npart(numpoint).eq.0) then |
---|
| 516 | write(*,*) 'FLEXPART MODEL ERROR' |
---|
| 517 | write(*,*) 'RELEASES file is corrupt.' |
---|
| 518 | write(*,*) 'At least for one release point, there are zero' |
---|
| 519 | write(*,*) 'particles released. Make changes to RELEASES.' |
---|
| 520 | stop |
---|
| 521 | endif |
---|
| 522 | |
---|
| 523 | ! Check whether x coordinates of release point are within model domain |
---|
| 524 | !********************************************************************* |
---|
| 525 | |
---|
| 526 | if (xpoint1(numpoint).lt.xlon0) & |
---|
| 527 | xpoint1(numpoint)=xpoint1(numpoint)+360. |
---|
| 528 | if (xpoint1(numpoint).gt.xlon0+(nxmin1)*dx) & |
---|
| 529 | xpoint1(numpoint)=xpoint1(numpoint)-360. |
---|
| 530 | if (xpoint2(numpoint).lt.xlon0) & |
---|
| 531 | xpoint2(numpoint)=xpoint2(numpoint)+360. |
---|
| 532 | if (xpoint2(numpoint).gt.xlon0+(nxmin1)*dx) & |
---|
| 533 | xpoint2(numpoint)=xpoint2(numpoint)-360. |
---|
| 534 | |
---|
| 535 | ! Determine relative beginning and ending times of particle release |
---|
| 536 | !****************************************************************** |
---|
| 537 | |
---|
| 538 | jul1=juldate(id1,it1) |
---|
| 539 | jul2=juldate(id2,it2) |
---|
[f13406c] | 540 | julm=(jul1+jul2)/2. |
---|
[e200b7a] | 541 | if (jul1.gt.jul2) then |
---|
| 542 | write(*,*) 'FLEXPART MODEL ERROR' |
---|
| 543 | write(*,*) 'Release stops before it begins.' |
---|
| 544 | write(*,*) 'Make changes to file RELEASES.' |
---|
| 545 | stop |
---|
| 546 | endif |
---|
| 547 | if (mdomainfill.eq.0) then ! no domain filling |
---|
| 548 | if (ldirect.eq.1) then |
---|
| 549 | if ((jul1.lt.bdate).or.(jul2.gt.edate)) then |
---|
| 550 | write(*,*) 'FLEXPART MODEL ERROR' |
---|
| 551 | write(*,*) 'Release starts before simulation begins or ends' |
---|
| 552 | write(*,*) 'after simulation stops.' |
---|
| 553 | write(*,*) 'Make files COMMAND and RELEASES consistent.' |
---|
| 554 | stop |
---|
| 555 | endif |
---|
[f13406c] | 556 | if (npart(numpoint).gt.num_min_discrete) then |
---|
| 557 | ireleasestart(numpoint)=int((jul1-bdate)*86400.) |
---|
| 558 | ireleaseend(numpoint)=int((jul2-bdate)*86400.) |
---|
| 559 | else |
---|
| 560 | ireleasestart(numpoint)=int((julm-bdate)*86400.) |
---|
| 561 | ireleaseend(numpoint)=int((julm-bdate)*86400.) |
---|
| 562 | endif |
---|
[e200b7a] | 563 | else if (ldirect.eq.-1) then |
---|
| 564 | if ((jul1.lt.edate).or.(jul2.gt.bdate)) then |
---|
| 565 | write(*,*) 'FLEXPART MODEL ERROR' |
---|
| 566 | write(*,*) 'Release starts before simulation begins or ends' |
---|
| 567 | write(*,*) 'after simulation stops.' |
---|
| 568 | write(*,*) 'Make files COMMAND and RELEASES consistent.' |
---|
| 569 | stop |
---|
| 570 | endif |
---|
[f13406c] | 571 | if (npart(numpoint).gt.num_min_discrete) then |
---|
| 572 | ireleasestart(numpoint)=int((jul1-bdate)*86400.) |
---|
| 573 | ireleaseend(numpoint)=int((jul2-bdate)*86400.) |
---|
| 574 | else |
---|
| 575 | ireleasestart(numpoint)=int((julm-bdate)*86400.) |
---|
| 576 | ireleaseend(numpoint)=int((julm-bdate)*86400.) |
---|
| 577 | endif |
---|
[e200b7a] | 578 | endif |
---|
| 579 | endif |
---|
| 580 | |
---|
[4c64400] | 581 | |
---|
[e200b7a] | 582 | ! Determine the release rate (particles per second) and total number |
---|
| 583 | ! of particles released during the simulation |
---|
| 584 | !******************************************************************* |
---|
| 585 | |
---|
| 586 | if (ireleasestart(numpoint).ne.ireleaseend(numpoint)) then |
---|
| 587 | releaserate=releaserate+real(npart(numpoint))/ & |
---|
| 588 | real(ireleaseend(numpoint)-ireleasestart(numpoint)) |
---|
| 589 | else |
---|
| 590 | releaserate=99999999 |
---|
| 591 | endif |
---|
| 592 | numpartmax=numpartmax+npart(numpoint) |
---|
[b4d29ce] | 593 | goto 101 |
---|
[e200b7a] | 594 | |
---|
| 595 | 250 close(unitreleases) |
---|
| 596 | |
---|
[8a65cb0] | 597 | if (nmlout.and.lroot) then |
---|
[b4d29ce] | 598 | close(unitreleasesout) |
---|
| 599 | endif |
---|
| 600 | |
---|
[8a65cb0] | 601 | if (lroot) write (*,*) 'Particles allocated (maxpart) : ',maxpart |
---|
| 602 | if (lroot) write (*,*) 'Particles released (numpartmax): ',numpartmax |
---|
[e200b7a] | 603 | numpoint=numpoint-1 |
---|
| 604 | |
---|
| 605 | if (ioutputforeachrelease.eq.1) then |
---|
| 606 | maxpointspec_act=numpoint |
---|
| 607 | else |
---|
| 608 | maxpointspec_act=1 |
---|
| 609 | endif |
---|
| 610 | |
---|
[b4d29ce] | 611 | ! Check, whether the total number of particles may exceed totally allowed |
---|
| 612 | ! number of particles at some time during the simulation |
---|
| 613 | !************************************************************************ |
---|
| 614 | |
---|
[e200b7a] | 615 | if (releaserate.gt. & |
---|
| 616 | 0.99*real(maxpart)/real(lage(nageclass))) then |
---|
[8a65cb0] | 617 | if (numpartmax.gt.maxpart.and.lroot) then |
---|
[e200b7a] | 618 | write(*,*) '#####################################################' |
---|
| 619 | write(*,*) '#### FLEXPART MODEL SUBROUTINE READRELEASES: ####' |
---|
| 620 | write(*,*) '#### ####' |
---|
| 621 | write(*,*) '####WARNING - TOTAL NUMBER OF PARTICLES SPECIFIED####' |
---|
| 622 | write(*,*) '#### IN FILE "RELEASES" MAY AT SOME POINT DURING ####' |
---|
| 623 | write(*,*) '#### THE SIMULATION EXCEED THE MAXIMUM ALLOWED ####' |
---|
| 624 | write(*,*) '#### NUMBER (MAXPART).IF RELEASES DO NOT OVERLAP,####' |
---|
| 625 | write(*,*) '#### FLEXPART CAN POSSIBLY COMPLETE SUCCESSFULLY.####' |
---|
| 626 | write(*,*) '#### HOWEVER, FLEXPART MAY HAVE TO STOP ####' |
---|
| 627 | write(*,*) '#### AT SOME TIME DURING THE SIMULATION. PLEASE ####' |
---|
| 628 | write(*,*) '#### MAKE SURE THAT YOUR SETTINGS ARE CORRECT. ####' |
---|
| 629 | write(*,*) '#####################################################' |
---|
| 630 | write(*,*) 'Maximum release rate may be: ',releaserate, & |
---|
| 631 | ' particles per second' |
---|
| 632 | write(*,*) 'Maximum allowed release rate is: ', & |
---|
| 633 | real(maxpart)/real(lage(nageclass)),' particles per second' |
---|
| 634 | write(*,*) & |
---|
| 635 | 'Total number of particles released during the simulation is: ', & |
---|
| 636 | numpartmax |
---|
| 637 | write(*,*) 'Maximum allowed number of particles is: ',maxpart |
---|
| 638 | endif |
---|
| 639 | endif |
---|
| 640 | |
---|
[4c64400] | 641 | if (lroot) then |
---|
| 642 | write(*,FMT='(A,ES14.7)') ' Total mass released:', sum(xmass(1:numpoint,1:nspec)) |
---|
| 643 | end if |
---|
| 644 | |
---|
[e200b7a] | 645 | return |
---|
| 646 | |
---|
| 647 | 994 write(*,*) '#####################################################' |
---|
| 648 | write(*,*) '#### FLEXPART MODEL SUBROUTINE READRELEASES: ####' |
---|
| 649 | write(*,*) '#### ####' |
---|
| 650 | write(*,*) '#### ERROR - MAXIMUM NUMBER OF EMITTED SPECIES IS####' |
---|
| 651 | write(*,*) '#### TOO LARGE. PLEASE REDUCE NUMBER OF SPECIES. ####' |
---|
| 652 | write(*,*) '#####################################################' |
---|
| 653 | stop |
---|
| 654 | |
---|
| 655 | 998 write(*,*) '#####################################################' |
---|
| 656 | write(*,*) '#### FLEXPART MODEL SUBROUTINE READRELEASES: ####' |
---|
| 657 | write(*,*) '#### ####' |
---|
| 658 | write(*,*) '#### FATAL ERROR - FILE "RELEASES" IS ####' |
---|
| 659 | write(*,*) '#### CORRUPT. PLEASE CHECK YOUR INPUTS FOR ####' |
---|
| 660 | write(*,*) '#### MISTAKES OR GET A NEW "RELEASES"- ####' |
---|
| 661 | write(*,*) '#### FILE ... ####' |
---|
| 662 | write(*,*) '#####################################################' |
---|
| 663 | stop |
---|
| 664 | |
---|
| 665 | |
---|
| 666 | 999 write(*,*) '#####################################################' |
---|
| 667 | write(*,*) ' FLEXPART MODEL SUBROUTINE READRELEASES: ' |
---|
| 668 | write(*,*) |
---|
| 669 | write(*,*) 'FATAL ERROR - FILE CONTAINING PARTICLE RELEASE POINTS' |
---|
| 670 | write(*,*) 'POINTS IS NOT AVAILABLE OR YOU ARE NOT' |
---|
| 671 | write(*,*) 'PERMITTED FOR ANY ACCESS' |
---|
| 672 | write(*,*) '#####################################################' |
---|
| 673 | stop |
---|
| 674 | |
---|
[b4d29ce] | 675 | 1000 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "RELEASES" #### ' |
---|
| 676 | write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### ' |
---|
| 677 | write(*,'(a)') path(2)(1:length(2)) |
---|
| 678 | stop |
---|
| 679 | |
---|
[e200b7a] | 680 | end subroutine readreleases |
---|