Note that
Is a ufl-expression
. To map a UFL expression to a function space, you need to use interpolate.
Specifically, you need to use the u2expr=dolfinx.fem.Expression(u2, W.element.interpolation_points())
and
u3 = Function(W)
u3.interpolate(u2expr)
.
Is there a specific reason for trying to avoid interpolation?
And what is the actual matrix you want to use?