WRF-Chem的安装和WRF的安装大致相同
1 库安装[1]
除了我之前的博客“Ubuntu中配置WRF”中提到需要安装的一些库(mpich、zlib、hdf5、netcdf、libpng、Jasper)之外,还需要额外安装:
(1)byacc
wget https://invisible-island.net/datafiles/release/byacc.tar.gz
tar -xzvf byacc.tar.gz
cd byacc
./configure --prefix=<byacc_dir>
make
make install
(2)flex
wget http://www.ncl.ucar.edu/Download/files/flex.tar.gz
tar -xzf flex.tar.gz
cd flex-2.5.3
./configure --prefix=<flex_directory>
make
make install
(3)ubuntu apt安装yacc和flex
ubuntu上使用flex和bison来代替lex和yacc
sudo apt-get install flex
sudo apt-get install bison
2 WRF-Chem安装[2]
版本4之后WRF的安装包中就自带了Chem,可以通过设置export WRF_CHEM=1或0来决定安装与否。
在~/. bashrc中设置:
ulimit -s unlimited
export MALLOC_CHECK_=0
export EM_CORE=1
export NMM_CORE=0
export WRF_CHEM=1
export WRF_KPP=1
export YACC='<byacc_dir>/bin/yacc -d'
export FLEX=<flex_directory>
export FLEX_LIB_DIR=<flex_directory>/lib
export KPP_HOME=<WRF_dir>/chem/KPP/kpp/kpp-2.1
export WRF_SRC_ROOT_DIR=<WRF_dir>
export PATH=$KPP_HOME/bin:$PATH
export SED=/usr/bin/sed
export WRFIO_NCD_LARGE_FILE_SUPPORT=1
注:<>中设置为自己的路径,不要设置错了
设置好之后
source ~/. bashrc
然后在WRF_dir下:
./configure
注意:WRF-Chem 不支持共享式内存的并行方式,因此 smpar and smpar+dmpar 编译选项不能使用,只能选择 serial 或 dmpar 选项。
(1)编译kpp
./compile 2>&1 | tee compile_kpp.log
(2)编译em_real
./compile em_real 2>&1 | tee compile_wrf.log
结束后
ls -lah main/*.exe
有real.exe 和 wrf.exe就是编译成功
(3)化学排放数据转化程序
cp compile compile.bak # 备份原来的compile
wget https://ruc.noaa.gov/wrf/wrf-chem/Fix/compile #下载新的compile
chmod +x compile
./compile emi_conv >& emcompile.log
ls chem/convert_emiss.exe #安装成功,chem文件夹下会有convert_emiss.exe程序复制
可以检查 emcompile.log 文件是否有编译错误。
WRF Chem V3.7以后就在 compile 里面删除了 convert_emiss.exe这个程序的编译。因此需要单独下载新的。若直接使用原来的 ./compile emi_conv 编译,会出现如下错误:This option is not recognized。
3 WPS的安装
与无Chem的WPS安装无异
参考
[1] WRFChem的安装-腾讯云开发者社区-腾讯云
[2] 在Ubuntu 22.04上安装WRF-Chem模型4.4版本和KPP-CSDN博客