Computing singular surface integral with FEniCS

Consider the following integral

I = \int_{\partial\Omega} \frac{e^{0.1(x_1+2x_2+3x_3)}}{|\vec z-\vec x|} \,dL(x), \hspace{3mm}

\vec x = (x_1,x_2,x_3) \in \Omega, \hspace{3mm} \vec z = (z_1,z_2,z_3) \in \partial\Omega

where

\Omega = \left\{(x,y,z) \mid x^2+\left(\frac{y}{2}\right)^2+\left(\frac{z}{3}\right)^2\le 1 \right\}

I’m trying to approximate the singular integral I. Is there anyways to do this in FEniCS?

Consider the following minimal code example:

from dolfin import *

mesh = UnitSquareMesh(10, 10)

x = SpatialCoordinate(mesh)

z = as_vector((0.96, 0))

expr = exp(0.1*(x[0]**2+2*x[1]**2))/sqrt(dot(x-z, x-z))
I = assemble(expr*ds)
print(I)
2 Likes