Hello nate,
thank you for the examples. I am now able to use interpolation on a simple finite element function space. However, when I try to use the same concept on a mixed element function space, I get the following error: “Cannot get interpolation points - no Basix element available. Maybe this is a mixed element?” Here is the corresponding MWE.
from ufl import SpatialCoordinate, FiniteElement, MixedElement
from dolfinx import mesh
from dolfinx.fem import FunctionSpace, Function
from mpi4py import MPI
import numpy
def y_init(x):
values = numpy.zeros((2, x.shape[1]))
values[0] = 1.0
values[1] = 2.0
return values
msh = mesh.create_interval(MPI.COMM_WORLD, 10, points=(0, 1))
x = SpatialCoordinate(msh)
CG1_elem = FiniteElement("CG", msh.ufl_cell(), 1)
ME_elem = MixedElement([CG1_elem, CG1_elem])
ME = FunctionSpace(msh, ME_elem)
y = Function(ME)
y.interpolate(y_init)
Thank you for your help.