Building WRF

The WRF (Weather Research & Forecasting) Model is a state of the art mesoscale numerical weather prediction system designed for both atmospheric research and operational forecasting applications. It features two dynamical cores, a data assimilation system, and a software architecture supporting parallel computation and system extensibility. The model serves a wide range of meteorological applications across scales from tens of meters to thousands of kilometers. The effort to develop WRF began in the latter 1990’s and was a collaborative partnership of the National Center for Atmospheric Research (NCAR), the National Oceanic and Atmospheric Administration (represented by the National Centers for Environmental Prediction (NCEP) and the Earth System Research Laboratory), the U.S. Air Force, the Naval Research Laboratory, the University of Oklahoma, and the Federal Aviation Administration (FAA).

For researchers, WRF can produce simulations based on actual atmospheric conditions (i.e., from observations and analyses) or idealized conditions. WRF offers operational forecasting a flexible and computationally-efficient platform, while reflecting recent advances in physics, numerics, and data assimilation contributed by developers from the expansive research community. WRF is currently in operational use at NCEP and other national meteorological centers as well as in real-time forecasting configurations at laboratories, universities, and companies. 1

The WRF/WPS compile process requires a signficant amount of resources. Builds must be run as Interactive Jobs to avoid errors. To start an interactive job suitable for building WRF/WPS, run
srun --nodes=1 --ntasks-per-node=4 --mem=10g --time=3:00:00 --qos=short --pty $SHELL.

Building WRF

Due to the way WRF operates, users are expected to compile it themselves on HCC resources. To simplify this process as much as possible, HCC provides an WRF module which loads all of the needed dependency packages and sets up the build environment. Example outputs showing the correct choices for the configure scripts are also provided.

The WRF module sets the various environment variables to their proper values. Users should not set these variables themselves, nor modify their ~/.profile files.

The following sections assume you have downloaded one of the WRF/WPS releases and unpacked it somewhere with sufficient space to work. The extraced WRF and WPS directories should be placed side-by-side in a new empty folder and renamed to WPS and either WRFV3 for WRF versions 3.x, or WRF for WRF versions 4.x. All commands in each section are run starting relative to the top-level directory, denoted here as <WRF root> or <WPS root>.

Building WRF version 3.x

Apply patch

In order to build WRF 3.x successfully , the configure source file requires patching. For convenience, these are contained in a single patch file which can be applied. Note that applying the patch should only be done once after unpacking the source code. Subsequent builds (even after running clean -a) do not require rerunning the patch command. Starting in the top level of the WRF source code directory, the patch may be applied by running

Apply patch for WRFv3
[demo01@c0604.crane WRF]$ wget https://hcc.unl.edu/docs/attachments/wrfv3_rpc_types.patch
[demo01@c0604.crane WRF]$ patch -b -p0 -i wrfv3_rpc_types.patch

Build WRF

The build process for WRFv3 must be run in serial only (i.e. omitting the -j option to ./compile). Attempting to build WRFv3 with more than the default number of build tasks will result in errors.

The following example commands show how to compile WRF v3.x.

Building WRFv3
[demo01@c0604.crane WRFV3]$ ls
arch   compile               dyn_em   external  inc       phys       README.hybrid_vert_coord  README.NMM         README_test_cases   run    tools
chem   configure             dyn_exp  frame     main      README     README.hydro              README.rsl_output  README.windturbine  share  var
clean  configure.wrf.backup  dyn_nmm  hydro     Makefile  README.DA  README.io_config          README.SSIB        Registry            test
[demo01@c0604.crane WRF]$ module purge

[demo01@c0604.crane WRF]$ module load compiler/pgi/20 openmpi/4.0 WRF/v3

[demo01@c0604.crane WRFV3]$ ./configure
checking for perl5... no
checking for perl... found /util/opt/anaconda/deployed-conda-envs/packages/perl/envs/perl-5.26.2/bin/perl (perl)
Will use NETCDF in dir: /util/opt/netcdf/4.7/pgi/20
Will use HDF5 in dir: /util/opt/hdf5/1.12/pgi/20
PHDF5 not set in environment. Will configure WRF for use without.
Will use 'time' to report timing information


If you REALLY want Grib2 output from WRF, modify the arch/Config_new.pl script.
Right now you are not getting the Jasper lib, from the environment, compiled into WRF.

------------------------------------------------------------------------
Please select from among the following Linux x86_64 options:

  1. (serial)   2. (smpar)   3. (dmpar)   4. (dm+sm)   PGI (pgf90/gcc)
  5. (serial)   6. (smpar)   7. (dmpar)   8. (dm+sm)   PGI (pgf90/pgcc): SGI MPT
  9. (serial)  10. (smpar)  11. (dmpar)  12. (dm+sm)   PGI (pgf90/gcc): PGI accelerator
 13. (serial)  14. (smpar)  15. (dmpar)  16. (dm+sm)   INTEL (ifort/icc)
                                         17. (dm+sm)   INTEL (ifort/icc): Xeon Phi (MIC architecture)
 18. (serial)  19. (smpar)  20. (dmpar)  21. (dm+sm)   INTEL (ifort/icc): Xeon (SNB with AVX mods)
 22. (serial)  23. (smpar)  24. (dmpar)  25. (dm+sm)   INTEL (ifort/icc): SGI MPT
 26. (serial)  27. (smpar)  28. (dmpar)  29. (dm+sm)   INTEL (ifort/icc): IBM POE
 30. (serial)               31. (dmpar)                PATHSCALE (pathf90/pathcc)
 32. (serial)  33. (smpar)  34. (dmpar)  35. (dm+sm)   GNU (gfortran/gcc)
 36. (serial)  37. (smpar)  38. (dmpar)  39. (dm+sm)   IBM (xlf90_r/cc_r)
 40. (serial)  41. (smpar)  42. (dmpar)  43. (dm+sm)   PGI (ftn/gcc): Cray XC CLE
 44. (serial)  45. (smpar)  46. (dmpar)  47. (dm+sm)   CRAY CCE (ftn $(NOOMP)/cc): Cray XE and XC
 48. (serial)  49. (smpar)  50. (dmpar)  51. (dm+sm)   INTEL (ftn/icc): Cray XC
 52. (serial)  53. (smpar)  54. (dmpar)  55. (dm+sm)   PGI (pgf90/pgcc)
 56. (serial)  57. (smpar)  58. (dmpar)  59. (dm+sm)   PGI (pgf90/gcc): -f90=pgf90
 60. (serial)  61. (smpar)  62. (dmpar)  63. (dm+sm)   PGI (pgf90/pgcc): -f90=pgf90
 64. (serial)  65. (smpar)  66. (dmpar)  67. (dm+sm)   INTEL (ifort/icc): HSW/BDW
 68. (serial)  69. (smpar)  70. (dmpar)  71. (dm+sm)   INTEL (ifort/icc): KNL MIC
 72. (serial)  73. (smpar)  74. (dmpar)  75. (dm+sm)   FUJITSU (frtpx/fccpx): FX10/FX100 SPARC64 IXfx/Xlfx

Enter selection [1-75] : 54
------------------------------------------------------------------------
Compile for nesting? (1=basic, 2=preset moves, 3=vortex following) [default 1]: 1

Configuration successful!
------------------------------------------------------------------------
testing for MPI_Comm_f2c and MPI_Comm_c2f
   MPI_Comm_f2c and MPI_Comm_c2f are supported
testing for fseeko and fseeko64
fseeko64 is supported
------------------------------------------------------------------------

# Settings for    Linux x86_64 ppc64le i486 i586 i686, PGI compiler with pgcc  (dmpar)
#
DESCRIPTION     =       PGI ($SFC/$SCC)
DMPARALLEL      =        1
OMPCPP          =       # -D_OPENMP
OMP             =       # -mp -Minfo=mp -Mrecursive
OMPCC           =       # -mp
SFC             =       pgf90
SCC             =       pgcc
CCOMP           =       pgcc
DM_FC           =       mpif90
DM_CC           =       mpicc -DMPI2_SUPPORT
FC              =       time $(DM_FC)
CC              =       $(DM_CC) -DFSEEKO64_OK
LD              =       $(FC)
RWORDSIZE       =       $(NATIVE_RWORDSIZE)
PROMOTION       =       -r$(RWORDSIZE) -i4
ARCH_LOCAL      =       -DNONSTANDARD_SYSTEM_SUBR  -DWRF_USE_CLM
CFLAGS_LOCAL    =       -w -O3
LDFLAGS_LOCAL   =
CPLUSPLUSLIB    =
ESMF_LDFLAG     =       $(CPLUSPLUSLIB)
FCOPTIM         =       -O3 #-fastsse -Mvect=noaltcode -Msmartalloc -Mprefetch=distance:8 -Mfprelaxed # -Minfo=all =Mneginfo=all
FCREDUCEDOPT    =       $(FCOPTIM)
FCNOOPT     =       -O0
FCDEBUG         =       # -g $(FCNOOPT)  # -C -Ktrap=fp -traceback
FORMAT_FIXED    =       -Mfixed
FORMAT_FREE     =       -Mfree
FCSUFFIX        =
BYTESWAPIO      =       -byteswapio
FCBASEOPTS_NO_G =       -w $(FORMAT_FREE) $(BYTESWAPIO) $(OMP)
FCBASEOPTS      =       $(FCBASEOPTS_NO_G) $(FCDEBUG)
MODULE_SRCH_FLAG =     -module $(WRF_SRC_ROOT_DIR)/main
TRADFLAG        =      -traditional-cpp
CPP             =      /lib/cpp -P -nostdinc
AR              =      ar
ARFLAGS         =      ru
M4              =      m4 -B 14000
RANLIB          =      ranlib
RLFLAGS     =
CC_TOOLS        =      $(SCC)

###########################################################
######################
# POSTAMBLE

FGREP = fgrep -iq

ARCHFLAGS       =    $(COREDEFS) -DIWORDSIZE=$(IWORDSIZE) -DDWORDSIZE=$(DWORDSIZE) -DRWORDSIZE=$(RWORDSIZE) -DLWORDSIZE=$(LWORDSIZE) \
                     $(ARCH_LOCAL) \
                     $(DA_ARCHFLAGS) \
                      -DDM_PARALLEL \
                       \
                      -DNETCDF \
                       \
                       \
                       \
                       \
                       \
                      -DHDF5 \
                       \
                       \
                       \
                       \
                      -DUSE_ALLOCATABLES \
                      -DGRIB1 \
                      -DINTIO \
                      -DKEEP_INT_AROUND \
                      -DLIMIT_ARGS \
                      -DCONFIG_BUF_LEN=$(CONFIG_BUF_LEN) \
                      -DMAX_DOMAINS_F=$(MAX_DOMAINS) \
                      -DMAX_HISTORY=$(MAX_HISTORY) \
              -DNMM_NEST=$(WRF_NMM_NEST)
CFLAGS          =    $(CFLAGS_LOCAL) -DDM_PARALLEL  \
                      -DMAX_HISTORY=$(MAX_HISTORY) -DNMM_CORE=$(WRF_NMM_CORE)
FCFLAGS         =    $(FCOPTIM) $(FCBASEOPTS)
ESMF_LIB_FLAGS  =
# ESMF 5 -- these are defined in esmf.mk, included above
 ESMF_IO_LIB     =    -L$(WRF_SRC_ROOT_DIR)/external/esmf_time_f90 -lesmf_time
ESMF_IO_LIB_EXT =    -L$(WRF_SRC_ROOT_DIR)/external/esmf_time_f90 -lesmf_time
INCLUDE_MODULES =    $(MODULE_SRCH_FLAG) \
                     $(ESMF_MOD_INC) $(ESMF_LIB_FLAGS) \
                      -I$(WRF_SRC_ROOT_DIR)/main \
                      -I$(WRF_SRC_ROOT_DIR)/external/io_netcdf \
                      -I$(WRF_SRC_ROOT_DIR)/external/io_int \
                      -I$(WRF_SRC_ROOT_DIR)/frame \
                      -I$(WRF_SRC_ROOT_DIR)/share \
                      -I$(WRF_SRC_ROOT_DIR)/phys \
                      -I$(WRF_SRC_ROOT_DIR)/chem -I$(WRF_SRC_ROOT_DIR)/inc \
                      -I$(NETCDFPATH)/include \

REGISTRY        =    Registry
CC_TOOLS_CFLAGS = -DNMM_CORE=$(WRF_NMM_CORE)

 LIB_BUNDLED     = \
                      $(WRF_SRC_ROOT_DIR)/external/fftpack/fftpack5/libfftpack.a \
                      $(WRF_SRC_ROOT_DIR)/external/io_grib1/libio_grib1.a \
                      $(WRF_SRC_ROOT_DIR)/external/io_grib_share/libio_grib_share.a \
                      $(WRF_SRC_ROOT_DIR)/external/io_int/libwrfio_int.a \
                      $(ESMF_IO_LIB) \
                      $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a \
                      $(WRF_SRC_ROOT_DIR)/frame/module_internal_header_util.o \
                      $(WRF_SRC_ROOT_DIR)/frame/pack_utils.o

 LIB_EXTERNAL    = \
                      -L$(WRF_SRC_ROOT_DIR)/external/io_netcdf -lwrfio_nf -L/util/opt/netcdf/4.7/pgi/20/lib -lnetcdff -lnetcdf     -L/util/opt/hdf5/1.12/pgi/20/lib -lhdf5_fortran -lhdf5 -lm -lz

LIB             =    $(LIB_BUNDLED) $(LIB_EXTERNAL) $(LIB_LOCAL) $(LIB_WRF_HYDRO)
LDFLAGS         =    $(OMP) $(FCFLAGS) $(LDFLAGS_LOCAL)
ENVCOMPDEFS     =
WRF_CHEM    =   0
CPPFLAGS        =    $(ARCHFLAGS) $(ENVCOMPDEFS) -I$(LIBINCLUDE) $(TRADFLAG)
NETCDFPATH      =    /util/opt/netcdf/4.7/pgi/20
HDF5PATH        =    /util/opt/hdf5/1.12/pgi/20
WRFPLUSPATH     =
RTTOVPATH       =
PNETCDFPATH     =

bundled:  io_only
external: io_only $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a gen_comms_rsllite module_dm_rsllite $(ESMF_TARGET)
io_only:  esmf_time wrfio_nf   \
      wrf_ioapi_includes wrfio_grib_share wrfio_grib1 wrfio_int fftpack


######################
------------------------------------------------------------------------
Settings listed above are written to configure.wrf.
If you wish to change settings, please edit that file.
If you wish to change the default options, edit the file:
     arch/configure_new.defaults
NetCDF users note:
 This installation of NetCDF supports large file support.  To DISABLE large file
 support in NetCDF, set the environment variable WRFIO_NCD_NO_LARGE_FILE_SUPPORT
 to 1 and run configure again. Set to any other value to avoid this message.


Testing for NetCDF, C and Fortran compiler

This installation of NetCDF is 64-bit
                 C compiler is 64-bit
           Fortran compiler is 64-bit
              It will build in 64-bit


[demo01@c0604.crane WRFV3]$ ./compile em_real
None of WRF_EM_CORE, WRF_NMM_CORE,
        specified in shell environment....
copying Registry/Registry.EM to Registry/Registry

==============================================================================================

V3.9

Compiling: WRF_EM_CORE
WRFIO_NCD_LARGE_FILE_SUPPORT=1

Linux c0604.crane.hcc.unl.edu 4.18.0-372.19.1.el8_6.x86_64 #1 SMP Tue Aug 2 13:42:59 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux

... <intermediate output omitted for clarity>

==========================================================================
build started:   Fri Sep 30 16:49:21 CDT 2022
build completed: Fri Sep 30 16:49:48 CDT 2022

--->                  Executables successfully built                  <---

-rwxr-xr-x 1 demo01 demo 40362432 Sep 30 16:49 main/ndown.exe
-rwxr-xr-x 1 demo01 demo 40173184 Sep 30 16:49 main/real.exe
-rwxr-xr-x 1 demo01 demo 39843768 Sep 30 16:49 main/tc.exe
-rwxr-xr-x 1 demo01 demo 43847392 Sep 30 16:49 main/wrf.exe

==========================================================================

[demo01@c0604.crane WRF]$ ls main/*.exe
main/ndown.exe  main/real.exe  main/tc.exe  main/wrf.exe

If the build finishes successfully a message will be printed, and the four executables (ndown.exe, real.exe, tc.exe, wrf.exe) will be present in the main directory.

Building WRF version 4.x

If you encounter compile errors with some WRFv4 versions, make sure you run compile in serial mode (i.e. ./compile -j 1 em_real).

Since WRFv4.4 the NoahMP code has been moved to an external repository. If downloading the source code from GitHub, DO NOT choose the releases named “Source Code” because they do not include the mandatory NoahMP submodule.

The following example commands show how to compile WRF v4.x.

Building WRFv4
[demo01@c0604.crane WRF]$ ls
arch  clean    configure      doc     external  hydro  LICENSE.txt  Makefile  README     Registry  share  tools  wrftladj
chem  compile  configure.wrf  dyn_em  frame     inc    main         phys      README.md  run       test   var
[demo01@c0604.crane WRF]$ module purge
[demo01@c0604.crane WRF]$ module load compiler/pgi/20 openmpi/4.0 WRF/v4
[demo01@c0604.crane WRF]$ ./configure
checking for perl5... no
checking for perl... found /util/opt/anaconda/deployed-conda-envs/packages/perl/envs/perl-5.26.2/bin/perl (perl)
Will use NETCDF in dir: /util/opt/netcdf/4.7/pgi/20
Will use HDF5 in dir: /util/opt/hdf5/1.12/pgi/20
PHDF5 not set in environment. Will configure WRF for use without.
Will use 'time' to report timing information


If you REALLY want Grib2 output from WRF, modify the arch/Config.pl script.
Right now you are not getting the Jasper lib, from the environment, compiled into WRF.

------------------------------------------------------------------------
Please select from among the following Linux x86_64 options:

  1. (serial)   2. (smpar)   3. (dmpar)   4. (dm+sm)   PGI (pgf90/gcc)
  5. (serial)   6. (smpar)   7. (dmpar)   8. (dm+sm)   PGI (pgf90/pgcc): SGI MPT
  9. (serial)  10. (smpar)  11. (dmpar)  12. (dm+sm)   PGI (pgf90/gcc): PGI accelerator
 13. (serial)  14. (smpar)  15. (dmpar)  16. (dm+sm)   INTEL (ifort/icc)
                                         17. (dm+sm)   INTEL (ifort/icc): Xeon Phi (MIC architecture)
 18. (serial)  19. (smpar)  20. (dmpar)  21. (dm+sm)   INTEL (ifort/icc): Xeon (SNB with AVX mods)
 22. (serial)  23. (smpar)  24. (dmpar)  25. (dm+sm)   INTEL (ifort/icc): SGI MPT
 26. (serial)  27. (smpar)  28. (dmpar)  29. (dm+sm)   INTEL (ifort/icc): IBM POE
 30. (serial)               31. (dmpar)                PATHSCALE (pathf90/pathcc)
 32. (serial)  33. (smpar)  34. (dmpar)  35. (dm+sm)   GNU (gfortran/gcc)
 36. (serial)  37. (smpar)  38. (dmpar)  39. (dm+sm)   IBM (xlf90_r/cc_r)
 40. (serial)  41. (smpar)  42. (dmpar)  43. (dm+sm)   PGI (ftn/gcc): Cray XC CLE
 44. (serial)  45. (smpar)  46. (dmpar)  47. (dm+sm)   CRAY CCE (ftn $(NOOMP)/cc): Cray XE and XC
 48. (serial)  49. (smpar)  50. (dmpar)  51. (dm+sm)   INTEL (ftn/icc): Cray XC
 52. (serial)  53. (smpar)  54. (dmpar)  55. (dm+sm)   PGI (pgf90/pgcc)
 56. (serial)  57. (smpar)  58. (dmpar)  59. (dm+sm)   PGI (pgf90/gcc): -f90=pgf90
 60. (serial)  61. (smpar)  62. (dmpar)  63. (dm+sm)   PGI (pgf90/pgcc): -f90=pgf90
 64. (serial)  65. (smpar)  66. (dmpar)  67. (dm+sm)   INTEL (ifort/icc): HSW/BDW
 68. (serial)  69. (smpar)  70. (dmpar)  71. (dm+sm)   INTEL (ifort/icc): KNL MIC
 72. (serial)  73. (smpar)  74. (dmpar)  75. (dm+sm)   FUJITSU (frtpx/fccpx): FX10/FX100 SPARC64 IXfx/Xlfx

Enter selection [1-75] : 54
------------------------------------------------------------------------
Compile for nesting? (1=basic, 2=preset moves, 3=vortex following) [default 1]: 1

Configuration successful!
------------------------------------------------------------------------
testing for fseeko and fseeko64
fseeko64 is supported
------------------------------------------------------------------------

# Settings for    Linux x86_64 ppc64le i486 i586 i686, PGI compiler with pgcc  (dmpar)
#
DESCRIPTION     =       PGI ($SFC/$SCC)
DMPARALLEL      =        1
OMPCPP          =       # -D_OPENMP
OMP             =       # -mp -Minfo=mp -Mrecursive
OMPCC           =       # -mp
SFC             =       pgf90
SCC             =       pgcc
CCOMP           =       pgcc
DM_FC           =       mpif90
DM_CC           =       mpicc
FC              =       time $(DM_FC)
CC              =       $(DM_CC) -DFSEEKO64_OK
LD              =       $(FC)
RWORDSIZE       =       $(NATIVE_RWORDSIZE)
PROMOTION       =       -r$(RWORDSIZE) -i4
ARCH_LOCAL      =       -DNONSTANDARD_SYSTEM_SUBR  -DWRF_USE_CLM $(NETCDF4_IO_OPTS)
CFLAGS_LOCAL    =       -w -O3 # -DRSL0_ONLY
LDFLAGS_LOCAL   =
CPLUSPLUSLIB    =
ESMF_LDFLAG     =       $(CPLUSPLUSLIB)
FCOPTIM         =       -O3 #-fastsse -Mvect=noaltcode -Msmartalloc -Mprefetch=distance:8 -Mfprelaxed # -Minfo=all =Mneginfo=all
FCREDUCEDOPT    =       $(FCOPTIM)
FCNOOPT     =       -O0
FCDEBUG         =       # -g $(FCNOOPT)  # -C -Ktrap=fp -traceback
FORMAT_FIXED    =       -Mfixed
FORMAT_FREE     =       -Mfree
FCSUFFIX        =
BYTESWAPIO      =       -byteswapio
FCBASEOPTS_NO_G =       -w $(FORMAT_FREE) $(BYTESWAPIO) $(OMP)
FCBASEOPTS      =       $(FCBASEOPTS_NO_G) $(FCDEBUG)
MODULE_SRCH_FLAG =     -module $(WRF_SRC_ROOT_DIR)/main
TRADFLAG        =      -traditional-cpp $(NETCDF4_IO_OPTS)
CPP             =      /lib/cpp -P -nostdinc
AR              =      ar
ARFLAGS         =      ru
M4              =      m4 -B 14000
RANLIB          =      ranlib
RLFLAGS     =
CC_TOOLS        =      $(SCC)
NETCDFPAR_BUILD =      echo SKIPPING

###########################################################
######################
# POSTAMBLE

FGREP = fgrep -iq

ARCHFLAGS       =    $(COREDEFS) -DIWORDSIZE=$(IWORDSIZE) -DDWORDSIZE=$(DWORDSIZE) -DRWORDSIZE=$(RWORDSIZE) -DLWORDSIZE=$(LWORDSIZE) \
                     $(ARCH_LOCAL) \
                     $(DA_ARCHFLAGS) \
                      -DDM_PARALLEL \
                       \
                      -DNETCDF \
                       \
                       \
                       \
                       \
                       \
                       \
                      -DHDF5 \
                       \
                       \
                       -DLANDREAD_STUB=1 \
                       \
                       \
                      -DUSE_ALLOCATABLES \
                      -Dwrfmodel \
                      -DGRIB1 \
                      -DINTIO \
                      -DKEEP_INT_AROUND \
                      -DLIMIT_ARGS \
                      -DBUILD_RRTMG_FAST=0 \
                      -DBUILD_RRTMK=0 \
                      -DBUILD_SBM_FAST=1 \
                      -DSHOW_ALL_VARS_USED=0 \
                      -DCONFIG_BUF_LEN=$(CONFIG_BUF_LEN) \
                      -DMAX_DOMAINS_F=$(MAX_DOMAINS) \
                      -DMAX_HISTORY=$(MAX_HISTORY) \
              -DNMM_NEST=$(WRF_NMM_NEST)
CFLAGS          =    $(CFLAGS_LOCAL) -DDM_PARALLEL  \
                      -DLANDREAD_STUB=1 \
                      -DMAX_HISTORY=$(MAX_HISTORY) -DNMM_CORE=$(WRF_NMM_CORE)
FCFLAGS         =    $(FCOPTIM) $(FCBASEOPTS)
ESMF_LIB_FLAGS  =
# ESMF 5 -- these are defined in esmf.mk, included above
 ESMF_IO_LIB     =    -L$(WRF_SRC_ROOT_DIR)/external/esmf_time_f90 -lesmf_time
ESMF_IO_LIB_EXT =    -L$(WRF_SRC_ROOT_DIR)/external/esmf_time_f90 -lesmf_time
INCLUDE_MODULES =    $(MODULE_SRCH_FLAG) \
                     $(ESMF_MOD_INC) $(ESMF_LIB_FLAGS) \
                      -I$(WRF_SRC_ROOT_DIR)/main \
                      -I$(WRF_SRC_ROOT_DIR)/external/io_netcdf \
                      -I$(WRF_SRC_ROOT_DIR)/external/io_int \
                      -I$(WRF_SRC_ROOT_DIR)/frame \
                      -I$(WRF_SRC_ROOT_DIR)/share \
                      -I$(WRF_SRC_ROOT_DIR)/phys \
                      -I$(WRF_SRC_ROOT_DIR)/wrftladj \
                      -I$(WRF_SRC_ROOT_DIR)/chem -I$(WRF_SRC_ROOT_DIR)/inc \
                      -I$(NETCDFPATH)/include \

REGISTRY        =    Registry
CC_TOOLS_CFLAGS = -DNMM_CORE=$(WRF_NMM_CORE)

LIB             =    $(LIB_BUNDLED) $(LIB_EXTERNAL) $(LIB_LOCAL) $(LIB_WRF_HYDRO)  $(NETCDF4_DEP_LIB)
LDFLAGS         =    $(OMP) $(FCFLAGS) $(LDFLAGS_LOCAL)
ENVCOMPDEFS     =
WRF_CHEM    =   0
CPPFLAGS        =    $(ARCHFLAGS) $(ENVCOMPDEFS) -I$(LIBINCLUDE) $(TRADFLAG)
NETCDFPATH      =    /util/opt/netcdf/4.7/pgi/20.4
HDF5PATH        =    /util/opt/hdf5/1.12/pgi/20
WRFPLUSPATH     =
RTTOVPATH       =
PNETCDFPATH     =

bundled:  io_only
external: io_only $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a gen_comms_rsllite module_dm_rsllite $(ESMF_TARGET)
io_only:  esmf_time wrfio_nf    \
      wrf_ioapi_includes wrfio_grib_share wrfio_grib1 wrfio_int fftpack


######################
------------------------------------------------------------------------
Settings listed above are written to configure.wrf.
If you wish to change settings, please edit that file.
If you wish to change the default options, edit the file:
     arch/configure.defaults
NetCDF users note:
 This installation of NetCDF supports large file support.  To DISABLE large file
 support in NetCDF, set the environment variable WRFIO_NCD_NO_LARGE_FILE_SUPPORT
 to 1 and run configure again. Set to any other value to avoid this message.


Testing for NetCDF, C and Fortran compiler

This installation of NetCDF is 64-bit
                 C compiler is 64-bit
           Fortran compiler is 64-bit
              It will build in 64-bit

NetCDF version: 4.7.4
Enabled NetCDF-4/HDF-5: yes
NetCDF built with PnetCDF: no


*****************************************************************************
This build of WRF will use NETCDF4 with HDF5 compression
*****************************************************************************

[demo01@c0604.crane WRF]$ ./compile -j 1 em_real
Neither WRF_EM_CORE nor WRF_PLUS_CORE
        are explicitly specified in shell environment....
copying Registry/Registry.EM to Registry/Registry

==============================================================================================

V4.4.1
No git found or not a git repository, git commit version not available.

Compiling: WRF_EM_CORE
WRFIO_NCD_LARGE_FILE_SUPPORT=1

Linux c0604.crane.hcc.unl.edu 4.18.0-372.19.1.el8_6.x86_64 #1 SMP Tue Aug 2 13:42:59 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux

... <intermediate output omitted for clarity>

==========================================================================
build started:   Wed Sep 28 22:11:46 CDT 2022
build completed: Wed Sep 28 22:46:42 CDT 2022

--->                  Executables successfully built                  <---

-rwxr-xr-x 1 demo01 demo 52380016 Sep 28 22:46 main/ndown.exe
-rwxr-xr-x 1 demo01 demo 52481680 Sep 28 22:46 main/real.exe
-rwxr-xr-x 1 demo01 demo 51706624 Sep 28 22:46 main/tc.exe
-rwxr-xr-x 1 demo01 demo 59986096 Sep 28 22:45 main/wrf.exe

==========================================================================

[demo01@c0604.crane WRF]$ ls main/*.exe
main/ndown.exe  main/real.exe  main/tc.exe  main/wrf.exe

If the build finishes successfully a message will be printed, and the four executables (ndown.exe, real.exe, tc.exe, wrf.exe) will be present in the main directory.

Building WPS

Building WPS version 3.x

Apply patch

In order to build WPS 3.x successfully , the configure source file requires patching. For convenience, these are contained in a single patch file which can be applied. Note that applying the patch should only be done once after unpacking the source code. Subsequent builds (even after running clean -a) do not require rerunning the patch command. Starting in the top level of the WRF source code directory, the patch may be applied by running

Apply patch for WPSv3
[demo01@c0604.crane WPS]$ wget https://hcc.unl.edu/docs/attachments/wps3_configure.patch
[demo01@c0604.crane WPS]$ patch -b -p0 -i wps3_configure.patch

Build WPSv3

Building WPSv3
[demo01@c0604.crane WPS]$ module purge

[demo01@c0604.crane WPS]$ module load compiler/pgi/20 openmpi/4.0 WRF/v3

[demo01@login.crane WPS]$ ls
arch   compile    external  link_grib.csh  namelist.wps              namelist.wps.fire    README  util
clean  configure  geogrid   metgrid        namelist.wps.all_options  namelist.wps.global  ungrib  wps4_configure.patch

[demo01@login.crane WPS]$ ./configure
Will use NETCDF in dir: /util/opt/netcdf/4.7/pgi/20
Found what looks like a valid WRF I/O library in ../WRF
Found Jasper environment variables for GRIB2 support...
  $JASPERLIB = /util/opt/jasper/2.0/pgi/20/lib
  $JASPERINC = /util/opt/jasper/2.0/pgi/20/include
------------------------------------------------------------------------
Please select from among the following supported platforms.

   1.  Linux x86_64, gfortran    (serial)
   2.  Linux x86_64, gfortran    (serial_NO_GRIB2)
   3.  Linux x86_64, gfortran    (dmpar)
   4.  Linux x86_64, gfortran    (dmpar_NO_GRIB2)
   5.  Linux x86_64, PGI compiler   (serial)
   6.  Linux x86_64, PGI compiler   (serial_NO_GRIB2)
   7.  Linux x86_64, PGI compiler   (dmpar)
   8.  Linux x86_64, PGI compiler   (dmpar_NO_GRIB2)
   9.  Linux x86_64, PGI compiler, SGI MPT   (serial)
  10.  Linux x86_64, PGI compiler, SGI MPT   (serial_NO_GRIB2)
  11.  Linux x86_64, PGI compiler, SGI MPT   (dmpar)
  12.  Linux x86_64, PGI compiler, SGI MPT   (dmpar_NO_GRIB2)
  13.  Linux x86_64, IA64 and Opteron    (serial)
  14.  Linux x86_64, IA64 and Opteron    (serial_NO_GRIB2)
  15.  Linux x86_64, IA64 and Opteron    (dmpar)
  16.  Linux x86_64, IA64 and Opteron    (dmpar_NO_GRIB2)
  17.  Linux x86_64, Intel compiler    (serial)
  18.  Linux x86_64, Intel compiler    (serial_NO_GRIB2)
  19.  Linux x86_64, Intel compiler    (dmpar)
  20.  Linux x86_64, Intel compiler    (dmpar_NO_GRIB2)
  21.  Linux x86_64, Intel compiler, SGI MPT    (serial)
  22.  Linux x86_64, Intel compiler, SGI MPT    (serial_NO_GRIB2)
  23.  Linux x86_64, Intel compiler, SGI MPT    (dmpar)
  24.  Linux x86_64, Intel compiler, SGI MPT    (dmpar_NO_GRIB2)
  25.  Linux x86_64, Intel compiler, IBM POE    (serial)
  26.  Linux x86_64, Intel compiler, IBM POE    (serial_NO_GRIB2)
  27.  Linux x86_64, Intel compiler, IBM POE    (dmpar)
  28.  Linux x86_64, Intel compiler, IBM POE    (dmpar_NO_GRIB2)
  29.  Linux x86_64 g95 compiler     (serial)
  30.  Linux x86_64 g95 compiler     (serial_NO_GRIB2)
  31.  Linux x86_64 g95 compiler     (dmpar)
  32.  Linux x86_64 g95 compiler     (dmpar_NO_GRIB2)
  33.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (serial)
  34.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (serial_NO_GRIB2)
  35.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (dmpar)
  36.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (dmpar_NO_GRIB2)
  37.  Cray XC CLE/Linux x86_64, Intel compiler   (serial)
  38.  Cray XC CLE/Linux x86_64, Intel compiler   (serial_NO_GRIB2)
  39.  Cray XC CLE/Linux x86_64, Intel compiler   (dmpar)
  40.  Cray XC CLE/Linux x86_64, Intel compiler   (dmpar_NO_GRIB2)

Enter selection [1-40] : 5
------------------------------------------------------------------------
Configuration successful. To build the WPS, type: compile
------------------------------------------------------------------------

Testing for NetCDF, C and Fortran compiler

This installation NetCDF is 64-bit
C compiler is 64-bit
Fortran compiler is 64-bit

[demo01@login.crane WPS]$ ./compile
==============================================================================================

Version 4.4

Linux login.crane.hcc.unl.edu 4.18.0-372.19.1.el8_6.x86_64 #1 SMP Tue Aug 2 13:42:59 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux


pgf90 20.4-0 LLVM 64-bit target on x86-64 Linux -tp sandybridge
PGI Compilers and Tools
Copyright (c) 2020, NVIDIA CORPORATION.  All rights reserved.

==============================================================================================


**** Compiling WPS and all utilities ****

... <intermediate output omitted for clarity>

if [ -h int2nc.exe ] ; then \
    /bin/rm -f int2nc.exe ; \
fi ; \
if [ -h ../int2nc.exe ] ; then \
    /bin/rm -f ../int2nc.exe ; \
fi ; \
if [ -e src/int2nc.exe ] ; then \
    ln -sf src/int2nc.exe . ; \
fi

[demo01@login.crane WPS]$ ls
arch     configure             foo_81824.c  geogrid.exe  link_grib.csh  metgrid.log               namelist.wps.fire    README      util
clean    configure.wps         foo_81824.f  geogrid.log  metgrid        namelist.wps              namelist.wps.global  ungrib      wps3_configure.patch
compile  configure.wps.backup  geogrid      gmeta        metgrid.exe    namelist.wps.all_options  namelist.wps.nmm     ungrib.log

[demo01@login.crane WPS]$ ls util/
avg_tsfc.exe      gfs.ncl          int2nc.exe    plotfmt.ncl     plotgrids_new.ncl    src                            vertical_grid_70_20m_80km.txt
calc_ecmwf_p.exe  gfs_old.ncl      Makefile      plotfmt_nc.ncl  plotgrids_old.ncl    vertical_grid_38_20m_G3.txt
g1print.exe       height_ukmo.exe  mod_levs.exe  plotgrids.ncl   rd_intermediate.exe  vertical_grid_50_20m_63km.txt

WPS does not print an explicit “Successful Build” message, but if the build finishes successfully no error messages should be present and several programs will exist in the util folder.

Building WPS version 4.x

Apply patch

In order to build WPS 4.x successfully , the configure source file requires patching. For convenience, these are contained in a single patch file which can be applied. Note that applying the patch should only be done once after unpacking the source code. Subsequent builds (even after running clean -a) do not require rerunning the patch command. Starting in the top level of the WRF source code directory, the patch may be applied by running

Apply patch for WPSv4
[demo01@c0604.crane WPS]$ wget https://hcc.unl.edu/docs/attachments/wps4_configure.patch
[demo01@c0604.crane WPS]$ patch -b -p0 -i wps4_configure.patch

Build WPSv4

Building WPSv4
[demo01@login.crane WPS]$ ls
arch   compile    external  link_grib.csh  namelist.wps              namelist.wps.fire    README  util
clean  configure  geogrid   metgrid        namelist.wps.all_options  namelist.wps.global  ungrib
[demo01@login.crane WPS]$ ./configure
Will use NETCDF in dir: /util/opt/netcdf/4.7/pgi/20
Found what looks like a valid WRF I/O library in ../WRF
Found Jasper environment variables for GRIB2 support...
  $JASPERLIB = /util/opt/jasper/2.0/pgi/20/lib
  $JASPERINC = /util/opt/jasper/2.0/pgi/20/include
------------------------------------------------------------------------
Please select from among the following supported platforms.

   1.  Linux x86_64, gfortran    (serial)
   2.  Linux x86_64, gfortran    (serial_NO_GRIB2)
   3.  Linux x86_64, gfortran    (dmpar)
   4.  Linux x86_64, gfortran    (dmpar_NO_GRIB2)
   5.  Linux x86_64, PGI compiler   (serial)
   6.  Linux x86_64, PGI compiler   (serial_NO_GRIB2)
   7.  Linux x86_64, PGI compiler   (dmpar)
   8.  Linux x86_64, PGI compiler   (dmpar_NO_GRIB2)
   9.  Linux x86_64, PGI compiler, SGI MPT   (serial)
  10.  Linux x86_64, PGI compiler, SGI MPT   (serial_NO_GRIB2)
  11.  Linux x86_64, PGI compiler, SGI MPT   (dmpar)
  12.  Linux x86_64, PGI compiler, SGI MPT   (dmpar_NO_GRIB2)
  13.  Linux x86_64, IA64 and Opteron    (serial)
  14.  Linux x86_64, IA64 and Opteron    (serial_NO_GRIB2)
  15.  Linux x86_64, IA64 and Opteron    (dmpar)
  16.  Linux x86_64, IA64 and Opteron    (dmpar_NO_GRIB2)
  17.  Linux x86_64, Intel compiler    (serial)
  18.  Linux x86_64, Intel compiler    (serial_NO_GRIB2)
  19.  Linux x86_64, Intel compiler    (dmpar)
  20.  Linux x86_64, Intel compiler    (dmpar_NO_GRIB2)
  21.  Linux x86_64, Intel compiler, SGI MPT    (serial)
  22.  Linux x86_64, Intel compiler, SGI MPT    (serial_NO_GRIB2)
  23.  Linux x86_64, Intel compiler, SGI MPT    (dmpar)
  24.  Linux x86_64, Intel compiler, SGI MPT    (dmpar_NO_GRIB2)
  25.  Linux x86_64, Intel compiler, IBM POE    (serial)
  26.  Linux x86_64, Intel compiler, IBM POE    (serial_NO_GRIB2)
  27.  Linux x86_64, Intel compiler, IBM POE    (dmpar)
  28.  Linux x86_64, Intel compiler, IBM POE    (dmpar_NO_GRIB2)
  29.  Linux x86_64 g95 compiler     (serial)
  30.  Linux x86_64 g95 compiler     (serial_NO_GRIB2)
  31.  Linux x86_64 g95 compiler     (dmpar)
  32.  Linux x86_64 g95 compiler     (dmpar_NO_GRIB2)
  33.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (serial)
  34.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (serial_NO_GRIB2)
  35.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (dmpar)
  36.  Cray XE/XC CLE/Linux x86_64, Cray compiler   (dmpar_NO_GRIB2)
  37.  Cray XC CLE/Linux x86_64, Intel compiler   (serial)
  38.  Cray XC CLE/Linux x86_64, Intel compiler   (serial_NO_GRIB2)
  39.  Cray XC CLE/Linux x86_64, Intel compiler   (dmpar)
  40.  Cray XC CLE/Linux x86_64, Intel compiler   (dmpar_NO_GRIB2)

Enter selection [1-40] : 5
------------------------------------------------------------------------
Configuration successful. To build the WPS, type: compile
------------------------------------------------------------------------

Testing for NetCDF, C and Fortran compiler

This installation NetCDF is 64-bit
C compiler is 64-bit
Fortran compiler is 64-bit

[demo01@login.crane WPS]$ ./compile
==============================================================================================

Version 4.4

Linux login.crane.hcc.unl.edu 4.18.0-372.19.1.el8_6.x86_64 #1 SMP Tue Aug 2 13:42:59 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux


pgf90 20.4-0 LLVM 64-bit target on x86-64 Linux -tp sandybridge
PGI Compilers and Tools
Copyright (c) 2020, NVIDIA CORPORATION.  All rights reserved.

==============================================================================================


**** Compiling WPS and all utilities ****

... <intermediate output omitted for clarity>

if [ -h int2nc.exe ] ; then \
    /bin/rm -f int2nc.exe ; \
fi ; \
if [ -h ../int2nc.exe ] ; then \
    /bin/rm -f ../int2nc.exe ; \
fi ; \
if [ -e src/int2nc.exe ] ; then \
    ln -sf src/int2nc.exe . ; \
fi

[demo01@login.crane WPS]$ ls
arch     configure             external     link_grib.csh  namelist.wps              namelist.wps.global  ungrib.exe
clean    configure.wps         geogrid      metgrid        namelist.wps.all_options  README               util
compile  configure.wps.backup  geogrid.exe  metgrid.exe    namelist.wps.fire         ungrib               wps4_configure.patch

[demo01@login.crane WPS]$ ls util/
avg_tsfc.exe      g2print.exe  height_ukmo.exe  mod_levs.exe    plotgrids.exe      plotgrids_old.ncl    vertical_grid_38_20m_G3.txt
calc_ecmwf_p.exe  gfs.ncl      int2nc.exe       plotfmt.ncl     plotgrids.ncl      rd_intermediate.exe  vertical_grid_50_20m_63km.txt
g1print.exe       gfs_old.ncl  Makefile         plotfmt_nc.ncl  plotgrids_new.ncl  src                  vertical_grid_70_20m_80km.txt

WPS does not print an explicit “Successful Build” message, but if the build finishes successfully no error messages should be present and several programs will exist in the util folder.

Running WRF

Example scripts for running WRF are provided here.