Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Updated: 26 July 18 October 2023

Table of Contents
minLevel1
maxLevel4
stylecircle

...

1. Load required modules and set environment variables

Paste the below lines into your terminal. (Putting these in ~/.bashrc is not recommended.)

Code Block
languagebash
module purge
module load cpeIntel/23.0309
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.3739-cpeIntel-23.0309
module load JasPer/1.900.1-cpeIntel-23.0309
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 =

...

3. Download WRF source code

An example for WRF 4.5.1 is as shown below.

Code Block
languagebash
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
Note

Some chemistry options may be incompatible with the most recent WRF release. Users may need to compile WRF-Chem using older versions.

...

Note

Must set JASPERINC and JASPERLIB in Step 1

Warning

GRIB2 IO is now deprecated in WRF 4.6.X.

  • 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"

Code Block
languagebash
vi ${DIR}/WRF/arch/Config.pl           # or Config_new.pl
# Change $I_really_want_to_output_grib2_from_WRF = "FALSE" ; 
#   to   $I_really_want_to_output_grib2_from_WRF = "TRUE" ;

5. Configure

Expand
titleWRF-Chem >4.6.1 with Intel oneAPI compilers (IFX/ICX)
  1. Execute module swap intel intel-oneapi to use the Intel oneAPI compilers

  2. Remove rm -f configure.wrf in ${DIR}/WRF/configure by, for example,
    executing sed -i 's/rm -rf configure.wrf//' ${DIR}/WRF/configure

  3. Run ./configure and select 78 for the new DM + INTEL (ifx/icx) : oneAPI LLVM choice and then select 1 for basic nesting.

  4. Edit ./configure.wrf to

    Code Block
    SFC    =   ftn
    SCC    =   cc
    CCOMP  =   cc
    DM_FC  =   ftn
    DM_CC  =   cc

    also add -fp-speculation=safe to FCBASEOPTS_NO_G

  5. Proceed to “Step 6: Compile WRF-Chem” in the main guide below


Note: It is alright to do Step 2, because the cause was from using the wrong compiler wrappers that are fixed in Step 5.

5.1 Run ./configure

Code Block
languagebash
cd ${DIR}/WRF
./configure
# Type 50, then press Enter <-- (dmpar) INTEL (ftn/icc): Cray XC
# Type 1, then press Enter  <-- Basic nesting 

...

Code Block
#!/bin/bash
#SBATCH -p compute              # Partition
#SBATCH -N 1                    # Number of nodes
#SBATCH --ntasks-per-node=128   # Number of MPI processes per node
#SBATCH -t 5-00:00:00           # Job runtime limit
#SBATCH -J WRFchem              # Job name
#SBATCH -A ltxxxxxx             # Account *** {USER EDIT} ***

module purge
module load cpeIntel/23.0309
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.3739-cpeIntel-23.0309
module load JasPer/1.900.1-cpeIntel-23.0309
module load flexADIOS2/2.6.4.9.1-cpeIntel-23.09

export OMP_NUM_THREADS=1

ulimit -s unlimited

#srun -n16 ./geogrid.exe
#srun -N1 -n1 ./ungrib.exe
#srun -n16 ./metgrid.exe

srun -n16 ./real.exe
srun ./wrf.exe

...

Note

CONVERT_EMISS of some WRF releases could cause an unexpected segmentation fault at runtime (see this and this). CONVERT_EMISS of WRF 3.6.1 and 4.5.X are recommended.

...

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

...