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

Commit

Permalink
ticket:4246 reorder solver flags and reword solver description
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Jan 31, 2017
1 parent b609f85 commit c0c9635
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion SimulationRuntime/c/simulation/solver/perform_simulation.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static int simulationUpdate(DATA* data, threadData_t *threadData, SOLVER_INFO* s
{
prefixedName_updateContinuousSystem(data, threadData);

if (solverInfo->solverMethod == S_SYM_IMP_EULER) data->callback->symEulerUpdate(data, solverInfo->solverStepSize);
if (solverInfo->solverMethod == S_SYM_EULER_SSC) data->callback->symEulerUpdate(data, solverInfo->solverStepSize);

saveZeroCrossings(data, threadData);

Expand Down
33 changes: 15 additions & 18 deletions SimulationRuntime/c/simulation/solver/solver_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ int solver_main_step(DATA* data, threadData_t *threadData, SOLVER_INFO* solverIn
return retVal;
#endif
#ifdef WITH_SUNDIALS
case S_RADAU1:
case S_LOBATTO2:
case S_IMPEULER:
case S_TRAPEZOID:
case S_IMPRUNGEKUTTA:
retVal = radau_lobatto_step(data, solverInfo);
if(omc_flag[FLAG_SOLVER_STEPS])
Expand All @@ -165,7 +165,7 @@ int solver_main_step(DATA* data, threadData_t *threadData, SOLVER_INFO* solverIn
if(omc_flag[FLAG_SOLVER_STEPS])
data->simulationInfo->solverSteps = solverInfo->solverStats[0] + solverInfo->solverStatsTmp[0];
return retVal;
case S_SYM_IMP_EULER:
case S_SYM_EULER_SSC:
retVal = sym_euler_im_with_step_size_control_step(data, threadData, solverInfo);
if(omc_flag[FLAG_SOLVER_STEPS])
data->simulationInfo->solverSteps = solverInfo->solverStats[0] + solverInfo->solverStatsTmp[0];
Expand Down Expand Up @@ -215,7 +215,7 @@ int initializeSolverData(DATA* data, threadData_t *threadData, SOLVER_INFO* solv
{
case S_SYM_EULER:
case S_EULER: break;
case S_SYM_IMP_EULER:
case S_SYM_EULER_SSC:
{
allocateSymEulerImp(solverInfo, data->modelData->nStates);
break;
Expand Down Expand Up @@ -278,14 +278,14 @@ int initializeSolverData(DATA* data, threadData_t *threadData, SOLVER_INFO* solv
}
#endif
#ifdef WITH_SUNDIALS
case S_RADAU1:
case S_LOBATTO2:
case S_IMPEULER:
case S_TRAPEZOID:
case S_IMPRUNGEKUTTA:
{
int usedImpRKOrder = DEFAULT_IMPRK_ORDER;
if (solverInfo->solverMethod == S_RADAU1)
if (solverInfo->solverMethod == S_IMPEULER)
usedImpRKOrder = 1;
if (solverInfo->solverMethod == S_LOBATTO2)
if (solverInfo->solverMethod == S_TRAPEZOID)
usedImpRKOrder = 2;

/* Check the order if set */
Expand Down Expand Up @@ -342,7 +342,7 @@ int freeSolverData(DATA* data, SOLVER_INFO* solverInfo)
free(solverInfo->solverStats);
free(solverInfo->solverStatsTmp);
/* deintialize solver related workspace */
if (solverInfo->solverMethod == S_SYM_IMP_EULER)
if (solverInfo->solverMethod == S_SYM_EULER_SSC)
{
freeSymEulerImp(solverInfo);
}
Expand Down Expand Up @@ -370,8 +370,8 @@ int freeSolverData(DATA* data, SOLVER_INFO* solverInfo)
}
#endif
#ifdef WITH_SUNDIALS
else if(solverInfo->solverMethod == S_RADAU1 ||
solverInfo->solverMethod == S_LOBATTO2 ||
else if(solverInfo->solverMethod == S_IMPEULER ||
solverInfo->solverMethod == S_TRAPEZOID ||
solverInfo->solverMethod == S_IMPRUNGEKUTTA)
{
/* free work arrays */
Expand Down Expand Up @@ -621,12 +621,9 @@ int solver_main(DATA* data, threadData_t *threadData, const char* init_initMetho
switch(solverInfo.solverMethod)
{
#ifndef WITH_SUNDIALS
case S_RADAU1:
case S_RADAU3:
case S_RADAU5:
case S_LOBATTO2:
case S_LOBATTO4:
case S_LOBATTO6:
case S_IMPEULER:
case S_TRAPEZOID:
case S_IMPRUNGEKUTTA:
warningStreamPrint(LOG_STDOUT, 0, "Sundial/kinsol is needed but not available. Please choose other solver.");
TRACE_POP
return 1;
Expand Down Expand Up @@ -725,7 +722,7 @@ int solver_main(DATA* data, threadData_t *threadData, const char* init_initMetho
retVal = data->callback->performSimulation(data, threadData, &solverInfo);
omc_alloc_interface.collect_a_little();
/* terminate the simulation */
if (solverInfo.solverMethod == S_SYM_IMP_EULER) data->callback->symEulerUpdate(data, 0);
if (solverInfo.solverMethod == S_SYM_EULER_SSC) data->callback->symEulerUpdate(data, 0);
finishSimulation(data, threadData, &solverInfo, outputVariablesAtEnd);
omc_alloc_interface.collect_a_little();
}
Expand Down
69 changes: 36 additions & 33 deletions SimulationRuntime/c/util/simulation_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,37 +501,40 @@ const int FLAG_TYPE[FLAG_MAX] = {
};

const char *SOLVER_METHOD_NAME[S_MAX] = {
"unknown",
"euler",
"rungekutta",
"dassl",
"optimization",
"impeuler",
"trapezoid",
"imprungekutta",
"symEuler",
"symEulerSsc",
"heun",
"ida",
"rungekutta_ssc",
"qss"

/* S_UNKNOWN = 0 */ "unknown",
/* S_EULER */ "euler",
/* S_HEUN */ "heun",
/* S_RUNGEKUTTA */ "rungekutta",
/* S_IMPEULER */ "impeuler",
/* S_TRAPEZOID */ "trapezoid",
/* S_IMPRUNGEKUTTA */ "imprungekutta",
/* S_DASSL */ "dassl",
/* S_IDA */ "ida",
/* S_ERKSSC */ "rungekuttaSsc",
/* S_SYM_EULER */ "symEuler",
/* S_SYM_EULER_SSC */ "symEulerSsc",
/* S_QSS */ "qss",
/* S_OPTIMIZATION */ "optimization",
/* S_MAX */ "s_max"
};

const char *SOLVER_METHOD_DESC[S_MAX] = {
"unknown",
"euler - Explicit Euler (order 1)",
"rungekutta - Runge-Kutta (fixed step, order 4)",
"dassl - BDF solver with colored numerical Jacobian, with interval root finding - default",
"optimization - Special solver for dynamic optimization",
"impeuler - Implicit Euler (actually Radau IIA, order 1) [sundial/kinsol needed]",
"trapezoid - Trapezoidal rule (actually Lobatto IIA with 2 points) [sundial/kinsol needed]",
"imprungekutta - Implicit Runge-Kutta bases on Radau and Lobatto IIA methods. Order based on flag 1-6 [sundial/kinsol needed]",
"symEuler - symbolic implicit euler, [compiler flag +symEuler needed]",
"symEulerSsc - symbolic implicit euler with step-size control, [compiler flag +symEuler needed]",
"heun - Heun's method (Runge-Kutta fixed step, order 2)",
"ida - Sundials ida solver",
"rungekutta_ssc - Runge-Kutta (with step size control, see. Novikov (2016), Solving Stiff Systems of ODEs...)",
"qss - A QSS solver [experimental]"
/* S_UNKNOWN = 0 */ "unknown",
/* S_EULER */ "euler - Euler - explicit, fixed step size, order 1",
/* S_HEUN */ "heun - Heun's method - explicit, fixed step, order 2",
/* S_RUNGEKUTTA */ "rungekutta - classical Runge-Kutta - explicit, fixed step, order 4",
/* S_IMPEULER */ "impeuler - Euler - implicit, fixed step size, order 1",
/* S_TRAPEZOID */ "trapezoid - trapezoidal rule - implicit, fixed step size, order 2",
/* S_IMPRUNGEKUTTA */ "imprungekutta - Runge-Kutta methods based on Radau and Lobatto IIA - implicit, fixed step size, order 1-6(selected manually by flag -impRKOrder)",
/* S_DASSL */ "dassl - default solver - BDF method - implicit, step size control, order 1-5",
/* S_IDA */ "ida - SUNDIALS IDA solver - BDF method with sparse linear solver - implicit, step size control, order 1-5",
/* S_ERKSSC */ "rungekuttaSsc - Runge-Kutta based on Novikov (2016) - explicit, step size control, order 4-5 [experimental]",
/* S_SYM_EULER */ "symEuler - symbolic implicit Euler [compiler flag +symEuler needed] - implicit, fixed step size, order 1",
/* S_SYM_EULER_SSC */ "symEulerSsc - symbolic implicit Euler with step size control [compiler flag +symEuler needed] - implicit, step size control, order 1",
/* S_QSS */ "qss - A QSS solver [experimental]"
/* S_OPTIMIZATION */ "optimization - Special solver for dynamic optimization",
/* S_MAX */ "S_MAX"
};

const char *INIT_METHOD_NAME[IIM_MAX] = {
Expand Down Expand Up @@ -566,7 +569,7 @@ const char *LS_DESC[LS_MAX+1] = {

/* LS_LAPACK */ "method using lapack LU factorization",
#if !defined(OMC_MINIMAL_RUNTIME)
/* LS_LIS */ "method using iterativ solver Lis",
/* LS_LIS */ "method using iterative solver Lis",
#endif
/* LS_KLU */ "method using klu sparse linear solver",
/* LS_UMFPACK */ "method using umfpack sparse linear solver",
Expand All @@ -592,7 +595,7 @@ const char *LSS_DESC[LS_MAX+1] = {
"unknown",

#if !defined(OMC_MINIMAL_RUNTIME)
/* LS_LIS */ "method using iterativ solver Lis",
/* LS_LIS */ "method using iterative solver Lis",
#endif
/* LS_KLU */ "method using klu sparse linear solver",
/* LS_UMFPACK */ "method using umfpack sparse linear solver",
Expand Down Expand Up @@ -698,9 +701,9 @@ const char *IDA_LS_METHOD_DESC[IDA_LS_MAX+1] = {

"ida internal dense method",
"ida use sparse direct solver KLU",
"ida generalized minimal residual method. Iterativ method",
"ida Bi-CGStab. Iterativ method",
"ida TFQMR. Iterativ method",
"ida generalized minimal residual method. Iterative method",
"ida Bi-CGStab. Iterative method",
"ida TFQMR. Iterative method",

"IDA_LS_MAX"
};
Expand Down
14 changes: 7 additions & 7 deletions SimulationRuntime/c/util/simulation_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,18 @@ enum SOLVER_METHOD
S_UNKNOWN = 0,

S_EULER,
S_HEUN,
S_RUNGEKUTTA,
S_DASSL,
S_OPTIMIZATION,
S_RADAU1,
S_LOBATTO2,
S_IMPEULER,
S_TRAPEZOID,
S_IMPRUNGEKUTTA,
S_SYM_EULER,
S_SYM_IMP_EULER,
S_HEUN,
S_DASSL,
S_IDA,
S_ERKSSC,
S_SYM_EULER,
S_SYM_EULER_SSC,
S_QSS,
S_OPTIMIZATION,

S_MAX
};
Expand Down

0 comments on commit c0c9635

Please sign in to comment.