From 14453054cba12f87d09e200d3c01b9c6372c64f6 Mon Sep 17 00:00:00 2001 From: oscarddssmith Date: Fri, 12 Dec 2025 10:46:31 -0500 Subject: [PATCH 1/2] fix OrdinaryDiffEqBDF test failures --- lib/OrdinaryDiffEqBDF/test/dae_ad_tests.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/OrdinaryDiffEqBDF/test/dae_ad_tests.jl b/lib/OrdinaryDiffEqBDF/test/dae_ad_tests.jl index cdb037f45e..ddf39d655b 100644 --- a/lib/OrdinaryDiffEqBDF/test/dae_ad_tests.jl +++ b/lib/OrdinaryDiffEqBDF/test/dae_ad_tests.jl @@ -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 From 5525dec1b070b6f725e180df4bcce9a9417ff956 Mon Sep 17 00:00:00 2001 From: oscarddssmith Date: Fri, 12 Dec 2025 11:37:32 -0500 Subject: [PATCH 2/2] fix controller typos --- lib/OrdinaryDiffEqBDF/src/controllers.jl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/OrdinaryDiffEqBDF/src/controllers.jl b/lib/OrdinaryDiffEqBDF/src/controllers.jl index cba5dcb56b..8ca920f813 100644 --- a/lib/OrdinaryDiffEqBDF/src/controllers.jl +++ b/lib/OrdinaryDiffEqBDF/src/controllers.jl @@ -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ₖ @@ -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 @@ -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ₖ @@ -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