WRF模式运行及后处理简介竺可桢-南森国际研究中心于恩涛2010-9-9yetsyu@mail.iap.ac.cn•WRF模式简介1•模式编译2•模式设置及运行3•后处理4报告提纲WRF:WeatherResearchandForecastingModel可用于业务和科研由包括NCEP、NCAR、NOAA等多家政府机构、科研机构及大学合作开发与更新采用F90语言,模块化代码编写,便于新模块耦合与更新WRF是?哪些人使用WRF?•大气科学家(动力过程,物理过程,天气气候研究)•天气气候业务预报人员•气象应用(空气质量,水文)WRF应用领域:•ARW&NMM–物理过程/参数化研究–个例模拟–天气预报系统研究–数据同化•ARW–区域气候模拟–耦合大气化学–全球模拟–Idealized模拟实例2000-2009中国地区夏季降水模拟DOWNLOAD&COMPILEMODELDownloadsourcecodeCompileWRFCompileWPSWPS&WRF下载与解压1.下载WRFV3.2.1.TAR.gz和WPSV3.2.1.TAR.gz2.设置netcdf路径(netcdf库必须由本机编译器编译)3解压wget://=/usr/local…3.tarzxfvWRFV3.2.1.TAR.gztarzxfvWPSV3.2.1.TAR.gzWRFconfigure生成configure.wrf文件WRFcompile(1)WRFcompile(2)如编译成功,则会生成可执行文件Tips:1.编译首先从最简单开始,即最好先从串行开始编译,编译成功再尝试编译并行。2.重新编译时,./clean–a清除所有,再开始重新编译。WPStip:WPS使用WRF库函数,因此WPS必须放在WRF源代码同一个目录下。WPScompileSETUP&RUNMODELWPS•流程–(1)设定domain,准备静态数据•geogrid.exe–(2)解压强迫场资料(GFS,NAM...)•ungrib.exe–(3)将静态数据和强迫场资料转为WRF需要格式•metgrid.exe•所有设定通过namelist.wpsnamelist.wps&sharewrf_core='ARW',max_dom=1,start_date='2007-09-02_00:00:00','2007-09-02_00:00:00',end_date='2007-09-03_12:00:00','2007-09-03_12:00:00',interval_seconds=21600,io_form_geogrid=2,/•start_date,end_date一个区域一列•interval_seconds是强迫场资料的时间间隔namelist.wps(续)&geogridparent_id=1,1,parent_grid_ratio=1,3,i_parent_start=1,53,j_parent_start=1,65,e_we=100,259,e_sn=76,199geog_data_res='2m','2m',dx=60000,dy=60000,map_proj='lambert',ref_lat=35,ref_lon=105.5,truelat1=30.0,truelat2=60.0,stand_lon=105.0,geog_data_path='geog'/thereismore…geogrid–设置区域,生成静态数据./geogrid.exe*生成geo_em.d01.nc*“Successfulcompletionofgeogrid.”运行成功Ungrib准备强迫场资料•强迫场可以使用在分析或全球模式结果.•需要指定合适的Vtable来解压grib1&grib2数据“Successfulcompletionofungrib.”说明运行成功metgrid.exe“Successfulcompletionofmetgrid.”...Output...met_em.d01.2007-09-02_00:00:00.ncmet_em.d01.2007-09-03_00:00:00.nc…….metgrid运行•流程–运行real.exe(生成WRF运行所需的输入资料)–运行wrf.exe•都使用namelist.input来控制namelist.input&time_controlrun_days=0,run_hours=0,run_minutes=0,run_seconds=0,start_year=2007,2007,start_month=09,09,start_day=02,02,start_hour=00,00,start_minute=00,00,start_second=00,00,end_year=2007,2007,end_month=09,09,end_day=03,03,end_hour=12,12,end_minute=00,00,end_second=00,00,Forstart_*,end_*,onecolumnperdomainnamelist.input(续)interval_seconds=10800input_from_file=.true.,.true.,history_interval=60,60,frames_per_outfile=6,6,restart=.false.,restart_interval=5000,interval_seconds同namelist.wpshistory_interval–结果文件输出频率frames_per_outfile–每个结果文件保存多少时次restart=.true.是否重启运行restart_interval输出重启文件的间隔namelist.input(续)&domainstime_step=360,time_step_fract_num=0,time_step_fract_den=1,max_dom=1,s_we=1,1,1,e_we=100,259,94,s_sn=1,1,1,e_sn=76,199,91,s_vert=1,1,1,e_vert=31,31,31,num_metgrid_levels=27dx=60000,12000,333,dy=60000,12000,333,grid_id=1,2,3,parent_id=0,1,2,i_parent_start=0,53,30,j_parent_start=0,65,30,parent_grid_ratio=1,3,3,parent_time_step_ratio=1,3,3,namelist.input(续)&physicsmp_physics[Microphysics]=1,1,ra_lw_physics[Longwaverad]=1,1,ra_sw_physics[Shortwaverad]=1,1,radt[Radiationtimestep;min]=60,10,sf_sfclay_physics[Surfacelayer]=1,1,sf_surface_physics[Surface]=1,1,bl_pbl_physics[Boundarylayer]=1,1,bldt[Boundarylayertimestep;min]=0,0,cu_physics[cumulusscheme]=1,0,cudt[cumulustimestep;min]=5,isfflx=1,ifsnow=0,icloud=1,surface_input_source=1,num_soil_layers=5,mp_zero_out=0,•Microphysics(mp)scheme每个区域必须一致,但cumulus(cu)schemes各个区域可以不同•不同的组合结果可能不同,但也可能一些组合模式无法运行,需要多多尝试realmpirun-np2real.exetail–frsl.out.0000--extrapolatingTEMPERATUREnearsfc:i,j,psfc,ptargetd012007-09-03_12:00:00forcingartificialsiltyclayloamLANDCHANGE=0WATERCHANGE=0d012007-09-03_12:00:00Timingforprocessing0s.LBCvalidbetweenthesetimes2007-09-03_09:00:00.00002007-09-03_12:00:00d012007-09-03_12:00:00Timingforoutput0s.d012007-09-03_12:00:00Timingforloop#13=0s.d012007-09-03_12:00:00real_em:SUCCESSCOMPLETEREAL_EMINITwrf.exe•real.exe生成文件:–wrfbdy_d01andwrfinput_d01(NetCDFfiles)–多个区域wrfinput会有多个–SSTupdate则会有wrflowinp•mpirun-np4wrf.exe&结果文件:wrfout_d01*rsl.out/rsl.error*WRF后处理推荐NCLload“$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.nclload“$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.nclbegina=addfile(./geo_em.d01.nc,r)wks=gsn_open_wks(pdf,plt_ter5)res=Trueres@MainTitle=GEOGRIDFIELDS”pltres=Truempres=Trueter=wrf_user_getvar(a,HGT_M,0)res@cnFillOn=Trueres@ContourParameters=(/0.,1000.,50./)contour=wrf_contour(a,wks,ter,res)plot=wrf_map_overlays(a,wks,(/contour/),\pltres,mpres)endSpecialWRFNCLFunctionswrf_user_getvarGetnativeanddiagnosticvariableswrf_contour/wrf_vectorCreateline/shaded&vectorplotswrf_map_overlays/wrf_overlaysOverlayplotscreatedwithwrf_contourandwrf_vectorwrf_user_intrp3d/wrf_user_intrp2dInterpolatehorizontallytoagivenpressure/height(3ddataonly)Interpolateverticallyalongagivenlinewrf_user_ll_to_ij/wrf_user_ij_to_llConvert:lat/lonijwrf_user_list_timesGetlistiftimesavailableininputfilewrf_user_unstaggerUnstaggersanarraySpecialWRFNC