This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

null space for preconditioner for Krylov solver

0 votes

I am solving linear elasticity problem with periodic boundary conditions. To have a unique solution I created a null vector and attached to PETSc matrix. Do I need also to create the null space related to the rigid body motion and to relate it to the preconditioner for Krylov solver for a better convergence?
Thanks a lot for the help.

asked Mar 10, 2016 by mptashnyk FEniCS Novice (300 points)
edited Mar 10, 2016 by mptashnyk

Hi, yes, you need to attach the entire nullspace (rigid motions + your constraint) to the system matrix/linear operator. Try modifying this demo.

Hi, thanks a lot for the answer. Do I need to update my dolfin to have PETSc Matrix attributed with set_near_nullspace or is it possible to make some changes in my current dolfin files? When trying the demo I am getting an error that PETSc Matrix is not attributed with set_near_nullspace.
Thanks a lot, Mariya.

Hi, PETScMatrix.set_near_nullspace is a very recent feature. If you do not want to update to the development version of DOLFIN the modification required to make the demo work is to attach the nullspace to the preconditioner, see here. So you had the wording right in your original post :)

Hi, thanks a lot for your answer. I will try it. I have just two more questions, if I am allowed :-).
I have elasticity equations with periodic BC, thus the three vectors from the basis of the null space for rigid motions I have to attach to the matrix in order to have a unique solution. Then do I need to attach to the preconditioner the whole null space or only the reminding basis vectors?
Also do I need to add some PETScOptions.set if I am using multigid petsc_amg preconditioner and gmres solver (cg solver does not converge even my problem is symmetric).
Thank you very much for the help.

1 Answer

+2 votes

Your need to:

  1. Attach the null space if it's not empty, and make sure your RHS is consistent.
  2. Attach the near nullspace if you're using smoothed aggregation AMG. For elasticity in 3D, the near nullspace contains the 6 rigid body modes.

You might have some trouble solver a singular problem with AMG on the coarse level.

Best to use the dev version for your problem.

answered Mar 18, 2016 by Garth N. Wells FEniCS Expert (35,930 points)
...