You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the solvers can handle DAEs, as long as they are given as ODEProblems with a mass-matrix. But in principle DAEProblems should also work, so we should have this.
if prob isa DiffEqBase.AbstractDAEProblem && alg isa OrdinaryDiffEqAlgorithm
error("You cannot use an ODE Algorithm with a DAEProblem")
endif prob isa DiffEqBase.AbstractODEProblem && alg isa DAEAlgorithm
error("You cannot use an DAE Algorithm with a ODEProblem")
end
I'm not sure what the best way out here would be. A hacky solution would be to transform each ODE problem into a DAE problem like this:
functionode2dae(prob::ODEProblem)
@assertisinplace(prob)
functiondae!(resid, du, u, p, t)
prob.f(resid, u, p, t)
resid .-= du
end
du0 =similar(prob.u0)
prob.f(du0, prob.u0, prob.p, prob.tspan[1])
returnDAEProblem(dae!, prob.du0, prob.u0, prob.tspan, prob.p)
end
and then just make all the methods DAE solvers, but that would also be confusing to users.
The cleanest solution might be to change the OrdinaryDiffEq.jl check from alg isa OrdinaryDiffEqAlgorithm to can_solve(prob, alg) or something similar.
The text was updated successfully, but these errors were encountered:
Currently the solvers can handle DAEs, as long as they are given as
ODEProblems
with a mass-matrix. But in principleDAEProblems
should also work, so we should have this.The main problem is that, as we rely on
OrdinaryDiffEq.solve
, algorithms can't actually solve both ODEs and DAEs:https://github.com/SciML/OrdinaryDiffEq.jl/blob/f52a126fa713f1d2d9d5744af63775c2156701ff/src/solve.jl#L74-L80
I'm not sure what the best way out here would be. A hacky solution would be to transform each ODE problem into a DAE problem like this:
and then just make all the methods DAE solvers, but that would also be confusing to users.
The cleanest solution might be to change the OrdinaryDiffEq.jl check from
alg isa OrdinaryDiffEqAlgorithm
tocan_solve(prob, alg)
or something similar.The text was updated successfully, but these errors were encountered: