[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 | |
---|
[5184a7c] | 76 | integer :: numpartmax,i,j,id1,it1,id2,it2,idum,stat,irel,ispc,nsettle |
---|
[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 |
---|
[5184a7c] | 80 | real,parameter :: eps2=1.e-9 |
---|
[e200b7a] | 81 | character(len=50) :: line |
---|
| 82 | logical :: old |
---|
| 83 | |
---|
[b4d29ce] | 84 | ! help variables for namelist reading |
---|
| 85 | integer :: numpoints, parts, readerror |
---|
| 86 | integer*2 :: zkind |
---|
| 87 | integer :: idate1, itime1, idate2, itime2 |
---|
| 88 | real :: lon1,lon2,lat1,lat2,z1,z2 |
---|
| 89 | character*40 :: comment |
---|
| 90 | integer,parameter :: unitreleasesout=2 |
---|
| 91 | real,allocatable, dimension (:) :: mass |
---|
| 92 | integer,allocatable, dimension (:) :: specnum_rel,specnum_rel2 |
---|
| 93 | |
---|
| 94 | ! declare namelists |
---|
| 95 | namelist /releases_ctrl/ & |
---|
[5184a7c] | 96 | nspec, & |
---|
| 97 | specnum_rel |
---|
[b4d29ce] | 98 | |
---|
| 99 | namelist /release/ & |
---|
[5184a7c] | 100 | idate1, itime1, & |
---|
| 101 | idate2, itime2, & |
---|
| 102 | lon1, lon2, & |
---|
| 103 | lat1, lat2, & |
---|
| 104 | z1, z2, & |
---|
| 105 | zkind, & |
---|
| 106 | mass, & |
---|
| 107 | parts, & |
---|
| 108 | comment |
---|
[e200b7a] | 109 | |
---|
[b4d29ce] | 110 | numpoint=0 |
---|
[e200b7a] | 111 | |
---|
[b4d29ce] | 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' |
---|
[e200b7a] | 117 | |
---|
[b4d29ce] | 118 | ! presetting namelist releases_ctrl |
---|
| 119 | 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 |
---|
[8a65cb0] | 129 | if (nmlout.and.lroot) then |
---|
| 130 | open(unitreleasesout,file=path(2)(1:length(2))//'RELEASES.namelist',access='append',status='replace',err=1000) |
---|
[e200b7a] | 131 | endif |
---|
| 132 | |
---|
[b4d29ce] | 133 | if ((readerror.ne.0).or.(nspec.lt.0)) then |
---|
[e200b7a] | 134 | |
---|
[5184a7c] | 135 | ! no namelist format, close file and allow reopening in old format |
---|
[b4d29ce] | 136 | close(unitreleases) |
---|
| 137 | open(unitreleases,file=path(1)(1:length(1))//'RELEASES',status='old',err=999) |
---|
[e200b7a] | 138 | |
---|
[b4d29ce] | 139 | readerror=1 ! indicates old format |
---|
[e200b7a] | 140 | |
---|
[5184a7c] | 141 | ! Check the format of the RELEASES file (either in free format, |
---|
| 142 | ! or using a formatted mask) |
---|
| 143 | ! Use of formatted mask is assumed if line 10 contains the word 'DIRECTION' |
---|
| 144 | !************************************************************************** |
---|
[e200b7a] | 145 | |
---|
[b4d29ce] | 146 | call skplin(12,unitreleases) |
---|
| 147 | read (unitreleases,901) line |
---|
| 148 | 901 format (a) |
---|
| 149 | if (index(line,'Total') .eq. 0) then |
---|
| 150 | old = .false. |
---|
| 151 | else |
---|
| 152 | old = .true. |
---|
| 153 | endif |
---|
| 154 | rewind(unitreleases) |
---|
[e200b7a] | 155 | |
---|
[b4d29ce] | 156 | |
---|
[5184a7c] | 157 | ! Skip first 11 lines (file header) |
---|
| 158 | !********************************** |
---|
[b4d29ce] | 159 | |
---|
| 160 | call skplin(11,unitreleases) |
---|
| 161 | |
---|
| 162 | read(unitreleases,*,err=998) nspec |
---|
| 163 | if (old) call skplin(2,unitreleases) |
---|
| 164 | do i=1,nspec |
---|
| 165 | read(unitreleases,*,err=998) specnum_rel(i) |
---|
| 166 | if (old) call skplin(2,unitreleases) |
---|
| 167 | end do |
---|
| 168 | |
---|
| 169 | numpoint=0 |
---|
| 170 | 100 numpoint=numpoint+1 |
---|
| 171 | read(unitreleases,*,end=25) |
---|
| 172 | read(unitreleases,*,err=998,end=25) idum,idum |
---|
| 173 | if (old) call skplin(2,unitreleases) |
---|
| 174 | read(unitreleases,*,err=998) idum,idum |
---|
| 175 | if (old) call skplin(2,unitreleases) |
---|
| 176 | read(unitreleases,*,err=998) xdum |
---|
| 177 | if (old) call skplin(2,unitreleases) |
---|
| 178 | read(unitreleases,*,err=998) xdum |
---|
| 179 | if (old) call skplin(2,unitreleases) |
---|
[e200b7a] | 180 | read(unitreleases,*,err=998) xdum |
---|
| 181 | if (old) call skplin(2,unitreleases) |
---|
[b4d29ce] | 182 | read(unitreleases,*,err=998) xdum |
---|
| 183 | if (old) call skplin(2,unitreleases) |
---|
| 184 | read(unitreleases,*,err=998) idum |
---|
| 185 | if (old) call skplin(2,unitreleases) |
---|
| 186 | read(unitreleases,*,err=998) xdum |
---|
| 187 | if (old) call skplin(2,unitreleases) |
---|
| 188 | read(unitreleases,*,err=998) xdum |
---|
| 189 | if (old) call skplin(2,unitreleases) |
---|
| 190 | read(unitreleases,*,err=998) idum |
---|
| 191 | if (old) call skplin(2,unitreleases) |
---|
| 192 | do i=1,nspec |
---|
| 193 | read(unitreleases,*,err=998) xdum |
---|
| 194 | if (old) call skplin(2,unitreleases) |
---|
| 195 | end do |
---|
[5184a7c] | 196 | !save compoint only for the first 1000 release points |
---|
[b4d29ce] | 197 | read(unitreleases,'(a40)',err=998) compoint(1)(1:40) |
---|
| 198 | if (old) call skplin(1,unitreleases) |
---|
| 199 | |
---|
| 200 | goto 100 |
---|
| 201 | |
---|
| 202 | 25 numpoint=numpoint-1 |
---|
| 203 | |
---|
| 204 | else |
---|
| 205 | |
---|
| 206 | readerror=0 |
---|
| 207 | do while (readerror.eq.0) |
---|
| 208 | idate1=-1 |
---|
| 209 | read(unitreleases,release,iostat=readerror) |
---|
| 210 | if ((idate1.lt.0).or.(readerror.ne.0)) then |
---|
| 211 | readerror=1 |
---|
| 212 | else |
---|
| 213 | numpoint=numpoint+1 |
---|
| 214 | endif |
---|
| 215 | end do |
---|
| 216 | readerror=0 |
---|
| 217 | endif ! if namelist input |
---|
| 218 | |
---|
| 219 | rewind(unitreleases) |
---|
| 220 | |
---|
[4c64400] | 221 | if (nspec.gt.maxspec) goto 994 |
---|
| 222 | |
---|
[b4d29ce] | 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) |
---|
[b0434e1] | 230 | deallocate(specnum_rel) |
---|
[5184a7c] | 231 | ! eso: BUG, crashes here for nspec=12 and maxspec=6, |
---|
| 232 | ! TODO: catch error and exit |
---|
[b4d29ce] | 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 | |
---|
[8a65cb0] | 266 | if (lroot) write (*,*) 'Releasepoints : ', numpoint |
---|
[b4d29ce] | 267 | |
---|
| 268 | do i=1,numpoint |
---|
| 269 | xmasssave(i)=0. |
---|
[e200b7a] | 270 | end do |
---|
| 271 | |
---|
| 272 | !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. |
---|
[c8fc724] | 279 | WETDEPSPEC(i)=.false. |
---|
[e200b7a] | 280 | end do |
---|
| 281 | |
---|
[b4d29ce] | 282 | if (readerror.ne.0) then |
---|
[5184a7c] | 283 | ! Skip first 11 lines (file header) |
---|
| 284 | !********************************** |
---|
[e200b7a] | 285 | |
---|
[b4d29ce] | 286 | call skplin(11,unitreleases) |
---|
[e200b7a] | 287 | |
---|
[5184a7c] | 288 | ! Assign species-specific parameters needed for physical processes |
---|
| 289 | !************************************************************************* |
---|
[e200b7a] | 290 | |
---|
[b4d29ce] | 291 | read(unitreleases,*,err=998) nspec |
---|
| 292 | if (nspec.gt.maxspec) goto 994 |
---|
| 293 | if (old) call skplin(2,unitreleases) |
---|
| 294 | endif |
---|
[e200b7a] | 295 | |
---|
[b4d29ce] | 296 | ! namelist output |
---|
[8a65cb0] | 297 | if (nmlout.and.lroot) then |
---|
[b4d29ce] | 298 | write(unitreleasesout,nml=releases_ctrl) |
---|
| 299 | endif |
---|
[e200b7a] | 300 | |
---|
| 301 | do i=1,nspec |
---|
[b4d29ce] | 302 | if (readerror.ne.0) then |
---|
| 303 | read(unitreleases,*,err=998) specnum_rel(i) |
---|
| 304 | if (old) call skplin(2,unitreleases) |
---|
| 305 | call readspecies(specnum_rel(i),i) |
---|
| 306 | else |
---|
| 307 | call readspecies(specnum_rel(i),i) |
---|
| 308 | endif |
---|
[e200b7a] | 309 | |
---|
[5184a7c] | 310 | ! For backward runs, only 1 species is allowed |
---|
| 311 | !********************************************* |
---|
[e200b7a] | 312 | |
---|
[5184a7c] | 313 | !if ((ldirect.lt.0).and.(nspec.gt.1)) then |
---|
| 314 | !write(*,*) '#####################################################' |
---|
| 315 | !write(*,*) '#### FLEXPART MODEL SUBROUTINE READRELEASES: ####' |
---|
| 316 | !write(*,*) '#### FOR BACKWARD RUNS, ONLY 1 SPECIES IS ALLOWED####' |
---|
| 317 | !write(*,*) '#####################################################' |
---|
| 318 | ! stop |
---|
| 319 | !endif |
---|
[e200b7a] | 320 | |
---|
[5184a7c] | 321 | ! Molecular weight |
---|
| 322 | !***************** |
---|
[e200b7a] | 323 | |
---|
[b4d29ce] | 324 | if (((iout.eq.2).or.(iout.eq.3)).and.(weightmolar(i).lt.0.)) then |
---|
[e200b7a] | 325 | write(*,*) 'For mixing ratio output, valid molar weight' |
---|
| 326 | write(*,*) 'must be specified for all simulated species.' |
---|
| 327 | write(*,*) 'Check table SPECIES or choose concentration' |
---|
| 328 | write(*,*) 'output instead if molar weight is not known.' |
---|
| 329 | stop |
---|
| 330 | endif |
---|
| 331 | |
---|
[5184a7c] | 332 | ! Radioactive decay |
---|
| 333 | !****************** |
---|
[e200b7a] | 334 | |
---|
| 335 | decay(i)=0.693147/decay(i) !conversion half life to decay constant |
---|
| 336 | |
---|
| 337 | |
---|
[5184a7c] | 338 | ! Dry deposition of gases |
---|
| 339 | !************************ |
---|
[e200b7a] | 340 | |
---|
[b4d29ce] | 341 | if (reldiff(i).gt.0.) rm(i)=1./(henry(i)/3000.+100.*f0(i)) ! mesophyll resistance |
---|
[e200b7a] | 342 | |
---|
[5184a7c] | 343 | ! Dry deposition of particles |
---|
| 344 | !**************************** |
---|
[e200b7a] | 345 | |
---|
| 346 | vsetaver(i)=0. |
---|
| 347 | cunningham(i)=0. |
---|
| 348 | dquer(i)=dquer(i)*1000000. ! Conversion m to um |
---|
[b4d29ce] | 349 | if (density(i).gt.0.) then ! Additional parameters |
---|
| 350 | call part0(dquer(i),dsigma(i),density(i),fracth,schmih,cun,vsh) |
---|
[e200b7a] | 351 | 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) |
---|
| 357 | end do |
---|
[8a65cb0] | 358 | if (lroot) write(*,*) 'Average settling velocity: ',i,vsetaver(i) |
---|
[e200b7a] | 359 | endif |
---|
| 360 | |
---|
[5184a7c] | 361 | ! Dry deposition for constant deposition velocity |
---|
| 362 | !************************************************ |
---|
[e200b7a] | 363 | |
---|
| 364 | dryvel(i)=dryvel(i)*0.01 ! conversion to m/s |
---|
| 365 | |
---|
[8a65cb0] | 366 | ! Check if wet deposition or OH reaction shall be calculated |
---|
| 367 | !*********************************************************** |
---|
[05cf28d] | 368 | |
---|
| 369 | ! 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 |
---|
[e200b7a] | 372 | WETDEP=.true. |
---|
[c8fc724] | 373 | WETDEPSPEC(i)=.true. |
---|
[8a65cb0] | 374 | if (lroot) then |
---|
[05cf28d] | 375 | write (*,*) ' Below-cloud scavenging: ON' |
---|
[5184a7c] | 376 | ! write (*,*) 'Below-cloud scavenging coefficients: ',weta(i),i |
---|
[8a65cb0] | 377 | end if |
---|
[4fbe7a5] | 378 | else |
---|
[05cf28d] | 379 | if (lroot) write (*,*) ' Below-cloud scavenging: OFF' |
---|
[e200b7a] | 380 | endif |
---|
[5184a7c] | 381 | |
---|
| 382 | ! NIK 31.01.2013 + 10.12.2013 + 15.02.2015 |
---|
[05cf28d] | 383 | if (dquer(i).gt.0..and.(ccn_aero(i).gt.0. .or. in_aero(i).gt.0.)) then |
---|
[4fbe7a5] | 384 | WETDEP=.true. |
---|
[c8fc724] | 385 | WETDEPSPEC(i)=.true. |
---|
[8a65cb0] | 386 | if (lroot) then |
---|
[05cf28d] | 387 | write (*,*) ' In-cloud scavenging: ON' |
---|
[5184a7c] | 388 | ! write (*,*) 'In-cloud scavenging coefficients: ',& |
---|
| 389 | ! &ccn_aero(i),in_aero(i),i !,wetc_in(i), wetd_in(i),i |
---|
[8a65cb0] | 390 | end if |
---|
| 391 | else |
---|
[05cf28d] | 392 | if (lroot) write (*,*) ' In-cloud scavenging: OFF' |
---|
[4fbe7a5] | 393 | endif |
---|
| 394 | |
---|
[8a65cb0] | 395 | if (ohcconst(i).gt.0.) then |
---|
[e200b7a] | 396 | OHREA=.true. |
---|
[05cf28d] | 397 | if (lroot) write (*,*) ' OHreaction switched on: ',ohcconst(i),i |
---|
[e200b7a] | 398 | endif |
---|
| 399 | |
---|
[b4d29ce] | 400 | if ((reldiff(i).gt.0.).or.(density(i).gt.0.).or.(dryvel(i).gt.0.)) then |
---|
[e200b7a] | 401 | DRYDEP=.true. |
---|
| 402 | DRYDEPSPEC(i)=.true. |
---|
| 403 | endif |
---|
| 404 | |
---|
[c8fc724] | 405 | end do ! end loop over species |
---|
[e200b7a] | 406 | |
---|
[b4d29ce] | 407 | if (WETDEP.or.DRYDEP) DEP=.true. |
---|
[e200b7a] | 408 | |
---|
| 409 | ! Read specifications for each release point |
---|
| 410 | !******************************************* |
---|
[b4d29ce] | 411 | numpoints=numpoint |
---|
[e200b7a] | 412 | numpoint=0 |
---|
| 413 | numpartmax=0 |
---|
| 414 | releaserate=0. |
---|
[5184a7c] | 415 | 101 numpoint=numpoint+1 |
---|
[b4d29ce] | 416 | |
---|
| 417 | if (readerror.lt.1) then ! reading namelist format |
---|
| 418 | |
---|
| 419 | if (numpoint.gt.numpoints) goto 250 |
---|
| 420 | zkind = 1 |
---|
| 421 | mass = 0 |
---|
| 422 | parts = 0 |
---|
| 423 | comment = ' ' |
---|
| 424 | read(unitreleases,release,iostat=readerror) |
---|
| 425 | id1=idate1 |
---|
| 426 | it1=itime1 |
---|
| 427 | id2=idate2 |
---|
| 428 | it2=itime2 |
---|
| 429 | xpoint1(numpoint)=lon1 |
---|
| 430 | xpoint2(numpoint)=lon2 |
---|
| 431 | ypoint1(numpoint)=lat1 |
---|
| 432 | ypoint2(numpoint)=lat2 |
---|
| 433 | zpoint1(numpoint)=z1 |
---|
| 434 | zpoint2(numpoint)=z2 |
---|
| 435 | kindz(numpoint)=zkind |
---|
| 436 | do i=1,nspec |
---|
| 437 | xmass(numpoint,i)=mass(i) |
---|
| 438 | end do |
---|
| 439 | npart(numpoint)=parts |
---|
| 440 | compoint(min(1001,numpoint))=comment |
---|
| 441 | |
---|
[5184a7c] | 442 | ! namelist output |
---|
[8a65cb0] | 443 | if (nmlout.and.lroot) then |
---|
[b4d29ce] | 444 | write(unitreleasesout,nml=release) |
---|
| 445 | endif |
---|
| 446 | |
---|
[e200b7a] | 447 | else |
---|
| 448 | |
---|
[b4d29ce] | 449 | read(unitreleases,*,end=250) |
---|
| 450 | read(unitreleases,*,err=998,end=250) id1,it1 |
---|
| 451 | if (old) call skplin(2,unitreleases) |
---|
| 452 | read(unitreleases,*,err=998) id2,it2 |
---|
| 453 | if (old) call skplin(2,unitreleases) |
---|
| 454 | read(unitreleases,*,err=998) xpoint1(numpoint) |
---|
| 455 | if (old) call skplin(2,unitreleases) |
---|
| 456 | read(unitreleases,*,err=998) ypoint1(numpoint) |
---|
| 457 | if (old) call skplin(2,unitreleases) |
---|
| 458 | read(unitreleases,*,err=998) xpoint2(numpoint) |
---|
| 459 | if (old) call skplin(2,unitreleases) |
---|
| 460 | read(unitreleases,*,err=998) ypoint2(numpoint) |
---|
| 461 | if (old) call skplin(2,unitreleases) |
---|
| 462 | read(unitreleases,*,err=998) kindz(numpoint) |
---|
| 463 | if (old) call skplin(2,unitreleases) |
---|
| 464 | read(unitreleases,*,err=998) zpoint1(numpoint) |
---|
| 465 | if (old) call skplin(2,unitreleases) |
---|
| 466 | read(unitreleases,*,err=998) zpoint2(numpoint) |
---|
| 467 | if (old) call skplin(2,unitreleases) |
---|
| 468 | read(unitreleases,*,err=998) npart(numpoint) |
---|
| 469 | if (old) call skplin(2,unitreleases) |
---|
| 470 | do i=1,nspec |
---|
| 471 | read(unitreleases,*,err=998) xmass(numpoint,i) |
---|
| 472 | if (old) call skplin(2,unitreleases) |
---|
| 473 | mass(i)=xmass(numpoint,i) |
---|
| 474 | end do |
---|
[5184a7c] | 475 | !save compoint only for the first 1000 release points |
---|
[b4d29ce] | 476 | if (numpoint.le.1000) then |
---|
| 477 | read(unitreleases,'(a40)',err=998) compoint(numpoint)(1:40) |
---|
| 478 | comment=compoint(numpoint)(1:40) |
---|
| 479 | else |
---|
| 480 | read(unitreleases,'(a40)',err=998) compoint(1001)(1:40) |
---|
| 481 | comment=compoint(1001)(1:40) |
---|
| 482 | endif |
---|
| 483 | if (old) call skplin(1,unitreleases) |
---|
| 484 | |
---|
[5184a7c] | 485 | ! namelist output |
---|
[8a65cb0] | 486 | if (nmlout.and.lroot) then |
---|
[b4d29ce] | 487 | idate1=id1 |
---|
| 488 | itime1=it1 |
---|
| 489 | idate2=id2 |
---|
| 490 | itime2=it2 |
---|
| 491 | lon1=xpoint1(numpoint) |
---|
| 492 | lon2=xpoint2(numpoint) |
---|
| 493 | lat1=ypoint1(numpoint) |
---|
| 494 | lat2=ypoint2(numpoint) |
---|
| 495 | z1=zpoint1(numpoint) |
---|
| 496 | z2=zpoint2(numpoint) |
---|
| 497 | zkind=kindz(numpoint) |
---|
| 498 | parts=npart(numpoint) |
---|
| 499 | write(unitreleasesout,nml=release) |
---|
| 500 | endif |
---|
| 501 | |
---|
| 502 | 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 |
---|
| 506 | 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 |
---|
| 509 | endif |
---|
| 510 | |
---|
| 511 | endif ! if namelist format |
---|
[e200b7a] | 512 | |
---|
| 513 | ! If a release point contains no particles, stop and issue error message |
---|
| 514 | !*********************************************************************** |
---|
| 515 | |
---|
| 516 | if (npart(numpoint).eq.0) then |
---|
| 517 | write(*,*) 'FLEXPART MODEL ERROR' |
---|
| 518 | write(*,*) 'RELEASES file is corrupt.' |
---|
| 519 | write(*,*) 'At least for one release point, there are zero' |
---|
| 520 | write(*,*) 'particles released. Make changes to RELEASES.' |
---|
| 521 | stop |
---|
| 522 | endif |
---|
| 523 | |
---|
[8ee24a5] | 524 | ! If FLEXPART is run for backward deposition force zpoint |
---|
| 525 | !********************************************************************* |
---|
| 526 | if (WETBKDEP) then |
---|
[5184a7c] | 527 | zpoint1(numpoint)=0. |
---|
| 528 | zpoint2(numpoint)=20000. |
---|
| 529 | kindz(numpoint)=1 |
---|
[8ee24a5] | 530 | endif |
---|
| 531 | if (DRYBKDEP) then |
---|
[5184a7c] | 532 | zpoint1(numpoint)=0. |
---|
| 533 | zpoint2(numpoint)=2.*href |
---|
| 534 | kindz(numpoint)=1 |
---|
[8ee24a5] | 535 | endif |
---|
| 536 | |
---|
| 537 | |
---|
[e200b7a] | 538 | ! Check whether x coordinates of release point are within model domain |
---|
| 539 | !********************************************************************* |
---|
| 540 | |
---|
[5184a7c] | 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. |
---|
[e200b7a] | 549 | |
---|
| 550 | ! Determine relative beginning and ending times of particle release |
---|
| 551 | !****************************************************************** |
---|
| 552 | |
---|
| 553 | jul1=juldate(id1,it1) |
---|
| 554 | jul2=juldate(id2,it2) |
---|
[f13406c] | 555 | julm=(jul1+jul2)/2. |
---|
[e200b7a] | 556 | if (jul1.gt.jul2) then |
---|
| 557 | write(*,*) 'FLEXPART MODEL ERROR' |
---|
| 558 | write(*,*) 'Release stops before it begins.' |
---|
| 559 | write(*,*) 'Make changes to file RELEASES.' |
---|
| 560 | stop |
---|
| 561 | endif |
---|
| 562 | if (mdomainfill.eq.0) then ! no domain filling |
---|
| 563 | if (ldirect.eq.1) then |
---|
| 564 | if ((jul1.lt.bdate).or.(jul2.gt.edate)) 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 | else if (ldirect.eq.-1) then |
---|
| 579 | if ((jul1.lt.edate).or.(jul2.gt.bdate)) then |
---|
| 580 | write(*,*) 'FLEXPART MODEL ERROR' |
---|
| 581 | write(*,*) 'Release starts before simulation begins or ends' |
---|
| 582 | write(*,*) 'after simulation stops.' |
---|
| 583 | write(*,*) 'Make files COMMAND and RELEASES consistent.' |
---|
| 584 | stop |
---|
| 585 | endif |
---|
[f13406c] | 586 | if (npart(numpoint).gt.num_min_discrete) then |
---|
| 587 | ireleasestart(numpoint)=int((jul1-bdate)*86400.) |
---|
| 588 | ireleaseend(numpoint)=int((jul2-bdate)*86400.) |
---|
| 589 | else |
---|
| 590 | ireleasestart(numpoint)=int((julm-bdate)*86400.) |
---|
| 591 | ireleaseend(numpoint)=int((julm-bdate)*86400.) |
---|
| 592 | endif |
---|
[e200b7a] | 593 | endif |
---|
| 594 | endif |
---|
| 595 | |
---|
[4c64400] | 596 | |
---|
[e200b7a] | 597 | ! Determine the release rate (particles per second) and total number |
---|
| 598 | ! of particles released during the simulation |
---|
| 599 | !******************************************************************* |
---|
| 600 | |
---|
| 601 | if (ireleasestart(numpoint).ne.ireleaseend(numpoint)) then |
---|
| 602 | releaserate=releaserate+real(npart(numpoint))/ & |
---|
| 603 | real(ireleaseend(numpoint)-ireleasestart(numpoint)) |
---|
| 604 | else |
---|
| 605 | releaserate=99999999 |
---|
| 606 | endif |
---|
| 607 | numpartmax=numpartmax+npart(numpoint) |
---|
[b4d29ce] | 608 | goto 101 |
---|
[e200b7a] | 609 | |
---|
[5184a7c] | 610 | 250 close(unitreleases) |
---|
[e200b7a] | 611 | |
---|
[8a65cb0] | 612 | if (nmlout.and.lroot) then |
---|
[b4d29ce] | 613 | close(unitreleasesout) |
---|
| 614 | endif |
---|
| 615 | |
---|
[8a65cb0] | 616 | if (lroot) write (*,*) 'Particles allocated (maxpart) : ',maxpart |
---|
| 617 | if (lroot) write (*,*) 'Particles released (numpartmax): ',numpartmax |
---|
[e200b7a] | 618 | numpoint=numpoint-1 |
---|
| 619 | |
---|
| 620 | if (ioutputforeachrelease.eq.1) then |
---|
| 621 | maxpointspec_act=numpoint |
---|
| 622 | else |
---|
| 623 | maxpointspec_act=1 |
---|
| 624 | endif |
---|
| 625 | |
---|
[5184a7c] | 626 | ! Disable settling if more than 1 species at any release point |
---|
| 627 | ! or if MQUASILAG and more than one species |
---|
| 628 | !************************************************************* |
---|
| 629 | |
---|
| 630 | if (mquasilag.ne.0) then |
---|
| 631 | if (nspec.gt.1) lsettling=.false. |
---|
| 632 | else |
---|
| 633 | do irel=1,numpoint |
---|
| 634 | nsettle=0 |
---|
| 635 | do ispc=1,nspec |
---|
| 636 | if (xmass(irel,ispc).gt.eps2) nsettle=nsettle+1 |
---|
| 637 | end do |
---|
| 638 | if (nsettle.gt.1) lsettling=.false. |
---|
| 639 | end do |
---|
| 640 | end if |
---|
| 641 | |
---|
| 642 | if (lroot) then |
---|
| 643 | if (.not.lsettling) then |
---|
| 644 | write(*,*) 'WARNING: more than 1 species per release point, settling & |
---|
| 645 | &disabled' |
---|
| 646 | end if |
---|
| 647 | end if |
---|
| 648 | |
---|
[b4d29ce] | 649 | ! Check, whether the total number of particles may exceed totally allowed |
---|
| 650 | ! number of particles at some time during the simulation |
---|
| 651 | !************************************************************************ |
---|
| 652 | |
---|
[e200b7a] | 653 | if (releaserate.gt. & |
---|
| 654 | 0.99*real(maxpart)/real(lage(nageclass))) then |
---|
[8a65cb0] | 655 | if (numpartmax.gt.maxpart.and.lroot) then |
---|
[5184a7c] | 656 | write(*,*) '#####################################################' |
---|
| 657 | write(*,*) '#### FLEXPART MODEL SUBROUTINE READRELEASES: ####' |
---|
| 658 | write(*,*) '#### ####' |
---|
| 659 | write(*,*) '####WARNING - TOTAL NUMBER OF PARTICLES SPECIFIED####' |
---|
| 660 | write(*,*) '#### IN FILE "RELEASES" MAY AT SOME POINT DURING ####' |
---|
| 661 | write(*,*) '#### THE SIMULATION EXCEED THE MAXIMUM ALLOWED ####' |
---|
| 662 | write(*,*) '#### NUMBER (MAXPART).IF RELEASES DO NOT OVERLAP,####' |
---|
| 663 | write(*,*) '#### FLEXPART CAN POSSIBLY COMPLETE SUCCESSFULLY.####' |
---|
| 664 | write(*,*) '#### HOWEVER, FLEXPART MAY HAVE TO STOP ####' |
---|
| 665 | write(*,*) '#### AT SOME TIME DURING THE SIMULATION. PLEASE ####' |
---|
| 666 | write(*,*) '#### MAKE SURE THAT YOUR SETTINGS ARE CORRECT. ####' |
---|
| 667 | write(*,*) '#####################################################' |
---|
[e200b7a] | 668 | write(*,*) 'Maximum release rate may be: ',releaserate, & |
---|
| 669 | ' particles per second' |
---|
| 670 | write(*,*) 'Maximum allowed release rate is: ', & |
---|
| 671 | real(maxpart)/real(lage(nageclass)),' particles per second' |
---|
| 672 | write(*,*) & |
---|
| 673 | 'Total number of particles released during the simulation is: ', & |
---|
| 674 | numpartmax |
---|
| 675 | write(*,*) 'Maximum allowed number of particles is: ',maxpart |
---|
| 676 | endif |
---|
| 677 | endif |
---|
| 678 | |
---|
[5184a7c] | 679 | |
---|
[4c64400] | 680 | if (lroot) then |
---|
| 681 | write(*,FMT='(A,ES14.7)') ' Total mass released:', sum(xmass(1:numpoint,1:nspec)) |
---|
| 682 | end if |
---|
| 683 | |
---|
[e200b7a] | 684 | return |
---|
| 685 | |
---|
[5184a7c] | 686 | 994 write(*,*) '#####################################################' |
---|
[e200b7a] | 687 | write(*,*) '#### FLEXPART MODEL SUBROUTINE READRELEASES: ####' |
---|
| 688 | write(*,*) '#### ####' |
---|
| 689 | write(*,*) '#### ERROR - MAXIMUM NUMBER OF EMITTED SPECIES IS####' |
---|
| 690 | write(*,*) '#### TOO LARGE. PLEASE REDUCE NUMBER OF SPECIES. ####' |
---|
| 691 | write(*,*) '#####################################################' |
---|
| 692 | stop |
---|
| 693 | |
---|
[5184a7c] | 694 | 998 write(*,*) '#####################################################' |
---|
[e200b7a] | 695 | write(*,*) '#### FLEXPART MODEL SUBROUTINE READRELEASES: ####' |
---|
| 696 | write(*,*) '#### ####' |
---|
| 697 | write(*,*) '#### FATAL ERROR - FILE "RELEASES" IS ####' |
---|
| 698 | write(*,*) '#### CORRUPT. PLEASE CHECK YOUR INPUTS FOR ####' |
---|
| 699 | write(*,*) '#### MISTAKES OR GET A NEW "RELEASES"- ####' |
---|
| 700 | write(*,*) '#### FILE ... ####' |
---|
| 701 | write(*,*) '#####################################################' |
---|
| 702 | stop |
---|
| 703 | |
---|
| 704 | |
---|
[5184a7c] | 705 | 999 write(*,*) '#####################################################' |
---|
[e200b7a] | 706 | write(*,*) ' FLEXPART MODEL SUBROUTINE READRELEASES: ' |
---|
| 707 | write(*,*) |
---|
| 708 | write(*,*) 'FATAL ERROR - FILE CONTAINING PARTICLE RELEASE POINTS' |
---|
| 709 | write(*,*) 'POINTS IS NOT AVAILABLE OR YOU ARE NOT' |
---|
| 710 | write(*,*) 'PERMITTED FOR ANY ACCESS' |
---|
| 711 | write(*,*) '#####################################################' |
---|
| 712 | stop |
---|
| 713 | |
---|
[b4d29ce] | 714 | 1000 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "RELEASES" #### ' |
---|
| 715 | write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### ' |
---|
| 716 | write(*,'(a)') path(2)(1:length(2)) |
---|
| 717 | stop |
---|
| 718 | |
---|
[e200b7a] | 719 | end subroutine readreleases |
---|