Technical Tutorial for WRF Installation and Operation

Statement 1 This tutorial is completely free, please do not commercialize
Statement 2 Time is short, if there are mistakes or deficiencies, welcome to criticize and correct

1. WRF installation

Official installation tutorial: https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compilation_tutorial.php
The official installation tutorial is very detailed, but some details are relatively tricky for beginners. This article will further discuss the needs of the WRF installation process Pay attention to the problem.

1.1 Verify and install the base package

Inspection instructions:

which gfortran
which cpp
which gcc

The which command is used to find and display the absolute path of a given command software (binary file). This command is very useful. When a command has multiple installation paths, this command can determine the path of the command call. If you find that which does not return a result, that is, a certain path is missing in PATH, you need to install the corresponding software. When the calling path is not the path you want, you need to add and re-add the path on the left side of PATH to adjust the path priority.

Installation instructions:

sudo apt-get install gfortran cpp gcc m4 g++

sudo is a system management command that temporarily allows ordinary users to obtain some super privileges. On your personal computer, the password of the current Linux account is required to execute the sudo command, so please be sure to remember the account password when registering; if you are already a root super user, you already have all the permissions of the Linux system and do not need sudo Then you can execute all commands; if you do not have super privileges on the server, cannot execute installation commands, and lack some necessary basic packages, please contact your administrator for solutions.

Other basic commands: ar head sed awk hostname sleep cat ln sort cd ls tar cp make touch cut mkdir tr expr mv uname file nm wc grep printf which gzip rm These commands are usually included in the Linux system. If not, use apt-get to install them
yourself

1.2 Directory structure of WRF installation

Build_WRF
  |-- TESTS
  |-- LIBRARIES
  |-- WPS
  |-- WRF
  |-- DATA (field data input, location optional)
  |-- GEOG (surface static data, location optional)

Create each directory

mkdir Build_WRF
cd Build_WRF
mkdir TESTS
mkdir LIBRARIES

Add a directory location variable to simplify the input of the command, where xxx depends on the situation of your own server

export DIR=/home/xxx/Build_WRF

1.3 Test the compiler, enter the test directory, download the test package and decompress it

cd $DIR/TESTS
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_tests.tar
tar xvf Fortran_C_tests.tar

carry out testing

gfortran TEST_1_fortran_only_fixed.f
./a.out
gfortran TEST_2_fortran_only_free.f90
./a.out
gcc TEST_3_c_only.c
./a.out
gcc -c -m64 TEST_4_fortran+c_c.c
gfortran -c -m64 TEST_4_fortran+c_f.f90
gfortran -m64 TEST_4_fortran+c_f.o TEST_4_fortran+c_c.o
./a.out
./TEST_csh.csh
./TEST_perl.pl
./TEST_sh.sh

A total of seven tests, all show SUCCESS means success. It is worth noting that the compiler used in this article is the GUN compiler, and the corresponding C and Fortran compilers are gcc and gfortran. In addition, there is an Intel compiler, and the corresponding C and Fortran compilers are icc and ifort.
Basic test succeeded

1.4 Enter the dependent package directory, download the dependent package and decompress it

cd $DIR/LIBRARIES
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/netcdf-4.1.3.tar.gz
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/mpich-3.0.4.tar.gz
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/libpng-1.2.50.tar.gz
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/zlib-1.2.7.tar.gz
tar xvf netcdf-4.1.3.tar.gz
tar xvf mpich-3.0.4.tar.gz
tar xvf jasper-1.900.1.tar.gz
tar xvf libpng-1.2.50.tar.gz
tar xvf zlib-1.2.7.tar.gz

Note that tar is a compression and packaging tool under Linux. The parameter -x means to decompress the file, the parameter -f specifies the file name, the parameter -v means to display the processing process, and sometimes the parameter -z means to call gzip to perform compression or decompression. So sometimes the command is also written as tar xzvf or tar -xzvf, the effect is the same.

1.5 Install each dependent package

Install netcdf:

cd $DIR/LIBRARIES/netcdf-4.1.3
./configure --prefix=$DIR/netcdf --disable-dap --disable-netcdf-4 --disable-shared
make
make install

Note that ./configure->make->make install is a general method to install software packages, the --prefix parameter specifies the installation path, make compiles the source code, make install will move the compiled code to the installation path, that is, perform
netcdf installed successfully
Successful prompt of make install for installing netcdf

Add path:

export PATH=$DIR/LIBRARIES/netcdf/bin:$PATH
export NETCDF=$DIR/LIBRARIES/netcdf

Here PATH=binary file path: $PATH will add the path of the corresponding software to the left side of the PATH variable, so that the system can find the corresponding command. If you just use export to add a path in the command line, this path will only take effect once, and it will become invalid the next time you log in. Therefore, these export instructions often need to be written in .bashrc, this file will store the user's personalized settings, and automatically load all instructions when Linux starts. To make the path permanent, you can add all the export directives in this article to your .bashrc.

Enter vi ~/.bashrc to edit the file. The "." here means a hidden file, so if you use the ls command in the home directory (ie /home/xxx, the wavy line in front represents this directory), the file will not be displayed, and you must enter ls -a to see it.

vi is a text editor under Linux, press the i key to enter the edit mode, then you can edit freely; press esc to exit the edit mode, and then enter: q to exit, if you have modified the file content, you need to enter: wq to save and exit or enter: q! to force quit without saving. The modified .bashrc will not take effect immediately, you need to enter source ~/.bashrc to make it take effect, or restart Linux.

Install mpich:

cd $DIR/LIBRARIES/mpich-3.0.4
./configure --prefix=$DIR/LIBRARIES/mpich
make
make install

Add path:

export PATH=$DIR/LIBRARIES/mpich/bin:$PATH

Install zlib:

cd $DIR/LIBRARIES/zlib-1.2.7
./configure --prefix=$DIR/LIBRARIES/grib2
make
make install

Install libpng:

cd $DIR/LIBRARIES/libpng-1.2.50
./configure --prefix=$DIR/LIBRARIES/grib2
make
make install

Install jasper:

cd $DIR/LIBRARIES/jasper-1.900.1
./configure --prefix=$DIR/LIBRARIES/grib2
make
make install

Add path:

export JASPERLIB=$DIR/LIBRARIES/grib2/lib
export JASPERINC=$DIR/LIBRARIES/grib2/include
export LDFLAGS=-L$DIR/LIBRARIES/grib2/lib
export CPPFLAGS=-I$DIR/LIBRARIES/grib2/include

1.6 Compatibility test, download the test package and decompress it

cd $DIR/TESTS
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_NETCDF_MPI_tests.tar
tar xvf Fortran_C_NETCDF_MPI_tests.tar

carry out testing:

cp ${NETCDF}/include/netcdf.inc .
gfortran -c 01_fortran+c+netcdf_f.f
gcc -c 01_fortran+c+netcdf_c.c
gfortran 01_fortran+c+netcdf_f.o 01_fortran+c+netcdf_c.o -L${NETCDF}/lib -lnetcdff -lnetcdf
./a.out
cp ${NETCDF}/include/netcdf.inc .
mpif90 -c 02_fortran+c+netcdf+mpi_f.f
mpicc -c 02_fortran+c+netcdf+mpi_c.c
mpif90 02_fortran+c+netcdf+mpi_f.o 02_fortran+c+netcdf+mpi_c.o -L${NETCDF}/lib -lnetcdff -lnetcdf
mpirun ./a.out

There are a total of two tests, respectively testing the netcdf and mpich just installed, if both show SUCCESS, it means success
Compatibility test successful

1.7 Download WPS and WRF

cd $DIR
git clone --recurse-submodules https://github.com/wrf-model/WRF
#或者较旧的版本(不推荐)
#git clone https://github.com/wrf-model/WRF
#或者更老的版本(不推荐)
#wget https://www2.mmm.ucar.edu/wrf/src/WRFV4.0.TAR.gz
git clone https://github.com/wrf-model/WPS

Compile WRF

cd $DIR/WRF
./configure
./compile em_real

If four exe files are successfully generated under $DIR/WRF/run or $DIR/WRF/test/em_real, the installation is successful
WRF success

Compile WPS

cd $DIR/WPS
./configure
./compile

If three exe files are successfully generated under $DIR/WPS, it means the installation is successful. It must be noted that WRF must be successfully compiled before WPS can be compiled, and the order cannot be reversed.
WPS success

When ./configure of WRF and WPS will let you choose the compiler and parallel mode. The rightmost column is the compiler. Generally speaking, the Intel compiler is more efficient, but if you don’t have one, you can only choose GUN. There are four parallel methods: serial (serial, that is, non-parallel), smpar (memory shared parallel), dmpar (distributed parallel), dm+sm (using dmpar and smpar at the same time), please choose according to the situation of your own server .
WRF configuration
WRF ./configure, select 34 on my server

WPS configuration
./configure of WPS, choose 3 on my server

1.8 Other required data

To run WPS and WRF, you also need to download surface static data and driving field data. Surface static data includes terrain, soil type and other information, divided into Mandatory Static Data, Static Data for Specific Applications and Optional Static Data, if there is no special need Just download Mandatory, and choose low resolution or high resolution according to your needs; the driving field data provides the input field of the model, which is essentially a type of reanalysis data, so it can sometimes be used as observation data. Different institutions provide different input fields, and there may be some minor differences. You can download it from the official website of WRF, or you can go to the official website of the corresponding institution to download (for example, this article gives the ERA5 data of ECMWF, which is also recognized as a relatively good reanalysis data).

Surface static data:
http://www2.mmm.ucar.edu/wrf/users/download/get_sources_wps_geog.html

Input fields:
https://www2.mmm.ucar.edu/wrf/users/download/free_data.html
https://cds.climate.copernicus.eu/cdsapp#!/search?text=ERA5%20hourly%20data

Installation of netcdf-c and netcdf-fortran (optional)

For simplicity, the netcdf version used above is version 4.1.3. After version 4.2, netcdf-c and netcdf-fortran start to separate and need to be installed separately. If you want to install a higher version of netcdf, please refer to the following tutorial:

cd $DIR/LIBRARIES
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/netcdf-c-4.7.2.tar.gz
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/netcdf-fortran-4.5.2.tar.gz
tar xvf netcdf-c-4.7.2.tar.gz
tar xvf netcdf-fortran-4.5.2.tar.gz

Install netcdf-c:

cd $DIR/LIBRARIES/netcdf-c-4.7.2
./configure --prefix=$DIR/LIBRARIES/netcdf --disable-dap --disable-netcdf-4 --disable-shared
make
make install

Add path:

export PATH=$DIR/LIBRARIES/netcdf/bin:$PATH
export NETCDF=$DIR/LIBRARIES/netcdf

Install netcdf-fortran:

cd $DIR/LIBRARIES/netcdf-fortran-4.5.2
./configure --prefix=$DIR/LIBRARIES/netcdf --disable-shared LIBS="-lnetcdf -lz" LDFLAGS="-L$DIR/LIBRARIES/netcdf/lib" CPPFLAGS="-I$DIR/LIBRARIES/netcdf/include"
make
make install

Note that netcdf-c must be successfully installed before netcdf-fortran can be installed, and the order cannot be reversed. After netcdf is installed successfully, other mpich, zlib, libpng, and jasper dependent packages are installed according to the previous tutorial.
If you do not set some of the above parameters, but you can still install normally, don't worry, it means that your software package can find the correct path. Or, you can install it successfully through some other tutorials, which is also possible. The focus is on being able to install successfully, not how to install it.

Problems that may be encountered during installation

You may encounter various problems during the above installation process, here we list some common problems and their solutions.
Problem 1. Insufficient permissions during ./configure. Permission denied.
Use sudo, such as:

sudo ./configure

Question 2 mpich installation is unsuccessful. The selected Fortran 90 compiler gfortran does not work with the selected Fortran 77 compiler gfortran.
To solve the problem, the version of mpich is too low. Consider installing the latest version of mpich or downgrading gfortran (below 10)

Question 3 Netcdf reports an error curl configure: error: curl required for byte range support. Install curl or build without --enable-byterange.
Solution According to the prompt, install the curl library

sudo apt-get install libcurl-dev

Or use the --disable-byterange parameter

./configure --prefix=$DIR/LIBRARIES/netcdf --disable-byterange

Question 4 netcdf, mpich, etc. use the wrong compiler when ./configure, for example, you frequently appear conda gcc_linux-64 in the configuration process
to solve Please set CC, FC, etc.:

./configure --prefix=$DIR/LIBRARIES/netcdf --disable-dap --disable-netcdf-4 --disable-shared CC=gcc CXX=g++ FC=gfortran FCFLAGS=-m64 F77=gfortran F90=gfortran FFLAGS=-m64

For example, CC=gcc here specifies that the C compiler is the default gcc. If you want to use gcc in other paths, you must write CC=xxx/gcc or adjust the priority of PATH. All these parameters should be written on the same line as ./configure. The same is true for CPPFLAGS and LDFLAGS when netcdf-fortran is installed later. Do not write in separate lines.

Problem 5.1 netcdf-fortran reported an error configure: error: C compiler cannot create executables in ./configure
Problem 5.2 libpng reported an error configure: error: zlib not installed
in ./configure link -lz lead to. Some servers are relatively well configured and have their own zlib environment, so this error will not occur; while some servers will not. If this error occurs, please follow the steps below:

  1. First install zlib according to this tutorial
  2. When performing ./configure of netcdf-fortran, enter:
./configure --prefix=$DIR/LIBRARIES/netcdf --disable-shared LIBS="-lnetcdf -lz" LDFLAGS="-L$DIR/LIBRARIES/netcdf/lib -L$DIR/LIBRARIES/grib2/lib" CPPFLAGS="-I$DIR/LIBRARIES/netcdf/include -I$DIR/LIBRARIES/grib2/include"
  1. When performing ./configure of libpng, enter:
./configure --prefix=$DIR/LIBRARIES/grib2 LDFLAGS=-L$DIR/LIBRARIES/grib2/lib CPPFLAGS=-I$DIR/LIBRARIES/grib2/include

In addition, please carefully check whether your $DIR and parameter settings are correct, and do not make mistakes.
Question 5.1 Error
Question 5.2 Error
All in all, the installation of netcdf-fortran may be one of the links with the most problems. If you have any problems that are difficult to solve, or have any supplementary suggestions, welcome to put forward in the comment area below.

Question 6 jasper fails to be installed in the Darwin kernel,
please refer to the Mac WRF installation tutorial

Question 7 There is a problem when compiling WRF /mnt/c/Windows/System32/cmd.exe/ifort: Not a directory.
Solution Obviously you do not have an Intel compiler, please select the GUN compiler when ./configure, if you want to use Intel to compile Please install it yourself
Question 7 error

Problem 8 Error Error Error NoahMP submodule files not populating WRF directories problem occurs when WRF is compiled
Consider downloading the latest version of WRF, that is, adding the –recurse-submodules parameter

git clone --recurse-submodules https://github.com/wrf-model/WRF

Question 8 Error

Problem 9 WRF and WPS keep swiping the screen during ./configure
to solve Restart your Shell, the so-called Shell is your operation interface

Of course, the situation of different computers is different, and the problems encountered will be full of tricks. There are far more problems that may arise when installing WRF, and it is impossible to list them all in this article. If the problem you encounter is not mentioned in this article, don't be discouraged. Please check the error message carefully, figure out the cause of the error, and solve the problem according to the prompts or search the Internet for solutions to the problem.

2. Operation of WRF

The official tutorial URL of WRF is here: https://www2.mmm.ucar.edu/wrf/users/docs/user_guide_v4/v4.4/contents.html
Please read the tutorial carefully, especially Chapter 3 and Chapter 5 , which introduces various technical details of WPS and WRF in detail. This article only briefly introduces some entry-level foundations. If you want to learn more and be familiar with WRF, please be sure to read the official tutorial.

2.1 Basic process of WPS and WRF operation

WPS (WRF Preprocessing System) is the preprocessing system of WRF. WRF is a numerical calculation program, so we need to run WPS first, and then run WRF. The overall process is as follows (taking the ERA5 input field as an example).
Run WPS:

cd $DIR/WPS
#修改你的namelist.wps,这是你的主要工作之一
vi namelist.wps
#处理静态网格,生成geo_em*,这里的*表示通配符
./geogrid.exe
#链接变量表
ln -sf ungrib/Variable_Tables/Vtable.ERA-interim.pl Vtable
#导入输入场,会生成GRIBFILE*链接文件
./link_grib ../DATA/era5*.grib
#“解构”grib文件,生成中间文件,中间文件的前缀可自定义,默认为FILE*
./ungrib.exe
#整合中间文件,生成气象场数据met_em*
./metgrid.exe

The Vtable mentioned above is a variable table, and different input fields use different Vtables. You can use vi to browse the contents of this table, and you can find that each variable corresponds to a number. This number is the variable code of the grib file, and ungrib.exe uses this code to determine the variable. Files in nc format cannot be processed by ungrib.exe and need to be converted. The ERA5 single levels and pressure levels on the CDS official website have many variables. If you don’t know which variables need to be downloaded as input fields, you can also refer to this table.
variable table example

Run WRF:

cd $DIR/WRF/test/em_real
#修改你的namelist.input,这是你的主要工作之一
vi namelist.input
#将WPS生成的met_em*链接过来
ln -s ../../../WPS/met_em* ./
#生成wrfinput*(初始条件)和wrfbdy*(边界条件)
./real.exe
#进行数值积分,这里&表示后台运行
./wrf.exe &

In rsl.error.0000, you can view the running process and error information. If wrf: SUCCESS COMPLETE WRF is displayed, congratulations, the operation is successful, and the wrfout* file generated in the directory is the output result. If you feel that the running speed is too slow, you can use parallel computing. It should be noted that wrf.exe and metgrid.exe can use parallel computing; ungrib.exe cannot use parallel computing; real.exe can theoretically use parallel computing, but the actual test It is found that there will be some problems in its parallelism, so it is not recommended to use parallel computing; the processing time of geogrid.exe is very short, and generally there is no need to use parallel computing.

2.2 Setting of namelist

Below we give a brief introduction to some commonly used parameters of namelist.wps and namelist.input. For details, please refer to the official website tutorial.
If you want to set up a layer of nested grids, you need to use two columns of parameter values ​​in the namelist to give the information of the parent grid and the nested grid, separated by commas; the same is true for multi-layer nesting ; If you don't want to use nesting, just use a list of parameter values.

namelist.wps
&share
wrf_core The framework of WRF, WRF can be divided into ARW (for scientific research) and NMM (for operational forecasting), two types, we use WRF-ARW, select 'ARW' here
max_dom Total number of grids (simulation domain)
start_date end_date Enter field data start and end time
interval_seconds Input field data interval time (time resolution), in seconds
&geogrid
parent_id The parent grid number of the nested grid, the outermost grid is set to 1
parent_grid_ratio The grid spacing ratio of the parent grid and the nested grid, the outermost grid is set to 1
i_parent_start j_parent_start The starting position of the nested grid in the parent grid, the outermost grid is set to 1
s_we s_sn The index value of the starting grid point in the east-west and north-south directions, the default is 1
e_we e_sn The index value of the ending grid point in the east-west and north-south directions is generally your total grid points
dx dy East-west (x) and north-south (y) direction grid spacing, in meters, but WRF does not support rectangular grids, here these two must be set to the same value
ref_lat ref_lon The latitude and longitude of the center of the simulation domain
map_proj Map projections, common projections include Lambert projection (more suitable for mid-latitudes), Mercator projection (more suitable for low latitudes), polar projection (more suitable for high latitudes), equidistant cylindrical projections (commonly used for drawing ), etc. For details, please learn the relevant knowledge of map projection, refer to https://www2.mmm.ucar.edu/wrf/users/docs/user_guide_v4/v4.4/users_guide_chap3.html#_How_to_Run
truelat1 truelat2 The standard latitude of the projection, the latitude at which the projection plane is the same length as the earth's latitude, that is, the latitude where the projection plane is tangent or cut to the earth
stand_lon Vertical reference longitude, see the figure below
geog_data_path Directory location for surface static data
&ungrib
out_format For the format of the intermediate file, select 'WPS' here, refer to https://www2.mmm.ucar.edu/wrf/users/docs/user_guide_v4/v4.4/users_guide_chap3.html#_Writing_Meteorological_Data
prefix intermediate file prefix
&metgrid
fg_name Prefix of intermediate files to read, recognized by metgrid.exe
io_form_metgrid met_em* file format, the default is 2 (nc format)
namelist.input
&time_control
start_year start_month start_day start_hours start_minute start_second Start time of WRF simulation (year, month, day, hour, minute, second)
end_year end_month end_day end_hours end_minute end_second The start time of WRF simulation (year, month, day, hour, minute, second), our WRF-ARW is only used for model research, not for business forecasting, so this time range cannot exceed the time range of the input field
run_days run_hours run_minutes run_seconds WRF simulation operation (day, hour, minute, second), in fact, as long as the start and end time are set, these can be ignored
interval_seconds Set it to be the same as namelist.wps
history_interval The time interval for WRF output results, in minutes
frames_per_outfile How many time records are there in each WRF output file
restart Whether to enable breakpoint restart
restart_interval How often to generate a restart file, in minutes
iofields_filename Control output variables, refer to https://www2.mmm.ucar.edu/wrf/users/docs/user_guide_v4/v4.4/users_guide_chap5.html#runtimeio
&domains
time_step time_step_fract_num time_step_fract_den Time integration step size (integer numerator and denominator), unit second
e_we e_sn e_vert e_vert is the end grid index value in the vertical direction, the others are the same as namelist.wps
p_top_requested Mode top pressure value, unit Pa
num_metgrid_levels num_metgrid_soil_levels The number of vertical layers and soil layers of the met_em* file can be viewed with the ncdump -h or ncl_filedump command
max_dom dx dy grid_id parent_id i_parent_start j_parent_start grid_id为网格区域的编号,其他同namelist.wps
parent_grid_ratio parent_time_step_ratio parent_time_step_ratio为母网格与嵌套网格的时间积分步长比,最外层网格设为1
&physics
mp_physics 微物理过程方案
cu_physics cudt 积云参数化方案和积云方案调用时间间隔
ra_lw_physics ra_sw_physics radt 长短波辐射方案和辐射方案调用时间间隔
bl_pbl_physics bldt 边界层方案和边界层方案调用时间间隔
sf_sfclay_physics 近地面层方案
sf_surface_physics 陆面过程方案

Standard longitude example

stand_lon分别设为102和108时的模拟区域,可见标准经度设为多少,哪一条经线就是“竖直”的,这两张图是用WPS自带的工具绘制的,位置在$DIR/WPS/util/plotgrids_new.ncl

运行过程中可能遇到的问题

你在WPS和WRF的运行过程中,可能遇到各种各样的问题,这里我们同样列举几个常见的问题以及它们的解决方法。如果本文的教程不能解决你的问题,请去网上搜索解决方法。
有一类问题是用户设置错误导致的,比如下面两个错误,分别是边界层方案和近地面方案不匹配以及模式顶气压设置过低(模式顶过高),你只需要根据提示修改相应的参数即可。
Type I error

还有一类问题属于模型自身的问题,比如下面这个SSiB陆面方案,它的设置相对复杂,容易出现错误。如果你并非想专门地深入研究该方案,就请放弃使用该方案,换一个其他的可运行的陆面方案即可。这两类问题我们不过多讨论,下面我们看几个常见的特殊错误。
Type II error

问题1 运行ungrib.exe出错:
\tI was expecting a Grib1 file, but this is a Grib2 file.
\tIt is possible this is because your GRIBFILE.XXX files
\tare not all of the same type.
\tWPS can handle both file types, but a separate ungrib
\tjob must be run for each Grib type.\n
解决 检查你的输入场grib文件。你在下载ERA5数据作为土壤地表近地面输入场时,应该下载ERA5 single levels而不是ERA5-Land。

问题2 运行wrf.exe出错:not enough info for a p sfc computation
解决 你的输出场缺失某些地表气压,请仔细检查输入场数据的完整性
Question 2 error

问题3 运行wrf.exe时,出现内存错误:
Backtrace for this error:
#0 0x2ba24472eb9a in ???
解决 可能是你的时间积分步长设置过大,导致溢出。一般而言,数值计算的时间步长和空间步长需要匹配,即前者是后者的3~6倍(s/km),比如你的格距dxdy为10000m,时间步长time_step就要设为60s。
Question 3 error
*注:在WRF较新的版本中,会直接提示时间步长过大
Question 3 Error New

问题4 运行wrf.exe出错:the domain size is too small for this many processors, or the decomposition aspect ratio is poor.
解决 使用的并行数太多,减少一些
Question 4 Error

问题5 运行wrf.exe出错:not enough eta levels to reach p_top
解决 模式层数太少,请增大e_vert值
Question 5 error

3. 前后处理工具

3.1 NCL

NCL(NCAR Command Language)是由美国大气研究中心(NCAR)开发的专门设计用于科学资料分析、科学数据处理以及科学数据可视化的一门解释型高级语言。常用在气象数据的处理和可视化上。
NCL官方网站:https://www.ncl.ucar.edu/

3.2 Python(+Matplotlib+Cartopy+Jupyter)(推荐)

众所周知,Python是一门很火的高级程序设计语言,也是当今主流编程语言之一。Matplotlib是Python的绘图库,与Cartopy包一起可以绘制许多精美的气象分析图,尤其再结合Jupyter Notebook可以随时保存结果,功能十分强大。NCL固然方便,但其开放性和发展性依然是远不及Python的。
Matplotlib官方示例:https://matplotlib.org/stable/tutorials/index.html
Cartopy官方示例:https://scitools.org.uk/cartopy/docs/latest/gallery/index.html
NCL and Python Demo

NCL和Python绘制的云南地区ERA5的2m温度分布

3.3 WRF Domain Wizard(推荐)

在设置namelist.wps时,一个首要问题就是确定模拟区域。你当然可以使用WPS自带的plotgrids_new.ncl绘制模拟域,但下面的WRF Domain Wizard软件更加方便,只需要轻轻几点,就可以框选出模拟区域,并确定参数信息。
官方下载地址:https://www.esrl.noaa.gov/gsd/wrfportal/DomainWizard.html
WRF Domain Wizard interface

3.4 CDO(推荐)

CDO (Climate Data Operators) is an extremely powerful and easy-to-operate software for meteorological data processing and analysis through the command line. It provides more than 700 individual operators, which can perform a series of operations related to meteorological data. With CDO, you can perform a series of processing such as merging, interpolation, and variable extraction on the output results of WRF, which is very convenient.
Official tutorial: https://code.mpimet.mpg.de/projects/cdo/wiki
Several commonly used CDO instructions:

#双线性插值
cdo remapbil,r360x180 infile outfile
#合并时间
cdo mergetime infile(s) outfile
#提取WRF变量2m温度
cdo select,name=T2 wrfout* outfile
#提取WRF变量2m相对湿度
cdo -b F32 -expr,'rh2=(Q2*PSFC)/(380.4*exp(17.27*(T2-273.15)/(T2-35.85)))*100' -select,name=Q2,PSFC,T2 wrfout* outfile

Guess you like

Origin blog.csdn.net/ME1010/article/details/129914778