ruf | R Documentation |
Generate a resource use function
ruf(x, R, C)
x |
A site by species matrix |
R |
A resource state matrix |
C |
A |
Resource use functions describe the impact a species has on the state of a location. This impact will commonly be zero (for static habitat features, for example), but for many resources (e.g., nutrient concentrations) the result will be negative (i.e., species deplete resources).
This function is intended as an example, and can be replaced with a user-defined function. The function must take a site by species matrix and a resource state matrix as its first two arguments, and it must return a matrix with the same dimensions as R giving the instantaneous rate of change in each resource. The units must match whatever is being used for the reaction-transport portion of the model; often something like $g-Resource L^-1 min^-1$.
The default behaviour is for species to consume more resources the closer they are to the
niche optimum. This is done by computing the value of the niche at the current concentration
(sp$col(R) - sp$ext(R)
) using f_niche()
and taking the ratio with the niche_max
attribute
for each species. This ratio is then multiplied by the r_scale
of each species to get the rate
of change. This leads to a convenient definition of the r_scale, which is the number of units
of resources depleted by a species at its maximum growth, per unit time.
A matrix of the same dimensions as R
giving the rate of change of each resource
mc = metacommunity(nsp=3)
Q = rep(1, 4)
adj = matrix(0, nrow = 4, ncol = 4)
adj[1,2] = adj[2,3] = adj[4,3] = 1
rn = river_network(adj, Q)
st0 = matrix(seq(0, 1, length.out = length(Q)), ncol = 1, dimnames = list(NULL, 'R'))
state (rn, "resources") = st0
state(rn, "species") = community_equilibrium(rn, mc)
ruf(rn$.species[[1]], rn$.resources[[1]], mc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.