1 PROGRAM AERMOD 2 !*********************************************************************** 3 ! MAIN Module of the AMS/EPA Regulatory Model - AERMOD 4 ! (DRAFT Version Dated 04300) 5 ! 6 ! *** SEE AERMOD MODEL CHANGE BULLETIN MCB#X *** 7 ! 8 ! ON THE SUPPORT CENTER FOR REGULATORY AIR MODELS (SCRAM) WEBSITE 9 ! 10 ! http://www.epa.gov/scram001/ 11 ! 12 !======================================================================= 13 ! 14 ! This DRAFT version (dated 04300) includes the Plume Volume Molar 15 ! Ratio Method (PVMRM) and the Ozone Limiting Method (OLM) for 16 ! modeling conversion of NOx to NO2. This work was supported by 17 ! BP Exploration (Alaska), Inc., Phillips Exploration, Inc., 18 ! and the Alaska Department of Environmental Conservation. 19 ! 20 ! This DRAFT version (dated 04300) also includes the following 21 ! modifications: 22 ! 23 ! 1. Dry depletion (DRYDPLT) and wet depletion (WETDPLT) are no 24 ! longer optional for deposition applications. These options 25 ! for removal of mass from the plume due to dry and/or wet 26 ! deposition processes will automatically be invoked for 27 ! applications in which dry and/or wet deposition are 28 ! considered. The DRYDPLT and WETDPLT options on the 29 ! MODELOPT card will be ignored, and need not be removed 30 ! from the model input file for the model to run. 31 ! 32 ! 2. Correction made to area source algorithm, subroutine PLUMEF, 33 ! to include a call to CRITDS to calculate the critical 34 ! dividing streamline height for gaseous pollutants. Also 35 ! modified PLUMEF to correct a problem with the AREADPLT option. 36 ! 37 ! 3. Corrections made to area source and openpit algorithms, 38 ! in subroutines ACALC and OCALC, to include tilted plume 39 ! for point source approximation of particle emissions, and 40 ! to include reinitialization of __VAL arrays at end of 41 ! receptor loop (reinitializations also included in PCALC and 42 ! VCALC for point and volume sources for consistency). The 43 ! latter correction fixes a potential problem with particle 44 ! emissions for area sources when the point source 45 ! approximation is used under the TOXICS option. 46 ! 47 ! 4. Corrected calling arguments for call to WAKE_SIG from 48 ! subroutine WAKE_DFSN2, to use wakiz and wakiy instead of 49 ! turbz and turby. 50 ! 51 ! 5. Minor correction made to wet deposition calculations to 52 ! include lateral term (FSUBY) in weighting of direct 53 ! and penetrated source contributions for WETFLUX. 54 ! 55 ! 6. Modified suroutine PRMCALC to place receptor on centerline 56 ! of cavity plumes by setting Y2 = 0.0 for SCREEN option. 57 ! 58 ! 7. Modified subroutine SRCQA to calculate equivalent XINIT 59 ! and YINIT values for AREAPOLY sources to allow for 60 ! calculation of area of source under TOXICS option and 61 ! for PVMRM option. Also modified SRCQA to include a more 62 ! refined computation of centroid for AREAPOLY sources. 63 ! 64 ! 8. Included check in subroutine METQA for absolute values of 65 ! Monin-Obukhov length (OBULEN) less than 1.0. Adjustment 66 ! of OBULEN is made to limit ABS(OBULEN) .GE. 1.0. The 67 ! sign of OBULEN is assigned the opposite of the sign of the 68 ! heat flux if OBULEN is 0.0. This limit on OBULEN is 69 ! already applied in AERMET, so this change in AERMOD will 70 ! only affect input data generated by other means. 71 ! 72 ! 9. Moved call to SUB. METDAT ahead of call to SUB. SET_METDATA 73 ! to avoid potential problem with negative (missing) 74 ! precipitation for first hour. 75 ! 76 ! 10. Added range check on gas deposition parameters to trap 77 ! on input of zero (0.0) values. 78 ! 79 ! 11. Modified subroutine METQA to reduce number of extraneous 80 ! warning messages, especially for hours with missing 81 ! meteorological data. Also modified range check for missing 82 ! wind direction in subroutine CHKMSG. 83 ! 84 ! 12. Modified PLOTFILE output to include date field. 85 ! 86 ! 13. Modifications to some debug output statements based on 87 ! code provided by ENSR. 88 ! 89 ! MODIFIED BY: Roger W. Brode 90 ! MACTEC Federal Programs, Inc. 91 ! (formerly known as PES, Inc.) 92 ! October 26, 2004 93 ! 94 ! MODIFIED FROM: AERMOD 95 ! (Version Dated 04079) 96 ! 97 !======================================================================= 98 ! 99 ! This revised DRAFT version (dated 04079) incorporates 100 ! modifications to the wet deposition algorithms for both 101 ! gaseous and particle emissions. For both gaseous and particle 102 ! wet deposition, the wet fluxes have been corrected to include 103 ! a factor of 3600.*SQRT(2*PI) in the denominator. The factor 104 ! of 3600 was needed to correct a unit conversion error between 105 ! seconds and hours in the final calculation of the flux. 106 ! The factor of SQRT(2*PI) is needed to complete the integrated 107 ! vertical term. A problem causing potential runtime errors for 108 ! volume and area sources with dry depletion was also corrected. 109 ! 110 ! In addition to the corrections identified above, the particle 111 ! wet deposition algorithms were also modified to include an 112 ! algorithm for calculating the collision efficiency as a function 113 ! of particle size and raindrop size. The previous version of 114 ! the model included a fixed value of 4.0e-4 for the collision 115 ! efficiency. 116 ! 117 ! 118 ! MODIFIED BY: Roger W. Brode 119 ! MACTEC Federal Programs, Inc. 120 ! (formerly known as PES, Inc.) 121 ! March 19, 2004 122 ! 123 ! MODIFIED FROM: AERMOD 124 ! (Version Dated 03273) 125 ! 126 !======================================================================= 127 ! 128 ! This DRAFT version (dated 03273) incorporates wet and dry 129 ! deposition algorithms based on the draft ANL report (Wesely, 130 ! et. al, 2001), with modifications to the wet deposition 131 ! algorithms based on peer review comments. The dry deposition 132 ! algorithms include dry depletion based on the simple source 133 ! depletion method. 134 ! 135 ! NOTE: The wet SCIM'ing and output by particle size options 136 ! from the ISCST3 model have not been implemented yet in AERMOD. 137 ! 138 ! This version includes the following modifications relative to 139 ! the previous draft (dated 03213): 140 ! 141 ! 1. Removed depletion for the "inside cavity source" from the 142 ! PRIME calculations. 143 ! 144 ! 2. Moved the code to adjust for TS < TA (used to model a fixed 145 ! delta TS-TA) from SUBROUTINE SETSRC back to SUBROUTINE 146 ! FLUXES. This corrects some minor discrepancies between 147 ! the consequence analysis results for non-buoyant sources 148 ! relative to version 02222. 149 ! 150 ! 3. Removed the dry particle deposition code associated with 151 ! DFAULT mode in ISCST3. The only dry particle deposition 152 ! in AERMOD is based on the ANL report for Methods 1 and 2. 153 ! This also corrects a logic problem if neither TOXICS nor 154 ! DFAULT options are specified. 155 ! 156 ! 4. Modified FUNCTION F2INT to only call DELTAH for point 157 ! sources during plume depletion calculation. 158 ! 159 ! 5. Added identification of urban sources and Method 2 sources 160 ! in summary of source inputs. 161 ! 162 ! 6. Included optional dry depletion option for Method 2. 163 ! 164 ! 7. Additional code cleanup and documentatino, including removal 165 ! of unused data arrays associated with ISCST3 depletion code 166 ! and moving the call to SUBROUTINE METINI to follow the call 167 ! to SETSRC in SUBROUTINE OCALC for open pit sources. 168 ! 169 ! 170 ! Version 03213 (August 1, 2003) included the following 171 ! modifications relative to the previous draft (dated 03171): 172 ! 173 ! 1. Corrects problem with calculation of f2 term used in gas 174 ! dry deposition. The calculation of Wnew and f2 had to be 175 ! moved outside the source loop to properly account for 176 ! accumulated precipitation over three hour period. 177 ! 178 ! 2. Changed the definition of the "top of the plume" to be based 179 ! on the plume centerline height plus 2.15*sigma-z, evaluated 180 ! at 20km downwind. The previous definition was based on 181 ! 3.9*sigma-z. 182 ! 183 ! 3. Terrain effects are now incorporated in the dry depletion 184 ! calculation. The terrain elevation is linearly interpolated 185 ! between the source base elevation and the terrain elevation 186 ! at the receptor. The hill height scale is linearly 187 ! interpolated between the stack release height at the 188 ! source and the hill height scale from AERMAP at the receptor 189 ! location. 190 ! 191 ! 4. Modified the short-term EVENT processing option to be 192 ! compatible with the deposition algorithms. If more than 193 ! one output type is selected in the normal model run that 194 ! generates the EVENT input file, the events will be defined 195 ! based on the first output type, in the order of CONC, DEPOS, 196 ! DDEP, WDEP. 197 ! 198 ! 5. Modified summary of first 24-hours of met data to include 199 ! additional parameters for deposition applications. 200 ! 201 ! 6. Modified the program to use free-formatted READ for the 202 ! surface meteorological input file for all cases. Decision 203 ! on whether to read additional parameters needed for deposition 204 ! is based on logical variables associated with deposition 205 ! calculations. 206 ! 207 ! 7. Incorporated a patch in SUBROUTINE UNLUMP of PRIME.FOR to 208 ! avoid potential math error for downwash calculations. 209 ! The plume temperature calculated by NUMRISE is limited to 210 ! be greater than or equal to the ambient temperature minus 211 ! 10 K. This avoids a potential SQRT of a negative number. 212 ! 213 ! MODIFIED BY: Roger W. Brode 214 ! MACTEC Federal Programs, Inc. 215 ! (formerly known as PES, Inc.) 216 ! September 30, 2003 217 ! 218 ! MODIFIED FROM: AERMOD 219 ! (Version Dated 02222) 220 ! 221 !======================================================================= 222 ! 223 ! This DRAFT version (dated 02222) includes fixes to the following 224 ! bugs: 225 ! 226 ! 1) modification to ACALC to avoid potential math errors 227 ! for AREAPOLY sources; 228 ! 2) correction to METSUM to output missing temperatures correctly 229 ! for the SCIM option; 230 ! 3) correction to EMVARY to replace 'STAR' option with 231 ! 'WSPEED' option; 232 ! 4) modified CAV_SRC to keep "outside" cavity source in array 233 ! element 3 for cases when no "inside" cavity source contribution 234 ! occurs; 235 ! 5) corrected meander algorithm to combine "plume" and 236 ! "pancake" components of concentrations rather than just 237 ! blending the lateral dispersion term, removed limit on pancake 238 ! term to be smaller than plume lateral term, and removed meander 239 ! from the PRIME component for sources subject to building 240 ! downwash; 241 ! 6) corrected problem in NUMRISE to avoid referencing an 242 ! undefined variable (xbi); 243 ! 7) corrected calling arguments for call to WAKE_SIG from 244 ! subroutine WAKE_DFSN, to use wakiz and wakiy instead of 245 ! turbz, and turby; and 246 ! 8) correction of Z_iuo in subroutine URBCALC from 500 to 400 247 ! meters. 248 ! 249 ! Modified to remove command line arguments for specifying 250 ! input and output file names, and use hardwired names of 251 ! AERMOD.INP and AERMOD.OUT. 252 ! 253 ! This version includes an adjustment to ustar and L for urban stable 254 ! cases, by equating the "convective" sigma-w based on the urban 255 ! "convective" w* with the mechanical sigma-w based on u* 256 ! evaluated at a height of 7 times the urban roughness length. 257 ! The URBANOPT keyword was modified to allow the user to input 258 ! the urban roughness length as an optional parameter following 259 ! the optional city name. If no urban roughness length is input, 260 ! then the model assumes an urban roughness length of 1.0 meter. 261 ! 262 ! This version also includes a modification to the minimum layer 263 ! depth near the ground used to calculate effective parameters. 264 ! A minimum layer depth of 5 meters is used instead of 2 meters 265 ! if the plume centroid height and receptor height are both below 266 ! 5 meters. 267 ! 268 ! MODIFIED BY: Roger W. Brode 269 ! PES, Inc. 270 ! September 10, 2002 271 ! 272 ! MODIFIED FROM: AERMOD 273 ! (Version Dated 01247) 274 ! 275 !======================================================================= 276 ! 277 ! This draft version (dated 01247) includes the PRIME building 278 ! downwash algorithms based on the ISC-PRIME model (dated 99207). 279 ! For cases involving building downwash, the model calculates a 280 ! non-wake contribution using the AERMOD algorithms, a wake 281 ! contribution using the PRIME algorithms, and blends the two 282 ! results using a factor called GAMFACT that varies based on the 283 ! location of the receptor relative to the wake. For receptors 284 ! within the wake region, where the lateral and vertical boundaries 285 ! are defined by the wake half-width and height, respectively, and 286 ! the longitudinal boundary is defined by a distance equal to 15R 287 ! or the point where wake turbulence intensity decays to ambient 288 ! turbulence intensity, whichever is greater, measured from the 289 ! upwind edge of the building, GAMFACT is set equal to 1.0 (i.e., 290 ! uses the PRIME result only). The PRIME algorithm has been 291 ! modified to use the AERMOD meteorological profiles and 292 ! definitions of ambient turbulence. 293 ! 294 ! This version also includes a modification to the DTHETA/DZ 295 ! profile (TEMPGRID.FOR) for extrapolating above the highest 296 ! measurement height for cases with observed temperature profiles, 297 ! a modification to the upper limit on the integration for 298 ! HCRIT (CALC2.FOR), a correction to the calculation of FYPAN 299 ! for meander (CALC2.FOR), and an adjustment to ISTRT_WIND used 300 ! for Y2K compliance to subtract 1 from ISTRT_WIND in case the 301 ! meteorological data file contains data from the end of the 302 ! previous year. 303 ! 304 ! MODIFIED BY: Roger W. Brode 305 ! PES, Inc. 306 ! September 4, 2001 307 ! 308 ! MODIFIED FROM: AERMOD 309 ! (Version Dated 00357) 310 ! 311 !======================================================================= 312 ! 313 ! This version (dated 00357) includes enhancements based on the 314 ! current ISCST3 model (dated 00101). These include: 1) the use of 315 ! globally allocatable arrays for data storage; 2) expanded data 316 ! structures to allow for output of concentration and deposition in 317 ! a single model run (for use when deposition algorithms are added 318 ! to AERMOD); 3) EVENT processing for short-term culpability analyses; 319 ! 4) post-1997 PM10 processing; 5) TOXICS option enhancements such as 320 ! optimizations for area sources, the SCIM option, and SEASONHR output 321 ! file option; 6) explicit treatment of multiple-year meteorological 322 ! data files and ANNUAL averages; 7) the SHRDOW and SHRDOW7 options 323 ! for specifying emissions that vary by season, hour-of-day, and 324 ! day-of-week; and 8) improved data structures for field length and 325 ! filename lengths. 326 ! 327 ! The following modifications have also been made to correct errors: 328 ! 1) the PARAMETER LAMDAY was implicitly typed as integer in previous 329 ! versions, and is now explicitly typed as real, which has an impact 330 ! on the plume height calculations for the indirect source; 2) the 331 ! calculation of the plume centroid height for unstable conditions 332 ! for area sources was moved from SUB. ACALC to be included inside 333 ! the area source integration in SUB. PLUMEF and SUB. PWIDTH, which 334 ! affects results for area sources during unstable conditions, 335 ! especially for receptors located inside an elongated area source 336 ! with the wind blowing along the long dimension of the source; and 337 ! 3) the STABLE and UNSTAB logical variables are now assigned prior 338 ! to the call to COMPTG in SUB. METEXT, potentially affecting the 339 ! observed DTHETA/DZ profile for the first stable hour in a day; 340 ! 4) the calculation of wind direction (WDIR) at stack top in SUB. 341 ! METINI and at stack height plus 0.5*deltaH in SUB. PCALC was 342 ! corrected to account for possible 0-360 crossover in the profile; 343 ! 5) corrections were made to the vertical terms to correct the 344 ! reflection component for receptors located below stack base elevation; 345 ! 6) corrected calculation of FYPAN term for meander in SUB. FYTERM 346 ! to use radial distance (DISTR) instead of downwind distance (X); and 347 ! 7) application of meander to both stable and unstable conditions. 348 ! Additional modifications were made to consolidate redundant code 349 ! and simplify future maintenance activities. 350 ! 351 ! MODIFIED BY: Roger W. Brode 352 ! PES, Inc. 353 ! December 22, 2000 354 ! 355 ! MODIFIED FROM: AERMOD 356 ! (Version Dated 99351) 357 ! 358 !======================================================================== 359 ! 360 ! (Version Dated 99351) 361 ! December 17, 1999 362 ! 363 ! This version (99351) includes the following corrections to the 364 ! implementation of the Schulman-Scire downwash algorithm: 1) added 365 ! call to DHPSS in calculation of plume centroid height (CENTER) in 366 ! subroutine PCALC; and 2) modified to use SZ3LB and SY3LB based on 367 ! building enhanced dispersion curves only in subroutine DHPSS. 368 ! Additional modifications were made to improve consistency with 369 ! ISCST3 implementation of Schulman-Scire downwash algorithm. 370 ! Also includes changes to subroutine PCCODE to facilitate 371 ! compilation of the model using the DEC Visual Fortran compiler. 372 ! The output file unit number, IOUNIT, was also changed from 6 to 9 373 ! in order for runtime status update to appear on the screen for 374 ! DEC-compiled executables. Minor, inconsequential changes were 375 ! also made to comment headers and variable declarations in 376 ! SIGGRID.FOR. 377 ! 378 ! 379 ! MODIFIED FROM: 380 ! (Version Dated 99211) 381 ! July 30, 1999 382 ! 383 !======================================================================== 384 ! 385 ! This version (99211) incorporates modifications for Y2K compliance. 386 ! Uses a window of 1950 to 2049 for 2-digit years. Will utilize 387 ! 4-digit year if input for surface and profile files using FREE 388 ! format (the default read format still reads a 2-digit year). 389 ! Changes also include calculation of a 10-digit date variable 390 ! (FULLDATE) with 4-digit year for date comparisons, and changes of 391 ! the output formats for the 8-digit variable, KURDAT, to I8.8 to 392 ! include leading zeros. The date and time routines used for the 393 ! page headers have been modified to use the standard Fortran 90 394 ! routines, and minor changes have been made to remove obsolescent 395 ! features from the code. Changes also include a correction to 396 ! a variable name in SUBROUTINE DELTAH. 397 ! 398 ! 399 ! MODIFIED FROM: 400 ! (Version Dated 98314) 401 ! November 10, 1998 402 ! 403 !======================================================================== 404 ! 405 ! This version (dated 98314) incorporates modifications for the final 406 ! draft AERMOD Model. This draft represents the final version of the 407 ! model prior to the Notice of Proposed Rulemaking for including 408 ! AERMOD in the modeling Guideline and subsequent public comment period. 409 ! Changes to the model are too numerous to list here in detail. 410 ! Changes to the interface are incorporated in the revised 411 ! AERMOD user's guide, and pertain primarily to the regulatory 412 ! default option on the CO MODELOPT card, and removal of the 413 ! developmental options for terrain affects. The CO TERRHGTS 414 ! keyword is now obsolete, and a new mandatory ME PROFBASE 415 ! keyword has been added for inputting the base elevation above 416 ! MSL for the gridded potential temperature profile. 417 ! 418 ! 419 ! MODIFIED FROM: 420 ! (Version Dated 98022) 421 ! January 22, 1998 422 ! 423 !======================================================================== 424 ! 425 ! This version (dated 98022) incorporates modifications for the revised 426 ! draft AERMOD Model. This draft represents the final Phase I version 427 ! of the model. This version includes the use a minimum sigma-v of 428 ! 0.2 m/s. It also incorporates corrections to the downwash algorithms. 429 ! It limits the number of iterations on inhomogeneity to 1, 430 ! i.e., effective parameters are calculated based on an average 431 ! for the layer from plume centerline to 2.15 sigma-z, where 432 ! sigma-z is based on parameters at plume centerline height. 433 ! The transport wind direction is based on the modpoint between 434 ! stack height and "final" plume height. Modifications have also 435 ! been made to the dtheta/dz profile, the Tly and Tlz used for stable 436 ! plumes above the CBL, and the height of the effective reflecting 437 ! surface for stable plumes. 438 ! 439 ! 440 ! MODIFIED FROM: 441 ! (Version Dated 97350) 442 ! December 16, 1997 443 ! 444 !======================================================================== 445 ! 446 ! This draft includes an option for specifying the transport wind 447 ! direction. The option is specified on the MODELOPT card, where 448 ! WDOPT1 is for wind direction taken at stack height, and 449 ! WDOPT2 is for wind direction at the midpoint between stack height 450 ! and "final" plume height. The default option is WDOPT1. 451 ! This version does not include conditional compilation code to 452 ! support the Microsoft Fortran compiler. This version of the 453 ! code is compatible with the Lahey F77L3 and Lahey LF/90 compilers. 454 ! The deposition algorithm for AERMOD is still under development, 455 ! and is not operational in this version. 456 ! R.W. Brode, PES, Inc., December 16, 1997 457 ! 458 ! 459 ! MODIFIED FROM: 460 ! (Version Dated 97064) 461 ! March 5, 1997 462 ! 463 !======================================================================== 464 ! 465 ! Incorporates modifications for second round of Beta Testing, 466 ! including code clean-up and removing obsolete options. Since 467 ! the urban stable boundary layer algorithm in AERMOD is still 468 ! under development, the keywords for implementing the urban 469 ! option in AERMOD have been disabled for this revised draft 470 ! Beta release of the model. 471 ! R.W. Brode, PES, Inc., March 5, 1997 472 ! 473 ! MODIFIED FROM: 474 ! (Version Dated 96239) 475 ! August 26, 1996 476 ! 477 !======================================================================== 478 ! 479 ! Includes modification to wind direction gridded profiling in 480 ! SUB. GRDWD, correcting a problem with wind directions backing 481 ! through 360 degrees. This could result in a level of observed 482 ! wind direction being erroneously counted as missing. 483 ! R.W. Brode, PES, Inc., August 26, 1996 484 ! 485 ! MODIFIED FROM: 486 ! (Version Dated 96228) 487 ! August 15, 1996 488 ! 489 !======================================================================== 490 ! 491 ! Includes modifications for low wind/low turbulence cases. Also 492 ! changed definition of "valid lower bound" to be 7zo instead of 493 ! 20zo for consistency with recent changes to AERMET. The terrain 494 ! options have also been reinstated on the CO MODELOPT card as 495 ! TERROPT1 and TERROPT2. The command line developmental option 496 ! switch has been enabled in this version. 497 ! R.W. Brode, PES, Inc., August 15, 1996 498 ! 499 ! MODIFIED FROM: 500 ! 501 ! (Version Dated 96198) 502 ! July 16, 1996 503 ! 504 !======================================================================== 505 ! 506 ! Includes Urban Boundary Layer Option based on the Model Coding 507 ! Abstract by Akula Ventkatram dated 4/1/96. Modified inputs 508 ! include two new keywords: 509 ! 510 ! CO URBANOPT Urbpop (Urbnam) 511 ! where Urbpop is the population of the urban area, and 512 ! Urbnam is an optional character field 513 ! for the name of the urban area. 514 ! 515 ! SO URBANSRC Srcid's and/or Srcrng's 516 ! where Srcid's identifies individual sources to be 517 ! modeled as urban sources, and Srcrng's 518 ! identifies a range of sources to be modeled 519 ! as urban. 520 ! 521 ! 522 ! MODIFIED FROM: 523 ! (Version Dated 96131) 524 ! May 10, 1996 525 ! 526 ! Includes OPTG3 and OPTG4 for stable plume reflection options. 527 ! 528 ! MODIFIED FROM: 529 ! (Version Dated 96053) 530 ! February 22, 1996 531 ! 532 ! Includes flow vector, AFV, in the EVALFILE output. 533 ! 534 ! MODIFIED FROM: 535 ! (Version Dated 96046) 536 ! February 15, 1996 537 ! 538 ! Includes new sigma-v and sigma-w profiles coded by Bob Paine, 539 ! some modifications to TEMPGRID.FOR to avoid discontinuities in 540 ! the VPTG profile, reinstates command-line input for developmental 541 ! options for the Lahey version, modifies the default option settings 542 ! to remove stable plume reflections, reinstates the original stable 543 ! profile for TLz, increases the maximum number of iterations in 544 ! IBLVAL from 5 to 20, and includes patches for smoothed h < 0 and 545 ! for mixing heights at (or near) 5,000m. 546 ! R.W. Brode, PES, Inc., February 15, 1996 547 ! 548 ! MODIFIED FROM: 549 ! (Version Dated 95272) 550 ! 551 ! Includes a SCREEN mode option on CO MODELOPT card, 552 ! addition of AREAPOLY and AREACIRC source types, 553 ! and INCLUDED keyword option for including data from 554 ! an external file for the SO and RE pathways. The 555 ! INCLUDED option is intended as a link to AERMAP and 556 ! for use with the screening version of AERMOD. 557 ! 558 ! MODIFIED FROM: 559 ! (Version Dated 95188) 560 ! 561 ! Hardcoded option settings for the Beta release of AERMOD. 562 ! 563 ! MODIFIED FROM: 564 ! (Version Dated 95066) 565 ! 566 ! "Optionized" version of AERMOD for Developmental Evaluation. 567 ! Developmental options are selected by use of an additional 568 ! 10-character command line argument, e.g. '1213121111'. 569 ! If the additional command line argument is not present, then 570 ! the model will default to the Base Model. This is equivalent 571 ! to using an additional command line argument of '1111111111'. 572 ! Note that the single quotes are not included on the command line. 573 ! R.W. Brode, PES, Inc., January 27, 1995 574 ! 575 ! Version 95066 includes a few minor fixes, some modifications to 576 ! the EVALFILE output, and the volume source option (mostly untested). 577 ! The fixes affect the SBL plume reflection option (OPTG2), and two of 578 ! the inhomogeneity options (OPTD2 and OPTD3). In the latter cases, 579 ! the effective wind speed was allowed to be less than the effective 580 ! sigma-w. Also, included EVALCART receptors with DISCCART receptors 581 ! for output purposes (RECTABLE, DAYTABLE, etc., and INPSUM.FOR). 582 ! R.W. Brode, PES, Inc., February 16, 1995 583 ! 584 ! Base Case Model for AERMOD Developmental Evaluation - 12/8/94 585 ! 586 ! MODIFIED FROM: ISC2 Short Term Model - ISCST2 587 ! (Version Dated 93109) 588 ! 589 ! MODIFIED FROM: (Version Dated 92273) 590 ! 591 ! MODIFIED FROM: (Version Dated 92062) 592 ! 593 ! PURPOSE: Controls Overall Flow and Processing of ISCST2 Model 594 ! 595 ! PROGRAMMED BY: Roger W. Brode 596 ! James O. Paumier 597 ! Jayant A. Hardikar 598 ! Pacific Environmental Services, Inc. 599 ! P.O. Box 12077 600 ! Research Triangle Park, North Carolina 27709 601 ! 602 ! DATE: November 9, 1993 603 ! 604 ! INPUTS: Command Line Options 605 ! 606 ! OUTPUTS: Model Results 607 ! 608 !======================================================================== 609 ! 610 ! Variable Declarations 611 USE MAIN1 612 IMPLICIT NONE 613 CHARACTER MODNAM*12 614 615 INTEGER :: I , IDSTAT 616 SAVE 617 618 ! Variable Initializations 619 MODNAM = 'MAIN' ! 7 620 FATAL = .FALSE. 621 RUNERR = .FALSE. 622 623 ! Open the Temporary File for Error Messages Generated from the Program 624 OPEN (UNIT=IERUNT,FILE='ERRMSG.TMP',STATUS='REPLACE') 625 626 !CLC Command line arguments removed. Use AERMOD.INP and AERMOD.OUT. 627 !CLC Retrieve Input and Output File Names From Command Line, 628 !CLC --- CALL GETCOM 629 !CL CALL GETCOM (' AERMOD ',ILEN_FLD,INPFIL,OUTFIL) 630 631 ! Open Input and Output Files --- CALL FILOPN 632 CALL FILOPN 633 634 ! Preprocess Setup Information to Determine Data Storage Needs 635 CALL PRESET 636 637 IF ( .NOT.EVONLY ) THEN 638 ! OPEN The Temporary File to Store Events for EVENT File; 639 OPEN (UNIT=ITEVUT,FILE='EVENT.TMP',STATUS='REPLACE') ! 3 640 ! Initialize the Event Counter 641 IEVENT = 0 642 ENDIF 643 644 ! Allocate SETUP Array Storage 645 CALL ALLSETUP ! 3 646 647 ! Variable Initializations --- CALL VARINI 648 CALL VARINI 649 650 ! Process The Model Setup Information --- CALL SETUP 651 IF ( EVONLY ) THEN 652 CALL EV_SETUP ! 0 653 ELSE 654 CALL SETUP ! 3 655 ENDIF 656 657 ! Open file with PVMRM debugging output 658 IF ( DEBUG .AND. PVMRM ) THEN ! 3 659 OPEN (50,FILE='PVMRM.TXT',STATUS='REPLACE') ! 0 660 WRITE (50,9001) 661 9001 FORMAT (8X,'DATE',3X,'IREC SRCID',6X,'DISTDOM',4X,'MAXCONC',2X,& 662 & 'NUMCONT O3CONC',6X,'O3MOLES',5X,'NOXMOLES',4X, & 663 & 'BHORIZ',6X,'BVERT',4X,'PLUMEVOL',3X,'PercentNO2') 664 ENDIF 665 666 ! Write the model options and debug data template to the 667 ! debug file if MODEL is specified 668 IF ( DEBUG ) THEN ! 3 669 ! Write the title(s) to the debug output file 670 WRITE (DBGUNT,100) TITLE1 , TITLE2 ! 0 671 100 FORMAT (' Title: ',A68,/' ',A68/) 672 ! Write the model options (MODOPS) to the output file 673 WRITE (DBGUNT,200) (MODOPS(I),I=1,18) 674 200 FORMAT (' OPTIONS: ',/18(1X,A6),/) 675 676 WRITE (DBGUNT,600) 677 600 FORMAT (/' NOTE: The Vert. Terms and associated', & 678 & ' CHIs are from the LIFT calculations!!!'/) 679 680 ENDIF 681 682 ! Open file for GDEP output from gas dry deposition algorithms 683 IF ( LDGAS ) OPEN (UNIT=100,FILE='GDEP.DAT',STATUS='REPLACE') ! 3 684 685 ! Open file for PDEP output from particle dry deposition algorithms 686 IF ( LDPART ) OPEN (UNIT=101,FILE='PDEP.DAT',STATUS='REPLACE') 687 688 ! Deallocate Temporary Storage 689 DEALLOCATE (IWRK2,STAT=IDSTAT) 690 IF ( IDSTAT.NE.0 ) THEN 691 WRITE (DUMMY,'(I8)') IDSTAT ! 0 692 CALL ERRHDL(PATH,MODNAM,'E','298',DUMMY) 693 ENDIF 694 IF ( .NOT.EVONLY ) THEN ! 3 695 DEALLOCATE (ZETMP1,ZETMP2,ZHTMP1,ZHTMP2,ZFTMP1,ZFTMP2, & 696 & STAT=IDSTAT) 697 IF ( IDSTAT.NE.0 ) THEN 698 WRITE (DUMMY,'(I8)') IDSTAT ! 0 699 CALL ERRHDL(PATH,MODNAM,'E','298',DUMMY) 700 ENDIF 701 ENDIF 702 703 ! Allocate Array Storage for Results 704 CALL ALLRESULT ! 3 705 706 ! Determine Number of Setup Messages by Message Type --- CALL TERRST 707 CALL TERRST 708 709 ! --- Set up common for PRIME numerical rise algorithm --- CALL NUMPR1 710 CALL NUMPR1 711 712 ! --- Set up common for PRIME building cavity model --- CALL PRIME1 713 CALL PRIME1 714 715 IF ( .NOT.RUN .OR. FATAL .OR. IWRN.GT.0 ) THEN 716 ! Write Out Summary Of Setup Error/Message Stats --- CALL SUMTBL 717 WRITE (IOUNIT,9111) ! 1 718 9111 FORMAT (//2X,'*** Message Summary For AERMOD Model Setup ***'/) 719 CALL SUMTBL 720 ENDIF 721 722 IF ( FATAL ) THEN ! 3 723 WRITE (*,99111) ! 1 724 99111 FORMAT ('+','Fatal Error Occurred During Setup Phase!') 725 WRITE (IOUNIT,9112) 726 9112 FORMAT (/4X,'**************************************',/4X, & 727 & '*** SETUP Finishes UN-successfully ***',/4X, & 728 & '**************************************'/) 729 ELSE 730 WRITE (IOUNIT,9113) ! 2 731 9113 FORMAT (/1X,'***********************************',/1X, & 732 & '*** SETUP Finishes Successfully ***',/1X, & 733 & '***********************************'/) 734 ENDIF 735 736 ! Print Summary of the Input Data --- CALL INPSUM 737 CALL INPSUM ! 3 738 739 ! Write Headers to GDEP.DAT and PDEP.DAT Files for new deposition algorithms 740 IF ( LDGAS ) THEN 741 WRITE (100,9901) ! 0 742 9901 FORMAT (1X,'YYMMDDHH',3X,'ISRC',4X,'Ra',12X,'Rb',12X,'Rc',12X, & 743 & 'Vdepg') 744 ENDIF 745 IF ( LDPART ) THEN ! 3 746 WRITE (101,9902) ! 0 747 9902 FORMAT (1X,'YYMMDDHH',3X,'ISRC',1X,'ICAT',2X,'Method No.',3X, & 748 & 'Ra',12X,'Rp',12X,'Vg(i)',9x,'Vdep(i)') 749 ENDIF 750 751 IF ( .NOT.FATAL .AND. RUN .AND. EVONLY ) THEN ! 3 752 ! No Fatal Errors in Setup and RUN Option Selected and EVENT Processing 753 754 ! Process The Data For Each Event --- CALL EVLOOP 755 CALL EVLOOP ! 0 756 757 ELSEIF ( .NOT.FATAL .AND. RUN .AND. .NOT.EVONLY ) THEN 758 ! No Fatal Errors in Setup and RUN Option Selected and Normal Processing 759 760 ! Reinitialize Results Arrays With Zeroes --- CALL RESINI 761 CALL RESINI ! 2 762 763 ! Initialize Results Arrays from Re-start File --- CALL RSINIT 764 IF ( RSTINP ) CALL RSINIT 765 766 ! Process The Hourly Meteorological Data --- CALL HRLOOP 767 CALL HRLOOP 768 769 IF ( (ANNUAL .OR. PM10AVE) .AND. .NOT.RUNERR ) THEN 770 ! Compute averages of the high-fourth-high 24-hr and annual values 771 IF ( NUMYRS.GT.0 ) THEN ! 0 772 DO IGRP = 1 , NUMGRP ! 0 773 DO IREC = 1 , NUMREC ! 0 774 IF ( PM10AVE ) SUMH4H(IREC,IGRP) & 775 & = SUMH4H(IREC,IGRP)/NUMYRS 776 IF ( ANNUAL ) THEN 777 DO ITYP = 1 , NUMTYP ! 0 778 ANNVAL(IREC,IGRP,ITYP) & 779 & = SUMANN(IREC,IGRP,ITYP)/NUMYRS 780 ENDDO 781 ENDIF 782 ENDDO 783 ENDDO 784 ELSE 785 ! Write Error Message: Number of Years = 0. 786 CALL ERRHDL(PATH,MODNAM,'E','480','NUMYRS=0') ! 0 787 RUNERR = .TRUE. 788 ENDIF 789 IF ( NREMAIN.NE.0 ) THEN ! 0 790 ! Write Warning Message: Met Data Remains After End of Last Year 791 WRITE (DUMMY,'(I8)') NREMAIN ! 0 792 CALL ERRHDL(PATH,MODNAM,'W','485',DUMMY) 793 ENDIF 794 ENDIF 795 796 IF ( (PERIOD .OR. ANNUAL) .AND. (.NOT.RUNERR) .AND. & 797 & NTOTHRS.GT.0 ) THEN 798 ! PERIOD Average Selected and No Runtime/Meteorology Errors 799 ! Calculate Period Average Concentrations --- CALL PERAVE 800 IF ( CONC .AND. PERIOD ) CALL PERAVE ! 2 801 DO ITYP = 1 , NUMTYP 802 ! Select Highest PERIOD Values by Source Group --- CALL HIPER 803 CALL HIPER ! 2 804 ENDDO 805 ! Write PERIOD/ANNUAL Results to Post File --- CALL PSTANN 806 IF ( ANPOST ) CALL PSTANN ! 2 807 ! Write PERIOD/ANNUAL Results to Plot File --- CALL PLTANN 808 IF ( ANPLOT ) CALL PLTANN 809 ENDIF 810 811 IF ( SEASONHR .AND. .NOT.RUNERR ) THEN ! 2 812 IF ( CONC ) CALL SHAVE ! 0 813 ENDIF 814 815 ! Write Short Term High Values to Plot File --- CALL PLOTFL 816 IF ( PLFILE .AND. (.NOT.RUNERR) ) CALL PLOTFL ! 2 817 818 ! Print Out Model Results --- CALL OUTPUT 819 IF ( .NOT.RUNERR ) CALL OUTPUT 820 821 ENDIF 822 823 CALL HEADER ! 3 824 WRITE (IOUNIT,9114) 825 9114 FORMAT (/1X,'*** Message Summary : AERMOD Model Execution ***'/) 826 ! Determine Number of Errors/Messages by Message Type --- CALL TERRST 827 CALL TERRST 828 ! Write Summary of Message Stats for Model Execution --- CALL SUMTBL 829 CALL SUMTBL 830 831 IF ( FATAL .OR. RUNERR ) THEN 832 WRITE (IOUNIT,9115) ! 1 833 9115 FORMAT (/4X,'***************************************',/4X, & 834 & '*** AERMOD Finishes UN-successfully ***',/4X, & 835 & '***************************************'/) 836 ELSE 837 WRITE (IOUNIT,9116) ! 2 838 9116 FORMAT (/4X,'************************************',/4X, & 839 & '*** AERMOD Finishes Successfully ***',/4X, & 840 & '************************************'/) 841 ENDIF 842 843 IF ( ERRLST ) THEN ! 3 844 ! OPEN and Write Out Permanent Error Message File --- CALL MSGWRT 845 OPEN (UNIT=IERWRT,FILE=MSGFIL,STATUS='REPLACE', & 846 & FORM='FORMATTED') 847 CALL MSGWRT 848 CLOSE (IERWRT) 849 ENDIF 850 851 ! Close and Delete The Error Message And EVENT Temporary Files 852 CLOSE (IERUNT,STATUS='DELETE') ! 3 853 CLOSE (ITEVUT,STATUS='DELETE') 854 855 CONTINUE 856 END
HyperKWIC - Version 1.00DD executed at 20:00 on 1 Mar 2018 | Personal or Academic or Evaluation User | Free for Non-Commercial, Non-Government Use