Platform: All Platforms Versions: All versions

Problem Description

When I look at the Solver Log of a time dependent model, I see that the NLFail column has non-zero entries:

Step TimeStepsize Res JacSolOrderTfailNLfailLinErrLinRes
0 0-out 23208e-14 3.5e-15
1 0.10.1115111012.6e-162.4e-16
... ..............................

What does this mean?

When solving a time dependent model, I get an error message similar to:

Nonlinear solver did not converge.
Maximum number of Newton iterations reached.
Time : 0.15582918651998362
Last time step is not converged.

What changes can I make to the solver settings to fix this?


The time dependent solver is computing the solution to a possibly nonlinear system of equations at each timestep via a set of iterative techniques based upon Newton's method. If these iterative techniques fail at any timestep, the NLFail column will get incremented. These Newton's method techniques for solving a nonlinear system of equations evaluate a function, as well as its derivative, at every timestep. This derivative is also known as the Jacobian and is relatively expensive to compute. Therefore the software will try to minimize reevaluating the Jacobian, by default. If the nonlinear solver has difficulty converging, it will reduce the requested timestep size and try to compute the solution. When the timestep is reduced, the Tfail column is incremented. This is a good approach if the solution fields vary rapidly in time.

However this can be a suboptimal approach, or may not work at all, if the model has strong nonlinearities. Such nonlinearities can arise as a consequence of material properties being a function of the solution, or due to feedback equations such as, for example, when using the Current- or Power-type Terminal conditions in the Electric Currents physics interface.

The resolution can be to update the Jacobian on every iteration that the nonlinear solver takes as it tries to compute the solution at each timestep. To do so, expand out the Study settings and go to the Time-Dependent Solver branch, Fully Coupled subfeature, Method and Termination section. Modify the Jacobian update: to be On every iteration rather than Minimal, as shown below. This change can often be enough.

Fully Coupled Settings

Modified settings in the Fully Coupled feature.

However, sometimes the nonlinear problem at every timestep is so strongly nonlinear that the Newton's method is still not able to converge, even with an updated Jacobian. The next setting to change is the Maximum number of iterations, which has a default value of 4 . Increase this to 25, or higher. Next, adjust the Tolerance factor: setting. Its default value of 1 means that the relative tolerance setting is being used, as specified in the Time Dependent Study Step. The default value of the relative tolerance is 0.01 and the Tolerance Factor: multiplies this number, so setting the Tolerance factor: to 0.1 in this case would result in a relative tolerance of 0.001 used for the nonlinear problem at each timestep. Thus, as you tighten the time-dependent solver relative tolerance setting, you can usually relax the tolerance factor.

If your model is still not converging, change the Nonlinear method: setting from Constant (Newton) to Automatic (Newton) which implements a damped Newton's method approach. This automatically updates the Jacobian and uses a dynamic damping term, it is therefore more computationally expensive. The Automatic highly nonlinear (Newton) is similar, but starts with more damping, and will be slower but more likely to converge.

Your model may, by default, be using a segregated approach. This is often the case when solving multiphysics problems and is usually reasonable since the strong nonlinearities often affect just one of the physics in the model. Within the segregated solver each segregated step represents the solution to a different physics and is being solved separately, again using some variation of Newton's method. You can make similar modifications as described above, but just to one segregated step, as motivated by the nonlinearities present. That is, if a material or feedback nonlinearity is present in only one physics, you probably only need to modify the settings for that physics, as shown in the screenshot below.

Modified settings in the Segregated Step feature.

If you are solving a multiphysics problem and suspect that there are strong nonlinearities between the physics, then switch from the segregated to fully coupled approach, as described in Knowledge Base 1258: Understanding the Fully Coupled vs. Segregated approach. You may still need to adjust the settings as described earlier.

If you are primarily observing that the Tfail column in the solver log is being incremented often, enable the Nonlinear controller within the Time Stepping settings as shown in the screenshot below. This will enable more efficient time-step control in the BDF method, especially for highly nonlinear models. Note that the Tfail column can get incremented even for a model without nonlinearities, in which case it is better to tighten the solver relative tolerance.

Enabling the nonlinear controller.

Lastly, keep in mind that you will always need to perform both a relative tolerance refinement study, as described here: Knowledge Base 1254: Controlling the Time-Dependent Solver Timesteps, and a mesh refinement study, as described here: Knowledge Base 1261: Performing a Mesh Refinement Study, to verify the accuracy of your model.