diff --git a/docs/Project.toml b/docs/Project.toml index 1b71dc522..b2f21b57e 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -60,7 +60,7 @@ FiniteDiff = "2" ForwardDiff = "0.10, 1" IncompleteLU = "0.2" JLD2 = "0.4, 0.5.1" -ModelingToolkit = "9" +ModelingToolkit = "10" NonlinearSolve = "3.15, 4" ODEProblemLibrary = "0.1" Optimization = "3, 4" diff --git a/docs/src/basics/faq.md b/docs/src/basics/faq.md index e008b0a25..a8735a05a 100644 --- a/docs/src/basics/faq.md +++ b/docs/src/basics/faq.md @@ -194,8 +194,7 @@ DAE solvers will not be able to accurately solve the equation without rewriting ModelingToolkit is able to automatically detect this kind of condition and perform the equation transformation automatically. As such, if you are having difficulties with a DAE system, it is highly recommended to try `modelingtookitize` to transform the system to MTK's formulation and -running `structural_simplify` to see how it would change the equations, simply convert the model -to MTK. +running `mtkcompile` to see how it would change the equations, simply convert the model to MTK. ## [Performance](@id faq_performance) diff --git a/docs/src/examples/outer_solar_system.md b/docs/src/examples/outer_solar_system.md index 64e85fb5a..207c9261f 100644 --- a/docs/src/examples/outer_solar_system.md +++ b/docs/src/examples/outer_solar_system.md @@ -16,6 +16,7 @@ The data is taken from the book “Geometric Numerical Integration” by E. Hair ```@example outersolarsystem using Plots, OrdinaryDiffEq, ModelingToolkit +using ModelingToolkit: t_nounits as t, D_nounits as D gr() G = 2.95912208286e-4 @@ -47,9 +48,8 @@ Here, we want to solve for the motion of the five outer planets relative to the ```@example outersolarsystem const ∑ = sum const N = 6 -@variables t u(t)[1:3, 1:N] +@variables u(t)[1:3, 1:N] u = collect(u) -D = Differential(t) potential = -G * ∑( i -> ∑(j -> (M[i] * M[j]) / √(∑(k -> (u[k, i] - u[k, j])^2, 1:3)), 1:(i - 1)), @@ -71,8 +71,7 @@ Thus, $\dot{q}$ is defined by the masses. We only need to define $\dot{p}$, and ```@example outersolarsystem eqs = vec(@. D(D(u))) .~ .-ModelingToolkit.gradient(potential, vec(u)) ./ repeat(M, inner = 3) -@named sys = ODESystem(eqs, t) -ss = structural_simplify(sys) +@mtkcompile sys = System(eqs, t) prob = ODEProblem(ss, [vec(u .=> pos); vec(D.(u) .=> vel)], tspan) sol = solve(prob, Tsit5()); ```