Difference between revisions of "Coupling with WRF-Chem"
Line 36: | Line 36: | ||
The tracer selected by <tt>tracer_opt=1</tt> will appear as an atmospheric variable in the output file with the name <tt>smoke</tt>. The chemical species in the atmosphere, selected by <tt>chem_opt</tt>, will appear under their respective names, such as <tt>n2o5</tt>. | The tracer selected by <tt>tracer_opt=1</tt> will appear as an atmospheric variable in the output file with the name <tt>smoke</tt>. The chemical species in the atmosphere, selected by <tt>chem_opt</tt>, will appear under their respective names, such as <tt>n2o5</tt>. | ||
− | == | + | ==Configuration== |
− | + | The selection of the model in WRF-Chem is controlled by namelist variables '''tracer_opt''' in the [https://github.com/jbeezley/wrf-fire/blob/master/wrfv2_fire/test/em_fire/chem/namelist.input#L78 '''&dynamics'''] section and '''chem_opt''' in the [https://github.com/jbeezley/wrf-fire/blob/master/wrfv2_fire/test/em_fire/chem/namelist.input#L203 '''&chemistry'''] section of '''namelist.input'''. The coupling supports '''trace_opt = 1''', which creates a single | |
− | the | + | tracer called '''smoke'''. |
− | + | ||
− | + | In each time step, the coupling code adds the fire emissions created in the time step to the first layer of atmosphere cells. The chemistry state arrays are have unit of concentrations ('''ppmv'''), so the amounts of the inserted species are | |
− | + | appropriately by the dry air mass in the first layer. The amount of the chemical species created is determined from the amount of fuel burned directly by an emissions table, while the smoke tracer uses the fire ground heat flux '''FGRNHFX''' as a proxy. The emissions table contains the amounts of emissions fuel burned in '''g/kg''' or '''mol/kg'''. The emissions tables are specified in file '''namelist.fire_emissions'''. This file contains a line like | |
+ | <pre> | ||
+ | no2=3.2,3.2,3.2,1.4,1.4,1.4,1.4,2.7,2.7,2.7,3,3,3, | ||
+ | </pre> | ||
+ | with emissions for each of the fuel categories used (by default, the 12 Anderson's categories). | ||
+ | |||
+ | There are two additional variables in '''namelist.fire_emissions''': | ||
+ | <pre> | ||
+ | compatible_chem_opt=112,119 | ||
+ | </pre> | ||
+ | is a list of '''chem_opt''' values intended to be used with the table. However, presently, the code does not check if the file lists other chemistry species supported by the coupling code, not just those for the given '''chem_opt'''. If it does, the results can be upredictable. | ||
+ | The variable | ||
+ | <pre> | ||
+ | printsums=1 | ||
+ | </pre> | ||
+ | will enable printing of the totals of each emissions species at the end of every time step. | ||
+ | |||
+ | There are currently two emissions tables available: | ||
+ | * {{Wrf-fire-path|wrfv2_fire/test/em_fire/chem/namelist.fire_emissions.RADM2|namelist.fire_emissions.RADM2}} for [http://ruc.noaa.gov/wrf/WG11/radm2.htm RADM2] | ||
+ | * {{Wrf-fire-path|wrfv2_fire/test/em_fire/chem/namelist.fire_emissions.MOZART|namelist.fire_emissions.MOZART}} for [http://www.acd.ucar.edu/wrf-chem/mozart.shtml MOZART] | ||
+ | |||
+ | ==Implementation== | ||
WRF-Chem contains a multitude of arrays representing concentrations of chemical species. The typical | WRF-Chem contains a multitude of arrays representing concentrations of chemical species. The typical | ||
method of injecting data into the simulation involves generating emission input data files from standard | method of injecting data into the simulation involves generating emission input data files from standard | ||
sources. These sources are read into the code using auxiliary input streams and interpolated into | sources. These sources are read into the code using auxiliary input streams and interpolated into | ||
− | the species arrays in the <tt>emissions</tt> module. For the coupling with | + | the species arrays in the <tt>emissions</tt> module. For the coupling with SFIRE, turning off file |
input in the namelist seems to initialize the emission arrays to zero. This eliminates the need to generate | input in the namelist seems to initialize the emission arrays to zero. This eliminates the need to generate | ||
− | useless emission files. | + | useless emission files. |
− | WRF-Chem stores its state in | + | WRF-Chem stores its state in arrays '''chem''' and '''tracer'''. These arrays are four dimensional indexed like '''(x,z,y,s)''', where s is the chemical |
− | species. | + | species. The domain structure contains scalars such as '''p_smoke''' (into the '''tracer''' array) and '''p_e_so4''' (into the '''chem''' array) that give the species index for |
− | + | each type. The species selections are specific to different chemistry options ('''chem_opt''') | |
− | + | from the registry; however, even unused species have their index set to 1. The dynamics section of the namelist has an option for '''tracer_opt'''. This | |
− | + | controls what tracers are generated for Chem. | |
− | contains scalars such as | ||
− | each type. The species | ||
− | from the registry | ||
− | |||
− | controls what tracers are generated for Chem | ||
− | |||
− | + | As of {{WRF-Fire-commit|e7b52ab1baef2565ae1743a25bc1ed7f7f2fc109|April 21, 2012}}, | |
− | + | the tracer is simply copied from the heat flux at the surface on the atmospheric mesh (<tt>GRNHFX</tt>). | |
− | + | A call to <tt>fire_emission</tt> has been added to <tt>module_fr_sfire_driver_wrf.F</tt> just after | |
− | + | calculation of heat flux tendencies. This subroutine has been added to the fire atmospheric module | |
+ | and is preprocessed out of the source when WRF-Chem is not being compiled. | ||
− | + | ==References== | |
− |
Revision as of 17:49, 23 December 2012
- Back to the WRF-SFIRE user guide.
As of WRF 3.4, WRF-Chem is now included in the SFire repository. Work into coupling SFire with WRF-Chem is ongoing. See branch chem. As of April 21, 2012, a working template has been implemented to inject a tracer into the atmosphere. This implementation seems to work as expected.
Compiling with chem support
Compiling the code with support for WRF-Chem is similar to the standard procedure. You must set an environment variable WRF_CHEM and configure with the argument chem as follows.
export WRF_CHEM=1 ./configure chem ./compile em_fire
Running an idealized example
An idealized example based on the hill case has been created in test/em_fire/chem. This example doesn't quite work out of the box because WRF-Chem requires USGS landuse data that the ideal case doesn't initialize. To get this example working, you have to trick WRF into thinking that the input file contains USGS landuse data. (I'm not sure if this data is even used when just using passive tracers anyway.) To do this, you can just change the global attribute MMINLU in wrfinput_d01 to the string "USGS". A python script (make_usgs.py) that does this is included in the test/em_fire/chem directory, but it requires netcdf4-python to run. Assuming you have this module, the following will execute the example.
./ideal.exe ./make_usgs.py ./wrf.exe
Alternatively, instead of ./make_usgs.py, you can execute in Matlab the script make_usgs.m
matlab -nodesktop -noflash < make_usgs.m
The tracer selected by tracer_opt=1 will appear as an atmospheric variable in the output file with the name smoke. The chemical species in the atmosphere, selected by chem_opt, will appear under their respective names, such as n2o5.
Configuration
The selection of the model in WRF-Chem is controlled by namelist variables tracer_opt in the &dynamics section and chem_opt in the &chemistry section of namelist.input. The coupling supports trace_opt = 1, which creates a single tracer called smoke.
In each time step, the coupling code adds the fire emissions created in the time step to the first layer of atmosphere cells. The chemistry state arrays are have unit of concentrations (ppmv), so the amounts of the inserted species are appropriately by the dry air mass in the first layer. The amount of the chemical species created is determined from the amount of fuel burned directly by an emissions table, while the smoke tracer uses the fire ground heat flux FGRNHFX as a proxy. The emissions table contains the amounts of emissions fuel burned in g/kg or mol/kg. The emissions tables are specified in file namelist.fire_emissions. This file contains a line like
no2=3.2,3.2,3.2,1.4,1.4,1.4,1.4,2.7,2.7,2.7,3,3,3,
with emissions for each of the fuel categories used (by default, the 12 Anderson's categories).
There are two additional variables in namelist.fire_emissions:
compatible_chem_opt=112,119
is a list of chem_opt values intended to be used with the table. However, presently, the code does not check if the file lists other chemistry species supported by the coupling code, not just those for the given chem_opt. If it does, the results can be upredictable. The variable
printsums=1
will enable printing of the totals of each emissions species at the end of every time step.
There are currently two emissions tables available:
Implementation
WRF-Chem contains a multitude of arrays representing concentrations of chemical species. The typical method of injecting data into the simulation involves generating emission input data files from standard sources. These sources are read into the code using auxiliary input streams and interpolated into the species arrays in the emissions module. For the coupling with SFIRE, turning off file input in the namelist seems to initialize the emission arrays to zero. This eliminates the need to generate useless emission files.
WRF-Chem stores its state in arrays chem and tracer. These arrays are four dimensional indexed like (x,z,y,s), where s is the chemical species. The domain structure contains scalars such as p_smoke (into the tracer array) and p_e_so4 (into the chem array) that give the species index for each type. The species selections are specific to different chemistry options (chem_opt) from the registry; however, even unused species have their index set to 1. The dynamics section of the namelist has an option for tracer_opt. This controls what tracers are generated for Chem.
As of April 21, 2012, the tracer is simply copied from the heat flux at the surface on the atmospheric mesh (GRNHFX). A call to fire_emission has been added to module_fr_sfire_driver_wrf.F just after calculation of heat flux tendencies. This subroutine has been added to the fire atmospheric module and is preprocessed out of the source when WRF-Chem is not being compiled.