What is the best method for interpolating a 3d array as an equation for heat generation source over a mesh?

See for instance: How to impose a pressure distribution from a data file as a boundary condition (loading)? - #5 by dokken

You can tabulate the dof coordinates of your space, and figure out what position in the 3D data-set each entry has.