Skip to content

Commit 3e83c18

Browse files
author
Willi Braun
committed
fix ticket:3983
1 parent 7b072a7 commit 3e83c18

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

SimulationRuntime/c/simulation/solver/ida_solver.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -503,22 +503,22 @@ ida_solver_initial(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo
503503
/* configure algebraic variables as such */
504504
if (idaData->daeMode)
505505
{
506-
if (omc_flag[FLAG_IDA_SUPPRESS_ALG])
506+
if (!omc_flag[FLAG_NO_SUPPRESS_ALG])
507507
{
508508
flag = IDASetSuppressAlg(idaData->ida_mem, TRUE);
509509
if (checkIDAflag(flag)){
510510
throwStreamPrint(threadData, "##IDA## Suppress algebraic variables in the local error test failed");
511511
}
512-
}
513512

514-
for(i=0; i<idaData->N; ++i)
515-
{
516-
tmp[i] = (i<data->modelData->nStates)? 1.0: 0.0;
517-
}
513+
for(i=0; i<idaData->N; ++i)
514+
{
515+
tmp[i] = (i<data->modelData->nStates)? 1.0: 0.0;
516+
}
518517

519-
flag = IDASetId(idaData->ida_mem, N_VMake_Serial(idaData->N,tmp));
520-
if (checkIDAflag(flag)){
521-
throwStreamPrint(threadData, "##IDA## Mark algebraic variables as such failed!");
518+
flag = IDASetId(idaData->ida_mem, N_VMake_Serial(idaData->N,tmp));
519+
if (checkIDAflag(flag)){
520+
throwStreamPrint(threadData, "##IDA## Mark algebraic variables as such failed!");
521+
}
522522
}
523523
}
524524

SimulationRuntime/c/util/simulation_options.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ const char *FLAG_NAME[FLAG_MAX+1] = {
4949
/* FLAG_IDA_NONLINCONVCOEF */ "idaNonLinConvCoef",
5050
/* FLAG_IDA_LS */ "idaLS",
5151
/* FLAG_IDAS */ "idaSensitivity",
52-
/* FLAG_IDA_SUPPRESS_ALG */ "idaSupressAlg",
5352
/* FLAG_IGNORE_HIDERESULT */ "ignoreHideResult",
5453
/* FLAG_IIF */ "iif",
5554
/* FLAG_IIM */ "iim",
@@ -91,6 +90,7 @@ const char *FLAG_NAME[FLAG_MAX+1] = {
9190
/* FLAG_NOEVENTEMIT */ "noEventEmit",
9291
/* FLAG_NO_RESTART */ "noRestart",
9392
/* FLAG_NO_ROOTFINDING */ "noRootFinding",
93+
/* FLAG_NO_SUPPRESS_ALG */ "noSupressAlg",
9494
/* FLAG_OPTDEBUGEJAC */ "optDebugeJac",
9595
/* FLAG_OPTIMIZER_NP */ "optimizerNP",
9696
/* FLAG_OPTIMIZER_TGRID */ "optimizerTimeGrid",
@@ -127,7 +127,6 @@ const char *FLAG_DESC[FLAG_MAX+1] = {
127127
/* FLAG_IDA_NONLINCONVCOEF */ "value specifies the safety factor in the nonlinear convergence test. The default value is 0.33.",
128128
/* FLAG_IDA_LS */ "selects the linear solver used by ida",
129129
/* FLAG_IDAS */ "flag to add sensitivity information to the result files",
130-
/* FLAG_IDA_SUPPRESS_ALG */ "flag to to suppress algebraic variables in the local error of ida solver in daeMode",
131130
/* FLAG_IGNORE_HIDERESULT */ "ignore HideResult=true annotation",
132131
/* FLAG_IIF */ "value specifies an external file for the initialization of the model",
133132
/* FLAG_IIM */ "value specifies the initialization method",
@@ -169,6 +168,7 @@ const char *FLAG_DESC[FLAG_MAX+1] = {
169168
/* FLAG_NOEVENTEMIT */ "do not emit event points to the result file",
170169
/* FLAG_NO_RESTART */ "flag deactivates the restart of dassl/ida after an event is performed.",
171170
/* FLAG_NO_ROOTFINDING */ "flag deactivates the internal root finding procedure of dassl/ida.",
171+
/* FLAG_NO_SUPPRESS_ALG */ "flag to not suppress algebraic variables in the local error test of ida solver in daeMode",
172172
/* FLAG_OPTDEBUGEJAC */ "value specifies the number of iter from the dyn. optimization, which will be debuge, creating *csv and *py file",
173173
/* FLAG_OPTIMIZER_NP */ "value specifies the number of points in a subinterval",
174174
/* FLAG_OPTIMIZER_TGRID */ "value specifies external file with time points.",
@@ -233,8 +233,6 @@ const char *FLAG_DETAILED_DESC[FLAG_MAX+1] = {
233233
" * spgmr - sparse iterative linear solver based on transpose free quasi-minimal residual method, convergance is not guaranteed, sundials method\n",
234234
/* FLAG_IDAS */
235235
" Enables sensitivity analysis with respect to parameters if the model is compiled with omc flag --calculateSensitivities.",
236-
/* FLAG_IDA_SUPPRESS_ALG */
237-
" flag to to suppress algebraic variables in the local error of ida solver in daeMode",
238236
/* FLAG_IGNORE_HIDERESULT */
239237
" Emits also variables with HideResult=true annotation.",
240238
/* FLAG_IIF */
@@ -347,6 +345,10 @@ const char *FLAG_DETAILED_DESC[FLAG_MAX+1] = {
347345
" Deactivates the restart of dassl/ida after an event is performed.",
348346
/* FLAG_NO_ROOTFINDING */
349347
" Deactivates the internal root finding procedure of dassl/ida solver.",
348+
/* FLAG_NO_SUPPRESS_ALG */
349+
" flag to not suppress algebraic variables in the local error test of the ida solver in daeMode.\n"
350+
" In general, the use of this option is discouraged when solving DAE systems of index 1,\n"
351+
" whereas it is generally encouraged for systems of index 2 or more.",
350352
/* FLAG_OPTDEBUGEJAC */
351353
" Value specifies the number of itereations from the dynamic optimization, which\n"
352354
" will be debugged, creating .csv and .py files.",
@@ -407,7 +409,6 @@ const int FLAG_TYPE[FLAG_MAX] = {
407409
/* FLAG_IDA_NONLINCONVCOEF */ FLAG_TYPE_OPTION,
408410
/* FLAG_IDA_LS */ FLAG_TYPE_OPTION,
409411
/* FLAG_IDAS */ FLAG_TYPE_FLAG,
410-
/* FLAG_IDA_SUPPRESS_ALG */ FLAG_TYPE_FLAG,
411412
/* FLAG_IGNORE_HIDERESULT */ FLAG_TYPE_FLAG,
412413
/* FLAG_IIF */ FLAG_TYPE_OPTION,
413414
/* FLAG_IIM */ FLAG_TYPE_OPTION,
@@ -448,6 +449,7 @@ const int FLAG_TYPE[FLAG_MAX] = {
448449
/* FLAG_NOEQUIDISTANT_OUT_TIME*/ FLAG_TYPE_OPTION,
449450
/* FLAG_NO_RESTART */ FLAG_TYPE_FLAG,
450451
/* FLAG_NO_ROOTFINDING */ FLAG_TYPE_FLAG,
452+
/* FLAG_NO_SUPPRESS_ALG */ FLAG_TYPE_FLAG,
451453
/* FLAG_NOEVENTEMIT */ FLAG_TYPE_FLAG,
452454
/* FLAG_OPTDEBUGEJAC */ FLAG_TYPE_OPTION,
453455
/* FLAG_OPTIZER_NP */ FLAG_TYPE_OPTION,

SimulationRuntime/c/util/simulation_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ enum _FLAG
5757
FLAG_IDA_NONLINCONVCOEF,
5858
FLAG_IDA_LS,
5959
FLAG_IDAS,
60-
FLAG_IDA_SUPPRESS_ALG,
6160
FLAG_IGNORE_HIDERESULT,
6261
FLAG_IIF,
6362
FLAG_IIM,
@@ -99,6 +98,7 @@ enum _FLAG
9998
FLAG_NOEVENTEMIT,
10099
FLAG_NO_RESTART,
101100
FLAG_NO_ROOTFINDING,
101+
FLAG_NO_SUPPRESS_ALG,
102102
FLAG_OPTDEBUGEJAC,
103103
FLAG_OPTIMIZER_NP,
104104
FLAG_OPTIMIZER_TGRID,

0 commit comments

Comments
 (0)