How to compile WRF-SFIRE

From openwfm
Revision as of 15:18, 2 April 2010 by Jbeezley (talk | contribs) (Created page with 'Compiling the WRF-Fire software is generally supported on most any *NIX based operating system including Mac OSX. The source code is a mix of C and fortran 90 along with a serie…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Compiling the WRF-Fire software is generally supported on most any *NIX based operating system including Mac OSX. The source code is a mix of C and fortran 90 along with a series of preprocessing directives (utilizing cpp, m4, and other custom scripts). The code is known to compile with a wide variety of compilers including ifort, pgf90, gfortran, g95, and xlf90. In addition, the WRF software infrastructure supports parallel execution using a combination of MPI and OpenMP. The WRF-Fire software distribution uses the same build system as released with WRF, for which detailed information can be found in the WRF User's Guide.

While various compiler and platform combinations are known to work, often one must tweak the configuration files in order to build the software successfully. We will outline here general tips for configuration and compilation of WRF-Fire as well as specific fixes for various platforms.

Prerequisites

Prerequisite libraries must be compiled using the same combination of C and fortran 90 compilers that you plan to build WRF-Fire with. Failure to do so will likely result in linking errors, or worse, random bugs at run time. All libraries (required and optional) use a standard GNU autotools configuration script. The build process for each is as follows:

  1. Choose a prefix directory where you want to install (i.e. PREFIX=/opt).
  2. Set environment variables dictating your choice of compilers (CC,CXX,FC,F77,F90).
  3. See specific help for each software package by running ./configure --help.
  4. Run the configure script with the argument --prefix=$PREFIX indicating the installation location.
  5. make
  6. make install

For example, if you are installing a gcc/g95 build into /opt/gcc-g95, you would issue the following series of commands.

CC=gcc CXX=g++ FC=g95 F77=g95 F90=g95 ./configure --prefix=/opt/gcc-g95
make
make install

Note, depending on your choice of prefix, you may need to be root to run the final command.

Required:

NetCDF
After installation set the environment variable NETCDF to the prefix directory. For example in bash, export NETCDF=$PREFIX.

Optional:

MPICH
Make sure the directory, $PREFIX/bin, is in your search path. For example in bash, export PATH="$PATH:$PREFIX/bin".