RIVERSEA WP1: a regional-island metaecosystem model.
This repo (soon a package) contains ODEs to extend EcologicalNetworksDynamics to include detritus and recycling, as well as spatial dynamics (i.e. a metaecosystem).
To play with the ecosystem model, please clone this repo and open the
draft.jl or this README.md, then copy and paste this code.
using Pkg
Pkg.activate(".")
using EcologicalNetworksDynamics, DifferentialEquations, Plots
# 2. With a dummy derivative function
include("src/utils.jl")
include("src/dudt.jl")
include("src/derivative_utils.jl")
include("src/simulate.jl")Here is an example of a nutrient-producer-consumer system with detritus and
recycling. Here, there is no external input of nutrient (turnover = 0), there
are all coming from the mineralisation of detritus (mineralisation). The
detritus are coming from the metabolic losses of consumers, their
non-assimilated food, and from natural
death (Mortality()).
#Play with simple module
base_model = default_model(
Foodweb([0 0; 1 0]),
ClassicResponse(; h = 2),
Mortality([0.2, 0.1]), # Mortality works
NutrientIntake(;
nodes = 1,
r = 1.0,
turnover = 0.0,
supply = 4.0,
concentration = .5,
half_saturation = .8
)
)
B0 = repeat([0.4], numberSN(base_model).S)
N0 = D0 = 0.4
tspan = (0, 500)
sol_enrichment = simulate_ecosystem(
base_model,
B0,
tspan[2],
N0 = N0,
D0 = D0, # Initial density of detritus
detritus_parameters = (;
input = 0.0, # External supply rate of detritus from regional pool
regional_density = 4.0, # Regional pool
loss = 0.0, # Loss rate of detritus (outside the system)
mineralisation = 0.4, # Mineralisation rate of detritus into nutrient
),
immigration_parameters = (;
input = 0.0, # Immigration rate from the regional pool
regional_density = 4.0, # Regional biomass density of species i
loss = 0.0, # Loss rate of species biomass (outside the system)
),
nutrient_extra_parameters = (;
loss = 0.0 # Loss rate of nutrient (outside the system)
),
)
plot(sol_enrichment,
label = ["Producer" "Consumer" "Nutrient 1" "Detritus"]
)
# Let's autorise some nutrient flush (loss of nutrient)
sol_nutrient_flush = simulate_ecosystem(
base_model,
B0,
tspan[2],
N0 = N0,
D0 = D0, # Initial density of detritus
detritus_parameters = (;
input = 0.0, # External supply rate of detritus from regional pool
regional_density = 4.0, # Regional pool
loss = 0.0, # Loss rate of detritus (outside the system)
mineralisation = 0.4, # Mineralisation rate of detritus into nutrient
),
nutrient_extra_parameters = (;
loss = 0.2 # Loss rate of nutrient (outside the system)
),
)
#It stabilises the dynamics
plot(sol_nutrient_flush,
label = ["Producer" "Consumer" "Nutrient 1" "Detritus"]
)Please see Lajaaiti et al. 2025 for a complete explanation of the equations.
We extended the model to an (meta-)ecosystem model. An ecosystem is a delimited system in space where transfer of energy and matter happen between organisms and non living matter.
To the difference with a community (classic food web models), an ecosystem explicitly describes the feedback between living matter and non-living matter.
Non-living matters classically features nutrients and detritus. Detritus are organic dead matter which are not directly available to primary producers and need to be mineralised,
e.g. by detritivores (together with decomposers), into nutrients. The nutrients are then used by primary producers. The Detritus are produced by living organisms by excreting or not assimilating all the food they ingest (feces), not ingesting all the food they collect (e.g.
So here, we modified the original Bioenergetic Food-Web model embedded into EcologicalNetworksDynamics.jl to incorporate ecosystem dynamics (dead biomass recycling through detritus), but also spatial dynamics by considering inputs from a regional pool/continent (Island-Continent model).
Below are the equations of the meta-ecosystem ODE system.
The entries and losses of species, nutrients, and detritus from the ecosystem:
- Entries are analogous to Nutrient dynamics:
- Species:
$I_i (B_{R,i} - B_i)$ - Nutrients:
$I_n (S_n - N_n)$ - Detritus:
$I_D (D_R - D)$ - Where
$I_*$ is the input/immigration rate from the regional pool/continent -
$B_{R, i}$ ,$D_R$ ,$S_l$ are the regional pool of species, detritus and nutrient respectively
- Species:
- Losses from the ecosystem are density dependant:
- Species:
$l_i B_i)$ - Nutrients:
$l_n N_n$ - Detritus:
$l_D D$ - Where
$l_*$ are the loss rates from the ecosystem
- Species:
- Detritus and recycling:
- Detritus locally accumulates dead biomass (see above for external fluxes) from:
- Species metabolic losses:
$\sum_i x_i B_i$ - Species natural death:
$\sum_i d_i B_i$ - Species non-assimilated food:
- Classic response version:
$$\sum_i B_i \sum_{j \in {\mathrm{prey.}}i } (1 - e_{ij}) F_{ij}$$ - Bioenergetic response version:
$\sum_i B_i \sum_{j \in {\mathrm{prey.}}i} (1 - e_{ij}) \frac{x_j y_j B_j F_{ji}}{e_{ji}}$
- Classic response version:
- Species metabolic losses:
- Detritus are mineralised into nutrients:
$m D$ , where$m$ is the mineralisation rate, each nutrient getting an equal share of the detritus mineralisation:$\frac{m D}{\sum n}$
- Detritus locally accumulates dead biomass (see above for external fluxes) from:
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No 101208188 — RIVERSEA.