Hi,

I’m trying to solve a relatively large system of ODE with some constraints (hence DAE) using the manifold projection method provided by Julia. My model contains some aerodynamics with large angles that means I could not get the symbolic formula for the whole ODE beforehand, hence no symbolic Jacobian can be provided. The f function takes the general form of

A * \dot(X) = b

, where X is a vector (42,1) where b consists of several functions that are called and added at each step, and hence

\dot(X) = A^{-1} * b.

And my problem is that it seems some methods such as RadauIIA5() or Rodas5() would fail with the error

LoadError: MethodError: no method matching Float64(::ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 11})

, upon checking it looks like the ODE integrator is trying to perform a numerical Jacobian calculation, and the error comes from the function call at

convert(#unused#::Type{Float64}, x::ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 11})

in the file ./number.jl:7 . And upon further checking, it looks like the problem is from my aerodynamics code that looks like this

A_inv[1, 1] = cos(psi)*cos(theta)

, where theta and psi are just some elements from the input vector, and this step is just to calculate the inverse of A. It seems that the ODE solver is trying to do a forward differentiation at this step and it needs to somehow convert a (11,1) vector into a Float64? (don’t know where the 11 comes from).

Apart from RadauIIA5() or Rodas5() methods, however, all the explicit Runge-Kuttta methods such as Vern6-Vern9, Adams-Bashforth Explicit Methods such as ABM54(), Adams explicit method like JVODE_Adams() and Sundial’s CVODE_BDF and CVODE_Adams() all works fine, with the exception that ARKODE() doesn’t work with the same above mentioned error, and CVODE_BDF() and CVODE_Adams() are extremely slow (takes 8 hours for simulate just 1 second while JVODE_Adams() doesn’t take more than 10 minutes).

Many thanks for your time and help in looking into this problem!

Decheng