ruf: Generate a resource use function

View source: R/ruf.R

rufR Documentation

Generate a resource use function

Description

Generate a resource use function

Usage

ruf(x, R, C)

Arguments

x

A site by species matrix

R

A resource state matrix

C

A metacommunity()

Details

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.

Value

A matrix of the same dimensions as R giving the rate of change of each resource

Examples

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)

flee-group/flume documentation built on Jan. 29, 2024, 6:44 p.m.