Redhat 5.6 ES Intel编译器 安装WRF 的全过程

来源:互联网 发布:中国移动 大数据 优势 编辑:程序博客网 时间:2024/06/05 10:57

一、操作系统安装:
建议完全安装RH5.6.

   建议选择每个安装包(语言包除外)。
二、编译器:
1、安装 Intel C 编译器:
[Intel.C...编译器].TLF‐SOFT‐Intel.C.Plus.Plus.Compiler.Professional.v11.1.046.LINUX‐SPYRAL.iso
安装步骤参照SPYRAL 目录下install‐cpp‐linux.txt:
Launch the setup.
When asked, select the "Alternative activation" option.
Use the included license file.
2、安装 Intel Fortran 编译器:
[Intel.Fortran.编译器Linux 专业版].TLF‐SOFT‐Intel.Fortran.Compiler.Professional.v11.1.046.LINUX‐SPYRAL.iso
安装步骤参照SPYRAL 目录下install‐cpp‐linux.txt:
Launch the setup.
When asked, select the "Alternative activation" option.
Use the included license file.
3、安装MPI[如果使用了嵌套,则必须装]
Intel.Cluster.Toolkit.Compiler.Edition.v3.1.LINUX.DVD.ISO 中提取mpi.tar
复制到/opt 目录下:
#tar –zxvf mpi.tar
#./install
完成安装后,MPI 安装在:/opt/ intel 下。
三、WRF 安装前需要的软件包的安装
1、gFortran:
只需要执行
# ln ‐s /usr/lib/libg2c.so.0 /usr/lib/libg2c.so
# ln ‐s /usr/lib/libgfortran.so.3 /usr/lib/libgfortran.a
2、安装 jasper‐1.900.1
#unzip jasper‐1.900.1.zip
#./configure ‐‐prefix=/usr/local/jasper
#make
#make install
3、安装netcdf‐4.0.tar.gz

#tar –zxvf netcdf‐4.0.tar.gz
#./configure ‐‐prefix=/usr/local/netcdf4
#make all
#make check
#make install
4、安装 libpng‐1.5.0.tar.gz
#tar –zxvf libpng‐1.5.0.tar.gz
#./configure ‐‐prefix=/usr/local/libpng
#make
#make install
5、安装 zlib‐1.2.5.tar.gz
#tar –zxvf zlib‐1.2.5.tar.gz
#./configure ‐‐prefix=/usr/local/zlib
#make
#make install
6、安装ncl
#mkdir /usr/local/ ncarg
#cp ./ ncl_ncarg‐5.2.1.Linux_i686_nodap_gcc432.tar.gz /usr/home/local/ncarg
#cd /usr/home/local/ncarg
#tar ‐zxvf ncl_ncarg‐5.2.1.Linux_i686_nodap_gcc432.tar
四、环境变量
/etc/profile 文件添加
ulimit ‐s unlimited
export INTEL_COMPILER_TOPDIR=/opt/intel/Compiler/11.1/046
export NETCDF=/usr/local/netcdf4
export NCARG=/usr/local/ncarg
export NCARG_ROOT=/usr/local/ncarg
export
PATH=$JAVA_HOME/bin:/opt/intel/mpi/3.1/include:/opt/intel/mpi/3.1/lib:/opt/intel/mpi/3.1/bin:/opt/intel/Compiler/
11.1/046/bin:/opt/intel/Compiler/11.1/046/bin/ia32:/opt/intel/Compiler/11.1/046/include:/opt/intel/Compiler/11.1/
046/lib/ia32:$NETCDF/lib:$NETCDF/include:$NCARG/bin:$NCARG/lib:$NCARG/include:/usr/local/libpng/include:/usr/l
ocal/libpng/bin:$PATH
export WRFIO_NCD_LARGE_FILE_SUPPORT=1
export JASPERLIB=/usr/local/jasper/lib
export JASPERINC=/usr/local/jasper/include
export INCLUDE=/usr/include:$INCLUDE
export LD_LIBRARY_PATH=/opt/intel/Compiler/11.1/046/lib/ia32:/usr/lib/:/opt/intel/mpi/3.1/lib:$LD_LIBRARY_PATH
export WRFIO_NCD_LARGE_FILE_SUPPORT=1
export DM_FC=mpiifort
export DM_CC=mpiicc
五、安装 WRFV3

#mkdir /wrf
1、解压缩:

# cp WRFV3.1.1.TAR.gz /wrf

#cd  /wrf
#gzip ‐cd WRFV3.1.1.TAR.gz | tar ‐xf –
2、运行命令:
#/opt/intel/Compiler/11.1/046/bin/ia32/ifortvars_ia32.sh
#/opt/intel/Compiler/11.1/046/bin/ia32/iccvars_ia32.sh
#cd WRFV3
3、配置:
#./configure ‐‐prefix=/opt/WRFV3‐mpi
Please select from among the following supported platforms.
1. Linux i486 i586 i686, gfortran compiler with gcc (serial)
2. Linux i486 i586 i686, gfortran compiler with gcc (smpar)
3. Linux i486 i586 i686, gfortran compiler with gcc (dmpar)
4. Linux i486 i586 i686, gfortran compiler with gcc (dm+sm)
5. Linux i486 i586 i686, g95 compiler with gcc (serial)
6. Linux i486 i586 i686, g95 compiler with gcc (dmpar)
7. Linux i486 i586 i686, PGI compiler with gcc (serial)
8. Linux i486 i586 i686, PGI compiler with gcc (smpar)
9. Linux i486 i586 i686, PGI compiler with gcc (dmpar)
10. Linux i486 i586 i686, PGI compiler with gcc (dm+sm)
11. Linux x86_64 i486 i586 i686, ifort compiler with icc (serial)
12. Linux x86_64 i486 i586 i686, ifort compiler with icc (smpar)
13. Linux x86_64 i486 i586 i686, ifort compiler with icc (dmpar)
14. Linux x86_64 i486 i586 i686, ifort compiler with icc (dm+sm)
15. Linux i486 i586 i686 x86_64, PathScale compiler with pathcc (serial)
16. Linux i486 i586 i686 x86_64, PathScale compiler with pathcc (dmpar)
Enter selection [1‐16] :11
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
Compile for nesting? (0=no nesting, 1=basic, 2=preset moves, 3=vortex following) [default 0]: 1
包含嵌套。

 

选11。然后输入1(base),这里表示包含嵌套。

3、编译[无需全部编译,做什么就编译需要的模块]
执行命令
#/opt/intel/Compiler/11.1/046/bin/ia32/ifortvars_ia32.sh
#/opt/intel/Compiler/11.1/046/bin/ia32/iccvars_ia32.sh
开始编译:
#mkdir ./buildlog ;编译日志目录

#./compile em_real &> ./buildlog/em_real


#./compile em_b_wave &> ./buildlog/em_b_wave
#./compile em_grav2d_x &> ./buildlog/em_grav2d_x
#./compile em_heldsuarez &> ./buildlog/em_heldsuarez
#./compile em_hill2d_x &> ./buildlog/em_hill2d_x
#./compile em_les &> ./buildlog/em_les
#./compile em_quarter_ss &> ./buildlog/em_quarter_ss
#./compile em_seabreeze2d_x &> ./buildlog/em_seabreeze2d_x
#./compile em_squall2d_x &> ./buildlog/em_squall2d_x
#./compile em_squall2d_y &> ./buildlog/em_squall2d_y
5、检查:
ls ‐ls main/*.exe
如果编译real,那么你可以看到 ndown.exe, real.exe, and wrf.exe文件生成。
if you built an ideal‐data case, you should see ideal.exe and wrf.exe
六、安装WPSV3.1.1.TAR.gz
1、解压缩:

# cp WPSV3.1.1.TAR.gz /wrf

#cd  /wrf
#gzip ‐cd WPSV3.1.1.TAR.gz | tar ‐xf –
2、配置


#cd WPS
#./configure
Please select from among the following supported platforms.
1. PC Linux i486 i586 i686, PGI compiler serial, NO GRIB2
2. PC Linux i486 i586 i686, PGI compiler serial
3. PC Linux i486 i586 i686, PGI compiler DM parallel, NO GRIB2
4. PC Linux i486 i586 i686, PGI compiler DM parallel
5. PC Linux i486 i586 i686, Intel compiler serial, NO GRIB2
6. PC Linux i486 i586 i686, Intel compiler serial
7. PC Linux i486 i586 i686, Intel compiler DM parallel, NO GRIB2
8. PC Linux i486 i586 i686, Intel compiler DM parallel
9. PC Linux i486 i586 i686, g95 compiler, serial, NO GRIB2
10. PC Linux i486 i586 i686, g95 compiler, serial
11. PC Linux i486 i586 i686, g95 compiler, DM PARALLEL, NO GRIB2
12. PC Linux i486 i586 i686, g95 compiler, DM PARALLEL
13. PC Linux i486 i586 i686, gfortran compiler, serial, NO GRIB2
14. PC Linux i486 i586 i686, gfortran compiler, serial
15. PC Linux i486 i586 i686, gfortran compiler, DM PARALLEL, NO GRIB2
16. PC Linux i486 i586 i686, gfortran compiler, DM PARALLEL
Enter selection [1‐16] :6

注意:如果ungrib.exe的输入文件是grib2格式,则选6;如果ungrib.exe的输入文件是grib1格式,则选5。
3、修改配置文件后才可以编译
#gedit ./configure.wps 文件修改如下行:
COMPRESSION_LIBS = ‐L/usr/lib /
‐lpng12 ‐lpng ‐lz /
‐L/usr/local/jasper/lib ‐ljasper
COMPRESSION_INC = ‐I/usr/include /
‐I/usr/local/jasper/include
NCARG_LIBS = ‐L$(NCARG_ROOT)/lib ‐lncarg ‐lncarg_gks ‐lncarg_c /
‐L/usr/lib ‐lX11 /
‐L/usr/lib ‐lgfortran
4、执行编译
#./compile &>/wrf/logger.txt
5、检查:
ls ‐ls *.exe
you should see geogrid.exe, ungrib.exe, and metgrid.exe
ls ‐ls util/*.exe
you should see a number of utility executables:
avg_tsfc.exe, g1print.exe,
g2print.exe, mod_levs.exe,
plotfmt.exe, plotgrids.exe,
and rd_intermediate.exe

七、安装地形资料文件geog

   #cd /wrf

   #tar -zxvf geog.tar.gz


八、运行WRF[real case]

  流程如下:

    geogrid ----|

                      |----metgrid--real --wrf

    ungrib   ----|

1、天气预报文件下载:

    http://motherlode.ucar.edu/native/grid/NCEP/GFS/Global_onedeg


2、拆分天气预报文件:

    采用wgrib2工具把预报文件拆解成每个3小时一个的文件。 wgrib2在 http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/index.html可找到。

参见《利用Wgrib2拆分美国天气预报(grib2格式)的方法

3、设置/wrf/WPS/namelist.wps

    例如(嵌套):

     &share
 wrf_core = 'ARW',   #输出数据是WRF;还可以是NMM
 max_dom = 3,        #域/嵌套数目,这里是3,表示2级嵌套
 start_date = '2011-05-24_00:00:00','2011-05-24_00:00:00','2011-05-24_00:00:00', #开始时间
 end_date   = '2011-05-25_00:00:00','2011-05-25_00:00:00','2011-05-25_00:00:00', #结束时间
 interval_seconds = 10800  #时间间隔,单位是妙。这里表示3小时
 io_form_geogrid = 2,          #WRFI/O API格式,geogrid.exe将写入文件。1:表示2进制;2:表示netcdf;3:grib1
/

&geogrid
 parent_id         =   1,   1,    2,
 parent_grid_ratio =   1,   3,    3,
 i_parent_start    =   1,  16,    8,  # X,Y的坐标
 j_parent_start    =   1,  16,    8,  #坐标
 e_we              =  40,  25,    31, #西东尺寸
 e_sn              =  40,  25,    31,  #南北尺寸
 geog_data_res     = '10m','2m',  '30s', #地形设置
 dx = 40000,                                      
 dy = 40000,
 map_proj = 'lambert',
 ref_lat   =  39.92,           #这里设置中心点的
 ref_lon   = 116.46,          #经纬度
 truelat1  =  30.0,
 truelat2  =  60.0,
 stand_lon = 116.46,
 geog_data_path = '/wrf/geog'                #地形文件目录
/

&ungrib
 out_format = 'WPS',     #ungrib的输出格式
 prefix = 'FILE',              #输出文件的前缀
/

&metgrid
 fg_name = 'FILE'         #ungrib生成文件的前缀
 io_form_metgrid = 2, #metgrid输出文件的格式,这里为netcdf
/

4、根据具输入文件格式创建Vtable连接。

5、运行/wrf/WPS/geogrid.exe

6、连接数据文件,运行/wrf/WPS/link_grib.csh

7、运行/wrf/WPS/ungrib.exe

8、运行/wrf/WPS/metgrid.exe

9、把/wrf/WPS目录下的met_em*.nc拷贝到/wrf/WRFV3/test/em_real目录下.

10、修改/wrf/WRFV3/test/em_real/namelist.input

11、运行/wrf/WRFV3/test/em_real/real.exe

12、运行/wrf/WRFV3/test/em_real/wrf.exe

14、检查生成文件:

  /wrf/WRFV3/test/em_real下的 wrfout_d01_* 、wrfout_d02_*(2层嵌套才有)
、wrfout_d03_*(3层嵌套才有)
注意:Intel编译器安装好后运行./wrf.exe(, 此过程出现segmentation fault, 需要在运行wrf.exe
之前执行ulimit –s unlimited, 再执行wrf.exe)。最好把ulimit –s unlimited 写在/etc/profile
文件中,就不需要每次运行wrf.exe 前执行ulimit –s unlimited 命令了。

原创粉丝点击