modelicadymola

How to get a Modelica (Dymola) Simulation running, that fails because of: "Warning: Failed to solve nonlinear system using Newton solver."


I am currently trying to rebuild the model presented in the paper "Strategies for a transition towards a solar district heating grid with integrated seasonal geothermal energy storage" (https://ideas.repec.org/a/eee/energy/v228y2021ics0360544221009117.html) but always run into the problem, that the simulation fails because Warning: Failed to solve nonlinear system using Newton solver.

For the model i am trying to use the MoSDH Library (https://github.com/MoSDH/MoSDH).

I can't upload my model in this forum, but i am happy to share it with everyone who is interested in looking into my problem.

I will add the last lines of the error message to give a better understanding of my problem.

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: simulation.nonlinear[27]
Homotopy reducing

Warning: Failed to solve nonlinear system using Newton solver.
  During initialization at time: 0
  Tag: simulation.nonlinear[27]
Error: Integrator failed to start model.

... Error message from dymosim

ERROR: The simulation of FormhalsModellNachbau.SolarThermalTest3 FAILED

I already tried the Dassl and Cvode solving cases, which are supposed to be the best working ones. Both reached the same problem.


Solution

  • That's a common issue in Modelica modelling/simulation projects.

    The mathematically correct name for this "Nonlinear Systems" is implicit algebraic equation systems. If they exist your model is a so called DAE and not an ODE.

    Usually Dymola solves the DAE by embedding Newton solvers for each algebraic system and exposing the resulting overall system to an ODE solver.

    But this Newton iterations can fail, as you have experienced. I would recommend the follwing ways to solve it:

    1. Get rid of the algebraic systems
    2. Provide better start values for the iteration variables
    3. Analyze residual functions and improve it (e.g. extrapolation, avoid zero slope)

    Point 1 is the most important one. You need to understand and break the algebraic loops. Typical causes are:

    We have published a Blog Article exactly about this topic.