Skip to content

Add configurable spread neighborhood radius (SpreadRad)#232

Open
DLWoodruff wants to merge 1 commit into
fire2a:mainfrom
DLWoodruff:feature/spread-radius
Open

Add configurable spread neighborhood radius (SpreadRad)#232
DLWoodruff wants to merge 1 commit into
fire2a:mainfrom
DLWoodruff:feature/spread-radius

Conversation

@DLWoodruff

@DLWoodruff DLWoodruff commented Jun 26, 2026

Copy link
Copy Markdown

Summary

Adds a --SpreadRad option that controls how far a burning cell can send spread messages in one neighborhood-layer definition. This ports the SpreadRad feature already merged in cell2fire/Cell2Fire#136 and proposed in fire2a/C2FK#3, adapted to C2F-W's code.

  • --SpreadRad 1 (default): immediate neighborhood — identical to current behavior
  • --SpreadRad 2: one extra ring; in general (2n+1)² − 1 candidate neighbors for radius n

The model keeps the original assumption that outgoing spread from a source cell i uses the ROS computed at source cell i for all candidate destinations.

Implementation notes

adjacentCells() takes a radius and returns the in-bounds neighbor box. Because a radius > 1 makes several neighbors share the same integer bearing, the old angle-keyed bookkeeping had to change:

  • ROSAngleDir, angleDict, fireProgress, distToCenter are now keyed by neighbor id (previously some were keyed by integer angle).
  • the angleToNb map is removed; a new selectHeadCell(windAzimuth) picks the neighbor closest to the wind azimuth for the slope calculation (replacing angleToNb[waz]).
  • the cleaning step in Cell2Fire.cpp removes a burnt cell from each neighbor's maps by cell id.

initializeFireFields() and adjacentCells() gain the radius parameter; --SpreadRad is parsed in ReadArgs (default 1, clamped to ≥ 1) and echoed in the run output.

Verification

Built with g++ (c++14) and run on test/model/kitral-asc (--sim K, seed 123):

  • --SpreadRad 1 reproduces the pre-change binary's burned-cell counts exactly (e.g. 2,18,21,8,9,…), so the default path is unchanged.
  • --SpreadRad 2 spreads further (total burned ~403 → ~748 over 30 sims on the kitral instance).
  • Adds test/spreadrad_test.sh (asserts default == --SpreadRad 1, that --SpreadRad 2 is reported, and that radius 2 burns ≥ radius 1) and wires it into build-debian.yml. The script passes locally.

I have not looked at the effect on any high-wind fires, which someone should do before you merge this.

🤖 Generated with Claude Code

Port of the SpreadRad feature from cell2fire/Cell2Fire#136 and
fire2a/C2FK#3, adapted to C2F-W.

A new --SpreadRad option controls how far a burning cell can send spread
messages: 1 (default) is the legacy immediate neighborhood; n includes
(2n+1)^2 - 1 candidate neighbors. adjacentCells() takes a radius and
returns the box of in-bounds neighbors.

Because a radius greater than 1 makes several neighbors share an integer
bearing, the per-cell spread bookkeeping (ROSAngleDir, angleDict,
fireProgress, distToCenter) is rekeyed from angle to neighbor id, the
angleToNb map is removed, and a new selectHeadCell() picks the neighbor
closest to the wind azimuth for the slope calculation. The cleaning step
in Cell2Fire.cpp erases the burnt cell from each neighbor's maps by id.

SpreadRad 1 reproduces legacy results exactly; SpreadRad >= 2 spreads
further. Adds test/spreadrad_test.sh and a CI step in build-debian.yml.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DLWoodruff DLWoodruff marked this pull request as ready for review June 26, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant