On Jun 27, 2014, at 11:22 PM, Qin Lu <[email protected]> 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

Reply via email to