Simulate diffusion by wind advection
random_walk.Rd
This function estimates diffusion across a windscape by Markov random walk. On each iteration, the "particle mass" in each grid cell is dispersed within the local 9-cell neighborhood in proportion with wind conductance. Depending on usage, this "mass" could represent probability, number of individuals, etc. As the simulation proceeds, the mass diffuses across the landscape.
Arguments
- rose
A
wind_rose
.- init
Initial conditions from which to begin diffusion, either a two-column matrix of coordinates, or a SpatRaster layer with non-negative mass values and the same spatial properties as
rose
. If coordinates, the simulation starts with a mass of 1 at each coordinate location. If a SpatRaster, diffusion is done directly on the raster; this could be the ouput from a prior random_walk, or any other data representing quantities to be spatially dispersed.- iter
Number of simulation iterations (positive integer).
- record
Integer vector specifying which iterations to record. Default is to record only the final iteration, i.e.
iter
. One raster layer is returned for each value inrecord
.- mode
Propagation mode, either "pulse" (default) or "ratchet". See details.
- timescale
A value between 0 and 1, giving the factor by which to scale the default time step length (which is calculated from the data; see rw_max_step). At each iteration, particle mass either exits cells at the rates given in the wind rose object, or remains in the cell. The default timescale value of 1 sets the timestep length to the maximum possible value, allowing the simulation to advance as far as possible in space given the number of iterations, which is computationally optimal. Reducing this value may be useful for smoothing the simulation dynamics, and/or setting the timestep to a desired duration.
Details
The input wind rose raster is converted to a simplex of nine probabilities for each grid cell, giving the rates at which particles are retained in a cell or moved to each of its eight neighbors. Probabilities of moving to a neighboring cell are proportional to conductance in the wind rose data set, with the probabilities of remaining in a cell scaled so that the cell with the highest conductance has a zero retention probability; this allows conductance to be normalized locally to a simplex while remaining proportional across cells and maximizing the dispersal occurring at each iteration.
The `mode` argument determines how particle mass propagates over time. The default method, `"pulse"`, tracks the fleeting diffusion of the initial starting particle mass, which will drift and spread like a cloud, eventually leaving the modeling domain (unless it's a closed spatial domain). The `mode = "ratchet"` option runs a propagating simulation in which local particle mass never declines in any cell, with every location continuing to transmit mass at the cumulative maximum rate; this is more akin to a biological process in which dispersing particles reproduce locally after establishment, or in which a continuous stream of particles is released from the original source at every time step.