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: Francesco Casella Owned by: Karim Adbdelhak
Priority: critical Milestone: 1.16.0
Component: Run-time Version:
Keywords: Cc: Andrea Bartolini, Andreas Heuermann

Description (last modified by Francesco 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 Francesco Casella 4 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Francesco Casella, 4 years ago

Cc: Andrea Bartolini added
Description: modified (diff)
Summary: The default nonlinear solver accepts solution which are not fulfilling NewtonXTolThe default nonlinear solver accepts solutions which are not fulfilling NewtonXTol

by Francesco Casella, 4 years ago

Attachment: TestNewton.mo added

comment:2 by Francesco Casella, 4 years ago

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

Cc: Andreas Heuermann added
Owner: changed from Andreas Heuermann to Karim Adbdelhak
Status: newassigned

comment:4 by Karim Adbdelhak, 4 years ago

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 by Karim Adbdelhak, 4 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.