Hi Sindre,
your issue is related to topic Autoupdate for GridFunctions
To use your Gridfunction on a refined mesh you have to add the auoupdate flag in the FESpace and GridFunction and, if you do not have the latest version of NGSolve, the nested flag for the Gridfunction
V = ng.H1(mesh, order=3, dirichlet="left|right|top", autoupdate=True)
T = ng.GridFunction(V, autoupdate=True, nested=True)
Best,
Michael