Allow arbitrary UFL expressions passed to interpolate
Point integrals can be perfectly used to efficiently evaluate arbitrary UFL expressions on the vertices of a mesh by projection onto a suitable test space, e.g.
# Compute sqrt(f) nodewise
V = FunctionSpace(mesh, "CG", 1)
v = TestFunction(V)
f = Function(V)
sqrt_f = Function(V)
assemble(v*sqrt(f)*dP, sqrt_f.vector())
It would be nice if the point integral was able to handle higher order Lagrange elements in order to support the above feature also on auxiliary nodes.
Comments (7)
-
-
reporter Exactly. A version of
interpolate
that takes an UFL expression as argument would be perfect. The above example is rather simple and could be implemented easily with the NumPy interface. However, I have to deal with cross products of CG vector spaces, so things get pretty complicated. Also I don't want to break the MPI features.What would you propose as a starting point for the implementation of such a feature?
-
Exactly. Generation of code for expressions without abusing the point integral. User interface via interpolate(). Ideally we could handle elements that are not point based as well, and match or surpass the performance of LagrangeInterpolator by avoiding superfluous recomputation of dofs shared between elements.
-
- changed title to Allow arbitrary UFL expressions passed to interpolate
- changed milestone to 1.6
-
Consider in relation to
https://bitbucket.org/fenics-project/ffc/issue/52/evaluate_dofs-for-expressions-is-sub
-
-
- removed milestone
Removing milestone: 1.7 (automated comment)
- Log in to comment
I see what you want, however this proposal breaks abstractions and should rather be implemented another way. Basically you want expression evaluation in all dof points of a function space?