Skip to content

Commit c1d4036

Browse files
committed
Ignore dt checking when initial guess is provided
1 parent 845a5e3 commit c1d4036

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

lib/BoundaryValueDiffEqCore/src/utils.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ end
207207
function __extract_problem_details(
208208
prob, u0::SciMLBase.ODESolution; dt = 0.0, check_positive_dt::Bool = false)
209209
# Problem passes in a initial guess function
210-
check_positive_dt && dt 0 && throw(ArgumentError("dt must be positive"))
211210
_u0 = first(u0.u)
212211
_t = u0.t
213212
return Val(true), eltype(_u0), length(_u0), (length(_t) - 1), _u0

test/misc/initial_guess_tests.jl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@testitem "Initial guess providing" begin
2+
using BoundaryValueDiffEq
3+
tspan = (0.0, pi / 2)
4+
function simplependulum!(du, u, p, t)
5+
θ = u[1]
6+
= u[2]
7+
du[1] =
8+
du[2] = -9.81 * sin(θ)
9+
end
10+
function bc!(residual, u, p, t)
11+
residual[1] = u(pi / 4)[1] + pi / 2
12+
residual[2] = u(pi / 2)[1] - pi / 2
13+
end
14+
u0 = [pi / 2, pi / 2]
15+
prob = BVProblem(simplependulum!, bc!, u0, tspan)
16+
sol1 = solve(prob, MIRK4(), dt = 0.05)
17+
18+
# Solution
19+
prob1 = BVProblem(simplependulum!, bc!, sol1, tspan)
20+
sol2 = solve(prob1, MIRK4())
21+
@test SciMLBase.successful_retcode(sol2)
22+
23+
sol3 = solve(prob1, RadauIIa5())
24+
@test SciMLBase.successful_retcode(sol3)
25+
26+
sol4 = solve(prob1, LobattoIIIa4(nested_nlsolve = true))
27+
@test SciMLBase.successful_retcode(sol4)
28+
29+
# VectorOfArray
30+
prob2 = BVProblem(simplependulum!, bc!, VectorOfArray(sol1.u), tspan)
31+
sol2 = solve(prob2, MIRK4())
32+
@test SciMLBase.successful_retcode(sol2)
33+
34+
sol3 = solve(prob2, RadauIIa5())
35+
@test SciMLBase.successful_retcode(sol3)
36+
37+
sol4 = solve(prob2, LobattoIIIa4(nested_nlsolve = true))
38+
@test SciMLBase.successful_retcode(sol4)
39+
end

0 commit comments

Comments
 (0)