Different mesh interpolation TypeError

Im trying to interpolate one Function between two different meshes. Basically, what I’m doing is (assuming I already have computed T in )

H = FunctionSpace(mesh,('Lagrange',2))
T_int = Function(H)
T_int.interpolate(T, nmm_interpolation_data=create_nonmatching_meshes_interpolation_data( T._V, H))

However, I get the following error:

TypeError: create_nonmatching_meshes_interpolation_data(): incompatible function arguments. The following argument types are supported:
    1. (Vu: dolfinx::fem::FunctionSpace, Vv: dolfinx::fem::FunctionSpace) -> Tuple[List[int], List[int], List[float], List[int]]
    2. (Vu: dolfinx::fem::FunctionSpace, Vv: dolfinx::fem::FunctionSpace, cells: numpy.ndarray[numpy.int32]) -> Tuple[List[int], List[int], List[float], List[int]]

Invoked with: FunctionSpace(Mesh(VectorElement(Basix element (P, triangle, 1, equispaced, unset, False), 2), 5), Basix element (P, triangle, 2, gll_warped, unset, False)), FunctionSpace(Mesh(VectorElement(Basix element (P, triangle, 1, equispaced, unset, False), 2), 6), Basix element (P, triangle, 2, gll_warped, unset, False))

I am using dolfinx 0.6.0, thank you very much

EDIT: if I chage the order of the funcion spaces, i.e. if I call

create_nonmatching_meshes_interpolation_data( H, T._V)

I get exactly the same error

See for instance the test: dolfinx/test_function.py at 8d55f950ca427228a96e96d43893b52b5071bf35 · FEniCS/dolfinx · GitHub

1 Like

Is there a trick to using create_nonmatching_meshes_interpolation_data? I attempt a simplefrom dolfinx.fem import create_nonmatching_meshes_interpolation_data and get the following error:

ImportError                               Traceback (most recent call last)
Cell In[7], line 1
----> 1 from dolfinx.fem import create_nonmatching_meshes_interpolation_data

ImportError: cannot import name 'create_nonmatching_meshes_interpolation_data' from 'dolfinx.fem' (/usr/local/anaconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/fem/__init__.py)

What version of DOLFINx do you have installed ?

conda version 0.6.0. I’m in the process of updating because I saw here that was an update 11 days ago. Hopefully that’s the problem.

EDIT. Updating didn’t help

This functionality was added after the 0.6.0 release.

The 0.6.0 release supports interpolation between meshes, but does not offer the Pre-compute interpolation data step.

1 Like