- 基础开发环境
- 依赖库
- WRF安装
- WPS安装
基础开发环境
系统:CentOS 7桌面版
硬盘:100G
内存:2G
编译器:GNU(gcc、g++、gfortran)4.8.5
安装过程:
yum install gcc
yum install cpp gcc-c++
yum install gcc-gfortran
yum install unzip time nfs-utils perl tcsh wget m4
yum install mlocate
yum install libX11-devel
yum install libXext-devel
yum install libXrender-devel
yum install fontconfig-devel
依赖库
1./home/username下创建文件夹
Build_WRF 存放WRF的安装源码包
|--LIBRARIES 依赖库安装父目录
|--geos 存放geos static数据
|--DATA 存放real time数据
|--src 存放依赖库安装源码包
2.安装netcdf-4.1.3
设置环境变量:
export DIR=/home/username/Build_WRF/LIBRARIES
export CC="gcc"
export CXX="g++"
export FC="gfortran"
export FCFLAGS="-m64"
export F77="gfortran"
export FFLAGS="-m64"
安装过程:
cd /home/username/Build_WRF/src
tar xzvf netcdf-4.1.3.tar.gz
cd netcdf-4.1.3
./configure –prefix=$DIR/netcdf –disable-dap –disable-netcdf-4 –disable-shared
make -j2
make install
添加环境变量
vi ~/.bash_profile
在文件末尾添加如下语句,保存后退出:
###netcdf
export PATH=/home/wrf/Build_WRF/LIBRARIES/netcdf/bin:$PATH
export NETCDF=/home/wrf/Build_WRF/LIBRARIES/netcdf
export NETCDF_LIB=$NETCDF/lib
export NETCDF_INC=$NETCDF/include
export MANPATH=$NETCDF/share/man
export LD_LIBRARY_PATH=$NETCDF/lib:$LD_LIBRARY_PATH
执行文件:
source ~/.bash_profile
也可以不添加进文件,但是在安装WRF和WPS需要再次输入这些语句
3.安装mpich-3.0.4
安装过程:
cd /home/username/Build_WRF/src
tar xzvf mpich-3.4.0.tar.gz
cd mpich-3.4.0
./configure –prefix=$DIR/mpich
make -j2
make install
添加环境变量
vi ~/.bash_profile
在文件末尾添加如下语句,保存后退出:
###mpich
export PATH=/home/wrf/Build_WRF/LIBRARIES/mpich/bin:$PATH
执行文件:
source ~/.bash_profile
4.安装zlib-1.2.7
添加环境变量:
export LDFLAGS=’-L$DIR/grib2/lib’
export CPPFLAGS=’-I$DIR/grib2/include’
安装过程:
cd /home/username/Build_WRF/src
tar xzvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure –prefix=$DIR/grib2
make -j2
make install
5.安装libpng-1.2.50
安装过程:
cd /home/username/Build_WRF/src
tar xzvf libpng-1.2.50.tar.gz
cd libpng-1.2.50
export LDFLAGS=’-L$DIR/grib2/lib’
export CPPFLAGS=’-I$DIR/grib2/include’
./configure –prefix=$DIR/grib2
make -j2
make install
添加环境变量
vi ~/.bash_profile
在文件末尾添加如下语句,保存后退出:
###libpng
export LDFLAGS=-L/home/wrf/Build_WRF/LIBRARIES/grib2/lib
export CPPFLAGS=-I/home/wrf/Build_WRF/LIBRARIES/grib2/include
export LD_LIBRARY_PATH=/home/wrf/Build_WRF/LIBRARIES/grib2/lib:$LD_LIBRARY_PATH
执行文件:
source ~/.bash_profile
6.安装jasper-1.900.1
安装过程
cd /home/username/Build_WRF/src
tar xzvf jasper-1.900.1.tar.gz
cd jasper-1.900.1
./configure –prefix=$DIR/grib2
make -j2
make install
添加环境变量
vi ~/.bash_profile
在文件末尾添加如下语句,保存后退出:
###jasper
export JASPERLIB=/home/wrf/Build_WRF/LIBRARIES/grib2/lib
export JASPERINC=/home/wrf/Build_WRF/LIBRARIES/grib2/include
export PATH=/home/wrf/Build_WRF/LIBRARIES/grib2/bin:$PATH
执行文件:
source ~/.bash_profile
7.安装ncl_ncarg-6.4.0-Centos7.3_64bit_gnu485
安装过程
mkdir -p /home/username/Build_WRF/LIBRARIES/ncl
cd /home/username/Build_WRF/LIBRARIES/ncl
tar xzvf /home/username/Build_WRF/src/ncl_ncarg-6.4.0-Centos7.3_64bit_gnu485.tar.gz
添加环境变量
vi ~/.bash_profile
在文件末尾添加如下语句,保存后退出:
###ncl
export NCARG_ROOT=//home/wrf/Build_WRF/LIBRARIES/ncl
export PATH=$NCARG_ROOT/bin:$PATH
执行文件:
source ~/.bash_profile
WRF安装
添加环境变量
vi ~/.bash_profile
在文件末尾添加如下语句,保存后退出:
###WRF
ulimit -s unlimited
export MALLOC_CHECK_=0
export WRF_EM_CORE=1
export WRFIO_NCD_LARGE_FILE_SUPPORT=1
执行文件:
source ~/.bash_profile
安装过程:
cd /home/username/Build_WRF
tar -xzvf WRFV3.8.1.TAR.gz
cd WRFV3
./configure
此时会提示选择需要编译的类型,可根据硬件、编译器等来选择
选好类型后,下一个选项填1即可。configure运行成功后运行compile:
./compile em_real >& log.compile
compile运行结束后可通过查看log.compile文件后几行来判断是否成功,或者输入:
ls -lah main/*.exe
显示如图即为成功:
WPS安装
安装过程:
cd /home/username/Build_WRF
tar -xzvf WPSV3.8.1.TAR.gz
cd WPS
export JASPERLIB=/home/wrf/Build_WRF/LIBRARIES/grib2/lib
export JASPERINC=/home/wrf/Build_WRF/LIBRARIES/grib2/include
./configure
显示如图,同样根据硬件、系统和编译器选择,还要考虑之前WRF选择的类型:
configure成功后需要修改configure.wps:
vi configure.wps
修改一:DM_FC的值只保留mpif90
DM_FC = mpif90
修改二:WRF_LIB最后一行末尾加上“ -lgomp”
WRF_LIB = -L$(WRF_DIR)/external/io_grib1 -lio_grib1 \
-L$(WRF_DIR)/external/io_grib_share -lio_grib_share \
-L$(WRF_DIR)/external/io_int -lwrfio_int \
-L$(WRF_DIR)/external/io_netcdf -lwrfio_nf \
-L$(NETCDF)/lib -lnetcdff -lnetcdf **-lgomp**
保存后退出,然后运行compile:
./compile >& log.compile
compile运行结束后可通过查看log.compile文件后几行来判断是否成功,或者输入:
ls -lah *.exe
显示如图即为成功: