Opened 4 years ago

Closed 4 years ago

#6106 closed defect (fixed)

The default nonlinear solver accepts solutions which are not fulfilling NewtonXTol

Reported by: casella Owned by: Karim.Abdelhak
Priority: critical Milestone: 1.16.0
Component: Run-time Version:
Keywords: Cc: Andrea.Bartolini, AnHeuermann

Description (last modified by casella)

Consider the attached test package. The test case represents a simple thermo-hydraulic system with a fixed pressure and temperature source, two series-connected laminar pressure losses and a variable volume, that breathes air in and out through the two pressure losses.

The two series-connected components generate a nonlinear system of equation in the regular section, which is torn and results in a system with two iteration variables p1 and p2.

If you simulate Test1, the simulation fails at time 0.32. Some analysis reveals that the derivative of the state p2rel is very noise, and that depends on the fact that w is also very noisy. This noise fools the error estimator of the ODE solver, causing it to reduce the time step and to eventually fail because it cannot guarantee the required tolerance.

By running the test with LOG_NLS_V turned on, several messages "NO ITERATION NECESSARY" pop up, at time instants corresponding to the spikes in w and der(p2rel). It seems that the code of the default nonlinear solver checks the residuals of the nonlinear system at each new time step, and in case they are below the tolerance NewtonFTol they accept the solution. This is not good, because also the tolerance on the unknowns NewtonXTol should be checked, triggering a few iterations of the solver and guaranteeing that not only the residual is small, but also that the solution is precise enough.

This problem only affects systems which are badly conditioned from a numerical point of view, but this often happens with thermo-hydraulic systems, in particular when components with small pressure losses are included in the circuit.

For the record, Test2 usese the KINSOL solver, which is not affected by this issue, resulting in the simulation to be successful and only require 14 steps.

Attachments (1)

TestNewton.mo (2.5 KB) - added by casella 4 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 4 years ago by casella

  • Cc Andrea.Bartolini added
  • Description modified (diff)
  • Summary changed from The default nonlinear solver accepts solution which are not fulfilling NewtonXTol to The default nonlinear solver accepts solutions which are not fulfilling NewtonXTol

Changed 4 years ago by casella

comment:2 Changed 4 years ago by casella

PR 6731 fixes the issue, by removing the test that shortcuts the Newton iterations in case the residual is already below the threshold with the initial guess coming from the previous simulation step.

comment:3 Changed 4 years ago by casella

  • Cc AnHeuermann added
  • Owner changed from AnHeuermann to Karim.Abdelhak
  • Status changed from new to assigned

comment:4 Changed 4 years ago by Karim.Abdelhak

The PR is pushed and the problem is fixed. We now will make one newton step no matter what.

This is needed to ensure that not only the residual error norm, but also the error norm for variables is checked when accepting a solution. The latter can only be computed if at least one step was made.

comment:5 Changed 4 years ago by Karim.Abdelhak

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.