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

Interpolate a function defined at discrete points not located on mesh vertices.

+1 vote

Say I have a discrete function $f(x,y)$ defined at set of $N$ coordinates $(x_p, y_p)$ that do not correspond with mesh vertices. I would like to interpolate the data onto the function space $V_h$ such that $f_h \approx f$ where $f_h \in V_h$. In other words, perform the operation
$$f_h = \sum_{i=1}^n f(x_p, y_p) \phi_i(x_p, y_p),$$
where $\phi_i$ is the P1 Lagrange finite-element basis function defined for $i =1,2,\ldots,n$ nodal points..

It seems like the FEniCS machinery could already be in place for this... For example, the basis functions can be evaluated at a given point using element.evaluate_basis().

asked Apr 8, 2017 by pf4d FEniCS User (2,970 points)
edited Apr 10, 2017 by pf4d

Hi, just to be clear you want $f_h \in V_h$ such that $f_h(x_p, y_p)=f(x_p, y_p)$ where the points are in general differ from the nodal points of the space. Correct?

$f_h \approx f$ because the point data are interpolated.

...