Skip to content

Commit

Permalink
introduced new debug flag LOG_NLS_RES into simulation runtime, to mon…
Browse files Browse the repository at this point in the history
…itor every evaluation of the residual function

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17526 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Christian SChubert committed Oct 4, 2013
1 parent 1ffaf91 commit f3e2188
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions SimulationRuntime/c/simulation/simulation_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ void setGlobalVerboseLevel(int argc, char**argv)
if(useStream[LOG_NLS_V])
useStream[LOG_NLS] = 1;

/* print LOG_NLS if LOG_NLS_RES if active */
if(useStream[LOG_NLS_RES])
useStream[LOG_NLS] = 1;

/* print LOG_EVENTS if LOG_EVENTS_V if active */
if(useStream[LOG_EVENTS_V])
useStream[LOG_EVENTS] = 1;
Expand Down
12 changes: 12 additions & 0 deletions SimulationRuntime/c/simulation/solver/nonlinearSolverHybrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,21 @@ static int wrapper_fvec_hybrj(integer* n, double* x, double* f, double* fjac, in
for(i=0; i<*n; i++)
x[i] = x[i]*solverData->xScalefactors[i];

/* debug output */
if(ACTIVE_STREAM(LOG_NLS_RES)) {
INFO1(LOG_NLS_RES, "-- residual function call %d --", solverData->nfev);
printVector(x, n, LOG_NLS_RES, "x vector");
}

/* call residual function */
(systemData->residualFunc)(data, x, f, iflag);

/* debug output */
if(ACTIVE_STREAM(LOG_NLS_RES)) {
printVector(f, n, LOG_NLS_RES, "residuals");
INFO1(LOG_NLS_RES, "-- end of residual function call %d --", solverData->nfev);
}

/* Scaling x vector */
if(solverData->useXScaling)
for(i=0; i<*n; i++)
Expand Down
2 changes: 2 additions & 0 deletions SimulationRuntime/c/util/omc_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const char *LOG_STREAM_NAME[LOG_MAX] = {
"LOG_NLS",
"LOG_NLS_V",
"LOG_NLS_JAC",
"LOG_NLS_RES",
"LOG_RES_INIT",
"LOG_SIMULATION",
"LOG_SOLVER",
Expand Down Expand Up @@ -87,6 +88,7 @@ const char *LOG_STREAM_DESC[LOG_MAX] = {
"logging for nonlinear systems", /* LOG_NLS */
"verbose logging of nonlinear systems", /* LOG_NLS_V */
"outputs the jacobian of nonlinear systems", /* LOG_NLS_JAC */
"outputs every evaluation of the residual function", /* LOG_NLS_RES */
"outputs residuals of the initialization", /* LOG_RES_INIT */
"additional information about simulation process", /* LOG_SIMULATION */
"additional information about solver process", /* LOG_SOLVER */
Expand Down
1 change: 1 addition & 0 deletions SimulationRuntime/c/util/omc_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ enum LOG_STREAM
LOG_NLS,
LOG_NLS_V,
LOG_NLS_JAC,
LOG_NLS_RES,
LOG_RES_INIT,
LOG_SIMULATION,
LOG_SOLVER,
Expand Down

0 comments on commit f3e2188

Please sign in to comment.