Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spatial ssa support #663

Closed
wants to merge 138 commits into from
Closed

Spatial ssa support #663

wants to merge 138 commits into from

Conversation

TorkelE
Copy link
Member

@TorkelE TorkelE commented Aug 27, 2023

I have added support for spatial jumps. Creating and solving a problem is relatively easy:

using Catalyst, Graphs, JumpProcesses

# Make model.
SIR_system = @reaction_network begin
    α, S + I --> 2I
    β, I --> R
end
trS = @transport_reaction dS S
trI = @transport_reaction dI I
lattice = Graphs.grid([2, 2])
lrs = LatticeReactionSystem(SIR_system, [trS, trI], lattice)

# Parameter values and initial conditions.
u0 = [:S => [999, 1000, 1000, 1000], :I => [1, 0, 0, 0], :R => 0]
pV = [ => 0.1 / 1000,  => 0.01]
pE = [:dS => [0.1, 0.1, 0.1, 0.2], :dI => [0.01, 0.01, 0.01, 0.02]]

# Create the problem.
dprob = DiscreteProblem(lrs, u0, (0.0,100.0), (pV,pE))
jprob = JumpProblem(lrs, dprob, NSM())
sol = solve(jprob, SSAStepper())

Current limitations:

  • Cartesian grids are not supported, only Graphs.
  • Of the 5 forms of the hopping rates, we now convert to the most general one (D_{s,i,j}). Once this is merged, I will introduce a routine which detects which is the most compact form that can be provided, and uses that one.
  • Currently, the constant rate jumps in each compartment must have the same parameter values. Once this is supported in JumpProcesses I will add support for it here as well.

@TorkelE
Copy link
Member Author

TorkelE commented Sep 20, 2023

Rebased on #644

@TorkelE
Copy link
Member Author

TorkelE commented Dec 2, 2023

Superseded by #737

@TorkelE TorkelE closed this Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants