SimulatorConstants
Constants configuration class for the simulator
| Attributes: |
|
|---|
Initialize the simulator constants with the default values.
The user may tweak the coefficient of ground elevation (a), as it seems low for general terrain to be effective
For custom theta_w, just set the value after initialization.
Default values are copied from the paper https://doi.org/10.1016/j.amc.2008.06.046, with meteorological conditions:
- Wind direction North
- Wind speed 8-10 m/s (~5 Beaufort)
- Average temperature 30 °C
- Humidity 36%
| Parameters: |
|
|---|
Source code in wildtorch/main.py
def __init__(self, p_h: float = 0.58, c_1: float = 0.045, c_2: float = 0.131, a: float = 0.078, theta_w: int = 0,
v: float = 10, p_firebreak: float = 0.9, p_continue_burn: float = 0.5,
device: torch.device = torch.device('cpu'), dtype: torch.dtype = torch.float32, ) -> None:
"""
Initialize the simulator constants with the default values.
The user may tweak the coefficient of ground elevation (a), as it seems low for general terrain to be effective
For custom theta_w, just set the value after initialization.
Default values are copied from the paper https://doi.org/10.1016/j.amc.2008.06.046,
with meteorological conditions:
- Wind direction North
- Wind speed 8-10 m/s (~5 Beaufort)
- Average temperature 30 °C
- Humidity 36%
Parameters:
p_h:
The probability that a burnable cell adjacent to a burning cell will catch fire
at the next time step under no wind and flat terrain
c_1:
The coefficient of wind velocity
c_2:
The coefficient of wind direction
a:
The coefficient of ground elevation
theta_w:
The direction of the wind in degrees, measured clockwise from north
v:
The wind velocity, unit in m/s
p_firebreak:
The probability that a burnable cell will not catch fire even if it is adjacent to a burning cell
p_continue_burn:
The probability that a burning cell will continue to burn at the next time step
device:
The device to use
dtype:
The data type to use
"""
self.device = device
self.dtype = dtype
self.p_h = torch.tensor(p_h, dtype=dtype, device=device)
self.c_1 = torch.tensor(c_1, dtype=dtype, device=device)
self.c_2 = torch.tensor(c_2, dtype=dtype, device=device)
self.a = torch.tensor(a, dtype=dtype, device=device)
self.theta = None
self.theta_w = torch.tensor(theta_w, dtype=dtype, device=device)
self.V = torch.tensor(v, dtype=dtype, device=device)
self.p_firebreak = torch.tensor(p_firebreak, dtype=dtype, device=device)
self.p_continue_burn = torch.tensor(p_continue_burn, dtype=dtype, device=device)
update_theta()
Update the wind direction matrix based on the wind direction (theta_w).
Source code in wildtorch/main.py
def update_theta(self) -> None:
"""
Update the wind direction matrix based on the wind direction (theta_w).
"""
self.theta = torch.tensor([[315, 0, 45], [270, 0, 90], [225, 180, 135]], dtype=self.dtype, device=self.device)
self.theta = torch.remainder(self.theta - self.theta_w, 360)
self.theta[1, 1] = 0