[petsc-users] Combining preconditioners

Barry Smith bsmith at mcs.anl.gov
Sat Jun 28 19:07:50 CDT 2014


  Ok, I see what you are getting at: 

  It is part of your PCShell’s responsibility to get any subset of the variables you are applying your “preconditioner" (restriction) to and then prolongation after the application your “preconditioner”.   You can use the PCGALERKIN if want to handle the “restriction” and “prolongation” for you. Hence you would still use PCCOMPOSITE but the first PC inside it would be a PCGALERKIN (the second ILU) then inside the PCGALERKIN would be whatever your “smaller” preconditioner is.

   Barry





On Jun 28, 2014, at 6:32 PM, Qin Lu <lu_qin_2000 at yahoo.com> wrote:

> I am not sure if I understand you correctly. See page 83 of PETSc manual (revision 3.4). B1 and B2 are two preconditioner matrices. The full residual is updated after application of the first preconditioner:
> 
> y = B1x
> w1 = x - Ay
> 
> In my case, say A is 200 by 200, but B1 is 100 by 100, so y is 1 by 100. It seems to me we need a prolongation matrix P to make Ay possible, that is, w1 = x - APy. If this is the case, how can I pass P to PETSc?
> 
> Thanks,
> Qin
> 
> From: Barry Smith <bsmith at mcs.anl.gov>
> To: Qin Lu <lu_qin_2000 at yahoo.com> 
> Cc: petsc-users <petsc-users at mcs.anl.gov> 
> Sent: Saturday, June 28, 2014 2:44 PM
> Subject: Re: [petsc-users] Combining preconditioners
> 
> 
>   With composite it updates the entire residual. Yes, a portion of the computations just make a zero update but as I said before part of a matrix vector product is generally much cheaper than a full preconditioner.
> 
>   The field split preconditioner has code to update just portions of the residual, but don’t use it until you see that your preconditioner has very good convergence properties.
> 
>   Barry
> 
> 
> 
> On Jun 28, 2014, at 2:13 PM, Qin Lu <lu_qin_2000 at yahoo.com> wrote:
> 
> > About 1, I don't get it. How does PETSc know what unknowns the first preconditioner solves? i.e., how does PETSc know the first preconditioner solves the unknowns with odd index rather than with even index? This info is necessary for updating the full residual, probably through a restriction (mapping) matrix/vector?
> > 
> > Thanks,
> > Qin
> > 
> > From: Barry Smith <bsmith at mcs.anl.gov>
> > To: Qin Lu <lu_qin_2000 at yahoo.com> 
> > Cc: petsc-users <petsc-users at mcs.anl.gov> 
> > Sent: Saturday, June 28, 2014 12:53 PM
> > Subject: Re: [petsc-users] Combining preconditioners
> > 
> > 
> > On Jun 28, 2014, at 12:43 PM, Qin Lu <lu_qin_2000 at yahoo.com> wrote:
> > 
> > > 1. About using PCCOMPOSITE: I didn't state correctly in my first email. Actually, the rank of first preconditioner matrix is, say, half of the rank of the full matrix (the latter is used as the second preconditioner matrix), and the first preconditioner solves half of the unknowns (say, unknowns with odd index), how can I let PETSc know this info, so that the solution of the first preconditioner can be applied to the full matrix and update the full residual before applying the second preconditioner?
> > > 
> > > In other words, does PCCOMPOSITE require that the ranks of all preconditioner matrices be the same as the full matrix?
> > 
> >  No. You don’t have to tell it anything special. 
> > > 
> > > 2. If I use PCFIELDSPLIT, does it also need PCCOMPOSITE to define multiple preconditioners?
> > 
> >  No field split is a different way of handling multiple preconditioners
> > 
> >  Barry
> > 
> > 
> > 
> > 
> > > 
> > > Thanks  a lot,
> > > Qin
> > > 
> > > From: Barry Smith <bsmith at mcs.anl.gov>
> > > To: Qin Lu <lu_qin_2000 at yahoo.com> 
> > > Cc: petsc-users <petsc-users at mcs.anl.gov> 
> > > Sent: Friday, June 27, 2014 11:41 PM
> > > Subject: Re: [petsc-users] Combining preconditioners
> > > 
> > > 
> > > On Jun 27, 2014, at 11:22 PM, Qin Lu <lu_qin_2000 at yahoo.com> wrote:
> > > 
> > > > Hello,
> > > > 
> > > > I would like to combine two preconditioners in PETSc linear solver. The first preconditioner is user defined, the second one is just PETSc ILU, and the residual is updated after application of each preconditioner (the multiplicative form). There are two questions:
> > > > 
> > > > 1. Shall I use PCShellSetApply to set the user defined preconditioner, and then use PCCompositeAddPC to combine the 2 preconditioners?
> > > 
> > >  Yes
> > > 
> > > > 2. The user defined preconditioner only applies to part of the components of the unknowns, in other words, the rank of the first preconditioner matrix is less than the rank of the full matrix. How can I let PETSc know how to update the residual after the application of the first preconditioner? Can I define a routine of residual updating for PETSc?
> > > 
> > >  At first just use PCCOMPOSITE and let PETSc compute the residual by doing the usual complete matrix-vector product. Usually the cost of the matrix vector product is much less then a preconditioner so it is not worth optimizing.
> > > 
> > >  If the composed preconditioner works very well and the shell PC affects only a small percentage of the components of the problem then you can switch to PCFIELDSPLIT which does support only updating a portion of the residual.
> > > 
> > >  Barry
> > > 
> > > 
> > > > 
> > > > Many thanks for your help.
> > > > 
> > > > Best Regards,
> > > > Qin
> > > 
> > > 
> > 
> > 
> 
> 



More information about the petsc-users mailing list