登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 iui 于 2021-11-28 21:23 编辑
#开始
mkdir Build_WRF cd Build_WRF # which csh看看,如果没有输出,证明系统里没有csh,按照下列步骤安装csh mkdir csh dpkg -X csh_20110502-3_amd64.deb csh # exec csh/bin/csh/bin/bsd-csh # 下载下面5个库 # 设置环境变量 export DIR=/xx/WRF/Build_WRF/LIBRARIES export CC=gcc export CXX=g++ export FC=gfortran export FCFLAGS=-m64 export F77=gfortran export FFLAGS=-m64 export JASPERLIB=$DIR/grib2/lib export JASPERINC=$DIR/grib2/include export LDFLAGS=-L$DIR/grib2/lib export CPPFLAGS=-I$DIR/grib2/include # 有些机器上执行后续的WPS/WRF exe时,出现cannot open libpng12.so no such file or directory等时,需要把$DIR/grib2/lib加到LD_LIBRARY_PATH里 export LD_LIBRARY_PATH=$DIR/grib2/lib:$LD_LIBRARY_PATH
#安装NetCDF 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 -j 32 make install export PATH=$DIR/netcdf/bin:$PATH export NETCDF=$DIR/netcdf cd .. # 安装MPICH tar xzvf mpich-3.0.4.tar.gz cd mpich-3.0.4 ./configure --prefix=$DIR/mpich make -j 32 make install export PATH=$DIR/mpich/bin:$PATH cd .. # 安装zlib tar xzvf zlib-1.2.7.tar.gz cd zlib-1.2.7 ./configure --prefix=$DIR/grib2 make -j 32 make install cd .. # 安装libpng tar xzvf libpng-1.2.50.tar.gz cd libpng-1.2.50 ./configure --prefix=$DIR/grib2 make -j 32 make install cd .. # 安装Jasper tar xzvf jasper-1.900.1.tar.gz cd jasper-1.900.1 ./configure --prefix=$DIR/grib2 make -j 32 make install cd .. # 安装WRF tar xzvf WRFV4.0.TAR.gz cd WRF # 选择32 GNU(serial) 然后compile for netest选basic 详情见图1 # 如果此步骤出现如图1.1所示问题,需要先 export NETCDF_classsic=1 ./configure # 如果系统里没有csh用下面命令 ../csh/bin/bsd-csh ./compile em_real # 如果系统里有csh,直接 ./compile em_real # 如果想要加入编译过程,修改compile make参数将j 2改成j 32,详情见图2 # 需要先安装WRF,再安装WPS tar xzvf WPSV4.0.TAR.gz cd WPS # 选1或者3 ./configure # 如果系统里没有csh用下面命令 ../csh/bin/bsd-csh ./compile # 如果系统里有csh,直接./compile # 如果编译出错,出现:Arguments of ‘iand’ have different kind type parameters at (1 ./compile
# 注意如果编译完WPS,ls只有ungrib.exe,没有geogrid和metgrid # 是因为WRF configure时没有选对,我按照下列issue将WRF编译时的configure改为了serial就行了 # bash设置环境变量 export DIR=/xx/WRF/Build_WRF/LIBRARIES export CC=gcc export CXX=g++ export FC=gfortran export FCFLAGS=-m64 export F77=gfortran export FFLAGS=-m64 export JASPERLIB=$DIR/grib2/lib export JASPERINC=$DIR/grib2/include export LDFLAGS=-L$DIR/grib2/lib export CPPFLAGS=-I$DIR/grib2/include
export PATH=$DIR/netcdf/bin:$PATH export NETCDF=$DIR/netcdf export PATH=$DIR/mpich/bin:$PATH
export LD_LIBRARY_PATH=$DIR:$LD_LIBRARY_PATH # csh设置环境变量 setenv DIR /xx/WRF/Build_WRF/LIBRARIES setenv CC gcc setenv CXX g++ setenv FC gfortran setenv FCFLAGS -m64 setenv F77 gfortran setenv FFLAGS -m64 setenv JASPERLIB $DIR/grib2/lib setenv JASPERINC $DIR/grib2/include setenv LDFLAGS -L$DIR/grib2/lib setenv CPPFLAGS -I$DIR/grib2/include
setenv PATH $DIR/mpich/bin:$PATH setenv PATH $DIR/netcdf/bin:$PATH setenv NETCDF $DIR/netcdf setenv LD_LIBRARY_PATH $DIR:$LD_LIBRARY_PATH
备注:如果编译完WRF后需要修改./configure,需要重新解压一份新的WRF,因为编译过的WRF有些文件有了改动
|