Interpolating numerical values (2D numpy array) over a mesh

You typically want to search the forum before asking a question. Interpolating a function defined from an array is quite a common question, even though probably the case of a vector field is less common.

The very first search result I found is How to interpolate numpy array into VectorFunctionSpace? : it boils down to creating a LinearNDInterpolator from scipy. I won’t be searching further results for you.

Furthermore, taking the risk of sounding rude, I won’t be reading your code either. That is far from a minimal example: we don’t need to see your linear elasticity problem, which even uses dolfinx_mpc, for your to formulate the question “how can I interpolate a 2D field defined in numpy to a dolfinx Function”? Just take a built in mesh, prepare mock numpy data, and then ask how to interpolate those in a dolfinx Function.