Allow arbitrary UFL expressions passed to interpolate

Issue #422 new
Claas Abert created an issue

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)

  1. Martin Sandve Alnæs

    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?

  2. Claas Abert 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?

  3. Martin Sandve Alnæs

    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.

  4. Log in to comment