Skip to content

Commit b700c76

Browse files
Handle the defaults changes
1 parent d557962 commit b700c76

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

test/common_interface/callbacks.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ tspan = (0.0, 100.0)
7979
differential_vars = BitVector([true, true, false])
8080
bvcond(u, t, integrator) = t - round(t)
8181
bvaffect!(integrator) = integrator.p[4] = 2.0
82-
cb = ContinuousCallback(bvcond, bvaffect!)
82+
cb = ContinuousCallback(bvcond, bvaffect!; initializealg = Sundials.BrownFullBasicInit())
8383
prob = DAEProblem(fbv, du₀, u₀, tspan, p, differential_vars = differential_vars)
84-
sol = solve(prob, IDA(), callback = cb, tstops = [50.0], abstol = 1e-12, reltol = 1e-12)
84+
sol = solve(prob, IDA(), callback = cb, tstops = [50.0], abstol = 1e-12, reltol = 1e-12, initializealg = Sundials.BrownFullBasicInit())
8585
@test sol.t[end] 100.0
8686

8787
# Test that SubArrays are not allowed as outputs to the integrator
8888
u_out = similar(u₀)
8989
cb = DiscreteCallback(Returns(true), integ -> integ(@view(u_out[2:2]), integ.t))
9090
prob = DAEProblem(fbv, du₀, u₀, tspan, p, differential_vars = differential_vars)
91-
@test_throws ArgumentError solve(prob, IDA(), callback = cb)
91+
@test_throws ArgumentError solve(prob, IDA(), initializealg = Sundials.BrownFullBasicInit(), callback = cb)

test/common_interface/errors.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ f_error2(du, u, p, t) = du .= u ./ t .- 1
1212
u0 = [1.0];
1313
du0 = [1.0];
1414
prob = DAEProblem(f_error2, u0, du0, (0.0, 1.0); differential_vars = [true])
15-
sol = solve(prob, IDA())
16-
sol = solve(prob, IDA(); verbose = false)
15+
sol = solve(prob, IDA(), initializealg = Sundials.BrownFullBasicInit())
16+
sol = solve(prob, IDA(); initializealg = Sundials.BrownFullBasicInit(), verbose = false)
1717

1818
@test sol.retcode == ReturnCode.InitialFailure
1919

test/common_interface/ida.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ sol = solve(dae_prob, IDA())
111111

112112
du0 = [0.0] # inconsistent
113113
dae_prob = DAEProblem(f!, du0, u0, tspan; differential_vars = [true])
114-
sol = solve(dae_prob, IDA())
114+
sol = solve(dae_prob, IDA(); initializealg = BrownFullBasicInit())
115115

116116
function f!(res, du, u, p, t)
117117
res[1] = u[1] - 1.01
@@ -132,7 +132,7 @@ function DiffEqBase.initialize_dae!(integrator::Sundials.IDAIntegrator,
132132
initializealg::DumbInit)
133133
integrator.u .= 1
134134
integrator.u_modified = true
135-
DiffEqBase.initialize_dae!(integrator, Sundials.IDADefaultInit())
135+
DiffEqBase.initialize_dae!(integrator, Sundials.BrownFullBasicInit())
136136
end
137137
f(du, u, p, t) = du - u # u(t) = exp(t)
138138
prob = DAEProblem(f, zeros(1), zeros(1), (0, 1), differential_vars = trues(1))
@@ -152,7 +152,7 @@ function f_initial_data(du, u, p, t)
152152
return [du[1] - (u[1] + 10.0)]
153153
end
154154
prob = DAEProblem(f_initial_data, [0.0], [1.0], (0.0, 1.0); differential_vars = [true])
155-
sol = solve(prob, IDA())
155+
sol = solve(prob, IDA(), initializealg = Sundials.BrownFullBasicInit())
156156
# If this is one, it incorrectly saved u, if it is 0., it incorrectly solved
157157
# the pre-init value rather than the post-init one.
158158
@test sol(0.0, Val{1})[1] 11.0
@@ -162,7 +162,7 @@ daefun = (du, u, p, t) -> [du[1] - u[2], u[2] - p]
162162
callback = PresetTimeCallback(0.5, integ->(integ.p = -integ.p;))
163163
prob = DAEProblem(daefun, [0.0, 0.0], [0.0, -1.0], (0.0, 1), 1;
164164
differential_vars = [true, false], callback)
165-
sol = solve(prob, IDA())
165+
sol = solve(prob, IDA(), initializealg = Sundials.BrownFullBasicInit())
166166
@test sol.retcode == ReturnCode.Success
167167
# test that the callback flipping p caused u[2] to get flipped.
168168
first_t = findfirst(isequal(0.5), sol.t)

0 commit comments

Comments
 (0)