AERMOD

[ Home | Homework | ]


Links for the 2018 course:

The EPA recommended air quality dispersion models are AERMOD and CALPUFF:  https://www.epa.gov/scram/air-quality-dispersion-modeling-preferred-and-recommended-models

AERMOD Model Dynamics, Physics & Parameterizations:  See AERMOD Model Formulation (2018):
https://www3.epa.gov/ttn/scram/models/aermod/aermod_mfed.pdf
We will discuss this in class, so that AERMOD is not a "black box" to you. 
There are 3 major sections below, for installing and testing:
A. AERMOD
B. AERMET
C. AERMAP



A. AERMOD Instalation Methods (2018) for your laptop or desktop computer:
  1. If you have a PC, you don't need to compile any code first.  Instead, you can download the existing executables.

    1. Use Windows Explorer to create a new directory C:\AERMOD .

    2. See "Model Code" to get the appropriate executable from https://www.epa.gov/scram/air-quality-dispersion-modeling-preferred-and-recommended-models#aermod .  Unzip it and copy the executable aermod.exe into your AERMOD subdirectory.

    3. Also see the "Installation Guide"  info at https://www.epa.gov/scram/air-quality-dispersion-modeling-preferred-and-recommended-models#aermod

  2. If you have a Mac, and if you are lucky, you can download executables for AERMOD, AERMET, and AERMAP that I compiled in July 2018 on my iMac.  You can find them in the zip file here .  Put the zip file on your Desktop, and unzip it.  To see if it works, skip step 3 below and go to the major section below that says "Check that AERMOD runs OK on your Computer."
    However, AERMOD is often updated, and Apple produces new operating systems.  So it is very likely that many of you with different Macs and different OSX versions will be unlucky.  (Sorry, please don't contact me because I will NOT provide support for these programs.)  In that case, see item 3 next.

  3. If you have a Mac, and you are NOT lucky, then you need to (a) download the iTerm2 terminal program, (b) download Xcode, (c) run Xcode and allow it to install the additional components when prompted, (d) install MacPorts, (e) download the fortran compiler to your Mac; (f) download the AERMOD source code and associated files; and (g) compile the code on your Mac.  Seems complicated, but I will guide you through it. 

    1. If you don't already have iTerm2 on your Mac, use your browser to search on "iTerm2".  Then download this free terminal program and install it.

    2. Check to see if you already have a fortran95 compiler on your Mac.  In your iTerm2, type  which gfortran .  If one already exists on your computer then the path to it will be displayed.  Or, you might already have it, but it might be an old version.  On your terminal, type gfortran --version .  I used GNU Fortran (GCC) 6.3.0 for all the work described below.  If you already have it, or if you have an older or newer version that works OK when you try to use it, then skip step c below.

    3. To install gfortran, follow the instructions in Tips to Install gfortran on your Mac  , but ...
      • Update to step 1 in that installation guide: use https:// instead of http://
      • Update to step 13 in that installation guide: use https:// instead of http://
      • Update to step 15: if your Mac is worried about the unidentified developer, another trick to open it is to option-click on the package.  This step might not be neeeded if you Mac happily opened the file.

    4. If you want to test your gfortran compiler with your own short fortran program, try this.  (But not needed for the aermod installation.)
    1. Using your web browser,

    2. Use iTerm2, and type the cd command to move into the "aermod_source" directory.  For example, if you had downloaded the airmod.zip file to your Desktop and unzipped it there, then the following command should put you in the correct directory.

      cd ~/Desktop/aermod_source

      To confirm you are in the right directory, type ls in your terminal window.  It should display a bunch of fortran files (i.e., files with the suffix ".f". 
    3. Next, copy and paste the following command in your iTerm, and hit the enter key to compile the aermod model.  This command should be as one very long line (it will automatically word wrap in iTerm).  
      It might take a long time to compile (a minute or so depending on the speed of your Mac) during which time nothing seems to happen in iTerm.  Please be patient and drink your coffee.

      gfortran -o aermod.x -fbounds-check -fcheck=all -Wall -frecursive -O3 modules.f aermod.f setup.f coset.f soset.f reset.f meset.f ouset.f inpsum.f metext.f iblval.f siggrid.f tempgrid.f windgrid.f calc1.f calc2.f prise.f prime.f sigmas.f pitarea.f output.f evset.f evcalc.f evoutput.f uninam.f -w

    4. When it is finished compiling, your normal prompt line will appear in your terminal.  If errors happened, then you will see lots of other stuff too.  Hopefully you don't see lots of other stuff.

      To confirm that aermod compled successfully, type ls into your terminal.  Among the list of all the files, you should also see a new file aermod.x , which is the executable file.   Congratulations.

Check that AERMOD runs OK on your Computer

  1. If you have a PC, here is an excellent SampleRun guide provided by EPA: https://www3.epa.gov/ttn/scram/models/aermod/SampleRun.pdf
    1. use  Windows Explorer to create a subdirectory:  C:\AERMOD\sample

    2. From
      https://www.epa.gov/scram/air-quality-dispersion-modeling-preferred-and-recommended-models#aermod

      download and save the Installation Guide (Sample Run) "Sample Run Instructions" pdf to your sample subdirectory.
       
    3. Then download the SampleRun.zip file into the same subdirectory, C:\AERMOD\sample .   Unzip it .
    4. use  Windows Explorer to create a new subdirectory (i.e., a new empty folder):

        C:\AERMOD\tryme
       
    5. Use Windows Explorer to move a COPY of the following 4 input files from your C:\AERMOD\sample\SampleRun directory into your  tryme  directory: 
      aermod.inp
       
      aermet2.sfc
      aermet2.pfl
      aertest_evt.inp     

      Also move a COPY of aermod.exe into that  tryme  directory.  These 5 files (4 inputs & 1 executable) should be the ONLY 5 files in your tryme subdirectory. 
    6. Open the Command Prompt window (i.e., the old DOS command-line window) on your PC.  (Hint: Start|All Programs|Accessories|Command Prompt ).  This will probably display a prompt on your screen of C:\Docuents and Settings\YOURNAME>_ .

    7. Then, use the cd command in the window to navigate to be in your tryme subdirectory.  For example, type: cd \aermod\tryme .  If this was successful, the prompt on your screen will now be C:\AERMOD\tryme> .
    8. At this command prompt, type DIR and the enter key.  It should display the names and other info about the 5 files in that tryme directory.  Namely, it should show the 5 files that were discussed in item (e) above.  You are doing this just to confirm that you have all the files you need for this run.

    9. Then, run AERMOD by typing  aermod.exe and the enter key  into your Command Prompt window.  Hopefully it runs, and produces new output file(s) in your tryme directory, which you can see by typing DIR enter .  Hopefully one of the new files produce is aermod.out .   (If your executable didn't run, then try typing only  aermod or only  AERMOD to get it to run.)

    10. Back in Windows Explorer, open the tryme folder to see what files are in it, and use your normal text editing programs to view all the input files and all the output files.  Please do this to learn more about input and output to/from aermod.
    11. The most important output is in your aermod.out file.  Normal text edit programs will word-wrap the output making it difficult to read.  However, you can read aermod.out into a Microsoft Word document, and then reformat it to be Landscape orientation, font size 8 points, and reduce all the margins by about half their initial values.  This also takes advantage of the page-breaks that are already in the aermod.out file.  The result is many pages (about 33 when I did it), but is very readable.  You can save it as a Word.doc , or print it into a pdf file.

    12. Some hints are in the Sample Run Instructions.pdf that you downloaded, but they have set up their directories slightly different than I suggested here.  Also, note that you need to enter DOS commands into the Command Prompt window to run aermod.  You can't just double click on the aermod.exe file. 

    13.  PC users, if any of the instructions above need fixing or clarification, please let me know.  Also, please refer to the SampleRun document provided by EPA.  https://www3.epa.gov/ttn/scram/models/aermod/SampleRun.pdf 
  2. If you have a Mac, .

    1. Use your Mac desktop to create a new folder called tryme .   Drag and drop (while holding down the option key)  aermod.x  from the aermod_source directory to your new tryme directory.  This puts a copy of the executable in tryme.

    2. From https://www.epa.gov/scram/air-quality-dispersion-modeling-preferred-and-recommended-models#aermod download the "Sample Run (ZIP)" file to your desktop, and un-zip it. 

    3. From this new Sample Run directory on your Desktop, use option-drag-drop to put a copy of each of the following 4 input files into your  tryme  folder: 
      aermod.inp
       
      aermet2.sfc
      aermet2.pfl
      aertest_evt.inp

    4. At this point, only  aermod.x  and those 4 input files should be in your tryme folder.  Nothing else please.

    5. Using iTerm2, use cd to navigate into your tryme directory.  For example: cd ~/Desktop/tryme

    6. Then, run AERMOD by typing  ./aermod.x   into your iTerm2 window. 

    7. Back on your normal Mac desktop, open the tryme folder to see what files are in it, and use your normal text editing programs (TextEdit or BBEdit) to view all the input files and all the output files. Please do this to learn more about input and output to/from aermod.
    8. The most important output is in your aermod.out file.  Normal text edit programs will word-wrap the output making it difficult to read.  However, you can read aermod.out into a Microsoft Word document, and then reformat it to be Landscape orientation, font size 8 points, and reduce all the margins by about half their initial values.  This also takes advantage of the page-breaks that are already in the aermod.out file.  The result is many pages (about 33 when I did it), but is very readable.  You can save it as a Word.doc , or print it into a pdf file.

  3. .



B. AIRMET Installation Methods (for the meteorological pre-processor)

AERMET is a pre-processor that accesses weather data in "normal" formats, and quality-controls it and then writes new meteorology output files in the special format that AERMOD needs as input.   See AERMET info at: https://www.epa.gov/scram/meteorological-processors-and-accessory-programs#aermet

AERMET has 3 stages, where you run AERMET 3 times to gradually create the output meteorology files needed as AERMOD input.

See the AERMET Users Guide at: https://www3.epa.gov/ttn/scram/7thconf/aermod/aermet_userguide.pdf

  1. If you have a PC: you don't need to compile any code first.  Instead, you can download the existing executables.

    1. Use Windows Explorer to create a new directory C:\AERMET .

    2. From https://www.epa.gov/scram/meteorological-processors-and-accessory-programs#aermet, see "Model Code" to get the appropriate executable.  Unzip it and copy the executable aermet.exe into your AERMET subdirectory.


  2. If you have a Mac: and if you downloaded a working executable from zip file here , then skip to step 3. 
    Otherwise, you will need to (a) download the AERMET fortran source code and associated files; and (b) compile the code on your Mac.  Hopefully, you have already installed gfortran on your Mac.  If not, please see AERMOD Mac steps 2a-d in the previous section to install and test gfortran. 

    1. Using your web browser, go to https://www.epa.gov/scram/meteorological-processors-and-accessory-programs#aermet .  Then ...

    1. Use iTerm2, and...

    2. .

  3. Both PC and Mac.  Run a sample to test if aermet is working.  In the following description, I will use the generic word "gui" for graphic user interface, which for PC users is Windows Explorer and for Mac users is their desktop Finder.  Also, when I use the generic word "terminal", then PC people should use Command Prompt, and Mac people should use iTerm2.  (See the examples above for AERMOD if you are unfamiliar with usage of these software systems.)

    1. Via your gui, use a web browser to download a copy of the aermet "Test Cases.zip" file, from https://www.epa.gov/scram/meteorological-processors-and-accessory-programs#aermet .  Then unzip it.
    2. Create a new subdirectory on your C drive (if PC) or Desktop (if Mac) called trymet .
    3. Open your unzipped aermet_test_cases folder, and find and open the subdirectory aermet_def_testcases folder, and then find and open its subdirectory EX03, and copy the following files into your trymet folder:
    4. From your aermet_source folder, copy your aermet executable (aermet.exe or aermet.x) into trymet .  Your trymet folder should now have 6 files in it. 
    5. Run the 1st stage of aermet as follows:
    6. Run the 2nd stage of aermet as follows.  In your gui, delete the old aermet.INP .  Make a copy of EX03_S2.INP and rename it as  aermet.INP.  In your terminal, execute aermet.  It should produce a new MR (merged meteorology) file in  trymet., which is used as input for the third stage.
    7. Run the 3rd stage of aermet as follows.  In your gui, delete the old aermet.INP .  Make a copy of EX03_S3.INP and rename it as  aermet.INP.  In your terminal, execute aermet.  It should produce two MP files in trymet.  These are the desired surface (.SFC) and vertical profile (.PFL) files that AERMOD needs as input. 
      (If this had been for an actual AERMOD run, you would copy these last 2 files into the folder holding your AERMOD executable and input file.)
    8. Use any text editor in your gui to view all of the input files and all of the output files, to help you to better understand these operations. 
  4. .



C. AIRMAP Installation Methods (for the AERMOD terrain  map and receptor pre-processor)

AERMAP is a terrain preprocessor for AERMOD.  AERMAP processes commercially available Digital Elevation Data and creates an output file suitable for use as input within an AERMOD control file.  This file would contain elevation and hill-height scaling factors for each receptor in the air dispersion study.   See AERMAP info at:
https://www.epa.gov/scram/air-quality-dispersion-modeling-related-model-support-programs#aermap

A users guide for AERMAP is at: https://www3.epa.gov/ttn/scram/models/aermod/aermap/aermap_userguide_v18081.pdf


  1. If you have a PC: you don't need to compile any code first.  Instead, you can download the existing executables.

    1. Use Windows Explorer to create a new directory C:\AERMAP .

    2. From https://www.epa.gov/scram/air-quality-dispersion-modeling-related-model-support-programs#aermap ,  see "Model Code" to download the appropriate executable to your PC.  Unzip it and copy the executable aermap.exe into your AERMAP subdirectory.  Also copy all the associated .las and .los files into that same subdirectory.


  2. If you have a Mac and if you downloaded a working executable from zip file here , then skip to step 3. 
    Otherwise, you will need to (a) download the AERMAP fortran source code and associated files; and (b) compile the code on your Mac.  Hopefully, you have already installed gfortran on your Mac.  If not, please see AERMOD Mac steps 2a-d in a previous section to install and test gfortran. 

    1. Using your web browser, go to https://www.epa.gov/scram/air-quality-dispersion-modeling-related-model-support-programs#aermap  .  Then ...

      • ...where it says "Model Code" / "Source Code", download to your Mac Desktop the AERMAP source code as a zip file. (As of Jul 2018, that zip file is at https://www3.epa.gov/ttn/scram/models/aermod/aermap/aermap_source.zip .)
        Move the downloaded zip file to your Desktop if it is not already there.

      • Then unzip the downloaded file.  You should now have a folder on your Desktop called  aermap_source .  It has about 20 fortran subroutine files that need to be compiled and linked into a single executable.  Luckily, we will automate this for you.

      • Use your web browser to download a copy of the makefile provided here to your computer.  Make sure the name of this file is makefile  (with NO  .txt suffix or any other suffix).  This is the script that tells the fortran compiler to compile all those subroutines and link them into a single executable program.  You can view this makefile in any text editor, but please don't change it and don't cause any .txt suffix to be added to it.

      • Copy the makefile into your aermap_source folder . 

    2. Use iTerm2, and...

    3. To get some of the additional supporting files, use your web-browser from your Finder to go back to https://www.epa.gov/scram/air-quality-dispersion-modeling-related-model-support-programs#aermap and then download the Windows executable zip file to your Mac desktop.  Unzip it on your desktop, which creates a folder called aermap_exe .  Use your finder to open that folder, and delete the windows executable file called aermap.exe . But keep the README and all associated .las and .los files.  Change the name of this subdirectory to gridshift_files , which are needed input files for the test cases that you can run . 

    4. .

  3. Both PC and Mac.  Run a sample to test if aermap is working.  In the following description, I will use the generic word "gui" for graphic user interface, which for PC users is Windows Explorer and for Mac users is their desktop Finder.  Also, when I use the generic word "terminal", then PC people should use Command Prompt, and Mac people should use iTerm2.  (See the examples above for AERMOD if you are unfamiliar with usage of these software systems.)

    1. Via your gui, use a web browser to go to https://www.epa.gov/scram/air-quality-dispersion-modeling-related-model-support-programs#aermap . and then from the Model Code section download the Test Cases zip file to your desktop.  Then unzip it.
    2. Create a new subdirectory on your C drive (if PC) or Desktop (if Mac) called myNAD_Gap .
    3. Open your unzipped aermmap_testcase folder, and find and open the subdirectory NAD_Gap folder.  Use your gui text editor (e.g., TextEdit or BBEdit on a Mac) to open the input text file aermap_NAD-GAP.inp  , and delete line 15 that says:    NADGRIDS  ..\  .  Then copy or "Save As" the edited file with the new name aermap.inp into your myNAD_Gap folder.
    4. Then copy the following files from the NAD_Gap folder into your myNAD_Gap folder:
    5. And copy the following files (from the gridshift_files folder if Mac, or from aermap_exe if PC) into your myNAD_Gap folder:
    6. From your aermap_source folder, copy your aermap executable (aermap.exe or aermap.x) into myNAD_Gap .  Your myNAD_Gap folder should now have 6 files in it (the 4 bulleted files listed above, plus the executable and the input file). 
    7. Run aermap as follows:
    8. Use any text editor in your gui to view all of the input files and all of the output files, to help you to better understand these operations. 
  4. .



.


[ Home | Homework | ]

http://www.eos.ubc.ca/courses/atsc507/ADM/
Copyright © 2016, 2018, 2021 by Roland Stull.