Compiling WRF and related tools¶
Warning
It is quite likely that the installation process described below will not work if you are working in an environment where conda is activated. We therefore recommand to
- not automatically activate a conda environment in your
~/.bashrcfile - deactivate any activated conda environment, if any, before proceeding further
Compile WRF¶
Basic usage¶
Use the compile_WRF.py script provided in WRF-infra to download and compile WRF:
This compiles WRF-Chem-Polar with chemistry activated. Compilation takes roughly an hour and a half. You can check that compilation was successful by looking for the following message at the end of compilation.log in your installation directory:
The default configuration of this script is based on the WRF-Chem-Polar team's most frequent use-case. Subsections below explain how to use different settings (see also this technical documentation for a description of all the existing options).
Compile upstream WRF¶
Use the --upstream switch to compile the upstream version of WRF or WRF-Chem:
Compile WRF without WRF-Chem¶
To use WRF in meteorology-only mode, tell the script not to compile any extra components:
(the default value of this parameter is "kpp,chem").
Choose where to install WRF¶
By default, the script installs WRF in a directory named "WRF". Use the option --destination to install it to a directory of your choice, for instance:
Using a scheduler (or not)¶
By default, the compile script sends all the work to the host's scheduler (eg. slurm). You can prevent this behaviour using:
On some machines, the scheduler requires that a project name be specified when running a job, which you can do using:
More generally, you can set any scheduler option using the following syntax:
Compile WPS¶
Although it is a pre-processor, WPS needs to be compiled after WRF because it depends on it. Use the compile_WPS.py script to download and compile the latest WPS version:
Compilation of WPS typically takes one or two minutes. You can verify that compilation was successful by checking for the presence of the following binaries in the installation directory (presence of the actual binaries in the */src directories and of the simlinks at the root of the directory):
geogrid.exe -> geogrid/src/geogrid.exemetgrid.exe -> metgrid/src/metgrid.exeungrib.exe -> ungrib/src/ungrib.exe
Just as for WRF, you can use the parameter --destination to specify where WPS should be installed. Additionally, if you installed WRF in a non-default location, you will have to use the option --wrfdir to point to where WRF is installed, for example:
Note that patches are required to compile WPS v4.6.0: