Computational Science Community Wiki

Installing WRF on unix-based desktops/laptops

These instructions describe how to compile WRF to run on a standard desktop/laptop running a unix-based operating system. These instructions have been tested against WRF versions 3.3.1 and 3.4.1 on a quad-core (Intel Core i7) Dell system with Fedora 15 installed.

Requirements:

* WRF model source code (including WPS); see http://www.mmm.ucar.edu/wrf/users/download/get_source.html

* gfortran compiler

* mpich2 and mpich2-devel packages

* netcdf libraries; see http://www.unidata.ucar.edu/downloads/netcdf/index.jsp

* ncl/ncar graphics (for the WPS utilities plotgrids.exe and plotfmt.exe); see http://ngwww.ucar.edu/

NB - some linux distributions now include netcdf and ncl libraries as standard (e.g. Fedora 15) - it is worth checking to see if they are available via package manager or the 'add/remove software' tool. If they are not available through your linux distribution then you can download them from the above websites, and compile them using the gfortran compiler.

To compile netcdf (if it is not provided through the package manager):

Unzip and untar the download file (using gunzip and tar -xvf). If you have downloaded v4 of netcdf or above, you may need to run the configure script with the '--disable-netcdf4' option, as at the time of writing WRF does not seem to support these additional features:

Also netcdf from v4.2 onwards is now distributed as seperate c and fortran packages, and so it is necessary to install both parts separately. If you have compiled netcdf succesfully, you should see 2 static library files in the lib directory of your netcdf installation, namely netcdf.a and netcdff.a (the latter has an additional 'f' at the end to indicate that this is the fortran component)

Compiling WRF

Set $LD_LIBRARY_PATH to point to your directories containing the netcdf and mpich libraries; e.g.

Set $NETCDF; e.g.

Set $NCARG_ROOT; e.g.

WRF needs to be compiled before WPS, so unzip and untar the WRF download. Then run the configure script:

Choose the appropriate settings for your system, e.g. gfortran, and distributed memory parallel ('dmpar').

This will produce a configure.wrf file. Within this file, you should make sure that links to both static netcdf library files are specified in LIB_EXTERNAL, i.e.

This is done by specifying '-lnetcdff' as well as '-lnetcdf' as above.

If you are compiling with mpich2, then you also need to add the path to the mpich2 libraries to LIB_EXTERNAL, as follows (note the path to the mpich2 libraries may be different on other systems)

When the configure script has completed, you can compile with:

When compiling with gfortran, you may encounter an error (depending on the version of WRF you are installing) associated with module_cu_g3.F. To get around this, find the following line:

and replace with:

Then recompile.

Compiling WPS

Run the configure script and select the option to install with gfortran, serial. The configure script should set the paths to your netcdf and ncl libraries as defined in the environment variables $NETCDF and $NCARG_ROOT that were defined earlier. NB - if you wish to install with support for grib2 data, then you will also need to install the following: libpng, zlib, jasper-libs jasper-devel. Your package manager should be able to provide these additional libraries. Once installed, you should edit configure.wps and set the paths to these libraries and include files as per your system, e.g for my sytem (64-bit with Fedora 15):

Support for grib2 is beneficial as it allows you to use NCEP GFS data at 0.5 degree resolution as well as the standard 1 degree data. Both are available from http://nomads.ncdc.noaa.gov/data.php --> choose 'TDS' servers --> 'NCEP Global Forecast System (GFS)' --> 'Directory: Global Forecast System (GFS4) - Half Degree' --> Choose the dates you need then download via the HTTPServer.

You can then complete the installation by running: