## 1 Introduction

Compartment models play an important role in the modeling of many biological systems ranging from pharmacokinetics to ecology (Anderson 1983; Godfrey 1983; Jacquez and Simon 1993). Key values in understanding the dynamics of these systems are the transit time: the mean time a particle spends in the compartmental system measured as the mean time from entry into the system to leaving the system (Bolin and Rodhe 1973; Eriksson 1971), and the mean age: the mean age of particles still in the system (Bolin and Rodhe 1973; Eriksson 1971). It is well known that these quantities need not be the same (Bolin and Rodhe 1973; Eriksson 1971; Rothman 2015).

We are motivated by an interest in studying the dynamics of the terrestrial carbon cycle which is typically modeled as a number of discrete pools of carbon in plant biomass, litter and soil organic matter. Many of the best studied models of the dynamics of carbon are linear, which reflects the fact that changes in carbon pools are proportional to the pool size (Bolker et al. 1998). Additionally, most analyses make the further assumption that all parameters describing the dynamics (and the input fluxes) are constant in time, leading to a model in the form of an autonomous linear differential equation. In this autonomous case, it is possible to derive analytic formulae giving expressions for the transit time (Garcia-Meseguer et al. 2003; Manzoni et al. 2009). These formulae for transit time are given in terms of (constant) transfer coefficients among compartments and analogous formulae are available for the mean age of particles in the system.

Many applications of models of terrestrial carbon relate to situations in which constant model parameters are replaced by time-dependent functions. Perhaps the most well-known examples are studies of how terrestrial carbon dynamics respond to climate change. In these, it is often assumed that the specific rates (per unit carbon) of carbon inputs and losses from the system change over time as a function of changes in climate, such as temperature. For example, increases in temperature are normally assumed to increase the rates of soil decomposition (Lloyd and Taylor 1994; Orchard and Cook 1983; Rothman 2015). As a consequence, the compartmental models of interest are nonautonomous, i.e. they depend on time (Luo et al. 2001, 2015; Xia et al. 2012). Nonautonomous compartmental systems are special cases of linear nonautonomous differential equations (Kloeden and Rasmussen 2011), which, in contrast to the linear autonomous case, cannot be solved analytically in general. Yet, both the mean age of particles in the system and the transit time remain of great interest for these time-dependent systems, as both quantities can be potentially measured in the actual systems being modeled (Rothman 2015; Trumbore 2000).

In this paper, we develop a theory for transit times and mean ages of mass in nonautonomous compartmental systems. As noted in one of the first papers to study transit time (Bolin and Rodhe 1973), there is obviously a close connection between age distribution and transit time in compartment models. We will build on this relationship to develop an approach for understanding the definition of transit time. We define a time-dependent version of transit time as the mean age of mass leaving the compartmental system. We use a time-dependent version of the McKendrick–von Förster equation (Brauer and Castillo-Chavez 2012; McKendrick 1926; Thieme 2003), the classic first-order partial differential equation describing age distributions, to prove that the mean age of mass satisfies an (inhomogeneous) linear nonautonomous differential equation. We show that under weak conditions, this equation is exponentially stable. Starting with demographic models highlights another important aspect of our approach. As is well known, solutions of demographic models depend on initial conditions, so quantities like the mean age and transit time also depend on initial conditions, but conventional definitions of these quantities ignore the influence of the initial conditions. For this reason, our nonautonomous approach also provides additional insight for autonomous compartmental systems that are not in equilibrium.

We apply the theory we have developed to numerically study transit times for a nine-dimensional compartmental system model of the carbon cycle, which is a modified version of the Carnegie–Ames–Stanford approach (CASA) model (Buermann et al. 2007; Potter et al. 1993; Randerson et al. 1996). We compare our nonautonomous quantities to the classical notion of transit time for autonomous systems, where we freeze the nonautonomous system in time to obtain an autonomous system, and we assume that we are in equilibrium. Our simulations illustrate the different and sometimes diverging trajectories of the autonomous and nonautonomous quantities over time. Our results demonstrate the necessity of our theory for the computation of transit times in nonautonomous compartmental systems and in autonomous compartmental systems that are not in equilibrium.

This paper is organized as follows. In Sect. 2, we first review the theory of transit times for autonomous compartmental systems, and we provide a heuristic derivation of the transit time formula. We then define nonautonomous compartmental systems in Sect. 3. In Sect. 4, we prove that under the assumption that the compartmental system is lower block triangular, and the diagonal blocks a diagonally dominant, the nonautonomous compartmental system is exponentially stable. In Sect. 5, we prove that the mean ages satisfy a linear nonautonomous differential equation, and we then use the stability criterion from Sect. 4 to prove exponential stability of the mean age equation. We define the concept of a transit time for nonautonomous compartmental systems in Sect. 6. In Sect. 7, we show that our nonautonomous theory is consistent with the autonomous case, in the sense that we get exactly the well-known autonomous transit time formula when applying the nonautonomous transit time to an autonomous system. Finally, in Sect. 8, we apply the theory to compute transit times for a nonautonomous compartmental model of the carbon cycle, which is a simplified version of the Carnegie–Ames–Stanford approach (CASA) model.

## 2 Transit times and mean ages for autonomous compartmental systems

An open (linear) autonomous compartmental system with both inputs and outputs (Anderson 1983; Godfrey 1983; Jacquez and Simon 1993) and with d pools is described by an inhomogeneous linear differential equation

\begin{aligned} \dot{x} = B x + s, \end{aligned}
(1)

where $$B \in \mathbb {R}^{d\times d}$$ is an invertible matrix, $$0\not =s\in [0,\infty )^d$$, and the entries $$\{b_{ij}\}_{i,j\in \{1,\ldots ,d\}}$$ of the matrix B satisfy

• $$b_{ii} < 0$$ for all $$i\in \{1,\ldots ,d\}$$,

• $$b_{ij} \ge 0$$ for all $$i\not =j\in \{1,\ldots ,d\}$$,

• $$\sum _{i=1}^d b_{ij} \le 0$$ for all $$j\in \{1,\ldots ,d\}$$.

The i-th row of the matrix B describes the dynamics of the mass in pool i: $$b_{ij}$$ is the rate at which mass moves from pool j to pool i, and $$b_{ii}$$ is the rate at which mass leaves the pool i which includes transfer to other pools and losses from the system. The flux at which mass enters from outside the system to pool i is given by $$s_i$$.

We assume that the homogeneous linear system $$\dot{x} = Bx$$ is exponentially stable, i.e. all eigenvalues of B have negative real parts (this is fulfilled e.g. when the matrix B is strictly diagonally dominant). This means that (1) has the exponentially stable equilibrium $$x^* = -B^{-1}s$$.

The concept of transit time for compartmental systems describes the mean time a particle spends in the compartmental system before it is released. There is a huge amount of literature on this topic, see e.g. Anderson (1983), Bolin and Rodhe (1973), Eriksson (1971), Garcia-Meseguer et al. (2003), Manzoni et al. (2009), but to our knowledge, the following simple derivation of the transit time formula has not been written down before.

Define $$r_i$$ as the mean (remaining) transit time in the system for a particle that has entered pool i either from outside the system or from another pool, and note that the transit time in pool i for a particle that has entered pool i either from outside the system or from another pool is given by $$-\frac{1}{b_{ii}}$$. Let $$p_{ij}$$ be the probability that a particle that enters pool i goes next to pool j, and note that

\begin{aligned} p_{ij} = -\frac{b_{ji}}{b_{ii}}. \end{aligned}

Next, note that the transit times for particles entering any pool i must satisfy the equation

\begin{aligned} r_i = -\frac{1}{b_{ii}} + \sum _{j \ne i} p_{ij}r_j, \end{aligned}

reflecting the fact that a particle in pool i spends the average time $$-\frac{1}{b_{ii}}$$ in pool i, before it either leaves the system or moves with the probability $$p_{ij}$$ to pool j, after which it spends the mean time $$r_j$$ before it leaves the system. This reads as

\begin{aligned} r = \begin{pmatrix} 0 &{}\quad p_{12} &{}\quad p_{1d} \\ p_{21} &{}\quad 0 &{}\quad p_{2d}\\ &{} &{}\quad \ddots &{} \\ p_{d1} &{}\quad p_{d2} &{}\quad 0 \end{pmatrix} r - \begin{pmatrix} \frac{1}{b_{11}} \\ \vdots \\ \frac{1}{b_{dd}} \end{pmatrix}, \end{aligned}

and multiplying the i-th row of this equation with $$-b_{ii}$$ yields

\begin{aligned} 0 = B^T r + (1,\ldots ,1)^T. \end{aligned}

Hence $$r^T= -(1,\ldots ,1) B^{-1}$$.

Let $$\beta _i$$ be the fraction of particles that enter the system from outside directly into pool i, i.e.

\begin{aligned} \beta _i = \frac{s_i}{\sum _{i=1}^d s_i} \quad \hbox {for all }\,i\in \{1,\ldots ,d\}, \end{aligned}

and let $$\beta =(\beta _1,\ldots ,\beta _d)^T$$. Then the transit time for the whole system is given by

\begin{aligned} R = -r^T\beta = -(1,\ldots ,1) B^{-1} \beta . \end{aligned}
(2)

Note that this transit time is equal to the turnover time $$U= \frac{(1,\ldots ,1)(x_1^*, \ldots , x_d^*)^T}{(1,\ldots ,1)(s_1, \ldots , s_d)^T}$$ (see Bolin and Rodhe 1973), which follows directly from $$x^* = -B^{-1}s$$.

We will show later that if the linear compartmental system (1) is in the equilibrium $$x^* = - B^{-1}s$$, then the mean age of the particles in the system is given by

\begin{aligned} M = -(1,\ldots ,1) B^{-1} \eta , \end{aligned}
(3)

where $$\eta = (\eta _1,\ldots ,\eta _d)^T$$, defined by

\begin{aligned} \eta _i = \frac{x_i^*}{\sum _{j=1}^d x_j^*} \quad \hbox {for all }\,i\in \{1,\ldots ,d\}, \end{aligned}

describes how mass is distributed when the system is in equilibrium. It is well-known that the mean age M is unequal to the transit time R (Bolin and Rodhe 1973; Rothman 2015), and we will demonstrate this now by means of two very simple compartmental systems.

### Example 1

(Transit times and mean ages) Consider the two compartmental systems

\begin{aligned} \dot{x} = \begin{pmatrix} -1 &{}\quad 2 \\ 0.5 &{}\quad -2 \end{pmatrix} x + \begin{pmatrix} 1 \\ 0 \end{pmatrix} \end{aligned}
(4)

and

\begin{aligned} \dot{x} = \begin{pmatrix} -1 &{}\quad 1 \\ 1 &{}\quad -2 \end{pmatrix} x + \begin{pmatrix} 1 \\ 0 \end{pmatrix}. \end{aligned}
(5)

It is easy to see that the transit times $$r_1$$ and $$r_2$$ for the two pools satisfies $$r_1< r_2$$ for (4) and $$r_1 > r_2$$ for (5). This follows either from using the above explicit formula for the vector r, or by considering the fact that particles can only leave from pool 1 in (4) and from pool 2 in (5). Since the transit time is given in both cases by $$r_1$$, and the mean age is a convex combination of $$r_1$$ and $$r_2$$, the transit time will be smaller than the mean age in (4), in contrast to the situation in (5).

## 3 Nonautonomous compartmental systems

In contrast to the autonomous case, both the coefficient matrix B and the input vector s of a nonautonomous compartmental system are allowed to depend on time.

### Definition 1

(Nonautonomous compartmental system) Let $$I:=(\tau ,\infty )$$ with $$\tau \in \{-\infty \}\cup \mathbb {R}$$ be a time interval, $$B :I \rightarrow \mathbb {R}^{d\times d}$$ be a bounded continuous function of invertible matrices and $$s:I\rightarrow [0,\infty )^d$$ be a bounded continuous function. A (linear) nonautonomous compartmental system with d pools is given by an inhomogeneous linear nonautonomous differential equation

\begin{aligned} \dot{x} = B(t) x + s(t), \end{aligned}
(6)

where we assume that the entries $$\{b_{ij}(t)\}_{i,j\in \{1,\ldots ,d\}}$$ of the matrix B(t) satisfy

• $$b_{ii}(t) < 0$$ for all $$i\in \{1,\ldots ,d\}$$ and $$t\in I$$,

• $$b_{ij}(t) \ge 0$$ for all $$i\not =j\in \{1,\ldots ,d\}$$ and $$t\in I$$,

• $$\sum _{i=1}^d b_{ij}(t) \le 0$$ for all $$j\in \{1,\ldots ,d\}$$ and $$t\in I$$.

Let $$\varPhi :I\times I\rightarrow \mathbb {R}^{d\times d}$$ denote the transition operator of the corresponding homogeneous equation $$\dot{x} = B(t)x$$, i.e. the function $$t\mapsto \varPhi (t,t_0)x_0$$ is the solution to $$\dot{x} = B(t)x$$ fulfilling the initial condition $$x(t_0) = x_0$$. Then the maximal solution to (6) satisfying the initial condition $$x(t_0) = x_0$$ is given by

\begin{aligned} \varphi (t,t_0,x_0) := \varPhi (t,t_0)x_0 + \int _{t_0}^t \varPhi (t,u)s(u)\,\mathrm {d}u \quad \hbox {for all }\,t\in I. \end{aligned}
(7)

In contrast to the autonomous case, nonautonomous compartmental systems of dimension two or higher are not explicitly solvable in general. Solutions can be obtained for systems with no feedbacks between pools, as the following example demonstrates.

### Example 2

(Explicitly solvable nonautonomous two-pool model) The nonautonomous compartmental system

\begin{aligned} \dot{x} = \begin{pmatrix} b_{11}(t)&{}\quad 0 \\ b_{21}(t) &{}\quad b_{22}(t) \end{pmatrix}x + \begin{pmatrix} 0 \\ s_2(t) \end{pmatrix}, \end{aligned}

where $$b_{11}(t), b_{22}(t)<0, b_{21}(t)\ge 0$$ and $$s_2(t)>0$$ for all $$t\in I$$, can be solved explicitly as follows: the general solution of the first equation is given by

\begin{aligned} x_1(t)= x_1^0 \exp \left( \textstyle \int _{t_0}^t b_{11}(u) \,\mathrm {d}u\right) , \end{aligned}

and thus, the second equation reads as

\begin{aligned} \dot{x}_2 = b_{22}(t)x_2 + b_{21}(t)x_1^0 \exp \left( \displaystyle \int _{t_0}^t b_{11}(u) \,\mathrm {d}u\right) + s_2(t), \end{aligned}

and can be solved using (7), since the equation is one-dimensional.

## 4 Exponential stability of nonautonomous compartmental systems

In this section, we provide a sufficient condition for global exponential stability of the nonautonomous compartmental system (6). This criterion will concern only the homogeneous part of (6), i.e. the matrix-valued function B, from which stability for the inhomogeneous equation follows. Since the result holds also for linear systems which are not compartmental systems, we formulate it more generally.

### Theorem 1

(Sufficient condition for exponential stability) Consider the linear nonautonomous differential equation

\begin{aligned} \dot{x} = B(t) x \end{aligned}
(8)

with transition operator $$\varPhi :I\times I\rightarrow \mathbb {R}^{d\times d}$$. Suppose that the function B is of the form

\begin{aligned} B(t) = \begin{pmatrix} B_{11}(t)&{}\quad 0 &{}\quad 0 &{}\quad 0\\ B_{21}(t)&{}\quad B_{22}(t) &{}\quad 0 &{}\quad 0\\ B_{31}(t)&{}\quad B_{32}(t) &{}\quad B_{33}(t) &{}\quad 0\\ &{} &{}\quad \ddots &{} \\ B_{m1}(t)&{}\quad B_{m2}(t)&{}\quad B_{m3}(t) &{}\quad B_{mm}(t)\\ \end{pmatrix} \end{aligned}
(9)

for $$m\ge 1$$ with bounded functions $$B_{ij}:I\rightarrow \mathbb {R}^{d_i\times d_j}$$. Note that $$\sum _{i=1}^m d_i = d$$. We assume that the linear subsystems $$\dot{x}_n = B_{nn}(t)x_n, n\in \{1,\ldots ,m\}$$, are strictly diagonally dominant, i.e. there exists a $$\delta >0$$ such that

1. (i)

$$(B_{nn}(t))_{ii} < 0$$ for all $$t\in I$$ and $$i\in \{1,\ldots ,d_n\}$$,

2. (ii)

$$(B_{nn}(t))_{ij} \ge 0$$ for all $$t\in I$$ and $$i\not =j\in \{1,\ldots ,d_n\}$$,

3. (iii)

$$\sum _{j=1}^{d_n} (B_{nn}(t))_{ij} \le -\delta$$ for all $$t\in I$$ and $$i\in \{1,\ldots ,d_n\}$$.

Then the linear system (8) is exponentially stable, i.e. there exist constants $$K\ge 1$$ and $$\gamma >0$$ such that

\begin{aligned} \Vert \varPhi (t,t_0)\Vert \le K e^{-\gamma (t-t_0)} \quad \hbox {for all }\,t\ge t_0 > \tau . \end{aligned}
(10)

### Proof

Assume first that I is bounded below, and consider the linear systems

\begin{aligned} \dot{x} = B_{ii}(t)x \end{aligned}
(11)

for each $$i\in \{1,\ldots ,m\}$$. These systems are strictly diagonally dominant, and it follows from (Coppel 1978, Proposition 3, page 55) that there exist $$K_i\ge 1$$ and $$\gamma _i>0$$ such that

\begin{aligned} \Vert \varPhi _i(t,t_0)\Vert \le K_i e^{-\gamma _i(t-t_0)} \quad \hbox {for all }\,t\ge t_0 > \tau , \end{aligned}

where $$\varPhi _i$$ is the transition operator of (11). Next Pötzsche (2016, Theorem 4.1) or Battelli and Palmer (2015, p. 540) yields that the dichotomy spectrum of (8) is bounded above by $$-\min _{i\in \{1,\ldots ,m\}} \gamma _i$$. This in turn implies the claimed estimate (10). In case $$I=\mathbb {R}$$, the results from Pötzsche (2016, Theorem 4.1) and Battelli and Palmer (2015, p. 540) are not applicable directly, since they require the system to be defined on a half line, but the result follows by considering the two time intervals $$(-\infty , 0)$$ and $$(0,\infty )$$ separately (note that we are not interested in the dichotomy spectrum for the entire line, which is not determined by the block diagonal system; we only require an upper bound, which we get from the block diagonal system).

The estimate (10) for the homogeneous system (8) implies that any two solutions of the compartmental system (6) converge to each other exponentially. More precisely, given two solutions $$\mu _1, \mu _2:I\rightarrow \mathbb {R}^d$$ of (6), then

\begin{aligned} \Vert \mu _1(t)-\mu _2(t)\Vert \le K e^{-\gamma (t-t_0)} \Vert \mu _1(t_0)-\mu _2(t_0)\Vert \quad \hbox {for all }\,t\ge t_0 > \tau , \end{aligned}

which follows from the fact that the difference of these two solutions is a solution of the homogeneous system (8), for which the estimate (10) holds. This implies that any solution is forward attracting, and in case the interval I is unbounded below, then there also exists a unique pullback attracting solution

\begin{aligned} \nu (t):= \int ^t_{-\infty } \varPhi (t,u)s(u)\,\mathrm {d}u\quad \hbox {for all }\,t\in I, \end{aligned}
(12)

see Aulbach and Wanner (1996). This solution pullback attracts bounded sets $$B\subset \mathbb {R}^d$$, in the sense of

\begin{aligned} \lim _{t_0\rightarrow -\infty } {\text {dist}}\left( \varphi (t,t_0, B), \{\nu (t)\}\right) = 0 \quad \hbox {for all }\,t\in I, \end{aligned}

where $$\varphi$$ denotes the maximal solution defined in (7) and $${\text {dist}}$$ denotes the Hausdorff distance. We refer to Kloeden and Rasmussen (2011), Rasmussen (2007) for an introduction to forward and pullback attractors of nonautonomous dynamical systems.

## 5 The mean age system

We prove in this section that the mean ages of mass in a nonautonomous compartmental system are solutions of a linear nonautonomous differential equation, which we call the mean age system. We derive this result from the evolution of age distributions, given by the well-known McKendrick–von Förster equation (McKendrick 1926; Brauer and Castillo-Chavez 2012; Thieme 2003), which is a linear first order partial differential equation. We also prove that the mean age system is exponentially stable under additional weak assumptions, by applying the theory developed in Sect. 4.

The mean age system is pivotal for the analysis of transit times for nonautonomous compartmental systems, since in order to compute the average time the mass spends in the system, we do not need to look at the full age distribution of ages, but only at the mean ages.

Let $$p_i(a,t)$$ be the density function on age a for the mass in pool i at time t, where the age is the time since the mass entered the system. Note that the following formulation is valid in principle even if all rates are age-dependent, i.e. $$b_{ij}$$ also depends on a, but we will not treat this situation here. The McKendrick–von Förster equation is given by

\begin{aligned} \frac{\partial p_i}{\partial t}+\frac{\partial p_i}{\partial a}= \sum _{j=1}^d b_{ij}(t)p_j \end{aligned}
(13)

with boundary condition

\begin{aligned} p_i(0,t)=s_i(t). \end{aligned}
(14)

Note that one also needs to specify initial conditions $$p_i(a,0)$$.

A componentwise solution can be written as follows. Note that if there are no loops, the solution is explicit, otherwise it is only implicit. The formula for $$t>a$$ is

\begin{aligned} p_i(t,a)= & {} s_i(t-a)\exp (\displaystyle \int _{t-a}^t b_{ii}(u)\,\mathrm {d}u)\\&+ \sum _{j \ne i} \int _0^a\left( b_{ij}(t-\sigma )p_j(a-\sigma ,t-\sigma )\exp (\displaystyle \int _{t-\sigma }^tb_{ii}(u) \,\mathrm {d}u)\right) \,\mathrm {d}\sigma . \end{aligned}

Note that an analogous formula for $$a<t$$ exists.

We are particularly interested in the transit time of (6) at a particular time t, which corresponds to the mean age of mass leaving the system at time t. For this purpose, we do not need the full age distribution determined by (13), since the situation is fully described by the mean age of mass in pool i, denoted as $${\bar{a}}_i (t)$$. The following theorem says that the evolution of the mean ages is determined by an ordinary differential equation.

### Theorem 2

(Mean age system) Consider the nonautonomous compartmental system (6) with a fixed solution $$t\mapsto (x_1(t),\ldots ,x_d(t))$$ of positive entries. Let $$p_i(a,t)$$ be the density function on age a for the mass in pool i at time t (note that $$\int _0^\infty p_i(a,t)\,\mathrm {d}a = x_i(t)$$), and define the mean age of mass in pool i by

\begin{aligned} {\bar{a}}_i(t) = \frac{\int _0^\infty a p_i(a,t)\,\mathrm {d}a}{\int _0^\infty p_i(a,t)\,\mathrm {d}a} \quad \hbox {for all }\,i\in \{1,\ldots ,d\}. \end{aligned}

Then the mean ages $${\bar{a}}(t) =({\bar{a}}_1(t), \ldots , {\bar{a}}_d(t))$$ solve the ordinary differential equation

\begin{aligned} {\dot{\bar{a}}} = g(t, x, {\bar{a}}), \end{aligned}
(15)

with

\begin{aligned} g_i(t,x,{\bar{a}}) = 1+ \frac{\sum _{j=1}^d ({\bar{a}}_j-{\bar{a}}_i)b_{ij}(t) x_j(t)-{\bar{a}}_is_i(t)}{x_i(t)} \quad \hbox {for all }\,i\in \{1,\ldots ,d\}. \end{aligned}

### Proof

By using $$\int _0^\infty a \frac{\partial p_i}{\partial a}(t,a)\,\mathrm {d}a = -x_i(t)$$ (integration by parts), it follows that

\begin{aligned} {\dot{\bar{a}}}_i(t)&= \frac{x_i(t) \int _0^\infty a \frac{\partial p_i}{\partial t}(t,a) \,\mathrm {d}a- {\bar{a}}_i (t)x_i(t)\dot{x}_i(t)}{x_i^2(t)}\\&= \frac{x_i(t) \int _0^\infty a \left( -\frac{\partial p_i}{\partial a}(t,a)+\sum _{j=1}^db_{ij}(t)p_j(t,a)\right) \,\mathrm {d}a - {\bar{a}}_i(t)x_i(t)\dot{x}_i(t)}{x_i^2(t)}\\&= \frac{x_i^2(t) + \sum _{j=1}^{d} b_{ij}(t) x_i(t) \int _0^\infty a p_j(t,a) \,\mathrm {d}a- {\bar{a}}_i(t)x_i(t)\dot{x}_i(t)}{x_i^2(t)}\\&= 1+ \frac{\sum _{j=1}^{d} b_{ij}(t) x_j(t){\bar{a}}_j(t) - {\bar{a}}_i(t) \left( \sum _{j=1}^d b_{ij}(t)x_j(t) + s_i(t)\right) }{x_i(t)}\\&= 1+ \frac{\sum _{j=1}^d ({\bar{a}}_j(t)-{\bar{a}}_i(t))b_{ij}(t) x_j-{\bar{a}}_i (t)s_i(t)}{x_i(t)}. \end{aligned}

This finishes the proof.

Combining the Eqs. (6) and (15) yields

\begin{aligned} \left( \begin{array}{l} \dot{x} \\ {\dot{\bar{a}}} \end{array}\right) = \left( \begin{array}{l} B(t)x + s(t)\\ g(t, x, {\bar{a}}) \end{array}\right) , \end{aligned}
(16)

which is a 2d-dimensional ordinary differential equation of skew product type, i.e. the x-equation does not depend on $${\bar{a}}$$, but the equation for $${\bar{a}}$$ depends on x. Note that (16) is a nonlinear equation, but given a solution $$x(t)= (x_1(t), \ldots , x_d(t))$$ of (6), the age equation (15) is an inhomogeneous linear nonautonomous differential equation, which reads as

\begin{aligned} {\dot{\bar{a}}} = A(t, x(t)) {\bar{a}} + (1,\ldots ,1)^T, \end{aligned}

where

\begin{aligned}\scriptstyle A(t, x(t)) = X(t)^{-1} \begin{pmatrix}\scriptstyle -s_1(t) - \sum _{j\not =1} b_{1j}(t)x_j(t) &{} \scriptstyle b_{12}(t)x_2(t) &{} &{}\scriptstyle b_{1d}(t)x_d(t)\\ \scriptstyle b_{21}(t)x_1(t) &{}\scriptstyle -s_2(t) - \sum _{j\not =2} b_{2j}(t)x_j(t) &{} &{}\scriptstyle b_{2d}(t)x_d(t)\\ &{} &{} \ddots &{} \\ \scriptstyle b_{d1}(t)x_1(t) &{} \scriptstyle b_{d2}(t)x_2(t) &{} &{} \scriptstyle -s_d(t) - \sum _{j\not =d} b_{dj}(t)x_j(t) \end{pmatrix} \end{aligned}

with $$X(t):= {\text {diag}} (x_1(t), \ldots , x_d(t))$$ for all $$t\in I$$.

We will show now that under additional weak assumptions, the mean age equation is exponentially stable.

### Theorem 3

(Exponential stability of the mean age system) Consider the nonautonomous compartmental system (6) with a fixed solution $$t\mapsto x(t)=(x_1(t),\ldots ,x_d(t))$$ of positive entries that are bounded and bounded away from zero, and suppose that (6) satisfies the assumptions of Theorem 1 with $$\delta >0$$. In addition, assume that

1. (a)

$$s_i(t) \ge \delta$$ for all $$t\in I$$ and $$i\in \{1,\ldots ,d_1\}$$, and

2. (b)

for all $$n\in \{2,\ldots ,m\}$$ and $$i\in \{1+\sum _{k=1}^{n-1}d_k,2+\sum _{k=1}^{n-1}d_k,\ldots ,\sum _{k=1}^{n}d_k\}$$, there exists a $$j\in \{1,\ldots ,\sum _{k=1}^{n-1}d_k\}$$ such that $$b_{ij}(t) \ge \delta$$ for all $$t\in I$$.

Then the mean age system (15) is exponentially stable. More precisely, there exist $$\bar{\delta }\in (0,\delta )$$ and $$\bar{K} > 0$$ such that the transition operator $$\varPsi : I\times I \rightarrow \mathbb {R}^{d\times d}$$ of the homogenous equation $${\dot{\bar{a}}} = A(t, x(t)) {\bar{a}}$$ satisfies the estimate

\begin{aligned} \Vert \varPsi (t,t_0)\Vert \le \bar{K} e^{-\bar{\delta }(t-t_0)} \quad \hbox {for all }\,t\ge t_0 > \tau . \end{aligned}

### Proof

We show now that the three conditions (i)–(iii) of Theorem 1 are satisfied with $$\delta$$ replaced by $$\delta \min \{1, \min _{t\in I,i\in \{1,\ldots ,d\}} |x_i(t)|\}$$. Note first that the matrix A(tx(t)) has the same block decomposition as the matrix B(t), which is described in (9).

Condition (i) of Theorem 1 follows from (a) (in case of $$n=1$$) or (b) (in case $$n>1$$; note that the sum of the entries in the i-th row of the matrix A(tx(t)) equals to $$-s_i(t)$$, and (b) guarantees that the diagonal entry is negative even though $$s_i(t)$$ might be zero). Condition (ii) of Theorem 1 follows from the fact that the original system (6) is a compartmental system, and the solution x(t) of (6) has positive entries. Finally, condition (iii) of Theorem 1 follows from fact that the sum of the i-th row of the matrix A(tx(t)) equals to $$-s_i(t)$$, and the positive contribution of at least $$b_{ij}(t)x_j(t)\ge \delta \min _{t\in I,i\in \{1,\ldots ,d\}} |x_i(t)|$$, with i and j chosen as in (b), will not be considered in the sum in condition (iii) of Theorem 1 and for this reason contributes negatively to this sum.

A natural choice for the solution $$t\mapsto x(t)$$ in the above theorem is the exponentially stable solution defined in (12) if the interval I is unbounded below. If the interval I is unbounded below, this will be the only bounded solution of the system, i.e. the norm of all other solutions converges to $$\infty$$ in the limit $$t\rightarrow -\infty$$, so the solution (12) is the only solution to which the theorem can be applied. However, if the interval I is bounded below, then all solutions of the nonautonomous compartmental system (6) are bounded and exponentially stable, and they are also bounded away from zero due to assumption (a) of Theorem 3.

## 6 Nonautonomous transit times

We define transit time as the mean age of mass leaving the system at a particular time t. Note that in our nonautonomous context, this quantity depends on the actual time t. We also provide a formula that corresponds to the mean age of mass currently residing in the compartmental system.

### Definition 2

(Nonautonomous transit time and mean age) Consider the skew product system (16) consisting of the nonautonomous compartmental system (6) and the mean age system (15). The transit time of a solution $$(x_1(t),\ldots ,x_d(t), {\bar{a}}_1(t), \ldots , {\bar{a}}_d(t)), t\in I$$, of this system is then defined as

\begin{aligned} R_t := \frac{\sum _{i=1}^d {\bar{a}}_i(t) x_i(t)\sum _{j=1}^d b_{ji}(t)}{\sum _{i=1}^d x_i(t)\sum _{j=1}^d b_{ji}(t)} \quad \hbox {for all }\,t\in I, \end{aligned}

and then mean age of this solution is defined by

\begin{aligned} M_t := \frac{\sum _{i=1}^d {\bar{a}}_i(t) x_i(t)}{\sum _{i=1}^d x_i(t)} \quad \hbox {for all }\,t\in I. \end{aligned}

The transit time $$R_t$$ is the mean age of carbon leaving the system at time t, where as the mean age $$M_t$$ is the mean age of carbon in the system at time t.

Note that, in general, $$R_t$$ and $$M_t$$ are different, see Example 1 for the autonomous case. In the following example, we show that transit times and mean ages are the same for one-dimensional compartmental systems.

### Example 3

(Transit time and mean ages for one-dimensional compartmental systems) Let $$I\subset \mathbb {R}$$ be an interval, and consider the one-dimensional nonautonomous compartmental system

\begin{aligned} \dot{x} = b(t) x +s(t), \end{aligned}

where $$b :I \rightarrow (-\infty ,0)$$ and $$s:I\rightarrow (0,\infty )$$ are bounded continuous functions. Fix a positive solution $$t\mapsto x(t)$$ of this system. Note that the solution is given explicitly by

\begin{aligned} x(t)= x(t,t_0,x_0) = \exp \left( \displaystyle \int _{t_0}^t b(u)\,\mathrm {d}u\right) x_0 +{\displaystyle \int _{t_0}^t }\exp \left( \textstyle \int _u^{t_0} b(v)\,\mathrm {d}v\right) s(u)\,\mathrm {d}u, \end{aligned}
(17)

where $$t_0$$ and $$x_0$$ are initial time and condition. Then the mean age equation is given by

\begin{aligned} {\dot{\bar{a}}} = -\frac{s(t)}{x(t)}{\bar{a}} + 1, \end{aligned}

and also this equation can be solved explicitly using (17). Note that, in this one-dimensional context, the formulae for transit time and mean age from Definition 2 are given by exactly the solution to this equation:

\begin{aligned} R_t= M_t = {\bar{a}}(t)\quad \hbox {for all }\,t\in I. \end{aligned}

## 7 Consistency with the autonomous case

In this section, we derive simple expressions for the transit time and mean age from Definition 2 in the special case of an autonomous compartmental system. The expression for the autonomous transit time coincides with the heuristically obtained formula (2), and we confirm the expression for the mean ages stated in (3).

Consider an autonomous compartmental system

\begin{aligned} \dot{x} = B x + s \end{aligned}
(18)

with an invertible matrix $$B\in \mathbb {R}^{d\times d}$$ and $$s\in \mathbb {R}^d$$. We assume that the homogeneous system $$\dot{x} = Bx$$ satisfies the assumptions of Theorems 1 and 3. Note that (18) has the exponentially stable equilibrium $$x^* := -B^{-1}s$$.

### Lemma 1

Consider the autonomous differential equation (18). Then the mean age equation (15) for the equilibrium $$x^*$$ reads as

\begin{aligned} {\dot{\bar{a}}} = \left( X^*\right) ^{-1} B X^* {\bar{a}} + (1,\ldots , 1)^T, \end{aligned}

and has the exponentially stable equilibrium

\begin{aligned} {\bar{a}}^* := -\left( X^*\right) ^{-1}B^{-1}X^* (1, \ldots , 1)^T, \end{aligned}

where $$X^*:= {\text {diag}} (x^*_1, \ldots , x^*_d)$$.

### Proof

Note that the mean age equation (15) is given by

\begin{aligned} {\dot{\bar{a}}} = \left( X^*\right) ^{-1}\begin{pmatrix}\scriptstyle -s_1 - \sum _{j\not =1} b_{1j}x^*_j &{} \scriptstyle b_{12}x^*_2 &{} &{}\scriptstyle b_{1d}x^*_d\\ \scriptstyle b_{21}x^*_1 &{}\scriptstyle -s_2 - \sum _{j\not =2} b_{2j}x^*_j &{} &{}\scriptstyle b_{2d}x^*_d\\ &{} &{} \ddots &{} \\ \scriptstyle b_{d1}x^*_1 &{} \scriptstyle b_{d2}x^*_2 &{} &{} \scriptstyle -s_d - \sum _{j\not =d} b_{dj}x^*_j \end{pmatrix}{\bar{a}} + \begin{pmatrix} 1\\ \vdots \\ 1 \end{pmatrix}. \end{aligned}

Since $$Bx^* = -s$$, we get $$-s_i - \sum _{j\not = i} b_{ij}x^*_j = b_{ii} x^*_i$$ for all $$i\in \{1,\ldots , d\}$$, so the mean age equation (15) gets simplified to

\begin{aligned} {\dot{\bar{a}}}&= \left( X^*\right) ^{-1}\begin{pmatrix}\scriptstyle b_{11}x^*_i &{}\quad \scriptstyle b_{12}x^*_2 &{}\quad \scriptstyle b_{1d}x^*_d\\ \scriptstyle b_{21}x^*_1 &{}\quad \scriptstyle b_{22}x^*_2 &{}\quad \scriptstyle b_{2d}x^*_d\\ &{} &{}\quad \ddots &{} \\ \scriptstyle b_{d1}x^*_1 &{}\quad \scriptstyle b_{d2}x^*_2 &{}\quad \scriptstyle b_{dd}x^*_d \end{pmatrix}{\bar{a}} + \begin{pmatrix} 1\\ \vdots \\ 1 \end{pmatrix}\\&= \left( X^*\right) ^{-1} B X^* {\bar{a}} + (1,\ldots , 1)^T. \end{aligned}

Hence the attractive equilibrium of (15) is given by

\begin{aligned} {\bar{a}}^* := -\left( X^*\right) ^{-1}B^{-1}X^* (1, \ldots , 1)^T, \end{aligned}

which finishes the proof of this lemma. $$\square$$

Let $$\beta _i$$ be the fraction of particles that enter the system from outside directly into pool i, i.e.

\begin{aligned} \beta _i = \frac{s_i}{\sum _{i=1}^d s_i} \quad \hbox {for all }\,i\in \{1,\ldots ,d\}, \end{aligned}

and let $$\beta =(\beta _1,\ldots ,\beta _d)^T$$. Moreover, define $$\eta = (\eta _1,\ldots ,\eta _d)^T$$ by

\begin{aligned} \eta _i = \frac{x_i^*}{\sum _{j=1}^d x_j^*} \quad \hbox {for all }\,i\in \{1,\ldots ,d\}, \end{aligned}

which describes how mass is distributed when the system is in equilibrium. Note that $$\sum _{i=1}^d \beta _i = \sum _{i=1}^d \eta _i= 1$$.

### Proposition 1

(Autonomous transit times and mean ages) Consider the autonomous compartmental system (18). The transit time with respect to the equilibrium solution $$t\mapsto (x^*, {\bar{a}}^*)$$ does not depend on time and is given by

\begin{aligned} R= -(1,\ldots ,1) B^{-1} \beta , \end{aligned}

and the mean age of mass is given by

\begin{aligned} M= -(1,\ldots ,1) B^{-1} \eta . \end{aligned}

### Proof

Using Definition 2, we have

\begin{aligned} R_t= & {} \frac{(1,\ldots ,1)B X^* {\bar{a}}^*}{(1,\ldots ,1)B x^*}=- \frac{(1,\ldots ,1)X^* (1,\ldots ,1)^T}{\sum _{i=1}^d s_i}\\= & {} -\frac{(1,\ldots ,1)x^*}{\sum _{i=1}^d s_i} =-\frac{(1,\ldots ,1)B^{-1}s}{\sum _{i=1}^d s_i}\\= & {} -(1,\ldots ,1) B^{-1} (\beta _1,\ldots ,\beta _d)^T \quad \hbox {for all }\,t \in \mathbb {R}\end{aligned}

for the transit time and

\begin{aligned} M_t= & {} \frac{(1,\ldots ,1)X^* {\bar{a}}^*}{(1,\ldots ,1) x^*}= -\frac{(1,\ldots ,1)B^{-1}X^*(1,\ldots ,1)^T}{\sum _{i=1}^d x_i^*}\\= & {} -\frac{(1,\ldots ,1)B^{-1}x^*}{\sum _{i=1}^d x_i^*} = -(1,\ldots ,1) B^{-1} (\eta _1,\ldots ,\eta _d)^T \quad \hbox {for all }\,t \in \mathbb {R}\end{aligned}

for the mean age. Note that both quantities do not depend on t, and this finished the proof of this proposition.

Note that derivation of the autonomous quantities for transit time R and mean age M in Proposition 1 required the autonomous compartmental system (18) to be in equilibrium, and the classical approach to transit times, as outlined in Sect. 2, is not applicable for autonomous systems not in equilibrium. It is very important to note that Definition 2 is useful for autonomous systems also, since it is applicable to systems that are not in equilibrium. For such autonomous systems, transit times and mean ages will depend on time in general, and although they converge to R and M in the limit $$t\rightarrow \infty$$, they might be very different to R and M.

## 8 Mean ages and transit times for the CASA model

Here we illustrate predicted changes in the mean age of carbon leaving and remaining in the system for a terrestrial carbon model under a climate change scenario. We consider a modification of the CASA model as used in Buermann et al. (2007) globally without resolving the spatial details of carbon pools using nine pools representing the global terrestrial carbon (e.g. three pools for plant biomass, or litter or soil organic matter). This caused the model to be precisely of the form of (6). Climate change was simulated by increasing atmospheric $$\mathrm {CO_2}$$ over time, which affected both B(t) and s(t) in (6). Increased $$\mathrm {CO_2}$$ directly increases carbon inputs s(t) through carbon dioxide fertilization. They also directly increase mean global temperatures. This increases the carbon loss rates from some of the carbon pools, changing components of B(t), and also has an effect on s(t). Thus increased $$\mathrm {CO_2}$$ alters the input and loss rates of components of the terrestrial carbon cycle, making both the sign and magnitude of the net change in carbon storage dependent the sensitivity of carbon inputs and loss rates.

We simulated changes in atmospheric $$\mathrm {CO_2}$$ using

\begin{aligned} x_a(t) = 1715\exp \left( 0.0305t/(1715+\exp (0.0305t)-1)\right) , \end{aligned}
(19)

where $$x_a(t)$$ is the atmospheric carbon dioxide concentration in parts per million and t is years since the year 1850. This represents a plausible time course of atmospheric $$\mathrm {CO_2}$$ from year $$1850 (t=0)\, {\hbox {to}}\, 2500 (t=650)$$ under a zero-mitigation, business as usual global change scenario (Raupach et al. 2011) (illustrated in Fig. 1a).

The effect of $$\mathrm {CO_2}$$ on mean global temperatures is modelled as

\begin{aligned} T_s(t)=T_{s0}+\frac{\sigma }{\ln (2)}\ln (x_a(t)/285), \end{aligned}
(20)

where $$T_{s0}=15$$ is the mean land surface temperature in 1850, and $$\sigma$$ is the sensitivity of global temperatures to $$x_a(t)$$. We chose an upper extreme of $$\sigma =4.5$$ based on the literature because the resulting simulation emphasises well the interplay between increased carbon input rates and carbon loss rates Scheffer et al. (2006). Changes in carbon input rates are simulated using

\begin{aligned} s(t) = (s_1(t), s_2(t), s_3(t), 0, 0, 0, 0, 0, 0) \end{aligned}
(21)

with $$s_i(t)=f_i \alpha s_0(1+\beta (x_a(t), T_s(t))\ln (x_a(t)/285))$$, where $$f_i=0.33$$ is the proportion of carbon input going to the different carbon pools, $$\alpha =0.5$$ is the proportion of gross primary production that remains after respiration and $$\beta$$ is the sensitivity of s(t) to $$x_a(t)$$ and $$T_s(t)$$, given by

\begin{aligned} \beta (x_a(t), T_s(t)) = \frac{3\rho x_a(t) \Gamma (T_s(t))}{(\rho x_a(t)-\Gamma (T_s(t)))(\rho x_a(t)+2\Gamma (T_s(t)))}, \end{aligned}

where $$x=0.65$$ is the ratio of the intracellular $$\mathrm {CO_2}$$ to $$x_a(t)$$, and $$\Gamma (T_s(t))$$ is given by

\begin{aligned} \Gamma (T_s(t))=42.7+1.68(T_s(t)-25)+0.012(T_s(t)-25)^2, \end{aligned}

see Polglase and Wang (1992). The solution of (21) with changes in $$x_a(t)$$ and $$T_s(t)$$ as described above is illustrated in Fig. 1b. The matrix controlling the rates of carbon transfer and loss from the system is given by

\begin{aligned}{\small B(t) \!= \!\begin{pmatrix} b_{11}&{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ 0 &{} b_{22} &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ 0 &{} 0 &{} b_{33} &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ b_{41} &{} b_{42} &{} 0 &{} b_{44}\xi (T_s(t)) &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ b_{51} &{} b_{52}&{} 0 &{} 0 &{} b_{55}\xi (T_s(t)) &{} 0 &{} 0 &{} 0 &{} 0 \\ 0&{} 0&{} b_{63} &{} 0 &{} 0 &{} b_{66}\xi (T_s(t)) &{} 0 &{} 0 &{} 0 \\ 0&{} 0&{} 0 &{} b_{74}\xi (T_s(t)) &{} b_{75}\xi (T_s(t)) &{} b_{76}\xi (T_s(t)) &{} b_{77}\xi (T_s(t)) &{} b_{78}\xi (T_s(t)) &{} b_{79}\xi (T_s(t)) \\ 0&{} 0&{} 0 &{} 0 &{} b_{85}\xi (T_s(t)) &{} b_{86}\xi (T_s(t)) &{} b_{87}\xi (T_s(t)) &{} b_{88}\xi (T_s(t)) &{} b_{89}\xi (T_s(t)) \\ 0&{} 0&{} 0 &{} 0 &{} 0 &{} 0&{} b_{97}\xi (T_s(t)) &{} b_{98}\xi (T_s(t)) &{} b_{99}\xi (T_s(t)) \end{pmatrix}}, \end{aligned}

indicating that it is the loss rates of pools $$i=\{3,\ldots ,9\}$$ that change with time. The coefficients $$b_{ij}$$ are listed in the legend to Fig. 1, and

\begin{aligned} \xi (T_s(t))=\xi _b^{0.1T_s(t)-2}, \end{aligned}
(22)

where $$\xi (T_s(t))$$ is the scaling of decomposition rates at $$T_s=20$$ degrees Celsius. Equation (22) is illustrated in Fig. 1c.

To define the model initial conditions we assume that $$x_a(t)=x_a(0)$$ for all $$t<0$$ and that x(0) has reached the positive equilibrium solution of the resulting system of autonomous equations. The model is then simulated forward from this initial condition using (19) as the forcing function. Under this simulated scenario, total land carbon increases then decreases over time as shown in Fig. 1d. This would represent an initial net uptake of carbon from the atmosphere due to carbon dioxide fertilization followed ultimately by a net carbon loss from the land back to the atmosphere due to global warming (Fig. 2 shows how this carbon change over time is distributed amongst the different components of x(t)).

Calculations of the transit time $$R_t$$ and mean age $$M_t$$ of carbon in the system (according to Definition 2), for the nine-pool model for the climate change simulation described above, show an order of magnitude difference in the absolute values of $$R_t$$ and $$M_t$$ (Fig. 3). This indicates that the average age of carbon stored on land is much older than the average age of carbon leaving the land. Note that at $$t=0$$ (corresponding to the year 1850), we assumed that $$M_0= M$$, where M is the mean age of the equilibrium solution at $$t=0$$ according to Proposition 1.

Perhaps surprisingly, the monotonic forcing of B(t) and s(t) translates into non-monotonic effects on $$R_t$$ and $$M_t$$. A detailed mathematical investigation of this phenomenon is outside the scope of the present study.

The nonautonomous properties $$R_t$$ and $$M_t$$ show contrasting trajectories to the instantaneous properties R and M (which we computed according to Proposition 1, but note that, since the system is nonautonomous, the assumptions of this proposition are not fulfilled). For example the latter properties change monotonically over time. This must be because the long term outcome of an increase in the input rate of young carbon and an increase in the output rate of old carbon is a decrease in the age of carbon both leaving and remaining in the system. Over the course of the simulation the numerical values of the autonomous and nonautonomous properties become visibly different (Fig. 3). This is because it will take a long time for the values of $$R_t$$ and $$M_t$$ to approach R and M due to the small loss rate of the ninth soil pool.

## 9 Conclusions

Models for terrestrial carbon cycling have led to renewed interest in the properties of compartment models. Key quantities that have been studied over many years in compartment models with parameters fixed in time (Eriksson 1971; Bolin and Rodhe 1973; Anderson 1983) are the mean age of particles in the system and the transit time of particles leaving the system. Formulae for these quantities that give the mean age and transit time in terms of parameters of the system in the long time limit have led to insights, but cannot be applied to the case of changing parameters.

As parameters change, for example in a model of carbon cycling due to climate change, it is not correct to calculate the mean age or transit time from the instantaneous parameter values. Using the theory of nonautonomous differential equations as a tool, and beginning with time dependent age structured models, we are able to define and derive formulae for the transit time and mean age for particles in the case of temporally changing parameters. These definitions lead to quantities that reduce to the analogous formulae for the autonomous (constant parameter) case when parameters do not change in time. However, the formulae for the nonautonomous case also highlight the fact that even in the constant parameter case the transit time and mean age do depend on initial conditions; some of the standard formulae do not include this dependence.

The difference between a transit time or mean age that is computed based on the parameters at a given instant and the better approach of taking into account the history of the system can be substantial as we illustrate using a variant of the CASA model. Thus, the approach we develop here is not just of mathematical interest but is of substantial practical importance as well.