Skip to content

Commit 4cb14b0

Browse files
fix formatting of new tutorials
1 parent c8027cf commit 4cb14b0

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

docs/src/mtkitize_tutorials/modelingtoolkitize_index_reduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ But that's not a satisfying answer, so what do you do about it?
110110
### Transforming Higher Order DAEs to Index-1 DAEs
111111

112112
It turns out that higher order DAEs can be transformed into lower order DAEs.
113-
If you differentiate the last equation two times and perform a substitution,
114-
you can arrive at the following set of equations:
113+
[If you differentiate the last equation two times and perform a substitution,
114+
you can arrive at the following set of equations](https://courses.seas.harvard.edu/courses/am205/g_act/dae_notes.pdf):
115115

116116
```math
117117
\begin{aligned}

docs/src/tutorials/tearing_parallelism.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -207,35 +207,35 @@ equations(sys)
207207
0 ~ rc50₊resistor50₊R*rc50₊capacitor50₊p₊i(t)*(1 + (rc50₊resistor50₊alpha*(((rc50₊capacitor50₊p₊i(t))*(rc50₊source₊V - (rc50₊capacitor50₊v(t)))) - rc50₊resistor50₊TAmbient))) - (rc50₊source₊V - (rc50₊capacitor50₊v(t)))
208208
Differential(t)(rc50₊capacitor50₊v(t)) ~ rc50₊capacitor50₊p₊i(t)*(rc50₊capacitor50₊C^-1)
209209
Differential(t)(rc50₊heat_capacitor50₊h₊T(t)) ~ rc50₊capacitor50₊p₊i(t)*(rc50₊heat_capacitor50₊V^-1)*(rc50₊heat_capacitor50₊cp^-1)*(rc50₊heat_capacitor50₊rho^-1)*(rc50₊source₊V - (rc50₊capacitor50₊v(t)))
210-
```
211-
212-
That's not all though. In addition, the tearing process has turned the sets of
213-
nonlinear equations into separate blocks and constructed a DAG for the dependencies
214-
between the blocks. We can use the bipartite graph functionality to dig in and
215-
investigate what this means:
216-
217-
```julia
218-
using ModelingToolkit.BipartiteGraphs
219-
big_rc = initialize_system_structure(big_rc)
220-
inc_org = BipartiteGraphs.incidence_matrix(structure(big_rc).graph)
221-
blt_org = StructuralTransformations.sorted_incidence_matrix(big_rc, only_algeqs=true, only_algvars=true)
222-
blt_reduced = StructuralTransformations.sorted_incidence_matrix(sys, only_algeqs=true, only_algvars=true)
223-
```
224-
225-
![](https://user-images.githubusercontent.com/1814174/110589027-d4ec9b00-8143-11eb-8880-651da986504d.PNG)
226-
227-
The figure on the left is the original incidence matrix of the algebraic equations.
228-
Notice that the original formulation of the model has dependencies between different
229-
equations, and so the full set of equations must be solved together. That exposes
230-
no parallelism. However, the Block Lower Triangular (BLT) transformation exposes
231-
independent blocks. This is then further impoved by the tearing process, which
232-
removes 90% of the equations and transforms the nonlinear equations into 50
233-
independent blocks *which can now all be solved in parallel*. The conclusion
234-
is that, your attempts to parallelize are neigh: performing parallelism after
235-
structural simplification greatly improves the problem that can be parallelized,
236-
so this is better than trying to do it by hand.
237-
238-
After performing this, you can construct the `ODEProblem`/`ODAEProblem` and set
239-
`parallel_form` to use the exposed parallelism in multithreaded function
240-
constructions, but this showcases why `structural_simplify` is so important
241-
to that process.
210+
```
211+
212+
That's not all though. In addition, the tearing process has turned the sets of
213+
nonlinear equations into separate blocks and constructed a DAG for the dependencies
214+
between the blocks. We can use the bipartite graph functionality to dig in and
215+
investigate what this means:
216+
217+
```julia
218+
using ModelingToolkit.BipartiteGraphs
219+
big_rc = initialize_system_structure(big_rc)
220+
inc_org = BipartiteGraphs.incidence_matrix(structure(big_rc).graph)
221+
blt_org = StructuralTransformations.sorted_incidence_matrix(big_rc, only_algeqs=true, only_algvars=true)
222+
blt_reduced = StructuralTransformations.sorted_incidence_matrix(sys, only_algeqs=true, only_algvars=true)
223+
```
224+
225+
![](https://user-images.githubusercontent.com/1814174/110589027-d4ec9b00-8143-11eb-8880-651da986504d.PNG)
226+
227+
The figure on the left is the original incidence matrix of the algebraic equations.
228+
Notice that the original formulation of the model has dependencies between different
229+
equations, and so the full set of equations must be solved together. That exposes
230+
no parallelism. However, the Block Lower Triangular (BLT) transformation exposes
231+
independent blocks. This is then further impoved by the tearing process, which
232+
removes 90% of the equations and transforms the nonlinear equations into 50
233+
independent blocks *which can now all be solved in parallel*. The conclusion
234+
is that, your attempts to parallelize are neigh: performing parallelism after
235+
structural simplification greatly improves the problem that can be parallelized,
236+
so this is better than trying to do it by hand.
237+
238+
After performing this, you can construct the `ODEProblem`/`ODAEProblem` and set
239+
`parallel_form` to use the exposed parallelism in multithreaded function
240+
constructions, but this showcases why `structural_simplify` is so important
241+
to that process.

0 commit comments

Comments
 (0)