﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
6275	--daeMode segfault with -idaLS=klu	Andreas Heuermann	Andreas Heuermann	"Reported by hanshell in the forum. Original post: https://openmodelica.org/forum/default-topic/3155-daemode-segfault-with-idals-klu


simulation option: `-idaLS=klu  -lv LOG_SOLVER`
{{{
Limited backtrace at point of segmentation fault
/lib64/libpthread.so.0(+0x132d0)[0x7f3d054022d0]
/usr/local/bin/../lib/x86_64-linux-gnu/omc/libsundials_sunlinsolklu.so.3(SUNLinSolSolve_KLU+0x92)[0x7f3d03b70f52]
/usr/local/bin/../lib/x86_64-linux-gnu/omc/libsundials_idas.so.4(idaLsSolve+0x1b7)[0x7f3d02860e17]
/usr/local/bin/../lib/x86_64-linux-gnu/omc/libsundials_idas.so.4(IDACalcIC+0x6b3)[0x7f3d0285df23]
/usr/local/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(ida_event_update+0x2b1)[0x7f3d08404021]
/usr/local/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(updateDiscreteSystem+0x89)[0x7f3d083ee969]
/usr/local/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(initialization+0x40b)[0x7f3d0841886b]
/usr/local/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(initializeModel+0xde)[0x7f3d083f9cce]
/usr/local/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(solver_main+0x140)[0x7f3d083fae30]
/usr/local/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(+0xd3e41)[0x7f3d08441e41]
/usr/local/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(startNonInteractiveSimulation+0xd1c)[0x7f3d08440f5c]
/usr/local/bin/../lib/x86_64-linux-gnu/omc/libSimulationRuntimeC.so(_main_SimulationRuntime+0x72)[0x7f3d08443fb2]
./DFIM10(main+0x19b)[0x416ad1]
/lib64/libc.so.6(__libc_start_main+0xea)[0x7f3d0505834a]
./DFIM10(_start+0x2a)[0x41490a]
}}}

{{{
LOG_SOLVER        | info    | NO override given on the command line.
LOG_SOLVER        | info    | numberOfIntervals = 10500
LOG_SOLVER        | info    | Allocated simulation result data storage for method 'mat' and file='DFIM10_res.mat'
LOG_SOLVER        | info    | recognized solver: ida
LOG_SOLVER        | info    | Initializing IDA DAE Solver
LOG_SOLVER        | info    | ## IDA ## Initializing solver of size 111 in DAE mode.
|                 | |       | | The relative tolerance is 1e-08. Following absolute tolerances are used for the states:
|                 | |       | | IDA uses internal root finding method YES
|                 | |       | | Maximum integration order 5
|                 | |       | | use equidistant time grid YES
|                 | |       | | IDA linear solver method selected ida use sparse direct solver KLU. (default)
|                 | |       | | Jacobian is calculated by ""Colored numerical Jacobian, which is default for dassl and ida. With option -idaLS=klu a sparse matrix is used.""
|                 | |       | | initial step size is set automatically.
LOG_SOLVER        | info    | ##IDA## do event update at -0.5
LOG_SOLVER        | info    | ##IDA## corrected step-size at 2.22044604925031e-16
LOG_SOLVER        | info    | #### IDA error message #####
|                 | |       | |  -> error code -22
|                 | |       | |  -> module IDAS
|                 | |       | |  -> function IDACalcIC
|                 | |       | |  Message: tout1 too close to t0 to attempt initial condition calculation.
LOG_SOLVER        | info    | ##IDA## IDACalcIC run status -22.
|                 | |       | Iterations : 0
LOG_SOLVER        | info    | ##IDA## first event iteration failed. Start next try without line search!
}}}

simulation option  `-idaLS=dense  -lv LOG_SOLVER`
results as expected


{{{
LOG_SOLVER        | info    | NO override given on the command line.
LOG_SOLVER        | info    | numberOfIntervals = 10500
LOG_SOLVER        | info    | Allocated simulation result data storage for method 'mat' and file='DFIM10_res.mat'
LOG_SOLVER        | info    | recognized solver: ida
LOG_SOLVER        | info    | Initializing IDA DAE Solver
LOG_SOLVER        | info    | ## IDA ## Initializing solver of size 111 in DAE mode.
|                 | |       | | The relative tolerance is 1e-08. Following absolute tolerances are used for the states:
|                 | |       | | IDA uses internal root finding method YES
|                 | |       | | Maximum integration order 5
|                 | |       | | use equidistant time grid YES
|                 | |       | | IDA linear solver method selected ida internal dense method.
|                 | |       | | Jacobian is calculated by ""Colored numerical Jacobian, which is default for dassl and ida. With option -idaLS=klu a sparse matrix is used.""
|                 | |       | | initial step size is set automatically.
LOG_SOLVER        | info    | ##IDA## do event update at -0.5
LOG_SOLVER        | info    | ##IDA## corrected step-size at 2.22044604925031e-16
LOG_SOLVER        | info    | #### IDA error message #####
|                 | |       | |  -> error code -22
|                 | |       | |  -> module IDAS
|                 | |       | |  -> function IDACalcIC
|                 | |       | |  Message: tout1 too close to t0 to attempt initial condition calculation.
LOG_SOLVER        | info    | ##IDA## IDACalcIC run status -22.
|                 | |       | Iterations : 0
LOG_SOLVER        | info    | ##IDA## first event iteration failed. Start next try without line search!
LOG_SOLVER        | info    | ##IDA## IDACalcIC run status 0.
|                 | |       | Iterations : 0
LOG_SUCCESS       | info    | The initialization finished successfully without homotopy method.
LOG_SOLVER        | info    | Wrote parameters to the file after initialization (for output formats that support this)
LOG_SOLVER        | info    | Start numerical solver from -0.5 to 10
LOG_SOLVER        | info    | Sparse structure of DAE sparse pattern [size: 111x111]
|                 | |       | | 393 nonzero elements
|                 | |       | | Transposed sparse structure (rows: states)
}}}
with version v1.16.0  sparse direct solver was working.

OMC version: OMCompiler v1.17.0-dev.224+g4c291412fa
OS: x86_64 x86_64 x86_64 GNU/Linux
"	defect	closed	blocker	1.17.0	Run-time	v1.17.0-dev	fixed	sundials, ida, klu, daeMode	
