Issue Approaching Solution for Poisson Problem With Singularity

Hi all,

I’m currently writing an AFEM solver for my bachelor thesis so I can compare the effectiveness of a residual based error estimator and a ZZ one. I’ve got it working for a simple Poisson problem u = \sin(\pi x)\sin(\pi y) on an L-shaped domain. Now I’m trying to get it to work on u=u = r^{2/3} \sin(\frac{2}{3}\theta)(1-x^2)(1-y^2).

I’m running into an issue where the real energy error seems to limit to 0.2, not 0. From analysing the error, it seems to be coming from the interior of the domain as well as the singularity (See photos).

For mesh refinement I’m running either estimator over the mesh, and then using Dörfler marking (with tol = 0.5, although changing it seemed to have little effect). I’m using a first order finite element space (so linear on each triangle just in case my terminology is wrong).

I’m at a loss for where this error could be coming from, it’s a very vague question but is anyone able to point me in the right direction? Is there any special considerations I need to make for a solution containing a singularity?

Just in case someone wants to have a look, here is my code:
Solver.ipynb (182.6 KB)