# Calculate the double-layer potential using a function obtained from fenicsx

Hi,

I have computed a flow using fenicsx and would like to utilize Bempp to calculate the BEM component. Although I have reviewed the example, I still find the process unclear.

Basically, I would like to calculate the integral

I = \int_{\partial S} \Phi \frac{\partial}{\partial n} \frac{1}{|r-r'|}dr,

where this integral is evaluated at the boundary of the body and \Phi is a scalar field calculated with fenicsx.

In fenicsx I defined:

mesh = dolfinx.mesh.create_box(MPI.COMM_WORLD, [np.array([0,0,0]), np.array([20, 20, 2])], [10,10,2])
V = functionspace(mesh, (“Lagrange”, 1, (mesh.geometry.dim,)))

problem = fem.petsc.LinearProblem(a, L, petsc_options={“ksp_type”: “preonly”})
PHI = problem.solve()

In Bempp:

trace_space, trace_matrix = fenicsx.fenics_to_bempp_trace_data(V)
bempp_space = bempp.api.function_space(trace_space.grid, “DP”, 0)

dlp = bempp.api.operators.boundary.laplace.double_layer(trace_space, bempp_space,bempp_space)

How should I continue?

thanks.

The integral I you like to evaluate is called the double-layer operator. You need to be careful and distinguish between the double-layer boundary operator and the double-layer potential operator.

If, in your notation, the location r' is outside the surface \partial S and \Phi is a known Dirichlet potential on \partial S, you can use the function bempp.api.operators.potential.laplace.double_layer(). See, for example, the variable dlp_pot in the FEM-BEM tutorial.

If the location r' is really on the surface \partial S, you need to handle the singularity in the Green’s function. This is usually dealt with by singular integration for the weak form of the operator, and provided in the function bempp.api.operators.boundary.laplace.double_layer(). However, this is a matrix with elements that correspond to cross-interactions between dofs on the surface. The variable \Phi is an unknown here and needs to be included in your model. See the variable dlp in the FEM-BEM tutorial, representing the operator K in the system matrix.

I hope this helps you forward.