Difference between revisions of "How to run the standalone fire model in WRF-SFIRE"

From openwfm
Jump to navigation Jump to search
(not working yet)
 
(34 intermediate revisions by the same user not shown)
Line 1: Line 1:
The fire code in WRF-Fire, called SFIRE (for Spread FIRE model), can be used independently without WRF for testing. To make comparison easier, it can run from the same inputs as WRF-Fire.
+
{{users guide}}
 +
 
 +
NOTE: the port of the standalone model to the WRF-SFIRE repository was not finished yet. Please see https://github.com/openwfm/WRF-SFIRE/issues/3 for updates. The instructions below are for the original WRF-Fire from 2011, see ''Works with'' below.
 +
 
 +
The fire code in WRF-Fire, called SFIRE (for Spread FIRE model), can be used independently without WRF, using only one-way atmosphere-fire coupling. WRF needs to run to create the atmospheric forcing first.
  
 
==Step by step instructions==
 
==Step by step instructions==
  
* [[How to run WRF-Fire|Install and build WRF-Fire]], leave the '''NETCDF''' environment variable as set for building WRF-Fire
+
===Building the software===
 +
* [[How to get WRF-Fire|Download and build the coupled WRF fire software]] to create '''wrf.exe''' and leave the '''NETCDF''' environment variable set.
 +
 
 +
* Change to the '''standalone''' directory.
  
* '''cd wrf-fire/standalone'''
+
* Find a suitable '''make.inc.*''' file and soft-link it to '''make.inc''', for example '''ln  -s make.inc.gfortran make.inc''' and type '''make'''
  
* Find a suitable '''make.inc.*''' file and soft-link it to '''make.inc''', for example '''ln  -s make.inc.gfortran make.inc'''
+
===Running the software===
  
* Type '''make''' to create '''fire.exe'''
+
* Navigate to a directory with your example (such as '''WRFV3/test/em_fire/hill'''). Make sure '''namelist.input''' specifies a short  '''history_interval_s''' (these will be the atmosphere states used by the fire model) and set large '''frames_per_outfile''' so that only one '''wrfout''' file is created.
  
* Change to one of the test directories, for example '''cd ../WRFV3/test/em_fire/hill'''
+
* Set up the problem by either '''ideal.exe''' or '''real.exe''' and run '''wrf.exe''' as usual.
  
* Run '''./ideal.exe''' to create the file '''wrfinput_d01'''
+
* Link or rename the created '''wrfout''' file to '''fire_input.nc'''
  
* Run '''./fire.exe'''
+
* Run '''fire.exe''' in the same directory. This will create the file '''fire_output.nc''' with the results.
  
==Interface between WRF and SFIRE==
+
==How it works==
  
* The defined interface to SFIRE is between '''WRFV3/phys/module_fr_sfire_driver_wrf.F''' and subroutine '''sfire_driver_em''' in '''WRFV3/phys/module_fr_sfire_driver.F'''
+
* The standalone model '''fire.exe''' reads the fire model inputs from the '''wrfout''', including interpolated wind fields '''UF''' and '''VF'''. Because the first frame in '''wrfout''' is created before the fire model is called and so those fields are not set yet, the fire model starts from the second frame. The atmosphere fields are interpolated linearly in time between the frames before they are passed to the fire model.
* The arguments of '''sfire_driver_em''' consist of two structures (called derived types in Fortran), '''grid''', which contains all state, input, and output variables, and '''config_flags''', with all variables read from from '''namelist.input''', plus some array dimensions.
+
 
* The standalone code defines its own '''grid''' derived type with only the subset of the fields needed, and replicates '''config_flags''' from WRF.
+
* The file '''fire_output.nc''' has the same format as '''wrfout''' but it contains only the variables that are the fire model outputs and some other fields copied from '''wrfout''', which are needed for visualization and interpreting the results. These include coordinates of the fire nodes in '''FXLONG''' and '''FXLAT''', the time string '''Times''', and the terrain height '''ZSF'''.
* All fields in '''grid''' are set in the standalone driver main file, '''standalone/model_test_main.F''', and nothing is hidden elsewhere.
+
 
* SFIRE is compliant with [http://www.mmm.ucar.edu/wrf/WG2/WRF_conventions.html WRF coding conventions]. WRF divides the horizontal domain into ''patches'' and divides the patches into ''tiles''. Each patch executes in one MPI process. Each tile is updated by one OpenMP thread.
+
* The standalone model build compiles the fire model files from the '''WRFV3/phys''' directory, so if the fire model changes, the standalone model may have to be updated. However, the standalone model does not depend on  WRF directly. The code consists of 3 files:
** The SFIRE standalone code is capable of parallel execution in shared memory. Division into tiles is controlled by fields in '''grid'''. There is only one OpenMP parallel loop over the tiles, in '''WRFV3/phys/module_fr_sfire_driver.F'''. The rest of the SFIRE code executes on a single tile, starting from '''WRFV3/phys/module_fr_sfire_model.F''' Because the tiles need to access values from neighboring tiles at several points in the computation, within a single invocation of SFIRE, the parallel loop is executed several times to synchronize the data in memory at the exit from the loop. Each execution of the parallel loop performs a different stage of the computation.
+
** '''fire.F''' is the standalone model driver
** When SFIRE runs in distributed memory, the communication between the patches is done in includes in '''WRFV3/phys/module_fr_sfire_driver.F''' (search for HALO). This has no effect in the standalone code; in WRF, the includes are provided by the WRF parallel infrastructure, RSL-Lite. If you want to run SFIRE in MPI, you need to provide equivalent HALO includes yourself.
+
** '''wrf_netcdf.F''' reads and writes {{wp|NetCDF|NetCDF}} files compatible with WRF
* The build process in '''standalone''' uses the fire code files from '''WRFV3/phys/module_fr_sfire_*.F''' except '''WRFV3/phys/module_fr_sfire_driver_wrf.F'''. There is no code duplication. Instead of WRF, the fire code is linked with '''.F''' files in the '''standalone''' directory, which provide I/O and substitute the required subset of WRF functionality.
+
** '''wrf_fakes.F''' implements a very limited subset of WRF routines to avoid dependency
 +
 
 +
*The files '''config_assigns.inc''' '''namelist_defaults.inc''' '''namelist_defines2.inc''' '''namelist_defines.inc''' '''namelist_statements.inc''' files are copied from WRF build to maintain compatibility with '''namelist.input''' in WRF. When the WRF registry changes, these files will need to be updated manually from the directory '''WRFV3/inc''' after WRF is built and committed again.
 +
 
 +
==Remarks==
 +
 
 +
* The results of the coupled model and the standalone model will not be identical, even if the coupled model runs the same fire, because the wind fields are interpolated between the frames for the standalone model. But the results should be close.
 +
 
 +
* To simulate different fires in the standalone model, the coupled model should run without ignition.  Then the coupled model will create the fire model inputs, but the atmosphere state will not be disturbed by the fire in the coupled model.
 +
 
 +
* The '''&fire''' section in '''namelist.input''' can change, and the fuel data including '''namelist.fire''' may also change.
 +
 
 +
* At the moment, '''fire.exe''' is serial only.
  
 
==Works with==
 
==Works with==
  
* {{branch|jm2/driver_wrf}} {{WRF-Fire-commit|590405355703c6a0aee9d6500ca4bfd793794c75|Jul 31 2010}}
+
* {{WRF-Fire-branch|jm2/devel}} {{WRF-Fire-commit|168fbfaa8a62061b51999001dc55162e2ac3a798|Oct 28 2011}}
* tested with gfortran 4.4 (gcc44 on Centos 5.5) and 4.3 (on OS X, from [http://www.macports.org/ MacPorts]), but will not compile under gfortran 4.1.2 (which is the default compiler distributed with RHEL5 and [http://www.centos.org Centos 5.5]) because of its lack of support of the Fortran 2003 standard
+
* Tested with gfortran 4.4.4 and pgf90 11.9 on Linux, and gfortran 4.3.3 on OSX (from   [http://www.macports.org/ MacPorts]).
* [http://www.pgroup.com/support/new_rel.htm PGI Fortran] 10.5 and hopefully later
+
 
 +
==See also==
 +
 
 +
* [[SFIRE|Fire model interface and standalone code description]]
 +
* [[SFIRE variables]]
  
 
[[Category:WRF-Fire]]
 
[[Category:WRF-Fire]]
[[Category:Howtos|Standalone fire model in WRF-Fire]]
+
[[Category:Howtos|Run the standalone fire model in WRF-Fire]]

Latest revision as of 22:01, 30 January 2022

Back to the WRF-SFIRE user guide.

NOTE: the port of the standalone model to the WRF-SFIRE repository was not finished yet. Please see https://github.com/openwfm/WRF-SFIRE/issues/3 for updates. The instructions below are for the original WRF-Fire from 2011, see Works with below.

The fire code in WRF-Fire, called SFIRE (for Spread FIRE model), can be used independently without WRF, using only one-way atmosphere-fire coupling. WRF needs to run to create the atmospheric forcing first.

Step by step instructions

Building the software

  • Change to the standalone directory.
  • Find a suitable make.inc.* file and soft-link it to make.inc, for example ln -s make.inc.gfortran make.inc and type make

Running the software

  • Navigate to a directory with your example (such as WRFV3/test/em_fire/hill). Make sure namelist.input specifies a short history_interval_s (these will be the atmosphere states used by the fire model) and set large frames_per_outfile so that only one wrfout file is created.
  • Set up the problem by either ideal.exe or real.exe and run wrf.exe as usual.
  • Link or rename the created wrfout file to fire_input.nc
  • Run fire.exe in the same directory. This will create the file fire_output.nc with the results.

How it works

  • The standalone model fire.exe reads the fire model inputs from the wrfout, including interpolated wind fields UF and VF. Because the first frame in wrfout is created before the fire model is called and so those fields are not set yet, the fire model starts from the second frame. The atmosphere fields are interpolated linearly in time between the frames before they are passed to the fire model.
  • The file fire_output.nc has the same format as wrfout but it contains only the variables that are the fire model outputs and some other fields copied from wrfout, which are needed for visualization and interpreting the results. These include coordinates of the fire nodes in FXLONG and FXLAT, the time string Times, and the terrain height ZSF.
  • The standalone model build compiles the fire model files from the WRFV3/phys directory, so if the fire model changes, the standalone model may have to be updated. However, the standalone model does not depend on WRF directly. The code consists of 3 files:
    • fire.F is the standalone model driver
    • wrf_netcdf.F reads and writes NetCDF files compatible with WRF
    • wrf_fakes.F implements a very limited subset of WRF routines to avoid dependency
  • The files config_assigns.inc namelist_defaults.inc namelist_defines2.inc namelist_defines.inc namelist_statements.inc files are copied from WRF build to maintain compatibility with namelist.input in WRF. When the WRF registry changes, these files will need to be updated manually from the directory WRFV3/inc after WRF is built and committed again.

Remarks

  • The results of the coupled model and the standalone model will not be identical, even if the coupled model runs the same fire, because the wind fields are interpolated between the frames for the standalone model. But the results should be close.
  • To simulate different fires in the standalone model, the coupled model should run without ignition. Then the coupled model will create the fire model inputs, but the atmosphere state will not be disturbed by the fire in the coupled model.
  • The &fire section in namelist.input can change, and the fuel data including namelist.fire may also change.
  • At the moment, fire.exe is serial only.

Works with

See also