Skip to content

Fix a minor issue in generate_initializesystem #2627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/systems/nonlinear/initializesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function generate_initializesystem(sys::ODESystem;
end
else
dd_guess = Dict()
filtered_u0 = u0map
filtered_u0 = todict(u0map)
end

defs = merge(defaults(sys), filtered_u0)
Expand Down
12 changes: 12 additions & 0 deletions test/odesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1030,3 +1030,15 @@ sol2 = @test_nowarn solve(prob2, Tsit5())
@test_nowarn @mtkbuild sys = ODESystem([D(x) ~ p * x, D(y) ~ x' * p * x], t)
@test_nowarn ODEProblem(sys, [x => ones(3), y => 2], (0.0, 10.0), [p => ones(3, 3)])
end

@parameters g L
@variables q₁(t) q₂(t) λ(t) θ(t)

eqs = [D(D(q₁)) ~ -λ * q₁,
D(D(q₂)) ~ -λ * q₂ - g,
q₁ ~ L * sin(θ),
q₂ ~ L * cos(θ)]

@named pend = ODESystem(eqs, t)
@test_nowarn generate_initializesystem(
pend, u0map = [q₁ => 1.0, q₂ => 0.0], guesses = [λ => 1])