[petsc-users] move from KSPSetNullSpace to MatSetNullSpace

Matthew Knepley knepley at gmail.com
Mon Jun 22 16:55:54 CDT 2015


On Mon, Jun 22, 2015 at 1:13 PM, Stephan Kramer <s.kramer at imperial.ac.uk>
wrote:

> Dear petsc devs
>
> I've been trying to move our code from using KSPSetNullSpace to use
> MatSetNullSpace instead. Although I appreciate the convenience of the
> nullspace being propagated automatically through the solver hierarchy, I'm
> still a little confused on how to deal with the case that mat/=pmat in a
> ksp.
>
> If I read the code correctly I need to call MatSetNullSpace on the pmat in
> order for a ksp to project that nullspace out of the residual during the
> krylov iteration. However the nullspaces of mat and pmat are not
> necessarily the same. For instance, what should I do if the system that I
> want to solve has a nullspace (i.e. the `mat` has a null vector), but the
> preconditioner matrix does not.
>
> As an example of existing setups that we have for which this is the case:
> take a standard Stokes velocity, pressure system - where we want to solve
> for pressure through a Schur complement. Suppose the boundary conditions
> are Dirichlet for velocity on all boundaries, then the pressure equation
> has the standard, constant nullspace. A frequently used preconditioner is
> the "scaled pressure mass matrix" where G^T K^{-1} G is approximated by a
> pressure mass matrix that is scaled by the value of the viscosity. So in
> this case the actual system has a nullspace, but the preconditioner matrix
> does not.
>
> The way we previously used to solve this is by setting the nullspace on
> the ksp of the Schur system, where the mat comes from
> MatCreateSchurComplement and the pmat is the scaled mass matrix. We then
> set the pctype to PCKSP and do not set a nullspace on its associated ksp. I
> don't really see how I can do this using only MatSetNullSpace - unless I
> create a copy of the mass matrix and have one copy with and one copy
> without a nullspace so that I could use the one with the nullspace for the
> pmat of the Schur ksp (and thus the mat of the pcksp) and the copy without
> the nullspace as the pmat for the pcksp.
>
> We would very much appreciate some guidance on what the correct way to
> deal with this kind of situation is
>

I can understand that this is inconsistent (we have not really thought of a
good way to make this consistent). However, does
this produce the wrong results? If A has a null space, won't you get the
same answer by attaching it to P, or am I missing the
import of the above example?

  Thanks,

     Matt


> Cheers
> Stephan
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150622/a9eec63d/attachment.html>


More information about the petsc-users mailing list