Convergence of Stokes with data from velocity of Navier-Stokes

Hi,
Please format your code properly by encapsulating it with ```, and make sure it is executable by others by copy-paste. Also remove all lines of code not required for the question, as specified in: Read before posting: How do I get my question answered? (This includes unnecessary imports, lines that are deactivated by commenting etc.)

To set the pressure average to zero you can also just solve without a Lagrange multipler, and subtract the average (as you are computing as q_avg) after solving.

Another way of enforcing a pressure condition is to apply a pointwise Dirichlet boundary condition of the pressure, where you apply the exact pressure solution at one point. See for instance: Pointsource on specific points python.