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 OrderStiff A-stable Dense Output Root Finder Method
LSODAR 1-12,

1-5

BothNo Yes YesMultiple step / Adams methods
DASSL 1-5Yes NoYes YesMultiple step / BDF
Radau Ila5 YesYesYes YesSingle step / Runge Kutta
Esdirk23a3 YesYesYes YesSingle step / Runge Kutta
Esdirk34a4YesYesYes YesSingle step / Runge Kutta
Esdirk45a5 YesYesYesYesSingle step / Runge Kutta
Dopri455NoN/AYes YesSingle step / Runge Kutta
Dopri8538 NoN/AYesYesSingle step / Runge Kutta
Sdirk34hw4YesYesYes YesSingle step / Runge Kutta
Cerk233 NoN/AYesYesSingle step / Runge Kutta
Cerk344NoN/AYes YesSingle step / Runge Kutta
Cerk455 NoN/AYesYesSingle step / Runge Kutta
CvodeVariableYesNoYesYesMultistep
Note: Cvode: For further details about the SUNDIALS CVODE solver, see https://computation.llnl.gov/casc/sundials/main.html.

Fixed Step Size Integration Algorithms Output

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

AlgorithmOrderStiff Dense OutputRoot Finder Method
Euler 1No NoYes Euler
Rkfix2 2NoNoNo Single step / Runge Kutta
Rkfix3 3NoNoNo Single step / Runge Kutta
Rkfix4 4NoNoNo 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.SparseActivate=true;.

    This flag is by default false.

  2. Select any of the following algorithms that supports sparse solvers:
    • LSODAR
    • DASSL
    • Cvode
    • 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.SparseMinimumStates=90;
  • Advanced.SparseMaximumDensity=5;

The number of cores used by the multithreaded (OpenMP) variant of SuperLU can be set using the flag Advanced.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.GenerateAnalyticJacobian available for scripting.
  • 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.

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