6  Physics-Informed Neural Networks

6.1 Introduction

Physics-Informed Neural Networks (PINNs) are a class of neural networks that incorporate physical laws directly into their learning process. Rather than learning purely from data, PINNs embed governing equations (like the level set PDE) into the loss function, ensuring predictions respect known physics.

For wildfire modeling, PINNs offer a promising approach to solving the level set equation while naturally handling the complex, spatially-varying fire spread rates from the Rothermel model.

6.2 Notation Guide

Before diving into the mathematics, here’s a guide to the notation used throughout this page:

6.2.1 Coordinates and Variables

Symbol Meaning
\(t\) Time (seconds or minutes)
\(x, y\) Spatial coordinates (meters or degrees)
\((x, y)\) A point in 2D space
\((t, x, y)\) A point in space-time

6.2.2 Level Set Function

Symbol Meaning
\(\psi\) or \(\Psi\) The level set function — a scalar field whose zero contour (\(\psi = 0\)) represents the fire front
\(\psi(t, x, y)\) Value of the level set at position \((x, y)\) and time \(t\)
\(\psi < 0\) Region that has burned (inside the fire)
\(\psi > 0\) Region that has not burned (outside the fire)
\(\psi = 0\) The fire front (perimeter)
\(\psi_0(x, y)\) Initial condition — the level set function at \(t = 0\)
\(\psi_\theta\) Level set function approximated by a neural network with parameters \(\theta\)

6.2.3 Derivatives and Gradients

Symbol Meaning
\(\frac{\partial \psi}{\partial t}\) Partial derivative of \(\psi\) with respect to time — how fast \(\psi\) changes at a fixed point
\(\frac{\partial \psi}{\partial x}\) Partial derivative with respect to \(x\)
\(\nabla \psi\) Gradient of \(\psi\): the vector \(\left(\frac{\partial \psi}{\partial x}, \frac{\partial \psi}{\partial y}\right)\) pointing in the direction of steepest increase
\(\|\nabla \psi\|\) Gradient magnitude: \(\sqrt{\left(\frac{\partial \psi}{\partial x}\right)^2 + \left(\frac{\partial \psi}{\partial y}\right)^2}\)
\(\frac{\partial \psi}{\partial n}\) Normal derivative — derivative in the direction perpendicular to a boundary
TipUnderstanding the Gradient

The gradient \(\nabla \psi\) points perpendicular to the fire front (from burned toward unburned). Its magnitude \(|\nabla \psi|\) indicates how sharply the level set function changes — ideally \(|\nabla \psi| = 1\) for a signed distance function.

6.2.4 Fire Spread

Symbol Meaning
\(S\) Spread rate — speed at which the fire front advances (m/s or m/min)
\(S(x, y, t)\) Spread rate at position \((x, y)\) and time \(t\) (varies with wind, terrain, fuel)
\(R_0\) Base spread rate — fire spread with no wind or slope (from Rothermel model)
\(\phi_w\) Wind factor — dimensionless multiplier for wind’s effect on spread rate
\(\phi_s\) Slope factor — dimensionless multiplier for terrain slope’s effect

6.2.5 Neural Network and Loss

Symbol Meaning
\(\theta\) Neural network parameters (all weights and biases)
\(\text{NN}_\theta\) Neural network function parameterized by \(\theta\)
\(\mathcal{L}\) Loss function — quantity minimized during training
\(\mathcal{L}_{\text{PDE}}\) Physics loss — penalizes violation of the level set equation
\(\mathcal{L}_{\text{IC}}\) Initial condition loss — penalizes deviation from initial fire shape
\(\mathcal{L}_{\text{BC}}\) Boundary condition loss — penalizes violation at domain edges
\(\lambda\) Weighting hyperparameter — controls relative importance of loss terms
\(N\) Number of sample points (e.g., \(N_{\text{PDE}}\) = number of collocation points)

6.2.6 Summation Notation

The expression:

\[\frac{1}{N} \sum_{i=1}^{N} |f_i|^2\]

means: “Take \(N\) samples, compute \(|f|^2\) for each, sum them up, and divide by \(N\).” This gives the mean squared error over the samples.

6.2.7 The Level Set Equation

The governing PDE is:

\[\frac{\partial \psi}{\partial t} + S \cdot |\nabla \psi| = 0\]

Reading this term by term:

  • \(\frac{\partial \psi}{\partial t}\): How fast the level set value changes at a fixed point
  • \(S\): The fire spread rate (from Rothermel)
  • \(|\nabla \psi|\): The gradient magnitude
  • \(= 0\): The equation must balance (this is the constraint the PINN learns to satisfy)

Physical interpretation: As the fire front advances with speed \(S\), the level set function adjusts so that the zero contour moves accordingly.

6.3 The Core Idea

Traditional neural networks learn mappings from inputs to outputs purely from labeled data:

\[\text{Neural Network: } (t, x, y) \mapsto \hat{\psi}(t, x, y)\]

PINNs extend this by adding a physics constraint: the network’s output must satisfy the governing PDE. This is achieved by adding the PDE residual to the loss function.

NotePINN Advantage

PINNs can learn from sparse or noisy observational data while still respecting known physical laws, making them ideal for scenarios where complete ground truth is unavailable.

6.4 Mathematical Formulation

6.4.1 Network Architecture

A PINN for the level set method takes spatiotemporal coordinates as input and outputs the level set function:

\[\text{NN}_\theta: (t, x, y) \rightarrow \psi_\theta(t, x, y)\]

where \(\theta\) represents the network parameters (weights and biases).

6.4.2 Composite Loss Function

The PINN minimizes a composite loss with three components:

\[\mathcal{L}(\theta) = \mathcal{L}_{\text{PDE}} + \lambda_{\text{IC}} \mathcal{L}_{\text{IC}} + \lambda_{\text{BC}} \mathcal{L}_{\text{BC}}\]

where:

  • \(\mathcal{L}_{\text{PDE}}\) enforces the level set equation
  • \(\mathcal{L}_{\text{IC}}\) enforces initial conditions
  • \(\mathcal{L}_{\text{BC}}\) enforces boundary conditions
  • \(\lambda\) terms are weighting hyperparameters

6.4.3 Physics Loss (PDE Residual)

The level set equation states:

\[\frac{\partial \psi}{\partial t} + S \cdot |\nabla \psi| = 0\]

The physics loss penalizes violations of this equation at collocation points \((t_i, x_i, y_i)\) sampled throughout the domain:

\[\mathcal{L}_{\text{PDE}} = \frac{1}{N_{\text{PDE}}} \sum_{i=1}^{N_{\text{PDE}}} \left| \frac{\partial \psi_\theta}{\partial t} + S_i \cdot |\nabla \psi_\theta| \right|^2\]

The key insight is that automatic differentiation computes the required derivatives \(\frac{\partial \psi_\theta}{\partial t}\), \(\frac{\partial \psi_\theta}{\partial x}\), and \(\frac{\partial \psi_\theta}{\partial y}\) exactly through the neural network.

6.4.4 Initial Condition Loss

The initial fire perimeter must be encoded:

\[\mathcal{L}_{\text{IC}} = \frac{1}{N_{\text{IC}}} \sum_{i=1}^{N_{\text{IC}}} \left| \psi_\theta(0, x_i, y_i) - \psi_0(x_i, y_i) \right|^2\]

For a circular ignition at \((x_0, y_0)\) with radius \(r\):

\[\psi_0(x, y) = \sqrt{(x - x_0)^2 + (y - y_0)^2} - r\]

6.4.5 Boundary Condition Loss

Neumann (zero-flux) boundary conditions ensure natural fire propagation at domain edges:

\[\mathcal{L}_{\text{BC}} = \frac{1}{N_{\text{BC}}} \sum_{i=1}^{N_{\text{BC}}} \left| \frac{\partial \psi_\theta}{\partial n} \right|^2\]

6.5 Incorporating Rothermel Physics

The fire spread rate \(S(x, y, t)\) in the level set equation comes from the Rothermel model. In a PINN framework, this physics is embedded directly in the loss computation.

6.5.1 Rothermel Model Notation

The Rothermel model uses several fuel and environmental parameters:

Symbol Name Meaning
\(\sigma\) Surface area-to-volume ratio How finely divided the fuel is (1/ft) — higher means faster ignition
\(\delta\) Fuel bed depth Height of the fuel layer (ft)
\(w_0\) Oven-dry fuel load Mass of fuel per unit area (lb/ft²)
\(M_f\) Fuel moisture content Water content as fraction of dry weight (e.g., 0.05 = 5%)
\(M_x\) Moisture of extinction Moisture level above which fire won’t spread
\(\rho_p\) Particle density Density of fuel particles (lb/ft³)
\(h\) Heat content Energy released per unit mass (BTU/lb)
\(\beta\) Packing ratio Fraction of fuel bed volume occupied by fuel
\(I_R\) Reaction intensity Heat release rate per unit area (BTU/ft²/min)

The final spread rate combines these into:

\[S = R_0 \cdot (1 + \phi_w + \phi_s)\]

where \(R_0\) depends on fuel properties, \(\phi_w\) accounts for wind pushing the fire, and \(\phi_s\) accounts for fire spreading faster uphill.

6.5.2 Differentiable Fire Spread

The spread rate calculation must be fully differentiable for gradient-based optimization:

function fire_spread_rate(x, y, Ψ_grad_x, Ψ_grad_y, t,
                         wind_fn, terrain_slope_fn, fuel_fn)
    # Get spatially-varying inputs
    fuel = fuel_fn(x, y)
    wind_x, wind_y = wind_fn(x, y, t)
    slope_x, slope_y = terrain_slope_fn(x, y)

    # Compute fire front normal direction
    gn = sqrt(Ψ_grad_x^2 + Ψ_grad_y^2)
    n_x, n_y = Ψ_grad_x / gn, Ψ_grad_y / gn

    # Rothermel base spread rate R₀
    R0 = rothermel_base_rate(fuel)

    # Wind factor (directional)
    U = abs(wind_x * n_x + wind_y * n_y)
    ϕw = wind_factor(U, fuel)

    # Slope factor (directional)
    tanϕ = slope_x * n_x + slope_y * n_y
    ϕs = slope_factor(tanϕ, fuel)

    return R0 * (1 + ϕw + ϕs)
end

6.5.3 Symbolic PDE Definition

Using Julia’s ModelingToolkit.jl, the level set equation can be defined symbolically:

using ModelingToolkit

@parameters t x y
@variables Ψ(..)

Dt = Differential(t)
Dx = Differential(x)
Dy = Differential(y)

# Gradient magnitude
grad_mag = sqrt(Dx(Ψ(t,x,y))^2 + Dy(Ψ(t,x,y))^2)

# Fire spread rate (registered as differentiable function)
S = fire_spread_rate(x, y, Dx(Ψ(t,x,y)), Dy(Ψ(t,x,y)), t,
                     wind_fn, slope_fn, fuel_fn)

# Level set PDE
equation = Dt(Ψ(t,x,y)) + S * grad_mag ~ 0

6.6 Training Process

6.6.1 Collocation Point Sampling

PINNs require sampling points throughout the domain:

Point Type Location Purpose
Interior Random \((t, x, y)\) in domain Enforce PDE
Initial \(t = 0\), random \((x, y)\) Enforce IC
Boundary Domain edges Enforce BC

6.6.2 Optimization

Training proceeds via gradient descent on the composite loss:

  1. Forward pass: Evaluate \(\psi_\theta\) at collocation points
  2. Compute derivatives: Automatic differentiation for \(\partial\psi/\partial t\), \(\nabla\psi\)
  3. Evaluate losses: PDE residual, IC error, BC error
  4. Backward pass: Compute gradients \(\nabla_\theta \mathcal{L}\)
  5. Update: Adjust network parameters

6.6.3 Training Dynamics

PINN training typically shows distinct phases:

  • Phase 1 (Early): Rapid loss decrease as network learns gross behavior
  • Phase 2 (Middle): Oscillations as network balances competing loss terms
  • Phase 3 (Late): Gradual convergence with fine-tuning of gradients

6.7 Advantages for Wildfire Modeling

6.7.1 1. Mesh-Free Computation

Unlike finite difference methods that require a fixed grid, PINNs can evaluate \(\psi\) at arbitrary points. This enables:

  • Adaptive resolution near the fire front
  • Easy handling of irregular domains
  • No explicit grid storage

6.7.2 2. Natural Handling of Spatiotemporal Variability

Wind, fuel, and terrain vary across space and time. PINNs naturally incorporate these variations through the physics loss without special discretization schemes.

6.7.3 3. Data Assimilation

PINNs can incorporate observational data (e.g., satellite fire detections) alongside physics:

\[\mathcal{L} = \mathcal{L}_{\text{PDE}} + \mathcal{L}_{\text{IC}} + \mathcal{L}_{\text{BC}} + \lambda_{\text{data}} \mathcal{L}_{\text{data}}\]

where \(\mathcal{L}_{\text{data}}\) penalizes deviation from observed fire perimeters.

6.7.4 4. Uncertainty Quantification

Bayesian extensions of PINNs can provide uncertainty estimates, crucial for operational fire prediction where input data (wind forecasts, fuel moisture) are uncertain.

6.8 Limitations and Challenges

6.8.1 Training Difficulty

PINNs can be challenging to train due to:

  • Competing loss terms: PDE, IC, and BC losses may conflict
  • Gradient imbalance: Different loss components have different gradient magnitudes
  • Hyperparameter sensitivity: Loss weights \(\lambda\) require careful tuning

6.8.2 Topological Changes

The level set method handles merging fire fronts automatically, but PINNs may struggle with:

  • Sharp gradients near fronts
  • Discontinuities in the spread rate

6.8.3 Computational Cost

While PINNs avoid grid storage, training requires many forward/backward passes. For simple domains, traditional methods (Method of Lines) may be faster.

6.9 Comparison with Traditional Methods

Aspect Finite Difference PINN
Grid Required Optional
Stability CFL condition Learned
Data integration Difficult Natural
Uncertainty Not built-in Extensions exist
Training None Required
Evaluation Grid points Anywhere

6.10 Julia Implementation: WildfireModels.jl

The WildfireModels.jl package by Jordan Clugston provides a complete PINN-based fire spread modeling framework. This package demonstrates how to combine the Rothermel fire behavior model with Physics-Informed Neural Networks to solve the level set equation for wildfire propagation.

6.10.1 Package Architecture

WildfireModels.jl leverages the Julia scientific machine learning ecosystem:

  • ModelingToolkit.jl: Symbolic definition of the level set PDE
  • NeuralPDE.jl: PINN solver framework that embeds physics into neural network training
  • Lux.jl: Neural network architecture for the PINN
  • MethodOfLines.jl: Traditional finite difference discretization (for comparison/validation)

6.10.2 How the PINN Works in WildfireModels.jl

6.10.2.1 1. Level Set PDE Definition

The core of the package is the level_set_equation() function, which constructs the governing PDE symbolically:

\[\frac{\partial \Psi}{\partial t} + S(x, y, t) \cdot |\nabla \Psi| = 0\]

This function returns the symbolic differential operators (Dt, Dx, Dy) and the equation itself, which NeuralPDE.jl uses to formulate the physics loss.

6.10.2.2 2. Fire Spread Rate from Rothermel

The fire_spread_rate() function computes \(S(x, y, t)\) using Rothermel’s 1972 empirical model. The calculation proceeds as:

  1. Extract fuel properties: Surface area-to-volume ratio (\(\sigma\)), moisture content, fuel load
  2. Compute intermediate quantities: Packing ratio (\(\beta\)), reaction intensity (\(I_R\)), base spread rate (\(R_0\))
  3. Wind-normal interaction: Project wind velocity onto the fire front normal direction
  4. Apply environmental corrections: Wind factor (\(\phi_w\)) and slope factor (\(\phi_s\))
  5. Final rate: \(S = R_0 \cdot (1 + \phi_w + \phi_s)\)

The key insight is that the spread rate depends on the direction of fire propagation (via \(\nabla\Psi\)), not just position—this creates a coupling between the neural network output and the physics.

6.10.2.3 3. User-Defined Environment Functions

WildfireModels.jl allows users to define custom environmental inputs as functions:

# Wind field: returns (u, v) velocity components
wind(x, y, t) = (50.0, 50.0)  # Constant 50 m/min wind

# Terrain slope: returns (∂z/∂x, ∂z/∂y)
terrain_slope(x, y) = (0.0, 0.0)  # Flat terrain

# Fuel properties: returns named tuple of fuel model parameters
fuel_props(x, y) = get_fuel_properties(x, y)

These functions are called during both training and evaluation, enabling spatially and temporally varying inputs without redefining the PDE.

6.10.2.4 4. PINN Training with NeuralPDE.jl

The package uses NeuralPDE.jl to train a neural network that satisfies:

  1. Physics loss: The level set equation residual at collocation points
  2. Initial condition loss: Match the initial fire perimeter (\(\Psi_0\))
  3. Boundary condition loss: Zero-flux conditions at domain edges
# Construct the PDE system
pde = level_set_equation(wind, terrain_slope, fuel_props)

# NeuralPDE discretizes and trains the PINN
# The neural network learns Ψ(t, x, y) that satisfies all constraints

6.10.3 Example Workflow

using WildfireModels

# 1. Define environmental inputs
wind_fn(x, y, t) = (5.0, 5.0)  # Constant wind
slope_fn(x, y) = (0.0, 0.0)    # Flat terrain
fuel_fn = make_fuel_properties_fn(FUEL_MODELS[1]; Mf=0.05)

# 2. Define initial fire (50m radius circle)
Ψ0(x, y) = sqrt((x - 500)^2 + (y - 500)^2) - 50

# 3. Create PDE system
@named pdesys = LevelSetPDESystem(
    wind_fn = wind_fn,
    terrain_slope_fn = slope_fn,
    fuel_properties_fn = fuel_fn,
    x_domain = (0.0, 1000.0),
    y_domain = (0.0, 1000.0),
    t_domain = (0.0, 60.0),
    Ψ0 = Ψ0
)

# 4. Train the PINN (uses NeuralPDE.jl internally)
# 5. Evaluate Ψ at any (t, x, y) to track fire front (Ψ = 0)

6.10.4 Key Advantages of the WildfireModels.jl Approach

  1. Modular physics: Rothermel model is cleanly separated from the PDE solver
  2. Flexible inputs: Wind, terrain, and fuel can be arbitrary functions
  3. Mesh-free: No grid storage required; evaluate \(\Psi\) anywhere
  4. Differentiable: Entire pipeline supports automatic differentiation
  5. Comparison ready: MethodOfLines.jl support enables validation against traditional methods

6.11 References

  • Raissi, M., Perdikaris, P., & Karniadakis, G. E. (2019). Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378, 686-707.
  • Karniadakis, G. E., et al. (2021). Physics-informed machine learning. Nature Reviews Physics, 3(6), 422-440.
  • Rothermel, R. C. (1972). A mathematical model for predicting fire spread in wildland fuels. USDA Forest Service Research Paper INT-115.