Open casella opened 2 years ago
The function returning this error code is
flag = IDACalcIC(ida mem, icopt, tout1);
and will indeed return IDA_LSETUP_FAIL
as you already noticed.
See ida_solver.c#L759-L780
The first call of IDANlsIC
is failing. Its task is to solves a nonlinear system for consistent initial conditions using IDANewtonIC
.
But inside that the linear solver setup function is failing with an error code of -809
(==> IDA_LSETUP_FAIL
).
Apparently KLU (the used linear solver) is failing to compute the LU factorization in sun_klu_factor()
.
KLU_factor
is reporting:
"Matrix is singular, and the Numeric object is only partially defined because we halted early. This is the default case for a singular matrix"
and breaks.
I didn't had any test cases for daeMode when updating SUNDIALS to v5.4.0, so there is a good chance I missed something. I'll have a look into this, probably next week.
We also have similar problems with KLU in Jacobians of nonlinear loops. See e.g. https://libraries.openmodelica.org/branches/master/ClaRa_dev/files/ClaRa_dev_ClaRa.Basics.ControlVolumes.FluidVolumes.Check.Validation_VolumeVLE_L2_HeatTransfer_1ph_shell.sim Maybe we are using it wrong in general?
We could try the sanity check of the jacobian / sparsity pattern in this one.
Sounds like a good idea! if the sparsity pattern is wrong, it's small wonder that sparse solvers fail.
@AnHeuermann, @phannebohm, any chance you can continue on this?
Description
There are many models in the newInst-daeMode testsuite, e.g. Modelica.Fluid.Examples.AST_BatchPlant.Test.OneTank or ModelicaTest.Fluid.TestExamplesVariants.IncompressibleFluidNetwork_StandardWaterOnePhase that fail with this error:
According to the IDA manual, error -6 is IDA LSETUP FAIL -6 The linear solver’s setup function failed in an unrecoverable manner. I'm not sure if this is really what the runtime refers to, since it also mention "discrete update", whatever that means.
Steps to Reproduce
Run the models with
--daeMode
.Expected Behavior
The models should run as in odeMode.