Install your own WRF-Chem
Updated: 18 October 2023
1. Load required modules and set environment variables
Paste the below lines into your terminal. (Putting these in ~/.bashrc is not recommended.)
module purge
module load cpeIntel/23.09
module load cray-hdf5-parallel/1.12.2.7
module load cray-netcdf-hdf5parallel/4.9.0.7
module load cray-parallel-netcdf/1.12.3.7
module load libpng/1.6.39-cpeIntel-23.09
module load JasPer/1.900.1-cpeIntel-23.09
module load flex/2.6.4
module load ADIOS2/2.9.1-cpeIntel-23.09
export WRF_EM_CORE=1 # Explicitly select ARW core developed by NCAR
export WRF_NMM_CORE=0 # Not NMM core
export WRF_DA_CORE=0 # Not WRFDA
export WRF_CHEM=1 # Select WRF-Chem
export NETCDF=${CRAY_NETCDF_HDF5PARALLEL_PREFIX}
export NETCDFPAR=${CRAY_NETCDF_HDF5PARALLEL_PREFIX}
export PNETCDF=${CRAY_PARALLEL_NETCDF_PREFIX}
export HDF5=${CRAY_HDF5_PARALLEL_PREFIX}
export JASPERINC=${EBROOTJASPER}/include # (Optional)
export JASPERLIB=${EBROOTJASPER}/lib # (Optional)
export ADIOS2=${EBROOTADIOS2}
export WRFIO_NCD_LARGE_FILE_SUPPORT=1 # (Optional)
export PNETCDF_QUILT=1 # (Optional)
export WRF_KPP=1
export FLEX=flex
export FLEX_LIB_DIR=${EBROOTFLEX}/lib
export YACC='/usr/bin/yacc -d'
### Common mistake :: insert spaces before or after =
2. Set install location directory (DIR)
Let set an install path, DIR.
# While being in your desired install location directory, execute
export DIR=$(pwd)
3. Download WRF source code
An example for WRF 4.5.1 is as shown below.
cd $DIR
wget https://github.com/wrf-model/WRF/releases/download/v4.5.1/v4.5.1.tar.gz
tar xzf v4.5.1.tar.gz
mv WRFV4.5.1 WRF
Some chemistry options may be incompatible with the most recent WRF release. Users may need to compile WRF-Chem using older versions.
For other version, check the WRF stable branches on the GitHub repository and its official website. For WRF 3.X, users have to add ./WRFV3/chem folder with these.
4. Enable GRIB2 IO (Optional)
Must set JASPERINC and JASPERLIB in Step 1
Open ${DIR}/WRF/arch/Config.pl (or Config_new.pl) using a text editor such as vi
Change the parameter
$I_really_want_to_output_grib2_from_WRF
from"FALSE"
to"TRUE"
5. Configure
5.1 Run ./configure
5.2 Edit configure.wrf
Open ${DIR}/WRF/configure.wrf using a text editor such as vi
Append
-Wno-implicit-function-declaration -Wno-implicit-int
tocc
.Prepend
-fp-model precise -fp-speculation=safe
toFCBASEOPTS_NO_G
.
5.3 Replace ./share/landread.c with ./share/landread.c.dist
5.4 Edit ./chem/KPP/kpp/kpp-2.1/src/Makefile
Remove all
-ll
in-lfl -ll -o kpp
5.5 Replace KPP folder + Use cpeGNU with two additional flags
Replace ./chem/KPP folder with a newer KPP, e.g., of 3.8.1.
Use cpeGNU → Type 34 → Type 1
Change compilers from gfortran, gcc to cc and ftn
append -fallow-argument-mismatch -fallow-invalid-boz to FCBASEOPTS_NO_G
6. Compile WRF-Chem
7. Example: Job submission script
A. Compile convert_emiss.exe (Optional)
Contact Us
ThaiSC support service : thaisc-support@nstda.or.th