登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 clover~ 于 2019-6-5 11:41 编辑
最近开始接触WRF-Chem,目前停留在学习用工具处理排放源的阶段。今天上午成功编译PREP-CHEM-SRC-1.5,其中遇到很多棘手的error,想了很多办法终于解决,个人感觉这些经验比较有用,因此分享给大家。
解压并安装后首先要看README!! 按照文件里面的步骤一步步安装基本上没问题。但是里面的内容写的相对简略,对于小白可能有些地方会看不太懂,所以我把文件中看不太懂的地方做些补充。
在编译之前,首先要确保成功安装以下三个库(注意版本)
1. ZLIB 1.2.8(libz.a) or later distribution. You may download the software from
http://www.zlib.net/
2. HDF5-1.8.13(libhdf5_fortran.a, libhdf5hl_fortran.a) or later distribution. You may download the software from
http://www.hdfgroup.org/HDF5/release/obtain5.html
3. NetCDF 4.1.3 (libnetcdf.a). You may download the software from
ftp://ftp.unidata.ucar.edu/pub/netcdf/
安装WRF的时候要求安装NetCDF,所以要去环境变量中看一下NetCDF库安装的位置。安装ZLIB库可能会遇到文件夹无法创建的问题,这个问题百度或者谷歌都可以轻松解决。困扰我一天之久的问题是HDF5库的安装,这也是里面最容易出问题的地方!!!画重点!!!
HDF5编译有问题,会出现prep chem Can't open module file 'hdf5.mod' for reading at (1): No such file or direct这个BUG,当HDF5配置成功之后,这个问题就解决了!!!!
下面我具体说明HDF5的安装步骤:
首先确保ZLIB已经成功安装,完成后安装HDF5,步骤如下:
./configure \
--prefix=/path_libs/hdf5-1.8.13 \
--with-zlib=/path_libs/zlib-1.2.8 \
--disable-shared \
--enable-fortran
make
make check
make install
make check-install
configure时,一定要按照标红的部分输入,不然编译PREP-CHEM-SRC-1.5时会出问题。make后要make check,保证没有error。完成以上步骤后,三个库就装好了。
接下来要编译prep_chem_sources。
首先需要进入bin/build目录下 cd bin/build
我用的服务器装的是gfortran,所以vim include.mk.gfortran.wrf
打开文件后要修改的内容如下
# NETCDF libraries
NETCDF=/users/public/Build_WRF/LIBRARIES/netcdf
#NETCDF=/scratchin/grupos/catt-brams/shared/libs/gfortran/netcdf-4.1.3
NETCDF_INC=-I$(NETCDF)/include
NETCDF_LIBS=-L$(NETCDF)/lib -lnetcdff -lnetcdf
# HDF libraries
HDF5=/users/wanghw/wrf_chem/prep_chem_resources/hdf5
#HDF5=/scratchin/grupos/catt-brams/shared/libs/gfortran/hdf5-1.8.13-serial
HDF5_INC=-I$(HDF5)/include
HDF5_LIB=-L$(HDF5)/lib -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -ldl -L/users/wanghw/wrf_chem/prep_chem_resources/zliblib -lz -ldl
标红的位置是需要修改的地方。
完成后,输入
make OPT=gfortran.wrf CHEM=RADM_WRF_FIM
or
make OPT=intel.wrf CHEM=RADM_WRF_FIM
or
make OPT=pgi.wrf CHEM=RADM_WRF_FIM
取决于编译器
如果没有出现上面提到的error,可能会出现另一个error:
cp -f ../../src/edgar_emissions.f90 edgar_emissions.f90 gfortran -c -Xpreprocessor -DRADM_WRF_FIM -O2 -fconvert=big-endian -frecord-marker=4 -I../../aux_src/utils/include -I/usr/include -I/usr/include edgar_emissions.f90 edgar_emissions.f90:841.15: 'AGRICULTURE',& 1 Error: Different CHARACTER lengths (11/6) in array constructor at (1) edgar_emissions.f90:894.61: filename=trim(edgar_data_dir)//"/"//trim(PREFIX)//trim(setor(isetor))//tr 1 Error: Function 'setor' at (1) has no IMPLICIT type edgar_emissions.f90:916.16: if(trim(setor(isetor)) .eq. 'AGRICULTURE' .and. trim(spc_name(ispc)) .n 1 Error: Function 'setor' at (1) has no IMPLICIT type edgar_emissions.f90:923.30: print*,trim(setor(isetor))," ",trim(dsetname),i, " MAX ",ma 1 Error: Function 'setor' at (1) has no IMPLICIT type edgar_emissions.f90:924.30: print*,trim(setor(isetor))," ",trim(dsetname),i, " MIN ",mi 1 Error: Function 'setor' at (1) has no IMPLICIT type make: *** [edgar_emissions.o] Error 1 |