Skip to content

fix(core): a front reaching the domain edge no longer floods the arrival map (#233) - #240

Merged
filippi merged 1 commit into
forefireAPI:devfrom
HugoFara:fix/edge-flood
Oct 31, 2026
Merged

filippi merged 1 commit into
forefireAPI:devfrom
HugoFara:fix/edge-flood

Conversation

@HugoFara

Copy link
Copy Markdown
Collaborator

Fixes #233. The flood came from NaN positions reaching the burning scan: a NaN bounding box makes it cover the whole grid, and a two-vertex retracting polygon marks every cell as burnt. Missing data produced the NaN in four places:

  • Data layers (NCXYZTDataLayer.h): values sit at cell centres, and since 6b5f6e1, bilinear lookups return NaN past the outermost centres. That covers half a cell inside every domain edge, so a quarter of a 2×2 wind layer has no wind. Inside the layer, that band now holds the edge cells; outside the layer, lookups still return NaN.
  • Slope (GradientDataLayer.h): a node at the edge looks one step ahead, out of the domain. When nothing is there, it now looks one step behind.
  • Nodes (FireNode.cpp): a NaN spread rate gave a NaN velocity, which neighbours then used. A NaN rate now means no spread.
  • Farsite: a non-burnable cell (no fuel load) gave 0/0. It now returns 0, as Rothermel and Balbi do. This changes Farsite results: before, a single non-burnable pixel stopped a node for good.

Also: singlePolygonAreaBurningScan had / for + in its Y bound.

Tests: 4 new unit cases: edge band, outside the layer, Farsite with no fuel, and a front run into the edge over a gridded altitude. Without the fix, the edge run segfaults and the others fail, except "outside the layer", which is unchanged on purpose. Unit tests: 55/55. ctest: 12/12. Moisture invariants hold. On the Mineral repro, the front reaches the east edge, stops there, and the rest keeps spreading to 60 h with no flood.

Drafted with Claude Opus 5.5.

…val map (forefireAPI#233)

Missing data turned into NaN node positions, and a NaN bounding box made
the burning scan cover the whole map:

- data layers returned NaN between the domain edge and the outermost cell
  centres; they now hold the edge cells there (still NaN outside the layer);
- the slope ahead of a node past the edge was NaN; it is now taken behind;
- a NaN spread rate now stops the node instead of giving it a NaN velocity;
- Farsite returned 0/0 on non-burnable cells; it now returns 0.

Also fixes the Y bound of singlePolygonAreaBurningScan (/ for +).
@HugoFara HugoFara added the bug Confirmed incorrect behavior label Oct 30, 2026

@filippi filippi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was big bug, thanks

@filippi
filippi merged commit 7d37e2c into forefireAPI:dev Oct 31, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Confirmed incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants