I found this repository on GitHub (solve Poisson equation with a finite difference scheme): https://github.com/blackcata/Poisson_Equation/blob/master/Jacobi.c.
At the end of the function, to check for convergence of the method, the author simply computes the ratio between the residue and the value of the equation at the point $(i,j)$. Where does this come from?