Allows you to add any number of unstructured resource components to an existing MizerParams object. Such unstructured components are appropriate whenever the predation on these components is not size based. Examples include detritus as a resource for detritivores, carrion as a resource for scavengers, or macroflora on which fish can graze.
setUR(params, dynamics, dynamics_params = list(), rho = NULL)
params | A MizerParams object |
---|---|
dynamics | A named list of functions that determine the dynamics of the unstructured resources by calculating their biomasses at the next time step from the current state. Details are described in the section "Setting resource dynamics". |
dynamics_params | A named list of parameters needed by the
|
rho | Optional. An array (species x resource x size) holding the rate at which a fish of a particular species and of a particular size feeds on each resource. Described in the section "Setting resource encounter rate". |
A MizerParams object
During a simulation using project()
, the biomasses of the resources are
updated at each time step by calling the functions specified in the
dynamics
list. This list should have one named entry for each unstructured
resource component, giving the name of the function as a string.
Mizer provides two example functions that you can use to model resource
dynamics: detritus_dynamics()
and carrion_dynamics()
, but you can easily
implement others by following those templates.
As you can see in the documentation of these functions, their arguments are:
the MizerParams
object params
, the current fish size spectra n
, the
current plankton spectrum n_pp
, the abundances of any other components
'n_other', the current rates calculated by the getRates()
function rates
,
the current time t
and the size of the time step dt
.
The other arguments to the resource dynamics functions are model parameters,
like for example growth rates. These need to be provided in the
dynamics_params
argument which is a named list. One model parameter that
should always be present in this list is the rate of change due to external
causes. This should be given a name of the form resource_external
where
resource
should be replaced by the name of the resource, see for example
detritus_external
in detritus_dynamics()
.
When writing your own resource dynamics functions, you can choose any names for your other model parameters, but you must make sure not to use the same name in the function for another resource component. One way to ensure this is to prefix all parameter names with your resource name.
The dynamics for a resource should always have a loss term accounting for
the consumption of the resource. The contribution to this loss arising from
consumption by fish should be calculated with
getConsumptionByFish
.
The resource encounter rate \(\rho_{id}(w)\) (units 1/year) determines the rate at which an individual of species \(i\) encounters biomass of resource \(d\), so that the contribution from all unstructured resources to the total encounter rate is $$E_{u.i}(w) = \sum_d\rho_{id}(w) B_d,$$ where \(B_d\) is the biomass of the d-th unstructured resource component.
Resource consumption is subject to satiation in the same way as other food, so that a consumer only consumes a fraction \(1-f_i(w)\) of the encountered resource biomass, where \(f_i(w)\) is the feeding level.
If the rho
array is not supplied, then the resource encounter rate is
set to a power law
$$\rho_{id}(w) = \rho_{id} w^n.$$
The coefficients \(\rho_{id}\) are parameters in the
params@species_params
dataframe. For example if there is a resource
called "detritus" then the species_params data frame needs to have a column
called rho_detritus
and similarly for each other resource.
If the rho
array is supplied, the ordering of the entries in the array
is important. The order of the species in the first array dimension needs to
be the same as that in the species parameter dataframe. The order of the
resources in the second array dimension must be the same as in the list of
resource dynamics. The third dimension is the size dimension.