Skip to content

Commit 2f84042

Browse files
Merge pull request #3856 from SciML/fix-structural-simplify-deprecation
Fix deprecated ODESystem and @mtkbuild usage in documentation examples
2 parents 418c34a + 5d03220 commit 2f84042

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ eqs = [D(D(x)) ~ σ * (y - x),
4646
D(y) ~ x *- z) - y,
4747
D(z) ~ x * y - β * z]
4848

49-
@mtkbuild sys = ODESystem(eqs, t)
49+
@mtkcompile sys = System(eqs, t)
5050

5151
u0 = [D(x) => 2.0,
5252
x => 1.0,
@@ -83,13 +83,13 @@ eqs = [D(x) ~ σ * (y - x),
8383
D(y) ~ x *- z) - y,
8484
D(z) ~ x * y - β * z]
8585

86-
@named lorenz1 = ODESystem(eqs, t)
87-
@named lorenz2 = ODESystem(eqs, t)
86+
@named lorenz1 = System(eqs, t)
87+
@named lorenz2 = System(eqs, t)
8888

8989
@variables a(t)
9090
@parameters γ
9191
connections = [0 ~ lorenz1.x + lorenz2.y + a * γ]
92-
@mtkbuild connected = ODESystem(connections, t, systems = [lorenz1, lorenz2])
92+
@mtkcompile connected = System(connections, t, systems = [lorenz1, lorenz2])
9393

9494
u0 = [lorenz1.x => 1.0,
9595
lorenz1.y => 0.0,

demo.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ using ModelingToolkit: t_nounits as t, D_nounits as D
2020
eqs = [D(D(x)) ~ λ * x
2121
D(D(y)) ~ λ * y - g
2222
x^2 + y^2 ~ 1]
23-
@mtkbuild pend = System(eqs, t)
23+
@mtkcompile pend = System(eqs, t)
2424
prob = ODEProblem(pend, [x => -1, y => 0], (0.0, 10.0), [g => 1], guesses ==> 1])
2525

2626
sol = solve(prob, FBDF())
@@ -37,7 +37,7 @@ eqs = [
3737
D(z) ~ x * y - β * z + 0.1z * a
3838
]
3939

40-
@mtkbuild sys1 = System(eqs, t)
40+
@mtkcompile sys1 = System(eqs, t)
4141

4242
eqs = [
4343
D(x) ~ σ * (y - x),
@@ -49,7 +49,7 @@ noiseeqs = [0.1*x;
4949
0.1*y;
5050
0.1*z;;]
5151

52-
@mtkbuild sys2 = SDESystem(eqs, noiseeqs, t)
52+
@mtkcompile sys2 = SDESystem(eqs, noiseeqs, t)
5353

5454
u0 = [
5555
x => 1.0,
@@ -73,7 +73,7 @@ odeprob = ODEProblem(sys1, u0, (0.0, 10.0), p; check_compatibility = false)
7373
eqs = [0 ~ σ * (y - x),
7474
y ~ x *- z),
7575
β * z ~ x * y]
76-
@mtkbuild sys = System(eqs)
76+
@mtkcompile sys = System(eqs)
7777

7878
## ImplicitDiscrete Affects
7979

@@ -83,7 +83,7 @@ eqs = [D(D(x)) ~ λ * x
8383
D(D(y)) ~ λ * y - g
8484
x^2 + y^2 ~ 1]
8585
c_evt = [t ~ 5.0] => [x ~ Pre(x) + 0.1]
86-
@mtkbuild pend = System(eqs, t, continuous_events = c_evt)
86+
@mtkcompile pend = System(eqs, t, continuous_events = c_evt)
8787
prob = ODEProblem(pend, [x => -1, y => 0], (0.0, 10.0), [g => 1], guesses ==> 1])
8888

8989
sol = solve(prob, FBDF())
@@ -104,4 +104,4 @@ function SysC(; name)
104104
@named subsys = SysB(; var1 = x)
105105
return System([D(x) ~ x], t; systems = [subsys], name)
106106
end
107-
@mtkbuild sys = SysC()
107+
@mtkcompile sys = SysC()

0 commit comments

Comments
 (0)