Skip to content

Commit 36bcb91

Browse files
committed
Skip default solver uses for spatial simulations.
1 parent b0545c2 commit 36bcb91

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/spatial_reaction_systems/lattice_reaction_systems.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ are possible.
2727
Example:
2828
```julia
2929
# Fetch packages.
30-
using Catalyst, OrdinaryDiffEqDefault
30+
using Catalyst, OrdinaryDiffEqTsit5
3131
import CairoMakie
3232
3333
# Creates the `LatticeReactionSystem` model.
@@ -43,7 +43,7 @@ u0 = [:X => rand(5,5)]
4343
tspan = (0.0, 1.0)
4444
ps = [:p => 1.0, :d => 0.5, :D => 0.1]
4545
oprob = ODEProblem(lrs, u0, tspan, ps)
46-
osol = solve(oprob)
46+
osol = solve(oprob, Tsit5())
4747
4848
# Saves an animation of the solution to the file "lattice_animation.mp4".
4949
lattice_animation(osol, :X, lrs, "lattice_animation.mp4")

src/spatial_reaction_systems/lattice_sim_struct_interfacing.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
lat_setp!(sim_struct, p, lrs::LatticeReactionSystem, p_val)
55
66
For a problem or integrators, update its `p` vector with the input `p_val`. For non-lattice models,
7-
this is can be done through direct interfacing (e.g. `prob[p] = 1.0`). However, for
7+
this is can be done through direct interfacing (e.g. `prob[p] = 1.0`). However, for
88
`LatticeReactionSystem`-based problems and integrators, this function must be used instead.
99
1010
Arguments:
@@ -82,7 +82,7 @@ end
8282
lat_getp(sim_struct, p, lrs::LatticeReactionSystem)
8383
8484
For a problem or integrators, retrieves its `p` values. For non-lattice models,
85-
this is can be done through direct interfacing (e.g. `prob[p]`). However, for
85+
this is can be done through direct interfacing (e.g. `prob[p]`). However, for
8686
`LatticeReactionSystem`-based problems and integrators, this function must be used instead. The
8787
output format depends on the lattice (a dense array for cartesian grid lattices, a sparse array for
8888
masked grid lattices, and a vector for graph lattices). This format is similar to what is used to
@@ -95,7 +95,7 @@ Arguments:
9595
- `lrs`: The `LatticeReactionSystem` which was used to generate the structure we wish to modify.
9696
9797
Notes:
98-
- Even if the parameter is spatially uniform, a full array with its values across all vertices will be retrieved.
98+
- Even if the parameter is spatially uniform, a full array with its values across all vertices will be retrieved.
9999
100100
Example:
101101
```julia
@@ -145,7 +145,7 @@ end
145145
lat_setu!(sim_struct, sp, lrs::LatticeReactionSystem, u)
146146
147147
For a problem or integrators, update its `u` vector with the input `u`. For non-lattice models,
148-
this is can be done through direct interfacing (e.g. `prob[X] = 1.0`). However, for
148+
this is can be done through direct interfacing (e.g. `prob[X] = 1.0`). However, for
149149
`LatticeReactionSystem`-based problems and integrators, this function must be used instead.
150150
151151
Arguments:
@@ -224,7 +224,7 @@ end
224224
lat_getu(sim_struct, sp, lrs::LatticeReactionSystem)
225225
226226
For a problem or integrators, retrieves its `u` values. For non-lattice models,
227-
this is can be done through direct interfacing (e.g. `prob[X]`). However, for
227+
this is can be done through direct interfacing (e.g. `prob[X]`). However, for
228228
`LatticeReactionSystem`-based problems and integrators, this function must be used instead. The
229229
output format depends on the lattice (a dense array for cartesian grid lattices, a sparse array for
230230
masked grid lattices, and a vector for graph lattices). This format is similar to which is used to
@@ -236,7 +236,7 @@ Arguments:
236236
- `lrs`: The `LatticeReactionSystem` which was used to generate the structure we wish to modify.
237237
238238
Notes:
239-
- Even if the species is spatially uniform, a full array with its values across all vertices will be retrieved.
239+
- Even if the species is spatially uniform, a full array with its values across all vertices will be retrieved.
240240
241241
Example:
242242
```julia
@@ -277,15 +277,15 @@ function lat_getu(jint::JumpProcesses.SSAIntegrator, sp_idx, sp_tot, lattice)
277277
return reshape_vals(jint.u[sp_idx, :], lattice)
278278
end
279279

280-
# A single function, `lat_getu`, which contains all interfacing functionality. However,
281-
# long-term it should be replaced with a sleeker interface. Ideally as MTK-wide support for
280+
# A single function, `lat_getu`, which contains all interfacing functionality. However,
281+
# long-term it should be replaced with a sleeker interface. Ideally as MTK-wide support for
282282
# lattice problems and solutions is introduced. Note that SciML considers jump simulation solutions
283283
# as `ODESolution`, hence that type is specified.
284284
"""
285285
lat_getu(sol, sp, lrs::LatticeReactionSystem; t = nothing)
286286
287287
A function for retrieving the solution of a `LatticeReactionSystem`-based simulation on various
288-
desired forms. Generally, for `LatticeReactionSystem`s, the values in `sol` is ordered in a
288+
desired forms. Generally, for `LatticeReactionSystem`s, the values in `sol` is ordered in a
289289
way which is not directly interpretable by the user. Furthermore, the normal Catalyst interface
290290
for solutions (e.g. `sol[:X]`) does not work for these solutions. Hence this function is used instead.
291291
@@ -307,13 +307,13 @@ Notes:
307307
308308
Example:
309309
```julia
310-
using Catalyst, OrdinaryDiffEq
310+
using Catalyst, OrdinaryDiffEqTsit5
311311
312312
# Prepare `LatticeReactionSystem`s.
313313
rs = @reaction_network begin
314314
(k1,k2), X1 <--> X2
315315
end
316-
tr = @transport_reaction D X1
316+
tr = @transport_reaction D X1
317317
lrs = LatticeReactionSystem(rs, [tr], CartesianGrid((2,2)))
318318
319319
# Create problems.
@@ -348,7 +348,7 @@ function lat_getu(sol::ODESolution, lattice, t::Nothing, sp_idx::Int64, sp_tot::
348348
end
349349
end
350350

351-
# Function which handles the input in the case where `t` is a range of values (i.e. return `sp`s
351+
# Function which handles the input in the case where `t` is a range of values (i.e. return `sp`s
352352
# value at all designated time points.
353353
function lat_getu(sol::ODESolution, lattice, t::AbstractVector{T}, sp_idx::Int64,
354354
sp_tot::Int64) where {T <: Number}
@@ -374,8 +374,8 @@ end
374374
"""
375375
rebuild_lat_internals!(sciml_struct)
376376
377-
Rebuilds the internal functions for simulating a LatticeReactionSystem. Whenever a problem or
378-
integrator has had its parameter values updated, this function should be called for the update to
377+
Rebuilds the internal functions for simulating a LatticeReactionSystem. Whenever a problem or
378+
integrator has had its parameter values updated, this function should be called for the update to
379379
be taken into account. For ODE simulations, `rebuild_lat_internals!` needs only to be called when
380380
- An edge parameter has been updated.
381381
- When a parameter with spatially homogeneous values has been given spatially heterogeneous values (or vice versa).
@@ -393,7 +393,7 @@ Example:
393393
rs = @reaction_network begin
394394
(k1,k2), X1 <--> X2
395395
end
396-
tr = @transport_reaction D X1
396+
tr = @transport_reaction D X1
397397
grid = CartesianGrid((2,2))
398398
lrs = LatticeReactionSystem(rs, [tr], grid)
399399

0 commit comments

Comments
 (0)