Detritus dynamics
detritus_dynamics.RdCalculates the detritus biomass at the next time step based on the current detritus biomass.
Details
The time evolution of the detritus biomass \(B\) is described by
$$dB_D/dt = P_D - c_D \cdot B_D $$
where \(c_D\) is the mass-specific rate of consumption, calculated
with detritus_consumption()and \(P_D\) is the rate at which the
rest of the system produces detritus biomass, calculate with
getDetritusProduction().
The dynamical equation is solved analytically to
$$B_D(t+dt) = B(t)\exp(-c_D \cdot dt) + \frac{P_D}{c_D} (1-\exp(-c_D \cdot dt)).$$
This avoids the stability problems that would arise if we used the Euler method to solve the equation numerically.