Jack
Jack

Reputation: 1242

How to improve the convergence performance of Dymola?

Recently I am working with fluid modeling with Modelica, but I come across a lot of divergence problems of nonlinear equations, like in the following screenshot. enter image description here

So I am considering if it is possible to use the min/max/nominal attributes of variables to improve the model's convergence, especially when a user comes across the nonlinear solver failure. According to the answer of this question on StackOverflow, min/max attributes won't help convergence, and based on the Modelica Specification 4.8.6, nomial attributes are used to determine appropriate tolerances or epsilons, or may be used for scaling.
So my question is:
If I meet this kind of divergence problem caused by the nonlinearity of my model, how could I help the compiler to get convergence better and quicker?
Someone might suggest better start values of variables used as state variables, but when I am dealing with large models, I am not sure how to find the specific state variables of which I should modify the start values.

Upvotes: 1

Views: 287

Answers (3)

Hans Olsson
Hans Olsson

Reputation: 12517

Adding to the answer by Imke Krueger. If the models fail after 2917 s one possibility is that the solution was diverging before that, with e.g., enthalpy decreasing further and further until the model has left the valid regions.

Assuming it happened fairly slowly it is best to plot the states and other variables in that components. Additionally the states dominating the error as indicated in the answer by Imke Krueger and see if any of them seem to diverge.

If it happened more quickly:

  • Log events and check whether something important like a flow reversal just happened before that time.
  • Disable equidistant output, as it is possible that the model diverged between two output points.

Upvotes: 1

Imke Krueger
Imke Krueger

Reputation: 786

Chapter 2.6.13 "Online diagnostics for non-linear systems" in manual 1B and following in the manual should help. You can e.g. list states that dominates error: usually these states are a good hint where to start your improvements.

Upvotes: 3

Atiyah Elsheikh
Atiyah Elsheikh

Reputation: 578

An eigenvalue-based analysis of the Jacobin at time = 0 provides a ranking of state-variables from most significant to the least one. That could be a heuristic to examine the influence of start variables of most significant state-variables.

What could be also helpful is to conduct a similar analysis a little time before the problem occurs.

Also there is a possibility to compute dynamic parameter sensitivities of state variables (before the problem occurs) w.r.t. start values, see e.g. https://github.com/Mathemodica/DerXP for a suggested approach. This gives you a hint which start values significantly influences the values of state variables.

Upvotes: 0

Related Questions