Non linear solver fails to converge. Is there a thumb-rule to avoid this in the future?

Nonlinear convergence difficulties can require some trial-and-error to resolve. The first thing to try is probably a line search strategy. See, e.g., this discussion for some code examples showing how to access PETSc’s line search implementation through FEniCS’s solver API. For unsteady problems, it can also help to decrease the time step size.