cd /path/to/WRF tar -xvf WRF-3.8.1.tar.gz
cd WRF-3.8.1
vim arch/configure_new.defaults
################################################## ######### #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)
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"
yum install libtirpc-devel export C_INCLUDE_PATH=/usr/include/tirpc export CPLUS_INCLUDE_PATH=/usr/include/tirpc
echo 4 | ./configure
vim ./configure.wrf
LIB_EXTERNAL = \ -L$(WRF_SRC_ROOT_DIR)/external/io_netcdf -lwrfio_nf -L/path/to/NETCDF/lib -lnetcdff -lnetcdf -L$(WRF_SRC_ROOT_DIR)/external/io_pnetcdf -lwrfio_pnf -L/path/to/PNETCDF/lib -lpnetcdf -L/path/to/HDF5/lib -lhdf5_fortran -lhdf5 -lm -lz -ltirpc
vim ./phys/module_cu_g3.F
integer, dimension (33) :: seed
在WRF 4.1.2版本安装过程中,本步骤可省略。
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
如果此前已经声明过编译器和OpenMPI的环境变量,本步骤可省略。
./compile -j 16 em_real 2>&1 | tee -a compile.log
如果编译中出现"Fatal Error: Cannot open module file ‘module_initialize_real.mod’ for reading at (1): No such file or directory",但module_initialize_real.mod文件确实已经在main目录下生成了,再次执行命令./compile -j 16 em_real 2>&1 | tee -a compile.log即可完成编译。
编译结束后回显如下图。
ls main
回显如下图,生成了“wrf.exe”可执行文件,表明安装成功,主程序安装时间在10分钟左右。