### Interpolating vs Evaluating an Expression on the Mesh Coordinates

37
views
0
23 days ago by
What is the difference between interpolating and evaluating an expression on a given mesh? My solution is using a mesh function to define three subdomains: [0, 1], [1, 2], and [2, 3], where the points 0, 1, 2, 3 are boundaries. I have an expression defined on [0, 1], and [2, 3] and contains 0's in the middle that when interpolated, eg:
interpolate(j, V).vector().get_local()[vertex_to_dof_map(V)]​

it will output an array taking the form of [..., x, x, nan, 0, ..., 0, x, x, x, ...] but when I evaluate the expression, eg:

numpy.array([j(x) for x in mesh.coordinates()])

it'll output [..., x, x, x, 0, ..., 0, nan, x, x, ...]. It just so happens that these NaNs are showing up on each of the internal boundaries depending on how I evaluate the expression. It seems a bit odd that to get the output I expect that I'd have to first interpolate, then replace the nth value with the evaluated value. I'd appreciate any insight.

Community: FEniCS Project