Hi Guosheng,
Changing the freedofs alone does not fix the static condensation. In your script you only make sure that the pressure dofs are appearing in the sparse factorization of the global problem, but haven't told the assembly to keep the pressure dofs in the global system in the first place.
You need to fix the CouplingType of the (lowest order functions of the) pressure space. You can simply do this with
Code:
Q = L2(mesh, order=0, lowest_order_wb=True)
as the L2-space has a flag for this case. Otherwise you can Set the CouplingType of each dof of an FESpace through python manually.
Best,
Christoph