[petsc-users] Fw: left and right preconditioning with a constant null space

Matthew Knepley knepley at gmail.com
Tue Mar 28 08:27:59 CDT 2017


On Tue, Mar 28, 2017 at 8:19 AM, Klaij, Christiaan <C.Klaij at marin.nl> wrote:

> Barry,
>
> That seems by far the best way to proceed! As a user I'm
> responsible for the velocity-pressure matrix and its null space,
> all the rest is up to PCFieldSplit. But unfortunately it doesn't
> work:
>
> I've constructed the null space [u,p]=[0,1], attached it to the
> velocity-pressure matrix and verified it by MatNullSpaceTest. I'm
> making sure the rhs is consistent with "MatNullSpaceRemove".
>
> However, the null space doesn't seem to propagate to the Schur
> complement, which therefore doesn't converge, see
> attachment "out1".
>
> When I attach the constant null space directly to A11, it does
> reach the Schur complement and I do get convergence, see
> attachment "out2".
>

So you attach a null space vector to the large matrix, and have a
consistent rhs?
This is not quite what we want. If you

  a) Had a consistent rhs and attached the constant nullspace vector to the
pressure IS, then things will work

  b) Had a consistent rhs and attached the constant nullspace vector to the
"field" object from a DM, it should work

  c) Attached the global nullspace vector to A^T and the constant nullspace
to the pressure IS, it should work

We can't really pull apart the global null vector because there is no
guarantee that its the nullspace of the submatrix.

  Thanks,

     Matt


> Chris
>
> ________________________________________
> From: Barry Smith <bsmith at mcs.anl.gov>
> Sent: Monday, March 27, 2017 6:35 PM
> To: Klaij, Christiaan
> Cc: Lawrence Mitchell; Matthew Knepley; petsc-users at mcs.anl.gov
> Subject: Re: [petsc-users] left and right preconditioning with a constant
> null space
>
> > On Mar 27, 2017, at 2:23 AM, Klaij, Christiaan <C.Klaij at marin.nl> wrote:
> >
> > Barry,
> >
> > I removed the null space from the rhs in the debug program that I
> > wrote to just solve Sp x = b once. In this debug program I've
> > constructed Sp myself after reading in the four blocks from the
> > real program. So this is independent of PCFieldSplit. Indeed I
> > also see bad convergence when using pc_type svd for this debug
> > program unless I remove the null space from the rhs.
> >
> > So far I haven't managed to translate any of this to the real
> > program.
> >
> > - Setting the null space for Sp in the real program seems to work
> >  by happy accident, but Lawrence gave me the hint to
> >  use "PetscObjectCompose" to set the nullspace using is1.
> >
> > - I still have to understand Lawrence's hint and Matt's comment
> >  about MatSetTransposeNullSpace.
> >
> > - I'm not sure how to remove the null space from the rhs vector
> >  in the real pogram, since I have one rhs vector with both
> >  velocity and pressure and the null space only refers to the
> >  pressure part. Any hints?
> >
> > - Or should I set the null space for the velocity-pressure matrix
> >  itself, instead of the Schur complement?
>
>    I would first check if the entire full velocity-pressure right hand
> side is consistent. If it is not you can make it consistent by removing the
> transpose null space. You can use MatCreateNullSpace() to create the null
> space by passing in a vector that is constant on all the pressure variables
> and 0 on the velocity variables.
>
>    Barry
>
> >
> > - Besides this, I'm also wondering why the rhs would be
> >  inconsistent in the first place, it's hard to understand from
> >  the discretization.
> >
> > Thanks for your reply,
> > Chris
> >
> >
> >
> > dr. ir. Christiaan Klaij  | Senior Researcher | Research & Development
> > MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl |
> http://www.marin.nl
> >
> > MARIN news: http://www.marin.nl/web/News/News-items/Comfort-and-Safety-
> at-Sea-March-29-Rotterdam.htm
> >
> > ________________________________________
> > From: Barry Smith <bsmith at mcs.anl.gov>
> > Sent: Saturday, March 25, 2017 1:29 AM
> > To: Klaij, Christiaan
> > Cc: Lawrence Mitchell; Matthew Knepley; petsc-users at mcs.anl.gov
> > Subject: Re: [petsc-users] left and right preconditioning with a
> constant null space
> >
> >> On Mar 24, 2017, at 10:11 AM, Klaij, Christiaan <C.Klaij at marin.nl>
> wrote:
> >>
> >> I've written a small PETSc program that loads the four blocks,
> >> constructs Sp, attaches the null space and solves with a random
> >> rhs vector.
> >>
> >> This small program replicates the same behaviour as the real
> >> code: convergence in the preconditioned norm, stagnation in the
> >> unpreconditioned norm.
> >>
> >> But when I add a call to remove the null space from the rhs
> >> vector ("MatNullSpaceRemove"),
> >
> >   Are you removing the null space from the original full right hand side
> or inside the solver for the Schur complement problem?
> >
> >   Note that if instead of using PCFIELDSPLIT you use some other simpler
> PC you should also see bad convergence, do you? Even if you use -pc_type
> svd you should see bad convergence?
> >
> >
> >
> >> I do get convergence in both
> >> norms! Clearly, the real code must somehow produce an
> >> inconsistent rhs vector. So the problem is indeed somewhere else
> >> and not in PCFieldSplit.
> >>
> >> Chris
> >>
> >>
> >>
> >> dr. ir. Christiaan Klaij  | Senior Researcher | Research & Development
> >> MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl |
> http://www.marin.nl
> >>
> >> MARIN news: http://www.marin.nl/web/News/News-items/Meet-us-again-at-
> the-OTC-2017.htm
> >>
> >> ________________________________________
> >> From: Klaij, Christiaan
> >> Sent: Friday, March 24, 2017 1:34 PM
> >> To: Lawrence Mitchell; Matthew Knepley
> >> Cc: petsc-users at mcs.anl.gov
> >> Subject: Re: [petsc-users] left and right preconditioning with a
> constant null space
> >>
> >> I've also loaded the four blocks into matlab, computed
> >>
> >> Sp = A11 - A10 inv(diag(A00)) A01
> >>
> >> and confirmed that Sp has indeed a constant null space.
> >>
> >> Chris
> >> ________________________________________
> >> From: Klaij, Christiaan
> >> Sent: Friday, March 24, 2017 9:05 AM
> >> To: Lawrence Mitchell; Matthew Knepley
> >> Cc: petsc-users at mcs.anl.gov
> >> Subject: Re: [petsc-users] left and right preconditioning with a
> constant null space
> >>
> >> Lawrence,
> >>
> >> I think you mean "-fieldsplit_1_mat_null_space_test"? This
> >> doesn't return any info, should it? Anyway, I've added a "call
> >> MatNullSpaceTest" to the code which returns "true" for the null
> >> space of A11.
> >>
> >> I also tried to run with "-fieldsplit_1_ksp_constant_null_space"
> >> so that the null space is only attached to S (and not to
> >> A11). Unfortunately, the behaviour is still the same: convergence
> >> in the preconditioned norm only.
> >>
> >> Chris
> >> ________________________________________
> >> From: Lawrence Mitchell <lawrence.mitchell at imperial.ac.uk>
> >> Sent: Thursday, March 23, 2017 4:52 PM
> >> To: Klaij, Christiaan; Matthew Knepley
> >> Cc: petsc-users at mcs.anl.gov
> >> Subject: Re: [petsc-users] left and right preconditioning with a
> constant null space
> >>
> >> On 23/03/17 15:37, Klaij, Christiaan wrote:
> >>> Yes, that's clearer, thanks! I do have is0 and is1 so I can try
> >>> PetscObjectCompose and let you know.
> >>>
> >>> Note though that the viewer reports that both S and A11 have a
> >>> null space attached... My matrix is a matnest and I've attached a
> >>> null space to A11, so the latter works as expected. But is the viewer
> >>> wrong for S?
> >>
> >> No, I think this is a consequence of using a matnest and attaching a
> >> nullspace to A11.  In that case you sort of "can" set a nullspace on
> >> the submatrix returned in MatCreateSubMatrix(Amat, is1, is1), because
> >> you just get a reference.  But if you switched to AIJ then you would
> >> no longer get this.
> >>
> >> So it happens that the nullspace you set on A11 /is/ transferred over
> >> to S, but this is luck, rather than design.
> >>
> >> So maybe there is something else wrong.  Perhaps you can run with
> >> -fieldsplit_1_ksp_test_null_space to check the nullspace matches
> >> correctly?
> >>
> >> Lawrence
> >>
> >
>
>


-- 
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/20170328/a10b6757/attachment.html>


More information about the petsc-users mailing list