Hi everyone,

How can I interpolate a `ufl.as_tensor`

object onto a finite element space? For example, in the code below, I calculate the curl of a tensor field and return it as an `as_tensor`

, which I would then like to interpolate to a `TensorFunctionSpace`

.

```
import dolfin as dlf
import ufl
import numpy as np
# Levi-Civita permutation tensor
perm = ufl.PermutationSymbol(3)
def tcurl(A):
i, j, k, l = ufl.indices(4)
return ufl.as_tensor(A[i, l].dx(k) * perm[j, k, l], (i,j,))
mesh = dlf.BoxMesh(
dlf.Point(0., 0., 0.),
dlf.Point(2., 2., 2.),
20,
20,
1
)
V = dlf.TensorFunctionSpace(mesh, "CG", 1)
u = dlf.Function(V, name="u")
curl_u = dlf.Function(V, name="curl of u")
u_exp = dlf.Expression("pow(x[0],2) + pow(x[1],2)*x[0] + sin(x[0])", degree=1)
u_init = dlf.Expression(
[
['u11', '0', '0'],
['0', '0', '0'],
['0', '0', '0']
],
u11=u_exp,
degree=1
)
u.assign(dlf.project(u_init, V))
# Interpolate the ufl.as_tensor (doesn't work)
curl_u.assign(dlf.interpolate(tcurl(u), V))
with dlf.XDMFFile("outfile.xdmf") as outfile:
outfile.parameters["flush_output"] = True
outfile.parameters["functions_share_mesh"] = True
outfile.write(u, 0.)
outfile.write(curl_u, 0.)
```

This throws me the error **‘ComponentTensor’ object has no attribute ‘_cpp_object’**.

Thanks in advance for your help!