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

Commit

Permalink
Fix check of homotopy solution
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - #1942
  • Loading branch information
ptaeuber authored and OpenModelica-Hudson committed Oct 25, 2017
1 parent 9e2d1a7 commit 2ac44ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,6 @@ static int symbolic_initialization(DATA *data, threadData_t *threadData)
fprintf(pFile, "\n");
}
#endif

if (check_nonlinear_solutions(data, 0) ||
check_linear_solutions(data, 0) ||
check_mixed_solutions(data, 0))
break;
}
data->simulationInfo->homotopyUsed = 1;
messageClose(LOG_INIT);
Expand Down
11 changes: 6 additions & 5 deletions SimulationRuntime/c/simulation/solver/nonlinearSystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ int solve_nonlinear_system(DATA *data, threadData_t *threadData, int sysNumber)

infoStreamPrint(LOG_INIT, 0, "[system %d] homotopy parameter lambda = %g", sysNumber, data->simulationInfo->lambda);
nonlinsys->solved = solveNLS(data, threadData, sysNumber);
if (!nonlinsys->solved) break;

#if !defined(OMC_NO_FILESYSTEM)
if(ACTIVE_STREAM(LOG_INIT))
Expand Down Expand Up @@ -992,10 +993,10 @@ int check_nonlinear_solution(DATA *data, int printFailingSystems, int sysNumber)
{
int index = nonlinsys[i].equationIndex, indexes[2] = {1,index};
if (!printFailingSystems) return 1;
warningStreamPrintWithEquationIndexes(LOG_NLS, 1, indexes, "nonlinear system %d fails: at t=%g", index, data->localData[0]->timeValue);
warningStreamPrintWithEquationIndexes(LOG_NLS, 0, indexes, "nonlinear system %d fails: at t=%g", index, data->localData[0]->timeValue);
if(data->simulationInfo->initial)
{
warningStreamPrint(LOG_NLS_V, 0, "proper start-values for some of the following iteration variables might help");
warningStreamPrint(LOG_INIT, 1, "proper start-values for some of the following iteration variables might help");
}
for(j=0; j<modelInfoGetEquation(&data->modelData->modelDataXml, (nonlinsys[i]).equationIndex).numVar; ++j) {
int done=0;
Expand All @@ -1006,18 +1007,18 @@ int check_nonlinear_solution(DATA *data, int printFailingSystems, int sysNumber)
if (!strcmp(mData->realVarsData[k].info.name, modelInfoGetEquation(&data->modelData->modelDataXml, (nonlinsys[i]).equationIndex).vars[j]))
{
done = 1;
warningStreamPrint(LOG_NLS_V, 0, "[%ld] Real %s(start=%g, nominal=%g)", j+1,
warningStreamPrint(LOG_INIT, 0, "[%ld] Real %s(start=%g, nominal=%g)", j+1,
mData->realVarsData[k].info.name,
mData->realVarsData[k].attribute.start,
mData->realVarsData[k].attribute.nominal);
}
}
if (!done)
{
warningStreamPrint(LOG_NLS_V, 0, "[%ld] Real %s(start=?, nominal=?)", j+1, modelInfoGetEquation(&data->modelData->modelDataXml, (nonlinsys[i]).equationIndex).vars[j]);
warningStreamPrint(LOG_INIT, 0, "[%ld] Real %s(start=?, nominal=?)", j+1, modelInfoGetEquation(&data->modelData->modelDataXml, (nonlinsys[i]).equationIndex).vars[j]);
}
}
messageCloseWarning(LOG_NLS);
messageCloseWarning(LOG_INIT);
return 1;
}
if(nonlinsys[i].solved == 2)
Expand Down

0 comments on commit 2ac44ce

Please sign in to comment.