When working in cylindrical coordinates, one often has to deal with removable singularities (e.g. in linear elasticity): for instance, the divergence of a vector field u contains the term u_r/r. Mathematically, this is not an issue since u_r must vanish at r=0.

However, numerically this can be a problem, since the fraction of very small numbers is computed. Is there a canonical way to deal with such terms in fenics?

In the code in this example the singularities are simply ignored. Is this safe to do? Is fenics dealing with this issue automatically?

I am using fenics version 2018.1.0.