Solving Modelica Models

Integration Methods

By default OpenModelica transforms a Modelica model into an ODE representation to perform a simulation by using numerical integration methods. This section contains additional information about the different integration methods in OpenModelica. They can be selected by the method parameter of the simulate command or the -s simflag.

The different methods are also called solver and can be distinguished by their characteristic:

  • explicit vs. implicit

  • order

  • step size control

  • multi step

A good introduction on this topic may be found in [CK06] and a more mathematical approach can be found in [HNorsettW93].

DASSL

DASSL is the default solver in OpenModelica, because of a severals reasons. It is an implicit, higher order, multi-step solver with a step-size control and with these properties it is quite stable for a wide range of models. Furthermore it has a mature source code, which was originally developed in the eighties an initial description may be found in [Pet82].

This solver is based on backward differentiation formula (BDF), which is a family of implicit methods for numerical integration. The used implementation is called DASPK2.0 (see 2) and it is translated automatically to C by f2c (see 3).

The following simulation flags can be used to adjust the behavior of the solver for specific simulation problems: jacobian, noRootFinding, noRestart, initialStepSize, maxStepSize, maxIntegrationOrder, noEquidistantTimeGrid.

IDA

The IDA solver is part of a software family called sundials: SUite of Nonlinear and DIfferential/ALgebraic equation Solvers [HBG+05]. The implementation is based on DASPK with an extended linear solver interface, which includes an interface to the high performance sparse linear solver KLU [DN10].

The simulation flags of DASSL are also valid for the IDA solver and furthermore it has the following IDA specific flags: idaLS, idaMaxNonLinIters, idaMaxConvFails, idaNonLinConvCoef, idaMaxErrorTestFails.

Basic Explicit Solvers

The basic explicit solvers are performing with a fixed step-size and differ only in the integration order. The step-size is based on the numberOfIntervals, the startTime and stopTime parameters in the simulate command: \mbox{stepSize} \approx \cfrac{\mbox{stopTime} - \mbox{startTime}}{\mbox{numberOfIntervals}}

  • euler - order 1

  • heun - order 2

  • rungekutta - order 4

Basic Implicit Solvers

The basic implicit solvers are all based on the non-linear solver KINSOL from the SUNDIALS suite. The underlining linear solver can be modified with the simflag -impRKLS. The step-size is determined as for the basic explicit solvers.

  • impeuler - order 1

  • trapezoid - order 2

  • imprungekutta - Based on Radau IIA and Lobatto IIIA defined by its Butcher tableau where the order can be adjusted by -impRKorder.

Experimental Solvers

The following solvers are marked as experimental, mostly because they are till now not tested very well.

  • rungekuttaSsc - Runge-Kutta based on Novikov (2016) - explicit, step-size control, order 4-5

  • irksco - Own developed Runge-Kutta solver - implicit, step-size control, order 1-2

  • symSolver - Symbolic inline solver (requires --symSolver) - fixed step-size, order 1

  • symSolverSsc - Symbolic implicit inline Euler with step-size control (requires --symSolver) - step-size control, order 1-2

  • qss - A QSS solver

DAE Mode Simulation

Beside the default ODE simulation, OpenModelica is able to simulate models in DAE mode. The DAE mode is enabled by the flag --daeMode. In general the whole equation system of a model is passed to the DAE integrator, including all algebraic loops. This reduces the amount of work that needs to be done in the post optimization phase of the OpenModelica backend. Thus models with large algebraic loops might compile faster in DAE mode.

Once a model is compiled in DAE mode the simulation can be only performed with SUNDIALS/IDA integrator and with enabled -daeMode simulation flag. Both are enabled automatically by default, when a simulation run is started.

References

CK06

Francois E. Cellier and Ernesto Kofman. Continuous System Simulation. Springer-Verlag New York, Inc., Secaucus, NJ, USA, 2006. ISBN 0387261028.

DN10

T. A. Davis and E. Palamadai Natarajan. Algorithm 907: klu, a direct sparse solver for circuit simulation problems. ACM Trans. Math. Softw., 37(3):36:1–36:17, September 2010. URL: http://doi.acm.org/10.1145/1824801.1824814, doi:10.1145/1824801.1824814.

HNorsettW93

E. Hairer, S. P. Nørsett, and G. Wanner. Solving Ordinary Differential Equations I: Nonstiff Problems. Springer-Verlag Berlin Heidelberg, 2nd rev. ed. 1993. corr. 3rd printing 2008 edition, 1993. ISBN 978-3-540-56670-0. doi:10.1007/978-3-540-78862-1.

HBG+05

A. C. Hindmarsh, P. N. Brown, K. E. Grant, S. L. Lee, R. Serban, D. E. Shumaker, and C. S. Woodward. SUNDIALS: suite of nonlinear and differential/algebraic equation solvers. ACM Transactions on Mathematical Software (TOMS), 31(3):363–396, 2005.

Pet82

L.R. Petzold. Description of dassl: a differential/algebraic system solver. 1982.

Footnotes

1

Sundials Webpage

2

DASPK Webpage

3

Cdaskr source