3.3. Compiling CMAQ for the Tutorial Simulation

For all CMAQ programs, other than MCIP, the program M3BLD is used to compile the source code into executables. The first step in the compilation of CMAQ is to compile M3BLD. Then compile the program libraries Stenex and Pario before moving on to the compilation of the rest of the CMAQ programs. For all of the CMAQ programs and libraries, the directory paths for the Fortran and C compilers in the build scripts will have to be changed to reflect the correct locations on the users system. For parallel compilations, some of the programs also require directory paths to MPICH include files. Program-specific compilation instructions are provided below. The compilation instructions in this section are for building executables for simulating the tutorial data sets distributed with CMAQ. Other than the paths to the compilers, the build scripts used in this section will not need to be changed to create working executables. Additional information about the configuration options for the different CMAQ programs are provided in Chapter 2 and 6.

  1. Use the following commands to compile M3BLD:

    cd $M3HOME/scripts/build
    bldit.m3bld

  2. Next create the stencil exchange libraries for serial and parallel processing. Check that the MPICH include file directory path is correct for the parallel version of the library on line 51 of the file bldit.se.pgf. Use the following commands to compile the Stenex libraries:

    cd $M3HOME/scripts/stenex
    bldit.se.pgf
    bldit.se_noop.pgf

  3. For parallel CCTM operation create the parallel I/O library:

    cd $M3HOME/scripts/pario
    bldit.pario.pgf

    Now create the model executables for JPROC, ICON, BCON, and the CCTM.

  4. For the benchmark case, confirm that JPROC is configured to produce photolysis rates for the mechanism labeled “cb05_ae4_aq”. Use the following command to compile JPROC:

    cd $M3HOME/scripts/jproc
    bldit.jproc.pgf

  5. ICON and BCON can be configured for different chemical mechanisms and for different kinds of input data. The configuration options for ICON and BCON are discussed in detail in Chapters 2 and 6. Use the following commands to compile ICON and BCON:

    cd $M3HOME/scripts/icon
    bldit.icon.pgf
    cd $M3HOME/scripts/bcon
    bldit.bcon.pgf

  6. MCIP is compiled using a FORTRAN Makefile instead of M3BLD. To create the MCIP executable, set the compiler, compiler flags, and netCDF and I/O API library paths in the Makefile distributed with MCIP. Use the following commands to compile MCIP:

    cd $M3HOME/scripts/mcip/BLD
    make

  7. CCTM has multiple configuration options that can be changed to optimize model performance for different applications. In addition to selecting the chemical mechanism to model, the user can also select from several different science modules. The science configuration options for CCTM are discussed in detail in Chapters 2 and 6. The CCTM build script is configured by default to run in multiprocessor mode for the benchmark simulation. CMAQ uses the MPICH message passing interface (MPI) to manage communication between processors in a clustered multiprocessor computing environment. Before compiling the CCTM for parallel execution, the user must specify the location of the MPICH directory on your system on line 156 of the CCTM build script. For single-processor systems or first-time users of the model, configure the build script to create a single-processor executable by commenting out the line that activates the variable “ParOpt” on line 52 of the build script. Use the following commands to compile CCTM:

    cd $M3HOME/scripts/cctm
    bldit.cctm.pgf

Although they are not used for the benchmark simulation, PDM and PROCAN can also be compiled using M3BLD.