Quick guide to choosing a Solver (Integration Algorithm), Tolerance and Output Interval in Dymola

In this blog post I will describe how to get started choosing your solver, tolerance and output interval in Dymola.

We also published another blog post on the subject of tolerance should you wish to learn more detail in this area: A closer look at solver tolerance

Figure 1. Snapshot of the Dymola Simulation Setup dialog

Figure 1. Snapshot of the Dymola Simulation Setup dialog

Integration

Algorithm: Fixed or variable step solver?

I nearly always simulate a model experiment using a variable step solver. Why, you ask? Because by the variable step solver will automatically adjust the solver time step in relation to the dynamics that are occurring in the model during simulation.

Large time step: Calculates the results less frequently

Smaller time step: Calculates the results more often

Take the example of a building. When the boiler has switched on and got up to temperature and is providing hot water to the radiators in the rooms at a near constant flow and the rooms are gradually warming up, the solver can take larger time steps because the changes in the state variables are gradual. When on the other hand the boiler has been off all night and has cooled down and it suddenly switches on in the morning to heat the house, there will be significant dynamics within the boiler (rapid changes in state) and temperatures of the components will rise very quickly. This situation requires a smaller solver time step to be able to capture those rapid changes for us.

Take the example of a car being simulated with automatic transmission. During cruising, not much is changing in terms of state and therefore the solver can afford to take larger time steps. During fast accelerations and during gear changes, the dynamics in the model will be faster and therefore will require a smaller solver time step to calculate the solution for us.

A variable step solver will do this for us automatically.

If we use a fixed step solver, we will need to choose a solver time step that allows the simulation to run successfully and this will generally be the smallest time step that is necessary to solve the parts of the simulation with fast dynamics. We will therefore be using a potentially very small solver time step for the entire simulation which is not efficient for models with large transients and near steady state conditions.

Tolerance

More details can be found here: A closer look at solver tolerance

Generally speaking most experiments will yield reliable results with tolerances ranging between 1e-7 and 1e-4. The more fast dynamics there are in the model, the smaller the tolerances are that we usually set. I would start with the default 1e-4 then re-simulate the experiment using a smaller tolerance, for example, 1e-5 and observe if there are any significant changes in the state variable values. If there are, then you could go down a step further and try 1e-6 for example until there are no noticeable changes in results. Fluids models will generally require a tolerance of 1e-5 or smaller.

If you find yourself having to use tolerances smaller than 1e-7 or larger than 1e-4, I would start questioning the model itself and its robustness. We can help you with that through our advanced support and training. Please get in touch for more details about our training courses

Output interval

Interval length

The output interval relates to how often the results get sampled and written to file. I like to choose a specific output interval (interval length) which normally ranges from 600 seconds for building simulation to microseconds if I am interested in inverter switching dynamics. If your plots look quite jagged and spiky, even when you zoom in, it is likely that it’s because the output interval is quite large. Make sure the output interval is small enough to capture the detail you require which is very important when following my method described in the section above, choosing a “tolerance” value.

N.B. If you also have Store variables at events selected (see Figure 2) then Dymola will additionally store two data points at each state event occurrence irrespective of the settings you chose for Interval length or Number of intervals.

Figure 2.  Snapshot of the Output tab of the Simulation Setup dialog

Figure 2. Snapshot of the Output tab of the Simulation Setup dialog

My approach summary:

  • Run experiment using default solver and tolerance settings (Dassl, 1e-4)
  • If the model struggles to run with Dassl, try the Radau solver or reduce the default tolerance by a factor of 10.
  • Adjust the Output Interval to capture the model detail (beware that output intervals smaller than 1e-3s will potentially impact simulation speed as it will be writing results to file very frequently).
  • Decrease tolerance by a factor of 10 and assess any changes in results to see whether it was necessary to go to a smaller tolerance.

If you are struggling to get your models to run, please get in touch as there are multiple ways we could assist you.

Written by: Alessandro Picarelli – Engineering Director

Please get in touch if you have any questions or have got a topic in mind that you would like us to write about. You can submit your questions / topics via: Tech Blog Questions / Topic Suggestion.

CONTACT US

Got a question? Just fill in this form and send it to us and we'll get back to you shortly.

Sending

© Copyright 2010-2025 Claytex Services Ltd All Rights Reserved

Log in with your credentials

Forgot your details?