Skip to content

Commit

Permalink
Merge 1f969c5 into cc2a777
Browse files Browse the repository at this point in the history
  • Loading branch information
TorkelE committed Jun 15, 2024
2 parents cc2a777 + 1f969c5 commit 97fb2e7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 319 deletions.
128 changes: 0 additions & 128 deletions docs/src/assets/long_ploting_times/model_creation/mm_kinetics.svg

This file was deleted.

128 changes: 0 additions & 128 deletions docs/src/assets/long_ploting_times/model_creation/sir_outbreaks.svg

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ jprob = JumpProblem(repressilator, dprob, Direct(), save_positions=(false,false)
# now, let's solve and plot the jump process:
sol = solve(jprob, SSAStepper(), saveat=10.)
plot(sol)
plot(sol, plotdensity = 1000, fmt = :png) # hide
```

We see that oscillations remain, but become much noisier. Note, in constructing
Expand Down
16 changes: 9 additions & 7 deletions docs/src/model_creation/examples/basic_CRN_library.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ using Plots
oplt = plot(osol; title = "Reaction rate equation (ODE)")
splt = plot(ssol; title = "Chemical Langevin equation (SDE)")
jplt = plot(jsol; title = "Stochastic chemical kinetics (Jump)")
plot(oplt, splt, jplt; lw = 2, size=(800,800), layout = (3,1))
plot!(bottom_margin = 3Plots.Measures.mm) # hide
nothing # hide
plot(oplt, splt, jplt; lw = 2, size=(800,800), layout = (3,1))
oplt = plot(osol; title = "Reaction rate equation (ODE)", plotdensity = 1000, fmt = :png) # hide
splt = plot(ssol; title = "Chemical Langevin equation (SDE)", plotdensity = 1000, fmt = :png) # hide
jplt = plot(jsol; title = "Stochastic chemical kinetics (Jump)", plotdensity = 1000, fmt = :png) # hide
plot(oplt, splt, jplt; lw = 2, size=(800,800), layout = (3,1), plotdensity = 1000, fmt = :png) # hide
```
![MM Kinetics](../../assets/long_ploting_times/model_creation/mm_kinetics.svg)
Note that, due to the large amounts of the species involved, the stochastic trajectories are very similar to the deterministic one.

## [SIR infection model](@id basic_CRN_library_sir)
The [SIR model](https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology#The_SIR_model) is the simplest model of the spread of an infectious disease. While the real system is very different from the chemical and cellular processes typically modelled with CRNs, it (and several other epidemiological systems) can be modelled using the same CRN formalism. The SIR model consists of three species: susceptible ($S$), infected ($I$), and removed ($R$) individuals, and two reaction events: infection and recovery.
Expand Down Expand Up @@ -160,9 +160,11 @@ jplt1 = plot(jsol1; title = "Outbreak")
jplt2 = plot(jsol2; title = "Outbreak")
jplt3 = plot(jsol3; title = "No outbreak")
plot(jplt1, jplt2, jplt3; lw = 3, size=(800,700), layout = (3,1))
nothing # hide
jplt1 = plot(jsol1; title = "Outbreak", plotdensity = 1000, fmt = :png) # hide
jplt2 = plot(jsol2; title = "Outbreak", plotdensity = 1000, fmt = :png) # hide
jplt3 = plot(jsol3; title = "No outbreak", plotdensity = 1000, fmt = :png) # hide
plot(jplt1, jplt2, jplt3; lw = 3, size=(800,700), layout = (3,1), plotdensity = 1000, fmt = :png) # hide
```
![SIR Outbreak](../../assets/long_ploting_times/model_creation/sir_outbreaks.svg)

## [Chemical cross-coupling](@id basic_CRN_library_cc)
In chemistry, [cross-coupling](https://en.wikipedia.org/wiki/Cross-coupling_reaction) is when a catalyst combines two substrates to form a product. In this example, the catalyst ($C$) first binds one substrate ($S₁$) to form an intermediary complex ($S₁C$). Next, the complex binds the second substrate ($S₂$) to form another complex ($CP$). Finally, the catalyst releases the now-formed product ($P$). This system is an extended version of the [Michaelis-Menten system presented earlier](@ref basic_CRN_library_mm).
Expand Down
3 changes: 1 addition & 2 deletions docs/src/model_simulation/ode_simulation_performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ oprob = ODEProblem(brusselator, u0, tspan, ps)
sol1 = solve(oprob, Tsit5())
plot(sol1)
nothing # hide
plot(sol1, plotdensity = 1000, fmt = :png) # hide
```
![Incomplete Brusselator Simulation](../assets/long_ploting_times/model_simulation/incomplete_brusselator_simulation.svg)

We get a warning, indicating that the simulation was terminated. Furthermore, the resulting plot ends at $t ≈ 12$, meaning that the simulation was not completed (as the simulation's endpoint is $t = 20$). Indeed, we can confirm this by checking the *return code* of the solution object:
```@example ode_simulation_performance_1
Expand Down

0 comments on commit 97fb2e7

Please sign in to comment.