title: How to fix ‘IDASolve : the corrector convergence failed’ when solving a DAE with scikits.odes and Sundial?
body: <p>I'm trying to solve a system of DAE (2 ODE and 1 algebraic equation) using the solver IDA from Sundials (<a href="https://computation.llnl.gov/projects/sundials/ida" rel="nofollow noreferrer">https://computation.llnl.gov/projects/sundials/ida</a>), through the Python package scikits.odes (<a href="https://scikits-odes.readthedocs.io" rel="nofollow noreferrer">https://scikits-odes.readthedocs.io</a>).</p>
  
  <p>I'm using scikits.odes 2.4.0, Sundials 3.1.1 and Python 3.6 64bit.</p>
  
  <p>Here is the code :</p>
  
  <pre class="lang-py prettyprint-override"><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)
  </code></pre>
  
  <p>When I run it, I get the following error :</p>
  
  <pre><code>[IDA ERROR]  IDASolve
    At t = 0 and h = 2.86102e-07, the corrector convergence failed repeatedly or with |h| = hmin.
  </code></pre>
  
  <p>Do you have any idea of from where it could come from?</p>