Skip to content

Commit 61861e1

Browse files
authored
Merge pull request #1182 from SciML/myb/doc
Update docs on @nAmed
2 parents 5f4b015 + 6123524 commit 61861e1

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

docs/src/tutorials/acausal_components.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ rc_eqs = [
9595
connect(capacitor.n, source.n, ground.g)
9696
]
9797

98-
@named rc_model = compose(ODESystem(rc_eqs, t),
98+
@named _rc_model = ODESystem(rc_eqs, t)
99+
@named rc_model = compose(_rc_model,
99100
[resistor, capacitor, source, ground])
100101
sys = structural_simplify(rc_model)
101102
u0 = [
@@ -288,7 +289,8 @@ rc_eqs = [
288289
Finally we build our four component model with these connection rules:
289290

290291
```julia
291-
@named rc_model = compose(ODESystem(rc_eqs, t)
292+
@named _rc_model = ODESystem(rc_eqs, t)
293+
@named rc_model = compose(_rc_model,
292294
[resistor, capacitor, source, ground])
293295
```
294296

docs/src/tutorials/higher_order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ eqs = [D(D(x)) ~ σ*(y-x),
2121
D(y) ~ x*-z)-y,
2222
D(z) ~ x*y - β*z]
2323

24-
sys = ODESystem(eqs)
24+
@named sys = ODESystem(eqs)
2525
```
2626

2727
Note that we could've used an alternative syntax for 2nd order, i.e.

docs/src/tutorials/nonlinear.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using ModelingToolkit, NonlinearSolve
1616
eqs = [0 ~ σ*(y-x),
1717
0 ~ x*-z)-y,
1818
0 ~ x*y - β*z]
19-
ns = NonlinearSystem(eqs, [x,y,z], [σ,ρ,β])
19+
@named ns = NonlinearSystem(eqs, [x,y,z], [σ,ρ,β])
2020

2121
guess = [x => 1.0,
2222
y => 0.0,

docs/src/tutorials/nonlinear_optimal_control.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ eqs = [
5959
D(v) ~ p[1]*u^3 + v
6060
]
6161

62-
sys = ControlSystem(loss,eqs,t,[x,v],[u],p)
62+
@named sys = ControlSystem(loss,eqs,t,[x,v],[u],p)
6363
```
6464

6565
## Solving a Control Problem via Discretize-Then-Optimize

docs/src/tutorials/optimization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using ModelingToolkit, GalacticOptim, Optim
66
@variables x y
77
@parameters a b
88
loss = (a - x)^2 + b * (y - x^2)^2
9-
sys = OptimizationSystem(loss,[x,y],[a,b])
9+
@named sys = OptimizationSystem(loss,[x,y],[a,b])
1010

1111
u0 = [
1212
x=>1.0

docs/src/tutorials/stochastic_diffeq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ noiseeqs = [0.1*x,
2323
0.1*y,
2424
0.1*z]
2525

26-
de = SDESystem(eqs,noiseeqs,t,[x,y,z],[σ,ρ,β])
26+
@named de = SDESystem(eqs,noiseeqs,t,[x,y,z],[σ,ρ,β])
2727

2828
u0map = [
2929
x => 1.0,

docs/src/tutorials/tearing_parallelism.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function Capacitor(;name, C = 1.0)
114114
), p, n)
115115
end
116116

117-
function rc_model(i; name, source, ground, R, C)
117+
function parallel_rc_model(i; name, source, ground, R, C)
118118
resistor = HeatingResistor(name=Symbol(:resistor, i), R=R)
119119
capacitor = Capacitor(name=Symbol(:capacitor, i), C=C)
120120
heat_capacitor = HeatCapacitor(name=Symbol(:heat_capacitor, i))
@@ -126,8 +126,8 @@ function rc_model(i; name, source, ground, R, C)
126126
connect_heat(resistor.h, heat_capacitor.h)
127127
]
128128

129-
rc_model = compose(ODESystem(rc_eqs, t, name=Symbol(name, i)),
130-
[resistor, capacitor, source, ground, heat_capacitor])
129+
compose(ODESystem(rc_eqs, t, name=Symbol(name, i)),
130+
[resistor, capacitor, source, ground, heat_capacitor])
131131
end
132132
```
133133

@@ -145,13 +145,14 @@ N = 50
145145
Rs = 10 .^range(0, stop=-4, length=N)
146146
Cs = 10 .^range(-3, stop=0, length=N)
147147
rc_systems = map(1:N) do i
148-
rc_model(i; name=:rc, source=source, ground=ground, R=Rs[i], C=Cs[i])
148+
parallel_rc_model(i; name=:rc, source=source, ground=ground, R=Rs[i], C=Cs[i])
149149
end;
150150
@variables E(t)=0.0
151151
eqs = [
152152
D(E) ~ sum(((i, sys),)->getproperty(sys, Symbol(:resistor, i)).h.Q_flow, enumerate(rc_systems))
153153
]
154-
big_rc = compose(ODESystem(eqs, t, [E], []), rc_systems)
154+
@named _big_rc = ODESystem(eqs, t, [E], [])
155+
@named big_rc = compose(_big_rc, rc_systems)
155156
```
156157

157158
Now let's say we want to expose a bit more parallelism via running tearing.

0 commit comments

Comments
 (0)