Several quick questions about the tolerances in FEniCSX

Hi all, I have several quick questions about the residual tolerances in FEniCSX:

(1) What is the definition of the relative and absolute tolerances in FEniCSX?
My guess is rtol=||\mathbf{R}||_2 and atol=||\mathbf{R}||_2 / ||\mathbf{R}_0||_2, respectively, where \mathbf{R} and \mathbf{R}_0 are the residual vectors at the current and first iterations, respectively. Can anyone tell me whether this is correct? I think it is the same thing in FEniCS.

(2) One related question is what is the definition of solver.convergence_criterion = "incremental" in Hyperelasticity — FEniCSx tutorial (jorgensd.github.io)?

(3) In addition, is there a way to reset the value of ||\mathbf{R}||_2 to the infinity (the same value at the first iteration as shown in the following figure)? Since sometimes we want to run the same FEM subroutine several times and the value of ||\mathbf{R}||_2 needs to be reset.

(4) Is there a way to output the convergence histories in only one process? I try to use the command dolfinx.log.set_log_level(dolfinx.log.LogLevel.INFO) to output the convergence histories. But it might become very messy if we run the code in parallel.

Thanks in advance!

I would suggest that you have a look at the source code: dolfinx/NewtonSolver.cpp at main · FEniCS/dolfinx · GitHub
as it can guide you on how to build a custom Newton solver in Python, where you can customize the behavior.

As most of the functions in the solver is set from python functions, you can use them in a custom solver as well.

As to logging in parallel, you could use a command such as: dolfinx_mpc/utils.py at master · jorgensd/dolfinx_mpc · GitHub
to only output the residual or one rank, or you could store the residual as part of your custom solver.

1 Like