Default absolute tolerance and relative tolerance

I write the following in the context of FE modelling rather than numerical analysis. I.e. this should be interpreted as tips and tricks. Perhaps someone else can contribute something more rigorous, or their own experience.

Do you know what to expect the residual of your system to be to machine precision?

Adjust your absolute tolerance accordingly. E.g:

  • A Poisson problem with a diffusion coefficient of 1 may yield a residual to machine precision around 10^{-12}.
  • Linear elasticity with a Young’s modulus of 10^9, convergence to machine precision you may see with a residual of around 10^{-3}.

Do you have no a priori information about the magnitude of the residual to machine precision?

Set the relative error tolerance accordingly, e.g. a relative tolerance of 10^{-12} is very precise.

Do you only care about solving your system in a loose approximate sense

Use a larger relative tolerance. This number should still be chosen based on your remaining knowledge of the numerical model.

Is your problem linear?

Make sure it converges in one iteration. If it does not, your system is not well defined. Newton’s method applied to a linear problem is equivalent to solving that linear problem.

Is your problem nonlinear, well posed, and the solution is smooth?

Ensure you have at least quadratic convergence of the residual between iterations. Otherwise you have a malformed Jacobian.

Does your Newton solver fail on the first step producing NaNs?

You likely have an initial guess leading to singularities in the Jacobian/residual. E.g: for a solution variable u

  • Zero initial guess with coefficients of the type 1/u or \sqrt{u}
  • Piecewise constant initial guess when invoking \nabla u^{-1} or \sqrt{\varepsilon_{\mathrm{II}}(u)}

Does the Newton solver converge initially, then diverge and blow up?

Try easing the relaxation parameter, or design a more sophisticated relaxation parameter e.g. here. This should encourage convergence for “highly nonlinear” problems.

Does the Newton solver slowly diverge or get stuck?

Ensure your initial guess is sufficiently in an attractor region.

25 Likes
Advice on: Newton solver does not converge
Newton Solver does not converge for nonlinear coupled field problem
Error while trying to solve coupled PDEs
Spatial Derivatives in non linear coefficient
Non integer power doesn't work
Conjugate gradient solver for nonlinear variational Problem
Error: Newton solver did not converge
Newton Solver issue with an non zero initial guess
Time-dependent nonlinear reaction-diffusion not proceeding in time loop
RuntimeError: Newton solver did not converge because maximum number of iterations reached
Getting residual "nan" from the start
Robin bcs with local gradient dependence
Unable to solve linear system using PETSc Krylov solver
Form compiles differently inside vs outside time loop [3D elasticity]
Solving a system of coupled PDEs in fenicsx
Runtime error while trying to solve a non linear equation with periodic boundary condition
The solution speed is very slow
Comment my code + many questions
Newbie questions around solving the brusselator equations
The solution speed is very slow
Newton iteration 0: r (abs) = 0.000e+00 (tol = 1.000e-10) r (rel) = -nan (tol = 1.000e-09) Newton solver finished in 0 iterations and 0 linear solver iterations
Cannot solve nonlinear PDE
Newton solver convergence for differential materials Young's modulus E
Solving a system of coupled PDEs in fenicsx
Newton solver residual returns NaN after 2 iterations
Unable to access vector of degrees of freedom
Newton solver converge initially, then diverge and blow up
About NewtonSolver error in Dolfin
Solving a BVP for a system of 2nd order ODEs
Failed convergence in PETSc (large non-linear problem)
Error out of memory
Navier-Stokes with a Lorentz force term
Nonlinear variational problem with user specified function
Coupling resulting in inappropriate deformation
PETSc Krylov Solver RuntimeError with fine mesh
Residual is nan
Non linear solver fails to converge. Is there a thumb-rule to avoid this in the future?
Problem with PETSc solver. error code 77
Modified Euler Equations with dolfin_dg
Fenics Nan for solving PDEs systems
Formulation with grad of function squared
Problem with setting initial conditions and history variable
PETSs Error Code 63 when trying to do Nonlinear Problem