Search code examples
python-3.xjuliaode

Why do implict ODE solver from diffeqpy (Julia)always jump back to t=0?


I am using the diffeqpy package to use implicit solver from Julia in python in order to solve a DAE problem. While I was checking different values during the calculation, I noticed that the solver starts integrating from t=0 and eventually goes to the next time point t1>0, but jumps back to t=0 after a few iterations. After a while it jumps to the next time point t2>t1 and keeps going like this until t successfully reaches the specified end t=tend.

The solver I use is given below:

dae_prob = de.DAEProblem(daefun,dy_dt_0,y0,tspan,differential_vars=differential_vars) sol = de.solve(dae_prob,de.DImplicitEuler(autodiff=False))

Can anybody tell me why the solver always jumps back to t=0 (is it because of the implicit way of solving the DAE problem) and how does it effect the solution calculated by the solver if some parameters/variables depend on t ?


Solution

  • This is expected. ODE/DAE solvers will often jump around in time (especially if you have callbacks that they need to find the time of when the callback happened). Specifically, I believe what you are obsreving is that the nonlinear solve that occurs in implicit methods generally has to evaluate the function a bunch of times at both the beginning and end of the step it is trying to take.

    Lastly, you probably don't want to be using DImplicitEuler. For implicit DAEs, DFBDF or IDA (from Sundials.jl) will likely be faster. Furthermore, switching to the mass matrix formulation would let you use solvers like Rosenbrock23 or FBDF thta will likely be faster still.