This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How is the residual calculated for the Newton solver?

0 votes

When solving a nonlinear variational problem I would assume the residual for each newton iteration is calculated by a L2 norm but I can't find documentation to confirm that. How is the residual calculated? Can I modify how it is calculated? When I get the following output what is the difference between r (abs) and r (rel)?

Solving nonlinear variational problem.
Newton iteration 0: r (abs) = 1.149e+01 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
Newton iteration 1: r (abs) = 2.535e-03 (tol = 1.000e-10) r (rel) = 2.207e-04 (tol = 1.000e-09)
Newton iteration 2: r (abs) = 4.556e-09 (tol = 1.000e-10) r (rel) = 3.965e-10 (tol = 1.000e-09)
Newton solver finished in 2 iterations and 2 linear solver iterations.

asked Jul 13, 2016 by aldenpack FEniCS User (1,450 points)

1 Answer

0 votes

Have a look at dolfin/nls/NewtonSolver.cpp on line 263 to see the computation of the norm of the residual vector (l2 norm), absolute and relative residual (scaled by the residual at iteration 0).
Not sure whether it is possible to add a new stopping criterion.

answered Jul 17, 2016 by francesco.ballarin FEniCS User (4,070 points)
...