Hello,
I’m fairly new to fenics and I need to evaluate a Function-object on specific points of the mesh. For example, take the non-linear poisson example (code see there). What I would now like to do is to specify the points, at which I want to evaluate the solution, and basically get the values at that point. After reading some other posts I came with the following:
dkiCoordX = np.linspace(0,1, 100)
dkiCoordY = np.linspace(0,1, 100)
# basically the cartesian product of the coordinate vectors, format 10000x2
dkiGrid = np.array(np.meshgrid(dkiCoordX, dkiCoordY)).T.reshape(-1,2)
values1 = np.ones(10000)
values2 = np.ones(10000)
u.eval(values1, dkiGrid.flatten())
u.eval(values2, mesh.coordinates().flatten())
Apparently, this is not what eval() is expecting from me. Though I get no errors, the only thing that happens to the values vectors is that the first entry changes, everything else stays 1. I’ve also tried a lower number (5x5), but it still doesn’t work.
I would be thankful for any hints and, of course, solutions. It doens’t even have to be the eval()-method, I really just need to evaluate the solution at given points.