Skip to content

Commit

Permalink
Merge pull request #1215 from SciML/precompile
Browse files Browse the repository at this point in the history
start trying to precompile ModelingToolkit better
  • Loading branch information
ChrisRackauckas authored Feb 1, 2022
2 parents 7969d00 + 33f1261 commit 31e131c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ModelingToolkit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ using .SystemStructures

include("systems/alias_elimination.jl")
include("structural_transformation/StructuralTransformations.jl")

@reexport using .StructuralTransformations

for S in subtypes(ModelingToolkit.AbstractSystem)
Expand Down Expand Up @@ -207,4 +208,6 @@ export modelingtoolkitize
export @variables, @parameters
export @named, @nonamespace, @namespace, extend, compose

include("precompile.jl")

end # module
28 changes: 28 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
let
while true
@parameters t σ ρ β
@variables x(t) y(t) z(t)
D = Differential(t)

eqs = [D(D(x)) ~ σ*(y-x) + x^0.000000000000135,
D(y) ~ x*-z)-y,
D(z) ~ x*y - β*z]

@named sys = ODESystem(eqs)
sys = structural_simplify(sys)

u0 = [D(x) => 2.0,
x => 1.0,
y => 0.0,
z => 0.0]

p ==> 28.0,
ρ => 10.0,
β => 8/3]

tspan = (0.0,100.0)
prob = ODEProblem(sys,u0,tspan,p,jac=true)

break
end
end

0 comments on commit 31e131c

Please sign in to comment.