Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Full WRF and WPS Installation Example (GNU)

kwerner

Administrator
Staff member
Follow the below instructions to install WRF and WPS with a GNU compiler. Alternatively, use this script for the library installations, but pay attention to the notes in the script.


From a terminal window, create the following new directory:

Code:
mkdir wrf_dependencies

Set the following environment variables.

Code:
DIR=$PWD/wrf_dependencies
export NETCDF=$DIR/netcdf
export LD_LIBRARY_PATH=$NETCDF/lib:$DIR/grib2/lib
export PATH=$NETCDF/bin:$DIR/mpich/bin:${PATH}
export JASPERLIB=$DIR/grib2/lib
export JASPERINC=$DIR/grib2/include

Set the following additional environment variables ONLY prior to building these dependencies. These SHOULD NOT be set when building WRF or WPS.

Code:
export CC=gcc
export CXX=g++
export FC=gfortran
export FCFLAGS="-m64 -fallow-argument-mismatch"
export F77=gfortran
export FFLAGS="-m64 -fallow-argument-mismatch"
export LDFLAGS="-L$NETCDF/lib -L$DIR/grib2/lib"
export CPPFLAGS="-I$NETCDF/include -I$DIR/grib2/include -fcommon"


Install zlib

Code:
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/zlib-1.2.11.tar.gz
tar xzvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=$DIR/grib2
make -j 4
make install
cd ..
rm -rf zlib*


Install HDF5

Code:
wget https://github.com/HDFGroup/hdf5/archive/hdf5-1_10_5.tar.gz
tar xzvf hdf5-1.10.5.tar.gz
cd hdf5-1.10.5
./configure --prefix=$DIR/netcdf --with-zlib=$DIR/grib2 --enable-fortran --enable-shared
make -j 4
make install
cd ..
rm -rf hdf5*


Install NetCDF-c

Code:
wget https://github.com/Unidata/netcdf-c/archive/v4.7.2.tar.gz
tar xzvf v4.7.2.tar.gz
cd netcdf-c-4.7.2
./configure --prefix=$DIR/netcdf --disable-dap --enable-netcdf4 --enable-hdf5 --enable-shared
make -j 4
make install
cd ..
rm -rf v4.7.2.tar.gz netcdf-c*


Install netcdf-fortran

Code:
export LIBS=”-lnetcdf -lz”
wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.2.tar.gz
tar xzvf v4.5.2.tar.gz
cd netcdf-fortran-4.5.2
./configure --prefix=$DIR/netcdf --disable-hdf5 --enable-shared
make -j 4
make install
cd ..
rm -rf netcdf-fortran* v4.5.2.tar.gz


Install mpich

Code:
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/mpich-3.0.4.tar.gz
tar xzvf mpich-3.0.4.tar.gz
cd mpich-3.0.4
./configure --prefix=$DIR/mpich
make -j 4 2>&1
make install
cd ..
rm -rf mpich*

Install libpng

Code:
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/libpng-1.2.50.tar.gz
tar xzvf libpng-1.2.50.tar.gz
cd libpng-1.2.50
./configure --prefix=$DIR/grib2
make -j 4
make install
cd ..
rm -rf libpng*

jasper

Code:
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz
tar xzvf jasper-1.900.1.tar.gz
cd jasper-1.900.1
./configure --prefix=$DIR/grib2
make -j 4
make install
cd ..
rm -rf jasper*


Now close the current terminal window, and open a new one. Environment variables set earlier will no longer be set. In the new terminal window, open up the .bashrc (or similar) file and and or edit the following entries. When done, save the file.

Code:
export NETCDF=$DIR/netcdf
export LD_LIBRARY_PATH=$NETCDF/lib:$DIR/grib2/lib
export PATH=$NETCDF/bin:$DIR/mpich/bin:${PATH}
export JASPERLIB=$DIR/grib2/lib
export JASPERINC=$DIR/grib2/include

Source the .bashrc (or similar) file so the above commands go into effect for the current terminal window.

Code:
source .bashrc


Build WRF

Code:
git clone --recurse-submodule https://github.com/wrf-model/WRF.git
cd WRF
./configure (choose options 34 and 1)
./compile em_real -j 4 >& log.compile

Build WPS

Code:
git clone https://github.com/wrf-model/WPS.git
cd WPS
export WRF_DIR=path-to-WRF-top-level-directory/WRF
./configure (choose option 1)
./compile >& log.compile
 
Last edited:
Top