1 Introduction

One of the goals of mathematical modeling of ecological systems is to understand the fate or long-term dynamics of such system. The main method to study such fate has been through the analysis of the attractors in a model (Ives and Carpenter 2007). Recent years have seen an increase in the interest of understanding non-attractor dynamics (hereafter transients) of the models, especially those that resemble an attractor for a long period of time (hereafter long transients) (Hastings et al. 2018). Long transients have gained recognition as a theoretical tool to better describe population dynamics by allowing the study of dynamics that occur in a more biologically relevant timeframe (Morozov et al. 2020). In addition, an understanding of long transients can inform conservation and natural resource management goals. For example, identifying that a positively valued long-term behavior observed in nature is actually a long transient and what causes it can guide management to prolong it (Francis et al. 2021).

Long transients often appear in the presence of a “small” (close to zero) parameter in the model (Morozov et al. 2020). One of the main challenges of identifying long transients is identifying such a small parameter, which may be a function of the biologically reasonable parameters, and thus may not be easily interpretable. For example, in ghost attractors, this small parameter is the difference between a bifurcation parameter and its bifurcation value (Morozov et al. 2020). While varying the parameter past such bifurcation leads to the destruction of an attractor, small differences the transient dynamics will resemble the attractor. In crawl-by attractors, the small parameter is determined by the degree to which the trajectory of the system is parallel to the stable manifold of a saddle node equilibrium at a given time (Morozov et al. 2020). In this case the system will behave similarly to such a stable manifold for a prolonged period of time before the unstable part of the trajectory leads to a change in the system behavior.

One behavior that has been demonstrated to lead to long transients in consumer–resource systems is group defense (Venturino and Petrovskii 2013). Group defense is a behavior where a resource population reduces the risk of individuals being predated by protecting each other. This behavior occurs in diverse animal taxa, which produce early-warning signals to detect predators, as is the case of colonial spiders (Uetz et al. 2002), birds, (Robinson 1985), and mammals (Ebensperger and Wallem 2002). This behavior also occurs in producers such as kelp, where high densities of kelp lead to an increase in predators of kelp grazers, which induces cryptic behavior on such grazers and thus reduces grazing intensity (Karatayev et al. 2021).

Group defense transients might also depend on lags in population growth caused by discrete reproductive pulses. In some taxa that exhibit group defense, adult stages of the population may reproduce in discrete, seasonal pulses, such as is the case of kelp (Karatayev et al. 2021) or bees (Kastberger et al. 2008). This can provide individuals to a population decades after stressful events which cause population declines, such as competitive exclusion of pioneer species in tropical rain forests (Dalling and Brown 2009), or extreme weather events in phytoplankton (Ellegaard and Ribeiro 2018).

In this paper we characterize the long transients in a consumer–resource with both group defense and reproductive pulses. We first construct the model that describes a consumer–resource interaction where the resource exhibits group defense and has discrete reproductive pulses. Then, to illustrate the long transients present in this model, we identify a small parameter that describes each of the transients (crawl-by and ghost attractor), and we use this parameter to calculate the time the system remains in this long transient (hereafter transient time). Finding approximations for these parameters and transient times provides biological insight into how these long transients may arise in natural systems with the modeled dynamics. We conclude this paper with a discussion of these results and their biological implications.

2 Model

In this section we construct a consumer–resource model with group defense and discrete reproductive pulses. We previously explored a spatial, non-smooth version of this model to understand spread of kelp being grazed by urchins (Arroyo-Esquivel et al. 2021). We consider the dynamics of adult consumer P and adult resource N densities through time. Adults of population \(i=P,N\) experience a natural mortality at a rate \(d_i\). In addition, consider that consumers consume resource following a unimodal Type IV Holling functional response that represents group defense with a decline in consumption at high resource densities (Andrews 1968). We let \(\gamma _N\) be the attack rate of the consumer, and the maximum per-capita resource consumption occurs when \(N=\frac{1}{\sqrt{\sigma _N}}\).

Reproduction and recruitment of juvenile stages occur at discrete points in time. We model this recruitment as an impulsive differential equation. Let \(t=m\) be the periods at which the offspring recruit to the population. The number of consumer recruits is proportional to the amount of resource consumed at time \(t=m\) with proportionality constant \(\gamma _P\). Resource produce a per-capita number R of recruits. We assume that \(R>1-\exp (-d_N)\) in order to have a self-replenishing resource in the absence of consumers. For predation, a fraction of those offspring survive consumption with a probability following an exponential distribution with mean \(\frac{1}{\gamma _S}\). Resource offspring also survive intracompetition from adults with carrying capacity proportional to \(\frac{1}{\beta }\).

Then, given \(P_{m+1}^-\) as the density of consumers before the pulse and \(P_{m+1}^+\) its density after the pulse (with analogous notation for resource, \(N_{m+1}^-\) and \(N_{m+1}^+\)), the dynamics of the adult consumer and resource populations satisfy the following system of impulsive differential equations:

$$\begin{aligned} \begin{aligned} \frac{\mathrm{d} P}{\mathrm{d} t}&=-d_PP,\\ \frac{\mathrm{d} N}{\mathrm{d} t}&=-\frac{\gamma _N PN}{1+\sigma _N N^2}-d_NN,\\ P^+_{m+1}&=P^-_{m+1}+\gamma _P\frac{P^-_{m+1}N^-_{m+1}}{1+\sigma _N N^{-2}_{m+1}},\\ N^+_{m+1}&=N^-_{m+1}+R\frac{\exp \left( -\gamma _S P^-_{m+1}\right) }{1+\beta N^-_{m+1}}N^-_{m+1}. \end{aligned} \end{aligned}$$
(1)

We next transform Model 1 into a discrete-time model. We can rewrite the continuous part of the Model 1 as

$$\begin{aligned} \begin{aligned} \frac{1}{P}\frac{\mathrm{d} P}{\mathrm{d} t}&=-d_P,\\ \frac{1}{N}\frac{\mathrm{d} N}{\mathrm{d} t}&=-\frac{\gamma _N P}{1+\sigma _N N^2}-d_N. \end{aligned} \end{aligned}$$
(2)

Following the derivation of Cui et al. (2016), we discretize System 2 as

$$\begin{aligned} \begin{aligned} P_{m+1}&=P_m\exp (-d_P),\\ N_{m+1}&=N_m\exp (-d_N)\exp \left( -\frac{\gamma _N\exp (-d_P) P_m}{1+\sigma _N N_m^2}\right) . \end{aligned} \end{aligned}$$
(3)

By taking \(\delta _P=\exp (-d_P),\delta _N=\exp (-d_N)\) and using \(P_{m+1}^-=P_m\) and \(N_{m+1}^-=N_m\) as described in System 1, we arrive the following discrete-time model:

$$\begin{aligned} \begin{aligned} P_{m+1}&=\delta _P P_m+\gamma _P\frac{P_{m}N_m}{1+\sigma _N N_{m}^2},\\ N_{m+1}&=\delta _NN_m\exp \left( -\frac{\gamma _N\delta _P P_m}{1+\sigma _N N_m^2}\right) \\ {}&\quad +R\frac{\exp \left( -\gamma _S P_m\right) }{1+\beta N_m}N_m. \end{aligned} \end{aligned}$$
(4)

To simplify our analysis, we will study a nondimensional version of the model. For each m, let \(p_m=\gamma _SP_m,n_m=\beta N_m\). Then, if \(\gamma _p=\gamma _P/\beta ,\gamma _n=\gamma _N\delta _P/\gamma _S,\sigma =\sigma _N/\beta ^2\), our nondimensional version of the model is

$$\begin{aligned} \begin{aligned} p_{m+1}&=\delta _p p_m+\gamma _p\frac{p_{m}n_m}{1+\sigma n_{m}^2},\\ n_{m+1}&=\delta _nn_m\exp \left( -\frac{\gamma _n p_m}{1+\sigma n_m^2}\right) +Rn_m\frac{\exp \left( - p_m\right) }{1+n_m}. \end{aligned} \end{aligned}$$
(5)

Note that we have also changed the indices of \(\delta _i\) and \(k_i\) in order to preserve clarity.

3 Analysis and Results

In this section we characterize the dynamics of Model 5 and its potential for long transient dynamics. We identify two different classes of long transients, a crawl-by transient around the extinction of resource and another around the carrying capacity of the resource, and a ghost consumer–resource cycle. To illustrate the transients identified and test the accuracy of our analytical approximations, we also characterize all transients numerically by iterating the logarithm of Model 5 in Julia, where the used, fixed parameters and initial conditions are specified as relevant to each analysis below. Based on preliminary numerical simulations in double-precision floating-point numbers, we find that iterating the logarithm of Model 5 instead of the original model prevents numerical instabilities potentially occurring at long-transients near zero by reducing the range of the derivative near zero. The source code for these simulations can be found in https://github.com/jarroyoe/characterizing-transients. We analytically derive approximations for the transient time of the crawl-by transients using perturbation theory, while we numerically analyze the ghost attractor transient time by regressing the transient time using a power law, which we describe further in Section 3.b.

Before we characterize these long transients, we first analyze the equilibria of the model. This model has up to four biologically relevant fixed points: a resource-only carrying capacity equilibrium \((0,n^*)\), an unstable extinction equilibrium (0, 0), and two possible unstable coexistence saddle equilibria \((p^{\vee \wedge },n^{\vee \wedge })\). We assume that the carrying capacity of resource is greater than the density at which consumption growth is its highest, i.e., \(n^*>1/\sqrt{\sigma }\), such that group defense is relevant to resource populations below carrying capacity. Under this condition, the equilibria \((0,n^*)\) and \((p^\wedge ,n^\wedge )\) go through a transcritical bifurcation at

$$\begin{aligned} \gamma _p^*=(1-\delta _p)\frac{1+\sigma n^{*2}}{n^*}. \end{aligned}$$
(6)

In this case, the equilibria \((0,n^*)\) is stable for \(\gamma _p<\gamma _p^*\) and unstable for \(\gamma _p>\gamma _p^*\), and the equilibrium \((p^{\wedge },n^{\wedge })\) is unstable for \(\gamma _p<\gamma _p^*\) and is not in the first quadrant (i.e., \(\mathbb {R}^2_+\)) for \(\gamma _p>\gamma _p^*\). See Appendix A for the expressions of these equilibria and their stability. This analysis allows us to better understand the nature of the transients we have identified.

3.1 Crawl-by Transients

Fig. 1
figure 1

Time series in logarithmic scale of a consumers \(p_m\) and b resource \(n_m\) following System 5 for 200 time steps (m). In this figure, \(p_0=10,n_0=1,\delta _p=0.9,\gamma _p=1,\sigma =2.67,\delta _n=0.8,\gamma _n=1,R=2\).

Although the coextinction equilibrium is a saddle in the n-direction (which implies that n will stay above 0), System 5 can resemble a system where the resource is extinct for a long period of time when consumer density is high (Fig. 1). This is an example of a long crawl-by transient. We determine how prevalent this behavior is in the following theorem, proven in Appendix B.

Theorem 1

Let \(\varepsilon \ll 1\). If \(p_0\) is of order \(\varepsilon ^{-1}\) and \(n_0\) of order 1, then System 5 goes through a crawl-by transient at the extinction of resource \(n=0\). Recovery of resource will begin after a time of approximately

$$\begin{aligned} M=O\left( \frac{\log (\varepsilon )}{\log (\delta _p)}\right) . \end{aligned}$$
(7)
Fig. 2
figure 2

Observed resource recovery time (circles) and estimated recovery time using Eq. 29 (solid line) in System 5 as a function of initial consumer density \(p_0\). In this figure, \(\delta _p=0.9,\gamma _p=1,\sigma =2.67,\delta _n=0.8,\gamma _n=1,R=2\).

In Fig. 2 we show that Eq. 7 is a reasonably close estimator of the observed point of recovery, especially for large values of the initial consumer density \(p_0\), where the consumer density is an order of magnitude higher than the initial resource density \(n_0\). We will show in the following theorem that the long-term dynamics shown in Fig. 1 did not depend on the initial conditions of the model.

Theorem 2

System 5 has a compact, connected global attractor in the first quadrant \(M=\{(p,n)\in \mathbb {R}^2:p\ge 0,n\ge 0\}\).

See Appendix C for the proof of this theorem. Theorem 2 implies that, when \(\gamma _p<\gamma _p^*\), System 5 will go towards carrying capacity of resource and extinction of consumers. On the other hand, when \(\gamma _p>\gamma _p^*\), there are no stable fixed points in the first quadrant. Thus, Theorem 2 implies the existence of a nonlinear attractor, which we can describe based on numerical observations, as shown in Fig. 3.

Fig. 3
figure 3

Time series of consumers \(p_m\) (a and c) and resource \(n_m\) b and d following System 5 for 5000 time steps (m). In this figure, \(p_0=10,n_0=1,\delta _p=0.9,\sigma =2.67,\delta _n=0.8,\gamma _n=1,R=2,\) and the consumer conversion intensity \(\gamma _p=3\) (a and b) and \(\gamma _p=8\) (c and d).

When \(\gamma _p>\gamma _p^*\), the resource population is able to reach a maximum density of carrying capacity and stay there for a prolonged period of time (Fig. 3). However, after the consumer reaches a high enough density, the resource population collapses and passes through a transient extinction phase. This cycle repeats itself through time, but at each repetition, the amplitude of consumer density varies. We hypothetize that this variation in amplitude is caused by the system having a long periodicity. In addition, increasing \(\gamma _p\) increases the period between each oscillation. This is consistent with the implication from Theorem 1 that a higher consumer density causes the resource to stay around the extinction equilibrium for a longer period of time.

Figure 3 also shows that the system can stay around the resource-only equilibrium for a prolonged time. We approximate this time in the following theorem, proven in Appendix D.

Theorem 3

Let \(\gamma _p>\gamma _p^*\), where \(\gamma _p^*\) is defined by Eq 6 and let

$$\begin{aligned} \lambda _1=\delta _p+\gamma _p\frac{n^*}{1+\sigma n^{*2}}. \end{aligned}$$
(8)

Then, if \((p_0,n_0)=(\varepsilon ,n^*-\varepsilon )\) for \(0<\varepsilon \ll 1\), System 5 goes a crawl-by transient at the resource-only equilibrium \(n=n^*\). resource will start decaying after a time of approximately

$$\begin{aligned} M=O\left( \frac{\log \left( \frac{1}{\varepsilon }\right) }{\log (\lambda _1)}\right) . \end{aligned}$$
(9)

In Fig. 4 we show that this expression is a reasonably close approximation of the time it takes for the consumer to escape extinction across a wide range of orders of magnitude for the initial consumer density.

Fig. 4
figure 4

Observed escape time of consumer extinction (circles) and estimated recovery time using Equ 45 (solid line) in System 5 as a function of initial consumer density \(p_0\). In this figure, \(\delta _p=0.9,\gamma _p=1,\sigma =2.67,\delta _n=0.8,\gamma _n=1,R=2\).

3.2 Ghost Attractors

Theorem 2 ensures that, when \(\gamma _p<\gamma _p^*\), System 5 will converge to the stable equilibrium \((0,n^*)\). However, when \(\gamma _p^*-\gamma _p\ll 1\), this convergence can take a significantly longer time, as can be seen in Fig. 5. Before the system reaches the equilibrium, the dynamics resemble pseudo-oscillations similar to those observed in Fig. 3 when \(\gamma _p>\gamma _p^*\).

Fig. 5
figure 5

Time series of a consumers \(p_m\) and b resource \(n_m\) following System 5 for 10000 time steps. In this figure we consider \(p_0=10,n_0=1,\delta _p=0.9,\gamma _p=0.9912\gamma _p^*,\sigma =2.67,\delta _n=0.8,\gamma _n=1,R=2\). Although we know that the system will converge to the equilibrium point, this convergence takes over 5000 time steps.

Given limitations of available analytical tools for exact derivation of limit cycles in discrete-time models, we approximate the time spent in the ghost attractor \(\tau \) by considering a power law for the time spent in a limit cycle (Medeiros et al. 2017):

$$\begin{aligned} \tau (\gamma _p)= A(\gamma _p^*-\gamma _p)^{-B}. \end{aligned}$$
(10)

Whenever \(n_M>n^\wedge \) and \(p_M<p^\wedge \), System 5 shows that \(n_{k+1}>n_k\) and \(p_{k+1}<p_k\) for all \(k>M\). Therefore, we identify the time the system escapes the ghost attractor as \(\tau =\min \{M:n_M>n^\wedge ,p_M<p^\wedge \}\). Figure 6 shows that this approximation using the power law provides a reasonable approximation.

Fig. 6
figure 6

Approximation of transient time (\(\tau \)) following Eq. 10, where \(\varepsilon =\gamma _p^*-\gamma _p\). In this figure, \(p_0=10,n_0=1,\delta _p=0.9,\sigma =2.67,\delta _n=0.8,\gamma _n=1,R=2\).

4 Discussion

In this work we have identified two types of long transients, crawl-by transients and ghost attractors, that can appear in a consumer–resource system with group defense with discrete reproductive pulses. Our long-term dynamics are qualitatively different from those found in Cui et al. (2016), where they identified a variety of bifurcations and chaotic dynamics. The key differences between the two models are that, while that of Cui et al. (2016) models reproduction as a continuous process and integrates the density-dependent growth for a case with overcompensation in discrete time, our model considers reproduction as a discrete event and has a saturating density-dependent function. The model in Cui et al. (2016) is a discrete-time model similar to the Ricker model, where increased reproduction rates lead to unstable dynamics (Ricker 1954). When modeling reproduction as a discrete process with saturating (Beverton–Holt style) density dependence rather than overcompensation, our analysis did not suggest that increased reproduction numbers leads to instabilities in our model.

In addition, discrete reproduction events are one of the main reasons we see the long transients analyzed in this model. The crawl-by transient observed at high consumer densities (Theorem 1) is caused by a sudden crash in the adults of the resource population, which is followed by a slow crash of the consumer population due to its inability to find enough resource for self-replacement. Although the adult resource population is almost nonexistent, the few remaining individuals eventually lead to an increase the resource population when the consumer population becomes small enough.

The other reason long transients appear in this model is due to the self-replacement of consumers depending on the ability of resource to defend themselves. The Type IV Holling functional response produces a bifurcation on the proportionality constant \(\gamma _p\) at the value \(\gamma _p^*\) given by Eq. 6. This constant can be associated with the conversion capability of consumers, i.e., the amount of energy invested in reproduction activities. When the conversion capability of consumers is too small (\(\gamma _p<\gamma _p^*\)), group defense of resource will prevent self-replacement of consumers at high resource densities, which will lead to collapse of consumers. When this conversion capability is high enough, self-replacement can be satisfied, and the consumer–resource cycles of Fig. 3 will occur. These cycles and their condition for existence resemble those found in other models where a mechanism of group defense of resource is considered (Ajraldi et al. 2011; Venturino 2011; Venturino and Petrovskii 2013).

In the case where the system presents consumer–resource cycles, the resource-dominated phase will include a crawl-by transient when the conversion capability is close to this bifurcation value (Theorem 3). This will follow by a crash of the resource population, where the consumer-dominated phase appears and presents the crawl-by transient previously described. This behavior presents an alternative perspective to the concept of alternate stable states (Beisner et al. 2003), where the different “alternative stable states” constitute long transients, which may resemble stable states during a long period of time, which then transition into the other phase and stay in a different long transient. In reality, stochasticity may render this juvenile survival when rare impossible or accelerate consumer death, which may lead the model to a stable state in a shorter period of time (Reimer et al. 2021).

When the conversion capability of consumers is smaller than the critical value \(\gamma _p^*\) but close to it, these quasiperiodic orbits do not disappear completely and stay as ghost attractors. This ghost attractor stays until the resource density surpasses a given threshold (the equilibrium value \(n^\wedge \)) and the system enters the basin of attraction of the resource-only equilibrium. The emergence of this ghost attractor is caused by group defense, because in its absence (\(\sigma =0\)), the unstable equilibria that cause the quasiperiodic orbits \((p^{\vee \wedge },n^{\vee \wedge })\) do not exist. In their absence, resource population density will consistently increase and the consumer density decrease.

The estimation of the transient time of the ghost attractor shows one of the limitations of our analysis, as the theory to study limit cycles in discrete-time systems is not developed enough to precisely analyze the transient time of this ghost attractor. Given the seasonality of the reproduction and recruitment for many organisms (Arreguin-Sanchez 1992; Cameron 1986; Russell et al. 1977; Wallace 1985), a continuous-time model may not properly reflect the biological dynamics we are interested in. Despite this challenge, the expression for the transient time found for transient limit cycles in continuous-time systems in Medeiros et al. (2017) is a reasonably accurate fit in our model. The transient times of the ghost attractor found in our work are similar to those found in the predator–prey model with group defense of Venturino and Petrovskii (2013). However, our biological mechanisms differ, as their transients could be attributed to search time of prey from the predators through space, a feature not explicitly modeled in our work. In contrast, the length of the ghost attractor in our model can be attributed to the length of the crawl-by transients that are part of the cycle itself, which are periods of low population growth for either the consumer or the resource.

In conclusion, we show how long transients can appear in predator–prey systems with group defense and discrete recruitment pulses. A possible extension of this model is to explicitly consider the dynamics of the juvenile stages through a continuous-time model, which could give a more accurate approximation of the transient times found in this paper. A multi-stage model would also allow exploration of the effect of relative adult versus juvenile vulnerability to consumption on the transient dynamics.