I have a mixed variational problem with a non-trivial null-space (think of the Stokes problem with velocity boundary conditions), which I would like to solve using a direct solver. The degrees of freedom involved in the null-space vector are coming from the DG0 and RT1 elements. In order to remove the null-space I would like to simply constrain one DOF of a DG0 space, which seems to be quite difficult to "catch" using the standard tools. Does anyone know an easy way to do this (which also works with decomposed meshes in MPI environment)?
Here is a simplified example of the issue:
from __future__ import print_function
from dolfin import *
comm = mpi_comm_world()
mpiRank = MPI.rank(comm)
parameters["ghost_mode"] = "shared_facet"
mesh = UnitSquareMesh(10,10)
DG0_Element = FiniteElement('DG',mesh.ufl_cell(),0)
V = FunctionSpace(mesh,DG0_Element)
u = TrialFunction(V)
v = TestFunction(V)
# just an example
a = inner(jump(u),jump(v))*dS
L = Constant(1.0)*v*dx
# Question: how to construct a boundary condition in order to remove
# the non-trivial null-space from the problem?
bcs = []
A,b = assemble_system(a,L,bcs)
null_space = project(Constant(1.0),V)
# test the null-space
tmp = Function(V)
A.mult(null_space.vector(),tmp.vector())
tmp_norm = norm(tmp.vector(),'l2')
if mpiRank==0:
print('norm = %e' % tmp_norm)