This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

interpolation of UFL operator in Lagrange function spaces

+1 vote

Dear FEniCS community,

I would like to efficiently carry out repeated interpolations of a UFL operator in a Lagrange function space for a fixed set of points, in python. I would like to avoid projections.

The approach I am currently using is based on a simple adaptation in python of the logic in LagrangeInterpolator [1].
This implementation relies on calling the eval() method of the UFL operator. Even though this works, the resulting code is quite slow and does not exploit the fact that the points set is fixed.

I am aware that performance improvements on Function::eval() can be obtained thanks to fenicstools [2], however the Probe interface only accepts Functions.
I am also aware of a workaround [3] that can be used to greatly improve performance in the case of CG1 spaces, however I would like to be able to also use higher order CG spaces.

Have you ever encountered this problem? Do you have any idea on how to efficiently carry out this task?
Thanks,
Francesco

[1] https://github.com/FEniCS/dolfin/blob/master/dolfin/function/LagrangeInterpolator.cpp, in particular methods at lines 34, 322 and 385
[2] https://github.com/mikaem/fenicstools/tree/master/fenicstools/Probe
[3] https://bitbucket.org/fenics-project/dolfin/issues/422/allow-arbitrary-ufl-expressions-passed-to

asked Mar 21, 2017 by francesco.ballarin FEniCS User (4,070 points)
...