WRF常见的问题
[toc]
To obtain the WRF model, become a registered user and then follow instructions to either clone or download the WRF source code from GitHub.
1) Courses by the COMET group at NCAR provide basic NWP training. 2) Container options, provided by the DTC lab at NCAR 3) Tutorial presentations: recorded presentations; .pdf versions of presentations 4) WRF Online Tutorial 5) WRF Users’ Guide 6) WRF and WPS Compiling Tutorial 7) WRF Technical Note 8) Best Practice for Namelists (provides recommended settings for creating a reasonable domain and other namelist descriptions): WPS: WRF namelist.wps Best Prac WRF: WRF Namelist.input Best Prac
For other information on downloading, etc. see the WRF Users’ Home Page.
1. Process ERA5 Data - 如何处理ERA5 数据
ERA5数据的格式是每个文件中每个变量的格式,这与其他传统的输入数据源不同。然而,通过 ungrib 处理它并没有太大的不同。你只需要将所有的文件——包括高空和地面数据——链接到你的工作目录中,ungrib 就可以使用 Vtable.ECMWF 来处理它。您需要做的一件不同的事情是包含不变的数据文件。您可以从您获得所有 ERA 数据的网站下载,或者我们也将其附加到本文。你需要把它放在你的 WPS 工作目录里。然后在运行 metgrid 之前,将以下代码行添加到名称列表的 & metgrid 部分(注意: 如果您从这里下载了它,请将文件名更改为 ERA5 _ INVARIANT) :
constants_name = 'ERA5_INVARIANT'
2. Choosing an Appropriate Number of Processors - 选择适当数量的处理器
A good STARTING PLACE is to use the following equations:
For your smallest-sized domain: ((e_we)/25) * ((e_sn)/25) = most amount of processors you should use
For your largest-sized domain: ((e_we)/100) * ((e_sn)/100) = least amount of processors you should use
https://forum.mmm.ucar.edu/threads/choosing-an-appropriate-number-of-processors.5082/
3. An appropriate number of vertical levels (e_vert) to use? - 使用适当数量的垂直级别 (e_vert)?
A good procedure to follow may be:
- Determine the model top pressure.
- Determine how thick your lowest layer is (50 m by default)
- Determine maximum thickness (1 km by default).
Then based on your needs, the stretching rates can be chosen using the table in chapter 4 of UG (link above) as a guideline.
- Choose the stretching rate(s) - larger if you want fewer levels but it’s not recommended that the rate be > 1.3. 2) Find the minimum number of levels that works for that stretching factor by iterating running real and changing e_vert. The minimum is the one that gives the smoothest variation in DNW, which can also be viewed in wrfinput as part of the process
It is worth mentioning that when one chooses this method, the real program prints out the thickness of the layer, and it can be very good information for making adjustments for the stretching parameters.
*Additional Notes
- Smoothly varying vertical levels can be very important for model stability. Tests have shown that two different sets of vertical levels gives different numbers of CFL prints.
- For cases with dz > dx (as can occur for dx < 1 km at the top), tests have also shown that continuous stretching works through to the model top better than having many equal dz levels.
4. How do I add a new 3d variable in tslist? - 如何在 tslist 中添加新的 3d 变量?
https://forum.mmm.ucar.edu/threads/how-do-i-add-a-new-3d-variable-in-tslist.8898/
5. How do I add a new 2d variable in tslist? - 如何在 tslist 中添加新的 2d 变量?
https://forum.mmm.ucar.edu/threads/how-do-i-add-a-new-2d-variable-in-tslist.147/
6. What fields are mandatory for running WRF? - 运行 WRF 时哪些数据是必需的?
3D Data (for data on constant pressure levels) Temperature U and V components of wind Geopotential height Relative humidity (or specific humidity)
3D Data (for data on native model levels) Temperature U and V components of wind Geopotential height Relative humidity (or specific humidity) Pressure
2D Data Surface pressure Mean sea-level pressure Skin temperature/SST 2 meter temperature 2 meter relative humidity 10 meter U and V components of wind Soil temperature Soil moisture Soil height (or terrain height) *Note: the 2m temperature, RH, and wind fields may be optional if one sets the namelist option use_surface = F before running real.exe)
The following are recommended fields: LANDSEA mask field for input data Water equivalent snow depth SEAICE (especially good for a high-latitude winter case) Additional SST data (this is mandatory for climate runs)
7. Force my WRF output to be written out to a different directory - 强制将我的 WRF 输出写入到不同的目录
In your namelist.input file, under the &time_control section, add the following line:
history_outname = ‘path_of_your_choice/directory_of_your_choice/wrfout_d
Make sure to leave the
8. Get the high-resolution terrain and landuse data for a moving nest run - 在一个移动的嵌套网格中运行的高分辨率地形和土地利用数据
To compile the code to read in the high-res terrain and landuse data, set environment variable TERRAIN_AND_LANDUSE before doing ‘configure’ and ‘compile’.
Since this high-res landuse dataset is from USGS, one should use USGS to create domain 1 input file.
To use the high-res terrain and landuse dataset in a moving nest run, first create a directory, and unzip and untar the following two files in the directory:
Then add the following namelists in &time_control:
rsmas_data_path = “path-to-the-high-res-data” input_from_hires = .false., .true., .true.,
9. Difference between grid nudging and observational nudging - 网格nudging和观测nudging之间的区别
Grid nudging assimilates reanalysis/analysis data inot the model simulation, while observational nudging assimilates observations collected at particular stations into the model simulation.
10. Convert model grid-relative wind to earth-relative wind (so that I can compare model wind to observations) - 将模型相对于网格的风转换为相对于地球的风(以便我可以将模型风与观测结果进行比较
Below are the equations to convert model u and v to earth-relative u and v:
u-earth = u-modelcosalpha - v-modelsinalpha v-earth = v-modelcosalpha + u-modelsinalpha
where cosalpha and sinalpha can be found in model input and output files.
11. Set the entire domain to be water - 将整个模拟区域设置为水
One way to do this is to edit phys/module_physics_init.F in the subroutine landuse_init. Try adding a line in this part of the code, just before the last line quoted here:
!Set arrays according to lu_index
itf = min0(ite,ide-1)
jtf = min0(jte,jde-1)
IF(usemonalb)CALL wrf_message('Climatological albedo is used instead of table values')
DO j = jts,jtf
DO i = its,itf
IS=nint(lu_index(i,j))
so that the new section reads:
!Set arrays according to lu_index
itf = min0(ite,ide-1)
jtf = min0(jte,jde-1)
IF(usemonalb)CALL wrf_message('Climatological albedo is used instead of table values')
DO j = jts,jtf
DO i = its,itf
lu_index = 16
IS=nint(lu_index(i,j))
Recompile the code after making this change (no need to do a ‘clean -a’ or to reconfigure since you are not changing anything in the Registry file). Check the field LU_INDEX in the wrfout file.
12. Change landuse type codes - 更改土地利用类型代码
As an example, look n dyn_em/module_initialize_real.F, around line 1627. Change the line beginning with grid%, from:
! Land use assignment
DO j = jts, MIN(jde-1,jte)
DO i = its, MIN(ide-1,ite)
grid%lu_index(i,j) = grid%ivgtyp(i,j)
to
grid%ivgtyp(i,j) = grid%lu_index(i,j)
Then recompile the code (no need to do a ‘clean -a’ or reconfigure, since you are not altering the Registry file). Check wrfinput_d01 after running real.exe. It should not have any effect on other fields in the input file.
13. Use MODIS 21-category, or USGS 28-category landuse data, will SST be interpolated to the inland lake points - 使用MODIS 21类,或USGS 28类土地利用数据,将SST插值到内陆湖点
Yes, SST will still be interpolated to the inland lake points; however, if you activate the lake module, temperature in the lake points will be re-initialized.
14. Handle a mismatch between landsea mask and soil data - 处理陆地掩模和土壤数据之间的不匹配
Try to add this line:
missing_value=-1.E+30
to name=SM000010, SM010200, ST000010, and ST010200 in the METGRID.TBL, so that they look something like this:
name=SM000010
interp_option=sixteen_pt+four_pt+average_4pt+search masked=water interp_mask=LANDSEA(0) fill_missing=1. missing_value=-1.E+30 flag_in_output=FLAG_SM000010
Re-run metgrid.exe and see if that corrects the problem.
15. How does the moving nest work to track storms - 移动网格如何追踪风暴
The moving nest option tracks the minimum geopotential height at a specified pressure level (set by namelist option track_level in &domains). The default tracking level is 50000 Pa.
16. How do I output a multi-time wrfinput file - 如何输出多次wrfinput文件
Simply add all_ic_times = .true. in the namelist.input file, in the &time_control section.
17. What value should be used for the radiation time step - 辐射时间步长应使用什么值
This value should coincide with the finest domain resolution (1 minute per km dx), but it usually is not necessary to go below 5 minutes. All domains should use the same value, so that radiation forcing is applied at the same time for all domains.
18. Find pressure and height at each WRF vertical level - 查找每个 WRF 垂直高度的压力和高度
They can be computed from:
(P + PB)*0.01 for pressure at half-sigma level, and
(PH + PHB)/9.81 for geopotential height at full level.
The model levels are not at constant pressure or height surfaces because they follow terrain.
19. How can I make a “fake” dry run in WRF - 如何在 WRF 中进行“假”的干的模式运行
There is an option called no_mp_heating you will put in the &physics section of the namelist.input file. Set this to .true. You will also need to set cu_physics = 0. This option turns off heating from microphysics, but water vapor, etc. will be advected in the model and a cloud will be produced.
20. How do I calculate dBZ - 如何计算 dBZ
In the namelist.input file, add do_radar_ref = 1 (&physics), and it will provide radar reflectivity in dBZ in wrfout file (field name refl_10cm). This currently works for mp_physics = 2,4,6,7,8,10,14,16,28.
21. How do I estimate the heating profile - 如何计算加热曲线
Calculate the sum of RTHCUTEN (from cumulus), RTHRATEN (from radiation), RTHBLTEN (from PBL parameterization), RTHNDGDTEN (if nudging is applied), and H_DIABATIC (from microphysics).
22. When and how do I use the sst_update option - 何时以及如何使用 sst_update 选项
The WRF model physics do not predict sea-surface temperature (SST), vegetation fraction, albedo, or sea-ice. For long simulations, the model provides an alternative to read-in the data and update these fields. In order to use this option, you must have access to time-varying SST and sea ice fields. Twelve monthly values of vegetation fraction and albedo are available from the geogrid program. Once these fields are produced via WPS, you can activate the following options before running real.exe and wrf.exe:
sst_update =1
auxinput4_inname = "wrflowinp_d"
auxinput4_interval = 360, 360, 360
23. If my input data do not have SKINTEMP, what field can I use to avoid the ‘mandatory SKINTEMP not found’ error - 如果我的输入数据没有 SKINTEMP,我可以使用什么字段来避免“强制 SKINTEMP 未找到”错误
There are several ways you can do this:
\1. Use SKINTEMP from a regular GFS forecast. This means you will need to run a separate ungrib.exe job just for SKINTEMP from that dataset.
\2. Create a Vtable that will ungrib the surface temp, and save it under a different name (e.g., Vtable.SKINTEMP), then change the prefix in the ungrib section of the namelist, and add it to the prefix under the ungrib section. So you will run ungrib once, per normal. Then run again, and in your namelist.wps file, you should have something like: &ungrib out_format = ‘WPS’, prefix = ‘SKINTEMP’
Then you will run metgrid, and your namelist should look like: &metgrid fg_name = ‘FILE’, ‘SKINTEMP’, io_form_metgrid = 2,
\3. If you are using Version 3.1.1 or later, SKINTEMP is no longer mandatory. You may run the utility program avg_tsfc.exe for multiple times, and create an averaged surface temp field TAVGSFC. Add this field to the &metgrid section of the namelist: &metgrid fg_name = ‘FILE’ constants_name = ‘./TAVGSFC’
In addition to the above, you will need to edit WPS/metgrid/METGRID.TBL. Find the section for SKINTEMP and remove mandatory = yes. This should allow you to finish metgrid.exe, and later when you run real.exe, it will use this field instead of SKINTEMP.
24. How can I change the land cover in my innermost domain only - 如何仅更改我最内部域的土地覆盖
If you are interested in changing the inner-most nest, make the change in wrfinput_d0X (where ‘X’ is your inner-nest domain ID). When you run wrf.exe, you should use input_from_file = .true., .true., .true. so that the model uses data from the nest domain input. If you made changes in the geogrid files (geo_em.d0x.nc), set surface_input_source = 3 before running real.exe.
25. Make changes to create a dry (adiabatic) model run - 进行更改以创建干(绝热)模型运行
To turn off latent heating, there is a namelist switch no_mp_heating = 1. This needs to be used with cu_physics = 0. If you would like to turn off surface sensible and latent heat fluxes, set isfflx = 0. This may not be applicable for all surface options, though.
26. What is the suggested time allowance for “spin-up” time? - 建议的“启动”时间是多少?
Typically the model requires anywhere between 6-12 hours to fully spin up. It will depend on the grid distances and time steps. The finer the grid size, the more time steps you would have in a given time window, hence faster spin-up. You may calculate the kinetic energy spectra at various model times to see how the model spins up (see Skamarock, W. C., 2004: Evaluating mesoscale NWP models using kinetic energy spectra. Mon. Wea. Rev., 132, 3019-3032). You may also compute d(surface pressure)/dt to see how the values settle down in time by turning on the option diag_print. One way to shorten the spin up time is to use digital filter initialization.
27. How can I get PBL tendencies - 如何获得 PBL 倾向
RUBLTEN, RVBLTEN, RTHBLTEN, RQVBLTEN, RQCBLTEN, and RQIBLTEN are coupled tendencies of wind, temperature, vapor, and cloud due to PBL parameterizations.
28. How to output vertical eddy viscosity and vertical thermal diffusivity - 如何输出垂直涡粘率和垂直热扩散率
The term “exch_h” represents vertical thermal diffusivity in the MYJ, YSU, QNSE, MYNN, and BouLac schemes. WRF does not output eddy viscosity. It can be extracted from the MYJ PBL in a similar way to exch_h, but would require some coding similar to exch_h in the MYJ module, in addition to a new array. AKMK is a local array in the MYJ PBL that is proportional to the eddy viscosity. XKMV and XKHV arrays are used by other PBL options (not MYJ).
29. Modify initial SST - 修改初始海表温度
Yes, you will need to make a small change in the dyn_em/module_initialize_real.F file. Look for this loop:
DO j = jts, MIN(jde-1, jte)
DO i = its, MIN(ide-1, ite)
IF ((grid%landmask(i,j) .LT. 0.5) .AND. (flag_sst .EQ. 1) .AND. &
(grid%sst(i,j) .GT. 170.) .AND. (grid%sst(i,j) .LT. 400.)) THEN
grid%tsk(i,j) = grid%sst(i,j)
ENDIF
END DO
END DO
and add your SST change here. This will work if your met_em* files contain an SST field, or if your netCDF file global attribute contains FLAG_SST = 1.
30. physical meanings for the variables used in the LANDUSE.TBL - LANDUSE.TBL 中使用的变量的物理含义
ALBD: Surface albedo SLMO: Surface moisture availability SFEM: Surface emissivity SFZO: Surface roughness THERIN: Surface thermal inertia SFHC: Soil heat capacity
31. Segmentation fault - 分段报错
Segmentation faults can be difficult to track down. As there isn’t usually a clear error message, it can take some trial and error to figure out the problem.
1) A segmentation fault is often the result of using too many or too few processors, or a bad decomposition. Take a look at this FAQ regarding choosing the appropriate number of processors, based on the size of your domain.
2) Sometimes it can be the result of a lack of disk space. Check how much space you have left available for the files to be written. If your domain is large or very high resolution, the output files will be much larger (sometimes a few GB).
3) If the model seg-faults right at the beginning of the run, it can often mean there is something wrong with the input data. Make sure to check your met_em* files to see if you notice anything odd in various variables. Check all variables and all levels.
4) Many times a seg-fault can mean there is a CFL error, which means the model has become unstable, typically due to complex terrain or very strong convection. To check for this error, issue the command
Code:
grep cfl rsl*
If you see several CFL notifications, this is likely the reason for the model failure. First try to reduce the timestep. The standard recommendation for time_step is 6xDX (e.g., if your DX = 30000, then you should not set time_step to anything larger than 180). However, if you are still getting CFL errors, you can try to reduce to something more like 4xDX or 3xDX. Sometimes this works, but not always. Another thing you could try is to add smooth_cg_topo = .true. in the &domains section of the namelist, prior to running real if CFL errors happen along boundary zones. This option smoothes the outer rows/columns of the coarse model grid to match the low resolution topography that comes with the driving data. If CFL errors occur near complex terrain, you may try to set epssm = 0.2 (up to 0.9) to see if that makes a difference. This option is used to slightly forward the centering of the vertical pressure gradient (or sound waves) in an effort to damp 3-d divergence. You can also try to set w_damping = 1.
5) A segmentation fault error could be due to a memory issue. Try typing one of the following to see if it helps: a. setenv MP_STACK_SIZE 64000000 (OMP_STACKSIZE) b. If you are using csh or tcsh, try this: limit stacksize unlimited c. If you are using sh or bash, use this command: ulimit -s unlimited This may not solve your problem, but the default stack size is often quite small and may result in segmentation faults due to insufficient memory.
Frequently Asked Questions:
https://forum.mmm.ucar.edu/forums/frequently-asked-questions.115/