WRF compile errors

本文解决 WRF/Chem 在编译过程中遇到的未定义引用、内部编译错误及土壤层级不匹配等问题。提供了 netCDF 配置、编译选项调整及 Vtable 更新等解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The errors met in WRF/Chem compile process and solution.

Error 1:
Situation: ./compile em_real
Error: wrf_io.f:(.text 0x16a2): undefined reference to `nf_inq_varid_’

Solution: vim configure.wrf
change the line

LIB_EXTERNAL    = \
                     $(WRF_SRC_ROOT_DIR)/external/io_netcdf/libwrfio_nf.a -L/home/kfu/netcdf/lib  -lnetcdff -lnetcdf

to

LIB_EXTERNAL    = \
                     $(WRF_SRC_ROOT_DIR)/external/io_netcdf/libwrfio_nf.a -L/home/kfu/netcdf/lib  -lnetcdf

Another solution:
Check if the NETCDFPATH in configure.wrf is right or not:

NETCDFPATH      =    /usr/intel/netcdf/

Error 2
ifort catastrophic error **internal compiler error segmentation violation signal raised**

Solution
Change to the directory where the compile error file locates, and run the compile command in the compile.log file with replacement of -O3 by -O2.
Ref: https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/559320
“It fails on the -O3 optimization, run the compile using -O3 and then change to -O2 in configure.wrf and compile the rest with that. Or update your compiler.”

Error 3
ver 3.5.1 WRF/Chem and ver 3.5.1 wps

real.exe

I am using GFS input data and am getting the following error:
----------------- ERROR -------------------

> namelist : num_metgrid_soil_levels = 4
> input files : NUM_METGRID_SOIL_LEVELS = 0 (from met_em files).
> -------------- FATAL CALLED ---------------
> FATAL CALLED FROM FILE: LINE: 695
> Mismatch between namelist and global attribute NUM_METGRID_SOIL_LEVELS
> -------------------------------------------

A3: Refer to
http://www2.mmm.ucar.edu/wrf/users/FAQ_files/FAQ_wrf_runtime.html

If you are using GFS initial conditions with WRFV3.6.1 or earlier, and with a start date of January 7, 2015 or later, then you will need to use a new Vtable, as GFS updated all of their data beginning 1/7/15. You can find the updated Vtable here. For additional information regarding the update to GFS data, click here.

You will need to copy this Vtable into your WPS/ungrib/Variable_Tables/ directory, and call it Vtable.GFS (this will overwrite your previous GFS Vtable). After that, you need to go back to the WPS/ directory and re-run ungrib.exe. Before running ungrib.exe, you will need to link-in the new Vtable:

ln -sf ungrib/Variable_Tables/Vtable.GFS Vtable

Once you are certain the ‘Vtable’ file in your WPS/ directory is the NEW Vtable.GFS, you can run ungrib.exe, then metgrid.exe, and then go to the WRFV3/ directory, link-in your met_em* files and run real.exe. You can verify that you have 4 soil levels in your met_em* files by issuing the command:

ncdump -h met_em.d01*
where ‘*’ represents only one of your met_em files

You should see the category (toward the bottom) NUM_METGRID_SOIL_LEVELS = 4.

After download the new Vtable_GFS file, and put it in the WPS ungrid Vtable directory, there still some problem. Check the original and new Vtable files, we can figure that there are four lines that affect the NUM_METGRID_SOIL_LEVELS:

  85 | 112  |   0  |  10  | ST000010 | K       | T 0-10 cm below ground layer (Upper)    |  2  |  0  |  2  | 106 |
  85 | 112  |  10  |  40  | ST010040 | K       | T 10-40 cm below ground layer (Upper)   |  2  |  0  |  2  | 106 |
  85 | 112  |  40  | 100  | ST040100 | K       | T 40-100 cm below ground layer (Upper)  |  2  |  0  |  2  | 106 |
  85 | 112  | 100  | 200  | ST100200 | K       | T 100-200 cm below ground layer (Bottom)|  2  |  0  |  2  | 106 |

Put these four lines in the original Vtable before the line

  11 | 112  |  10  | 200  | ST010200 | K       | T 10-200 cm below ground layer (Bottom) |  0  |  0  |  0  | 106 |

And run real.exe, problem solved.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值