Skip to content

Commit f1157a5

Browse files
authored
Merge pull request #785 from SciML/states_to_unknowns
Change states to unknowns
2 parents c4762dc + 3770bf3 commit f1157a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+232
-255
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ HomotopyContinuation = "2.9"
4444
LaTeXStrings = "1.3.0"
4545
Latexify = "0.14, 0.15, 0.16"
4646
MacroTools = "0.5.5"
47-
ModelingToolkit = "8.73"
47+
ModelingToolkit = "9.5"
4848
Parameters = "0.12"
4949
Reexport = "0.2, 1.0"
5050
Requires = "1.0"

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Distributions = "0.25"
3939
Documenter = "0.27"
4040
HomotopyContinuation = "2.6"
4141
Latexify = "0.15, 0.16"
42-
ModelingToolkit = "8.47"
42+
ModelingToolkit = "9.5"
4343
NonlinearSolve = "3.4.0"
4444
Optim = "1"
4545
Optimization = "3.19"

docs/src/api/catalyst_api.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ retrieve info from just a base [`ReactionSystem`](@ref) `rn`, ignoring
9595
sub-systems of `rn`, one can use the ModelingToolkit accessors (these provide
9696
direct access to the corresponding internal fields of the `ReactionSystem`)
9797

98-
* `ModelingToolkit.get_states(rn)` is a vector that collects all the species
98+
* `ModelingToolkit.get_unknowns(rn)` is a vector that collects all the species
9999
defined within `rn`, ordered by species and then non-species variables.
100100
* `Catalyst.get_species(rn)` is a vector of all the species variables in the system. The
101101
entries in `get_species(rn)` correspond to the first `length(get_species(rn))`
102-
components in `get_states(rn)`.
102+
components in `get_unknowns(rn)`.
103103
* `ModelingToolkit.get_ps(rn)` is a vector that collects all the parameters
104104
defined *within* reactions in `rn`.
105105
* `ModelingToolkit.get_eqs(rn)` is a vector that collects all the
@@ -120,10 +120,10 @@ To retrieve information from the full reaction network represented by a system
120120
`rn`, which corresponds to information within both `rn` and all sub-systems, one
121121
can call:
122122

123-
* `ModelingToolkit.states(rn)` returns all species *and variables* across the
123+
* `ModelingToolkit.unknowns(rn)` returns all species *and variables* across the
124124
system, *all sub-systems*, and all constraint systems. Species are ordered
125-
before non-species variables in `states(rn)`, with the first `numspecies(rn)`
126-
entires in `states(rn)` being the same as `species(rn)`.
125+
before non-species variables in `unknowns(rn)`, with the first `numspecies(rn)`
126+
entires in `unknowns(rn)` being the same as `species(rn)`.
127127
* [`species(rn)`](@ref) is a vector collecting all the chemical species within
128128
the system and any sub-systems that are also `ReactionSystems`.
129129
* `ModelingToolkit.parameters(rn)` returns all parameters across the
@@ -196,7 +196,6 @@ ModelingToolkit.extend
196196
ModelingToolkit.compose
197197
Catalyst.flatten
198198
merge!(network1::ReactionSystem, network2::ReactionSystem)
199-
reorder_states!
200199
```
201200

202201
## Network analysis and representations

docs/src/catalyst_applications/advanced_simulations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ want the callback to trigger. The `affect!` function determines what happens to
173173
the simulation when the callback is triggered. It takes a single object, an
174174
`integrator` and makes some modification to it (please read more about
175175
integrators [here](https://docs.sciml.ai/DiffEqDocs/stable/basics/integrator/)).
176-
Here, we access the system's state `X` through the `integrator`, and add
176+
Here, we access the system's unknown `X` through the `integrator`, and add
177177
`5.0` to its amount. We can now simulate our system using the
178178
callback:
179179
```@example ex2

docs/src/catalyst_applications/bifurcation_diagrams.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Here, in the bistable region, we only see a single branch. The reason is that th
8686

8787

8888
## Systems with conservation laws
89-
Some systems are under-determined at steady-state, so that for a given parameter set they have an infinite number of possible steady state solutions, preventing bifurcation diagrams from being computed. Similar to when we [compute steady states for fixed parameter values](@ref homotopy_continuation_conservation_laws), we can utilise Catalyst's ability to detect and eliminate conservation laws to resolve this issue. This requires us to provide information of the species concentrations at which we wish to compute the bifurcation diagram (to determine the values of conserved quantities). These are provided to the `BifurcationProblem` using the `u0` argument.
89+
Some systems are under-determined at steady state, so that for a given parameter set they have an infinite number of possible steady state solutions, preventing bifurcation diagrams from being computed. Similar to when we [compute steady states for fixed parameter values](@ref homotopy_continuation_conservation_laws), we can utilise Catalyst's ability to detect and eliminate conservation laws to resolve this issue. This requires us to provide information of the species concentrations at which we wish to compute the bifurcation diagram (to determine the values of conserved quantities). These are provided to the `BifurcationProblem` using the `u0` argument.
9090

9191
To illustrate this, we will create a simple model of a kinase that is produced and degraded (at rates $p$ and $d$). The kinase facilitates the phosphorylation of a protein ($X$), which is dephosphorylated at a constant rate. For this system, we will compute a bifurcation diagram, showing how the concentration of the phosphorylated protein ($Xp$) depends on the degradation rate of the kinase ($d$). We will set the total amount of protein ($X+Xp$) to $1.0$.
9292
```@example ex2

docs/src/catalyst_applications/simulation_structure_interfacing.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# [Interfacing problems, integrators, and solutions](@id simulation_structure_interfacing)
22
When simulating a model, one begins with creating a [problem](https://docs.sciml.ai/DiffEqDocs/stable/basics/problem/). Next, a simulation is performed on a problem, during which the state of the simulation is recorded through an [integrator](https://docs.sciml.ai/DiffEqDocs/stable/basics/integrator/). Finally, the simulation output is returned as a [solution](https://docs.sciml.ai/DiffEqDocs/stable/basics/solution/). This tutorial describes how to access, or modify the state, or parameter, values of problems, integrators, and solutions structures.
33

4-
Generally, when we have a structure `simulation_struct` and want to interface with the state (or parameter) `G`, we use `simulation_struct[:G]` to access the value, and `simulation_struct[:G] = 5.0` to set it to a new value. However, see the following examples for full details.
4+
Generally, when we have a structure `simulation_struct` and want to interface with the unknown (or parameter) `G`, we use `simulation_struct[:G]` to access the value, and `simulation_struct[:G] = 5.0` to set it to a new value. However, see the following examples for full details.
55

66
## Interfacing problem objects
77

@@ -27,7 +27,7 @@ with the notation being identical for parameters:
2727
oprob[:k1]
2828
```
2929

30-
If we want to change a state's initial condition value, we use the following notation
30+
If we want to change an unknown's initial condition value, we use the following notation
3131
```@example ex1
3232
oprob[:X1] = 10.0
3333
```
@@ -68,7 +68,7 @@ During a simulation, the solution is stored in an integrator object, we will her
6868
```@example ex1
6969
integrator = init(oprob)
7070
```
71-
Using a similar syntax to problems, we can get the current values of a state within the integrator:
71+
Using a similar syntax to problems, we can get the current values of an unknown within the integrator:
7272
```@example ex1
7373
integrator[:X1]
7474
```
@@ -89,15 +89,15 @@ Finally, we consider solution objects. First, we simulate our problem:
8989
```@example ex1
9090
sol = solve(oprob)
9191
```
92-
For solutions, when we access a state, we get its whole simulation vector:
92+
For solutions, when we access an unknown, we get its whole simulation vector:
9393
```@example ex1
9494
sol[:X1]
9595
```
9696
while when we access a parameter we only get a single value:
9797
```@example ex1
9898
sol[:k1]
9999
```
100-
Finally, we note that we cannot change the values of solution states or parameters (i.e. both `sol[:X1] = 0.0` and `sol[:k1] = 0.0` generate errors).
100+
Finally, we note that we cannot change the values of solution unknowns or parameters (i.e. both `sol[:X1] = 0.0` and `sol[:k1] = 0.0` generate errors).
101101

102102
## [Interfacing using symbolic representation](@id simulation_structure_interfacing_symbolic_representation)
103103

@@ -127,7 +127,7 @@ oprob[k1]
127127
```
128128
To interface with integrators and solutions we use a similar syntax.
129129

130-
Finally, instead of using `@unpack` to access a symbolic variable or parameter, we can access it directly using `rn.X1`, and thus access a state of our `ODEProblem` using
130+
Finally, instead of using `@unpack` to access a symbolic variable or parameter, we can access it directly using `rn.X1`, and thus access an unknown of our `ODEProblem` using
131131
```@example ex2
132132
oprob[rn.X1]
133133
```

docs/src/catalyst_functionality/compositional_modeling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Catalyst.get_rxs(rn)
7272
```
7373
To see all the species, parameters and reactions in the tree we can use
7474
```@example ex1
75-
species(rn) # or states(rn)
75+
species(rn) # or unknowns(rn)
7676
```
7777
```@example ex1
7878
parameters(rn) # or reactionparameters(rn)

docs/src/catalyst_functionality/constraint_equations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ rn = @reaction_network begin
4747
end
4848
```
4949
Notice, here we interpolated the variable `V` with `$V` to ensure we use the
50-
same symbolic state variable in the `rn` as we used in building `osys`. See the
50+
same symbolic unknown variable in the `rn` as we used in building `osys`. See the
5151
doc section on [interpolation of variables](@ref
5252
dsl_description_interpolation_of_variables) for more information.
5353

@@ -99,7 +99,7 @@ lower-level approach for creating events via the DifferentialEquations.jl
9999
callback interface is illustrated in the [Advanced Simulation Options](@ref
100100
advanced_simulations) tutorial.
101101

102-
Let's first create our equations and states/species again
102+
Let's first create our equations and unknowns/species again
103103
```@example ceq3
104104
using Catalyst, DifferentialEquations, Plots
105105
@@ -124,7 +124,7 @@ oprob = ODEProblem(rs, [], (0.0, 10.0))
124124
sol = solve(oprob, Tsit5())
125125
plot(sol; plotdensity = 1000)
126126
```
127-
We can also model discrete events. Similar to our example with continuous events, we start by creating reaction equations, parameters, variables, and states.
127+
We can also model discrete events. Similar to our example with continuous events, we start by creating reaction equations, parameters, variables, and unknowns.
128128
```@example ceq3
129129
@parameters k_on switch_time k_off
130130
@variables t

docs/src/catalyst_functionality/dsl_description.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ end
546546
Please see the API [Rate Laws](@ref api_rate_laws) section for more details.
547547

548548
## Including non-species variables
549-
Non-species state variables can be specified in the DSL using the `@variables`
549+
Non-species unknown variables can be specified in the DSL using the `@variables`
550550
macro. These are declared similarly to species. For example,
551551
```@example tut2
552552
rn_with_volume = @reaction_network begin
@@ -562,10 +562,10 @@ and one non-species
562562
```@example tut2
563563
nonspecies(rn_with_volume)
564564
```
565-
giving two state variables, always internally ordered by species and then
565+
giving two unknown variables, always internally ordered by species and then
566566
nonspecies:
567567
```@example tut2
568-
states(rn_with_volume)
568+
unknowns(rn_with_volume)
569569
```
570570

571571
`rn_with_volume` could then be extended with constraint equations for how `V(t)`
@@ -584,9 +584,9 @@ rn_with_s = @reaction_network begin
584584
end
585585
show(stdout, MIME"text/plain"(), rn_with_s) # hide
586586
```
587-
where we see all states are now functions of `s`.
587+
where we see all unknowns are now functions of `s`.
588588

589-
Similarly, if one wants states to be functions of more than one independent
589+
Similarly, if one wants unknowns to be functions of more than one independent
590590
variable, for example to encode a spatial problem, one can list more than one
591591
variable, i.e. `@ivs t x y`. Here the first listed independent variable is
592592
always chosen to represent time. For example,

docs/src/catalyst_functionality/example_networks/smoluchowski_coagulation_equation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ end
5151
```
5252
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`.
5353
```julia
54-
# state variables are X, pars stores rate parameters for each rx
54+
# unknown variables are X, pars stores rate parameters for each rx
5555
@variables t
5656
@species k[1:nr] (X(t))[1:N]
5757
pars = Pair.(collect(k), kv)

0 commit comments

Comments
 (0)