一、安装WPS+WRF
# 先安装wrf
# 载入所需依赖模块
module load wrf-deps/intel-2015B
cd /WRF
./configure
17. Linux x86_64 i486 i586 i686, ifort compiler with icc (serial)
18. Linux x86_64 i486 i586 i686, ifort compiler with icc (smpar)
19. Linux x86_64 i486 i586 i686, ifort compiler with icc (dmpar)
20. Linux x86_64 i486 i586 i686, ifort compiler with icc (dm+sm)
#选19
p.s.
# 关于并行串行的介绍
serial 表示串行计算;
smpar 表示内存共享并行计算(shared memory option),即使用openMP,大部分多核电脑都支持这项功能;
dmpar 表示分布式并行计算(distributed memory option),即使用MPI 进行并行计算,主要用在计算集群,单个电脑就没必要用了;
dm+sm 表示同时使用openMP与MPI两种并行方式.
# 编译这步非常非常久,为防止ssh自动超时断线,推荐nohup方式
./compile
# nohup方式后台运行
nohup ./compile em_real >& compile.log &
==========================================================
# 再安装WPS
# 载入所需依赖模块
module load WPS/3.5.1-intel-2015B-dmpar
module load netCDF-Fortran/4.4.0-intel-2015B
./configure
17. Linux x86_64, Intel compiler (serial)
18. Linux x86_64, Intel compiler (serial_NO_GRIB2)
19. Linux x86_64, Intel compiler (dmpar)
20. Linux x86_64, Intel compiler (dmpar_NO_GRIB2)
选17
# 编译这步不会很久
./compile
二、下载气象数据CFSR
CFSR数据是NCEP提供的再分析数据,包含1979.1-2011.1的海洋、大气、陆地产品,时间步长为6小时,空间分辨率提供0.3, 0.5, 1.0, 1.9, 2.5°。另外CFSv2提供2011年-2019年的数据。
- 在NCAR-UCAR网站注册用户;
- 选择ds093.0数据-NCEP Climate Forecast System Reanalysis (CFSR) 6-hourly Products, January 1979 to December 2010;
- 点击Data Access-Data File Downloads-Web Server Holdings-Web File Listing-Faceted Browse;
- 选择数据包,以下两套数据都要下载;
- 可以直接点击文件名下载,也可以勾选文件后使用其提供的下载脚本下载;
- 拷贝到**WPS/run/test3路径下解压;
第一套:Pressure levels preset
选择时间范围,点击Parameter presets:WRF Model Input:Vtable. CFSR - Pressure levels preset,不要设置区域,因为WRF只识别CFSR全球数据,否则报错;高度包含37层1-1000mbar,还有Mean sea level、Specified height above ground: 2 m。数据为6小时预报,空间分辨率0.5x0.5°;
其中包含:
Geopotential height
Pressure reduced to MSL
Relative humidity
Temperature
u-component of wind
v-component of wind
第二套:Surface
同样的步骤还需要下载WRF Model Input:Vtable. CFSR - Surface
其中包含:
Geopotential height
Ice cover
Land cover (0=sea, 1=land)
Pressure
Specific humidity
Temperature
u-component of wind
v-component of wind
Volumetric soil moisture content
Water equivalent of accumulated snow depth
三、使用WPS生成WRF所需文件
# 载入所需依赖模块
module load WPS/3.5.1-intel-2015B-dmpar
module load netCDF-Fortran/4.4.0-intel-2015B
# 修改文件&share和&geogrid中的时间、分辨率、地形数据路径
vi namelist.wps
start_date = '1993-01-02_00:00:00',
end_date = '1993-01-04_00:00:00',
e_we = 156 # 东西总格点数
e_sn = 149 # 南北总格点数
geog_data_res = '10m' # 地形分辨率,通常是10m
dx = 9000, # 东西分辨率
dy = 9000, # 南北分辨率
map_proj = 'mercator', # 投影方式
ref_lat = 32, # 网格中心纬度
ref_lon = 136,# 网格中心经度
truelat1 = 32,
truelat2 = 32,
stand_lon = 136,# 网格中心经度
geog_data_path = './topo/geog' # 地形文件所在路径
opt_geogrid_tbl_path = './geogrid/' # 地形数据表所在路径
# 地形初始化
./geogrid.exe
----------------------------------------------------------
# 为了解码pgbh06.gdas.*.grb2文件
# 修改&ungrib内前缀名称,可以在上步完成
vi namelist.wps
prefix='PRESS'
# 链接物理量表
ln -sf ./ungrib/Variable_Tables/Vtable.CFSR_press_pgbh06 Vtable
# 链接CFSR,多出形如GRIBFILE.AAA的链接文件
./link_grib.csh ./run/test3/pgbh06.gdas.*
# 解包上述链接文件,多出形如PRESS:1993-01-02_00的文件
./ungrib.exe
----------------------------------------------------------
# 为了解码flxf06.gdas.*.grb2文件
# 修改&ungrib内前缀名称
vi namelist.wps
prefix='SFC'
# 链接物理量表
ln -sf ./ungrib/Variable_Tables/Vtable.CFSR_sfc_flxf06 Vtable
# 链接CFSR,多出形如GRIBFILE.AAA的链接文件
./link_grib.csh ./run/test3/flxf06.gdas.*
# 解包上述链接文件,多出形如SFC:1993-01-02_00的文件
./ungrib.exe
----------------------------------------------------------
# 修改&ungrib内前缀名称,可在上步完成
vi namelist.wps
fg_name = 'PRESS', 'SFC'
# 多出形如met_em.d01.1993-01-02_00:00:00.nc的文件,
./metgrid.exe
# 为了整洁,把生成的文件放进独立文件夹里,其实有用的只有met_em.d01*们
rm GRIBFILE*
mv PRES* SFC* met_em* ./run/test3/
cp namelist.wps ./run/test3/
==========================================================
四、使用WRF生成初值边界数据并运行
# 载入所需依赖模块
module load wrf-deps/intel-2015B
# 修改namelist.input中时长、区域等信息
vi namelist.input
# 链接me_em.d01*.nc到WRF路径
ln -sf ../WPS_yu/run/test3/met_em.d01* ./
# 处理初值和边值,得到 wrfinput_d01、wrflowinp_d01、wrfbdy_d01、namelist.output
./real.exe
# 转起来
ulimit -s unlimited
# 单核
./wrf.exe
# 多核 # top中可见多个进程
nohup mpirun -np 6 ./wrf.exe > wrf.exe.log & top
tail -f rsl.out.0000 # 实时可见运行情况
# 提交任务
vi runwrf.pbs
#BSUB -P 082751400583 # 设置自己的账号myproject -l可看账号
#BSUB -W 02:20 # sets to 24 hours the job's runtime wall-clock limit.
#BSUB -n 20 # assigns 648 cpus/cores for execution.
ulimit -s unlimited
bsub < runwrf.pbs
bjobs # 查看提交情况
bkill 8360773 #数字为job号,在bjobs中获得
五、BUG
Bug1
[hengkai.yao@ada2 WPS]$ ./geogrid.exe
Parsed 20 entries in GEOGRID.TBL
Processing domain 1 of 1
ERROR: Could not open /scratch/user/hengkai.yao/Models/WRF_3.5.1/WPS/geog/orogwd_10m/con/index
application called MPI_Abort(MPI_COMM_WORLD, 0) - process 0
原因:地形文件没有保存在对应的文件夹内。
把官网的静态地形文件保存下载就可以了。
Bug2
[hengkai.yao@ada2 WPS]$ ./metgrid.exe
Processing domain 1 of 1
Processing 1993-01-01_00
PRESS
SFC
Oops, something is not right with the Gaussian latitude computation.
The input data gave the starting latitude as 37.936.
This routine computed the starting latitude as +- 89.761.
The difference is larger than 0.01 degrees, which is not expected.
ERROR: Gaussian_latitude_computation
application called MPI_Abort(MPI_COMM_WORLD, 0) - process 0
原因:CFSR对于局部区域的自带bug.
解决方案:下载全球数据,不要会用局部区域即可。但运行速度变慢。
六、TIPS
报错检查
# 可获得所需依赖库
ldd ungrib.exe
七、其他
准备ROMS输入文件所需数据
这里选用Copernicus上的GLOBAL_REANALYSIS_PHY_001_030数据,网址。
八、特别鸣谢
感谢余萧学姐在安装配置过程中的帮助和支持。
2 comments
学长你好,请问一下你有没有出现过核心数多了运算速度反而慢了的情况 ?
我自己的经历是一个运算节点28核并行比8个节点上224核并行还要快。
任何并行运算都会有一个sweet point,跟cpu主频、IO、硬盘读写都有关系,多尝试几种可能,选一个最好的。我们这一般360核是最佳。