小曾日志-2022.11.1

WRF users guide

chapter 3 WPS

function of each wps program

(1) Program geogrid
geogrid 的作用是定义模拟区域,将静态地理数据通过插值的方式定义到模拟栅格。需要修改namelist.wps以定义模拟区域,地图比例因子等,通过地理静态数据将不随时间改变的数据插值到研究区域,生成gem*.nc 文件。插值的静态地理数据包括土壤类别、土地利用类别、地形高度、年平均值 深部土壤温度, 月植被分数, 月反照率, 最大雪地反照率和坡度。除此之外,geogrid 还可以使用表GEOGRID.TBL 插值新的或者额外的数据集。GEOGRID.TBL 定义了插值的field字段,对应的插值方法以及该字段对应的数据集位置。

(2) Program ungrib
ubgrib 的作用是将下载的动态气象GRIB数据文件转化成中间格式,以被metgrid识别。使用的GRIB文件包含随时间变化的气象字段并通常来自另一个区域或全球模型,例如NCEP的NAM或GFS model。ungrib can read grib file, if compile, it can read grib2 files. 如果数据不是grib或grib2格式,需要手动将数据写入中间格式文件。

ungrib 将气象数据写入中间格式:

integer :: version             ! Format version (must =5 for WPS format)

integer :: nx, ny              ! x- and y-dimensions of 2-d array

integer :: iproj               ! Code for projection of data in array:

                               !       0 = cylindrical equidistant

                               !       1 = Mercator

                               !       3 = Lambert conformal conic

                               !       4 = Gaussian (global only!)

                               !       5 = Polar stereographic

real :: nlats                  ! Number of latitudes north of equator

                               !       (for Gaussian grids)

real :: xfcst                  ! Forecast hour of data

real :: xlvl                   ! Vertical level of data in 2-d array

real :: startlat, startlon     ! Lat/lon of point in array indicated by

                               !       startloc string

real :: deltalat, deltalon     ! Grid spacing, degrees

real :: dx, dy                 ! Grid spacing, km

real :: xlonc                  ! Standard longitude of projection

real :: truelat1, truelat2     ! True latitudes of projection

real :: earth_radius           ! Earth radius, km

real, dimension(nx,ny) :: slab ! The 2-d array holding the data

logical :: is_wind_grid_rel    ! Flag indicating whether winds are                                        

                               !       relative to source grid (TRUE) or

                               !       relative to earth (FALSE)

character (len=8)  :: startloc ! Which point in array is given by

                               !       startlat/startlon; set either                                       

                               !       to 'SWCORNER' or 'CENTER  '

character (len=9)  :: field    ! Name of the field

character (len=24) :: hdate    ! Valid date for data YYYY:MM:DD_HH:00:00

character (len=25) :: units    ! Units of data

character (len=32) :: map_source  !  Source model / originating center

character (len=46) :: desc     ! Short description of data

 

   

!  1) WRITE FORMAT VERSION

write(unit=ounit) version

 

!  2) WRITE METADATA

! Cylindrical equidistant

if (iproj == 0) then

      write(unit=ounit) hdate, xfcst, map_source, field, &

                        units, desc, xlvl, nx, ny, iproj

      write(unit=ounit) startloc, startlat, startlon, &

                        deltalat, deltalon, earth_radius

 

! Mercator

else if (iproj == 1) then

      write(unit=ounit) hdate, xfcst, map_source, field, &

                        units, desc, xlvl, nx, ny, iproj

      write(unit=ounit) startloc, startlat, startlon, dx, dy, &

                        truelat1, earth_radius

 

! Lambert conformal

else if (iproj == 3) then

      write(unit=ounit) hdate, xfcst, map_source, field, &

                        units, desc, xlvl, nx, ny, iproj

      write(unit=ounit) startloc, startlat, startlon, dx, dy, &

                        xlonc, truelat1, truelat2, earth_radius

 

! Gaussian

else if (iproj == 4) then

      write(unit=ounit) hdate, xfcst, map_source, field, &

                        units, desc, xlvl, nx, ny, iproj

      write(unit=ounit) startloc, startlat, startlon, &

                               nlats, deltalon, earth_radius

 

! Polar stereographic

else if (iproj == 5) then

      write(unit=ounit) hdate, xfcst, map_source, field, &

                        units, desc, xlvl, nx, ny, iproj

      write(unit=ounit) startloc, startlat, startlon, dx, dy, &

                        xlonc, truelat1, earth_radius

    

end if

 

!  3) WRITE WIND ROTATION FLAG

write(unit=ounit) is_wind_grid_rel

 

!  4) WRITE 2-D ARRAY OF DATA

write(unit=ounit) slab

ungrib首先需要把数据链接过来./link_grib.csh ~/Build_WRF/data,grib文件包括的fields通常远远超过WRF运行所需,WPS通常使用代码识别所需变量,代码存储于变量表Vtabels中,因此使用ln -sf ungrib/Variable_Tables/Vtable.GFS Vtable命令将变量表链接过来即可运行./ungrib.exe

  • 注: WRF运行所需变量rt
    rt
    (3) Program metgrid
    WPS运行的最后一步就是metgrid啦,顾名思义,就是气象格网。Metgrid的作用是将第二步转化的气象数据插值到第一步定义的模拟网格中。插值后的metgrid输出可以被WRF real program 提取。每个气象字段的插值方式由METGRID.TBL文件定义,该文件为每个字段提供一个部分以定义插值的具体算法。

Installing the WPS

不赘述,users guide上有详细过程,但建议参考安装WPS和地理静态数据

Running the WPS

  1. Define a model coarse domain and any nested domains with geogrid.
    
  2. Extract meteorological fields from GRIB data sets for the simulation period with ungrib.
    
  3. Horizontally interpolate meteorological fields to the model domains with metgrid.
    

notes: 如果要使用相同的模拟区域多次模拟,只需执行一次step1即可。

首先修改 namelist.wps

具体参数名及含义

A. SHARE section
本部分描述了多个wps程序共享使用的信息,具体如下

1. WRF_CORE:设置为“ARW”或“NMM”的字符串,告诉WPS哪个动态核心输入数据 正在准备中。默认值为“ARW”。WRF分为ARW(Advanced Research WRF) 和 NMM(Nonhydrostatic Mesoscale Model)两种。绝大多数气象领域的研究者使用的主要都是ARW版本。
2. MAX_DOM:指定域/嵌套总数的整数,默认值为1。WRF在全部区域使用高分辨率会消耗大量运算资源,嵌套是指先用粗分辨率运行,在关键区域采取高分辨率,而其母区域使用粗分辨率提供边界条件。双向嵌套是母区域给子区域提供边界条件,而子区域的计算结果会反馈回到母区域。namelist.input文件中设置feedback=1开启双向嵌套。嵌套的子区域不需要准备初始场数据,其静态数据和气象场从母区域中插值得到。优势:子区域模拟的起始时间可以晚于母区域。劣势:子区域的模拟结果无法受益于高精度的静态数据,可能会影响模拟的质量。 # namelist.input中,d02的输入文件设置为false,无需输入,从d01插值得到
input_from_file = .true., .false.,
3. START_YEAR:指定起始 UTC  4 位整数的列表 每个嵌套的模拟年份。
4. START_MONTH:指定起始 UTC 的 2 位整数的列表 每个嵌套的模拟月份。
5. START_DAY:指定 UTC 起始日期的 2 位整数的列表 每个嵌套的模拟。
6. START_HOUR :指定起始 UTC 的 MAX_DOM 位 2 位整数的列表 
7. END_YEAR 
8. END_MONTH
9. END_DAY 
10. END_HOUR
11. START_DATE : 格式为'YYYY-MM-DD_HH:mm:ss'的MAX_DOM字符串的列表指定 每个嵌套的模拟开始 UTC 日期。start_date变量是一个 替代指定start_year、start_month、start_day 和start_hour,如果两者都指定 方法用于指定开始时间,start_date变量将优先。
12. END_DATE : 格式为'YYYY-MM-DD_HH:mm:ss'的MAX_DOM字符串列表指定 每个嵌套的模拟结束 UTC 日期。end_date变量是一个 替代指定end_year、end_month、end_day 和end_hour,如果两者兼而有之 方法用于指定结束时间,end_date变量将优先。
13. INTERVAL_SECONDS:气象数据的时间间隔,单位:秒。例如grib数据是0,6,12,18点的,时间间隔是6小时,21600秒。
14. ACTIVE_GRID :MAX_DOM逻辑值的列表,为每个网格指定该网格是否应由Geogrid和Metgrid处理。默认值为True.作用是用于定义嵌套的处理。
15. IO_FORM_GEOGRID:geogrid文件创建的 WRF I/O API 格式 文件将被写入。可能的选项有:1 for binary; 2 for NetCDF; 3 for GRIB1. 当给出选项 1 时,域文件的后缀将为 .int;当给出选项 2 时,域文件的后缀为 .nc;什么时候 给出选项 3,域文件的后缀为 .gr1。默认值为 2(netCDF).
16. OPT_OUTPUT_FROM_GEOGRID_PATH:提供路径的字符串,其中之一 相对于或绝对值,即来自 Geogrid 的输出文件的位置 写给和读。默认值为“./”。
17. DEBUG_LEVEL:debug等级,0代表仅将有用的和警告写入标准输出。当debug_level大于 100 时,提供进一步运行时的信息性消息 详细信息也会写入标准输出。 专门用于日志文件的调试消息和消息永远不会写入标准输出,但 始终写入日志文件。默认值为 0。

B. GEOGRID section
本部分描述了仅用于geogrid.exe运行的变量,主要定义模拟区域的大小和位置,以及定义静态地理数据的存储位置。
嵌套具体设计见:WRF嵌套网格设计 以北京地区为例

父区域的网格大小是子区域的3倍,因此parent_grid_ration = 1,3 , 同时子区域内we网格数为(68-31)*3+1

1.  PARENT_ID :   指定每一个网格嵌套进的上一层粗网格的编号(也称为父网格)。
2.  PARENT_GRID_RATIO : 对于每个嵌套,相对于域的父级的嵌套比率。无默认值。
3. I_PARENT_START :对于每个嵌套,父非聚集网格中嵌套左下角的x坐标。对于最粗糙的域,应指定值1。无默认值。
4. J_PARENT_START : 对于每个嵌套,父非聚集网格中嵌套左下角的y坐标。对于最粗糙的域,应指定值1。无默认值。
5. S_WE: 设置为1
6. E_WE: 对每个嵌套,嵌套的东西维度。应该大于parent_grid_ratio的整数倍(i.e., e_we = n*parent_grid_ratio+1 for some positive integer n)
7. S_SN: 设置为·
8. E_SN: 对每个嵌套,嵌套的南北维度(i.e., e_sn = n*parent_grid_ratio+1 for some positive integer n)
9. GEOG_DATA_RES:为每个嵌套设置分辨率
10. DX :指定 x 方向上的网格距离的实际值,地图比例因子为 1。对于 ARW,“极地”、“朗伯”和“墨卡托”投影的网格距离以米为单位。
11. DY:指定 y 方向上的网格距离的实际值,地图比例因子为 1。对于 ARW,“极地”、“朗伯”和“墨卡托”投影的网格距离以米为单位。
12. MAP_PROJ:指定模拟投影的字符串 域。对于ARW,公认的投影是“lambert”,“polar”,“mercator”和“lat-lon”。默认值为“lambert”。
13. REF_LAT:指定纬度部分(纬度、经度)的实值 其 (i,j) 在模拟域中的位置已知的位置。对于 ARW,ref_lat给出了 默认情况下粗域中心点的纬度(即,当ref_x和ref_y不是时 指定)。
14. REF_LON:指定经度部分(纬度、经度)的实数值 其 (i, j) 在模拟域中的位置已知的位置。对于 ARW,ref_lon给出了 默认情况下粗域中心点的经度(即,当ref_x和ref_y未设定时 指定。
15. REF_X:一个实值,指定 (i, j) 位置的 i 部分,其 (纬度、经度)在模拟域中的位置是已知的。(i, j) 位置始终相对于交错网格给出,其维度比不交错网格的维度小 1。默认为 (((E_WE-1.)+1.)/2.)= (E_WE/2.)。
16. REF_Y:(((E_SN-1.)+1.)/2.)= (E_SN/2.)。
17. TRUELAT1 :A real value specifying, for ARW, the first true latitude for the Lambert conformal projection, or the only true latitude for the Mercator and polar stereographic projections.
18. TRUELAT2 : A real value specifying, for ARW, the second true latitude for the Lambert conformal conic projection. For all other projections, truelat2 is ignored. 
19. STAND_LON:一个实数值,指定 ARW 的平行经度 在朗伯等角和极立体投影中的 y 轴。 对于常规经纬度投影,此值给出旋转 关于地球的地理极点。对于 NMM,stand_lon将被忽略。不 默认值。
20. POLE_LAT : For the latitude-longitude projection for ARW, the latitude of the North Pole with respect to the computational latitude-longitude grid in which -90.0° latitude is at the bottom of a global domain, 90.0° latitude is at the top, and 180.0° longitude is at the center. Default value is 90.0.
21.  POLE_LON : For the latitude-longitude projection for ARW, the longitude of the North Pole with respect to the computational lat/lon grid in which -90.0° latitude is at the bottom of a global domain, 90.0° latitude is at the top, and 180.0° longitude is at the center. Default value is 0.0.
22. GEOG_DATA_PATH:地理静态数据路径。
23. OPT_GEOGRID_TBL_PATH:提供路径的字符串,可以是相对的,也可以是相对的 绝对,对地球格栅。TBL 文件。路径不应包含实际文件 名称,作为地球格栅。假定为 TBL,但应仅提供此文件的路径。默认值为 './geogrid/'。

C. UNGRIB section
目前,本节只包含两个变量,它们决定了ungrib编写的输出格式和输出文件的名称

1. OUT_FORMAT:设置为“WPS”、“SI”或“MM5”的字符串。 如果设置为“MM5”, ungrib 将以 MM5 预网格程序的格式写入输出;如果设置为“SI”,ungrib 将写入 以grib_prep.exe格式输出;如果设置为“WPS”,ungrib 将在 WPS 中写入数据 中间格式。默认值为“WPS”。
2. PREFIX:将用作前缀的字符串 由 ungrib 创建的中间格式文件;在这里,前缀是指中间文件的文件名前缀:YYYY-MM-DD_HH中的字符串前缀。这 前缀可能包含路径信息,可以是相对的,也可以是绝对的,在这种情况下 中间文件将写入指定的目录中。此选项 如果要运行 ungrib,则可能有助于避免重命名中间文件 GRIB 数据的多个来源。默认值为“FILE”。
3. ADD_LVLS:确定 ungrib 是否会尝试 垂直插值到一组额外的垂直级别,使用 “NEW_PLVL”和“INTERP_TYPE名称列表”选项。 默认值为。FALSE..
4. INTERP_TYPE:一个整数值,指定 ungrib 将使用的方法 当垂直插值到新LEVEL时。值为0会导致 unrib 在气压水平上线性插值,值为1会导致 ungrib 在对数压力中线性插值。默认值为0。

5. NEW_PLVL:指定附加垂直的实数值数组 水平,以 Pa 为单位给出,ungrib 程序将尝试插入到的水平 当ADD_LVLS 真。可以显式指定新级别集,或者,如果级别 在压力中均匀分布,可以精确指定三个值:起始值 压力、结束压力和压力增量。当开始 指定压力、结束压力和增量,压力增量 必须是负数才能向 ungrib 程序发出此值为 不是目标压力水平,而是在 第一个和第二个值。无默认值。

6. PMIN:指定最小压力水平的实值,以帕为单位,为 从 GRIB 数据处理。此选项仅适用于同量异位模型数据集。 默认值为100。

D. METGRID section
本节定义了仅由metgrid程序使用的变量。通常,用户主要对fg_name变量感兴趣,可能需要较少地修改本节的其他变量。

1. . FG_NAME:指定路径和前缀的字符串列表 未绑定的数据文件。路径可以是相对路径,也可以是绝对路径,前缀 应包含文件名的所有字符,但不包括 日期前的冒号。当指定了多个fg_name,并且找到相同的字段时 在两个或多个输入源中,最后一个遇到的源中的数据将采用 优先于该字段的所有先前源。默认值为空 列表(即没有气象字段).

ARW对应的投影参数如下:
在这里插入图片描述

Creating Nested Domains with the WPS

namelist.wps设置如下,嵌套区域如图
在这里插入图片描述

&share
 wrf_core = 'ARW',
 max_dom = 2,
 start_date = '2008-03-24_12:00:00','2008-03-24_12:00:00',
 end_date   = '2008-03-24_18:00:00','2008-03-24_12:00:00', 
 interval_seconds = 21600,
 io_form_geogrid = 2
/

&geogrid
 parent_id         =   1,   1,
 parent_grid_ratio =   1,   3,
 i_parent_start    =   1,  31,
 j_parent_start    =   1,  17,
 e_we              =  74, 112,
 e_sn              =  61,  97,
 geog_data_res     = 'default','default',
 dx = 30000,
 dy = 30000,
 map_proj = 'lambert',
 ref_lat   = 34.83,
 ref_lon   = -81.03,
 truelat1  =  30.0,
 truelat2  =  60.0,
 stand_lon = -98.
 geog_data_path = '/mmm/users/wrfhelp/WPS_GEOG/'
/
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值