Skip to content

Commit

Permalink
Merge ffb230e into 71e9563
Browse files Browse the repository at this point in the history
  • Loading branch information
TorkelE committed Jun 1, 2024
2 parents 71e9563 + ffb230e commit b8d51d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/pages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pages = Any[
"model_creation/dsl_advanced.md",
#"model_creation/programmatic_CRN_construction.md",
#"model_creation/compositional_modeling.md",
#"model_creation/constraint_equations.md",
"model_creation/constraint_equations.md",
# Events.
#"model_creation/parametric_stoichiometry.md",# Distributed parameters, rates, and initial conditions.
# Loading and writing models to files.
Expand Down
10 changes: 7 additions & 3 deletions docs/src/model_creation/constraint_equations.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ creating these two systems.
Here, to create differentials with respect to time (for our differential equations), we must import the time differential operator from Catalyst. We do this through `D = default_time_deriv()`. Here, `D(V)` denotes the differential of the variable `V` with respect to time.

```@example ceq1
using Catalyst, DifferentialEquations, Plots
using Catalyst, OrdinaryDiffEq, Plots
t = default_t()
D = default_time_deriv()
Expand Down Expand Up @@ -58,6 +58,7 @@ We can now merge the two systems into one complete `ReactionSystem` model using
[`ModelingToolkit.extend`](@ref):
```@example ceq1
@named growing_cell = extend(osys, rn)
growing_cell = complete(growing_cell)
```

We see that the combined model now has both the reactions and ODEs as its
Expand All @@ -72,7 +73,7 @@ plot(sol)
As an alternative to the previous approach, we could have constructed our
`ReactionSystem` all at once by directly using the symbolic interface:
```@example ceq2
using Catalyst, DifferentialEquations, Plots
using Catalyst, OrdinaryDiffEq, Plots
t = default_t()
D = default_time_deriv()
Expand All @@ -83,6 +84,7 @@ rx1 = @reaction $V, 0 --> P
rx2 = @reaction 1.0, P --> 0
@named growing_cell = ReactionSystem([rx1, rx2, eq], t)
setdefaults!(growing_cell, [:P => 0.0])
growing_cell = complete(growing_cell)
oprob = ODEProblem(growing_cell, [], (0.0, 1.0))
sol = solve(oprob, Tsit5())
Expand All @@ -105,7 +107,7 @@ advanced_simulations) tutorial.

Let's first create our equations and unknowns/species again
```@example ceq3
using Catalyst, DifferentialEquations, Plots
using Catalyst, OrdinaryDiffEq, Plots
t = default_t()
D = default_time_deriv()
Expand All @@ -124,6 +126,7 @@ continuous_events = [V ~ 2.0] => [V ~ V/2, P ~ P/2]
We can now create and simulate our model
```@example ceq3
@named rs = ReactionSystem([rx1, rx2, eq], t; continuous_events)
rs = complete(rs)
oprob = ODEProblem(rs, [], (0.0, 10.0))
sol = solve(oprob, Tsit5())
Expand All @@ -148,6 +151,7 @@ p = [k_on => 100.0, switch_time => 2.0, k_off => 10.0]
Simulating our model,
```@example ceq3
@named osys = ReactionSystem(rxs, t, [A, B], [k_on, k_off, switch_time]; discrete_events)
osys = complete(osys)
oprob = ODEProblem(osys, u0, tspan, p)
sol = solve(oprob, Tsit5(); tstops = 2.0)
Expand Down

0 comments on commit b8d51d1

Please sign in to comment.