AERMET 22112 is the meteorological data preprocessor of AERMOD 22112, the preferred air quality dispersion model of US-EPA since June 27, 2022. AERMOD and AERMET are used all over the world as reference model for regulatory purposes. US-EPA distributes the Fortran source code and an executable to be used with Microsoft Windows.

The source code is available on the US-EPA web site.

In order to compile the source code under Linux with the GNU Fortran compiler gfortran, it may be necessary to apply some fixes to the code, maybe depending on the gfortran version installed.

File mod_main1.f90, line 542:

Replace 
        if (qindx(1) == 0) then
with
        if (qindx(1) .eqv. .false.) then
                    
File mod_upperair.f90, line 3135:

Replace 
        write(formstr(3),'(2(a))'),'a,1x,i8,1x,a,i8)'
with
        write(formstr(3),'(2(a))') '(a,1x,i8,1x,a,i8)'
                    
File mod_onsite.f90, line 2002:

Replace 
         if (osvars(wind_vars(1))%lread /= osvars(wind_vars(2))%lread) then
with
         if (osvars(wind_vars(1))%lread .neqv. osvars(wind_vars(2))%lread) then
                    
File mod_pbl.f90, line 1085:

Replace 
        read(inpline(fileind(1):fileind(2)),'(a)'),tempfil
with
        read(inpline(fileind(1):fileind(2)),'(a)') tempfil
                    
File mod_read_input.f90, line 482 (and other similar lines):

This is a line with more than 132 charcters. 

A line of more than 132 characters is not a standard feature of Fortran. This error above happens for gcc version < 8

It can be fixed with compile flag -ffree-line-length-none  (https://stackoverflow.com/questions/19311766/gfortran-line-length-limit) 
                
                    

Save the lines below in a file named compile.gfortran.sh the folder where the AERMET source files are. Then make it executable.

#!/bin/sh
# Compile AERMET 22112 on Linux using gfortran

if [ -f aermet_22112.gfortran.x ]; then rm aermet_22112.gfortran.x; fi

COMPILE_FLAGS="-fcheck=all -Wall -Wno-compare-reals -Wno-character-truncation -ffree-line-length-none -finit-local-zero -fbacktrace -fno-automatic"
LINK_FLAGS="-O3"

gfortran -c $COMPILE_FLAGS mod_file_units.f90
gfortran -c $COMPILE_FLAGS mod_main1.f90
gfortran -c $COMPILE_FLAGS mod_upperair.f90
gfortran -c $COMPILE_FLAGS mod_surface.f90
gfortran -c $COMPILE_FLAGS mod_onsite.f90
gfortran -c $COMPILE_FLAGS mod_pbl.f90
gfortran -c $COMPILE_FLAGS mod_read_input.f90
gfortran -c $COMPILE_FLAGS mod_reports.f90
gfortran -c $COMPILE_FLAGS mod_misc.f90
gfortran -c $COMPILE_FLAGS aermet.f90

gfortran -o aermet_22112.gfortran.x $LINK_FLAGS mod_file_units.o mod_main1.o mod_upperair.o mod_surface.o mod_onsite.o mod_pbl.o mod_read_input.o mod_reports.o mod_misc.o aermet.o

rm *.o
rm *.mod
                    

Then run it as ./compile.gfortran.sh in the same directory and it will create an executable of AERMET named aermet_22112.gfortran.x