Skip to content

Commit

Permalink
[cRuntime] if IDA fails with linear solver setup reinit and try again
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - OpenModelica/OMCompiler#2274
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Mar 14, 2018
1 parent 747e401 commit 779ff67
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions SimulationRuntime/c/simulation/solver/ida_solver.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ ida_solver_step(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo)
long int tmp;
static unsigned int stepsOutputCounter = 1;
int stepsMode;
int restartAfterLSFail = 0;

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

Expand Down Expand Up @@ -968,6 +969,15 @@ ida_solver_step(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo)
{
warningStreamPrint(LOG_SOLVER, 0, "##IDA## has done too much work with small steps at time = %.15g", solverInfo->currentTime);
}
else if (flag == IDA_LSETUP_FAIL && !restartAfterLSFail )
{
flag = IDAReInit(idaData->ida_mem,
solverInfo->currentTime,
idaData->y,
idaData->yp);
restartAfterLSFail = 1;
warningStreamPrint(LOG_SOLVER, 0, "##IDA## linear solver failed try once again = %.15g", solverInfo->currentTime);
}
else
{
infoStreamPrint(LOG_STDOUT, 0, "##IDA## %d error occurred at time = %.15g", flag, solverInfo->currentTime);
Expand Down

0 comments on commit 779ff67

Please sign in to comment.