Dymosim Integrators

All integrators support the entire range of events that are present in Modelica models, that is, state events, time events, and dynamic state selection.

New algorithms are provided along with traditional ones such as Euler, DASSL etc..

This section provides information about:

This page discusses:

Variable Step Size Integration Algorithms Output

Dymosim provides a number of variable step size integration algorithms. The most important characteristics of these algorithms are given in the following table:

Algorithm Order Stiff A-stable Dense Output Root Finder Method
LSODAR 1-12,

1-5

Both No Yes Yes Multiple step / Adams methods
DASSL 1-5 Yes No Yes Yes Multiple step / BDF
Radau Ila 5 Yes Yes Yes Yes Single step / Runge Kutta
Esdirk23a 3 Yes Yes Yes Yes Single step / Runge Kutta
Esdirk34a 4 Yes Yes Yes Yes Single step / Runge Kutta
Esdirk45a 5 Yes Yes Yes Yes Single step / Runge Kutta
Dopri45 5 No N/A Yes Yes Single step / Runge Kutta
Dopri853 8 No N/A Yes Yes Single step / Runge Kutta
Sdirk34hw 4 Yes Yes Yes Yes Single step / Runge Kutta
Cerk23 3 No N/A Yes Yes Single step / Runge Kutta
Cerk34 4 No N/A Yes Yes Single step / Runge Kutta
Cerk45 5 No N/A Yes Yes Single step / Runge Kutta
Cvode 1-5 Yes No Yes Yes Multiple step / BDF
Ida 1-5 Yes No Yes Yes Multiple step / BDF
Note: Cvode and Ida: For further details about the SUNDIALS Cvode and Ida solver, see https://computing.llnl.gov/projects/sundials/.

Fixed Step Size Integration Algorithms Output

There are four different fixed step size integration algorithms, intended for real-time simulations:

Algorithm Order Stiff Dense Output Root Finder Method
Euler 1 No No Yes Euler
Rkfix2 2 No No No Single step / Runge Kutta
Rkfix3 3 No No No Single step / Runge Kutta
Rkfix4 4 No No No Single step / Runge Kutta

Advanced Algorithms

A number of algorithms are available for an advanced use.

Few Events
If the model contains few events:
  • and is stiff: use LSODAR.
  • and is non-stiff: use DASSL.
Many Events
If the model contains many events:
  • and is stiff: use Radau Il or Esdirk (use higher order if stricter tolerance is wanted).
  • and is non-stiff: use Cerk or Dopri can (use higher order if stricter tolerance is wanted).
Sparse Solvers
If the model is suitable for sparse solvers, a message about this appears in the Messages Reporting window, the Simulation tab, the Translation part of the message tree when simulating the model.
Note: The message line is Sparse solver handling possible: false. Click the line to see the full message.

If this message appears, you can do the following to select to use sparse solvers:

  1. Set the flag Advanced.Translation.SparseActivate=true;.

    This flag is by default false.

    Note: You can only work directly with flags in the Dymola Behavior Modeling app.

  2. Select any of the following algorithms that supports sparse solvers:
    • LSODAR
    • DASSL
    • Cvode
    • Ida
    • RadauIIa
    • Esdirk23a, 34a, or 45a
    • Sdirk34hw
    For more information, see Integration Tab.
    Note: You can store the selection of algorithm in the model, but not the value of the flag.

The sparse solvers use a multithreaded (OpenMP) variant of SuperLU. The flags defining if the model is suitable for sparse solvers are already tuned to suitable values (the last one in percentage):

  • Advanced.Translation.SparseMinimumStates=90;
  • Advanced.Translation.SparseMaximumDensity=5;

The number of cores used by the multithreaded (OpenMP) variant of SuperLU can be set using the flag Advanced.Translation.NumberOfCores. If the value of the flag is set to 0 (default value) the number of cores is set to 1.

Analytic ODE Jacobians
To improve the simulation speed, you can use analytic ODE Jacobians during simulation and also during linearization. You can activate the use of analytic ODE Jacobians by the option Generate Analytic Jacobians for the ODE problem. For more information where to find this option, see Translation Tab.
Notes:
  • This option generates a large amount of C code that needs to be compiled. The speed improvement may not be as large as assumed since the case where the option is not used is also optimized.
  • There is a corresponding flag Advanced.Translation.Generate.AnalyticJacobian available for scripting.
    Note: You can only work directly with flags in the Dymola Behavior Modeling app.
  • If sparse solvers are used (see previous section) these Jacobians are stored in sparse matrix format during simulation, and is subject to sparse linear algebra.
DAE Mode
DAE (Differential Algebraic Equations) mode is supported. The DAE mode is activated by specifying the flag Advanced.Simulation.Define.DAEsolver=true. (The flag is by default false.)
Note: You can only work directly with flags in the Dymola Behavior Modeling app.

The DAE mode is supported for the algorithms (solvers):

  • DASSL
  • RadauIIa
  • Esdirk23a, 34a, or 45a
  • Sdirk34hw
  • Ida

A translated model may contain several nonlinear equation systems. (These are listed in the translation log, under Statistics.) When a DAE solver is not enabled, these equations are solved numerically whenever the integrator calls the model. When a DAE solver is enabled, the equations in the output and dynamics section of the model are not solved during calls to the model. They are instead handled by the integrator as part of the nonlinear system of equations that the integrator solves each step. If the translated model contains several or large nonlinear equation systems, then DAE solvers may be more effective since fewer nonlinear systems are solved.

For more infromation about DAE solvers, see Henningsson, Olsson, and Vanfretti: DAE Solvers for Large-Scale Hybrid Models.

Inline Integration Algorithms

Inline integration is provided to increase the simulation speed, in particular for real-time simulation.

Inline integration is a combined symbolic and numeric approach to solve differential-algebraic equations systems. Discretization expressions representing the numerical integration algorithm are symbolically inserted into the differential algebraic equation model. The equations are then transformed into a representation that is efficient for numeric simulation.

You need the Export for HILS license (HIS) to use inline integration.

The following inline integration algorithms are provided:

  • Inline Explicit Euler
  • Inline Implicit Euler
  • Inline Trapezoidal Method
  • Inline Mixed Implicit/Explicit Euler
  • Inline Explicit Runge Kutta
  • Inline Implicit Runge Kutta.
  • Rosenbrock