Volume 8, Issue 7 p. 881-886
Application
Free Access

Simulations of biomass dynamics in community food webs

Eva Delmas

Corresponding Author

Eva Delmas

Department of Biological Sciences, University of Montréal, Montréal, QC, H3C 3J7 Canada

Québec Centre for Biodiversity Sciences, Montréal, QC, H3C 3J7 Canada

Correspondence author. E-mail: [email protected]Search for more papers by this author
Ulrich Brose

Ulrich Brose

German Centre for Integrative Biodiversity Research (iDiv), Halle-Jena-Leipzig, Deutscher Platz 5e, 04103 Leipzig, Germany

Institute of Ecology, Friedrich-Schiller Universität Jena, 07743 Jena, Germany

Search for more papers by this author
Dominique Gravel

Dominique Gravel

Québec Centre for Biodiversity Sciences, Montréal, QC, H3C 3J7 Canada

Department of Biology, University of Sherbrooke, Sherbrooke, QC, J1K 2R1 Canada

Search for more papers by this author
Daniel B. Stouffer

Daniel B. Stouffer

School of Biological Sciences, University of Canterbury, Christchurch, 8140 New Zealand

Search for more papers by this author
Timothée Poisot

Timothée Poisot

Department of Biological Sciences, University of Montréal, Montréal, QC, H3C 3J7 Canada

Québec Centre for Biodiversity Sciences, Montréal, QC, H3C 3J7 Canada

Search for more papers by this author
First published: 09 December 2016
Citations: 20

Summary

  1. Food webs are the backbone upon which biomass flows through ecosystems. Dynamical models of biomass can reveal how the structure of food webs is involved in many key ecosystem properties, such as persistence, stability, etc.
  2. In this contribution, we present BioEnergeticFoodWebs, an implementation of Yodzis & Innes (The American Naturalist 139, 1151?1175, 1992) bio-energetic model, in the high-performance computing language Julia.
  3. We illustrate how this package can be used to conduct numerical experiments in a reproducible and standard way.
  4. A reference implementation of this widely used model will ease reproducibility and comparison of results across studies.

Introduction

Community and ecosystem ecologists have long sought to understand the diversity, properties and dynamics of multi-species assemblages. The characteristics of communities emerge in unpredictable ways because species influence one another through direct, and indirect, ecological interactions. Seeing that the coexistence of populations is constrained at least by feeding interactions, models of the relationship between resources and consumers have provided a useful and frequent tool in studying the theory of community dynamics. Although these modelling efforts started from simple, abstract models like those from the Lotka–Volterra family (Bacaër 2011), more tailored and parameterized models have emerged whose goal was to include a broader range of ecological and biological mechanisms, thus hopefully providing more realistic representations of empirical systems. Among these, the ‘bio-energetic’ model of Yodzis & Innes (1992) is a general representation of resource–consumer dynamics, yielding results comparable to empirical systems, while needing minimal parameters. To achieve this purpose, it uses allometric scaling of metabolic biomass production and feeding rates, meaning that the flow of biomass from a resource to its consumer depends on their body mass.

Since the work of Yodzis & Innes (1992), Chesson & Kuang (2008) have shown that the dynamics of ecological communities are driven not only by pairwise interactions but also by the fact that these interactions are embedded in larger networks, and Berlow et al. (2004) showed how disturbances affecting species biomass or density cascade up, not only to the species that they interact with but also with species up to two degrees of separation from the original perturbation. In this context, models of energy transfer through trophic interactions are better justified when they account for the entire food-web structure, such as Williams, Brose & Martinez (2007) adaptation of Yodzis & Innes (1992) model. This food-web bio-energetic model has been used, for example, to show how food web stability can emerge from allometric scaling (Brose, Williams & Martinez 2006b) or allometry-constrained degree distributions (Otto, Rall & Brose 2007) (more past uses of the model are described in Table S1, Supporting Information). Yet, although these and other studies used the same mathematical model, implementations differ from study to study and few have been released. Motivated by the fact that this model addresses mechanisms that are fundamental to our understanding of energy flow throughout food webs, we present BioEnergeticFoodWebs (Bio-Energetic Food-Webs Model), a Julia package implementing Yodzis & Innes (1992) bio-energetic model adapted for food webs (Williams, Brose & Martinez 2007) with updated allometric coefficients (Brown et al. 2004; Brose, Williams & Martinez 2006b).

This package aims to offer an efficient common ground for modelling food-web dynamics, to make investigations of this model easier, and to facilitate reproducibility and transparency of modelling efforts. Taking a broader perspective, we argue that providing the community with reference implementations of common models is an important task. First, implementing complex models can be a difficult task, in which programming mistakes will bias the output of the simulations, and therefore the ecological interpretations we draw from them. Second, reference implementations facilitate the comparison of studies. Currently, comparing studies means not only comparing results but also comparing implementations – because not all code is public, a difference in results cannot be properly explained as an error in either studies, and this eventually generates more uncertainty than it does answers. Finally, having a reference implementation eases reproducibility substancially. Specifically, it becomes enough to specify which version of the package was used, and to publish the script used to run the simulations (as we do in this manuscript). We fervently believe that more effort should be invested in providing the community with reference implementations of the models that represents cornerstones of our ecological understanding.

The model

Biomass dynamics

We implement the model as described by Brose, Williams & Martinez (2006b), which is itself explained in greater detail in Williams, Brose & Martinez (2007). This model describes the flows of biomass across trophic levels, primarily defined by body size. It distinguishes populations based on two variables known to drive many biological rates: body mass (i.e. how large an organism is, how much biomass it stocks) and metabolic type (i.e. where the organism get its biomass from and how it is metabolized). Once this distinction made, it models populations as simple stocks of biomass growing and shrinking through consumer–resources interactions. The governing equations below describe the changes in relative density of producers and consumers respectively.
urn:x-wiley:2041210X:media:mee312713:mee312713-math-0001(eqn 1)
urn:x-wiley:2041210X:media:mee312713:mee312713-math-0002(eqn 2)
where urn:x-wiley:2041210X:media:mee312713:mee312713-math-0003 is the biomass of population i, urn:x-wiley:2041210X:media:mee312713:mee312713-math-0004 is the mass-specific maximum growth rate, urn:x-wiley:2041210X:media:mee312713:mee312713-math-0005 is the net growth rate, urn:x-wiley:2041210X:media:mee312713:mee312713-math-0006 is i's mass-specific metabolic rate, urn:x-wiley:2041210X:media:mee312713:mee312713-math-0007 is i's maximum consumption rate relative to its metabolic rate, urn:x-wiley:2041210X:media:mee312713:mee312713-math-0008 is i's assimilation efficiency when consuming population j and urn:x-wiley:2041210X:media:mee312713:mee312713-math-0009 is the multi-resources functional response of i consuming j:
urn:x-wiley:2041210X:media:mee312713:mee312713-math-0010(eqn 3)

Growth rate function

The formulation of the growth rate urn:x-wiley:2041210X:media:mee312713:mee312713-math-0011 can be chosen among three possibilities (Williams 2008) that all share the general equation of urn:x-wiley:2041210X:media:mee312713:mee312713-math-0012, where s is the sum of biomass of populations in competition for a resource with carrying capacity k. The first scenario, used by Brose, Williams & Martinez (2006b), sets urn:x-wiley:2041210X:media:mee312713:mee312713-math-0013 and k = K: species only compete with themselves for independent resources. The issue with this formulation is that the biomass and productivity of the system scales linearly with the number of primary producers (Kondoh 2003). The second formulation ‘shares’ the resource across primary producers, with urn:x-wiley:2041210X:media:mee312713:mee312713-math-0014 and urn:x-wiley:2041210X:media:mee312713:mee312713-math-0015, wherein urn:x-wiley:2041210X:media:mee312713:mee312713-math-0016 is the number of primary producers. Finally, a more general solution that encompasses both of the previous functions is urn:x-wiley:2041210X:media:mee312713:mee312713-math-0017, with urn:x-wiley:2041210X:media:mee312713:mee312713-math-0018 (intraspecific competition) set to unity and urn:x-wiley:2041210X:media:mee312713:mee312713-math-0019 (interspecific competition) taking values greater than or equal to 0. Note that urn:x-wiley:2041210X:media:mee312713:mee312713-math-0020 is equivalent to the first scenario of k = K and urn:x-wiley:2041210X:media:mee312713:mee312713-math-0021.

Numerical response

In eqn (3), urn:x-wiley:2041210X:media:mee312713:mee312713-math-0022 is i's relative consumption rate when consuming j, or the relative preference of consumer i for j (McCann, Hastings & Huxel 1998; Chesson & Kuang 2008). We have chosen to implement its simplest formulation: urn:x-wiley:2041210X:media:mee312713:mee312713-math-0023, where urn:x-wiley:2041210X:media:mee312713:mee312713-math-0024 is the number of resources of consumer j. The Hill coefficient h is responsible for the hyperbolic or sigmodal shape of the functional response (Real 1977), urn:x-wiley:2041210X:media:mee312713:mee312713-math-0025 is the half saturation density and c quantifies the strength of the intraspecific predator interference – the degree to which increasing the predator population's biomass negatively affect its feeding rates (Beddington 1975; DeAngelis, Goldstein & O'neill 1975). Depending on the parameters h and c the functional response can take several forms such as type II (h = 1 and c = 0), type III (h > 1 and c = 0) or predator interference (h = 1 and c > 0).

Metabolic types and scaling

As almost all organisms’ metabolic characteristics vary predictably with body mass (Brown et al. 2004), these variations can be described by allometric relationships as described in Brose, Williams & Martinez (2006b). Hence, the per unit biomass biological rates of production, metabolism and maximum consumption follow negative power-law relationships with the typical adult body mass (Savage et al. 2004; Price et al. 2012).
urn:x-wiley:2041210X:media:mee312713:mee312713-math-0026(eqn 4)
urn:x-wiley:2041210X:media:mee312713:mee312713-math-0027(eqn 5)
urn:x-wiley:2041210X:media:mee312713:mee312713-math-0028(eqn 6)
where the subscripts P and C refer to producers and consumers populations respectively, M is the typical adult body mass, and urn:x-wiley:2041210X:media:mee312713:mee312713-math-0029, urn:x-wiley:2041210X:media:mee312713:mee312713-math-0030 and urn:x-wiley:2041210X:media:mee312713:mee312713-math-0031 are the allometric constant. To resolve the dynamics of the system, it is necessary to define a time-scale. To do so, these biological rates are normalized by the growth rate of the producers population (cf. eqn 4) (Brose, Williams & Martinez 2006b; Williams, Brose & Martinez 2007).
urn:x-wiley:2041210X:media:mee312713:mee312713-math-0032(eqn 7)
urn:x-wiley:2041210X:media:mee312713:mee312713-math-0033(eqn 8)
In eqns (1) and (2), urn:x-wiley:2041210X:media:mee312713:mee312713-math-0034 refer to the maximum consumption rate of population i relative to its metabolic rate and thus become a non-dimensional rate:
urn:x-wiley:2041210X:media:mee312713:mee312713-math-0035(eqn 9)

As the biological rates also vary with the organisms metabolic types, the maximum consumption rate of population i relative to its metabolic rate (urn:x-wiley:2041210X:media:mee312713:mee312713-math-0036) is not the same for ectotherm vertebrate (urn:x-wiley:2041210X:media:mee312713:mee312713-math-0037) and invertebrate (urn:x-wiley:2041210X:media:mee312713:mee312713-math-0038) predators; the same goes for the allometric constant urn:x-wiley:2041210X:media:mee312713:mee312713-math-0039, which causes the mass-specific metabolic rate (urn:x-wiley:2041210X:media:mee312713:mee312713-math-0040) to differ for ectotherm vertebrates (urn:x-wiley:2041210X:media:mee312713:mee312713-math-0041) and invertebrates (urn:x-wiley:2041210X:media:mee312713:mee312713-math-0042). The diet of predators also affects their assimilation efficiency (urn:x-wiley:2041210X:media:mee312713:mee312713-math-0043) which is greater for carnivores (urn:x-wiley:2041210X:media:mee312713:mee312713-math-0044) than for herbivores (urn:x-wiley:2041210X:media:mee312713:mee312713-math-0045).

Based on the observation that most natural food webs have a constant size structure (Brose et al. 2006a; Hatton et al. 2015), the consumer–resource body-mass ratio (Z) is assumed to be constant. The body mass of consumers is then a function of their mean trophic level (T), and it increases with trophic level when Z ≥ 1 and decreases when Z ≤ 1:
urn:x-wiley:2041210X:media:mee312713:mee312713-math-0046(eqn 10)
where urn:x-wiley:2041210X:media:mee312713:mee312713-math-0047 is the body mass of consumers, normalized by the body mass of the basal species (T = 1) to make the results independent of the body mass of the basal species.

Setting the simulation parameters

All of these parameters can be modified before running the simulations (see ?model_parameters), and are saved alongside the simulation output for future analyses. The default values and meanings of the different parameters are explained in the documentation of the model_parameters function. The user can specify which species are ectotherm vertebrates by supplying an array of boolean values, and the body mass of each species by supplying an array of floating-point values.

Saving simulations and output format

The core function simulate performs the main simulation loop. It takes two arguments, p – the dictionary generated through the model_parameters function and containing the entire set of parameters – and biomass, a vector that contains the initial biomasses for every population. Three keywords arguments can be used to define the initial (start) and final (stop) times as well as the integration method (use, see ?simulate or the online documentation for more details on the numerical integration methods available). This function returns an object with a fixed format, made of three fields: :p has all the parameters used to start the simulation (including the food web itself), :t has a list of all timesteps (including intermediate integration points), and :B is a matrix of biomasses for each population (columns) over time (rows). All measures on output described below operate on this object.

The output of simulations can be saved to disc in either the JSON (javascript object notation) format, or in the native jld format. The jld option should be preferred as it preserves the structure of all objects (JSON should be used when the results will be analysed outside of Julia, for example in R). The function to save results is called BioEnergeticFoodWebs.save (note that the prefix BioEnergeticFoodWebs. is mandatory, to avoid clashes with other functions called save in base Julia or other packages).

Measures on output

The BioEnergeticFoodWebs package implements a variety of measures that can be applied on the objects returned by simulations. All measures take an optional keyword argument last, indicating over how many timesteps before the end of the simulations the results should be averaged.

Total biomass (total_biomass) is the sum of the biomasses across all populations. It is measured based on the populations biomasses (population_biomass).

The number of remaining species (species_richness) is measured as the number of species whose biomass is larger than an arbitrary threshold. As BioEnergeticFoodWebs uses robust adaptive numerical integrators (such as ODE45 and ODE78), the threshold default value is ε, i.e. the upper bound of the relative error due to rounding in floating point arithmetic. In short, species are considered extinct when their biomass is smaller than the rounding error. For floating point values encoded over 64 bits (IEEE 754), this is around urn:x-wiley:2041210X:media:mee312713:mee312713-math-0048. An additional output related to species_richness is species_persistence, which is the number of persisting species divided by the starting number of species. A value of species_persistence of 1 means that all species persisted. A value of species_persistence of 0 indicates that all species went extinct.

Shannon's entropy (foodweb_evenness) is used to measure diversity within the food web. This measure is corrected for the total number of populations. This returns values in ]0;1], where 1 indicates that all populations have the same biomass. It is measured as
urn:x-wiley:2041210X:media:mee312713:mee312713-math-0049(eqn 11)
where n is the number of populations, and b are the relative biomasses (urn:x-wiley:2041210X:media:mee312713:mee312713-math-0050).

Finally, we used the negative size-corrected coefficient of variation to assess the temporal stability of biomass stocks across populations (Tilman 1995) (population_stability). This function also accepts an additional threshold argument, specifying the biomass below which populations are excluded from the analysis. For the same reason as for the species_richness threshold, we suggest that this value be set to either the machine's ε(0·0) (i.e. the smallest value immediately above 0·0 that the machine can represent), or to 0·0. We found that using either of these values had no qualitative bearing on the results described below. Values close to 0 indicate little variation over time, and increasingly negative values indicate larger fluctuations (relative to the mean standing biomass).

Implementation and availability

The BioEnergeticFoodWebs package is available for the Julia programming language, and it is continuously tested on the current version of Julia, the release immediately before and on the current development version. Julia is an ideal platform for this type of models, as it is easy to write, designed for numerical computations, extremely fast, easily parallelized and has good numerical integration libraries. The package can be installed from the Julia REPL using Pkg.add("BioEnergeticFoodWebs"). A user manual and function reference is available online at http://poisotlab.io/BioEnergeticFoodWebs.jl/latest/, which also gives instructions about installing Julia, the package, and how to get started.

The code is released under the MIT license. This software note describes version 0.2.0. The source code of the package can be viewed, downloaded, and worked on at https://github.com/PoisotLab/BioEnergeticFoodWebs.jl. Potential issues with the code or package can be reported through the Issues system or at https://gitter.im/PoisotLab/BioEnergeticFoodWebs.jl. The code is version-controlled, undergoes continuous integration, and has a code coverage of approximately 90% to this date.

Use cases

All functions in the package have an in-line documentation available at http://poisotlab.io/BioEnergeticFoodWebs.jl/latest/, as well as from the Julia interface by typing ? followed by the name of the function. In this section, we will describe three of the aforementioned use cases. The code to execute them is attached as Data S1. As all code in Data S1 uses Julia's parallel computing abilities, it will differ slightly from the examples given in the paper. For all figures, each point is the average of at least 500 replicates. We conducted the simulations in parallel on 50 Intel Xeon cores at 2·00 Ghz. All random networks were generated using the implementation of the niche model of food webs (Williams & Martinez 2000), also provided in BioEnergeticFoodWebs.

Effect of carrying capacity on diversity

Starting from networks generated with the niche model with 20 species and connectance of 0·15 ± 0·01, we investigate the effect of increasing the carrying capacity of the resource (on a log scale from 0·1 to 10). We use three values of the urn:x-wiley:2041210X:media:mee312713:mee312713-math-0051 parameter, ranging from 0·92 (the interspecific competition is smaller than the intraspecific competition, which should favour coexistence), neutrally stable (intra- = interspecific competition = 1), to 1·08 (the intraspecific competition is smaller the interspecific competition, which should favour competitive exclusion).

We run the simulations with the default parameters (given in ?model_parameters, and in the manual). Each simulation consists of the following code:

  • # We generate a random food web

  • A=nichemodel(20,0.15, tolerance=0.01, toltype=:abs)

  • # Prepare the simulation parameters

  • for a in linspace(0.92, 1.08, 3)

  • for K in logspace(1, 1, 9)

  • p = model_parameters(A, α = a,

  • K=K,

  • productivity=:competitive)

  • # We start each simulation with

  • # random biomasses in ]0;1[

  • bm = rand(size(A, 1))

  • # And finally, we simulate.

  • out = simulate(p, bm, start=0, stop=2000, use=:ode45)

  • # And measure the output

  • diversity = foodweb_evenness(out,

  • last=1000,

  • threshold=eps())

  • end

  • end

The results are presented in Fig. 1.

Details are in the caption following the image
Effect of increasing the carrying capacity of the resource for different levels of competition (α ∈ [0·9,1·1]). For conditions of neutral coexistence or coexistence (α ≤ 1), diversity is stable until K ≈ 5. For conditions of competition exclusion (α > 1), diversity increases for K<5, and decreases after.

Effect of consumer–resource body-mass ratio on stability

In Fig. 2, we illustrate how the effect of body-mass ratio differs between food webs with invertebrates and ectotherm vertebrate consumers.

Details are in the caption following the image
The peak of stability, in terms of allometric scaling, differs between vertebrates and invertebrates. Note that the y axis is reversed, as more negative values indicate less variation, and therefore more temporal stability. The shaded area represents negative scaling, i.e. predators are smaller than their preys.

The body-mass ratio is controlled by the parameter Z (field Z in the code), and can be changed in the following way:

  • scaling = logspace(-2, 4, 19) #creates an array with 19 body-mass ratio values

  • # Prepare the simulation parameters

  • p=model_parameters(A, Z=scaling[i]) # where i is a number from 1 to 19

Which species is an ectotherm vertebrate is controlled by the parameter vertebrate of model_parameters, which is an array of boolean (true/false) values. In order to have all consumers be ectotherm vertebrates, we use

vert = round(Bool,trophic_rank(A).>1.0)

so that for each network, we prepare the simulations with

  • # Prepare the simulation parameters

  • for i in 1:size(scaling, 1)

  • p = model_parameters(A, Z=scaling[i],

  • vertebrates=vert)

  • end

  • # where i is a number from 1 to 19, as there are 19 body-mass ratio values in the

  • # scaling array

Effect of connectance on coexistence

We investigate the effect of connectance on species coexistence under different scenarios of interspecific competition rates between producers (Fig. 3). These simulations therefore measure how the persistence of the entire food web is affected by competition at the most basal trophic level. The persistence is used here as the measure of coexistence.

  • for co in vec([0.05 0.15 0.25])

  • # We generate a random food web

  • A = nichemodel(20, co, tolerance = 0.01, toltype =:abs)

  • # Prepare the simulation parameters

  • for a in linspace(0.8, 1.2 , 7)

  • p = model_parameters(A, α = a,

  • productivity=:competitive)

  • bm = rand(size(A, 1))

  • # And finally, we simulate.

  • out = simulate(p, bm, start=0, stop=2000, use=:ode45)

  • # And measure the output

  • persistence = species_persistence(out,

  • last=1000,

  • threshold=eps())

  • end

  • end

Values of α larger than 1 should result in competitive exclusion in the absence of trophic interactions (Williams 2008). Indeed, this is the case when Co=0·05 (only a single consumer remains). Increasing connectance results in more species persisting.

Details are in the caption following the image
Although maximal species persistence is reached for values of interspecific competition lower than unity, the increased trophic control at higher connectances allow coexistence even under stronger competition. The shaded area represents values of α smaller than unity, i.e. coexistence is favoured.

Conclusion

We have presented BioEnergeticFoodWebs, a reference implementation of the bio-energetic model applied to food webs. We provided examples that can serve as templates to perform novel simulation studies or use this model as an effective teaching tool. Because the output can be exported in a language-neutral format (JSON), the results obtained with this model can be analysed in other languages that are currently popular with ecologists, such as R, python, or MatLab. Because we provide a general implementation that covers some of the modifications made to this model over the years, there is a decreased need for individual scientists to start their own implementation, which is a both a time consuming and potentially risky endeavour.

Authors’ contributions

Authors E.D. and T.P. contributed most of the code, which is based on a preliminary C version by D.G., and was modified during discussions with U.B. and D.B.S.

Acknowledgements

T.P. acknowledges financial support from NSERC, and an equipment grant from FRQNT. We thank the developers and maintainers of ODE.jl.

    Data accessibility

    No data were used in this manuscript.