Importing a 2D mesh from FEniCSx

Dear Bempp users,

I am trying to implement a vibroacoustics FEM-BEM coupled model using FEniCSx and Bempp.
The model is simplified to a box with only one surface vibrates to produce sound into the exterior (the rest is rigid), and I would like to model the box in FEM and the vibrating surface in BEM.
The FEM part is already implemented, but I am struggling to import the surface mesh into Bempp side.

fenicsx.fenics_to_bempp_trace_data would create a function space for the boundary of the mesh given, so I can’t directly give the 2D submesh of the vibrating surface created in FEniCSx.

Meanwhile, even if I give fenicsx.fenics_to_bempp_trace_data the whole cube to create a function space for the all 6 surfaces, I am under the impression that I would not be able to use gmsh Physical tags to selectively choose and access the vibrating surface.

Ideally, I would like to create the trace space specifically for this one vibrating surface without dealing with coordinates to identify which surface is which.

Does anyone have any idea of how I might be able to do this?

Thank you in advance for your time, and I am looking forward to your advice.

Hi,

The function trace_space, trace_matrix = fenicsx.fenics_to_bempp_trace_data(fenics_space) returns the variable trace_space, which is a bempp-cl FunctionSpace. You can access its grid with the attribute trace_space.grid.

Indeed, when extracting a surface mesh from a fenics mesh, the gmsh physical tags are not used, which you can check by accessing trace_space.grid.domain_indices. They are all zero.

For simple structures like cubes, you can find subsets of the grid manually, e.g., finding a face of a cube as face_elements = np.isclose(trace_space.grid.centroids[:,0], 0) to find the face at x=0, up to rounding errors.

With this information, you can overwrite the domain_indices attribute, create a new mesh, or create a new function space as face_space = bempp_cl.api.function_space(trace_space.grid, support_elements=face_elements, kind="DP", degree=0).

I hope these ideas will help you move forward.

Best,
Elwin