How to compile WRF-Chem

This is the basic one about WRF-Chem. You can check this one for more information.



$ cd flex_directory
$ wget
$ tar -xzf flex.tar.gz
$ cd flex-2.5.3
$ ./configure --prefix=flex_directory
$ make
$ make install


Google search byacc

$ wget ......
$ tar -xzvf ......
$ ./configure --prefix=........
$ make
$ make install

Environment Variables

$ vi ~/.bashrc
#for chem
export WRF_CHEM=1
export WRF_KPP=1
export PATH=yacclocation:$PATH
export PATH=flexlocation/bin:$PATH
export YACC='yacclocation/yacc -d'
export FLEX=flexlocation/bin/flex
export FLEX_LIB_DIR=flexlocation/lib
source ~/.bash_profile


Fix bug

In line 82 of chem/KPP/kpp/kpp-2.1/src/Makefile, change
@$(YACC) scan.y
@$(YACC) -d scan.y
Deleting -ll link:
Open file chem/KPP/kpp/kpp-2.1/src/Makefile
delete all (there are two) entrances of -ll there.
Fixing paths for integr_edit.exe:
Open file chem/KPP/util/write_decomp/Makefile
Find the line
integr_edit.exe $(MECH)
and replace it with
./integr_edit.exe $(MECH)

There’re two issues in module_lightning_driver in the phys/ directory (as mentioned in wrf-chem lightning forum):

  1. in subroutine lightning_driver, the following line (in my version on line 310):

IF ( MOD((itimestep * dt - lightning_start_seconds), lightning_dt ) .ne. 0 ) RETURN
will exit the subroutine if lightning_start_seconds is a multiple of lightning_dt (in the default case where lightning_dt is set to the model time step).

  1. line 474:

WRITE(message, ) ‘ lightning_driver: using user-prescribed IC:CG ratio = ‘, iccg_prescribed_num, iccg_prescribed_den
results in an error because only one variable can be added to the string. Changing this to:
) ‘ lightning_driver: using user-prescribed IC:CG ratio = ‘, iccg_prescribed_num / iccg_prescribed_den
resolves the issue.


$ cd WRFV3/
$ ./configure
(dmpar) INTEL (ifort/icc)
$ vi configure.wrf
$ ./compile em_real >& compile.log &


$ ./configure
intel (dmpar)
./compile > compile.log &


My environment variables:

hpc nuist

module unload intel
module load intel/16.0.1 hdf5 netcdf jasper zlib libpng grib_api ncview ncl openmpi
#for chem
export WRF_CHEM=1
export WRF_KPP=1
export PATH=my_work_path/model/yacc/byacc-20170709:$PATH
export PATH=my_work_path/model/flex/flex-2.5.3/bin:$PATH
export YACC='my_work_path/model/yacc/byacc-20170709/yacc -d'
export FLEX=my_work_path/model/flex/flex-2.5.3/bin/flex
export FLEX_LIB_DIR=my_work_path/model/flex/flex-2.5.3/lib
# added by Anaconda3 4.4.0 installer
#export PATH="my_home_path/anaconda3/bin:$PATH"
# hdfview
#export PATH=my_work_path/softwares/hdfview/HDFView-3.0.0-Linux/HDFView/3.0.0:$PATH


export OPENMPLIB=/public/software/compiler/composer_xe_2013_sp1.0.080/compiler/lib/intel64
export PATH=/public/software/mathlib/jasper/bin:$PATH
export PATH=/public/software/mathlib/libpng/bin:$PATH
export PATH=/public/software/mathlib/netcdf/4.3.0/intel/bin:$PATH
export NETCDF=/public/software/mathlib/netcdf/4.3.0/intel
export NETCDFINC=${NETCDF}/include
export NETCDFLIB=${NETCDF}/lib
export JASPER=/public/software/mathlib/jasper
export JASPERINC=${JASPER}/include
export JASPERLIB=${JASPER}/lib
export ZLIB_PATH=/public/software/mathlib/zlib
#for chem
export WRF_CHEM=1
export WRF_KPP=1
export PATH=/public/home/zhangxin/models/yacc/byacc-20170709/bin:$PATH
export PATH=/public/home/zhangxin/models/flex/flex-2.5.3/bin:$PATH
export YACC='/public/home/zhangxin/models/yacc/byacc-20170709/yacc -d'
export FLEX=/public/home/zhangxin/models/flex/flex-2.5.3/bin/flex
export FLEX_LIB_DIR=/public/home/zhangxin/models/flex/flex-2.5.3/lib
test -s ~/.alias && . ~/.alias || true
export PATH=/public/home/zhangxin/softwares/HDFView/3.0.0:$PATH
export PATH=/public/home/zhangxin/softwares/HDFView/3.0.0/slf4j-1.7.25:$PATH
# added by Anaconda3 installer
export PATH="/public/home/zhangxin/anaconda3/bin:$PATH"

Powered by Hexo and Hexo-theme-hiker

Copyright © 2013 - 2019 Dreambooker All Rights Reserved.

UV : | PV :