Skip to content

Commit e05e21a

Browse files
Marcus WaltherOpenModelica-Hudson
authored andcommitted
- Logger of Cpp runtime is now enabled by default, the standard log level was reduced to "warning"
- Kinsol will no continue solving non linear equation systems if the convergence criteria was not reached -> a warning is printed instead until we have a solver that is able to solve the systems correctly
1 parent e427c5c commit e05e21a

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

Compiler/Template/CodegenCpp.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2295,7 +2295,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
22952295
try
22962296
{
22972297
Logger::initialize();
2298-
Logger::setEnabled(false);
2298+
Logger::setEnabled(true);
22992299
<%if boolNot(stringEq(getConfigString(PROFILING_LEVEL),"none")) then
23002300
<<
23012301
std::vector<MeasureTimeData> measureTimeArraySimulation = std::vector<MeasureTimeData>(2); //0 all, 1 setup

SimulationRuntime/cpp/Core/System/ContinuousEvents.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ bool ContinuousEvents::startEventIteration(bool& state_vars_reinitialized)
6767
_event_system->getConditions(_conditions1);
6868
bool crestart = !std::equal (_conditions1, _conditions1+dim,_conditions0);
6969

70-
return((drestart||crestart)); //returns true if new events occured
70+
return((drestart||crestart)); //returns true if new events occurred
7171
}
7272
/** @} */ // end of coreSystem
7373
/*

SimulationRuntime/cpp/Include/Core/SimulationSettings/IGlobalSettings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct LogSettings
3535

3636
LogSettings()
3737
{
38-
modes = std::vector<LogLevel>(8,LL_ERROR);
38+
modes = std::vector<LogLevel>(8,LL_WARNING);
3939
}
4040

4141
void setAll(LogLevel l)

SimulationRuntime/cpp/Include/Solver/Kinsol/Kinsol.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ class Kinsol : public IAlgLoopSolver
9797

9898
bool
9999
_eventRetry,
100-
_fValid;
100+
_fValid,
101+
_solverErrorNotificationGiven;
101102

102103
realtype _fnorm,
103104
_currentIterateNorm;

SimulationRuntime/cpp/Solver/Kinsol/Kinsol.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ Kinsol::Kinsol(IAlgLoop* algLoop, INonLinSolverSettings* settings)
6565
, _Kin_fScale (NULL)
6666
, _kinMem (NULL)
6767
, _scale (NULL)
68+
, _fValid(false)
69+
, _solverErrorNotificationGiven(false)
6870
{
6971
_data = ((void*)this);
7072
}
@@ -396,7 +398,12 @@ void Kinsol::solve()
396398
}
397399
*/
398400
if(_iterationStatus == SOLVERERROR && !_eventRetry)
399-
throw ModelicaSimulationError(ALGLOOP_SOLVER,"Nonlinear solver failed!");
401+
if(!_solverErrorNotificationGiven)
402+
{
403+
Logger::write("Kinsol: Solver error detected. The simulation will continue, but the results may be incorrect.",LC_NLS,LL_WARNING);
404+
_solverErrorNotificationGiven = true;
405+
}
406+
// throw ModelicaSimulationError(ALGLOOP_SOLVER,"Nonlinear solver failed!");
400407

401408
}
402409
}

0 commit comments

Comments
 (0)