Skip to content

Commit 40fba9f

Browse files
authored
Merge pull request #310 from SciML/qqy/twp_bigfloat
2 parents 0f0f278 + 8994824 commit 40fba9f

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Random = "1.10"
5858
ReTestItems = "1.29"
5959
Reexport = "1.2"
6060
SciMLBase = "2.82"
61+
Sparspak = "0.3.11"
6162
StaticArrays = "1.9.8"
6263
Test = "1.10"
6364
julia = "1.10"
@@ -76,8 +77,9 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
7677
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
7778
ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
7879
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
80+
Sparspak = "e56a9233-b9d6-4f03-8d0f-1825330902ac"
7981
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
8082
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
8183

8284
[targets]
83-
test = ["Aqua", "DiffEqDevTools", "Hwloc", "InteractiveUtils", "JET", "LinearSolve", "NonlinearSolveFirstOrder", "ODEInterface", "OrdinaryDiffEq", "Pkg", "Random", "ReTestItems", "RecursiveArrayTools", "StaticArrays", "Test"]
85+
test = ["Aqua", "DiffEqDevTools", "Hwloc", "InteractiveUtils", "JET", "LinearSolve", "NonlinearSolveFirstOrder", "ODEInterface", "OrdinaryDiffEq", "Pkg", "Random", "ReTestItems", "RecursiveArrayTools", "Sparspak", "StaticArrays", "Test"]

test/misc/bigfloat_test.jl

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
@testitem "BigFloat compatibility" begin
22
using BoundaryValueDiffEq
3+
# Need Sparspak for BigFloat
4+
using Sparspak
5+
36
tspan = (0.0, pi / 2)
47
function simplependulum!(du, u, p, t)
58
θ = u[1]
@@ -12,15 +15,36 @@
1215
residual[2] = u(pi / 2)[1] - big(pi / 2)
1316
end
1417
u0 = BigFloat.([pi / 2, pi / 2])
15-
prob = BVProblem(simplependulum!, bc!, u0, tspan)
16-
sol1 = solve(prob, MIRK4(), dt = 0.05)
17-
@test SciMLBase.successful_retcode(sol1.retcode)
18+
multi_point_bvp = BVProblem(simplependulum!, bc!, u0, tspan)
19+
20+
@testset "BigFloat compatiability with Multi-point BVP" begin
21+
for solver in [MIRK4(), RadauIIa5(), LobattoIIIa4(nested_nlsolve = true)]
22+
sol = solve(multi_point_bvp, solver, dt = 0.05)
23+
@test SciMLBase.successful_retcode(sol.retcode)
24+
end
25+
end
1826

19-
sol2 = solve(prob, RadauIIa5(), dt = 0.05)
20-
@test SciMLBase.successful_retcode(sol2.retcode)
27+
function f!(du, u, p, t)
28+
du[1] = u[2]
29+
du[2] = u[1]
30+
end
31+
function bca!(resid_a, u_a, p)
32+
resid_a[1] = u_a[1] - 1
33+
end
34+
function bcb!(resid_b, u_b, p)
35+
resid_b[1] = u_b[1]
36+
end
37+
bvp_function = BVPFunction(
38+
f!, (bca!, bcb!), bcresid_prototype = (zeros(1), zeros(1)), twopoint = Val(true))
39+
tspan = (0.0, 1.0)
40+
two_point_bvp = BVProblem(bvp_function, BigFloat.([1.0, 0.0]), tspan)
2141

22-
sol3 = solve(prob, LobattoIIIa4(nested_nlsolve = true), dt = 0.05)
23-
@test SciMLBase.successful_retcode(sol3.retcode)
42+
@testset "BigFloat compatiability with Two-point BVP" begin
43+
for solver in [MIRK4(), RadauIIa5(), LobattoIIIa4(nested_nlsolve = true)]
44+
sol = solve(two_point_bvp, solver, dt = 0.05)
45+
@test SciMLBase.successful_retcode(sol.retcode)
46+
end
47+
end
2448

2549
function second_f!(ddu, du, u, p, t)
2650
ϵ = 0.1

0 commit comments

Comments
 (0)