You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/model_creation/examples/smoluchowski_coagulation_equation.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,13 +60,14 @@ elseif i==2
60
60
kv =fill(C / V, nr)
61
61
end
62
62
```
63
-
We'll store the reaction rates in `pars` as `Pair`s, and set the initial condition that only monomers are present at ``t=0`` in `u₀map`.
63
+
We'll set the parameters and the initial condition that only monomers are present at ``t=0`` in `u₀map`.
64
64
```julia
65
-
# unknown variables are X, pars stores rate parameters for each rx
65
+
# k is a vector of the parameters, with values given by the vector kv
66
+
@parameters k[1:nr] = kv
67
+
68
+
# create the vector of species X_1,...,X_N
66
69
t =default_t()
67
-
@parameters k[1:nr]
68
70
@species (X(t))[1:N]
69
-
pars =Pair.(collect(k), kv)
70
71
71
72
# time-span
72
73
if i ==1
@@ -78,7 +79,7 @@ end
78
79
# initial condition of monomers
79
80
u₀ =zeros(Int64, N)
80
81
u₀[1] = uₒ
81
-
u₀map =Pair.(collect(X), u₀) # map variable to its initial value
82
+
u₀map =Pair.(collect(X), u₀) # map species to its initial value
82
83
```
83
84
Here we generate the reactions programmatically. We systematically create Catalyst `Reaction`s for each possible reaction shown in the figure on [Wikipedia](https://en.wikipedia.org/wiki/Smoluchowski_coagulation_equation). When `vᵢ[n] == vⱼ[n]`, we set the stoichiometric coefficient of the reactant multimer to two.
84
85
```julia
@@ -100,7 +101,7 @@ We now convert the [`ReactionSystem`](@ref) into a `ModelingToolkit.JumpSystem`,
0 commit comments