Default absolute tolerance and relative tolerance

Dear All, I have a quick question about the absolute and relative tolerance of Newton solver in FeniCS, does anybody know what is the default value for these two tolerances in FeniCS? Thanks!

See here.

1 Like

Hello Nate, thank you so much for pointing me this, It’s very helpful! I guess these are the recommended values for absolute and relative tolerance in general, right? Is there any criteria for choosing these tolerance, in other words, is there an upper bound for the acceptable tolerance values? I guess for different problems in reality, the convergence behaviors will be quite different.

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.


Hi Nate, Thank you so much for the kind help!

1 Like