-
-
Notifications
You must be signed in to change notification settings - Fork 239
Open
Labels
DAEDifferential-Algebraic EquationsDifferential-Algebraic Equations
Description
MWE:
using OrdinaryDiffEq
tspan = (0.0,1.0)
u0 = zeros(1)
u0[1] = 1/2
function residual(res,du,u,p,t)
res[1] = - 1.01u[1] + du[1]
end
function jacobian(jac,du,u,p,gamma,t)
jac[1,1] = gamma - 1.01
nothing
end
f_iip = DAEFunction{true}(residual;jac=jacobian)
prob_iip = DAEProblem{true}(f_iip,u0,u0,tspan)
sol_iip = solve(prob_iip, DImplicitEuler(), reltol=1e-8, abstol=1e-8)
sol_iip = solve(prob_iip, DABDF2(), reltol=1e-8, abstol=1e-8)The issue is threefold.
- The Jacobian references
duprevwhich doesn't exist. This should befsalfirst fsalfirstisn't defined in the first step, so that will be undefined until the first Jacobian is calculated, which gives a causality issue...jacfor a DAE is actually the W-matrix, so that needs to move to thecalc_W!section.
Metadata
Metadata
Assignees
Labels
DAEDifferential-Algebraic EquationsDifferential-Algebraic Equations