Invert DL matrix in single step to compute full surface impedance matrix

Hi, I am exploring the use of BEMPP for computing surface impedance matrices [Z] (an NxN matrix of columns of surface pressures induced by individual velocity sources). This requires inverting the DL operator matrix. All the examples I have seen only solve for a single RHS using GMRES. Doing this for every source point is computationally exorbitant. Does BEMPP have a function to simply invert the DL matrix and output it? Or, can I call GMRES once with multiple RHS (I got an error when I tried it, which isn’t surprising). Or perhaps there are other inversion functions that work with BEMPP. Thanks,

The discrete boundary operators in Bempp are linear operators that implement a matrix-vector multiplication and are compatible with the iterative linear solvers in SciPy. If you want direct access to the matrix and use custom linear solvers or inversion techniques, you can use the function bempp.api.as_matrix(). This function creates a dense matrix in NumPy format.

1 Like

Thanks for the answer. Does bempp still support h-matrix methods or have they been dropped?

I tried the .as_matrix function but get the error: AttributeError: ‘BoundaryOperatorWithAssembler’ has no attribute ‘to-dense’. Here’s how I assemble the operators:

grid = bempp.api.Grid(vertices, elements)
space = bempp.api.function_space(grid,“P”,1) # piecewise linear
Lk = bempp.api.operators.boundary.helmholtz.single_layer(space, space, space, k)
Mk = bempp.api.operators.boundary.helmholtz.double_layer(space, space, space, k)
Lkout = bempp.api.as_matrix(Lk)
Mkout = bempp.api.as_matrix(Mk)

Any suggestions? Thanks again,

-S. Hambric

In your example code, Lk and Mk are continuous operators. You need to assemble the discrete operator first. Try Lkout = bempp.api.as_matrix(Lk.weak_form()) to assemble the weak form. Alternatively, use strong_form() to assemble the strong form.

The legacy bempp v.3 has H-matrix compression but bempp-cl has not. It has an interface to ExaFMM for fast matrix-vector products.