Compilation and Installation
- Use PuTTY to log in to the server as the root user.
- Run the following commands to decompress the WRF installation package.
cd /path/to/WRF tar -xvf WRF-3.8.1.tar.gz
- Run the following command to switch to WRF source code directory:
cd WRF-3.8.1
- Run the following command to modify the arch/configure_new.defaults file.
- Open the arch/configure_new.defaults file.
vim arch/configure_new.defaults
- Press i to enter the insert mode and add the following content above 1856:
################################################## ######### #ARCH Linux aarch64,gnu OpenMPI #serial smpar dmpar dm+sm DESCRIPTION = GNU ($SFC/$SCC) DMPARALLEL = 1 OMPCPP = -D_OPENMP OMP = -fopenmp OMPCC = -fopenmp SFC = gfortran SCC = gcc CCOMP = gcc DM_FC = mpif90 -f90=$(SFC) DM_CC = mpicc -cc=$(SCC) -DMPI2_SUPPORT FC = CONFIGURE_FC CC = CONFIGURE_CC LD = $(FC) RWORDSIZE = CONFIGURE_RWORDSIZE PROMOTION = #-fdefault-real-8 ARCH_LOCAL = -DNONSTANDARD_SYSTEM_SUBR -DWRF_USE_CLM CFLAGS_LOCAL = -w -O3 -c -march=armv8.2-a -L/path/to/MATH/lib -lmathlib LDFLAGS_LOCAL = CPLUSPLUSLIB = ESMF_LDFLAG = $(CPLUSPLUSLIB) FCOPTIM = -O3 -ftree-vectorize -funroll-loops -march=armv8.2-a -L/path/to/MATH/lib -lmathlib FCREDUCEDOPT = $(FCOPTIM) FCNOOPT = -O0 FCDEBUG = # -g $(FCNOOPT) # -fbacktrace -ggdb-fcheck=bounds,do,mem,pointer -ffpe-trap=invalid,zero,overflow FORMAT_FIXED = -ffixed-form FORMAT_FREE = -ffree-form -ffree-line-length-none FCSUFFIX = BYTESWAPIO = -fconvert=big-endian -frecord-marker=4 FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO) FCBASEOPTS = $(FCBASEOPTS_NO_G) $(FCDEBUG) MODULE_SRCH_FLAG = TRADFLAG = -traditional CPP = /lib/cpp -P AR = ar ARFLAGS = ru M4 = m4 -G RANLIB = ranlib RLFLAGS = CC_TOOLS = $(SCC)
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the arch/configure_new.defaults file.
- Run the following commands to configure the pre-compilation environment:
export WRFIO_NCD_LARGE_FILE_SUPPORT=1 export NETCDF=/path/to/NETCDF export HDF5=/path/to/HDF5 export PNETCDF=/path/to/PNETCDF export CPPFLAGS="-I$HDF5/include -I$PNETCDF/include -I$NETCDF/include" export LDFLAGS="-L$HDF5/lib -L$PNETCDF/lib -L$NETCDF/lib -lnetcdf -lnetcdff -lpnetcdf -lhdf5_hl -lhdf5 -lz"
- Run the following command to generate a configuration file:
echo 4 | ./configure
- Run the following command to modify the ./phys/module_cu_g3.F file:
- Open the ./phys/module_cu_g3.F file.
vim ./phys/module_cu_g3.F
- Press i to enter the insert mode and modify the content in line 3125.
integer, dimension (33) :: seed
- Press Esc, type :wq!, and press Enter to save the file and exit.
You can skip this step during the installation of WRF 4.1.2.
- Open the ./phys/module_cu_g3.F file.
- Run the following commands to load the compiler and set the Open MPI environment variables.
export PATH=/path/to/GNU/bin:/path/to/OPENMPI/bin:$PATH export LD_LIBRARY_PATH=/path/to/GNU/lib64:/path/to/OPENMPI/lib:$LD_LIBRARY_PATH
If the environment variables of the compiler and Open MPI have been declared, skip this step.
- Run the following command to perform compilation and installation:
./compile -j 16 em_real 2>&1 | tee -a compile.log
- Run the following command to verify the installation:
ls main
If the following information is displayed (the wrf.exe file is generated), the installation is successful. The installation of the main program takes approximately 10 minutes.

Parent topic: WRF 3.8.1 Porting Guide (CentOS 7.6)