Weather Research and Forecast (WRF) model
This document is intended to serve as a reference for new users in building and running the WRF and WPS on Keeling. This guide assumes WRF version 4.0.0 and greater.
Acquiring WRF source code
WRF Versions 4.0 and greater are available at the WRF GitHub repository
To acquire the WRF model there are various options:
You can clone the WRF repository directly by:
git clone https://github.com/wrf-model/WRF.gitCreate your own fork the WRF repository through GitHub (or by clicking here) and then acquire the code by:
git clone https://github.com/<your GitHub username>/WRF.gitAcquire a specific version as a tarball from the WRF GitHub Release page
Note
For example, to acquire a tar file of version 4.4.2:
wget https://github.com/wrf-model/WRF/releases/download/v4.4.2/v4.4.2.tar.gzand you can unpack by:
tar -xvzf v4.4.2.tar.gzOlder versions (before v4.0) are available for download from the WRF Users Page
Building WRF
Setting up the build environment
There are two compiler options on Keeling to compile WRF: GNU and Intel.
If building with GNU compilers, load the following modules:
module load mpi/openmpi-x86_64If building with Intel compilers, load the following modules:
module load intel/intel-oneapi module load intel/intel-mpi module load intel/netcdf4-4.9.2-intel-oneapi
Set the path to NetCDF:
export NETCDF=`nc-config --prefix`If you are interested in compiling WRF with chemistry options, WRF-Chem can be enabled on by:
export WRF_CHEM=1
Configuring and compiling WRF
To configure WRF, run the configure process by:
./configureFor GNU compilers, select the
GNU (gfortran/gcc)option that is distributed memory (DM) (option[34])For Intel compileres, select the option that says
INTEL (ifx/icx)(option[78]as of version 4.6.1)Note
For older version of WRF, you may have to select
INTEL (ifort/icc)option and edit theconfigure.wrffile to change the compiler to ifx/icx from ifort/icc.Unless you require moving nesting, select
[1]for default nesting.Upon completion of the configure process a file
configure.wrfwill be generated that contains all the settings for building WRF. This is the file that one may be required to modify in event of a problem or to further modify compiler options/flags.To compile WRF to do a real case and send the output to a log file, run the following:
./compile em_real >& compile_WRF.log
Note
WRF also has various idealized cases. These cases are found in the test directory and
all available cases can be seen the following command:
./compile -h
with further information regarding each case found in the README files within each case directory
within the test directory. As an example, if you wanted to compile the LES scenario found in test/em_les
./compile em_les >& compile_WRF_les.log
Building WRF Pre-Processing System (WPS)
The WRF Pre-Processing System (WPS) is a collection programs that provides data used as input to the real.exe program. WPS is available on GitHub.
Change to the directory where your WRF directory can be found. WPS will need a compiled version of WRF to compile and will be expecting it in this specific location (
../relative to the WPS directory). If you do not wish to do this, you can set theWRF_DIRenvironment variable to the location of the WRF directory.Clone WPS repository:
git clone https://github.com/wrf-model/WPS.gitCheckout the major version that matches your version of WRF. For example, if you have compield WRF v4.6.2, checkout the v4.6 branch:
git checkout -b v4.6 v4.6To configure:
./configureSelect the option that matches your WRF compiler choice: option
[1]if you used GNU compilers or[17]if you used Intel.To compile WPS:
./compile >& compile_WPS.logVerify that the directory now contains the following executables:
geogrid.exe: creates the geography dataungrib.exe: decodes the data using tables and creates an intermediate formatmetgrid.exe: ingests the data and interpolates the fields to the model domain