How to add namelist variables
(Redirected from How to add variables to namelist.input)
Jump to navigation
Jump to search
namelist.input
- Edit Registry/registry.fire to add a config line. It should be clear from the lines already there how. Use NumTLev 1. Then you need to put the variable in namelist.input line only once. If you use MaxLevels, Otherwise you will need to guess how many levels there are and hit the correct one. (Ideally, the finest level where the fire model lives, should be the first, then it would not matter, but we are not so lucky, many models are configured so that the finest domain is the last. We really should have used 1 from the beginning always. Oh well.)
- Add declaration of the variable and its default value to the list at the beginning of phys/module_fr_sfire_util.F. That will make the variable known anywhere in phys/module_fr_sfire_*.F. Please use the same name for this variable as in the registry, lest a confusion ensues.
- Add a line to copy the value from config_flags into the variable in module_fr_sfire_driver.F subroutine set_flags
namelist.fire
- Add a declaration of the variable at the beginning of module_fr_sfire_phys.F, before the "contains" statement. That will make it accessible throughout that file.
- The variable can be either scalar, or vary by category, then declare it with dimension(mfuelcats)
- If you want to use the variable in other files, you need to make it PUBLIC a little bit below and import it in those other files through a USE statement. E.g. you can add it to
use module_fr_sfire_phys, only: mfuelcats, nfuelcats
in module_fr_sfire_atm.F (if your added code deals with atmosphere, it should go this file)
- Add data statement after the declaration with your default values for the variable
- In subroute init_fuel_cats, add the variable to namelist /fuel_categories/. The order does note matter.
- Add call wrf_dm_bcast_real or call wrf_dm_bcast_integeras appropriate to communicate the variable to other MPI processes; the file namelist.fire is read only by the master process.
- The description above is for fuel categories. The code for fuel moisture classes is similar.