On Jun 28, 2014, at 12:43 PM, Qin Lu <[email protected]> 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 <[email protected]> > To: Qin Lu <[email protected]> > Cc: petsc-users <[email protected]> > Sent: Friday, June 27, 2014 11:41 PM > Subject: Re: [petsc-users] Combining preconditioners > > > 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 > >
