Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!,
trivial_limiter!,
issplit, qsteady_min_default, qsteady_max_default,
get_current_alg_order, get_current_adaptive_order,
default_controller, stepsize_controller!,
legacy_default_controller, stepsize_controller!,
step_accept_controller!,
step_reject_controller!, post_newton_controller!,
u_modified!, DAEAlgorithm, _unwrap_val, DummyController,
Expand Down
2 changes: 1 addition & 1 deletion lib/OrdinaryDiffEqBDF/src/controllers.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function default_controller(alg::Union{QNDF, FBDF}, args...)
function legacy_default_controller(alg::Union{QNDF, FBDF}, args...)
DummyController()
end

Expand Down
23 changes: 17 additions & 6 deletions lib/OrdinaryDiffEqCore/src/alg_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -306,23 +306,34 @@ alg_maximum_order(alg::CompositeAlgorithm) = maximum(alg_order(x) for x in alg.a

alg_adaptive_order(alg::Union{OrdinaryDiffEqAlgorithm, DAEAlgorithm}) = alg_order(alg) - 1

# this is actually incorrect and is purposefully decreased as this tends
# to track the real error much better
# this is actually incorrect and is purposefully decreased as this tends
# to track the real error much better

function default_controller(alg, cache, qoldinit, _beta1 = nothing, _beta2 = nothing)
function default_controller_v7(QT, alg)
if ispredictive(alg)
return PredictiveController()
return PredictiveController(QT, alg)
elseif isstandard(alg)
return IController()
return IController(QT, alg)
else
return PIController(QT, alg)
end
end

function legacy_default_controller(alg, cache, qoldinit, _beta1 = nothing, _beta2 = nothing)
if ispredictive(alg)
return LegacyPredictiveController()
elseif isstandard(alg)
return LegacyIController()
else # Default is PI-controller
QT = typeof(qoldinit)
beta1, beta2 = _digest_beta1_beta2(alg, cache, Val(QT), _beta1, _beta2)
return PIController(beta1, beta2)
return LegacyPIController(beta1, beta2)
end
end

# TODO remove this when done
default_controller = legacy_default_controller

function _digest_beta1_beta2(alg, cache, ::Val{QT}, _beta1, _beta2) where {QT}
if alg isa OrdinaryDiffEqCompositeAlgorithm
beta2 = _beta2 === nothing ?
Expand Down
Loading
Loading