How to calculate grid function value at arbitrary points

Hi all,

I see bempp.api.GridFunction.evaluate_on_element_centers() and bempp.api.GridFunction.evaluate_on_vertices() functions that evaluate the grid function value at the grid element centers and at the grid vertices.

I’m wondering if it’s possible to compute the value of the grid function at arbitrary points on a surface in bempp? If not in bempp-cl, maybe this feature is available in bem++ 3.3.4?

Best regards,
Vladimir

Hello,

You can evaluate at an arbitrary points on cells using the following code:

import bempp.api

function = bempp.api.GridFunction(....)

values = function.evaluate(3, np.array([[0.1, 0.3, 0.5], [0.2, 0.1, 0.5]]))

This will evaluate the function at the local coordinates (0.1, 0.2), (0.3, 0.1), and (0.5,0.5) in cell 3.

(Using this evaluate function can be a little bit fiddly, as you have to provide the local 2D coordinates in the cell you are evaluating in, as Bempp cannot evaluate a function at an arbitrary point in 3D as the grid function is only defined on the 2D boundary surface.)

1 Like