WRF 4.7.1 Installation
Requirements
Base OS: Rocky Linux (x86_64) \(\boldsymbol{\ge}\) 8.5
Compiler: GCC 11.2.0
Dependencies: * gcc 11.2.0 * curl 7.77.0 * openmpi 4.1.2 * compiler 2022.0.2 * zlib 1.2.12 * hdf5 1.12.0 * NetCDF-C 4.7.4 * NetCDF-Fortran 4.5.3 * JasPer 1.900.29 * libpng 1.6.37 * jpeg 9e
Installation
Downloading Source Code
git clone --recurse-submodules https://github.com/wrf-model/WRF
Module Loading
module load compiler/2022.0.2
module load openmpi/4.1.2_gcc-11.2.0
module load gcc/11.2.0
module load curl
Create Directory for Libraries
To install the libraries, all must be placed in the same location.
export DIR=$PWD
mkdir wrf_install_gcc
mkdir wrf_lib_gcc
Download Libraries
cd wrf_install_gcc
wget https://www.zlib.net/fossils/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
wget https://onboardcloud.dl.sourceforge.net/project/libpng/libpng16/1.6.37/libpng-1.6.37.tar.gz
tar -zxvf libpng-1.6.37.tar.gz
wget https://hdf-wordpress-1.s3.amazonaws.com/wp-content/uploads/manual/HDF5/HDF5_1_12_0/source/hdf5-1.12.0.tar.gz
tar -zxvf hdf5-1.12.0.tar.gz
wget https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.7.4.tar.gz
tar -zxvf v4.7.4.tar.gz
wget https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.5.3.tar.gz
tar -zxvf v4.5.3.tar.gz
wget https://www.ece.uvic.ca/~frodo/jasper/software/jasper-1.900.29.tar.gz
tar -zxvf jasper-1.900.29.tar.gz
wget https://www.ijg.org/files/jpegsrc.v9e.tar.gz
tar -zxvf jpegsrc.v9e.tar.gz
rm -rf *.tar.gz
Build zlib
cd zlib-1.2.11
./configure --prefix=$DIR/wrf_lib_gcc
make
make install
Export Libraries
export LD_LIBRARY_PATH=$DIR/wrf_lib_gcc/lib:$LD_LIBRARY_PATH
export LDFLAGS=-L$DIR/wrf_lib_gcc/lib
export CPPFLAGS=-I$DIR/wrf_lib_gcc/include
export LD_RUN_PATH=$DIR/wrf_lib_gcc/lib:$LD_RUN_PATH
export PATH=$DIR/wrf_lib_gcc/bin:$PATH
Build libpng
cd ..
cd libpng-1.6.37
./configure --prefix=$DIR/wrf_lib_gcc
make
make install
Build JPEG
cd ..
cd jpeg-9e/
./configure --prefix=$DIR/wrf_lib_gcc
make
make install
Build HDF5
cd ..
cd hdf5-1.12.0
./configure --prefix=$DIR/wrf_lib_gcc --with-zlib=$DIR/wrf_lib_gcc/ --enable-fortran
make
make install
Build NetCDF-C
cd ..
cd netcdf-c-4.7.4
export HDF5=$DIR/wrf_lib_gcc
./configure --prefix=$DIR/wrf_lib_gcc
make
make install
Build NetCDF-Fortran
cd ..
cd netcdf-fortran-4.5.3
./configure --prefix=$DIR/wrf_lib_gcc
make
make install
Build JasPer
cd ..
sed -i 's/char \*optstr/const char *optstr/g' src/libjasper/jpg/jpg_dummy.c
cd jasper-1.900.29
./configure --prefix=$DIR/wrf_lib_gcc
make
make install
Distributed Memory Installation
Restart the environment by exiting and re-entering the terminal.
Export the necessary modules and variables, set the $DIR variable exactly as before.
module load compiler/2022.0.2 module load openmpi/4.1.2_gcc-11.2.0 module load gcc/11.2.0 module load curl export LD_LIBRARY_PATH=$DIR/wrf_lib_gcc/lib:$LD_LIBRARY_PATH export LDFLAGS=-L$DIR/wrf_lib_gcc/lib export CPPFLAGS=-I$DIR/wrf_lib_gcc/include export LD_RUN_PATH=$DIR/wrf_lib_gcc/lib:$LD_RUN_PATH export NETCDF=$DIR/wrf_lib_gcc export HDF5=$DIR/wrf_lib_gcc export JASPERLIB=$DIR/wrf_lib_gcc/lib export JASPERINC=$DIR/wrf_lib_gcc/include export PATH=$DIR/wrf_lib_gcc/bin:$PATH
Execute the configuration script inside the WRF folder. You will be asked two questions: choose
34for the first one (Distributed-memory processing with GCC compiler), and1for the second one../configure
Remove the “time” command from the following line in the configure.wrf file.
FC = time $(DM_FC) # Change to this, save and exit FC = $(DM_FC)
Compile WRF with the case you need (recommended:
em_real)../compile <case> >& compile.log & tail -f compile.log # to see the progress
If compilation is successful, you should see the following executables in
main/:For real case compilation:
wrf.exe real.exe ndown.exe tc.exe
For idealized case compilation:
wrf.exe ideal.exe