I am looking at demo_singular-poisson.py (#15 from the Documented DOLFIN demos), which solves a Neumann boundary-value problem for the Laplace operator over the unit square. I am writing with two questions:
1) I understand that, once one (builds a mesh on the domain and) specifies a function space $V$, one goes on to consider the finite-dimensional approximation (on $V$) to the exact variational problem. This finite-dimensional approximation is equivalent to a system of linear equations of the form $Ax = b$, where $A$ is a symmetric matrix.
It is stated in demo_singular.py that, for this Neumann boundary-value problem, the matrix $A$ has a non-trivial null space and, furthermore, that this null space is one-dimensional - may I ask why (or under what conditions) that is the case?
2) Can I also ask for an elaboration of what this block of code from demo_singular.py does:
# Create vector that spans the null space
null_vec = Vector(u.vector())
V.dofmap().set(null_vec, 1.0)
null_vec *= 1.0/null_vec.norm("l2")