OpenModelica icon indicating copy to clipboard operation
OpenModelica copied to clipboard

Wrong simulation results when using simflags -nls="hybrid" or -nls="kinsol"

Open bernhardbachmann opened this issue 3 years ago • 3 comments

Description

Please consider the attached test case GridBaseBreakers.mo.txt

Running this model with the default non-linear solver "hybrid" produces errors at time 83.093 and later as well as the simulation results are not as expected. . Running the same model with Kinsol produces even worse results. Running the same model with the non-linear solver "homotopy" or "newton" works just fine.

Steps to Reproduce

To reproduce the error please use the attached script file GridBaseBreakers.mos.txt

Screenshots

Wrong result using -nls="hybrid": WrongResult

Wrong result using -nls="kinsol": WrongResultKinsol

Correct result using -nls"homotopy": CorrectResult

Version and OS

  • OpenModelica Version: OMCompiler v1.19.0-dev.603+g56e1f47568

bernhardbachmann avatar Feb 21 '22 10:02 bernhardbachmann

A similar behaviour took place with models from the PowerGrids library. In fact, all these models are best solved with daeMode for efficiency reasons (the jacobian in daeMode is sparse, while it becomes dense in odeMode).

In any case, there is no reason why odeMode simulation should produce wrong results, and this bug could also affect models where there is no advantage in using daeMode, so we need to figure out why this happens and fix it.

casella avatar Feb 21 '22 10:02 casella

I made further test with the basic model of the PowerGridDae library GridBase.mo model. See attached file GridBase.mo.txt

The solution of the problem highly depends on the tearing method used. Please look at the attached scripting file for the exact settings: GridBase.mos.txt

--tearingMethod=cellierTearing (default), -nls="hybrid" cellierTearing_hybrid

--tearingMethod=cellierTearing (default), -nls="homotopy" cellierTearing_homotopy

--tearingMethod=omcTearing, -nls="hybrid" omcTearing_hybrid

--tearingMethod=omcTearing, -nls="homotopy" omcTearing_homotopy

bernhardbachmann avatar Feb 21 '22 18:02 bernhardbachmann

Well, these plots are really awful. Apparently, tearing picks some iteration variables that have a low sensitivity on the solution.

However, all this noise has a visible influence on the state variables, and those have error control. I find it really weird that such solutions, with completely bogus oscillations on the omega and theta states, are accepted.

casella avatar Feb 21 '22 23:02 casella