Skip to content

Commit 8205b68

Browse files
committed
test(bvp): compare the solution at stricter tolerances
for the BVP case the solution is more precise at default tolerances
1 parent 0f23eaf commit 8205b68

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

lib/ModelingToolkitBase/test/bvproblem.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,21 @@ end
6767
tspan = (0.0, 6.0)
6868

6969
op = ODEProblem(pend, [u0map; parammap], tspan)
70-
osol = solve(op, Vern9())
70+
osol = solve(op, Vern9(), abstol=1e-10, reltol=1e-10)
7171

72-
bvp = SciMLBase.BVProblem{true, SciMLBase.AutoSpecialize}(
73-
pend, [u0map; parammap], tspan
74-
)
72+
bvp = BVProblem(pend, [u0map; parammap], tspan)
7573
for solver in solvers
76-
sol = solve(bvp, solver(), dt = 0.01)
77-
@test isapprox(sol.u[end], osol.u[end]; atol = 0.01)
74+
sol = solve(bvp, solver(), dt = 1e-2)
75+
@test isapprox(sol.u[end], osol.u[end])
7876
@test sol.u[1] ==/ 2, π / 2]
7977
end
8078

8179
# Test out-of-place
82-
bvp2 = SciMLBase.BVProblem{false, SciMLBase.FullSpecialize}(
83-
pend, [u0map; parammap], tspan
84-
)
80+
bvp2 = BVProblem{false, SciMLBase.FullSpecialize}(pend, [u0map; parammap], tspan)
8581

8682
for solver in solvers
8783
sol = solve(bvp2, solver(), dt = 0.01)
88-
@test isapprox(sol.u[end], osol.u[end]; atol = 0.01)
84+
@test isapprox(sol.u[end], osol.u[end])
8985
@test sol.u[1] ==/ 2, π / 2]
9086
end
9187
end

0 commit comments

Comments
 (0)