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 )
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)
Change History (6)
comment:1 by , 4 years ago
Cc: | added |
---|---|
Description: | modified (diff) |
Summary: | The default nonlinear solver accepts solution which are not fulfilling NewtonXTol → The default nonlinear solver accepts solutions which are not fulfilling NewtonXTol |
by , 4 years ago
Attachment: | TestNewton.mo added |
---|
comment:2 by , 4 years ago
comment:3 by , 4 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:4 by , 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 , 4 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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.