Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
vyudu committed Dec 4, 2024
1 parent a9fdfd6 commit a9f2106
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/systems/diffeqs/abstractodesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -534,15 +534,15 @@ function SciMLBase.BVProblem{iip, specialize}(sys::AbstractODESystem, u0map = []

# Define the boundary conditions.
bc = if iip
(residual, u, p, t) -> (residual .= u[1] - _u0)
(residual, u, p, t) -> (residual .= u[1] .- _u0)
else
(u, p, t) -> (u[1] - _u0)
end

return BVProblem{iip}(f, bc, u0, tspan, p; kwargs1..., kwargs...)
end

get_callback(prob::BVProblem) = prob.kwargs[:callback]
get_callback(prob::BVProblem) = error("BVP solvers do not support callbacks.")

"""
```julia
Expand Down
8 changes: 4 additions & 4 deletions test/bvproblem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ sol2 = solve(bvp, MIRK4(), dt = 0.01);
op = ODEProblem(lotkavolterra, u0map, tspan, parammap)
osol = solve(op, Vern9())

@test isapprox(sol.u[end],osol.u[end]; atol = 0.001)
@test isapprox(sol2.u[end],osol.u[end]; atol = 0.001)
@test isapprox(sol.u[end],osol.u[end]; atol = 0.01)
@test isapprox(sol2.u[end],osol.u[end]; atol = 0.01)
@test sol.u[1] == [1., 2.]
@test sol2.u[1] == [1., 2.]

Expand All @@ -50,7 +50,7 @@ sol2 = solve(bvp2, MIRK4(), dt = 0.01);
op = ODEProblem(pend, u0map, tspan, parammap)
osol = solve(op, Vern9())

@test sol.u[end] osol.u[end]
@test isapprox(sol.u[end], osol.u[end]; atol = 0.01)
@test sol.u[1] ==/2, π/2]
@test sol2.u[end] osol.u[end]
@test isapprox(sol2.u[end], osol.u[end]; atol = 0.01)
@test sol2.u[1] ==/2, π/2]
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ end
@safetestset "NonlinearSystem Test" include("nonlinearsystem.jl")
@safetestset "PDE Construction Test" include("pde.jl")
@safetestset "JumpSystem Test" include("jumpsystem.jl")
@safetestset "BVProblem Test" include("bvproblem.jl")
@safetestset "print_tree" include("print_tree.jl")
@safetestset "Constraints Test" include("constraints.jl")
end
Expand Down

0 comments on commit a9f2106

Please sign in to comment.