I'm trying to solve a system of DAE (2 ODE and 1 algebraic equation) using the solver IDA from Sundials (https://computation.llnl.gov/projects/sundials/ida), through the Python package scikits.odes (https://scikits-odes.readthedocs.io).
I'm using scikits.odes 2.4.0, Sundials 3.1.1 and Python 3.6 64bit.
Here is the code :
import numpy as np
from scikits.odes.dae import dae
SOLVER = 'ida'
extra_options = {'old_api': False, 'algebraic_vars_idx': [0, 1]}
##### Parameters #####
# vectors
v1 = np.array([3.e-05, 9.e-04])
v2 = np.array([-0.01])
v3 = np.array([100])
# matrices
m1 = np.array([[-1, 1, -1], [0, -1, 0]])
m2 = np.array([[1, 0, 0]])
m3 = np.array([[0, 0, 1]])
m4 = np.array([[0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0.],
[0., 0., 2000., 0., 0., 0.],
[0., 0., 0., 13e3, 0., 0.],
[0., 0., 0., 0., 13e3, 0.],
[0., 0., 0., 0., 0., 13e3]])
##### Equations #####
def f(_, y):
y1 = y[:2]
y2 = y[2:3]
y3 = y[3:]
return np.hstack((m1 @ y3 + v1,
- m2 @ y3 - v2,
- 2e2 * np.abs(y3*1000) ** 0.852 * y3 + m1.T @ y1 + m2.T @ y2 + m3.T @ v3))
def right_hand_side(_, y, ydot, residue):
residue[:] = f(_, y) - m4 @ ydot
return 0
##### Initial conditions and time grid #####
tout = np.array([0., 300.])
y_initial = np.array([0., 0., 0., 0., 0., 0.])
ydot_initial = np.array([0., 0., 0., 0., 0., 0.])
##### Solver #####
dae_solver = dae(SOLVER, right_hand_side, **extra_options)
output = dae_solver.solve(tout, y_initial, ydot_initial)
print(output.values.y)
When I run it, I get the following error :
[IDA ERROR] IDASolve
At t = 0 and h = 2.86102e-07, the corrector convergence failed repeatedly or with |h| = hmin.
Do you have any idea of from where it could come from?