Install your own WRFDA

Updated: 12 January 2024


1. Load required modules and set environment variables

Paste the whole recipe into your terminal.

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 export WRF_EM_CORE=1 # Explicitly select ARW core developed by NCAR export WRF_NMM_CORE=0 # Not NMM core export WRF_CHEM=0 # 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} unset ADIOS2 # ADIOS2 have not yet been integrated well into WRFDA 4dvar. export JASPERINC=${EBROOTJASPER}/include # (Optional) export JASPERLIB=${EBROOTJASPER}/lib # (Optional) export WRFIO_NCD_LARGE_FILE_SUPPORT=1 # (Optional) export PNETCDF_QUILT=1 # (Optional) ### 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

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. Install RTTOV (Optional)

WRFDA 4d-var version 4.5.1 supports up to RTTOV 12.1

  1. Download the source code from https://nwp-saf.eumetsat.int/site/software/rttov/ (registration required)

  2. Make a directory RTTOV, extract the source code and go inside its build directory.

  1. Edit the below lines in the Makefile.local.

  1. Create ./arch/cray-ifort-lanta file that contains the following recipe
    (vi ${DIR}/RTTOV/build/arch/cray-ifort-lanta)

  1. Run the ./rttov_compile.sh script

    1. Type ‘cray-ifort-lanta' → Press ‘Enter'

    2. (Leave blank) → Press ‘Enter'

    3. Type ‘y’ → Press ‘Enter’

    4. Type '-j 2' → Press 'Enter’

    5. Type 'y' → Press 'Enter’
      (This step will take around 10-15 minutes.)

  2. Set the RTTOV environment variable

6. Compile WRFPLUS (Optional, only for 4dvar)

  1. Copy the source code and go inside the directory

  1. Run ./confiugre wrfplus
    → Type ‘26' + Press 'Enter’

  2. Open ./configure.wrf

    • Change icc to cc -Wno-implicit-function-declaration -Wno-implicit-int

    • Append -Wno-implicit-function-declaration -Wno-implicit-int to existing cc

    • Prepend -fp-model precise -fp-speculation=safe to FCBASEOPTS_NO_G.

  3. Compile the program

  1. Run ls ./main/*.exe to check if wrfplus.exe exists.

  2. Set the WRFPLUS_DIR environment variable

7. Compile WRFDA 4dvar

  1. Copy the source code and go inside the directory

  1. Run ./confiugre 4dvar
    → Type ‘26' + Press ‘Enter’
    (Note: for 3dvar, run ./configure wrfda -> Type '50' + Press 'Enter')

  2. Open ./configure.wrf

    • Change icc to cc -Wno-implicit-function-declaration -Wno-implicit-int

    • Append -Wno-implicit-function-declaration -Wno-implicit-int to existing cc

    • Prepend -fp-model precise -fp-speculation=safe to FCBASEOPTS_NO_G.

  3. Run

  1. Run ls ./var/build/*.exe | wc -l to check if 43 executables were successfully compiled.

  2. Run ls ./var/obsproc/src/*.exe to check if obsproc.exe exists.

8. Example: Job submission script


Contact Us
ThaiSC support service : thaisc-support@nstda.or.th