This is because you have consistently written the wrong expression in your code:
It should be 1/beta2-1/beta1.
You have done this consistently throughout your code.
As a side note, I would not use eval_cell in an Expression when the function is not discontinuous.
class u_exact(Expression):
def __init__(self, subdom, **kwargs):
self.subdom = subdom
def eval(self, values, x):
if sqrt(pow(x[0],2) + pow(x[1],2)) > r0:
values[0] = pow(sqrt(pow(x[0],2) + pow(x[1],2)),alfa)/beta1 + (1/beta2 - 1/beta1)*pow(r0,alfa)
else:
values[0] = pow(sqrt(pow(x[0],2) + pow(x[1],2)),alfa)/beta2
If you look at the exact solution produced by your original interpolation (the “u_e.pvd” file) you see that is does not look quite right.