Fire Simulator¶
The embrs.fire_simulator package contains the core runtime components of EMBRS. FireSim drives the main simulation loop — advancing time steps, propagating fire, and coordinating weather, logging, and visualization. Cell represents a single hexagonal unit in the grid and stores all per-cell fire behavior state. RealTimeVisualizer provides a live rendering interface that runs alongside a simulation.
Most users interact with FireSim indirectly through a ControlClass subclass, using the methods inherited from BaseFireSim. The classes below are primarily useful for understanding simulation internals or building custom tooling.
FireSim¶
The main simulation class. Extends BaseFireSim with the Rothermel fire spread loop, crown fire checks, logging, and visualization hooks. User control code receives a FireSim instance as the fire argument in process_state().
Core fire simulation model.
This module defines the FireSim class, which implements wildfire simulation based on fire spread dynamics, wind conditions, and terrain influences. It extends BaseFireSim and incorporates hexagonal grid modeling to track fire behavior at a cellular level.
Classes:
| Name | Description |
|---|---|
- FireSim |
The main wildfire simulation model. |
.. autoclass:: FireSim :members:
FireSim
¶
Bases: BaseFireSim
A hexagonal grid-based wildfire simulation model.
Extends BaseFireSim and models wildfire spread using Rothermel's fire spread equations. Handles core fire behavior simulation while inheriting grid management, weather, and terrain functionality from the base class.
Attributes:
| Name | Type | Description |
|---|---|---|
logger |
Logger
|
Logging utility for storing simulation outputs. |
progress_bar |
tqdm
|
Progress bar for tracking simulation steps. |
agent_list |
list
|
Agents interacting with the fire. |
agents_added |
bool
|
Whether agents have been added to the simulation. |
Source code in embrs/fire_simulator/fire.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
agent_list
property
¶
List of agents registered with the simulation.
agents_added
property
¶
True if agents have been registered, False otherwise.
__init__(sim_params)
¶
Initialize the wildfire simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_params
|
SimParams
|
Simulation parameters including terrain, fuel, wind conditions, and ignition points. |
required |
Source code in embrs/fire_simulator/fire.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
iterate()
¶
Advance the fire simulation by one time step.
Updates fire propagation, weather conditions, and burning cell states. Handles new ignitions, calculates rate of spread, and transitions fully burned cells to BURNT state.
Side Effects
- Updates cell states and fire spread distances.
- May ignite neighboring cells.
- Logs changes if logger is configured.
- Updates visualizer if configured.
Source code in embrs/fire_simulator/fire.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
set_visualizer(visualizer)
¶
Set the visualizer reference for this simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visualizer
|
RealTimeVisualizer
|
Visualizer instance to use. |
required |
Source code in embrs/fire_simulator/fire.py
355 356 357 358 359 360 361 | |
visualize_ensemble_prediction(prediction_grid)
¶
Visualize ensemble prediction results on the current visualization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prediction_grid
|
dict
|
Ensemble prediction data structure containing multiple forecast scenarios. |
required |
Side Effects
- Passes prediction to visualizer if available.
- Stores prediction in self.curr_prediction for logging.
Source code in embrs/fire_simulator/fire.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | |
visualize_prediction(prediction_grid)
¶
Display a prediction grid on the visualization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prediction_grid
|
dict
|
Prediction data mapping timestamps to coordinate lists. |
required |
Side Effects
- Passes prediction to visualizer if available.
- Stores prediction in self.curr_prediction for logging.
Source code in embrs/fire_simulator/fire.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
Fuel
¶
Base fuel model for Rothermel fire spread calculations.
Encapsulate the physical properties of a fuel type and precompute derived constants used in the Rothermel (1972) equations. Non-burnable fuel types (e.g., water, urban) store only name and model number.
All internal units follow the Rothermel convention: loading in lb/ft², surface-area-to-volume ratio in 1/ft, fuel depth in ft, heat content in BTU/lb.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Human-readable fuel model name. |
model_num |
int
|
Numeric fuel model identifier. |
burnable |
bool
|
Whether this fuel can sustain fire. |
dynamic |
bool
|
Whether herbaceous fuel transfer is applied. |
load |
ndarray
|
Fuel loading per class (tons/acre), shape (6,). Order: [1h, 10h, 100h, dead herb, live herb, live woody]. |
s |
ndarray
|
Surface-area-to-volume ratio per class (1/ft), shape (6,). |
sav_ratio |
int
|
Characteristic SAV ratio (1/ft). |
dead_mx |
float
|
Dead fuel moisture of extinction (fraction). |
fuel_depth_ft |
float
|
Fuel bed depth (feet). |
heat_content |
float
|
Heat content (BTU/lb), default 8000. |
rho_p |
float
|
Particle density (lb/ft³), default 32. |
Source code in embrs/models/fuel_models.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
__init__(name, model_num, burnable, dynamic, w_0, s, s_total, dead_mx, fuel_depth)
¶
Initialize a fuel model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Human-readable fuel model name. |
required |
model_num
|
int
|
Numeric identifier for the fuel model. |
required |
burnable
|
bool
|
Whether this fuel can sustain fire. |
required |
dynamic
|
bool
|
Whether herbaceous transfer applies. |
required |
w_0
|
ndarray
|
Fuel loading per class (tons/acre), shape (6,). None for non-burnable models. |
required |
s
|
ndarray
|
SAV ratio per class (1/ft), shape (6,). None for non-burnable models. |
required |
s_total
|
int
|
Characteristic SAV ratio (1/ft). |
required |
dead_mx
|
float
|
Dead fuel moisture of extinction (fraction). |
required |
fuel_depth
|
float
|
Fuel bed depth (feet). |
required |
Source code in embrs/models/fuel_models.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
calc_E_B_C()
¶
Compute wind factor coefficients E, B, and C.
These coefficients parameterize the wind factor equation in the Rothermel model as a function of the characteristic SAV ratio.
Returns:
| Type | Description |
|---|---|
tuple
|
Tuple[float, float, float]: |
Source code in embrs/models/fuel_models.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
calc_W(w_0_tpa)
¶
Compute dead-to-live fuel loading ratio W.
W is used to determine live fuel moisture of extinction. Returns
np.inf when there is no live fuel loading (denominator is zero).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
w_0_tpa
|
ndarray
|
Fuel loading per class (tons/acre), shape (6,). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Dead-to-live loading ratio (dimensionless), or |
Source code in embrs/models/fuel_models.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
calc_flux_ratio()
¶
Compute propagating flux ratio for the Rothermel equation.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Propagating flux ratio (dimensionless). |
Source code in embrs/models/fuel_models.py
132 133 134 135 136 137 138 139 140 141 | |
compute_f_and_g_weights()
¶
Compute fuel class weighting factors f_ij, g_ij, and category fractions f_i.
Derive weighting arrays from fuel loading and SAV ratios. f_ij
gives fractional area weights within dead/live categories. g_ij
gives SAV-bin-based moisture weighting factors. f_i gives the
dead vs. live category fractions.
Side Effects
Sets self.f_ij (2×6), self.g_ij (2×6), and
self.f_i (2,) arrays.
Source code in embrs/models/fuel_models.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
set_fuel_loading(w_n)
¶
Set net fuel loading and recompute weighted dead/live net loadings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
w_n
|
ndarray
|
Net fuel loading per class (lb/ft²), shape (6,). |
required |
Side Effects
Updates self.w_n, self.w_n_dead, and self.w_n_live.
Source code in embrs/models/fuel_models.py
237 238 239 240 241 242 243 244 245 246 247 248 | |
BTU_ft2_min_to_kW_m2(f_btu_ft2_min)
¶
Convert heat flux from BTU/(ft^2*min) to kW/m^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_btu_ft2_min
|
float
|
Heat flux in BTU/(ft^2*min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Heat flux in kW/m^2. |
Source code in embrs/utilities/unit_conversions.py
220 221 222 223 224 225 226 227 228 229 | |
BTU_ft_min_to_kW_m(f_btu_ft_min)
¶
Convert fireline intensity from BTU/(ft*min) to kW/m.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_btu_ft_min
|
float
|
Fireline intensity in BTU/(ft*min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fireline intensity in kW/m. |
Source code in embrs/utilities/unit_conversions.py
232 233 234 235 236 237 238 239 240 241 | |
BTU_ft_min_to_kcal_s_m(f_btu_ft_min)
¶
Convert fireline intensity from BTU/(ftmin) to kcal/(sm).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_btu_ft_min
|
float
|
Fireline intensity in BTU/(ft*min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fireline intensity in kcal/(s*m). |
Source code in embrs/utilities/unit_conversions.py
244 245 246 247 248 249 250 251 252 253 | |
BTU_lb_to_cal_g(f_btu_lb)
¶
Convert heat content from BTU/lb to cal/g.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_btu_lb
|
float
|
Heat content in BTU/lb. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Heat content in cal/g. |
Source code in embrs/utilities/unit_conversions.py
272 273 274 275 276 277 278 279 280 281 | |
F_to_C(f_f)
¶
Convert temperature from Fahrenheit to Celsius.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_f
|
float
|
Temperature in degrees Fahrenheit. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Temperature in degrees Celsius. |
Source code in embrs/utilities/unit_conversions.py
48 49 50 51 52 53 54 55 56 57 | |
KiSq_to_Lbsft2(f_kisq)
¶
Convert fuel loading from kg/m^2 to lb/ft^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_kisq
|
float
|
Fuel loading in kg/m^2. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in lb/ft^2. |
Source code in embrs/utilities/unit_conversions.py
156 157 158 159 160 161 162 163 164 165 | |
KiSq_to_TPA(f_kisq)
¶
Convert fuel loading from kg/m^2 to tons per acre.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_kisq
|
float
|
Fuel loading in kg/m^2. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in tons per acre. |
Source code in embrs/utilities/unit_conversions.py
204 205 206 207 208 209 210 211 212 213 | |
Lbsft2_to_KiSq(f_libsft2)
¶
Convert fuel loading from lb/ft^2 to kg/m^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_libsft2
|
float
|
Fuel loading in lb/ft^2. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in kg/m^2. |
Source code in embrs/utilities/unit_conversions.py
144 145 146 147 148 149 150 151 152 153 | |
Lbsft2_to_TPA(f_lbsft2)
¶
Convert fuel loading from lb/ft^2 to tons per acre.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_lbsft2
|
float
|
Fuel loading in lb/ft^2. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in tons per acre. |
Source code in embrs/utilities/unit_conversions.py
192 193 194 195 196 197 198 199 200 201 | |
TPA_to_KiSq(f_tpa)
¶
Convert fuel loading from tons per acre to kg/m^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_tpa
|
float
|
Fuel loading in tons per acre. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in kg/m^2. |
Source code in embrs/utilities/unit_conversions.py
168 169 170 171 172 173 174 175 176 177 | |
TPA_to_Lbsft2(f_tpa)
¶
Convert fuel loading from tons per acre to lb/ft^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_tpa
|
float
|
Fuel loading in tons per acre. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fuel loading in lb/ft^2. |
Source code in embrs/utilities/unit_conversions.py
180 181 182 183 184 185 186 187 188 189 | |
accelerate(cell, time_step)
¶
Apply fire acceleration toward steady-state ROS.
Update the transient rate of spread (cell.r_t) and average ROS
(cell.avg_ros) for each spread direction using the exponential
acceleration model (McAlpine 1989). Directions already at or above
steady-state are clamped.
Uses a JIT-compiled inner loop to avoid numpy dispatch overhead on small (12-element) arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Burning cell with |
required |
time_step
|
float
|
Simulation time step in seconds. |
required |
Side Effects
Updates cell.r_t, cell.avg_ros, and cell.I_t in-place.
Source code in embrs/models/rothermel.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
cal_g_to_BTU_lb(f_cal_g)
¶
Convert heat content from cal/g to BTU/lb.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_cal_g
|
float
|
Heat content in cal/g. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Heat content in BTU/lb. |
Source code in embrs/utilities/unit_conversions.py
260 261 262 263 264 265 266 267 268 269 | |
calc_I_r(fuel, dead_moist_damping, live_moist_damping)
¶
Compute reaction intensity from fuel properties and moisture damping.
Reaction intensity is the rate of heat release per unit area of the flaming front (Rothermel 1972, Eq. 27).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with net fuel loadings, heat content, and
optimum reaction velocity ( |
required |
dead_moist_damping
|
float
|
Dead fuel moisture damping coefficient in [0, 1]. |
required |
live_moist_damping
|
float
|
Live fuel moisture damping coefficient in [0, 1]. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Reaction intensity (BTU/ft²/min). |
Source code in embrs/models/rothermel.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | |
calc_eccentricity(fuel, R_h, R_0)
¶
Compute fire ellipse eccentricity from effective wind speed.
Convert the effective wind speed to m/s, then compute the length-to-
breadth ratio z and derive eccentricity. Capped at z = 8.0
following Anderson (1983).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model for effective wind speed calculation. |
required |
R_h
|
float
|
Head-fire rate of spread (ft/min). |
required |
R_0
|
float
|
No-wind, no-slope base ROS (ft/min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fire ellipse eccentricity in [0, 1). |
Source code in embrs/models/rothermel.py
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
calc_effective_wind_factor(R_h, R_0)
¶
Compute the effective wind factor from head-fire and base ROS.
The effective wind factor (phi_e) represents the combined influence of wind and slope as if it were a single wind-only factor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
R_h
|
float
|
Head-fire rate of spread (ft/min). |
required |
R_0
|
float
|
No-wind, no-slope base ROS (ft/min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Effective wind factor (dimensionless). |
Source code in embrs/models/rothermel.py
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | |
calc_effective_wind_speed(fuel, R_h, R_0)
¶
Compute the effective wind speed from the effective wind factor.
Invert the wind factor equation to recover the equivalent wind speed that produces the same effect as the combined wind and slope.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with wind coefficients |
required |
R_h
|
float
|
Head-fire rate of spread (ft/min). |
required |
R_0
|
float
|
No-wind, no-slope base ROS (ft/min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Effective wind speed (ft/min). Returns 0 when |
Source code in embrs/models/rothermel.py
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | |
calc_flame_len(cell)
¶
Estimate flame length from maximum fireline intensity.
For surface fires, uses Brown and Davis (1973) correlation. For crown fires, uses Thomas (1963) correlation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell with |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Flame length in feet. |
Source code in embrs/models/rothermel.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
calc_heat_sink(fuel, m_f)
¶
Compute heat sink term for the Rothermel spread equation.
The heat sink represents the energy required to raise the fuel ahead of the fire front to ignition temperature, weighted by fuel class properties and moisture contents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with bulk density, weighting factors, and surface-area-to-volume ratios. |
required |
m_f
|
ndarray
|
Fuel moisture content array of shape (6,) as fractions. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Heat sink (BTU/ft³). |
Source code in embrs/models/rothermel.py
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
calc_live_mx(fuel, m_f)
¶
Compute live fuel moisture of extinction.
Determine the threshold moisture content above which live fuels will
not sustain combustion, based on the ratio of dead-to-live fuel loading
(fuel.W) and the dead characteristic moisture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with loading ratio |
required |
m_f
|
float
|
Weighted characteristic dead fuel moisture (fraction). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Live fuel moisture of extinction (fraction). Clamped to be
at least |
Source code in embrs/models/rothermel.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
calc_mineral_damping(s_e=0.01)
¶
Compute mineral damping coefficient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s_e
|
float
|
Effective mineral content (fraction). Defaults to 0.010 (standard value for wildland fuels). |
0.01
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Mineral damping coefficient (dimensionless). |
Source code in embrs/models/rothermel.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
calc_moisture_damping(m_f, m_x)
¶
Compute moisture damping coefficient for dead or live fuel.
Evaluates a cubic polynomial in the moisture ratio m_f / m_x
(Rothermel 1972, Eq. 29). Returns 0 when moisture of extinction is
zero or when the polynomial evaluates to a negative value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_f
|
float
|
Characteristic fuel moisture content (fraction). |
required |
m_x
|
float
|
Moisture of extinction (fraction). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Moisture damping coefficient in [0, 1]. |
Source code in embrs/models/rothermel.py
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | |
calc_r_0(fuel, m_f)
¶
Compute no-wind, no-slope base rate of spread and reaction intensity.
Evaluate the Rothermel (1972) equations for base ROS using fuel properties and moisture content. This is the fundamental spread rate before wind and slope adjustments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with precomputed constants. |
required |
m_f
|
ndarray
|
Fuel moisture content array of shape (6,) with entries [1h, 10h, 100h, dead herb, live herb, live woody] as fractions (g water / g fuel). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Tuple[float, float]: |
Source code in embrs/models/rothermel.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
calc_r_h(cell, R_0=None, I_r=None)
¶
Compute head-fire rate of spread combining wind and slope effects.
Resolve the wind and slope vectors to determine the maximum spread
direction (alpha) and head-fire ROS (R_h). Wind speed is capped
at 0.9 × reaction intensity per Rothermel's wind limit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell with wind, slope, fuel, and moisture data. |
required |
R_0
|
float
|
Pre-computed no-wind, no-slope ROS (ft/min). Computed internally if None. |
None
|
I_r
|
float
|
Pre-computed reaction intensity (BTU/ft²/min). Computed internally if None. |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[float, float, float, float]
|
Tuple[float, float, float, float]: |
Side Effects
May update cell.aspect when slope is zero (set to wind direction).
Source code in embrs/models/rothermel.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
calc_slope_factor(fuel, phi)
¶
Compute the slope factor (phi_s) for the Rothermel spread equation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with bulk density |
required |
phi
|
float
|
Slope angle (radians). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Dimensionless slope factor (phi_s). |
Source code in embrs/models/rothermel.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | |
calc_vals_for_all_directions(cell, R_h, I_r, alpha, e, I_h=None)
¶
Compute ROS and fireline intensity along all spread directions.
Use the fire ellipse (eccentricity e) and the combined wind/slope
heading alpha to resolve the head-fire ROS into each of the cell's
spread directions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell providing directions and fuel properties. |
required |
R_h
|
float
|
Head-fire rate of spread (ft/min for surface, m/min for crown fire). |
required |
I_r
|
float
|
Reaction intensity (BTU/ft²/min). Ignored when
|
required |
alpha
|
float
|
Combined wind/slope heading in radians, relative to the cell's aspect (upslope direction). |
required |
e
|
float
|
Fire ellipse eccentricity in [0, 1). |
required |
I_h
|
float
|
Head-fire fireline intensity (BTU/ft/min).
When provided, directional intensities are scaled from this
value instead of being computed from |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
Tuple[np.ndarray, np.ndarray]: |
Source code in embrs/models/rothermel.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
calc_wind_factor(fuel, wind_speed)
¶
Compute the wind factor (phi_w) for the Rothermel spread equation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model with precomputed wind coefficients
|
required |
wind_speed
|
float
|
Midflame wind speed (ft/min). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Dimensionless wind factor (phi_w). |
Source code in embrs/models/rothermel.py
436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
calc_wind_slope_vec(R_0, phi_w, phi_s, angle)
¶
Compute the combined wind and slope vector magnitude and direction.
Resolve wind and slope spread factors into a single resultant vector using Rothermel's vector addition method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
R_0
|
float
|
No-wind, no-slope ROS (ft/min). |
required |
phi_w
|
float
|
Wind factor (dimensionless). |
required |
phi_s
|
float
|
Slope factor (dimensionless). |
required |
angle
|
float
|
Angle between wind and upslope directions (radians). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Tuple[float, float]: |
Source code in embrs/models/rothermel.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
ft_min_to_m_s(f_ft_min)
¶
Convert speed from feet per minute to meters per second.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ft_min
|
float
|
Speed in ft/min. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Speed in m/s. |
Source code in embrs/utilities/unit_conversions.py
92 93 94 95 96 97 98 99 100 101 | |
ft_min_to_mph(f_ft_min)
¶
Convert speed from feet per minute to miles per hour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ft_min
|
float
|
Speed in ft/min. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Speed in mph. |
Source code in embrs/utilities/unit_conversions.py
116 117 118 119 120 121 122 123 124 125 | |
ft_to_m(f_ft)
¶
Convert length from feet to meters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ft
|
float
|
Length in feet. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Length in meters. |
Source code in embrs/utilities/unit_conversions.py
76 77 78 79 80 81 82 83 84 85 | |
get_characteristic_moistures(fuel, m_f)
¶
Compute weighted characteristic dead and live fuel moisture contents.
Use fuel weighting factors (f_dead_arr, f_live_arr) to collapse
the per-class moisture array into single dead and live values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fuel
|
Fuel
|
Fuel model providing weighting arrays. |
required |
m_f
|
ndarray
|
Moisture content array of shape (6,) as fractions. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Tuple[float, float]: |
Source code in embrs/models/rothermel.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
m_s_to_ft_min(m_s)
¶
Convert speed from meters per second to feet per minute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_s
|
float
|
Speed in m/s. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Speed in ft/min. |
Source code in embrs/utilities/unit_conversions.py
104 105 106 107 108 109 110 111 112 113 | |
m_to_ft(f_m)
¶
Convert length from meters to feet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_m
|
float
|
Length in meters. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Length in feet. |
Source code in embrs/utilities/unit_conversions.py
64 65 66 67 68 69 70 71 72 73 | |
mph_to_ft_min(f_mph)
¶
Convert speed from miles per hour to feet per minute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_mph
|
float
|
Speed in mph. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Speed in ft/min. |
Source code in embrs/utilities/unit_conversions.py
128 129 130 131 132 133 134 135 136 137 | |
njit_if_enabled(**jit_kwargs)
¶
Decorator that applies Numba njit if available and enabled.
Equivalent to jit_if_enabled(nopython=True, **jit_kwargs). Use this for functions that must run in nopython mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**jit_kwargs
|
Any
|
Keyword arguments to pass to numba.njit. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Callable |
Callable
|
Decorated function (JIT-compiled if enabled, else unchanged). |
Source code in embrs/utilities/numba_utils.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
surface_fire(cell)
¶
Compute steady-state surface fire ROS and fireline intensity for a cell.
Calculate the head-fire rate of spread (R_h), then resolve spread rates and fireline intensities along all 12 spread directions using fire ellipse geometry. Results are stored directly on the cell object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
Cell
|
Cell to evaluate. Must have fuel, moisture, wind, slope, and direction attributes populated. |
required |
Side Effects
Sets cell.r_ss (m/s), cell.I_ss (BTU/ft/min),
cell.r_h_ss (m/s), cell.reaction_intensity (BTU/ft²/min),
cell.alpha (radians), and cell.e (eccentricity) on the cell.
Source code in embrs/models/rothermel.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
Cell¶
Each cell tracks its terrain (elevation, slope, aspect), fuel model, fuel moisture, fire state, and spread geometry. Cells are typically accessed through FireSim lookup methods like get_cell_from_xy() or get_cell_from_indices() rather than constructed directly.
Representation of the discrete cells that make up the fire simulation.
This module defines the Cell class, which represents the fundamental units of
the wildfire simulation grid. Each Cell object stores terrain properties, fire spread
parameters, and state transitions necessary for modeling fire behavior.
Classes:
| Name | Description |
|---|---|
- Cell |
A hexagonal simulation unit with fire propagation attributes. |
.. autoclass:: Cell :members:
Cell
¶
Represents a hexagonal simulation cell in the wildfire model.
Each cell maintains its physical properties (elevation, slope, aspect), fuel characteristics, fire state, and interactions with neighboring cells. Cells are structured in a point-up hexagonal grid to model fire spread dynamics.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Unique identifier for the cell. |
col |
int
|
Column index of the cell in the simulation grid. |
row |
int
|
Row index of the cell in the simulation grid. |
cell_size |
float
|
Edge length of the hexagonal cell (meters). |
cell_area |
float
|
Area of the hexagonal cell (square meters). |
x_pos |
float
|
X-coordinate of the cell in the simulation space (meters). |
y_pos |
float
|
Y-coordinate of the cell in the simulation space (meters). |
elevation_m |
float
|
Elevation of the cell (meters). |
aspect |
float
|
Upslope direction in degrees (0° = North, 90° = East, etc.). |
slope_deg |
float
|
Slope angle of the terrain at the cell (degrees). |
fuel |
Fuel
|
Fire Behavior Fuel Model (FBFM) for the cell, from either Anderson 13 or Scott-Burgan 40. |
state |
CellStates
|
Current fire state (FUEL, FIRE, BURNT). |
neighbors |
dict
|
Dictionary of adjacent cell neighbors. |
burnable_neighbors |
dict
|
Subset of |
forecast_wind_speeds |
list
|
Forecasted wind speeds in m/s. |
forecast_wind_dirs |
list
|
Forecasted wind directions in degrees (cartesian). |
Source code in embrs/fire_simulator/cell.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 | |
burnable_neighbors
property
¶
Dictionary of adjacent cells that are in a burnable state.
Same format as neighbors: keys are cell IDs, values are (dx, dy) offsets.
cell_area
property
¶
Area of the cell in square meters.
cell_size
property
¶
Size of the cell in meters.
Measured as the side length of the hexagon.
col
property
¶
Column index of the cell in the simulation grid.
elevation_m
property
¶
Elevation of the cell in meters.
fire_area_m2
property
¶
Fire area within cell via trapezoidal polar integration.
Computes A = (1/2) Σ Δθ_i · (r_i² + r_{i+1}²) / 2 over the discretized spread directions. For center ignition (n_loc=0) the sum includes a closing segment from the last direction back to the first. No area_fraction is needed — the angular range of the directions already encodes whether the fire covers the full cell, a half-cell, or a 60° sector.
Clamped to cell_area as an upper bound.
Returns 0.0 for non-burning cells, cells with no spread data, or cells where _ign_n_loc has not yet been set.
fuel
property
¶
Fuel model for this cell.
Can be any Anderson or Scott-Burgan fuel model.
n_disabled_locs
property
¶
Number of boundary locations disabled by prior suppression.
neighbors
property
¶
Dictionary of adjacent cells.
Keys are neighbor cell IDs, values are (dx, dy) tuples indicating the column and row offset from this cell to the neighbor.
row
property
¶
Row index of the cell in the simulation grid.
state
property
¶
Current fire state of the cell (FUEL, FIRE, or BURNT).
x_pos
property
¶
X-coordinate of the cell center in meters.
Increases left to right in the visualization.
y_pos
property
¶
Y-coordinate of the cell center in meters.
Increases bottom to top in the visualization.
__getstate__()
¶
Prepare cell state for pickling.
Excludes the weak reference to parent which cannot be pickled.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Cell state dictionary with _parent set to None. |
Source code in embrs/fire_simulator/cell.py
1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 | |
__gt__(other)
¶
Compares two cells based on their unique ID.
This method allows for sorting and comparison of cells using the > (greater than) operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Cell
|
Another cell to compare against. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
Source code in embrs/fire_simulator/cell.py
1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 | |
__init__(id, col, row, cell_size)
¶
Initialize a hexagonal cell with position and geometry.
Creates a cell at the specified grid position and calculates its spatial coordinates based on the hexagonal grid layout. The cell is initialized with default values for fire state and fuel properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
int
|
Unique identifier for this cell. |
required |
col
|
int
|
Column index in the simulation grid. |
required |
row
|
int
|
Row index in the simulation grid. |
required |
cell_size
|
float
|
Edge length of the hexagon in meters. |
required |
Notes
- Spatial position is calculated using point-up hexagon geometry.
- For even rows: x = col * cell_size * sqrt(3)
- For odd rows: x = (col + 0.5) * cell_size * sqrt(3)
- y = row * cell_size * 1.5
Source code in embrs/fire_simulator/cell.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
__lt__(other)
¶
Compares two cells based on their unique ID.
This method allows for sorting and comparison of cells using the < (less than) operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Cell
|
Another cell to compare against. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
Source code in embrs/fire_simulator/cell.py
1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | |
__setstate__(state)
¶
Restore cell state after unpickling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
dict
|
Cell state dictionary from getstate. |
required |
Source code in embrs/fire_simulator/cell.py
1331 1332 1333 1334 1335 1336 1337 | |
__str__()
¶
Returns a formatted string representation of the cell.
The string includes the cell's ID, coordinates, elevation, fuel type, and state.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
A formatted string representing the cell. |
Source code in embrs/fire_simulator/cell.py
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 | |
add_retardant(duration_hr, effectiveness)
¶
Apply long-term fire retardant to this cell.
Marks the cell as treated with retardant, which reduces the rate of spread by the effectiveness factor until the retardant expires.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration_hr
|
float
|
Duration of retardant effectiveness in hours. |
required |
effectiveness
|
float
|
Reduction factor for rate of spread (0.0-1.0). A value of 0.5 reduces ROS by 50%. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If effectiveness is not in range [0, 1]. |
Side Effects
- Sets self._retardant to True.
- Sets self._retardant_factor to (1 - effectiveness).
- Sets self.retardant_expiration_s to expiration time.
Source code in embrs/fire_simulator/cell.py
900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 | |
apply_vw_suppression()
¶
Apply moisture injection from accumulated Van Wagner water energy.
Called by iterate() for cells with water_applied_kJ > 0. Computes suppression ratio from current fire state, then injects moisture toward dead_mx proportionally.
Uses
- I_ss (BTU/ft/min) converted to kW/m
- fuel.w_n_dead + w_n_live (lb/ft²) converted to kg/m²
- fire_area_m2 property
- self._vw_efficiency (stored from water_drop_vw call)
- heat_to_extinguish_kJ() (Eq. 7b + 10b + Table 4)
- compute_suppression_ratio()
- compute_moisture_injection()
Side Effects
- Modifies self.fmois
- Sets self.has_steady_state = False
Source code in embrs/fire_simulator/cell.py
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 | |
calc_cell_area()
¶
Calculates the area of the hexagonal cell in square meters.
The formula for the area of a regular hexagon is:
Area = (3 * sqrt(3) / 2) * side_length²
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The area of the hexagonal cell in square meters. |
Source code in embrs/fire_simulator/cell.py
1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 | |
calc_hold_prob(flame_len_m)
¶
Calculate the probability that a fuel break will stop fire spread.
Uses the Mees et al. (1993) model to estimate the probability that a fuel discontinuity (road, firebreak) will prevent fire from crossing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flame_len_m
|
float
|
Flame length at the fire front in meters. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Probability that the fuel break holds (0.0-1.0). Returns 0 if no fuel break is present in this cell. |
Notes
- Based on Mees, et al. (1993).
Source code in embrs/fire_simulator/cell.py
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 | |
compute_disabled_locs()
¶
Compute boundary locations consumed by current fire and add to disabled_locs.
Must be called BEFORE fire-state arrays are cleared. Uses three rules to determine which boundary locations (1-12) have been consumed.
Rule 1: Entry point is consumed. Rule 2: Each crossed intersection's exit boundary location is consumed. Rule 3: For corner ignitions, adjacent midpoints are consumed if fire has spread past half the distance in that direction.
Source code in embrs/fire_simulator/cell.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
curr_wind()
¶
Get the current wind speed and direction at this cell.
Returns the wind conditions for the current weather interval from the cell's local wind forecast. For prediction runs, may trigger forecast updates if needed.
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple
|
(wind_speed, wind_direction) where speed is in m/s and direction is in degrees using cartesian convention (0° = blowing toward North/+y, 90° = blowing toward East/+x). |
Source code in embrs/fire_simulator/cell.py
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | |
get_ign_params(n_loc)
¶
Calculate fire spread directions and distances from an ignition location.
Computes the radial spread directions from the specified ignition point within the cell to each edge or vertex. Initializes arrays for tracking rate of spread and fireline intensity in each direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_loc
|
int
|
Ignition location index within the cell. 0=center, 1-6=vertices, 7-12=edge midpoints. |
required |
Side Effects
- Sets self.directions: array of compass directions in degrees.
- Sets self.distances: slope-adjusted distances to cell boundaries.
- Sets self.end_pts: coordinates of cell boundary points.
- Initializes self.avg_ros, self.I_t, self.r_t to zero arrays.
Source code in embrs/fire_simulator/cell.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | |
iter_neighbor_cells()
¶
Iterate over neighboring Cell objects.
Yields each adjacent cell by looking up neighbor IDs in the parent simulation's cell_dict.
Yields:
| Name | Type | Description |
|---|---|---|
Cell |
Cell
|
Each neighboring cell object. |
Notes
- Returns immediately if parent reference is None.
Source code in embrs/fire_simulator/cell.py
1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 | |
project_distances_to_surf(distances)
¶
Project horizontal distances onto the sloped terrain surface.
Adjusts the flat-ground distances to each cell edge by accounting for the slope and aspect of the terrain. This ensures fire spread distances are measured along the actual terrain surface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distances
|
ndarray
|
Horizontal distances to cell edges in meters. |
required |
Side Effects
- Sets self.distances to the slope-adjusted distances in meters.
Source code in embrs/fire_simulator/cell.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | |
reset_to_fuel()
¶
Reset cell to initial FUEL state, preserving terrain/fuel/geometry data.
Resets all mutable fire-state attributes to their initial values as set
by __init__ and _set_cell_data. Immutable properties such as
position, fuel model, elevation, slope, aspect, canopy attributes,
polygon, wind adjustment factor, and neighbor topology are preserved.
This is used by FirePredictor to efficiently restore cells to a clean state between predictions, avoiding expensive deepcopy operations.
Side Effects
- Resets fire state to CellStates.FUEL
- Clears all spread tracking arrays
- Resets suppression effects (retardant, rain, firebreaks)
- Resets fuel moisture to initial values
- Restores full neighbor set to _burnable_neighbors
Source code in embrs/fire_simulator/cell.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
set_arrays()
¶
Initialize fuel moisture tracking arrays for this cell.
DFM objects are created lazily on first moisture update to avoid allocating ~12 numpy arrays per object for cells that never burn.
Side Effects
- Sets self.wdry and self.sigma from fuel model properties.
- Initializes self.fmois array with initial moisture fractions.
- Sets self._dfms_needed tuple for lazy DFM creation.
Source code in embrs/fire_simulator/cell.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | |
set_parent(parent)
¶
Sets the parent BaseFire object for this cell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
BaseFireSim
|
The BaseFire object that owns this cell. |
required |
Source code in embrs/fire_simulator/cell.py
167 168 169 170 171 172 173 | |
suppress_to_fuel()
¶
Suppress cell back to FUEL state, preserving moisture and disabled_locs.
Similar to reset_to_fuel() but preserves: - disabled_locs (accumulated consumed boundary locations) - _suppression_count (incremented) - Fuel moisture state (fmois, dfms, moist_update_time_s)
Clears fire-state arrays, VW water state, and crown fire state. Restores burnable_neighbors from full neighbor set.
Source code in embrs/fire_simulator/cell.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | |
to_log_entry(time)
¶
Create a log entry capturing the cell's current state.
Generates a structured record of the cell's fire behavior, fuel moisture, wind conditions, and other properties for logging and playback.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
float
|
Current simulation time in seconds. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
CellLogEntry |
CellLogEntry
|
Dataclass containing cell state for logging. |
Source code in embrs/fire_simulator/cell.py
1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | |
to_polygon()
¶
Generates a Shapely polygon representation of the hexagonal cell.
The polygon is created in a point-up orientation using the center (x_pos, y_pos)
and the hexagon's side length.
Returns:
| Name | Type | Description |
|---|---|---|
Polygon |
Polygon
|
A Shapely polygon representing the hexagonal cell. |
Source code in embrs/fire_simulator/cell.py
1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 | |
water_drop_as_moisture_bump(moisture_bump)
¶
Apply a water drop as a direct fuel moisture increase.
Simulates water delivery by directly increasing the outer node moisture of each dead fuel class, then advances the moisture model briefly to allow diffusion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
moisture_bump
|
float
|
Moisture fraction to add to fuel surface. |
required |
Side Effects
- Increases outer node moisture on each DeadFuelMoisture object.
- Advances moisture model by 30 seconds.
- Updates self.fmois with new moisture fractions.
Notes
- No effect on non-burnable fuel types.
Source code in embrs/fire_simulator/cell.py
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | |
water_drop_as_rain(water_depth_cm, duration_s=30)
¶
Apply a water drop modeled as equivalent rainfall.
Simulates water delivery by treating the water as cumulative rainfall input to the fuel moisture model. Updates moisture state immediately.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
water_depth_cm
|
float
|
Equivalent water depth in centimeters. |
required |
duration_s
|
float
|
Duration of the water application in seconds. |
30
|
Side Effects
- Updates self.local_rain with accumulated water depth.
- Advances moisture model through the application period.
- Updates self.fmois with new moisture fractions.
Notes
- No effect on non-burnable fuel types.
Source code in embrs/fire_simulator/cell.py
927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 | |
water_drop_vw(volume_L, efficiency=2.5, T_a=20.0)
¶
Apply water using Van Wagner (2022) energy-balance model.
Converts water volume to cooling energy (Eq. 1b) and accumulates in water_applied_kJ. Moisture injection is applied during iterate() by apply_vw_suppression().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume_L
|
float
|
Water volume in liters (1 L = 1 kg). |
required |
efficiency
|
float
|
Application efficiency multiplier (Table 4, Van Wagner 2022). Typical range 2.0–4.0. Default 2.5. |
2.5
|
T_a
|
float
|
Ambient air temperature in °C. Default 20. |
20.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If volume_L < 0. |
Source code in embrs/fire_simulator/cell.py
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | |
RealTimeVisualizer¶
Renders fire spread, agent positions, and weather data in real-time during a simulation. Created internally by the simulation launcher — most users do not need to instantiate this directly.
Real-time visualization for running fire simulations.
This module provides a visualizer that renders fire simulation state in real-time during simulation execution. It extends the base visualizer with live update capabilities and caching for efficient rendering.
Classes:
| Name | Description |
|---|---|
- RealTimeVisualizer |
Live visualization interface for FireSim instances. |
.. autoclass:: RealTimeVisualizer :members:
RealTimeVisualizer
¶
Bases: BaseVisualizer
Real-time visualization interface for running fire simulations.
Provides live rendering of fire spread, agent positions, and weather data during simulation execution. Cell updates are cached between visualization frames for efficient batch rendering.
Attributes:
| Name | Type | Description |
|---|---|---|
sim |
FireSim
|
Reference to the associated fire simulation. |
cell_cache |
list
|
Buffer of CellLogEntry objects awaiting visualization. |
Source code in embrs/fire_simulator/visualizer.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
__init__(sim)
¶
Initialize the real-time visualizer for a simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
FireSim
|
The fire simulation instance to visualize. |
required |
Side Effects
- Initializes the base visualizer with simulation parameters.
- Creates an empty cell cache for buffering updates.
Source code in embrs/fire_simulator/visualizer.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
cache_changes(updated_cells)
¶
Add cell updates to the visualization cache.
Buffers cell state changes for batch rendering on the next update call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
updated_cells
|
list
|
List of CellLogEntry objects to cache. |
required |
Side Effects
- Extends self.cell_cache with new entries.
Source code in embrs/fire_simulator/visualizer.py
67 68 69 70 71 72 73 74 75 76 77 78 | |
get_init_entries()
¶
Generate initial log entries for all cells in the simulation.
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
List of CellLogEntry objects representing the initial state of every cell in the simulation grid. |
Source code in embrs/fire_simulator/visualizer.py
57 58 59 60 61 62 63 64 65 | |
get_input_params()
¶
Build visualization parameters from the current simulation state.
Extracts grid geometry, weather forecasts, terrain data, and initial cell states from the simulation to configure the base visualizer.
Returns:
| Name | Type | Description |
|---|---|---|
VisualizerInputs |
VisualizerInputs
|
Configuration dataclass for BaseVisualizer. |
Source code in embrs/fire_simulator/visualizer.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
set_sim(sim)
¶
Update the simulation reference for this visualizer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim
|
FireSim
|
New simulation instance to visualize. |
required |
Source code in embrs/fire_simulator/visualizer.py
49 50 51 52 53 54 55 | |
update()
¶
Render all cached updates to the visualization.
Collects agent positions and action entries from the simulation, then renders all cached cell changes along with current agent and action state.
Side Effects
- Calls update_grid with cached cell data.
- Clears the cell cache after rendering.
Source code in embrs/fire_simulator/visualizer.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |