Opened 6 years ago

Last modified 3 years ago

#5208 accepted defect

IDA with dense numerical jacobian doesn't work well

Reported by: Francesco Casella Owned by: Willi Braun
Priority: high Milestone:
Component: Run-time Version:
Keywords: Cc: federico.terraneo@…

Description

Please run the following test model in OMEdit

model Thermal1D
  parameter Integer nx = 100;
  parameter Real g = 0.0314785;
  parameter Real c = 0.2707936;
  parameter Real Thi = 400;
  parameter Real Tlo = 0;
  Real T[nx];
initial equation
  for x in 1:100 loop
    T[x] = Tlo;
  end for;
equation
  c * der(T[1]) = g * (T[2] - T[1]) + 2 * g * (Thi - T[1]);
  c * der(T[nx]) = g * (T[nx - 1] - T[nx]) + 2 * g * (Tlo - T[nx]);
  for x in 2:nx-1 loop
    c * der(T[x]) = g * (T[x - 1] - T[x]) + g * (T[x + 1] - T[x]);
  end for;
  annotation(
    experiment(StartTime = 0, StopTime = 100000, Tolerance = 1e-06, Interval = 200),
    __OpenModelica_simulationFlags(s = "ida"));
end Thermal1D;

The whole simulation, using the IDA solver, takes about 345 steps, computed in 0.04 s on my laptop.

Now, re-simulate the system choosing the (dense) numerical option of Jacobian computation. This time, the solver has lots of trouble increasing the step above a certain value, so it takes about 60000 steps and over 3 s to complete the simulation, and there are 29000 convergence test failures of the solver.

This is rather weird, because the system is 100% linear, so there shouldn't be any convergence problem of the BDF algorithm with arbitrarily large time steps, nor should the computation of the Jacobian be problematic by any means. The system is intrinsecally well-scaled, without the need of resorting to nominal attributes for improved scaling.

Coloured numeric jacobian works fine, so there is probably little reason to use the full 'dumb' numerical Jacobian, except for performance comparison reasons. In any case, if an option (numerical Jacobian in this case) is available, it should work correctly, otherwise I'd suggest to rather remove it.

Change History (6)

comment:1 by Willi Braun, 6 years ago

Status: newaccepted

Actually the pure numerical option is not supported by the IDA solver.

comment:2 by Francesco Casella, 6 years ago

Milestone: 1.13.01.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:3 by Francesco Casella, 5 years ago

Milestone: 1.14.01.16.0

Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0

comment:4 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:5 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:6 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.