Simple question about writing to files

Hi all,
I have a simple question about exporting a mesh and corresponding function values. I can write the mesh values to a file using mesh.coordinates() and the function values using u.vector(), but I don’t know how to match the function points with the right coordinates for some post-processing elsewhere. How can I do this? (Yes, this is a very basic question, thanks in advance)

You should either use:
FunctionSpace.tabulate_dof_coordinates() which has a one to one correspondence with

Or you can interpolate the function values into the mesh coordinate space by using
compute_vertex_values() as shown in