1 Introduction

In his pioneering work, Turing (1952) showed that stable spatial patterns can develop in reaction-diffusion systems which include chemical species (morphogens) with different diffusion constants. Considering a system of two chemical species with concentrations \(u(x,t)\) and \(v(x,t)\) in a one-dimensional interval \(x \in [0,L]\), the underlying deterministic model of Turing patterns can be written as a system of two reaction-diffusion partial differential equations (PDEs)

$$\begin{aligned} \frac{\partial u}{\partial t}&= D_u \frac{\partial ^2 u}{\partial x^2} + f_1(u,v), \end{aligned}$$
(1)
$$\begin{aligned} \frac{\partial v}{\partial t}&= D_v \frac{\partial ^2 v}{\partial x^2} + f_2(u,v), \end{aligned}$$
(2)

where \(D_u\) and \(D_v\) are diffusion constants of morphogens \(u\) and \(v\), respectively, and \(f_1(u,v)\) and \(f_2(u,v)\) describe chemical reactions. Then, the standard analysis proceeds as follows (Murray 2002; Satnoianu et al. 2000): a homogeneous steady state \(u(x,t) \equiv u_\mathrm{s}\), \(v(x,t) \equiv v_\mathrm{s}\) is found by solving \(f_1(u_\mathrm{s},v_\mathrm{s}) = 0\) and \(f_2(u_\mathrm{s},v_\mathrm{s})=0\). It is shown that the homogenous steady state is stable when \(D_u = D_v\), and conditions on \(f_1\), \(f_2\), \(D_u\) and \(D_v\) are obtained which guarantee that the homogeneous steady state will become unstable for \(D_u \ne D_v\). Then, Turing patterns are observed at the steady state.

The above argument was extensively analyzed in the mathematical biology literature, and conditions for Turing patterns have been determined (Murray 2002; Satnoianu et al. 2000). Experimental studies with chemical systems (chlorite-iodide-malonic acid reaction) demonstrated Turing type patterns (Kepper et al. 1991; Quyang and Swinney 1991). There has also been experimental evidence that a simple Turing patterning mechanism can appear in developmental biology, for example, in the regulation of hair follicle patterning in developing murine skin (Sick et al. 2006). One of the criticisms of Turing patterns is their lack of robustness (Maini et al. 2012). The PDE system (1)–(2) can have several stable non-homogeneous solutions which the system can achieve with relatively small perturbations to the initial condition. Considering PDEs in a suitably growing domain, one can obtain an additional constraint on the system which restricts the set of accessible patterns, increasing the robustness of pattern generation with respect to the initial conditions (Crampin et al. 1999; Barrass et al. 2006). However, to assess the sensitivity of patterns with respect to fluctuations, stochastic models have to be considered (Maini et al. 2012; Black and McKane 2012).

One of the most common approaches to stochastic reaction-diffusion modeling is formulated in the compartment-based (lattice-based) framework (Erban et al. 2007). In the one-dimensional setting, the compartment-based analogue of the PDE model (1)–(2) can be formulated as follows: The computational domain \([0,L]\) is divided into \(K\) compartments of length \(h = L/K\). We denote the number of molecules of chemical species \(U\) (resp. \(V\)) in the \(i\)-th compartment \(((i-1)h,ih)\) by \(U_i\) (resp. \(V_i\)), \(i=1,2,\dots ,K\). Then, the diffusion of \(U\) and \(V\) is described by the following chains of “chemical reactions” (Erban et al. 2007):

(3)
(4)

where

$$\begin{aligned} d_u = \frac{D_u}{h^2} \qquad \text{ and } \qquad d_v = \frac{D_v}{h^2}. \end{aligned}$$
(5)

Reactions are localized to each compartment. For example, considering the commonly studied Schnakenberg reaction system (Schnakenberg 1979), chemical reactions in the \(i\)-th compartment are described by (Qiao et al. 2006):

(6)

The above formulation (3), (4) and (6) describes the stochastic reaction-diffusion model as a system of (\(8K-4\)) chemical reactions: We have (\(K-1\)) diffusive jumps of \(U\) molecules to the left (resp. right), (\(K-1\)) diffusive jumps of \(V\) molecules to the left (resp. right) and \(4 K\) reactions (6). This system can be simulated using the Gillespie algorithm (Gillespie 1977), or its equivalent formulations (Cao et al. 2004; Gibson and Bruck 2000). In Fig. 1, we present an illustrative simulation of the reaction-diffusion system (3), (4) and (6). We clearly see that Turing patterns can be observed for the chosen set of dimensionless parameters: \(k_1 = 4 \times 10^3\), \(k_2 = 2\), \(k_3 = 1.2 \times 10^3\), \(k_4 = 6.25 \times 10^{-8}\), \(D_u = 10^{-3}\) and \(D_v = 10^{-1}\). Compartment values above (resp. below) the homogeneous steady-state values \(U_\mathrm{{st}} = 200\) and \(V_\mathrm{{st}} = 75\) are colored black (resp. light gray) to visualize stochastic Turing patterns. Let us note that the rate constants \(k_1\) and \(k_3\) are production rates per unit of area. The stochastic model uses the production rates per one compartment which are given as \(k_1 h\) and \(k_3 h\), respectively. More details of this stochastic simulation are given in Sect. 2 where we introduce the corresponding propensity functions (10)–(11).

Fig. 1
figure 1

Turing patterns for the stochastic reaction-diffusion system (3), (4) and (6). a Numbers of molecules of chemical species \(U\) in each compartment at time \(18\); b the same plot for chemical species \(V\). The initial condition was the homogeneous steady state \(U_\mathrm{{st}} = 200\) and \(V_\mathrm{{st}} = 75\) for the parameters given in the text. The values of \(U_\mathrm{{st}}\) and \(V_\mathrm{{st}}\) are denoted by dashed lines. Adapted from Erban et al. (2007) with permission

The compartment-based approach has been used for both theoretical analysis and computational modeling (Scott et al. 2011; Hattne et al. 2005). The regions where stochastic Turing patterns can be expected were calculated using the linear noise analysis (Biancalani et al. 2010; McKane et al. 2014; Butler and Goldenfeld 2011). These studies were also generalized to growing domains (Woolley et al. 2011a, b), to stochastic reaction-diffusion models with delays (Woolley et al. 2012), to non-local trimolecular reactions (Biancalani et al. 2011) and to stochastic Turing patterns on a network (Asslani et al. 2012). Compartment-based software packages were developed (Hattne et al. 2005) and applied to modeling biological systems (Fange and Elf 2006). Computational approaches were also generalized to non-regular compartments (lattices) and complex geometries (Engblom et al. 2009; Isaacson and Peskin 2006). Stochastic simulations of Turing patterns (Twomey 2007; Fu et al. 2008; Hori and Hara 2012) and excitable media (Vigelius and Meyer 2012) were also presented in the literature. However, these theoretical and computational studies use the same discretization for each chemical species. In this paper, we will demonstrate that, in the case of Turing patterns, this simplifying assumption can undesirably bias the obtained theoretical and computational results.

One of the assumption of the compartment-based modeling is that compartments are small enough so that they can be assumed well-mixed. In particular, the relative size of diffusion and reaction constants determine the appropriate size of the compartment (Erban and Chapman 2009; Isaacson 2009; Hellander et al. 2012). It can be shown that there exists a limitation on the compartment size from below whenever the reaction-diffusion system includes a bimolecular reaction (Erban and Chapman 2009; Isaacson 2009; Hellander et al. 2012). There are also bounds on the compartment size from above (Kang et al. 2012; Hu et al. 2014), again the diffusion constant plays an important role in these estimates. In the case of Turing patterns, we have chemical species with different diffusion constants. For example, in the illustrative simulation in Fig. 1, we have \(D_v/D_u = 100\), i.e., the diffusion constant of \(V\) is 100-times larger than the diffusion constant of \(U\). However, we used the same discretization for both \(U\) and \(V\) which is schematically denoted in Fig. 2a. If we take into account that \(V\) diffuses much faster, then one could also consider the discretization in Fig. 2b where one compartment in the \(V\) variable corresponds to several compartments in the \(U\) variable. In this paper, we will study differences between discretizations in Fig. 2a, b. We will show that these discretizations lead to different parameter regimes for stochastic Turing patterns.

Fig. 2
figure 2

a Schematic of the uniform discretization. b Schematic of different meshes used for \(U\) and \(V\) where \(\gamma \) defined by (12) is equal to 5

The paper is organized as follows. In Sect. 2, we introduce and analyze a simple test problem which will be used to illustrate our results. It will be based on the above model (3), (4) and (6). In Sect. 3, we analyze both types of discretizations, considering a simple two-compartment discretization in \(U\). Illustrative numerical results are presented in Sect. 4. We conclude this paper with the discussion of our results in Sect. 5.

2 Deterministic and Stochastic Models of an Illustrative Reaction-Diffusion System

We will consider a simple one-dimensional Schnakenberg model (6) where the reaction rate constants are given by (Qiao et al. 2006)

$$\begin{aligned} k_1 = \omega , \qquad k_2 = 2, \qquad k_3 = 3\omega , \qquad k_4 = \frac{1}{\omega ^2} \end{aligned}$$
(7)

and \(\omega \) is a scale factor. We used \(\omega = 4 \times 10^3\) in the illustrative simulation in Fig. 1. When there is no diffusion involved, the dynamics of this system can be represented as the system of reaction rate ordinary differential equations (ODEs)

which has a unique stable steady state at \(u_\mathrm{s} = 2 \omega \) and \(v_\mathrm{s} = 3\omega /4\). When we consider diffusion, the reaction-diffusion PDEs (1)–(2) are given by

$$\begin{aligned} \frac{\partial u}{\partial t}&= D_u \frac{\partial ^2 u}{\partial x^2} + k_1 - k_2 u + k_4 u^2 v, \end{aligned}$$
(8)
$$\begin{aligned} \frac{\partial v}{\partial t}&= D_v \frac{\partial ^2 v}{\partial x^2} + k_3 - k_4 u^2 v. \end{aligned}$$
(9)

We are implicitly assuming homogeneous Neumann boundary conditions (zero-flux) in the whole paper, but both the PDE model (8)–(9) and its stochastic counterparts could also be generalized to different types of boundary conditions (Erban and Chapman 2007). Using standard analysis of Turing instabilities (Qiao et al. 2006; Murray 2002), one can show that the Turing patterns are obtained for \(D_v > 39.6 D_u\) for the parameter values (7). This condition is independent of \(\omega .\) The illustrative simulation in Fig. 1 was computed for \(D_v/D_u = 100\), i.e., the condition for (deterministic, mean-field) Turing patterns was satisfied.

When we are concerned with the stochastic effects, the reaction-diffusion system can be simulated by the Gillespie stochastic simulation algorithm with the one-dimensional computational domain \([0,L]\) discretized. Considering uniform discretization in Fig. 2a, the stochastic model is given as a set of   “chemical reactions” (3), (4) and (6). Denoting the compartment length by \(h\), we have the following propensity functions in the \(i\)-th compartment (Gillespie 1977; Qiao et al. 2006):

$$\begin{aligned}&\alpha _1 = k_1 h, \quad \alpha _2 = k_2 U_i, \quad \alpha _3 = k_3 h, \quad \alpha _4 = \frac{k_4}{h^2} U_i (U_i - 1) V_i, \end{aligned}$$
(10)
$$\begin{aligned}&\alpha _5 = \alpha _6 = d_u U_i, \quad \alpha _7 = \alpha _8 = d_v V_i, \end{aligned}$$
(11)

where \(d_u\) and \(d_v\) are given by (5). The first four propensities (10) are for the four chemical reactions in (6). The propensities (11) are for the diffusive jumps (left and right) for \(U\) (indices 5 and 6) and \(V\) (indices 7 and 8) which correspond to (3) and (4), respectively. In the illustrative simulation in Fig. 1, we divided interval \([0,1]\) into \(K=40\) compartments, i.e., \(h=1/40=0.025\). In particular, the production rate of \(U\) molecules in one compartment was equal to \(\alpha _1 = k_1 h = \omega h = 100\). The homogeneous steady state in compartments corresponded to values \(U_\mathrm{{st}} = u_\mathrm{s} h= 2 \omega h = 200\) and \(V_\mathrm{{st}} = v_\mathrm{s} h = 3 h \omega /4 = 75.\)

2.1 Formulation of the Generalized Compartment-Based Model

The compartmentalization in Fig. 2b generalizes (3) and (4) to the case where different discretizations are used for \(U\) and \(V\). We will denote by \(K_u\) (resp. \(K_v\)) the number of compartments in the \(U\) (resp. \(V\)) variable. We define the compartment lengths by

$$\begin{aligned} h_u = \frac{L}{K_u}, \qquad h_v = \frac{L}{K_v}, \qquad \text{ and } \qquad \gamma = \frac{K_u}{K_v} = \frac{h_v}{h_u}, \end{aligned}$$
(12)

where \(\gamma \) is the ratio of compartment sizes in the \(V\) and \(U\) variable. In what follows, we will consider that \(\gamma \) is an integer. For example, the schematic diagram in Fig. 2b used \(\gamma =5\). Then, the diffusion model is formulated as follows

(13)
(14)

where

$$\begin{aligned} d_u = \frac{D_u}{h_u^2}, \qquad \qquad d_v = \frac{D_v}{h_v^2} = \frac{D_v}{D_u \gamma ^2} \, d_u. \end{aligned}$$
(15)

In the standard compartment-based model (3) and (4), we have \(\gamma =1\). One option to choose \(\gamma \) in the generalized model (13) and (14) is to ensure that \(d_u = d_v\) which implies

$$\begin{aligned} \gamma = \sqrt{ \frac{D_v}{D_u} }. \end{aligned}$$
(16)

Then, the jump rates \(d_u\) and \(d_v\) from the corresponding compartments are equal for molecules of \(U\) and \(V\). However, we will not restrict to the case (16) and consider general choices of \(\gamma \) in this paper. The generalization of the first three propensities in (10) is straightforward. Propensities \(\alpha _1\) and \(\alpha _2\) in (10) correspond to chemical species \(U\), and we have the following propensities in the \(i\)-th compartment, \(i=1,2,\dots ,K_u\): \(\alpha _1 = k_1 h_u\) and \(\alpha _2 = k_2 U_i\). The propensity \(\alpha _3\) in (10) is considered in the \(j\)-th compartment corresponding to the \(V\) species, i.e., in the compartment \(\big ((j-1)h_v,j h_v \big )\). It is given as \(\alpha _3 = k_3 h_v\). To generalize \(\alpha _4\), we have to consider the occurrences of the trimolecular reaction

$$\begin{aligned} 2 U + V \;\displaystyle \mathop {\displaystyle \longrightarrow }^{k_4}\; 3 U \end{aligned}$$

in every small compartment used for the discretization of the \(U\) variable. In the \(i\)-th compartment, the propensity function \(\alpha _4\) is:

$$\begin{aligned} \alpha _4 = \frac{k_4}{h_u^2} U_i (U_i - 1) \frac{V_j}{\gamma }, \end{aligned}$$
(17)

where \(V_j\) corresponds to the \(j\)-th compartment in the \(V\) variable to which the \(i\)-th compartment belongs, i.e.,

$$\begin{aligned} \big ((i-1)h_u,i h_u \big ) \subset \big ((j-1)h_v,j h_v \big ). \end{aligned}$$

The main idea of the compartment-based model is that the molecules of \(V\) are considered to be well-mixed in the compartments of the size \(h_v\). Thus, the propensity function (17) correctly generalizes the propensity of trimolecular reaction \(\alpha _4\) in the smaller compartment of length \(h_u\).

In Fig. 3, we present an illustrative simulation of the generalized compartment-based model (13)–(17). We use the same parameters as in Fig. 1 to enable direct comparisons, i.e., \(k_1\), \(k_2\), \(k_3\), \(k_4\) are given by (7) where the scale factor \(\omega = 4 \times 10^3\). We use (16) to select the value of \(\gamma \). Since \(D_u = 10^{-3}\) and \(D_v = 10^{-1}\), the formula (16) implies \(\gamma = 10\). We use the same number of compartments for \(U\) variable as in Fig. 1: \(K_u = 40\). Using \(\gamma = 10\), we obtain that \(V\) is discretized into \(K_v = 4\) compartments. In Fig. 3, we see that the Turing pattern can still be clearly observed. As in Fig. 1, compartment values above (resp. below) the homogeneous steady-state values \(U_\mathrm{{st}} = 200\) and \(V_\mathrm{{st}} = 75 \gamma = 750\) are colored black (resp. light gray) to visualize stochastic Turing patterns.

Fig. 3
figure 3

Turing patterns computed by the generalized compartment-based model (13)–(17). a Numbers of molecules of chemical species \(U\) in each compartment at time \(18\); b the same plot for chemical species \(V\). The initial condition was the homogeneous steady state \(U_\mathrm{{st}} = 200\) and \(V_\mathrm{{st}} = 750\) for the parameters given in the text. The values of \(U_\mathrm{{st}}\) and \(V_\mathrm{{st}}\) are denoted by dashed lines

Since the compartments for the \(V\) variable are 10-times larger in Fig. 3b than in Fig. 1b, it is not surprising that the numbers of molecules of \(V\) (per compartment) increased by the factor of 10. However, we can also notice that the numbers of molecules of \(U\) per compartment quantitatively differ in Figs. 1a and 3a (black peaks are twice as tall). An open question is to quantify these differences. In this paper, we show that even qualitative differences can be observed in some parameter regimes, where the generalized compartment-based model exhibits Turing patterns, while the original model does not.

The generalized compartment-based model (13) and (14) can be used to construct computational approaches to speed-up simulations of the standard compartment-based model, because it does not simulate all diffusion events for chemical species with large diffusion constants (Li and Cao 2012, 2014). For example, the illustrative simulation in Fig. 3 simulates ten times less compartments for \(V\) and is less computationally intensive than the original simulation in Fig. 1. However, in this work, we are interested in a different question than discussing numerical errors with different discretization strategies. We will investigate the Turing pattern formation under different discretizations. We will argue that the classical compartment-based approach is not the best starting point to analyze noise in systems which have chemical species with different diffusion constants. This conclusion can be already demonstrated if we consider a simple two-compartment model as we will see in the next section.

3 Analysis of Compartment-Based Models for \(K_u = 2\)

We will consider that the domain \([0,L]\) is divided into two compartments in the \(U\) variable, i.e., \(K_u = 2.\) Then, we have two possible options for the discretization of the quickly diffusing chemical species \(V\):

  1. (i)

    \(\gamma \!=\! 1\) which corresponds to the classical compartment-based model where \(K_v \!=\! 2\);

  2. (ii)

    \(\gamma = 2\) which corresponds to the generalized compartment-based model where \(K_v = 1\).

We will start with the latter case which includes three variables \(U_1\), \(U_2\) and \(V_1\) and is easier to analyze. In Sect. 3.2, we compare our results with the classical compartment-based approach.

3.1 Generalized Compartment-Based Model: \(K_u = 2\) and \(K_v = 1\)

We consider the case where the whole interval \([0, \ L]\) is divided into two compartments for \(U\) and one compartment for \(V\). The discretization is illustrated in Fig. 4a. We will denote by \(u_1\), \(u_2\) and \(v_1\) the average numbers of molecules of \(U_1\), \(U_2\) and \(V_1\) as predicted by the corresponding mean-field model. They satisfy the following system of three ODEs (Erban et al. 2007)

$$\begin{aligned} \frac{\text{ d }u_1}{\text{ d }t}&= d_u (u_2 - u_1) + k_1 h_u - k_2 u_1 + \frac{k_4}{h_u h_v} u_1^2 v_1, \end{aligned}$$
(18)
$$\begin{aligned} \frac{\text{ d }u_2}{\text{ d }t}&= d_u (u_1 - u_2) + k_1 h_u - k_2 u_2 + \frac{k_4}{h_u h_v} u_2^2 v_1, \end{aligned}$$
(19)
$$\begin{aligned} \frac{\text{ d }v_1}{\text{ d }t}&= k_3 h_v - \frac{k_4}{h_u h_v} \left( u_1^2 + u_2^2 \right) v_1. \end{aligned}$$
(20)

We will study the stability of its steady states. In order to find the steady state, we let the left-hand side terms be zero. The corresponding algebraic equations can be written in the following form:

$$\begin{aligned} d_u(u_2 - u_1) + \frac{k_1 L}{2} - k_2 u_1 + \frac{2 k_4}{L^2} \, u_1^2 v_1&= 0, \end{aligned}$$
(21)
$$\begin{aligned} d_u(u_1 - u_2) + \frac{k_1 L}{2} - k_2 u_2 + \frac{2 k_4}{L^2} \, u_2^2 v_1&= 0, \end{aligned}$$
(22)
$$\begin{aligned} k_3 L - \frac{2 k_4}{L^2} \, (u_1^2 + u_2^2) v_1&= 0, \end{aligned}$$
(23)

where we used \(h_u = L/K_u = L/2\) and \(h_v = L/K_v = L.\) Adding all three equations, we have

$$\begin{aligned} u_1 + u_2 = \frac{ ( k_1+k_3) L}{ k_2} = 2 \omega L , \end{aligned}$$
(24)
Fig. 4
figure 4

a Generalized compartment-based model for \(K_u = 2\) and \(K_v = 1\): The interval is divided into two compartments for \(U\) and remains as one compartment for \(V\). b Classical compartment-based model: The interval is divided into two compartments for both \(U\) and \(V\)

where we used the parameter choice (7). Let \(u_1 = (1 + r) \omega L \) and \(u_2 = (1 - r) \omega L\). Solving (23) for \(v_1\), we obtain

$$\begin{aligned} v_1 = \frac{k_3L^3}{2k_4 (u_1^2 + u_2^2)} = \frac{3 \omega L}{4 (1 + r^2 )}. \end{aligned}$$
(25)

Substituting (25) back to (21), we have

$$\begin{aligned} -2 d_u \, r \, \omega L + \frac{k_1 L}{2} - k_2 (1+r) \omega L + 2 k_4 (1 + r)^2 \omega ^2 \frac{3 \omega L}{4 (1+r^2)} = 0. \end{aligned}$$

Using the parameter choice (7), we can simplify it to

$$\begin{aligned} r \left[ (1- 2d_u) - 2 (1+d_u) r^2 \right] = 0. \end{aligned}$$
(26)

The system will have a non-homogeneous solution \(u_1 \ne u_2\) if and only if the equation (26) has a nonzero solution, and that requires \(2 d_u < 1\). Using (15) and \(h_u = L/2\), we obtain

$$\begin{aligned} D_u < \frac{L^2}{8}. \end{aligned}$$
(27)

If this condition is satisfied, then the system has two non-nonhomogeneous steady-state solutions

$$\begin{aligned} u_1 = (1 \pm r) \omega L, \qquad u_2 = (1 \mp r) \omega L, \qquad v_1 = \frac{3 \omega L}{4 (1 + r^2 )}, \end{aligned}$$
(28)

where

$$\begin{aligned} r = \sqrt{\frac{L^2 - 8 D_u}{2 L^2 + 8 D_u}}. \end{aligned}$$
(29)

In Fig. 5, we illustrate this result. We use \(L=1\), \(D_u = 0.1\) and \(\omega = 500\). Then, \(r=0.27\) and the steady-state values of \(u_1\) (resp. \(u_2\) are):

$$\begin{aligned} u_\mathrm{s}^1 \doteq 366, \qquad u_\mathrm{s}^2 \doteq 500, \qquad u_\mathrm{s}^3 \doteq 634. \end{aligned}$$

In Fig. 5a, we present the time evolution of \(U_1\) computed by the Gillespie algorithm. We initialize the system at the steady state \([U_1(0),U_2(0),V_1(0)]=[634,366,350]\). We clearly see that the system is capable of switching between this state and the second non-homogeneous state. In Fig. 5b, we visualize the corresponding time-dependent pattern. As in Figs. 1 and 3, we plot the values which are larger than the homogeneous steady state \(u_\mathrm{s}^2 = 500\) in black. Light gray color denotes the values which are lower than \(u_\mathrm{s}^2 = 500\). We plot both \(U_1\) and \(U_2\) values in Fig. 5b to visualize the resulting pattern.

Fig. 5
figure 5

a The time evolution of \(U_1\) computed for the generalized compartment-based model with \(K_u = 2\) and \(K_v = 1\). The homogeneous steady state \(u_\mathrm{s}^2 = 500\) is plotted using the dashed line. b The time-dependent pattern given by the values of \(U_1\) and \(U_2\) computed for the same realization of the Gillespie algorithm as in the panel (a)

3.2 Classical Compartment-Based Model: \(K_u = 2\) and \(K_v = 2\)

Next, we consider the case where the whole interval \([0, \ L]\) is divided into two compartments for both \(U\) and \(V\). The discretization is illustrated in Fig. 4b. Denoting \(u_1\), \(u_2\), \(v_1\) and \(v_2\) the average numbers of molecules obtained by the corresponding mean-field model, they satisfy the following system of four ODEs (Erban et al. 2007)

$$\begin{aligned} \frac{\text{ d }u_1}{\text{ d }t}&= d_u(u_2 - u_1) + k_1 h_u - k_2 u_1 + \frac{k_4}{h_u h_v} u_1^2 v_1, \\ \frac{\text{ d }u_2}{\text{ d }t}&= d_u(u_1 - u_2) + k_1 h_u - k_2 u_2 + \frac{k_4}{h_u h_v} u_2^2 v_2 , \\ \frac{\text{ d }v_1}{\text{ d }t}&= d_v (v_2 - v_1) + k_3 h_v - \frac{k_4}{h_u^2} u_1^2 v_1, \\ \frac{\text{ d }v_2}{\text{ d }t}&= d_v (v_1 - v_2) + k_3 h_v - \frac{k_4}{h_u^2} u_2^2 v_2. \end{aligned}$$

Again letting the left-hand side terms be zero and using \(h_u = h_v = L/2\), we obtain the following system of algebraic equations

$$\begin{aligned} 2 d_u(u_2 - u_1) + k_1 L - 2 k_2 u_1 + \frac{8 k_4}{L^2} u_1^2 v_1&= 0, \end{aligned}$$
(30)
$$\begin{aligned} 2 d_u(u_1 - u_2) + k_1 L - 2 k_2 u_2 + \frac{8 k_4}{L^2} u_2^2 v_2&= 0, \end{aligned}$$
(31)
$$\begin{aligned} 2 d_v (v_2 - v_1) + k_3 L - \frac{8 k_4}{L^2} u_1^2 v_1&= 0, \end{aligned}$$
(32)
$$\begin{aligned} 2 d_v (v_1 - v_2) + k_3 L - \frac{8 k_4}{L^2} u_2^2 v_2&= 0. \end{aligned}$$
(33)

Adding all equations together, we have

$$\begin{aligned} u_1 + u_2 = \frac{(k_1+k_3) L}{k_2} = 2 \omega L. \end{aligned}$$
(34)

Adding (32) and (33), we also have

$$\begin{aligned} u_1^2v_1 + u_2^2v_2 = \frac{k_3 L^3}{4 k_4} = \frac{3 \omega ^3 L^3}{4}. \end{aligned}$$
(35)

Adding (30) and (32), we obtain

$$\begin{aligned} (k_1 + k_3)L - 2 k_2u_1 + 2d_u(u_2 - u_1) + 2d_v (v_2 - v_1) = 0. \end{aligned}$$
(36)

Using (34), we have \(u_1 = (1 + r) \omega L \) and \(u_2 = (1 - r) \omega L\) for a suitable \(r\). Thus, (36) can be rewritten as

$$\begin{aligned} v_2 - v_1 = \frac{2 r (1+d_u) \omega L}{d_v} = 2 r R \omega L, \end{aligned}$$
(37)

where we denoted \(R = (1+d_u)/d_v\). Substituting (37) into (32) and denoting \(S = 1 + d_u = d_v R\), we have

$$\begin{aligned} v_1 = \frac{(3 + 4Sr)\omega L}{8(1+r)^2}. \end{aligned}$$
(38)

Similarly from (33), we have

$$\begin{aligned} v_2 = \frac{(3 - 4Sr)L\omega }{8(1-r)^2}. \end{aligned}$$
(39)

Substituting both (38) and (39) to (37), we obtain

$$\begin{aligned} \frac{3 - 4Sr}{8(1 - r)^2} - \frac{3 + 4Sr}{8(1 + r)^2} = 2Rr. \end{aligned}$$

which can be simplified to the equation

$$\begin{aligned} r \left( 4R \left( 1 - r^2 \right) ^2 + 2 S \left( 1 + r^2 \right) - 3 \right) = 0. \end{aligned}$$

We are looking for the non-homogeneous solution where \(r \ne 0\). Denoting \(y = r^2 > 0\), we have a quadratic equation

$$\begin{aligned} 4R y^2 + (2S - 8R) y + (4R + 2S - 3) = 0. \end{aligned}$$
(40)

We will look for conditions such that the equation (40) has a solution \(0 < y < 1\) (since \(-1 < r < 1\)). Let

$$\begin{aligned} f(y) = 4R y^2 + (2S - 8R) y + (4R + 2S - 3). \end{aligned}$$
(41)

Then, we have \(f(1) = 4S - 3 = 1 + 4d_u > 0\). One can verify that if \(f(0) > 0\), it is impossible for the equation \(f(y) = 0\) to have a solution between 0 and 1. On the other hand, if \(f(0) < 0\), we will definitely have a solution between 0 and 1. Thus, we have a necessary and sufficient condition

$$\begin{aligned} f(0) = 4R + 2S - 3 < 0, \end{aligned}$$
(42)

which corresponds to the condition for \(d_u\) and \(d_v\):

$$\begin{aligned} \frac{4}{d_v} + 2 < \frac{3}{1 + d_u}. \end{aligned}$$

We note that \(d_u = D_u/h^2\) and \(d_v = D_v/h^2\), where \(h= h_u= h_v = L/2\). Thus, the necessary and sufficient condition for patterns becomes

$$\begin{aligned} \frac{L^2}{D_v} + 2 < \frac{3L^2}{L^2 + 4 D_u}. \end{aligned}$$
(43)

If \(D_v \rightarrow \infty \), then the condition (43) becomes the condition (27) which was derived for the case of the generalized compartment-based model. The condition (27) is a necessary condition for (43) but not sufficient. We illustrate it in Fig. 6 for \(L=1\). The condition (27) corresponds to all parameter values to the left of the dashed line in Fig. 6. The condition (43) corresponds to the values of \(D_u\) and \(D_v\) which are above the (blue) solid line. The shaded area corresponds to parameter values for which the generalized compartment-based model yields non-homogeneous patterns and the standard compartment-based model does not. Next, we will use the same value of \(D_u\) as in Fig. 5, namely \(D_u = 0.1\). We choose two values of \(D_v\) which are denoted as the (blue) circle and (red) square in Fig. 6. We use the Gillespie algorithm to simulate the standard compartment-based model for \(K_u = K_v = 2\). The results are shown in Fig. 7. The top panels show the time evolution of \(U_1\) and \(U_2\). We clearly see the switching between two patterns for \(D_v = 10\), but there is no bistability for \(D_v = 0.4.\) The resulting patterns are visualized in the bottom panels. As in Figs. 1, 3 and 5, we plot the values which are larger than the homogeneous steady state \(u_\mathrm{s}^2 = 500\) in black. Light gray color denotes the values which are lower than \(u_\mathrm{s}^2 = 500\).

Fig. 6
figure 6

The regions of patterning in \(D_u\)-\(D_v\) plane. The shaded area is the region where the standard compartment-based model does not yield patterns and the generalized compartment-based model has patterns. The (blue) circle is the parameter regime used in Fig. 7a, and the (red) square is the parameter regime used in Fig. 7b (Color figure online)

Fig. 7
figure 7

Time evolution of \(U_1\) (blue line) and \(U_2\) (red line) for \(K_u = K_v = 2\) is shown in top panels for a \(D_u = 0.1\), \(D_v = 0.4\) and b \(D_u = 0.1\), \(D_v = 10\). The corresponding time-dependent pattern is shown in bottom panels (Color figure online)

Let us note that we are comparing the generalized compartment-based model with \(K_u = 2\) and \(K_v = 1\) with the classical compartment-based model. In particular, the generalized compartment-based model uses \(\gamma = 2\). If we substitute \(\gamma = 2\) in formula (16), we obtain \(D_v = 4 D_u\). In particular, the parameter values \(D_u = 0.1\) and \(D_v = 0.4.\) are compatible with the choice (16). However, the standard compartment-based model does not exhibit patterns for this parameter choice as we observed in Fig. 7a.

Remark Let \(z = L^2\). Then, the inequality (43) becomes

$$\begin{aligned} z^2 + (4D_u - D_v) z + 8 D_uD_v < 0, \end{aligned}$$
(44)

which is possible for some values of \(L\) if and only if

$$\begin{aligned} 4D_u < D_v \quad \text{ and } \quad (4D_u - D_v)^2 - 32D_uD_v > 0. \end{aligned}$$
(45)

Thus, patterns are possible for some values of \(L\) provided that

$$\begin{aligned} \frac{D_v}{D_u} > 20 + 8 \sqrt{6} \approx 39.6 . \end{aligned}$$
(46)

This condition is also the condition for the Turing patterns to emerge for the original system of mean-field PDEs (8)–(9).

4 Comparison of Compartment-Based Models for \(K_u > 2\)

The condition (27) for the generalized compartment-based model is only a necessary condition for the condition (43) for the classical case as we showed in Fig. 6. The bistability condition difference suggests that, if we use different discretizations for \(U\) and \(V\), the stability of the homogeneous system may change. In this section, we compare the generalized and classical compartment-based models for \(K_u > 2.\) In Fig. 8, we use \(D_u = 5\times 10^{-4}\) and \(D_v = 20 D_u\). In this case, the condition for (deterministic) Turing patterns (46) is not satisfied. The classical compartment-based model also does not show Turing patterns as it is demonstrated in Fig. 8a (with \(K_u = K_v = 64\) compartments) and Fig. 8b (with \(K_u = K_v = 8\) compartments). In both cases, no spatial Turing pattern is observed except noise from stochastic effects. However, if the generalized compartment-based model is used, then the Turing pattern may appear. In Fig. 8c, a result for the generalized compartment-based model with \(K_u = 64\) and \(K_v = 8\) is presented. There is a clear Turing pattern. In Fig. 8c, we have \(\gamma = 8\). We also tested cases when \(\gamma = 2\) and \(\gamma = 4\) and obtained Turing patterns. The case \(\gamma = 4\) is plotted in Fig. 8d.

Fig. 8
figure 8

Spatial distribution of \(U\) at time \(T = 100\) for \(D_v = 20 D_u\), \(\omega =4096\) and \(D_u = 5\times 10^{-4}\) with a \(K_u = K_v = 64\); b \(K_u = K_v = 8\); c \(K_u = 64\) and \(K_v = 8\); d \(K_u = 32\) and \(K_v = 8\). There is no Turing pattern in the top panels (classical compartment-based model). Turing patterns appear in the bottom panels (generalized compartment-based model)

In Fig. 9, we demonstrate that both discretizations strategies clearly show Turing patterns when we increase the ratio of diffusion constants to \(D_v/D_u = 80\). In this case, the condition for (deterministic) Turing patterns (46) is satisfied. Finally, we present results for \(D_v = 40D_u\) in Fig. 10. In the deterministic PDE system, when \(D_v = 40D_u\), Turing pattern should still appear. But in the classical compartment-based model, it is hard to claim that there is a visible Turing pattern (see Figs. 10a, c). Considering the generalized compartment-based model, Turing patterns can be clearly observed (see Fig. 10b, d).

Fig. 9
figure 9

Spatial distribution of \(U\) at time \(T = 100\) for \(D_v = 80 D_u\). Both discretization strategies clearly show Turing patterns. We use \(\omega =4096\), \(D_u = 5\times 10^{-4}\) with a \(K_u = K_v = 32\); b \(K_u = 32\) and \(K_v = 8\)

Fig. 10
figure 10

Spatial distribution of \(U\) at time \(T = 100\) for \(D_v = 40 D_u\). The generalized compartment-based model clearly shows Turing patterns, while it is difficult to see whether Turing patterns appear in the classical compartment-based model. We use \(\omega =4096\), \(D_u = 5\times 10^{-4}\) with a \(K_u = K_v = 32\); b \(K_u = 32\) and \(K_v = 8\); c \(K_u = K_v = 64\); d \(K_u = 64\) and \(K_v = 8\)

5 Discussion

We have shown that two choices of compartments illustrated in Fig. 2 can give different parameter regions for stochastic Turing patterns. An obvious question is which one is correct. One possibility to address this question is to consider a more detailed molecular-based approach which would be written in the form of Brownian dynamics (Erban and Chapman 2009). We are currently working on such a simulation, and we will report our findings in a future publication.

Although our results might look like a warning against the use of compartment-based methods for patterns based on the Turing mechanism, there are very good reasons to use the compartment-based model in other situations (Engblom et al. 2009; Isaacson and Peskin 2006). Compartment-based models are often less computationally intensive than detailed Brownian dynamics simulations (Flegg et al. 2012; Hellander et al. 2012). They can be used for developing efficient multiscale methods where parts of the domain are simulated using the detailed Brownian dynamics while the rest of the domain is simulated using compartments (Erban et al. 2014; Flegg et al. 2013). They can also be used to bridge Brownian dynamics simulations with macroscopic PDEs (Ferm et al. 2010), because direct multiscale methods for coupling Brownian dynamics with PDEs are challenging to implement (Franz et al. 2013).

We have shown in Fig. 9 that the resulting patterns are comparable when the ratio of diffusion constants is sufficiently large. In this case, the generalized compartment-based model could also be used to construct computational approaches to speed-up simulations of the standard compartment-based model, because it does not simulate all diffusion events for chemical species with large diffusion constants (Li and Cao 2012, 2014). This multigrid discretization strategy has been recently applied in the modeling and simulation of a spatiotemporal model of PopZ localization in Caulobacter crescentus (Subramanian et al. 2014). In this model, the PopZ localization demonstrates a clear Turing pattern that can be modeled by a variation of the Schnakenberg model (6). The ratio of diffusion constants is sufficiently large, because PopZ monomers (variable \(V\)) diffuse (by three orders of magnitude) faster than PopZ polymers (variable \(U\)). Thus, the multigrid discretization strategy can be safely applied, and there is a significant speedup in numerical simulation (Subramanian et al. 2014).