Skip to content

Commit

Permalink
fix: provide initial conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Jun 13, 2024
1 parent fd7b8f8 commit 238e998
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
14 changes: 9 additions & 5 deletions docs/src/examples/spring_damper_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,19 @@ eqs = [connect(world.frame_b, bar1.frame_a)
ssys = structural_simplify(IRSystem(model))
prob = ODEProblem(ssys, [damper1.d => 2], (0, 10))
prob = ODEProblem(ssys, [
damper1.d => 2;
collect(body1.v_0) .=> 0;
collect(body1.w_a) .=> 0;
], (0, 10))
sol = solve(prob, Rodas4())
@assert SciMLBase.successful_retcode(sol)
plot(
plot(sol, idxs = [spring1.s, spring2.s]),
plot(sol, idxs = [body1.r_0[2], body2.r_0[2]]),
plot(sol, idxs = [spring1.f, spring2.f]),
Plots.plot(
Plots.plot(sol, idxs = [spring1.s, spring2.s]),
Plots.plot(sol, idxs = [body1.r_0[2], body2.r_0[2]]),
Plots.plot(sol, idxs = [spring1.f, spring2.f]),
)
```

Expand Down
1 change: 1 addition & 0 deletions docs/src/examples/three_springs.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ eqs = [connect(world.frame_b, bar1.frame_a)
ssys = structural_simplify(IRSystem(model))
prob = ODEProblem(ssys, [
D.(spring3.lineforce.r_rel_0) .=> 0;
collect(body1.v_0) .=> 0;
], (0, 10))
sol = solve(prob, Rodas4(), u0=prob.u0 .+ 1e-1*randn(length(prob.u0)))
Expand Down

0 comments on commit 238e998

Please sign in to comment.