Compiling and Testing the WRF Model
The Weather Research and Forecasting (WRF) Model is a next-generation 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. – WRF
目录
I. Prerequisites
A. Install perl
, mpi
, hdf5
, netcdf
using the package manager
####### Fedora / CentOS / Redhat #######
#### Perl
sudo dnf/yum install perl perl-devel
#### MPICH2
sudo dnf/yum install mpich mpich-devel mpich-autoreload
#### openmpi
sudo dnf/yum install openmpi openmpi-devel
#### hdf5 & netcdf
sudo dnf/yum install hdf5 hdf5-devel hdf5-mpich hdf5-mpich-devel hdf5-openmpi hdf5-openmpi-devel netcdf netcdf-devel\
netcdf-fortran netcdf-fortran-devel netcdf-fortran-mpich netcdf-fortran-mpich-devel netcdf-fortran-openmpi\
netcdf-fortran-openmpi-devel netcdf-mpich netcdf-mpich-devel netcdf-openmpi netcdf-openmpi-devel
########### ubuntu/debian ##############
#### Perl
sudo apt install perl libperl-dev
#### MPICH2
sudo apt install mpich2 libmpich2-dev
#### openmpi
sudo apt install openmpi-bin openmpi-common libopenmpi-dev
#### netcdf & netcdf-fortran
sudo apt install libhdf5-7 libhdf5-dev libhdf5-mpich2-7 libhdf5-mpich2-dev libhdf5-openmpi-7 libhdf5-openmpi-dev\
libnetcdf-dev libnetcdff5 libnetcdfc7 libhdf5-7 libnetcdfc++4 libcf0 netcdf-bin
########### Windows / macOS ##############
### What? You wanna install WRF on Windows or macOS???? Why are you hating yourself???
##### If you want compile wrf with intel compiler, you should compile and install hdf5, netcdf and netcdf-fortran mannually as below.
B. Compiling hdf5 & netcdf manually
- hdf5. Download hdf5 and unpack it to
hdf5
. Current versions are1.8.20
and1.10.1
, and we choose the latest version.
module load mpi/mpich-x86_64
export HDF5=/usr/local
./configure --prefix=$HDF5 --enable-fortran=yes --enable-hl --enable-optimization=high --enable-parallel CFLAGS='-fPIC'
make && make check && make install
- netcdf and netcdf-fortran. Download netcdf and netcdf-fortran, and unpack them. Current version is
4.6.0
fornetcdf
and4.4.4
fornetcdf-fortran
till5/2/2018
.
cd netcdf-4.6.0
#### XXX: If you install hdf5 into a non-standard location, remember to add $HDF5/include to $C_INCLUDE_PATH and $HDF4/lib to $LD_LIBRARY_PATH
export NETCDF=/usr/local
./configure --prefix=$NETCDF --enable-dot --enable-fsync --enable-cdf5 LDFLAGS="-L$HDF5/lib" CPPFLAGS="-I$HDF5/include"
make -j4 && make check && make install
cd ../
cd netcdf-fortran-4.4.4
./configure --prefix=/usr/local --enable-dot LDFLAGS="-L$HDF5/lib -L$NETCDF/lib" CPPFLAGS="-I$HDF5/include -I$NETCDF/include"
ake -j4 && make check && make install
II. Compiling WRF
- The latest release of WRF is
3.9.1.1
till now5/2/2018
. Download the WRF source code, and extract it toWRF
- Configure
WRF
module load mpi/mpich-x86_64
#### If you didn't set NETCDF and HDF5 environment variables, set them to where they are installed.
#export NETCDF=/usr/local
#export HDF5=/usr/local
export WRFIO_NCD_LARGE_FILE_SUPPORT=1
#### run ./configure
./configure
After run `./configure`, it will let us to choose which option to compile. Here we choose `35`, which `wrf` will use `mpi` and `openmp`.
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
#### nesting option: 1=basic just ok
Compile for nesting? (1=basic, 2=preset moves, 3=vortex following) [default 1]: 1
......
#### configure done
- After
configure
finished, we then can run./compile wrf
to compileWRF
. Note that if one choose INTEL compiler withmpi
andopenmp
, one might need to editconfigure.wrf
by changing-openmp
to-qopenmp
, or it will fail to compile.
./compile wrf
./compile em_real
#./compile em_fire
#./compile convert_em
When compilation is done, you will find `wrf.exe` and other executable files under the `main` directory.
III. Runnig Test of WRF
The test directory is WRF/run
, and you can run a test job on a cluster… -_-…


