Skip to content

Commit 09ed5bc

Browse files
finish composition docs
1 parent 5b57398 commit 09ed5bc

File tree

7 files changed

+33
-20
lines changed

7 files changed

+33
-20
lines changed

docs/src/basics/Composition.md

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,9 @@ equations(connected)
4545
# Differential(t)(decay1₊x(t)) ~ decay1₊f(t) - (decay1₊a*(decay1₊x(t)))
4646
# Differential(t)(decay2₊x(t)) ~ decay2₊f(t) - (decay2₊a*(decay2₊x(t)))
4747

48-
equations(alias_elimination(connected))
48+
simplified_sys = structural_simplify(connected)
4949

50-
# 4-element Vector{Equation}:
51-
# Differential(t)(decay1₊f(t)) ~ 0
52-
# 0 ~ decay1₊x(t) - (decay2₊f(t))
53-
# Differential(t)(decay1₊x(t)) ~ decay1₊f(t) - (decay1₊a*(decay1₊x(t)))
54-
# Differential(t)(decay2₊x(t)) ~ decay2₊f(t) - (decay2₊a*(decay2₊x(t)))
50+
equations(simplified_sys)
5551
```
5652

5753
Now we can solve the system:
@@ -94,7 +90,7 @@ example, let's say there is a variable `x` in `states` and a variable
9490
`x` in `subsys`. We can declare that these two variables are the same
9591
by specifying their equality: `x ~ subsys.x` in the `eqs` for `sys`.
9692
This algebraic relationship can then be simplified by transformations
97-
like `alias_elimination` or `tearing` which will be described later.
93+
like `structural_simplify` which will be described later.
9894

9995
### Numerics with Composed Models
10096

@@ -123,13 +119,13 @@ done even if the variable `x` is eliminated from the system from
123119
transformations like `alias_elimination` or `tearing`: the variable
124120
will be lazily reconstructed on demand.
125121

126-
## Alias Elimination
122+
## Structural Simplify
127123

128124
In many cases, the nicest way to build a model may leave a lot of
129125
unnecessary variables. Thus one may want to remove these equations
130-
before numerically solving. The `alias_elimination` function removes
131-
these relationships and trivial singularity equations, i.e. equations
132-
which result in `0~0` expressions in over-specified systems.
126+
before numerically solving. The `structural_simplify` function removes
127+
these trivial equality relationships and trivial singularity equations,
128+
i.e. equations which result in `0~0` expressions, in over-specified systems.
133129

134130
## Inheritance and Combine (TODO)
135131

@@ -179,7 +175,7 @@ values. The user of this model can then solve this model simply by
179175
specifying the values at the highest level:
180176

181177
```julia
182-
sireqn_simple = alias_elimination(sir)
178+
sireqn_simple = structural_simplify(sir)
183179

184180
## User Code
185181

@@ -212,6 +208,22 @@ systems. For example, we could equivalently have done:
212208
@named sir = combine([seqn,ieqn,reqn])
213209
```
214210

215-
## The Tearing Transformation
216-
217-
## Automatic Model Promotion
211+
## Tearing Problem Construction
212+
213+
Some system types, specifically `ODESystem` and `NonlinearSystem`, can be further
214+
reduced if `structural_simplify` has already been applied to them. This is done
215+
by using the alternative problem constructors, `ODAEProblem` and `BlockNonlinearProblem`
216+
respectively. In these cases, the constructor uses the knowledge of the
217+
strongly connected components calculated during the process of simplification
218+
as the basis for building pre-simplified nonlinear systems in the implicit
219+
solving. In summary: these problems are structurally modified, but could be
220+
more efficient and more stable.
221+
222+
## Automatic Model Promotion (TODO)
223+
224+
In many cases one might want to compose models of different types. For example,
225+
one may want to include a `NonlinearSystem` as a set of algebraic equations
226+
within an `ODESystem`, or one may want to use an `ODESystem` as a subsystem of
227+
an `SDESystem`. In these cases, the compostion works automatically by promoting
228+
the model via `promote_system`. System promotions exist in the cases where a
229+
mathematically-trivial definition of the promotion exists.

docs/src/systems/ControlSystem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ ControlSystem
1717

1818
```@docs
1919
ModelingToolkit.runge_kutta_discretize
20-
alias_elimination
20+
structural_simplify
2121
```

docs/src/systems/JumpSystem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ JumpSystem
1616
## Transformations
1717

1818
```@docs
19-
alias_elimination
19+
structural_simplify
2020
```
2121

2222
## Problem Constructors

docs/src/systems/NonlinearSystem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ NonlinearSystem
1515
## Transformations
1616

1717
```@docs
18-
alias_elimination
18+
structural_simplify
1919
```
2020

2121
## Applicable Calculation and Generation Functions

docs/src/systems/ODESystem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ODESystem
1616
## Transformations
1717

1818
```@docs
19-
alias_elimination
19+
structural_simplify
2020
ode_order_lowering
2121
liouville_transform
2222
```

docs/src/systems/ReactionSystem.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,5 @@ ismassaction
5959

6060
```@docs
6161
Base.convert
62+
structural_simplify
6263
```

docs/src/systems/SDESystem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ SDESystem
1616
## Transformations
1717

1818
```@docs
19-
alias_elimination
19+
structural_simplify
2020
```
2121

2222
## Applicable Calculation and Generation Functions

0 commit comments

Comments
 (0)