Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 779ff67

Browse files
Willi BraunOpenModelica-Hudson
authored andcommitted
[cRuntime] if IDA fails with linear solver setup reinit and try again
Belonging to [master]: - #2274
1 parent 747e401 commit 779ff67

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

SimulationRuntime/c/simulation/solver/ida_solver.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,7 @@ ida_solver_step(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo)
786786
long int tmp;
787787
static unsigned int stepsOutputCounter = 1;
788788
int stepsMode;
789+
int restartAfterLSFail = 0;
789790

790791
IDA_SOLVER *idaData = (IDA_SOLVER*) solverInfo->solverData;
791792

@@ -968,6 +969,15 @@ ida_solver_step(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo)
968969
{
969970
warningStreamPrint(LOG_SOLVER, 0, "##IDA## has done too much work with small steps at time = %.15g", solverInfo->currentTime);
970971
}
972+
else if (flag == IDA_LSETUP_FAIL && !restartAfterLSFail )
973+
{
974+
flag = IDAReInit(idaData->ida_mem,
975+
solverInfo->currentTime,
976+
idaData->y,
977+
idaData->yp);
978+
restartAfterLSFail = 1;
979+
warningStreamPrint(LOG_SOLVER, 0, "##IDA## linear solver failed try once again = %.15g", solverInfo->currentTime);
980+
}
971981
else
972982
{
973983
infoStreamPrint(LOG_STDOUT, 0, "##IDA## %d error occurred at time = %.15g", flag, solverInfo->currentTime);

0 commit comments

Comments
 (0)