Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2017 Jun 11.
Published in final edited form as: SIAM J Sci Comput. 2016 Jan 6;38(1):A55–A83. doi: 10.1137/15M101110X

ANALYSIS AND DESIGN OF JUMP COEFFICIENTS IN DISCRETE STOCHASTIC DIFFUSION MODELS*

LINA MEINECKE , STEFAN ENGBLOM , ANDREAS HELLANDER , PER LÖTSTEDT
PMCID: PMC5466879  NIHMSID: NIHMS857292  PMID: 28611531

Abstract

In computational systems biology, the mesoscopic model of reaction-diffusion kinetics is described by a continuous time, discrete space Markov process. To simulate diffusion stochastically, the jump coefficients are obtained by a discretization of the diffusion equation. Using unstructured meshes to represent complicated geometries may lead to negative coefficients when using piecewise linear finite elements. Several methods have been proposed to modify the coefficients to enforce the nonnegativity needed in the stochastic setting. In this paper, we present a method to quantify the error introduced by that change. We interpret the modified discretization matrix as the exact finite element discretization of a perturbed equation. The forward error, the error between the analytical solutions to the original and the perturbed equations, is bounded by the backward error, the error between the diffusion of the two equations. We present a backward analysis algorithm to compute the diffusion coefficient from a given discretization matrix. The analysis suggests a new way of deriving nonnegative jump coefficients that minimizes the backward error. The theory is tested in numerical experiments indicating that the new method is superior and also minimizes the forward error.

Keywords: stochastic simulation, diffusion, unstructured mesh, finite element method

AMS subject classifications: 65C40, 65C05, 65M60, 60H35, 92C05

1. Introduction

The molecular pathways that regulate cellular function are inherently spatial. Cells have a high level of subcellular organization, such as a confined nucleus in eukaryotes or membrane bound reaction complexes. Macromolecules are transported by passive diffusion or active transport, driven by molecular motors, between different areas in the cell in order to arrive at the correct location to perform their function. For example, many gene regulatory pathways rely on a cytoplasmic component, where a signal is propagated from the cell membrane to the nucleus, and a nuclear component, where transcription factors bind to DNA to regulate the expression of genes.

On a macroscopic modeling level, the diffusion equation—a partial differential equation (PDE)—is used to describe the time evolution of the concentration of a population of molecules undergoing diffusion. This is a valid model if molecules are abundant. But in cellular regulatory networks, key proteins such as transcription factors are present only in low copy numbers, and the deterministic PDE model becomes inaccurate. Experiments [8, 26, 32, 34, 35, 38, 45] and theory [14, 33] have shown the importance of accounting for intrinsic noise when modeling cellular control systems. Consequently, we need spatial stochastic simulation methods, and diffusion in particular is described by a random walk. We can distinguish between two levels of accuracy.

On the mesoscopic level we use a discrete Brownian motion to model the jump process of the molecules. The domain is partitioned into compartments or voxels. The state of the system is the number of molecules of each species in each voxel. Molecules can jump between neighboring voxels and react if they are in the same voxel. The probability density function (PDF) for the probability of being in a state at a certain time satisfies a master equation. If bimolecular reactions are included, in general there is no analytical solution for the PDF, and a numerical solution is difficult to compute due to the high dimensionality of the state space. Instead, the stochastic simulation algorithm (SSA) can be used to generate trajectories of the system. It was first developed by Gillespie [16, 17] for reactions independent of space. Its efficiency has been improved in [5, 15], and it is extended to space dependency with a Cartesian partitioning of the space in [7, 20, 22]. A more accurate description is the space-continuous microscopic level, where individual molecules are followed along their Brownian trajectories. Methods and software for this approach are found in [1, 6, 23, 41, 50].

In this work, we focus on diffusion at the mesoscopic level. The probability per unit of time for a molecule to jump from its voxel to a neighbor is obtained by a discretization of the Laplace operator in the diffusion equation on the same mesh. A mathematically equivalent interpretation is that this probability is obtained from a discretization of the Fokker–Planck equation for Brownian motion. The resulting matrix is the generator of a Markov process, and all the off-diagonal entries, which represent transition rates, need to be nonnegative. On the macroscopic level of deterministic PDEs, requiring nonnegative jump coefficients enforces the discrete maximum principle [46, 48]. To represent the complicated geometries present in cells (e.g., mitochondria or convoluted membranes), we work with unstructured meshes, meaning triangular or tetrahedral meshes in two and three dimensions. Many interesting cellular processes happen on the membranes. Using a vertex centered discretization allows us to couple diffusion in the bulk to diffusion on the surface of the domain in a straightforward way. If a molecule reaches a boundary node, we can use the surface mesh for its two-dimensional (2D) diffusion on the membrane.

Piecewise linear finite elements on unstructured meshes are used in [9] to obtain the jump propensities. Software exists for discretizing PDEs with the finite element method (FEM) on a given mesh; see, e.g., [30]. In two dimensions, mesh generators are usually able to provide high quality meshes [10], but in three dimensions the mesh quality decreases and negative off-diagonal elements often appear in the FEM discretization matrix [3, 24, 27]. This matrix can then no longer be interpreted as the generator matrix to a Markov process and thus provide transition rates. For our application in stochastic simulations in systems biology, we need to modify this discretization matrix to guarantee nonnegative jump coefficients. In [9] the negative entries are set to zero and the diagonal element is recalculated so that the row sum equals zero. This changes the diffusion speed and leads to errors in, for example, the time a signal needs to propagate from the nucleus to the cell membrane. To address this, in previous work [31] we developed a method that preserves mean first passage times. Another approach to obtain nonnegative jump coefficients is to use the finite volume method (FVM). But, as we will see, despite positive coefficients the vertex centered FVM scheme does not approximate diffusion more accurately than a filtered FEM discretization for typical meshes. These methods make the stochastic simulation of diffusion mesh dependent, but this also holds for the accuracy of the numerical solution of the PDE. FEM and FVM coefficients have been modified in [4, 13, 42] to be nonnegative, but they depend on the PDE solution, which makes them unsuitable for stochastic simulation.

In this paper we analyze the error introduced by modifying the discretization matrix to enforce nonnegative jump coefficients. Since the concentration of the species simulated by the SSA converges towards the solution of the diffusion equation [28, 29], we quantify the error in this deterministic limit. We use backward analysis to find the diffusion equation solved by the new discretization matrix. We study two error estimates: the backward error, describing the difference in the diffusion in the equations, and the forward error, describing the error in the solutions to the equations. The analysis suggests a new method to obtain a nonnegative discretization by minimizing the backward error.

In section 2 we describe the mesoscopic model and how the jump coefficients are obtained for unstructured triangular and tetrahedral meshes. In section 3, we develop theory to bound the forward error by the backward error. An algorithm is provided in section 4 for calculating the backward error, and then in section 5 we show how new error minimizing jump coefficients can be computed. In the experiments in section 6, we analyze the errors numerically, test our new method, observe that it also minimizes the forward error in agreement with the estimates in section 3, and discuss possibilities for a practical implementation. Final conclusions are drawn in section 7.

Vectors and matrices are written in boldface. A vector u has the components ui, and the elements of a matrix A are Aij. For vectors and matrices, ║u║p denotes the vector norm in p and ║A║p denotes its subordinate matrix norm, and uA2=uTAu for a positive definite A. The derivative of a variable u with respect to time t is ut. If u(x), x ∈ Ω, varies in space, then uLpp=ΩuppdΩ.

2. Mesoscopic model of diffusion

To model diffusion in discrete space, the domain of interest Ω is partitioned into nonoverlapping voxels Vk,k=1,,N. Each voxel Vj has a node or vertex with the coordinates xj in the interior; see Figure 1. If Vi and Vj are neighbors, the vertices xi and xj are connected by the edge eij. Molecules in a voxel Vj can diffuse by jumps to a neighboring voxel Vi along the edge eij.

Fig. 1.

Fig. 1

The primal triangular mesh (thin lines), defining the edges eij, and the dual mesh (thick lines), defining the voxels Vi.

The state of the system is the discrete number of molecules of each species in each voxel. Let yj be the number of molecules of chemical species Y in Vj. The jump rate λji from Vj to a neighboring Vi needs to satisfy the condition

λji0. (2.1)

The total jump rate out of voxel Vj is λj=i,ijλji. The next time for a jump from Vj is exponentially distributed with the intensity λjyj. Voxel Vi is chosen as the destination with a probability proportional to λji. After a jump, the number of molecules is updated and the time for a new jump is determined. This is the SSA of Gillespie [16] for simulating mesoscopic diffusion of molecules between the voxels.

Algorithm 1.

Stochastic simulation algorithm for diffusion [16].

1: Initialize yk, k = 1, …, N, in the N voxels at t = 0.
2: Sample the exponentially distributed time tk with rate λkyk to the first diffusion event in all N voxels.
3: Let tj be the minimum of all tk. If tj > T, then stop; otherwise continue.
4: For the jump from Vj, sample a jump to Vi with probability λji/λj.
5: Update t := tj, yi, and yj. Sample Δti with the rate λiyi and Δtj with the rate λjyj and recompute ti = t + Δti and tj = t + Δtj. Go to 3

We will now show how to derive the propensities λij from a discretization of the diffusion equation. Let y be a vector with entries yi, describing the number of Y molecules in voxel Vi. The probability distribution p(y, t) for the distribution of the molecules is the solution to the diffusion master equation

pt(y,t)=i=1Nj=1Nλij(yμij)p(yμij,t)λij(y)p(y,t), (2.2)

where μij,i = −1, μij,j = 1, and μij,k = 0 for ki, j. Calculating the expected value y¯i of the number of molecules in each voxel i leads to a system of ordinary differential equations (ODEs) for the mean concentration ui=y¯i/|Vi| in each voxel Vi,

uit=j=1N|Vj||Vi|λjiujuij=1Nλij; (2.3)

see [9]. This can be interpreted as a discretization of the diffusion equation

ut=γΔu=(γu),xΩ,t0,nu=0,xΩ,t0,u=u0,xΩ,t=0, (2.4)

with the diffusion coefficient γ and γ = γI. Thus, the jump rates λj and λji can be computed using discretizations of the diffusion equation on the triangular or tetrahedral mesh. The space derivatives in (2.4) are approximated in the voxels by D to obtain equations for the unknowns ui,

ut=Du. (2.5)

A discretization with FEM using piecewise linear Lagrangian basis and test functions yields a mass matrix M and a stiffness matrix S. The diagonal A is obtained after mass lumping of M. The diagonal elements are Ajj=|Vj|. Then the system matrix in (2.5) is

D=A1S. (2.6)

Let h be a measure of the mesh size. The solution of (2.5) converges to the solution of (2.4) when h → 0, and the difference between them is O(h2). If the off-diagonal elements Dij in D are nonnegative, then these are taken as the jump coefficients λji in the SSA in Algorithm 1 scaled by the volumes of the voxels |Vi| and |Vj|,

λji=Dij|Vi||Vj|=Sij|Vj|; (2.7)

see [9]. The concentrations yj/|Vj| computed by the SSA converge in the limit of large numbers of molecules to the concentrations in (2.5) by [28, 29].

In two dimensions, the entry Sij corresponding to edge eij is

Sij=sin(φ+θ)/2sin(φ)sin(θ), (2.8)

where φ and θ are the two angles opposing eij [49]; see Figure 1. If φ + θ > π, then Sij < 0, and we can no longer use it to define a jump propensity. A similar condition exists in three dimensions [49]. Mesh generators in two dimensions are usually able to construct meshes leading to positive Sij [10], but in three dimensions, negative off-diagonal entries often occur [24]. The extra requirement in systems biology to have nonnegative off-diagonal elements in the stiffness matrix is a sufficient but unnecessary condition to fulfill the discrete maximum principle when solving the PDE (2.4) numerically [46, 48].

We now present three different methods of modifying the stiffness matrix S, or the discretization matrix D containing off-diagonal negative coefficients, so that we can interpret them as the generator matrix of the Markov process simulated by the SSA. The discretization matrix D is modified to D~ in [9] such that, if Dij < 0, then D~ij=0 and D~ii=j=1niD~ij, where ni is the number of edges leaving vertex i. This method of calculating the jump coefficients by eliminating the negative contributions is denoted here by nnFEM (nonnegative FEM). Convergence of the solution to the equation with the diffusion operator γΔ is lost, but nonnegative jump coefficients are defined. Solving the system of equations

u~ht=A1S~uh=D~uh, (2.9)

however, can be viewed as a discrete approximation to a perturbed diffusion equation

u~t=(γ~u~). (2.10)

The diffusion matrix γ~ belongs to ℝ2×2 in two dimensions and ℝ2×2 in three dimensions, is symmetric, and should be positive definite for all x. If γ~ is only positive semidefinite, it has at least one eigenvalue equal to zero, which means that there is no diffusion along the direction of the corresponding eigenvector. It is unrealistic to expect this to happen inside living cells, and we do not consider this case, although the following analysis can be generalized to the positive semidefinite case.

Another option is to choose a straightforward FVM. If the boundary Vj of a voxel Vj consists of nj straight segments (two dimensions) or flat faces (three dimensions) Vji,i=1,,nj, of length or area |Vji| with normal nji of unit length, then

Vj(γu)dv=Vjnγudsi=1njnjiγeji(uiuj)|Vji|eji22, (2.11)

and the stiffness matrix in (2.9) is S~ji=njiγeji|Vji|/eji22. The elements in S~ derived from (2.11) are always nonnegative, and hence the λji in (2.7) defined by the FVM are nonnegative. The N components of u represent the average value of u in the voxels. However, the solution of (2.5) may not converge to the solutions of (2.4) when the mesh size h is reduced [44], since the approximation in (2.11) is consistent with γΔu only if the mesh is of Voronoi type [12]. But we can again interpret D~ij=S~ij/|Vi| as a consistent FEM discretization of the perturbed equation (2.10). The scheme in (2.11) is a vertex centered FVM. A cell centered FVM is used in [21] to define the jump coefficients.

In [31], the jump coefficients are chosen to be close to the FEM coefficients in (2.6). If Dij is nonnegative, then λji is as in (2.7). If Dij < 0, then the λji coefficients for voxel j are determined such that the mean first exit time εj from a vertex j in the mesh to the boundary Ω is a solution of the system of linear equations

D~ε=e,eT=(1,1,,1), (2.12)

where D~ij=λji|Vj|/|Vi| The mean first exit time is the expected time it takes for a molecule initially at a position inside Ω to reach Ω. With these coefficients in Algorithm 1, the average of the simulated first exit times from vertices in the mesh agree very well in [31] with those computed numerically with a FEM discretization of (2.12). This method of computing the jump coefficients is based on the global first exit time of the molecules and is denoted by GFET.

3. Analysis

Previously, we presented three methods that can be regarded as modifications of the FEM discretization matrix D into a matrix D~ with nonnegative jump coefficients. In this section we view D~ as a FEM discretization of a certain perturbed PDE (3.2) below. To quantify the error introduced by the change in the diffusion matrix, we therefore aim at bounding the difference between the solutions to the PDEs,

ut=γΔu, (3.1)
u~t=·(γ~u~), (3.2)

for x ∈ Ω, with homogeneous Neumann boundary conditions ∂u/∂n = ∂ũ/∂n = 0 for x ∈ ∂Ω, and initial data u0=u~0 at t = 0. Here γ~(x) is a symmetric, uniformly positive definite matrix. The mean first exit time used to define the GFET algorithm fulfills Poisson’s equation [36]

1=γΔε, (3.3)

with the corresponding perturbed equation

1=·(γ~ε~) (3.4)

and homogeneous Dirichlet boundary condition.

Let H1(Ω) be the Hilbert space of all functions uL2(Ω) for which the first weak derivative exists and lies in L2(Ω) The corresponding weak problems for (3.1) and (3.2) are find u, u~H1(Ω) such thatvH1(Ω),

(v,ut)=(v,γu), (3.5)
(v,u~t)=(v,γ~u~). (3.6)

For finite element solutions in a finite-dimensional subspace Hh1(Ω)H1(Ω), we have the following set of equations (see also (2.5) and (2.9) above):

Mut=Su, (3.7)
Mu~t=S~u~. (3.8)

We shall require the following basic a priori estimates.

Lemma 3.1

For some C > 0,

uL2u0L2, (3.9)
u~L2Cu0L2, (3.10)

where (3.10) assumes that γ~ is uniformly positive definite such that gy22yTγ~(x)yGy22, for some positive constants (g, G), ∀x ∈ Ω ⊂ ℝd, ∀y ∈ ℝd, where d is the dimension.

Proof

The case (3.9) of a scalar γ follows straightforwardly, so we focus on (3.10). Letting v=u~t in (3.6), we arrive at

u~tL22=(u~t,γ~u~)=12ddt(u~,γ~u~),

since γ~ is symmetric. Integrating, we get

(u~,γ~u~)(u~0,γ~u~0).

Invoking the definiteness of γ~, we arrive at

gu~L22Gu~0L22.

We now bound the error in the two solutions u and ũ.

Theorem 3.2

For some constant C > 0,

u~uL22Ctγγ~u0L22, (3.11)

where the norm of the difference of the diffusion rates is defined by

γγ~:=maxxΩγγ~2. (3.12)

Proof

Subtracting (3.5) from (3.11) and using v = ũu we get

12ddtvL22=γvL22+(v,(γγ~)u~)Ω|vT(γγ~)u~|dΩΩγγ~2v2u~2dΩmaxxΩγγ~2Ωv2u~2dΩγγ~vL2u~L2γγ~(uL2+u~L2)u~L2Cγγ~u0L22

using Lemma 3.1. The estimate (3.11) follows by integration of the inequality. □

This shows that the forward error uu~L2 is bounded. Using the maximum norm of the difference between the two diffusion constants as in (3.11) is, however, pessimistic, and instead we now use the mean value of γγ~(x)2 in over Ω to bound the error the solutions.

Proposition 3.3

For some constant C > 0,

ddtu~uL22Cγγ~(uL4+u~L4)u~L4, (3.13)

where

γγ~2:=1|Ω|Ωγγ~22dΩ. (3.14)

Proof

As previously, subtracting (3.5) from (3.6) and using v = ũu, we get

12ddtvL22Ωγγ~2v2u~2dΩ(Ωγγ~22dΩ)12(Ωv22u~22dΩ)12γγ~|Ω|12(dΩv42u~42dΩ)12γγ~|Ω|12d12vL4u~L4.

For tδ > 0, the diffusion equations (3.1) and (3.2) smooth out irregularities in the initial data, so we can assume that uL4 and u~L4 are bounded such that for some C > 0,

uL4Candu~L4C, (3.15)

and hence by integration of (3.13),

u~uL22Ctγγ~. (3.16)

In summary, Theorem 3.2 shows that the forward error can be bounded in terms of the difference γγ~ and some factors that are independent of γ~ (assuming that γ~ is uniformly positive definite). Inequality (3.16) shows a sharper bound in terms of γγ~ at the cost of factors that may depend on γ~. We take (3.16) as the basis for our further analysis, thus assuming essentially that C in (3.15) depends only mildly on γ~.

The following proposition proves that u and ũ have identical steady states, which shows that the t-dependent estimates in Theorem 3.2 and (3.16) are pessimistic and give a relevant bound only for small t.

Proposition 3.4

For t → ∞ the steady state solutions of (3.1) and (3.2) fulfill

u=u~=u0L1/|Ω|. (3.17)

Proof

Using v = ũ in (3.6), we have at the steady state that

0=(u~,γ~u~).

By the positive definiteness of γ~ this means ∇ũ = 0, and hence ũ is constant. A similar argument for u implies the same property, and, moreover, since u is a density, we can safely assume u0 = ũ0 ≥ 0. Setting v = 1 in (3.6), we conclude that

u~|Ω|=Ωu~dΩ=(u~,1)=(u~0,1)=u~0L1,

which also holds analogously for u. □

Using u0 = ũ0, we have from Proposition 3.4 that, since uu~L2 is continuous in time, there exists a t ∈ (0, ∞), where the error reaches its maximum u(t)u~(t)L2u(t)u~(t)L2t.

We obtain a similar result for the error in Poisson’s equations.

Theorem 3.5

Assume ∂Ω ∈ C and γ~(x)C; then for the weak solutions ε and ε~ of the weak problems corresponding to (3.3) and (3.4),

εε~L22Cγγ~ (3.18)

for some constant C > 0.

Proof

Choosing v=εε~ and subtracting the weak formulations for (3.3) and (3.4), we obtain, with vγ2=(v,γv),

0=vγ~2+(Δv,(γγ~)ε);

using the same arguments as in the proof of Propositi on 3.3 gives

vγ~2Cγγ~vL4εL4.

By the Poincaré–Friedrich inequality and the positive definiteness of γ~,

vL2Cg1γγ~vL4εL4.

By [11, Chap. 6.3, Thm. 6] and the assumptions, we obtain εC(Ω¯) and ε~C(Ω¯). This bounds both ‖∇ε‖ and ε~, and hence εL4C and ε~L4C. □

We conclude that we can effectively bound both the forward error uu~L2 and the error in the mean first exit time εε~L2 by the difference γγ~. In the following section we present an algorithm for calculating this quantity for a given discretization matrix D~.

4. Backward analysis

In section 2, we presented the FVM and the modified FEM to compute the stiffness matrix S~ leading to nonnegative jump coefficients in (2.7). This matrix can be interpreted as the FEM matrix of a standard, convergent discretization of the perturbed equation (3.2). The general diffusion matrix γ~(x) is symmetric and positive definite and may have nonzero off-diagonal elements. The difference between γ and γ~ should be as small as possible. This is a measure of how close the jump coefficients are to modeling stochastic diffusion, which converges to isotropic diffusion with a constant γ.

4.1. The FEM discretization

Interpreting S~ as the standard FEM stiffness matrix to the perturbed equation (3.2) implies that

S~ij=(ψi,γ~(x)ψj) (4.1)

∀ edges eij. The sparsity pattern of S and S~ is the same and is determined by the connectivity of the mesh. Here ψi and ψj are the hat functions of linear Lagrangian finite elements with ψi (xi) = 1 and ψi(xj) = 0 when ij. Since the right-hand side of (4.1) is a symmetric expression in i and j, the perturbed stiffness matrix S~ has to be symmetric. The FVM and nnFEM generate symmetric stiffness matrices. To symmetrize S~ resulting from GFET, we use its symmetric part (S~+S~T)/2 as S~ in the following. The boundary ∂Ω of the domain Ω is assumed to be polygonal, and Ω is discretized such that

Ω=TkTTk, (4.2)

where T is the set of all nonoverlapping elements Tk. These elements are triangles in two dimensions and tetrahedra in three dimensions in the primal mesh on Ω defined by the edges eij; see Figure 1. The dual mesh on Ω defines the voxels Vi in section 2. With TijT being the set of all triangles in two dimensions or tetrahedra in three dimensions containing edge eij, we can write (4.1) as

S~ij=TkTijTkψiTγ~(x)ψjdx=TkTijψiT| TkTkγ~dxψj| Tk=TkTijψiT| Tkγ~kψj| Tk|Tk|, (4.3)

since the gradients are constant in Tk. It is only the average γ~k of γ~(x) on each element Tk that contributes to S~ij. Thus, we calculate γ~k of the following type in two and three dimensions, respectively:

γ~k2D=(γ~k1γ~k3γ~k3γ~k2),γ~k3D(γ~k1γ~k4γ~k5γ~k4γ~k2γ~k6γ~k5γ~k6γ~k3). (4.4)

With

ψi2D=(ψi1ψi2),ψi3D=(ψi1ψi2ψi3), (4.5)

and the coefficients Cijkl and L as in Table 1, for each edge eij, (4.1) becomes

S~ij=TkTijl=1LCijklγ~kl. (4.6)

Table 1.

Coefficients in (4.6).

Two dimensions Three dimensions

L 3 6

Cijk1 −∇ψi1ψj1 −∇ψi1ψj1
Cijk2 −∇ψi2ψj2 −∇ψi2ψj2
Cijk3 −(∇ψi1ψj2 + ∇ψi2ψj1) −∇ψi3ψj3
Cijk4 −(∇ψi1ψj2 + ∇ψi2ψj1)
Cijk5 −(∇ψi1ψj3 + ∇ψi3ψj1)
Cijk6 −(∇ψi2ψj3 + ∇ψi3ψj2)

In two dimensions, the integrand in (4.1) is nonzero on two triangles and on at least three tetrahedra in three dimensions for the edges in the interior of Ω. One can show using induction that a 2D mesh with N vertices and EB edges at the boundary has T = 2N − 2 − EB triangles and E = 3N − 3 − EB edges. Taking into account that there are three unknowns per triangle in (4.4) and one equation (4.6) per edge, we have to solve an underdetermined system for any triangulation containing more than one triangle with 3N − 3 − 2EB remaining degrees of freedom.

In three dimensions, the system of linear equations defined by (4.6) is also underdetermined if the mesh consists of more than one tetrahedron. Each edge in the mesh is an edge of at least one tetrahedron, but there may be only one tetrahedron associated with the edge on the boundary. Then the number of unknowns is six in (4.4) and the number of linear constraints of the form (4.6) is six. For each additional tetrahedron sharing the same edge, there are six new unknowns and three new constraints. The total number of unknowns for each edge is 6T, where T is the number of tetrahedra with a common edge and the number of linear constraints is 3T + 3. Locally, the diffusion matrix γ~ is underdetermined with 3T − 3 degrees of freedom.

Consequently, the diffusion γ~ satisfying (4.6) is not unique, but for all possible γ~ the error analysis in section 3 holds. We obtain the sharpest bounds on uu~L2 and εε~L2 by finding γ~ satisfying (4.6) and minimizing the difference γγ~ in the equations. An alternative would be to replace ‖·‖2 in (3.14) by the Frobenius norm‖·‖F. Since

A2AFdA2 (4.7)

for a matrix A [18], the bound in section 3 is sharper if the minimization is made in the ‖·‖2 norm. In the following, we propose a global and a local optimization procedure to find these minimizers γ~.

4.2. Global optimization

The diffusion matrix γ~ closest to the original diffusion γ with constant coefficient γ is found by minimizing the distance between γ~(x) and γ under the constraints in (4.6). The stiffness matrix S~ is given by (2.7) and one of the methods in section 2. As only the average γ~k of γ~(x) appears in the FEM approximation on each triangle Tk (see (4.3)), the norm of the difference in diffusion in (3.14) reduces to the weighted sum of the differences γ~kγ22 as a measure of the distance resulting in the following optimization problem:

minγ~kTkT|Tk|γ~kγ22, (4.8)
TkTijl=1LCijklγ~kl=S~ijeij. (4.9)

This is a nonlinear programming problem with 3T variables in two dimensions, 6T variables in three dimensions, and E linear constraints.

The difference γ~kγ22 is a convex function in the unknowns in γ~k. Hence, the objective function in (4.8) is a convex function too. Since also the constraint set in (4.9) is convex, the local solution to (4.8) and (4.9) is the unique global optimum. If Sij ≥ 0 ∀ i,j from the FEM discretization with diffusion constant γ, then S~ij=Siji,j, and the solution to (4.8) is γ~k=γTk.

The mean value matrix γ~k defines two (three) main axes in two (three) dimensions on Tk. Let the columns of V be the eigenvectors vj of γ~k with eigenvalues λj. After a coordinate transformation from x to y with x = Vy, the diffusion term is

x(γ~xu)=jλj2uvj2. (4.10)

The eigenvectors define the main axes of the diffusion, and the diffusion speed along those axes is given by the eigenvalues of γ~. Since

γ~kγ2=maxj|λjγ|, (4.11)

the ℓ2 norm in (4.8) measures the maximum deviation in speed of the diffusion in γ~ compared to γ weighted by the size of Tk. In the Frobenius norm,

γ~kγF=(j=1d(λjγ)2)1/2, (4.12)

and the norm is equal to the ℓ2 norm of the difference in diffusion speed in all directions. The objective function in (4.8) is continuous in γ~ but not continuously differentiable everywhere.

4.3. Local optimization

The optimization problem in the previous section may be computationally expensive but is simplified if we approach the solution of (4.9) by local optimization. Let ij be defined by

ij={emn:emnis an edge of anyTkTij}. (4.13)

The adjacent γ~k in Tk in Tij for each edge eij is optimized, while keeping S~ij constant on the other edges in ij. Update γ~k with the most recently computed diffusion matrix. Then iterate over all edges once. Still, the underdetermined system (4.9) will be satisfied, but with a different γ~L compared to γ~G solving (4.8). The algorithm is as follows.

Algorithm 2.

Local optimization I.

1:
γ~k=γTkT
2: for all eij do
3:  Solve
minγ~knewTkTij|Tk|γ~knewγ22  TkTijl=1LCijklγ~klnew=S~ij, l=1LCmnklγ~klnew=l=1LCmnklγ~kl  emnij\eij,TkTij
4: γ~k=γ~knew,TkTij
5: end for

The diffusion γ~k changes successively only on the elements adjacent to eij (two triangles in two dimensions and at least three tetrahedra in three dimensions in the interior) in each iterative step. At each inner edge in two dimensions, there are six variables and five constraints. As remarked in section 4.1 above, the number of variables in three dimensions in Algorithm 2 is 6T and the number of constraints is 3T + 3, where T is the number of tetrahedra sharing the common edge eij. For a boundary edge, the number of unknowns equals the number of constraints in two dimensions, and one has to solve only the linear system in (4.6).

Also, here we have that if S~ij=Sij0i,j, then the solution is γ~k=γ. The order in which the edges are traversed matters for the result of the algorithm, but when all edges have been visited, (4.9) is satisfied. In the numerical experiments in section 6, the order is random but other choices are possible.

The global γ~kG from (4.8) and the local γ~kL from Algorithm 2 fulfill

η2G=1|Ω|TkT|Tk|γ~kGγ221|Ω|TkT|Tk|γ~kLγ22=η2L, (4.14)

since γ~kG is the global minimum solution.

Neither the global nor the local procedure for determining γ~ guarantees its positive definiteness when the solution is computed with an optimization algorithm for a nonlinear objective function with linear constraints. Extra nonlinear constraints can be added to enforce positive definiteness. That leads to slow algorithms or sometimes very large backward errors γγ~k2 in the numerical experiments in section 6. An alternative would be to apply a computationally more expensive semidefinite programming algorithm [2, 47] to the problem. In section 6, we first compute γ~ without constraints for positive definiteness and then check the solution for positive definiteness. The nonlinear programming algorithm finds positive definite γ~k for all elements in most cases.

The diffusion γ~ is computed for a given mesh of finite mesh size h. What happens with γ~ when the mesh is refined depends on the mesh generator. If all Sij become nonnegative as h → 0, then γ~γ. Otherwise, there will be a difference γγ~ of O(1) as h vanishes.

The backward analysis is extended in the next section to the design of the stiffness matrix S~ such that the backward error γγ~ is minimized.

5. Design

In the previous section, we described how to analyze existing methods for creating positive jump coefficients by backward analysis. In this section we determine a new discretization using FEM by minimizing the backward error. We devise nonnegative jump coefficients such that the perturbed diffusion γ~ is as close as possible to the original diffusion with a constant γ. The connectivity of the network of edges is the same as in section 4.1 but S~ij is free to vary. Molecules in the stochastic setting are allowed to jump only to the neighboring voxels, but the rate is a free variable to be optimized such that the distribution of molecules converges to the diffusion equation (3.2) in the limit of large molecules numbers.

5.1. Global optimization

The diffusion γ~k in each triangle or tetrahedron is determined such that

minγ~kTkT|Tk|γ~kγ22, (5.1)
TkTijl=1LCijklγ~kl0eij. (5.2)

The equality constraints in (4.9) are replaced by the inequalities in (5.2). The new jump coefficients λji are computed by the optimal γ~ and S~ij,

S~ij=TkTijl=1LCijklγ~kl,ij, (5.3)

inserted into (2.7). The stiffness matrix is thus obtained from the FEM discretization of the diffusion term in (2.10) with linear Lagrangian elements and diffusion matrix γ~k on Tk.

5.2. Local optimization

The local optimization algorithm in section 4.3 to analyze given jump coefficients is modified in the same way to generate new coefficients instead. For each edge, the adjacent diffusion matrices are computed such that they are close to γ and the nonnegativity constraint is satisfied for the edges. Instead of keeping the contribution to the other edges constant, we let it vary constrained by nonnegativity. If emn is an edge in ij\eij, then we allow γ~ to be such that

TkTmnl=1LCmnklγ~kl=S~mn0. (5.4)

In each local optimization step, γ~k in the elements Tk adjacent to edge eij are modified while keeping S~mn in other edges in ij nonnegative. Splitting the sum in (5.4) into two parts, we have

TkTijTmnl=1LCmnklγ~klTkTmn\(TijTmn)l=1LCmnklγ~kl (5.5)
=TkTijTmnl=1LCmnklγ~klS~mn. (5.6)

The diffusion matrix on the left-hand side of (5.5) is updated given the diffusion matrix in the right-hand side in (5.6). This is repeated successively for all edges in the following algorithm.

Algorithm 3.

Local optimization II.

1:
γ~k=γTkT
2: for all eij do
3: S~ij=TkTijl=1LCijklγ~kl
4: end for
5: for all eij do
6:  Solve
minγ~knewTkTij|Tk|γ~knewγ22  TkTijl=1LCijklγ~klnew0, TkTijTmnl=1LCmnklγ~klnewTkTijTmnl=1LCmnklγ~klS~mn  emnij\eij,TkTij
7: γ~k=γ~knew,TkTij
8: S~ij=TkTijl=1LCijklγ~kl
9: end for

The number of optimization problems to be solved in Algorithm 3 is the number of edges E which is bounded by a constant times the number of vertices N in a mesh. The size of each optimization problem is independent of E and N. Hence, the computational work is proportional to N in the local optimization and of the same computational complexity as the matrix assembly of S. The edges are traversed in a random order in the experiments in section 6. When all edges have been visited once, S~ij satisfies (5.3) and S~ij0, and the new λji is computed using (2.7).

5.3. Practical implementation

The local minimization problem contains only the adjacent triangles or tetrahedra and is hence faster to compute, but η2L>η2G; see (4.14). Instead of running the local Algorithms 2 and 3 only once, we can repeat them iteratively with the results γ~k of the previous iteration as the initial guess for the next minimization. Then η2L will approach η2G.

A possible way to speed up the computation is to replace the ℓ2 norm of the error by the Frobenius norm,

ηF=1|Ω|TkT|Tk|γ~kγF2. (5.7)

The global nonlinear minimization problem (4.8) then simplifies to the quadratic programming problem

minγ¯γ¯THγ¯2fTγ¯, (5.8)
TkTijl=1LCijklγ~kl0eij, (5.9)

where H is a diagonal matrix with positive elements on the diagonal and γ¯ is a vector with γ~kl as components. By the relation between the ℓ2 and Frobenius norms (4.7), the resulting ηF yields only an upper bound on the global minimum η2G. In the local optimizations in Algorithms 2 and 3, ·22 is then substituted by ·2F.

We can further reduce the computational complexity by rewriting the high-dimensional minimization problem (5.8) as the smaller dual problem,

minμ0μTH~μ+2f~Tμ, (5.10)

where μ ≥ 0 is equivalent to μi ≥ 0 ∀i, and

H~=CH1CT,f~=CH1f,γ=H1(CTμf). (5.11)

In (5.11), C is such that (5.9) is replaced by Cγ¯0. The primal problem of dimension 3T is hence reduced by approximately a factor of two to the dual problem of dimension E in two dimensions. In three dimensions the dual problem is more than a factor of 4.5 smaller than the primal problem in the numerical experiments in section 6. The interior point algorithm is well suited for the quadratic programming problems (5.8) and (5.10); see, e.g., [2, 25].

5.4. Alternatives to determine a nonnegative S~

Another two possibilities are investigated to calculate an S~ with only nonnegative off-diagonal entries. From the set of discrete equations (2.5) it appears that a smaller difference between the discretization matrices D and D~ leads to a smaller error in the solution uu~L2. That suggests finding an S~ with the same sparsity pattern as S but with only nonnegative entries such that DD~2 is minimized.

A second alternative to guarantee nonnegative jump coefficients is adding artificial viscosity to the system. The same viscosity is added patchwise in all elements with a common vertex. If edge eij corresponds to a negative entry, then enough viscosity to eliminate the negative entry Sij is added to all edges originating from xi and xj as in the graph Laplacian. The symmetry of the original matrix S is preserved by adding |Sij|/2 to the nodes around xi and xj in the following way:

S~ik=Sik+|Sij|/2,S~ki=Ski+|Sij|/2xkconnected toxibyeki,S~jk=Sjk+|Sij|/2,S~kj=Skj+|Sij|/2xkconnected toxjbyekj,

This is a generalization of the nnFEM approach, where a sufficient amount of viscosity is added only to the negative edge. This type of artificial viscosity is introduced in [19] to prove that the maximum principle is satisfied for a conservation law.

6. Numerical experiments

In this section, we determine numerically the local ηL and global ηG backward errors in (4.14) for the different methods generating nonnegative coefficients as described in sections 2 and 5 with a diffusion coefficient γ = 1. By the analysis in section 3, the backward error bounds the forward error of the mean values in the spatial distribution of the copy numbers of the molecules uu~L2 in (3.13) and the exit times εε~L2 in (3.18). All computations are done in MATLAB using its optimization routines. The meshes are generated by COMSOL Multiphysics, and the FEM matrices are assembled by the same software.

6.1. Diffusion in two dimensions

The square [−0.5, 0.5] × [−0.5, 0.5] is discretized into 227 nodes; see Figure 2. As mentioned in section 2, mesh generators usually produce good quality meshes in two dimensions, and the mesh in Figure 2 is intentionally perturbed to obtain 47 edges with negative jump coefficients (marked as thick lines in Figure 2).

Fig. 2.

Fig. 2

The mesh in two dimensions. Negative edges are shown as thick lines.

The requirement to obtain a nonnegative discretization poses other constraints on the mesh than what is necessary for a FEM solution of high accuracy. Examples of quality measures Q related to errors in the finite element solution of Poisson’s equation are found in [43]. In two dimensions, let h1,h2,h3 be the lengths of the edges of a triangle of area A with the angle φ3 opposing the edge of maximum length h3. A bound on the error in the gradient between f and the approximating fh in the triangle is in [43],

ffhcf3h1h2h32A=cf3h32sin(φ3)=cf1Q, (6.1)

where cf is a bound on the second derivatives of f. The measure Q is positive and should be as large as possible. Suppose that two triangles with the same edge lengths have the edge eij of length h3 in common. Then Sij in (2.8) is negative when φ3 > π/2, while the estimate in (6.1) is as small as possible when φ3 is in the neighborhood of π/2. On the other hand, the accuracy is poor if h3 is large and all angles are less than π/2. Then Q is small but the jump coefficients are positive. A large h3 will of course also affect the spatial resolution of the stochastic simulations, but the diffusion propensities are well defined.

6.1.1. Backward analysis

We compare the FVM, the symmetrized GFET method, the nnFEM, and the method minimizing the backward error (MBE). These methods all produce discretization matrices approximating the Laplacian with only nonnegative off-diagonal entries. The experiments are carried out for the mesh in Figure 2. In Figure 3, the local backward error e=γ~kγ2 is plotted for all triangles TkT, calculated by the local and global minimizations in Algorithms 2 and 3 and in (4.8), (4.9) and (5.1), (5.2).

Fig. 3.

Fig. 3

The backward error calculated by the local and global minimizations in sections 4 and 5. The local error is e=γ~kγ2 on each triangle TkT.

In Table 2 we show the error

η2=TkT|Tk|γ~kγ22/|Ω|, (6.2)

where η2 is either η2L or η2G according to (4.14). For the global MBE, the matrices γ~k are first calculated by nnFEM and then used as an initial guess for the MBE optimization. The minima are computed by the MATLAB <m>fmincon</m> with the active-set algorithm.

Table 2.

The global backward errors in (6.2) computed locally η2L and globally η2G.

η2L
η2G
FVM 0.4211 0.2729
nnFEM 0.2057 0.1524
GFET 0.1963 0.1356
MBE 0.0693 0.0690

The local calculation of the backward error is more pessimistic than the global one in the table as expected from (4.14), but the ranking of the different methods is the same for both η2L and η2G. The FVM naturally leading to nonnegative jump coefficients causes the largest backward error when used on a poor mesh. A partial explanation of the FVM results may be that the jump coefficients are generated by a different principle than FEM. The fluxes over the element boundaries are approximated in FVM, and the method is forced into the framework of FEM. On four triangles, a discretization with FVM even leads to a negative definite diffusion matrix γ~k when calculated locally without the positive definiteness constraint. The GFET and nnFEM perform comparably for the mesh in Figure 2. Computing D~ for GFET is slightly more expensive than setting the negative off-diagonal entries to 0 in nnFEM. However, contrary to the nnFEM, the GFET preserves the exit time property of the original diffusion; see [31]. The minimization constrained by inequalities to obtain the discretization matrices with MBE improves the introduced backward error substantially. The faster local and slower global minimization algorithms yield similar results for MBE on the mesh in this example.

6.1.2. Forward error

The relative error in discrete solution uhu~hL2/uhL2 is computed to verify our analysis in section 3. Here uhL22=uhTMuh, with uh being the vector of the solution in each node and M the lumped mass matrix. The relative error is plotted between the discrete solution uh with the original discretization matrix D (with negative off-diagonal entries) and the perturbed discrete solution u~h resulting from one of the algorithms generating nonnegative off-diagonal entries in D~. The system of ODEs in (3.8) is solved by the MATLAB <m>ode15s</m>. Figure 4(a) shows the initial condition

u(x,0)=tanh(20x1)tanh(20x2)+1 (6.3)

on the mesh in Figure 2.

Fig. 4.

Fig. 4

(a) Initial condition. (b)–(f) Forward error uh(xi)u~h(xi)L2/uhL2 for different approximations at each node at t = 0.01.

The forward error uh(x,t)u~h(x,t)L2/uhL2 in space at t = 0.01 is depicted in Figures 4(b)–(f).

The forward error behaves in the way predicted by the backward error in Figure 3, Table 2, and the stability estimates in section 3. This is also confirmed in Figure 5, where the forward error in time is displayed in a log-lin scale such that the error for short times becomes visible. The unique steady state (3.17) is reached for large t, and the bound ||uhũh ||2kt with some k > 0 for the error derived in section 3 is sharp for small t only.

Fig. 5.

Fig. 5

Forward relative error uhu~hL2/uhL2 for 0 ≤ t ≤ 1.

Comparing the results in Figure 5 and Table 2, we see that the order between the methods is the same using the minimization procedure in section 4 and the solutions of (2.5) and (2.9). The performance of the different methods in the forward error is correctly predicted by the performance in the backward error, as expected from section 3. The MBE is the best method and FVM is the worst method, but the forward error is quite small in all methods, with a peak for FVM of less than three percent.

6.1.3. Error in eigenvalues

In the original equation (2.4), the diffusion is isotropic, the quotient between the eigenvalues in (4.10) of γ in two dimensions is λ12 = 1, and the eigenvectors point in the coordinate directions. The quotient q = λminmax is g/G in Lemma 3.1, and for the FVM and the MBE, q is shown in Figure 6.

Fig. 6.

Fig. 6

Quotient between the two eigenvalues λminmax of γ~i and the direction of the eigenvector corresponding to the larger eigenvalue. (a) Global FVM. (b) Global MBE.

Avoiding the negative off-diagonal elements leads to a local anisotropy in the diffusion γ~ in Figure 6. The eigenvectors corresponding to the larger eigenvalues are not aligned but point in what appears to be random directions. The effect of the change of the diffusion from γ to γ~ is randomized over Ω. A global anisotropy is not found here, in contrast to what we have in the special regular rhombus mesh in [31]. All voxels are tilted there in the same direction, increasing the diffusion speed in this direction in almost all mesh triangles. A random change of the major axis of diffusion is expected in general in a mesh created by any mesh generator.

6.1.4. Alternative methods

The two alternatives suggested in section 5.4—minimizing the difference between D and D~ in the ℓ2 norm and adding viscosity—are compared to the previous methods.

At a first glance at (3.7) and (3.8) it may seem like minimizing the difference between the matrices D and D~ in ℓ2 would result in the smallest forward error, but this is not the case. Indeed, Figure 7 shows the forward error for this approach together with the best (MBE) and the worst (FVM) methods. Comparing the matrix deviations in Table 3 with the results in Figure 7 reveals that there is only a weak correlation between a small forward error and the closeness of the matrices in the ℓ2 norm.

Fig. 7.

Fig. 7

Forward relative error uhu~hL2/uhL2 for 0 ≤ t ≤ 1, for ℓ2-optimization η2G=0.1643, and for added viscosity η2G=0.6265.

Table 3.

Relative difference DD~2/D2 between the discretization matrices.

DD~2/D2
Viscosity 0.7856
FVM 0.4520
Local MBE 0.1967
Global MBE 0.1487
nnFEM 0.1059
GFET 0.0846
2 optimal 0.0696

The ℓ2 norm of the difference in the discretization matrices in Table 3 does not reflect the behavior of the forward and backward errors, and the D~ optimized in the ℓ2 norm does not reproduce the correct steady state in Figure 7. There is no unique equation and no unique γ~(x) corresponding to a discretization matrix D~ in section 4. Hence, it is more meaningful to quantify and minimize the error in the solutions uh and ũh than to compare the discretization matrices representing many different analytical equations. In section 3 we showed that the γ~ closest to γ can be used to bound the error in the solution.

We see that adding viscosity to all nodes in the patch leads to adding an unnecessarily large amount of viscosity, resulting in a larger error than even the FVM in this case.

6.1.5. Practical implementation

The local backward error is too pessimistic in Table 2, but since only small optimization problems have to be solved involving the local triangles or tetrahedra to an edge, it is faster to compute. Furthermore, the backward error can be reduced by repeatedly applying Algorithm 2. The last solution in one iteration is the initial guess in the next iteration, and the edges are traversed in a different order in each iteration.

The effect of repeating Algorithm 2 is to spread the local error in each triangle over the domain. The η2L error is reduced towards the global minimum when altering the order of the edges in each iteration, but it does not seem to converge to η2G. Repeating Algorithm 2 about five times in Figure 8 is sufficient to achieve an improved backward error at a small increase in computation time.

Fig. 8.

Fig. 8

The error η2L for different numbers of iterations of Algorithm 2 and nnFEM, compared to the error η2G and the computing time for η2L and η2G.

Minimizing the ℓ2 norm becomes prohibitively slow, especially in the most expensive algorithm of computing the MBE globally. Therefore, to arrive at a practical implementation we switch to the Frobenius norm (5.7). Then the minimization problem (5.1) has a quadratic objective function in (5.8) and is solved by the MATLAB <m>quadprog</m> with the interior-point-convex algorithm. The approximate computing times in seconds and the computed backward error for the global MBE are displayed in Table 4. Since ‖A2 ≤ ‖AF, the minimization in the Frobenius norm does not reach the global minimum in the ℓ2 norm, but this is compensated for by a substantial speedup.

Table 4.

The computation time in seconds for the global MBE and the resulting global error in the ℓ2 norm when minimizing the ℓ2 norm and the Frobenius norm in the primal (5.8) problem.

Minimization Time
TkT|Tk|γγ~k22/|Ω|
║·║2 3620 0.0690
║·║F 0.9737 0.0804

In Figure 9, we compare the forward errors for the MBE when minimizing in the Frobenius and ℓ2 norms. The error resulting from minimization in the Frobenius norm is not much larger, while a reduction of the computing time of more than 3000 is achieved in Table 4.

Fig. 9.

Fig. 9

Forward error of the MBE with minimization in Frobenius and ℓ2 norms. The errors for the global and local minimizations in the Frobenius norm are indistinguishable.

6.2. Diffusion in three dimensions

Our methods are tested on a more realistic mesh such as those encountered in systems biology simulations. A sphere with radius 1 is discretized into two tetrahedral meshes with 602 and 1660 nodes. In both meshes, about 17 percent of the edges have a negative jump propensity with the standard FEM discretization. Mesh generators other than that in COMSOL Multiphysics were tested in [24] with similar results.

In the following experiments, the global backward error and D~ in MBE are computed by minimizing in the Frobenius norm. The number of unknown variables in the global optimization problem for the largest mesh is 51096 in the primal problem (5.8) and 10599 in the dual problem (5.10) in Table 5. The local optimization problems typically have 24 variables in the primal problem and 13 in the dual problem. In Figure 10 and Table 5, we see that the methods examined in two dimensions behave similarly to those in three dimensions. The FVM leads to a nonpositive definite diffusion γ~k in five tetrahedra on the coarse mesh and 12 on the fine mesh when calculated locally with Algorithm 2, where ‖·‖2 is replaced by ‖·‖F. There is a slight difference between the local and global MBEs but the error is in general small for all methods. The ranking of the methods is the same as in two dimensions in Table 2 for small t. Since the percentage of negative edges is the same when refining the mesh, the nnFEM and GFET methods do not improve on a finer mesh. How the backward error of the methods behaves when the mesh is refined depends not only on the mesh size but also on the shape of the elements. For small t, the methods perform in forward error on each mesh as predicted by the respective backward error in Table 5.

Table 5.

Locally and globally computed errors TkT|Tk|γ~kγ22/|Ω| on the coarse (602 nodes) and fine (1660 nodes) meshes.

602 1660

Local Global Local Global
FVM 0.6415 0.4284 0.6077 0.4227
nnFEM 0.3720 0.2898 0.3683 0.2818
GFET 0.3604 0.2618 0.3570 0.2632
MBE 0.1680 0.1593 0.1676 0.1698

Fig. 10.

Fig. 10

Forward error uhu~hL2/uhL2 for the different methods on a mesh with 602 nodes (solid lines) and with 1660 nodes (dashed lines with the same markers) discretizing the unit sphere.

6.3. Mean first hitting time

Molecules in biological cells undergo not only diffusion but also reactions. In order to measure the error in a way relevant for reaction-diffusion kinetics, we construct a problem that mimics the mean first binding time for two molecules A and B diffusing in a spherical domain in a diffusion limited case. The assumption is that the molecules react instantaneously when they are in the same voxel. We calculate the mean time it takes for molecule A diffusing in Ω with reflecting boundary conditions at ∂Ω to reach a certain node i at xi, where its reaction partner B is located. The molecule A is removed when it reaches the node at xi by introducing a sink at this point. This setup models a reaction complex B situated at node xi, transforming our molecule of interest A.

Let pi(x, t) be the probability distribution function of finding A in x at time t when B is at xi, and let S be the Dirac measure. Then pi satisfies

pit(x,t)=γΔpi(x,t)kδ(xxi)pi(x,t), (6.4)

with a Neumann boundary condition at ∂Ω and a constant k > 0. The mean value of the hitting time τi for A to find B is determined for all possible starting positions of A in the mesh. The initial condition is a uniform distribution of A, pi(x, 0) = 1/|Ω|. The domain Ω is the sphere of radius 1 discretized by the same meshes as in the previous section. A discrete approximation of (6.4) is

pit=(γDKi)pi, (6.5)

where piT=(pi1,pi2,,piN) and Ki is the zero matrix except for Kii = 109.

The survival probability Si(t) and the PDF πi(τ) for τi are defined by

Si(t)=Ωpi(x,t)dx=P(τit),πi(t)=Sit. (6.6)

The expected value of the hitting time τi can then be calculated by

E[τi]=0τπi(τ)dτ=0τSitdτ=0Ωpi(x,τ)dxdτ0k=1N|Vk|pikdτ. (6.7)

In Table 6, we compare E[τi] on the coarse mesh for the original discretization matrix D and the modified discretizations D~ described in sections 2 and 5. A sink is placed at one node i in the mesh. Since many interesting reactions in cells occur in reaction complexes bound to the membrane or in the nucleus, we especially investigate the time it takes for A to find B either at a boundary node or at the node closest to the center. The average of E[τi] over i is first computed when the sink and B are at any node and at any node on the boundary. Then the sink is at the node closest to the center. Finally, E[τi] is computed with stochastic simulation employing Algorithm 1. The time for A to reach B at the center is recorded for each trajectory, and the average is taken over 105 realizations. The initial position of A is sampled from a uniform distribution. With N being the total number of nodes, NB the number of boundary nodes, M the number of trajectories, and τcm the hitting time of trajectory m, the quantities in the table are

EAll=1Ni=1NE[τi],EBnd=1NBxiΩE[τi],ECdet=E[τc],ECstoch=1Mm1Mτcm,EStd2=1NB1xiΩ(E[τi]EBnd)2. (6.8)

Table 6.

Averages of the expected first hitting time E[τi] defined in (6.8) for different methods are shown in columns 2–5 on the mesh with 602 nodes.

EAll EBnd ECdet ECstoch
FEM 8.0413 11.6860 4.9211 N/A

FVM 8.8255 12.7055 5.9304 5.9733
GFET 7.7308 11.4102 3.6250 3.6424
nnFEM 7.4794 10.8482 4.4648 4.4707
MBE 8.2944 12.0863 5.3001 5.3323

The results with standard FEM are found in the top row in the table as reference values. The FEM values are second order accurate and converge to the analytical values of the original diffusion equation when the mesh size is reduced. Since the FEM stiffness matrix has negative off-diagonal elements, stochastic simulation with its jump coefficients is impossible. In Figure 11, we illustrate the results in Table 6 by plotting the expected time to reach a node xi as a function of its radial position. We average the expected exit times at all nodes in shells of the sphere of width 0.1.

Fig. 11.

Fig. 11

Expected exit times as a function of the radial position.

The MBE is the superior method both in the average over all nodes and in reaching the center when compared to the FEM in Table 6 and Figure 11. The GFET, which was designed in [31] to be accurate for the global first exit time—meaning the first hitting time of a boundary node—performs best for the boundary nodes. However, the GFET is not able to compute the time to reach the center of the cell very accurately. This shortcoming was discussed in [31]. The FVM is too slow, with a longer time to reach the sinks than FEM, and GFET and nnFEM are a little too fast, corresponding to a global diffusion coefficient larger than γ. This tendency was noted also in [31]. The results of the stochastic simulations in column 5 for the central node are close to the deterministic values of (6.7) in column 4 as expected for a large M.

The standard deviation of the mean time it takes to reach a boundary node measures the variation between different nodes at the boundary and should be small (ideally 0) for a good mesh and an accurate discretization. In Table 7, we compare the expected time to reach a boundary node and its standard deviation (6.8) for the different methods on the two meshes.

Table 7.

Expected time to reach a boundary node and its standard deviation on a mesh with 602 nodes (left) and a fine mesh with 1660 nodes (right).

602 1660

EBnd EStd/EBnd EBnd EStd/EBnd
FEM 11.6860 0.0876 15.8015 0.0808

FVM 12.7055 0.1557 16.7264 0.1386
GFET 11.4102 0.1170 15.4179 0.1060
nnFEM 10.8482 0.1171 14.6743 0.1060
MBE 12.0863 0.0908 16.2679 0.0853

The standard deviation of MBE is close to that of FEM, demonstrating that the anisotropy in the diffusion introduced by MBE has a small impact compared to the accuracy effects of the discretization and the mesh. The small difference in EStd/EBnd between MBE and FEM is most likely explained by the random directions of maximum and minimum diffusion as in Figure 6. The relative standard deviation is reduced slightly when the mesh is refined but EBnd has not yet converged. The EBnd closest to the FEM value is obtained by GFET. When simulating a signal being transmitted inside the cell, it is advantageous to use GFET if the important reactions occur on the membrane. On the other hand, if the signal is traveling inside the cytoplasm and reacting there, then the MBE results in the most accurate transmission time in Table 6.

7. Conclusion

For the discrete stochastic simulation of diffusion in systems biology, we need jump propensities for the molecules in the discrete space model. These propensities are chosen as the off-diagonal elements of the discretization matrix obtained by a numerical approximation of the Laplacian. The jump coefficients have to be nonnegative. For unstructured meshes, nonnegative off-diagonal elements cannot be guaranteed with a discretization matrix assembled by a standard finite element method (FEM), but there exist different approaches to change this discretization matrix to fulfill the nonnegativity condition. As a result of this change, a diffusion equation with an altered diffusion is approximated.

We first present a method to analyze these existing methods, producing nonnegative jump propensities on an unstructured mesh of poor quality. The difference between the solution to the original and the perturbed diffusion equations is bounded by the difference in the diffusion coefficients. Then the perturbed diffusion is retrieved by backward analysis. This leads us to the derivation of a new algorithm creating a discretization matrix based on FEM, minimizing the backward error.

We show in numerical experiments that the finite volume method (FVM) to compute a nonnegative discretization incurs high forward and backward errors on our meshes. Our previously proposed methods of eliminating the negative coefficients in the finite element method (nnFEM) and satisfying the global first exit time constraint (GFET) perform comparably. The new method to generate jump coefficients on a given mesh proposed in this paper results in a considerably smaller error on both an artificial mesh in two dimensions and a realistic mesh in three dimensions.

The average of the first hitting time obtained by stochastic simulations with nonnegative jump coefficients is close to the solution of a deterministic equation with a modified diffusion as expected. The accuracy of this average compared to the exact analytical values depends not only on the number of trajectories in the Monte Carlo simulation but also on the mesh size and the mesh quality. In general, with the MBE the backward and forward errors are small and the mean hitting time to any node is well approximated. The errors in the stochastic diffusion simulation are of the same order as the errors in biological measurements [37, 39]. Furthermore, there is a variation in the diffusion constant across the cell in measurements in [40] comparable to the variation of the space-dependent γ~ of the perturbed diffusion equation (3.2) determined by our algorithms.

Since the off-diagonal elements are nonnegative, the FEM discretization of the equation with the modified diffusion satisfies the sufficient conditions for the discrete maximum principle for the FEM solution. The discrete maximum principle being satisfied for the original diffusion on any mesh seems to be possible only with a nonlinear scheme as in [4]. Then the stiffness matrix S is reassembled in every time step. Our scheme is linear with a constant S but for a modified diffusion.

Acknowledgments

We have had fruitful discussions with Murtazo Nazarov and Stefano Serra-Capizzano concerning parts of this work.

Footnotes

*

This work was supported by Swedish Research Council grant 621-2011-3148, the UPMARC Linnaeus center of Excellence, the Swedish strategic research programme eSSENCE, and NIH grant for StochSS 1R01EB014877-01.

References

  • 1.Andrews SS, Addy NJ, Brent R, Arkin AP. Detailed simulations of cell biology with Smoldyn 2.1. PLoS Comput Biol. 2010;6:e1000705. doi: 10.1371/journal.pcbi.1000705. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 2.Boyd S, Vandenberghe L. Convex Optimization. Cambridge University Press; Cambridge, UK: 2004. [Google Scholar]
  • 3.Brandts J, Korotov S, Křížek M, Šolc J. On nonobtuse simplicial partitions. SIAM Rev. 2009;51:317–335. [Google Scholar]
  • 4.Burman E, Ern A. Stabilized Galerkin approximation of convection-diffusion-reaction equations: Discrete maximum principle and convergence. Math Comp. 2005;74:1637–1652. [Google Scholar]
  • 5.Cao Y, Gillespie DT, Petzold LR. The slow-scale stochastic simulation algorithm. J Chem Phys. 2005;122:014116. doi: 10.1063/1.1824902. [DOI] [PubMed] [Google Scholar]
  • 6.Donev A, Bulatov VV, Oppelstrup T, Gilmer GH, Sadigh B, Kalos MH. A first-passage kinetic Monte Carlo algorithm for complex diffusion-reaction systems. J Comput Phys. 2010;229:3214–3236. [Google Scholar]
  • 7.Elf J, Ehrenberg M. Spontaneous separation of bi-stable biochemical systems into spatial domains of opposite phases. Syst Biol. 2004;1:230–236. doi: 10.1049/sb:20045021. [DOI] [PubMed] [Google Scholar]
  • 8.Elowitz MB, Levine AJ, Siggia ED, Swain PS. Stochastic gene expression in a single cell. Science. 2002;297:1183–1186. doi: 10.1126/science.1070919. [DOI] [PubMed] [Google Scholar]
  • 9.Engblom S, Ferm L, Hellander A, Lötstedt P. Simulation of stochastic reaction-diffusion processes on unstructured meshes. SIAM J Sci Comput. 2009;31:1774–1797. [Google Scholar]
  • 10.Erten H, Üngör A. Quality triangulations with locally optimal Steiner points. SIAM J Sci Comput. 2009;31:2103–2130. [Google Scholar]
  • 11.Evans LC. Partial Differential Equations. AMS; Providence, RI: 1998. (Grad. Stud. Math. 19). [Google Scholar]
  • 12.Eymard R, Gallouët T, Herbin R. A cell-centred finite-volume approximation for anisotropic diffusion operators on unstructured meshes in any dimension. IMA J Numer Anal. 2006;26:326–353. [Google Scholar]
  • 13.Gao Z, Wu J. A second-order positivity-preserving finite volume scheme for diffusion equations on general meshes. SIAM J Sci Comput. 2015;37:A420–A438. [Google Scholar]
  • 14.Gardiner CW, McNeil KJ, Walls DF, Matheson IS. Correlations in stochastic theories of chemical reactions. J Stat Phys. 1976;14:307–331. [Google Scholar]
  • 15.Gibson MA, Bruck J. Efficient exact stochastic simulation of chemical systems with many species and many channels. J Phys Chem. 2000;104:1876–1889. [Google Scholar]
  • 16.Gillespie DT. A general method for numerically simulating the stochastic time evolution of coupled chemical reactions. J Comput Phys. 1976;22:403–434. [Google Scholar]
  • 17.Gillespie DT, Hellander A, Petzold LR. Perspective: Stochastic algorithms for chemical kinetics. J Chem Phys. 2013;138:170901. doi: 10.1063/1.4801941. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Golub GH, Van Loan CF. Matrix Computations. Johns Hopkins University Press; Baltimore, MD: 1989. [Google Scholar]
  • 19.Guermond JL, Nazarov M. A maximum-principle preserving C0 finite element method for scalar conservation equations. Comput Methods Appl Mech Engrg. 2014;272:198–213. [Google Scholar]
  • 20.Hattne J, Fange D, Elf J. Stochastic reaction-diffusion simulation with MesoRD. Bioinformatics. 2005;21:2923–2924. doi: 10.1093/bioinformatics/bti431. [DOI] [PubMed] [Google Scholar]
  • 21.Hepburn I, Chen W, Wils S, De Schutter E. STEPS: Efficient simulation of stochastic reaction-diffusion models in realistic morphologies. BMC Syst Biol. 2012;6:36. doi: 10.1186/1752-0509-6-36. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 22.Isaacson SA, Peskin CS. Incorporating diffusion in complex geometries into stochastic chemical kinetics simulations. SIAM J Sci Comput. 2006;28:47–74. [Google Scholar]
  • 23.Kerr RA, Bartol TM, Kaminsky B, Dittrich M, Chang JCJ, Baden SB, Sejnowski TJ, Stiles JR. Fast Monte Carlo simulation methods for biological reaction-diffusion systems in solution and on surfaces. SIAM J Sci Comput. 2008;30:3126–3149. doi: 10.1137/070692017. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 24.Kieri E. MSc thesis. Uppsala University; Uppsala, Sweden: 2011. Accuracy Aspects of the Reaction-Diffusion Master Equation on Unstructured Meshes. (Tech report UPTEC F 11014). [Google Scholar]
  • 25.Kim SJ, Koh K, Lustig M, Boyd S, Gorinevsky D. An interior-point method for large-scale ℓ1-regularized least squares. IEEE J Selected Topics Signal Process. 2007;1:606–617. [Google Scholar]
  • 26.Kiviet DJ, Nghe P, Walker N, Boulineau S, Sunderlikova V, Tans SJ. Stochasticity of metabolism and growth at the single-cell level. Nature. 2014;514:376–379. doi: 10.1038/nature13582. [DOI] [PubMed] [Google Scholar]
  • 27.Korotov S, Křížek M, Neittanmäki P. Weakened acute type condition for tetrahedral triangulations and the discrete maximum principle. Math Comp. 2000;70:107–119. [Google Scholar]
  • 28.Kurtz TG. Solutions of ordinary differential equations as limits of pure jump Markov processes. J Appl Probab. 1970;7:49–58. [Google Scholar]
  • 29.Kurtz TG. Limit theorems for sequences of jump Markov processes approximating ordinary differential processes. J Appl Probab. 1971;8:344–356. [Google Scholar]
  • 30.Logg A, Mardal KA, Wells G. Automated Solution of Differential Equations by the Finite Element Method. Springer; Berlin: 2012. [Google Scholar]
  • 31.Lötstedt P, Meinecke L. Simulation of stochastic diffusion via first exit times. J Comput Phys. 2015;300:862–886. doi: 10.1016/j.jcp.2015.07.065. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 32.McAdams HH, Arkin A. Stochastic mechanisms in gene expression. Proc Natl Acad Sci USA. 1997;94:814–819. doi: 10.1073/pnas.94.3.814. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 33.McQuarrie DA. Stochastic approach to chemical kinetics. J Appl Probab. 1967;4:413–478. [Google Scholar]
  • 34.Metzler R. The future is noisy: The role of spatial fluctuations in genetic switching. Phys Rev Lett. 2001;87:068103. doi: 10.1103/PhysRevLett.87.068103. [DOI] [PubMed] [Google Scholar]
  • 35.Munsky B, Neuert G, van Oudenaarden A. Using gene expression noise to understand gene regulation. Science. 2012;336:183–187. doi: 10.1126/science.1216379. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36.Øksendal B. Stochastic Differential Equations. 6th. Springer; Berlin: 2003. [Google Scholar]
  • 37.Persson F, Lindén M, Unoson C, Elf J. Extracting intracellular diffusive states and transition rates from single molecule tracking data. Nature Methods. 2013;10:265–269. doi: 10.1038/nmeth.2367. [DOI] [PubMed] [Google Scholar]
  • 38.Raj A, van Oudenaarden A. Nature, nurture, or chance: Stochastic gene expression and its consequences. Cell. 2008;135:216–226. doi: 10.1016/j.cell.2008.09.050. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 39.Di Rienzo C, Piazza V, Gratton E, Beltram F, Cardarelli F. Probing short-range protein Brownian motion in the cytoplasm of living cells. Nature Commun. 2014;5:5891. doi: 10.1038/ncomms6891. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 40.Lanzano L, Ranjit S, Gratton E. Mapping diffusion in a living cell via the phasor approach. Biophys J. 2014;107:2775–2785. doi: 10.1016/j.bpj.2014.08.041. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 41.Schöneberg J, Ullrich A, Noé F. Simulation tools for particle-based reaction-diffusion dynamics in continuous space. BMC Biophys. 2014;7:11. doi: 10.1186/s13628-014-0011-5. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 42.Sheng Z, Yuan G. An improved monotone finite volume scheme for diffusion equation on polygonal meshes. J Comput Phys. 2012;231:3739–3754. [Google Scholar]
  • 43.Shewchuk JR. Proceedings of the 11th International Meshing Roundtable (Ithaca, NY) Springer-Verlag; New York: 2002. What is a good linear element? Interpolation, conditioning, and quality measures; pp. 115–126. [Google Scholar]
  • 44.Svärd M, Gong J, Nordström J. An accuracy evaluation of unstructured node-centred finite volume methods. Appl Numer Math. 2008;58:1142–1158. [Google Scholar]
  • 45.Swain PS, Elowitz MB, Siggia ED. Intrinsic and extrinsic contributions to stochasticity in gene expression. Proc Natl Acad Sci USA. 2002;99:12795–12800. doi: 10.1073/pnas.162041399. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 46.Thomée V. Galerkin Finite Element Methods for Parabolic Problems. Springer; Berlin: 1997. [Google Scholar]
  • 47.Vandenberghe L, Boyd S. Semidefinite programming. SIAM Rev. 1996;38:49–95. [Google Scholar]
  • 48.Varga RS. Matrix Iterative Analysis. Prentice-Hall; Englewood Cliffs, NJ: 1962. [Google Scholar]
  • 49.Xu J, Zikatanov L. A monotone finite element scheme for convection-diffusion equations. Math Comp. 1999;68:1429–1446. [Google Scholar]
  • 50.van Zon JS, ten Wolde PR. 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]

RESOURCES