Skip to content

Commit 9a362a9

Browse files
format
1 parent b1ec63a commit 9a362a9

7 files changed

+45
-27
lines changed

src/dae_default_alg.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function default_algorithm(prob::DiffEqBase.AbstractDAEProblem{uType, duType, tType,
2-
isinplace};
3-
kwargs...) where {uType, duType, tType, isinplace}
2+
isinplace};
3+
kwargs...) where {uType, duType, tType, isinplace}
44
o = Dict{Symbol, Any}(kwargs)
55
extra_kwargs = Any[]
66
alg = IDA() # Standard default

src/dde_default_alg.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function default_algorithm(prob::DiffEqBase.AbstractDDEProblem{uType, tType, lType,
2-
isinplace};
3-
kwargs...) where {uType, tType, lType, isinplace}
2+
isinplace};
3+
kwargs...) where {uType, tType, lType, isinplace}
44
o = Dict{Symbol, Any}(kwargs)
55
extra_kwargs = Any[]
66
alg = MethodOfSteps(AutoTsit5(Rosenbrock23(autodiff = false))) # Standard default

src/default_solve.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function DiffEqBase.__solve(prob::DiffEqBase.DEProblem,
2-
alg::Union{Nothing, DiffEqBase.DEAlgorithm},
3-
args...; default_set = false, kwargs...)
2+
alg::Union{Nothing, DiffEqBase.DEAlgorithm},
3+
args...; default_set = false, kwargs...)
44
if default_set == true
55
error("The chosen algorithm, $alg, does not exist. Please verify that the appropriate solver package has been installed.")
66
end
@@ -15,8 +15,8 @@ function DiffEqBase.__solve(prob::DiffEqBase.DEProblem,
1515
end
1616

1717
function DiffEqBase.__init(prob::DiffEqBase.DEProblem,
18-
alg::Union{Nothing, DiffEqBase.DEAlgorithm},
19-
args...; default_set = false, kwargs...)
18+
alg::Union{Nothing, DiffEqBase.DEAlgorithm},
19+
args...; default_set = false, kwargs...)
2020
if default_set == true
2121
error("The chosen algorithm, $alg, does not exist. Please verify that the appropriate solver package has been installed.")
2222
end

src/ode_default_alg.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function default_algorithm(prob::DiffEqBase.AbstractODEProblem{uType, tType, inplace};
2-
kwargs...) where {uType, tType, inplace}
2+
kwargs...) where {uType, tType, inplace}
33
o = Dict{Symbol, Any}(kwargs)
44
extra_kwargs = Any[]
55
alg = AutoTsit5(Rosenbrock23(autodiff = false)) # Standard default
@@ -75,8 +75,8 @@ function default_algorithm(prob::DiffEqBase.AbstractODEProblem{uType, tType, inp
7575
elseif tol_level == :low_tol
7676
if length(prob.u0) > 500
7777
alg = AutoVern7(Rodas4(autodiff = false,
78-
linsolve = LinearSolve.KrylovJL_GMRES()),
79-
lazy = !callbacks)
78+
linsolve = LinearSolve.KrylovJL_GMRES()),
79+
lazy = !callbacks)
8080
elseif length(prob.u0) > 50
8181
alg = AutoVern7(TRBDF2(autodiff = false), lazy = !callbacks)
8282
else

src/sde_default_alg.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function default_algorithm(prob::DiffEqBase.AbstractSDEProblem{uType, tType, isinplace, ND};
2-
kwargs...) where {uType, tType, isinplace, ND}
2+
kwargs...) where {uType, tType, isinplace, ND}
33
o = Dict{Symbol, Any}(kwargs)
44
extra_kwargs = Any[]
55
alg = SOSRI() # Standard default

test/default_ode_alg_test.jl

+9-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using DifferentialEquations, Test
33
f_2dlinear = (du, u, p, t) -> (@. du = p * u)
44
f_2dlinear_analytic = (u0, p, t) -> @. u0 * exp(p * t)
55
prob_ode_2Dlinear = ODEProblem(ODEFunction(f_2dlinear, analytic = f_2dlinear_analytic),
6-
rand(4, 2), (0.0, 1.0), 1.01)
6+
rand(4, 2), (0.0, 1.0), 1.01)
77

88
alg, kwargs = default_algorithm(prob_ode_2Dlinear; dt = 1 // 2^(4))
99
integ = init(prob_ode_2Dlinear; dt = 1 // 2^(4))
@@ -36,12 +36,14 @@ sol = solve(prob_ode_2Dlinear; alg_hints = [:stiff], reltol = 1e-1)
3636
@test typeof(sol.alg) <: Rosenbrock23
3737

3838
const linear_bigα = parse(BigFloat, "1.01")
39-
f = (du, u, p, t) -> begin for i in 1:length(u)
40-
du[i] = linear_bigα * u[i]
41-
end end
39+
f = (du, u, p, t) -> begin
40+
for i in 1:length(u)
41+
du[i] = linear_bigα * u[i]
42+
end
43+
end
4244
(::typeof(f))(::Type{Val{:analytic}}, u0, p, t) = u0 * exp(linear_bigα * t)
4345
prob_ode_bigfloat2Dlinear = ODEProblem(f, map(BigFloat, rand(4, 2)) .* ones(4, 2) / 2,
44-
(0.0, 1.0))
46+
(0.0, 1.0))
4547

4648
sol = solve(prob_ode_bigfloat2Dlinear; dt = 1 // 2^(4))
4749
@test typeof(sol.alg.algs[1]) <: Vern9
@@ -60,12 +62,12 @@ sol = solve(prob_ode_bigfloat2Dlinear, nothing; alg_hints = [:stiff])
6062
struct FooAlg end
6163

6264
@test_throws DiffEqBase.NonSolverError solve(prob_ode_bigfloat2Dlinear, FooAlg();
63-
default_set = true)
65+
default_set = true)
6466

6567
struct FooAlg2 <: DiffEqBase.DEAlgorithm end
6668

6769
@test_throws DiffEqBase.ProblemSolverPairingError solve(prob_ode_bigfloat2Dlinear,
68-
FooAlg2(); default_set = true)
70+
FooAlg2(); default_set = true)
6971

7072
prob = ODEProblem(f, rand(4, 2) .* ones(4, 2) / 2, (0.0, 1.0))
7173

test/runtests.jl

+24-8
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,28 @@
22

33
using DifferentialEquations, Test, SafeTestsets
44
@time begin
5-
@time @safetestset "Default Discrete Algorithm" begin include("default_discrete_alg_test.jl") end
6-
@time @safetestset "Default ODE Algorithm" begin include("default_ode_alg_test.jl") end
7-
@time @safetestset "Default Steady State Algorithm" begin include("default_steady_state_alg_test.jl") end
8-
@time @safetestset "Default SDE Algorithm" begin include("default_sde_alg_test.jl") end
9-
@time @safetestset "Default RODE Algorithm" begin include("default_rode_alg_test.jl") end
10-
@time @safetestset "Default DDE Algorithm" begin include("default_dde_alg_test.jl") end
11-
@time @safetestset "Default DAE Algorithm" begin include("default_dae_alg_test.jl") end
12-
@time @safetestset "Default BVP Algorithm" begin include("default_bvp_alg_test.jl") end
5+
@time @safetestset "Default Discrete Algorithm" begin
6+
include("default_discrete_alg_test.jl")
7+
end
8+
@time @safetestset "Default ODE Algorithm" begin
9+
include("default_ode_alg_test.jl")
10+
end
11+
@time @safetestset "Default Steady State Algorithm" begin
12+
include("default_steady_state_alg_test.jl")
13+
end
14+
@time @safetestset "Default SDE Algorithm" begin
15+
include("default_sde_alg_test.jl")
16+
end
17+
@time @safetestset "Default RODE Algorithm" begin
18+
include("default_rode_alg_test.jl")
19+
end
20+
@time @safetestset "Default DDE Algorithm" begin
21+
include("default_dde_alg_test.jl")
22+
end
23+
@time @safetestset "Default DAE Algorithm" begin
24+
include("default_dae_alg_test.jl")
25+
end
26+
@time @safetestset "Default BVP Algorithm" begin
27+
include("default_bvp_alg_test.jl")
28+
end
1329
end

0 commit comments

Comments
 (0)