Skip to content

Commit 6b77082

Browse files
committed
Merge branch 'dev'
2 parents b80a783 + c61aa61 commit 6b77082

11 files changed

Lines changed: 183 additions & 20 deletions

File tree

.github/workflows/docker.yml

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,58 @@
1-
name: Docker
1+
name: Build, Test, and Push Docker Image
22

33
on:
44
push:
5-
branches:
6-
- "master"
7-
# - "dev-ci"
5+
branches: [ "master" ]
6+
tags: [ 'v*.*.*' ] # Trigger on semver tags
87
pull_request:
98
branches: [ "master" ]
10-
119
workflow_dispatch:
1210

13-
jobs:
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
1414

15-
docker:
15+
jobs:
16+
build-test-and-push:
1617
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
1722
steps:
1823
- name: Checkout repository
1924
uses: actions/checkout@v4
25+
with:
26+
lfs: true
27+
28+
- name: Log in to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
2034

21-
- name: Set up Docker Buildx
22-
uses: docker/setup-buildx-action@v3
35+
- name: Extract Docker metadata
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
tags: |
41+
type=semver,pattern={{version}}
2342
24-
- name: Build Docker Image
25-
run: docker build -t forefire:latest .
43+
- name: Build and push Docker image
44+
id: build-and-push
45+
uses: docker/build-push-action@v5
46+
with:
47+
context: .
48+
# Only push if the ref starts with 'refs/tags/'
49+
push: ${{ startsWith(github.ref, 'refs/tags/') }}
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}
52+
load: true
2653

27-
- name: Check ForeFire version inside Docker
54+
- name: Run 'runff' Test Script on the built image
2855
run: |
29-
docker run --rm forefire:latest forefire -v
56+
TEST_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n 1)
57+
echo "Testing image with tag: $TEST_TAG"
58+
docker run --rm $TEST_TAG bash -c "cd tests/runff && bash ff-run.bash"

.github/workflows/macos.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ jobs:
1313
runs-on: macos-latest
1414
steps:
1515
- name: Checkout repository
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
17+
with:
18+
lfs: true
1719

1820
- name: Make install script executable
1921
run: chmod +x ./install-forefire-osx.sh
@@ -23,3 +25,18 @@ jobs:
2325

2426
- name: Check ForeFire version
2527
run: ./bin/forefire -v
28+
29+
- name: Install Python test dependencies
30+
run: pip3 install --break-system-packages lxml xarray netCDF4
31+
32+
- name: Add Build/Runtime Diagnostics
33+
run: |
34+
echo "--- Input data.nc Info ---"
35+
ls -lh tests/runff/data.nc
36+
brew install netcdf
37+
ncdump -k tests/runff/data.nc || echo "Could not check data.nc format"
38+
39+
- name: Run 'runff' Test Script
40+
run: |
41+
cd tests/runff
42+
bash ff-run.bash

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ RUN apt-get update && \
1212
git && \
1313
rm -rf /var/lib/apt/lists/*
1414

15+
# Install Python dependencies for testing
16+
RUN pip3 install --no-cache-dir lxml xarray netCDF4
17+
1518
WORKDIR /forefire
1619
ENV FOREFIREHOME=/forefire
1720

@@ -24,7 +27,7 @@ RUN sh cmake-build.sh
2427
# Add the main forefire executable to the PATH
2528
RUN cp /forefire/bin/forefire /usr/local/bin/
2629

27-
# Use pip to install the Python dependencies defined in pyproject.toml
30+
# Use pip to install the Python bindings
2831
RUN pip3 install ./bindings/python
2932

3033
# Set the entrypoint to bash for interactive sessions

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Welcome to the official documentation for ForeFire — the open-source wildfire
2222
:caption: User Guide
2323

2424
user_guide/basic_configuration
25-
user_guide/fuels_file
25+
user_guide/fuels_and_models
2626
user_guide/landscape_file
2727
user_guide/forefire_script
2828
user_guide/core_concepts

docs/source/reference/parameters.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,13 @@ Physics & Models
171171

172172
propagationModel
173173
""""""""""""""""
174-
* **Description:** Name of the primary Rate of Spread (ROS) model to use for calculating fire spread speed (e.g., `Iso`, `Rothermel`, `Balbi`). Specific models may have their own parameters (e.g., `Iso.speed`).
174+
* **Description:** Name of the Rate of Spread (ROS) model to use. ForeFire is a general solver, and this choice dictates how spread speed is calculated and what fuel parameterization is required.
175175
* **Default:** `Iso`
176+
* **Available Models:** The string provided must match the name of a registered C++ model class. Common supported models include:
177+
* `Iso`: A simple isotropic model. Does not use a fuels file. Speed is set via the `Iso.speed` parameter.
178+
* `Rothermel`: The Rothermel 1972 surface fire spread model. Requires a detailed fuel parameterization file.
179+
* `BalbiNov2011`, `Balbi2015`: Physical models from Balbi et al. Also use the fuel parameterization file.
180+
* **More Info:** See the :doc:`/user_guide/fuels_and_models` guide for detailed explanations of each model and their data requirements.
176181

177182
burningTresholdFlux
178183
"""""""""""""""""""

docs/source/user_guide/basic_configuration.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@ Basic Configuration
33

44
ForeFire simulations typically require three main input files to run:
55

6-
1. **Fuels File (.csv)**: Defines the classes of fuels and their associated parameters used by the fire spread model (e.g., Rothermel).
7-
2. **Landscape File (.nc)**: A NetCDF file containing geospatial data layers for the simulation domain, typically including:
6+
1. **Model Parameter File (e.g., fuels.csv)**:
7+
8+
A file that defines physical parameters required by the selected propagation model. For example, the `Rothermel` and `Balbi` models use a ``fuels.csv`` file to define fuel bed properties. Other models, like `Iso`, do not require an external file. See the :doc:`Fuels & Models guide <fuels_and_models>` for details.
9+
2. **Landscape File (.nc)**:
10+
11+
A NetCDF file containing geospatial data layers for the simulation domain, typically including:
812

913
- Elevation (Digital Elevation Model - DEM)
1014
- Fuel types map (matching the indices in the Fuels File)
1115
- (Optionally) Pre-defined wind fields or other environmental data.
12-
3. **ForeFire Script File (.ff)**: A text file containing commands and parameters that control the simulation execution. This includes:
16+
17+
3. **ForeFire Script File (.ff)**:
18+
19+
A text file containing commands and parameters that control the simulation execution. This includes:
1320

1421
- Setting simulation parameters (e.g., propagation model, output format).
1522
- Loading the landscape and fuels data.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
.. _userguide-fuels-and-models:
2+
3+
Fuel & Model Parameterization
4+
=============================
5+
6+
A core feature of ForeFire is its flexibility as a **general Rate of Spread (ROS) model solver**. Rather than being tied to a single fire spread equation, it can use different physical or empirical models depending on the user's needs. This is controlled via the :ref:`propagationModel <param-propagationModel>` parameter.
7+
8+
.. note::
9+
**For New Users:** The most common use case for ForeFire is simulating surface wildfires using the standard **Rothermel** model. This model **requires a ``fuels.csv`` file**. If this is your goal, you can skip directly to the section :ref:`The Rothermel / Balbi Fuel File <rothermel-fuel-file>` to learn how to prepare this critical input.
10+
11+
The choice of propagation model is critical because it dictates what physical parameters the simulation requires. This guide explains the available models and how to provide the necessary parameterization for each.
12+
13+
Available Propagation Models
14+
----------------------------
15+
16+
ForeFire includes several built-in propagation models. Below are the primary models intended for general use. For a complete list of all implemented models, including experimental ones, users can refer to the C++ source code.
17+
18+
**Iso**
19+
^^^^^^^
20+
* **Description:** A simple isotropic model where the fire spreads at a constant rate in all directions. It ignores all environmental factors except for blocking terrain.
21+
* **Use Case:** Ideal for simple tests, debugging setups, or scenarios where a constant spread rate is desired.
22+
* **Parameterization:** This model **does not** use an external fuels file. The spread speed is set directly in the simulation script via a model-specific parameter.
23+
* **Example:**
24+
25+
.. code-block:: bash
26+
27+
setParameter[propagationModel=Iso]
28+
setParameter[Iso.speed=0.5] # Sets spread to 0.5 meters/second
29+
30+
**Rothermel**
31+
^^^^^^^^^^^^^
32+
* **Description:** Implements the Rothermel (1972) surface fire spread model, a widely used semi-empirical model in wildfire simulation.
33+
* **Use Case:** The standard choice for simulating surface fire spread in various fuel types (grass, shrub, timber litter).
34+
* **Parameterization:** This model requires a detailed set of fuel bed parameters. These are provided via a **CSV file**, the format of which is detailed in the section below.
35+
36+
**Balbi** variants (e.g., `BalbiNov2011`, `Balbi2015`)
37+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38+
* **Description:** Implements physical models based on the work of Balbi et al. These models take a different approach from Rothermel, often considering factors like flame geometry and radiative heat transfer more explicitly.
39+
* **Use Case:** Primarily for research applications, model comparison studies, or scenarios where a more physics-based approach is preferred.
40+
* **Parameterization:** These models also source their parameters from the same CSV fuel file format used by Rothermel, though they may use a different subset of the columns for their calculations.
41+
42+
.. note::
43+
The relationship between a model and its parameters is key: when a model like `Rothermel` is selected, it informs the simulation engine which properties it needs (e.g., `slope`, `normalWind`, `fuel.Rhod`, etc.). The engine then provides these values, retrieving the `fuel.*` properties from the loaded CSV table.
44+
45+
----
46+
47+
.. _rothermel-fuel-file:
48+
49+
The Rothermel / Balbi Fuel File (`fuels.csv`)
50+
-----------------------------------------------
51+
52+
When a `propagationModel` like `Rothermel` or a `Balbi` variant is selected, ForeFire needs a file that defines the physical characteristics of the fuel types present in the landscape.
53+
54+
**File Format**
55+
56+
* **Format:** Comma Separated Value (CSV).
57+
* **Delimiter:** The parser expects a **semicolon (`;`)** as the delimiter.
58+
* **Header:** The first line *must* be a header row containing the exact column names specified below. The file parser requires all columns to be present, even if a specific model does not use all of them.
59+
60+
**Required Columns**
61+
62+
The ``Index`` column links these properties to the integer values in the landscape file's fuel layer.
63+
64+
* ``Index``: **Critical.** Unique non-negative integer for the fuel type (e.g., `0` for non-burnable).
65+
* ``Rhod``: Oven-dry particle density (kg/m³).
66+
* ``Rhol``: (Model Specific)
67+
* ``Md``: Oven-dry fuel moisture content (dimensionless ratio, e.g., 0.1 for 10%).
68+
* ``Ml``: (Model Specific)
69+
* ``sd``: Surface-area-to-volume ratio of dry fuel (m²/m³).
70+
* ``sl``: (Model Specific)
71+
* ``e``: Fuel bed depth (meters).
72+
* ``Sigmad``: Oven-dry fuel load (kg/m²).
73+
* ``Sigmal``: (Model Specific)
74+
* ``stoch``: (Model Specific)
75+
* ``RhoA``: (Model Specific)
76+
* ``Ta``: (Model Specific)
77+
* ``Tau0``: (Model Specific)
78+
* ``Deltah``: (Model Specific)
79+
* ``DeltaH``: Fuel particle heat content (J/kg).
80+
* ``Cp``: (Model Specific)
81+
* ``Cpa``: (Model Specific)
82+
* ``Ti``: (Model Specific)
83+
* ``X0``: (Model Specific)
84+
* ``r00``: (Model Specific)
85+
* ``Blai``: (Model Specific)
86+
* ``me``: Moisture content of extinction (dimensionless ratio).
87+
88+
.. important::
89+
While all columns are required by the file parser, the parameters most fundamentally driving the *Rothermel* calculation are typically: ``Index``, ``Rhod``, ``Md``, ``sd``, ``e``, ``Sigmad``, ``DeltaH``, and ``me``. Different models may utilize different columns.
90+
91+
----
92+
93+
Finding and Creating Fuel Parameter Sets
94+
----------------------------------------
95+
96+
Finding appropriate fuel parameter values is a scientific task in itself. Users have two primary resources:
97+
98+
1. **Reference Examples:** The test cases within the ForeFire repository (e.g., `tests/runff/fuels.csv`) provide the best and intended reference for a correctly formatted file.
99+
2. **External Parameter Libraries:** For users looking for standard or pre-published fuel parameter sets, the following external repository, maintained by the ForeFire team, is the recommended resource:
100+
101+
* **wildfire_ROS_models:** `https://github.com/forefireAPI/wildfire_ROS_models`
102+
* This repository contains parameterizations for various fuel models and is a valuable companion to ForeFire for preparing simulation inputs.

0 commit comments

Comments
 (0)