我要评分
获取效率
正确性
完整性
易理解

Compilation and Installation

  1. Use PuTTY to log in to the server as the root user.
  2. Run the following commands to decompress the WRF installation package.
    cd /path/to/WRF
    tar -xvf WRF-3.8.1.tar.gz
  3. Run the following command to switch to WRF source code directory:
    cd WRF-3.8.1
  4. Run the following command to modify the arch/configure_new.defaults file.
    1. Open the arch/configure_new.defaults file.
      vim arch/configure_new.defaults
    2. 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)
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  5. 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"
  6. Run the following command to generate a configuration file:
    echo 4 | ./configure
  7. Run the following command to modify the ./phys/module_cu_g3.F file:
    1. Open the ./phys/module_cu_g3.F file.
      vim ./phys/module_cu_g3.F
    2. Press i to enter the insert mode and modify the content in line 3125.
      integer,  dimension (33) :: seed
    3. 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.

  8. 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.

  9. Run the following command to perform compilation and installation:
    ./compile -j 16 em_real 2>&1 | tee -a compile.log
  10. 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.