It is not safe to use Expressions
when your division is singular (at x[1]=0). Usage of ufl and projection is safer:
V = FunctionSpace(mesh, "Lagrange", 1)
x = SpatialCoordinate(mesh)
u_D = project(atan(x[0]/x[1]), FunctionSpace(mesh, "Lagrange", 4))