AERMOD 16216r is the preferred air quality dispersion model of US-EPA and it is 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 and macOS with the free GNU Fortran compiler gfortran you can use this commnad:
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
In order to compile the source code of previous version 15181 under Linux and OS X with the free GNU Fortran compiler gfortran it is necessary to make some fixes to the source code, otherwise there is a segmentation fault error that prevents a successful compilation.
In file setup.f, lines 1636-1639:
XR_SCS(:) = 0.0D0
YR_SCS(:) = 0.0D0
XR_SCS(:) = 0.0D0
YR_SCS(:) = 0.0D0
need to be changed in:
IF (ALLOCATED(XR_SCS)) XR_SCS(:) = 0.0D0
IF (ALLOCATED(YR_SCS)) YR_SCS(:) = 0.0D0
IF (ALLOCATED(XR_RCS)) XR_RCS(:) = 0.0D0
IF (ALLOCATED(YR_RCS)) YR_RCS(:) = 0.0D0
Also, it is necessary to set the -frecursive compilation flag to avoid another runtime error showing this in other cases:
At line 5910 of file aermod.f
Fortran runtime error: Recursive call to nonrecursive procedure
A working makefile for gfortran under Linux is this one:
PROG = aermod
SRCS = modules.f aermod.f calc1.f calc2.f coset.f evcalc.f evoutput.f evset.f iblval.f \
inpsum.f meset.f metext.f ouset.f output.f pitarea.f \
prime.f prise.f reset.f setup.f siggrid.f sigmas.f soset.f tempgrid.f \
windgrid.f
OBJS = modules.o aermod.o calc1.o calc2.o coset.o evcalc.o evoutput.o evset.o iblval.o \
inpsum.o meset.o metext.o ouset.o output.o pitarea.o \
prime.o prise.o reset.o setup.o siggrid.o sigmas.o soset.o tempgrid.o \
windgrid.o
LIBS =
FC = gfortran
FFLAGS = -fbounds-check -fcheck=all -Wall -frecursive -O3
LDFLAGS =
all: $(PROG)
$(PROG): $(OBJS)
$(FC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
clean:
rm -f $(PROG) $(OBJS) *.mod
Save the text in a file named "makefile" in the same directory of the source code and in that directory type maketo build aermod
Then run int as ./aermod in the directory where the input file aermod.inp is.
For installing gfortran under OS X you can refer to this article.