Interpolation from Submesh (Facet Mesh) to Solid Domain in FEniCSx

Hello,

I am working on a coupled fluid-solid problem in FEniCSx. I have defined a pressure field on a submesh (facet mesh) corresponding to the top boundary of a solid domain. I want to interpolate this pressure field onto the solid domain to use it as a traction force in the linear elastic equation.

However, I encountered the following error during the interpolation:

Traceback (most recent call last):
  File "/home/phavaej/Fenics/test_interpolation_block_coupling/assemple_submesh_test_V3.py", line 31, in <module>
    p_boundary.interpolate(p)
  File "/home/phavaej/anaconda3/envs/fenicsx-env/lib/python3.12/site-packages/dolfinx/fem/function.py", line 459, in interpolate
    _interpolate(u0)
  File "/home/phavaej/anaconda3/envs/fenicsx-env/lib/python3.12/functools.py", line 907, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/phavaej/anaconda3/envs/fenicsx-env/lib/python3.12/site-packages/dolfinx/fem/function.py", line 445, in _
    self._cpp_object.interpolate(u0._cpp_object, cells0, cells1)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Cannot interpolate between elements defined on different cell types.

I also created a Minimal Working Example to reproduce the same error, which is as follows:

import numpy as np
import ufl
from mpi4py import MPI
from dolfinx import mesh, fem

# Parameters
L, W = 1, 1  # Length and width of the domain

# Create solid mesh
domain = mesh.create_rectangle(MPI.COMM_WORLD, [(-L / 2, -W), (L / 2, 0)], [10, 10], mesh.CellType.triangle)

# Locate the top boundary of the solid domain
def top_boundary(x):
    return np.isclose(x[1], 0)  # Boundary at y=0

top_facets = mesh.locate_entities_boundary(domain, domain.topology.dim - 1, top_boundary)

# Create a submesh for the top boundary
submesh, submesh_to_mesh = mesh.create_submesh(domain, domain.topology.dim - 1, top_facets)[:2]

# Define function spaces
VBar = fem.functionspace(submesh, ("Lagrange", 1))  # Fluid pressure on the submesh
V = fem.functionspace(domain, ("Lagrange", 1))  # Scalar field on the solid boundary

# Define and interpolate a sample pressure field on the fluid submesh
p = fem.Function(VBar)
p.interpolate(lambda x: 1e-6 + x[0]**2 / (2 * 0.01))  # Example pressure field

# Interpolate the pressure field onto the solid boundary
p_boundary = fem.Function(V)
p_boundary.interpolate(p)

In the fact, the submesh is a facet of the whole mesh (domain). I already tried different approach such those tested in
test_interpolation.py .
However, I have not succeed in the interpolation.

I am using the latest version of the dolfinx (v 0.90) and Python 3.12.

Any guidance on how to properly interpolate or project data from the submesh to the solid domain would be greatly appreciated.

Thank you very much.

Kind regards,
Peyman