Opened 6 years ago

Last modified 3 years ago

#5256 assigned defect

Non-linear system iterations

Reported by: contacto@… Owned by: Francesco Casella
Priority: high Milestone:
Component: Run-time Version: v1.13.0-dev.beta1
Keywords: non-linear solver, external function Cc:

Description

Good afternoon,

I'm modeling thermo-fluid systems with OpenModelica.

These vectorial equations "produce" an algebraic loop (see model "AlgebraicLoop.test"):

Dn = VaporDn(P = P, T = T);
Hn = VaporHn(P = P, T = T);

The thermo functions are highly dependent on temperature.

Every time that the algebraic loop is solved, a lot of iterations are needed:

############ Solve nonlinear system 37 at time 1 ############
initial variable values:
[ 1]                       volume.P  =        100169.17         nom =           100000
[ 2]                       volume.T  =        499.97788         nom =              300
Solution status: SOLVED

number of iterations           : 1263

number of function evaluations : 4588

number of jacobian evaluations : 1263

solution values:
[ 1]                       volume.P  =        100169.17
[ 2]                       volume.T  =        499.97788

Even when the initial values are really close to the solution, a lot of iterations are needed. Why is this happening?

My time step is 1 second and the solver dassl.

The thermo belongs to my company, is there a way to share the package only with the developers?

Thanks in advance

Jose

Attachments (1)

AlgebraicLoop.zip.gpg (64.9 KB ) - added by contacto@… 6 years ago.
Test library

Download all attachments as: .zip

Change History (8)

comment:1 by Francesco Casella, 6 years ago

Some actions you can try

  • set the nominal attribute of P to 1e5, and the nominal attribute of D to 500 (if you are using Modelica.SIunits type, this is not necessary, as there are already good defaults for the nominal attribute). This is used to produce scaled results, which usually improves convergence for badly scaled systems
  • try the kinsol nonlinear solver instead of the default one (simulation flag -nls=kinsol)
  • try the simulation flag -newtonFTol=1e-10 (the default is 1e-12, which may be too tight if the VaporDn and VaporHn functions are numerically noisy)

To send the model you can encrypt the source code files as explained here and then attach it to the ticket

comment:2 by contacto@…, 6 years ago

Thanks for the quick answer and sorry for the delay (I was in my honeymoon).

The nominal values and the Newton tolerance didn't change the number of iterations.

Kinsol is worse in this case because of this message:

{{{[1] Real volume.P(start=99493, nominal=100000)
[2] Real volume.T(start=773.15, nominal=500)
Fatal error on line 900, column 10: tag mismatch}}}

The library that contains the model is encrypted and attached.

Thanks!

Jose

by contacto@…, 6 years ago

Attachment: AlgebraicLoop.zip.gpg added

Test library

comment:3 by Francesco Casella, 6 years ago

Component: *unknown*Run-time
Milestone: Future1.14.0
Owner: changed from somebody to Francesco Casella
Status: newassigned

comment:4 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:5 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:6 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:7 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.