Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions lib/OrdinaryDiffEqBDF/src/controllers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function step_accept_controller!(integrator, alg::QNDF{max_order}, q) where {max
Fₖ₋₁ = inv(zₖ₋₁)
if zₖ₋₁ <= 0.1
hₖ₋₁ = 10 * h
elseif 1 / 10 < zₖ₋₁ <= 1.3
elseif zₖ₋₁ <= 1.3
hₖ₋₁ = Fₖ₋₁ * h
end
if hₖ₋₁ > hₖ
Expand Down Expand Up @@ -89,14 +89,6 @@ function step_accept_controller!(integrator, alg::QNDF{max_order}, q) where {max
return integrator.dt / q
end

function step_reject_controller!(integrator, ::QNDF)
bdf_step_reject_controller!(integrator, integrator.cache.EEst1)
end

function step_reject_controller!(integrator, ::FBDF)
bdf_step_reject_controller!(integrator, integrator.cache.terkm1)
end

function bdf_step_reject_controller!(integrator, EEst1)
k = integrator.cache.order
h = integrator.dt
Expand All @@ -122,7 +114,7 @@ function bdf_step_reject_controller!(integrator, EEst1)
Fₖ₋₁ = inv(zₖ₋₁)
if zₖ₋₁ <= 10
hₖ₋₁ = Fₖ₋₁ * h
elseif zₖ₋₁ > 10
else # zₖ₋₁ > 10
hₖ₋₁ = 0.1 * h
end
if integrator.cache.consfailcnt > 2 || hₖ₋₁ > hₖ
Expand All @@ -138,6 +130,14 @@ function bdf_step_reject_controller!(integrator, EEst1)
integrator.cache.order = kₙ
end

function step_reject_controller!(integrator, ::QNDF)
bdf_step_reject_controller!(integrator, integrator.cache.EEst1)
end

function step_reject_controller!(integrator, ::FBDF)
bdf_step_reject_controller!(integrator, integrator.cache.terkm1)
end

function post_newton_controller!(integrator, alg::FBDF)
(; cache) = integrator
if cache.order > 1 && cache.nlsolver.nfails >= 3
Expand Down
6 changes: 3 additions & 3 deletions lib/OrdinaryDiffEqBDF/test/dae_ad_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ f_mm = ODEFunction{true}(f_ode, mass_matrix = M)
prob_mm = ODEProblem(f_mm, u₀, tspan, p)
f_mm_oop = ODEFunction{false}(f_ode, mass_matrix = M)
prob_mm_oop = ODEProblem(f_mm_oop, u₀, tspan, p)
@test_broken sol1 = @inferred solve(
sol1 = @inferred solve(
prob, DFBDF(autodiff = afd_cs3), dt = 1e-5, abstol = 1e-8, reltol = 1e-8)
@test_broken sol2 = @inferred solve(
sol2 = @inferred solve(
prob_oop, DFBDF(autodiff = afd_cs3), dt = 1e-5, abstol = 1e-8, reltol = 1e-8)
@test_broken sol3 = @inferred solve(
sol3 = @inferred solve(
prob_mm, FBDF(autodiff = afd_cs3), dt = 1e-5, abstol = 1e-8, reltol = 1e-8)

# These tests flex differentiation of the solver and through the initialization
Expand Down
Loading