Opened 8 years ago

Last modified 3 years ago

#4396 reopened defect

IDA solver in DAE mode is inefficient with badly scaled systems — at Initial Version

Reported by: Francesco Casella Owned by: Willi Braun
Priority: high Milestone:
Component: Run-time Version:
Keywords: Cc:

Description

Modelica models are often badly scaled because of the recommended use of variables in SI units, which often causes variables in the same model to differ by many orders of magnitude, up to 15 or more.

The Modelica language allows to define nominal values for the scaling of variables, that can be used to set up properly scaled numerical problems in the runtime code. However, this mechanism seem not to work properly when using the IDA solver in DAE mode.

The attached test case shows clearly the problem. The model is taken from #4395, with the end displacement d_tot no longer being a constant, but rather the solution of the trivial differential equation der(d_tot)=1.

Test1 is natively scaled in a benign way, with all variables of the order of unity or, in the worst case, of 1e-3.

Test2 is the same model as Test1 with much higher stiffness constants, so that some of the unknowns during integration (the vector F[N]) now have order of magnitude 1e8. Note that, apart from the scaling factor, the solution has exactly the same shape.

Test3 is the same model as Test2, with the proper nominal attribute set on the vector F[N]. In principle, if the model gets properly scaled according to this information, Test3 should numerically become exactly the same as Test1, and thus take more or less the same time to be solved. Note that is is only true if both the variables and the residuals are properly scaled.

The following table summarizes the results obtained on my PC with running omc v1.12.0-dev-354-gadf56d3 on Windows

Test Steps functionODE calls Jacobian evaluations Simulation time
Test1 183316 8.17
Test2 162614 97.30
Test3 162614 100.85

Analyzing the results, one can take the following conclusions

  • the number of steps is only decided by the trivial differential equation, and is thus roughly constant
  • the time spent solving each step grows 10-fold for the badly scaled problem, though this only basically reflects a change in the units of variable F[N], not a change in the nature of the problem
  • setting the nominal attribute on the badly scaled variables does not improve the situation - in fact, it makes it slightly worse

One can expect that similar problems will arise when using IDA in DAE mode to solve real-life problems; as soon as the units of the variables are such that their order of magnitude is much different, there will be a performance penalty of one order of magnitude (or possibly more, for larger models) in terms of simulation time.

I would suggest to investigate why this happens and to introduce the appropriate corrective measures, so that the simulation time of models Test1 and Test3 becomes comparable.

Change History (0)

Note: See TracTickets for help on using tickets.