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

interpolate data from polygon corners onto edges

+2 votes

On a polygonal domain, I have scalar values given in the polygon corners. I would like to linearly interpolate those onto the polygon edges for use as Dirichlet boundary conditions for, say, the heat equation.

A brute-force approach would be to define an Expression that checks whether an input coordinate x indeed sits on a polygon edge, and return the respective linearly interpolated value. Since I'm planning to solve the heat equation many times though, some way for caching the result would be handy.

How would you do it?

asked Aug 28, 2013 by nschloe FEniCS User (7,120 points)
...