Opened 6 years ago

Last modified 5 years ago

#5139 closed defect

Initialization failures due to min/max and assert() violations do not trigger the homotopy-based initialization — at Version 3

Reported by: Francesco Casella Owned by: Andreas Heuermann
Priority: high Milestone: 1.16.0
Component: Run-time Version:
Keywords: Cc: Lennart Ochel, Karim Adbdelhak, Adeel Asghar

Description (last modified by Francesco Casella)

Please run this model

model Test
  Real x(min = 0);
  Real y(start = 0, fixed = true);
equation
  0 = homotopy(1e-6*x + sin(x+0.5),
               x-2.65);
  der(y) = x;
  annotation(__OpenModelica_commandLineOptions = "-d=nowarnMinMax");
end Test;

The simulation fails with

assert | warning | The following assertion has been violated at time 0.000000 x > = 0.0
assert | error | Variable violating min constraint: 0.0 <= x, has value: -0.5
assert | info | simulation terminated by an assertion at initialization
stdout | error | Simulation process failed. Exited with code -1.

The User's Guide says about -homotopyOnFirstTry:

If the model contains the homotopy operator, directly use the homotopy method to solve the initialization problem. Without this flag, the solver first tries to solve the initialization problem without homotopy and only uses homotopy as fallback option.

If this was actually done, homotopy would ensure the convergence of the nonlinear solver to the positive solution, which would then be accepted by the min/max checks.

A similar issue takes place with ModelicaTest.Blocks.LimitersHomotopy, which currently fails with the message:

Regular simulation: ./ModelicaTest_3.2.3_ModelicaTest.Blocks.LimitersHomotopy -abortSlowSimulation -alarm=480   
assert            | warning | The following assertion has been violated during initialization at time 0.000000
|                 | |       | abs(mustUseHomotopy.x - 100.0) < 1e-06
assert            | error   | Wrong solution selected
assert            | info    | simulation terminated by an assertion at initialization

as well as many other test cases in ModelicaTest.

In both cases I would suggest to print out the following notification message:

Invalid initial solution obtained without homotopy. Trying with homotopy-based initialization. You can skip the attempt without homotopy with the -homotopyOnFirstTry simulation flag.

then restart the solution process with the homotopy-based solver.

Change History (3)

comment:1 by Francesco Casella, 6 years ago

Milestone: 1.13.01.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:2 by Francesco Casella, 6 years ago

Cc: Lennart Ochel Andreas Heuermann added
Description: modified (diff)
Owner: changed from Willi Braun to Andreas Heuermann
Status: newassigned
Summary: Initialization failure due to min/max violations do not trigger the homotopy-based initializationInitialization failures due to min/max and assert() violations do not trigger the homotopy-based initialization

Widened the scope of the ticket and made it a blocker for 1.14.0, as it involves ModelicaTest 3.2.3. Should be a quick fix.

Andreas, Karim, Lennart, please have a look and decide who takes care of it.

comment:3 by Francesco Casella, 6 years ago

Cc: Karim Adbdelhak added; Andreas Heuermann removed
Description: modified (diff)
Note: See TracTickets for help on using tickets.