Sets the intrinsic resource growth rate and the intrinsic resource carrying capacity as well as the name of the function used to simulate the resource dynamics

setResource(
  params,
  resource_rate = NULL,
  resource_capacity = NULL,
  r_pp = resource_params(params)[["r_pp"]],
  kappa = resource_params(params)[["kappa"]],
  lambda = resource_params(params)[["lambda"]],
  n = resource_params(params)[["n"]],
  w_pp_cutoff = resource_params(params)[["w_pp_cutoff"]],
  resource_dynamics = NULL,
  ...
)

getResourceRate(params)

getResourceCapacity(params)

getResourceDynamics(params)

Arguments

params

A MizerParams object

resource_rate

Optional. Vector of resource intrinsic birth rates

resource_capacity

Optional. Vector of resource intrinsic carrying capacity

r_pp

Coefficient of the intrinsic resource birth rate

kappa

Coefficient of the intrinsic resource carrying capacity

lambda

Scaling exponent of the intrinsic resource carrying capacity

n

Allometric growth exponent for resource

w_pp_cutoff

The upper cut off size of the resource spectrum. Default is 10 g.

resource_dynamics

Optional. Name of the function that determines the resource dynamics by calculating the resource spectrum at the next time step from the current state. You only need to specify this if you do not want to use the default resource_semichemostat().

...

Unused

Value

A MizerParams object with updated resource parameters. Because of the way the R language works, setResource() does not make the changes to the params object that you pass to it but instead returns a new params object. So to affect the change you call the function in the form params <- setResource(params, ...).

Setting resource dynamics

By default, mizer uses a semichemostat model to describe the resource dynamics in each size class independently. This semichemostat dynamics is implemented by the function resource_semichemostat(). You can change the resource dynamics by writing your own function, modelled on resource_semichemostat(), and then passing the name of your function in the resource_dynamics argument.

The resource_rate argument is a vector specifying the intrinsic resource growth rate for each size class. If it is not supplied, then the intrinsic growth rate \(r(w)\) at size \(w\) is set to $$r(w) = r_{pp}\, w^{n-1}.$$ The values of \(r_{pp}\) and \(n\) are taken from the r_pp and n arguments.

The resource_capacity argument is a vector specifying the intrinsic resource carrying capacity for each size class. If it is not supplied, then the intrinsic carrying capacity \(c(w)\) at size \(w\) is set to $$c(w) = \kappa\, w^{-\lambda}$$ for all \(w\) less than w_pp_cutoff and zero for larger sizes. The values of \(\kappa\) and \(\lambda\) are taken from the kappa and lambda arguments.

See also