AMICI icon indicating copy to clipboard operation
AMICI copied to clipboard

DAE integration fails

Open yannikschaelte opened this issue 7 years ago • 6 comments

I have a problem with a simple published model (5 states, 8 parameters): I would like to have it as a DAE, but AMICI fails to do the simulation then, giving a status -99 and just nan values. Using the matlab solver ODE15S works and gives the expected result. Also simulating the system as an ODE works. Computing with or without gradients changes nothing about this.

The output I get from the script contained in the enclosed zip is:

Solved with AMICI as ODE:

ans =

     0


ans =

    0.4405    4.6192    0.8595

Warning: AMICI ERROR: in module IDAS in function IDACalcIC : Newton/Linesearch algorithm failed to converge.  
> In simulate_model_kuntz_dae (line 232)
  In example_kuntz (line 58) 
Warning: AMICI simulation failed:
AMICI setup failed:
(IDA routine IDACalcIC failed with error code -4)
Error occured in:
stacktrace not available on windows platforms
 
> In simulate_model_kuntz_dae (line 232)
  In example_kuntz (line 58) 
Solved with AMICI as DAE:

ans =

   -99


ans =

   NaN   NaN   NaN

Solved with ODE15S as ODE:

ans =

    0.4405    4.6192    0.8595    0.8636    2.4634

Solved with ODE15S as DAE:

ans =

    0.4405    4.7000    0.8696    0.8696    2.4633

The test script: example.zip

Tested on Windows with latest amici and Matlab 2017b. Any hints on what is wrong here?

yannikschaelte avatar Nov 14 '18 09:11 yannikschaelte

Sorry, I have very limited knowledge of DAEs, so I am probably not going to be of much help.

What I can tell you:

IDAs fails to compute consistent initial conditions (IDACalcIC : Newton/Linesearch algorithm failed to converge.). I remember that we had some trouble with this a while back and I would currently guess that this is more of an implementation problem on the AMICI side (as in either the options or input functions to IDACalcIC are incorrect).

FFroehlich avatar Nov 14 '18 14:11 FFroehlich

So you think something is passed to or computed for IDAS incorrectly? In this case, the DAE is just setting the derivatives of 4 out of 5 species to zero, as they are assumed to change slowly. Since the ODE can be solved without problems and its behavior is similar to that of the DAE, I would guess it is not a problem of the model?

yannikschaelte avatar Nov 14 '18 15:11 yannikschaelte

The only DAE testcase we have is the robertson mode, so there is overall very limited testing of DAEs.

What I imagine could be wrong:

  • The functions to compute the mass matrix and/or the system jacobian.
  • The options that are passed to IDACalcIC. If I remember correctly, the key parameter is whether the initial conditions should be computed based on the initial conditions for the state or the derivative of the state.
  • something entirely different I have not thought of so far.

FFroehlich avatar Nov 14 '18 15:11 FFroehlich

I recall that sometimes simply changing the sign of the mass matrix and the vector field helped. Probably not the problem here, but easy to test.

JanHasenauer avatar Nov 14 '18 15:11 JanHasenauer

I tested the robertson model with the latest amici, and it still gave me non-nans, so some thing seems to work.

yannikschaelte avatar Nov 14 '18 15:11 yannikschaelte

Found a bug https://github.com/AMICI-dev/AMICI/pull/1376. Don't think this will fix anything in this case nor whether this is still relevant, but if it is, might be worth a try to check this again.

FFroehlich avatar Jan 15 '21 00:01 FFroehlich