3.1. Canonical Stochastic Method
In this section we consider a canonical stochastic system, introducing the notation and general framework associated with the SRCM without explicitly interfacing with the PDEs (this will be done in
Section 3.2). This canonical system will incorporate diffusion, reaction kinetics and also, importantly, the forward and backward conversion reactions (although these will not take effect until we interface with the PDE in
Section 3.2). In the regime conversion method [
23], ‘forward’ conversion is the conversion from continuous to discrete mass, while ‘backward’ conversion refers to the conversion from discrete to continuous. We will refer to these as ‘C-D conversion’ and ‘D-C conversion’ to mean continuous-to-discrete and discrete-to-continuous conversion, respectively. At this point, while introducing the canonical stochastic framework these conversion reactions are simply placeholders—dummy reactions with no impact on the system—however, it is important to introduce them here as these reactions later control transitions between discrete and continuous representations in the SRCM. We define the set of conversion reactions within each compartment as follows:
The first
M reactions correspond to continuous-to-discrete conversion reactions for species
, respectively, whilst the second
M reactions correspond to discrete-to-continuous reactions for species
, respectively. We now extend the full reaction list for compartment
to include these conversion reactions
Each element of
is a label for a specific reaction initiated within compartment
. As there are
distinct reaction types per compartment and
K compartments, the system comprises a total of
reactions. For
, the reaction is a C-D conversion of species
. For
, it is a D-C conversion of species
. Reactions with
represent leftward diffusion, and those with
represent rightward diffusion, both of species
. Finally, for
, the reaction corresponds to one of the
Q kinetic reactions. Whilst compartments share the same set of reactions,
, the propensity functions of the diffusion reactions in the boundary compartments (i.e.,
and
) are adjusted to implement the appropriate boundary conditions [
26] (typically, in the test simulations of
Section 4, these will be zero-flux boundary conditions). The complete list of reactions across all the compartments of the domain is given by
.
We introduce for and , which define the rate of reaction q occurring in compartment k. In general, these reaction rates will be consistent across compartments.
In the following subsections we will introduce notation for each of the three reaction types—conversion, diffusion, and kinetic—and discuss their implementation in the canonical stochastic framework.
3.1.1. Conversion Reactions
Here we briefly discuss conversion reactions, which handle transformations between discrete and continuous representations of species in the SRCM. Although conversion plays a crucial role in the full SRCM framework, it is important to stress that we have not yet discussed the inclusion of the PDE dynamics, so the aim of this subsection is to lay the groundwork for its later inclusion.
Let
index a continuous-to-discrete conversion reaction of species
i, representing the transformation of a single particle’s worth of continuous mass into a discrete particle. In the SRCM, this would describe mass transfer from the continuous to the discrete regime. For now, in this purely stochastic setting, we model this simply as a trivial first-order reaction (which does not impact the system):
This results in an update to the discrete state in compartment
k:
Conversely, for the discrete-to-continuous conversion, suppose
. This would correspond to the conversion of a single discrete particle to particle’s worth of continuous mass in the SRCM. However in the canonical stochastic system we simply represent this as follows:
with the corresponding stoichiometric change:
Although these reactions currently have no effect on any discrete or continuous species (since such a representation is not yet included), they play a vital role in the SRCM.
3.1.2. Diffusion Reactions
Let reaction index the leftward diffusion of species . This reaction corresponds to the movement of a particle of species i from compartment k to compartment . While this reaction is defined for , the corresponding propensity function for will be set to zero for the examples in this paper, implementing zero-flux boundary conditions by ensuring that there is no leftward diffusion from the first compartment.
The stoichiometric update for this reaction is encoded in the matrix
. Since only species
i is involved, all the rows except row
i are zero. Similarly, since the diffusive jump affects only two compartments, the majority of the columns of
are zero. The non-zero columns are as follows:
where
is the standard basis vector with a 1 in the
i-th position (and zeros elsewhere). For all the other compartments:
Similarly, indexes the rightward diffusion reactions, where species i moves from compartment k to compartment . While this reaction is defined for , the corresponding propensity function for will be set to zero for the examples in this paper, implementing zero-flux boundary conditions by ensuring there is no rightward diffusion from the last compartment.
The corresponding stoichiometric update vectors are as follows:
and for all the other compartments:
3.1.3. Kinetic Reactions
We now focus on the kinetic reactions, which are local to each compartment. To represent these reactions, we define a stoichiometric vector
for each reaction
q, where the scalar
denotes the net change in the number of particles of species
m given reaction
q occurs. Only the entries of
corresponding to the species involved in the reaction (as reactants or products) will be non-zero (even some of these entries may be zero if the corresponding reactant acts as a catalyst and therefore emerges from the reaction unchanged in copy-number). Suppose a kinetic reaction with index
occurs in compartment
. The vector
comprises the
k-th column of the stoichiometric matrix
, while all the other columns are zero:
Later, when we extend this notation to the full SRCM framework, it will be necessary to introduce new reaction types that allow interactions between discrete particles and continuous mass.
3.1.4. Propensity Functions
We define
to be the propensity function of reaction
q occurring within compartment
k. We define
to be the vector of all the propensity functions occurring in compartment
k, for
. We then concatenate these vectors in order to define the full propensity matrix across all the compartments as follows:
These propensity values are used in the Gillespie algorithm to determine both the timing and location of the next reaction event. We define the total propensity within each compartment:
and collect these totals into a vector:
which will be used to determine the compartment index. We then calculate the total propensity sum that will be used to calculate the time for the next reaction:
The Gillespie algorithm for this canonical stochastic reaction network is given in Algorithm 1.
| Algorithm 1 Stochastic simulation of canonical system |
- 1:
Set ▹Initialise time - 2:
Set T ▹Set end time - 3:
Initialise state vector - 4:
while do - 5:
Draw random numbers - 6:
for to K do ▹Work out propensity list for every compartment - 7:
Compute propensities - 8:
Compute total propensity in compartment k: - 9:
end for - 10:
Compute total system propensity: - 11:
Compute time to next reaction: - 12:
Determine the reaction compartment, k, such that: - 13:
Determine the reaction index, q, that occurs within compartment k such that: - 14:
Execute reaction q in compartment k by updating the state: - 15:
Advance time: - 16:
end while
|
3.2. Including the Continuous Representation—The Spatial Regime Conversion Method
After developing the groundwork for the canonical stochastic model, we now interface this with the continuous representation to characterise the SRCM. To capture discrete and continuous dynamics, we extend the state space to include both representations for each species .
We define the function
to be the continuous profile of species
i within the SRCM framework. In order to allow the interaction and conversion between continuous and discrete mass, we will need to calculate the amount of continuum mass within each compartment and to be able to treat it, in some sense, as if it were discrete mass (i.e., particles). To that end (as in [
19]) we define the number of ‘pseudo-particles’ in a compartment as the number of discrete particles that would have the same mass as represented by the continuous PDE profile over that compartment’s support. The pseudo-particle count for species
i in compartment
is denoted by
for
and
. The number of continuous-mass pseudo-particles in compartment
is calculated as follows
Since these values represent continuous mass, they may take non-integer values. The continuous representation of species
will be labelled
.
Correspondingly, the discrete representation of species is labelled , with the number of discrete particles in compartment given by . These values represent actual particle counts and are, therefore, restricted to non-negative integers.
We calculate the total number of particles of species
in compartment
as the sum of its continuous and discrete components:
For the SRCM we must extend the chemical reaction network to incorporate both continuous and discrete species and the potential reactions between them. We label the extended chemical reaction network as . This extended network explicitly includes reactions involving both continuous and discrete components. Consequently, the theoretical framework and associated stoichiometric matrices must be adapted to account for transformations involving continuously represented mass.
In the SRCM, we extend the original set of reactions to a new, augmented reaction set:
where
denotes the extended kinetic reaction set in the discrete regime of the SRCM (which we will describe in
Section 3.2.4). The conversion and diffusion reactions remain unchanged. Recall that while the conversion reactions were redundant in the canonical stochastic model, they play a crucial role in the full SRCM, facilitating mass transfer between regimes in a concentration-dependent manner (as described in
Section 3.2.2).
To describe the system state in this extended framework, we introduce the new state matrix
. The first
M rows of the state matrix represent the number of discrete particles, and the second
M rows represent the number of continuous pseudo-particles. Formally, we define the following:
We now turn to defining the stoichiometric updates in the extended system. In the canonical system, each reaction was associated with a stoichiometric matrix . In the SRCM, we must extend this to a stoichiometric matrix , capturing updates to both the discrete and continuous components of the system state.
3.2.1. Updating the Continuous Profile
As described previously, in the event that a reaction occurs which changes the number of continuous pseudo-particles, with the corresponding state update equation
there will be some non-zero element within the final
M rows of
. This will represent an integer change
in at least one of the species
, which is captured by the following equation for the number of pseudo-particles of species
i in compartment
:
We need to update the continuous representation of the species by adding a (possibly negative) mass
, spread across the area that corresponds to compartment
. This change would be implemented as follows, in the continuous PDE solution:
where
is the indicator function for compartment
, and
denotes its volume.
However, since we are implementing a numerical solution of the PDE, we add
particles’ worth of mass spread evenly across the grid points in the associated compartment (remembering we are mapping between PDE points and compartments using the left-hand rule):
This numerical update ensures that the correct mass is added or subtracted from the numerical solution. In particular, it guarantees conservation of mass under these conversion-type reactions. In the following subsections, we extend the conversion, diffusion, and kinetic reactions for the SRCM in order to demonstrate how the framework changes with respect to the canonical stochastic system outlined in
Section 3.1.
3.2.2. Conversion Reactions
In this section we will outline the implementation of conversion reactions in the full SRCM. Specifically we will consider a conversion reaction assumed to be occurring in compartment for . In the canonical system, conversion reactions are described by the stoichiometric matrices for C-D conversion reactions, where , and by for D-C conversion reactions, where . Because we did not include the continuous representation in the purely stochastic canonical system, these reactions were essentially redundant.
In the SRCM, we define the augmented stoichiometric matrices
for the C-D conversion reactions. The first
M rows correspond to the changes in the discrete representation, and the second
M rows represent changes in their continuous counterparts. Specifically, the stoichiometric matrix for the C-D conversion reactions in compartment
are defined as follows:
This results in the appropriate increase in the discrete particle numbers whilst also specifying that we should update the numerical PDE concentration profile as follows:
Note that if for any PDE solution point, j, in the associated compartment, then this conversion will be aborted, as this would lead to negative values in the numerical PDE solution profile.
The stoichiometric matrix for the D-C conversion reaction,
in compartment
is defined as follows:
This results in the appropriate decrease in the discrete particle numbers as well as specifying that we should update the numerical PDE profile as follows:
Note that there are no restrictions on D-C conversions since discrete particle numbers are integer valued; if the number of particles of species i is zero, that species will never be selected for a D-C conversion.
The conversion reactions are regulated by concentration thresholds, , for each species . These thresholds correspond to mass thresholds within a compartment, defined as , where is the compartment volume. In a given compartment , if the mass of species i, denoted , exceeds its mass threshold , then D-to-C conversion is active; otherwise, C-to-D conversion takes place.
We denote the full set of conversion reactions as
which are included in the local reaction list
for compartment
. As before, we index these reactions by
. The rate of each conversion reaction in compartment
k is defined as the product of the fixed conversion rate
and an indicator function that is one or zero depending on whether the combined mass is above or below the mass threshold:
3.2.3. Diffusion Reactions
In the canonical system, the diffusion reactions are described by for leftward jumps, where , and by for rightward jumps, where . In the extended system, we define , where the first M rows are identical to and the remaining M rows are zero. This is because diffusion reactions only impact the discrete regime and do not affect the continuous regime. The same extended structure applies to .
3.2.4. Kinetic Reactions
Kinetic reactions present potentially the greatest departure of the SRCM from the canonical stochastic system. They must be categorised by reaction order to be implemented appropriately in the SRCM. We classify reactions as zeroth-order, first-order, and second-order. The assignment of products to either the discrete or continuous regime is governed by the following rules:
- (C1):
To minimise unnecessary transitions between modelling regimes, product molecules of species are assigned to the same regime as their corresponding reactants of species (if any). In the event of a homodimerisation reaction between and (discrete and continuous representation), we will place product molecules of this species in the discrete regime.
- (C2):
To preserve stochasticity, any reaction products that do not correspond to a reactant species are placed in the discrete regime.
- (C3):
If all reactants in a reaction belong to the continuous regime, their products remain in the continuous regime. In this case, the reaction is naturally modelled using the PDE.
These rules were developed initially for the regime conversion method for well-mixed systems [
23]. In the spatial setting of the SRCM, we will adhere to these rules in the implementation of our test problems unless otherwise specified.
In what follows, we consider kinetic reactions occurring within compartment with the assumption that identical reactions are defined independently in other compartments.
Given the stoichiometric vector
capturing the effect of reaction
q on the species numbers in compartment
in the canonical stochastic system, we define
to be the extended stoichiometric vector associated with reaction
q in which the first
M entries are the same as
and the second set of
M entries are zero. We specify these as follows:
where
are
-dimensional basis vectors and
represents the
element of
.
3.2.5. Zeroth-Order Reactions
Each zeroth-order reaction in the original discrete reaction system maps directly to a single corresponding reaction in the hybrid system. A general zeroth-order reaction takes the form
which will be implemented in the SRCM as follows:
In accordance with rule (C2), we assign all the products to the discrete regime. The stoichiometric vector is, therefore,
, as defined in Equation (
7). Correspondingly, the stoichiometric matrix,
, will have the first
M rows exactly the same as
in the canonical stochastic system, and the second set of
M rows will be zero.
3.2.6. First-Order Reactions
In the canonical stochastic implementation, we can write a generic first-order reaction as follows:
where
is the stoichiometric vector for the canonical system associated with reaction
q. This corresponds to two possible implementations in the SRCM:
Reaction (F2) involves only continuous species and is naturally implemented in the PDE regime. Consequently, we explicitly model only reaction (F1) within the discrete framework. Similarly to zeroth-order reactions, there is a one-to-one mapping between first-order reactions in the canonical stochastic reaction system and reactions of type (F1) in the discrete regime of the SRCM. The stoichiometric vector is hence
as specified in Equation (
7).
3.2.7. Second-Order Reactions
Second-order reactions involve the interaction of two species and are written in general form as follows:
where it is possible, in the case of homodimerisation, that
. This potentially gives rise to four distinct second-order reactions within the SRCM:
As was the case of first-order reactions, the second-order reactions involving only continuous reactants (S4) are handled directly within the PDE framework in accordance with rule (C1). By contrast, reactions (S1)–(S3) involve at least one discrete species and are, therefore, treated in the discrete SRCM framework. This distinction makes second-order reactions more complex to represent in the SRCM than their zeroth- or first-order counterparts.
In the canonical stochastic system, the total number of kinetic reactions is
, where the subscripts denote reaction order. In the extended hybrid system, each first-order reaction yields two subreactions (corresponding to whether the reactant is discrete or continuous), and each second-order reaction yields four (depending on the combination of discrete and continuous reactants involved), so the total number of kinetic reactions becomes
Among these kinetic reactions, those with all the reactants in the continuous state (
) are modelled in the continuous regime. The remaining
are handled stochastically in the discrete regime. Let
denote the full set of kinetic reactions in the extended system, with
We partition this set as follows:
where
comprises the
reactions with at least one discrete reactant, and
comprises the
reactions with only continuous reactant species.
Diffusion and conversion reactions remain unchanged. Consequently, the complete set of reactions modelled in compartment
k of the discrete framework is as follows:
We order the kinetic reaction set in increasing reaction order: zeroth, first, and then second, remembering that each second-order reaction of the canonical stochastic system yields three subreactions: (S1)–(S3). We specify cumulative index sets in the extended reaction network. The zeroth-order reactions correspond to indices . The first-order reactions correspond to indices . Finally, the second-order reactions correspond to indices , where the factor of three accounts for the three discrete sub-reactions associated with each second-order reaction.
We re-index kinetic reactions in the extended system using index
. For zeroth- and first-order reactions, the mapping is identical:
Second-order reactions, originally indexed by
in the canonical stochastic system, are each expanded into three discrete sub-reactions, (S1)–(S3), in the extended system. Let
then the re-indexed sub-reactions are
Given that , then we will simply define .
We consider a generic second-order reaction involving two species
and
within the SRCM. Each original second-order reaction
q thus yields
, corresponding to reactions (S1), (S2), and (S3), respectively. The associated stoichiometric vectors
are defined as follows:
Each kinetic reaction is implemented within a single compartment
, so the stoichiometric matrices are
The full state update upon the firing of reaction
in compartment
is given by the following:
If
or
then there will be an interaction between continuous and discrete regimes, and therefore we would like to update the amount of mass within the continuous PDE regime as follows:
The vector
describes the change in the value
given that reaction
has occurred in the extended system. Correspondingly, we update the numerical solution of the PDE profile as follows:
3.2.8. Propensity Functions for Extended System
We define
as the propensity function of the reaction
q that occurs within compartment
of the SRCM. We note that the propensity functions will remain the same as the canonical system for
. However, we must introduce new propensity functions for
, corresponding to the second-order interactions:
The propensity functions of the second-order reactions may now depend on the continuous mass. For example, if we study reactions (S1)–(S3) then the associated propensities are as follows:
Now that we have defined the full list of propensities for each compartment, we can concatenate them to produce the following propensity matrix:
We define the total propensity within each compartment as follows:
We collect these totals into a vector as follows:
and define the overall propensity sum which will be used to calculate the time until the next reaction occurs:
Throughout the simulations of the SRCM, we must update the state matrix
to reflect the number of pseudo-particles representing the continuous mass. This is essential because the propensity functions, specifically those associated with second-order mixed (discrete and continuous reactants) kinetic reactions and conversion reactions, depend on these values. In practice, however, we employ a more efficient strategy: rather than explicitly updating
at every PDE step, we compute the corresponding pseudo-particle numbers from the PDE solution whenever they are required by the stochastic dynamics. The pseudocode for the SRCM is presented in Algorithm 2.
| Algorithm 2 Spatial regime conversion method (SRCM) |
- 1:
Set ▹Initialise time - 2:
Set T ▹ Set end time - 3:
Initialise discrete state matrix - 4:
Initialise PDE solution for all - 5:
Update extended state matrix - 6:
▹ PDE timestep counter - 7:
while do - 8:
for to K do - 9:
Compute propensities - 10:
Compute total propensity for compartment k: - 11:
end for - 12:
Compute total system propensity: - 13:
Draw random numbers - 14:
Compute time to next reaction: - 15:
if then ▹ Stochastic step - 16:
Determine compartment k such that: - 17:
Determine reaction q within compartment k such that: - 18:
if has non-zero continuous component then▹ A change in the continuous analogue - 19:
for to M do - 20:
- 21:
end for - 22:
end if - 23:
Update the extended state matrix . - 24:
Advance time: - 25:
else ▹ PDE step - 26:
for to M do - 27:
Perform an update step of the PDE for: - 28:
end for - 29:
Update the extended state matrix following the PDE update. - 30:
Set - 31:
Set - 32:
end if - 33:
end while
|