Skip to content

Commit 95252f2

Browse files
authored
Merge pull request #89 from SciML/myb/init
More robust inits
2 parents 588966b + a9d2215 commit 95252f2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

test/Mechanical/rotational.jl

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ D = Differential(t)
2020

2121
@named model = ODESystem(connections, t, systems=[fixed, inertia1, inertia2, spring, damper])
2222
sys = structural_simplify(model)
23-
prob = DAEProblem(sys, D.(states(sys)) .=> 0.0, [], (0, 10.0))
23+
prob = DAEProblem(sys, D.(states(sys)) .=> 0, D.(states(model)) .=> 0.0, (0, 10.0))
2424
sol = solve(prob, DFBDF())
2525

2626
# Plots.plot(sol; vars=[inertia1.w, inertia2.w])
@@ -53,8 +53,7 @@ end
5353

5454
@named model = ODESystem(connections, t, systems=[fixed, torque, inertia1, inertia2, spring, damper, sine])
5555
sys = structural_simplify(model)
56-
#prob = ODAEProblem(sys, Pair[], (0, 1.0))
57-
prob = DAEProblem(sys, D.(states(sys)) .=> 0.0, [D(D(inertia2.phi)) => 1.0], (0, 10.0))
56+
prob = DAEProblem(sys, D.(states(sys)) .=> 0.0, [D(D(inertia2.phi)) => 1.0; D.(states(model)) .=> 0.0], (0, 10.0))
5857
sol = solve(prob, DFBDF())
5958

6059
# Plots.plot(sol; vars=[inertia1.w, -inertia2.w*2])

0 commit comments

Comments
 (0)