Improving convergence in nonlinear time dependent models

Solution Number: 1127
Title: Improving convergence in nonlinear time dependent models
Platform: All Platforms
Applies to: All Products
Versions: All versions
Categories: Solver

Problem Description

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. These iterative techniques evaluate a function, as well as its derivative, at every timestep. The derivative is also known as the Jacobian and is relatively expensive to compute. Therefore the software will try to minimize the reevaluation of the Jacobian, by default. If the solver has difficulty converging, it will instead reduce the requested timestep size and try to compute the solution. 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.

  • Note: Before making any of the solver changes described below, make certain that your model is well-posed. Examine the nonlinearities in your model and any feedback conditions and try to estimate what kind of response they will produce for your given inputs. If the solution shoots off to infinity due to positive feedback, for example, the solver will not be able to capture this. A non-converging model can often be a sign of an incorrectly, or incompletely, set up model.

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 in 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. In this case each segregated step is being solved separately, again using some variation of Newton's method. You can make similar modifications as described above, but only to one particular steps as motivated by the nonlinearities present. That is, if a material or feedback nonlinearity is present in only one physics, you only need to modify the settings for that physics.

Segregated Solver Settings

Modified settings in the Segregated Step feature.

Alternatively, if the non-convergence is happening when a load or boundary condition is changing abruptly in time, use Events as described in Knowledge Base 1245: Solving Models with Pulsed Loads in Time.

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.


COMSOL makes every reasonable effort to verify the information you view on this page. Resources and documents are provided for your information only, and COMSOL makes no explicit or implied claims to their validity. COMSOL does not assume any legal liability for the accuracy of the data disclosed. Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark details.