Abstract
Reaction–diffusion models are used to describe systems in fields as diverse as physics, chemistry, ecology and biology. The fundamental quantities in such models are individual entities such as atoms and molecules, bacteria, cells or animals, which move and/or react in a stochastic manner. If the number of entities is large, accounting for each individual is inefficient, and often partial differential equation (PDE) models are used in which the stochastic behaviour of individuals is replaced by a description of the averaged, or mean behaviour of the system. In some situations the number of individuals is large in certain regions and small in others. In such cases, a stochastic model may be inefficient in one region, and a PDE model inaccurate in another. To overcome this problem, we develop a scheme which couples a stochastic reaction–diffusion system in one part of the domain with its mean field analogue, i.e. a discretised PDE model, in the other part of the domain. The interface in between the two domains occupies exactly one lattice site and is chosen such that the mean field description is still accurate there. In this way errors due to the flux between the domains are small. Our scheme can account for multiple dynamic interfaces separating multiple stochastic and deterministic domains, and the coupling between the domains conserves the total number of particles. The method preserves stochastic features such as extinction not observable in the mean field description, and is significantly faster to simulate on a computer than the pure stochastic model.
Keywords: Reaction–diffusion system, Stochastic model, Hybrid model, Fisher–Kolmogorov equation, Lotka–Volterra equation
Highlights
-
•
A novel hybrid stochastic/deterministic reaction–diffusion simulation method is given.
-
•
Can massively speed up stochastic simulations while preserving stochastic effects.
-
•
Can handle multiple reacting species.
-
•
Can handle moving boundaries.
1. Introduction
Random effects due to finite numbers of components are ubiquitous in reaction–diffusion systems. Within this context, much research has been done, for instance, on the robustness and response to noise in gene regulatory networks. The study of such systems, as well as other examples such as chemical pattern-forming reaction–diffusion systems, has also revealed that an accurate description of their dynamics may require inclusion of the effects of spatially-inhomogeneous distributions of molecules. The usual framework to analyse such situations is that of stochastic reaction–diffusion models.
A popular approach for studying stochastic reaction–diffusion models involves decomposing the domain occupied by the system into small compartments or voxels, and counting the number of molecules of each species in each voxel [33,3]. Chemical reactions between species are treated locally (i.e. within each voxel), their rates being determined by the local abundance of each constituent species. Molecular transport between compartments is usually modelled by simple diffusion.
This compartmental approach poses a problem: numerical (Monte Carlo) techniques such as the Gillespie stochastic simulation algorithm (SSA) [18,19] or the τ-leap method [20,8] are inefficient since they scale poorly with the number of reaction channels, which is proportional to the number of compartments.
In order to overcome issues regarding the efficiency of direct simulation methods, several strategies have been proposed. For example, the Next Reaction Method (NRM) proposed by Gibson and Bruck [17] is an exact method in the same sense as the SSA, i.e. the sample paths generated are exact realisations of the solution of the corresponding Master Equation. However, unlike the SSA, the computing time grows logarithmically with the number of reaction channels. This is accomplished by (i) recycling the random numbers generated in previous time steps, so at each time step only one new random number must be generated, and (ii) organising the reaction channels in a queue (more specifically, a tree) with events ordered in ascending order of waiting time. In this way, it is possible to determine which channel will fire next, and when it will fire, by looking at the root of the tree. The Next Sub-Volume Method (NSVM) is a modification of the NRM which accounts for reaction–diffusion systems [10]. It deals with the stiffness problem arising from the fact that the transition rates associated with diffusion are proportional to , where h is the compartment length.
An alternative set of methods are hybrid methods. Often a stochastic description is only needed in a certain region of the domain. Elsewhere the number of components is sufficiently large for a mean-field description to be reasonable. A paradigmatic example of this situation is front propagation in reaction–diffusion systems [4,6,5]. In systems such as the stochastic Fisher–Kolmogorov model, the number of particles ahead of the front is small and, therefore, fluctuations need to be taken into account. By contrast, behind the front, the number of particles fluctuates about the carrying capacity of the model. In these conditions, simulating the system using the compartmental approach and a direct (Gillespie) simulation method is inefficient and it is natural to propose a hybrid approach where the region behind the front is modelled as a Fisher–Kolmogorov PDE, the region ahead of the front is treated as a stochastic process, and appropriate matching conditions are applied in the intermediate region.
This idea, and variations thereupon, have been implemented for several different methods and several systems. Its first incarnations consisted of hybrid models for pure diffusion [12,14,15]. In [15] uni-molecular chemical reactions such as chemoabsorption are also considered. In all these methods the boundary or overlapping region between the two regimes is considered fixed.
A further step forward towards algorithms that can cope with more complex situations has recently been proposed by Hellander et al. [21]. Based on previous work on a method to simulate stochastic reaction–diffusion systems on unstructured domains [11], they have proposed a method where, at each voxel, the different species are divided into two classes, namely, mesoscopic (i.e. well-mixed within the voxel and with dynamics determined by the corresponding Master Equation) and microscopic. Concerning the latter, they are assumed to be subject to off-lattice reaction–diffusion dynamics, modelled in terms of the Green's function method for the corresponding Smoluchowski equation proposed by Van Zon and ten Wolde [37,36]. The coupling between mesoscopic and microscopic degrees of freedom within each voxel is accomplished via a splitting scheme. Similar hybrid algorithms are discussed in [1,2,27,28,13,30,31,23,38].
Moro [5] proposed a similar method for simulating stochastic reaction–diffusion systems with propagating fronts in which a macroscopic PDE is coupled with a mesoscopic Master Equation. The two descriptions hold in different sub-domains and are coupled across a moving boundary, using a method which balances the fluxes between the sub-domains on average only.
The hybrid algorithm presented in this paper also couples a mesoscopic description of a stochastic reaction–diffusion system, modelled by an on-lattice, reaction–diffusion Master Equation (RDME), with a reaction–diffusion system, which is obtained from the mean field equations associated with the stochastic model. We remark that whilst our mean-field reaction–diffusion system converges to a reaction–diffusion PDE in the continuum limit, the RDME does not converge to the associated off-lattice (Doi or Schmolokowski) reaction–diffusion models [24,22] in spatial dimensions larger than 2. In light of this, our method should be viewed as the hybridisation of the RDME with its associated on-lattice, mean-field reaction–diffusion limit.
Our method extends the work of [5] to systems without propagating fronts. Furthermore, the interface condition used here preserves the total amount of particles at all times in every single simulation. The interface is also chosen such that the mean field description is still valid at the interface region, and each interface is only one compartment in size. In this way, errors in the flux between the two domains are negligible. We allow multiple interfaces so the stochastic and deterministic regions need not be connected, and interfaces may be dynamic in space and time. For multi-species models, different species may exist in different stochastic and deterministic sub-domains. We test our algorithm on two classical systems, the Fisher–Kolmogorov equation and a spatial Lotka–Volterra system. The former serves as the simplest example of a system with a propagating front, and in our hybrid model a single interface separates the stochastic region at the wave front from the deterministic region behind the wave front. The spatially resolved Lotka–Volterra system serves as a test case for a multi-species reaction–diffusion system, where the hybrid model can, in general, have multiple species-specific interfaces.
The paper is organised as follows: In Section 2 we introduce notations and conventions for stochastic and deterministic reaction–diffusion systems. The methodology for a generic hybrid model with an arbitrary number of species is presented in Section 3 and our algorithm is applied to the Fisher–Kolmogorov equation in Section 4. Finally, the spatially resolved Lotka–Volterra model is investigated in Section 5.
2. Stochastic and deterministic reaction–diffusion systems
2.1. Stochastic reaction–diffusion systems
We consider a system of species defined on a regular lattice. Each species comprises individuals that can migrate to neighbouring lattice sites, or react locally with entities of the same or other species. For simplicity, we describe the system in one spatial dimension, where the lattice index is , but the generalisation to higher dimensions is straightforward. We let , denote the number of individuals of species s in box k at time t, and let h denote the lattice constant, so that is the domain size. If is Markovian, then the time evolution of is governed by a master equation of the form
(1) |
Here, N denotes a generic state specified by the number of individuals of all species s in any compartment k, and likewise , so the sum is understood to be over all states defined by . The probability that the system is in state N at time t is denoted and the transition rate for a change from state N to state is . In what follows, we suppress the time dependence of whenever it is clear that depends on the current time t. We will consider two types of transition rates , one describing a random walk and the second local reactions:
(2) |
In (2), , whereas the specification of the transition rates in the boundary boxes depends on the boundary conditions. Furthermore, denotes the index of a particular reaction, and specifies how reaction r changes the number of individuals of species s. Thus, a step in the random walk changes the spatial distribution of a particular species, whereas reactions act locally in a particular box k.
We define shift operators
(3) |
where the dots indicate that the function can depend on for , , but operator affects only . Substituting (2) in (1), we can write the master equation as
(4) |
2.2. Mean-field limit
The mean quantities evolve in time according
(5) |
The equations for depend on the boundary conditions. If the reaction terms are non-linear, then these equations are not closed but depend on higher moments of . However, if the number of particles of each species is large, , where , we can perform a system size expansion in inverse powers of Ω [35]. The leading order term in the expansion closes the time evolution equations for the means so that
(6) |
By expanding to lowest order in , we obtain the total reaction rate for species s. In the limit we can obtain from (6) continuum reaction–diffusion equations for the particle densities :
(7) |
In (7) we have abused notation, identified for , and introduced a local reaction term , which is obtained from by
(8) |
Note that in higher spatial dimensions (), the h in the denominator needs to be replaced by . Furthermore, we note that to solve (7) numerically, we must discretise the PDE, potentially with a different discretisation than that used for the stochastic compartment model. This might be desirable as for a PDE, typically we want the lattice to be as small as computationally reasonable to avoid discretisation errors; by contrast for the stochastic model we must be careful when simulating non-linear reactions if the lattice becomes similar in size to the reaction radii. Hence, if we do not alter the compartmental model, we cannot decrease the compartment size arbitrarily, see also the discussion in [24]. For the remainder of this paper we use the mean field equation (6), and do not consider the continuum limit (7) any further. We emphasise whether a variable is part of the deterministic or stochastic regime by using capital letters for stochastic variables, and lower case letters for deterministic variables, so (6) is rewritten in terms of the as
(9) |
2.3. Method of solution of the stochastic model
We solve the stochastic model using the Gillespie algorithm [18,19], exploiting the fact that the time to the next event is distributed exponentially. Hence, if denotes one of the non-zero transition rates of the model, and is a random number uniformly distributed in , then
(10) |
gives the time to the next event. Furthermore, if is a second, independent random number uniformly distributed in , we can calculate which event l happens by imposing the condition
(11) |
The advantage of using the Gillespie algorithm is that it simulates exactly the defined Markov process. The hybrid methods discussed in this paper do not depend on the details of how the stochastic process is simulated, and faster algorithms such as the τ leaping algorithm [20,8] can also be used. Since these algorithms are not exact, in this paper we prefer to keep the stochastic simulation as detailed and accurate as possible and use the original Gillespie algorithm, and improve computational performance by switching to a mean field description when appropriate.
3. General algorithm for stochastic/deterministic reaction–diffusion hybrid model
Our algorithm involves decomposing the spatial domain into two regions for each species. In one region the species of interest is modelled in a stochastic way; in the other the mean-field limit is used. In regions where one species is modelled stochastically and the other deterministically, all interaction terms involving the two species are modelled stochastically. The interface condition describes how the two domains are coupled together, and how the interface moves. The following steps are performed by the hybrid model repeatedly:
Hybrid algorithm
For notational simplicity, in the main part of this section, we focus on a one-species system with a single interface. We explain in Appendix A how this algorithm can be modified to account for multiple species and multiple dynamic interfaces.
3.1. Hybrid algorithm with a single interface
Let be our modelling domain, discretised as before into compartments of size h such that is the mean field domain, is the stochastic domain, and labels the interface compartment. We use equation (9) to solve for the variables in the deterministic regime, whereas the evolution of the stochastic variables is determined by simulations of the master equation (1) with transition rates (2). The equations used to determine the variables at will be discussed below.
3.1.1. Fluxes and reactions at the interface
We now explain how the stochastic and deterministic regimes are coupled at the interface. We identify at all times
(12) |
to emphasise that the interface compartment will exhibit both deterministic and stochastic behaviour. Three processes contribute to changes in particle numbers in compartment : fluxes into and from compartment , which is part of the mean field domain, fluxes into and from compartment , which is part of the stochastic domain, and local reactions (see Fig. 1). Hence, we model the flux between compartments and deterministically, and the flux between compartments and in a stochastic manner. If τ denotes the current Gillespie time step, we calculate
(13) |
The flux between boxes and is accounted for by the transition rates
(14) |
We also have
(15) |
as the corresponding flux is already accounted for by equation (13). Finally, we specify the local reactions in a stochastic way via transition rates
(16) |
In Appendix A.3 we discuss an alternative formulation for which local reactions are calculated in the mean field framework.
We remark that due to the interfacial coupling, the mean field solution acquires some stochasticity. Indeed, formally, (13) appears to correspond to a Neumann-like boundary condition at the interface. However, since is subject to both stochastic reactions and a stochastic flux into the stochastic domain, the interface condition appears as a stochastic source for the mean field model at the interface.
The mean behaviour of the full hybrid model is obtained by solving the mean field equations in the whole domain. By construction, these are obtained from the mean of the stochastic model. We now have to convince ourselves that the mean behaviour at the interface gives the mean field limit of the full stochastic model. Note that (13) appears to diverge in the limit . This is because the deterministic contribution due to diffusion includes only the flux between the interface and the deterministic domain. To obtain the full discrete Laplacian, we must add the mean flux to the right-hand side. This is easily obtained if we calculate the mean field limit associated with the transition rates (14), giving , and this contribution is simply added to (13).
3.1.1.1. Fractional particles
Conventionally, the state of the stochastic model is defined by the numbers of individuals in each compartment k, and these are non-negative integers, whereas the densities are real-valued. At the interface the flux into and from the mean field domain is given by equation (13) which alters , and thus , by a real-valued number. However, local reactions, as well as the flux into and from the stochastic domain, are described by transition rates (14) and (16), which effect integer changes in . Consequently, it is not a priori clear whether the stochastic components of the reactions and fluxes at the interface are well defined. First, we note that, by definition, the interface is such that the particle number there is sufficiently large, , so that the mean field description is accurate, and hence agrees closely with the corresponding stochastic model (which has integer-valued particle numbers). Adding a real part between zero and one to a large integer number will not significantly alter the transition rates, so the stochastic model with real-valued will agree closely with both the stochastic model with integer-valued and the mean field model. Formally, the state space of the stochastic model at the interface is thus still in one-to-one correspondence with the integers, which are shifted by the fractional part of . Hence, the stochastic part of the hybrid model is well-defined. There is still a numerical mismatch between the results obtained from a Gillespie algorithm with fractional or with integer-valued numbers, but as long as , we found this mismatch to be negligible.
3.2. Moving interface condition
The condition used to locate the interface is not dictated by a rigorous mathematical requirement: it represents a compromise between performance and accuracy. We view the mean field equations as an approximation to the stochastic model that neglects fluctuations. Hence, the larger the mean field domain, the fewer stochastic fluctuations are taken into account. However, we then typically increase the performance of the simulation.
We determine whether a compartment belongs to the stochastic or mean field domain by comparing the number of particles in that compartment with a threshold number, , such that if , then box k is part of the stochastic domain, and otherwise part of the mean field domain.1 This is justified since fluctuations typically scale with the square root of the number of particles in a box, . As the number of individuals may change in time, the position of the interface may also evolve in space and time.
We also implement a minimum domain size condition as a simple check that no connected component of the mean field domain is allowed to become too small. Imagine, for instance, that the mean field domain is enclosed by two disconnected components of the stochastic domain. If the mean field domain comprises only a few compartments in the discretisation, it might be computationally more efficient to remove the mean field domain and absorb it into the stochastic domain, as then we do not have to calculate the interface condition. In the simulations performed in this paper a minimum domain size of 5 compartments for the mean field model was used. In higher dimensions, we anticipate that a cube with a length of 5 compartments would work well. We stress, however, that the choice of threshold conditions is model specific, and hence the minimal domain size requirement should be chosen on a case-by-case basis.
After the position of the interface is updated, we must check that all particle numbers in the stochastic domain are integer values, paying particular attention to compartments that were previously part of the mean field domain. By mass conservation, this will result in a renormalisation of the density functions in the mean field domain: this procedure is discussed in Section 3.3.
The following steps are used to adjust the position of the interface:
-
1.
Calculate threshold condition to locate interface
-
2.
Calculate minimum domain size condition
-
3.
Renormalise particles and densities
3.3. Renormalisation of particle distribution
When the interface moves such that a compartment previously treated deterministically and, hence, described by real-valued densities , enters the stochastic domain, we need to ensure that the number of particles becomes integer-valued. By mass conservation, we cannot simply remove the fractional part of : instead we rescale the densities outside the stochastic domain.
Let us focus on a single box k (and assume that the single interface has moved by only one compartment, so that is now non-integer-valued but part of the stochastic domain). We interpret the fractional part
(17) |
as the probability that an additional particle is in this box. We draw a uniform random number . If then we place the particle in box k; otherwise it is placed in the deterministic domain. To preserve particle numbers, we renormalise the density function in the deterministic regime and reset so that if then
(18) |
and otherwise
(19) |
A similar rescaling procedure was used in [15], where a reaction–diffusion PDE was coupled with a Brownian dynamics model. There, it was found that particles crossing the interface twice can cause increased variance. Our algorithm does not lead to an observable increase in variance as, by construction, the interface is chosen so that the mean field and interface domain always contain a large number of particles.
4. Stochastic Fisher–Kolmogorov equation
In this section, we apply our algorithm to the Fisher–Kolmogorov equation,
(20) |
Here, D is the diffusion coefficient, λ is the growth rate and Ω is the carrying capacity.
A stochastic, lattice-based version of equation (20) was studied in [4,6] and is defined by a master equation with the transition rates
(21) |
with Dirichlet boundary conditions , . The evolution of the means is given by
(22) |
Defining , with , the mean field equation for n reduces to (20) if , as the van Kampen approximation at leading order implies the moment reduction .
We will now use the hybrid algorithm to simulate travelling wave solutions as we vary several model parameters. As noted in [4,6] for the stochastic Fisher–Kolmogorov equation with the conventions used in the present paper and in [5,7,9] for alternative formulations, stochastic effects can produce wave speeds which deviate from the deterministic Fisher–Kolmogorov equation (20), . The three other parameters control the various limits: yields the stochastic model from the hybrid model, yields the mean field model from the stochastic model, and yields the PDE from the mean field model. We will study the effect of variation in these three parameters on travelling wave speeds in the next subsection.
4.1. Fisher–Kolmogorov travelling waves
We now study travelling wave solutions, fixing , . We ensure that in all simulations the travelling wave is sufficiently far from the boundaries, so that effects associated with the finite domain size are negligible. As initial conditions we approximate the travelling wave solution of the PDE (20), so that we can focus on wave propagation, rather than wave formation.
Fig. 2 compares travelling wave solutions generated from the stochastic model, the hybrid model (with ) and the PDE. In each plot we present a single realisation and the mean of 256 realisations of the stochastic (Fig. 2(a), (c), (e)) and hybrid models (Fig. 2(b), (d), (f)) together with the numerical solution of the corresponding PDE. We fix , , , and allow to vary Ω. We note that the travelling wave speeds for the stochastic and hybrid models are slower than those of the PDE, and the speed increases with Ω. Furthermore, the relative noise, i.e. the fluctuation of a single stochastic or hybrid realisation about the mean, decreases as Ω increases. Finally, the wave front of the PDE appears to be steeper compared to the wave front of the mean of 256 realisations both in the stochastic and hybrid models compared to the PDE, and the steepness increases with Ω. This is explained as the different realisations of the stochastic model can have different speeds, hence the average broadens the wave front.
We now compare the stochastic to the hybrid model. For , so , neither single realisations nor the mean of the stochastic model (Fig. 2(a)) differ significantly from the hybrid model (Fig. 2(b)), as the threshold of the hybrid model is considerably larger than the carrying capacity, so almost certainly the entire domain of the hybrid model will be stochastic. When , so , the stochastic model (Fig. 2(c)) and the hybrid model (Fig. 2(d)) differ significantly away from the wave front. The stochastic model is much noisier, but the noise in the hybrid model is non-zero as noise from the stochastic domain can diffuse into the mean field domain, raising the particle number above the threshold value. Note that fluctuations can also reach beyond the threshold in the hybrid model due to the minimum domain size requirement for the deterministic domain. When , so , the noise away from the wave front associated with the stochastic model (Fig. 2(e)) is absent in the hybrid model (Fig. 2(f)). Nevertheless, the wave fronts of the means appear similar. Hence, for the parameter values used, the hybrid model represents a good approximation to the stochastic model, producing travelling waves with the same speed. If the carrying capacity is larger than the threshold Θ then fluctuations around the carrying capacity behind the front are suppressed, without affecting the wave speed.
Fig. 3 shows the dependence of the wave speed on the lattice constant. We compare the stochastic model against the mean field model, i.e. the finite difference discretisation of the PDE with the same lattice constant, and the hybrid model. Densities are fixed by adjusting . Likewise, , but we also compare to the hybrid model with a fixed threshold . The wave speed c is calculated by observing that the change of the total number of particles in time, averaged over all simulations, , should be proportional to c. We approximate the wave speed by comparing after fixed time intervals , obtaining . The finite difference model converges, as expected, to as , even though every finite lattice spacing will still result in some visible dispersion after a long time. The stochastic model has a significantly lower wave speed and the wave speed of the hybrid model, with , converges to that for the stochastic model. However, if , then the hybrid model does not appear to converge to the stochastic model.
Fig. 4(a) shows how the wave speed varies with the carrying capacity Ω for the stochastic and hybrid models. Here, in all cases. The wave speeds for the stochastic model are identical to those obtained in [4], and for large Ω they approach the wave speed of the mean field theory as expected by general theory [26,35], this value is slightly above because h is finite. When , the wave speeds for the hybrid and stochastic models are indistinguishable. We remark that a naive expectation that the hybrid model should be intermediate between the PDE and the stochastic model does not imply that the wave speed of the hybrid model should be intermediate between their wave speeds. However, a correct expectation is that as Θ increases, the agreement between the hybrid and stochastic models, including their wave speeds, increases. Fig. 4(b) shows this clearly. Here, we have fixed and varied Θ. The wave speed monotonically approaches that of the stochastic model (not shown, but it is formally obtained as ), and for the wave speed of the hybrid model is almost identical to that of the stochastic model. Due to the observation in those numerical simulations that the wave speed seems to plateau for high and low values of Θ, we have fitted the function to the values obtained from the simulations, and obtained a very good fit for the values , , , .
5. Spatial stochastic Lotka–Volterra system
We now investigate a predator–prey system with predator M and prey N. In the stochastic model, each species can jump to neighbouring lattice sites, the prey reproduce at rate a, predators die at rate c and consume prey and reproduce at rate b. The transition rates are given by
(23) |
For simplicity, we choose the interaction reaction such that each time a prey is eaten by a predator, a single new predator is born. The mean field and continuum limit corresponds to the classical spatial Lotka–Volterra equations:
(24) |
Here, and are prey and predator densities related to and respectively in the same way as before.
As before, we use a finite difference approximation to solve equation (24), discretising in space using the same lattice as for the stochastic model. For the time integration we use the Runge–Kutta method. All plots are normalised so that the number of predators or prey in a box is shown, rather than the corresponding density.
There are now four subdomains to consider, depending on whether each of the predator and prey evolve deterministically or stochastically. For notational simplicity we identify and where appropriate. We will now explain explicitly which transition rates define the stochastic model, and which PDEs correspond to the mean field model solved in the respective subdomain. The interfaces between the subdomains are as given in Section 3.1.1.
Deterministic predator and deterministic prey
In this region, we solve Equations (24), and set the transition rates (23) equal to zero, so no stochastic reactions occur.
Deterministic predator and stochastic prey
The deterministic equation are:
(25) |
and the transition rates are the following
(26) |
Stochastic predator and deterministic prey
Deterministic part equations are described below,
(27) |
and the transition rates are the following
(28) |
Stochastic predator and stochastic prey
Here both species are fully stochastic and we use transition rates (23). We consider two scenarios appearing in the spatial Lotka–Volterra system, and compare the hybrid model to the stochastic and deterministic models. Both scenarios correspond to solutions of the PDE which oscillate in space and time, but in one case the oscillations bring the total number of prey so close to zero that extinction is possible in the stochastic model.
5.1. Oscillatory behaviour without observable extinction
The domain of length is divided into boxes, so . Initially it contains a spatially homogeneous distribution of prey and predators so that , . The model parameters are fixed so that , , , . With Neumann boundary conditions, equations (24) remain spatially homogeneous at all times, and both populations oscillate in time. Typical results are presented in Fig. 5, and show that the peak in prey numbers is followed by a peak in the number of predators. For this choice of parameter values the minimum number of individuals of either species is always sufficiently large that extinction in the stochastic, spatial model is almost impossible. Corresponding results for the stochastic and hybrid models for two choices of the threshold values ( and ) are shown in Fig. 6. The column on the left shows the spatial profile of the number of predators and prey in a given box at time , both for a single realisation and the mean of 256 different realisations. Comparing either predator and prey numbers, we note that the means for the stochastic and hybrid models appear similar for both values of Θ (see Fig. 6(a), (c), (e)), and are fairly homogeneous, whereas single realisations of either model differ markedly. As expected, the profile of predator and prey numbers in the stochastic model is noisy throughout the domain, whereas noise is suppressed in the hybrid model when the population numbers exceed the threshold. We observe the predator numbers in Fig. 6(c) are above the threshold and hence smoothly distributed in space, but they are not homogeneous, in contrast to the profile of the mean.
The column to the right in Fig. 6 shows the time evolution of the spatial mean of the number of prey, . We note that the means for the stochastic model (Fig. 6(b)) and the hybrid model are similar for either threshold (Figs. 6(d), (f)). In all cases, we observe oscillatory behaviour around , the steady state of the corresponding PDE Eq. (24), with a decreasing amplitude. This contrasts with the dynamics of the PDE (see Fig. 5) where the amplitude of oscillations was constant in time. This is because stochastic fluctuations may cause oscillations to fall out of synchrony and hence oscillations average out. Hence, the damping effect is stronger when plotting the mean of all realisations, rather than a single realisation, where the amplitude can fluctuate in time. However, this also implies that the PDE is not a good approximation to the mean over different realisations. We finally remark that while the plots of the spatial mean number of predators look different for the stochastic and hybrid models with the two thresholds, this is not significant as different realisations of the same model (not shown here) also look different. To properly compare the stochastic and hybrid models, we need quantitative measures (Table 1). We calculate the spatial and temporal average of the mean number of prey across 256 different realisations,
(29) |
over the simulation time of , and likewise the average of the mean number of predators. In this way we obtain a single number with large statistical significance, which is easier to compare as at individual time points, the oscillations in different realisations can be out of synchrony. We observe good agreement between the models. The values reported in Table 1 are in good agreement with the steady state values of the corresponding ODE model, but slightly different, as the temporal oscillations are not necessarily symmetric with respect to the steady state value. We then measure the standard deviation of the spatio-temporal averages, which is for prey numbers, and likewise for predator numbers. Here, we note that the stochastic model is in close agreement with the hybrid model with ; this agreement is less striking when . We conclude that the hybrid model can reproduce stochastic measures of the stochastic model, such as the standard deviation, and the agreement is better for larger values of the threshold Θ.
Table 1.
Stochastic | Hybrid Θ = 25 | Hybrid Θ = 10 | Mean field | |
---|---|---|---|---|
30.50 ± 0.05 | 30.32 ± 0.05 | 30.30 ± 0.16 | 30.47 | |
20.35 ± 0.04 | 20.23 ± 0.04 | 20.22 ± 0.13 | 20.20 | |
16.0 ± 0.3 | 16.0 ± 0.3 | 15.4 ± 0.4 | ||
12.8 ± 0.3 | 12.8 ± 0.3 | 12.3 ± 0.4 |
5.2. Extinction and blow-up
We now choose a spatially homogeneous population of prey, , , a number of predators present only on the left side of the domain, , , , , and , , Neumann boundary conditions and parameters , , , , . This scenario is a typical example of invasion of a predator into a population of prey, leading to spatial and temporal fluctuations even in the purely deterministic model (Fig. 7).
Fig. 7 shows how the number of predators and prey at the two boundaries (, ) vary in time for the mean field model. We note that during the first few oscillations both predator and prey populations are close to zero. In the corresponding stochastic model, the population can only be integer-valued, so a value below 1 in the deterministic model indicates that extinction of the population is likely. At later times, we observe regular oscillations with minima significantly above 0, and conclude that if extinction were to occur in the stochastic model, it would most likely happen at early times. Fig. 8 confirms these expectations. Fig. 8(a) shows that, for the stochastic model, the spatial average of the number of predators (or prey) may exhibit oscillations similar to those of the deterministic model. However, extinction of either population can also occur. Fig. 8(c) shows that if the prey die out first, then, necessarily, the predators will also die out. On the other hand, if the predators die out first, then prey numbers will blow up (see Fig. 8(e)). Figs. 8(b), (d), (f) confirm that the hybrid model can reproduce each of these three qualitatively different scenarios. Since statistics for the mean and standard deviation are not meaningful if the prey population blows up, we compare the frequency of extinction events in the stochastic and hybrid models.
The results presented in Table 2 suggest that the hybrid model with a threshold of or larger has a similar probability of extinction as the stochastic model. We conclude that in this case the hybrid model provides a good approximation to the stochastic model. We finally investigate the performance gain obtained by using the hybrid model.
Table 2.
Stochastic | Hybrid 100 | Hybrid 50 | Hybrid 25 | Hybrid 10 | |
---|---|---|---|---|---|
Prey | 0.46 | 0.45 | 0.46 | 0.45 | 0.43 |
Predator | 0.59 | 0.57 | 0.59 | 0.61 | 0.56 |
Table 3 compares the computational time needed to perform 256 simulations of the stochastic and hybrid models proceeding until extinction or time in all cases. The simulations were performed on a Xeon-2680 16-core server with 2.7 GHz and 128 GB RAM. Simulations of the stochastic model were stopped once predator extinction occurred, as in that case the population of prey necessarily blows up. Hence, the advantage in performance of the hybrid model is even larger than the numbers indicate.
Table 3.
Stochastic | Hybrid 100 | Hybrid 10 | |
---|---|---|---|
Simulation time in hours | 40.0 | 10.3 | 4.8 |
6. Conclusions
In this paper we have presented a hybrid algorithm which couples a stochastic reaction–diffusion system on a lattice to its associated mean field limit, which can be seen as the finite-difference discretisation of a reaction–diffusion PDE. Our algorithm preserves mass at the interface between the stochastic and deterministic domains, and these domains need neither to be static nor connected. Furthermore, for multi-species systems, the corresponding stochastic and deterministic domains may differ for individual species. We also introduced a normalisation procedure to ensure that the stochastic domain contains only integer numbers of particles when the mean field equations are evolved or the interface is moved. With the example of the spatial Lotka–Volterra system, this paper provides a detailed study of a multi-species hybrid system that can accommodate multiple moving interfaces. We found that our hybrid algorithm can produce stochastic effects that are not present in the corresponding mean field model with the same frequency as the stochastic model, while the time taken to perform hybrid simulations is much shorter than that for fully stochastic simulations.
At present, we solve the deterministic equations on the same grid as the stochastic model. For computational reasons, one might consider other numerical schemes to solve the mean field equations [11,25]. This could be particularly important for simulating systems in higher spatial dimensions and geometries with curved boundaries because, in such cases, finite difference discretisations might not be sufficiently accurate. Another modification to determine the position of our algorithm could be to refine the condition used at the interface. For the models studied in this paper, we found that counting the number of particles in a box provides a good threshold condition for when to use the stochastic, and when to use the mean field, model. This is justified as typically stochastic fluctuations scale with the square root of the number of particles. However, for some systems one might need to choose the domains directly according to the size of the fluctuations.
Finally, it would be interesting to test our algorithm on reaction–diffusion systems involving larger numbers of individuals, such as models of cancer growth [16,34], angiogenesis [32] or cell polarity [29]. Such considerations are beyond the scope of this paper and are therefore postponed for future research.
Acknowledgements
This publication was based on work supported in part by Award No KUK-C1-013-04, made by King Abdullah University of Science and Technology (KAUST). TA gratefully acknowledges the Spanish Ministry for Science and Innovation (MICINN) for funding under grant MTM2011-29342 and Generalitat de Catalunya for funding under grant 2009SGR345. PG acknowledges Wellcome Trust [WT098325MA] and Junta de Andalucía Project FQM 954.
Footnotes
If this condition splits the whole modelling domain such that the stochastic domain consists of multiple, disconnected components we either need to introduce multiple interfaces, see Appendix A.4, or connect the disconnected components.
Appendix A. Alterations of the hybrid algorithm
A.1. Large stochastic time step
A significant problem with continuous diffusion equations is that, in finite times, mass can spread arbitrarily far. As a result, when the PDE is evolved, its solution can leak arbitrarily far into the stochastic domain unless this is prevented by the imposition of an artificial condition at the interface. In our hybrid algorithm, this problem is avoided by using a finite-difference approximation of the PDE with the same lattice size as the stochastic model so that on each time step the PDE solution spreads by only one spatial compartment. Thus, the PDE solution can, in one time step, enter the interface region, but not the stochastic domain. We remark that the infinitely fast spread associated with the continuous diffusion equation is not physically realistic, and consequently the finite difference approximation to the diffusion PDE is not necessarily less realistic than the PDE itself.
A problem can arise when the time τ to the next event is larger than the maximum time step such that the finite difference scheme converges. In this case, we need several iterations of (9) to evolve the PDE until time τ, and during this time the PDE solution could leak into the stochastic domain. This problem can be avoided by increasing the size of the interface region, or one could choose a smaller lattice constant for the PDE regime (compared to the stochastic domain). In the examples shown in the present paper, the problem of is rare. When we encountered , we chose i such that the finite difference scheme (9) converges with time step . We then iterated (9) i times with time step , keeping the interface, still consisting of one compartment only, fixed. Hence, the interface is treated as a Neumann-no-flux boundary during the time step τ. We observed that the total change of mass in the interface box is small relative to the total amount of mass present, so the error we introduce due to the artificial Neumann condition is negligible.
A related problem is that when mass moves from the PDE into the interface domain, this, in principle, changes the transition rates of stochastic reactions of the interface, and drift terms to the master must be added to equation. However, as discussed above, for the simulations performed in this paper the change of mass in the interface compartment is small within one time step. Hence, the change in the transition rates will also be small and can be neglected.
A.2. Small stochastic time step
If the random Gillespie time step is much smaller than the PDE convergence time step, , a simple modification of our algorithm consists of not iterating the mean field domain during every time step, but only after I time steps such that for the i Gillespie time steps , we have , but the next time step is likely to bring the cumulative time step above .
A.3. Deterministic interface reactions
The interface is chosen such that the mean-field equations are sufficiently accurate to represent the system at the interface. In Section 3.1.1, we have described the reactions in the interface compartment in a stochastic way, but we could also describe the reactions deterministically by replacing equation (13) with
(A.1) |
Then, the transition rates describing stochastic reactions in the interface compartment should be set to zero.
A.4. Multiple interfaces for different species
In many situations, the regions where the concentration of one species is high, and hence the deterministic PDE description is valid, are different for different species. Hence, there is often a requirement to have separate interfaces for the different species. We can use the interface condition as in Section 3.1.1 for each species separately. However, we will now encounter regions of space where some species are modelled stochastically and others deterministically. Let be stochastic for , and be deterministic in the same interval, where, as before, we identify , . For simplicity, we focus on a single reaction involving only those two species, which in the full stochastic model would be written as
(A.2) |
As species 2 is modelled deterministically, we replace by and obtain
(A.3) |
Hence, the reaction is still stochastic. However, is real-valued. The situation is thus similar to how reactions were dealt with at a single-species interface. The real-valuedness does not cause any problems as we assume is large in the interface region. If the reaction vector is negative, we have to assume , so that a single stochastic reaction cannot lead to negative values of . This is easily ensured by choosing the hybrid model threshold accordingly high.
We can regard this reaction as a stochastic source for an otherwise deterministic . The deterministic part of the evolution of is described by
(A.4) |
The corresponding equations at or require modifications of the flux term in the same way as the equations in the single species case, equation (13). We have denoted reactions which only depend on as .
The finite difference equation (9) was chosen such that it produces exactly the mean behaviour of the underlying stochastic model. We now confirm that the mixed model (A.3) and (A.4) still produces the same mean behaviour in the limit of large particle numbers. This means we assume , with , whereas already to justify the use of the deterministic equations. We have, by the derivation of (6), that
(A.5) |
But this means we will also have
(A.6) |
as required.
References
- 1.Alexander F.J., Garcia A.L., Tartakovsky D.M. Algorithm refinement for stochastic partial differential equations: I. Linear diffusion. J. Comput. Phys. 2002;182(1):47–66. [Google Scholar]
- 2.Alexander F.J., Garcia A.L., Tartakovsky D.M. Algorithm refinement for stochastic partial differential equations: II. Correlated systems. J. Comput. Phys. 2005;207(2):769–787. [Google Scholar]
- 3.Bernstein D. Simulating mesoscopic reaction–diffusion systems using the Gillespie algorithm. Phys. Rev. E. 2005;71(4):041103. doi: 10.1103/PhysRevE.71.041103. [DOI] [PubMed] [Google Scholar]
- 4.Breuer H.-P., Huber W., Petruccione F. Fluctuation effects on wave propagation in a reaction–diffusion process. Phys. D, Nonlinear Phenom. 1994;73(3):259–273. [Google Scholar]
- 5.Breuer H.-P., Huber W., Petruccione F. Hybrid method for simulating front propagation in reaction–diffusion systems. Europhys. Lett. 1995;30(2):69. [Google Scholar]
- 6.Breuer H.-P., Huber W., Petruccione F. The macroscopic limit in a stochastic reaction–diffusion process. Europhys. Lett. 1995;30(2):69. [Google Scholar]
- 7.Brunet É., Derrida B. Effect of microscopic noise on front propagation. J. Stat. Phys. 2001;103(1–2):269–282. [Google Scholar]
- 8.Cao Y., Gillespie D.T., Petzold L.R. Efficient step size selection for the tau-leaping simulation method. J. Chem. Phys. 2006;124(4):044109. doi: 10.1063/1.2159468. [DOI] [PubMed] [Google Scholar]
- 9.Conlon J.G., Doering C.R. On travelling waves for the stochastic Fisher–Kolmogorov–Petrovsky–Piscunov equation. J. Stat. Phys. 2005;120(3–4):421–477. [Google Scholar]
- 10.Elf J., Ehrenberg M. Spontaneous separation of bi-stable biochemical systems into spatial domains of opposite phases. Syst. Biol. 2004;1:230–235. doi: 10.1049/sb:20045021. [DOI] [PubMed] [Google Scholar]
- 11.Engblom S., Ferm L., Hellander A., Lötstedt P. Simulation of stochastic reaction–diffusion processes on unstructured meshes. SIAM J. Sci. Comput. 2009;31(3):1774–1797. [Google Scholar]
- 12.Flegg M.B., Chapman S.J., Erban R. Two regime method for optimizing stochastic reaction–diffusion simulations. J. R. Soc. Interface. 2012;9:859–868. doi: 10.1098/rsif.2011.0574. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.Flegg M.B., Hellander S., Erban R. Convergence of methods for coupling of microscopic and mesoscopic reaction–diffusion simulations. 2013. arXiv:1304.7393 [DOI] [PMC free article] [PubMed]
- 14.Flekkøy E., Feder J., Wagner G. Coupling particles and fields in a diffusive hybrid model. Phys. Rev. E. 2001;64(6):066302. doi: 10.1103/PhysRevE.64.066302. [DOI] [PubMed] [Google Scholar]
- 15.Franz B., Flegg M.B., Chapman S.J., Erban R. Multiscale reaction–diffusion algorithms: PDE assisted brownian dynamics. SIAM J. Appl. Math. 2013;73:1224–1247. [Google Scholar]
- 16.Gatenby R.A., Gawlinski E.T. A reaction–diffusion model of cancer invasion. Cancer Res. 1996;56(24):5745–5753. [PubMed] [Google Scholar]
- 17.Gibson M.A., Bruck J. Efficient exact stochastic simulation of chemical systems with many species and many channels. J. Phys. Chem. A. 2000;104:1876–1889. [Google Scholar]
- 18.Gillespie D.T. A general method for numerically simulating the stochastic time evolution of coupled chemical reactions. J. Comput. Phys. 1976;22(4):403–434. [Google Scholar]
- 19.Gillespie D.T. Exact stochastic simulation of coupled chemical reactions. J. Phys. Chem. 1977;81(25):2340–2361. [Google Scholar]
- 20.Gillespie D.T. Approximate accelerated stochastic simulation of chemically reacting systems. J. Chem. Phys. 2001;115(4):1716–1733. [Google Scholar]
- 21.Hellander A., Hellander S., Lotstedt P. Coupled mesoscopic and microscopic simulation of reaction–diffusion processes in mixed dimensions. Multiscale Model. Simul. 2012;10:585–611. [Google Scholar]
- 22.Hellander S., Hellander A., Petzold L. Reaction rates for mesoscopic reaction–diffusion kinetics. Phys. Rev. E. 2015;91:023312. doi: 10.1103/PhysRevE.91.023312. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Hepp B., Gupta A., Khammash M. Adaptive hybrid simulations for multiscale stochastic reaction networks. J. Chem. Phys. 2015;142(3):034118. doi: 10.1063/1.4905196. [DOI] [PubMed] [Google Scholar]
- 24.Isaacson S.A. A convergent reaction–diffusion master equation. J. Chem. Phys. 2013;139(5):054101. doi: 10.1063/1.4816377. [DOI] [PubMed] [Google Scholar]
- 25.Isaacson S.A., Peskin C.S. Incorporating diffusion in complex geometries into stochastic chemical kinetics simulations. SIAM J. Sci. Comput. 2006;28(1):47–74. [Google Scholar]
- 26.Kurtz T.G. Solutions of ordinary differential equations as limits of pure jump Markov processes. J. Appl. Probab. 1970;7(1):49–58. [Google Scholar]
- 27.Li C., Ebert U., Hundsdorfer W. Spatially hybrid computations for streamer discharges with generic features of pulled fronts: I. Planar fronts. J. Comput. Phys. 2010;229(1):200–220. [Google Scholar]
- 28.Li C., Ebert U., Hundsdorfer W. Spatially hybrid computations for streamer discharges: II. Fully 3d simulations. J. Comput. Phys. 2012;231(3):1020–1050. [Google Scholar]
- 29.McKane A.J., Biancalani T., Rogers T. Stochastic pattern formation and spontaneous polarisation: the linear noise approximation and beyond. Bull. Math. Biol. 2014;76(4):895–921. doi: 10.1007/s11538-013-9827-4. [DOI] [PubMed] [Google Scholar]
- 30.Robinson M., Flegg M., Erban R. Adaptive two-regime method: application to front propagation. J. Chem. Phys. 2014;140(12):124109. doi: 10.1063/1.4868652. [DOI] [PubMed] [Google Scholar]
- 31.Sanft K.R., Othmer H.G. Constant-complexity stochastic simulation algorithm with optimal binning. 2015. arXiv:1503.05832 [DOI] [PMC free article] [PubMed]
- 32.Spill F., Guerrero P., Alarcon T., Maini P.K., Byrne H.M. Mesoscopic and continuum modelling of angiogenesis. J. Math. Biol. 2014:1–48. doi: 10.1007/s00285-014-0771-1. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 33.Stundzia A.B., Lumsden C.J. Stochastic simulation of coupled reaction–diffusion processes. J. Comput. Phys. 1996;127(1):196–207. [Google Scholar]
- 34.Swanson K.R., Bridge C., Murray J., Alvord E.C., Jr. Virtual and real brain tumors: using mathematical modeling to quantify glioma growth and invasion. J. Neurol. Sci. 2003;216(1):1–10. doi: 10.1016/j.jns.2003.06.001. [DOI] [PubMed] [Google Scholar]
- 35.Van Kampen N.G. North-Holland; 1992. Stochastic Processes in Physics and Chemistry, vol. 1. [Google Scholar]
- 36.Van Zon J.S., ten Volde P.R. Green's-function reaction dynamics: a particle-based approach for simulating biochemical networks in time and space. J. Chem. Phys. 2005;123:234910. doi: 10.1063/1.2137716. [DOI] [PubMed] [Google Scholar]
- 37.Van Zon J.S., ten Volde P.R. Simulating biochemical networks at the particle level in time and space: Green's function reaction dynamics. Phys. Rev. Lett. 2005;94:128103. doi: 10.1103/PhysRevLett.94.128103. [DOI] [PubMed] [Google Scholar]
- 38.Yates C.A., Flegg M.B. The pseudo-compartment method for coupling partial differential equation and compartment-based models of diffusion. J. R. Soc. Interface. 2015;12(106) doi: 10.1098/rsif.2015.0141. [DOI] [PMC free article] [PubMed] [Google Scholar]