My function works the same of the following:
but here the FunctionSpaces come from two different meshes.
Suppose that we want to interpolate a function from V_0 to V_1. It results:
\mathbf{I} = f(V_1, V_0)
Now, suppose that we have the following situation:
V_0 = FunctionSpace(mesh_0,("CG",deg_0))
V_1 = FunctionSpace(mesh_1,("CG",deg_1))
p_0 = Function(V_0)
...
p_0 = SomeComputations()
we define a new function on V_1:
p_1 = Function(V_1)
If we wanted to interpolate the function, we could use the command:
p_1.interpolate(p_0)
But now we have an alternative. We can indeed compute the interpolation matrix and compute the p_1
array from a matrix multiplication between I_matrix
and the p_0
array:
I_matrix = interpolation_matrix_nonmatching_meshes(V_1,V_0)
p_1.x.array[:] = np.matmul(I_matrix,p_0.x.array)
getting the same result.
The purpose of such matrix is to try building a monolithic coupled vibro-acoustic system where the domains meshes at the interface don’t match.
Maybe someone else finds this useful.
Bye guys, I need a beer now.
Antonio