Running WRFChem
=====
The i ran meteorology sucessfuly last time with the same configurations, but now with chemistry does not work.
## namelist.wps
```
&share
wrf_core = 'ARW',
max_dom = 3,
start_date = '2014-08-04_00:00:00','2014-08-04_00:00:00','2014-08-04_00:00:00',
end_date = '2014-08-11_00:00:00','2014-08-11_00:00:00','2014-08-11_00:00:00',
interval_seconds = 21600
io_form_geogrid = 2,
/
&geogrid
parent_id = 1, 1, 2,
parent_grid_ratio = 1, 5, 5,
i_parent_start = 1, 26, 57,
j_parent_start = 1, 26, 59,
e_we = 80, 181, 191,
e_sn = 80, 181, 181,
geog_data_res = 'modis_30s+2m', 'modis_30s+30s', 'modis_30s+30s',
dx = 25000,
dy = 25000,
map_proj = 'mercator',
ref_lat = -23.550391,
ref_lon = -46.633949,
truelat1 = -23.550391,
truelat2 = -24.550,
stand_lon = -39.300,
geog_data_path = '/scr4/sibarra/geo/geog'
/
&ungrib
out_format = 'WPS',
prefix = 'FILE',
/
&metgrid
fg_name = 'FILE'
io_form_metgrid = 2,
/
```
running `ncl util/plotgrids_new.ncl` returns the following figure.
![](https://i.imgur.com/7vk4j79.png)
Now can be run the other wrf scripts:
```
cd geogrid
ln -sf GEOGRID.TBL.ARW_CHEM GEOGRID.TBL
ln -sf ungrib/Variable_Tables/Vtable.GFS Vtable
./geogrid.exe
./link_grib.csh /scr4/sibarra/met/GFS2014/GFS*
./ungrib.exe
./metgrid.exe
```
## real.exe
From http://www2.mmm.ucar.edu/wrf/users/docs/user_guide_V3.8/users_guide_chap4.htm#Real
The real-data WRF cases are those that have the input data to the “real.exe”
The WPS package delivers data that is ready to be used in the WRF system by the “real.exe” program:
- The data adheres to the WRF IO API. Unless you are developing special tools, stick with the netCDF option to communicate between the WPS package and “real.exe”.
- The data has already been horizontally interpolated to the correct grid-point staggering for each variable, and the winds are correctly rotated to the WRF model map projection.
- 3-D meteorological data required from the WPS: pressure, u, v, temperature, relative humidity, geopotential height
- Optional 3-D hydrometeor data may be provided to the real program at run-time, but these fields will not be used in the coarse-grid lateral boundary file. Fields named: QR, QC, QS, QI, QG, QH, QNI (mixing ratio for rain, cloud, snow, ice, graupel, hail, and number concentration) are eligible for input from the metgrid output files.
- 3D soil data from the WPS: soil temperature, soil moisture, soil liquid (optional, depending on physics choices in the WRF model)
- 2D meteorological data from the WPS: sea level pressure, surface pressure, surface u and v, surface temperature, surface relative humidity, input elevation
- 2-D meteorological optional data from WPS: sea surface temperature, physical snow depth, water equivalent snow depth
- 2D static data for the physical surface: terrain elevation, land use categories, soil texture categories, temporally-interpolated monthly data, land sea mask, elevation of the input model’s topography
- 2D static data for the projection: map factors, Coriolis, projection rotation, computational latitude
- constants: domain size, grid distances, date
- The WPS data may either be isobaric or some more-generalized vertical coordinate, where each column is monotonic in pressure
- All 3-D meteorological data (wind, temperature, height, moisture, pressure) must have the same number of levels, and variables must have the exact same levels. For example, it is not acceptable to have more levels for temperature (for example) than height. Likewise, it is not acceptable to have an extra level for the horizontal wind components, but not for moisture.
```
&time_control
run_days = 0,
run_hours = 0,
run_minutes = 0,
run_seconds = 0,
start_year = 2014, 2014, 2014,
start_month = 08, 08, 08,
start_day = 04, 04, 04,
start_hour = 00, 00, 00,
start_minute = 00, 00, 00,
start_second = 00, 00, 00,
end_year = 2014, 2014, 2014,
end_month = 08, 08, 08,
end_day = 11, 11, 11,
end_hour = 00, 00, 00,
end_minute = 00, 00, 00,
end_second = 00, 00, 00,
interval_seconds = 21600
input_from_file = .true.,.true.,.true.,
history_interval = 60, 60, 60,
history_outname = "/scr4/sibarra/masp/run2/wrfout_d<domain>_<date>"
frames_per_outfile = 5000, 5000, 5000,
restart = .false.,
restart_interval = 10080,
auxinput5_interval_m = 60,
io_form_auxinput2 = 2,
!io_form_auxinput5 = 0,
io_form_history = 2
io_form_restart = 2
io_form_input = 2
io_form_boundary = 2
debug_level = 0
/
&domains
time_step = 150,
time_step_fract_num = 0,
time_step_fract_den = 1,
max_dom = 3,
e_we = 80, 181, 191,
e_sn = 80, 181, 181,
e_vert = 35, 35, 35,
p_top_requested = 5000,
num_metgrid_levels = 27,
vert_refine_fact = 1,
num_metgrid_soil_levels = 4,
dx = 25000, 5000, 1000,
dy = 25000, 5000, 1000,
grid_id = 1, 2, 3,
parent_id = 1, 1, 2,
i_parent_start = 1, 26, 57,
j_parent_start = 1, 26, 59,
parent_grid_ratio = 1, 5, 5,
parent_time_step_ratio = 1, 5, 5,
feedback = 1,
smooth_option = 0
/
&physics
mp_physics = 2, 2, 2,
ra_lw_physics = 1, 1, 1,
ra_sw_physics = 2, 2, 2,
radt = 15, 15, 15,
sf_sfclay_physics = 1, 1, 1,
sf_surface_physics = 2, 2, 2,
bl_pbl_physics = 1, 1, 1,
bldt = 0, 0, 0,
cu_physics = 5, 5, 0,
cudt = 0, 0, 0,
cu_diag = 1,
cu_rad_feedback = .true.,
isfflx = 1,
ifsnow = 0,
icloud = 0,
surface_input_source = 1,
num_soil_layers = 4,
num_land_cat = 20,
sf_urban_physics = 1, 1, 1,
/
&fdda
/
&dynamics
w_damping = 0,
diff_opt = 1, 1, 1,
km_opt = 4, 4, 4,
diff_6th_opt = 0, 0, 0,
diff_6th_factor = 0.12, 0.12, 0.12,
base_temp = 290.
damp_opt = 0,
zdamp = 5000., 5000., 5000.,
dampcoef = 0.2, 0.2, 0.2
khdif = 0, 0, 0,
kvdif = 0, 0, 0,
non_hydrostatic = .true., .true., .true.,
moist_adv_opt = 1, 1, 1,
scalar_adv_opt = 1, 1, 1,
/
&bdy_control
spec_bdy_width = 5,
spec_zone = 1,
relax_zone = 4,
specified = .true., .false.,.false.,
nested = .false., .true., .true.,
/
&grib2
/
&chem
kemit = 1,
chem_opt = 0, 0, 0,
bioemdt = 30, 15, 15,
photdt = 30, 15, 15,
chemdt = 2., 2., 2.,
io_style_emissions = 1, ! 2 cuando se lee modelar todo el periodo
emiss_inpt_opt = 1, 1, 1,
emiss_opt = 2, 3, 3,
chem_in_opt = 0, 0, 0,
phot_opt = 2, 2, 2,
gas_drydep_opt = 0, 1, 1,
aer_drydep_opt = 0, 1, 1,
bio_emiss_opt = 1, 1, 1,
dust_opt = 0,
dmsemis_opt = 0,
seas_opt = 2,
gas_bc_opt = 1, 1, 1,
gas_ic_opt = 1, 1, 1,
aer_bc_opt = 1, 1, 1,
aer_ic_opt = 1, 1, 1,
aer_op_opt = 1, 0, 0,
! opt_pars_out = 1, 0, 0,
gaschem_onoff = 1, 1, 1,
aerchem_onoff = 1, 1, 1,
wetscav_onoff = 0, 0, 0,
cldchem_onoff = 0, 0, 0,
vertmix_onoff = 1, 1, 1,
chem_conv_tr = 1, 1, 1,
biomass_burn_opt = 0, 0, 1,
! plumerisefire_frq = 30, 30, 30,
aer_ra_feedback = 0, 0, 0
have_bcs_chem = .true., .false., .false.,
/
&namelist_quilt
nio_tasks_per_group = 0,
nio_groups = 1,
/
```
Then
```
ln -sf ../../../WPS/met_em* .
ssh noh4
mpirun -machinefile /scr4/sibarra/host2 -np 32 ./real.exe &
tail -f rsl.error.0000
```
After real were generated al three wrfinputs for d01, d02 and d03. So now it is a good idea to generate the wrfchemi input files. Some of the results are
![NO](https://i.imgur.com/QgMyuOE.png)
![CO](https://i.imgur.com/zjS4Nu0.png)
![ALD](https://i.imgur.com/PdVLBMC.png)
## wrf.exe
After ./real.exe was ran sucessfully, it is time to run ./wrf.exe. Nevertheless, it can be used the same namelist.input. That is because, the namelist.input in this case has max_dom=3, and the strategy here will be to simulate first the domain 3 and 2, the bigger domains.
```
&time_control
run_days = 0,
run_hours = 0,
run_minutes = 0,
run_seconds = 0,
start_year = 2014, 2014, 2014,
start_month = 08, 08, 08,
start_day = 04, 04, 04,
start_hour = 00, 00, 00,
start_minute = 00, 00, 00,
start_second = 00, 00, 00,
end_year = 2014, 2014, 2014,
end_month = 08, 08, 08,
end_day = 11, 11, 11,
end_hour = 00, 00, 00,
end_minute = 00, 00, 00,
end_second = 00, 00, 00,
interval_seconds = 21600
input_from_file = .true.,.true.,.true.,
history_interval = 60, 60, 60,
history_outname = "/scr4/sibarra/masp/run2/wrfout_d<domain>_<date>"
frames_per_outfile = 5000, 5000, 5000,
restart = .false.,
restart_interval = 10080,
auxinput5_interval_m = 60,
io_form_auxinput2 = 2,
!io_form_auxinput5 = 0,
io_form_history = 2
io_form_restart = 2
io_form_input = 2
io_form_boundary = 2
debug_level = 0
/
&domains
time_step = 150,
time_step_fract_num = 0,
time_step_fract_den = 1,
max_dom = 2,
e_we = 80, 181, 191,
e_sn = 80, 181, 181,
e_vert = 35, 35, 35,
p_top_requested = 5000,
num_metgrid_levels = 27,
vert_refine_fact = 1,
num_metgrid_soil_levels = 4,
dx = 25000, 5000, 1000,
dy = 25000, 5000, 1000,
grid_id = 1, 2, 3,
parent_id = 1, 1, 2,
i_parent_start = 1, 26, 57,
j_parent_start = 1, 26, 59,
parent_grid_ratio = 1, 5, 5,
parent_time_step_ratio = 1, 5, 5,
feedback = 1,
smooth_option = 0
/
&physics
mp_physics = 2, 2, 2,
ra_lw_physics = 1, 1, 1,
ra_sw_physics = 2, 2, 2,
radt = 15, 15, 15,
sf_sfclay_physics = 1, 1, 1,
sf_surface_physics = 2, 2, 2,
bl_pbl_physics = 1, 1, 1,
bldt = 0, 0, 0,
cu_physics = 5, 5, 0,
cudt = 0, 0, 0,
cu_diag = 1,
cu_rad_feedback = .true.,
isfflx = 1,
ifsnow = 0,
icloud = 0,
surface_input_source = 1,
num_soil_layers = 4,
num_land_cat = 20,
sf_urban_physics = 1, 1, 1,
/
&fdda
/
&dynamics
w_damping = 0,
diff_opt = 1, 1, 1,
km_opt = 4, 4, 4,
diff_6th_opt = 0, 0, 0,
diff_6th_factor = 0.12, 0.12, 0.12,
base_temp = 290.
damp_opt = 0,
zdamp = 5000., 5000., 5000.,
dampcoef = 0.2, 0.2, 0.2
khdif = 0, 0, 0,
kvdif = 0, 0, 0,
non_hydrostatic = .true., .true., .true.,
moist_adv_opt = 1, 1, 1,
scalar_adv_opt = 1, 1, 1,
/
&bdy_control
spec_bdy_width = 5,
spec_zone = 1,
relax_zone = 4,
specified = .true., .false.,.false.,
nested = .false., .true., .true.,
/
&grib2
/
&chem
kemit = 1,
chem_opt = 0, 0, 0,
bioemdt = 30, 15, 15,
photdt = 30, 15, 15,
chemdt = 2., 2., 2.,
io_style_emissions = 1, ! 2 cuando se lee modelar todo el periodo
emiss_inpt_opt = 1, 1, 1,
emiss_opt = 2, 3, 3,
chem_in_opt = 0, 0, 0,
phot_opt = 2, 2, 2,
gas_drydep_opt = 0, 1, 1,
aer_drydep_opt = 0, 1, 1,
bio_emiss_opt = 1, 1, 1,
dust_opt = 0,
dmsemis_opt = 0,
seas_opt = 2,
gas_bc_opt = 1, 1, 1,
gas_ic_opt = 1, 1, 1,
aer_bc_opt = 1, 1, 1,
aer_ic_opt = 1, 1, 1,
aer_op_opt = 1, 0, 0,
! opt_pars_out = 1, 0, 0,
gaschem_onoff = 1, 1, 1,
aerchem_onoff = 1, 1, 1,
wetscav_onoff = 0, 0, 0,
cldchem_onoff = 0, 0, 0,
vertmix_onoff = 1, 1, 1,
chem_conv_tr = 1, 1, 1,
biomass_burn_opt = 0, 0, 1,
! plumerisefire_frq = 30, 30, 30,
aer_ra_feedback = 0, 0, 0
have_bcs_chem = .true., .false., .false.,
/
&namelist_quilt
nio_tasks_per_group = 0,
nio_groups = 1,
/
```
The changes from the previous namelist are:
max_dom=2
```
ssh noh4
mpirun -machinefile /scr4/sibarra/host2 -np 32 ./wrf.exe &
tail -f rsl.error.0000
```
## ndow.exe
before running ./ndow.exe there are important changes to do at the namelist.input. Timestep should changes from 150 to 6,
interval_seconds = 3600, max_dom=2, and change e_we, e_sn. In summary, delete the first column.
also:
```
mv wrfinput_d03 wrfndi_d02
rm wrfinput_d01 | rm wrfinput_d02
ln -sf /scr4/sibarra/masp/run2/wrfout_d02_2014-08-04_00\:00\:00 wrfout_d01_2014-08-00_00\:00\:00
mpirun -machinefile /scr4/sibarra/host2 -np 32 ./ndown.exe &
```
Because the inputs are wrfndi_d02 and wrfout_d01.... **./down.exe** returns
wrfinput and wrfbdy d02.
```
&time_control
run_days = 0,
run_hours = 0,
run_minutes = 0,
run_seconds = 0,
start_year = 2014, 2014, 2014,
start_month = 08, 08, 08,
start_day = 04, 04, 04,
start_hour = 00, 00, 00,
start_minute = 00, 00, 00,
start_second = 00, 00, 00,
end_year = 2014, 2014, 2014,
end_month = 08, 08, 08,
end_day = 11, 11, 11,
end_hour = 00, 00, 00,
end_minute = 00, 00, 00,
end_second = 00, 00, 00,
interval_seconds = 21600
input_from_file = .true.,.true.,.true.,
history_interval = 60, 60, 60,
history_outname = "/scr4/sibarra/masp/run2/wrfout_d<domain>_<date>"
frames_per_outfile = 5000, 5000, 5000,
restart = .false.,
restart_interval = 10080,
auxinput5_interval_m = 60,
io_form_auxinput2 = 2,
!io_form_auxinput5 = 0,
io_form_history = 2
io_form_restart = 2
io_form_input = 2
io_form_boundary = 2
debug_level = 0
/
&domains
time_step = 6,
time_step_fract_num = 0,
time_step_fract_den = 1,
max_dom = 2,
e_we = 181, 191,
e_sn = 181, 181,
e_vert = 35, 35,
p_top_requested = 5000,
num_metgrid_levels = 27,
vert_refine_fact = 1,
num_metgrid_soil_levels = 4,
dx = 5000, 1000,
dy = 5000, 1000,
grid_id = 2, 3,
parent_id = 1, 2,
i_parent_start = 26, 57,
j_parent_start = 26, 59,
parent_grid_ratio = 5, 5,
parent_time_step_ratio = 5, 5,
feedback = 1,
smooth_option = 0
/
&physics
mp_physics = 2, 2, 2,
ra_lw_physics = 1, 1, 1,
ra_sw_physics = 2, 2, 2,
radt = 15, 15, 15,
sf_sfclay_physics = 1, 1, 1,
sf_surface_physics = 2, 2, 2,
bl_pbl_physics = 1, 1, 1,
bldt = 0, 0, 0,
cu_physics = 5, 5, 0,
cudt = 0, 0, 0,
cu_diag = 1,
cu_rad_feedback = .true.,
isfflx = 1,
ifsnow = 0,
icloud = 0,
surface_input_source = 1,
num_soil_layers = 4,
num_land_cat = 20,
sf_urban_physics = 1, 1, 1,
/
&fdda
/
&dynamics
w_damping = 0,
diff_opt = 1, 1, 1,
km_opt = 4, 4, 4,
diff_6th_opt = 0, 0, 0,
diff_6th_factor = 0.12, 0.12, 0.12,
base_temp = 290.
damp_opt = 0,
zdamp = 5000., 5000., 5000.,
dampcoef = 0.2, 0.2, 0.2
khdif = 0, 0, 0,
kvdif = 0, 0, 0,
non_hydrostatic = .true., .true., .true.,
moist_adv_opt = 1, 1, 1,
scalar_adv_opt = 1, 1, 1,
/
&bdy_control
spec_bdy_width = 5,
spec_zone = 1,
relax_zone = 4,
specified = .true., .false.,.false.,
nested = .false., .true., .true.,
/
&grib2
/
&chem
kemit = 1,
chem_opt = 0, 0, 0,
bioemdt = 30, 15, 15,
photdt = 30, 15, 15,
chemdt = 2., 2., 2.,
io_style_emissions = 1, ! 2 cuando se lee modelar todo el periodo
emiss_inpt_opt = 1, 1, 1,
emiss_opt = 2, 3, 3,
chem_in_opt = 0, 0, 0,
phot_opt = 2, 2, 2,
gas_drydep_opt = 0, 1, 1,
aer_drydep_opt = 0, 1, 1,
bio_emiss_opt = 1, 1, 1,
dust_opt = 0,
dmsemis_opt = 0,
seas_opt = 2,
gas_bc_opt = 1, 1, 1,
gas_ic_opt = 1, 1, 1,
aer_bc_opt = 1, 1, 1,
aer_ic_opt = 1, 1, 1,
aer_op_opt = 1, 0, 0,
! opt_pars_out = 1, 0, 0,
gaschem_onoff = 1, 1, 1,
aerchem_onoff = 1, 1, 1,
wetscav_onoff = 0, 0, 0,
cldchem_onoff = 0, 0, 0,
vertmix_onoff = 1, 1, 1,
chem_conv_tr = 1, 1, 1,
biomass_burn_opt = 0, 0, 1,
! plumerisefire_frq = 30, 30, 30,
aer_ra_feedback = 0, 0, 0
have_bcs_chem = .true., .false., .false.,
/
&namelist_quilt
nio_tasks_per_group = 0,
nio_groups = 1,
/
```
Once ./ndown.exe was ran, outputs must change names:
```
mv wrfinput_d02 wrfinput_d01 | mv wrfbdy_d02 wrfbdy_d01
```
It is also important to change name or remove wrfout_d01...
```
rm wrfout_d01_2014-08-00_00\:00\:00
```
In this case, this file comes form a symbolic link `ln -sf ...`
## ./wrf.exe
```
&time_control
run_days = 0,
run_hours = 0,
run_minutes = 0,
run_seconds = 0,
start_year = 2014,
start_month = 08,
start_day = 04,
start_hour = 00,
start_minute = 00,
start_second = 00,
end_year = 2014,
end_month = 08,
end_day = 11,
end_hour = 00,
end_minute = 00,
end_second = 00,
interval_seconds = 21600
input_from_file = .true.,.true.,.true.,
history_interval = 60,
history_outname = "/scr4/sibarra/masp/run2/1km/wrfout_d<domain>_<date>"
frames_per_outfile = 5000,
restart = .false.,
restart_interval = 10080,
auxinput5_interval_m = 60,
io_form_auxinput2 = 2,
! io_form_auxinput5 = 11,
io_form_history = 2
io_form_restart = 2
io_form_input = 2
io_form_boundary = 2
debug_level = 0
/
&domains
time_step = 3,
time_step_fract_num = 0,
time_step_fract_den = 1,
max_dom = 1,
e_we = 191,
e_sn = 181,
e_vert = 35,
p_top_requested = 5000,
num_metgrid_levels = 27,
vert_refine_fact = 1,
num_metgrid_soil_levels = 4,
dx = 1000,
dy = 1000,
grid_id = 3,
parent_id = 2,
i_parent_start = 57,
j_parent_start = 59,
parent_grid_ratio = 5,
parent_time_step_ratio = 5,
feedback = 1,
smooth_option = 0
/
&physics
mp_physics = 2,
ra_lw_physics = 1,
ra_sw_physics = 2,
radt = 15,
sf_sfclay_physics = 1,
sf_surface_physics = 2,
bl_pbl_physics = 1,
bldt = 0,
cu_physics = 0,
cudt = 0,
cu_diag = 1,
cu_rad_feedback = .true.,
isfflx = 1,
ifsnow = 0,
icloud = 0,
surface_input_source = 1,
num_soil_layers = 4,
num_land_cat = 20,
sf_urban_physics = 1,
/
&fdda
/
&dynamics
w_damping = 0,
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.2
khdif = 0,
kvdif = 0,
non_hydrostatic = .true., .true., .true.,
moist_adv_opt = 1,
scalar_adv_opt = 1,
/
&bdy_control
spec_bdy_width = 5,
spec_zone = 1,
relax_zone = 4,
specified = .true., .false.,.false.,
nested = .false., .true., .true.,
/
&grib2
/
&chem
kemit = 1,
chem_opt = 1,
bioemdt = 15,
photdt = 15,
chemdt = 2.,
io_style_emissions = 2,
emiss_inpt_opt = 1,
emiss_opt = 2,
chem_in_opt = 1,
phot_opt = 2,
gas_drydep_opt = 1,
aer_drydep_opt = 0,
bio_emiss_opt = 0,
dust_opt = 0,
dmsemis_opt = 0,
seas_opt = 0,
gas_bc_opt = 1,
gas_ic_opt = 1,
aer_bc_opt = 1,
aer_ic_opt = 1,
aer_op_opt = 0,
! opt_pars_out = 0,
gaschem_onoff = 1,
aerchem_onoff = 1,
wetscav_onoff = 0,
cldchem_onoff = 0,
vertmix_onoff = 1,
chem_conv_tr = 0,
biomass_burn_opt = 0,
aer_ra_feedback = 0
have_bcs_chem = .false., .false., .false.,
/
&namelist_quilt
nio_tasks_per_group = 0,
nio_groups = 1,
/
```
Before run the model, it is good idea to check the files in the folder:
![](https://i.imgur.com/tLqCwon.png)
Important files:
- wrfbdy_d01
- wrfchemi_d01_2014_08_00_00:00:00
- wrfndi_d02
- wrfinput_d01
Then, just run the model
```
mpirun -machinefile /scr4/sibarra/host2 -np 32 ./wrf.exe &
tail -f rsl.error.0000
```
So far, the results look very low.
CO
![CO (ppm)](https://i.imgur.com/MsC6L7G.png)
O$_3$
![O3 (ppm)](https://i.imgur.com/UAOx6Ix.png)
It seems that is not reading the emissiosn data, however, the terminal says that emissions data i been read correctly (i believe).
![emis](https://i.imgur.com/6bRNcJM.png)