Hi, I want to construct an “acoustic transfer matrix”, which maps source pressure on the boundary to the field points. Construction of the transfer matrix requires operator inverse on the boundary operator. Yes, I can convert boundary operator into matrix. However, I can’t find a way to convert potential operator into a (strong form) matrix.
Hi Marco,
unfortunately, I cannot answer your question but I have basically the same question for the Laplace single layer or double layer potential operators. In the past, there was a discrete_operator member in the bempp.api.assembly.PotentialOperator class: Operator concepts — The BEM++ Project
But I did not find an equivalent in the current bempp-cl. I am curious about the reasons for not offering a matrix representation of potential operators. If I find a solution, I will post it here.
The bempp-cl library provides functionality to export the boundary integral operators as Numpy matrices (bempp.api.as_matrix()
). However, the potential integral operators can currently not be exported as matrices. They need to be evaluated on a GridFunction
.
A trick that may serve you is to create a GridFunction
with a single dof excited, that is, a GridFunction
with coefficients all set to zero but one index set to one. Applying the potential operator to such a GridFunction will evaluate the field emitted from a single dof.
Here is a minimal working example.
import bempp.api
import numpy as np
grid = bempp.api.shapes.sphere(h=.5)
space = bempp.api.function_space(grid, "P", 1)
my_dofid = 0 # select dof id
my_gridcoef = np.zeros(space.global_dof_count)
my_gridcoef[my_dofid] = 1
my_gridfun = bempp.api.GridFunction(space, coefficients=my_gridcoef)
evaluation_points = np.array([[1.1,2,10],[0,0,0],[0,0,0]])
slp_pot = bempp.api.operators.potential.laplace.single_layer(space, evaluation_points)
field_values = slp_pot.evaluate(my_gridfun)
print(field_values)
You can loop over different dofs, but this may become computationally expensive for large grids.