Description
The following example fails with DABDF2:
f = function (out,du,u,p,t)
out[1] = - p[1]*u[1] + p[3]*u[2]*u[3] - du[1]
out[2] = + p[1]*u[1] - p[2]*u[2]^2 - p[3]*u[2]*u[3] - du[2]
out[3] = u[1] + u[2] + u[3] - p[4]
end
u₀ = [1.0, 0, 0]
du₀ = [0.0, 0.0, 0.0]
p = [0.04, 3.0e7, 1.0e4, 1.0]
tspan = (0.0,100.0)
differential_vars = [true,true,false]
prob = DAEProblem(f,du₀,u₀,tspan,p,differential_vars=differential_vars)
condition(u,t,integrator) = t in [50.0]
affect!(integrator) = integrator.p[4] += 1.0
cb = DiscreteCallback(condition,affect!)
sol = solve(prob, DABDF2(), callback=cb, tstops=[50.0])
That gives the following error:
MethodError: no method matching (::var"#35#36")(::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Float64)
Closest candidates are:
#35(::Any, ::Any, ::Any, ::Any, !Matched::Any) at In[59]:2
Note that this does not fail with DImplicitEuler. I have not tried yet the case with Continuous callbacks.