I’d like to visualize multiple functions using a single xdmf file
Try
with XDMFFile(MPI.comm_world, 'filename.xdmf') as file:
file.parameters.update(
{
"functions_share_mesh": True,
"rewrite_function_mesh": False
})
file.write(u, 0.)
file.write(rho, 0.)