Install Ubuntu Mpich WRF 4.4 Chem KPP Eng
Install Ubuntu Mpich WRF 4.4 Chem KPP Eng
Compute System
1. Objective.
To understand about WRF-Chem with KPP installation.
2. Scope.
Installation WRF-Chem Model Version 4.4 and KPP On Ubuntu.
3. Definition.
Ubuntu is linux operating system.
WRF-Chem Model is the Weather Research and Forecasting (WRF) model coupled with Chemistry.
The model simulates the emission, transport, mixing, and chemical transformation of trace gases
and aerosols simultaneously with the meteorology. The model is used for investigation of regional-
scale air quality, field program analysis, and cloud-scale interactions between clouds and
chemistry.
Kinetic PreProcessor(KPP) is a software tool that assists the computer simulation of chemical
kinetic systems. The concentrations of a chemical system evolve in time according to the
differential law of mass action kinetics. A numerical simulation requires an implementation of the
differential laws and a numerical integration in time.
4. Device.
Linux Ubuntu 22.04 type server have available space is 80G and memory more than 32G.
5. Operating Procedures.
5.1. open ssh client and connect to your linux ubuntu with username ubuntu.
ssh ubuntu@192.168.122.229
show ubuntu version.
$ cat /etc/os-release
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 LTS (Jammy Jellyfish)"
show default home directory.
$ pwd
/home/ubuntu
show user name.
$ whoami
ubuntu
$ make -j4
$ make install
### mpich
export PATH=/home/ubuntu/Build_WRF/LIBRARIES/mpich/bin:$PATH
$ make -j4
$ make install
Create PATH variable in file .bash_profile.
$ vi /home/ubuntu/.profile
### hdf5
export PATH=/home/ubuntu/Build_WRF/LIBRARIES/hdf5/bin:$PATH
export LD_LIBRARY_PATH=/home/ubuntu/Build_WRF/LIBRARIES/hdf5/lib:$LD_LIBRARY_PATH
$ CFLAGS=-fPIC CPPFLAGS='-I/home/ubuntu/Build_WRF/LIBRARIES/hdf5/include -
I/home/ubuntu/Build_WRF/LIBRARIES/curl/include' LDFLAGS='-
L/home/ubuntu/Build_WRF/LIBRARIES/hdf5/lib -
L/home/ubuntu/Build_WRF/LIBRARIES/curl/lib ' ./configure --
prefix=/home/ubuntu/Build_WRF/LIBRARIES/netcdf --enable-netcdf-4 --enable-netcdf4 --
enable-shared --enable-dap
$ make -j4
$ make install
$ cd ..
$ tar xzvf netcdf-fortran-4.5.3.tar.gz
$ cd netcdf-fortran-4.5.3
$ CPPFLAGS='-I/home/ubuntu/Build_WRF/LIBRARIES/netcdf/include' LDFLAGS='-
L/home/ubuntu/Build_WRF/LIBRARIES/netcdf/lib' FCFLAGS='-m64' ./configure --
prefix=/home/ubuntu/Build_WRF/LIBRARIES/netcdf
$ make -j4
$ make install
Create PATH variable in file .profile.
$ vi /home/ubuntu/.profile
### netcdf
export PATH=/home/ubuntu/Build_WRF/LIBRARIES/netcdf/bin:$PATH
export NETCDF=/home/ubuntu/Build_WRF/LIBRARIES/netcdf
export LD_LIBRARY_PATH=/home/ubuntu/Build_WRF/LIBRARIES/netcdf/lib:$LD_LIBRARY_PATH
$ CPPFLAGS='-I/home/ubuntu/Build_WRF/LIBRARIES/netcdf/include' FCFLAGS='-
m64' ./configure --prefix=/home/ubuntu/Build_WRF/LIBRARIES/libpng
$ make -j4
$ make install
5.6.7. Install Jasper Library.
change to source code directory.
$ cd /home/ubuntu/Build_WRF/src
$ cd /home/ubuntu/Build_WRF/src/jasper-2.0.10-build
$ make install
#### jasper
export PATH=/home/ubuntu/Build_WRF/LIBRARIES/jasper/bin:$PATH
export LD_LIBRARY_PATH=/home/ubuntu/Build_WRF/LIBRARIES/jasper/lib:$LD_LIBRARY_PATH
Install miniconda.
$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ sh ./Miniconda3-latest-Linux-x86_64.sh
Enter…, yes, ENTER, yesl
Install ncl.
$ source /home/ubuntu/.bashrc
$ conda create -n ncl_stable -c conda-forge ncl
$ source activate ncl_stable
Test ncl.
$ ncl -V
Show version 6.6.2 is good.
#### ncl
source activate ncl_stable
5.7. Install WRF-Chem.
5.7.1 Install WRF-Chem and KPP.
Variable setup.
$ 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='/usr/bin/yacc -d'
$ export FLEX=/usr/bin/flex
$ export FLEX_LIB_DIR=/usr/lib/x86_64-linux-gnu
$ export KPP_HOME=/home/ubuntu/Build_WRF/WRFV4.4/chem/KPP/kpp/kpp-2.1
$ export WRF_SRC_ROOT_DIR=/home/ubuntu/Build_WRF/WRFV4.4
$ export PATH=$KPP_HOME/bin:$PATH
$ export SED=/usr/bin/sed
$ export WRFIO_NCD_LARGE_FILE_SUPPORT=1
Change to directory.
$ cd /home/ubuntu/Build_WRF/
and nesting is 1
Compile for nesting? (1=basic, 2=preset moves, 3=vortex following) [default 1]: 1
Complie kpp.
$ ./compile 2>&1 | tee compile_kpp.log
Show message below is good.
Define variable.
$ cd WPS-4.4
$ export JASPERLIB=/home/ubuntu/Build_WRF/LIBRARIES/jasper/lib
$ export JASPERINC=/home/ubuntu/Build_WRF/LIBRARIES/jasper/include
Configure WPS.
$ ./configure
edit configure.wps file. Change DM_FC to mpif90 and Append -lgomp in WRF_LIB.
$ vi configure.wps
COMPRESSION_LIBS = -L/home/ubuntu/Build_WRF/LIBRARIES/jasper/lib -ljasper -lpng -lz
COMPRESSION_INC = -I/home/ubuntu/Build_WRF/LIBRARIES/jasper/include
DM_FC = mpif90
WRF_LIB = -L$(WRF_DIR)/external/io_grib1 -lio_grib1 \
-L$(WRF_DIR)/external/io_grib_share -lio_grib_share \
-L$(WRF_DIR)/external/io_int -lwrfio_int \
-L$(WRF_DIR)/external/io_netcdf -lwrfio_nf \
-L$(NETCDF)/lib -lnetcdff -lnetcdf -lgomp
Complie WPS.
$ ./compile 2>&1 | tee compile_wps.log
&geogrid
parent_id = 1,
parent_grid_ratio = 1,
i_parent_start = 1,
j_parent_start = 1,
e_we = 41,
e_sn = 41,
geog_data_res = '10m',
dx = 100000,
dy = 100000,
map_proj = 'lambert',
ref_lat = 35.0,
ref_lon = 25.0,
truelat1 = 30.0,
truelat2 = 40.0,
stand_lon = 25.0,
geog_data_path = '/home/ubuntu/Build_WRF/geog'
/
ref_x = 20.5
ref_y = 20.5
&ungrib
out_format = 'WPS',
prefix = 'FILE',
/
&metgrid
fg_name = 'FILE'
io_form_metgrid = 2,
/
opt_ignore_dom_center = .true.,
&mod_levs
press_pa = 201300 , 200100 , 100000 ,
95000 , 90000 ,
85000 , 80000 ,
75000 , 70000 ,
65000 , 60000 ,
55000 , 50000 ,
45000 , 40000 ,
35000 , 30000 ,
25000 , 20000 ,
15000 , 10000 ,
5000 , 1000
/
Create Geography Data.
$ ./geogrid.exe
link Vtable
$ ln -sf ungrib/Variable_Tables/Vtable.GFS Vtable
Edit namelist.input
$ vi namelist.input
&time_control
run_days = 2,
run_hours = 0,
run_minutes = 0,
run_seconds = 0,
start_year = 2010,
start_month = 07,
start_day = 14,
start_hour = 00,
start_minute = 00,
start_second = 00,
end_year = 2010,
end_month = 07,
end_day = 16,
end_hour = 00,
end_minute = 00,
end_second = 00,
interval_seconds = 10800,
input_from_file = .true.,
history_interval = 60,
frames_per_outfile = 72,
restart = .false.,
restart_interval = 0,
io_form_history = 2,
io_form_restart = 2,
io_form_input = 2,
io_form_boundary = 2,
auxinput6_inname = 'wrfbiochemi_d01',
auxinput7_inname = 'wrffirechemi_d<domain>',
auxinput8_inname = 'wrfchemi_gocart_bg_d<domain>',
auxinput12_inname = 'wrf_chem_input',
auxinput5_interval_m = 86400,
auxinput7_interval_m = 86400,
auxinput8_interval_m = 86400,
io_form_auxinput2 = 2,
io_form_auxinput5 = 0,
io_form_auxinput6 = 0,
io_form_auxinput7 = 0,
io_form_auxinput8 = 0,
io_form_auxinput12 = 0,
debug_level = 0,
auxinput1_inname = "met_em.d<domain>.<date>",
auxinput13_inname = 'wrfchemv_d<domain>',
auxinput13_interval_m = 86400,
io_form_auxinput13 = 0,
/
&dfi_control
/
&domains
time_step = 600,
time_step_fract_num = 0,
time_step_fract_den = 1,
max_dom = 1,
s_we = 1,
e_we = 41,
s_sn = 1,
e_sn = 41,
e_vert = 31,
num_metgrid_levels = 27,
num_metgrid_soil_levels = 4,
dx = 100000,
dy = 100000,
grid_id = 1,
parent_id = 0,
i_parent_start = 1,
j_parent_start = 1,
parent_grid_ratio = 1,
parent_time_step_ratio = 1,
p_top_requested = 10000,
feedback = 1,
smooth_option = 0,
p_top_requested = 10000,
zap_close_levels = 50,
interp_type = 1,
t_extrap_type = 2,
force_sfc_in_vinterp = 0,
use_levels_below_ground = .true.,
use_surface = .true.,
lagrange_order = 1,
sfcp_to_sfcp = .true.,
/
&physics
num_land_cat = 21,
mp_physics = 4,
progn = 0,
ra_lw_physics = 1,
ra_sw_physics = 2,
radt = 30,
sf_sfclay_physics = 1,
sf_surface_physics = 2,
bl_pbl_physics = 1,
bldt = 0,
cu_physics = 5,
cu_diag = 1,
cudt = 0,
ishallow = 0,
isfflx = 1,
ifsnow = 1,
icloud = 1,
surface_input_source = 1,
num_soil_layers = 4,
sf_urban_physics = 0,
mp_zero_out = 2,
mp_zero_out_thresh = 1.e-12,
maxiens = 1,
maxens = 3,
maxens2 = 3,
maxens3 = 16,
ensdim = 144,
cu_rad_feedback = .true.,
/
&fdda
/
&dynamics
rk_ord = 3,
w_damping = 1,
diff_opt = 1,
km_opt = 4,
diff_6th_opt = 0,
diff_6th_factor = 0.12,
base_temp = 290.
damp_opt = 0,
zdamp = 5000.,
dampcoef = 0.01,
khdif = 0,
kvdif = 0,
non_hydrostatic = .true.,
moist_adv_opt = 2,
scalar_adv_opt = 2,
chem_adv_opt = 2,
tke_adv_opt = 2,
time_step_sound = 4,
h_mom_adv_order = 5,
v_mom_adv_order = 3,
h_sca_adv_order = 5,
v_sca_adv_order = 3,
/
&bdy_control
spec_bdy_width = 5,
spec_zone = 1,
relax_zone = 4,
specified = .true.,
nested = .false.,
/
&grib2
/
&namelist_quilt
nio_tasks_per_group = 0,
nio_groups = 1,
/
&chem
kemit = 1,
chem_opt = 401,
bioemdt = 0,
photdt = 0,
chemdt = 10,
io_style_emissions = 0,
emiss_opt = 3,
emiss_opt_vol = 0,
emiss_ash_hgt = 20000.,
chem_in_opt = 0,
phot_opt = 0,
gas_drydep_opt = 0,
aer_drydep_opt = 1,
bio_emiss_opt = 0,
ne_area = 0,
dust_opt = 1,
dmsemis_opt = 0,
seas_opt = 0,
depo_fact = 0.25,
gas_bc_opt = 0,
gas_ic_opt = 0,
aer_bc_opt = 1,
aer_ic_opt = 1,
gaschem_onoff = 0,
aerchem_onoff = 1,
wetscav_onoff = 0,
cldchem_onoff = 0,
vertmix_onoff = 1,
chem_conv_tr = 0,
conv_tr_wetscav = 0,
conv_tr_aqchem = 0,
biomass_burn_opt = 0,
plumerisefire_frq = 30,
have_bcs_chem = .false.,
aer_ra_feedback = 0,
aer_op_opt = 0,
opt_pars_out = 0,
diagnostic_chem = 0,
/
Run WRF
$ mpirun -np 2 ./wrf.exe
$ vi plot_dust_5.ncl
;*************************************************
; WRF: DUST_5
;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
begin
f = addfile ("wrfout_d01_2010-07-14_00:00:00", "r")
res@tfDoNDCOverlay = True
res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks
do nt=0,ntimes,6
x = f->DUST_5(nt,0,:,:) ; (Time,level, south_north, west_east)
res@tiMainString = "WRF-CHEM (DUST_5) " + times(nt)
res@gsnLeftString = x@description
plot = gsn_csm_contour_map(wks,x(:,:),res)
end do
end
Create PDF
$ ncl plot_dust_5.ncl
Output is WRF_DUST_5.pdf, you can open pdf file from pdf viewer or download to your laptop or
type “evince WRF_DUST_5.pdf”.
6. Conclusion.
We can setup WRF-Chem and KPP. And thank you website
• https://wiki.harvard.edu/confluence/pages/viewpage.action?pageId=228526205
• https://github.com/whatheway/WRFCHEM-4.4-install-script-linux-
64bit/blob/main/WRF_CHEMKPP_INSTALL_64BIT.sh
• https://ruc.noaa.gov/wrf/wrf-chem/tutorialexercises/tutorialexercises001.html
• https://www.ncl.ucar.edu/Training/Tutorials/WRF_Users_Workshop/WRF_NCL.shtml
for information.
Thank you.